@everfur/sdk 1.5.2 → 1.5.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{bookingCopy.d-BL2-URcv.d.ts → bookingCopy.d-Bn8bdo89.d.ts} +4 -4
- package/dist/{bookingCopy.d-Dfew1pjY.d.cts → bookingCopy.d-Dg7bPM-U.d.cts} +4 -4
- package/dist/chat/index.cjs +1 -1
- package/dist/chat/index.js +1 -1
- package/dist/chat/lite/index.cjs +1 -1
- package/dist/chat/lite/index.js +1 -1
- package/dist/{chunk-K7YHXFPQ.js → chunk-CFEHTNKX.js} +1 -1
- package/dist/{chunk-2T5CB5MW.js → chunk-OU5RMGKD.js} +8 -8
- package/dist/{chunk-ASE36WGP.js → chunk-XGF2HYNN.js} +14 -14
- package/dist/{chunk-CMDCBYUH.js → chunk-ZGL2GEEI.js} +1 -1
- package/dist/client/index.cjs +1 -1
- package/dist/client/index.d.cts +1 -1
- package/dist/client/index.d.ts +1 -1
- package/dist/client/index.js +1 -1
- package/dist/core/index.cjs +1 -1
- package/dist/core/index.js +1 -1
- package/dist/{idempotency.d-dOFfV91-.d.ts → idempotency.d-CbB07p64.d.ts} +10 -8
- package/dist/{idempotency.d-CFVMhWcv.d.cts → idempotency.d-DrxKLPPe.d.cts} +10 -8
- package/dist/index.cjs +2 -2
- package/dist/index.js +2 -2
- package/dist/{optInView.d-ByDJMrMv.d.cts → optInView.d-ChJyJMBA.d.cts} +4 -1
- package/dist/{optInView.d-DVshLxbD.d.ts → optInView.d-Cps7aLQN.d.ts} +4 -1
- package/dist/records/index.cjs +1 -1
- package/dist/records/index.js +1 -1
- package/dist/server/events/index.cjs +1 -1
- package/dist/server/events/index.js +1 -1
- package/dist/server/index.cjs +1 -1
- package/dist/server/index.js +1 -1
- package/dist/shop/index.cjs +1 -1
- package/dist/shop/index.d.cts +2 -2
- package/dist/shop/index.d.ts +2 -2
- package/dist/shop/index.js +1 -1
- package/dist/televet/booking/index.cjs +156 -156
- package/dist/televet/booking/index.d.cts +2 -2
- package/dist/televet/booking/index.d.ts +2 -2
- package/dist/televet/booking/index.js +156 -156
- package/dist/texting/index.cjs +8 -8
- package/dist/texting/index.d.cts +2 -2
- package/dist/texting/index.d.ts +2 -2
- package/dist/texting/index.js +8 -8
- package/dist/web/health-plan/index.cjs +1 -1
- package/dist/web/health-plan/index.js +1 -1
- package/dist/web/index.cjs +3 -3
- package/dist/web/index.js +3 -3
- package/dist/web/records-sheet/index.cjs +1 -1
- package/dist/web/records-sheet/index.js +1 -1
- package/dist/web/shop/index.cjs +2 -2
- package/dist/web/shop/index.d.cts +2 -2
- package/dist/web/shop/index.d.ts +2 -2
- package/dist/web/shop/index.js +3 -3
- package/dist/web/televet/booking/index.cjs +185 -185
- package/dist/web/televet/booking/index.d.cts +2 -2
- package/dist/web/televet/booking/index.d.ts +2 -2
- package/dist/web/televet/booking/index.js +185 -185
- package/dist/web/televet/call/index.cjs +1 -1
- package/dist/web/televet/call/index.js +1 -1
- package/dist/web/texting/index.cjs +3 -4
- package/dist/web/texting/index.d.cts +2 -2
- package/dist/web/texting/index.d.ts +2 -2
- package/dist/web/texting/index.js +3 -4
- package/dist/web/ui/index.cjs +1 -1
- package/dist/web/ui/index.js +33 -33
- package/package.json +1 -1
|
@@ -1,15 +1,15 @@
|
|
|
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
2
|
import{createContext,forwardRef as e,createElement as t,useMemo as n,useState as r,useRef as l,useEffect as i,useCallback as o,useReducer as a,useContext as s,useSyncExternalStore as d,Component as c}from"react";import*as u from"react-native";import{TextInput as p,StyleSheet as h,View as f,Pressable as m,Linking as g,Animated as y,Alert as b,BackHandler as v,Image as T,ActivityIndicator as k,ScrollView as w,Platform as C,KeyboardAvoidingView as S,Modal as _,StatusBar as x,Text as I,Dimensions as D,useWindowDimensions as P}from"react-native";import{z as R}from"zod";import{jsx as E,jsxs as z,Fragment as F}from"react/jsx-runtime";import*as L from"@everfur/sdk/televet/call";import{useSafeAreaInsets as A}from"react-native-safe-area-context";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 j=["scheduled","in_progress","awaiting_summary","completed","cancelled_owner","cancelled_ops","no_show_owner","no_show_vet"],O=/* @__PURE__ */new Set(["completed","cancelled_owner","cancelled_ops","no_show_owner","no_show_vet"]),N=/* @__PURE__ */new Set(["scheduled","in_progress","awaiting_summary"]);function B(e){return N.has(e.status)}var
|
|
4
|
-
return Object.freeze(n)}function X(e,t){let n=U(e);return n===null?null:/* @__PURE__ */Object.freeze({state:K(n.state)??t,wellnessAvailable:G(n.wellness_available,false),prescriptionsAvailable:G(n.prescriptions_available,false),cancellationPolicyText:Y(n.cancellation_policy_text)})}function ee(e){let t=U(e);if(t===null)return null;let n=Y(t.summary),r=Y(t.version);return n===null||r===null?null:/* @__PURE__ */Object.freeze({summary:n,version:r})}function te(e){let t=U(e);if(t===null)return null;let n=K(t.clinician_id),r=K(t.display_name);return n===null||r===null?null:/* @__PURE__ */Object.freeze({clinicianId:n,displayName:r,credentials:Y(t.credentials_text),rating:J(t.rating),ratingCount:J(t.rating_count),bio:Y(t.bio),photoRef:K(t.photo_ref),licensedStates:Z(t.licensed_states,e=>{let t=U(e),n=t===null?null:K(t.state);return n===null?null:/* @__PURE__ */Object.freeze({state:n,canPrescribe:G(t?.can_prescribe,false)})}),role:ne(t.clinician_role)})}function ne(e){let t=K(e)?.trim().toLowerCase();return t==="vet"||t==="vet_tech"?t:null}function re(e){let t=U(e);if(t===null)return null;let n=K(t.slot_id),r=K(t.starts_at);return n===null||r===null?null:/* @__PURE__ */Object.freeze({slotId:n,startsAt:r,endsAt:K(t.ends_at)??r})}function le(e){let t=U(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 ie(e){let t=U(e);if(t===null)return null;let n=K(t.slot_id),r=K(t.hold_expires_at);return n===null||r===null?null:/* @__PURE__ */Object.freeze({slotId:n,expiresAt:r})}function oe(e){let t=U(e);if(t===null)return null;let n=K(t.consult_id),r=K(t.scheduled_at);return n===null||r===null?null:/* @__PURE__ */Object.freeze({consultId:n,petId:K(t.pet_id)??"",clinicianId:K(t.clinician_id)??"",clinicianName:Y(t.display_name),reasonText:Y(t.reason_text),mediaRefs:Z(t.media_refs,e=>K(e)),status:Q(j,t.status),kind:Q(
|
|
5
|
-
return Object.freeze({active:G(t?.active,false)})}var se=240;function de(e){let t=U(e);if(t===null)return null;let n=J(t.fee_cents);return n===null||n<0?null:/* @__PURE__ */Object.freeze({feeCents:n,currency:K(t.currency)??"usd",feeRecorded:G(t.fee_recorded,n>0),summary:Y(t.summary)})}var ce=15,ue=250,pe=/* @__PURE__ */new Set(["scheduled","in_progress"]);function he(e){let t=Date.parse(e.scheduledAt);return Number.isNaN(t)?null:t}function televetJoinOpensAtMs(e){let t=he(e);return t===null?null:t-ce*6e4}function televetJoinReadiness(e,t){if(e===null)return{ready:false,reason:"not_open_yet"};if(O.has(e.status))return{ready:false,reason:"consult_over"};if(e.status==="in_progress")return{ready:true};let n=he(e);return n===null?{ready:false,reason:"not_open_yet"}:t<n-ce*6e4?{ready:false,reason:"not_open_yet"}:t>n+ue*6e4?{ready:false,reason:"consult_over"}:{ready:true}}function televetJoinDecision(e,t){if(!pe.has(e.status))return{joinable:false,reason:`status_${e.status}`};if(!e.hasRoom)return{joinable:false,reason:"room_not_ready"};let n=he(e);return n===null||t<n-ce*6e4?{joinable:false,reason:"too_early"}:t>n+ue*6e4?{joinable:false,reason:"too_late"}:{joinable:true}}function splitTelevetVisits(e,t){let n=[],r=[];for(let l of e){let e=he(l);(pe.has(l.status)&&e!==null&&e+ue*6e4>t?n:r).push(l)}return n.sort((e,t)=>(he(e)??0)-(he(t)??0)),r.sort((e,t)=>(he(t)??0)-(he(e)??0)),/* @__PURE__ */Object.freeze({upcoming:/* @__PURE__ */Object.freeze(n),past:/* @__PURE__ */Object.freeze(r)})}function canManageTelevetVisit(e){return e==="scheduled"}function fe(e){let t=globalThis.console;try{t?.error?.("[everfur] A host callback threw; the SDK ignored it.",e)}catch{}}function me(e){return(typeof e=="object"||typeof e=="function")&&e!==null&&typeof e.then=="function"}function ge(e,...t){if(typeof e=="function")try{let n=e(...t);return me(n)&&Promise.resolve(n).then(void 0,fe),n}catch(e){fe(e);return}}var ye=/* @__PURE__ */new WeakMap;function be(e){if(typeof e!="function")return;let t=ye.get(e);if(t!==void 0)return t;let n=(...t)=>{ge(e,...t)};return ye.set(e,n),n}function ve(e,t){let n=null;for(let r of t){let t=e[r];typeof t=="function"&&(n??={...e},n[r]=be(t))}return n??e}function Te(e,...t){let n;try{n=e(...t)}catch(e){return fe(e),Promise.resolve({ok:false,error:e})}return Promise.resolve(n).then(e=>({ok:true,value:e}),e=>({ok:false,error:e}))}function ke(){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 we=createContext(null);function Ce(e,t=true){let n=s(we),r=l(e);r.current=e,i(()=>{if(!(n===null||!t))return n.register(()=>r.current())},[n,t])}var Se="Go to the nearest emergency vet now.";var DRAFT=e=>e,_e=["[PLACEHOLDER","[PLAN NAME]","[LINK]","[Last]","TODO","TBD"];function xe(e){return _e.some(t=>e.toUpperCase().includes(t.toUpperCase()))}function Ie(e,t){let n=e;for(let[e,r]of Object.entries(t))n=n.split(`{${e}}`).join(r);return n}var De=/* @__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:Se,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 Pe(e=De){return typeof e=="string"?[e]:typeof e!="object"||e===null?[]:Object.values(e).flatMap(e=>Pe(e))}function isTelevetBookingCopyReady(){return Pe().every(e=>e.trim().length>0&&!xe(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}],Ee=/* @__PURE__ */Object.freeze(Re.map(e=>/* @__PURE__ */Object.freeze(e)));/* @__PURE__ */Object.freeze(Ee.map(e=>e.wireCode));var ze=/* @__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"}),Fe=/* @__PURE__ */Object.freeze(Ee.map(e=>/* @__PURE__ */Object.freeze({wireCode:e.wireCode,envelope:e.envelope,retryable:e.retryable,normalized:ze[e.wireCode]}))),Le=new Map(Fe.map(e=>[e.envelope+e.wireCode.toUpperCase(),e])),Ae=/* @__PURE__ */Object.freeze(["http_envelope",...[...new Set(Fe.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=Le.get(e+n);if(t)return t}}var je=/* @__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 je[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 Oe=/* @__PURE__ */new Set(["streamTimeout","rateLimited","internalError","upstreamLlmTimeout","streamIncomplete"]);function isAutoRetryable(e){return Oe.has(e)}var Ne=/* @__PURE__ */new Set(["serviceUnavailable","conflict","idempotencyInFlight"]);function isRetryableCode(e){return isAutoRetryable(e)||Ne.has(e)}var Be=500,Me=8e3,He=4;function backoffDelayMs(e,t=Math.random){let n=Math.max(0,e),r=Math.min(Be*2**n,Me);return Math.floor(t()*r)}var $e="This feature isn't available on your account right now.",We="Something in that request was not right. Check the details and try again.",Ve=/* @__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:$e,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:We,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:$e,runtimeDisposed:We,unknown:"Something went wrong. Please try again."}),qe="This session has ended. Please sign in again.",Ue="linked_account_read_only";function Ke(e,t,n){return e==="conflict"&&n===Ue?$e:(e==="authRejected"||e==="authExpired")&&typeof t=="string"&&t.trim().toLowerCase()==="session_revoked"?qe:userFacingError(e)}function userFacingError(e){return Ve[e]}function Ye(e,t,n){Object.defineProperty(e,t,{value:n,enumerable:false,writable:false,configurable:false})}var Ge=/^[a-z][a-z0-9_]{0,63}$/;function makeEverfurError(e,t){let n=contractErrorFor(t?.wireCode,t?.wireEnvelope),r=e==="conflict"&&t?.reasonCode===Ue,l={code:e,category:categoryFor(e),retryable:t?.retryable??(r?false:isRetryableCode(e)),displayMessage:Ke(e,t?.wireCode,r?Ue:null)};t?.httpStatus!==void 0&&(l.httpStatus=t.httpStatus),t?.requestId&&(l.requestId=t.requestId),typeof t?.reasonCode=="string"&&Ge.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&&Ye(l,"wireMessage",t.wireMessage),t?.raw!==void 0&&t.raw!==null&&Ye(l,"raw",t.raw),/* @__PURE__ */Object.freeze(l)}function ok(e,t){/* @__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 j=["scheduled","in_progress","awaiting_summary","completed","cancelled_owner","cancelled_ops","no_show_owner","no_show_vet"],O=/* @__PURE__ */new Set(["completed","cancelled_owner","cancelled_ops","no_show_owner","no_show_vet"]),N=/* @__PURE__ */new Set(["scheduled","in_progress","awaiting_summary"]);function B(e){return N.has(e.status)}var H=["wellness","prescription"],M=60;function $(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,M):null}var W=64,V=2e3,q=10;function isWellFormedStateCode(e){return typeof e=="string"&&/^[A-Za-z]{2}$/.test(e.trim())}function U(e){return typeof e=="object"&&e!==null?e:null}function K(e){return typeof e=="string"&&e.length>0?e:null}function Y(e){return typeof e=="string"&&e.trim().length>0?e.trim():null}function G(e,t){return typeof e=="boolean"?e:t}function J(e){return typeof e=="number"&&Number.isFinite(e)?e:null}function Q(e,t){return typeof t=="string"&&e.includes(t)?t:"unknown"}function Z(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 X(e,t){let n=U(e);return n===null?null:/* @__PURE__ */Object.freeze({state:K(n.state)??t,wellnessAvailable:G(n.wellness_available,false),prescriptionsAvailable:G(n.prescriptions_available,false),cancellationPolicyText:Y(n.cancellation_policy_text)})}function ee(e){let t=U(e);if(t===null)return null;let n=Y(t.summary),r=Y(t.version);return n===null||r===null?null:/* @__PURE__ */Object.freeze({summary:n,version:r})}function te(e){let t=U(e);if(t===null)return null;let n=K(t.clinician_id),r=K(t.display_name);return n===null||r===null?null:/* @__PURE__ */Object.freeze({clinicianId:n,displayName:r,credentials:Y(t.credentials_text),rating:J(t.rating),ratingCount:J(t.rating_count),bio:Y(t.bio),photoRef:K(t.photo_ref),licensedStates:Z(t.licensed_states,e=>{let t=U(e),n=t===null?null:K(t.state);return n===null?null:/* @__PURE__ */Object.freeze({state:n,canPrescribe:G(t?.can_prescribe,false)})}),role:ne(t.clinician_role)})}function ne(e){let t=K(e)?.trim().toLowerCase();return t==="vet"||t==="vet_tech"?t:null}function re(e){let t=U(e);if(t===null)return null;let n=K(t.slot_id),r=K(t.starts_at);return n===null||r===null?null:/* @__PURE__ */Object.freeze({slotId:n,startsAt:r,endsAt:K(t.ends_at)??r})}function le(e){let t=U(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 ie(e){let t=U(e);if(t===null)return null;let n=K(t.slot_id),r=K(t.hold_expires_at);return n===null||r===null?null:/* @__PURE__ */Object.freeze({slotId:n,expiresAt:r})}function oe(e){let t=U(e);if(t===null)return null;let n=K(t.consult_id),r=K(t.scheduled_at);return n===null||r===null?null:/* @__PURE__ */Object.freeze({consultId:n,petId:K(t.pet_id)??"",clinicianId:K(t.clinician_id)??"",clinicianName:Y(t.display_name),reasonText:Y(t.reason_text),mediaRefs:Z(t.media_refs,e=>K(e)),status:Q(j,t.status),kind:Q(H,t.kind),scheduledAt:r,emergencyFlagged:G(t.emergency_flagged,false),hasRoom:K(t.meeting_url)!==null})}function ae(e){let t=U(e);/* @__PURE__ */
|
|
5
|
+
return Object.freeze({active:G(t?.active,false)})}var se=240;function de(e){let t=U(e);if(t===null)return null;let n=J(t.fee_cents);return n===null||n<0?null:/* @__PURE__ */Object.freeze({feeCents:n,currency:K(t.currency)??"usd",feeRecorded:G(t.fee_recorded,n>0),summary:Y(t.summary)})}var ce=15,ue=250,pe=/* @__PURE__ */new Set(["scheduled","in_progress"]);function he(e){let t=Date.parse(e.scheduledAt);return Number.isNaN(t)?null:t}function televetJoinOpensAtMs(e){let t=he(e);return t===null?null:t-ce*6e4}function televetJoinReadiness(e,t){if(e===null)return{ready:false,reason:"not_open_yet"};if(O.has(e.status))return{ready:false,reason:"consult_over"};if(e.status==="in_progress")return{ready:true};let n=he(e);return n===null?{ready:false,reason:"not_open_yet"}:t<n-ce*6e4?{ready:false,reason:"not_open_yet"}:t>n+ue*6e4?{ready:false,reason:"consult_over"}:{ready:true}}function televetJoinDecision(e,t){if(!pe.has(e.status))return{joinable:false,reason:`status_${e.status}`};if(!e.hasRoom)return{joinable:false,reason:"room_not_ready"};let n=he(e);return n===null||t<n-ce*6e4?{joinable:false,reason:"too_early"}:t>n+ue*6e4?{joinable:false,reason:"too_late"}:{joinable:true}}function splitTelevetVisits(e,t){let n=[],r=[];for(let l of e){let e=he(l);(pe.has(l.status)&&e!==null&&e+ue*6e4>t?n:r).push(l)}return n.sort((e,t)=>(he(e)??0)-(he(t)??0)),r.sort((e,t)=>(he(t)??0)-(he(e)??0)),/* @__PURE__ */Object.freeze({upcoming:/* @__PURE__ */Object.freeze(n),past:/* @__PURE__ */Object.freeze(r)})}function canManageTelevetVisit(e){return e==="scheduled"}function fe(e){let t=globalThis.console;try{t?.error?.("[everfur] A host callback threw; the SDK ignored it.",e)}catch{}}function me(e){return(typeof e=="object"||typeof e=="function")&&e!==null&&typeof e.then=="function"}function ge(e,...t){if(typeof e=="function")try{let n=e(...t);return me(n)&&Promise.resolve(n).then(void 0,fe),n}catch(e){fe(e);return}}var ye=/* @__PURE__ */new WeakMap;function be(e){if(typeof e!="function")return;let t=ye.get(e);if(t!==void 0)return t;let n=(...t)=>{ge(e,...t)};return ye.set(e,n),n}function ve(e,t){let n=null;for(let r of t){let t=e[r];typeof t=="function"&&(n??={...e},n[r]=be(t))}return n??e}function Te(e,...t){let n;try{n=e(...t)}catch(e){return fe(e),Promise.resolve({ok:false,error:e})}return Promise.resolve(n).then(e=>({ok:true,value:e}),e=>({ok:false,error:e}))}function ke(){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 we=createContext(null);function Ce(e,t=true){let n=s(we),r=l(e);r.current=e,i(()=>{if(!(n===null||!t))return n.register(()=>r.current())},[n,t])}var Se="Go to the nearest emergency vet now.";var DRAFT=e=>e,_e=["[PLACEHOLDER","[PLAN NAME]","[LINK]","[Last]","TODO","TBD"];function xe(e){return _e.some(t=>e.toUpperCase().includes(t.toUpperCase()))}function Ie(e,t){let n=e;for(let[e,r]of Object.entries(t))n=n.split(`{${e}}`).join(r);return n}var De=/* @__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:Se,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 Pe(e=De){return typeof e=="string"?[e]:typeof e!="object"||e===null?[]:Object.values(e).flatMap(e=>Pe(e))}function isTelevetBookingCopyReady(){return Pe().every(e=>e.trim().length>0&&!xe(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}],Ee=/* @__PURE__ */Object.freeze(Re.map(e=>/* @__PURE__ */Object.freeze(e)));/* @__PURE__ */Object.freeze(Ee.map(e=>e.wireCode));var ze=/* @__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"}),Fe=/* @__PURE__ */Object.freeze(Ee.map(e=>/* @__PURE__ */Object.freeze({wireCode:e.wireCode,envelope:e.envelope,retryable:e.retryable,normalized:ze[e.wireCode]}))),Le=new Map(Fe.map(e=>[e.envelope+e.wireCode.toUpperCase(),e])),Ae=/* @__PURE__ */Object.freeze(["http_envelope",...[...new Set(Fe.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=Le.get(e+n);if(t)return t}}var je=/* @__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 je[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 Oe=/* @__PURE__ */new Set(["streamTimeout","rateLimited","internalError","upstreamLlmTimeout","streamIncomplete"]);function isAutoRetryable(e){return Oe.has(e)}var Ne=/* @__PURE__ */new Set(["serviceUnavailable","conflict","idempotencyInFlight"]);function isRetryableCode(e){return isAutoRetryable(e)||Ne.has(e)}var Be=500,He=8e3,Me=4;function backoffDelayMs(e,t=Math.random){let n=Math.max(0,e),r=Math.min(Be*2**n,He);return Math.floor(t()*r)}var $e="This feature isn't available on your account right now.",We="Something in that request was not right. Check the details and try again.",Ve=/* @__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:$e,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:We,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:$e,runtimeDisposed:We,unknown:"Something went wrong. Please try again."}),qe="This session has ended. Please sign in again.",Ue="linked_account_read_only";function Ke(e,t,n){return e==="conflict"&&n===Ue?$e:(e==="authRejected"||e==="authExpired")&&typeof t=="string"&&t.trim().toLowerCase()==="session_revoked"?qe:userFacingError(e)}function userFacingError(e){return Ve[e]}function Ye(e,t,n){Object.defineProperty(e,t,{value:n,enumerable:false,writable:false,configurable:false})}var Ge=/^[a-z][a-z0-9_]{0,63}$/;function makeEverfurError(e,t){let n=contractErrorFor(t?.wireCode,t?.wireEnvelope),r=e==="conflict"&&t?.reasonCode===Ue,l={code:e,category:categoryFor(e),retryable:t?.retryable??(r?false:isRetryableCode(e)),displayMessage:Ke(e,t?.wireCode,r?Ue:null)};t?.httpStatus!==void 0&&(l.httpStatus=t.httpStatus),t?.requestId&&(l.requestId=t.requestId),typeof t?.reasonCode=="string"&&Ge.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&&Ye(l,"wireMessage",t.wireMessage),t?.raw!==void 0&&t.raw!==null&&Ye(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 Je=class _EverfurConfigError extends Error{constructor(e,t){super(t),this.name="EverfurConfigError",this.kind=e,Object.setPrototypeOf(this,_EverfurConfigError.prototype)}};var Qe="x-everfur-anon-token",Ze="anonTokenInvalid";async function Xe(e){if(e.userRef!==null||e.anonIdentity===void 0)return null;try{return await e.anonIdentity.token()}catch{return null}}function et(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[Qe]=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:{...tt(e.headers),...authHeaders(t)}}}function tt(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===Qe||(t[n]=r)}return t}async function authedSend(e,t){if(t.mode==="anonymous"){let n=await Xe(t),r=await t.transport.request(withAuthHeaders(e,nt(t,n)));if(r.ok||lt(r.error.raw)!==Ze||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,nt(t,l)))}let n;try{n=await t.identity.currentToken()}catch(e){return t.identity.reportRejected?.(),err(et(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(et(e,{wireCode:lt(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(rt(i.error))):i}function nt(e,t){return{mode:"anonymous",publishableKey:e.publishableKey,userRef:e.userRef,...e.sessionId?{sessionId:e.sessionId}:{},...t!==null?{anonToken:t}:{}}}function rt(e){let t=e.raw,n=lt(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 lt(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 it(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 dt(e)}var ot=/^([a-z][a-z0-9+.-]*):\/\/(?:([^:@/?#]*)(?::([^@/?#]*))?@)?(\[[0-9a-f:.]+\]|[\w.~-]+)(?::(\d*))?(\/[^?#]*)?(\?[^#]*)?(#.*)?$/i,at=/[\s\u0000-\u001f\u007f\\]/,st={"http:":"80","https:":"443"};function dt(e,t){let n=e.trim();let r=at.test(n)?null:ot.exec(n);if(r===null)return null;let[,l="",i="",o="",a="",s="",d="",c="",u=""]=r,p=`${l.toLowerCase()}:`,h=Number(s);if(h>65535)return null;let f=s===""||String(h)===st[p]?"":String(h),m=st[p]!==void 0,g=a.toLowerCase()+(f&&`:${f}`),y=d||(m?"/":""),b=i||o?`${i}${o&&`:${o}`}@`:"";return{href:`${p}//${b}${g}${y}${c}${u}`,protocol:p,username:i,password:o,hostname:a.toLowerCase(),port:f,origin:m?`${p}//${g}`:"null",pathname:y,search:c==="?"?"":c,hash:u==="#"?"":u}}function networkError(e){return makeEverfurError("internalError",{retryable:true,wireMessage:ct(e)})}function ct(e){return e instanceof Error?e.message:typeof e=="string"?e:"network request failed"}var ut=3e4,pt=
|
|
7
|
+
return Object.freeze({ok:false,error:e})}var Je=class _EverfurConfigError extends Error{constructor(e,t){super(t),this.name="EverfurConfigError",this.kind=e,Object.setPrototypeOf(this,_EverfurConfigError.prototype)}};var Qe="x-everfur-anon-token",Ze="anonTokenInvalid";async function Xe(e){if(e.userRef!==null||e.anonIdentity===void 0)return null;try{return await e.anonIdentity.token()}catch{return null}}function et(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[Qe]=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:{...tt(e.headers),...authHeaders(t)}}}function tt(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===Qe||(t[n]=r)}return t}async function authedSend(e,t){if(t.mode==="anonymous"){let n=await Xe(t),r=await t.transport.request(withAuthHeaders(e,nt(t,n)));if(r.ok||lt(r.error.raw)!==Ze||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,nt(t,l)))}let n;try{n=await t.identity.currentToken()}catch(e){return t.identity.reportRejected?.(),err(et(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(et(e,{wireCode:lt(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(rt(i.error))):i}function nt(e,t){return{mode:"anonymous",publishableKey:e.publishableKey,userRef:e.userRef,...e.sessionId?{sessionId:e.sessionId}:{},...t!==null?{anonToken:t}:{}}}function rt(e){let t=e.raw,n=lt(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 lt(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 it(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 dt(e)}var ot=/^([a-z][a-z0-9+.-]*):\/\/(?:([^:@/?#]*)(?::([^@/?#]*))?@)?(\[[0-9a-f:.]+\]|[\w.~-]+)(?::(\d*))?(\/[^?#]*)?(\?[^#]*)?(#.*)?$/i,at=/[\s\u0000-\u001f\u007f\\]/,st={"http:":"80","https:":"443"};function dt(e,t){let n=e.trim();let r=at.test(n)?null:ot.exec(n);if(r===null)return null;let[,l="",i="",o="",a="",s="",d="",c="",u=""]=r,p=`${l.toLowerCase()}:`,h=Number(s);if(h>65535)return null;let f=s===""||String(h)===st[p]?"":String(h),m=st[p]!==void 0,g=a.toLowerCase()+(f&&`:${f}`),y=d||(m?"/":""),b=i||o?`${i}${o&&`:${o}`}@`:"";return{href:`${p}//${b}${g}${y}${c}${u}`,protocol:p,username:i,password:o,hostname:a.toLowerCase(),port:f,origin:m?`${p}//${g}`:"null",pathname:y,search:c==="?"?"":c,hash:u==="#"?"":u}}function networkError(e){return makeEverfurError("internalError",{retryable:true,wireMessage:ct(e)})}function ct(e){return e instanceof Error?e.message:typeof e=="string"?e:"network request failed"}var ut=3e4,pt=He*2,ht="idempotency-key",ft=/* @__PURE__ */new Set(["POST","PUT","PATCH","DELETE"]),mt=/* @__PURE__ */Object.freeze({onEvent(){}}),gt=/* @__PURE__ */Object.freeze({setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),now:()=>Date.now()});function yt(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??mt,n=e.timers??gt,r=e.rng??Math.random,l=e.sleep??((e,t)=>Ft(e,n,t)),i=e.maxAttempts??Me,o=e.unaryTimeoutMs??ut,a=e.newIdempotencyKey??vt(),s=e=>{try{t.onEvent(e)}catch{}};async function d(t,d,c){let u=c?.maxAttempts,p=Math.max(1,u??i),h=c?.idempotent??ft.has(d.method),f=c?.idempotencyKey===void 0?null:yt(c.idempotencyKey),m=h?f??a():null,g=bt(d,m),y=0;for(;;){let i=e=>/* @__PURE__ */Object.freeze({call:t,method:d.method,path:d.path,attempt:y,...m?{idempotencyKey:m}:{},...e});s(i({phase:"attempt"}));let a=Et(o,n),c=zt(a.signal,d.signal),h;try{h=await authedSend({...g,signal:c.signal},e.auth)}catch(e){h=err(networkError(e))}finally{c.dispose(),a.cancel()}if(h.ok)return s(i({phase:"settled",ok:true,reason:"ok"})),h;let f=h.error,b=kt(f,y,{maxAttempts:p,rng:r,now:n.now(),aborted:d.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,d.signal),d.signal?.aborted===true)return s(i({phase:"settled",...v,reason:"aborted"})),err(f);y+=1}}async function c(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:d,authorize:c,stream:u})}function bt(e,t){let n={};for(let[t,r]of Object.entries(e.headers??{}))t.toLowerCase()!==ht&&(n[t]=r);return t!==null&&(n["Idempotency-Key"]=t),{...e,headers:n}}function vt(){let e=0;return()=>`efk_${Date.now().toString(36)}_${(e++).toString(36)}_${Math.random().toString(36).slice(2,12)}`}var Tt=10;function kt(e,t,n){if(n.aborted)return{retry:false,reason:"aborted"};let r=wt(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(Tt,Math.floor(t)))},o=n.perCallMaxAttempts??i()??n.maxAttempts;if(t+1>=o)return{retry:false,reason:"attempts-exhausted"};let a=Ct(e,n.now);return a!==null?a>pt?{retry:false,reason:"server-reset-beyond-budget"}:{retry:true,reason:l,delayMs:a}:{retry:true,reason:l,delayMs:backoffDelayMs(t,n.rng)}}function wt(e){let t=e.code==="unknown"?fromWire(Dt(e.raw)):e.code;return t==="quotaExceeded"?"quota":t==="rateLimited"||e.httpStatus===429?"burst":null}function Ct(e,t){let n=_t(e.raw);if(n!==null){let e=n-t;return e>0?e:0}let r=St(e.raw);return r===null?null:Math.round(r*1e3)}function St(e){for(let t of xt(e)){let e=t.retry_after_seconds;if(typeof e=="number"&&Number.isFinite(e)&&e>=0)return e}return null}function _t(e){for(let t of xt(e)){let e=t.resets_at,n=It(e);if(n!==null)return n}return null}function xt(e){if(!Pt(e))return[];let t=[e];for(let n of["error","detail"]){let r=e[n];Pt(r)&&t.push(r)}return t}function It(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 Dt(e){for(let t of xt(e)){let e=t.code;if(typeof e=="string"&&e.length>0)return e}return null}function Pt(e){return typeof e=="object"&&e!==null}async function Rt(e){if(e.mode==="anonymous"){let t=await Xe(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 Et(e,t){let n=new AbortController,r=t.setTimeout(()=>n.abort(),e);return{signal:n.signal,cancel:()=>t.clearTimeout(r)}}function zt(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 Ft(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 Lt=/* @__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,jt=200*1024*1024,Ot=[[".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 Nt(e,t){let n=(t??"").trim().toLowerCase();if(n==="image/jpg")return"image/jpeg";if(Lt.includes(n))return n;if(n.length>0)return null;let r=e.toLowerCase();return Ot.find(([e])=>r.endsWith(e))?.[1]??null}function Bt(e){let t=Nt(e.filename,e.mimeType);if(t===null)return"type";if(!Number.isFinite(e.fileSize)||e.fileSize<=0)return"unreadable";let n=t.startsWith("video/")?jt:At;return e.fileSize<=n?null:"size"}function
|
|
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
|
|
11
|
-
return Object.freeze({kind:"rate_limited",retryAfterSeconds:Jt(e),message:
|
|
12
|
-
return Object.freeze({kind:"rate_limited",retryAfterSeconds:Jt(e),message:
|
|
9
|
+
return Object.freeze({send:d,authorize:c,stream:u})}function bt(e,t){let n={};for(let[t,r]of Object.entries(e.headers??{}))t.toLowerCase()!==ht&&(n[t]=r);return t!==null&&(n["Idempotency-Key"]=t),{...e,headers:n}}function vt(){let e=0;return()=>`efk_${Date.now().toString(36)}_${(e++).toString(36)}_${Math.random().toString(36).slice(2,12)}`}var Tt=10;function kt(e,t,n){if(n.aborted)return{retry:false,reason:"aborted"};let r=wt(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(Tt,Math.floor(t)))},o=n.perCallMaxAttempts??i()??n.maxAttempts;if(t+1>=o)return{retry:false,reason:"attempts-exhausted"};let a=Ct(e,n.now);return a!==null?a>pt?{retry:false,reason:"server-reset-beyond-budget"}:{retry:true,reason:l,delayMs:a}:{retry:true,reason:l,delayMs:backoffDelayMs(t,n.rng)}}function wt(e){let t=e.code==="unknown"?fromWire(Dt(e.raw)):e.code;return t==="quotaExceeded"?"quota":t==="rateLimited"||e.httpStatus===429?"burst":null}function Ct(e,t){let n=_t(e.raw);if(n!==null){let e=n-t;return e>0?e:0}let r=St(e.raw);return r===null?null:Math.round(r*1e3)}function St(e){for(let t of xt(e)){let e=t.retry_after_seconds;if(typeof e=="number"&&Number.isFinite(e)&&e>=0)return e}return null}function _t(e){for(let t of xt(e)){let e=t.resets_at,n=It(e);if(n!==null)return n}return null}function xt(e){if(!Pt(e))return[];let t=[e];for(let n of["error","detail"]){let r=e[n];Pt(r)&&t.push(r)}return t}function It(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 Dt(e){for(let t of xt(e)){let e=t.code;if(typeof e=="string"&&e.length>0)return e}return null}function Pt(e){return typeof e=="object"&&e!==null}async function Rt(e){if(e.mode==="anonymous"){let t=await Xe(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 Et(e,t){let n=new AbortController,r=t.setTimeout(()=>n.abort(),e);return{signal:n.signal,cancel:()=>t.clearTimeout(r)}}function zt(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 Ft(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 Lt=/* @__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,jt=200*1024*1024,Ot=[[".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 Nt(e,t){let n=(t??"").trim().toLowerCase();if(n==="image/jpg")return"image/jpeg";if(Lt.includes(n))return n;if(n.length>0)return null;let r=e.toLowerCase();return Ot.find(([e])=>r.endsWith(e))?.[1]??null}function Bt(e){let t=Nt(e.filename,e.mimeType);if(t===null)return"type";if(!Number.isFinite(e.fileSize)||e.fileSize<=0)return"unreadable";let n=t.startsWith("video/")?jt:At;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)??At,s3_key:i,purpose:n(t.purpose)})}function Mt(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 $t(e){if(e.httpStatus===404)return"dark";if(e.httpStatus===400){let t=Mt(e.raw);if(t==="FILE_TOO_LARGE")return"size";if(t==="INVALID_CONTENT_TYPE")return"type"}return"failed"}var Wt="televet_booking_not_live";function Vt(e){return makeEverfurError("conflict",{retryable:false,reasonCode:Wt,wireMessage:`the booking was answered with a consult whose status is ${e}, which is not a live visit`})}var qt="televet_booking_key_reused",Ut="IDEMPOTENCY_KEY_REUSED_DIFFERENT_REQUEST";function Kt(e){return e.httpStatus!==409||e.reasonCode===qt||Yt(e)?.code!==Ut?e:makeEverfurError(e.code,{retryable:false,httpStatus:409,...e.requestId!==void 0?{requestId:e.requestId}:{},wireCode:Ut,reasonCode:qt,...e.wireMessage!==void 0?{wireMessage:e.wireMessage}:{},raw:e.raw})}function Yt(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 Gt(e){let t=Yt(e)?.categories;return Array.isArray(t)?/* @__PURE__ */Object.freeze(t.filter(e=>typeof e=="string")):/* @__PURE__ */Object.freeze([])}function Jt(e){let t=Yt(e)?.retry_after_seconds;return typeof t=="number"&&Number.isFinite(t)&&t>0?t:null}var Qt="You’ve made a lot of requests just now. You can try again shortly.";function Zt(){return Qt}function Xt(e){let t=e.reasonCode;if(typeof t=="string"&&t.length>0)return t;let n=Yt(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:Jt(e),message:Zt()});if(t===404)/* @__PURE__ */return Object.freeze({kind:"unavailable"});switch(Xt(e)){case"televet_rate_limited":/* @__PURE__ */
|
|
12
|
+
return Object.freeze({kind:"rate_limited",retryAfterSeconds:Jt(e),message:Zt()});case"televet_emergency_ack_required":/* @__PURE__ */
|
|
13
13
|
return Object.freeze({kind:"emergency",categories:Gt(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__ */
|
|
@@ -19,107 +19,107 @@ return Object.freeze({kind:"slot_taken"});case"televet_clinician_cannot_prescrib
|
|
|
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
|
|
23
|
-
return Object.freeze({roomUrl:t.trim(),token:n,recordingNotice:typeof r=="boolean"?r:true,callLimits:
|
|
24
|
-
return Object.freeze({messageId:e.message_id,petRef:e.pet_ref,role:e.role,content:e.content,createdAt:e.created_at,senderName:t?
|
|
25
|
-
return Object.freeze({drug:n,strength:
|
|
26
|
-
return Object.freeze({consultId:n.consult_id,findingsText:n.findings_text??"",nextStepsText:n.next_steps_text??"",medications:/* @__PURE__ */Object.freeze((n.medications??[]).map(Tn).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:mn(n.approved_by_display_name),credentialsText:mn(n.credentials_text)})}function isVetMessagesDark(e){return e.httpStatus===404}function isVetThreadVetFirst(e){return e.httpStatus===409}function wn(e){return err(makeEverfurError("validationFailed",{retryable:false,wireMessage:e}))}function Cn(e){return err(makeEverfurError("internalError",{retryable:false,httpStatus:502,wireMessage:e}))}function Sn(e){return e===void 0||!Number.isFinite(e)?an:Math.min(sn,Math.max(1,Math.trunc(e)))}function _n(e){return e.trim().length>0&&!Number.isNaN(Date.parse(e))}function xn(e,t,n){try{e?.track(t,n)}catch{}}function In(e,t){return{async listVetThreads(t){let n=await e.send("televet.messages.threads",{method:"GET",path:ln,...t?{signal:t}:{}});if(!n.ok)return err(n.error);let r=vn(n.value);return r===null?Cn("the vet thread list was unreadable"):ok(r)},async listVetMessages(petRef,t={},n){let r=petRef.trim();if(r.length===0)return wn("petRef is required");let l=t.before?.trim();if(l!==void 0&&l.length>0&&!_n(l))return wn("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:Sn(t.limit)},...n?{signal:n}:{}});if(!i.ok)return err(i.error);let o=bn(i.value);return o===null?Cn("the vet thread page was unreadable"):ok(o)},async sendVetMessage(petRef,n){let r=petRef.trim();if(r.length===0)return wn("petRef is required");if(n.trim().length===0)return wn("content must not be blank");if(n.length>on)return wn(`content must be at most ${on} 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 xn(t,"televet.messages.send_failed",{status:l.error.httpStatus??null}),err(l.error);let i=yn(l.value);return i===null?Cn("the sent message was unreadable"):ok(i)},async markVetThreadRead(petRef,t){let n=petRef.trim();if(n.length===0)return wn("petRef is required");if(!_n(t))return wn("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 wn("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=kn(l.value);return i===null?Cn("the visit summary was unreadable"):ok(i)}}}var Dn="/widget/v1/televet",Pn=`${Dn}/state-policy`,Rn=`${Dn}/vets`,En=`${Dn}/slots`,zn=`${Dn}/slots/next`,Fn=`${Dn}/consults`,Ln=`${Dn}/entitlement`,An=`${Dn}/cancellation-policy`,jn=`${Dn}/attachments/initiate`,On=`${Fn}/triage`;function televetHoldCall(e){return`${En}/${encodeURIComponent(e)}/hold`}function televetRescheduleCall(e){return`${Fn}/${encodeURIComponent(e)}/reschedule`}function televetConsultCall(e){return`${Fn}/${encodeURIComponent(e)}`}function televetJoinCall(e){return`${televetConsultCall(e)}/join`}function televetCancelCall(e){return`${televetConsultCall(e)}/cancel`}var Nn=100;function Bn(e){return err(makeEverfurError("validationFailed",{retryable:false,wireMessage:e}))}function Mn(e){return err(makeEverfurError("internalError",{retryable:false,httpStatus:502,wireMessage:e}))}function Hn(e){return e.httpStatus===404}function $n(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>V?`reason_text must be at most ${V} characters`:Wn(e)}function Wn(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>W?`cancellation_policy_version must be at most ${W} characters`:null}function createTelevetBookingController(e){let t=e.funnel??createRequestFunnel({auth:e.auth,...e.errorPolicy?{errorPolicy:e.errorPolicy}:{}}),n=e.telemetry;return{...In(t,n),async statePolicy(e,n){let r=e.trim();if(!isWellFormedStateCode(r))return Bn("state must be a two-letter US state code");let l=await t.send("televet.booking.state_policy",{method:"GET",path:`${Pn}/${encodeURIComponent(r)}`,...n?{signal:n}:{}});if(!l.ok)return err(l.error);let i=X(l.value,r);return i===null?Mn("the state policy response was unreadable"):ok(i)},async entitlement(e){let n=await t.send("televet.booking.entitlement",{method:"GET",path:Ln,...e?{signal:e}:{}});return n.ok?ok(ae(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(ee(n.value)):ok(null)},async clinicians(e,n){let r=e.trim();if(!isWellFormedStateCode(r))return Bn("state must be a two-letter US state code");let l=await t.send("televet.booking.clinicians",{method:"GET",path:Rn,query:{state:r},...n?{signal:n}:{}});return l.ok?ok(Z(qn(l.value,"vets"),te)):Hn(l.error)?ok(/* @__PURE__ */Object.freeze([])):err(l.error)},async slots(e,n){let r=e.trim();if(r.length===0)return Bn("clinicianId is required");let l=await t.send("televet.booking.slots",{method:"GET",path:En,query:{clinician_id:r},...n?{signal:n}:{}});return l.ok?ok(Z(qn(l.value,"slots"),re)):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:zn,...e?{signal:e}:{}});return n.ok?ok(re(unwrap(n.value,"slot"))):ok(null)},async holdSlot(e){let r=e.trim();if(r.length===0)return Bn("slotId is required");let l=await t.send("televet.booking.hold",{method:"POST",path:televetHoldCall(r)},{idempotent:false,maxAttempts:1});if(!l.ok)return $n(n,"televet.booking.hold_failed",{status:l.error.httpStatus??null}),err(l.error);let i=ie(l.value);return i===null?Mn("the hold response carried no usable expiry"):ok(i)},async releaseHold(e){let n=e.trim();if(n.length===0)return Bn("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 Bn(l);let i=r.trim();if(i.length===0)return Bn("idempotencyKey is required");let o=await t.send("televet.booking.book",{method:"POST",path:Fn,body:Vn(e)},{idempotent:true,idempotencyKey:i,maxAttempts:1});if(!o.ok)return $n(n,"televet.booking.book_failed",{status:o.error.httpStatus??null}),err(Kt(o.error));let a=oe(o.value);return a===null?Mn("the booking response was unreadable"):B(a)?ok(a):($n(n,"televet.booking.book_failed",{status:null,consult_status:a.status}),err(Vt(a.status)))},async reschedule(e,r){let l=e.trim(),i=r.trim();if(l.length===0)return Bn("consultId is required");if(i.length===0)return Bn("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 $n(n,"televet.booking.reschedule_failed",{status:o.error.httpStatus??null}),err(o.error);let a=oe(o.value);return a===null?Mn("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:On,body:{reason_text:l},...r?{signal:r}:{}},{idempotent:false,maxAttempts:1});return i.ok?ok(le(i.value)):($n(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:Fn,query:{limit:String(Nn)},...e?{signal:e}:{}});return n.ok?ok(Z(qn(n.value,"consults"),oe)):Hn(n.error)?ok(/* @__PURE__ */Object.freeze([])):err(n.error)},async getConsult(e,n){let r=e.trim();if(r.length===0)return Bn("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=oe(l.value);return i===null?Mn("the consult response was unreadable"):ok(i)},async joinConsult(e){let r=e.trim();if(r.length===0)return Bn("consultId is required");let l=await t.send("televet.booking.join",{method:"POST",path:televetJoinCall(r)},{idempotent:false,maxAttempts:1});if(!l.ok)return $n(n,"televet.booking.join_failed",{status:l.error.httpStatus??null}),err(l.error);let i=parseVetCallCredential(l.value);return i===null?Mn("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 Bn("consultId is required");if(i.length===0)return Bn("reason is required");if(i.length>se)return Bn(`reason must be at most ${se} 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 $n(n,"televet.booking.cancel_failed",{status:o.error.httpStatus??null}),err(o.error);let a=de(o.value);return a===null?Mn("the cancel response was unreadable"):ok(a)},async initiateAttachment(e,n){let r=await t.send("televet.booking.attachment_initiate",{method:"POST",path:jn,body:{filename:e.filename,content_type:e.contentType,file_size:e.fileSize},...n?{signal:n}:{}});if(!r.ok)return err(r.error);let l=Mt(r.value);return l===null?Mn("the attachment presign was unreadable"):ok(l)}}}function Vn(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 qn(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 Un=/* @__PURE__ */Symbol.for("@everfur/sdk#EverfurContext@v1"),Kn=globalThis,Yn=Kn[Un]??(Kn[Un]=createContext(null));Yn.displayName??="EverfurContext";function Gn(){let e=s(Yn);if(e===null)throw new Je("not-initialized","Everfur hooks must be called inside <EverfurProvider>. Wrap your tree once, high.");return e}var Jn=/* @__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 Jn[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 Xn({name:e,enabled:false,isPending:true,limits:{}});let i=Qn(r,l);return r.filter(e=>l.get(e)?.granted!==true).length===0?Xn({name:e,enabled:true,isPending:false,limits:i}):Xn({name:e,enabled:false,isPending:false,limits:i,disabled:Zn(r,l)})}function Qn(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 Zn(e,t){for(let n of e){let e=t.get(n)?.disabled;if(e)/* @__PURE__ */
|
|
22
|
+
return Object.freeze({kind:"failed"})}function en(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function isSafeRoomUrl(e){return it(e.trim())?.protocol==="https:"}function isUsableRoomCredential(e,t){return isSafeRoomUrl(e)&&t.trim().length>0}function tn(e,t){return typeof e=="number"&&Number.isInteger(e)&&e>=t?e:null}function nn(e){if(!en(e))return null;let t=tn(e.consult_minutes,1),n=tn(e.auto_end_minutes,0),r=tn(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(!en(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:nn(e.call_limits)})}function vetCallJoinReason(e){let t=rn(e.raw);return t!==null&&t.length>0?t:null}function rn(e){if(!en(e))return null;let t=e.detail??e.error,n=(en(t)?t:e).reason;return typeof n=="string"?n:null}function vetCallJoinRefusal(e){if(e.httpStatus===404)return"unavailable";let t=rn(e.raw);return t==="too_early"||t==="too_late"||t==="room_not_ready"?t:t!==null&&t.startsWith("status_")?"not_joinable":"unknown"}var ln="/widget/v1/televet",on=`${ln}/messages/threads`;function televetThreadMessagesCall(petRef){return`${on}/${encodeURIComponent(petRef)}/messages`}function televetThreadReadCall(petRef){return`${on}/${encodeURIComponent(petRef)}/read`}function televetVisitSummaryCall(e){return`${ln}/consults/${encodeURIComponent(e)}/summary`}var an=4e3,sn=50,dn=100,cn=/* @__PURE__ */R.string().min(1).refine(e=>!Number.isNaN(Date.parse(e))),un=/* @__PURE__ */R.string().nullish(),pn=/* @__PURE__ */R.object({message_id:/* @__PURE__ */R.string().min(1),pet_ref:/* @__PURE__ */R.string().min(1),role:/* @__PURE__ */R.enum(["owner","vet","system"]),content:/* @__PURE__ */R.string(),created_at:cn,sender:/* @__PURE__ */R.object({display_name:un,specialty:un}).nullish(),sender_display_name:un,attachment_count:/* @__PURE__ */R.number().int().nonnegative().nullish()}),hn=/* @__PURE__ */R.object({pet_ref:/* @__PURE__ */R.string().min(1),last_message_at:cn,unread_count:/* @__PURE__ */R.number().int().nonnegative().nullish(),owner_can_start:/* @__PURE__ */R.boolean().nullish(),last_message:/* @__PURE__ */pn.nullish()}),fn=/* @__PURE__ */R.object({drug:/* @__PURE__ */R.string().nullish(),strength:un,form:un,sig:un,quantity:/* @__PURE__ */R.union([/* @__PURE__ */R.string(),/* @__PURE__ */R.number()]).nullish(),refills:/* @__PURE__ */R.number().int().nonnegative().nullish()}).passthrough(),mn=/* @__PURE__ */R.object({consult_id:/* @__PURE__ */R.string().min(1),findings_text:/* @__PURE__ */R.string().nullish(),next_steps_text:/* @__PURE__ */R.string().nullish(),medications:/* @__PURE__ */R.array(/* @__PURE__ */R.unknown()).nullish(),product_refs:/* @__PURE__ */R.array(/* @__PURE__ */R.string()).nullish(),action_items:/* @__PURE__ */R.array(/* @__PURE__ */R.string()).nullish(),approved_at:cn,approved_by_display_name:un,credentials_text:un});function gn(e){let t=e?.trim()??"";return t.length>0?t:null}function yn(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?gn(e.sender?.display_name)??gn(e.sender_display_name):null,senderSpecialty:t?gn(e.sender?.specialty):null,attachmentCount:e.attachment_count??0})}function bn(e){let t=pn.safeParse(e);return t.success?yn(t.data):null}function vn(e){let t=R.array(pn).safeParse(e);return t.success?/* @__PURE__ */Object.freeze(t.data.map(yn)):null}function Tn(e){let t=R.array(hn).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?yn(e.last_message):null}))):null}function kn(e){let t=fn.safeParse(e);if(!t.success)return null;let n=gn(t.data.drug);if(n===null)return null;let r=t.data.quantity;/* @__PURE__ */
|
|
25
|
+
return Object.freeze({drug:n,strength:gn(t.data.strength),form:gn(t.data.form),sig:gn(t.data.sig),quantity:r==null?null:gn(String(r)),refills:t.data.refills??null})}function wn(e){let t=mn.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(kn).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:gn(n.approved_by_display_name),credentialsText:gn(n.credentials_text)})}function isVetMessagesDark(e){return e.httpStatus===404}function isVetThreadVetFirst(e){return e.httpStatus===409}function Cn(e){return err(makeEverfurError("validationFailed",{retryable:false,wireMessage:e}))}function Sn(e){return err(makeEverfurError("internalError",{retryable:false,httpStatus:502,wireMessage:e}))}function _n(e){return e===void 0||!Number.isFinite(e)?sn:Math.min(dn,Math.max(1,Math.trunc(e)))}function xn(e){return e.trim().length>0&&!Number.isNaN(Date.parse(e))}function In(e,t,n){try{e?.track(t,n)}catch{}}function Dn(e,t){return{async listVetThreads(t){let n=await e.send("televet.messages.threads",{method:"GET",path:on,...t?{signal:t}:{}});if(!n.ok)return err(n.error);let r=Tn(n.value);return r===null?Sn("the vet thread list was unreadable"):ok(r)},async listVetMessages(petRef,t={},n){let r=petRef.trim();if(r.length===0)return Cn("petRef is required");let l=t.before?.trim();if(l!==void 0&&l.length>0&&!xn(l))return Cn("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:_n(t.limit)},...n?{signal:n}:{}});if(!i.ok)return err(i.error);let o=vn(i.value);return o===null?Sn("the vet thread page was unreadable"):ok(o)},async sendVetMessage(petRef,n){let r=petRef.trim();if(r.length===0)return Cn("petRef is required");if(n.trim().length===0)return Cn("content must not be blank");if(n.length>an)return Cn(`content must be at most ${an} 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 In(t,"televet.messages.send_failed",{status:l.error.httpStatus??null}),err(l.error);let i=bn(l.value);return i===null?Sn("the sent message was unreadable"):ok(i)},async markVetThreadRead(petRef,t){let n=petRef.trim();if(n.length===0)return Cn("petRef is required");if(!xn(t))return Cn("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 Cn("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=wn(l.value);return i===null?Sn("the visit summary was unreadable"):ok(i)}}}var Pn="/widget/v1/televet",Rn=`${Pn}/state-policy`,En=`${Pn}/vets`,zn=`${Pn}/slots`,Fn=`${Pn}/slots/next`,Ln=`${Pn}/consults`,An=`${Pn}/entitlement`,jn=`${Pn}/cancellation-policy`,On=`${Pn}/attachments/initiate`,Nn=`${Ln}/triage`;function televetHoldCall(e){return`${zn}/${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 Bn=100;function Hn(e){return err(makeEverfurError("validationFailed",{retryable:false,wireMessage:e}))}function Mn(e){return err(makeEverfurError("internalError",{retryable:false,httpStatus:502,wireMessage:e}))}function $n(e){return e.httpStatus===404}function Wn(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>V?`reason_text must be at most ${V} characters`:Vn(e)}function Vn(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>W?`cancellation_policy_version must be at most ${W} characters`:null}function createTelevetBookingController(e){let t=e.funnel??createRequestFunnel({auth:e.auth,...e.errorPolicy?{errorPolicy:e.errorPolicy}:{}}),n=e.telemetry;return{...Dn(t,n),async statePolicy(e,n){let r=e.trim();if(!isWellFormedStateCode(r))return Hn("state must be a two-letter US state code");let l=await t.send("televet.booking.state_policy",{method:"GET",path:`${Rn}/${encodeURIComponent(r)}`,...n?{signal:n}:{}});if(!l.ok)return err(l.error);let i=X(l.value,r);return i===null?Mn("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(ae(n.value)):err(n.error)},async cancellationPolicy(e){let n=await t.send("televet.booking.cancellation_policy",{method:"GET",path:jn,...e?{signal:e}:{}});return n.ok?ok(ee(n.value)):ok(null)},async clinicians(e,n){let r=e.trim();if(!isWellFormedStateCode(r))return Hn("state must be a two-letter US state code");let l=await t.send("televet.booking.clinicians",{method:"GET",path:En,query:{state:r},...n?{signal:n}:{}});return l.ok?ok(Z(Un(l.value,"vets"),te)):$n(l.error)?ok(/* @__PURE__ */Object.freeze([])):err(l.error)},async slots(e,n){let r=e.trim();if(r.length===0)return Hn("clinicianId is required");let l=await t.send("televet.booking.slots",{method:"GET",path:zn,query:{clinician_id:r},...n?{signal:n}:{}});return l.ok?ok(Z(Un(l.value,"slots"),re)):$n(l.error)?ok(/* @__PURE__ */Object.freeze([])):err(l.error)},async nextSlot(e){let n=await t.send("televet.booking.next_slot",{method:"GET",path:Fn,...e?{signal:e}:{}});return n.ok?ok(re(unwrap(n.value,"slot"))):ok(null)},async holdSlot(e){let r=e.trim();if(r.length===0)return Hn("slotId is required");let l=await t.send("televet.booking.hold",{method:"POST",path:televetHoldCall(r)},{idempotent:false,maxAttempts:1});if(!l.ok)return Wn(n,"televet.booking.hold_failed",{status:l.error.httpStatus??null}),err(l.error);let i=ie(l.value);return i===null?Mn("the hold response carried no usable expiry"):ok(i)},async releaseHold(e){let n=e.trim();if(n.length===0)return Hn("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 Hn(l);let i=r.trim();if(i.length===0)return Hn("idempotencyKey is required");let o=await t.send("televet.booking.book",{method:"POST",path:Ln,body:qn(e)},{idempotent:true,idempotencyKey:i,maxAttempts:1});if(!o.ok)return Wn(n,"televet.booking.book_failed",{status:o.error.httpStatus??null}),err(Kt(o.error));let a=oe(o.value);return a===null?Mn("the booking response was unreadable"):B(a)?ok(a):(Wn(n,"televet.booking.book_failed",{status:null,consult_status:a.status}),err(Vt(a.status)))},async reschedule(e,r){let l=e.trim(),i=r.trim();if(l.length===0)return Hn("consultId is required");if(i.length===0)return Hn("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 Wn(n,"televet.booking.reschedule_failed",{status:o.error.httpStatus??null}),err(o.error);let a=oe(o.value);return a===null?Mn("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:Nn,body:{reason_text:l},...r?{signal:r}:{}},{idempotent:false,maxAttempts:1});return i.ok?ok(le(i.value)):(Wn(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(Bn)},...e?{signal:e}:{}});return n.ok?ok(Z(Un(n.value,"consults"),oe)):$n(n.error)?ok(/* @__PURE__ */Object.freeze([])):err(n.error)},async getConsult(e,n){let r=e.trim();if(r.length===0)return Hn("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=oe(l.value);return i===null?Mn("the consult response was unreadable"):ok(i)},async joinConsult(e){let r=e.trim();if(r.length===0)return Hn("consultId is required");let l=await t.send("televet.booking.join",{method:"POST",path:televetJoinCall(r)},{idempotent:false,maxAttempts:1});if(!l.ok)return Wn(n,"televet.booking.join_failed",{status:l.error.httpStatus??null}),err(l.error);let i=parseVetCallCredential(l.value);return i===null?Mn("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 Hn("consultId is required");if(i.length===0)return Hn("reason is required");if(i.length>se)return Hn(`reason must be at most ${se} 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 Wn(n,"televet.booking.cancel_failed",{status:o.error.httpStatus??null}),err(o.error);let a=de(o.value);return a===null?Mn("the cancel response was unreadable"):ok(a)},async initiateAttachment(e,n){let r=await t.send("televet.booking.attachment_initiate",{method:"POST",path:On,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?Mn("the attachment presign was unreadable"):ok(l)}}}function qn(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 Un(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 Kn=/* @__PURE__ */Symbol.for("@everfur/sdk#EverfurContext@v1"),Yn=globalThis,Gn=Yn[Kn]??(Yn[Kn]=createContext(null));Gn.displayName??="EverfurContext";function Jn(){let e=s(Gn);if(e===null)throw new Je("not-initialized","Everfur hooks must be called inside <EverfurProvider>. Wrap your tree once, high.");return e}var Qn=/* @__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 Qn[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 er({name:e,enabled:false,isPending:true,limits:{}});let i=Zn(r,l);return r.filter(e=>l.get(e)?.granted!==true).length===0?er({name:e,enabled:true,isPending:false,limits:i}):er({name:e,enabled:false,isPending:false,limits:i,disabled:Xn(r,l)})}function Zn(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 Xn(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
|
|
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&&rr(s.error)))return Promise.resolve(s);let d={abort:new AbortController,promise:null,settled:null,keptUntil:0,waiters:0};return n.set(e,d),d.promise=t(d.abort.signal).then(t=>(i(e,d,t,o.freshMs),t),t=>{throw d.promise=null,n.get(e)===d&&n.delete(e),t}),l(e,d,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 sr=/* @__PURE__ */new WeakMap;function dr(e){let t=sr.get(e);return t===void 0&&(t=ar(),sr.set(e,t)),t}var cr=/* @__PURE__ */Object.freeze(["slots:","next-slot"]),ur=/* @__PURE__ */Object.freeze(["consults:","consult:","slots:","next-slot"]);function pr(e,t){sr.get(e)?.invalidate(t)}function useTelevetBookingController(e){let{runtime:t,userRef:userRef,scopeEpoch:r}=Gn();return n(()=>e||(userRef===null?null:fr(t,`${userRef}\0${r}`,()=>{let{services:e}=t.registry;return createTelevetBookingController({auth:e.authFor(userRef),telemetry:e.telemetry,...e.errorPolicy?{errorPolicy:e.errorPolicy}:{}})})),[t,userRef,r,e])}var hr=/* @__PURE__ */new WeakMap;function fr(e,t,n){let r=hr.get(e);if(r!==void 0&&r.scope===t)return r.controller;let l=n();return hr.set(e,{scope:t,controller:l}),l}function useTelevetBookingAvailable(){let{userRef:userRef}=Gn(),e=useCapability("televet");return n(()=>({available:e.enabled&&userRef!==null,isPending:e.isPending}),[e.enabled,e.isPending,userRef])}function mr(e,t,a,s,d=or,c=false){let[u,p]=r(()=>{let n=t&&a!==null&&s!==null&&!c?dr(s).peek(e):null;return n!==null?n.ok?{key:e,data:n.value,isPending:false,error:null}:{key:e,data:null,isPending:false,error:n.error}:{key:e,data:null,isPending:t&&a!==null,error:null}}),[h,f]=r(0),m=l(a);m.current=a;let g=l(s);g.current=s;let y=l(c);i(()=>{let n=m.current;if(!t||n===null){p({key:e,data:null,isPending:false,error:null});return}let r=y.current;y.current=false;let l=g.current===null?null:dr(g.current),i=r||l===null?null:l.peek(e);if(i!==null){p(i.ok?{key:e,data:i.value,isPending:false,error:null}:{key:e,data:null,isPending:false,error:i.error});return}let o=new AbortController,a=true;return p(t=>t.key===e?{...t,isPending:true,error:null}:{key:e,data:null,isPending:true,error:null}),(async()=>{let t;try{t=l===null?await n(o.signal):await l.read(e,n,{signal:o.signal,freshMs:d,force:r})}catch{a&&p({key:e,data:null,isPending:false,error:null});return}a&&(t.ok?p({key:e,data:t.value,isPending:false,error:null}):p({key:e,data:null,isPending:false,error:t.error}))})(),()=>{a=false,o.abort()}},[e,t,h]);let b=o(()=>{y.current=true,f(e=>e+1)},[]),v=u.key===e;return n(()=>({enabled:t,data:v?u.data:null,isPending:t&&(!v||u.isPending),isError:v&&u.error!==null,error:v?u.error:null,refetch:b}),[t,v,u.data,u.isPending,u.error,b])}function useTelevetStatePolicy(e,t){let n=e?.trim()??"",r=t?.statePolicy!==void 0&&isWellFormedStateCode(n),l=t?.statePolicy;return mr(`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 mr("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 mr("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 mr(`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 mr(`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 mr("next-slot",t,t&&n?t=>n.call(e,t):null,e)}function gr(e){let[t,a]=r(null),s=l(true),d=l(false),c=l(e);c.current=e,i(()=>(s.current=true,()=>{s.current=false}),[]);let u=o((...e)=>{let t=c.current;if(t===null||d.current)return;let n=e[e.length-1],r=typeof n=="object"&&n!==null&&("onSuccess"in n||"onError"in n),l=r?n:void 0,i=r?e.slice(0,-1):e;d.current=true,a({variables:i[0]??null}),(async()=>{let e=null;try{e=await t(...i)}catch{e=null}d.current=false,s.current&&a(null),e!==null&&(e.ok?l?.onSuccess?.(e.value):l?.onError?.(e.error))})()},[]);return n(()=>({isPending:t!==null,variables:t?.variables??null,mutate:u}),[t,u])}async function yr(e,t,n){let r=await n;return r.ok&&pr(e,t),r}function useTelevetHoldSlot(e){return gr(e?t=>yr(e,cr,e.holdSlot(t)):null)}function useTelevetBookConsult(e){return gr(e?(t,n)=>yr(e,ur,e.book(t,n)):null)}function useTelevetRescheduleConsult(e,t){return gr(t&&e?n=>yr(t,ur,t.reschedule(e,n)):null)}function br(e,t=0,n){let r=e?.listConsults!==void 0,l=e?.listConsults;return mr(`consults:${t}`,r,r&&l?t=>l.call(e,t):null,e,or,n?.reread===true)}function vr(e,t,n=0){let r=e?.trim()??"",l=t?.getConsult!==void 0&&r.length>0,i=t?.getConsult;return mr(`consult:${r}:${n}`,l,l&&i?e=>i.call(t,r,e):null,t)}function Tr(e,t){let n=t?.cancelConsult;return gr(t&&n&&e?r=>yr(t,ur,n.call(t,e,r)):null)}function kr(e){return e.error!==null&&e.error.httpStatus===404}function wr(e){let t=br(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 Cr=/* @__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[Cr[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[Cr[t]]};let l=face(e,t);return l.fontWeight===void 0||r===null?l:{fontFamily:l.fontFamily,fontWeight:r}}function Sr(e){return e<=450?"regular":e<=650?"medium":"bold"}var _r={regular:"mono",medium:"monoMedium",bold:"monoBold"};function textRole(e,t){let n=xr.get(e);n===void 0&&(n=/* @__PURE__ */new Map,xr.set(e,n));let r=n.get(t);if(r!==void 0)return r;let l=Ir(e,t);return n.set(t,l),l}var xr=/* @__PURE__ */new WeakMap;function Ir(e,t){let n=e.type.roles[t],r=n.weight==="400"&&n.face!=="mono"?e.type.weight.regular:n.weight,l=Sr(Number(r)),i=n.face==="mono"?face(e,_r[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,d={...a,fontSize:s,lineHeight:Math.round(s*n.lineHeight*100)/100};return n.letterSpacing!==0&&(d.letterSpacing=Math.round(s*n.letterSpacing*100)/100),n.uppercase&&(d.textTransform="uppercase"),/* @__PURE__ */Object.freeze(d)}var Dr=/* @__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 Pr=Object.freeze;function deepFreeze(e){if(e!==null&&typeof e=="object"&&!Object.isFrozen(e)){Pr(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 Er={xs:4,sm:8,md:12,lg:16,xl:24,xxl:32},zr={tile:5,xs:6,sm:10,md:14,lg:20,xl:28,pill:500},Fr={nano:8,small:9,micro:10,tiny:11,caption:13,bodyTight:15,body:17,subtitle:20,heading:22,verdict:24},Lr={tight:1.15,snug:1.3,normal:1.4,relaxed:1.55},Ar={regular:"400",medium:"500",bold:"700"},jr={eyebrow:1,monoWide:.9,headerBrand:-.42,tight:-.35},Or=0,Nr="System",Br="monospace",Mr=["content","heading","control","compact","badge"];function Hr(e){let t={};for(let n of Mr)t[n]=e;return t}var $r=[];function Wr(){return{family:Nr,mono:Br,fontUrl:null,families:{regular:Nr,medium:Nr,bold:Nr,mono:Br,monoMedium:Br,monoBold:Br},namedFaces:{regular:false,medium:false,bold:false,mono:false,monoMedium:false,monoBold:false},fontUrls:{},size:Fr,tierSizes:Hr(Fr),lineHeight:Lr,weight:Ar,letterSpacing:jr,scale:1,maxScale:Or,scaleCaps:Rr,headingFamily:null,headingWeight:null,fontSources:$r,roles:Dr,typeScale:1}}var Vr={},qr=/* @__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 Ur={duration:{instant:80,fast:140,normal:220,slow:320},spring:{gentle:{damping:18,stiffness:200}},easing:{standard:cssCubicBezier(qr.standard),emphasized:cssCubicBezier(qr.emphasized),exit:cssCubicBezier(qr.exit)},reducedMotion:false},Kr={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)"},Yr=deepFreeze({brightness:"light",highContrast:false,meta:{displayName:"Everfur",logoUrl:null,placeholder:null,hidePoweredBy:false,assistantAvatarUrl:null},color:Kr,space:Er,radius:zr,type:Wr(),motion:Ur,slots:Vr}),Gr={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:Gr,space:Er,radius:zr,type:Wr(),motion:Ur,slots:Vr});var Jr=/* @__PURE__ */Symbol.for("@everfur/sdk#EverfurThemeContext@v1"),Qr=globalThis,Zr=Qr[Jr]??(Qr[Jr]=createContext(Yr));Zr.displayName??="EverfurThemeContext";function useEverfurTheme(){return s(Zr)}function Xr(e,t){let n=e.scaleCaps[t];return n>0?n:void 0}function Text({tier:e,variant:n,...r}){let l=useEverfurTheme(),i=n===void 0?void 0:l.type.roles[n],o=Xr(l.type,e??i?.tier??"content"),a=n===void 0?r:{...r,style:[{...textRole(l,n),color:l.color.text.primary,flexShrink:1},r.style]};return t(I,o===void 0?a:{maxFontSizeMultiplier:o,...a})}var el=e(function(e,n){return t(p,{...e,...n===null?{}:{ref:n}})});var tl=class extends c{constructor(){super(...arguments);this.state={failed:false,key:this.props.resetKey}}static getDerivedStateFromError(){return{failed:true}}static getDerivedStateFromProps(e,t){return Object.is(e.resetKey,t.key)?null:{failed:false,key:e.resetKey}}render(){return this.state.failed?this.props.fallback:this.props.children}};function RenderHost({render:e}){return e()}function HostRender({render:e,fallback:n,resetKey:r}){return t(tl,{fallback:n,resetKey:r,children:t(RenderHost,{render:e})})}var nl=48;function rl(e){return e.isPending?"pending":e.enabled?"enabled":"disabled"}function CapabilityGate(e){let{capability:t,children:r,renderDisabled:l,renderPending:i,style:o}=e,a=useCapability(t),s=n(()=>rl(a),[a]);switch(s){case"enabled":return r;case"pending":return i?/* @__PURE__ */E(HostRender,{render:i,fallback:/* @__PURE__ */E(PendingSkeleton,{capability:t,style:o})}):/* @__PURE__ */E(PendingSkeleton,{capability:t,style:o});case"disabled":return l?/* @__PURE__ */E(HostRender,{render:()=>l(a),fallback:/* @__PURE__ */E(OffState,{decision:a,style:o}),resetKey:a}):/* @__PURE__ */E(OffState,{decision:a,style:o});default:return assertNever(s)}}function PendingSkeleton({capability:e,style:t}){let r=useEverfurTheme(),l=n(()=>ll(r),[r]);/* @__PURE__ */
|
|
30
|
-
return E(f,{style:[l.offstate,t],accessible:true,accessibilityState:{busy:true},accessibilityLabel:`Loading ${e}`,children:/* @__PURE__ */E(f,{style:l.skeletonBar})})}function OffState({decision:e,style:t}){let r=useEverfurTheme(),l=n(()=>
|
|
31
|
-
return E(f,{style:[l.offstate,t],accessible:true,accessibilityRole:"text",accessibilityLabel:i,children:i.length>0?/* @__PURE__ */E(Text,{style:l.offstateText,children:i}):null})}function
|
|
32
|
-
return Object.freeze({profileVersion:typeof t=="number"&&Number.isInteger(t)&&t>=0?t:0,sex:
|
|
33
|
-
return Object.freeze({petRef:
|
|
34
|
-
return Object.freeze(t.flatMap(e=>{let t=widgetPetFromWire(e);return t===null?[]:[t]}))}function createPetsRepository(e){return
|
|
35
|
-
return Object.freeze([...
|
|
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
|
|
37
|
-
return Object.freeze({...e,index:t,furthestIndex:Math.max(e.furthestIndex,t)})}case"back":{if(
|
|
38
|
-
return Object.freeze({...e,index:l,furthestIndex:Math.max(e.furthestIndex,l)})}default:return e}}function
|
|
28
|
+
return Object.freeze({reason:userFacingError("accessDenied"),level:"user_entitlement",recoverable:false})}function er(e){let t={name:e.name,enabled:e.enabled,isPending:e.isPending,limits:/* @__PURE__ */Object.freeze({...e.limits})};return e.disabled!==void 0&&(t.disabled=e.disabled),/* @__PURE__ */Object.freeze(t)}function useCapability(e){let{runtime:t}=Jn(),r=t.entitlements,l=d(r.subscribe,r.getSnapshot,r.getSnapshot);return n(()=>decideCapability(e,l.decisions,{isPending:l.isPending}),[e,l])}var tr=/* @__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"})}),nr=60;var rr=/* @__PURE__ */Object.freeze({title:tr.rate_limited.title,body:tr.rate_limited.body});function lr(e){return e!=null&&(e.code==="rateLimited"||e.httpStatus===429)}function ir(e,t){return Ct(e,t)??nr*1e3}function or(e){let t=lr(e),[n,l]=r(null);return i(()=>{if(!t||e==null)return;let n=setTimeout(()=>l(e),ir(e,Date.now()));return()=>clearTimeout(n)},[e,t]),{rateLimited:t,waiting:t&&n!==e}}var ar=3e4;function sr(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&&lr(l.error)?(r.settled=l,r.keptUntil=t()+ir(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&&lr(s.error)))return Promise.resolve(s);let d={abort:new AbortController,promise:null,settled:null,keptUntil:0,waiters:0};return n.set(e,d),d.promise=t(d.abort.signal).then(t=>(i(e,d,t,o.freshMs),t),t=>{throw d.promise=null,n.get(e)===d&&n.delete(e),t}),l(e,d,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 dr=/* @__PURE__ */new WeakMap;function cr(e){let t=dr.get(e);return t===void 0&&(t=sr(),dr.set(e,t)),t}var ur=/* @__PURE__ */Object.freeze(["slots:","next-slot"]),pr=/* @__PURE__ */Object.freeze(["consults:","consult:","slots:","next-slot"]);function hr(e,t){dr.get(e)?.invalidate(t)}function useTelevetBookingController(e){let{runtime:t,userRef:userRef,scopeEpoch:r}=Jn();return n(()=>e||(userRef===null?null:mr(t,`${userRef}\0${r}`,()=>{let{services:e}=t.registry;return createTelevetBookingController({auth:e.authFor(userRef),telemetry:e.telemetry,...e.errorPolicy?{errorPolicy:e.errorPolicy}:{}})})),[t,userRef,r,e])}var fr=/* @__PURE__ */new WeakMap;function mr(e,t,n){let r=fr.get(e);if(r!==void 0&&r.scope===t)return r.controller;let l=n();return fr.set(e,{scope:t,controller:l}),l}function useTelevetBookingAvailable(){let{userRef:userRef}=Jn(),e=useCapability("televet");return n(()=>({available:e.enabled&&userRef!==null,isPending:e.isPending}),[e.enabled,e.isPending,userRef])}function gr(e,t,a,s,d=ar,c=false){let[u,p]=r(()=>{let n=t&&a!==null&&s!==null&&!c?cr(s).peek(e):null;return n!==null?n.ok?{key:e,data:n.value,isPending:false,error:null}:{key:e,data:null,isPending:false,error:n.error}:{key:e,data:null,isPending:t&&a!==null,error:null}}),[h,f]=r(0),m=l(a);m.current=a;let g=l(s);g.current=s;let y=l(c);i(()=>{let n=m.current;if(!t||n===null){p({key:e,data:null,isPending:false,error:null});return}let r=y.current;y.current=false;let l=g.current===null?null:cr(g.current),i=r||l===null?null:l.peek(e);if(i!==null){p(i.ok?{key:e,data:i.value,isPending:false,error:null}:{key:e,data:null,isPending:false,error:i.error});return}let o=new AbortController,a=true;return p(t=>t.key===e?{...t,isPending:true,error:null}:{key:e,data:null,isPending:true,error:null}),(async()=>{let t;try{t=l===null?await n(o.signal):await l.read(e,n,{signal:o.signal,freshMs:d,force:r})}catch{a&&p({key:e,data:null,isPending:false,error:null});return}a&&(t.ok?p({key:e,data:t.value,isPending:false,error:null}):p({key:e,data:null,isPending:false,error:t.error}))})(),()=>{a=false,o.abort()}},[e,t,h]);let b=o(()=>{y.current=true,f(e=>e+1)},[]),v=u.key===e;return n(()=>({enabled:t,data:v?u.data:null,isPending:t&&(!v||u.isPending),isError:v&&u.error!==null,error:v?u.error:null,refetch:b}),[t,v,u.data,u.isPending,u.error,b])}function useTelevetStatePolicy(e,t){let n=e?.trim()??"",r=t?.statePolicy!==void 0&&isWellFormedStateCode(n),l=t?.statePolicy;return gr(`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 gr("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 gr("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 gr(`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 gr(`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 gr("next-slot",t,t&&n?t=>n.call(e,t):null,e)}function yr(e){let[t,a]=r(null),s=l(true),d=l(false),c=l(e);c.current=e,i(()=>(s.current=true,()=>{s.current=false}),[]);let u=o((...e)=>{let t=c.current;if(t===null||d.current)return;let n=e[e.length-1],r=typeof n=="object"&&n!==null&&("onSuccess"in n||"onError"in n),l=r?n:void 0,i=r?e.slice(0,-1):e;d.current=true,a({variables:i[0]??null}),(async()=>{let e=null;try{e=await t(...i)}catch{e=null}d.current=false,s.current&&a(null),e!==null&&(e.ok?l?.onSuccess?.(e.value):l?.onError?.(e.error))})()},[]);return n(()=>({isPending:t!==null,variables:t?.variables??null,mutate:u}),[t,u])}async function br(e,t,n){let r=await n;return r.ok&&hr(e,t),r}function useTelevetHoldSlot(e){return yr(e?t=>br(e,ur,e.holdSlot(t)):null)}function useTelevetBookConsult(e){return yr(e?(t,n)=>br(e,pr,e.book(t,n)):null)}function useTelevetRescheduleConsult(e,t){return yr(t&&e?n=>br(t,pr,t.reschedule(e,n)):null)}function vr(e,t=0,n){let r=e?.listConsults!==void 0,l=e?.listConsults;return gr(`consults:${t}`,r,r&&l?t=>l.call(e,t):null,e,ar,n?.reread===true)}function Tr(e,t,n=0){let r=e?.trim()??"",l=t?.getConsult!==void 0&&r.length>0,i=t?.getConsult;return gr(`consult:${r}:${n}`,l,l&&i?e=>i.call(t,r,e):null,t)}function kr(e,t){let n=t?.cancelConsult;return yr(t&&n&&e?r=>br(t,pr,n.call(t,e,r)):null)}function wr(e){return e.error!==null&&e.error.httpStatus===404}function Cr(e){let t=vr(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 Sr=/* @__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[Sr[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[Sr[t]]};let l=face(e,t);return l.fontWeight===void 0||r===null?l:{fontFamily:l.fontFamily,fontWeight:r}}function _r(e){return e<=450?"regular":e<=650?"medium":"bold"}var xr={regular:"mono",medium:"monoMedium",bold:"monoBold"};function textRole(e,t){let n=Ir.get(e);n===void 0&&(n=/* @__PURE__ */new Map,Ir.set(e,n));let r=n.get(t);if(r!==void 0)return r;let l=Dr(e,t);return n.set(t,l),l}var Ir=/* @__PURE__ */new WeakMap;function Dr(e,t){let n=e.type.roles[t],r=n.weight==="400"&&n.face!=="mono"?e.type.weight.regular:n.weight,l=_r(Number(r)),i=n.face==="mono"?face(e,xr[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,d={...a,fontSize:s,lineHeight:Math.round(s*n.lineHeight*100)/100};return n.letterSpacing!==0&&(d.letterSpacing=Math.round(s*n.letterSpacing*100)/100),n.uppercase&&(d.textTransform="uppercase"),/* @__PURE__ */Object.freeze(d)}var Pr=/* @__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 Rr=Object.freeze;function deepFreeze(e){if(e!==null&&typeof e=="object"&&!Object.isFrozen(e)){Rr(e);for(let t of Object.keys(e))deepFreeze(e[t])}return e}var Er=/* @__PURE__ */Object.freeze({content:0,heading:2,control:1.8,compact:1.5,badge:1.3});var zr={xs:4,sm:8,md:12,lg:16,xl:24,xxl:32},Fr={tile:5,xs:6,sm:10,md:14,lg:20,xl:28,pill:500},Lr={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},jr={regular:"400",medium:"500",bold:"700"},Or={eyebrow:1,monoWide:.9,headerBrand:-.42,tight:-.35},Nr=0,Br="System",Hr="monospace",Mr=["content","heading","control","compact","badge"];function $r(e){let t={};for(let n of Mr)t[n]=e;return t}var Wr=[];function Vr(){return{family:Br,mono:Hr,fontUrl:null,families:{regular:Br,medium:Br,bold:Br,mono:Hr,monoMedium:Hr,monoBold:Hr},namedFaces:{regular:false,medium:false,bold:false,mono:false,monoMedium:false,monoBold:false},fontUrls:{},size:Lr,tierSizes:$r(Lr),lineHeight:Ar,weight:jr,letterSpacing:Or,scale:1,maxScale:Nr,scaleCaps:Er,headingFamily:null,headingWeight:null,fontSources:Wr,roles:Pr,typeScale:1}}var qr={},Ur=/* @__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 Kr={duration:{instant:80,fast:140,normal:220,slow:320},spring:{gentle:{damping:18,stiffness:200}},easing:{standard:cssCubicBezier(Ur.standard),emphasized:cssCubicBezier(Ur.emphasized),exit:cssCubicBezier(Ur.exit)},reducedMotion:false},Yr={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)"},Gr=deepFreeze({brightness:"light",highContrast:false,meta:{displayName:"Everfur",logoUrl:null,placeholder:null,hidePoweredBy:false,assistantAvatarUrl:null},color:Yr,space:zr,radius:Fr,type:Vr(),motion:Kr,slots:qr}),Jr={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:Jr,space:zr,radius:Fr,type:Vr(),motion:Kr,slots:qr});var Qr=/* @__PURE__ */Symbol.for("@everfur/sdk#EverfurThemeContext@v1"),Zr=globalThis,Xr=Zr[Qr]??(Zr[Qr]=createContext(Gr));Xr.displayName??="EverfurThemeContext";function useEverfurTheme(){return s(Xr)}function el(e,t){let n=e.scaleCaps[t];return n>0?n:void 0}function Text({tier:e,variant:n,...r}){let l=useEverfurTheme(),i=n===void 0?void 0:l.type.roles[n],o=el(l.type,e??i?.tier??"content"),a=n===void 0?r:{...r,style:[{...textRole(l,n),color:l.color.text.primary,flexShrink:1},r.style]};return t(I,o===void 0?a:{maxFontSizeMultiplier:o,...a})}var tl=e(function(e,n){return t(p,{...e,...n===null?{}:{ref:n}})});var nl=class extends c{constructor(){super(...arguments);this.state={failed:false,key:this.props.resetKey}}static getDerivedStateFromError(){return{failed:true}}static getDerivedStateFromProps(e,t){return Object.is(e.resetKey,t.key)?null:{failed:false,key:e.resetKey}}render(){return this.state.failed?this.props.fallback:this.props.children}};function RenderHost({render:e}){return e()}function HostRender({render:e,fallback:n,resetKey:r}){return t(nl,{fallback:n,resetKey:r,children:t(RenderHost,{render:e})})}var rl=48;function ll(e){return e.isPending?"pending":e.enabled?"enabled":"disabled"}function CapabilityGate(e){let{capability:t,children:r,renderDisabled:l,renderPending:i,style:o}=e,a=useCapability(t),s=n(()=>ll(a),[a]);switch(s){case"enabled":return r;case"pending":return i?/* @__PURE__ */E(HostRender,{render:i,fallback:/* @__PURE__ */E(PendingSkeleton,{capability:t,style:o})}):/* @__PURE__ */E(PendingSkeleton,{capability:t,style:o});case"disabled":return l?/* @__PURE__ */E(HostRender,{render:()=>l(a),fallback:/* @__PURE__ */E(OffState,{decision:a,style:o}),resetKey:a}):/* @__PURE__ */E(OffState,{decision:a,style:o});default:return assertNever(s)}}function PendingSkeleton({capability:e,style:t}){let r=useEverfurTheme(),l=n(()=>il(r),[r]);/* @__PURE__ */
|
|
30
|
+
return E(f,{style:[l.offstate,t],accessible:true,accessibilityState:{busy:true},accessibilityLabel:`Loading ${e}`,children:/* @__PURE__ */E(f,{style:l.skeletonBar})})}function OffState({decision:e,style:t}){let r=useEverfurTheme(),l=n(()=>il(r),[r]),i=e.disabled?.reason??"";/* @__PURE__ */
|
|
31
|
+
return E(f,{style:[l.offstate,t],accessible:true,accessibilityRole:"text",accessibilityLabel:i,children:i.length>0?/* @__PURE__ */E(Text,{style:l.offstateText,children:i}):null})}function il(e){let{color:t,space:n,radius:r,type:l}=e;return h.create({offstate:{minHeight:rl,justifyContent:"center",paddingHorizontal:n.lg,paddingVertical:n.md,backgroundColor:t.surfaceCream,borderRadius:r.md,borderWidth:h.hairlineWidth,borderColor:t.brandBorder},offstateText:{...face(e,"regular"),fontSize:l.size.body,lineHeight:Math.round(l.size.body*l.lineHeight.normal),color:t.text.muted},skeletonBar:{height:n.md,borderRadius:r.xs,backgroundColor:t.brandSofter}})}function ol(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 al(e){return[...e].length}var sl=/* @__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(sl,t)?sl[t]:null}var dl=50,cl=128,ul=120,pl=120,hl=2e3,fl=120,ml=80,gl=/* @__PURE__ */new Set(["male","female","unknown"]),yl=/* @__PURE__ */new Set(["day","month","year"]),bl=/* @__PURE__ */new Set(["low","medium","high","athletic"]),vl=/* @__PURE__ */new Set(["indoor","outdoor","both"]),Tl=/* @__PURE__ */new Set(["mild","moderate","severe"]),kl=/^(\d{4})-(\d{2})-(\d{2})$/,wl=[["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"]],Cl=[["allergies","allergies"],["medications","medications"],["supplements","supplements"],["conditions","conditions"]];/* @__PURE__ */Object.freeze([...wl,...Cl].map(([e])=>e));function Sl(e){let t=kl.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 _l=e=>(t,n)=>typeof n=="string"&&e.has(n)?null:`${t} must be one of ${[...e].join(", ")}`,xl=(e,t)=>typeof t=="boolean"?null:`${e} must be true or false`,Il=(e,t)=>typeof t=="string"&&Sl(t)?null:`${e} must be a real date written YYYY-MM-DD`,Dl=(e,t={})=>(n,r)=>{if(typeof r!="string")return`${n} must be a string`;if(ol(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=al(l);return i<=e?null:`${n} is ${i} characters; the server accepts at most ${e}`},Pl={sex:_l(gl),spayedNeutered:xl,birthDate:Il,birthDatePrecision:_l(yl),activityLevel:_l(bl),indoorOutdoor:_l(vl),foodBrand:Dl(fl),foodType:Dl(fl),microchipId:Dl(ml)},Rl=["ref","ref",false,Dl(cl,{required:true,trimmed:true})],El=["notes","notes",false,Dl(hl,{trimmed:true})],zl=[Rl,["name","name",true,Dl(ul,{required:true,trimmed:true})],["dose","dose",false,Dl(pl,{trimmed:true})],["frequency","frequency",false,Dl(pl,{trimmed:true})],["startDate","start_date",false,Il],["endDate","end_date",false,Il],El],Fl={allergies:[Rl,["allergen","allergen",true,Dl(ul,{required:true,trimmed:true})],["severity","severity",false,_l(Tl)],El],medications:zl,supplements:zl,conditions:[Rl,["conditionName","condition_name",true,Dl(ul,{required:true,trimmed:true})],["diagnosedDate","diagnosed_date",false,Il],El]};function Ll(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 Fl[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>dl)return{error:`${e} has ${t.length} items; the server accepts at most ${dl}`};let n=[],r=/* @__PURE__ */new Set;for(let l=0;l<t.length;l+=1){let i=Ll(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 jl(e,t){let n=e,r={};for(let[e,t]of wl){let l=n[e];if(l!==void 0){if(l!==null){let t=Pl[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 Cl){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 Ol=e=>typeof e=="string"?e:null,Nl=(e,t)=>typeof t=="string"&&e.has(t)?t:null,Bl=e=>typeof e=="boolean"?e:null;function Hl(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 Ml(e){let t=Ol(e.name);return t===null||t.length===0?null:/* @__PURE__ */Object.freeze({ref:Ol(e.ref),name:t,dose:Ol(e.dose),frequency:Ol(e.frequency),startDate:Ol(e.start_date),endDate:Ol(e.end_date),notes:Ol(e.notes)})}function $l(e){let t=e.profile_version;/* @__PURE__ */
|
|
32
|
+
return Object.freeze({profileVersion:typeof t=="number"&&Number.isInteger(t)&&t>=0?t:0,sex:Nl(gl,e.sex),spayedNeutered:Bl(e.spayed_neutered),birthDate:Ol(e.birth_date),birthDatePrecision:Nl(yl,e.birth_date_precision),activityLevel:Nl(bl,e.activity_level),indoorOutdoor:Nl(vl,e.indoor_outdoor),foodBrand:Ol(e.food_brand),foodType:Ol(e.food_type),microchipId:Ol(e.microchip_id),allergies:Hl(e.allergies,e=>{let t=Ol(e.allergen);return t===null||t.length===0?null:/* @__PURE__ */Object.freeze({ref:Ol(e.ref),allergen:t,severity:Nl(Tl,e.severity),notes:Ol(e.notes)})}),medications:Hl(e.medications,Ml),supplements:Hl(e.supplements,Ml),conditions:Hl(e.conditions,e=>{let t=Ol(e.condition_name);return t===null||t.length===0?null:/* @__PURE__ */Object.freeze({ref:Ol(e.ref),conditionName:t,diagnosedDate:Ol(e.diagnosed_date),notes:Ol(e.notes)})})})}var Wl=100,Vl=50,ql=100,Ul=50,Kl=500,Yl=128,Gl=6e4;function Jl(e){return makeEverfurError("validationFailed",{retryable:false,wireMessage:e})}function Ql(e,t,n){if(typeof t!="string")return Jl(`${e} must be a string`);let r=al(t);return r<=n?null:Jl(`${e} is ${r} characters; the server accepts at most ${n}`)}function Zl(e,t,n){return typeof t=="number"&&Number.isFinite(t)&&t>=0&&t<=n?null:Jl(`${e} must be a finite number between 0 and ${n}`)}function Xl(petRef,e){if(typeof petRef!="string")return Jl("pet_ref must be a string");if(petRef.trim().length===0)return Jl("pet_ref must not be blank");if(ol(petRef))return Jl("pet_ref contains an unpaired surrogate and cannot be encoded");if(e!=null&&typeof e!="object")return Jl("profile must be an object");let t=[Ql("pet_ref",petRef,Yl)];return e?.name!==void 0&&t.push(Ql("name",e.name,Wl)),e?.species!==void 0&&t.push(Ql("species",e.species,Vl)),e?.breed!==void 0&&t.push(Ql("breed",e.breed,ql)),e?.ageYears!==void 0&&t.push(Zl("age_years",e.ageYears,Ul)),e?.weightKg!==void 0&&t.push(Zl("weight_kg",e.weightKg,Kl)),t.find(e=>e!==null)??null}function ei(e,t){let n=jl(e,t);return"error"in n?{error:Jl(n.error)}:n}function ti(e){if(typeof e!="object"||e===null)return{error:Jl("patch must be an object")};let t=e,n=[["name","name",e=>Ql("name",e,Wl)],["species","species",e=>Ql("species",e,Vl)],["breed","breed",e=>Ql("breed",e,ql)],["ageYears","age_years",e=>Zl("age_years",e,Ul)],["weightKg","weight_kg",e=>Zl("weight_kg",e,Kl)]],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=ei(t,t.species);return"error"in l?l:(Object.assign(r,l.body),Object.keys(r).length===0?{error:Jl("patch must change at least one field")}:{body:r})}function ni(e){if(e==null)return{body:{}};let t=ei(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 ri=e=>typeof e=="string"?e:null,li=e=>typeof e=="number"&&Number.isFinite(e)?e:null;function ii(e,petRef){let t=typeof e=="object"&&e!==null?e:{};/* @__PURE__ */
|
|
33
|
+
return Object.freeze({petRef:ri(t.pet_ref)??petRef,name:ri(t.name),species:ri(t.species),breed:ri(t.breed),ageYears:li(t.age_years),weightKg:li(t.weight_kg)})}function widgetPetFromWire(e){if(typeof e!="object"||e===null)return null;let t=e,petRef=ri(t.pet_ref);return petRef===null||petRef.length===0?null:/* @__PURE__ */Object.freeze({petId:ri(t.pet_id),petRef:petRef,name:ri(t.name),species:ri(t.species),breed:ri(t.breed),ageYears:li(t.age_years),weightKg:li(t.weight_kg),updatedAt:ri(t.updated_at)})}function oi(e){let t=widgetPetFromWire(e);return t===null?null:/* @__PURE__ */Object.freeze({...t,...$l(e)})}function ai(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 si(createRequestFunnel({auth:e}),createRequestFunnel({auth:e,unaryTimeoutMs:Gl}))}function si(e,t=e){let n=(e,t)=>t?{...e,signal:t}:e,r=petRef=>Xl(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(ai(r.value)):err(r.error)},async registerPet(petRef,t,n){let r=Xl(petRef,t);if(r!==null)return err(r);let l=ni(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(ii(o.value,petRef)):err(o.error)},async updatePet(petRef,t,l){let i=r(petRef);if(typeof i!="string")return err(i);let o=ti(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(ii(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=oi(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 di=/* @__PURE__ */new WeakMap;function ci(e,t){let n=di.get(e);return n===void 0&&(n=/* @__PURE__ */new Set,di.set(e,n)),n.add(t),()=>{n?.delete(t)}}function useEverfurPets(){let{runtime:e,userRef:userRef,activePet:t,scopeEpoch:a}=Jn(),s=n(()=>createPetsRepository(e.registry.services.authFor(userRef)),[e,userRef,a]),[d,c]=r({repository:s,pets:[],loading:true,error:null}),u=d.repository===s?d:{pets:[],loading:true,error:null},p=l(0),h=o(async()=>{let e=++p.current;c(e=>({...e,repository:s,loading:true,error:null,pets:e.repository===s?e.pets:[]}));let t=await s.list();e===p.current&&c(t.ok?{repository:s,pets:t.value,loading:false,error:null}:e=>({repository:s,pets:e.repository===s?e.pets:[],loading:false,error:t.error}))},[s]);i(()=>(h(),()=>{p.current+=1}),[h]),i(()=>ci(e,()=>{h()}),[e,h]);let f=n(()=>t===null?null:u.pets.find(e=>e.petRef===t)??null,[t,u.pets]);return n(()=>({pets:u.pets,activePet:f,loading:u.loading,error:u.error,refresh:h}),[u.pets,u.loading,u.error,f,h])}var ui=/* @__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))),pi="other";function hi(e){/* @__PURE__ */
|
|
35
|
+
return Object.freeze([...ui/* @__PURE__ */,Object.freeze({id:pi,label:De.otherIssue})])}function fi(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 mi=/* @__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 gi(e){let t=e?.trim().toUpperCase()??"";return mi.find(e=>e.code===t)?.name??t}function yi(e,t){return e?e.wellnessAvailable?e.prescriptionsAvailable?Ie(De.wherePrescribeMetaTemplate,{pet:t}):De.whereWellnessMeta:De.stateBlockedTitle:null}function bi(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)?Ie(De.whereLicensedTemplate,{vet:e.displayName,state:gi(l),pet:r}):null}function vi(e){let{hostState:t,state:n,policy:l,clinician:i,petName:a,controller:s,onState:d}=e,c=t&&isWellFormedStateCode(t)?t.trim().toUpperCase():null,u=n&&isWellFormedStateCode(n)?n.trim().toUpperCase():null,p=useTelevetStatePolicy(c,s),[h,f]=r(c===null||u!==null&&u!==c),m=c===null||h,g=o(()=>{c!==null&&(f(false),d(c))},[c,d]),y=o(()=>{f(true),u===c&&d(null)},[u,c,d]),b=o(e=>{f(true),d(e.trim().toUpperCase())},[d]),v=c===null?null:{code:c,name:gi(c),meta:yi(p.data,a)},T=m&&u!==null&&(c===null||u!==c||h)?u:null,k=T===null?null:{code:T,name:gi(T),meta:yi(l.data,a)};return{hostPlace:v,otherSelected:m,otherPlace:k,licensedLine:bi(i,l.data,u,a),stateName:u===null?null:gi(u),canContinue:u!==null,pickHost:g,pickOther:y,pickState:b}}function Ti(e){let{reasonText:t,state:i,hostState:a,clinicianId:s,clinicians:d,policy:c,petName:u,controller:p,dispatch:h}=e,[f,m]=r([]),[g,y]=r(null),b=l(false),v=n(()=>hi(),[]),T=f.map(e=>v.find(t=>t.id===e)?.label??"").filter(Boolean),k=fi(T,t),w=T.length>0?T.join(", "):t.trim(),C=o(e=>m(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e]),[]),S=d?.find(e=>e.clinicianId===s)??d?.[0]??null,_=vi({hostState:a,state:i,policy:c,clinician:S,petName:u??De.petFallback,controller:p,onState:o(e=>{b.current=true,h({type:"patch",patch:{state:e,clinicianId:null}})},[h])});return{issueChips:v,concernIds:f,toggleConcern:C,composedReason:k,aboutLine:w,emergencyAnswer:g,setEmergencyAnswer:y,where:_,matchedClinician:S,whereTouched:b}}var ki=/* @__PURE__ */Object.freeze(["pet","where","issues","reason","emergency","clinician","time","review","booked"]),wi=/* @__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({...wi,...t}),r=Si(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 Ci(e){return ki[e]}function Si(e,t){for(let n=e;n<ki.length;n+=1){let e=Ci(n);if(e&&!isSkipped(e,t))return n}return ki.length-1}function _i(e,t){for(let n=e;n>=0;n-=1){let e=Ci(n);if(e&&!isSkipped(e,t))return n}return null}function hasPreviousStep(e,t){return _i(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=Si(e.index+1,n);/* @__PURE__ */
|
|
37
|
+
return Object.freeze({...e,index:t,furthestIndex:Math.max(e.furthestIndex,t)})}case"back":{if(Ci(e.index)==="booked")return e;let t=_i(e.index-1,n);return t===null?e:/* @__PURE__ */Object.freeze({...e,index:t})}case"goTo":{let r=ki.indexOf(t.step);if(r<0)return e;let l=isSkipped(t.step,n)?Si(r,n):r;/* @__PURE__ */
|
|
38
|
+
return Object.freeze({...e,index:l,furthestIndex:Math.max(e.furthestIndex,l)})}default:return e}}function xi(e){return ki.filter(t=>t!=="booked"&&(e===void 0||!isSkipped(t,e)))}function Ii(e,t,n=false){let r=e==="reason"&&n?"emergency":e,l=r==="booked"||t.includes(r)?t:xi();return{current:r==="booked"?l.length:l.indexOf(r)+1,total:l.length,steps:l}}function currentStep(e){return Ci(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<=V}function isHoldExpired(e,t){if(!e.holdExpiresAt)return false;let n=Date.parse(e.holdExpiresAt);return Number.isNaN(n)?false:n<=t}function Di(e,t,n){return e.slot?.slotId!==t||e.holdExpiresAt===null||e.idempotencyKey===null?false:!isHoldExpired(e,n)}var Pi=/* @__PURE__ */Object.freeze({slot:null,holdExpiresAt:null,idempotencyKey:null}),Ri=vt();function televetBookingKey(e){return`televet.book.${Ri()}.${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 Ei(e){let t=new Date(e);return Number.isNaN(t.getTime())?null:t}function zi(e){let t=Ei(e);return t?t.toLocaleTimeString(void 0,{hour:"numeric",minute:"2-digit"}):""}function Fi(e){let t=Ei(e);return t?t.toLocaleDateString(void 0,{month:"long",day:"numeric"}):""}function Li(e){let t=Ei(e);return t?t.toLocaleDateString(void 0,{weekday:"short",month:"short",day:"numeric"}):""}var Ai=10;function ji(e){let t=Ei(e);return t?new Intl.DateTimeFormat(void 0,{timeZoneName:"short"}).formatToParts(t).find(e=>e.type==="timeZoneName")?.value??"":""}function formatVisitRange(e){let t=Ei(e);if(!t)return"";let n=new Date(t.getTime()+Ai*6e4).toISOString(),r=ji(e),l=`${zi(e)} - ${zi(n)}`;return r&&r!==""?`${l} ${r}`:l}function formatWhen(e){let t=Fi(e),n=[zi(e),ji(e)].filter(Boolean).join(" ");return[t,n].filter(Boolean).join(", ")}function formatWhenWithDay(e){let t=Ei(e);return t?[t.toLocaleDateString(void 0,{weekday:"short"}),formatWhen(e)].filter(Boolean).join(", "):""}function Oi(e){let t=Ei(e);if(!t)return"";let n=t.toLocaleDateString(void 0,{weekday:"short"}),r=t.toLocaleDateString(void 0,{year:"numeric",month:"long",day:"numeric"}),l=[zi(e),ji(e)].filter(Boolean).join(" ");return[n,r,l].filter(Boolean).join(", ")}function Ni(e){return[zi(e),ji(e)].filter(Boolean).join(" ")}function Bi(e){let t=Ei(e);return t?`${t.getFullYear()}-${t.getMonth()+1}-${t.getDate()}`:"unknown"}function Hi(e){let t=Ei(e);return t===null?"":t.toLocaleDateString(void 0,{month:"long"})}function Mi(e){let t=Ei(e);return t===null?"":t.toLocaleDateString(void 0,{weekday:"long",month:"long",day:"numeric"})}function $i(e){return e.toLocaleDateString(void 0,{weekday:"short",month:"short",day:"numeric"})}function Wi(e){let t=Ei(e);return t?[$i(t),Ni(e)].filter(Boolean).join(" · "):""}function Vi(e){return Ei(e)?`${Mi(e)} at ${Ni(e)}`:""}function qi(e,t=false){let n=Ei(e);return n?`${$i(n)} at ${t?Ni(e):zi(e)}`:""}function Ui(e){let t=Ei(e),n=t===null?0:t.getHours();return n<12?"morning":n<17?"afternoon":"evening"}function Ki(e){let{draft:t,reasonText:n,book:r,stateAttested:l,termsAttested:i,cancellationPolicy:a,triage:s,goTo:d,releaseSlot:c,setFailure:u,setEmergency:p,setBookedConsult:h,onBooked:f,media:m}=e,g=o(e=>{let o=t.idempotencyKey;if(!canConfirm(t,n)||!o||m?.sending)return;if(isHoldExpired(t,Date.now())){u("expired"),d("time");return}let g=e=>{let t=televetBookingRefusal(e);if(t.kind==="emergency"){p(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"&&(c(),d("time"))};u(null),p(null);let y=c=>r.mutate({pet_id:t.petId,clinician_id:t.clinicianId,slot_id:t.slot.slotId,state:t.state,reason_text:n.trim(),species:null,media_refs:c,emergency_acknowledged:e||s.isAcknowledged(n),share_health_records:t.shareHealthRecords,...attestation(l,i,a)},o,{onSuccess:e=>{if(!B(e)){g(Vt(e.status));return}h(e),d("booked"),f?.(e)},onError:e=>g(Kt(e))});if(!m){y([]);return}m.send().then(y,()=>y([]))},[t,n,r,l,i,a,s,d,c,u,p,h,f,m]),y=o(()=>g(false),[g]);return{submitBooking:g,confirm:y}}function Yi(e){return e.slot!==null&&e.holdExpiresAt!==null&&e.idempotencyKey!==null?e.slot.slotId:null}function Gi({controller:e,draft:t,keep:n}){let r=Yi(t),o=l({controller:e,keep:n});o.current={controller:e,keep:n};let a=l(null);i(()=>{let e=a.current;a.current=r,e!==null&&e!==r&&Ji(o.current,e)},[r]),i(()=>()=>{let e=a.current;a.current=null,e!==null&&Ji(o.current,e)},[])}function Ji(e,t){if(e.keep)return;let n=e.controller,r=n?.releaseHold;n==null||r===void 0||r.call(n,t).catch(()=>{}).finally(()=>hr(n,ur))}function Qi(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
|
|
44
|
-
return Object.freeze(e==="dark"?{title:De.noCliniciansTitle,message:De.noCliniciansBody,retryLabel:De.noCliniciansRetryCta,interestReason:null}:{title:De.noCliniciansTitle,message:De.noCliniciansRegionBody,retryLabel:null,interestReason:"no_licensed_vet"})}function televetEmptyRosterCause(e){return e?"roster":"dark"}var
|
|
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
|
|
46
|
-
return Object.freeze({postMultipart(t,n,r){if(typeof n.uri!="string"||n.uri.length===0)return Promise.reject(new Error(
|
|
43
|
+
return Object.freeze({failure:"failed"})}}function Zi(e){let{draft:t,hold:n,dispatch:r,setFailure:l,refetchSlots:i}=e;return o(e=>{if(l(null),Di(t,e.slotId,Date.now())){r({type:"next"});return}n.mutate(e.slotId,{onSuccess:t=>{r({type:"patch",patch:{slot:e,holdExpiresAt:t.expiresAt,idempotencyKey:televetBookingKey(e.slotId)}}),r({type:"next"})},onError:e=>{let t=Qi(e);l(t.failure),t.failure==="taken"&&i()}})},[t,n,r,l,i])}function Xi(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(e){let[t,n]=r(false),[a,s]=r(false),[d,c]=r(null),u=l(null),p=l(null),h=l(true);i(()=>(h.current=true,()=>{h.current=false,p.current?.abort(),p.current=null}),[]);let f=o(()=>{p.current?.abort(),p.current=null,h.current&&s(false)},[]),m=o(async t=>{if(p.current!==null)return false;let r=t.trim();if(d!==null&&d===r||!e)return true;let l=u.current!==null&&u.current.reason===r?u.current.emergency:null;if(l===null){let t=new AbortController;p.current=t,s(true);try{let n=await e(r,t.signal);if(t.signal.aborted||!h.current)return!1;n===null?l=!1:(l=n.isEmergency||n.fallback,u.current=/* @__PURE__ */Object.freeze({reason:r,emergency:l}))}catch{if(t.signal.aborted||!h.current)return false;l=false}finally{p.current===t&&(p.current=null,h.current&&s(false))}}return l===true?(n(true),false):true},[d,e]),g=o(e=>{c(e.trim()),n(false)},[]),y=o(()=>n(false),[]),b=o(()=>{f(),u.current=null,c(null),n(false)},[f]),v=o(e=>d!==null&&d===e.trim(),[d]);return{open:t,checking:a,check:m,acknowledge:g,close:y,cancel:f,reset:b,isAcknowledged:v}}function eo(e){let t=e?.trim().toUpperCase()??"";return/^[A-Z]{2}$/.test(t)?t:null}function useStateInterest(e,t){let i=eo(e),[a,s]=r(()=>/* @__PURE__ */Object.freeze({})),d=l(0),c=l(null),u=o(e=>{if(!t||i===null)return null;let n=`${i}:${e}`;c.current!==null&&c.current!==n&&(d.current+=1),c.current=n;let r=a[n]??"idle";return{joined:r==="joined",pending:r==="pending",failed:r==="failed",onPress:()=>{if(r==="pending"||r==="joined")return;let l=d.current+=1;s(e=>/* @__PURE__ */Object.freeze({...e,[n]:"pending"})),(async()=>{let r=false;try{r=await t(i,e)}catch{r=false}d.current===l&&s(e=>/* @__PURE__ */Object.freeze({...e,[n]:r?"joined":"failed"}))})()}}},[i,a,t]);return n(()=>({actionFor:u}),[u])}function televetEmptyRosterView(e){/* @__PURE__ */
|
|
44
|
+
return Object.freeze(e==="dark"?{title:De.noCliniciansTitle,message:De.noCliniciansBody,retryLabel:De.noCliniciansRetryCta,interestReason:null}:{title:De.noCliniciansTitle,message:De.noCliniciansRegionBody,retryLabel:null,interestReason:"no_licensed_vet"})}function televetEmptyRosterCause(e){return e?"roster":"dark"}var to=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<=to)return t;let n=t.lastIndexOf(".");if(n===-1||n===t.length-1)return t.slice(0,to);let r=t.slice(n);return r.length>=to?t.slice(0,to):`${t.slice(0,n).slice(0,to-r.length)}${r}`}var no=e=>/* @__PURE__ */Object.freeze({ok:true,value:e}),ro=e=>/* @__PURE__ */Object.freeze({ok:false,error:e});function lo(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 ro(lo("cancelled",true,n.filename));try{return await e.postMultipart(t,n.file,{...r?.signal?{signal:r.signal}:{},...r?.onProgress?{onProgress:r.onProgress}:{}}),no(void 0)}catch{return l()?ro(lo("cancelled",true,n.filename)):ro(lo("server",true,n.filename))}}var io=/* @__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=De.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=>Ie(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?io:/* @__PURE__ */Object.freeze({failed:t,refused:io.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 oo=6e4;function ao(e){let t=Nt(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 so(e,t){if(e?.kind!=="ready")return null;let n=e.policy.expires_in_seconds*1e3;return t-e.at<n-oo?e.policy:null}function co({media:e,controller:t,transport:a}){let[s,d]=r(()=>/* @__PURE__ */new Map),[c,u]=r(false),[p,h]=r(false),f=l(s),m=l(e);m.current=e;let g=l(false),y=l(false),b=l(new AbortController);i(()=>{let e=new AbortController;return b.current=e,()=>e.abort()},[]);let v=t?.initiateAttachment?.bind(t),T=c||v===void 0,k=o((e,t)=>{let n=new Map(f.current);n.set(e,t),f.current=n,d(n)},[]),w=o(()=>{g.current=true,u(true)},[]),C=o(async(e,t)=>{if(v===void 0)return"dark";let n=await v({filename:t.filename,contentType:t.contentType,fileSize:t.sizeBytes},b.current.signal);if(b.current.signal.aborted)return null;if(n.ok)return k(e.uri,{kind:"ready",policy:n.value,at:Date.now()}),n.value;let r=$t(n.error);return r==="dark"?"dark":(k(e.uri,r==="failed"?{kind:"retry"}:{kind:"refused",cause:r}),null)},[v,k]);i(()=>{if(!T)for(let t of e){if(f.current.has(t.uri))continue;let e=Bt(t),n=ao(t);if(e!==null||n===null){k(t.uri,{kind:"refused",cause:e??"type"});continue}k(t.uri,{kind:"checking"}),C(t,n).then(e=>{e==="dark"&&w()})}},[e,T,C,k,w]);let S=o(async()=>{if(g.current||v===void 0||y.current)return[];y.current=true,h(true);let e=[];try{for(let t of m.current){let n=f.current.get(t.uri);if(n?.kind==="sent"){e.push(n.s3Key);continue}if(n?.kind==="refused")continue;let r=ao(t);if(r===null)continue;let l=so(n,Date.now());if(l===null){let e=await C(t,r);if(e==="dark")return w(),[];if(e===null){f.current.get(t.uri)?.kind==="retry"&&k(t.uri,{kind:"failed"});continue}l=e}if(b.current.signal.aborted)return[];let i=await uploadAttachmentBytes(a,l,r,{signal:b.current.signal});if(b.current.signal.aborted)return[];i.ok?(k(t.uri,{kind:"sent",s3Key:l.s3_key}),e.push(l.s3_key)):k(t.uri,{kind:"failed"})}return e}catch{return e}finally{y.current=false,b.current.signal.aborted||h(false)}},[v,C,k,w,a]),_=n(()=>{if(e.length===0)return io;if(T)return mediaShortfallFromUnsentPicks(e.length);let t={size:0,type:0,unreadable:0},n=0;for(let r of e){let e=s.get(r.uri);e?.kind==="refused"?t[e.cause]+=1:e?.kind==="failed"&&(n+=1)}return n===0&&t.size+t.type+t.unreadable===0?io:/* @__PURE__ */Object.freeze({failed:n,refused:/* @__PURE__ */Object.freeze(t)})},[e,T,s]),x=n(()=>e.flatMap(e=>{let t=s.get(e.uri);return t?.kind==="sent"?[{key:t.s3Key,pick:e}]:[]}),[e,s]),I=o(e=>{if(T)return _;let t=new Set(e.mediaRefs),n=x.filter(e=>!t.has(e.key)).length;return n===0?_:/* @__PURE__ */Object.freeze({failed:_.failed+n,refused:_.refused})},[T,_,x]),D=o(e=>{if(T||x.length!==1)return false;let[t]=x;return t===void 0||!e.mediaRefs.includes(t.key)?false:(Nt(t.pick.filename,t.pick.mimeType)??"").startsWith("image/")},[T,x]),P=!T&&[...s.values()].some(e=>e.kind==="ready"||e.kind==="sent");return n(()=>({shortfall:_,sending:p,live:P,send:S,bookedShortfall:I,sentOnePhoto:D}),[_,p,P,S,I,D])}var uo="file",po="multipart upload failed";function ho(e){let t;try{t=new FormData;for(let[n,r]of Object.entries(e.fields))t.append(n,r);t.append(uo,e.file)}catch{return Promise.reject(new Error(po))}return e.fetch!==void 0?go(e.fetch,e.url,t,e.signal):mo(e.url,t,e.signal)}function fo(e){return e>=200&&e<300}function mo(e,t,n){return new Promise((r,l)=>{let i=globalThis.XMLHttpRequest;if(typeof i!="function"||n?.aborted===true){l(new Error(po));return}let o=null,a=()=>{o!==null&&n?.removeEventListener("abort",o)},s=()=>{a(),l(new Error(po))};try{let l=new i;l.open("POST",e),l.withCredentials=!1,l.onload=()=>{a(),r(fo(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 go(e,t,n,r){return Promise.resolve().then(()=>e(t,{method:"POST",body:n,credentials:"omit",...r?{signal:r}:{}})).then(e=>e.ok)}var yo="chat attachment upload: the file handle has no uri",bo="chat attachment upload failed";function vo(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(yo));let{signal:l,onProgress:i}=r,o=()=>Promise.reject(new Error(bo));return l?.aborted===true?o():ho({url:t.upload_url,fields:t.upload_fields,file:vo(n),signal:l,fetch:e.fetch}).then(e=>{if(!e)return o();i?.(1)},o)}})}var To=/* @__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 ko="/widget/v1/televet/sandbox/visits",wo=128,Co=64,So=/* @__PURE__ */new Set(["booked","cancelled","completed","no_show"]),_o=/* @__PURE__ */new Set(["applied","already_applied","not_applicable"]),xo=/* @__PURE__ */new Set(["rescheduled","reminder","followup_sent","message_received","ended"]),Io=/* @__PURE__ */new Set(["24h","30m"]);function Do(e){return makeEverfurError("validationFailed",{retryable:false,wireMessage:e})}function Po(e,t,n){return typeof t!="string"||t.length===0?Do(`${e} is required and must be a non-empty string`):ol(t)?Do(`${e} contains an unpaired surrogate and cannot be encoded`):al(t)>n?Do(`${e} is longer than ${n} characters`):null}function Ro(e){if(typeof e!="object"||e===null)return null;let{result:t,visit:n}=e;if(typeof t!="string"||!_o.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"||!So.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 Eo(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=Ro(l.value);return i===null?err(makeEverfurError("internalError",{retryable:false})):ok(i)};return{createVisit(petRef){let e=Po("pet_ref",petRef,wo);return e!==null?Promise.resolve(err(e)):n("televet.sandbox.createVisit",ko,{pet_ref:petRef})},advanceVisit(e,t){let r=Po("visit_ref",e,Co);if(r!==null)return Promise.resolve(err(r));if(typeof t!="string"||!So.has(t))return Promise.resolve(err(Do("to must be booked, cancelled, completed or no_show")));let l=`${ko}/${encodeURIComponent(e)}/advance`;return n("televet.sandbox.advanceVisit",l,{to:t})},simulateVisitEvent(e,t,r){let l=Po("visit_ref",e,Co);if(l!==null)return Promise.resolve(err(l));if(typeof t!="string"||!xo.has(t))return Promise.resolve(err(Do(`event must be one of ${[...xo].join(", ")}`)));if(t==="reminder"){if(typeof r!="string"||!Io.has(r))return Promise.resolve(err(Do(`stage must be one of ${[...Io].join(", ")} for a reminder`)))}else if(r!==void 0)return Promise.resolve(err(Do("stage is only for a reminder")));let i=`${ko}/${encodeURIComponent(e)}/simulate`;return n("televet.sandbox.simulateVisitEvent",i,r===void 0?{event:t}:{event:t,stage:r})}}}function useEverfurVetVisitSandbox(){let{runtime:e,userRef:userRef,scopeEpoch:t}=Jn();return n(()=>{let{services:t}=e.registry;return Eo({auth:t.authFor(userRef),...t.errorPolicy?{errorPolicy:t.errorPolicy}:{}})},[e,userRef,t])}function zo(e,t){return!e||!t.enabled?false:t.data!==null&&t.data.active===false||wr({error:t.error??null})}var Fo=e=>e.livemode===false;function Lo(){let e=Jn().runtime.entitlements,t=o(()=>Fo(e.getSnapshot()),[e]);return d(e.subscribe,t,t)}function Ao(e,t){let n=zo(Lo(),e);return{simulate:n,fundingRefused:t&&!n}}function jo(e,t){return!e||!t.enabled?true:(t.data!==null||(t.error??null)!==null)&&!zo(true,t)}function Oo(e,t){return jo(Lo(),t)?e:null}function No(petRef){let e=useEverfurVetVisitSandbox(),[t,n]=r(null),[a,s]=r(null),[d,c]=r(false),u=l(false),p=l(true);i(()=>(p.current=true,()=>{p.current=false}),[]);let h=o((e,t,r)=>{u.current||(u.current=true,c(true),t().then(t=>{if(u.current=false,!!p.current){if(c(false),!t.ok){s({tone:"danger",text:Ie(To.errorTemplate,{label:e,message:t.error.displayMessage})});return}r&&n(t.value.visit),s({tone:"ok",text:Ie(To.resultTemplate,{label:e,result:t.value.result})})}}))},[]),f=o(()=>{h(To.createLabel,()=>e.createVisit(petRef),true)},[petRef,h,e]),m=o(n=>{t!==null&&h(To.advance[n],()=>e.advanceVisit(t.visitRef,n),true)},[h,e,t]),g=o(n=>{if(t===null)return;let r=n==="reminder"?"24h":void 0;h(To.events[n],()=>e.simulateVisitEvent(t.visitRef,n,r),false)},[h,e,t]),y=t===null?null:Ie(To.visitTemplate,{visitRef:t.visitRef,status:t.status,scheduledAt:t.scheduledAt});return{visit:t,visitLine:y,line:a,busy:d,create:f,advance:m,raise:g}}var Bo=/* @__PURE__ */Object.freeze(["completed","cancelled","no_show"]),Ho=/* @__PURE__ */Object.freeze(["rescheduled","reminder","followup_sent","message_received","ended"]);function parseColor(e){let t=Mo(e);return t===null?null:Yo(t)}function Mo(e){if(typeof e=="number")return Vo(e);if(typeof e!="string")return null;let t=e.trim();if(t.length===0)return null;if(t.startsWith("#"))return $o(t.slice(1));if(t.toLowerCase().startsWith("0x"))return $o(t.slice(2));if(t.toLowerCase().startsWith("rgb"))return Wo(t);if(/^[0-9a-fA-F]+$/.test(t)){let e=$o(t);if(e!==null)return e}return/^\d+$/.test(t)?Vo(Number.parseInt(t,10)):null}function $o(e){let t=e.trim();if(!/^[0-9a-fA-F]+$/.test(t))return null;if(t.length===3)return{r:Uo(t[0]),g:Uo(t[1]),b:Uo(t[2]),a:1};if(t.length===6)return{r:qo(t,0),g:qo(t,2),b:qo(t,4),a:1};if(t.length===8){let e=qo(t,0);return{r:qo(t,2),g:qo(t,4),b:qo(t,6),a:e/255}}return null}function Wo(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=Ko(Number(r[0])),i=Ko(Number(r[1])),o=Ko(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 Vo(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 qo(e,t){return Number.parseInt(e.slice(t,t+2),16)}function Uo(e){return Number.parseInt(`${e??"0"}${e??"0"}`,16)}function Ko(e){return Number.isFinite(e)?Math.min(255,Math.max(0,Math.round(e))):null}function Yo(e){if(e.a>=1)return Go(e.r,e.g,e.b);let t=Math.round(e.a*1e3)/1e3;return`rgba(${e.r},${e.g},${e.b},${t})`}function Go(e,t,n){return`#${Jo(e)}${Jo(t)}${Jo(n)}`.toUpperCase()}function Jo(e){return e.toString(16).padStart(2,"0")}var Qo="#FFFFFF",Zo="#000000";function Xo(e){let t=t=>e.reduce((e,n)=>Math.min(e,contrastRatio(t,n)),Number.POSITIVE_INFINITY);return t(Qo)>=t(Zo)?Qo:Zo}function ea(e){let t=ta(e.r/255),n=ta(e.g/255),r=ta(e.b/255);return.2126*t+.7152*n+.0722*r}function ta(e){return e<=.03928?e/12.92:Math.pow((e+.055)/1.055,2.4)}function na(e,t){let n=Math.max(e,t),r=Math.min(e,t);return(n+.05)/(r+.05)}function contrastRatio(e,t){let n=Mo(e),r=Mo(t);if(n===null||r===null)return 1;let l=r.a>=1?r:{...r},i=n.a>=1?n:ra(n,l);return na(ea(i),ea(l))}function ra(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 la(e,t){let n=Mo(e),r=Mo(t);if(n===null||r===null)return null;let l=n.a>=1?n:ra(n,{...r});return Go(l.r,l.g,l.b)}function ia(e,t){let n=Mo(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 oa=.22,aa=.5,sa="#FFC3BC";function da(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 ca(e){let t=e.color,n=parseColor(t.highlight)===sa,r=ia(t.highlight,n?oa:aa);return{...da(e),pinkSoft:(r===null?null:la(r,t.surface))??t.surface}}function ua(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 pa(e,t){return e===void 0||e.borderRadius!==void 0||e.backgroundColor===void 0&&e.borderColor===void 0?e:{...e,borderRadius:t}}function ha(e){return e?.textColor===void 0?{}:{color:e.textColor}}var fa=44;function ma(){let e=useEverfurTheme();return n(()=>ga(e),[e])}function TelevetButton({label:e,onPress:t,kind:n="primary",disabled:r=false,loading:l=false,fullWidth:i=true,accessibilityLabel:o,testID:a,style:s}){let d=ma(),c=useEverfurTheme(),u=r||l;/* @__PURE__ */
|
|
47
47
|
return z(m,{onPress:t,disabled:u,accessibilityRole:"button",accessibilityLabel:o??e,accessibilityState:{disabled:u,busy:l},style:({pressed:e})=>[d.button,n==="primary"?d.buttonPrimary:n==="danger"?d.buttonDanger:n==="quiet"?d.buttonQuiet:d.buttonSecondary,i?d.buttonFull:d.buttonAuto,u?d.buttonDisabled:null,e&&!c.motion.reducedMotion?d.buttonPressed:null,s],testID:a,children:[l?/* @__PURE__ */E(k,{size:"small",color:n==="secondary"||n==="quiet"?c.color.brandInk:n==="danger"?c.color.onDanger:c.color.onPrimary}):null,
|
|
48
|
-
/* @__PURE__ */E(Text,{tier:"control",style:n==="secondary"||n==="quiet"?d.buttonSecondaryLabel:n==="danger"?d.buttonDangerLabel:d.buttonPrimaryLabel,children:e})]})}function TelevetStateCard({title:e,message:t,actionLabel:n,onAction:r,testID:l}){let i=
|
|
48
|
+
/* @__PURE__ */E(Text,{tier:"control",style:n==="secondary"||n==="quiet"?d.buttonSecondaryLabel:n==="danger"?d.buttonDangerLabel:d.buttonPrimaryLabel,children:e})]})}function TelevetStateCard({title:e,message:t,actionLabel:n,onAction:r,testID:l}){let i=ma(),o=typeof n=="string"&&n.length>0&&typeof r=="function";/* @__PURE__ */
|
|
49
49
|
return z(f,{style:i.stateCard,testID:l,children:[
|
|
50
|
-
/* @__PURE__ */E(Text,{style:i.stateTitle,accessibilityRole:"header",children:e}),t?/* @__PURE__ */E(Text,{style:i.stateMessage,children:t}):null,o?/* @__PURE__ */E(TelevetButton,{label:n,onPress:r,kind:"secondary",fullWidth:false}):null]})}function TelevetSkeletonBlock({height:e,width:t="100%",testID:n}){let r=
|
|
51
|
-
return E(f,{style:[r.skeleton,{height:e,width:t}],testID:n,accessibilityElementsHidden:true,importantForAccessibility:"no"})}function TelevetFailureLine({message:e,assertive:t=false,testID:n,style:r}){let l=
|
|
52
|
-
return E(Text,{style:[l.failure,r],accessibilityLiveRegion:t?"assertive":"polite",testID:n,children:e})}function
|
|
50
|
+
/* @__PURE__ */E(Text,{style:i.stateTitle,accessibilityRole:"header",children:e}),t?/* @__PURE__ */E(Text,{style:i.stateMessage,children:t}):null,o?/* @__PURE__ */E(TelevetButton,{label:n,onPress:r,kind:"secondary",fullWidth:false}):null]})}function TelevetSkeletonBlock({height:e,width:t="100%",testID:n}){let r=ma();/* @__PURE__ */
|
|
51
|
+
return E(f,{style:[r.skeleton,{height:e,width:t}],testID:n,accessibilityElementsHidden:true,importantForAccessibility:"no"})}function TelevetFailureLine({message:e,assertive:t=false,testID:n,style:r}){let l=ma();/* @__PURE__ */
|
|
52
|
+
return E(Text,{style:[l.failure,r],accessibilityLiveRegion:t?"assertive":"polite",testID:n,children:e})}function ga(e){let{color:t,space:n,radius:r,type:l}=e,{size:i,lineHeight:o}=l,a=e.slots.bookingStep,s=a?.backgroundColor!==void 0||a?.borderColor!==void 0?{padding:n.lg,...ua(a,1)}:ua(a,1),d=ha(e.slots.card);return h.create({screen:{flex:1,paddingHorizontal:n.xl,gap:n.md},stepFill:{flex:1,minHeight:0,gap:n.md},stepFillBox:{flex:1,minHeight:0,gap:n.md,...s},list:{gap:n.sm},button:{minHeight:52,flexDirection:"row",alignItems:"center",justifyContent:"center",gap:n.sm,paddingHorizontal:20,paddingVertical:n.xs,borderRadius:r.pill,borderWidth:1.5,borderColor:"transparent"},buttonFull:{alignSelf:"stretch"},buttonAuto:{alignSelf:"flex-start",minWidth:fa,minHeight:fa},buttonPrimary:{backgroundColor:t.primary,borderColor:t.primaryEdge},buttonSecondary:{borderColor:t.brandInk,backgroundColor:t.surface},buttonQuiet:{backgroundColor:"transparent",paddingHorizontal:n.sm},buttonDanger:{backgroundColor:t.danger,borderColor:t.danger},buttonDisabled:{opacity:.45},buttonPressed:{transform:[{scale:.97}]},buttonPrimaryLabel:{...face(e,"bold"),color:t.onPrimary,fontSize:i.bodyTight,lineHeight:i.bodyTight*o.snug},buttonDangerLabel:{...face(e,"bold"),color:t.onDanger,fontSize:i.bodyTight,lineHeight:i.bodyTight*o.snug},buttonSecondaryLabel:{...face(e,"bold"),color:t.brandInk,fontSize:i.bodyTight,lineHeight:i.bodyTight*o.snug},stateCard:{minHeight:140,justifyContent:"center",gap:n.sm,padding:n.lg,borderRadius:r.lg,borderWidth:1,borderColor:t.brandBorder,...ua(e.slots.card,1)},stateTitle:{...headingFace(e,"medium"),color:t.brandInk,fontSize:i.subtitle,lineHeight:i.subtitle*o.snug,...d},stateMessage:{...face(e,"regular"),color:t.text.metaCool,fontSize:i.body,lineHeight:i.body*o.normal,...d},skeleton:{borderRadius:r.md,backgroundColor:t.skeleton},failure:{...face(e,"regular"),color:t.danger,fontSize:i.caption,lineHeight:i.caption*o.normal},stepTitle:{...headingFace(e,"medium"),color:t.brandInk,fontSize:i.heading,lineHeight:i.heading*o.snug,letterSpacing:-.33},stepHelp:{...face(e,"regular"),color:t.text.primary,fontSize:i.body,lineHeight:i.body*o.relaxed},divider:{height:1,backgroundColor:t.brandBorder},scrollRoot:{flex:1,minHeight:0,...s},scrollBody:{flex:1},scrollFooter:{paddingTop:n.md,paddingBottom:n.lg}})}function TelevetEmergencyExits({petName:e,primaryVet:t,onFindEmergencyVet:r}){let l=useEverfurTheme(),i=n(()=>ya(l),[l]),o=e?.trim()??"",a=[];return r||a.push(
|
|
53
53
|
/* @__PURE__ */E(f,{style:i.vetCard,testID:"televet-emergency-go-to-er",children:/* @__PURE__ */E(Text,{style:i.vetTitle,children:De.emergency.exitGoToErTitle})},"go-to-er")),r&&a.push(
|
|
54
54
|
/* @__PURE__ */E(m,{accessibilityRole:"button",accessibilityLabel:De.emergency.exitFindErTitle,onPress:()=>{ge(r)},style:i.vetCard,testID:"televet-emergency-find-vet",children:/* @__PURE__ */E(f,{style:i.vetRow,children:/* @__PURE__ */E(Text,{tier:"control",style:i.vetTitle,children:De.emergency.exitFindErTitle})})},"find")),a.push(
|
|
55
55
|
/* @__PURE__ */E(m,{accessibilityRole:"link",accessibilityLabel:`${De.emergency.poisonControl}, ${De.emergency.poisonControlDetail}`,accessibilityHint:De.emergency.startCallHint,onPress:()=>{g.openURL(De.emergency.poisonControlTel).catch(()=>{})},style:i.vetCard,testID:"televet-emergency-poison-control",children:/* @__PURE__ */z(f,{style:i.vetText,children:[
|
|
56
56
|
/* @__PURE__ */E(Text,{tier:"control",style:i.vetTitle,children:De.emergency.poisonControl}),
|
|
57
|
-
/* @__PURE__ */E(Text,{style:i.vetDetail,children:De.emergency.poisonControlDetail})]})},"poison")),t!=null&&o.length>0&&a.push(/* @__PURE__ */E(PrimaryVetCard,{petName:o,vet:t},"clinic")),a.length===0?null:/* @__PURE__ */E(f,{style:i.box,testID:"televet-emergency-exits",children:a.map((e,t)=>/* @__PURE__ */E(f,{style:t>0?i.split:null,children:e},t))})}function PrimaryVetCard({petName:e,vet:t}){let r=useEverfurTheme(),l=n(()=>
|
|
57
|
+
/* @__PURE__ */E(Text,{style:i.vetDetail,children:De.emergency.poisonControlDetail})]})},"poison")),t!=null&&o.length>0&&a.push(/* @__PURE__ */E(PrimaryVetCard,{petName:o,vet:t},"clinic")),a.length===0?null:/* @__PURE__ */E(f,{style:i.box,testID:"televet-emergency-exits",children:a.map((e,t)=>/* @__PURE__ */E(f,{style:t>0?i.split:null,children:e},t))})}function PrimaryVetCard({petName:e,vet:t}){let r=useEverfurTheme(),l=n(()=>ya(r),[r]),i=Ie(De.emergency.exitPrimaryVetTitle,{petName:e}),o=t.detail?.trim()??"",a=/* @__PURE__ */E(f,{style:l.vetRow,children:/* @__PURE__ */z(f,{style:l.vetText,children:[
|
|
58
58
|
/* @__PURE__ */E(Text,{tier:"control",style:l.vetTitle,children:i}),o.length>0?/* @__PURE__ */E(Text,{style:l.vetDetail,children:o}):null]})});if(!t.dial)/* @__PURE__ */
|
|
59
59
|
return E(f,{style:l.vetCard,testID:"televet-early-emergency-primary-vet",children:a});let s=t.dial;/* @__PURE__ */
|
|
60
|
-
return E(m,{accessibilityRole:"link",accessibilityLabel:o.length>0?`${i}, ${o}`:i,accessibilityHint:De.emergency.startCallHint,onPress:()=>{ge(s)},style:l.vetCard,testID:"televet-early-emergency-primary-vet-call",children:a})}function
|
|
60
|
+
return E(m,{accessibilityRole:"link",accessibilityLabel:o.length>0?`${i}, ${o}`:i,accessibilityHint:De.emergency.startCallHint,onPress:()=>{ge(s)},style:l.vetCard,testID:"televet-early-emergency-primary-vet-call",children:a})}function ya(e){let{space:t,radius:n,type:r}=e,{size:l,lineHeight:i}=r,o=ca(e);return{box:{borderRadius:n.sm,backgroundColor:o.surface,paddingHorizontal:14},split:{borderTopWidth:1,borderTopColor:o.line},vetCard:{minHeight:fa,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:e,primaryVet:t,onFindEmergencyVet:r,onContinue:l}){let i=useEverfurTheme(),o=ma(),a=n(()=>ba(i),[i]);/* @__PURE__ */
|
|
61
61
|
return z(f,{style:[o.stepFill,a.emergencyPanel],testID:"televet-early-emergency",children:[
|
|
62
62
|
/* @__PURE__ */E(Text,{tier:"heading",accessibilityRole:"header",accessibilityLiveRegion:"assertive",style:a.emergencyTitle,children:De.emergency.bannerTitle}),
|
|
63
63
|
/* @__PURE__ */E(Text,{style:a.emergencyLede,children:De.emergency.lede}),
|
|
64
64
|
/* @__PURE__ */E(TelevetEmergencyExits,{petName:e,primaryVet:t,onFindEmergencyVet:r}),
|
|
65
|
-
/* @__PURE__ */E(TelevetButton,{label:De.emergency.keepBookingCta,kind:"secondary",onPress:l,testID:"televet-early-emergency-continue"})]})}function TelevetStateInterestAction({action:e,testIDPrefix:t}){let r=useEverfurTheme(),l=n(()=>
|
|
65
|
+
/* @__PURE__ */E(TelevetButton,{label:De.emergency.keepBookingCta,kind:"secondary",onPress:l,testID:"televet-early-emergency-continue"})]})}function TelevetStateInterestAction({action:e,testIDPrefix:t}){let r=useEverfurTheme(),l=n(()=>ba(r),[r]);return e===null?null:e.joined?/* @__PURE__ */z(f,{testID:`${t}-joined`,style:l.interestFeedback,children:[
|
|
66
66
|
/* @__PURE__ */E(Text,{tier:"control",accessibilityRole:"header",children:De.stateInterest.joinedTitle}),
|
|
67
67
|
/* @__PURE__ */E(Text,{style:l.interestBody,children:De.stateInterest.joinedBody})]}):/* @__PURE__ */z(f,{testID:t,style:l.interestAction,children:[
|
|
68
68
|
/* @__PURE__ */E(TelevetButton,{label:De.stateInterest.cta,kind:"secondary",loading:e.pending,disabled:e.pending,onPress:e.onPress,testID:`${t}-submit`}),e.failed?
|
|
69
69
|
/* @__PURE__ */E(TelevetFailureLine,{message:De.stateInterest.failed,testID:`${t}-error`}):null]})}function TelevetClinicianEmptyState({cause:e,onRetry:t,stateInterest:n=null}){let r=televetEmptyRosterView(e);/* @__PURE__ */
|
|
70
70
|
return z(f,{testID:"televet-clinicians-empty",children:[
|
|
71
71
|
/* @__PURE__ */E(TelevetStateCard,{title:r.title,message:r.message,...r.retryLabel!==null&&t?{actionLabel:r.retryLabel,onAction:t}:{}}),r.interestReason!==null?/* @__PURE__ */E(TelevetStateInterestAction,{action:n??null,testIDPrefix:"televet-state-interest-no-licensed-vet"}):null]})}function TelevetEntitlementInterestState({onCheckAvailability:e}){/* @__PURE__ */
|
|
72
|
-
return E(EntitlementPausedState,{...e?{onCheckAvailability:e}:{}})}function EntitlementPausedState({onCheckAvailability:e,renderUnavailable:t}){let n=
|
|
73
|
-
return z(f,{testID:"televet-booking-not-entitled",style:n.list,children:[t?t():/* @__PURE__ */E(TelevetStateCard,{title:De.bookingPausedTitle}),e?/* @__PURE__ */E(TelevetButton,{label:De.checkAvailabilityCta,kind:"secondary",onPress:e,testID:"televet-check-state-availability"}):null]})}function TelevetMediaDropNotice({shortfall:e,testIDPrefix:t}){let r=useEverfurTheme(),l=n(()=>
|
|
72
|
+
return E(EntitlementPausedState,{...e?{onCheckAvailability:e}:{}})}function EntitlementPausedState({onCheckAvailability:e,renderUnavailable:t}){let n=ma();/* @__PURE__ */
|
|
73
|
+
return z(f,{testID:"televet-booking-not-entitled",style:n.list,children:[t?t():/* @__PURE__ */E(TelevetStateCard,{title:De.bookingPausedTitle}),e?/* @__PURE__ */E(TelevetButton,{label:De.checkAvailabilityCta,kind:"secondary",onPress:e,testID:"televet-check-state-availability"}):null]})}function TelevetMediaDropNotice({shortfall:e,testIDPrefix:t}){let r=useEverfurTheme(),l=n(()=>ba(r),[r]);if(isMediaShortfallEmpty(e))return null;let i=televetMediaShortfallLines(e);return i.length===0?null:/* @__PURE__ */E(f,{style:l.mediaNotice,testID:`${t}-media-notice`,children:i.map((e,n)=>/* @__PURE__ */E(Text,{style:l.mediaLine,accessibilityLiveRegion:"polite",testID:`${t}-media-line-${String(n)}`,children:e},e))})}function ba(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 va(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:t,primaryVet:n,onFindEmergencyVet:r,stateInterest:l=null,onCheckAvailability:i,onAcknowledgeEmergency:o,renderUnavailable:a}){let s=ma(),{surfaceUnavailable:d,notEntitled:c,policyBlocked:u,triageOpen:p,step:h}=e;return d?/* @__PURE__ */E(f,{style:s.stepFill,testID:"televet-booking-unavailable",children:a?a():/* @__PURE__ */E(TelevetStateCard,{title:De.bookingPausedTitle})}):c&&h!=="clinician"?/* @__PURE__ */E(EntitlementPausedState,{...i?{onCheckAvailability:i}:{},...a?{renderUnavailable:a}:{}}):u?
|
|
74
74
|
/* @__PURE__ */z(f,{testID:"televet-booking-state-blocked",children:[
|
|
75
75
|
/* @__PURE__ */E(TelevetStateCard,{title:De.stateBlockedTitle}),
|
|
76
|
-
/* @__PURE__ */E(TelevetStateInterestAction,{action:l,testIDPrefix:"televet-state-interest-state-blocked"})]}):h==="reason"&&p?/* @__PURE__ */E(TelevetEarlyEmergency,{...t!==void 0?{petName:t}:{},...n?{primaryVet:n}:{},onFindEmergencyVet:r,onContinue:o}):null}var
|
|
77
|
-
/* @__PURE__ */E(f,{testID:"televet-booking-location-unknown",children:/* @__PURE__ */E(TelevetStateCard,{title:n==="blocked"?De.locationBlockedTitle:n==="unavailable"?De.locationUnavailableTitle:De.locationUnknownTitle,message:n==="blocked"?De.locationBlockedBody:n==="unavailable"?De.locationUnavailableBody:r?De.locationUnknownBody:void 0,actionLabel:r?n==="blocked"?De.locationBlockedCta:De.locationUnknownCta:void 0,onAction:r})}):e.isEmpty?/* @__PURE__ */E(TelevetClinicianEmptyState,{cause:t,onRetry:l,stateInterest:o}):/* @__PURE__ */E(EntitlementPausedState,{...a?{renderUnavailable:a}:{}})}function
|
|
78
|
-
/* @__PURE__ */E(y.View,{style:[h.avatar,{opacity:w,transform:[{scale:w.interpolate({inputRange:[0,1],outputRange:[.92,1]})}]}],accessibilityElementsHidden:true,importantForAccessibility:"no-hide-descendants",children:/* @__PURE__ */E(Text,{tier:"heading",style:h.avatarText,children:v.length>0?
|
|
76
|
+
/* @__PURE__ */E(TelevetStateInterestAction,{action:l,testIDPrefix:"televet-state-interest-state-blocked"})]}):h==="reason"&&p?/* @__PURE__ */E(TelevetEarlyEmergency,{...t!==void 0?{petName:t}:{},...n?{primaryVet:n}:{},onFindEmergencyVet:r,onContinue:o}):null}var Ta=false;function ka(){if(!Ta){Ta=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 wa(e){return e.noState?true:e.isPending||e.isError?false:e.isEmpty||e.notEntitled}function TelevetClinicianOutcome({state:e,cause:t,locationStatus:n,onRequestLocation:r,onRetry:l,stateInterest:o=null,renderUnavailable:a}){let s=e.noState&&!r;return i(()=>{s&&ka()},[s]),e.noState?
|
|
77
|
+
/* @__PURE__ */E(f,{testID:"televet-booking-location-unknown",children:/* @__PURE__ */E(TelevetStateCard,{title:n==="blocked"?De.locationBlockedTitle:n==="unavailable"?De.locationUnavailableTitle:De.locationUnknownTitle,message:n==="blocked"?De.locationBlockedBody:n==="unavailable"?De.locationUnavailableBody:r?De.locationUnknownBody:void 0,actionLabel:r?n==="blocked"?De.locationBlockedCta:De.locationUnknownCta:void 0,onAction:r})}):e.isEmpty?/* @__PURE__ */E(TelevetClinicianEmptyState,{cause:t,onRetry:l,stateInterest:o}):/* @__PURE__ */E(EntitlementPausedState,{...a?{renderUnavailable:a}:{}})}function Ca(e){return e.trim().replace(/^dr\.?\s+/i,"").slice(0,1).toUpperCase()}function televetConsultCalendarKey(e){return`televet-consult-${e}`}function TelevetBookedScreen({consult:e,petName:t,onDone:o,onAddToCalendar:a,canJoinInApp:s=false,sharedRecords:d=false,sentPhoto:c=false}){let u=useEverfurTheme(),p=ma(),h=n(()=>Sa(u),[u]),[m,g]=r("idle"),b=async()=>{if(!a)return;g("saving");let t=new Date(e.scheduledAt);if(Number.isNaN(t.getTime())){g("failed");return}let n=await Te(a,{key:televetConsultCalendarKey(e.consultId),title:De.visit.title,startDate:t,endDate:new Date(t.getTime()+Ai*6e4),alarmOffsetMinutes:-30});g(n.ok&&n.value===true?"saved":"failed")},v=e.clinicianName?.trim()??"",T=t?.trim()||De.petFallback.charAt(0).toUpperCase()+De.petFallback.slice(1),k=[De.booked.remindPromise,d&&v.length>0?Ie(c?De.booked.recordsPhotoPromiseTemplate:De.booked.recordsPromiseTemplate,{pet:T,vet:v}):Ie(De.booked.summaryPromise,{pet:T}),...s?[De.booked.joinPromise]:[]],w=l(new y.Value(u.motion.reducedMotion?1:0)).current;return i(()=>{u.motion.reducedMotion||y.spring(w,{toValue:1,damping:14,stiffness:180,mass:1,useNativeDriver:true}).start()},[w,u.motion.reducedMotion]),isTelevetBookingCopyReady()?/* @__PURE__ */z(f,{style:h.screen,testID:"televet-booked",children:[
|
|
78
|
+
/* @__PURE__ */E(y.View,{style:[h.avatar,{opacity:w,transform:[{scale:w.interpolate({inputRange:[0,1],outputRange:[.92,1]})}]}],accessibilityElementsHidden:true,importantForAccessibility:"no-hide-descendants",children:/* @__PURE__ */E(Text,{tier:"heading",style:h.avatarText,children:v.length>0?Ca(v):""})}),
|
|
79
79
|
/* @__PURE__ */E(Text,{tier:"heading",style:h.title,accessibilityRole:"header",children:v.length>0?Ie(De.bookedTitleTemplate,{vet:v}):De.bookedTitle}),
|
|
80
|
-
/* @__PURE__ */E(Text,{style:h.when,children:t?Ie(De.bookedLeadTemplate,{when:
|
|
80
|
+
/* @__PURE__ */E(Text,{style:h.when,children:t?Ie(De.bookedLeadTemplate,{when:Vi(e.scheduledAt),pet:t}):Vi(e.scheduledAt)}),
|
|
81
81
|
/* @__PURE__ */E(f,{style:h.steps,accessibilityLabel:De.booked.stepsLabel,testID:"televet-booked-steps",children:k.map((e,t)=>/* @__PURE__ */z(f,{style:[h.step,t===k.length-1?h.stepLast:null],children:[
|
|
82
82
|
/* @__PURE__ */E(Text,{tier:"badge",style:h.stepNumberText,accessibilityElementsHidden:true,importantForAccessibility:"no",children:String(t+1).padStart(2,"0")}),
|
|
83
83
|
/* @__PURE__ */E(Text,{style:h.stepText,children:e.trim()})]},e))}),
|
|
84
84
|
/* @__PURE__ */z(f,{style:h.actions,children:[m==="failed"?/* @__PURE__ */E(Text,{style:[p.failure,h.calendarNote],accessibilityLiveRegion:"polite",testID:"televet-booked-calendar-failed",children:De.booked.calendarFailedBody}):null,a?/* @__PURE__ */E(TelevetButton,{label:m==="saved"?De.booked.calendarAdded:De.addToCalendarCta,kind:"secondary",loading:m==="saving",disabled:m==="saving"||m==="saved",onPress:()=>{b()},testID:"televet-booked-calendar"}):null,
|
|
85
|
-
/* @__PURE__ */E(TelevetButton,{label:De.doneCta,kind:"primary",onPress:o,testID:"televet-booked-done"})]})]}):/* @__PURE__ */E(f,{style:h.screen,testID:"televet-booked-copy-unapproved"})}function
|
|
86
|
-
/* @__PURE__ */E(m,{onPress:l?a:y,accessibilityRole:"button",accessibilityLabel:
|
|
85
|
+
/* @__PURE__ */E(TelevetButton,{label:De.doneCta,kind:"primary",onPress:o,testID:"televet-booked-done"})]})]}):/* @__PURE__ */E(f,{style:h.screen,testID:"televet-booked-copy-unapproved"})}function Sa(e){let{space:t,radius:n,type:r}=e,{size:l,lineHeight:i}=r,o=ca(e),a=ha(e.slots.card);return h.create({screen:{flex:1,paddingHorizontal:t.xl,paddingTop:t.lg,gap:t.md},avatar:{alignSelf:"center",width:112,height:112,borderRadius:56,backgroundColor:o.mist,borderWidth:4,borderColor:o.go,alignItems:"center",justifyContent:"center"},avatarText:{...face(e,"medium"),color:o.ink,fontSize:38,lineHeight:44},title:{textAlign:"center",...headingFace(e,"medium"),color:o.ink,fontSize:l.heading,lineHeight:l.heading*i.snug,letterSpacing:-.33,paddingTop:t.md},when:{textAlign:"center",...face(e,"regular"),color:o.text,fontSize:l.body,lineHeight:l.body*i.relaxed},steps:{marginTop:t.md,paddingHorizontal:t.lg,borderRadius:n.lg,borderWidth:1,borderColor:o.line,backgroundColor:o.surface,...ua(e.slots.card,1)},step:{flexDirection:"row",alignItems:"flex-start",gap:t.md,paddingVertical:14,borderBottomWidth:1,borderBottomColor:o.line},stepLast:{borderBottomWidth:0},stepNumberText:{width:28,...face(e,"monoBold"),color:o.ink,fontSize:13,lineHeight:l.body*i.relaxed,...a},stepText:{flex:1,...face(e,"regular"),color:o.text,fontSize:l.body,lineHeight:l.body*i.relaxed,...a},actions:{marginTop:"auto",paddingBottom:t.xl,gap:t.md},calendarNote:{textAlign:"center"}})}function _a(e){let[t,n]=r(null);return{shown:e!==null&&t!==e,onError:()=>n(e)}}function BrandLogo({logoUrl:e,name:t,barStyle:n,logoStyle:r,testID:l}){let i=_a(e);return e===null||!i.shown?null:/* @__PURE__ */E(f,{style:n,...l===void 0?{}:{testID:l},children:/* @__PURE__ */E(T,{source:{uri:e},style:r,resizeMode:"contain",accessible:true,accessibilityRole:"image",accessibilityLabel:t,onError:i.onError})})}function TelevetBookingChrome({step:e,furthestIndex:t,title:r,canGoBack:l,isDirty:o,onBack:a,onClose:s,onConfirmDiscard:d,triageOpen:c=false,stepContext:u,presentation:p="rail"}){let h=useEverfurTheme(),g=n(()=>Ra(h),[h]),y=n(()=>()=>{if(!o){s();return}let e={title:De.chrome.discardTitle,body:De.chrome.discardBody,confirmLabel:De.chrome.discardConfirmCta,keepLabel:De.chrome.discardKeepCta};if(d){Promise.resolve(d(e)).then(e=>{e&&s()},()=>{});return}b.alert(e.title,e.body,[{text:e.keepLabel,style:"cancel"},{text:e.confirmLabel,style:"destructive",onPress:s}])},[o,s,d]),T=n(()=>()=>l?(a(),true):(y(),true),[l,a,y]);i(()=>{let e=v.addEventListener("hardwareBackPress",T);return()=>{e.remove()}},[T]),Ce(T);let k=n(()=>xi(u),[u]),{current:w,total:C,steps:S}=Ii(e,k,c),_=e==="booked"?De.bookedStepLabel:Ie(De.loading.progressTemplate,{step:String(w),total:String(C)});return p==="nav"?/* @__PURE__ */E(f,{style:g.wrap,children:/* @__PURE__ */z(f,{style:g.navBar,children:[
|
|
86
|
+
/* @__PURE__ */E(m,{onPress:l?a:y,accessibilityRole:"button",accessibilityLabel:Ia,testID:"televet-booking-back",style:g.navIcon,children:/* @__PURE__ */E(f,{style:g.chevron,accessibilityElementsHidden:true,importantForAccessibility:"no"})}),
|
|
87
87
|
/* @__PURE__ */E(Text,{tier:"compact",numberOfLines:1,style:g.navTitle,accessibilityRole:"header",testID:"televet-booking-title",children:r??De.navTitle}),
|
|
88
|
-
/* @__PURE__ */E(m,{onPress:y,accessibilityRole:"button",accessibilityLabel:De.close,accessibilityHint:De.chrome.closeHint,testID:"televet-booking-close",style:g.navIcon,children:/* @__PURE__ */E(Text,{tier:"control",style:g.close,accessibilityElementsHidden:true,importantForAccessibility:"no",children:
|
|
88
|
+
/* @__PURE__ */E(m,{onPress:y,accessibilityRole:"button",accessibilityLabel:De.close,accessibilityHint:De.chrome.closeHint,testID:"televet-booking-close",style:g.navIcon,children:/* @__PURE__ */E(Text,{tier:"control",style:g.close,accessibilityElementsHidden:true,importantForAccessibility:"no",children:xa})})]})}):/* @__PURE__ */z(f,{style:g.wrap,children:[
|
|
89
89
|
/* @__PURE__ */E(BrandLogo,{logoUrl:h.meta.logoUrl,name:h.meta.displayName,barStyle:g.logoBar,logoStyle:g.logo,testID:"televet-booking-logo"}),
|
|
90
90
|
/* @__PURE__ */z(f,{style:g.bar,children:[
|
|
91
|
-
/* @__PURE__ */E(m,{onPress:l?a:y,accessibilityRole:"button",accessibilityLabel:
|
|
91
|
+
/* @__PURE__ */E(m,{onPress:l?a:y,accessibilityRole:"button",accessibilityLabel:Ia,testID:"televet-booking-back",style:g.ring,children:/* @__PURE__ */E(f,{style:g.chevron,accessibilityElementsHidden:true,importantForAccessibility:"no"})}),
|
|
92
92
|
/* @__PURE__ */z(f,{style:g.center,accessibilityRole:"header",accessibilityLabel:`${r??De.navTitle}, ${_}`,children:[
|
|
93
93
|
/* @__PURE__ */E(Text,{tier:"compact",style:g.stepLabel,testID:"televet-booking-progress-label",children:_}),
|
|
94
94
|
/* @__PURE__ */E(f,{style:g.segments,accessibilityElementsHidden:true,importantForAccessibility:"no-hide-descendants",testID:"televet-booking-rail",children:S.map((e,t)=>/* @__PURE__ */E(f,{style:[g.segment,t<w?g.segmentDone:null]},e))})]}),
|
|
95
|
-
/* @__PURE__ */E(m,{onPress:y,accessibilityRole:"button",accessibilityLabel:De.close,accessibilityHint:De.chrome.closeHint,testID:"televet-booking-close",style:g.ring,children:/* @__PURE__ */E(Text,{tier:"control",style:g.close,accessibilityElementsHidden:true,importantForAccessibility:"no",children:
|
|
96
|
-
return E(
|
|
95
|
+
/* @__PURE__ */E(m,{onPress:y,accessibilityRole:"button",accessibilityLabel:De.close,accessibilityHint:De.chrome.closeHint,testID:"televet-booking-close",style:g.ring,children:/* @__PURE__ */E(Text,{tier:"control",style:g.close,accessibilityElementsHidden:true,importantForAccessibility:"no",children:xa})})]})]})}var xa="×",Ia="Back",Da=28,Pa=160;function Ra(e){let{space:t,type:n}=e,r=ca(e),l=e.slots.header,i=l?.textColor??r.ink;return h.create({wrap:{...ua(pa(l,e.radius.lg))},logoBar:{alignItems:"center",paddingTop:t.sm},logo:{height:Da,width:Pa},bar:{flexDirection:"row",alignItems:"center",gap:t.md,paddingVertical:t.sm,minHeight:60},ring:{width:fa,height:fa,borderRadius:fa/2,borderWidth:1.5,borderColor:r.line,alignItems:"center",justifyContent:"center"},chevron:{width:10,height:10,marginLeft:4,borderLeftWidth:2,borderBottomWidth:2,borderColor:i,transform:[{rotate:"45deg"}]},close:{...face(e,"regular"),color:i,fontSize:24,lineHeight:26},center:{flex:1,alignItems:"center",gap:6},stepLabel:{...face(e,"monoBold"),color:i,fontSize:12,lineHeight:16,letterSpacing:1.2,textTransform:"uppercase"},segments:{flexDirection:"row",gap:4,alignSelf:"stretch"},segment:{flex:1,height:4,borderRadius:2,backgroundColor:r.mist},segmentDone:{backgroundColor:r.go},title:{...headingFace(e,"medium"),color:i,fontSize:n.size.subtitle},navBar:{flexDirection:"row",alignItems:"center",minHeight:58,paddingHorizontal:t.sm,gap:t.xs},navIcon:{width:fa,height:fa,alignItems:"center",justifyContent:"center"},navTitle:{...textRole(e,"cardTitle"),fontSize:17*n.typeScale,lineHeight:25.5*n.typeScale,color:i,flex:1,textAlign:"center"}})}var Ea=640,za=600,Fa=/* @__PURE__ */Object.freeze({width:0,height:0}),La="useWindowDimensions"in u&&typeof u.useWindowDimensions=="function"?u.useWindowDimensions:()=>Fa,Aa=/* @__PURE__ */Object.freeze({width:"100%",maxWidth:Ea,alignSelf:"center"});/* @__PURE__ */Object.freeze({...Aa,flex:1});var ja=/* @__PURE__ */Object.freeze({...Aa,flexGrow:1,flexShrink:1});function Oa(){return La().width>=za}var Na=/* @__PURE__ */Symbol.for("@everfur/sdk#InSdkColumn@v1"),Ba=globalThis,Ha=Ba[Na]??(Ba[Na]=createContext(false));Ha.displayName??="EverfurInSdkColumn";function SdkColumnReset({children:e}){/* @__PURE__ */
|
|
96
|
+
return E(Ha.Provider,{value:false,children:e})}function SdkTabletColumn({children:e,style:t,testID:n}){let r=Oa(),l=s(Ha);return!r||l?e:/* @__PURE__ */E(f,{style:t===void 0?ja:[ja,t],testID:n??"everfur-tablet-column",children:/* @__PURE__ */E(Ha.Provider,{value:true,children:e})})}var Ma=/* @__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 $a(e){return e?Ie(Ma.bookedTitleTemplate,{pet:e}):De.bookedTitle}var Wa=18,Va=78;function qa(e,t=1){let n=e.color,r=e.type.typeScale,l=e=>Math.round(e*r*100)/100,i=e.slots.card,o=e.slots.input,a=e.slots.primaryButton?.borderRadius??999,s=i?.backgroundColor??n.surface,d=ha(i).color??n.text.primary,c={shadowColor:n.text.primary,shadowOpacity:.06,shadowRadius:3,shadowOffset:{width:0,height:1},elevation:1};return h.create({screen:{paddingHorizontal:0,gap:0,backgroundColor:n.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:Wa,paddingBottom:20},scroll:{flex:1},stepLabel:{...textRole(e,"label"),fontSize:l(11),lineHeight:l(16.5),letterSpacing:l(.88),color:n.text.muted},title:{...textRole(e,"display"),lineHeight:l(31.32),marginTop:8,color:n.text.primary},subtitle:{...textRole(e,"body"),lineHeight:l(21.75),marginTop:8,color:n.text.metaCool},options:{gap:10,marginTop:20},option:{flexDirection:"row",alignItems:"center",gap:12,minHeight:56,paddingVertical:12,paddingHorizontal:16,borderRadius:16,backgroundColor:s,borderWidth:2,borderColor:"transparent",...c},optionPicked:{backgroundColor:n.highlight,borderColor:n.text.primary},radio:{width:22,height:22,borderRadius:11,borderWidth:2,borderColor:n.controlEdge},radioPicked:{borderWidth:7,borderColor:n.text.primary},optionLabel:{...textRole(e,"rowTitle"),fontSize:l(16),lineHeight:l(24),color:d,flex:1},optionLabelPicked:{color:n.onHighlight},note:{gap:6,marginTop:18},noteLabel:{...textRole(e,"rowTitle"),fontSize:l(14),lineHeight:l(21),color:n.text.primary},noteInput:{...textRole(e,"body"),fontSize:l(16),lineHeight:l(22.4),minHeight:84,paddingVertical:12,paddingHorizontal:14,borderRadius:o?.borderRadius??14,borderWidth:1,borderColor:o?.borderColor??n.borderRingCream,backgroundColor:o?.backgroundColor??n.surface,color:o?.textColor??n.text.primary,textAlignVertical:"top"},days:{flexDirection:"row",flexWrap:"wrap",gap:8,marginTop:18},day:{flexGrow:1,flexBasis:0,minWidth:Math.ceil(Va*t),minHeight:62,paddingVertical:8,paddingHorizontal:6,borderRadius:14,backgroundColor:s,alignItems:"center",justifyContent:"center",...c},dayPicked:{backgroundColor:n.primary},dayName:{...textRole(e,"cardTitle"),fontSize:l(15),lineHeight:l(22.5),color:d,textAlign:"center"},dayDate:{...face(e,"medium"),fontSize:l(13),lineHeight:l(19.5),color:n.text.muted,textAlign:"center"},dayTextPicked:{color:n.onPrimary},dayDatePicked:{color:n.onPrimary,opacity:.78},slots:{gap:10,marginTop:18},slotRow:{flexDirection:"row",gap:10},slot:{flex:1,minHeight:52,paddingHorizontal:14,borderRadius:999,backgroundColor:s,borderWidth:1.5,borderColor:n.borderRingCream,alignItems:"center",justifyContent:"center"},slotPicked:{backgroundColor:n.accent,borderWidth:2,borderColor:n.text.primary},slotSpacer:{flex:1},slotLabel:{...textRole(e,"rowTitle"),fontSize:l(15.5),lineHeight:l(23.25),color:d,textAlign:"center"},slotLabelPicked:{color:n.onAccent},ticks:{marginTop:18,gap:4},lines:{marginTop:12,gap:8},foot:{paddingTop:12,paddingHorizontal:Wa,paddingBottom:34,backgroundColor:n.background,borderTopWidth:1,borderTopColor:n.surfaceSubtle,gap:10},button:{minHeight:48,paddingHorizontal:22,borderRadius:a,backgroundColor:n.primary,alignItems:"center",justifyContent:"center",flexDirection:"row",gap:8},buttonGhost:{backgroundColor:"transparent",borderWidth:1.5,borderColor:n.text.primary},buttonDisabled:{opacity:.4},buttonLabel:{...textRole(e,"button"),fontSize:l(16),lineHeight:l(24),color:n.onPrimary,textAlign:"center"},buttonGhostLabel:{color:n.text.primary},fine:{...textRole(e,"caption"),fontSize:l(12.5),lineHeight:l(18.75),color:n.text.muted,textAlign:"center"},done:{paddingTop:40,paddingHorizontal:22,paddingBottom:20,alignItems:"center"},check:{width:76,height:76,borderRadius:38,backgroundColor:n.accent,alignItems:"center",justifyContent:"center"},checkMark:{width:34,height:18,marginTop:-8,borderLeftWidth:4,borderBottomWidth:4,borderColor:n.onAccent,transform:[{rotate:"-45deg"}]},doneTitle:{...textRole(e,"display"),fontSize:l(34),lineHeight:l(39.1),marginTop:20,color:n.text.primary,textAlign:"center"},when:{...textRole(e,"rowTitle"),fontSize:l(16),lineHeight:l(24),marginTop:10,color:n.text.primary,textAlign:"center"},who:{...textRole(e,"body"),marginTop:2,color:n.text.metaCool,textAlign:"center"},note2:{marginTop:22,alignSelf:"stretch"},calendarNote:{...textRole(e,"caption"),color:n.danger,textAlign:"center"}})}function Ua(e){let t=[],n=e.breed?.trim();n&&t.push(n);let r=Ka(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 Ka(e){if(typeof e!="number"||!Number.isFinite(e))return null;let t=Math.floor(e);return t>=0?t:null}var Ya=/* @__PURE__ */Object.freeze({}),Ga=100,Ja=20;function Qa(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 Za(e,t){let a=typeof e=="number",s=l(null),[d,c]=r(null),u=l(null),p=l(null),h=l(true),f=o(()=>{p.current!==null&&clearTimeout(p.current),p.current=null},[]);i(()=>(h.current=true,()=>{h.current=false,f()}),[f]);let m=o(function e(t){s.current?.measureInWindow((n,r)=>{let l=u.current;if(!h.current||l===null)return;let i=Qa(r,l.y,l.height,D.get("window").height);if(i!==null){c(e=>e!==null&&e.chatTop===i.chatTop&&e.parentTop===i.parentTop?e:i);return}t>=Ja||(p.current=setTimeout(()=>{p.current=null,e(t+1)},Ga))})},[]),g=o(e=>{let{y:t,height:n}=e.nativeEvent.layout;u.current={y:t,height:n},f(),m(0)},[m,f]);return n(()=>{if(!t)return{avoidingProps:Ya,probeRef:null,topInWindow:null};let e=d?.parentTop??0;return{avoidingProps:e>0?{keyboardVerticalOffset:e,onLayout:g}:{onLayout:g},probeRef:s,topInWindow:d?.chatTop??null}},[t,a,e,d,g])}function KeyboardOffsetProbe({probeRef:e}){return e===null?null:/* @__PURE__ */E(f,{ref:e,collapsable:false,pointerEvents:"none",style:Xa})}var Xa=/* @__PURE__ */Object.freeze({position:"absolute",top:0,left:0,width:0,height:0});function TelevetIntakeMedia({media:e,onChange:t,onPickMedia:l,meta:i}){let o=useEverfurTheme(),a=n(()=>rs(o),[o]),s=q-e.length,[d,c]=r(false);if(!l)return null;let u=async()=>{if(!(d||s<=0)){c(true);try{let n=await Te(l,s);if(!n.ok||n.value===null||n.value.length===0)return;let r=new Set(e.map(e=>e.uri)),i=n.value.filter(e=>typeof e?.uri=="string"&&e.uri.length>0&&!r.has(e.uri));if(i.length===0)return;t([...e,...i].slice(0,q))}finally{c(false)}}};/* @__PURE__ */
|
|
97
97
|
return z(f,{children:[
|
|
98
98
|
/* @__PURE__ */z(f,{style:a.row,children:[e.map((n,r)=>/* @__PURE__ */z(f,{style:a.thumb,children:[
|
|
99
|
-
/* @__PURE__ */E(T,{source:{uri:n.uri},style:a.thumbImage,resizeMode:"cover"}),n.mimeType?.startsWith("video/")?/* @__PURE__ */E(f,{style:a.videoBadge,testID:`televet-intake-media-video-${String(r)}`,children:/* @__PURE__ */E(Text,{tier:"badge",style:a.videoBadgeText,children:
|
|
100
|
-
/* @__PURE__ */E(m,{onPress:()=>t(e.filter((e,t)=>t!==r)),accessibilityRole:"button",accessibilityLabel:De.removePhotoLabel,testID:`televet-intake-media-remove-${String(r)}`,style:a.remove,children:/* @__PURE__ */E(Text,{tier:"control",style:a.removeGlyph,children:
|
|
101
|
-
/* @__PURE__ */E(Text,{tier:"compact",style:i.month,testID:"televet-day-strip-month",children:
|
|
99
|
+
/* @__PURE__ */E(T,{source:{uri:n.uri},style:a.thumbImage,resizeMode:"cover"}),n.mimeType?.startsWith("video/")?/* @__PURE__ */E(f,{style:a.videoBadge,testID:`televet-intake-media-video-${String(r)}`,children:/* @__PURE__ */E(Text,{tier:"badge",style:a.videoBadgeText,children:ts})}):null,
|
|
100
|
+
/* @__PURE__ */E(m,{onPress:()=>t(e.filter((e,t)=>t!==r)),accessibilityRole:"button",accessibilityLabel:De.removePhotoLabel,testID:`televet-intake-media-remove-${String(r)}`,style:a.remove,children:/* @__PURE__ */E(Text,{tier:"control",style:a.removeGlyph,children:es})})]},`${n.uri}-${String(r)}`)),s>0?/* @__PURE__ */E(m,{onPress:()=>{u()},disabled:d,accessibilityRole:"button",accessibilityLabel:De.addPhotoCta,accessibilityState:{busy:d,disabled:d},testID:"televet-intake-add-media",style:[a.dropzone,d?a.dropzoneBusy:null],children:d?/* @__PURE__ */E(k,{testID:"televet-intake-media-busy"}):/* @__PURE__ */E(Text,{tier:"compact",style:a.dropzoneText,children:De.addPhotoCta})}):null]}),i?/* @__PURE__ */E(Text,{tier:"compact",style:a.meta,testID:"televet-intake-media-meta",children:i}):null]})}var es="×",ts="▶",ns=92;function rs(e){let{color:t,space:n,radius:r,type:l}=e,{size:i,lineHeight:o}=l;return h.create({row:{flexDirection:"row",flexWrap:"wrap",gap:n.md,paddingTop:n.sm},thumb:{width:ns,height:ns,borderRadius:r.md,backgroundColor:t.surfaceSubtle},thumbImage:{width:"100%",height:"100%",borderRadius:r.md},videoBadge:{position:"absolute",left:6,bottom:6,paddingHorizontal:6,paddingVertical:2,borderRadius:r.sm,backgroundColor:t.shadow},videoBadgeText:{color:t.text.onBrand,fontSize:i.nano},remove:{position:"absolute",top:-8,right:-8,width:fa-16,height:fa-16,borderRadius:fa/2,backgroundColor:t.text.metaCool,alignItems:"center",justifyContent:"center"},removeGlyph:{...face(e,"medium"),color:t.surface,fontSize:i.subtitle,lineHeight:i.subtitle,includeFontPadding:false},dropzone:{width:ns,height:ns,borderRadius:r.md,borderWidth:1,borderStyle:"dashed",borderColor:t.brandBorder,alignItems:"center",justifyContent:"center",paddingHorizontal:n.sm},dropzoneBusy:{opacity:.6},meta:{...face(e,"regular"),color:t.text.metaCool,fontSize:i.caption,lineHeight:i.caption*o.normal,paddingTop:n.sm},dropzoneText:{...face(e,"mono"),color:t.text.metaCool,fontSize:i.nano,lineHeight:i.nano*o.normal,letterSpacing:.3,textAlign:"center"}})}function TelevetDayStrip({slots:e,selectedDayKey:t,onSelectDay:r}){let l=useEverfurTheme(),i=n(()=>os(l),[l]),o=n(()=>televetDaysFromSlots(e),[e]),a=is(),s=o[0];return s===void 0?null:/* @__PURE__ */z(f,{children:[
|
|
101
|
+
/* @__PURE__ */E(Text,{tier:"compact",style:i.month,testID:"televet-day-strip-month",children:Hi(s.iso)}),
|
|
102
102
|
/* @__PURE__ */E(w,{ref:a.scrollRef,horizontal:true,showsHorizontalScrollIndicator:false,contentContainerStyle:i.strip,onLayout:a.onStripLayout,onContentSizeChange:a.onContentSize,testID:"televet-day-strip",children:o.map(e=>{let n=e.key===t;/* @__PURE__ */
|
|
103
103
|
return z(m,{onLayout:n?a.onSelectedDayLayout:void 0,onPress:()=>r(e),accessibilityRole:"button",accessibilityLabel:Mi(e.iso),accessibilityState:{selected:n},testID:`televet-day-${e.key}`,style:[i.day,n?i.daySelected:null],children:[
|
|
104
104
|
/* @__PURE__ */E(Text,{tier:"compact",style:[i.dayWeekday,n?i.dayTextSelected:null],children:e.weekday}),
|
|
105
|
-
/* @__PURE__ */E(Text,{tier:"compact",style:[i.dayNumber,n?i.dayTextSelected:null],children:e.dayNumber})]},e.key)})})]})}var
|
|
105
|
+
/* @__PURE__ */E(Text,{tier:"compact",style:[i.dayNumber,n?i.dayTextSelected:null],children:e.dayNumber})]},e.key)})})]})}var ls=/* @__PURE__ */Object.freeze({done:false,viewport:null,content:null,chip:null});function is(){let e=l(null),t=l(ls),n=o(n=>{let r={...t.current,...n};if(r.done||r.viewport===null||r.content===null||r.chip===null){t.current=r;return}t.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&&e.current?.scrollTo({x:i,animated:false})},[]),r=o(e=>n({viewport:e.nativeEvent.layout.width}),[n]),i=o(e=>n({content:e}),[n]),a=o(e=>{let{x:t,width:r}=e.nativeEvent.layout;n({chip:{x:t,width:r}})},[n]);return{scrollRef:e,onStripLayout:r,onContentSize:i,onSelectedDayLayout:a}}function televetDaysFromSlots(e){let t=/* @__PURE__ */new Map;for(let n of e){let e=Bi(n.startsAt);if(t.has(e))continue;let r=new Date(n.startsAt);Number.isNaN(r.getTime())||t.set(e,
|
|
106
106
|
/* @__PURE__ */Object.freeze({key:e,iso:n.startsAt,weekday:r.toLocaleDateString(void 0,{weekday:"short"}),dayNumber:String(r.getDate())}))}/* @__PURE__ */
|
|
107
|
-
return Object.freeze([...t.values()])}function
|
|
107
|
+
return Object.freeze([...t.values()])}function os(e){let{space:t,type:n}=e,{size:r,lineHeight:l}=n,i=ca(e),o=e.slots.chip,a=ha(o);return h.create({month:{...face(e,"bold"),color:i.ink,fontSize:r.body,lineHeight:r.body*l.snug,paddingBottom:t.md},strip:{gap:t.sm,paddingHorizontal:2,paddingVertical:2},day:{width:52,minHeight:64,paddingVertical:t.sm,borderRadius:14,borderWidth:1.5,borderColor:i.line,backgroundColor:i.surface,alignItems:"center",justifyContent:"center",gap:2,...ua(o,1.5)},daySelected:{backgroundColor:i.pink,borderColor:i.ink},dayWeekday:{...face(e,"monoBold"),color:i.ink,fontSize:11,lineHeight:14,letterSpacing:.88,textTransform:"uppercase",...a},dayNumber:{...face(e,"medium"),color:i.ink,fontSize:r.heading,lineHeight:r.heading*l.tight,...a},dayTextSelected:{color:i.onPink}})}function TelevetSlotPicker({slots:e,busySlotId:t,onPick:l,selectedSlot:i=null,ListHeaderComponent:o,rowTestIdPrefix:a="televet-slot",testID:s="televet-slot-list",periodLabels:d}){let c=useEverfurTheme(),u=n(()=>ds(c),[c]),p=n(()=>televetDaysFromSlots(e),[e]),[h,g]=r(null),y=i?Bi(i.startsAt):null,b=ss(p,[h,y])??p[0]?.key??null,v=n(()=>b?e.filter(e=>Bi(e.startsAt)===b):[],[e,b]),T=o,k=n(()=>v.map(e=>ji(e.startsAt)),[v]),C=n(()=>new Set(k.filter(e=>e.length>0)).size>1,[k]),S=v[0];
|
|
108
108
|
/* @__PURE__ */
|
|
109
109
|
return z(f,{style:u.root,testID:s,children:[T?/* @__PURE__ */E(T,{}):null,
|
|
110
|
-
/* @__PURE__ */E(TelevetDayStrip,{slots:e,selectedDayKey:b,onSelectDay:e=>g(e.key)}),S&&!C?/* @__PURE__ */E(Text,{tier:"compact",style:u.zone,testID:"televet-slot-zone",children:
|
|
111
|
-
/* @__PURE__ */E(w,{style:u.gridScroll,contentContainerStyle:u.groups,showsVerticalScrollIndicator:false,children:
|
|
110
|
+
/* @__PURE__ */E(TelevetDayStrip,{slots:e,selectedDayKey:b,onSelectDay:e=>g(e.key)}),S&&!C?/* @__PURE__ */E(Text,{tier:"compact",style:u.zone,testID:"televet-slot-zone",children:ji(S.startsAt)}):null,
|
|
111
|
+
/* @__PURE__ */E(w,{style:u.gridScroll,contentContainerStyle:u.groups,showsVerticalScrollIndicator:false,children:as(v,d).map(e=>/* @__PURE__ */z(f,{style:u.group,children:[e.label?/* @__PURE__ */E(Text,{tier:"compact",style:u.period,accessibilityRole:"header",testID:`televet-slot-period-${e.key}`,children:e.label}):null,
|
|
112
112
|
/* @__PURE__ */E(f,{style:u.grid,children:e.slots.map(e=>{let n=v.indexOf(e),r=t===e.slotId,o=t!==null,s=i?.slotId===e.slotId,d=C?k[n]??"":"";/* @__PURE__ */
|
|
113
|
-
return z(m,{onPress:()=>l(e),disabled:o,accessibilityRole:"button",accessibilityLabel:[
|
|
114
|
-
/* @__PURE__ */E(Text,{tier:"compact",style:[u.chipLabel,s?u.chipLabelPicked:null,r?u.chipLabelBusy:null],children:
|
|
113
|
+
return z(m,{onPress:()=>l(e),disabled:o,accessibilityRole:"button",accessibilityLabel:[zi(e.startsAt),d].filter(e=>e.length>0).join(" "),accessibilityState:{disabled:o,busy:r,selected:s},testID:`${a}-${e.slotId}`,style:({pressed:e})=>[u.chip,s?u.chipPicked:null,r?u.chipBusy:null,o&&!r?u.chipDisabled:null,e&&!c.motion.reducedMotion?u.chipPressed:null],children:[
|
|
114
|
+
/* @__PURE__ */E(Text,{tier:"compact",style:[u.chipLabel,s?u.chipLabelPicked:null,r?u.chipLabelBusy:null],children:zi(e.startsAt)}),d.length>0?/* @__PURE__ */E(Text,{tier:"compact",style:[u.chipZone,s?u.chipLabelPicked:null,r?u.chipLabelBusy:null],testID:`${a}-${e.slotId}-zone`,children:d}):null]},e.slotId)})})]},e.key))})]})}function as(e,t){return t?["morning","afternoon","evening"].map(n=>({key:n,label:t[n],slots:e.filter(e=>Ui(e.startsAt)===n)})).filter(e=>e.slots.length>0):[{key:"all",label:null,slots:e}]}function ss(e,t){for(let n of t)if(n!==null&&e.some(e=>e.key===n))return n;return null}function ds(e){let{color:t,space:n,radius:r,type:l}=e,{size:i,lineHeight:o}=l,a=ca(e),s=e.slots.chip,d=ha(s);return h.create({root:{flex:1,minHeight:0},groups:{gap:n.lg,paddingBottom:n.xl},group:{gap:n.sm},period:{...face(e,"monoBold"),color:a.muted,fontSize:12,lineHeight:16,letterSpacing:.96,textTransform:"uppercase"},gridScroll:{flex:1},zone:{textAlign:"center",...face(e,"mono"),color:t.text.muted,fontSize:i.tiny,lineHeight:i.tiny*o.normal,letterSpacing:.4,paddingVertical:n.md},grid:{flexDirection:"row",flexWrap:"wrap",gap:n.sm},chip:{minWidth:96,flexGrow:1,flexBasis:"auto",minHeight:44,borderRadius:r.pill,borderWidth:1.5,borderColor:a.line,backgroundColor:a.surface,alignItems:"center",justifyContent:"center",paddingHorizontal:n.md,...ua(s,1.5)},chipPicked:{borderColor:a.ink,backgroundColor:a.pink},chipLabelPicked:{color:a.onPink},chipPressed:{transform:[{scale:.95}]},chipBusy:{backgroundColor:t.primary,borderColor:t.primary},chipDisabled:{opacity:.45},chipLabel:{...face(e,"bold"),color:a.ink,fontSize:i.bodyTight,lineHeight:i.bodyTight*o.snug,fontVariant:["tabular-nums"],...d},chipLabelBusy:{color:t.onPrimary},chipZone:{...face(e,"mono"),color:t.text.muted,fontSize:i.tiny,lineHeight:i.tiny*o.normal,letterSpacing:.4,...d}})}function TelevetSummaryRow({label:e,value:t,last:r=false,action:l,note:i,testID:o}){let a=useEverfurTheme(),s=n(()=>us(a),[a]);/* @__PURE__ */
|
|
115
115
|
return z(f,{style:[s.row,r?s.rowLast:null],testID:o,children:[
|
|
116
116
|
/* @__PURE__ */E(Text,{style:s.rowLabel,children:e}),i?/* @__PURE__ */z(f,{style:s.rowValueStack,children:[
|
|
117
117
|
/* @__PURE__ */E(Text,{style:[s.rowValue,s.rowValueStacked],children:t}),
|
|
118
|
-
/* @__PURE__ */E(Text,{style:s.rowNote,testID:o?`${o}-note`:void 0,children:i})]}):/* @__PURE__ */E(Text,{style:s.rowValue,children:t}),l??null]})}function TelevetConsentCheckbox({label:e,checked:t,onToggle:r,testID:l}){let i=useEverfurTheme(),o=n(()=>
|
|
118
|
+
/* @__PURE__ */E(Text,{style:s.rowNote,testID:o?`${o}-note`:void 0,children:i})]}):/* @__PURE__ */E(Text,{style:s.rowValue,children:t}),l??null]})}function TelevetConsentCheckbox({label:e,checked:t,onToggle:r,testID:l}){let i=useEverfurTheme(),o=n(()=>us(i),[i]);/* @__PURE__ */
|
|
119
119
|
return z(m,{onPress:()=>r(!t),accessibilityRole:"checkbox",accessibilityLabel:e,accessibilityState:{checked:t},testID:l,style:o.consent,children:[
|
|
120
|
-
/* @__PURE__ */E(f,{style:[o.box,t?o.boxChecked:null],children:t?/* @__PURE__ */E(Text,{tier:"badge",style:o.tick,children:
|
|
121
|
-
/* @__PURE__ */E(Text,{style:o.consentLabel,children:e})]})}var
|
|
122
|
-
return E(f,{style:l.card,testID:t,children:e})}function
|
|
120
|
+
/* @__PURE__ */E(f,{style:[o.box,t?o.boxChecked:null],children:t?/* @__PURE__ */E(Text,{tier:"badge",style:o.tick,children:cs}):null}),
|
|
121
|
+
/* @__PURE__ */E(Text,{style:o.consentLabel,children:e})]})}var cs="✓";function TelevetSummaryCard({children:e,testID:t}){let r=useEverfurTheme(),l=n(()=>us(r),[r]);/* @__PURE__ */
|
|
122
|
+
return E(f,{style:l.card,testID:t,children:e})}function us(e){let{color:t,space:n,radius:r,type:l}=e,{size:i,lineHeight:o}=l,a=ha(e.slots.card);return h.create({card:{borderRadius:r.lg,borderWidth:1,borderColor:t.borderRingCream,backgroundColor:t.surface,paddingHorizontal:n.lg,...ua(e.slots.card,1)},row:{flexDirection:"row",alignItems:"center",gap:n.md,minHeight:48,paddingVertical:n.md,borderBottomWidth:1,borderBottomColor:t.borderRingCream},rowLast:{borderBottomWidth:0},rowLabel:{width:64,...face(e,"regular"),color:t.text.muted,fontSize:i.bodyTight,lineHeight:i.bodyTight*o.normal,...a},rowValue:{flex:1,...face(e,"bold"),color:t.brandInk,fontSize:i.bodyTight,lineHeight:i.bodyTight*o.normal,...a},rowValueStack:{flex:1,gap:2},rowValueStacked:{flex:0},rowNote:{...face(e,"regular"),color:t.text.muted,fontSize:i.caption,lineHeight:i.caption*o.normal,...a},consent:{flexDirection:"row",alignItems:"flex-start",gap:n.md,minHeight:fa,paddingVertical:14,paddingHorizontal:n.lg,borderRadius:r.sm,backgroundColor:t.surfaceSubtle},box:{width:22,height:22,borderRadius:r.xs,borderWidth:1.5,borderColor:t.brandInk,backgroundColor:t.surface,alignItems:"center",justifyContent:"center"},boxChecked:{backgroundColor:t.primary,borderColor:t.primary},tick:{...face(e,"bold"),color:t.onPrimary,fontSize:i.caption,lineHeight:i.caption,includeFontPadding:false},consentLabel:{flex:1,...face(e,"regular"),color:t.text.primary,fontSize:i.bodyTight,lineHeight:i.bodyTight*o.relaxed}})}function ReviewStep({when:e,onChangeWhen:t,stateName:r,about:l,lengthMinutes:i,clinician:o,clinicianRole:a,petName:s,reason:d,shareRecords:c,onToggleShare:u,stateCode:p,stateAttested:h,onToggleStateAttest:m,cancellationTerms:g,termsAttested:y,onToggleTermsAttest:b,canConfirm:v,busy:T,failure:k,onConfirm:C,emergency:S,onAcknowledgeEmergency:_,onSeeOtherVets:x,mediaShortfall:I=io,primaryVet:D,onFindEmergencyVet:P}){let R=ma(),F=useEverfurTheme(),L=n(()=>ms(F),[F]),A=r??p??"",j=s?Ie(De.whereAttestTemplate,{pet:s,state:A}):Ie(De.stateAttestTemplate,{state:A}),O=l??d,N=De.emergency.lede;/* @__PURE__ */
|
|
123
123
|
return z(f,{style:R.scrollRoot,testID:"televet-booking-review",children:[
|
|
124
124
|
/* @__PURE__ */z(w,{style:R.scrollBody,contentContainerStyle:L.body,keyboardShouldPersistTaps:"handled",showsVerticalScrollIndicator:false,testID:"televet-booking-review-scroll",children:[
|
|
125
125
|
/* @__PURE__ */E(Text,{tier:"heading",style:R.stepTitle,accessibilityRole:"header",children:De.reviewHeading}),
|
|
@@ -133,32 +133,32 @@ return z(f,{style:R.scrollRoot,testID:"televet-booking-review",children:[
|
|
|
133
133
|
/* @__PURE__ */E(TelevetEmergencyExits,{petName:s,primaryVet:D,onFindEmergencyVet:P}),
|
|
134
134
|
/* @__PURE__ */E(TelevetButton,{label:De.emergency.keepBookingCta,kind:"secondary",loading:T,disabled:T,onPress:_,testID:"televet-review-emergency-ack"})]}):null,k==="failed"?/* @__PURE__ */E(TelevetFailureLine,{message:De.confirmFailed}):null,k==="clinician_unavailable"?/* @__PURE__ */z(f,{style:R.list,testID:"televet-review-clinician-unavailable",children:[
|
|
135
135
|
/* @__PURE__ */E(TelevetFailureLine,{message:De.confirmFailed}),
|
|
136
|
-
/* @__PURE__ */E(TelevetButton,{label:De.seeOtherVetsCta,kind:"secondary",onPress:x,testID:"televet-review-see-other-vets"})]}):null,k==="rate_limited"?/* @__PURE__ */E(TelevetFailureLine,{message:De.confirmFailed,testID:"televet-review-rate-limited"}):null,k==="not_entitled"?/* @__PURE__ */E(TelevetFailureLine,{message:De.bookingPausedTitle,testID:"televet-review-not-entitled"}):null]}),S?null:/* @__PURE__ */E(f,{style:R.scrollFooter,children:/* @__PURE__ */E(TelevetButton,{label:T?De.confirmBusy:De.confirmCta,kind:"primary",loading:T,disabled:!v||T||!!p&&!h||!!g&&!y,onPress:C,testID:"televet-review-confirm"})})]})}var
|
|
136
|
+
/* @__PURE__ */E(TelevetButton,{label:De.seeOtherVetsCta,kind:"secondary",onPress:x,testID:"televet-review-see-other-vets"})]}):null,k==="rate_limited"?/* @__PURE__ */E(TelevetFailureLine,{message:De.confirmFailed,testID:"televet-review-rate-limited"}):null,k==="not_entitled"?/* @__PURE__ */E(TelevetFailureLine,{message:De.bookingPausedTitle,testID:"televet-review-not-entitled"}):null]}),S?null:/* @__PURE__ */E(f,{style:R.scrollFooter,children:/* @__PURE__ */E(TelevetButton,{label:T?De.confirmBusy:De.confirmCta,kind:"primary",loading:T,disabled:!v||T||!!p&&!h||!!g&&!y,onPress:C,testID:"televet-review-confirm"})})]})}var ps="○";function hs(e,t){return t?e.find(e=>e.petRef===t||e.petId===t)?.name??null:null}function TelevetStepFrame({heading:e,lead:t,testID:r,scrollTestID:l,scrollRef:i,footer:o,children:a}){let s=ma(),d=useEverfurTheme(),c=n(()=>ms(d),[d]),u=C.OS==="ios",p=Za(void 0,u);/* @__PURE__ */
|
|
137
137
|
return E(f,{style:s.scrollRoot,testID:r,children:/* @__PURE__ */z(S,{behavior:u?"padding":void 0,style:c.avoider,...p.avoidingProps,children:[
|
|
138
138
|
/* @__PURE__ */E(KeyboardOffsetProbe,{probeRef:p.probeRef}),
|
|
139
139
|
/* @__PURE__ */z(w,{...i?{ref:i}:{},style:s.scrollBody,contentContainerStyle:c.body,keyboardShouldPersistTaps:"handled",keyboardDismissMode:u?"interactive":"on-drag",showsVerticalScrollIndicator:false,...l?{testID:l}:{},children:[
|
|
140
140
|
/* @__PURE__ */z(f,{style:c.head,children:[
|
|
141
|
-
/* @__PURE__ */E(Text,{tier:"heading",style:s.stepTitle,accessibilityRole:"header",children:e}),t?/* @__PURE__ */E(Text,{style:s.stepHelp,children:t}):null]}),a]}),o?/* @__PURE__ */E(f,{style:s.scrollFooter,children:o}):null]})})}function TelevetChoiceRow({title:e,meta:t,selected:r,onPress:l,testID:i,leading:o}){let a=useEverfurTheme(),s=n(()=>
|
|
141
|
+
/* @__PURE__ */E(Text,{tier:"heading",style:s.stepTitle,accessibilityRole:"header",children:e}),t?/* @__PURE__ */E(Text,{style:s.stepHelp,children:t}):null]}),a]}),o?/* @__PURE__ */E(f,{style:s.scrollFooter,children:o}):null]})})}function TelevetChoiceRow({title:e,meta:t,selected:r,onPress:l,testID:i,leading:o}){let a=useEverfurTheme(),s=n(()=>ms(a),[a]);/* @__PURE__ */
|
|
142
142
|
return z(m,{onPress:l,accessibilityRole:"radio",accessibilityLabel:t?`${e}, ${t}`:e,accessibilityState:{checked:r,selected:r},testID:i,style:({pressed:e})=>[s.choice,r?s.choiceSelected:null,e&&!a.motion.reducedMotion?s.pressed:null],children:[o??/* @__PURE__ */E(f,{style:s.radio,children:/* @__PURE__ */E(f,{style:[s.radioDot,r?s.radioDotOn:null]})}),
|
|
143
143
|
/* @__PURE__ */z(f,{style:s.choiceText,children:[
|
|
144
|
-
/* @__PURE__ */E(Text,{style:s.choiceTitle,children:e}),t?/* @__PURE__ */E(Text,{tier:"compact",style:s.choiceMeta,children:t}):null]})]})}function PetStep({pets:e,isPending:t,isError:r,error:l,onRetry:i,selectedId:o,onSelect:a,onNext:s,onAddPet:d}){let c=
|
|
145
|
-
/* @__PURE__ */E(f,{style:p.choices,accessibilityRole:"radiogroup",testID:"televet-pets",children:e.map(e=>/* @__PURE__ */E(TelevetChoiceRow,{title:e.name??"",meta:
|
|
144
|
+
/* @__PURE__ */E(Text,{style:s.choiceTitle,children:e}),t?/* @__PURE__ */E(Text,{tier:"compact",style:s.choiceMeta,children:t}):null]})]})}function PetStep({pets:e,isPending:t,isError:r,error:l,onRetry:i,selectedId:o,onSelect:a,onNext:s,onAddPet:d}){let c=ma(),u=useEverfurTheme(),p=n(()=>ms(u),[u]);return t?/* @__PURE__ */E(f,{style:c.list,testID:"televet-pets-loading",children:[0,1].map(e=>/* @__PURE__ */E(TelevetSkeletonBlock,{height:72},e))}):r?/* @__PURE__ */E(f,{testID:"televet-pets-error",children:/* @__PURE__ */E(TelevetLoadFailed,{error:l,title:De.chrome.loadFailedTitle,actionLabel:De.chrome.retryCta,onRetry:i})}):e.length===0?/* @__PURE__ */E(f,{testID:"televet-pets-empty",children:/* @__PURE__ */E(TelevetStateCard,{title:De.chrome.noPetsTitle,actionLabel:De.addPetCta,onAction:d})}):/* @__PURE__ */z(TelevetStepFrame,{heading:De.petSelectTitle,testID:"televet-booking-pets",footer:s?/* @__PURE__ */E(TelevetButton,{label:De.continueCta,kind:"primary",disabled:!o,onPress:s,testID:"televet-pets-next"}):null,children:[
|
|
145
|
+
/* @__PURE__ */E(f,{style:p.choices,accessibilityRole:"radiogroup",testID:"televet-pets",children:e.map(e=>/* @__PURE__ */E(TelevetChoiceRow,{title:e.name??"",meta:Ua(e),selected:o===e.petRef,onPress:()=>a(e.petRef),testID:`televet-pet-${e.petRef}`,leading:/* @__PURE__ */E(f,{style:p.petDisc,children:/* @__PURE__ */E(Text,{tier:"compact",style:p.petDiscGlyph,children:fs(e.name??"")})})},e.petRef))}),d?/* @__PURE__ */E(TelevetButton,{label:De.addAnotherPetCta,kind:"quiet",fullWidth:false,onPress:d,testID:"televet-pet-add"}):null]})}function fs(e){let t=e.trim();return t.length===0?ps:t.slice(0,1).toUpperCase()}function ClinicianStep({clinicians:e,isPending:t,isError:r,error:l,selectedId:i,stateCode:o,stateName:a,onSelect:s,onRetry:d}){let c=ma(),u=useEverfurTheme(),p=n(()=>ms(u),[u]);if(t)/* @__PURE__ */
|
|
146
146
|
return E(f,{style:c.list,testID:"televet-clinicians-loading",children:/* @__PURE__ */E(TelevetSkeletonBlock,{height:220})});if(r)/* @__PURE__ */
|
|
147
147
|
return E(f,{testID:"televet-clinicians-error",children:/* @__PURE__ */E(TelevetLoadFailed,{error:l,title:De.chrome.loadFailedTitle,actionLabel:De.chrome.retryCta,onRetry:d})});if(e.length===0)/* @__PURE__ */
|
|
148
148
|
return E(f,{testID:"televet-clinicians-empty",children:/* @__PURE__ */E(TelevetStateCard,{title:De.noCliniciansTitle,message:De.noCliniciansBody,actionLabel:De.noCliniciansRetryCta,onAction:d})});let h=e.find(e=>e.clinicianId===i)??e[0];if(h===void 0)return null;let m=o?.trim().toUpperCase()??"",g=m.length>0&&h.licensedStates.some(e=>e.state.trim().toUpperCase()===m),y=h.role==="vet_tech";/* @__PURE__ */
|
|
149
149
|
return E(TelevetStepFrame,{heading:De.yourVetTitle,testID:"televet-clinicians",footer:/* @__PURE__ */E(TelevetButton,{label:De.continueCta,kind:"primary",onPress:()=>s(h.clinicianId),testID:`televet-clinician-${h.clinicianId}`}),children:/* @__PURE__ */z(f,{style:p.meet,children:[
|
|
150
|
-
/* @__PURE__ */E(f,{style:p.vetAvatar,children:/* @__PURE__ */E(Text,{tier:"heading",style:p.vetAvatarText,children:
|
|
151
|
-
/* @__PURE__ */E(Text,{style:p.vetName,children:h.credentials?`${h.displayName}, ${h.credentials}`:h.displayName}),y?/* @__PURE__ */E(f,{style:p.pill,testID:"televet-vet-role",children:/* @__PURE__ */E(Text,{tier:"badge",style:p.pillText,children:De.vetTechRoleLabel})}):null,g&&a?/* @__PURE__ */E(f,{style:p.pill,testID:"televet-vet-licensed",children:/* @__PURE__ */E(Text,{tier:"badge",style:p.pillText,children:Ie(De.licensedPillTemplate,{state:a})})}):null,y?/* @__PURE__ */E(Text,{tier:"compact",style:p.vetRating,testID:"televet-vet-no-rx",children:De.vetTechNoRxLine}):null,h.rating!==null&&h.ratingCount!==null?/* @__PURE__ */E(Text,{tier:"compact",style:p.vetRating,testID:"televet-vet-rating",children:`★ ${String(h.rating)} · ${String(h.ratingCount)} ${De.reviewsLabel}`}):null,h.bio?/* @__PURE__ */E(Text,{style:p.vetBio,testID:"televet-vet-bio",children:h.bio}):null]})})}function SlotStep({slots:e,enabled:t,isPending:n,isError:r,error:l,busySlotId:i,failure:o,selectedSlot:a,nextOpening:s,onPick:d,onRetry:c,onSeeOtherVets:u}){let p=
|
|
150
|
+
/* @__PURE__ */E(f,{style:p.vetAvatar,children:/* @__PURE__ */E(Text,{tier:"heading",style:p.vetAvatarText,children:Ca(h.displayName)||ps})}),
|
|
151
|
+
/* @__PURE__ */E(Text,{style:p.vetName,children:h.credentials?`${h.displayName}, ${h.credentials}`:h.displayName}),y?/* @__PURE__ */E(f,{style:p.pill,testID:"televet-vet-role",children:/* @__PURE__ */E(Text,{tier:"badge",style:p.pillText,children:De.vetTechRoleLabel})}):null,g&&a?/* @__PURE__ */E(f,{style:p.pill,testID:"televet-vet-licensed",children:/* @__PURE__ */E(Text,{tier:"badge",style:p.pillText,children:Ie(De.licensedPillTemplate,{state:a})})}):null,y?/* @__PURE__ */E(Text,{tier:"compact",style:p.vetRating,testID:"televet-vet-no-rx",children:De.vetTechNoRxLine}):null,h.rating!==null&&h.ratingCount!==null?/* @__PURE__ */E(Text,{tier:"compact",style:p.vetRating,testID:"televet-vet-rating",children:`★ ${String(h.rating)} · ${String(h.ratingCount)} ${De.reviewsLabel}`}):null,h.bio?/* @__PURE__ */E(Text,{style:p.vetBio,testID:"televet-vet-bio",children:h.bio}):null]})})}function SlotStep({slots:e,enabled:t,isPending:n,isError:r,error:l,busySlotId:i,failure:o,selectedSlot:a,nextOpening:s,onPick:d,onRetry:c,onSeeOtherVets:u}){let p=ma();return t?n?/* @__PURE__ */E(f,{style:p.list,testID:"televet-slots-loading",children:[0,1,2].map(e=>/* @__PURE__ */E(TelevetSkeletonBlock,{height:48},e))}):r?/* @__PURE__ */E(TelevetLoadFailed,{error:l,title:De.slotsErrorTitle,actionLabel:De.retryCta,onRetry:c,testID:"televet-slots-error"}):e.length===0?/* @__PURE__ */E(f,{testID:"televet-slots-empty",children:/* @__PURE__ */E(TelevetStateCard,{title:De.noSlotsTitle,message:s?Ie(De.nextOpeningTemplate,{when:formatWhenWithDay(s.startsAt)}):void 0,actionLabel:s?De.seeOtherVetsCta:void 0,onAction:s?u:void 0})}):
|
|
152
152
|
/* @__PURE__ */z(f,{style:p.stepFillBox,testID:"televet-slots",children:[
|
|
153
153
|
/* @__PURE__ */E(Text,{tier:"heading",style:p.stepTitle,accessibilityRole:"header",children:De.timeHeading}),o==="expired"?/* @__PURE__ */E(TelevetFailureLine,{message:De.holdExpired}):null,o==="taken"?/* @__PURE__ */E(TelevetFailureLine,{message:De.slotTaken}):null,o==="failed"||o==="rate_limited"?/* @__PURE__ */E(TelevetFailureLine,{message:De.confirmFailed,testID:"televet-slots-hold-failed"}):null,
|
|
154
|
-
/* @__PURE__ */E(TelevetSlotPicker,{slots:e,busySlotId:i,onPick:d,selectedSlot:a,periodLabels:{morning:De.timeMorning,afternoon:De.timeAfternoon,evening:De.timeEvening}})]}):/* @__PURE__ */E(f,{testID:"televet-slots-unavailable",children:/* @__PURE__ */E(TelevetStateCard,{title:De.bookingPausedTitle})})}function ReasonStep({value:e,composed:t,vetName:r,onChange:l,onNext:i,media:o,onChangeMedia:a,onPickMedia:s,mediaLive:d=false,checking:c=false}){let u=useEverfurTheme(),p=n(()=>
|
|
154
|
+
/* @__PURE__ */E(TelevetSlotPicker,{slots:e,busySlotId:i,onPick:d,selectedSlot:a,periodLabels:{morning:De.timeMorning,afternoon:De.timeAfternoon,evening:De.timeEvening}})]}):/* @__PURE__ */E(f,{testID:"televet-slots-unavailable",children:/* @__PURE__ */E(TelevetStateCard,{title:De.bookingPausedTitle})})}function ReasonStep({value:e,composed:t,vetName:r,onChange:l,onNext:i,media:o,onChangeMedia:a,onPickMedia:s,mediaLive:d=false,checking:c=false}){let u=useEverfurTheme(),p=n(()=>ms(u),[u]),h=(t??e).trim(),m=h.length>0&&h.length<=V,g=r?Ie(De.describeHeadingTemplate,{vet:r}):De.describeHeading;/* @__PURE__ */
|
|
155
155
|
return z(TelevetStepFrame,{heading:g,lead:De.describeHelpLong,testID:"televet-booking-reason",scrollTestID:"televet-booking-reason-scroll",footer:/* @__PURE__ */E(TelevetButton,{label:De.continueCta,kind:"primary",disabled:!m,loading:c,onPress:i,testID:"televet-reason-next"}),children:[
|
|
156
156
|
/* @__PURE__ */z(f,{style:p.field,children:[
|
|
157
157
|
/* @__PURE__ */E(Text,{tier:"compact",style:p.fieldLabel,children:De.describeFieldLabel}),
|
|
158
|
-
/* @__PURE__ */E(
|
|
159
|
-
/* @__PURE__ */E(TelevetIntakeMedia,{media:o,onChange:a,meta:d?De.addPhotoMeta:null,...s?{onPickMedia:s}:{}})]})}function
|
|
158
|
+
/* @__PURE__ */E(tl,{value:e,onChangeText:l,multiline:true,accessibilityLabel:De.describeFieldLabel,placeholder:De.reasonPlaceholder,placeholderTextColor:u.color.text.placeholder,style:p.reasonInput,testID:"televet-reason-input"})]}),(t??e).trim().length>V?/* @__PURE__ */E(TelevetFailureLine,{message:De.reasonTooLong}):null,
|
|
159
|
+
/* @__PURE__ */E(TelevetIntakeMedia,{media:o,onChange:a,meta:d?De.addPhotoMeta:null,...s?{onPickMedia:s}:{}})]})}function ms(e){let{color:t,space:n,radius:r,type:l}=e,{size:i,lineHeight:o}=l,a=ca(e),s=e.slots.card,d=ha(s);return h.create({marker:{minHeight:1},spacer:{height:n.md},body:{gap:n.xl,paddingBottom:n.xl},avoider:{flex:1,minHeight:0},head:{gap:n.sm},pressed:{transform:[{scale:.98}]},choices:{gap:n.md},choice:{flexDirection:"row",alignItems:"center",gap:n.lg,minHeight:64,paddingVertical:n.lg,paddingHorizontal:18,borderRadius:r.lg,borderWidth:1.5,borderColor:a.line,backgroundColor:a.surface,...ua(s,1.5)},choiceSelected:{borderColor:a.ink,backgroundColor:a.pinkSoft},radio:{width:22,height:22,borderRadius:11,borderWidth:1.5,borderColor:a.ink,alignItems:"center",justifyContent:"center"},radioDot:{width:10,height:10,borderRadius:5,backgroundColor:"transparent"},radioDotOn:{backgroundColor:a.ink},choiceText:{flex:1,gap:2},choiceTitle:{...face(e,"bold"),color:a.ink,fontSize:i.body,lineHeight:i.body*o.snug},choiceMeta:{...face(e,"regular"),color:a.muted,fontSize:i.caption,lineHeight:i.caption*o.normal},petDisc:{width:48,height:48,borderRadius:24,backgroundColor:a.mist,alignItems:"center",justifyContent:"center"},petDiscGlyph:{...face(e,"medium"),color:a.ink,fontSize:i.subtitle,lineHeight:i.subtitle},meet:{alignItems:"center",gap:6,paddingVertical:n.xxl,paddingHorizontal:n.xl,borderRadius:r.lg,borderWidth:1,borderColor:a.line,...ua(s,1)},vetAvatar:{width:104,height:104,borderRadius:52,borderWidth:4,borderColor:a.go,backgroundColor:a.mist,alignItems:"center",justifyContent:"center",marginBottom:n.sm},vetAvatarText:{...face(e,"medium"),color:a.ink,fontSize:36,lineHeight:40},vetName:{...headingFace(e,"medium"),color:a.ink,fontSize:i.heading,lineHeight:i.heading*o.snug,textAlign:"center",...d},pill:{height:24,paddingHorizontal:10,borderRadius:r.pill,borderWidth:1.5,borderColor:a.line,justifyContent:"center",marginVertical:n.xs},pillText:{...face(e,"monoBold"),color:a.muted,fontSize:11,letterSpacing:.9,textTransform:"uppercase"},vetRating:{...face(e,"regular"),color:a.muted,fontSize:i.caption,lineHeight:i.caption*o.normal,...d},vetBio:{...face(e,"regular"),color:a.text,fontSize:i.bodyTight,lineHeight:i.bodyTight*o.relaxed,textAlign:"center",...d},field:{gap:n.sm},fieldLabel:{...face(e,"bold"),color:a.ink,fontSize:i.bodyTight,lineHeight:i.bodyTight*o.snug},reasonInput:{minHeight:140,textAlignVertical:"top",borderWidth:1.5,borderColor:a.line,borderRadius:r.lg,paddingVertical:n.lg,paddingHorizontal:18,backgroundColor:a.surface,...face(e,"regular"),color:t.text.primary,fontSize:i.body,lineHeight:i.body*o.relaxed,...ua(e.slots.input,1.5),...ha(e.slots.input)},emergencyBanner:{gap:n.md,padding:18,borderRadius:r.lg,borderWidth:1.5,borderColor:a.alert,backgroundColor:a.alertWash},emergencyTitle:{...face(e,"bold"),color:t.errorRed,fontSize:i.subtitle,lineHeight:i.subtitle*o.snug},emergencyLede:{...face(e,"regular"),color:a.text,fontSize:i.body,lineHeight:i.body*o.relaxed}})}function TelevetLoadFailed({error:e,title:t,actionLabel:n,onRetry:r,testID:l}){let i=or(e),o=l===void 0?{}:{testID:l};return i.rateLimited?/* @__PURE__ */E(TelevetStateCard,{title:rr.title,message:rr.body,...i.waiting?{}:{actionLabel:n,onAction:r},testID:l===void 0?"televet-rate-limited":`${l}-rate-limited`}):/* @__PURE__ */E(TelevetStateCard,{title:t,actionLabel:n,onAction:r,...o})}function gs(){let e=useEverfurTheme(),{fontScale:t}=P(),r=e.type.scaleCaps.heading,l=r>0?Math.min(t||1,r):t||1;return n(()=>qa(e,l),[e,l])}function StepLabel({step:e,styles:t}){/* @__PURE__ */
|
|
160
160
|
return E(Text,{tier:"compact",style:t.stepLabel,testID:"televet-quick-step",children:Ie(De.loading.progressTemplate,{step:String(e),total:"2"})})}function QuickButton({label:e,onPress:t,disabled:n=false,busy:r=false,ghost:l=false,styles:i,testID:o}){let a=n||r;/* @__PURE__ */
|
|
161
|
-
return E(m,{onPress:t,disabled:a,accessibilityRole:"button",accessibilityLabel:e,accessibilityState:{disabled:a,busy:r},style:[i.button,l?i.buttonGhost:null,a?i.buttonDisabled:null],testID:o,children:/* @__PURE__ */E(Text,{tier:"control",style:[i.buttonLabel,l?i.buttonGhostLabel:null],children:e})})}function TelevetQuickReasonStep({petName:e,reasons:t,pickedId:n,onPick:r,note:l,onChangeNote:i,notePlaceholder:o,checking:a,onNext:s}){let d=
|
|
161
|
+
return E(m,{onPress:t,disabled:a,accessibilityRole:"button",accessibilityLabel:e,accessibilityState:{disabled:a,busy:r},style:[i.button,l?i.buttonGhost:null,a?i.buttonDisabled:null],testID:o,children:/* @__PURE__ */E(Text,{tier:"control",style:[i.buttonLabel,l?i.buttonGhostLabel:null],children:e})})}function TelevetQuickReasonStep({petName:e,reasons:t,pickedId:n,onPick:r,note:l,onChangeNote:i,notePlaceholder:o,checking:a,onNext:s}){let d=gs(),c=useEverfurTheme();/* @__PURE__ */
|
|
162
162
|
return z(f,{style:d.bleed,testID:"televet-quick-reason",children:[
|
|
163
163
|
/* @__PURE__ */z(w,{style:d.scroll,contentContainerStyle:d.body,keyboardShouldPersistTaps:"handled",children:[
|
|
164
164
|
/* @__PURE__ */E(StepLabel,{step:1,styles:d}),
|
|
@@ -169,19 +169,19 @@ return z(m,{onPress:()=>r(e.id),accessibilityRole:"radio",accessibilityState:{ch
|
|
|
169
169
|
/* @__PURE__ */E(Text,{style:[d.optionLabel,t?d.optionLabelPicked:null],children:e.label})]},e.id)})}),
|
|
170
170
|
/* @__PURE__ */z(f,{style:d.note,children:[
|
|
171
171
|
/* @__PURE__ */E(Text,{style:d.noteLabel,nativeID:"televet-quick-note-label",children:Ma.noteLabel}),
|
|
172
|
-
/* @__PURE__ */E(
|
|
173
|
-
/* @__PURE__ */E(f,{style:d.foot,children:/* @__PURE__ */E(QuickButton,{label:De.timeHeading,onPress:s,disabled:!n,busy:a,styles:d,testID:"televet-quick-next"})})]})}function
|
|
172
|
+
/* @__PURE__ */E(tl,{value:l,onChangeText:i,placeholder:o,placeholderTextColor:c.color.text.muted,accessibilityLabel:Ma.noteLabel,multiline:true,style:d.noteInput,testID:"televet-quick-note"})]})]}),
|
|
173
|
+
/* @__PURE__ */E(f,{style:d.foot,children:/* @__PURE__ */E(QuickButton,{label:De.timeHeading,onPress:s,disabled:!n,busy:a,styles:d,testID:"televet-quick-next"})})]})}function ys(e,t){let n=Bi(e);if(n===Bi(new Date(t).toISOString()))return Ma.today;let r=new Date(t);return r.setDate(r.getDate()+1),n===Bi(r.toISOString())?Ma.tomorrow:new Date(e).toLocaleDateString(void 0,{weekday:"short"})}function bs(e){return new Date(e).toLocaleDateString(void 0,{month:"short",day:"numeric"})}function vs(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 ji(e)}function Ts(e,t){if(!e)return Ma.bookCta;let n=ys(e.startsAt,t),r=n===Ma.today||n===Ma.tomorrow?n.toLowerCase():n;return Ie(Ma.bookAtTemplate,{day:r,time:zi(e.startsAt)})}function TelevetQuickTimeStep(e){let{slots:t,subtitle:l,finePrint:i,selectedSlot:o,busySlotId:a,failure:s,onPick:d,renderUnready:c,petName:u,stateCode:p,stateName:h,stateAttested:g,onToggleStateAttest:y,cancellationTerms:b,termsAttested:v,onToggleTermsAttest:T,canConfirm:k,busy:C,onConfirm:S,emergency:_,onAcknowledgeEmergency:x,onSeeOtherVets:I,primaryVet:D,onFindEmergencyVet:P}=e,R=gs(),L=useEverfurTheme(),A=n(()=>ms(L),[L]),j=e.nowMs??Date.now(),O=n(()=>{let e=/* @__PURE__ */new Map;for(let n of t){if(Number.isNaN(new Date(n.startsAt).getTime()))continue;let t=Bi(n.startsAt);e.has(t)||e.set(t,n.startsAt)}return[...e.entries()].map(([e,t])=>({key:e,iso:t}))},[t]),[N,B]=r(null),H=o?Bi(o.startsAt):null,M=[N,H,O[0]?.key].find(e=>e!=null&&O.some(t=>t.key===e))??null,$=t.filter(e=>Bi(e.startsAt)===M),W=[];for(let e=0;e<$.length;e+=2)W.push($.slice(e,e+2));let V=h??p??"",q=u?Ie(De.whereAttestTemplate,{pet:u,state:V}):Ie(De.stateAttestTemplate,{state:V}),U=De.emergency.lede,K=c===null,Y=!K||!k||C||!!p&&!g||!!b&&!v;/* @__PURE__ */
|
|
174
174
|
return z(f,{style:R.bleed,testID:"televet-quick-time",children:[
|
|
175
175
|
/* @__PURE__ */z(w,{style:R.scroll,contentContainerStyle:R.body,children:[
|
|
176
176
|
/* @__PURE__ */E(StepLabel,{step:2,styles:R}),
|
|
177
177
|
/* @__PURE__ */E(Text,{tier:"heading",style:R.title,accessibilityRole:"header",children:De.timeHeading}),
|
|
178
178
|
/* @__PURE__ */E(Text,{style:R.subtitle,children:l}),c?/* @__PURE__ */E(f,{style:R.lines,children:c()}):/* @__PURE__ */z(F,{children:[
|
|
179
|
-
/* @__PURE__ */E(f,{style:R.days,accessibilityRole:"radiogroup",children:O.map(e=>{let t=e.key===
|
|
179
|
+
/* @__PURE__ */E(f,{style:R.days,accessibilityRole:"radiogroup",children:O.map(e=>{let t=e.key===M,n=ys(e.iso,j),r=bs(e.iso);/* @__PURE__ */
|
|
180
180
|
return z(m,{onPress:()=>B(e.key),accessibilityRole:"radio",accessibilityState:{checked:t},accessibilityLabel:`${n}, ${r}`,style:[R.day,t?R.dayPicked:null],testID:`televet-quick-day-${e.key}`,children:[
|
|
181
181
|
/* @__PURE__ */E(Text,{tier:"heading",style:[R.dayName,t?R.dayTextPicked:null],children:n}),
|
|
182
182
|
/* @__PURE__ */E(Text,{tier:"heading",style:[R.dayDate,t?R.dayDatePicked:null],children:r})]},e.key)})}),
|
|
183
183
|
/* @__PURE__ */E(f,{style:R.slots,accessibilityRole:"radiogroup",testID:"televet-slots",children:W.map(e=>/* @__PURE__ */z(f,{style:R.slotRow,children:[e.map(e=>{let t=o?.slotId===e.slotId,n=a===e.slotId;/* @__PURE__ */
|
|
184
|
-
return E(m,{onPress:()=>d(e),disabled:a!==null||C,accessibilityRole:"radio",accessibilityState:{checked:t,busy:n},style:[R.slot,t?R.slotPicked:null],testID:`televet-slot-${e.slotId}`,children:/* @__PURE__ */E(Text,{tier:"compact",style:[R.slotLabel,t?R.slotLabelPicked:null],children:
|
|
184
|
+
return E(m,{onPress:()=>d(e),disabled:a!==null||C,accessibilityRole:"radio",accessibilityState:{checked:t,busy:n},style:[R.slot,t?R.slotPicked:null],testID:`televet-slot-${e.slotId}`,children:/* @__PURE__ */E(Text,{tier:"compact",style:[R.slotLabel,t?R.slotLabelPicked:null],children:zi(e.startsAt)})},e.slotId)}),e.length===1?/* @__PURE__ */E(f,{style:R.slotSpacer}):null]},e[0]?.slotId))})]}),
|
|
185
185
|
/* @__PURE__ */z(f,{style:R.lines,children:[s==="expired"?/* @__PURE__ */E(TelevetFailureLine,{message:De.holdExpired}):null,s==="taken"?/* @__PURE__ */E(TelevetFailureLine,{message:De.slotTaken}):null,s==="failed"||s==="rate_limited"?/* @__PURE__ */E(TelevetFailureLine,{message:De.confirmFailed,testID:"televet-quick-failed"}):null,s==="not_entitled"?/* @__PURE__ */E(TelevetFailureLine,{message:De.bookingPausedTitle}):null,s==="clinician_unavailable"?/* @__PURE__ */z(F,{children:[
|
|
186
186
|
/* @__PURE__ */E(TelevetFailureLine,{message:De.confirmFailed}),
|
|
187
187
|
/* @__PURE__ */E(TelevetButton,{label:De.seeOtherVetsCta,kind:"secondary",onPress:I,testID:"televet-quick-see-other-vets"})]}):null]}),K&&o?/* @__PURE__ */z(f,{style:R.ticks,children:[p?/* @__PURE__ */E(TelevetConsentCheckbox,{label:q,checked:g,onToggle:y,testID:"televet-quick-state-attest"}):null,b?/* @__PURE__ */E(TelevetConsentCheckbox,{label:b,checked:v,onToggle:T,testID:"televet-quick-terms-attest"}):null]}):null,_?/* @__PURE__ */z(f,{style:[A.emergencyBanner,R.ticks],testID:"televet-quick-emergency",children:[
|
|
@@ -189,29 +189,29 @@ return E(m,{onPress:()=>d(e),disabled:a!==null||C,accessibilityRole:"radio",acce
|
|
|
189
189
|
/* @__PURE__ */E(Text,{style:A.emergencyLede,children:U}),_.length>0?/* @__PURE__ */E(Text,{style:A.emergencyLede,children:_.join(", ")}):null,
|
|
190
190
|
/* @__PURE__ */E(TelevetEmergencyExits,{petName:u,primaryVet:D,onFindEmergencyVet:P}),
|
|
191
191
|
/* @__PURE__ */E(TelevetButton,{label:De.emergency.keepBookingCta,kind:"secondary",loading:C,disabled:C,onPress:x,testID:"televet-quick-emergency-ack"})]}):null]}),_?null:/* @__PURE__ */z(f,{style:R.foot,children:[
|
|
192
|
-
/* @__PURE__ */E(QuickButton,{label:C?De.confirmBusy:
|
|
192
|
+
/* @__PURE__ */E(QuickButton,{label:C?De.confirmBusy:Ts(o,j),onPress:S,disabled:Y,busy:C,styles:R,testID:"televet-quick-book"}),i?/* @__PURE__ */E(Text,{style:R.fine,testID:"televet-quick-fine",children:i}):null]})]})}function ks(e,t){let n=Ie(Ma.whenTemplate,{day:ys(e,t),date:bs(e),time:zi(e)}),r=vs(e);return r?`${n} ${r}`:n}function TelevetQuickBookedScreen({consult:e,petName:t,onDone:n,onAddToCalendar:l,renderNote:i,nowMs:o}){let a=gs(),[s,d]=r("idle"),c=async()=>{if(!l)return;let t=new Date(e.scheduledAt);if(Number.isNaN(t.getTime())){d("failed");return}d("saving");let n=await Te(l,{key:televetConsultCalendarKey(e.consultId),title:De.visit.title,startDate:t,endDate:new Date(t.getTime()+Ai*6e4),alarmOffsetMinutes:-30});d(n.ok&&n.value===true?"saved":"failed")};/* @__PURE__ */
|
|
193
193
|
return z(f,{style:a.bleed,testID:"televet-quick-booked",children:[
|
|
194
194
|
/* @__PURE__ */z(w,{style:a.scroll,contentContainerStyle:a.done,children:[
|
|
195
195
|
/* @__PURE__ */E(f,{style:a.check,accessibilityElementsHidden:true,importantForAccessibility:"no-hide-descendants",children:/* @__PURE__ */E(f,{style:a.checkMark})}),
|
|
196
|
-
/* @__PURE__ */E(Text,{tier:"heading",style:a.doneTitle,accessibilityRole:"header",children
|
|
197
|
-
/* @__PURE__ */E(Text,{style:a.when,testID:"televet-quick-booked-when",children:
|
|
196
|
+
/* @__PURE__ */E(Text,{tier:"heading",style:a.doneTitle,accessibilityRole:"header",children:$a(t)}),
|
|
197
|
+
/* @__PURE__ */E(Text,{style:a.when,testID:"televet-quick-booked-when",children:ks(e.scheduledAt,o??Date.now())}),
|
|
198
198
|
/* @__PURE__ */E(Text,{style:a.who,children:Ma.who}),i?/* @__PURE__ */E(f,{style:a.note2,children:i()}):null]}),
|
|
199
199
|
/* @__PURE__ */z(f,{style:a.foot,children:[s==="failed"?/* @__PURE__ */E(Text,{style:a.calendarNote,accessibilityLiveRegion:"polite",testID:"televet-quick-calendar-failed",children:De.booked.calendarFailedBody}):null,l?/* @__PURE__ */E(QuickButton,{label:s==="saved"?De.booked.calendarAdded:De.addToCalendarCta,onPress:()=>{c()},disabled:s==="saved",busy:s==="saving",ghost:true,styles:a,testID:"televet-quick-calendar"}):null,
|
|
200
|
-
/* @__PURE__ */E(QuickButton,{label:De.doneCta,onPress:n,styles:a,testID:"televet-quick-done"})]})]})}function TelevetVisitSimulator({petId:e,roster:t,onAddPet:n,onPickPet:r}){return e===null?/* @__PURE__ */E(PetStep,{pets:t.pets,isPending:t.loading,isError:t.error!==null,onRetry:()=>{t.refresh()},onAddPet:n,selectedId:null,onSelect:r}):/* @__PURE__ */E(SimulatorScreen,{petRef:e})}function SimulatorScreen({petRef:petRef}){let e=
|
|
200
|
+
/* @__PURE__ */E(QuickButton,{label:De.doneCta,onPress:n,styles:a,testID:"televet-quick-done"})]})]})}function TelevetVisitSimulator({petId:e,roster:t,onAddPet:n,onPickPet:r}){return e===null?/* @__PURE__ */E(PetStep,{pets:t.pets,isPending:t.loading,isError:t.error!==null,onRetry:()=>{t.refresh()},onAddPet:n,selectedId:null,onSelect:r}):/* @__PURE__ */E(SimulatorScreen,{petRef:e})}function SimulatorScreen({petRef:petRef}){let e=ma(),t=No(petRef);/* @__PURE__ */
|
|
201
201
|
return E(f,{style:e.stepFill,testID:"televet-simulator",children:/* @__PURE__ */z(w,{contentContainerStyle:e.list,children:[
|
|
202
|
-
/* @__PURE__ */E(TelevetStateCard,{title:
|
|
203
|
-
/* @__PURE__ */E(TelevetButton,{label:
|
|
204
|
-
/* @__PURE__ */E(Text,{style:e.stateMessage,testID:"televet-simulator-visit",children:t.visitLine}),
|
|
205
|
-
/* @__PURE__ */E(Text,{style:e.stateMessage,children:
|
|
202
|
+
/* @__PURE__ */E(TelevetStateCard,{title:To.title}),
|
|
203
|
+
/* @__PURE__ */E(TelevetButton,{label:To.create,onPress:t.create,kind:"secondary",disabled:t.busy,testID:"televet-simulator-create"}),t.visitLine!==null?/* @__PURE__ */z(F,{children:[
|
|
204
|
+
/* @__PURE__ */E(Text,{style:e.stateMessage,testID:"televet-simulator-visit",children:t.visitLine}),Bo.map(e=>/* @__PURE__ */E(TelevetButton,{label:To.advance[e],onPress:()=>t.advance(e),kind:"secondary",disabled:t.busy,testID:`televet-simulator-advance-${e}`},e)),
|
|
205
|
+
/* @__PURE__ */E(Text,{style:e.stateMessage,children:To.eventsNote}),Ho.map(e=>/* @__PURE__ */E(TelevetButton,{label:To.events[e],onPress:()=>t.raise(e),kind:"secondary",disabled:t.busy,testID:`televet-simulator-event-${e}`},e))]}):null,t.line===null?null:t.line.tone==="danger"?/* @__PURE__ */E(TelevetFailureLine,{message:t.line.text,testID:"televet-simulator-error"}):/* @__PURE__ */E(Text,{style:e.stateMessage,accessibilityLiveRegion:"polite",testID:"televet-simulator-log",children:t.line.text})]})})}function TelevetPick({label:e,on:t,onPress:r,testID:l,role:i="checkbox"}){let o=useEverfurTheme(),a=n(()=>ws(o),[o]);/* @__PURE__ */
|
|
206
206
|
return z(m,{onPress:r,accessibilityRole:i,accessibilityLabel:e,accessibilityState:{checked:t},testID:l,style:({pressed:e})=>[a.pick,t?a.pickOn:null,e&&!o.motion.reducedMotion?a.pressed:null],children:[t?/* @__PURE__ */E(f,{style:a.check,accessibilityElementsHidden:true,importantForAccessibility:"no"}):null,
|
|
207
|
-
/* @__PURE__ */E(Text,{tier:"control",style:[a.pickLabel,t?a.pickLabelOn:null],children:e})]})}function WhereStep({petName:e,where:t,onNext:r}){let l=useEverfurTheme(),i=n(()=>
|
|
207
|
+
/* @__PURE__ */E(Text,{tier:"control",style:[a.pickLabel,t?a.pickLabelOn:null],children:e})]})}function WhereStep({petName:e,where:t,onNext:r}){let l=useEverfurTheme(),i=n(()=>ms(l),[l]),o=n(()=>ws(l),[l]),a=e??De.petFallback,s=t.otherSelected;/* @__PURE__ */
|
|
208
208
|
return z(TelevetStepFrame,{heading:Ie(De.whereTitleTemplate,{pet:a}),lead:Ie(De.whereLeadTemplate,{pronoun:De.wherePronounFallback}),testID:"televet-booking-where",footer:/* @__PURE__ */E(TelevetButton,{label:De.continueCta,kind:"primary",disabled:!t.canContinue,onPress:r,testID:"televet-where-next"}),children:[t.hostPlace?/* @__PURE__ */z(f,{style:i.choices,accessibilityRole:"radiogroup",accessibilityLabel:Ie(De.whereFormLabelTemplate,{pet:a}),children:[
|
|
209
209
|
/* @__PURE__ */E(TelevetChoiceRow,{title:t.hostPlace.name,meta:t.hostPlace.meta,selected:!s,onPress:t.pickHost,testID:"televet-where-host"}),
|
|
210
210
|
/* @__PURE__ */E(TelevetChoiceRow,{title:De.whereAnotherState,meta:t.otherPlace?.meta??null,selected:s,onPress:t.pickOther,testID:"televet-where-other"})]}):null,s?/* @__PURE__ */z(f,{style:i.field,children:[
|
|
211
211
|
/* @__PURE__ */E(Text,{tier:"compact",style:i.fieldLabel,accessibilityRole:"header",children:De.whereWhichState}),
|
|
212
|
-
/* @__PURE__ */E(f,{style:o.pickRow,accessibilityRole:"radiogroup",accessibilityLabel:De.whereWhichState,children:
|
|
213
|
-
/* @__PURE__ */E(Text,{style:o.note,children:De.whereAskEveryTime})]})}function IssuesStep({petName:e,chips:t,selected:r,onToggle:l,onNext:i}){let o=useEverfurTheme(),a=n(()=>
|
|
214
|
-
return E(TelevetStepFrame,{heading:Ie(De.issuesTitleTemplate,{pet:e??De.petFallback}),lead:De.issuesHint,testID:"televet-booking-issues",footer:/* @__PURE__ */E(TelevetButton,{label:De.continueCta,kind:"primary",disabled:r.length===0,onPress:i,testID:"televet-issues-next"}),children:/* @__PURE__ */E(f,{style:a.pickRow,accessibilityLabel:De.issuesFormLabel,children:t.map(e=>/* @__PURE__ */E(TelevetPick,{label:e.label,on:r.includes(e.id),onPress:()=>l(e.id),testID:`televet-issue-${e.id}`},e.id))})})}function EmergencyStep({petName:e,answer:t,onAnswer:r,onNext:o,onHandled:a,primaryVet:s,onFindEmergencyVet:d}){let c=useEverfurTheme(),u=n(()=>
|
|
212
|
+
/* @__PURE__ */E(f,{style:o.pickRow,accessibilityRole:"radiogroup",accessibilityLabel:De.whereWhichState,children:mi.filter(e=>e.code!==t.hostPlace?.code).map(e=>/* @__PURE__ */E(TelevetPick,{label:e.name,role:"radio",on:t.otherPlace?.code===e.code,onPress:()=>t.pickState(e.code),testID:`televet-where-state-${e.code}`},e.code))}),t.hostPlace===null&&t.otherPlace?.meta?/* @__PURE__ */E(Text,{style:o.note,children:t.otherPlace.meta}):null]}):null,t.licensedLine?/* @__PURE__ */E(Text,{style:o.callout,testID:"televet-where-licensed",children:t.licensedLine}):null,
|
|
213
|
+
/* @__PURE__ */E(Text,{style:o.note,children:De.whereAskEveryTime})]})}function IssuesStep({petName:e,chips:t,selected:r,onToggle:l,onNext:i}){let o=useEverfurTheme(),a=n(()=>ws(o),[o]);/* @__PURE__ */
|
|
214
|
+
return E(TelevetStepFrame,{heading:Ie(De.issuesTitleTemplate,{pet:e??De.petFallback}),lead:De.issuesHint,testID:"televet-booking-issues",footer:/* @__PURE__ */E(TelevetButton,{label:De.continueCta,kind:"primary",disabled:r.length===0,onPress:i,testID:"televet-issues-next"}),children:/* @__PURE__ */E(f,{style:a.pickRow,accessibilityLabel:De.issuesFormLabel,children:t.map(e=>/* @__PURE__ */E(TelevetPick,{label:e.label,on:r.includes(e.id),onPress:()=>l(e.id),testID:`televet-issue-${e.id}`},e.id))})})}function EmergencyStep({petName:e,answer:t,onAnswer:r,onNext:o,onHandled:a,primaryVet:s,onFindEmergencyVet:d}){let c=useEverfurTheme(),u=n(()=>ms(c),[c]),p=n(()=>ws(c),[c]),h=De.emergencyCheck,m=De.emergency.lede,g=l(null),y=l(false);i(()=>{t!=="some"&&(y.current=false)},[t]);let b=e=>{y.current||(y.current=true,g.current?.scrollTo({y:Math.max(0,e.nativeEvent.layout.y-c.space.md),animated:!c.motion.reducedMotion}))};/* @__PURE__ */
|
|
215
215
|
return z(TelevetStepFrame,{heading:Ie(h.titleTemplate,{pet:e??De.petFallback}),lead:h.lead,scrollRef:g,testID:"televet-booking-emergency",footer:/* @__PURE__ */E(TelevetButton,{label:De.continueCta,kind:"primary",disabled:t!=="none",onPress:o,testID:"televet-emergency-next"}),children:[
|
|
216
216
|
/* @__PURE__ */E(f,{style:p.signs,testID:"televet-emergency-signs",children:h.signs.map(e=>/* @__PURE__ */z(f,{style:p.sign,children:[
|
|
217
217
|
/* @__PURE__ */E(f,{style:p.bullet}),
|
|
@@ -222,19 +222,19 @@ return z(TelevetStepFrame,{heading:Ie(h.titleTemplate,{pet:e??De.petFallback}),l
|
|
|
222
222
|
/* @__PURE__ */E(Text,{style:u.emergencyTitle,accessibilityRole:"header",children:De.emergency.bannerTitle}),
|
|
223
223
|
/* @__PURE__ */E(Text,{style:u.emergencyLede,children:m}),
|
|
224
224
|
/* @__PURE__ */E(TelevetEmergencyExits,{petName:e,primaryVet:s,onFindEmergencyVet:d}),
|
|
225
|
-
/* @__PURE__ */E(TelevetButton,{label:De.emergency.keepBookingCta,kind:"quiet",fullWidth:false,onPress:a,testID:"televet-emergency-handled"})]}):null]})}function
|
|
226
|
-
return E(SdkTabletColumn,{children:/* @__PURE__ */E(BookingBody,{...e})})}function BookingBody(e){let{petRef:petRef,usState:t,controller:s,onBooked:d,onExit:c,onAddPet:u,onPickMedia:p,onAddToCalendar:h,onConfirmDiscard:m,onRequestLocation:g,locationStatus:y="unknown",onTriageReason:b,onStateInterest:v,primaryVet:T,onFindEmergencyVet:k,canJoinInApp:w=false,renderUnavailable:C,style:S,testID:_,variant:x="steps",quick:I}=ve(e,["onBooked","onExit","onAddPet","onRequestLocation","onFindEmergencyVet"]),D=
|
|
227
|
-
/* @__PURE__ */E(TelevetBookingChrome,{step:ce,furthestIndex:B.furthestIndex,canGoBack:!qe&&(Se.open||(
|
|
228
|
-
/* @__PURE__ */E(TelevetClinicianOutcome,{state:Qe,cause:Ye,locationStatus:y,...g?{onRequestLocation:g}:{},onRetry:()=>ge.refetch(),stateInterest:_e,...C?{renderUnavailable:C}:{}}):
|
|
229
|
-
/* @__PURE__ */E(TelevetBookedScreen,{consult:ae,petName:
|
|
225
|
+
/* @__PURE__ */E(TelevetButton,{label:De.emergency.keepBookingCta,kind:"quiet",fullWidth:false,onPress:a,testID:"televet-emergency-handled"})]}):null]})}function ws(e){let{space:t,radius:n,type:r}=e,{size:l,lineHeight:i}=r,o=ca(e),a=e.slots.chip;return h.create({pickRow:{flexDirection:"row",flexWrap:"wrap",gap:10},pick:{minHeight:44,flexDirection:"row",alignItems:"center",gap:t.sm,paddingHorizontal:t.lg,borderRadius:n.pill,borderWidth:1,borderColor:o.ink,backgroundColor:o.surface,...ua(a,1)},pickOn:{backgroundColor:o.pink,borderColor:o.ink},pressed:{transform:[{scale:.97}]},check:{width:12,height:7,marginTop:-3,borderLeftWidth:2,borderBottomWidth:2,borderColor:o.onPink,transform:[{rotate:"-45deg"}]},pickLabel:{...face(e,"bold"),color:o.ink,fontSize:l.bodyTight,lineHeight:l.bodyTight*i.snug,...ha(a)},pickLabelOn:{color:o.onPink},note:{...face(e,"regular"),color:o.muted,fontSize:l.bodyTight,lineHeight:l.bodyTight*i.relaxed},callout:{padding:t.md,borderRadius:n.sm,backgroundColor:o.mist,overflow:"hidden",...face(e,"regular"),color:o.text,fontSize:l.bodyTight,lineHeight:l.bodyTight*i.relaxed},signs:{gap:t.sm},sign:{flexDirection:"row",gap:t.md,alignItems:"flex-start"},bullet:{width:6,height:6,borderRadius:3,backgroundColor:o.text,marginTop:l.body*.6},signText:{flex:1,...face(e,"regular"),color:o.text,fontSize:l.body,lineHeight:l.body*i.relaxed}})}function EverfurTelevetBooking(e){/* @__PURE__ */
|
|
226
|
+
return E(SdkTabletColumn,{children:/* @__PURE__ */E(BookingBody,{...e})})}function BookingBody(e){let{petRef:petRef,usState:t,controller:s,onBooked:d,onExit:c,onAddPet:u,onPickMedia:p,onAddToCalendar:h,onConfirmDiscard:m,onRequestLocation:g,locationStatus:y="unknown",onTriageReason:b,onStateInterest:v,primaryVet:T,onFindEmergencyVet:k,canJoinInApp:w=false,renderUnavailable:C,style:S,testID:_,variant:x="steps",quick:I}=ve(e,["onBooked","onExit","onAddPet","onRequestLocation","onFindEmergencyVet"]),D=ma(),P=useEverfurTheme(),R=n(()=>ms(P),[P]),L=useTelevetBookingController(s),A=useEverfurPets(),j=A.pets,O=j.length,N=n(()=>({ownedPetCount:O,withIssues:true}),[O]),[B,H]=a((e,t)=>televetBookingReducer(e,t,N),void 0,()=>{let e=initialTelevetBookingState({ownedPetCount:0,withIssues:true},{petId:petRef??null,state:t??null});return x==="quick"&&t?televetBookingReducer(e,{type:"goTo",step:"reason"},{ownedPetCount:0,withIssues:true}):e}),M=x==="quick",W=o(e=>H(e),[]),[V,q]=r(""),[U,K]=r(null),Y=n(()=>I?.reasons!==void 0&&I.reasons.length>0?I.reasons:hi(),[I?.reasons]),[G,J]=r(null),[Q,Z]=r(null),[X,ee]=r(false),[te,ne]=r(false),[re,le]=r([]),ie=n(()=>createRnChatAttachmentTransport(),[]),oe=co({media:re,controller:L,transport:ie}),[ae,se]=r(null),{draft:de}=B,ce=currentStep(B),ue=l(de.state);ue.current!==de.state&&(ue.current=de.state,X&&ee(false),te&&ne(false));let pe=useTelevetStatePolicy(de.state,L),he=useTelevetCancellationPolicy(L),fe=useTelevetBookingEntitlement(L),me=Oo(L,fe),ge=useTelevetClinicians(de.state,me),ye=useTelevetSlots(de.clinicianId,me),be=ye.refetch,Te=useTelevetNextSlot(me).data??null,ke=useTelevetHoldSlot(L),we=useTelevetBookConsult(L),Ce=n(()=>Xi(L),[L]),Se=useEarlyTriage(b??Ce),_e=useStateInterest(de.state,v??null).actionFor("no_licensed_vet"),xe=t??null,Ie=hs(j,de.petId),Pe=Ti({reasonText:V,state:de.state,hostState:xe,clinicianId:de.clinicianId,clinicians:ge.data,policy:pe,petName:Ie,controller:L,dispatch:W}),{where:Re,matchedClinician:Ee}=Pe,ze=Y.find(e=>e.id===U)?.label,Fe=M?fi(ze?[ze]:[],V):Pe.composedReason;i(()=>{xe&&!de.state&&!Pe.whereTouched.current&&W({type:"patch",patch:{state:xe}})},[xe,de.state,W]),i(()=>{petRef&&!de.petId&&W({type:"patch",patch:{petId:petRef}})},[petRef,de.petId,W]);let Le=j.length===1?j[0]?.petRef??null:null;i(()=>{Le&&!de.petId&&W({type:"patch",patch:{petId:Le}})},[Le,de.petId,W]);let Ae=l(ce);Ae.current=ce;let je=l(de.petId);je.current=de.petId;let Oe=l(0);i(()=>{if(O===Oe.current)return;Oe.current=O;let e=O>1&&!je.current;W({type:"goTo",step:e?"pet":Ae.current})},[O,W]);let Ne=ge.data?.[0]?.clinicianId??null;i(()=>{Ne&&!de.clinicianId&&W({type:"patch",patch:{clinicianId:Ne}})},[Ne,de.clinicianId,W]);let Be=o(e=>{M&&e.type==="next"||W(e)},[M,W]),He=Zi({draft:de,hold:ke,dispatch:Be,setFailure:J,refetchSlots:be});Gi({controller:L,draft:de,keep:ce==="booked"||we.isPending});let{submitBooking:Me,confirm:$e}=Ki({draft:de,reasonText:Fe,book:we,stateAttested:X,termsAttested:te,cancellationPolicy:he.data??null,triage:Se,goTo:o(e=>W({type:"goTo",step:e}),[W]),releaseSlot:o(()=>{W({type:"patch",patch:Pi}),be()},[W,be]),setFailure:J,setEmergency:Z,setBookedConsult:se,...d?{onBooked:d}:{},media:oe}),We=pe.enabled&&pe.data!==null&&!pe.data.wellnessAvailable&&ce!=="pet"&&ce!=="where",Ve=fe.enabled&&fe.data?.active===false||G==="not_entitled",{simulate:qe,fundingRefused:Ue}=Ao(fe,Ve),Ke=fe.enabled&&fe.data!==null,Ye=televetEmptyRosterCause(Ke),Ge=Fe.trim().length>0||!!de.slot,Je=L===null||G==="unavailable"||wr(fe)||wr(pe),Qe={noState:!de.state,isPending:ge.enabled&&ge.isPending,isError:ge.isError,isEmpty:(ge.data?.length??0)===0,notEntitled:Ue},Ze=wa(Qe),Xe=ce==="clinician"?"time":ce==="time"?"reason":ce==="reason"&&!xe?"where":(ce==="reason"||ce==="where")&&O>1?"pet":null,et=e=>W({type:"goTo",step:e==="pet"&&!xe?"where":e==="reason"?"time":"reason"}),tt=n(()=>qa(P),[P]),nt={surfaceUnavailable:Je,notEntitled:Ue,policyBlocked:We,triageOpen:Se.open,step:ce},rt=va(nt),lt=M&&!qe&&!rt&&(ce==="reason"||ce==="time"&&!Ze||ce==="booked"),it=e=>M&&!lt?/* @__PURE__ */E(f,{style:tt.pad,children:e}):e;return isTelevetBookingCopyReady()?/* @__PURE__ */z(f,{style:[D.screen,M?tt.screen:null,S],testID:_??"televet-booking",children:[
|
|
227
|
+
/* @__PURE__ */E(TelevetBookingChrome,{step:ce,furthestIndex:B.furthestIndex,canGoBack:!qe&&(Se.open||(M?Xe!==null:hasPreviousStep(B,N)))&&ce!=="booked",isDirty:Ge,onBack:()=>{if(Se.open){Se.close();return}Se.cancel(),M&&Xe?W({type:"goTo",step:Xe}):M||W({type:"back"})},onClose:()=>c?.(),triageOpen:Se.open,stepContext:N,presentation:M?"nav":"rail",...m?{onConfirmDiscard:m}:{}}),it(qe?/* @__PURE__ */E(TelevetVisitSimulator,{petId:de.petId,roster:A,onAddPet:u,onPickPet:e=>W({type:"patch",patch:{petId:e}})}):rt?/* @__PURE__ */E(TelevetBookingGate,{state:nt,petName:hs(j,de.petId),...T?{primaryVet:T}:{},onFindEmergencyVet:k,stateInterest:_e,...v?{onCheckAvailability:()=>W({type:"goTo",step:"clinician"})}:{},onAcknowledgeEmergency:()=>{Se.acknowledge(Fe),M?et("reason"):W({type:"next"})},...C?{renderUnavailable:C}:{}}):M&&ce==="reason"?/* @__PURE__ */E(TelevetQuickReasonStep,{petName:Ie,reasons:Y,pickedId:U,onPick:K,note:V,onChangeNote:q,notePlaceholder:I?.notePlaceholder??De.reasonPlaceholder,checking:Se.checking,onNext:()=>{Se.check(Fe).then(e=>{e&&et("reason")})}}):M&&ce==="time"&&!Ze?/* @__PURE__ */E(TelevetQuickTimeStep,{slots:ye.data??[],subtitle:I?.subtitle??Ma.who,finePrint:I?.finePrint??null,selectedSlot:de.slot,busySlotId:ke.isPending?ke.variables:null,failure:G,onPick:He,renderUnready:!ye.enabled||ye.isPending&&ye.data===null||ye.isError||(ye.data?.length??0)===0?()=>/* @__PURE__ */E(SlotStep,{slots:ye.data??[],enabled:ye.enabled,isPending:ye.enabled&&ye.isPending&&ye.data===null,isError:ye.isError,error:ye.error,busySlotId:null,failure:null,selectedSlot:de.slot,nextOpening:Te,onPick:He,onRetry:()=>ye.refetch(),onSeeOtherVets:()=>W({type:"goTo",step:"clinician"})}):null,petName:Ie,stateCode:de.state,stateName:Re.stateName,stateAttested:X,onToggleStateAttest:ee,cancellationTerms:he.data?.summary??null,termsAttested:te,onToggleTermsAttest:ne,canConfirm:canConfirm(de,Fe),busy:we.isPending||oe.sending,onConfirm:$e,emergency:Q,onAcknowledgeEmergency:()=>Me(true),onSeeOtherVets:()=>W({type:"goTo",step:"clinician"}),primaryVet:T,onFindEmergencyVet:k}):M&&ce==="time"?
|
|
228
|
+
/* @__PURE__ */E(TelevetClinicianOutcome,{state:Qe,cause:Ye,locationStatus:y,...g?{onRequestLocation:g}:{},onRetry:()=>ge.refetch(),stateInterest:_e,...C?{renderUnavailable:C}:{}}):M&&ce==="booked"?/* @__PURE__ */E(f,{style:D.stepFill,testID:"televet-booking-booked",children:ae?/* @__PURE__ */E(TelevetQuickBookedScreen,{consult:ae,petName:hs(j,ae.petId)??Ie,onDone:()=>c?.(),renderNote:I?.renderBookedNote,...h?{onAddToCalendar:h}:{}}):null}):ce==="time"?/* @__PURE__ */E(SlotStep,{slots:ye.data??[],enabled:ye.enabled,isPending:ye.enabled&&ye.isPending&&ye.data===null,isError:ye.isError,error:ye.error,busySlotId:ke.isPending?ke.variables:null,failure:G,selectedSlot:de.slot,nextOpening:Te,onPick:He,onRetry:()=>ye.refetch(),onSeeOtherVets:()=>W({type:"goTo",step:"clinician"})}):ce==="review"?/* @__PURE__ */E(ReviewStep,{when:de.slot?Wi(de.slot.startsAt):"",onChangeWhen:()=>W({type:"goTo",step:"time"}),stateName:Re.stateName,about:Pe.aboutLine,lengthMinutes:(de.slot?$(de.slot):null)??Ai,petName:hs(j,de.petId),reason:Fe.trim(),clinician:ge.data?.find(e=>e.clinicianId===de.clinicianId)?.displayName??null,clinicianRole:ge.data?.find(e=>e.clinicianId===de.clinicianId)?.role??null,shareRecords:de.shareHealthRecords,stateCode:de.state,stateAttested:X,onToggleStateAttest:ee,cancellationTerms:he.data?.summary??null,termsAttested:te,onToggleTermsAttest:ne,onToggleShare:e=>W({type:"patch",patch:{shareHealthRecords:e}}),canConfirm:canConfirm(de,Fe),busy:we.isPending||oe.sending,failure:G,onConfirm:$e,emergency:Q,onAcknowledgeEmergency:()=>Me(true),onSeeOtherVets:()=>W({type:"goTo",step:"clinician"}),mediaShortfall:oe.shortfall,primaryVet:T,onFindEmergencyVet:k}):ce==="booked"?/* @__PURE__ */E(f,{style:D.stepFill,testID:"televet-booking-booked",children:ae?/* @__PURE__ */z(F,{children:[
|
|
229
|
+
/* @__PURE__ */E(TelevetBookedScreen,{consult:ae,petName:hs(j,ae.petId)??hs(j,de.petId),onDone:()=>c?.(),canJoinInApp:w,sharedRecords:de.shareHealthRecords,sentPhoto:oe.sentOnePhoto(ae),...h?{onAddToCalendar:h}:{}}),
|
|
230
230
|
/* @__PURE__ */E(TelevetMediaDropNotice,{shortfall:oe.bookedShortfall(ae),testIDPrefix:"televet-booked"})]}):null}):ce==="clinician"&&Ze?
|
|
231
231
|
/* @__PURE__ */E(TelevetClinicianOutcome,{state:Qe,cause:Ye,locationStatus:y,...g?{onRequestLocation:g}:{},onRetry:()=>ge.refetch(),stateInterest:_e,...C?{renderUnavailable:C}:{}}):ce==="clinician"?/* @__PURE__ */E(ClinicianStep,{clinicians:ge.data??[],isPending:ge.enabled&&ge.isPending,isError:ge.isError,error:ge.error,selectedId:de.clinicianId,stateCode:de.state,stateName:Re.stateName,onRetry:()=>ge.refetch(),onSelect:e=>{W({type:"patch",patch:{clinicianId:e}}),W({type:"next"})}}):ce==="reason"?/* @__PURE__ */E(ReasonStep,{value:V,composed:Fe,vetName:Ee?.displayName??null,onChange:q,media:re,onChangeMedia:le,mediaLive:oe.live,...p?{onPickMedia:p}:{},checking:Se.checking,onNext:()=>{Se.check(Fe).then(e=>{e&&W({type:"next"})})}}):ce==="pet"?
|
|
232
|
-
/* @__PURE__ */E(PetStep,{pets:j,isPending:A.loading,isError:A.error!==null,error:A.error,onRetry:()=>{A.refresh()},onAddPet:u,selectedId:de.petId,onSelect:e=>W({type:"patch",patch:{petId:e}}),onNext:()=>
|
|
233
|
-
/* @__PURE__ */E(f,{style:R.marker,testID:`televet-booking-step-${ce}`}))]}):/* @__PURE__ */E(f,{style:[D.screen,S],testID:_??"televet-booking",children:/* @__PURE__ */E(f,{style:D.stepFill,testID:"televet-booking-copy-unapproved",children:C?C():null})})}var
|
|
234
|
-
return E(f,{style:n.navRow,children:/* @__PURE__ */E(m,{onPress:e,accessibilityRole:"button",accessibilityLabel:
|
|
232
|
+
/* @__PURE__ */E(PetStep,{pets:j,isPending:A.loading,isError:A.error!==null,error:A.error,onRetry:()=>{A.refresh()},onAddPet:u,selectedId:de.petId,onSelect:e=>W({type:"patch",patch:{petId:e}}),onNext:()=>M?et("pet"):W({type:"next"})}):ce==="where"?/* @__PURE__ */E(WhereStep,{petName:Ie,where:Re,onNext:()=>M?et("where"):W({type:"next"})}):ce==="issues"?/* @__PURE__ */E(IssuesStep,{petName:Ie,chips:Pe.issueChips,selected:Pe.concernIds,onToggle:Pe.toggleConcern,onNext:()=>W({type:"next"})}):ce==="emergency"?/* @__PURE__ */E(EmergencyStep,{petName:Ie,answer:Pe.emergencyAnswer,onAnswer:Pe.setEmergencyAnswer,onNext:()=>W({type:"next"}),onHandled:()=>{Se.acknowledge(Fe),W({type:"next"})},...T?{primaryVet:T}:{},onFindEmergencyVet:k}):
|
|
233
|
+
/* @__PURE__ */E(f,{style:R.marker,testID:`televet-booking-step-${ce}`}))]}):/* @__PURE__ */E(f,{style:[D.screen,S],testID:_??"televet-booking",children:/* @__PURE__ */E(f,{style:D.stepFill,testID:"televet-booking-copy-unapproved",children:C?C():null})})}var Cs=2e4;function Ss(e=true,t=Cs){let[n,l]=r(()=>Date.now());return i(()=>{if(!e)return;l(Date.now());let n=setInterval(()=>l(Date.now()),t);return()=>clearInterval(n)},[e,t]),n}function _s(e){return e.httpStatus!==void 0&&!isVetMessagesDark(e)}function useVetThreads(e,t=0){let l=e?.listVetThreads,a=l!==void 0,[s,d]=r(()=>({availability:a?"pending":"dark",threads:[],isPending:a,error:null})),[c,u]=r(0);i(()=>{if(!e||!l){d({availability:"dark",threads:[],isPending:false,error:null});return}let t=new AbortController,n=true;return d(e=>({...e,isPending:true})),l.call(e,t.signal).then(e=>{n&&(e.ok?d({availability:"lit",threads:e.value,isPending:false,error:null}):isVetMessagesDark(e.error)?d({availability:"dark",threads:[],isPending:false,error:null}):d(t=>({availability:_s(e.error)?"lit":t.availability,threads:t.threads,isPending:false,error:e.error})))},()=>{n&&d(e=>({...e,isPending:false}))}),()=>{n=false,t.abort()}},[e,l,t,c]);let p=o(()=>u(e=>e+1),[]);return n(()=>({...s,refetch:p}),[s,p])}function useVetThread(e,petRef,t={}){let a=t.now??Date.now,s=e?.listVetMessages,[d,c]=r([]),[u,p]=r("loading"),[h,f]=r(false),[m,g]=r(false),[y,b]=r(t.ownerCanStart===false),[v,T]=r(false),[k,w]=r(null),[C,S]=r(0),[_,x]=r(0),I=l(true),D=l(false),P=l(false),R=l(a);R.current=a,i(()=>(I.current=true,()=>{I.current=false}),[]),i(()=>{t.ownerCanStart===false&&b(true)},[t.ownerCanStart]),i(()=>{if(c([]),f(false),!e||!s){p("ready");return}p("loading");let t=new AbortController,n=true;return s.call(e,petRef,{},t.signal).then(e=>{if(n){if(!e.ok){p("error");return}c([...e.value].reverse()),f(e.value.length>=sn),p("ready")}},()=>{n&&p("error")}),()=>{n=false,t.abort()}},[e,s,petRef,_]);let E=l(null);i(()=>{let t=e?.markVetThreadRead;u!=="ready"||!e||!t||E.current===petRef||(E.current=petRef,t.call(e,petRef,new Date(R.current()).toISOString()).catch(()=>{}))},[u,e,petRef]);let z=o(()=>{let t=d[0];if(!e||!s||!h||t===void 0||P.current)return;P.current=true,g(true);let n=new AbortController;s.call(e,petRef,{before:t.createdAt},n.signal).then(e=>{if(P.current=false,!I.current||(g(false),!e.ok))return;let t=new Set(d.map(e=>e.messageId)),n=[...e.value].reverse().filter(e=>!t.has(e.messageId));c(e=>[...n,...e]),f(e.value.length>=sn)},()=>{P.current=false,I.current&&g(false)})},[e,s,petRef,h,d]),F=o(async t=>{let n=e?.sendVetMessage;if(!e||!n||D.current||t.trim().length===0)return false;D.current=true,T(true),w(null);let r=false;try{let l=await n.call(e,petRef,t);if(!I.current)return l.ok;l.ok?(r=!0,c(e=>[...e,l.value]),S(e=>e+1)):isVetThreadVetFirst(l.error)?(b(!0),w("vetWritesFirst")):w("notSent")}catch{I.current&&w("notSent")}finally{D.current=false,I.current&&T(false)}return r},[e,petRef]),L=o(()=>x(e=>e+1),[]),A=e?.sendVetMessage!==void 0&&!y;return n(()=>({status:u,messages:d,hasOlder:h,loadingOlder:m,loadOlder:z,canWrite:A,sending:v,sendFailure:k,sentCount:C,send:F,retry:L}),[u,d,h,m,z,A,v,k,C,F,L])}function useVisitSummary(e,t){let l=e?.visitSummary,[a,s]=r(()=>({status:l?"loading":"absent",summary:null})),[d,c]=r(0);i(()=>{if(!e||!l){s({status:"absent",summary:null});return}s({status:"loading",summary:null});let n=new AbortController,r=true;return l.call(e,t,n.signal).then(e=>{r&&(e.ok?s({status:"ready",summary:e.value}):s({status:isVetMessagesDark(e.error)?"pending":"error",summary:null}))},()=>{r&&s({status:"error",summary:null})}),()=>{r=false,n.abort()}},[e,l,t,d]);let u=o(()=>c(e=>e+1),[]);return n(()=>({...a,retry:u}),[a,u])}function vetThreadPetRef(e,t){return t?e.find(e=>e.petRef===t||e.petId===t)?.petRef??null:null}var xs="your vet",Is="your pet",Ds=/* @__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 Ps(e,t){let n=e;for(let[e,r]of Object.entries(t))n=n.split(`{${e}}`).join(r);return n}function Rs(e){return e.length===0?e:e.charAt(0).toUpperCase()+e.slice(1)}function Es(e){let t=e?.trim()??"";return t.length>0?t:xs}function zs(e){let t=e?.trim()??"";return t.length>0?t:Is}function Fs(e){let t=new Date(e);return Number.isNaN(t.getTime())?"":t.toLocaleDateString(void 0,{month:"short",day:"numeric"})}var Ls=/* @__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 Ls.statusCompleted;case"cancelled_owner":case"cancelled_ops":return Ls.statusCancelled;case"no_show_owner":case"no_show_vet":return Ls.statusMissed;default:return null}}function TelevetVisitBackRow({onBack:e,testID:t}){let n=js();/* @__PURE__ */
|
|
234
|
+
return E(f,{style:n.navRow,children:/* @__PURE__ */E(m,{onPress:e,accessibilityRole:"button",accessibilityLabel:Ia,testID:t,style:n.backTap,children:/* @__PURE__ */E(f,{style:n.chevron,accessibilityElementsHidden:true,importantForAccessibility:"no"})})})}function js(){let e=useEverfurTheme();return n(()=>Os(e),[e])}function Os(e){let{color:t,space:n,radius:r,type:l}=e,{size:i,lineHeight:o}=l,a=ca(e),s=e.slots.header,d=e.slots.card,c=ha(d);return h.create({screen:{flex:1,paddingHorizontal:n.xl},body:{gap:n.lg,paddingBottom:n.xl},navRow:{paddingVertical:n.sm,flexDirection:"row",...ua(pa(s,r.lg))},backTap:{width:fa,height:fa,borderRadius:fa/2,borderWidth:1.5,borderColor:a.line,alignItems:"center",justifyContent:"center"},chevron:{width:10,height:10,marginLeft:n.xs,borderLeftWidth:2,borderBottomWidth:2,borderColor:s?.textColor??a.ink,transform:[{rotate:"45deg"}]},title:{...headingFace(e,"bold"),color:a.ink,fontSize:i.subtitle,lineHeight:i.subtitle*o.snug},list:{gap:0},card:{gap:14,padding:n.lg,borderRadius:r.lg,borderWidth:1,borderColor:a.line,backgroundColor:a.surface,...ua(d,1)},cardHead:{flexDirection:"row",alignItems:"center",gap:n.sm},pill:{marginLeft:"auto",height:24,paddingHorizontal:10,borderRadius:r.pill,backgroundColor:a.pink,justifyContent:"center"},pillLine:{backgroundColor:a.surface,borderWidth:1.5,borderColor:a.line},pillText:{...face(e,"monoBold"),color:a.onPink,fontSize:11,letterSpacing:.9,textTransform:"uppercase"},pillLineText:{color:a.muted},visit:{flexDirection:"row",alignItems:"flex-start",gap:n.lg},dateTile:{width:56,paddingVertical:n.sm,borderRadius:14,backgroundColor:a.pinkSoft,alignItems:"center",gap:2},dateTileSmall:{...face(e,"monoBold"),color:a.ink,fontSize:11,letterSpacing:.9,textTransform:"uppercase"},dateTileDay:{...face(e,"medium"),color:a.ink,fontSize:i.heading,lineHeight:i.heading*o.tight},visitMain:{flex:1,gap:2},visitTitle:{...headingFace(e,"bold"),color:a.ink,fontSize:i.body,lineHeight:i.body*o.snug,...c},visitLine:{...face(e,"regular"),color:a.text,fontSize:i.bodyTight,lineHeight:i.bodyTight*o.normal,...c},row:{gap:2,paddingVertical:n.md,borderTopWidth:1,borderTopColor:a.line},rowFirst:{borderTopWidth:0,paddingTop:0},rowHead:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",gap:n.sm},when:{flex:1,...face(e,"bold"),color:a.ink,fontSize:i.body,lineHeight:i.body*o.snug,...c},status:{...face(e,"monoBold"),color:a.muted,fontSize:11,letterSpacing:.9,textTransform:"uppercase",...c},meta:{...face(e,"regular"),color:a.muted,fontSize:i.caption,lineHeight:i.caption*o.normal,...c},bookCard:{gap:n.md,padding:n.lg,borderRadius:r.lg,borderWidth:1,borderColor:a.line,backgroundColor:a.surface,...ua(d,1)},bookTitle:{...headingFace(e,"bold"),color:a.ink,fontSize:i.subtitle,lineHeight:i.subtitle*o.snug,...c},bookSubtitle:{...face(e,"regular"),color:a.muted,fontSize:i.bodyTight,lineHeight:i.bodyTight*o.normal,...c},footnote:{...face(e,"regular"),color:a.muted,fontSize:i.caption,lineHeight:i.caption*o.relaxed,textAlign:"center"},visitCard:{gap:n.md,padding:n.lg,borderRadius:r.lg,borderWidth:1,borderColor:a.line,backgroundColor:a.surface,...ua(d,1)},visitWhen:{...headingFace(e,"medium"),color:a.ink,fontSize:i.heading,lineHeight:i.heading*o.snug,...c},visitWho:{...face(e,"bold"),color:a.ink,fontSize:i.body,lineHeight:i.body*o.snug,...c},visitMeta:{...face(e,"regular"),color:a.text,fontSize:i.bodyTight,lineHeight:i.bodyTight*o.normal,...c},reason:{...face(e,"regular"),color:a.muted,fontSize:i.caption,lineHeight:i.caption*o.normal,...c},terms:{padding:n.md,borderRadius:r.sm,backgroundColor:a.mist,...face(e,"regular"),color:a.text,fontSize:i.caption,lineHeight:i.caption*o.normal},noticeTitle:{...headingFace(e,"medium"),color:a.ink,fontSize:i.heading,lineHeight:i.heading*o.snug},noticeBody:{...face(e,"regular"),color:a.muted,fontSize:i.body,lineHeight:i.body*o.normal},receipt:{gap:n.xs,padding:n.md,borderRadius:r.sm,backgroundColor:a.mist},stack:{gap:n.sm},whyHead:{flexDirection:"row",flexWrap:"wrap",alignItems:"baseline",gap:n.sm},whyTitle:{...face(e,"bold"),color:a.ink,fontSize:i.bodyTight,lineHeight:i.bodyTight*o.snug},whyNote:{...face(e,"regular"),color:a.muted,fontSize:i.caption,lineHeight:i.caption*o.normal},hint:{flexDirection:"row",flexWrap:"wrap",alignItems:"center",justifyContent:"space-between",gap:n.sm,paddingVertical:n.sm,paddingHorizontal:n.lg,borderRadius:r.sm,backgroundColor:a.mist},muted:{...face(e,"regular"),color:t.text.primary,fontSize:i.bodyTight}})}function Ns(e){let{color:t,space:n,radius:r,type:l}=e,{size:i,lineHeight:o}=l,a=ca(e),s={...face(e,"regular"),maxWidth:"85%",paddingVertical:10,paddingHorizontal:14,borderRadius:18,fontSize:i.body,lineHeight:i.body*o.normal};return h.create({head:{gap:2},screenTitle:{...headingFace(e,"medium"),color:a.ink,fontSize:i.heading,lineHeight:i.heading*o.snug},meta:{...face(e,"regular"),color:a.muted,fontSize:i.bodyTight,lineHeight:i.bodyTight*o.normal},log:{gap:n.sm,paddingBottom:n.md},day:{alignSelf:"center",...face(e,"monoBold"),color:a.muted,fontSize:11,letterSpacing:.9,textTransform:"uppercase",paddingTop:n.sm},item:{gap:4,alignItems:"flex-start"},itemMine:{alignItems:"flex-end"},whoRow:{flexDirection:"row",alignItems:"baseline",gap:n.sm},who:{...face(e,"bold"),color:a.ink,fontSize:i.bodyTight},time:{...face(e,"regular"),color:a.muted,fontSize:i.caption},bubbleMine:{...s,backgroundColor:t.bubbleUser,color:t.onPrimary,borderBottomRightRadius:6},bubbleVet:{...s,backgroundColor:t.bubbleVet,color:t.onBubbleVet,borderBottomLeftRadius:6},system:{...face(e,"regular"),color:a.muted,fontSize:i.caption,textAlign:"center",alignSelf:"center"},attachments:{...face(e,"regular"),color:a.muted,fontSize:i.caption},composer:{flexDirection:"row",alignItems:"flex-end",gap:n.sm,padding:n.sm,borderRadius:r.lg,borderWidth:1.5,borderColor:a.line,backgroundColor:a.surface,...ua(e.slots.input,1.5)},field:{flex:1,minHeight:fa,paddingHorizontal:n.sm,paddingVertical:10,...face(e,"regular"),color:a.text,fontSize:i.body,...ha(e.slots.input)},send:{minWidth:fa,height:fa,paddingHorizontal:n.md,borderRadius:fa/2,backgroundColor:t.primary,alignItems:"center",justifyContent:"center"},sendDisabled:{opacity:.5},sendLabel:{...face(e,"bold"),color:t.onPrimary,fontSize:i.bodyTight},note:{...face(e,"regular"),color:a.muted,fontSize:i.caption,lineHeight:i.caption*o.normal},failure:{...face(e,"bold"),color:a.alert,fontSize:i.caption},label:{...face(e,"monoBold"),color:a.muted,fontSize:11,letterSpacing:.9,textTransform:"uppercase"},body:{...face(e,"regular"),color:a.text,fontSize:i.body,lineHeight:i.body*o.normal},planItem:{flexDirection:"row",gap:n.md,alignItems:"flex-start"},planNumber:{...face(e,"monoBold"),color:a.ink,fontSize:12,letterSpacing:.9,paddingTop:3},planText:{flex:1,...face(e,"regular"),color:a.text,fontSize:i.body,lineHeight:i.body*o.normal},rowPress:{flexDirection:"row",alignItems:"center",gap:n.md,minHeight:fa},rowMain:{flex:1,gap:2},rowEnd:{alignItems:"flex-end",gap:4},preview:{...face(e,"regular"),color:a.muted,fontSize:i.caption},link:{minHeight:fa,justifyContent:"center",alignSelf:"flex-start"},linkText:{...face(e,"bold"),color:t.linkInk,fontSize:i.bodyTight,textDecorationLine:"underline"}})}function Bs(){let e=useEverfurTheme();return n(()=>Ns(e),[e])}function TelevetConsultScreen({consult:e,controller:t,onJoin:n,onReschedule:l,onCancelled:i,onBack:a,revision:s=0,onMessageVet:d,nowMs:c,style:u}){let p=js(),h=Bs(),g=useTelevetBookingController(t),[y,b]=r(0),v=Tr(e.consultId,g,s+y),T=useTelevetCancellationPolicy(g),k=kr(e.consultId,g),{pets:C}=useEverfurPets(),S=useVetThreads(g),[_,x]=r(false),[I,D]=r(null),[P,R]=r(false),[L,A]=r(null),j=v.isError&&v.error?.httpStatus===404,N=j?null:v.data??e,B=N!==null&&O.has(N.status),H=Ss(!B),M=televetJoinReadiness(N,c??H),$=N===null?null:hs(C,N.petId),W=T.data?.summary.trim()||null,V=o(()=>{W&&(R(false),k.mutate(I??Ls.cancelReason,{onSuccess:e=>{x(false),A(e),b(e=>e+1),i?.(e)},onError:()=>R(true)}))},[W,k,i,I]);if(N===null)/* @__PURE__ */
|
|
235
235
|
return z(f,{style:[p.screen,u],testID:"televet-consult-missing",children:[
|
|
236
236
|
/* @__PURE__ */E(TelevetVisitBackRow,{onBack:a,testID:"televet-consult-back"}),
|
|
237
|
-
/* @__PURE__ */E(TelevetStateCard,{title:
|
|
237
|
+
/* @__PURE__ */E(TelevetStateCard,{title:Ls.notFoundTitle,message:Ls.notFoundBody})]});let q=N.status,U=q==="cancelled_owner"||q==="cancelled_ops",K=q==="scheduled"||q==="in_progress",Y=canManageTelevetVisit(q)&&L===null,G=N.clinicianName??Ls.vetUnassigned,J=[$,N.reasonText].filter(Boolean).join(" · "),Q=S.availability==="lit"?vetThreadPetRef(C,N.petId):null,Z=Q===null?void 0:S.threads.find(e=>e.petRef===Q),X=Q===null?null:{petRef:Q,petName:$,vetName:N.clinicianName,...Z?{ownerCanStart:Z.ownerCanStart}:{}};/* @__PURE__ */
|
|
238
238
|
return z(f,{style:[p.screen,u],testID:"televet-consult",children:[
|
|
239
239
|
/* @__PURE__ */E(TelevetVisitBackRow,{onBack:a,testID:"televet-consult-back"}),
|
|
240
240
|
/* @__PURE__ */z(w,{contentContainerStyle:p.body,children:[
|
|
@@ -242,120 +242,120 @@ return z(f,{style:[p.screen,u],testID:"televet-consult",children:[
|
|
|
242
242
|
/* @__PURE__ */E(Text,{style:p.visitWhen,accessibilityRole:"header",testID:"televet-consult-when",children:formatWhenWithDay(N.scheduledAt)}),
|
|
243
243
|
/* @__PURE__ */z(f,{style:p.stack,children:[
|
|
244
244
|
/* @__PURE__ */E(Text,{style:p.visitWho,testID:"televet-consult-vet",children:G}),J?/* @__PURE__ */E(Text,{style:p.visitMeta,numberOfLines:2,children:J}):null]})]}),K&&L===null?/* @__PURE__ */z(F,{children:[
|
|
245
|
-
/* @__PURE__ */E(TelevetButton,{label:
|
|
246
|
-
/* @__PURE__ */E(Text,{style:p.noticeTitle,accessibilityRole:"header",children:
|
|
247
|
-
/* @__PURE__ */E(Text,{style:p.noticeBody,children:
|
|
248
|
-
/* @__PURE__ */E(Text,{style:p.noticeTitle,accessibilityRole:"header",children:$?Ie(
|
|
245
|
+
/* @__PURE__ */E(TelevetButton,{label:Ls.joinCta,disabled:!M.ready,onPress:()=>n(N,$),testID:"televet-consult-join"}),M.ready?null:/* @__PURE__ */E(Text,{style:p.reason,testID:"televet-consult-join-reason",children:M.reason==="consult_over"?Ls.joinOverReason:Ls.joinDisabledReason}),X&&d?/* @__PURE__ */E(m,{onPress:()=>d(X),accessibilityRole:"link",style:h.link,testID:"televet-consult-late",children:/* @__PURE__ */E(Text,{style:h.linkText,children:Ps(Ds.runningLateTemplate,{vet:N.clinicianName??xs})})}):null,Y&&l?/* @__PURE__ */E(TelevetButton,{label:Ls.rescheduleCta,kind:"secondary",onPress:()=>l(N),testID:"televet-consult-reschedule"}):null]}):null,L?/* @__PURE__ */E(f,{style:p.receipt,testID:"televet-consult-cancel-receipt",children:/* @__PURE__ */E(Text,{style:p.noticeTitle,accessibilityLiveRegion:"polite",children:L.summary??Ls.phaseCancelled})}):U?/* @__PURE__ */z(f,{style:p.stack,testID:"televet-consult-cancelled",children:[
|
|
246
|
+
/* @__PURE__ */E(Text,{style:p.noticeTitle,accessibilityRole:"header",children:Ls.phaseCancelled}),
|
|
247
|
+
/* @__PURE__ */E(Text,{style:p.noticeBody,children:Ls.phaseCancelledBody})]}):null,Y?/* @__PURE__ */z(f,{style:p.stack,children:[W?/* @__PURE__ */E(Text,{style:p.terms,accessibilityLiveRegion:"polite",testID:"televet-consult-cancellation-policy",children:W}):T.enabled&&T.isPending?/* @__PURE__ */E(f,{testID:"televet-consult-cancellation-policy-loading",children:/* @__PURE__ */E(TelevetSkeletonBlock,{height:42})}):/* @__PURE__ */E(TelevetStateCard,{title:Ls.cancelPolicyErrorTitle,actionLabel:Ls.retryCta,onAction:()=>T.refetch(),testID:"televet-consult-cancellation-policy-error"}),_?/* @__PURE__ */z(f,{style:p.stack,testID:"televet-consult-cancel-confirm",children:[
|
|
248
|
+
/* @__PURE__ */E(Text,{style:p.noticeTitle,accessibilityRole:"header",children:$?Ie(Ls.cancelConfirmTitleTemplate,{pet:$}):Ls.cancelConfirmTitle}),
|
|
249
249
|
/* @__PURE__ */z(f,{style:p.whyHead,children:[
|
|
250
|
-
/* @__PURE__ */E(Text,{style:p.whyTitle,children:
|
|
251
|
-
/* @__PURE__ */E(Text,{style:p.whyNote,testID:"televet-consult-cancel-optional",children:
|
|
252
|
-
/* @__PURE__ */E(f,{style:p.stack,accessibilityRole:"radiogroup",accessibilityLabel:`${
|
|
250
|
+
/* @__PURE__ */E(Text,{style:p.whyTitle,children:Ls.cancelWhyTitle}),
|
|
251
|
+
/* @__PURE__ */E(Text,{style:p.whyNote,testID:"televet-consult-cancel-optional",children:Ls.cancelWhyOptional})]}),
|
|
252
|
+
/* @__PURE__ */E(f,{style:p.stack,accessibilityRole:"radiogroup",accessibilityLabel:`${Ls.cancelWhyTitle} ${Ls.cancelWhyOptional}`,children:[...$?[{id:"better",label:Ie(Ls.cancelWhyBetterTemplate,{pet:$})}]:[],{id:"time",label:Ls.cancelWhyTime},{id:"regular-vet",label:Ls.cancelWhyRegularVet},{id:"other",label:Ls.cancelWhyOther}].map(e=>/* @__PURE__ */z(f,{style:p.stack,children:[
|
|
253
253
|
/* @__PURE__ */E(TelevetChoiceRow,{title:e.label,selected:I===e.label,onPress:()=>D(I===e.label?null:e.label),testID:`televet-consult-cancel-why-${e.id}`}),e.id==="time"&&I===e.label?/* @__PURE__ */z(f,{style:p.hint,testID:"televet-consult-cancel-time-hint",children:[
|
|
254
|
-
/* @__PURE__ */E(Text,{style:p.muted,children:
|
|
255
|
-
/* @__PURE__ */E(TelevetButton,{label:
|
|
256
|
-
/* @__PURE__ */E(TelevetButton,{label:
|
|
254
|
+
/* @__PURE__ */E(Text,{style:p.muted,children:Ls.cancelWhyTimeHint}),l?/* @__PURE__ */E(TelevetButton,{label:Ls.cancelMoveInstead,kind:"quiet",fullWidth:false,onPress:()=>l(N),testID:"televet-consult-cancel-move"}):null]}):null]},e.id))}),P?/* @__PURE__ */E(TelevetFailureLine,{message:Ls.cancelFailedTitle,testID:"televet-consult-cancel-failed"}):null,
|
|
255
|
+
/* @__PURE__ */E(TelevetButton,{label:Ls.cancelConfirmCta,kind:"danger",loading:k.isPending,onPress:V,testID:"televet-consult-cancel-yes"}),
|
|
256
|
+
/* @__PURE__ */E(TelevetButton,{label:Ls.cancelKeepCta,kind:"secondary",disabled:k.isPending,onPress:()=>{x(false),R(false)},testID:"televet-consult-cancel-keep"})]}):/* @__PURE__ */E(TelevetButton,{label:Ls.cancelCta,kind:"secondary",disabled:!W,onPress:()=>{R(false),x(true)},testID:"televet-consult-cancel"})]}):null,v.isError&&!j?/* @__PURE__ */E(TelevetStateCard,{title:Ls.staleTitle,actionLabel:Ls.staleRetry,onAction:()=>v.refetch(),testID:"televet-consult-stale"}):null]})]})}var Hs=/* @__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`:Hs.lobbyTitleNoName},lobbyPrep:e=>{let t=e?.trim()??"";return t.length>0?`Have ${t} nearby and somewhere well lit.`:Hs.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`:Hs.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 Ms(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 $s="No way to join this visit yet.";function Ws(e){return e==="room_not_ready"||e==="unknown"}var Vs=/* @__PURE__ */Symbol.for("@everfur/sdk/televet");function qs(){let e=globalThis,t=e[Vs];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[Vs]=n,n}function Us(){return qs().dailyRegistered}function Ks(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 Ys=/* @__PURE__ */Object.freeze({status:"joining"});function useTelevetJoin(e,t){let[n,a]=r(0),[s,d]=r(Ys),c=l(null);i(()=>{let r=t?.joinConsult;if(t===null||r===void 0){d(/* @__PURE__ */Object.freeze({status:"refused",refusal:"unavailable",reason:null}));return}let l=`${e}#${String(n)}`,i=c.current;if(i===null||i.key!==l){let n;try{n=r.call(t,e)}catch(e){n=Promise.reject(e)}i={key:l,promise:n},c.current=i}let o=true;return d(Ys),i.promise.then(e=>{o&&(e.ok?d(/* @__PURE__ */Object.freeze({status:"ready",credential:e.value})):d(/* @__PURE__ */Object.freeze({status:"refused",refusal:vetCallJoinRefusal(e.error),reason:vetCallJoinReason(e.error)})))},()=>{o&&d(/* @__PURE__ */Object.freeze({status:"refused",refusal:"unknown",reason:null}))}),()=>{o=false}},[e,t,n]);let u=o(()=>a(e=>e+1),[]);return{state:s,retry:u}}var Gs=/* @__PURE__ */Symbol.for("@everfur/sdk/televet/recording-notice-receipt");function Js(){let e=globalThis;return e[Gs]??=/* @__PURE__ */new Map}function Qs(e){let t=Js();t.set(e,(t.get(e)??0)+1)}function Zs(e){let t=Js(),n=t.get(e)??0;n<=1?t.delete(e):t.set(e,n-1)}var Xs=createContext(null);function ed(e){let t=s(Xs);i(()=>{if(!(t===null||!e))return t.setFullBleed(true),()=>{t.setFullBleed(false)}},[t,e])}var td=Ks(()=>Promise.resolve(L));function TelevetJoinScreen({consultId:e,...t}){let n=ma(),r=rd();return r===null?/* @__PURE__ */E(f,{style:[n.screen,t.style],testID:"televet-join-checking"}):/* @__PURE__ */E(TelevetJoinGate,{consultId:e,...t,canHostCall:r},e)}function TelevetJoinGate({canHostCall:e,onLeave:t,style:n,...l}){let[i,a]=r(false);nd(()=>(t(),true),!i);let s=o(()=>{a(false),t()},[t]);return e?i?/* @__PURE__ */E(TelevetJoinRoom,{...l,onLeave:s,style:n}):/* @__PURE__ */E(TelevetRecordingNotice,{onContinue:()=>a(true),onLeave:t,style:n}):/* @__PURE__ */E(TelevetJoinUnavailable,{onLeave:t,style:n})}function TelevetJoinRoom({consultId:e,controller:t,clinicianName:n,petName:l,onLeave:o,style:a}){let s=ma(),d=useTelevetBookingController(t),{state:c,retry:u}=useTelevetJoin(e,d),[p,h]=r(null),[m,g]=r(false),y=c.status==="ready";i(()=>{if(!y||p!==null)return;let e=true;return td().then(t=>{e&&h(()=>t)},()=>{e&&g(true)}),()=>{e=false}},[y,p]);let b=c.status==="ready"?c.credential.roomUrl:null,[v,T]=r(null);i(()=>{if(b!==null)return Qs(b),T(b),()=>{Zs(b)}},[b]);let k=y&&p!==null&&!m;nd(()=>(k||o(),true),true);let w=c.status==="ready"?c.credential:null;if(ed(k&&w!==null&&p.isUsableRoomCredential(w.roomUrl,w.token)&&p.loadEverfurDaily().available),c.status==="refused"||m){let e=c.status==="refused"?c.refusal:"unavailable";/* @__PURE__ */
|
|
257
257
|
return z(f,{style:[s.screen,s.stepFill,a],testID:"televet-join-refused",children:[
|
|
258
|
-
/* @__PURE__ */E(TelevetFailureLine,{message:Ms(e),testID:"televet-join-refused-message"})
|
|
259
|
-
/* @__PURE__ */E(TelevetButton,{label:
|
|
258
|
+
/* @__PURE__ */E(TelevetFailureLine,{message:Ms(e),testID:"televet-join-refused-message"}),Ws(e)&&c.status==="refused"?/* @__PURE__ */E(TelevetButton,{label:De.retryCta,kind:"primary",onPress:u,testID:"televet-join-retry"}):null,
|
|
259
|
+
/* @__PURE__ */E(TelevetButton,{label:Hs.leaveCta,kind:"secondary",onPress:o,testID:"televet-join-leave"})]})}if(c.status==="joining"||p===null||v!==c.credential.roomUrl)/* @__PURE__ */
|
|
260
260
|
return E(TelevetRecordingNotice,{busy:true,onLeave:o,style:a});let{EverfurVetCall:C}=p;/* @__PURE__ */
|
|
261
|
-
return E(C,{roomUrl:c.credential.roomUrl,token:c.credential.token,onLeave:o,clinicianName:n??null,petName:l??null,consultMinutes:c.credential.callLimits?.consultMinutes??null,renderUnavailable:()=>/* @__PURE__ */E(TelevetJoinUnavailable,{onLeave:o,style:a}),style:a})}function TelevetRecordingNotice({onContinue:e,onLeave:t,busy:n=false,style:r}){let l=
|
|
261
|
+
return E(C,{roomUrl:c.credential.roomUrl,token:c.credential.token,onLeave:o,clinicianName:n??null,petName:l??null,consultMinutes:c.credential.callLimits?.consultMinutes??null,renderUnavailable:()=>/* @__PURE__ */E(TelevetJoinUnavailable,{onLeave:o,style:a}),style:a})}function TelevetRecordingNotice({onContinue:e,onLeave:t,busy:n=false,style:r}){let l=ma();/* @__PURE__ */
|
|
262
262
|
return E(f,{style:[l.screen,l.stepFill,r],children:/* @__PURE__ */z(f,{style:l.stateCard,testID:"everfur-vet-call-recording-notice",accessibilityState:{busy:n},children:[
|
|
263
|
-
/* @__PURE__ */E(Text,{style:l.stateTitle,accessibilityRole:"header",children:
|
|
264
|
-
/* @__PURE__ */E(TelevetButton,{label:
|
|
265
|
-
/* @__PURE__ */E(TelevetButton,{label:
|
|
263
|
+
/* @__PURE__ */E(Text,{style:l.stateTitle,accessibilityRole:"header",children:Hs.recordingNoticeTitle}),
|
|
264
|
+
/* @__PURE__ */E(TelevetButton,{label:Hs.recordingNoticeCta,kind:"primary",loading:n,onPress:()=>e?.(),testID:"everfur-vet-call-recording-continue"}),
|
|
265
|
+
/* @__PURE__ */E(TelevetButton,{label:Hs.leaveCta,kind:"secondary",onPress:t,testID:"everfur-vet-call-recording-leave"})]})})}function TelevetJoinUnavailable({onLeave:e,style:t}){let n=ma();/* @__PURE__ */
|
|
266
266
|
return z(f,{style:[n.screen,n.stepFill,t],testID:"televet-join-call-unavailable",children:[
|
|
267
|
-
/* @__PURE__ */E(TelevetFailureLine,{message
|
|
268
|
-
/* @__PURE__ */E(TelevetButton,{label:
|
|
269
|
-
return E(SdkTabletColumn,{children:/* @__PURE__ */E(RescheduleBody,{...e})})}function RescheduleBody(e){let{consult:t,onRescheduled:l,onCancel:i,controller:a,style:s,testID:d}=ve(e,["onRescheduled","onCancel"]),c=
|
|
267
|
+
/* @__PURE__ */E(TelevetFailureLine,{message:$s}),
|
|
268
|
+
/* @__PURE__ */E(TelevetButton,{label:Hs.leaveCta,kind:"secondary",onPress:e,testID:"televet-join-unavailable-leave"})]})}function nd(e,t){Ce(e,t);let n=l(e);n.current=e,i(()=>{if(!t)return;let e=v.addEventListener("hardwareBackPress",()=>n.current());return()=>{e.remove()}},[t])}function rd(){let[e,t]=r(()=>Us()?null:false);return i(()=>{let e=true;return td().then(n=>{if(!e)return;let r=n.loadEverfurDaily();if(t(r.available),!r.available)try{globalThis.console?.warn?.(`${n.EVERFUR_DAILY_SETUP} (${r.reason})`)}catch{}},()=>{e&&t(false)}),()=>{e=false}},[]),e}function EverfurTelevetReschedule(e){/* @__PURE__ */
|
|
269
|
+
return E(SdkTabletColumn,{children:/* @__PURE__ */E(RescheduleBody,{...e})})}function RescheduleBody(e){let{consult:t,onRescheduled:l,onCancel:i,controller:a,style:s,testID:d}=ve(e,["onRescheduled","onCancel"]),c=ma(),u=useTelevetBookingController(a),p=useTelevetSlots(t?.clinicianId??null,u),h=useTelevetHoldSlot(u),g=useTelevetRescheduleConsult(t?.consultId??null,u),[y,b]=r(null),[v,T]=r(null),{pets:k}=useEverfurPets(),w=useEverfurTheme(),C=n(()=>ld(w),[w]),S=o(e=>{b(null),h.mutate(e.slotId,{onSuccess:()=>{g.mutate(e.slotId,{onSuccess:e=>l?.(e),onError:e=>b(televetBookingRefusal(e).kind==="unavailable"?"unavailable":"failed")})},onError:e=>b(televetBookingRefusal(e).kind==="unavailable"?"unavailable":"taken")})},[h,g,l]),_=h.isPending||g.isPending;return isTelevetBookingCopyReady()?t?
|
|
270
270
|
/* @__PURE__ */z(f,{style:[c.screen,c.stepFill,s],testID:d??"televet-reschedule",children:[
|
|
271
271
|
/* @__PURE__ */z(f,{style:C.bar,children:[
|
|
272
272
|
/* @__PURE__ */E(m,{onPress:()=>i?.(),disabled:_,accessibilityRole:"button",accessibilityLabel:De.keepExistingCta,testID:"televet-reschedule-keep",style:C.ring,children:/* @__PURE__ */E(f,{style:C.chevron,accessibilityElementsHidden:true,importantForAccessibility:"no"})}),
|
|
273
273
|
/* @__PURE__ */E(Text,{tier:"compact",style:C.label,children:De.rescheduleStepLabel})]}),
|
|
274
|
-
/* @__PURE__ */E(Text,{tier:"heading",style:c.stepTitle,accessibilityRole:"header",children:Ie(De.rescheduleTitleTemplate,{pet:
|
|
274
|
+
/* @__PURE__ */E(Text,{tier:"heading",style:c.stepTitle,accessibilityRole:"header",children:Ie(De.rescheduleTitleTemplate,{pet:hs(k,t.petId)??De.petFallback})}),
|
|
275
275
|
/* @__PURE__ */z(f,{style:C.now,testID:"televet-reschedule-now",children:[
|
|
276
276
|
/* @__PURE__ */E(f,{style:C.nowPill,children:/* @__PURE__ */E(Text,{tier:"badge",style:C.nowPillText,children:De.rescheduleNowLabel})}),
|
|
277
|
-
/* @__PURE__ */E(Text,{style:C.nowText,accessibilityLabel:Ie(De.rescheduleFromTemplate,{when
|
|
277
|
+
/* @__PURE__ */E(Text,{style:C.nowText,accessibilityLabel:Ie(De.rescheduleFromTemplate,{when:Wi(t.scheduledAt)}),children:Wi(t.scheduledAt)})]}),y==="taken"?/* @__PURE__ */E(TelevetFailureLine,{message:De.slotTaken}):null,y==="failed"?/* @__PURE__ */E(TelevetFailureLine,{message:De.rescheduleFailed}):null,y==="unavailable"?/* @__PURE__ */E(TelevetFailureLine,{message:De.bookingPausedTitle,testID:"televet-reschedule-unavailable"}):null,p.enabled?p.isPending?/* @__PURE__ */E(f,{style:c.list,testID:"televet-reschedule-slots-loading",children:[0,1,2].map(e=>/* @__PURE__ */E(TelevetSkeletonBlock,{height:48},e))}):p.isError?/* @__PURE__ */E(TelevetStateCard,{title:De.slotsErrorTitle,actionLabel:De.retryCta,onAction:()=>p.refetch(),testID:"televet-reschedule-slots-error"}):(p.data??[]).length===0?/* @__PURE__ */E(f,{testID:"televet-reschedule-empty",children:/* @__PURE__ */E(TelevetStateCard,{title:De.noSlotsTitle})}):/* @__PURE__ */E(TelevetSlotPicker,{slots:p.data??[],busySlotId:_?h.variables:null,onPick:e=>{b(null),T(e)},selectedSlot:v,periodLabels:{morning:De.timeMorning,afternoon:De.timeAfternoon,evening:De.timeEvening},rowTestIdPrefix:"televet-reschedule-slot",testID:"televet-reschedule-slots"}):/* @__PURE__ */E(f,{testID:"televet-reschedule-paused",children:/* @__PURE__ */E(TelevetStateCard,{title:De.bookingPausedTitle})}),v?/* @__PURE__ */E(f,{style:c.scrollFooter,children:/* @__PURE__ */E(TelevetButton,{label:_?De.rescheduleMoving:Ie(De.rescheduleMoveTemplate,{when:qi(v.startsAt)}),loading:_,onPress:()=>S(v),testID:"televet-reschedule-move"})}):null]}):/* @__PURE__ */E(f,{style:[c.screen,c.list,s],testID:"televet-reschedule-loading",children:[0,1].map(e=>/* @__PURE__ */E(TelevetSkeletonBlock,{height:48},e))}):/* @__PURE__ */E(f,{style:[c.screen,c.stepFill,s],testID:"televet-reschedule-copy-unapproved"})}function ld(e){let t=ca(e);return h.create({bar:{flexDirection:"row",alignItems:"center",gap:14,paddingVertical:e.space.sm},ring:{width:44,height:44,borderRadius:22,borderWidth:1.5,borderColor:t.line,alignItems:"center",justifyContent:"center"},chevron:{width:10,height:10,marginLeft:4,borderLeftWidth:2,borderBottomWidth:2,borderColor:t.ink,transform:[{rotate:"45deg"}]},label:{...face(e,"monoBold"),color:t.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:t.line,justifyContent:"center"},nowPillText:{...face(e,"monoBold"),color:t.muted,fontSize:11,letterSpacing:.9,textTransform:"uppercase"},nowText:{...face(e,"regular"),color:t.muted,fontSize:e.type.size.body,textDecorationLine:"line-through"}})}function TelevetVetMessagesCard({threads:e,pets:t,onOpen:n}){let r=js(),l=Bs();/* @__PURE__ */
|
|
278
278
|
return z(f,{style:r.card,testID:"televet-messages-card",children:[
|
|
279
|
-
/* @__PURE__ */E(Text,{style:r.title,accessibilityRole:"header",children:
|
|
280
|
-
/* @__PURE__ */E(f,{style:r.list,children:e.map((e,i)=>{let o=t.find(t=>t.petRef===e.petRef)?.name??null,a=e.lastMessage?.role==="vet"?e.lastMessage.senderName:null,s=
|
|
281
|
-
return z(m,{onPress:()=>n({petRef:e.petRef,petName:o,vetName:a,ownerCanStart:e.ownerCanStart}),accessibilityRole:"button",accessibilityLabel:[s,d,c,u?
|
|
279
|
+
/* @__PURE__ */E(Text,{style:r.title,accessibilityRole:"header",children:Ds.messagesTitle}),
|
|
280
|
+
/* @__PURE__ */E(f,{style:r.list,children:e.map((e,i)=>{let o=t.find(t=>t.petRef===e.petRef)?.name??null,a=e.lastMessage?.role==="vet"?e.lastMessage.senderName:null,s=Rs(zs(o)),d=e.lastMessage?id(e.lastMessage):null,c=Fs(e.lastMessageAt),u=e.unreadCount>0;/* @__PURE__ */
|
|
281
|
+
return z(m,{onPress:()=>n({petRef:e.petRef,petName:o,vetName:a,ownerCanStart:e.ownerCanStart}),accessibilityRole:"button",accessibilityLabel:[s,d,c,u?Ds.newPillNative:null].filter(Boolean).join(", "),style:[r.row,i===0?r.rowFirst:null,l.rowPress],testID:`televet-messages-row-${e.petRef}`,children:[
|
|
282
282
|
/* @__PURE__ */z(f,{style:l.rowMain,children:[
|
|
283
283
|
/* @__PURE__ */E(Text,{style:r.when,children:s}),d?/* @__PURE__ */E(Text,{style:l.preview,numberOfLines:1,children:d}):null]}),
|
|
284
|
-
/* @__PURE__ */z(f,{style:l.rowEnd,children:[c?/* @__PURE__ */E(Text,{style:r.meta,children:c}):null,u?/* @__PURE__ */E(f,{style:[r.pill,{marginLeft:0}],children:/* @__PURE__ */E(Text,{tier:"badge",style:r.pillText,children:
|
|
284
|
+
/* @__PURE__ */z(f,{style:l.rowEnd,children:[c?/* @__PURE__ */E(Text,{style:r.meta,children:c}):null,u?/* @__PURE__ */E(f,{style:[r.pill,{marginLeft:0}],children:/* @__PURE__ */E(Text,{tier:"badge",style:r.pillText,children:Ds.newPillNative})}):null]})]},e.petRef)})})]})}function id(e){let t=e.content.split(`\n`)[0]?.trim()??"";return e.role==="owner"?Ps(Ds.previewOwnerTemplate,{text:t}):t}function TelevetVisitsScreen({controller:e,onOpenVisit:t,onBook:r,onBack:o,revision:a=0,onOpenThread:s,onOpenSummary:d,joinFirst:c,onJoinFirst:u,nowMs:p,style:h}){let g=js(),y=useTelevetBookingController(e),b=vr(y,a),{pets:v}=useEverfurPets(),T=useVetThreads(y,a),k=T.availability==="lit",C=b.data??[],S=C.some(e=>!O.has(e.status)),_=Ss(S),x=p??_,{upcoming:I,past:D}=n(()=>splitTelevetVisits(C,x),[C,x]),P=b.enabled&&b.isPending,R=b.isError&&b.data===null,F=l(c??null),L=b.enabled&&!P&&!R;i(()=>{let e=F.current;if(e===null||!u||!L)return;F.current=null;let t=I.find(t=>t.consultId===e)??null;u(t,t?hs(v,t.petId):null)},[L,I,v,u]);let A=e=>{let t=hs(v,e.petId),n=e.clinicianName;return t&&n?Ie(Ls.visitTitleTemplate,{pet:t,vet:n}):t??n},j=(e,n)=>{let r=As(e.status),l=A(e);return e.status==="completed"&&k&&d?/* @__PURE__ */z(m,{onPress:()=>d(e),accessibilityRole:"button",accessibilityLabel:[l??Oi(e.scheduledAt),r].filter(Boolean).join(", "),style:[g.row,n===0?g.rowFirst:null],testID:`televet-visits-summary-${e.consultId}`,children:[
|
|
285
285
|
/* @__PURE__ */z(f,{style:g.rowHead,children:[
|
|
286
|
-
/* @__PURE__ */E(Text,{style:g.when,children:l??
|
|
286
|
+
/* @__PURE__ */E(Text,{style:g.when,children:l??Oi(e.scheduledAt)}),r?/* @__PURE__ */E(Text,{style:g.status,children:r}):null]}),l?/* @__PURE__ */E(Text,{style:g.meta,children:Oi(e.scheduledAt)}):null]},e.consultId):/* @__PURE__ */z(f,{style:[g.row,n===0?g.rowFirst:null],testID:`televet-visits-row-${e.consultId}`,children:[
|
|
287
287
|
/* @__PURE__ */z(f,{style:g.rowHead,children:[
|
|
288
|
-
/* @__PURE__ */E(Text,{style:g.when,children:l??
|
|
288
|
+
/* @__PURE__ */E(Text,{style:g.when,children:l??Oi(e.scheduledAt)}),r?/* @__PURE__ */E(Text,{style:g.status,testID:`televet-visits-status-${e.consultId}`,children:r}):null]}),l?/* @__PURE__ */E(Text,{style:g.meta,children:Oi(e.scheduledAt)}):null,e.status==="completed"?null:/* @__PURE__ */E(TelevetButton,{label:Ls.manageCta,kind:"quiet",fullWidth:false,onPress:()=>t(e),testID:`televet-visits-open-${e.consultId}`})]},e.consultId)},N=e=>{let n=new Date(e.scheduledAt),r=Number.isNaN(n.getTime())?null:{weekday:n.toLocaleDateString(void 0,{weekday:"short"}),day:String(n.getDate()),month:n.toLocaleDateString(void 0,{month:"short"})},l=e.reasonText?.split(`\n`)[0]?.trim()??"";/* @__PURE__ */
|
|
289
289
|
return z(f,{style:g.card,testID:`televet-visits-row-${e.consultId}`,children:[
|
|
290
290
|
/* @__PURE__ */z(f,{style:g.cardHead,children:[
|
|
291
|
-
/* @__PURE__ */E(Text,{style:g.title,accessibilityRole:"header",children:
|
|
291
|
+
/* @__PURE__ */E(Text,{style:g.title,accessibilityRole:"header",children:Ls.upcomingTitle}),e.status==="scheduled"?/* @__PURE__ */E(f,{style:g.pill,children:/* @__PURE__ */E(Text,{tier:"badge",style:g.pillText,children:Ls.bookedPill})}):null]}),
|
|
292
292
|
/* @__PURE__ */z(f,{style:g.visit,children:[r?/* @__PURE__ */z(f,{style:g.dateTile,accessibilityElementsHidden:true,importantForAccessibility:"no-hide-descendants",children:[
|
|
293
293
|
/* @__PURE__ */E(Text,{tier:"badge",style:g.dateTileSmall,children:r.weekday}),
|
|
294
294
|
/* @__PURE__ */E(Text,{tier:"heading",style:g.dateTileDay,children:r.day}),
|
|
295
295
|
/* @__PURE__ */E(Text,{tier:"badge",style:g.dateTileSmall,children:r.month})]}):null,
|
|
296
296
|
/* @__PURE__ */z(f,{style:g.visitMain,children:[A(e)?/* @__PURE__ */E(Text,{style:g.visitTitle,children:A(e)}):null,
|
|
297
|
-
/* @__PURE__ */E(Text,{style:g.visitLine,children
|
|
298
|
-
/* @__PURE__ */E(TelevetButton,{label:
|
|
297
|
+
/* @__PURE__ */E(Text,{style:g.visitLine,children:Wi(e.scheduledAt)}),l?/* @__PURE__ */E(Text,{style:g.visitLine,children:l}):null]})]}),
|
|
298
|
+
/* @__PURE__ */E(TelevetButton,{label:Ls.getReadyCta,kind:"primary",onPress:()=>t(e),testID:`televet-visits-open-${e.consultId}`})]},e.consultId)};/* @__PURE__ */
|
|
299
299
|
return z(f,{style:[g.screen,h],testID:"televet-visits",children:[
|
|
300
300
|
/* @__PURE__ */E(TelevetVisitBackRow,{onBack:o,testID:"televet-visits-back"}),
|
|
301
301
|
/* @__PURE__ */z(w,{contentContainerStyle:g.body,children:[R?
|
|
302
302
|
/* @__PURE__ */z(f,{style:g.stack,children:[
|
|
303
|
-
/* @__PURE__ */E(TelevetStateCard,{title:
|
|
304
|
-
/* @__PURE__ */z(f,{style:g.stack,testID:"televet-visits-empty",children:[r?/* @__PURE__ */E(BookCard,{title:
|
|
303
|
+
/* @__PURE__ */E(TelevetStateCard,{title:Ls.loadErrorTitle,actionLabel:Ls.retryCta,onAction:()=>b.refetch(),testID:"televet-visits-error"}),r?/* @__PURE__ */E(BookCard,{title:Ls.bookCardTitle,onBook:r}):null]}):P?/* @__PURE__ */E(f,{style:g.stack,testID:"televet-visits-loading",children:[0,1,2].map(e=>/* @__PURE__ */E(TelevetSkeletonBlock,{height:72},e))}):C.length===0?
|
|
304
|
+
/* @__PURE__ */z(f,{style:g.stack,testID:"televet-visits-empty",children:[r?/* @__PURE__ */E(BookCard,{title:Ls.bookCardTitle,onBook:r}):null,
|
|
305
305
|
/* @__PURE__ */z(f,{style:g.card,children:[
|
|
306
|
-
/* @__PURE__ */E(Text,{style:g.title,accessibilityRole:"header",children:
|
|
307
|
-
/* @__PURE__ */E(Text,{style:g.meta,children:
|
|
306
|
+
/* @__PURE__ */E(Text,{style:g.title,accessibilityRole:"header",children:Ls.pastTitle}),
|
|
307
|
+
/* @__PURE__ */E(Text,{style:g.meta,children:Ls.emptyTitle})]})]}):/* @__PURE__ */z(f,{style:g.body,children:[I.length>0?/* @__PURE__ */E(f,{style:g.body,testID:"televet-visits-upcoming",children:I.map(N)}):r?/* @__PURE__ */E(BookCard,{title:Ls.bookCardTitle,onBook:r}):null,k&&s&&T.threads.length>0?/* @__PURE__ */E(TelevetVetMessagesCard,{threads:T.threads,pets:v,onOpen:s}):null,
|
|
308
308
|
/* @__PURE__ */z(f,{style:g.card,testID:"televet-visits-past",children:[
|
|
309
|
-
/* @__PURE__ */E(Text,{style:g.title,accessibilityRole:"header",children:
|
|
310
|
-
/* @__PURE__ */E(Text,{style:g.footnote,testID:"televet-visits-footnote",children:De.footnote})]})]})}function BookCard({title:e,onBook:t}){let n=
|
|
309
|
+
/* @__PURE__ */E(Text,{style:g.title,accessibilityRole:"header",children:Ls.pastTitle}),D.length>0?/* @__PURE__ */E(f,{style:g.list,children:D.map(j)}):null]}),I.length>0&&r?/* @__PURE__ */E(BookCard,{title:Ls.bookAnotherTitle,onBook:r}):null]}),
|
|
310
|
+
/* @__PURE__ */E(Text,{style:g.footnote,testID:"televet-visits-footnote",children:De.footnote})]})]})}function BookCard({title:e,onBook:t}){let n=js();/* @__PURE__ */
|
|
311
311
|
return z(f,{style:n.bookCard,testID:"televet-visits-book-card",children:[
|
|
312
312
|
/* @__PURE__ */E(Text,{style:n.bookTitle,children:e}),
|
|
313
|
-
/* @__PURE__ */E(Text,{style:n.bookSubtitle,children:
|
|
314
|
-
/* @__PURE__ */E(TelevetButton,{label:
|
|
313
|
+
/* @__PURE__ */E(Text,{style:n.bookSubtitle,children:Ls.bookCardSubtitle}),
|
|
314
|
+
/* @__PURE__ */E(TelevetButton,{label:Ls.bookCta,kind:"primary",onPress:t,testID:"televet-visits-book"})]})}var od=48,ad=/* @__PURE__ */Object.freeze({flex:1,minHeight:0});function TelevetVetThreadScreen({petRef:petRef,petName:e,vetName:t,ownerCanStart:n,controller:o,onBack:a,style:s}){let d=js(),c=Bs(),u=useTelevetBookingController(o),p=useVetThread(u,petRef,{ownerCanStart:n}),[h,g]=r(""),y=l(null),b=C.OS==="ios",v=Za(void 0,b),T=t?.trim()||sd(p.messages),k=Es(T),_=p.messages[p.messages.length-1]?.messageId;i(()=>{p.status==="ready"&&y.current?.scrollToEnd?.({animated:false})},[p.status,_]);let x=()=>{let e=h;e.trim().length===0||p.sending||p.send(e).then(e=>{e&&g("")})},I=h.trim().length>0&&!p.sending;/* @__PURE__ */
|
|
315
315
|
return z(f,{style:[d.screen,s],testID:"televet-vet-thread",children:[
|
|
316
316
|
/* @__PURE__ */E(TelevetVisitBackRow,{onBack:a,testID:"televet-vet-thread-back"}),
|
|
317
317
|
/* @__PURE__ */z(f,{style:c.head,children:[
|
|
318
|
-
/* @__PURE__ */E(Text,{style:c.screenTitle,accessibilityRole:"header",children:
|
|
319
|
-
/* @__PURE__ */z(S,{behavior:b?"padding":void 0,style:
|
|
320
|
-
/* @__PURE__ */E(KeyboardOffsetProbe,{probeRef:v.probeRef}),p.status==="loading"?/* @__PURE__ */z(f,{style:d.stack,testID:"televet-vet-thread-loading",accessibilityLabel:
|
|
318
|
+
/* @__PURE__ */E(Text,{style:c.screenTitle,accessibilityRole:"header",children:Rs(zs(e))}),T?/* @__PURE__ */E(Text,{style:c.meta,children:Ps(Ds.threadMetaTemplateNative,{vet:T})}):null]}),
|
|
319
|
+
/* @__PURE__ */z(S,{behavior:b?"padding":void 0,style:ad,...v.avoidingProps,children:[
|
|
320
|
+
/* @__PURE__ */E(KeyboardOffsetProbe,{probeRef:v.probeRef}),p.status==="loading"?/* @__PURE__ */z(f,{style:d.stack,testID:"televet-vet-thread-loading",accessibilityLabel:Ds.loading,children:[
|
|
321
321
|
/* @__PURE__ */E(TelevetSkeletonBlock,{height:56}),
|
|
322
|
-
/* @__PURE__ */E(TelevetSkeletonBlock,{height:56})]}):p.status==="error"?/* @__PURE__ */E(TelevetStateCard,{title:
|
|
322
|
+
/* @__PURE__ */E(TelevetSkeletonBlock,{height:56})]}):p.status==="error"?/* @__PURE__ */E(TelevetStateCard,{title:Ds.loadFailed,actionLabel:Ds.retry,onAction:p.retry,testID:"televet-vet-thread-error"}):/* @__PURE__ */z(w,{ref:y,accessibilityLabel:Ps(Ds.threadLogTemplate,{vet:k}),contentContainerStyle:c.log,scrollEventThrottle:64,keyboardShouldPersistTaps:"handled",keyboardDismissMode:b?"interactive":"on-drag",onScroll:e=>{e.nativeEvent.contentOffset.y<=od&&p.loadOlder()},testID:"televet-vet-thread-log",children:[p.messages.length===0?/* @__PURE__ */E(Text,{style:c.system,children:Ds.empty}):null,p.messages.map((e,t)=>/* @__PURE__ */E(ThreadItem,{message:e,previous:p.messages[t-1],vet:k,styles:c},e.messageId))]}),p.status==="ready"&&p.canWrite?/* @__PURE__ */z(f,{style:d.stack,children:[
|
|
323
323
|
/* @__PURE__ */z(f,{style:c.composer,children:[
|
|
324
|
-
/* @__PURE__ */E(
|
|
325
|
-
/* @__PURE__ */E(m,{onPress:x,disabled:!I,accessibilityRole:"button",accessibilityLabel:
|
|
324
|
+
/* @__PURE__ */E(tl,{value:h,onChangeText:g,multiline:true,accessibilityLabel:Rs(Ps(Ds.composerLabelTemplateNative,{vet:k})),placeholder:Ps(Ds.composerPlaceholderTemplate,{vet:k}),style:c.field,testID:"televet-vet-thread-field"}),
|
|
325
|
+
/* @__PURE__ */E(m,{onPress:x,disabled:!I,accessibilityRole:"button",accessibilityLabel:Ds.send,accessibilityState:{disabled:!I,busy:p.sending},style:[c.send,I?null:c.sendDisabled],testID:"televet-vet-thread-send",children:/* @__PURE__ */E(Text,{tier:"control",style:c.sendLabel,children:Ds.send})})]}),p.sendFailure==="notSent"?/* @__PURE__ */E(Text,{style:c.failure,accessibilityLiveRegion:"assertive",testID:"televet-vet-thread-failure",children:Ds.notSent}):p.sentCount>0?/* @__PURE__ */E(Text,{style:c.note,accessibilityLiveRegion:"polite",testID:"televet-vet-thread-status",children:Ds.sent}):null]}):null,p.sendFailure==="vetWritesFirst"?/* @__PURE__ */E(Text,{style:c.note,accessibilityLiveRegion:"polite",testID:"televet-vet-thread-vet-first",children:Ds.vetWritesFirst}):null]})]})}function ThreadItem({message:e,previous:t,vet:n,styles:r}){let l=Li(e.createdAt),i=t===void 0||Li(t.createdAt)!==l,o=e.attachmentCount>0?Ps(Ds.attachmentsTemplate,{n:String(e.attachmentCount)}):null;/* @__PURE__ */
|
|
326
326
|
return z(F,{children:[i?/* @__PURE__ */E(Text,{style:r.day,children:l}):null,e.role==="system"?/* @__PURE__ */E(Text,{style:r.system,children:e.content}):/* @__PURE__ */z(f,{style:[r.item,e.role==="owner"?r.itemMine:null],testID:`televet-vet-thread-message-${e.messageId}`,children:[e.role==="vet"?/* @__PURE__ */z(f,{style:r.whoRow,children:[
|
|
327
|
-
/* @__PURE__ */E(Text,{style:r.who,children:e.senderName??
|
|
328
|
-
/* @__PURE__ */E(Text,{style:r.time,children:
|
|
327
|
+
/* @__PURE__ */E(Text,{style:r.who,children:e.senderName??Rs(n)}),
|
|
328
|
+
/* @__PURE__ */E(Text,{style:r.time,children:zi(e.createdAt)})]}):null,e.content.length>0?/* @__PURE__ */E(Text,{style:e.role==="owner"?r.bubbleMine:r.bubbleVet,children:e.content}):null,o?/* @__PURE__ */E(Text,{style:r.attachments,children:o}):null]})]})}function sd(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:t,onBack:n,onMessageVet:r,onBook:l,style:i}){let o=js(),a=Bs(),s=useTelevetBookingController(t),d=useVisitSummary(s,e.consultId),{pets:c}=useEverfurPets(),u=hs(c,e.petId),p=d.summary,h=p?.approvedByName??e.clinicianName,m=Es(h),g=u&&e.clinicianName?Ps(Ls.visitTitleTemplate,{pet:u,vet:e.clinicianName}):Rs(zs(u)),y=[Fi(e.scheduledAt),h].filter(Boolean).join(" · "),b=vetThreadPetRef(c,e.petId),v=r&&b!==null?()=>r({petRef:b,petName:u,vetName:h??null}):void 0;/* @__PURE__ */
|
|
329
329
|
return z(f,{style:[o.screen,i],testID:"televet-visit-summary",children:[
|
|
330
330
|
/* @__PURE__ */E(TelevetVisitBackRow,{onBack:n,testID:"televet-visit-summary-back"}),
|
|
331
331
|
/* @__PURE__ */z(w,{contentContainerStyle:o.body,children:[
|
|
332
332
|
/* @__PURE__ */z(f,{style:a.head,children:[
|
|
333
|
-
/* @__PURE__ */E(Text,{style:a.screenTitle,accessibilityRole:"header",children:g}),y?/* @__PURE__ */E(Text,{style:a.meta,children:y}):null]}),d.status==="loading"?/* @__PURE__ */z(f,{style:o.stack,testID:"televet-visit-summary-loading",accessibilityLabel:
|
|
333
|
+
/* @__PURE__ */E(Text,{style:a.screenTitle,accessibilityRole:"header",children:g}),y?/* @__PURE__ */E(Text,{style:a.meta,children:y}):null]}),d.status==="loading"?/* @__PURE__ */z(f,{style:o.stack,testID:"televet-visit-summary-loading",accessibilityLabel:Ds.loading,children:[
|
|
334
334
|
/* @__PURE__ */E(TelevetSkeletonBlock,{height:96}),
|
|
335
|
-
/* @__PURE__ */E(TelevetSkeletonBlock,{height:96})]}):d.status==="absent"?null:d.status==="pending"?/* @__PURE__ */E(TelevetStateCard,{title:
|
|
336
|
-
/* @__PURE__ */E(Text,{style:o.title,accessibilityRole:"header",children:Ps(Ds
|
|
335
|
+
/* @__PURE__ */E(TelevetSkeletonBlock,{height:96})]}):d.status==="absent"?null:d.status==="pending"?/* @__PURE__ */E(TelevetStateCard,{title:Ds.summaryPending,testID:"televet-visit-summary-pending"}):d.status==="error"||p===null?/* @__PURE__ */E(TelevetStateCard,{title:Ds.loadFailed,actionLabel:Ds.retry,onAction:d.retry,testID:"televet-visit-summary-error"}):/* @__PURE__ */z(F,{children:[p.findingsText.trim().length>0?/* @__PURE__ */z(f,{style:o.card,children:[
|
|
336
|
+
/* @__PURE__ */E(Text,{style:o.title,accessibilityRole:"header",children:Rs(Ps(Ds.sawTitleTemplate,{vet:m}))}),
|
|
337
337
|
/* @__PURE__ */z(f,{style:o.cardHead,children:[
|
|
338
|
-
/* @__PURE__ */E(Text,{style:a.label,children:
|
|
339
|
-
/* @__PURE__ */E(f,{style:[o.pill,o.pillLine],children:/* @__PURE__ */E(Text,{tier:"badge",style:[o.pillText,o.pillLineText],children:Ps(Ds
|
|
338
|
+
/* @__PURE__ */E(Text,{style:a.label,children:Ds.summaryLabel}),
|
|
339
|
+
/* @__PURE__ */E(f,{style:[o.pill,o.pillLine],children:/* @__PURE__ */E(Text,{tier:"badge",style:[o.pillText,o.pillLineText],children:Rs(Ps(Ds.fromVetTemplate,{vet:m}))})})]}),
|
|
340
340
|
/* @__PURE__ */E(Text,{style:a.body,children:p.findingsText})]}):null,p.nextStepsText.trim().length>0||p.actionItems.length>0?/* @__PURE__ */z(f,{style:o.card,testID:"televet-visit-summary-plan",children:[
|
|
341
341
|
/* @__PURE__ */z(f,{style:o.cardHead,children:[
|
|
342
|
-
/* @__PURE__ */E(Text,{style:o.title,accessibilityRole:"header",children:Ps(Ds
|
|
343
|
-
/* @__PURE__ */E(f,{style:o.pill,children:/* @__PURE__ */E(Text,{tier:"badge",style:o.pillText,children:
|
|
342
|
+
/* @__PURE__ */E(Text,{style:o.title,accessibilityRole:"header",children:Rs(Ps(Ds.planTitleTemplate,{pet:zs(u)}))}),
|
|
343
|
+
/* @__PURE__ */E(f,{style:o.pill,children:/* @__PURE__ */E(Text,{tier:"badge",style:o.pillText,children:Ds.wordForWord})})]}),p.nextStepsText.trim().length>0?/* @__PURE__ */E(Text,{style:a.body,children:p.nextStepsText}):null,p.actionItems.map((e,t)=>/* @__PURE__ */z(f,{style:a.planItem,children:[
|
|
344
344
|
/* @__PURE__ */E(Text,{style:a.planNumber,children:String(t+1).padStart(2,"0")}),
|
|
345
345
|
/* @__PURE__ */E(Text,{style:a.planText,children:`“${e}”`})]},`${String(t)}-${e}`))]}):null,p.medications.length>0?/* @__PURE__ */z(f,{style:o.card,testID:"televet-visit-summary-medications",children:[
|
|
346
|
-
/* @__PURE__ */E(Text,{style:o.title,accessibilityRole:"header",children:
|
|
347
|
-
/* @__PURE__ */E(Text,{style:o.when,children:[e.drug,e.strength].filter(Boolean).join(" ")}),e.sig?/* @__PURE__ */E(Text,{style:o.meta,children:e.sig}):null]},`${String(t)}-${e.drug}`))]}):null,h||v?/* @__PURE__ */z(f,{style:o.card,testID:"televet-visit-summary-vet",children:[h?/* @__PURE__ */E(Text,{style:o.title,children:h}):null,p.credentialsText?/* @__PURE__ */E(Text,{style:o.meta,children:p.credentialsText}):null,v?/* @__PURE__ */E(TelevetButton,{label:Ps(Ds
|
|
348
|
-
/* @__PURE__ */E(Text,{style:o.footnote,testID:"televet-visit-summary-footnote",children:Ds
|
|
346
|
+
/* @__PURE__ */E(Text,{style:o.title,accessibilityRole:"header",children:Ds.fromThisVisitTitle}),p.medications.map((e,t)=>/* @__PURE__ */z(f,{style:[o.row,t===0?o.rowFirst:null],children:[
|
|
347
|
+
/* @__PURE__ */E(Text,{style:o.when,children:[e.drug,e.strength].filter(Boolean).join(" ")}),e.sig?/* @__PURE__ */E(Text,{style:o.meta,children:e.sig}):null]},`${String(t)}-${e.drug}`))]}):null,h||v?/* @__PURE__ */z(f,{style:o.card,testID:"televet-visit-summary-vet",children:[h?/* @__PURE__ */E(Text,{style:o.title,children:h}):null,p.credentialsText?/* @__PURE__ */E(Text,{style:o.meta,children:p.credentialsText}):null,v?/* @__PURE__ */E(TelevetButton,{label:Rs(Ps(Ds.messageVetTemplate,{vet:m})),kind:"secondary",fullWidth:false,onPress:v,testID:"televet-visit-summary-message"}):null]}):null,l?/* @__PURE__ */E(TelevetButton,{label:Ds.bookFollowUp,onPress:l,testID:"televet-visit-summary-book"}):null,
|
|
348
|
+
/* @__PURE__ */E(Text,{style:o.footnote,testID:"televet-visit-summary-footnote",children:Ps(Ds.summaryFootnoteTemplate,{vet:m})})]})]})]})}var dd=/* @__PURE__ */Object.freeze({name:"home"}),cd=/* @__PURE__ */Object.freeze({name:"visits"}),ud=/* @__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}):dd}function pd(e,t){switch(t.type){case"push":/* @__PURE__ */
|
|
349
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,...r}=ve(e,["onExit","onBooked","onAddPet","onRequestLocation","onFindEmergencyVet"]);/* @__PURE__ */
|
|
350
|
-
return E(CapabilityGate,{capability:"televet",style:t,...n?{renderPending:n}:{},children:/* @__PURE__ */E(TelevetFlowBody,{...r,style:t})})}function TelevetFlowBody({petRef:petRef,usState:e,controller:t,onBooked:n,onExit:l,onAddPet:s,onPickMedia:d,onAddToCalendar:c,onConfirmDiscard:u,onRequestLocation:p,locationStatus:h,primaryVet:m,onFindEmergencyVet:g,onTriageReason:y,canJoinInApp:b=false,renderUnavailable:T,initialScreen:k,bookingVariant:w,quickBooking:C,style:S}){let _=
|
|
351
|
-
return E(TelevetLandingScreen,{controller:t,onLand:
|
|
350
|
+
return E(CapabilityGate,{capability:"televet",style:t,...n?{renderPending:n}:{},children:/* @__PURE__ */E(TelevetFlowBody,{...r,style:t})})}function TelevetFlowBody({petRef:petRef,usState:e,controller:t,onBooked:n,onExit:l,onAddPet:s,onPickMedia:d,onAddToCalendar:c,onConfirmDiscard:u,onRequestLocation:p,locationStatus:h,primaryVet:m,onFindEmergencyVet:g,onTriageReason:y,canJoinInApp:b=false,renderUnavailable:T,initialScreen:k,bookingVariant:w,quickBooking:C,style:S}){let _=ma(),[x,I]=a(pd,k??dd,e=>/* @__PURE__ */Object.freeze({stack:/* @__PURE__ */Object.freeze([e])})),[D,P]=r(()=>k?.name==="join"?k.consultId:null),R=x.stack[x.stack.length-1]??dd,z=x.stack.length,[F,L]=r(0),A=o(()=>L(e=>e+1),[]),j=o(()=>z<=1||R.name==="call"||R.name==="booking"?false:(I({type:"pop"}),true),[z,R.name]);i(()=>{let e=v.addEventListener("hardwareBackPress",j);return()=>{e.remove()}},[j]),Ce(j);let O=o(()=>T?T():/* @__PURE__ */E(f,{style:_.list,testID:"televet-unavailable",children:isTelevetBookingCopyReady()?/* @__PURE__ */E(TelevetStateCard,{title:De.bookingPausedTitle}):null}),[T,_.list]),N=o(()=>{z>1?I({type:"pop"}):l?.()},[z,l]),B=e=>I({type:"push",screen:e}),H=o(e=>I({type:"land",screen:e==="visits"?cd:ud}),[]),M=/* @__PURE__ */E(EverfurTelevetBooking,{...petRef!==void 0?{petRef:petRef}:{},...e!==void 0?{usState:e}:{},...t?{controller:t}:{},onBooked:e=>{A(),n?.(e)},onExit:N,...s?{onAddPet:s}:{},...d?{onPickMedia:d}:{},...c?{onAddToCalendar:c}:{},...u?{onConfirmDiscard:u}:{},...p?{onRequestLocation:p}:{},...h?{locationStatus:h}:{},...m?{primaryVet:m}:{},...g?{onFindEmergencyVet:g}:{},...y?{onTriageReason:y}:{},canJoinInApp:b,renderUnavailable:O,...w?{variant:w}:{},...C?{quick:C}:{},style:S}),$=/* @__PURE__ */E(TelevetVisitsScreen,{...t?{controller:t}:{},revision:F,onOpenVisit:e=>B({name:"consult",consult:e}),onBook:()=>B({name:"booking"}),onBack:N,onOpenThread:e=>B({name:"thread",target:e}),onOpenSummary:e=>B({name:"summary",consult:e}),...D!==null?{joinFirst:D,onJoinFirst:(e,t)=>{P(null),e!==null&&(televetJoinDecision(e,Date.now()).joinable?B({name:"call",consultId:e.consultId,clinicianName:e.clinicianName,petName:t}):B({name:"consult",consult:e}))}}:{},style:S}),W=V();return R.name==="call"?W:/* @__PURE__ */E(SdkTabletColumn,{children:W});function V(){switch(R.name){case"home":/* @__PURE__ */
|
|
351
|
+
return E(TelevetLandingScreen,{controller:t,onLand:H,style:S});case"booking":return M;case"visits":case"visit":case"join":return $;case"consult":/* @__PURE__ */
|
|
352
352
|
return E(TelevetConsultScreen,{consult:R.consult,...t?{controller:t}:{},revision:F,onJoin:(e,t)=>B({name:"call",consultId:e.consultId,clinicianName:e.clinicianName,petName:t}),onReschedule:e=>B({name:"reschedule",consult:e}),onCancelled:A,onBack:N,onMessageVet:e=>B({name:"thread",target:e}),style:S});case"reschedule":/* @__PURE__ */
|
|
353
353
|
return E(EverfurTelevetReschedule,{consult:R.consult,...t?{controller:t}:{},onRescheduled:()=>{A(),I({type:"pop"})},onCancel:()=>I({type:"pop"}),style:S});case"call":/* @__PURE__ */
|
|
354
354
|
return E(TelevetJoinScreen,{consultId:R.consultId,...t?{controller:t}:{},...R.clinicianName!==void 0?{clinicianName:R.clinicianName}:{},...R.petName!==void 0?{petName:R.petName}:{},onLeave:()=>{A(),N()},style:S});case"thread":/* @__PURE__ */
|
|
355
355
|
return E(TelevetVetThreadScreen,{petRef:R.target.petRef,petName:R.target.petName,vetName:R.target.vetName,...R.target.ownerCanStart!==void 0?{ownerCanStart:R.target.ownerCanStart}:{},...t?{controller:t}:{},onBack:()=>{A(),N()},style:S});case"summary":/* @__PURE__ */
|
|
356
|
-
return E(TelevetVisitSummaryScreen,{consult:R.consult,...t?{controller:t}:{},onBack:N,onMessageVet:e=>B({name:"thread",target:e}),onBook:()=>B({name:"booking"}),style:S});default:return assertNever(R)}}}function TelevetLandingScreen({controller:e,onLand:t,style:n}){let r=
|
|
356
|
+
return E(TelevetVisitSummaryScreen,{consult:R.consult,...t?{controller:t}:{},onBack:N,onMessageVet:e=>B({name:"thread",target:e}),onBook:()=>B({name:"booking"}),style:S});default:return assertNever(R)}}}function TelevetLandingScreen({controller:e,onLand:t,style:n}){let r=ma(),l=useTelevetBookingController(e),o=Cr(l);return i(()=>{o!=="pending"&&t(o)},[o,t]),/* @__PURE__ */z(f,{style:[r.screen,r.list,n],testID:"televet-landing-loading",children:[
|
|
357
357
|
/* @__PURE__ */E(TelevetSkeletonBlock,{height:72}),
|
|
358
|
-
/* @__PURE__ */E(TelevetSkeletonBlock,{height:72})]})}var
|
|
358
|
+
/* @__PURE__ */E(TelevetSkeletonBlock,{height:72})]})}var hd=EverfurTelevetFlow;function EverfurTelevetModal({request:e,onClose:t,onAddToCalendar:l,onPickMedia:i,primaryVet:a,onFindEmergencyVet:s}){let d=useEverfurTheme(),c=A(),u=n(()=>ke(),[]),p=o(()=>{u.dispatch()||t()},[u,t]),[h,m]=r(false),g=n(()=>({setFullBleed:m}),[]),y=n(()=>televetScreenForRequest(e),[e]),b=h||Xo([d.color.surface])===Qo;/* @__PURE__ */
|
|
359
359
|
return z(_,{visible:true,animationType:d.motion.reducedMotion?"none":"slide",presentationStyle:"fullScreen",onRequestClose:p,children:[
|
|
360
360
|
/* @__PURE__ */E(x,{barStyle:b?"light-content":"dark-content",animated:true}),
|
|
361
|
-
/* @__PURE__ */E(f,{testID:"everfur-televet-modal",style:[
|
|
361
|
+
/* @__PURE__ */E(f,{testID:"everfur-televet-modal",style:[fd.root,{backgroundColor:d.color.surface},h?null:{paddingTop:c.top,paddingBottom:c.bottom}],children:/* @__PURE__ */E(SdkColumnReset,{children:/* @__PURE__ */E(we.Provider,{value:u,children:/* @__PURE__ */E(Xs.Provider,{value:g,children:/* @__PURE__ */E(hd,{...e.petRef!==void 0?{petRef:e.petRef}:{},...e.usState!==void 0?{usState:e.usState}:{},initialScreen:y,onExit:t,...l?{onAddToCalendar:l}:{},...i?{onPickMedia:i}:{},...a?{primaryVet:a}:{},...s?{onFindEmergencyVet:s}:{},canJoinInApp:Us(),style:fd.root})})})})})]})}var fd=h.create({root:{flex:1}});function useUpcomingTelevetVisit(e){let t=useTelevetBookingController(),r=e?.enabled!==false&&t!==null,l=vr(r?t:null);return n(()=>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])}export{Ia as BACK_LABEL,W as CANCELLATION_POLICY_VERSION_MAX,se as CANCEL_REASON_MAX,H as CONSULT_KINDS,Ai as CONSULT_MINUTES,j as CONSULT_STATUSES,hd as EverfurTelevet,EverfurTelevetBooking,EverfurTelevetFlow,EverfurTelevetModal,EverfurTelevetReschedule,q as MEDIA_REFS_MAX,io as NO_MEDIA_SHORTFALL,V as REASON_TEXT_MAX,Pn as TELEVET_BOOKING_BASE,De as TELEVET_BOOKING_COPY,ki as TELEVET_BOOKING_STEPS,Bn as TELEVET_CONSULT_PAGE_LIMIT,ue as TELEVET_JOIN_CLOSES_MINUTES_AFTER,ce as TELEVET_JOIN_OPENS_MINUTES_BEFORE,on as TELEVET_MESSAGE_THREADS_PATH,O as TERMINAL_CONSULT_STATUSES,TelevetBookedScreen,TelevetBookingChrome,TelevetClinicianEmptyState,TelevetConsentCheckbox,TelevetConsultScreen,TelevetDayStrip,TelevetEarlyEmergency,TelevetEmergencyExits,TelevetEntitlementInterestState,TelevetIntakeMedia,TelevetJoinScreen,TelevetMediaDropNotice,TelevetSlotPicker,TelevetStateInterestAction,TelevetSummaryCard,TelevetSummaryRow,TelevetVetThreadScreen,TelevetVisitSummaryScreen,TelevetVisitsScreen,Ds as VET_MESSAGES_COPY,an as VET_MESSAGE_CONTENT_MAX,sn as VET_MESSAGE_PAGE_DEFAULT,dn as VET_MESSAGE_PAGE_MAX,attestation,canConfirm,canManageTelevetVisit,createTelevetBookingController,currentStep,wi as emptyTelevetDraft,formatVisitRange,formatWhen,formatWhenWithDay,hasPreviousStep,initialTelevetBookingState,isHoldExpired,isMediaShortfallEmpty,isSkipped,isTelevetBookingCopyReady,isVetMessagesDark,isVetThreadVetFirst,isWellFormedStateCode,mediaShortfallFromUnsentPicks,parseVetCallCredential,splitTelevetVisits,televetBookingKey,televetBookingReducer,televetBookingRefusal,televetCancelCall,televetConsultCalendarKey,televetConsultCall,televetDaysFromSlots,televetEmptyRosterCause,televetEmptyRosterView,televetHoldCall,televetJoinCall,televetJoinOpensAtMs,televetJoinReadiness,televetMediaShortfallLines,televetRescheduleCall,televetScreenForRequest,televetThreadMessagesCall,televetThreadReadCall,televetVisitSummaryCall,useEarlyTriage,useStateInterest,useTelevetBookConsult,useTelevetBookingAvailable,useTelevetBookingController,useTelevetBookingEntitlement,useTelevetCancellationPolicy,useTelevetClinicians,useTelevetHoldSlot,useTelevetJoin,useTelevetNextSlot,useTelevetRescheduleConsult,useTelevetSlots,useTelevetStatePolicy,useUpcomingTelevetVisit,useVetThread,useVetThreads,useVisitSummary,validateBookingBody,vetCallJoinReason,vetCallJoinRefusal,vetThreadPetRef,withUnsentPicks};
|