@everfur/sdk 1.4.1 → 1.5.1
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/README.md +2 -2
- package/dist/{Chat.d-qQVN6VLp.d.ts → Chat.d-BCfyvzX8.d.ts} +1 -1
- package/dist/{Chat.d-Bl-_TsvQ.d.cts → Chat.d-Od44h51D.d.cts} +1 -1
- package/dist/{DepthViews.d-PmjccZLr.d.cts → DepthViews.d-BGspxovy.d.cts} +1 -1
- package/dist/{DepthViews.d-aOChkwU2.d.ts → DepthViews.d-BIHVrf9r.d.ts} +1 -1
- package/dist/{DepthViews.d-ktxIIsnb.d.cts → DepthViews.d-BaLh7Lsi.d.cts} +1 -1
- package/dist/{DepthViews.d-CpF_Y_z9.d.ts → DepthViews.d-CEVk9poG.d.ts} +1 -1
- package/dist/ErrorPolicyPort.d-BIdmYQnk.d.cts +43 -0
- package/dist/ErrorPolicyPort.d-BnI5qWg4.d.ts +43 -0
- package/dist/{RecordsPage.d-BfMSOsg_.d.ts → RecordsPage.d-D10RIgdc.d.ts} +1 -1
- package/dist/{RecordsPage.d-DWjFpZs1.d.cts → RecordsPage.d-DbhYNSbq.d.cts} +1 -1
- package/dist/animations/index.d.cts +3 -3
- package/dist/animations/index.d.ts +3 -3
- package/dist/{attachments.d-DOmkQ_8O.d.ts → attachments.d-BlukNfIf.d.ts} +1 -1
- package/dist/{attachments.d-DBlHzWYy.d.cts → attachments.d-CF4lLuGK.d.cts} +1 -1
- package/dist/{bookingCopy.d-ITpabqPr.d.ts → bookingCopy.d-BL2-URcv.d.ts} +15 -14
- package/dist/{bookingCopy.d-B39JAmIZ.d.cts → bookingCopy.d-Dfew1pjY.d.cts} +15 -14
- package/dist/{callCopy.d-Bw6oZT54.d.cts → callCopy.d-BQxpwXqT.d.cts} +3 -3
- package/dist/{callCopy.d-Bw6oZT54.d.ts → callCopy.d-BQxpwXqT.d.ts} +3 -3
- package/dist/{callRoom.d-B1DoYdJe.d.cts → callRoom.d-9Dm7XnUr.d.cts} +1 -1
- package/dist/{callRoom.d-Dqm1rUqT.d.ts → callRoom.d-t-khijDv.d.ts} +1 -1
- package/dist/{casesRepository.d-De4ZtgJ_.d.cts → casesRepository.d-CVuKTkJo.d.cts} +1 -1
- package/dist/{casesRepository.d-DsEeFd0F.d.ts → casesRepository.d-Dn1fK1b2.d.ts} +1 -1
- package/dist/chat/index.cjs +21 -21
- package/dist/chat/index.d.cts +12 -12
- package/dist/chat/index.d.ts +12 -12
- package/dist/chat/index.js +21 -21
- package/dist/chat/lite/index.cjs +21 -21
- package/dist/chat/lite/index.d.cts +12 -12
- package/dist/chat/lite/index.d.ts +12 -12
- package/dist/chat/lite/index.js +21 -21
- package/dist/{chatHandoffToken.d-B4-iQ35P.d.cts → chatHandoffToken.d-BjfmIxXk.d.cts} +6 -6
- package/dist/{chatHandoffToken.d-Br3Gw3w-.d.ts → chatHandoffToken.d-CFiI6IMc.d.ts} +6 -6
- package/dist/{checkin.d-CAKQydg8.d.cts → checkin.d-BP3ZWBfX.d.cts} +5 -5
- package/dist/{checkin.d-qvYXugN3.d.ts → checkin.d-CokpahFL.d.ts} +5 -5
- package/dist/{chunk-7MMJ7CYN.js → chunk-IO4CGYHT.js} +1 -1
- package/dist/{chunk-PJHMKQ5C.js → chunk-NBAOR5TJ.js} +23 -23
- package/dist/{chunk-5OK2AF63.js → chunk-RD6ZGYEJ.js} +17 -17
- package/dist/{chunk-6I4REU4U.js → chunk-ZYHPCQVM.js} +1 -1
- package/dist/client/index.cjs +31 -31
- package/dist/client/index.d.cts +19 -16
- package/dist/client/index.d.ts +19 -16
- package/dist/client/index.js +30 -30
- package/dist/{clinicBatch.d-B3YJc8IO.d.cts → clinicBatch.d-C0xx5L4j.d.cts} +3 -3
- package/dist/{clinicBatch.d-DhvQuPHV.d.ts → clinicBatch.d-DNi4UURs.d.ts} +3 -3
- package/dist/{config.d-DRoQ2lAx.d.ts → config.d-B7Z-KTGq.d.ts} +10 -2
- package/dist/{config.d-BiVy0fLx.d.cts → config.d-ClAI2RZ6.d.cts} +10 -2
- package/dist/consent/index.d.cts +6 -6
- package/dist/consent/index.d.ts +6 -6
- package/dist/{context.d-DZfxKxNi.d.cts → context.d-Bj6-xYPA.d.cts} +11 -5
- package/dist/{context.d-FjU7dQP7.d.ts → context.d-DS1GXUEY.d.ts} +11 -5
- package/dist/{copy.d-Ce_8KuZg.d.cts → copy.d--F5A9cXK.d.cts} +3 -3
- package/dist/{copy.d-BP36f_63.d.ts → copy.d-DmxuFJFe.d.ts} +3 -3
- package/dist/core/index.cjs +41 -40
- package/dist/core/index.d.cts +16 -16
- package/dist/core/index.d.ts +16 -16
- package/dist/core/index.js +41 -40
- package/dist/{depth.d-DzMMmRN4.d.ts → depth.d-CgzYE6_n.d.ts} +3 -3
- package/dist/{depth.d-BtlcIqPJ.d.cts → depth.d-DLaP0o8Y.d.cts} +3 -3
- package/dist/{entitlementRepository.d-BltqS1W8.d.ts → entitlementRepository.d-CkUTlVAb.d.ts} +2 -2
- package/dist/{entitlementRepository.d-wfqpUIKN.d.cts → entitlementRepository.d-DVTp-BB9.d.cts} +2 -2
- package/dist/{focus.d-BX7oahFk.d.cts → focus.d-CLTjm6In.d.cts} +1 -1
- package/dist/{focus.d-armXecf0.d.ts → focus.d-u-HYvim0.d.ts} +1 -1
- package/dist/health-plan/index.d.cts +15 -15
- package/dist/health-plan/index.d.ts +15 -15
- package/dist/{healthPlanRepository.d-DBx7-NLE.d.cts → healthPlanRepository.d-B22kjrYa.d.cts} +3 -3
- package/dist/{healthPlanRepository.d-C7K9dJK5.d.ts → healthPlanRepository.d-CwRXeoM7.d.ts} +3 -3
- package/dist/{idempotency.d-Dak2-pON.d.cts → idempotency.d-CFVMhWcv.d.cts} +1 -1
- package/dist/{idempotency.d-symqJ8Tt.d.ts → idempotency.d-dOFfV91-.d.ts} +1 -1
- package/dist/{identity.d-DOKJFaiz.d.ts → identity.d-D4VtpqRr.d.ts} +1 -1
- package/dist/{identity.d-DIH9h3Le.d.cts → identity.d-DDpXOtas.d.cts} +1 -1
- package/dist/{inbox.d-AuGKeaZv.d.cts → inbox.d-CPcMMz-Y.d.cts} +2 -2
- package/dist/{inbox.d-B5b57OXc.d.ts → inbox.d-DJ9xgU1Z.d.ts} +2 -2
- package/dist/index.cjs +246 -245
- package/dist/index.d.cts +17 -17
- package/dist/index.d.ts +17 -17
- package/dist/index.js +244 -243
- package/dist/{introEvents.d-ehik7PEn.d.cts → introEvents.d-B7acmGwf.d.cts} +1 -1
- package/dist/{introEvents.d-S4Q4BOSt.d.ts → introEvents.d-DW3gLljE.d.ts} +1 -1
- package/dist/{layout.d-Bm2_1wa4.d.ts → layout.d-C8y_ki1V.d.ts} +1 -1
- package/dist/{layout.d-CFF-nBXf.d.cts → layout.d-DfaFM_lp.d.cts} +1 -1
- package/dist/{models.d-DOwpK1ZF.d.ts → models.d-NAWqF1wC.d.ts} +6 -3
- package/dist/{models.d-Su_BBBTW.d.cts → models.d-wJ_Ze4p5.d.cts} +6 -3
- package/dist/notifications/inbox/index.d.cts +7 -7
- package/dist/notifications/inbox/index.d.ts +7 -7
- package/dist/notifications/index.d.cts +8 -8
- package/dist/notifications/index.d.ts +8 -8
- package/dist/{optInView.d-DbGx1A9R.d.cts → optInView.d-ByDJMrMv.d.cts} +13 -13
- package/dist/{optInView.d-xnIxCLlH.d.ts → optInView.d-DVshLxbD.d.ts} +13 -13
- package/dist/{parse.d-DtHmpAMT.d.cts → parse.d-BDZ7ffgj.d.cts} +4 -1
- package/dist/{parse.d-DtHmpAMT.d.ts → parse.d-BDZ7ffgj.d.ts} +4 -1
- package/dist/{pets.d-BEqKykpu.d.ts → pets.d-BpLObpfM.d.ts} +1 -1
- package/dist/{pets.d-BS6sLxY-.d.cts → pets.d-DXhzTNuI.d.cts} +1 -1
- package/dist/{petsRepository.d-iHrHkXM2.d.ts → petsRepository.d-_QfM7F6T.d.ts} +1 -1
- package/dist/{petsRepository.d-DB5CNKsK.d.cts → petsRepository.d-ai_tZ3lu.d.cts} +1 -1
- package/dist/records/depth/index.d.cts +10 -10
- package/dist/records/depth/index.d.ts +10 -10
- package/dist/records/index.cjs +1 -1
- package/dist/records/index.d.cts +11 -11
- package/dist/records/index.d.ts +11 -11
- package/dist/records/index.js +1 -1
- package/dist/{requestFunnel.d-SySe6xHp.d.cts → requestFunnel.d-BwZDfWVD.d.cts} +3 -3
- package/dist/{requestFunnel.d-CehftayS.d.ts → requestFunnel.d-DKBPTpsy.d.ts} +3 -3
- package/dist/{route.d-DSSSpSB-.d.cts → route.d-DCzQh4ix.d.cts} +3 -3
- package/dist/{route.d-B395-hNX.d.ts → route.d-DSYEd2MR.d.ts} +3 -3
- package/dist/{runtimeTypes.d-DAz0Tgw5.d.ts → runtimeTypes.d-BzUig75K.d.ts} +11 -7
- package/dist/{runtimeTypes.d-DPh1Wh15.d.cts → runtimeTypes.d-CL4l7ta4.d.cts} +11 -7
- package/dist/{screenProps.d-Bd2yphad.d.cts → screenProps.d-6xmE1C-V.d.cts} +2 -2
- package/dist/{screenProps.d-D9Vi-Afl.d.ts → screenProps.d-fHBKArt_.d.ts} +2 -2
- package/dist/{sdkConfigStore.d-VPvsIL8E.d.ts → sdkConfigStore.d-BNCVVEWC.d.ts} +1 -1
- package/dist/{sdkConfigStore.d-BHrzkVpP.d.cts → sdkConfigStore.d-C2BAr9kI.d.cts} +1 -1
- package/dist/server/events/index.cjs +4 -4
- package/dist/server/events/index.d.cts +2 -2
- package/dist/server/events/index.d.ts +2 -2
- package/dist/server/events/index.js +4 -4
- package/dist/server/index.cjs +9 -9
- package/dist/server/index.d.cts +3 -3
- package/dist/server/index.d.ts +3 -3
- package/dist/server/index.js +9 -9
- package/dist/shop/index.d.cts +3 -3
- package/dist/shop/index.d.ts +3 -3
- package/dist/slots/index.d.cts +6 -6
- package/dist/slots/index.d.ts +6 -6
- package/dist/tabs/index.cjs +87 -84
- package/dist/tabs/index.d.cts +15 -15
- package/dist/tabs/index.d.ts +15 -15
- package/dist/tabs/index.js +95 -92
- package/dist/televet/booking/index.cjs +74 -75
- package/dist/televet/booking/index.d.cts +8 -8
- package/dist/televet/booking/index.d.ts +8 -8
- package/dist/televet/booking/index.js +4 -5
- package/dist/televet/call/index.d.cts +2 -2
- package/dist/televet/call/index.d.ts +2 -2
- package/dist/testing/index.d.cts +1 -1
- package/dist/testing/index.d.ts +1 -1
- package/dist/testing/rn/index.d.cts +10 -10
- package/dist/testing/rn/index.d.ts +10 -10
- package/dist/testing/web/index.d.cts +10 -10
- package/dist/testing/web/index.d.ts +10 -10
- package/dist/texting/index.d.cts +6 -6
- package/dist/texting/index.d.ts +6 -6
- package/dist/{threadOptions.d-bEAFkIsC.d.cts → threadOptions.d-Bqy5d5Fx.d.cts} +1 -1
- package/dist/{threadOptions.d-U5YBUKM-.d.ts → threadOptions.d-DOEIpk1t.d.ts} +1 -1
- package/dist/{threadOptions.d-DUQxxHyM.d.cts → threadOptions.d-Dc57dm7h.d.cts} +5 -5
- package/dist/{threadOptions.d-DnM9UcMx.d.ts → threadOptions.d-NSlFx-Lp.d.ts} +5 -5
- package/dist/{timelineRows.d-DXppCSCg.d.cts → timelineRows.d-7w8NsNi4.d.cts} +1 -1
- package/dist/{timelineRows.d-9Uhf4q5d.d.ts → timelineRows.d-CthNM5hV.d.ts} +1 -1
- package/dist/{useHealthPlanSubscription.d-CRBPMlsc.d.ts → useHealthPlanSubscription.d-CV7M21HS.d.ts} +3 -3
- package/dist/{useHealthPlanSubscription.d-DfjTYv1u.d.cts → useHealthPlanSubscription.d-SA9-SuKe.d.cts} +3 -3
- package/dist/{useInboxUnread.d-CP3KwSkn.d.ts → useInboxUnread.d-CXiaR3BZ.d.ts} +1 -1
- package/dist/{useInboxUnread.d-DiE_NbtS.d.cts → useInboxUnread.d-DERpMelw.d.cts} +1 -1
- package/dist/{usePresentation.d-DUYzYXgA.d.cts → usePresentation.d-BJzFicRQ.d.cts} +2 -2
- package/dist/{usePresentation.d-Buxz2Jkt.d.ts → usePresentation.d-DgSGIWS-.d.ts} +2 -2
- package/dist/{useRecordsDepth.d-l6D0ZS4l.d.cts → useRecordsDepth.d-C9W45gwS.d.cts} +1 -1
- package/dist/{useRecordsDepth.d-DG2GiAyt.d.ts → useRecordsDepth.d-ZX2rhcUx.d.ts} +1 -1
- package/dist/{useUnread.d-B6Ehu0ao.d.ts → useUnread.d-CedFK4k6.d.ts} +4 -4
- package/dist/{useUnread.d-7-cuCooM.d.cts → useUnread.d-DST1GMmL.d.cts} +4 -4
- package/dist/{view.d-ufGX_MKK.d.cts → view.d-3lxzyJlL.d.cts} +6 -6
- package/dist/{view.d-iTInze7B.d.ts → view.d-DRiYNQJ8.d.ts} +6 -6
- package/dist/web/consent/index.d.cts +6 -6
- package/dist/web/consent/index.d.ts +6 -6
- package/dist/web/health-plan/index.cjs +1 -1
- package/dist/web/health-plan/index.d.cts +16 -16
- package/dist/web/health-plan/index.d.ts +16 -16
- package/dist/web/health-plan/index.js +1 -1
- package/dist/web/inbox/index.d.cts +9 -8
- package/dist/web/inbox/index.d.ts +9 -8
- package/dist/web/index.cjs +191 -190
- package/dist/web/index.d.cts +28 -28
- package/dist/web/index.d.ts +28 -28
- package/dist/web/index.js +191 -190
- package/dist/web/intro/index.d.cts +8 -8
- package/dist/web/intro/index.d.ts +8 -8
- package/dist/web/notifications/index.d.cts +7 -7
- package/dist/web/notifications/index.d.ts +7 -7
- package/dist/web/records/depth/index.d.cts +10 -10
- package/dist/web/records/depth/index.d.ts +10 -10
- package/dist/web/records/index.d.cts +13 -13
- package/dist/web/records/index.d.ts +13 -13
- package/dist/web/records-sheet/index.cjs +1 -1
- package/dist/web/records-sheet/index.js +1 -1
- package/dist/web/shop/index.cjs +1 -1
- package/dist/web/shop/index.d.cts +3 -3
- package/dist/web/shop/index.d.ts +3 -3
- package/dist/web/shop/index.js +1 -1
- package/dist/web/televet/booking/index.cjs +12 -13
- package/dist/web/televet/booking/index.d.cts +9 -9
- package/dist/web/televet/booking/index.d.ts +9 -9
- package/dist/web/televet/booking/index.js +12 -13
- package/dist/web/televet/call/index.cjs +1 -1
- package/dist/web/televet/call/index.d.cts +2 -2
- package/dist/web/televet/call/index.d.ts +2 -2
- package/dist/web/televet/call/index.js +1 -1
- package/dist/web/texting/index.d.cts +6 -6
- package/dist/web/texting/index.d.ts +6 -6
- package/dist/web/ui/index.cjs +1 -1
- package/dist/web/ui/index.js +13 -13
- package/package.json +1 -32
- package/dist/ErrorPolicyPort.d-68yrE3BE.d.ts +0 -23
- package/dist/ErrorPolicyPort.d-DirW9hgO.d.cts +0 -23
|
@@ -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
|
"use strict";var e=require("react"),t=require("react-native"),n=require("zod"),r=require("react/jsx-runtime"),l=require("@everfur/sdk/televet/call"),i=require("react-native-safe-area-context");function o(e){if(e&&e.__esModule)return e;var t=Object.create(null);if(e){Object.keys(e).forEach(function(n){if(n!=="default"){var r=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,r.get?r:{enumerable:true,get:function(){return e[n]}})}})}t.default=e;return Object.freeze(t)}var a=/*#__PURE__*/o(l);function assertNever(e){throw new Error(`assertNever: unhandled discriminated-union member ${JSON.stringify(e)}`)}function errorFrame(e){/* @__PURE__ */
|
|
3
|
-
return Object.freeze({kind:"error",terminal:true,code:e.code,retryable:e.retryable,wireMessage:e.wireMessage,synthesized:e.synthesized,lastEventId:e.lastEventId,serverRequestId:null,...e.freeCap?{freeCap:/* @__PURE__ */Object.freeze({...e.freeCap})}:{}})}var s=["scheduled","in_progress","awaiting_summary","completed","cancelled_owner","cancelled_ops","no_show_owner","no_show_vet"],c=/* @__PURE__ */new Set(["completed","cancelled_owner","cancelled_ops","no_show_owner","no_show_vet"]),d=/* @__PURE__ */new Set(["scheduled","in_progress","awaiting_summary"]);function u(e){return d.has(e.status)}var p=["wellness","prescription"],h=60;function f(e){let t=Date.parse(e.startsAt),n=Date.parse(e.endsAt);if(Number.isNaN(t)||Number.isNaN(n))return null;let r=Math.round((n-t)/6e4);return r>0?Math.min(r,h):null}var m=64,g=2e3,y=10;function isWellFormedStateCode(e){return typeof e=="string"&&/^[A-Za-z]{2}$/.test(e.trim())}function b(e){return typeof e=="object"&&e!==null?e:null}function v(e){return typeof e=="string"&&e.length>0?e:null}function x(e){return typeof e=="string"&&e.trim().length>0?e.trim():null}function T(e,t){return typeof e=="boolean"?e:t}function
|
|
4
|
-
return Object.freeze(n)}function j(e,t){let n=b(e);return n===null?null:/* @__PURE__ */Object.freeze({state:v(n.state)??t,wellnessAvailable:T(n.wellness_available,false),prescriptionsAvailable:T(n.prescriptions_available,false),cancellationPolicyText:x(n.cancellation_policy_text)})}function C(e){let t=b(e);if(t===null)return null;let n=x(t.summary),r=x(t.version);return n===null||r===null?null:/* @__PURE__ */Object.freeze({summary:n,version:r})}function _(e){let t=b(e);if(t===null)return null;let n=v(t.clinician_id),r=v(t.display_name);return n===null||r===null?null:/* @__PURE__ */Object.freeze({clinicianId:n,displayName:r,credentials:x(t.credentials_text),rating:
|
|
5
|
-
return Object.freeze({active:T(t?.active,false)})}var F=240;function L(e){let t=b(e);if(t===null)return null;let n=w(t.fee_cents);return n===null||n<0?null:/* @__PURE__ */Object.freeze({feeCents:n,currency:v(t.currency)??"usd",feeRecorded:T(t.fee_recorded,n>0),summary:x(t.summary)})}var A=15,O=250,V=/* @__PURE__ */new Set(["scheduled","in_progress"]);function N(e){let t=Date.parse(e.scheduledAt);return Number.isNaN(t)?null:t}function televetJoinOpensAtMs(e){let t=N(e);return t===null?null:t-A*6e4}function televetJoinReadiness(e,t){if(e===null)return{ready:false,reason:"not_open_yet"};if(c.has(e.status))return{ready:false,reason:"consult_over"};if(e.status==="in_progress")return{ready:true};let n=N(e);return n===null?{ready:false,reason:"not_open_yet"}:t<n-A*6e4?{ready:false,reason:"not_open_yet"}:t>n+O*6e4?{ready:false,reason:"consult_over"}:{ready:true}}function televetJoinDecision(e,t){if(!V.has(e.status))return{joinable:false,reason:`status_${e.status}`};if(!e.hasRoom)return{joinable:false,reason:"room_not_ready"};let n=N(e);return n===null||t<n-A*6e4?{joinable:false,reason:"too_early"}:t>n+O*6e4?{joinable:false,reason:"too_late"}:{joinable:true}}function splitTelevetVisits(e,t){let n=[],r=[];for(let l of e){let e=N(l);(V.has(l.status)&&e!==null&&e+O*6e4>t?n:r).push(l)}return n.sort((e,t)=>(N(e)??0)-(N(t)??0)),r.sort((e,t)=>(N(t)??0)-(N(e)??0)),/* @__PURE__ */Object.freeze({upcoming:/* @__PURE__ */Object.freeze(n),past:/* @__PURE__ */Object.freeze(r)})}function canManageTelevetVisit(e){return e==="scheduled"}function B(e){let t=globalThis.console;try{t?.error?.("[everfur] A host callback threw; the SDK ignored it.",e)}catch{}}function M(e){return(typeof e=="object"||typeof e=="function")&&e!==null&&typeof e.then=="function"}function H(e,...t){if(typeof e=="function")try{let n=e(...t);return M(n)&&Promise.resolve(n).then(void 0,B),n}catch(e){B(e);return}}var $=/* @__PURE__ */new WeakMap;function W(e){if(typeof e!="function")return;let t=$.get(e);if(t!==void 0)return t;let n=(...t)=>{H(e,...t)};return $.set(e,n),n}function q(e,t){let n=null;for(let r of t){let t=e[r];typeof t=="function"&&(n??={...e},n[r]=W(t))}return n??e}function U(e,...t){let n;try{n=e(...t)}catch(e){return B(e),Promise.resolve({ok:false,error:e})}return Promise.resolve(n).then(e=>({ok:true,value:e}),e=>({ok:false,error:e}))}function K(){let e=[];return{register(t){return e=[...e,t],()=>{e=e.filter(e=>e!==t)}},dispatch(){for(let t of[...e].reverse())try{if(t())return!0}catch{}return false}}}var Y=e.createContext(null);function G(t,n=true){let r=e.useContext(Y),l=e.useRef(t);l.current=t,e.useEffect(()=>{if(!(r===null||!n))return r.register(()=>l.current())},[r,n])}var J="Go to the nearest emergency vet now.";var DRAFT=e=>e,Q=["[PLACEHOLDER","[PLAN NAME]","[LINK]","[Last]","TODO","TBD"];function X(e){return Q.some(t=>e.toUpperCase().includes(t.toUpperCase()))}function Z(e,t){let n=e;for(let[e,r]of Object.entries(t))n=n.split(`{${e}}`).join(r);return n}var ee=/* @__PURE__ */Object.freeze({stateBlockedTitle:DRAFT("Not available in this state yet"),noCliniciansTitle:DRAFT("No vets available right now"),noCliniciansBody:DRAFT("Nobody is free in your area at the moment. This changes through the day."),noCliniciansRetryCta:DRAFT("Check again"),noCliniciansRegionBody:DRAFT("Video visits have to be with a vet licensed in your state, and we don’t have one there yet."),yourVetTitle:DRAFT("Your vet"),licensedPillTemplate:DRAFT("Licensed in {state}"),reviewsLabel:DRAFT("reviews"),vetTechRoleLabel:DRAFT("Vet tech"),vetTechNoRxLine:DRAFT("Vet techs can’t prescribe medication."),rescheduleFromTemplate:DRAFT("Moving your visit on {when}"),rescheduleFailed:DRAFT("That did not move. Your original time is unchanged."),rescheduleStepLabel:DRAFT("Reschedule"),rescheduleTitleTemplate:DRAFT("Pick a new time for {pet}"),rescheduleNowLabel:DRAFT("Now"),rescheduleMoveTemplate:DRAFT("Move to {when}"),rescheduleMoving:DRAFT("Moving…"),rescheduleKeepLabel:DRAFT("Keep the visit as it is"),keepExistingCta:DRAFT("Keep my current time"),bookingPausedTitle:DRAFT("Booking is not available right now."),slotsErrorTitle:DRAFT("Could not load times"),noSlotsTitle:DRAFT("No times available"),nextOpeningTemplate:DRAFT("Next opening across our vets: {when}"),seeOtherVetsCta:DRAFT("See other vets"),retryCta:DRAFT("Try again"),holdExpired:DRAFT("That time is no longer held. Pick another."),slotTaken:DRAFT("That time was just taken. Pick another."),reasonPlaceholder:DRAFT("What is going on with your pet?"),reasonTooLong:DRAFT("That is too long. Please shorten it."),shareRecordsOff:DRAFT("Share health records with this vet"),confirmNotEntitled:DRAFT("A Pro membership is needed to book a video visit."),confirmFailed:DRAFT("That did not book. Try again."),checkAvailabilityCta:DRAFT("Check availability"),stateInterest:/* @__PURE__ */Object.freeze({cta:DRAFT("Add me to the list"),submitting:DRAFT("Adding you to the list…"),joinedTitle:DRAFT("You are on the list"),joinedBody:DRAFT("We will let you know when this changes."),failed:DRAFT("That did not save. Try again.")}),media:/* @__PURE__ */Object.freeze({droppedTemplate:DRAFT("{n} attachment did not upload."),droppedPluralTemplate:DRAFT("{n} attachments did not upload."),refusedSizeTemplate:DRAFT("{n} attachment was too large to send."),refusedSizePluralTemplate:DRAFT("{n} attachments were too large to send."),refusedTypeTemplate:DRAFT("{n} attachment is a file type that cannot be sent."),refusedTypePluralTemplate:DRAFT("{n} attachments are file types that cannot be sent."),refusedUnreadableTemplate:DRAFT("{n} attachment could not be read."),refusedUnreadablePluralTemplate:DRAFT("{n} attachments could not be read.")}),navTitle:DRAFT("Book a visit"),petFallback:"your pet",whereTitleTemplate:DRAFT("Where will {pet} be during the visit?"),whereLeadTemplate:DRAFT("Pick where {pronoun} be for the call, not where you live. It decides what the vet can do."),wherePronounFallback:"they’ll",whereFormLabelTemplate:DRAFT("Where {pet} will be"),whereLegend:DRAFT("State"),wherePrescribeMetaTemplate:DRAFT("Video visit, and prescriptions if {pet} needs them"),whereWellnessMeta:DRAFT("Wellness visit: advice and a care plan, no prescriptions yet"),whereAnotherState:DRAFT("Another state"),whereWhichState:DRAFT("Which state?"),whereLicensedTemplate:DRAFT("{vet} is licensed in {state}, so a prescription can be part of {pet}’s plan."),whereAskEveryTime:DRAFT("We ask every time: state rules require it."),issuesTitleTemplate:DRAFT("What’s going on with {pet}?"),issuesHint:DRAFT("Pick as many as you like."),issuesFormLabel:DRAFT("What’s going on"),issuesLegend:DRAFT("Main issues"),issuesPickOne:DRAFT("Pick at least one. Not sure? Choose Something else."),otherIssue:DRAFT("Something else"),describeHeadingTemplate:DRAFT("Tell {vet} what you’re seeing"),describeFieldLabel:DRAFT("What you’re seeing"),emergencyCheck:/* @__PURE__ */Object.freeze({titleTemplate:DRAFT("Is {pet} doing any of these right now?"),lead:DRAFT("A scheduled video visit isn’t the right place for an emergency."),signs:/* @__PURE__ */Object.freeze([DRAFT("Trouble breathing, or blue, grey or very pale gums"),DRAFT("Collapsed, or can’t stand up"),DRAFT("A seizure"),DRAFT("Ate something toxic, like grapes, chocolate, xylitol or medicine"),DRAFT("A swollen, hard belly, or retching with nothing coming up"),DRAFT("Bleeding that won’t stop"),DRAFT("Straining to pee with nothing coming out")]),formLabel:DRAFT("Emergency check"),legend:DRAFT("Any of these now?"),noneCta:DRAFT("No, none of these"),someCta:DRAFT("Yes, at least one")}),timeHeading:DRAFT("Pick a time"),timeMorning:DRAFT("Morning"),timeAfternoon:DRAFT("Afternoon"),timeEvening:DRAFT("Evening"),timeLegendTemplate:DRAFT("Time on {day}"),dayLegend:DRAFT("Day"),reviewHeading:DRAFT("Does this look right?"),summaryWhere:DRAFT("Where"),changeCta:DRAFT("Change"),whereAttestTemplate:DRAFT("{pet} and I will be in {state} during the visit."),attestBoth:DRAFT("Check both boxes to book the visit."),bookedStepLabel:DRAFT("Booked"),bookedTitleTemplate:DRAFT("You’re booked with {vet}"),bookedLeadTemplate:DRAFT("{when}, for {pet}."),footnote:DRAFT("Video visits are with a licensed veterinarian. Prescriptions where allowed, starting with California. In an emergency, go to the nearest emergency animal hospital."),rescheduleNavTitle:DRAFT("Change your visit"),close:DRAFT("Close"),continueCta:DRAFT("Continue"),petSelectTitle:DRAFT("Who is this visit for?"),addPetCta:DRAFT("Add a pet"),addAnotherPetCta:DRAFT("Add another pet"),locationUnknownTitle:DRAFT("We need your location to find a vet"),locationUnknownBody:DRAFT("Turn on location for Everfur, then try again."),locationUnknownCta:DRAFT("Allow location"),locationBlockedTitle:DRAFT("Location is turned off"),locationBlockedBody:DRAFT("Everfur needs your location to match you with a vet in your area."),locationBlockedCta:DRAFT("Open Settings"),locationUnavailableTitle:DRAFT("We could not read your location"),locationUnavailableBody:DRAFT("Try again in a moment."),stateAttestTemplate:DRAFT("I confirm my pet and I are in {state} right now."),describeHeading:DRAFT("Tell the vet what you are seeing"),describeHelpLong:DRAFT("When it started, what’s changed, what you’ve tried. Anything helps."),addPhotoCta:DRAFT("Add photos or videos"),addPhotoMeta:DRAFT("Optional. A close-up in good light helps."),removePhotoLabel:DRAFT("Remove photo"),summaryPet:DRAFT("Pet"),summaryVet:DRAFT("Vet"),summaryWhen:DRAFT("When"),summaryLength:DRAFT("Length"),summaryReason:DRAFT("About"),summaryLengthTemplate:DRAFT("{n} minutes"),confirmCta:DRAFT("Book the visit"),confirmBusy:DRAFT("Booking…"),bookedTitle:DRAFT("You are booked."),addToCalendarCta:DRAFT("Add to calendar"),doneCta:DRAFT("Done"),booked:/* @__PURE__ */Object.freeze({remindPromise:DRAFT("We will notify you 30 minutes before."),summaryPromise:DRAFT("{pet}'s summary goes to the vet ahead of the call."),recordsPromiseTemplate:DRAFT("{pet}’s records and your notes go to {vet} ahead of the call."),recordsPhotoPromiseTemplate:DRAFT("{pet}’s records, your notes and the photo go to {vet} ahead of the call."),stepsLabel:DRAFT("What happens next"),joinPromise:DRAFT("Join right here in the app. No links to hunt for."),backToPet:DRAFT("Back to {pet}"),calendarAdded:DRAFT("Added to your calendar"),calendarFailedBody:DRAFT("That did not save to your calendar.")}),chrome:/* @__PURE__ */Object.freeze({closeHint:DRAFT("Closes without saving"),discardTitle:DRAFT("Leave without booking?"),discardBody:DRAFT("Your answers will not be saved."),discardConfirmCta:DRAFT("Leave"),discardKeepCta:DRAFT("Keep going"),noPetsTitle:DRAFT("No pets on this account"),loadFailedTitle:DRAFT("Could not load"),retryCta:DRAFT("Try again")}),emergency:/* @__PURE__ */Object.freeze({bannerTitle:DRAFT("This can’t wait for a scheduled visit."),keepBookingCta:DRAFT("I’ve handled this, continue booking"),lede:DRAFT("What you’re describing is the kind of thing vets want to see in person, now. Call one of these first."),ledeWithoutExits:DRAFT("What you’re describing is the kind of thing vets want to see in person, now."),exitPrimaryVetTitle:DRAFT("Call {petName}’s regular vet"),exitFindErTitle:DRAFT("Find an emergency vet near you"),exitGoToErTitle:J,startCallHint:DRAFT("Starts a phone call"),poisonControl:DRAFT("ASPCA Animal Poison Control"),poisonControlDetail:DRAFT("(888) 426-4435 · a fee may apply"),poisonControlTel:"tel:+18884264435"}),visit:/* @__PURE__ */Object.freeze({title:DRAFT("Your visit")}),loading:/* @__PURE__ */Object.freeze({pets:"Loading pets. Nothing to read yet.",clinicians:"Loading vets. Nothing to read yet.",slots:"Loading times. Nothing to read yet.",consult:"Loading your visit. Nothing to read yet.",progressTemplate:"Step {step} of {total}"})});function te(e=ee){return typeof e=="string"?[e]:typeof e!="object"||e===null?[]:Object.values(e).flatMap(e=>te(e))}function isTelevetBookingCopyReady(){return te().every(e=>e.trim().length>0&&!X(e))}var ne=[{wireCode:"AccessDeniedException",envelope:"http_envelope",httpStatus:403,retryable:false},{wireCode:"AuthorizationException",envelope:"http_envelope",httpStatus:401,retryable:false},{wireCode:"ConflictException",envelope:"http_envelope",httpStatus:409,retryable:true},{wireCode:"DAILY_QUOTA_EXCEEDED",envelope:"http_envelope",httpStatus:429,retryable:true},{wireCode:"FILE_TOO_LARGE",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"IDEMPOTENCY_KEY_IN_FLIGHT",envelope:"http_envelope",httpStatus:409,retryable:true},{wireCode:"IDEMPOTENCY_KEY_REUSED_DIFFERENT_REQUEST",envelope:"http_envelope",httpStatus:409,retryable:false},{wireCode:"INVALID_CONTENT_TYPE",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"InternalFailureException",envelope:"http_envelope",httpStatus:500,retryable:true},{wireCode:"MethodNotAllowedException",envelope:"http_envelope",httpStatus:405,retryable:false},{wireCode:"NotImplementedException",envelope:"http_envelope",httpStatus:501,retryable:false},{wireCode:"PaymentRequiredException",envelope:"http_envelope",httpStatus:402,retryable:false},{wireCode:"ResourceNotFoundException",envelope:"http_envelope",httpStatus:404,retryable:false},{wireCode:"ServiceUnavailableException",envelope:"http_envelope",httpStatus:503,retryable:true},{wireCode:"TIER_UPGRADE_REQUIRED",envelope:"http_envelope",httpStatus:402,retryable:false},{wireCode:"ThrottlingException",envelope:"http_envelope",httpStatus:429,retryable:true},{wireCode:"ValidationException",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"accessDenied",envelope:"http_envelope",httpStatus:403,retryable:false},{wireCode:"access_denied",envelope:"oauth_error",httpStatus:302,retryable:false},{wireCode:"anchor_not_found",envelope:"http_envelope",httpStatus:404,retryable:false},{wireCode:"anchor_ref_invalid",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"anonTokenInvalid",envelope:"http_envelope",httpStatus:401,retryable:false},{wireCode:"attachment_unreadable",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"authExpired",envelope:"http_envelope",httpStatus:401,retryable:true},{wireCode:"authRejected",envelope:"http_envelope",httpStatus:401,retryable:false},{wireCode:"before_invalid",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"bundle_mismatch",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"bundle_not_uploaded",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"bundles_unavailable",envelope:"http_envelope",httpStatus:503,retryable:true},{wireCode:"catalog_empty_refused",envelope:"http_envelope",httpStatus:409,retryable:false},{wireCode:"catalog_shrink_refused",envelope:"http_envelope",httpStatus:409,retryable:false},{wireCode:"consent_invalid",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"consent_required",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"consent_scope_wrong_route",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"device_cipher_unavailable",envelope:"http_envelope",httpStatus:503,retryable:true},{wireCode:"email_invalid",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"endpoint_not_allowed",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"environment_mismatch",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"event_cursor_invalid",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"event_filter_invalid",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"event_id_invalid",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"event_payload_invalid",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"event_type_not_available",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"event_type_unknown",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"idempotency_key_invalid",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"idempotency_key_required",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"idempotency_key_reused",envelope:"http_envelope",httpStatus:409,retryable:false},{wireCode:"inbox_cursor_invalid",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"insufficientCapability",envelope:"http_envelope",httpStatus:403,retryable:false},{wireCode:"insufficient_scope",envelope:"http_envelope",httpStatus:403,retryable:false},{wireCode:"internal_error",envelope:"sse_frame",httpStatus:200,retryable:false},{wireCode:"invalidRequest",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"invalid_client",envelope:"oauth_error",httpStatus:401,retryable:false},{wireCode:"invalid_client_metadata",envelope:"oauth_error",httpStatus:400,retryable:false},{wireCode:"invalid_grant",envelope:"oauth_error",httpStatus:400,retryable:false},{wireCode:"invalid_redirect_uri",envelope:"oauth_error",httpStatus:400,retryable:false},{wireCode:"invalid_request",envelope:"oauth_error",httpStatus:400,retryable:false},{wireCode:"invalid_scope",envelope:"oauth_error",httpStatus:400,retryable:false},{wireCode:"invalid_target",envelope:"oauth_error",httpStatus:400,retryable:false},{wireCode:"item_id_invalid",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"linked_account_read_only",envelope:"http_envelope",httpStatus:409,retryable:false},{wireCode:"mcp_connection_not_found",envelope:"http_envelope",httpStatus:404,retryable:false},{wireCode:"mcp_request_conflict",envelope:"http_envelope",httpStatus:409,retryable:false},{wireCode:"mcp_request_gone",envelope:"http_envelope",httpStatus:410,retryable:false},{wireCode:"mcp_request_not_found",envelope:"http_envelope",httpStatus:404,retryable:false},{wireCode:"not_found",envelope:"sse_frame",httpStatus:200,retryable:false},{wireCode:"not_found",envelope:"http_envelope",httpStatus:404,retryable:false},{wireCode:"open_url_not_allowed",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"partner_visit_link_conflict",envelope:"http_envelope",httpStatus:409,retryable:false},{wireCode:"partner_visit_owner_only",envelope:"http_envelope",httpStatus:403,retryable:false},{wireCode:"partner_visit_pet_already_mapped",envelope:"http_envelope",httpStatus:409,retryable:false},{wireCode:"payload_too_large",envelope:"http_envelope",httpStatus:413,retryable:false},{wireCode:"petRefInUse",envelope:"http_envelope",httpStatus:409,retryable:false},{wireCode:"pet_health_list_removals_unconfirmed",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"pet_health_species_unsupported",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"pet_not_registered",envelope:"http_envelope",httpStatus:404,retryable:false},{wireCode:"provider_unsupported",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"rateLimited",envelope:"http_envelope",httpStatus:429,retryable:true},{wireCode:"read_target_invalid",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"record_species_unsupported",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"record_subject_not_found",envelope:"http_envelope",httpStatus:404,retryable:false},{wireCode:"record_upload_invalid",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"records_consent_required",envelope:"http_envelope",httpStatus:409,retryable:false},{wireCode:"restricted_key",envelope:"http_envelope",httpStatus:403,retryable:false},{wireCode:"sandbox_only",envelope:"http_envelope",httpStatus:403,retryable:false},{wireCode:"session_required",envelope:"http_envelope",httpStatus:403,retryable:false},{wireCode:"session_revoked",envelope:"http_envelope",httpStatus:401,retryable:false},{wireCode:"share_limit_reached",envelope:"http_envelope",httpStatus:429,retryable:false},{wireCode:"slow_down",envelope:"oauth_error",httpStatus:429,retryable:true},{wireCode:"species_unsupported",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"subscription_keys_invalid",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"tenant_filter_invalid",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"tenant_has_no_capabilities",envelope:"http_envelope",httpStatus:409,retryable:false},{wireCode:"tenant_resource_not_found",envelope:"http_envelope",httpStatus:404,retryable:false},{wireCode:"tenant_surface_not_enabled",envelope:"http_envelope",httpStatus:409,retryable:false},{wireCode:"ticket_not_resolved",envelope:"http_envelope",httpStatus:409,retryable:false},{wireCode:"tickets_disabled",envelope:"http_envelope",httpStatus:404,retryable:false},{wireCode:"timeout",envelope:"sse_frame",httpStatus:200,retryable:true},{wireCode:"timezone_invalid",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"token_invalid",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"unavailable",envelope:"sse_frame",httpStatus:200,retryable:true},{wireCode:"unavailable",envelope:"http_envelope",httpStatus:503,retryable:true},{wireCode:"unrestrictedKeyRequired",envelope:"http_envelope",httpStatus:403,retryable:false},{wireCode:"unsupported_grant_type",envelope:"oauth_error",httpStatus:400,retryable:false},{wireCode:"unsupported_response_type",envelope:"oauth_error",httpStatus:302,retryable:false},{wireCode:"user_ref_invalid",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"verify_mint_rate_limited",envelope:"http_envelope",httpStatus:429,retryable:true},{wireCode:"verify_mint_refused",envelope:"http_envelope",httpStatus:403,retryable:false},{wireCode:"verify_mint_unavailable",envelope:"http_envelope",httpStatus:503,retryable:true},{wireCode:"verify_user_ref_invalid",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"web_push_unavailable",envelope:"http_envelope",httpStatus:503,retryable:true},{wireCode:"webhook_endpoint_update_empty",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"webhook_endpoint_update_invalid",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"webhook_url_rejected",envelope:"http_envelope",httpStatus:400,retryable:false}],re=/* @__PURE__ */Object.freeze(ne.map(e=>/* @__PURE__ */Object.freeze(e)));/* @__PURE__ */Object.freeze(re.map(e=>e.wireCode));var le=/* @__PURE__ */Object.freeze({ValidationException:"validationFailed",AuthorizationException:"authRejected",PaymentRequiredException:"paymentRequired",AccessDeniedException:"accessDenied",ResourceNotFoundException:"resourceNotFound",ConflictException:"conflict",ThrottlingException:"rateLimited",InternalFailureException:"internalError",NotImplementedException:"notImplemented",ServiceUnavailableException:"serviceUnavailable",MethodNotAllowedException:"validationFailed",authExpired:"authExpired",unavailable:"serviceUnavailable",session_required:"sessionRequired",session_revoked:"authExpired",anonTokenInvalid:"authRejected",accessDenied:"accessDenied",invalidRequest:"sdkUpdateRequired",authRejected:"authRejected",rateLimited:"rateLimited",insufficientCapability:"accessDenied",unrestrictedKeyRequired:"accessDenied",user_ref_invalid:"validationFailed",event_cursor_invalid:"validationFailed",event_filter_invalid:"validationFailed",event_payload_invalid:"validationFailed",event_type_unknown:"validationFailed",idempotency_key_invalid:"validationFailed",idempotency_key_required:"validationFailed",idempotency_key_reused:"idempotencyConflict",payload_too_large:"validationFailed",webhook_url_rejected:"validationFailed",webhook_endpoint_update_empty:"validationFailed",webhook_endpoint_update_invalid:"validationFailed",event_type_not_available:"conflict",record_subject_not_found:"resourceNotFound",records_consent_required:"conflict",record_species_unsupported:"validationFailed",record_upload_invalid:"validationFailed",FILE_TOO_LARGE:"validationFailed",INVALID_CONTENT_TYPE:"validationFailed",attachment_unreadable:"validationFailed",provider_unsupported:"validationFailed",token_invalid:"validationFailed",device_cipher_unavailable:"serviceUnavailable",email_invalid:"validationFailed",consent_required:"validationFailed",consent_invalid:"validationFailed",consent_scope_wrong_route:"validationFailed",IDEMPOTENCY_KEY_IN_FLIGHT:"idempotencyInFlight",IDEMPOTENCY_KEY_REUSED_DIFFERENT_REQUEST:"idempotencyConflict",DAILY_QUOTA_EXCEEDED:"quotaExceeded",TIER_UPGRADE_REQUIRED:"paymentRequired",not_found:"conversationNotFound",timeout:"streamTimeout",internal_error:"internalError",invalid_request:"validationFailed",invalid_client:"authRejected",invalid_grant:"authRejected",unsupported_grant_type:"validationFailed",invalid_scope:"validationFailed",invalid_target:"validationFailed",invalid_redirect_uri:"validationFailed",invalid_client_metadata:"validationFailed",unsupported_response_type:"validationFailed",access_denied:"accessDenied",slow_down:"rateLimited",mcp_request_not_found:"resourceNotFound",mcp_request_gone:"resourceNotFound",mcp_connection_not_found:"resourceNotFound",mcp_request_conflict:"conflict",sandbox_only:"accessDenied",tenant_has_no_capabilities:"conflict",verify_mint_refused:"accessDenied",verify_mint_rate_limited:"rateLimited",verify_mint_unavailable:"serviceUnavailable",verify_user_ref_invalid:"validationFailed",insufficient_scope:"accessDenied",tenant_filter_invalid:"validationFailed",tenant_resource_not_found:"resourceNotFound",tenant_surface_not_enabled:"conflict",pet_health_species_unsupported:"validationFailed",pet_health_list_removals_unconfirmed:"validationFailed",petRefInUse:"conflict",share_limit_reached:"conflict",pet_not_registered:"resourceNotFound",species_unsupported:"validationFailed",partner_visit_owner_only:"accessDenied",partner_visit_link_conflict:"conflict",partner_visit_pet_already_mapped:"conflict",linked_account_read_only:"conflict",catalog_empty_refused:"conflict",catalog_shrink_refused:"conflict",endpoint_not_allowed:"validationFailed",event_id_invalid:"validationFailed",inbox_cursor_invalid:"validationFailed",item_id_invalid:"validationFailed",open_url_not_allowed:"validationFailed",read_target_invalid:"validationFailed",subscription_keys_invalid:"validationFailed",web_push_unavailable:"serviceUnavailable",anchor_not_found:"resourceNotFound",anchor_ref_invalid:"validationFailed",before_invalid:"validationFailed",bundle_mismatch:"validationFailed",bundle_not_uploaded:"validationFailed",bundles_unavailable:"serviceUnavailable",environment_mismatch:"validationFailed",restricted_key:"accessDenied",ticket_not_resolved:"conflict",tickets_disabled:"resourceNotFound",timezone_invalid:"validationFailed"}),ie=/* @__PURE__ */Object.freeze(re.map(e=>/* @__PURE__ */Object.freeze({wireCode:e.wireCode,envelope:e.envelope,retryable:e.retryable,normalized:le[e.wireCode]}))),oe=new Map(ie.map(e=>[e.envelope+e.wireCode.toUpperCase(),e])),ae=/* @__PURE__ */Object.freeze(["http_envelope",...[...new Set(ie.map(e=>e.envelope))].filter(e=>e!=="http_envelope").sort()]);function contractErrorFor(e,t){if(typeof e!="string")return;let n=e.trim().toUpperCase();if(n.length!==0)for(let e of[t??"http_envelope",...ae]){let t=oe.get(e+n);if(t)return t}}var se=/* @__PURE__ */Object.freeze({authExpired:"authentication",authRejected:"authentication",sessionRequired:"authentication",identitySignatureRequired:"authentication",accessDenied:"authorization",paymentRequired:"entitlement",quotaExceeded:"rateLimit",rateLimited:"rateLimit",validationFailed:"invalidRequest",sdkUpdateRequired:"invalidRequest",runtimeDisposed:"invalidRequest",conversationNotFound:"notFound",petNotFound:"notFound",resourceNotFound:"notFound",conflict:"conflict",idempotencyConflict:"conflict",idempotencyInFlight:"conflict",streamTimeout:"connection",streamIncomplete:"connection",upstreamLlmTimeout:"connection",serviceUnavailable:"connection",internalError:"server",notImplemented:"server",mediaUploadFailed:"media",moderationBlocked:"policy",unknown:"unknown"});function categoryFor(e){return se[e]}function fromWire(e){let t=contractErrorFor(e);if(t)return t.normalized;let n=(e??"").trim().toUpperCase(),r=n.replace(/[^A-Z0-9]/g,"");if(r==="AUTHREJECTED")return"authRejected";if(n.startsWith("AUTH"))return"authExpired";switch(r){case"DAILYQUOTAEXCEEDED":case"QUOTAEXCEEDED":return"quotaExceeded";case"RATELIMITED":case"TOOMANYREQUESTS":case"TELEVETRATELIMITED":return"rateLimited";case"IDEMPOTENCYKEYCONFLICT":case"IDEMPOTENCYCONFLICT":return"idempotencyConflict";case"ACCESSDENIED":case"FORBIDDEN":return"accessDenied";case"IDENTITYSIGNATUREREQUIRED":return"identitySignatureRequired";case"FREECAPREACHED":return"paymentRequired";case"RUNTIMEDISPOSED":return"runtimeDisposed";case"NOTFOUND":case"CONVERSATIONNOTFOUND":return"conversationNotFound";case"PETNOTFOUND":return"petNotFound";case"TIMEOUT":case"STREAMTIMEOUT":return"streamTimeout";case"MEDIAUPLOADFAILED":case"UNRECOGNIZEDVIDEOFORMAT":case"FILETOOSMALL":return"mediaUploadFailed";case"MODERATIONBLOCKED":return"moderationBlocked";case"UPSTREAMLLMTIMEOUT":return"upstreamLlmTimeout";case"INTERNALERROR":case"INTERNALSERVERERROR":return"internalError";case"STREAMINCOMPLETE":case"CHATSTREAMINCOMPLETE":return"streamIncomplete";case"INVALIDANALYSISTYPE":case"INVALIDUPLOADPURPOSE":return"unknown";default:return"unknown"}}var ce=/* @__PURE__ */new Set(["streamTimeout","rateLimited","internalError","upstreamLlmTimeout","streamIncomplete"]);function isAutoRetryable(e){return ce.has(e)}var de=/* @__PURE__ */new Set(["serviceUnavailable","conflict","idempotencyInFlight"]);function isRetryableCode(e){return isAutoRetryable(e)||de.has(e)}var ue=500,pe=8e3,he=4;function backoffDelayMs(e,t=Math.random){let n=Math.max(0,e),r=Math.min(ue*2**n,pe);return Math.floor(t()*r)}var fe="This feature isn't available on your account right now.",me="Something in that request was not right. Check the details and try again.",ge=/* @__PURE__ */Object.freeze({authExpired:"Please sign in again to continue.",authRejected:"Please sign in again to continue.",sessionRequired:"This app needs to be updated to keep using Everfur.",accessDenied:fe,paymentRequired:"This is part of a paid plan.",quotaExceeded:"You have used today's messages. This resets tomorrow.",rateLimited:"You are sending messages quickly. Try again in a few seconds.",validationFailed:me,sdkUpdateRequired:"This app needs to be updated to keep using Everfur.",conflict:"That is already running. Wait for it to finish, then try again.",idempotencyConflict:"That message was already delivered.",idempotencyInFlight:"That is still processing. Give it a moment.",conversationNotFound:"This conversation is no longer available.",petNotFound:"We could not find that pet. Please pick a pet and try again.",resourceNotFound:"We could not find that.",streamTimeout:"The response timed out. Tap retry to try again.",mediaUploadFailed:"We could not upload that photo. Please attach it again.",moderationBlocked:"This request cannot be answered here.",upstreamLlmTimeout:"The response timed out. Tap retry to try again.",internalError:"We hit a snag on our end. Please try again.",notImplemented:"That is not available yet.",serviceUnavailable:"That service is briefly unavailable. Try again shortly.",streamIncomplete:"The connection dropped mid-answer. Tap retry to continue.",identitySignatureRequired:fe,runtimeDisposed:me,unknown:"Something went wrong. Please try again."}),ye="This session has ended. Please sign in again.",be="linked_account_read_only";function ve(e,t,n){return e==="conflict"&&n===be?fe:(e==="authRejected"||e==="authExpired")&&typeof t=="string"&&t.trim().toLowerCase()==="session_revoked"?ye:userFacingError(e)}function userFacingError(e){return ge[e]}function xe(e,t,n){Object.defineProperty(e,t,{value:n,enumerable:false,writable:false,configurable:false})}var Te=/^[a-z][a-z0-9_]{0,63}$/;function makeEverfurError(e,t){let n=contractErrorFor(t?.wireCode,t?.wireEnvelope),r=e==="conflict"&&t?.reasonCode===be,l={code:e,category:categoryFor(e),retryable:t?.retryable??(r?false:isRetryableCode(e)),displayMessage:ve(e,t?.wireCode,r?be:null)};t?.httpStatus!==void 0&&(l.httpStatus=t.httpStatus),t?.requestId&&(l.requestId=t.requestId),typeof t?.reasonCode=="string"&&Te.test(t.reasonCode)&&(l.reasonCode=t.reasonCode);let i=t?.retryAfterSeconds;if(typeof i=="number"&&Number.isFinite(i)&&i>=0&&(l.retryAfterSeconds=Math.round(i)),n);return t?.wireMessage&&xe(l,"wireMessage",t.wireMessage),t?.raw!==void 0&&t.raw!==null&&xe(l,"raw",t.raw),/* @__PURE__ */Object.freeze(l)}function ok(e,t){/* @__PURE__ */
|
|
3
|
+
return Object.freeze({kind:"error",terminal:true,code:e.code,retryable:e.retryable,wireMessage:e.wireMessage,synthesized:e.synthesized,lastEventId:e.lastEventId,serverRequestId:null,...e.freeCap?{freeCap:/* @__PURE__ */Object.freeze({...e.freeCap})}:{}})}var s=["scheduled","in_progress","awaiting_summary","completed","cancelled_owner","cancelled_ops","no_show_owner","no_show_vet"],c=/* @__PURE__ */new Set(["completed","cancelled_owner","cancelled_ops","no_show_owner","no_show_vet"]),d=/* @__PURE__ */new Set(["scheduled","in_progress","awaiting_summary"]);function u(e){return d.has(e.status)}var p=["wellness","prescription"],h=60;function f(e){let t=Date.parse(e.startsAt),n=Date.parse(e.endsAt);if(Number.isNaN(t)||Number.isNaN(n))return null;let r=Math.round((n-t)/6e4);return r>0?Math.min(r,h):null}var m=64,g=2e3,y=10;function isWellFormedStateCode(e){return typeof e=="string"&&/^[A-Za-z]{2}$/.test(e.trim())}function b(e){return typeof e=="object"&&e!==null?e:null}function v(e){return typeof e=="string"&&e.length>0?e:null}function x(e){return typeof e=="string"&&e.trim().length>0?e.trim():null}function T(e,t){return typeof e=="boolean"?e:t}function k(e){return typeof e=="number"&&Number.isFinite(e)?e:null}function w(e,t){return typeof t=="string"&&e.includes(t)?t:"unknown"}function S(e,t){if(!Array.isArray(e))/* @__PURE__ */return Object.freeze([]);let n=[];for(let r of e){let e=t(r);e!==null&&n.push(e)}/* @__PURE__ */
|
|
4
|
+
return Object.freeze(n)}function j(e,t){let n=b(e);return n===null?null:/* @__PURE__ */Object.freeze({state:v(n.state)??t,wellnessAvailable:T(n.wellness_available,false),prescriptionsAvailable:T(n.prescriptions_available,false),cancellationPolicyText:x(n.cancellation_policy_text)})}function C(e){let t=b(e);if(t===null)return null;let n=x(t.summary),r=x(t.version);return n===null||r===null?null:/* @__PURE__ */Object.freeze({summary:n,version:r})}function _(e){let t=b(e);if(t===null)return null;let n=v(t.clinician_id),r=v(t.display_name);return n===null||r===null?null:/* @__PURE__ */Object.freeze({clinicianId:n,displayName:r,credentials:x(t.credentials_text),rating:k(t.rating),ratingCount:k(t.rating_count),bio:x(t.bio),photoRef:v(t.photo_ref),licensedStates:S(t.licensed_states,e=>{let t=b(e),n=t===null?null:v(t.state);return n===null?null:/* @__PURE__ */Object.freeze({state:n,canPrescribe:T(t?.can_prescribe,false)})}),role:I(t.clinician_role)})}function I(e){let t=v(e)?.trim().toLowerCase();return t==="vet"||t==="vet_tech"?t:null}function E(e){let t=b(e);if(t===null)return null;let n=v(t.slot_id),r=v(t.starts_at);return n===null||r===null?null:/* @__PURE__ */Object.freeze({slotId:n,startsAt:r,endsAt:v(t.ends_at)??r})}function D(e){let t=b(e);if(t===null)return null;let n=t.is_emergency===true,r=t.fallback===true;return n||r?/* @__PURE__ */Object.freeze({isEmergency:n,fallback:r}):t.is_emergency===false&&t.fallback===false?/* @__PURE__ */Object.freeze({isEmergency:false,fallback:false}):null}function P(e){let t=b(e);if(t===null)return null;let n=v(t.slot_id),r=v(t.hold_expires_at);return n===null||r===null?null:/* @__PURE__ */Object.freeze({slotId:n,expiresAt:r})}function R(e){let t=b(e);if(t===null)return null;let n=v(t.consult_id),r=v(t.scheduled_at);return n===null||r===null?null:/* @__PURE__ */Object.freeze({consultId:n,petId:v(t.pet_id)??"",clinicianId:v(t.clinician_id)??"",clinicianName:x(t.display_name),reasonText:x(t.reason_text),mediaRefs:S(t.media_refs,e=>v(e)),status:w(s,t.status),kind:w(p,t.kind),scheduledAt:r,emergencyFlagged:T(t.emergency_flagged,false),hasRoom:v(t.meeting_url)!==null})}function z(e){let t=b(e);/* @__PURE__ */
|
|
5
|
+
return Object.freeze({active:T(t?.active,false)})}var F=240;function L(e){let t=b(e);if(t===null)return null;let n=k(t.fee_cents);return n===null||n<0?null:/* @__PURE__ */Object.freeze({feeCents:n,currency:v(t.currency)??"usd",feeRecorded:T(t.fee_recorded,n>0),summary:x(t.summary)})}var A=15,O=250,V=/* @__PURE__ */new Set(["scheduled","in_progress"]);function N(e){let t=Date.parse(e.scheduledAt);return Number.isNaN(t)?null:t}function televetJoinOpensAtMs(e){let t=N(e);return t===null?null:t-A*6e4}function televetJoinReadiness(e,t){if(e===null)return{ready:false,reason:"not_open_yet"};if(c.has(e.status))return{ready:false,reason:"consult_over"};if(e.status==="in_progress")return{ready:true};let n=N(e);return n===null?{ready:false,reason:"not_open_yet"}:t<n-A*6e4?{ready:false,reason:"not_open_yet"}:t>n+O*6e4?{ready:false,reason:"consult_over"}:{ready:true}}function televetJoinDecision(e,t){if(!V.has(e.status))return{joinable:false,reason:`status_${e.status}`};if(!e.hasRoom)return{joinable:false,reason:"room_not_ready"};let n=N(e);return n===null||t<n-A*6e4?{joinable:false,reason:"too_early"}:t>n+O*6e4?{joinable:false,reason:"too_late"}:{joinable:true}}function splitTelevetVisits(e,t){let n=[],r=[];for(let l of e){let e=N(l);(V.has(l.status)&&e!==null&&e+O*6e4>t?n:r).push(l)}return n.sort((e,t)=>(N(e)??0)-(N(t)??0)),r.sort((e,t)=>(N(t)??0)-(N(e)??0)),/* @__PURE__ */Object.freeze({upcoming:/* @__PURE__ */Object.freeze(n),past:/* @__PURE__ */Object.freeze(r)})}function canManageTelevetVisit(e){return e==="scheduled"}function B(e){let t=globalThis.console;try{t?.error?.("[everfur] A host callback threw; the SDK ignored it.",e)}catch{}}function M(e){return(typeof e=="object"||typeof e=="function")&&e!==null&&typeof e.then=="function"}function H(e,...t){if(typeof e=="function")try{let n=e(...t);return M(n)&&Promise.resolve(n).then(void 0,B),n}catch(e){B(e);return}}var $=/* @__PURE__ */new WeakMap;function W(e){if(typeof e!="function")return;let t=$.get(e);if(t!==void 0)return t;let n=(...t)=>{H(e,...t)};return $.set(e,n),n}function U(e,t){let n=null;for(let r of t){let t=e[r];typeof t=="function"&&(n??={...e},n[r]=W(t))}return n??e}function q(e,...t){let n;try{n=e(...t)}catch(e){return B(e),Promise.resolve({ok:false,error:e})}return Promise.resolve(n).then(e=>({ok:true,value:e}),e=>({ok:false,error:e}))}function K(){let e=[];return{register(t){return e=[...e,t],()=>{e=e.filter(e=>e!==t)}},dispatch(){for(let t of[...e].reverse())try{if(t())return!0}catch{}return false}}}var Y=e.createContext(null);function G(t,n=true){let r=e.useContext(Y),l=e.useRef(t);l.current=t,e.useEffect(()=>{if(!(r===null||!n))return r.register(()=>l.current())},[r,n])}var J="Go to the nearest emergency vet now.";var DRAFT=e=>e,Q=["[PLACEHOLDER","[PLAN NAME]","[LINK]","[Last]","TODO","TBD"];function X(e){return Q.some(t=>e.toUpperCase().includes(t.toUpperCase()))}function Z(e,t){let n=e;for(let[e,r]of Object.entries(t))n=n.split(`{${e}}`).join(r);return n}var ee=/* @__PURE__ */Object.freeze({stateBlockedTitle:DRAFT("Not available in this state yet"),noCliniciansTitle:DRAFT("No vets available right now"),noCliniciansBody:DRAFT("Nobody is free in your area at the moment. This changes through the day."),noCliniciansRetryCta:DRAFT("Check again"),noCliniciansRegionBody:DRAFT("Video visits have to be with a vet licensed in your state, and we don’t have one there yet."),yourVetTitle:DRAFT("Your vet"),licensedPillTemplate:DRAFT("Licensed in {state}"),reviewsLabel:DRAFT("reviews"),vetTechRoleLabel:DRAFT("Vet tech"),vetTechNoRxLine:DRAFT("Vet techs can’t prescribe medication."),rescheduleFromTemplate:DRAFT("Moving your visit on {when}"),rescheduleFailed:DRAFT("That did not move. Your original time is unchanged."),rescheduleStepLabel:DRAFT("Reschedule"),rescheduleTitleTemplate:DRAFT("Pick a new time for {pet}"),rescheduleNowLabel:DRAFT("Now"),rescheduleMoveTemplate:DRAFT("Move to {when}"),rescheduleMoving:DRAFT("Moving…"),rescheduleKeepLabel:DRAFT("Keep the visit as it is"),keepExistingCta:DRAFT("Keep my current time"),bookingPausedTitle:DRAFT("Booking is not available right now."),slotsErrorTitle:DRAFT("Could not load times"),noSlotsTitle:DRAFT("No times available"),nextOpeningTemplate:DRAFT("Next opening across our vets: {when}"),seeOtherVetsCta:DRAFT("See other vets"),retryCta:DRAFT("Try again"),holdExpired:DRAFT("That time is no longer held. Pick another."),slotTaken:DRAFT("That time was just taken. Pick another."),reasonPlaceholder:DRAFT("What is going on with your pet?"),reasonTooLong:DRAFT("That is too long. Please shorten it."),shareRecordsOff:DRAFT("Share health records with this vet"),confirmNotEntitled:DRAFT("A Pro membership is needed to book a video visit."),confirmFailed:DRAFT("That did not book. Try again."),checkAvailabilityCta:DRAFT("Check availability"),stateInterest:/* @__PURE__ */Object.freeze({cta:DRAFT("Add me to the list"),submitting:DRAFT("Adding you to the list…"),joinedTitle:DRAFT("You are on the list"),joinedBody:DRAFT("We will let you know when this changes."),failed:DRAFT("That did not save. Try again.")}),media:/* @__PURE__ */Object.freeze({droppedTemplate:DRAFT("{n} attachment did not upload."),droppedPluralTemplate:DRAFT("{n} attachments did not upload."),refusedSizeTemplate:DRAFT("{n} attachment was too large to send."),refusedSizePluralTemplate:DRAFT("{n} attachments were too large to send."),refusedTypeTemplate:DRAFT("{n} attachment is a file type that cannot be sent."),refusedTypePluralTemplate:DRAFT("{n} attachments are file types that cannot be sent."),refusedUnreadableTemplate:DRAFT("{n} attachment could not be read."),refusedUnreadablePluralTemplate:DRAFT("{n} attachments could not be read.")}),navTitle:DRAFT("Book a visit"),petFallback:"your pet",whereTitleTemplate:DRAFT("Where will {pet} be during the visit?"),whereLeadTemplate:DRAFT("Pick where {pronoun} be for the call, not where you live. It decides what the vet can do."),wherePronounFallback:"they’ll",whereFormLabelTemplate:DRAFT("Where {pet} will be"),whereLegend:DRAFT("State"),wherePrescribeMetaTemplate:DRAFT("Video visit, and prescriptions if {pet} needs them"),whereWellnessMeta:DRAFT("Wellness visit: advice and a care plan, no prescriptions yet"),whereAnotherState:DRAFT("Another state"),whereWhichState:DRAFT("Which state?"),whereLicensedTemplate:DRAFT("{vet} is licensed in {state}, so a prescription can be part of {pet}’s plan."),whereAskEveryTime:DRAFT("We ask every time: state rules require it."),issuesTitleTemplate:DRAFT("What’s going on with {pet}?"),issuesHint:DRAFT("Pick as many as you like."),issuesFormLabel:DRAFT("What’s going on"),issuesLegend:DRAFT("Main issues"),issuesPickOne:DRAFT("Pick at least one. Not sure? Choose Something else."),otherIssue:DRAFT("Something else"),describeHeadingTemplate:DRAFT("Tell {vet} what you’re seeing"),describeFieldLabel:DRAFT("What you’re seeing"),emergencyCheck:/* @__PURE__ */Object.freeze({titleTemplate:DRAFT("Is {pet} doing any of these right now?"),lead:DRAFT("A scheduled video visit isn’t the right place for an emergency."),signs:/* @__PURE__ */Object.freeze([DRAFT("Trouble breathing, or blue, grey or very pale gums"),DRAFT("Collapsed, or can’t stand up"),DRAFT("A seizure"),DRAFT("Ate something toxic, like grapes, chocolate, xylitol or medicine"),DRAFT("A swollen, hard belly, or retching with nothing coming up"),DRAFT("Bleeding that won’t stop"),DRAFT("Straining to pee with nothing coming out")]),formLabel:DRAFT("Emergency check"),legend:DRAFT("Any of these now?"),noneCta:DRAFT("No, none of these"),someCta:DRAFT("Yes, at least one")}),timeHeading:DRAFT("Pick a time"),timeMorning:DRAFT("Morning"),timeAfternoon:DRAFT("Afternoon"),timeEvening:DRAFT("Evening"),timeLegendTemplate:DRAFT("Time on {day}"),dayLegend:DRAFT("Day"),reviewHeading:DRAFT("Does this look right?"),summaryWhere:DRAFT("Where"),changeCta:DRAFT("Change"),whereAttestTemplate:DRAFT("{pet} and I will be in {state} during the visit."),attestBoth:DRAFT("Check both boxes to book the visit."),bookedStepLabel:DRAFT("Booked"),bookedTitleTemplate:DRAFT("You’re booked with {vet}"),bookedLeadTemplate:DRAFT("{when}, for {pet}."),footnote:DRAFT("Video visits are with a licensed veterinarian. Prescriptions where allowed, starting with California. In an emergency, go to the nearest emergency animal hospital."),rescheduleNavTitle:DRAFT("Change your visit"),close:DRAFT("Close"),continueCta:DRAFT("Continue"),petSelectTitle:DRAFT("Who is this visit for?"),addPetCta:DRAFT("Add a pet"),addAnotherPetCta:DRAFT("Add another pet"),locationUnknownTitle:DRAFT("We need your location to find a vet"),locationUnknownBody:DRAFT("Turn on location for Everfur, then try again."),locationUnknownCta:DRAFT("Allow location"),locationBlockedTitle:DRAFT("Location is turned off"),locationBlockedBody:DRAFT("Everfur needs your location to match you with a vet in your area."),locationBlockedCta:DRAFT("Open Settings"),locationUnavailableTitle:DRAFT("We could not read your location"),locationUnavailableBody:DRAFT("Try again in a moment."),stateAttestTemplate:DRAFT("I confirm my pet and I are in {state} right now."),describeHeading:DRAFT("Tell the vet what you are seeing"),describeHelpLong:DRAFT("When it started, what’s changed, what you’ve tried. Anything helps."),addPhotoCta:DRAFT("Add photos or videos"),addPhotoMeta:DRAFT("Optional. A close-up in good light helps."),removePhotoLabel:DRAFT("Remove photo"),summaryPet:DRAFT("Pet"),summaryVet:DRAFT("Vet"),summaryWhen:DRAFT("When"),summaryLength:DRAFT("Length"),summaryReason:DRAFT("About"),summaryLengthTemplate:DRAFT("{n} minutes"),confirmCta:DRAFT("Book the visit"),confirmBusy:DRAFT("Booking…"),bookedTitle:DRAFT("You are booked."),addToCalendarCta:DRAFT("Add to calendar"),doneCta:DRAFT("Done"),booked:/* @__PURE__ */Object.freeze({remindPromise:DRAFT("We will notify you 30 minutes before."),summaryPromise:DRAFT("{pet}'s summary goes to the vet ahead of the call."),recordsPromiseTemplate:DRAFT("{pet}’s records and your notes go to {vet} ahead of the call."),recordsPhotoPromiseTemplate:DRAFT("{pet}’s records, your notes and the photo go to {vet} ahead of the call."),stepsLabel:DRAFT("What happens next"),joinPromise:DRAFT("Join right here in the app. No links to hunt for."),backToPet:DRAFT("Back to {pet}"),calendarAdded:DRAFT("Added to your calendar"),calendarFailedBody:DRAFT("That did not save to your calendar.")}),chrome:/* @__PURE__ */Object.freeze({closeHint:DRAFT("Closes without saving"),discardTitle:DRAFT("Leave without booking?"),discardBody:DRAFT("Your answers will not be saved."),discardConfirmCta:DRAFT("Leave"),discardKeepCta:DRAFT("Keep going"),noPetsTitle:DRAFT("No pets on this account"),loadFailedTitle:DRAFT("Could not load"),retryCta:DRAFT("Try again")}),emergency:/* @__PURE__ */Object.freeze({bannerTitle:DRAFT("This can’t wait for a scheduled visit."),keepBookingCta:DRAFT("I’ve handled this, continue booking"),lede:DRAFT("What you’re describing is the kind of thing vets want to see in person, now. Call one of these first."),ledeWithoutExits:DRAFT("What you’re describing is the kind of thing vets want to see in person, now."),exitPrimaryVetTitle:DRAFT("Call {petName}’s regular vet"),exitFindErTitle:DRAFT("Find an emergency vet near you"),exitGoToErTitle:J,startCallHint:DRAFT("Starts a phone call"),poisonControl:DRAFT("ASPCA Animal Poison Control"),poisonControlDetail:DRAFT("(888) 426-4435 · a fee may apply"),poisonControlTel:"tel:+18884264435"}),visit:/* @__PURE__ */Object.freeze({title:DRAFT("Your visit")}),loading:/* @__PURE__ */Object.freeze({pets:"Loading pets. Nothing to read yet.",clinicians:"Loading vets. Nothing to read yet.",slots:"Loading times. Nothing to read yet.",consult:"Loading your visit. Nothing to read yet.",progressTemplate:"Step {step} of {total}"})});function te(e=ee){return typeof e=="string"?[e]:typeof e!="object"||e===null?[]:Object.values(e).flatMap(e=>te(e))}function isTelevetBookingCopyReady(){return te().every(e=>e.trim().length>0&&!X(e))}var ne=[{wireCode:"AccessDeniedException",envelope:"http_envelope",httpStatus:403,retryable:false},{wireCode:"AuthorizationException",envelope:"http_envelope",httpStatus:401,retryable:false},{wireCode:"ConflictException",envelope:"http_envelope",httpStatus:409,retryable:true},{wireCode:"DAILY_QUOTA_EXCEEDED",envelope:"http_envelope",httpStatus:429,retryable:true},{wireCode:"FILE_TOO_LARGE",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"IDEMPOTENCY_KEY_IN_FLIGHT",envelope:"http_envelope",httpStatus:409,retryable:true},{wireCode:"IDEMPOTENCY_KEY_REUSED_DIFFERENT_REQUEST",envelope:"http_envelope",httpStatus:409,retryable:false},{wireCode:"INVALID_CONTENT_TYPE",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"InternalFailureException",envelope:"http_envelope",httpStatus:500,retryable:true},{wireCode:"MethodNotAllowedException",envelope:"http_envelope",httpStatus:405,retryable:false},{wireCode:"NotImplementedException",envelope:"http_envelope",httpStatus:501,retryable:false},{wireCode:"PaymentRequiredException",envelope:"http_envelope",httpStatus:402,retryable:false},{wireCode:"ResourceNotFoundException",envelope:"http_envelope",httpStatus:404,retryable:false},{wireCode:"ServiceUnavailableException",envelope:"http_envelope",httpStatus:503,retryable:true},{wireCode:"TIER_UPGRADE_REQUIRED",envelope:"http_envelope",httpStatus:402,retryable:false},{wireCode:"ThrottlingException",envelope:"http_envelope",httpStatus:429,retryable:true},{wireCode:"ValidationException",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"accessDenied",envelope:"http_envelope",httpStatus:403,retryable:false},{wireCode:"access_denied",envelope:"oauth_error",httpStatus:302,retryable:false},{wireCode:"anchor_not_found",envelope:"http_envelope",httpStatus:404,retryable:false},{wireCode:"anchor_ref_invalid",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"anonTokenInvalid",envelope:"http_envelope",httpStatus:401,retryable:false},{wireCode:"attachment_unreadable",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"authExpired",envelope:"http_envelope",httpStatus:401,retryable:true},{wireCode:"authRejected",envelope:"http_envelope",httpStatus:401,retryable:false},{wireCode:"before_invalid",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"bundle_mismatch",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"bundle_not_uploaded",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"bundles_unavailable",envelope:"http_envelope",httpStatus:503,retryable:true},{wireCode:"catalog_empty_refused",envelope:"http_envelope",httpStatus:409,retryable:false},{wireCode:"catalog_shrink_refused",envelope:"http_envelope",httpStatus:409,retryable:false},{wireCode:"consent_invalid",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"consent_required",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"consent_scope_wrong_route",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"device_cipher_unavailable",envelope:"http_envelope",httpStatus:503,retryable:true},{wireCode:"email_invalid",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"endpoint_not_allowed",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"environment_mismatch",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"event_cursor_invalid",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"event_filter_invalid",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"event_id_invalid",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"event_payload_invalid",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"event_type_not_available",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"event_type_unknown",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"idempotency_key_invalid",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"idempotency_key_required",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"idempotency_key_reused",envelope:"http_envelope",httpStatus:409,retryable:false},{wireCode:"inbox_cursor_invalid",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"insufficientCapability",envelope:"http_envelope",httpStatus:403,retryable:false},{wireCode:"insufficient_scope",envelope:"http_envelope",httpStatus:403,retryable:false},{wireCode:"internal_error",envelope:"sse_frame",httpStatus:200,retryable:false},{wireCode:"invalidRequest",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"invalid_client",envelope:"oauth_error",httpStatus:401,retryable:false},{wireCode:"invalid_client_metadata",envelope:"oauth_error",httpStatus:400,retryable:false},{wireCode:"invalid_grant",envelope:"oauth_error",httpStatus:400,retryable:false},{wireCode:"invalid_redirect_uri",envelope:"oauth_error",httpStatus:400,retryable:false},{wireCode:"invalid_request",envelope:"oauth_error",httpStatus:400,retryable:false},{wireCode:"invalid_scope",envelope:"oauth_error",httpStatus:400,retryable:false},{wireCode:"invalid_target",envelope:"oauth_error",httpStatus:400,retryable:false},{wireCode:"item_id_invalid",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"linked_account_read_only",envelope:"http_envelope",httpStatus:409,retryable:false},{wireCode:"mcp_connection_not_found",envelope:"http_envelope",httpStatus:404,retryable:false},{wireCode:"mcp_request_conflict",envelope:"http_envelope",httpStatus:409,retryable:false},{wireCode:"mcp_request_gone",envelope:"http_envelope",httpStatus:410,retryable:false},{wireCode:"mcp_request_not_found",envelope:"http_envelope",httpStatus:404,retryable:false},{wireCode:"not_found",envelope:"sse_frame",httpStatus:200,retryable:false},{wireCode:"not_found",envelope:"http_envelope",httpStatus:404,retryable:false},{wireCode:"open_url_not_allowed",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"partner_visit_link_conflict",envelope:"http_envelope",httpStatus:409,retryable:false},{wireCode:"partner_visit_owner_only",envelope:"http_envelope",httpStatus:403,retryable:false},{wireCode:"partner_visit_pet_already_mapped",envelope:"http_envelope",httpStatus:409,retryable:false},{wireCode:"payload_too_large",envelope:"http_envelope",httpStatus:413,retryable:false},{wireCode:"petRefInUse",envelope:"http_envelope",httpStatus:409,retryable:false},{wireCode:"pet_health_list_removals_unconfirmed",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"pet_health_species_unsupported",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"pet_not_registered",envelope:"http_envelope",httpStatus:404,retryable:false},{wireCode:"provider_unsupported",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"rateLimited",envelope:"http_envelope",httpStatus:429,retryable:true},{wireCode:"read_target_invalid",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"record_species_unsupported",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"record_subject_not_found",envelope:"http_envelope",httpStatus:404,retryable:false},{wireCode:"record_upload_invalid",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"records_consent_required",envelope:"http_envelope",httpStatus:409,retryable:false},{wireCode:"restricted_key",envelope:"http_envelope",httpStatus:403,retryable:false},{wireCode:"sandbox_only",envelope:"http_envelope",httpStatus:403,retryable:false},{wireCode:"session_required",envelope:"http_envelope",httpStatus:403,retryable:false},{wireCode:"session_revoked",envelope:"http_envelope",httpStatus:401,retryable:false},{wireCode:"share_limit_reached",envelope:"http_envelope",httpStatus:429,retryable:false},{wireCode:"slow_down",envelope:"oauth_error",httpStatus:429,retryable:true},{wireCode:"species_unsupported",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"subscription_keys_invalid",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"tenant_filter_invalid",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"tenant_has_no_capabilities",envelope:"http_envelope",httpStatus:409,retryable:false},{wireCode:"tenant_resource_not_found",envelope:"http_envelope",httpStatus:404,retryable:false},{wireCode:"tenant_surface_not_enabled",envelope:"http_envelope",httpStatus:409,retryable:false},{wireCode:"ticket_not_resolved",envelope:"http_envelope",httpStatus:409,retryable:false},{wireCode:"tickets_disabled",envelope:"http_envelope",httpStatus:404,retryable:false},{wireCode:"timeout",envelope:"sse_frame",httpStatus:200,retryable:true},{wireCode:"timezone_invalid",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"token_invalid",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"unavailable",envelope:"sse_frame",httpStatus:200,retryable:true},{wireCode:"unavailable",envelope:"http_envelope",httpStatus:503,retryable:true},{wireCode:"unrestrictedKeyRequired",envelope:"http_envelope",httpStatus:403,retryable:false},{wireCode:"unsupported_grant_type",envelope:"oauth_error",httpStatus:400,retryable:false},{wireCode:"unsupported_response_type",envelope:"oauth_error",httpStatus:302,retryable:false},{wireCode:"user_ref_invalid",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"verify_mint_rate_limited",envelope:"http_envelope",httpStatus:429,retryable:true},{wireCode:"verify_mint_refused",envelope:"http_envelope",httpStatus:403,retryable:false},{wireCode:"verify_mint_unavailable",envelope:"http_envelope",httpStatus:503,retryable:true},{wireCode:"verify_user_ref_invalid",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"web_push_unavailable",envelope:"http_envelope",httpStatus:503,retryable:true},{wireCode:"webhook_endpoint_update_empty",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"webhook_endpoint_update_invalid",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"webhook_url_rejected",envelope:"http_envelope",httpStatus:400,retryable:false}],re=/* @__PURE__ */Object.freeze(ne.map(e=>/* @__PURE__ */Object.freeze(e)));/* @__PURE__ */Object.freeze(re.map(e=>e.wireCode));var le=/* @__PURE__ */Object.freeze({ValidationException:"validationFailed",AuthorizationException:"authRejected",PaymentRequiredException:"paymentRequired",AccessDeniedException:"accessDenied",ResourceNotFoundException:"resourceNotFound",ConflictException:"conflict",ThrottlingException:"rateLimited",InternalFailureException:"internalError",NotImplementedException:"notImplemented",ServiceUnavailableException:"serviceUnavailable",MethodNotAllowedException:"validationFailed",authExpired:"authExpired",unavailable:"serviceUnavailable",session_required:"sessionRequired",session_revoked:"authExpired",anonTokenInvalid:"authRejected",accessDenied:"accessDenied",invalidRequest:"sdkUpdateRequired",authRejected:"authRejected",rateLimited:"rateLimited",insufficientCapability:"accessDenied",unrestrictedKeyRequired:"accessDenied",user_ref_invalid:"validationFailed",event_cursor_invalid:"validationFailed",event_filter_invalid:"validationFailed",event_payload_invalid:"validationFailed",event_type_unknown:"validationFailed",idempotency_key_invalid:"validationFailed",idempotency_key_required:"validationFailed",idempotency_key_reused:"idempotencyConflict",payload_too_large:"validationFailed",webhook_url_rejected:"validationFailed",webhook_endpoint_update_empty:"validationFailed",webhook_endpoint_update_invalid:"validationFailed",event_type_not_available:"conflict",record_subject_not_found:"resourceNotFound",records_consent_required:"conflict",record_species_unsupported:"validationFailed",record_upload_invalid:"validationFailed",FILE_TOO_LARGE:"validationFailed",INVALID_CONTENT_TYPE:"validationFailed",attachment_unreadable:"validationFailed",provider_unsupported:"validationFailed",token_invalid:"validationFailed",device_cipher_unavailable:"serviceUnavailable",email_invalid:"validationFailed",consent_required:"validationFailed",consent_invalid:"validationFailed",consent_scope_wrong_route:"validationFailed",IDEMPOTENCY_KEY_IN_FLIGHT:"idempotencyInFlight",IDEMPOTENCY_KEY_REUSED_DIFFERENT_REQUEST:"idempotencyConflict",DAILY_QUOTA_EXCEEDED:"quotaExceeded",TIER_UPGRADE_REQUIRED:"paymentRequired",not_found:"conversationNotFound",timeout:"streamTimeout",internal_error:"internalError",invalid_request:"validationFailed",invalid_client:"authRejected",invalid_grant:"authRejected",unsupported_grant_type:"validationFailed",invalid_scope:"validationFailed",invalid_target:"validationFailed",invalid_redirect_uri:"validationFailed",invalid_client_metadata:"validationFailed",unsupported_response_type:"validationFailed",access_denied:"accessDenied",slow_down:"rateLimited",mcp_request_not_found:"resourceNotFound",mcp_request_gone:"resourceNotFound",mcp_connection_not_found:"resourceNotFound",mcp_request_conflict:"conflict",sandbox_only:"accessDenied",tenant_has_no_capabilities:"conflict",verify_mint_refused:"accessDenied",verify_mint_rate_limited:"rateLimited",verify_mint_unavailable:"serviceUnavailable",verify_user_ref_invalid:"validationFailed",insufficient_scope:"accessDenied",tenant_filter_invalid:"validationFailed",tenant_resource_not_found:"resourceNotFound",tenant_surface_not_enabled:"conflict",pet_health_species_unsupported:"validationFailed",pet_health_list_removals_unconfirmed:"validationFailed",petRefInUse:"conflict",share_limit_reached:"conflict",pet_not_registered:"resourceNotFound",species_unsupported:"validationFailed",partner_visit_owner_only:"accessDenied",partner_visit_link_conflict:"conflict",partner_visit_pet_already_mapped:"conflict",linked_account_read_only:"conflict",catalog_empty_refused:"conflict",catalog_shrink_refused:"conflict",endpoint_not_allowed:"validationFailed",event_id_invalid:"validationFailed",inbox_cursor_invalid:"validationFailed",item_id_invalid:"validationFailed",open_url_not_allowed:"validationFailed",read_target_invalid:"validationFailed",subscription_keys_invalid:"validationFailed",web_push_unavailable:"serviceUnavailable",anchor_not_found:"resourceNotFound",anchor_ref_invalid:"validationFailed",before_invalid:"validationFailed",bundle_mismatch:"validationFailed",bundle_not_uploaded:"validationFailed",bundles_unavailable:"serviceUnavailable",environment_mismatch:"validationFailed",restricted_key:"accessDenied",ticket_not_resolved:"conflict",tickets_disabled:"resourceNotFound",timezone_invalid:"validationFailed"}),ie=/* @__PURE__ */Object.freeze(re.map(e=>/* @__PURE__ */Object.freeze({wireCode:e.wireCode,envelope:e.envelope,retryable:e.retryable,normalized:le[e.wireCode]}))),oe=new Map(ie.map(e=>[e.envelope+e.wireCode.toUpperCase(),e])),ae=/* @__PURE__ */Object.freeze(["http_envelope",...[...new Set(ie.map(e=>e.envelope))].filter(e=>e!=="http_envelope").sort()]);function contractErrorFor(e,t){if(typeof e!="string")return;let n=e.trim().toUpperCase();if(n.length!==0)for(let e of[t??"http_envelope",...ae]){let t=oe.get(e+n);if(t)return t}}var se=/* @__PURE__ */Object.freeze({authExpired:"authentication",authRejected:"authentication",sessionRequired:"authentication",identitySignatureRequired:"authentication",accessDenied:"authorization",paymentRequired:"entitlement",quotaExceeded:"rateLimit",rateLimited:"rateLimit",validationFailed:"invalidRequest",sdkUpdateRequired:"invalidRequest",runtimeDisposed:"invalidRequest",conversationNotFound:"notFound",petNotFound:"notFound",resourceNotFound:"notFound",conflict:"conflict",idempotencyConflict:"conflict",idempotencyInFlight:"conflict",streamTimeout:"connection",streamIncomplete:"connection",upstreamLlmTimeout:"connection",serviceUnavailable:"connection",internalError:"server",notImplemented:"server",mediaUploadFailed:"media",moderationBlocked:"policy",unknown:"unknown"});function categoryFor(e){return se[e]}function fromWire(e){let t=contractErrorFor(e);if(t)return t.normalized;let n=(e??"").trim().toUpperCase(),r=n.replace(/[^A-Z0-9]/g,"");if(r==="AUTHREJECTED")return"authRejected";if(n.startsWith("AUTH"))return"authExpired";switch(r){case"DAILYQUOTAEXCEEDED":case"QUOTAEXCEEDED":return"quotaExceeded";case"RATELIMITED":case"TOOMANYREQUESTS":case"TELEVETRATELIMITED":return"rateLimited";case"IDEMPOTENCYKEYCONFLICT":case"IDEMPOTENCYCONFLICT":return"idempotencyConflict";case"ACCESSDENIED":case"FORBIDDEN":return"accessDenied";case"IDENTITYSIGNATUREREQUIRED":return"identitySignatureRequired";case"FREECAPREACHED":return"paymentRequired";case"RUNTIMEDISPOSED":return"runtimeDisposed";case"NOTFOUND":case"CONVERSATIONNOTFOUND":return"conversationNotFound";case"PETNOTFOUND":return"petNotFound";case"TIMEOUT":case"STREAMTIMEOUT":return"streamTimeout";case"MEDIAUPLOADFAILED":case"UNRECOGNIZEDVIDEOFORMAT":case"FILETOOSMALL":return"mediaUploadFailed";case"MODERATIONBLOCKED":return"moderationBlocked";case"UPSTREAMLLMTIMEOUT":return"upstreamLlmTimeout";case"INTERNALERROR":case"INTERNALSERVERERROR":return"internalError";case"STREAMINCOMPLETE":case"CHATSTREAMINCOMPLETE":return"streamIncomplete";case"INVALIDANALYSISTYPE":case"INVALIDUPLOADPURPOSE":return"unknown";default:return"unknown"}}var ce=/* @__PURE__ */new Set(["streamTimeout","rateLimited","internalError","upstreamLlmTimeout","streamIncomplete"]);function isAutoRetryable(e){return ce.has(e)}var de=/* @__PURE__ */new Set(["serviceUnavailable","conflict","idempotencyInFlight"]);function isRetryableCode(e){return isAutoRetryable(e)||de.has(e)}var ue=500,pe=8e3,he=4;function backoffDelayMs(e,t=Math.random){let n=Math.max(0,e),r=Math.min(ue*2**n,pe);return Math.floor(t()*r)}var fe="This feature isn't available on your account right now.",me="Something in that request was not right. Check the details and try again.",ge=/* @__PURE__ */Object.freeze({authExpired:"Please sign in again to continue.",authRejected:"Please sign in again to continue.",sessionRequired:"This app needs to be updated to keep using Everfur.",accessDenied:fe,paymentRequired:"This is part of a paid plan.",quotaExceeded:"You have used today's messages. This resets tomorrow.",rateLimited:"You are sending messages quickly. Try again in a few seconds.",validationFailed:me,sdkUpdateRequired:"This app needs to be updated to keep using Everfur.",conflict:"That is already running. Wait for it to finish, then try again.",idempotencyConflict:"That message was already delivered.",idempotencyInFlight:"That is still processing. Give it a moment.",conversationNotFound:"This conversation is no longer available.",petNotFound:"We could not find that pet. Please pick a pet and try again.",resourceNotFound:"We could not find that.",streamTimeout:"The response timed out. Tap retry to try again.",mediaUploadFailed:"We could not upload that photo. Please attach it again.",moderationBlocked:"This request cannot be answered here.",upstreamLlmTimeout:"The response timed out. Tap retry to try again.",internalError:"We hit a snag on our end. Please try again.",notImplemented:"That is not available yet.",serviceUnavailable:"That service is briefly unavailable. Try again shortly.",streamIncomplete:"The connection dropped mid-answer. Tap retry to continue.",identitySignatureRequired:fe,runtimeDisposed:me,unknown:"Something went wrong. Please try again."}),ye="This session has ended. Please sign in again.",be="linked_account_read_only";function ve(e,t,n){return e==="conflict"&&n===be?fe:(e==="authRejected"||e==="authExpired")&&typeof t=="string"&&t.trim().toLowerCase()==="session_revoked"?ye:userFacingError(e)}function userFacingError(e){return ge[e]}function xe(e,t,n){Object.defineProperty(e,t,{value:n,enumerable:false,writable:false,configurable:false})}var Te=/^[a-z][a-z0-9_]{0,63}$/;function makeEverfurError(e,t){let n=contractErrorFor(t?.wireCode,t?.wireEnvelope),r=e==="conflict"&&t?.reasonCode===be,l={code:e,category:categoryFor(e),retryable:t?.retryable??(r?false:isRetryableCode(e)),displayMessage:ve(e,t?.wireCode,r?be:null)};t?.httpStatus!==void 0&&(l.httpStatus=t.httpStatus),t?.requestId&&(l.requestId=t.requestId),typeof t?.reasonCode=="string"&&Te.test(t.reasonCode)&&(l.reasonCode=t.reasonCode);let i=t?.retryAfterSeconds;if(typeof i=="number"&&Number.isFinite(i)&&i>=0&&(l.retryAfterSeconds=Math.round(i)),n);return t?.wireMessage&&xe(l,"wireMessage",t.wireMessage),t?.raw!==void 0&&t.raw!==null&&xe(l,"raw",t.raw),/* @__PURE__ */Object.freeze(l)}function ok(e,t){/* @__PURE__ */
|
|
6
6
|
return Object.freeze({ok:true,value:e})}function err(e){/* @__PURE__ */
|
|
7
|
-
return Object.freeze({ok:false,error:e})}var
|
|
7
|
+
return Object.freeze({ok:false,error:e})}var ke=class _EverfurConfigError extends Error{constructor(e,t){super(t),this.name="EverfurConfigError",this.kind=e,Object.setPrototypeOf(this,_EverfurConfigError.prototype)}};var we="x-everfur-anon-token",Se="anonTokenInvalid";async function je(e){if(e.userRef!==null||e.anonIdentity===void 0)return null;try{return await e.anonIdentity.token()}catch{return null}}function Ce(e,t){let n=e instanceof Error?e.message:typeof e=="string"?e:null;return makeEverfurError("authRejected",{retryable:false,...t?.wireCode?{wireCode:t.wireCode}:{},...t?.requestId?{requestId:t.requestId}:{},...n?{wireMessage:n}:{},...e!=null?{raw:e}:{}})}function authHeaders(e){let t={};return e.mode==="personalized"?t.authorization=`Bearer ${e.token}`:(t["x-everfur-partner-key"]=e.publishableKey,e.anonToken&&(t[we]=e.anonToken)),e.userRef&&(t["x-everfur-user-ref"]=e.userRef),e.sessionId&&(t["x-everfur-session-id"]=e.sessionId),t}function withAuthHeaders(e,t){return{...e,headers:{..._e(e.headers),...authHeaders(t)}}}function _e(e){if(!e)return{};let t={};for(let[n,r]of Object.entries(e)){let e=n.toLowerCase();e==="authorization"||e==="x-everfur-partner-key"||e===we||(t[n]=r)}return t}async function authedSend(e,t){if(t.mode==="anonymous"){let n=await je(t),r=await t.transport.request(withAuthHeaders(e,Ie(t,n)));if(r.ok||De(r.error.raw)!==Se||t.anonIdentity===void 0||t.userRef!==null)return r;let l=await t.anonIdentity.token({forceRefresh:true});return l===null||l===n?r:t.transport.request(withAuthHeaders(e,Ie(t,l)))}let n;try{n=await t.identity.currentToken()}catch(e){return t.identity.reportRejected?.(),err(Ce(e))}let r=await t.transport.request(withAuthHeaders(e,{mode:"personalized",token:n,userRef:t.userRef,...t.sessionId?{sessionId:t.sessionId}:{}}));if(r.ok||r.error.httpStatus!==401)return r;let l;try{l=await t.identity.currentToken({forceRefresh:!0})}catch(e){return t.identity.reportRejected?.(),err(Ce(e,{wireCode:De(r.error.raw),requestId:r.error.requestId}))}let i=await t.transport.request(withAuthHeaders(e,{mode:"personalized",token:l,userRef:t.userRef,...t.sessionId?{sessionId:t.sessionId}:{}}));return!i.ok&&i.error.httpStatus===401?(t.identity.reportRejected?.(),err(Ee(i.error))):i}function Ie(e,t){return{mode:"anonymous",publishableKey:e.publishableKey,userRef:e.userRef,...e.sessionId?{sessionId:e.sessionId}:{},...t!==null?{anonToken:t}:{}}}function Ee(e){let t=e.raw,n=De(t);return makeEverfurError("authRejected",{retryable:false,...e.httpStatus!==void 0?{httpStatus:e.httpStatus}:{},...e.requestId?{requestId:e.requestId}:{},...n?{wireCode:n}:{},...e.reasonCode?{reasonCode:e.reasonCode}:{},...e.wireMessage?{wireMessage:e.wireMessage}:{},...t!=null?{raw:t}:{}})}function De(e){if(typeof e!="object"||e===null)return null;let t=e,n=(typeof t.error=="object"&&t.error!==null?t.error.code:void 0)??t.code;return typeof n=="string"&&n.length>0?n:null}function Pe(e,t){let n=globalThis.URL;if(typeof n=="function"){let r;try{r=t===void 0?new n(e):new n(e,t)}catch{return null}try{if(r.protocol)return r}catch{}}return Le(e)}var Re=/^([a-z][a-z0-9+.-]*):\/\/(?:([^:@/?#]*)(?::([^@/?#]*))?@)?(\[[0-9a-f:.]+\]|[\w.~-]+)(?::(\d*))?(\/[^?#]*)?(\?[^#]*)?(#.*)?$/i,ze=/[\s\u0000-\u001f\u007f\\]/,Fe={"http:":"80","https:":"443"};function Le(e,t){let n=e.trim();let r=ze.test(n)?null:Re.exec(n);if(r===null)return null;let[,l="",i="",o="",a="",s="",c="",d="",u=""]=r,p=`${l.toLowerCase()}:`,h=Number(s);if(h>65535)return null;let f=s===""||String(h)===Fe[p]?"":String(h),m=Fe[p]!==void 0,g=a.toLowerCase()+(f&&`:${f}`),y=c||(m?"/":""),b=i||o?`${i}${o&&`:${o}`}@`:"";return{href:`${p}//${b}${g}${y}${d}${u}`,protocol:p,username:i,password:o,hostname:a.toLowerCase(),port:f,origin:m?`${p}//${g}`:"null",pathname:y,search:d==="?"?"":d,hash:u==="#"?"":u}}function networkError(e){return makeEverfurError("internalError",{retryable:true,wireMessage:Ae(e)})}function Ae(e){return e instanceof Error?e.message:typeof e=="string"?e:"network request failed"}var Oe=3e4,Ve=pe*2,Ne="idempotency-key",Be=/* @__PURE__ */new Set(["POST","PUT","PATCH","DELETE"]),Me=/* @__PURE__ */Object.freeze({onEvent(){}}),He=/* @__PURE__ */Object.freeze({setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),now:()=>Date.now()});function $e(e){let t=e.trim().replace(/[^A-Za-z0-9_.:-]/g,"-");return t.length===0?null:`efs_${t}`.slice(0,128)}function createRequestFunnel(e){let t=e.observer??Me,n=e.timers??He,r=e.rng??Math.random,l=e.sleep??((e,t)=>it(e,n,t)),i=e.maxAttempts??he,o=e.unaryTimeoutMs??Oe,a=e.newIdempotencyKey??Ue(),s=e=>{try{t.onEvent(e)}catch{}};async function c(t,c,d){let u=d?.maxAttempts,p=Math.max(1,u??i),h=d?.idempotent??Be.has(c.method),f=d?.idempotencyKey===void 0?null:$e(d.idempotencyKey),m=h?f??a():null,g=We(c,m),y=0;for(;;){let i=e=>/* @__PURE__ */Object.freeze({call:t,method:c.method,path:c.path,attempt:y,...m?{idempotencyKey:m}:{},...e});s(i({phase:"attempt"}));let a=rt(o,n),d=lt(a.signal,c.signal),h;try{h=await authedSend({...g,signal:d.signal},e.auth)}catch(e){h=err(networkError(e))}finally{d.dispose(),a.cancel()}if(h.ok)return s(i({phase:"settled",ok:true,reason:"ok"})),h;let f=h.error,b=Ke(f,y,{maxAttempts:p,rng:r,now:n.now(),aborted:c.signal?.aborted===true,...u!==void 0?{perCallMaxAttempts:u}:{},...e.errorPolicy!==void 0?{policy:e.errorPolicy}:{}}),v={ok:false,code:f.code,reason:b.reason,...f.httpStatus!==void 0?{httpStatus:f.httpStatus}:{},...f.requestId!==void 0?{requestId:f.requestId}:{}};if(!b.retry)return s(i({phase:"settled",...v})),err(f);if(s(i({phase:"retry",...v,delayMs:b.delayMs})),await l(b.delayMs,c.signal),c.signal?.aborted===true)return s(i({phase:"settled",...v,reason:"aborted"})),err(f);y+=1}}async function d(t){return withAuthHeaders(t,await nt(e.auth))}async function*u(t,n,r){s(
|
|
8
8
|
/* @__PURE__ */Object.freeze({call:t,phase:"stream.open",method:n.method,path:n.path,attempt:0}));try{yield*e.auth.transport.stream(n,r)}catch{yield errorFrame({code:"internal_error",retryable:true,wireMessage:null,synthesized:true,lastEventId:null})}}/* @__PURE__ */
|
|
9
|
-
return Object.freeze({send:c,authorize:d,stream:u})}function We(e,t){let n={};for(let[t,r]of Object.entries(e.headers??{}))t.toLowerCase()!==Ne&&(n[t]=r);return t!==null&&(n["Idempotency-Key"]=t),{...e,headers:n}}function
|
|
10
|
-
return Object.freeze({upload_id:n(t.upload_id)??"",upload_url:l,upload_fields:/* @__PURE__ */Object.freeze(o),expires_in_seconds:r(t.expires_in_seconds)??0,max_content_length:r(t.max_content_length)??at,s3_key:i,purpose:n(t.purpose)})}function ht(e){if(typeof e!="object"||e===null)return null;let t=[e,e.detail,e.error];for(let e of t)if(!(typeof e!="object"||e===null))for(let t of["error","code"]){let n=e[t];if(typeof n=="string"&&n.length>0)return n}return null}function ft(e){if(e.httpStatus===404)return"dark";if(e.httpStatus===400){let t=ht(e.raw);if(t==="FILE_TOO_LARGE")return"size";if(t==="INVALID_CONTENT_TYPE")return"type"}return"failed"}var mt="televet_booking_not_live";function gt(e){return makeEverfurError("conflict",{retryable:false,reasonCode:mt,wireMessage:`the booking was answered with a consult whose status is ${e}, which is not a live visit`})}var yt="televet_booking_key_reused",bt="IDEMPOTENCY_KEY_REUSED_DIFFERENT_REQUEST";function vt(e){return e.httpStatus!==409||e.reasonCode===yt||xt(e)?.code!==bt?e:makeEverfurError(e.code,{retryable:false,httpStatus:409,...e.requestId!==void 0?{requestId:e.requestId}:{},wireCode:bt,reasonCode:yt,...e.wireMessage!==void 0?{wireMessage:e.wireMessage}:{},raw:e.raw})}function xt(e){let t=e.raw;if(typeof t!="object"||t===null)return null;let n=t,r=n.detail??n.error;return typeof r=="object"&&r!==null?r:n}function Tt(e){let t=xt(e)?.categories;return Array.isArray(t)?/* @__PURE__ */Object.freeze(t.filter(e=>typeof e=="string")):/* @__PURE__ */Object.freeze([])}function
|
|
11
|
-
return Object.freeze({kind:"rate_limited",retryAfterSeconds:
|
|
12
|
-
return Object.freeze({kind:"rate_limited",retryAfterSeconds:
|
|
9
|
+
return Object.freeze({send:c,authorize:d,stream:u})}function We(e,t){let n={};for(let[t,r]of Object.entries(e.headers??{}))t.toLowerCase()!==Ne&&(n[t]=r);return t!==null&&(n["Idempotency-Key"]=t),{...e,headers:n}}function Ue(){let e=0;return()=>`efk_${Date.now().toString(36)}_${(e++).toString(36)}_${Math.random().toString(36).slice(2,12)}`}var qe=10;function Ke(e,t,n){if(n.aborted)return{retry:false,reason:"aborted"};let r=Ye(e);if(r==="quota")return{retry:false,reason:"daily-quota-exhausted"};if(r!=="burst"&&!isAutoRetryable(e.code))return{retry:false,reason:"terminal-code"};let l=r==="burst"?"burst-throttle":"retryable-code";if((()=>{if(n.policy===void 0)return false;try{return!n.policy.shouldRetry(e.code,t)}catch{return false}})())return{retry:false,reason:"terminal-code"};let i=()=>{if(n.policy===void 0)return null;let t;try{t=n.policy.maxAttempts(e.code)}catch{return null}return typeof t!="number"||!Number.isFinite(t)?null:Math.max(1,Math.min(qe,Math.floor(t)))},o=n.perCallMaxAttempts??i()??n.maxAttempts;if(t+1>=o)return{retry:false,reason:"attempts-exhausted"};let a=Ge(e,n.now);return a!==null?a>Ve?{retry:false,reason:"server-reset-beyond-budget"}:{retry:true,reason:l,delayMs:a}:{retry:true,reason:l,delayMs:backoffDelayMs(t,n.rng)}}function Ye(e){let t=e.code==="unknown"?fromWire(et(e.raw)):e.code;return t==="quotaExceeded"?"quota":t==="rateLimited"||e.httpStatus===429?"burst":null}function Ge(e,t){let n=Qe(e.raw);if(n!==null){let e=n-t;return e>0?e:0}let r=Je(e.raw);return r===null?null:Math.round(r*1e3)}function Je(e){for(let t of Xe(e)){let e=t.retry_after_seconds;if(typeof e=="number"&&Number.isFinite(e)&&e>=0)return e}return null}function Qe(e){for(let t of Xe(e)){let e=t.resets_at,n=Ze(e);if(n!==null)return n}return null}function Xe(e){if(!tt(e))return[];let t=[e];for(let n of["error","detail"]){let r=e[n];tt(r)&&t.push(r)}return t}function Ze(e){if(typeof e=="number"&&Number.isFinite(e))return e<1e11?Math.round(e*1e3):Math.round(e);if(typeof e=="string"&&e.trim().length>0){let t=Date.parse(e);return Number.isFinite(t)?t:null}return null}function et(e){for(let t of Xe(e)){let e=t.code;if(typeof e=="string"&&e.length>0)return e}return null}function tt(e){return typeof e=="object"&&e!==null}async function nt(e){if(e.mode==="anonymous"){let t=await je(e);return{mode:"anonymous",publishableKey:e.publishableKey,userRef:e.userRef,...e.sessionId?{sessionId:e.sessionId}:{},...t!==null?{anonToken:t}:{}}}return{mode:"personalized",token:await e.identity.currentToken(),userRef:e.userRef,...e.sessionId?{sessionId:e.sessionId}:{}}}function rt(e,t){let n=new AbortController,r=t.setTimeout(()=>n.abort(),e);return{signal:n.signal,cancel:()=>t.clearTimeout(r)}}function lt(e,t){let n=()=>{};if(!t)return{signal:e,dispose:n};let r=new AbortController;if(e.aborted||t.aborted)return r.abort(),{signal:r.signal,dispose:n};let l=()=>r.abort();return e.addEventListener("abort",l,{once:true}),t.addEventListener("abort",l,{once:true}),{signal:r.signal,dispose:()=>{e.removeEventListener("abort",l),t.removeEventListener("abort",l)}}}function it(e,t,n){return e<=0||n?.aborted===true?Promise.resolve():new Promise(r=>{let l=t.setTimeout(()=>{n?.removeEventListener("abort",i),r()},e),i=()=>{t.clearTimeout(l),r()};n?.addEventListener("abort",i,{once:true})})}var ot=/* @__PURE__ */Object.freeze(["image/jpeg","image/png","image/webp","image/heic","image/heif","application/pdf","text/csv","video/mp4","video/quicktime"]),at=25*1024*1024,st=200*1024*1024,ct=[[".jpg","image/jpeg"],[".jpeg","image/jpeg"],[".png","image/png"],[".webp","image/webp"],[".heic","image/heic"],[".heif","image/heif"],[".pdf","application/pdf"],[".csv","text/csv"],[".mp4","video/mp4"],[".mov","video/quicktime"]];function dt(e,t){let n=(t??"").trim().toLowerCase();if(n==="image/jpg")return"image/jpeg";if(ot.includes(n))return n;if(n.length>0)return null;let r=e.toLowerCase();return ct.find(([e])=>r.endsWith(e))?.[1]??null}function ut(e){let t=dt(e.filename,e.mimeType);if(t===null)return"type";if(!Number.isFinite(e.fileSize)||e.fileSize<=0)return"unreadable";let n=t.startsWith("video/")?st:at;return e.fileSize<=n?null:"size"}function pt(e){if(typeof e!="object"||e===null)return null;let t=e,n=e=>typeof e=="string"&&e.length>0?e:null,r=e=>typeof e=="number"&&Number.isFinite(e)?e:null,l=n(t.upload_url),i=n(t.s3_key);if(l===null||i===null)return null;let o={},a=t.upload_fields;if(typeof a=="object"&&a!==null)for(let[e,t]of Object.entries(a))typeof t=="string"&&(o[e]=t);/* @__PURE__ */
|
|
10
|
+
return Object.freeze({upload_id:n(t.upload_id)??"",upload_url:l,upload_fields:/* @__PURE__ */Object.freeze(o),expires_in_seconds:r(t.expires_in_seconds)??0,max_content_length:r(t.max_content_length)??at,s3_key:i,purpose:n(t.purpose)})}function ht(e){if(typeof e!="object"||e===null)return null;let t=[e,e.detail,e.error];for(let e of t)if(!(typeof e!="object"||e===null))for(let t of["error","code"]){let n=e[t];if(typeof n=="string"&&n.length>0)return n}return null}function ft(e){if(e.httpStatus===404)return"dark";if(e.httpStatus===400){let t=ht(e.raw);if(t==="FILE_TOO_LARGE")return"size";if(t==="INVALID_CONTENT_TYPE")return"type"}return"failed"}var mt="televet_booking_not_live";function gt(e){return makeEverfurError("conflict",{retryable:false,reasonCode:mt,wireMessage:`the booking was answered with a consult whose status is ${e}, which is not a live visit`})}var yt="televet_booking_key_reused",bt="IDEMPOTENCY_KEY_REUSED_DIFFERENT_REQUEST";function vt(e){return e.httpStatus!==409||e.reasonCode===yt||xt(e)?.code!==bt?e:makeEverfurError(e.code,{retryable:false,httpStatus:409,...e.requestId!==void 0?{requestId:e.requestId}:{},wireCode:bt,reasonCode:yt,...e.wireMessage!==void 0?{wireMessage:e.wireMessage}:{},raw:e.raw})}function xt(e){let t=e.raw;if(typeof t!="object"||t===null)return null;let n=t,r=n.detail??n.error;return typeof r=="object"&&r!==null?r:n}function Tt(e){let t=xt(e)?.categories;return Array.isArray(t)?/* @__PURE__ */Object.freeze(t.filter(e=>typeof e=="string")):/* @__PURE__ */Object.freeze([])}function kt(e){let t=xt(e)?.retry_after_seconds;return typeof t=="number"&&Number.isFinite(t)&&t>0?t:null}function wt(e){let t=e.wireMessage;if(typeof t=="string"&&t.trim().length>0)return t.trim();let n=xt(e)?.message;return typeof n=="string"&&n.trim().length>0?n.trim():null}function St(e){let t=e.reasonCode;if(typeof t=="string"&&t.length>0)return t;let n=xt(e),r=n?.code??n?.error_code;return typeof r=="string"&&r.length>0?r:null}function televetBookingRefusal(e){let t=e.httpStatus;if(t===402)/* @__PURE__ */return Object.freeze({kind:"not_entitled"});if(t===429||e.code==="rateLimited"||e.code==="quotaExceeded")/* @__PURE__ */
|
|
11
|
+
return Object.freeze({kind:"rate_limited",retryAfterSeconds:kt(e),message:wt(e)});if(t===404)/* @__PURE__ */return Object.freeze({kind:"unavailable"});switch(St(e)){case"televet_rate_limited":/* @__PURE__ */
|
|
12
|
+
return Object.freeze({kind:"rate_limited",retryAfterSeconds:kt(e),message:wt(e)});case"televet_emergency_ack_required":/* @__PURE__ */
|
|
13
13
|
return Object.freeze({kind:"emergency",categories:Tt(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__ */
|
|
@@ -21,29 +21,29 @@ return Object.freeze({kind:"not_entitled"});case"televet_registry_unavailable":/
|
|
|
21
21
|
return Object.freeze({kind:"failed"})}/* @__PURE__ */
|
|
22
22
|
return Object.freeze({kind:"failed"})}function jt(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function isSafeRoomUrl(e){return Pe(e.trim())?.protocol==="https:"}function isUsableRoomCredential(e,t){return isSafeRoomUrl(e)&&t.trim().length>0}function Ct(e,t){return typeof e=="number"&&Number.isInteger(e)&&e>=t?e:null}function _t(e){if(!jt(e))return null;let t=Ct(e.consult_minutes,1),n=Ct(e.auto_end_minutes,0),r=Ct(e.warn_before_seconds,0);return t===null||n===null||r===null?null:/* @__PURE__ */Object.freeze({consultMinutes:t,autoEndMinutes:n,warnBeforeSeconds:r})}function parseVetCallCredential(e){if(!jt(e))return null;let t=e.room_url??e.url,n=e.token;if(typeof t!="string"||typeof n!="string"||!isUsableRoomCredential(t,n))return null;let r=e.recording_notice;/* @__PURE__ */
|
|
23
23
|
return Object.freeze({roomUrl:t.trim(),token:n,recordingNotice:typeof r=="boolean"?r:true,callLimits:_t(e.call_limits)})}function vetCallJoinReason(e){let t=It(e.raw);return t!==null&&t.length>0?t:null}function It(e){if(!jt(e))return null;let t=e.detail??e.error,n=(jt(t)?t:e).reason;return typeof n=="string"?n:null}function vetCallJoinRefusal(e){if(e.httpStatus===404)return"unavailable";let t=It(e.raw);return t==="too_early"||t==="too_late"||t==="room_not_ready"?t:t!==null&&t.startsWith("status_")?"not_joinable":"unknown"}var Et="/widget/v1/televet",Dt=`${Et}/messages/threads`;function televetThreadMessagesCall(petRef){return`${Dt}/${encodeURIComponent(petRef)}/messages`}function televetThreadReadCall(petRef){return`${Dt}/${encodeURIComponent(petRef)}/read`}function televetVisitSummaryCall(e){return`${Et}/consults/${encodeURIComponent(e)}/summary`}var Pt=4e3,Rt=50,zt=100,Ft=/* @__PURE__ */n.z.string().min(1).refine(e=>!Number.isNaN(Date.parse(e))),Lt=/* @__PURE__ */n.z.string().nullish(),At=/* @__PURE__ */n.z.object({message_id:/* @__PURE__ */n.z.string().min(1),pet_ref:/* @__PURE__ */n.z.string().min(1),role:/* @__PURE__ */n.z.enum(["owner","vet","system"]),content:/* @__PURE__ */n.z.string(),created_at:Ft,sender:/* @__PURE__ */n.z.object({display_name:Lt,specialty:Lt}).nullish(),sender_display_name:Lt,attachment_count:/* @__PURE__ */n.z.number().int().nonnegative().nullish()}),Ot=/* @__PURE__ */n.z.object({pet_ref:/* @__PURE__ */n.z.string().min(1),last_message_at:Ft,unread_count:/* @__PURE__ */n.z.number().int().nonnegative().nullish(),owner_can_start:/* @__PURE__ */n.z.boolean().nullish(),last_message:/* @__PURE__ */At.nullish()}),Vt=/* @__PURE__ */n.z.object({drug:/* @__PURE__ */n.z.string().nullish(),strength:Lt,form:Lt,sig:Lt,quantity:/* @__PURE__ */n.z.union([/* @__PURE__ */n.z.string(),/* @__PURE__ */n.z.number()]).nullish(),refills:/* @__PURE__ */n.z.number().int().nonnegative().nullish()}).passthrough(),Nt=/* @__PURE__ */n.z.object({consult_id:/* @__PURE__ */n.z.string().min(1),findings_text:/* @__PURE__ */n.z.string().nullish(),next_steps_text:/* @__PURE__ */n.z.string().nullish(),medications:/* @__PURE__ */n.z.array(/* @__PURE__ */n.z.unknown()).nullish(),product_refs:/* @__PURE__ */n.z.array(/* @__PURE__ */n.z.string()).nullish(),action_items:/* @__PURE__ */n.z.array(/* @__PURE__ */n.z.string()).nullish(),approved_at:Ft,approved_by_display_name:Lt,credentials_text:Lt});function Bt(e){let t=e?.trim()??"";return t.length>0?t:null}function Mt(e){let t=e.role==="vet";/* @__PURE__ */
|
|
24
|
-
return Object.freeze({messageId:e.message_id,petRef:e.pet_ref,role:e.role,content:e.content,createdAt:e.created_at,senderName:t?Bt(e.sender?.display_name)??Bt(e.sender_display_name):null,senderSpecialty:t?Bt(e.sender?.specialty):null,attachmentCount:e.attachment_count??0})}function Ht(e){let t=At.safeParse(e);return t.success?Mt(t.data):null}function $t(e){let t=n.z.array(At).safeParse(e);return t.success?/* @__PURE__ */Object.freeze(t.data.map(Mt)):null}function Wt(e){let t=n.z.array(Ot).safeParse(e);return t.success?/* @__PURE__ */Object.freeze(t.data.map(e=>/* @__PURE__ */Object.freeze({petRef:e.pet_ref,lastMessageAt:e.last_message_at,unreadCount:e.unread_count??0,ownerCanStart:e.owner_can_start??true,lastMessage:e.last_message?Mt(e.last_message):null}))):null}function
|
|
25
|
-
return Object.freeze({drug:n,strength:Bt(t.data.strength),form:Bt(t.data.form),sig:Bt(t.data.sig),quantity:r==null?null:Bt(String(r)),refills:t.data.refills??null})}function
|
|
26
|
-
return Object.freeze({consultId:n.consult_id,findingsText:n.findings_text??"",nextStepsText:n.next_steps_text??"",medications:/* @__PURE__ */Object.freeze((n.medications??[]).map(qt).filter(e=>e!==null)),productRefs:/* @__PURE__ */Object.freeze([...n.product_refs??[]]),actionItems:/* @__PURE__ */Object.freeze((n.action_items??[]).filter(e=>e.trim().length>0)),approvedAt:n.approved_at,approvedByName:Bt(n.approved_by_display_name),credentialsText:Bt(n.credentials_text)})}function isVetMessagesDark(e){return e.httpStatus===404}function isVetThreadVetFirst(e){return e.httpStatus===409}function Kt(e){return err(makeEverfurError("validationFailed",{retryable:false,wireMessage:e}))}function Yt(e){return err(makeEverfurError("internalError",{retryable:false,httpStatus:502,wireMessage:e}))}function Gt(e){return e===void 0||!Number.isFinite(e)?Rt:Math.min(zt,Math.max(1,Math.trunc(e)))}function Jt(e){return e.trim().length>0&&!Number.isNaN(Date.parse(e))}function Qt(e,t,n){try{e?.track(t,n)}catch{}}function Xt(e,t){return{async listVetThreads(t){let n=await e.send("televet.messages.threads",{method:"GET",path:Dt,...t?{signal:t}:{}});if(!n.ok)return err(n.error);let r=Wt(n.value);return r===null?Yt("the vet thread list was unreadable"):ok(r)},async listVetMessages(petRef,t={},n){let r=petRef.trim();if(r.length===0)return Kt("petRef is required");let l=t.before?.trim();if(l!==void 0&&l.length>0&&!Jt(l))return Kt("before must be an ISO date-time");let i=await e.send("televet.messages.thread",{method:"GET",path:televetThreadMessagesCall(r),query:{...l?{before:l}:{},limit:Gt(t.limit)},...n?{signal:n}:{}});if(!i.ok)return err(i.error);let o=$t(i.value);return o===null?Yt("the vet thread page was unreadable"):ok(o)},async sendVetMessage(petRef,n){let r=petRef.trim();if(r.length===0)return Kt("petRef is required");if(n.trim().length===0)return Kt("content must not be blank");if(n.length>Pt)return Kt(`content must be at most ${Pt} characters`);let l=await e.send("televet.messages.send",{method:"POST",path:televetThreadMessagesCall(r),body:{content:n}},{idempotent:false,maxAttempts:1});if(!l.ok)return Qt(t,"televet.messages.send_failed",{status:l.error.httpStatus??null}),err(l.error);let i=Ht(l.value);return i===null?Yt("the sent message was unreadable"):ok(i)},async markVetThreadRead(petRef,t){let n=petRef.trim();if(n.length===0)return Kt("petRef is required");if(!Jt(t))return Kt("readAt must be an ISO date-time");let r=await e.send("televet.messages.read",{method:"PUT",path:televetThreadReadCall(n),body:{read_at:t}});return r.ok?ok(void 0):err(r.error)},async visitSummary(t,n){let r=t.trim();if(r.length===0)return Kt("consultId is required");let l=await e.send("televet.messages.summary",{method:"GET",path:televetVisitSummaryCall(r),...n?{signal:n}:{}});if(!l.ok)return err(l.error);let i=Ut(l.value);return i===null?Yt("the visit summary was unreadable"):ok(i)}}}var Zt="/widget/v1/televet",en=`${Zt}/state-policy`,tn=`${Zt}/vets`,nn=`${Zt}/slots`,rn=`${Zt}/slots/next`,ln=`${Zt}/consults`,on=`${Zt}/entitlement`,an=`${Zt}/cancellation-policy`,sn=`${Zt}/attachments/initiate`,cn=`${ln}/triage`;function televetHoldCall(e){return`${nn}/${encodeURIComponent(e)}/hold`}function televetRescheduleCall(e){return`${ln}/${encodeURIComponent(e)}/reschedule`}function televetConsultCall(e){return`${ln}/${encodeURIComponent(e)}`}function televetJoinCall(e){return`${televetConsultCall(e)}/join`}function televetCancelCall(e){return`${televetConsultCall(e)}/cancel`}var dn=100;function un(e){return err(makeEverfurError("validationFailed",{retryable:false,wireMessage:e}))}function pn(e){return err(makeEverfurError("internalError",{retryable:false,httpStatus:502,wireMessage:e}))}function hn(e){return e.httpStatus===404}function fn(e,t,n){try{e?.track(t,n)}catch{}}function validateBookingBody(e){if(e.pet_id.trim().length===0)return"pet_id is required";if(e.clinician_id.trim().length===0)return"clinician_id is required";if(e.slot_id.trim().length===0)return"slot_id is required";if(!isWellFormedStateCode(e.state))return"state must be a two-letter US state code";let t=e.reason_text.trim();return t.length===0?"reason_text is required":t.length>g?`reason_text must be at most ${g} characters`:mn(e)}function mn(e){let t=e.state_attested===true,n=e.cancellation_policy_version?.trim()??"";return t!==n.length>0?"state_attested and cancellation_policy_version must be sent together or omitted together":n.length>m?`cancellation_policy_version must be at most ${m} characters`:null}function createTelevetBookingController(e){let t=e.funnel??createRequestFunnel({auth:e.auth,...e.errorPolicy?{errorPolicy:e.errorPolicy}:{}}),n=e.telemetry;return{...Xt(t,n),async statePolicy(e,n){let r=e.trim();if(!isWellFormedStateCode(r))return un("state must be a two-letter US state code");let l=await t.send("televet.booking.state_policy",{method:"GET",path:`${en}/${encodeURIComponent(r)}`,...n?{signal:n}:{}});if(!l.ok)return err(l.error);let i=j(l.value,r);return i===null?pn("the state policy response was unreadable"):ok(i)},async entitlement(e){let n=await t.send("televet.booking.entitlement",{method:"GET",path:on,...e?{signal:e}:{}});return n.ok?ok(z(n.value)):err(n.error)},async cancellationPolicy(e){let n=await t.send("televet.booking.cancellation_policy",{method:"GET",path:an,...e?{signal:e}:{}});return n.ok?ok(C(n.value)):ok(null)},async clinicians(e,n){let r=e.trim();if(!isWellFormedStateCode(r))return un("state must be a two-letter US state code");let l=await t.send("televet.booking.clinicians",{method:"GET",path:tn,query:{state:r},...n?{signal:n}:{}});return l.ok?ok(S(yn(l.value,"vets"),_)):hn(l.error)?ok(/* @__PURE__ */Object.freeze([])):err(l.error)},async slots(e,n){let r=e.trim();if(r.length===0)return un("clinicianId is required");let l=await t.send("televet.booking.slots",{method:"GET",path:nn,query:{clinician_id:r},...n?{signal:n}:{}});return l.ok?ok(S(yn(l.value,"slots"),E)):hn(l.error)?ok(/* @__PURE__ */Object.freeze([])):err(l.error)},async nextSlot(e){let n=await t.send("televet.booking.next_slot",{method:"GET",path:rn,...e?{signal:e}:{}});return n.ok?ok(E(unwrap(n.value,"slot"))):ok(null)},async holdSlot(e){let r=e.trim();if(r.length===0)return un("slotId is required");let l=await t.send("televet.booking.hold",{method:"POST",path:televetHoldCall(r)},{idempotent:false,maxAttempts:1});if(!l.ok)return fn(n,"televet.booking.hold_failed",{status:l.error.httpStatus??null}),err(l.error);let i=P(l.value);return i===null?pn("the hold response carried no usable expiry"):ok(i)},async releaseHold(e){let n=e.trim();if(n.length===0)return un("slotId is required");let r=await t.send("televet.booking.release_hold",{method:"DELETE",path:televetHoldCall(n)},{idempotent:false,maxAttempts:1});return!r.ok&&r.error.httpStatus!==404?err(r.error):ok(void 0)},async book(e,r){let l=validateBookingBody(e);if(l!==null)return un(l);let i=r.trim();if(i.length===0)return un("idempotencyKey is required");let o=await t.send("televet.booking.book",{method:"POST",path:ln,body:gn(e)},{idempotent:true,idempotencyKey:i,maxAttempts:1});if(!o.ok)return fn(n,"televet.booking.book_failed",{status:o.error.httpStatus??null}),err(vt(o.error));let a=R(o.value);return a===null?pn("the booking response was unreadable"):u(a)?ok(a):(fn(n,"televet.booking.book_failed",{status:null,consult_status:a.status}),err(gt(a.status)))},async reschedule(e,r){let l=e.trim(),i=r.trim();if(l.length===0)return un("consultId is required");if(i.length===0)return un("slotId is required");let o=await t.send("televet.booking.reschedule",{method:"POST",path:televetRescheduleCall(l),body:{new_slot_id:i}},{idempotent:false,maxAttempts:1});if(!o.ok)return fn(n,"televet.booking.reschedule_failed",{status:o.error.httpStatus??null}),err(o.error);let a=R(o.value);return a===null?pn("the reschedule response was unreadable"):ok(a)},async triage(e,r){let l=e.trim();if(l.length===0)return ok(null);let i=await t.send("televet.booking.triage",{method:"POST",path:cn,body:{reason_text:l},...r?{signal:r}:{}},{idempotent:false,maxAttempts:1});return i.ok?ok(D(i.value)):(fn(n,"televet.booking.triage_unavailable",{status:i.error.httpStatus??null}),ok(null))},async listConsults(e){let n=await t.send("televet.booking.consults",{method:"GET",path:ln,query:{limit:String(dn)},...e?{signal:e}:{}});return n.ok?ok(S(yn(n.value,"consults"),R)):hn(n.error)?ok(/* @__PURE__ */Object.freeze([])):err(n.error)},async getConsult(e,n){let r=e.trim();if(r.length===0)return un("consultId is required");let l=await t.send("televet.booking.consult",{method:"GET",path:televetConsultCall(r),...n?{signal:n}:{}});if(!l.ok)return err(l.error);let i=R(l.value);return i===null?pn("the consult response was unreadable"):ok(i)},async joinConsult(e){let r=e.trim();if(r.length===0)return un("consultId is required");let l=await t.send("televet.booking.join",{method:"POST",path:televetJoinCall(r)},{idempotent:false,maxAttempts:1});if(!l.ok)return fn(n,"televet.booking.join_failed",{status:l.error.httpStatus??null}),err(l.error);let i=parseVetCallCredential(l.value);return i===null?pn("the join response carried no usable room credential"):ok(i)},async cancelConsult(e,r){let l=e.trim(),i=r.trim();if(l.length===0)return un("consultId is required");if(i.length===0)return un("reason is required");if(i.length>F)return un(`reason must be at most ${F} characters`);let o=await t.send("televet.booking.cancel",{method:"POST",path:televetCancelCall(l),body:{reason:i}},{idempotent:false,maxAttempts:1});if(!o.ok)return fn(n,"televet.booking.cancel_failed",{status:o.error.httpStatus??null}),err(o.error);let a=L(o.value);return a===null?pn("the cancel response was unreadable"):ok(a)},async initiateAttachment(e,n){let r=await t.send("televet.booking.attachment_initiate",{method:"POST",path:sn,body:{filename:e.filename,content_type:e.contentType,file_size:e.fileSize},...n?{signal:n}:{}});if(!r.ok)return err(r.error);let l=pt(r.value);return l===null?pn("the attachment presign was unreadable"):ok(l)}}}function gn(e){let t=e.cancellation_policy_version?.trim()??"",n=e.state_attested===true&&t.length>0;return{pet_id:e.pet_id,clinician_id:e.clinician_id,slot_id:e.slot_id,state:e.state,reason_text:e.reason_text.trim(),species:e.species,media_refs:[...e.media_refs],emergency_acknowledged:e.emergency_acknowledged,share_health_records:e.share_health_records,...n?{state_attested:true,cancellation_policy_version:t}:{}}}function yn(e,t){if(Array.isArray(e))return e;if(typeof e=="object"&&e!==null){let n=e,r=n[t]??n.items??n.data;if(Array.isArray(r))return r}return e}function unwrap(e,t){if(typeof e=="object"&&e!==null&&!Array.isArray(e)){let n=e,r=n[t]??n.data;if(typeof r=="object"&&r!==null)return r}return e}var bn=/* @__PURE__ */Symbol.for("@everfur/sdk#EverfurContext@v1"),vn=globalThis,xn=vn[bn]??(vn[bn]=e.createContext(null));xn.displayName??="EverfurContext";function Tn(){let t=e.useContext(xn);if(t===null)throw new we("not-initialized","Everfur hooks must be called inside <EverfurProvider>. Wrap your tree once, high.");return t}var wn=/* @__PURE__ */Object.freeze({chat:/* @__PURE__ */Object.freeze(["chat.message.create"]),records:/* @__PURE__ */Object.freeze(["records.upload.create","records.record.read"]),recordsClinic:/* @__PURE__ */Object.freeze(["records.clinic.create"]),video:/* @__PURE__ */Object.freeze(["video.gait.execute"]),photo:/* @__PURE__ */Object.freeze(["photo.checkup.execute"]),animations:/* @__PURE__ */Object.freeze(["animations.state.read"]),televet:/* @__PURE__ */Object.freeze(["televet.visit.create"]),texting:/* @__PURE__ */Object.freeze(["sms.identity.read","sms.identity.update"]),healthPlan:/* @__PURE__ */Object.freeze(["shop.plan.read","shop.plan.update"])});function requires(e){return wn[e]}function decideCapability(e,t,n){let r=requires(e),l=/* @__PURE__ */new Map;for(let e of t)l.set(e.resource,e);if(n?.isPending===true&&r.some(e=>!l.has(e)))return jn({name:e,enabled:false,isPending:true,limits:{}});let i=kn(r,l);return r.filter(e=>l.get(e)?.granted!==true).length===0?jn({name:e,enabled:true,isPending:false,limits:i}):jn({name:e,enabled:false,isPending:false,limits:i,disabled:Sn(r,l)})}function kn(e,t){let n={};for(let r of e){let e=t.get(r)?.limits;if(e)for(let[t,r]of Object.entries(e)){let e=n[t];n[t]=e===void 0?r:Math.min(e,r)}}return n}function Sn(e,t){for(let n of e){let e=t.get(n)?.disabled;if(e)/* @__PURE__ */
|
|
24
|
+
return Object.freeze({messageId:e.message_id,petRef:e.pet_ref,role:e.role,content:e.content,createdAt:e.created_at,senderName:t?Bt(e.sender?.display_name)??Bt(e.sender_display_name):null,senderSpecialty:t?Bt(e.sender?.specialty):null,attachmentCount:e.attachment_count??0})}function Ht(e){let t=At.safeParse(e);return t.success?Mt(t.data):null}function $t(e){let t=n.z.array(At).safeParse(e);return t.success?/* @__PURE__ */Object.freeze(t.data.map(Mt)):null}function Wt(e){let t=n.z.array(Ot).safeParse(e);return t.success?/* @__PURE__ */Object.freeze(t.data.map(e=>/* @__PURE__ */Object.freeze({petRef:e.pet_ref,lastMessageAt:e.last_message_at,unreadCount:e.unread_count??0,ownerCanStart:e.owner_can_start??true,lastMessage:e.last_message?Mt(e.last_message):null}))):null}function Ut(e){let t=Vt.safeParse(e);if(!t.success)return null;let n=Bt(t.data.drug);if(n===null)return null;let r=t.data.quantity;/* @__PURE__ */
|
|
25
|
+
return Object.freeze({drug:n,strength:Bt(t.data.strength),form:Bt(t.data.form),sig:Bt(t.data.sig),quantity:r==null?null:Bt(String(r)),refills:t.data.refills??null})}function qt(e){let t=Nt.safeParse(e);if(!t.success)return null;let n=t.data;/* @__PURE__ */
|
|
26
|
+
return Object.freeze({consultId:n.consult_id,findingsText:n.findings_text??"",nextStepsText:n.next_steps_text??"",medications:/* @__PURE__ */Object.freeze((n.medications??[]).map(Ut).filter(e=>e!==null)),productRefs:/* @__PURE__ */Object.freeze([...n.product_refs??[]]),actionItems:/* @__PURE__ */Object.freeze((n.action_items??[]).filter(e=>e.trim().length>0)),approvedAt:n.approved_at,approvedByName:Bt(n.approved_by_display_name),credentialsText:Bt(n.credentials_text)})}function isVetMessagesDark(e){return e.httpStatus===404}function isVetThreadVetFirst(e){return e.httpStatus===409}function Kt(e){return err(makeEverfurError("validationFailed",{retryable:false,wireMessage:e}))}function Yt(e){return err(makeEverfurError("internalError",{retryable:false,httpStatus:502,wireMessage:e}))}function Gt(e){return e===void 0||!Number.isFinite(e)?Rt:Math.min(zt,Math.max(1,Math.trunc(e)))}function Jt(e){return e.trim().length>0&&!Number.isNaN(Date.parse(e))}function Qt(e,t,n){try{e?.track(t,n)}catch{}}function Xt(e,t){return{async listVetThreads(t){let n=await e.send("televet.messages.threads",{method:"GET",path:Dt,...t?{signal:t}:{}});if(!n.ok)return err(n.error);let r=Wt(n.value);return r===null?Yt("the vet thread list was unreadable"):ok(r)},async listVetMessages(petRef,t={},n){let r=petRef.trim();if(r.length===0)return Kt("petRef is required");let l=t.before?.trim();if(l!==void 0&&l.length>0&&!Jt(l))return Kt("before must be an ISO date-time");let i=await e.send("televet.messages.thread",{method:"GET",path:televetThreadMessagesCall(r),query:{...l?{before:l}:{},limit:Gt(t.limit)},...n?{signal:n}:{}});if(!i.ok)return err(i.error);let o=$t(i.value);return o===null?Yt("the vet thread page was unreadable"):ok(o)},async sendVetMessage(petRef,n){let r=petRef.trim();if(r.length===0)return Kt("petRef is required");if(n.trim().length===0)return Kt("content must not be blank");if(n.length>Pt)return Kt(`content must be at most ${Pt} characters`);let l=await e.send("televet.messages.send",{method:"POST",path:televetThreadMessagesCall(r),body:{content:n}},{idempotent:false,maxAttempts:1});if(!l.ok)return Qt(t,"televet.messages.send_failed",{status:l.error.httpStatus??null}),err(l.error);let i=Ht(l.value);return i===null?Yt("the sent message was unreadable"):ok(i)},async markVetThreadRead(petRef,t){let n=petRef.trim();if(n.length===0)return Kt("petRef is required");if(!Jt(t))return Kt("readAt must be an ISO date-time");let r=await e.send("televet.messages.read",{method:"PUT",path:televetThreadReadCall(n),body:{read_at:t}});return r.ok?ok(void 0):err(r.error)},async visitSummary(t,n){let r=t.trim();if(r.length===0)return Kt("consultId is required");let l=await e.send("televet.messages.summary",{method:"GET",path:televetVisitSummaryCall(r),...n?{signal:n}:{}});if(!l.ok)return err(l.error);let i=qt(l.value);return i===null?Yt("the visit summary was unreadable"):ok(i)}}}var Zt="/widget/v1/televet",en=`${Zt}/state-policy`,tn=`${Zt}/vets`,nn=`${Zt}/slots`,rn=`${Zt}/slots/next`,ln=`${Zt}/consults`,on=`${Zt}/entitlement`,an=`${Zt}/cancellation-policy`,sn=`${Zt}/attachments/initiate`,cn=`${ln}/triage`;function televetHoldCall(e){return`${nn}/${encodeURIComponent(e)}/hold`}function televetRescheduleCall(e){return`${ln}/${encodeURIComponent(e)}/reschedule`}function televetConsultCall(e){return`${ln}/${encodeURIComponent(e)}`}function televetJoinCall(e){return`${televetConsultCall(e)}/join`}function televetCancelCall(e){return`${televetConsultCall(e)}/cancel`}var dn=100;function un(e){return err(makeEverfurError("validationFailed",{retryable:false,wireMessage:e}))}function pn(e){return err(makeEverfurError("internalError",{retryable:false,httpStatus:502,wireMessage:e}))}function hn(e){return e.httpStatus===404}function fn(e,t,n){try{e?.track(t,n)}catch{}}function validateBookingBody(e){if(e.pet_id.trim().length===0)return"pet_id is required";if(e.clinician_id.trim().length===0)return"clinician_id is required";if(e.slot_id.trim().length===0)return"slot_id is required";if(!isWellFormedStateCode(e.state))return"state must be a two-letter US state code";let t=e.reason_text.trim();return t.length===0?"reason_text is required":t.length>g?`reason_text must be at most ${g} characters`:mn(e)}function mn(e){let t=e.state_attested===true,n=e.cancellation_policy_version?.trim()??"";return t!==n.length>0?"state_attested and cancellation_policy_version must be sent together or omitted together":n.length>m?`cancellation_policy_version must be at most ${m} characters`:null}function createTelevetBookingController(e){let t=e.funnel??createRequestFunnel({auth:e.auth,...e.errorPolicy?{errorPolicy:e.errorPolicy}:{}}),n=e.telemetry;return{...Xt(t,n),async statePolicy(e,n){let r=e.trim();if(!isWellFormedStateCode(r))return un("state must be a two-letter US state code");let l=await t.send("televet.booking.state_policy",{method:"GET",path:`${en}/${encodeURIComponent(r)}`,...n?{signal:n}:{}});if(!l.ok)return err(l.error);let i=j(l.value,r);return i===null?pn("the state policy response was unreadable"):ok(i)},async entitlement(e){let n=await t.send("televet.booking.entitlement",{method:"GET",path:on,...e?{signal:e}:{}});return n.ok?ok(z(n.value)):err(n.error)},async cancellationPolicy(e){let n=await t.send("televet.booking.cancellation_policy",{method:"GET",path:an,...e?{signal:e}:{}});return n.ok?ok(C(n.value)):ok(null)},async clinicians(e,n){let r=e.trim();if(!isWellFormedStateCode(r))return un("state must be a two-letter US state code");let l=await t.send("televet.booking.clinicians",{method:"GET",path:tn,query:{state:r},...n?{signal:n}:{}});return l.ok?ok(S(yn(l.value,"vets"),_)):hn(l.error)?ok(/* @__PURE__ */Object.freeze([])):err(l.error)},async slots(e,n){let r=e.trim();if(r.length===0)return un("clinicianId is required");let l=await t.send("televet.booking.slots",{method:"GET",path:nn,query:{clinician_id:r},...n?{signal:n}:{}});return l.ok?ok(S(yn(l.value,"slots"),E)):hn(l.error)?ok(/* @__PURE__ */Object.freeze([])):err(l.error)},async nextSlot(e){let n=await t.send("televet.booking.next_slot",{method:"GET",path:rn,...e?{signal:e}:{}});return n.ok?ok(E(unwrap(n.value,"slot"))):ok(null)},async holdSlot(e){let r=e.trim();if(r.length===0)return un("slotId is required");let l=await t.send("televet.booking.hold",{method:"POST",path:televetHoldCall(r)},{idempotent:false,maxAttempts:1});if(!l.ok)return fn(n,"televet.booking.hold_failed",{status:l.error.httpStatus??null}),err(l.error);let i=P(l.value);return i===null?pn("the hold response carried no usable expiry"):ok(i)},async releaseHold(e){let n=e.trim();if(n.length===0)return un("slotId is required");let r=await t.send("televet.booking.release_hold",{method:"DELETE",path:televetHoldCall(n)},{idempotent:false,maxAttempts:1});return!r.ok&&r.error.httpStatus!==404?err(r.error):ok(void 0)},async book(e,r){let l=validateBookingBody(e);if(l!==null)return un(l);let i=r.trim();if(i.length===0)return un("idempotencyKey is required");let o=await t.send("televet.booking.book",{method:"POST",path:ln,body:gn(e)},{idempotent:true,idempotencyKey:i,maxAttempts:1});if(!o.ok)return fn(n,"televet.booking.book_failed",{status:o.error.httpStatus??null}),err(vt(o.error));let a=R(o.value);return a===null?pn("the booking response was unreadable"):u(a)?ok(a):(fn(n,"televet.booking.book_failed",{status:null,consult_status:a.status}),err(gt(a.status)))},async reschedule(e,r){let l=e.trim(),i=r.trim();if(l.length===0)return un("consultId is required");if(i.length===0)return un("slotId is required");let o=await t.send("televet.booking.reschedule",{method:"POST",path:televetRescheduleCall(l),body:{new_slot_id:i}},{idempotent:false,maxAttempts:1});if(!o.ok)return fn(n,"televet.booking.reschedule_failed",{status:o.error.httpStatus??null}),err(o.error);let a=R(o.value);return a===null?pn("the reschedule response was unreadable"):ok(a)},async triage(e,r){let l=e.trim();if(l.length===0)return ok(null);let i=await t.send("televet.booking.triage",{method:"POST",path:cn,body:{reason_text:l},...r?{signal:r}:{}},{idempotent:false,maxAttempts:1});return i.ok?ok(D(i.value)):(fn(n,"televet.booking.triage_unavailable",{status:i.error.httpStatus??null}),ok(null))},async listConsults(e){let n=await t.send("televet.booking.consults",{method:"GET",path:ln,query:{limit:String(dn)},...e?{signal:e}:{}});return n.ok?ok(S(yn(n.value,"consults"),R)):hn(n.error)?ok(/* @__PURE__ */Object.freeze([])):err(n.error)},async getConsult(e,n){let r=e.trim();if(r.length===0)return un("consultId is required");let l=await t.send("televet.booking.consult",{method:"GET",path:televetConsultCall(r),...n?{signal:n}:{}});if(!l.ok)return err(l.error);let i=R(l.value);return i===null?pn("the consult response was unreadable"):ok(i)},async joinConsult(e){let r=e.trim();if(r.length===0)return un("consultId is required");let l=await t.send("televet.booking.join",{method:"POST",path:televetJoinCall(r)},{idempotent:false,maxAttempts:1});if(!l.ok)return fn(n,"televet.booking.join_failed",{status:l.error.httpStatus??null}),err(l.error);let i=parseVetCallCredential(l.value);return i===null?pn("the join response carried no usable room credential"):ok(i)},async cancelConsult(e,r){let l=e.trim(),i=r.trim();if(l.length===0)return un("consultId is required");if(i.length===0)return un("reason is required");if(i.length>F)return un(`reason must be at most ${F} characters`);let o=await t.send("televet.booking.cancel",{method:"POST",path:televetCancelCall(l),body:{reason:i}},{idempotent:false,maxAttempts:1});if(!o.ok)return fn(n,"televet.booking.cancel_failed",{status:o.error.httpStatus??null}),err(o.error);let a=L(o.value);return a===null?pn("the cancel response was unreadable"):ok(a)},async initiateAttachment(e,n){let r=await t.send("televet.booking.attachment_initiate",{method:"POST",path:sn,body:{filename:e.filename,content_type:e.contentType,file_size:e.fileSize},...n?{signal:n}:{}});if(!r.ok)return err(r.error);let l=pt(r.value);return l===null?pn("the attachment presign was unreadable"):ok(l)}}}function gn(e){let t=e.cancellation_policy_version?.trim()??"",n=e.state_attested===true&&t.length>0;return{pet_id:e.pet_id,clinician_id:e.clinician_id,slot_id:e.slot_id,state:e.state,reason_text:e.reason_text.trim(),species:e.species,media_refs:[...e.media_refs],emergency_acknowledged:e.emergency_acknowledged,share_health_records:e.share_health_records,...n?{state_attested:true,cancellation_policy_version:t}:{}}}function yn(e,t){if(Array.isArray(e))return e;if(typeof e=="object"&&e!==null){let n=e,r=n[t]??n.items??n.data;if(Array.isArray(r))return r}return e}function unwrap(e,t){if(typeof e=="object"&&e!==null&&!Array.isArray(e)){let n=e,r=n[t]??n.data;if(typeof r=="object"&&r!==null)return r}return e}var bn=/* @__PURE__ */Symbol.for("@everfur/sdk#EverfurContext@v1"),vn=globalThis,xn=vn[bn]??(vn[bn]=e.createContext(null));xn.displayName??="EverfurContext";function Tn(){let t=e.useContext(xn);if(t===null)throw new ke("not-initialized","Everfur hooks must be called inside <EverfurProvider>. Wrap your tree once, high.");return t}var kn=/* @__PURE__ */Object.freeze({chat:/* @__PURE__ */Object.freeze(["chat.message.create"]),records:/* @__PURE__ */Object.freeze(["records.upload.create","records.record.read"]),recordsClinic:/* @__PURE__ */Object.freeze(["records.clinic.create"]),video:/* @__PURE__ */Object.freeze(["video.gait.execute"]),photo:/* @__PURE__ */Object.freeze(["photo.checkup.execute"]),animations:/* @__PURE__ */Object.freeze(["animations.state.read"]),televet:/* @__PURE__ */Object.freeze(["televet.visit.create"]),texting:/* @__PURE__ */Object.freeze(["sms.identity.read","sms.identity.update"]),healthPlan:/* @__PURE__ */Object.freeze(["shop.plan.read","shop.plan.update"])});function requires(e){return kn[e]}function decideCapability(e,t,n){let r=requires(e),l=/* @__PURE__ */new Map;for(let e of t)l.set(e.resource,e);if(n?.isPending===true&&r.some(e=>!l.has(e)))return jn({name:e,enabled:false,isPending:true,limits:{}});let i=wn(r,l);return r.filter(e=>l.get(e)?.granted!==true).length===0?jn({name:e,enabled:true,isPending:false,limits:i}):jn({name:e,enabled:false,isPending:false,limits:i,disabled:Sn(r,l)})}function wn(e,t){let n={};for(let r of e){let e=t.get(r)?.limits;if(e)for(let[t,r]of Object.entries(e)){let e=n[t];n[t]=e===void 0?r:Math.min(e,r)}}return n}function Sn(e,t){for(let n of e){let e=t.get(n)?.disabled;if(e)/* @__PURE__ */
|
|
27
27
|
return Object.freeze({reason:e.reason,level:e.level,recoverable:e.recoverable})}/* @__PURE__ */
|
|
28
28
|
return Object.freeze({reason:userFacingError("accessDenied"),level:"user_entitlement",recoverable:false})}function jn(e){let t={name:e.name,enabled:e.enabled,isPending:e.isPending,limits:/* @__PURE__ */Object.freeze({...e.limits})};return e.disabled!==void 0&&(t.disabled=e.disabled),/* @__PURE__ */Object.freeze(t)}function useCapability(t){let{runtime:n}=Tn(),r=n.entitlements,l=e.useSyncExternalStore(r.subscribe,r.getSnapshot,r.getSnapshot);return e.useMemo(()=>decideCapability(t,l.decisions,{isPending:l.isPending}),[t,l])}var Cn=/* @__PURE__ */Object.freeze({idle:/* @__PURE__ */Object.freeze({title:"Find your pet’s clinic",body:"Search for the clinic that holds your pet’s records. We’ll request them on your behalf once you sign the authorization.",action:null}),no_requests:/* @__PURE__ */Object.freeze({title:"No record requests yet",body:"When you request records from a clinic, you’ll be able to track every step here.",action:null}),no_records:/* @__PURE__ */Object.freeze({title:"Nothing to show just yet",body:"Once your pet’s records arrive and our team reviews them, lab trends and visits will appear here.",action:null}),rate_limited:/* @__PURE__ */Object.freeze({title:"Slow down a moment",body:"You’ve made a lot of requests just now. You can try again shortly.",action:"Try again"}),service_unavailable:/* @__PURE__ */Object.freeze({title:"Records search is temporarily down",body:"We’re working on it. Please try again in a few minutes.",action:"Try again"}),error:/* @__PURE__ */Object.freeze({title:"Couldn’t reach Everfur",body:"Check your connection and try again.",action:"Try again"})}),_n=60;var In=/* @__PURE__ */Object.freeze({title:Cn.rate_limited.title,body:Cn.rate_limited.body});function En(e){return e!=null&&(e.code==="rateLimited"||e.httpStatus===429)}function Dn(e,t){return Ge(e,t)??_n*1e3}function Pn(t){let n=En(t),[r,l]=e.useState(null);return e.useEffect(()=>{if(!n||t==null)return;let e=setTimeout(()=>l(t),Dn(t,Date.now()));return()=>clearTimeout(e)},[t,n]),{rateLimited:n,waiting:n&&r!==t}}var Rn=3e4;function zn(e={}){let t=e.now??Date.now,n=/* @__PURE__ */new Map,r=e=>e!==void 0&&e.settled!==null&&t()<e.keptUntil?e.settled:null,l=(e,t,r)=>{let l=t.promise;t.waiters+=1;let i=()=>{t.waiters-=1,t.waiters===0&&t.promise!==null&&(t.abort.abort(),n.get(e)===t&&n.delete(e))};return r.aborted?(i(),l):(r.addEventListener("abort",i,{once:true}),l.finally(()=>r.removeEventListener("abort",i)))},i=(e,r,l,i)=>{if(r.promise=null,n.get(e)!==r||r.abort.signal.aborted){n.get(e)===r&&n.delete(e);return}l.ok&&i>0?(r.settled=l,r.keptUntil=t()+i):!l.ok&&En(l.error)?(r.settled=l,r.keptUntil=t()+Dn(l.error,t())):n.delete(e)};/* @__PURE__ */
|
|
29
|
-
return Object.freeze({read(e,t,o){let a=n.get(e);if(a?.promise)return l(e,a,o.signal);let s=r(a);if(s!==null&&(o.force!==true||!s.ok&&En(s.error)))return Promise.resolve(s);let c={abort:new AbortController,promise:null,settled:null,keptUntil:0,waiters:0};return n.set(e,c),c.promise=t(c.abort.signal).then(t=>(i(e,c,t,o.freshMs),t),t=>{throw c.promise=null,n.get(e)===c&&n.delete(e),t}),l(e,c,o.signal)},peek(e){return r(n.get(e))},invalidate(e){for(let t of[...n.keys()])e.some(e=>t.startsWith(e))&&n.delete(t)}})}var Fn=/* @__PURE__ */new WeakMap;function Ln(e){let t=Fn.get(e);return t===void 0&&(t=zn(),Fn.set(e,t)),t}var An=/* @__PURE__ */Object.freeze(["slots:","next-slot"]),On=/* @__PURE__ */Object.freeze(["consults:","consult:","slots:","next-slot"]);function Vn(e,t){Fn.get(e)?.invalidate(t)}function useTelevetBookingController(t){let{runtime:n,userRef:userRef,scopeEpoch:r}=Tn();return e.useMemo(()=>t||(userRef===null?null:Bn(n,`${userRef}\0${r}`,()=>{let{services:e}=n.registry;return createTelevetBookingController({auth:e.authFor(userRef),telemetry:e.telemetry,...e.errorPolicy?{errorPolicy:e.errorPolicy}:{}})})),[n,userRef,r,t])}var Nn=/* @__PURE__ */new WeakMap;function Bn(e,t,n){let r=Nn.get(e);if(r!==void 0&&r.scope===t)return r.controller;let l=n();return Nn.set(e,{scope:t,controller:l}),l}function useTelevetBookingAvailable(){let{userRef:userRef}=Tn(),t=useCapability("televet");return e.useMemo(()=>({available:t.enabled&&userRef!==null,isPending:t.isPending}),[t.enabled,t.isPending,userRef])}function Mn(t,n,r,l,i=Rn,o=false){let[a,s]=e.useState(()=>{let e=n&&r!==null&&l!==null&&!o?Ln(l).peek(t):null;return e!==null?e.ok?{key:t,data:e.value,isPending:false,error:null}:{key:t,data:null,isPending:false,error:e.error}:{key:t,data:null,isPending:n&&r!==null,error:null}}),[c,d]=e.useState(0),u=e.useRef(r);u.current=r;let p=e.useRef(l);p.current=l;let h=e.useRef(o);e.useEffect(()=>{let e=u.current;if(!n||e===null){s({key:t,data:null,isPending:false,error:null});return}let r=h.current;h.current=false;let l=p.current===null?null:Ln(p.current),o=r||l===null?null:l.peek(t);if(o!==null){s(o.ok?{key:t,data:o.value,isPending:false,error:null}:{key:t,data:null,isPending:false,error:o.error});return}let a=new AbortController,c=true;return s(e=>e.key===t?{...e,isPending:true,error:null}:{key:t,data:null,isPending:true,error:null}),(async()=>{let n;try{n=l===null?await e(a.signal):await l.read(t,e,{signal:a.signal,freshMs:i,force:r})}catch{c&&s({key:t,data:null,isPending:false,error:null});return}c&&(n.ok?s({key:t,data:n.value,isPending:false,error:null}):s({key:t,data:null,isPending:false,error:n.error}))})(),()=>{c=false,a.abort()}},[t,n,c]);let f=e.useCallback(()=>{h.current=true,d(e=>e+1)},[]),m=a.key===t;return e.useMemo(()=>({enabled:n,data:m?a.data:null,isPending:n&&(!m||a.isPending),isError:m&&a.error!==null,error:m?a.error:null,refetch:f}),[n,m,a.data,a.isPending,a.error,f])}function useTelevetStatePolicy(e,t){let n=e?.trim()??"",r=t?.statePolicy!==void 0&&isWellFormedStateCode(n),l=t?.statePolicy;return Mn(`state-policy:${n}`,r,r&&l?e=>l.call(t,n,e):null,t)}function useTelevetBookingEntitlement(e){let t=e?.entitlement!==void 0,n=e?.entitlement;return Mn("entitlement",t,t&&n?t=>n.call(e,t):null,e,0)}function useTelevetCancellationPolicy(e){let t=e?.cancellationPolicy!==void 0,n=e?.cancellationPolicy;return Mn("cancellation-policy",t,t&&n?t=>n.call(e,t):null,e)}function useTelevetClinicians(e,t){let n=e?.trim()??"",r=t?.clinicians!==void 0&&isWellFormedStateCode(n),l=t?.clinicians;return Mn(`clinicians:${n}`,r,r&&l?e=>l.call(t,n,e):null,t)}function useTelevetSlots(e,t){let n=e?.trim()??"",r=t!==null&&n.length>0;return Mn(`slots:${n}`,r,r&&t?e=>t.slots(n,e):null,t)}function useTelevetNextSlot(e){let t=e?.nextSlot!==void 0,n=e?.nextSlot;return Mn("next-slot",t,t&&n?t=>n.call(e,t):null,e)}function Hn(t){let[n,r]=e.useState(null),l=e.useRef(true),i=e.useRef(false),o=e.useRef(t);o.current=t,e.useEffect(()=>(l.current=true,()=>{l.current=false}),[]);let a=e.useCallback((...e)=>{let t=o.current;if(t===null||i.current)return;let n=e[e.length-1],a=typeof n=="object"&&n!==null&&("onSuccess"in n||"onError"in n),s=a?n:void 0,c=a?e.slice(0,-1):e;i.current=true,r({variables:c[0]??null}),(async()=>{let e=null;try{e=await t(...c)}catch{e=null}i.current=false,l.current&&r(null),e!==null&&(e.ok?s?.onSuccess?.(e.value):s?.onError?.(e.error))})()},[]);return e.useMemo(()=>({isPending:n!==null,variables:n?.variables??null,mutate:a}),[n,a])}async function $n(e,t,n){let r=await n;return r.ok&&Vn(e,t),r}function useTelevetHoldSlot(e){return Hn(e?t=>$n(e,An,e.holdSlot(t)):null)}function useTelevetBookConsult(e){return Hn(e?(t,n)=>$n(e,On,e.book(t,n)):null)}function useTelevetRescheduleConsult(e,t){return Hn(t&&e?n=>$n(t,On,t.reschedule(e,n)):null)}function Wn(e,t=0,n){let r=e?.listConsults!==void 0,l=e?.listConsults;return Mn(`consults:${t}`,r,r&&l?t=>l.call(e,t):null,e,Rn,n?.reread===true)}function qn(e,t,n=0){let r=e?.trim()??"",l=t?.getConsult!==void 0&&r.length>0,i=t?.getConsult;return Mn(`consult:${r}:${n}`,l,l&&i?e=>i.call(t,r,e):null,t)}function Un(e,t){let n=t?.cancelConsult;return Hn(t&&n&&e?r=>$n(t,On,n.call(t,e,r)):null)}function Kn(e){return e.error!==null&&e.error.httpStatus===404}function Yn(e){let t=Wn(e);if(!t.enabled)return"booking";if(t.isPending)return"pending";if(t.isError)return"visits";let{upcoming:n,past:r}=splitTelevetVisits(t.data??[],Date.now());return n.length>0||r.length>0?"visits":"booking"}var Gn=/* @__PURE__ */Object.freeze({regular:"regular",medium:"medium",bold:"bold",mono:"regular",monoMedium:"medium",monoBold:"bold"});function face(e,t){let n=e.type,r=n.families[t];return t==="mono"||n.namedFaces[t]?{fontFamily:r}:{fontFamily:r,fontWeight:n.weight[Gn[t]]}}function headingFace(e,t="bold"){let{headingFamily:n,headingWeight:r}=e.type;if(n===null&&r===null)return face(e,t);if(n!==null)return{fontFamily:n,fontWeight:r??e.type.weight[Gn[t]]};let l=face(e,t);return l.fontWeight===void 0||r===null?l:{fontFamily:l.fontFamily,fontWeight:r}}function Jn(e){return e<=450?"regular":e<=650?"medium":"bold"}var Qn={regular:"mono",medium:"monoMedium",bold:"monoBold"};function textRole(e,t){let n=Xn.get(e);n===void 0&&(n=/* @__PURE__ */new Map,Xn.set(e,n));let r=n.get(t);if(r!==void 0)return r;let l=Zn(e,t);return n.set(t,l),l}var Xn=/* @__PURE__ */new WeakMap;function Zn(e,t){let n=e.type.roles[t],r=n.weight==="400"&&n.face!=="mono"?e.type.weight.regular:n.weight,l=Jn(Number(r)),i=n.face==="mono"?face(e,Qn[l]):n.face==="heading"?headingFace(e,l):face(e,l),o=n.face==="heading"?e.type.headingWeight??r:r,a=i.fontWeight===void 0?i:{fontFamily:i.fontFamily,fontWeight:o},s=n.size,c={...a,fontSize:s,lineHeight:Math.round(s*n.lineHeight*100)/100};return n.letterSpacing!==0&&(c.letterSpacing=Math.round(s*n.letterSpacing*100)/100),n.uppercase&&(c.textTransform="uppercase"),/* @__PURE__ */Object.freeze(c)}var er=/* @__PURE__ */Object.freeze({display:/* @__PURE__ */Object.freeze({size:29,lineHeight:1.06,weight:"800",face:"heading",letterSpacing:-.01,uppercase:false,tier:"heading"}),title:/* @__PURE__ */Object.freeze({size:23,lineHeight:1.12,weight:"800",face:"heading",letterSpacing:-.01,uppercase:false,tier:"heading"}),cardTitle:/* @__PURE__ */Object.freeze({size:19,lineHeight:1.22,weight:"800",face:"sans",letterSpacing:0,uppercase:false,tier:"heading"}),rowTitle:/* @__PURE__ */Object.freeze({size:15.5,lineHeight:1.4,weight:"700",face:"sans",letterSpacing:0,uppercase:false,tier:"content"}),body:/* @__PURE__ */Object.freeze({size:15,lineHeight:1.5,weight:"400",face:"sans",letterSpacing:0,uppercase:false,tier:"content"}),message:/* @__PURE__ */Object.freeze({size:15.5,lineHeight:1.5,weight:"400",face:"sans",letterSpacing:0,uppercase:false,tier:"content"}),bodySmall:/* @__PURE__ */Object.freeze({size:14.5,lineHeight:1.4,weight:"400",face:"sans",letterSpacing:0,uppercase:false,tier:"content"}),caption:/* @__PURE__ */Object.freeze({size:13,lineHeight:1.4,weight:"400",face:"sans",letterSpacing:0,uppercase:false,tier:"content"}),label:/* @__PURE__ */Object.freeze({size:10.5,lineHeight:1.4,weight:"400",face:"mono",letterSpacing:.05,uppercase:true,tier:"compact"}),eyebrow:/* @__PURE__ */Object.freeze({size:15,lineHeight:1.5,weight:"400",face:"mono",letterSpacing:.07,uppercase:true,tier:"compact"}),chip:/* @__PURE__ */Object.freeze({size:15,lineHeight:1.3,weight:"600",face:"sans",letterSpacing:0,uppercase:false,tier:"compact"}),tab:/* @__PURE__ */Object.freeze({size:16,lineHeight:1.5,weight:"600",face:"sans",letterSpacing:0,uppercase:false,tier:"compact"}),button:/* @__PURE__ */Object.freeze({size:15,lineHeight:1.5,weight:"700",face:"sans",letterSpacing:0,uppercase:false,tier:"control"}),badge:/* @__PURE__ */Object.freeze({size:12,lineHeight:1.5,weight:"700",face:"sans",letterSpacing:0,uppercase:false,tier:"badge"})});var tr=Object.freeze;function deepFreeze(e){if(e!==null&&typeof e=="object"&&!Object.isFrozen(e)){tr(e);for(let t of Object.keys(e))deepFreeze(e[t])}return e}var nr=/* @__PURE__ */Object.freeze({content:0,heading:2,control:1.8,compact:1.5,badge:1.3});var rr={xs:4,sm:8,md:12,lg:16,xl:24,xxl:32},lr={tile:5,xs:6,sm:10,md:14,lg:20,xl:28,pill:500},ir={nano:8,small:9,micro:10,tiny:11,caption:13,bodyTight:15,body:17,subtitle:20,heading:22,verdict:24},or={tight:1.15,snug:1.3,normal:1.4,relaxed:1.55},ar={regular:"400",medium:"500",bold:"700"},sr={eyebrow:1,monoWide:.9,headerBrand:-.42,tight:-.35},cr=0,dr="System",ur="monospace",pr=["content","heading","control","compact","badge"];function hr(e){let t={};for(let n of pr)t[n]=e;return t}var fr=[];function mr(){return{family:dr,mono:ur,fontUrl:null,families:{regular:dr,medium:dr,bold:dr,mono:ur,monoMedium:ur,monoBold:ur},namedFaces:{regular:false,medium:false,bold:false,mono:false,monoMedium:false,monoBold:false},fontUrls:{},size:ir,tierSizes:hr(ir),lineHeight:or,weight:ar,letterSpacing:sr,scale:1,maxScale:cr,scaleCaps:nr,headingFamily:null,headingWeight:null,fontSources:fr,roles:er,typeScale:1}}var gr={},yr=/* @__PURE__ */Object.freeze({standard:/* @__PURE__ */Object.freeze([.2,0,0,1]),emphasized:/* @__PURE__ */Object.freeze([.2,.8,.2,1]),exit:/* @__PURE__ */Object.freeze([.4,0,1,1])});function cssCubicBezier(e){return`cubic-bezier(${e.join(", ")})`}var br={duration:{instant:80,fast:140,normal:220,slow:320},spring:{gentle:{damping:18,stiffness:200}},easing:{standard:cssCubicBezier(yr.standard),emphasized:cssCubicBezier(yr.emphasized),exit:cssCubicBezier(yr.exit)},reducedMotion:false},vr={brand:"#10462E",brandSoft:"rgba(16,70,46,0.10)",brandSofter:"rgba(16,70,46,0.15)",brandBorder:"rgba(16,70,46,0.18)",borderHairlineGreen:"rgba(16,70,46,0.25)",brandBorderStrong:"rgba(16,70,46,0.55)",brandInk:"#10462E",linkInk:"#10462E",surface:"#FFFFFF",surfaceCream:"#FFFFFF",surfaceSubtle:"#F1F5F2",background:"#FFFFFF",borderRingCream:"#E4E4E4",chatGround:"#FFFFFF",composerFill:"#FFFFFF",composerBorder:"rgba(16,70,46,0.75)",shadow:"#0B3421",text:{primary:"#000000",secondary:"#0E462E",muted:"#6B6B6B",placeholder:"rgba(61,61,61,0.75)",onBrand:"#FFFFFF",metaCool:"#3D3D3D",timestamp:"rgba(61,61,61,0.75)"},primary:"#10462E",onPrimary:"#FFFFFF",accent:"#10462E",onAccent:"#FFFFFF",accentEdge:"#07C168",success:"#07C168",danger:"#C03410",onDanger:"#FFFFFF",errorRed:"#C03410",warningStrong:"#A45610",cautionAccent:"#D9821D",riskConcern:"#EFA700",sentiment:{up:"#07C168",neutral:"#FBC558",down:"#FF1B00"},badgeBgPositive:"rgba(7,193,104,0.12)",badgeBgCaution:"rgba(217,130,29,0.14)",badgeBgCritical:"rgba(192,52,16,0.06)",badgeBgNeutral:"rgba(107,107,107,0.12)",bubbleUser:"#10462E",bubbleAssistant:"#FFFFFF",bubbleVet:"#FFC3BC",onBubbleVet:"#000000",skeleton:"#E9F1E9",scanButtonPink:"#FFC3BC",highlight:"#FFC3BC",onHighlight:"#000000",mark:"#07C168",controlEdge:"rgba(16,70,46,0.18)",structureEdge:"rgba(16,70,46,0.25)",primaryEdge:"#10462E",checkupCardLowRiskBg:"rgba(7,193,104,0.10)",checkupCardConcernBg:"rgba(239,167,0,0.10)",info:"#10462E",badgeBgInfo:"rgba(16,70,46,0.10)",infoEdge:"rgba(16,70,46,0.25)"},xr=deepFreeze({brightness:"light",highContrast:false,meta:{displayName:"Everfur",logoUrl:null,placeholder:null,hidePoweredBy:false,assistantAvatarUrl:null},color:vr,space:rr,radius:lr,type:mr(),motion:br,slots:gr}),Tr={brand:"#6BD39A",brandSoft:"rgba(107,211,154,0.12)",brandSofter:"rgba(107,211,154,0.18)",brandBorder:"rgba(107,211,154,0.22)",borderHairlineGreen:"rgba(107,211,154,0.28)",brandBorderStrong:"rgba(107,211,154,0.55)",brandInk:"#6BD39A",linkInk:"#6BD39A",surface:"#1C1F23",surfaceCream:"#23272C",surfaceSubtle:"#23272C",background:"#15171A",borderRingCream:"#3A3F45",chatGround:"#1C1F23",composerFill:"#23272C",composerBorder:"rgba(107,211,154,0.75)",shadow:"#000000",text:{primary:"#F5F3F0",secondary:"#A9E4C4",muted:"#9A9A9A",placeholder:"rgba(255,255,255,0.55)",onBrand:"#0E1F17",metaCool:"#C9C9C9",timestamp:"rgba(245,243,240,0.7)"},primary:"#6BD39A",onPrimary:"#0E1F17",accent:"#6BD39A",onAccent:"#0E1F17",accentEdge:"#34D888",success:"#07C168",danger:"#F87171",onDanger:"#0E1F17",errorRed:"#FF6B5B",warningStrong:"#F0A35E",cautionAccent:"#D9821D",riskConcern:"#EFA700",sentiment:{up:"#07C168",neutral:"#FBC558",down:"#FF1B00"},badgeBgPositive:"rgba(7,193,104,0.18)",badgeBgCaution:"rgba(217,130,29,0.20)",badgeBgCritical:"rgba(185,28,28,0.22)",badgeBgNeutral:"rgba(255,255,255,0.10)",bubbleUser:"#6BD39A",bubbleAssistant:"#1C1F23",bubbleVet:"#FFC3BC",onBubbleVet:"#000000",skeleton:"#23272C",scanButtonPink:"#FFC3BC",highlight:"#605051",onHighlight:"#F5F3F0",mark:"#07C168",controlEdge:"rgba(107,211,154,0.22)",structureEdge:"rgba(107,211,154,0.28)",primaryEdge:"#6BD39A",checkupCardLowRiskBg:"rgba(7,193,104,0.16)",checkupCardConcernBg:"rgba(239,167,0,0.16)",info:"#6BD39A",badgeBgInfo:"rgba(107,211,154,0.12)",infoEdge:"rgba(107,211,154,0.28)"};deepFreeze({brightness:"dark",highContrast:false,meta:{displayName:"Everfur",logoUrl:null,placeholder:null,hidePoweredBy:false,assistantAvatarUrl:null},color:Tr,space:rr,radius:lr,type:mr(),motion:br,slots:gr});var wr=/* @__PURE__ */Symbol.for("@everfur/sdk#EverfurThemeContext@v1"),kr=globalThis,Sr=kr[wr]??(kr[wr]=e.createContext(xr));Sr.displayName??="EverfurThemeContext";function useEverfurTheme(){return e.useContext(Sr)}function jr(e,t){let n=e.scaleCaps[t];return n>0?n:void 0}function Text({tier:n,variant:r,...l}){let i=useEverfurTheme(),o=r===void 0?void 0:i.type.roles[r],a=jr(i.type,n??o?.tier??"content"),s=r===void 0?l:{...l,style:[{...textRole(i,r),color:i.color.text.primary,flexShrink:1},l.style]};return e.createElement(t.Text,a===void 0?s:{maxFontSizeMultiplier:a,...s})}var Cr=e.forwardRef(function(n,r){return e.createElement(t.TextInput,{...n,...r===null?{}:{ref:r}})});var _r=class extends e.Component{constructor(){super(...arguments);this.state={failed:false,key:this.props.resetKey}}static getDerivedStateFromError(){return{failed:true}}static getDerivedStateFromProps(e,t){return Object.is(e.resetKey,t.key)?null:{failed:false,key:e.resetKey}}render(){return this.state.failed?this.props.fallback:this.props.children}};function RenderHost({render:e}){return e()}function HostRender({render:t,fallback:n,resetKey:r}){return e.createElement(_r,{fallback:n,resetKey:r,children:e.createElement(RenderHost,{render:t})})}var Ir=48;function Er(e){return e.isPending?"pending":e.enabled?"enabled":"disabled"}function CapabilityGate(t){let{capability:n,children:l,renderDisabled:i,renderPending:o,style:a}=t,s=useCapability(n),c=e.useMemo(()=>Er(s),[s]);switch(c){case"enabled":return l;case"pending":return o?/* @__PURE__ */r.jsx(HostRender,{render:o,fallback:/* @__PURE__ */r.jsx(PendingSkeleton,{capability:n,style:a})}):/* @__PURE__ */r.jsx(PendingSkeleton,{capability:n,style:a});case"disabled":return i?/* @__PURE__ */r.jsx(HostRender,{render:()=>i(s),fallback:/* @__PURE__ */r.jsx(OffState,{decision:s,style:a}),resetKey:s}):/* @__PURE__ */r.jsx(OffState,{decision:s,style:a});default:return assertNever(c)}}function PendingSkeleton({capability:n,style:l}){let i=useEverfurTheme(),o=e.useMemo(()=>Dr(i),[i]);/* @__PURE__ */
|
|
29
|
+
return Object.freeze({read(e,t,o){let a=n.get(e);if(a?.promise)return l(e,a,o.signal);let s=r(a);if(s!==null&&(o.force!==true||!s.ok&&En(s.error)))return Promise.resolve(s);let c={abort:new AbortController,promise:null,settled:null,keptUntil:0,waiters:0};return n.set(e,c),c.promise=t(c.abort.signal).then(t=>(i(e,c,t,o.freshMs),t),t=>{throw c.promise=null,n.get(e)===c&&n.delete(e),t}),l(e,c,o.signal)},peek(e){return r(n.get(e))},invalidate(e){for(let t of[...n.keys()])e.some(e=>t.startsWith(e))&&n.delete(t)}})}var Fn=/* @__PURE__ */new WeakMap;function Ln(e){let t=Fn.get(e);return t===void 0&&(t=zn(),Fn.set(e,t)),t}var An=/* @__PURE__ */Object.freeze(["slots:","next-slot"]),On=/* @__PURE__ */Object.freeze(["consults:","consult:","slots:","next-slot"]);function Vn(e,t){Fn.get(e)?.invalidate(t)}function useTelevetBookingController(t){let{runtime:n,userRef:userRef,scopeEpoch:r}=Tn();return e.useMemo(()=>t||(userRef===null?null:Bn(n,`${userRef}\0${r}`,()=>{let{services:e}=n.registry;return createTelevetBookingController({auth:e.authFor(userRef),telemetry:e.telemetry,...e.errorPolicy?{errorPolicy:e.errorPolicy}:{}})})),[n,userRef,r,t])}var Nn=/* @__PURE__ */new WeakMap;function Bn(e,t,n){let r=Nn.get(e);if(r!==void 0&&r.scope===t)return r.controller;let l=n();return Nn.set(e,{scope:t,controller:l}),l}function useTelevetBookingAvailable(){let{userRef:userRef}=Tn(),t=useCapability("televet");return e.useMemo(()=>({available:t.enabled&&userRef!==null,isPending:t.isPending}),[t.enabled,t.isPending,userRef])}function Mn(t,n,r,l,i=Rn,o=false){let[a,s]=e.useState(()=>{let e=n&&r!==null&&l!==null&&!o?Ln(l).peek(t):null;return e!==null?e.ok?{key:t,data:e.value,isPending:false,error:null}:{key:t,data:null,isPending:false,error:e.error}:{key:t,data:null,isPending:n&&r!==null,error:null}}),[c,d]=e.useState(0),u=e.useRef(r);u.current=r;let p=e.useRef(l);p.current=l;let h=e.useRef(o);e.useEffect(()=>{let e=u.current;if(!n||e===null){s({key:t,data:null,isPending:false,error:null});return}let r=h.current;h.current=false;let l=p.current===null?null:Ln(p.current),o=r||l===null?null:l.peek(t);if(o!==null){s(o.ok?{key:t,data:o.value,isPending:false,error:null}:{key:t,data:null,isPending:false,error:o.error});return}let a=new AbortController,c=true;return s(e=>e.key===t?{...e,isPending:true,error:null}:{key:t,data:null,isPending:true,error:null}),(async()=>{let n;try{n=l===null?await e(a.signal):await l.read(t,e,{signal:a.signal,freshMs:i,force:r})}catch{c&&s({key:t,data:null,isPending:false,error:null});return}c&&(n.ok?s({key:t,data:n.value,isPending:false,error:null}):s({key:t,data:null,isPending:false,error:n.error}))})(),()=>{c=false,a.abort()}},[t,n,c]);let f=e.useCallback(()=>{h.current=true,d(e=>e+1)},[]),m=a.key===t;return e.useMemo(()=>({enabled:n,data:m?a.data:null,isPending:n&&(!m||a.isPending),isError:m&&a.error!==null,error:m?a.error:null,refetch:f}),[n,m,a.data,a.isPending,a.error,f])}function useTelevetStatePolicy(e,t){let n=e?.trim()??"",r=t?.statePolicy!==void 0&&isWellFormedStateCode(n),l=t?.statePolicy;return Mn(`state-policy:${n}`,r,r&&l?e=>l.call(t,n,e):null,t)}function useTelevetBookingEntitlement(e){let t=e?.entitlement!==void 0,n=e?.entitlement;return Mn("entitlement",t,t&&n?t=>n.call(e,t):null,e,0)}function useTelevetCancellationPolicy(e){let t=e?.cancellationPolicy!==void 0,n=e?.cancellationPolicy;return Mn("cancellation-policy",t,t&&n?t=>n.call(e,t):null,e)}function useTelevetClinicians(e,t){let n=e?.trim()??"",r=t?.clinicians!==void 0&&isWellFormedStateCode(n),l=t?.clinicians;return Mn(`clinicians:${n}`,r,r&&l?e=>l.call(t,n,e):null,t)}function useTelevetSlots(e,t){let n=e?.trim()??"",r=t!==null&&n.length>0;return Mn(`slots:${n}`,r,r&&t?e=>t.slots(n,e):null,t)}function useTelevetNextSlot(e){let t=e?.nextSlot!==void 0,n=e?.nextSlot;return Mn("next-slot",t,t&&n?t=>n.call(e,t):null,e)}function Hn(t){let[n,r]=e.useState(null),l=e.useRef(true),i=e.useRef(false),o=e.useRef(t);o.current=t,e.useEffect(()=>(l.current=true,()=>{l.current=false}),[]);let a=e.useCallback((...e)=>{let t=o.current;if(t===null||i.current)return;let n=e[e.length-1],a=typeof n=="object"&&n!==null&&("onSuccess"in n||"onError"in n),s=a?n:void 0,c=a?e.slice(0,-1):e;i.current=true,r({variables:c[0]??null}),(async()=>{let e=null;try{e=await t(...c)}catch{e=null}i.current=false,l.current&&r(null),e!==null&&(e.ok?s?.onSuccess?.(e.value):s?.onError?.(e.error))})()},[]);return e.useMemo(()=>({isPending:n!==null,variables:n?.variables??null,mutate:a}),[n,a])}async function $n(e,t,n){let r=await n;return r.ok&&Vn(e,t),r}function useTelevetHoldSlot(e){return Hn(e?t=>$n(e,An,e.holdSlot(t)):null)}function useTelevetBookConsult(e){return Hn(e?(t,n)=>$n(e,On,e.book(t,n)):null)}function useTelevetRescheduleConsult(e,t){return Hn(t&&e?n=>$n(t,On,t.reschedule(e,n)):null)}function Wn(e,t=0,n){let r=e?.listConsults!==void 0,l=e?.listConsults;return Mn(`consults:${t}`,r,r&&l?t=>l.call(e,t):null,e,Rn,n?.reread===true)}function Un(e,t,n=0){let r=e?.trim()??"",l=t?.getConsult!==void 0&&r.length>0,i=t?.getConsult;return Mn(`consult:${r}:${n}`,l,l&&i?e=>i.call(t,r,e):null,t)}function qn(e,t){let n=t?.cancelConsult;return Hn(t&&n&&e?r=>$n(t,On,n.call(t,e,r)):null)}function Kn(e){return e.error!==null&&e.error.httpStatus===404}function Yn(e){let t=Wn(e);if(!t.enabled)return"booking";if(t.isPending)return"pending";if(t.isError)return"visits";let{upcoming:n,past:r}=splitTelevetVisits(t.data??[],Date.now());return n.length>0||r.length>0?"visits":"booking"}var Gn=/* @__PURE__ */Object.freeze({regular:"regular",medium:"medium",bold:"bold",mono:"regular",monoMedium:"medium",monoBold:"bold"});function face(e,t){let n=e.type,r=n.families[t];return t==="mono"||n.namedFaces[t]?{fontFamily:r}:{fontFamily:r,fontWeight:n.weight[Gn[t]]}}function headingFace(e,t="bold"){let{headingFamily:n,headingWeight:r}=e.type;if(n===null&&r===null)return face(e,t);if(n!==null)return{fontFamily:n,fontWeight:r??e.type.weight[Gn[t]]};let l=face(e,t);return l.fontWeight===void 0||r===null?l:{fontFamily:l.fontFamily,fontWeight:r}}function Jn(e){return e<=450?"regular":e<=650?"medium":"bold"}var Qn={regular:"mono",medium:"monoMedium",bold:"monoBold"};function textRole(e,t){let n=Xn.get(e);n===void 0&&(n=/* @__PURE__ */new Map,Xn.set(e,n));let r=n.get(t);if(r!==void 0)return r;let l=Zn(e,t);return n.set(t,l),l}var Xn=/* @__PURE__ */new WeakMap;function Zn(e,t){let n=e.type.roles[t],r=n.weight==="400"&&n.face!=="mono"?e.type.weight.regular:n.weight,l=Jn(Number(r)),i=n.face==="mono"?face(e,Qn[l]):n.face==="heading"?headingFace(e,l):face(e,l),o=n.face==="heading"?e.type.headingWeight??r:r,a=i.fontWeight===void 0?i:{fontFamily:i.fontFamily,fontWeight:o},s=n.size,c={...a,fontSize:s,lineHeight:Math.round(s*n.lineHeight*100)/100};return n.letterSpacing!==0&&(c.letterSpacing=Math.round(s*n.letterSpacing*100)/100),n.uppercase&&(c.textTransform="uppercase"),/* @__PURE__ */Object.freeze(c)}var er=/* @__PURE__ */Object.freeze({display:/* @__PURE__ */Object.freeze({size:29,lineHeight:1.06,weight:"800",face:"heading",letterSpacing:-.01,uppercase:false,tier:"heading"}),title:/* @__PURE__ */Object.freeze({size:23,lineHeight:1.12,weight:"800",face:"heading",letterSpacing:-.01,uppercase:false,tier:"heading"}),cardTitle:/* @__PURE__ */Object.freeze({size:19,lineHeight:1.22,weight:"800",face:"sans",letterSpacing:0,uppercase:false,tier:"heading"}),rowTitle:/* @__PURE__ */Object.freeze({size:15.5,lineHeight:1.4,weight:"700",face:"sans",letterSpacing:0,uppercase:false,tier:"content"}),body:/* @__PURE__ */Object.freeze({size:15,lineHeight:1.5,weight:"400",face:"sans",letterSpacing:0,uppercase:false,tier:"content"}),message:/* @__PURE__ */Object.freeze({size:15.5,lineHeight:1.5,weight:"400",face:"sans",letterSpacing:0,uppercase:false,tier:"content"}),bodySmall:/* @__PURE__ */Object.freeze({size:14.5,lineHeight:1.4,weight:"400",face:"sans",letterSpacing:0,uppercase:false,tier:"content"}),caption:/* @__PURE__ */Object.freeze({size:13,lineHeight:1.4,weight:"400",face:"sans",letterSpacing:0,uppercase:false,tier:"content"}),label:/* @__PURE__ */Object.freeze({size:10.5,lineHeight:1.4,weight:"400",face:"mono",letterSpacing:.05,uppercase:true,tier:"compact"}),eyebrow:/* @__PURE__ */Object.freeze({size:15,lineHeight:1.5,weight:"400",face:"mono",letterSpacing:.07,uppercase:true,tier:"compact"}),chip:/* @__PURE__ */Object.freeze({size:15,lineHeight:1.3,weight:"600",face:"sans",letterSpacing:0,uppercase:false,tier:"compact"}),tab:/* @__PURE__ */Object.freeze({size:16,lineHeight:1.5,weight:"600",face:"sans",letterSpacing:0,uppercase:false,tier:"compact"}),button:/* @__PURE__ */Object.freeze({size:15,lineHeight:1.5,weight:"700",face:"sans",letterSpacing:0,uppercase:false,tier:"control"}),badge:/* @__PURE__ */Object.freeze({size:12,lineHeight:1.5,weight:"700",face:"sans",letterSpacing:0,uppercase:false,tier:"badge"})});var tr=Object.freeze;function deepFreeze(e){if(e!==null&&typeof e=="object"&&!Object.isFrozen(e)){tr(e);for(let t of Object.keys(e))deepFreeze(e[t])}return e}var nr=/* @__PURE__ */Object.freeze({content:0,heading:2,control:1.8,compact:1.5,badge:1.3});var rr={xs:4,sm:8,md:12,lg:16,xl:24,xxl:32},lr={tile:5,xs:6,sm:10,md:14,lg:20,xl:28,pill:500},ir={nano:8,small:9,micro:10,tiny:11,caption:13,bodyTight:15,body:17,subtitle:20,heading:22,verdict:24},or={tight:1.15,snug:1.3,normal:1.4,relaxed:1.55},ar={regular:"400",medium:"500",bold:"700"},sr={eyebrow:1,monoWide:.9,headerBrand:-.42,tight:-.35},cr=0,dr="System",ur="monospace",pr=["content","heading","control","compact","badge"];function hr(e){let t={};for(let n of pr)t[n]=e;return t}var fr=[];function mr(){return{family:dr,mono:ur,fontUrl:null,families:{regular:dr,medium:dr,bold:dr,mono:ur,monoMedium:ur,monoBold:ur},namedFaces:{regular:false,medium:false,bold:false,mono:false,monoMedium:false,monoBold:false},fontUrls:{},size:ir,tierSizes:hr(ir),lineHeight:or,weight:ar,letterSpacing:sr,scale:1,maxScale:cr,scaleCaps:nr,headingFamily:null,headingWeight:null,fontSources:fr,roles:er,typeScale:1}}var gr={},yr=/* @__PURE__ */Object.freeze({standard:/* @__PURE__ */Object.freeze([.2,0,0,1]),emphasized:/* @__PURE__ */Object.freeze([.2,.8,.2,1]),exit:/* @__PURE__ */Object.freeze([.4,0,1,1])});function cssCubicBezier(e){return`cubic-bezier(${e.join(", ")})`}var br={duration:{instant:80,fast:140,normal:220,slow:320},spring:{gentle:{damping:18,stiffness:200}},easing:{standard:cssCubicBezier(yr.standard),emphasized:cssCubicBezier(yr.emphasized),exit:cssCubicBezier(yr.exit)},reducedMotion:false},vr={brand:"#10462E",brandSoft:"rgba(16,70,46,0.10)",brandSofter:"rgba(16,70,46,0.15)",brandBorder:"rgba(16,70,46,0.18)",borderHairlineGreen:"rgba(16,70,46,0.25)",brandBorderStrong:"rgba(16,70,46,0.55)",brandInk:"#10462E",linkInk:"#10462E",surface:"#FFFFFF",surfaceCream:"#FFFFFF",surfaceSubtle:"#F1F5F2",background:"#FFFFFF",borderRingCream:"#E4E4E4",chatGround:"#FFFFFF",composerFill:"#FFFFFF",composerBorder:"rgba(16,70,46,0.75)",shadow:"#0B3421",text:{primary:"#000000",secondary:"#0E462E",muted:"#6B6B6B",placeholder:"rgba(61,61,61,0.75)",onBrand:"#FFFFFF",metaCool:"#3D3D3D",timestamp:"rgba(61,61,61,0.75)"},primary:"#10462E",onPrimary:"#FFFFFF",accent:"#10462E",onAccent:"#FFFFFF",accentEdge:"#07C168",success:"#07C168",danger:"#C03410",onDanger:"#FFFFFF",errorRed:"#C03410",warningStrong:"#A45610",cautionAccent:"#D9821D",riskConcern:"#EFA700",sentiment:{up:"#07C168",neutral:"#FBC558",down:"#FF1B00"},badgeBgPositive:"rgba(7,193,104,0.12)",badgeBgCaution:"rgba(217,130,29,0.14)",badgeBgCritical:"rgba(192,52,16,0.06)",badgeBgNeutral:"rgba(107,107,107,0.12)",bubbleUser:"#10462E",bubbleAssistant:"#FFFFFF",bubbleVet:"#FFC3BC",onBubbleVet:"#000000",skeleton:"#E9F1E9",scanButtonPink:"#FFC3BC",highlight:"#FFC3BC",onHighlight:"#000000",mark:"#07C168",controlEdge:"rgba(16,70,46,0.18)",structureEdge:"rgba(16,70,46,0.25)",primaryEdge:"#10462E",checkupCardLowRiskBg:"rgba(7,193,104,0.10)",checkupCardConcernBg:"rgba(239,167,0,0.10)",info:"#10462E",badgeBgInfo:"rgba(16,70,46,0.10)",infoEdge:"rgba(16,70,46,0.25)"},xr=deepFreeze({brightness:"light",highContrast:false,meta:{displayName:"Everfur",logoUrl:null,placeholder:null,hidePoweredBy:false,assistantAvatarUrl:null},color:vr,space:rr,radius:lr,type:mr(),motion:br,slots:gr}),Tr={brand:"#6BD39A",brandSoft:"rgba(107,211,154,0.12)",brandSofter:"rgba(107,211,154,0.18)",brandBorder:"rgba(107,211,154,0.22)",borderHairlineGreen:"rgba(107,211,154,0.28)",brandBorderStrong:"rgba(107,211,154,0.55)",brandInk:"#6BD39A",linkInk:"#6BD39A",surface:"#1C1F23",surfaceCream:"#23272C",surfaceSubtle:"#23272C",background:"#15171A",borderRingCream:"#3A3F45",chatGround:"#1C1F23",composerFill:"#23272C",composerBorder:"rgba(107,211,154,0.75)",shadow:"#000000",text:{primary:"#F5F3F0",secondary:"#A9E4C4",muted:"#9A9A9A",placeholder:"rgba(255,255,255,0.55)",onBrand:"#0E1F17",metaCool:"#C9C9C9",timestamp:"rgba(245,243,240,0.7)"},primary:"#6BD39A",onPrimary:"#0E1F17",accent:"#6BD39A",onAccent:"#0E1F17",accentEdge:"#34D888",success:"#07C168",danger:"#F87171",onDanger:"#0E1F17",errorRed:"#FF6B5B",warningStrong:"#F0A35E",cautionAccent:"#D9821D",riskConcern:"#EFA700",sentiment:{up:"#07C168",neutral:"#FBC558",down:"#FF1B00"},badgeBgPositive:"rgba(7,193,104,0.18)",badgeBgCaution:"rgba(217,130,29,0.20)",badgeBgCritical:"rgba(185,28,28,0.22)",badgeBgNeutral:"rgba(255,255,255,0.10)",bubbleUser:"#6BD39A",bubbleAssistant:"#1C1F23",bubbleVet:"#FFC3BC",onBubbleVet:"#000000",skeleton:"#23272C",scanButtonPink:"#FFC3BC",highlight:"#605051",onHighlight:"#F5F3F0",mark:"#07C168",controlEdge:"rgba(107,211,154,0.22)",structureEdge:"rgba(107,211,154,0.28)",primaryEdge:"#6BD39A",checkupCardLowRiskBg:"rgba(7,193,104,0.16)",checkupCardConcernBg:"rgba(239,167,0,0.16)",info:"#6BD39A",badgeBgInfo:"rgba(107,211,154,0.12)",infoEdge:"rgba(107,211,154,0.28)"};deepFreeze({brightness:"dark",highContrast:false,meta:{displayName:"Everfur",logoUrl:null,placeholder:null,hidePoweredBy:false,assistantAvatarUrl:null},color:Tr,space:rr,radius:lr,type:mr(),motion:br,slots:gr});var kr=/* @__PURE__ */Symbol.for("@everfur/sdk#EverfurThemeContext@v1"),wr=globalThis,Sr=wr[kr]??(wr[kr]=e.createContext(xr));Sr.displayName??="EverfurThemeContext";function useEverfurTheme(){return e.useContext(Sr)}function jr(e,t){let n=e.scaleCaps[t];return n>0?n:void 0}function Text({tier:n,variant:r,...l}){let i=useEverfurTheme(),o=r===void 0?void 0:i.type.roles[r],a=jr(i.type,n??o?.tier??"content"),s=r===void 0?l:{...l,style:[{...textRole(i,r),color:i.color.text.primary,flexShrink:1},l.style]};return e.createElement(t.Text,a===void 0?s:{maxFontSizeMultiplier:a,...s})}var Cr=e.forwardRef(function(n,r){return e.createElement(t.TextInput,{...n,...r===null?{}:{ref:r}})});var _r=class extends e.Component{constructor(){super(...arguments);this.state={failed:false,key:this.props.resetKey}}static getDerivedStateFromError(){return{failed:true}}static getDerivedStateFromProps(e,t){return Object.is(e.resetKey,t.key)?null:{failed:false,key:e.resetKey}}render(){return this.state.failed?this.props.fallback:this.props.children}};function RenderHost({render:e}){return e()}function HostRender({render:t,fallback:n,resetKey:r}){return e.createElement(_r,{fallback:n,resetKey:r,children:e.createElement(RenderHost,{render:t})})}var Ir=48;function Er(e){return e.isPending?"pending":e.enabled?"enabled":"disabled"}function CapabilityGate(t){let{capability:n,children:l,renderDisabled:i,renderPending:o,style:a}=t,s=useCapability(n),c=e.useMemo(()=>Er(s),[s]);switch(c){case"enabled":return l;case"pending":return o?/* @__PURE__ */r.jsx(HostRender,{render:o,fallback:/* @__PURE__ */r.jsx(PendingSkeleton,{capability:n,style:a})}):/* @__PURE__ */r.jsx(PendingSkeleton,{capability:n,style:a});case"disabled":return i?/* @__PURE__ */r.jsx(HostRender,{render:()=>i(s),fallback:/* @__PURE__ */r.jsx(OffState,{decision:s,style:a}),resetKey:s}):/* @__PURE__ */r.jsx(OffState,{decision:s,style:a});default:return assertNever(c)}}function PendingSkeleton({capability:n,style:l}){let i=useEverfurTheme(),o=e.useMemo(()=>Dr(i),[i]);/* @__PURE__ */
|
|
30
30
|
return r.jsx(t.View,{style:[o.offstate,l],accessible:true,accessibilityState:{busy:true},accessibilityLabel:`Loading ${n}`,children:/* @__PURE__ */r.jsx(t.View,{style:o.skeletonBar})})}function OffState({decision:n,style:l}){let i=useEverfurTheme(),o=e.useMemo(()=>Dr(i),[i]),a=n.disabled?.reason??"";/* @__PURE__ */
|
|
31
|
-
return r.jsx(t.View,{style:[o.offstate,l],accessible:true,accessibilityRole:"text",accessibilityLabel:a,children:a.length>0?/* @__PURE__ */r.jsx(Text,{style:o.offstateText,children:a}):null})}function Dr(e){let{color:n,space:r,radius:l,type:i}=e;return t.StyleSheet.create({offstate:{minHeight:Ir,justifyContent:"center",paddingHorizontal:r.lg,paddingVertical:r.md,backgroundColor:n.surfaceCream,borderRadius:l.md,borderWidth:t.StyleSheet.hairlineWidth,borderColor:n.brandBorder},offstateText:{...face(e,"regular"),fontSize:i.size.body,lineHeight:Math.round(i.size.body*i.lineHeight.normal),color:n.text.muted},skeletonBar:{height:r.md,borderRadius:l.xs,backgroundColor:n.brandSofter}})}function Pr(e){for(let t=0;t<e.length;t+=1){let n=e.charCodeAt(t);if(n>=55296&&n<=56319){let n=e.charCodeAt(t+1);if(!(n>=56320&&n<=57343))return true;t+=1}else if(n>=56320&&n<=57343)return true}return false}function Rr(e){return[...e].length}var zr=/* @__PURE__ */Object.freeze({dog:"dog",canine:"dog",k9:"dog",puppy:"dog",cat:"cat",feline:"cat",kitten:"cat"});function canonicalPetSpecies(e){if(typeof e!="string")return null;let t=e.trim().toLowerCase();return Object.prototype.hasOwnProperty.call(zr,t)?zr[t]:null}var Fr=50,Lr=128,Ar=120,Or=120,Vr=2e3,Nr=120,Br=80,Mr=/* @__PURE__ */new Set(["male","female","unknown"]),Hr=/* @__PURE__ */new Set(["day","month","year"]),$r=/* @__PURE__ */new Set(["low","medium","high","athletic"]),Wr=/* @__PURE__ */new Set(["indoor","outdoor","both"]),
|
|
32
|
-
return Object.freeze({profileVersion:typeof t=="number"&&Number.isInteger(t)&&t>=0?t:0,sex:cl(Mr,e.sex),spayedNeutered:dl(e.spayed_neutered),birthDate:sl(e.birth_date),birthDatePrecision:cl(Hr,e.birth_date_precision),activityLevel:cl($r,e.activity_level),indoorOutdoor:cl(Wr,e.indoor_outdoor),foodBrand:sl(e.food_brand),foodType:sl(e.food_type),microchipId:sl(e.microchip_id),allergies:ul(e.allergies,e=>{let t=sl(e.allergen);return t===null||t.length===0?null:/* @__PURE__ */Object.freeze({ref:sl(e.ref),allergen:t,severity:cl(
|
|
31
|
+
return r.jsx(t.View,{style:[o.offstate,l],accessible:true,accessibilityRole:"text",accessibilityLabel:a,children:a.length>0?/* @__PURE__ */r.jsx(Text,{style:o.offstateText,children:a}):null})}function Dr(e){let{color:n,space:r,radius:l,type:i}=e;return t.StyleSheet.create({offstate:{minHeight:Ir,justifyContent:"center",paddingHorizontal:r.lg,paddingVertical:r.md,backgroundColor:n.surfaceCream,borderRadius:l.md,borderWidth:t.StyleSheet.hairlineWidth,borderColor:n.brandBorder},offstateText:{...face(e,"regular"),fontSize:i.size.body,lineHeight:Math.round(i.size.body*i.lineHeight.normal),color:n.text.muted},skeletonBar:{height:r.md,borderRadius:l.xs,backgroundColor:n.brandSofter}})}function Pr(e){for(let t=0;t<e.length;t+=1){let n=e.charCodeAt(t);if(n>=55296&&n<=56319){let n=e.charCodeAt(t+1);if(!(n>=56320&&n<=57343))return true;t+=1}else if(n>=56320&&n<=57343)return true}return false}function Rr(e){return[...e].length}var zr=/* @__PURE__ */Object.freeze({dog:"dog",canine:"dog",k9:"dog",puppy:"dog",cat:"cat",feline:"cat",kitten:"cat"});function canonicalPetSpecies(e){if(typeof e!="string")return null;let t=e.trim().toLowerCase();return Object.prototype.hasOwnProperty.call(zr,t)?zr[t]:null}var Fr=50,Lr=128,Ar=120,Or=120,Vr=2e3,Nr=120,Br=80,Mr=/* @__PURE__ */new Set(["male","female","unknown"]),Hr=/* @__PURE__ */new Set(["day","month","year"]),$r=/* @__PURE__ */new Set(["low","medium","high","athletic"]),Wr=/* @__PURE__ */new Set(["indoor","outdoor","both"]),Ur=/* @__PURE__ */new Set(["mild","moderate","severe"]),qr=/^(\d{4})-(\d{2})-(\d{2})$/,Kr=[["sex","sex"],["spayedNeutered","spayed_neutered"],["birthDate","birth_date"],["birthDatePrecision","birth_date_precision"],["activityLevel","activity_level"],["indoorOutdoor","indoor_outdoor"],["foodBrand","food_brand"],["foodType","food_type"],["microchipId","microchip_id"]],Yr=[["allergies","allergies"],["medications","medications"],["supplements","supplements"],["conditions","conditions"]];/* @__PURE__ */Object.freeze([...Kr,...Yr].map(([e])=>e));function Gr(e){let t=qr.exec(e);if(t===null)return false;let[n,r,l]=[Number(t[1]),Number(t[2]),Number(t[3])],i=new Date(Date.UTC(n,r-1,l));return i.getUTCFullYear()===n&&i.getUTCMonth()===r-1&&i.getUTCDate()===l}var Jr=e=>(t,n)=>typeof n=="string"&&e.has(n)?null:`${t} must be one of ${[...e].join(", ")}`,Qr=(e,t)=>typeof t=="boolean"?null:`${e} must be true or false`,Xr=(e,t)=>typeof t=="string"&&Gr(t)?null:`${e} must be a real date written YYYY-MM-DD`,Zr=(e,t={})=>(n,r)=>{if(typeof r!="string")return`${n} must be a string`;if(Pr(r))return`${n} contains an unpaired surrogate and cannot be encoded`;let l=t.trimmed?r.trim():r;if(t.required&&l.length===0)return`${n} is required and must not be blank`;let i=Rr(l);return i<=e?null:`${n} is ${i} characters; the server accepts at most ${e}`},el={sex:Jr(Mr),spayedNeutered:Qr,birthDate:Xr,birthDatePrecision:Jr(Hr),activityLevel:Jr($r),indoorOutdoor:Jr(Wr),foodBrand:Zr(Nr),foodType:Zr(Nr),microchipId:Zr(Br)},tl=["ref","ref",false,Zr(Lr,{required:true,trimmed:true})],nl=["notes","notes",false,Zr(Vr,{trimmed:true})],rl=[tl,["name","name",true,Zr(Ar,{required:true,trimmed:true})],["dose","dose",false,Zr(Or,{trimmed:true})],["frequency","frequency",false,Zr(Or,{trimmed:true})],["startDate","start_date",false,Xr],["endDate","end_date",false,Xr],nl],ll={allergies:[tl,["allergen","allergen",true,Zr(Ar,{required:true,trimmed:true})],["severity","severity",false,Jr(Ur)],nl],medications:rl,supplements:rl,conditions:[tl,["conditionName","condition_name",true,Zr(Ar,{required:true,trimmed:true})],["diagnosedDate","diagnosed_date",false,Xr],nl]};function il(e,t,n){let r=`${e}[${t}]`;if(typeof n!="object"||n===null||Array.isArray(n))return{error:`${r} must be an object`};let l=n,i={};for(let[t,n,o,a]of ll[e]){let e=l[t];if(e==null){if(o)return{error:`${r}.${t} is required`};e===null&&(i[n]=null);continue}let s=a(`${r}.${t}`,e);if(s!==null)return{error:s};i[n]=e}let o=i.start_date,a=i.end_date;return typeof o=="string"&&typeof a=="string"&&a<o?{error:`${r}.endDate must not be before startDate`}:{item:i}}function ol(e,t){if(!Array.isArray(t))return{error:`${e} must be an array (send [] to clear it)`};if(t.length>Fr)return{error:`${e} has ${t.length} items; the server accepts at most ${Fr}`};let n=[],r=/* @__PURE__ */new Set;for(let l=0;l<t.length;l+=1){let i=il(e,l,t[l]);if("error"in i)return i;let o=i.item.ref;if(typeof o=="string"){let t=o.trim();if(r.has(t))return{error:`${e}: ref ${JSON.stringify(t)} is used twice; a ref names one item`};r.add(t)}n.push(i.item)}return{items:n}}function al(e,t){let n=e,r={};for(let[e,t]of Kr){let l=n[e];if(l!==void 0){if(l!==null){let t=el[e](e,l);if(t!==null)return{error:t}}r[t]=l}}let l=n.birthDate!==void 0,i=n.birthDatePrecision!==void 0;if(l!==i||l&&n.birthDate===null!=(n.birthDatePrecision===null))return{error:"birthDate and birthDatePrecision must be sent together, both set or both null"};for(let[e,t]of Yr){let l=n[e];if(l===void 0)continue;let i=ol(e,l);if("error"in i)return i;r[t]=i.items}return Object.keys(r).length>0&&t!==void 0&&canonicalPetSpecies(t)===null?{error:"health fields need a pet Everfur reads as a dog or a cat (dog, canine, k9, puppy, cat, feline, kitten)"}:{body:r}}var sl=e=>typeof e=="string"?e:null,cl=(e,t)=>typeof t=="string"&&e.has(t)?t:null,dl=e=>typeof e=="boolean"?e:null;function ul(e,t){return Array.isArray(e)?/* @__PURE__ */Object.freeze(e.flatMap(e=>{if(typeof e!="object"||e===null||Array.isArray(e))return[];let n=t(e);return n===null?[]:[n]})):/* @__PURE__ */Object.freeze([])}function pl(e){let t=sl(e.name);return t===null||t.length===0?null:/* @__PURE__ */Object.freeze({ref:sl(e.ref),name:t,dose:sl(e.dose),frequency:sl(e.frequency),startDate:sl(e.start_date),endDate:sl(e.end_date),notes:sl(e.notes)})}function hl(e){let t=e.profile_version;/* @__PURE__ */
|
|
32
|
+
return Object.freeze({profileVersion:typeof t=="number"&&Number.isInteger(t)&&t>=0?t:0,sex:cl(Mr,e.sex),spayedNeutered:dl(e.spayed_neutered),birthDate:sl(e.birth_date),birthDatePrecision:cl(Hr,e.birth_date_precision),activityLevel:cl($r,e.activity_level),indoorOutdoor:cl(Wr,e.indoor_outdoor),foodBrand:sl(e.food_brand),foodType:sl(e.food_type),microchipId:sl(e.microchip_id),allergies:ul(e.allergies,e=>{let t=sl(e.allergen);return t===null||t.length===0?null:/* @__PURE__ */Object.freeze({ref:sl(e.ref),allergen:t,severity:cl(Ur,e.severity),notes:sl(e.notes)})}),medications:ul(e.medications,pl),supplements:ul(e.supplements,pl),conditions:ul(e.conditions,e=>{let t=sl(e.condition_name);return t===null||t.length===0?null:/* @__PURE__ */Object.freeze({ref:sl(e.ref),conditionName:t,diagnosedDate:sl(e.diagnosed_date),notes:sl(e.notes)})})})}var fl=100,ml=50,gl=100,yl=50,bl=500,vl=128,xl=6e4;function Tl(e){return makeEverfurError("validationFailed",{retryable:false,wireMessage:e})}function kl(e,t,n){if(typeof t!="string")return Tl(`${e} must be a string`);let r=Rr(t);return r<=n?null:Tl(`${e} is ${r} characters; the server accepts at most ${n}`)}function wl(e,t,n){return typeof t=="number"&&Number.isFinite(t)&&t>=0&&t<=n?null:Tl(`${e} must be a finite number between 0 and ${n}`)}function Sl(petRef,e){if(typeof petRef!="string")return Tl("pet_ref must be a string");if(petRef.trim().length===0)return Tl("pet_ref must not be blank");if(Pr(petRef))return Tl("pet_ref contains an unpaired surrogate and cannot be encoded");if(e!=null&&typeof e!="object")return Tl("profile must be an object");let t=[kl("pet_ref",petRef,vl)];return e?.name!==void 0&&t.push(kl("name",e.name,fl)),e?.species!==void 0&&t.push(kl("species",e.species,ml)),e?.breed!==void 0&&t.push(kl("breed",e.breed,gl)),e?.ageYears!==void 0&&t.push(wl("age_years",e.ageYears,yl)),e?.weightKg!==void 0&&t.push(wl("weight_kg",e.weightKg,bl)),t.find(e=>e!==null)??null}function jl(e,t){let n=al(e,t);return"error"in n?{error:Tl(n.error)}:n}function Cl(e){if(typeof e!="object"||e===null)return{error:Tl("patch must be an object")};let t=e,n=[["name","name",e=>kl("name",e,fl)],["species","species",e=>kl("species",e,ml)],["breed","breed",e=>kl("breed",e,gl)],["ageYears","age_years",e=>wl("age_years",e,yl)],["weightKg","weight_kg",e=>wl("weight_kg",e,bl)]],r={};for(let[e,l,i]of n){let n=t[e];if(n!==void 0){if(n!==null){let e=i(n);if(e!==null)return{error:e}}r[l]=n}}let l=jl(t,t.species);return"error"in l?l:(Object.assign(r,l.body),Object.keys(r).length===0?{error:Tl("patch must change at least one field")}:{body:r})}function _l(e){if(e==null)return{body:{}};let t=jl(e,e.species);return"error"in t?t:{body:{...e.name!==void 0?{name:e.name}:{},...e.species!==void 0?{species:e.species}:{},...e.breed!==void 0?{breed:e.breed}:{},...e.ageYears!==void 0?{age_years:e.ageYears}:{},...e.weightKg!==void 0?{weight_kg:e.weightKg}:{},...t.body}}}var Il=e=>typeof e=="string"?e:null,El=e=>typeof e=="number"&&Number.isFinite(e)?e:null;function Dl(e,petRef){let t=typeof e=="object"&&e!==null?e:{};/* @__PURE__ */
|
|
33
33
|
return Object.freeze({petRef:Il(t.pet_ref)??petRef,name:Il(t.name),species:Il(t.species),breed:Il(t.breed),ageYears:El(t.age_years),weightKg:El(t.weight_kg)})}function widgetPetFromWire(e){if(typeof e!="object"||e===null)return null;let t=e,petRef=Il(t.pet_ref);return petRef===null||petRef.length===0?null:/* @__PURE__ */Object.freeze({petId:Il(t.pet_id),petRef:petRef,name:Il(t.name),species:Il(t.species),breed:Il(t.breed),ageYears:El(t.age_years),weightKg:El(t.weight_kg),updatedAt:Il(t.updated_at)})}function Pl(e){let t=widgetPetFromWire(e);return t===null?null:/* @__PURE__ */Object.freeze({...t,...hl(e)})}function Rl(e){let t=Array.isArray(e)?e:typeof e=="object"&&e!==null&&Array.isArray(e.pets)?e.pets:[];/* @__PURE__ */
|
|
34
34
|
return Object.freeze(t.flatMap(e=>{let t=widgetPetFromWire(e);return t===null?[]:[t]}))}function createPetsRepository(e){return zl(createRequestFunnel({auth:e}),createRequestFunnel({auth:e,unaryTimeoutMs:xl}))}function zl(e,t=e){let n=(e,t)=>t?{...e,signal:t}:e,r=petRef=>Sl(petRef,void 0)??`/widget/v1/pets/${encodeURIComponent(petRef)}`;return{async list(t){let r=await e.send("pets.list",n({method:"GET",path:"/widget/v1/pets"},t?.signal));return r.ok?ok(Rl(r.value)):err(r.error)},async registerPet(petRef,t,n){let r=Sl(petRef,t);if(r!==null)return err(r);let l=_l(t);if("error"in l)return err(l.error);let i={method:"POST",path:`/widget/v1/pets/${encodeURIComponent(petRef)}`,body:l.body},o=await e.send("pets.registerPet",n?.signal?{...i,signal:n.signal}:i);return o.ok?ok(Dl(o.value,petRef)):err(o.error)},async updatePet(petRef,t,l){let i=r(petRef);if(typeof i!="string")return err(i);let o=Cl(t);if("error"in o)return err(o.error);let a=await e.send("pets.updatePet",n({method:"PATCH",path:i,body:o.body},l?.signal));return a.ok?ok(Dl(a.value,petRef)):err(a.error)},async getPetProfile(petRef,t){let l=r(petRef);if(typeof l!="string")return err(l);let i=await e.send("pets.getPetProfile",n({method:"GET",path:`${l}/profile`},t?.signal));if(!i.ok)return err(i.error);let o=Pl(i.value);return o===null?err(makeEverfurError("internalError",{retryable:false,httpStatus:502,wireMessage:"the pet profile response carried no pet_ref"})):ok(o)},async deletePet(petRef,t){let l=r(petRef);if(typeof l!="string")return err(l);let i=await e.send("pets.deletePet",n({method:"DELETE",path:l},t?.signal));return i.ok?ok(void 0):err(i.error)},async eraseUserData(e){let r=await t.send("pets.eraseUserData",n({method:"DELETE",path:"/widget/v1/me"},e?.signal),{maxAttempts:1});return r.ok?ok(void 0):err(r.error)}}}var Fl=/* @__PURE__ */new WeakMap;function Ll(e,t){let n=Fl.get(e);return n===void 0&&(n=/* @__PURE__ */new Set,Fl.set(e,n)),n.add(t),()=>{n?.delete(t)}}function useEverfurPets(){let{runtime:t,userRef:userRef,activePet:n,scopeEpoch:r}=Tn(),l=e.useMemo(()=>createPetsRepository(t.registry.services.authFor(userRef)),[t,userRef,r]),[i,o]=e.useState({repository:l,pets:[],loading:true,error:null}),a=i.repository===l?i:{pets:[],loading:true,error:null},s=e.useRef(0),c=e.useCallback(async()=>{let e=++s.current;o(e=>({...e,repository:l,loading:true,error:null,pets:e.repository===l?e.pets:[]}));let t=await l.list();e===s.current&&o(t.ok?{repository:l,pets:t.value,loading:false,error:null}:e=>({repository:l,pets:e.repository===l?e.pets:[],loading:false,error:t.error}))},[l]);e.useEffect(()=>(c(),()=>{s.current+=1}),[c]),e.useEffect(()=>Ll(t,()=>{c()}),[t,c]);let d=e.useMemo(()=>n===null?null:a.pets.find(e=>e.petRef===n)??null,[n,a.pets]);return e.useMemo(()=>({pets:a.pets,activePet:d,loading:a.loading,error:a.error,refresh:c}),[a.pets,a.loading,a.error,d,c])}var Al=/* @__PURE__ */Object.freeze([{id:"itchy-skin",label:"Itchy skin and allergies"},{id:"ear-infections",label:"Ear problems"},{id:"upset-stomach",label:"Upset stomach"},{id:"anxiety",label:"Anxiety and behavior"},{id:"parasites",label:"Fleas, ticks and heartworm"},{id:"joint-pain",label:"Joints and mobility"},{id:"eye-issues",label:"Eyes"},{id:"urinary",label:"Peeing and urinary"},{id:"surgery-aftercare",label:"Surgery aftercare"},{id:"senior-care",label:"Senior care"},{id:"wellness",label:"A wellness check-in"}].map(e=>/* @__PURE__ */Object.freeze(e))),Ol="other";function Vl(e){/* @__PURE__ */
|
|
35
|
-
return Object.freeze([...Al/* @__PURE__ */,Object.freeze({id:Ol,label:ee.otherIssue})])}function Nl(e,t){let n=e.filter(e=>e.trim().length>0),r=t.trim();return n.length===0?r:r.length===0?n.join(", "):`${n.join(", ")}\n${r}`}var Bl=/* @__PURE__ */Object.freeze([["AL","Alabama"],["AK","Alaska"],["AZ","Arizona"],["AR","Arkansas"],["CA","California"],["CO","Colorado"],["CT","Connecticut"],["DE","Delaware"],["DC","District of Columbia"],["FL","Florida"],["GA","Georgia"],["HI","Hawaii"],["ID","Idaho"],["IL","Illinois"],["IN","Indiana"],["IA","Iowa"],["KS","Kansas"],["KY","Kentucky"],["LA","Louisiana"],["ME","Maine"],["MD","Maryland"],["MA","Massachusetts"],["MI","Michigan"],["MN","Minnesota"],["MS","Mississippi"],["MO","Missouri"],["MT","Montana"],["NE","Nebraska"],["NV","Nevada"],["NH","New Hampshire"],["NJ","New Jersey"],["NM","New Mexico"],["NY","New York"],["NC","North Carolina"],["ND","North Dakota"],["OH","Ohio"],["OK","Oklahoma"],["OR","Oregon"],["PA","Pennsylvania"],["RI","Rhode Island"],["SC","South Carolina"],["SD","South Dakota"],["TN","Tennessee"],["TX","Texas"],["UT","Utah"],["VT","Vermont"],["VA","Virginia"],["WA","Washington"],["WV","West Virginia"],["WI","Wisconsin"],["WY","Wyoming"]].map(([e,t])=>/* @__PURE__ */Object.freeze({code:e,name:t})));function Ml(e){let t=e?.trim().toUpperCase()??"";return Bl.find(e=>e.code===t)?.name??t}function Hl(e,t){return e?e.wellnessAvailable?e.prescriptionsAvailable?Z(ee.wherePrescribeMetaTemplate,{pet:t}):ee.whereWellnessMeta:ee.stateBlockedTitle:null}function $l(e,t,n,r){if(!e||!t||!n||!t.prescriptionsAvailable)return null;let l=n.trim().toUpperCase();return e.licensedStates.some(e=>e.state.trim().toUpperCase()===l&&e.canPrescribe)?Z(ee.whereLicensedTemplate,{vet:e.displayName,state:Ml(l),pet:r}):null}function Wl(t){let{hostState:n,state:r,policy:l,clinician:i,petName:o,controller:a,onState:s}=t,c=n&&isWellFormedStateCode(n)?n.trim().toUpperCase():null,d=r&&isWellFormedStateCode(r)?r.trim().toUpperCase():null,u=useTelevetStatePolicy(c,a),[p,h]=e.useState(c===null||d!==null&&d!==c),f=c===null||p,m=e.useCallback(()=>{c!==null&&(h(false),s(c))},[c,s]),g=e.useCallback(()=>{h(true),d===c&&s(null)},[d,c,s]),y=e.useCallback(e=>{h(true),s(e.trim().toUpperCase())},[s]),b=c===null?null:{code:c,name:Ml(c),meta:Hl(u.data,o)},v=f&&d!==null&&(c===null||d!==c||p)?d:null,x=v===null?null:{code:v,name:Ml(v),meta:Hl(l.data,o)};return{hostPlace:b,otherSelected:f,otherPlace:x,licensedLine:$l(i,l.data,d,o),stateName:d===null?null:Ml(d),canContinue:d!==null,pickHost:m,pickOther:g,pickState:y}}function
|
|
36
|
-
return Object.freeze({index:r,draft:n,furthestIndex:r})}function isSkipped(e,t){return e==="pet"?t.ownedPetCount<=1:e==="issues"?t.withIssues!==true:false}function Yl(e){return
|
|
37
|
-
return Object.freeze({...e,index:t,furthestIndex:Math.max(e.furthestIndex,t)})}case"back":{if(Yl(e.index)==="booked")return e;let t=Jl(e.index-1,n);return t===null?e:/* @__PURE__ */Object.freeze({...e,index:t})}case"goTo":{let r=
|
|
38
|
-
return Object.freeze({...e,index:l,furthestIndex:Math.max(e.furthestIndex,l)})}default:return e}}function Ql(e){return
|
|
35
|
+
return Object.freeze([...Al/* @__PURE__ */,Object.freeze({id:Ol,label:ee.otherIssue})])}function Nl(e,t){let n=e.filter(e=>e.trim().length>0),r=t.trim();return n.length===0?r:r.length===0?n.join(", "):`${n.join(", ")}\n${r}`}var Bl=/* @__PURE__ */Object.freeze([["AL","Alabama"],["AK","Alaska"],["AZ","Arizona"],["AR","Arkansas"],["CA","California"],["CO","Colorado"],["CT","Connecticut"],["DE","Delaware"],["DC","District of Columbia"],["FL","Florida"],["GA","Georgia"],["HI","Hawaii"],["ID","Idaho"],["IL","Illinois"],["IN","Indiana"],["IA","Iowa"],["KS","Kansas"],["KY","Kentucky"],["LA","Louisiana"],["ME","Maine"],["MD","Maryland"],["MA","Massachusetts"],["MI","Michigan"],["MN","Minnesota"],["MS","Mississippi"],["MO","Missouri"],["MT","Montana"],["NE","Nebraska"],["NV","Nevada"],["NH","New Hampshire"],["NJ","New Jersey"],["NM","New Mexico"],["NY","New York"],["NC","North Carolina"],["ND","North Dakota"],["OH","Ohio"],["OK","Oklahoma"],["OR","Oregon"],["PA","Pennsylvania"],["RI","Rhode Island"],["SC","South Carolina"],["SD","South Dakota"],["TN","Tennessee"],["TX","Texas"],["UT","Utah"],["VT","Vermont"],["VA","Virginia"],["WA","Washington"],["WV","West Virginia"],["WI","Wisconsin"],["WY","Wyoming"]].map(([e,t])=>/* @__PURE__ */Object.freeze({code:e,name:t})));function Ml(e){let t=e?.trim().toUpperCase()??"";return Bl.find(e=>e.code===t)?.name??t}function Hl(e,t){return e?e.wellnessAvailable?e.prescriptionsAvailable?Z(ee.wherePrescribeMetaTemplate,{pet:t}):ee.whereWellnessMeta:ee.stateBlockedTitle:null}function $l(e,t,n,r){if(!e||!t||!n||!t.prescriptionsAvailable)return null;let l=n.trim().toUpperCase();return e.licensedStates.some(e=>e.state.trim().toUpperCase()===l&&e.canPrescribe)?Z(ee.whereLicensedTemplate,{vet:e.displayName,state:Ml(l),pet:r}):null}function Wl(t){let{hostState:n,state:r,policy:l,clinician:i,petName:o,controller:a,onState:s}=t,c=n&&isWellFormedStateCode(n)?n.trim().toUpperCase():null,d=r&&isWellFormedStateCode(r)?r.trim().toUpperCase():null,u=useTelevetStatePolicy(c,a),[p,h]=e.useState(c===null||d!==null&&d!==c),f=c===null||p,m=e.useCallback(()=>{c!==null&&(h(false),s(c))},[c,s]),g=e.useCallback(()=>{h(true),d===c&&s(null)},[d,c,s]),y=e.useCallback(e=>{h(true),s(e.trim().toUpperCase())},[s]),b=c===null?null:{code:c,name:Ml(c),meta:Hl(u.data,o)},v=f&&d!==null&&(c===null||d!==c||p)?d:null,x=v===null?null:{code:v,name:Ml(v),meta:Hl(l.data,o)};return{hostPlace:b,otherSelected:f,otherPlace:x,licensedLine:$l(i,l.data,d,o),stateName:d===null?null:Ml(d),canContinue:d!==null,pickHost:m,pickOther:g,pickState:y}}function Ul(t){let{reasonText:n,state:r,hostState:l,clinicianId:i,clinicians:o,policy:a,petName:s,controller:c,dispatch:d}=t,[u,p]=e.useState([]),[h,f]=e.useState(null),m=e.useRef(false),g=e.useMemo(()=>Vl(),[]),y=u.map(e=>g.find(t=>t.id===e)?.label??"").filter(Boolean),b=Nl(y,n),v=y.length>0?y.join(", "):n.trim(),x=e.useCallback(e=>p(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e]),[]),T=o?.find(e=>e.clinicianId===i)??o?.[0]??null,k=Wl({hostState:l,state:r,policy:a,clinician:T,petName:s??ee.petFallback,controller:c,onState:e.useCallback(e=>{m.current=true,d({type:"patch",patch:{state:e,clinicianId:null}})},[d])});return{issueChips:g,concernIds:u,toggleConcern:x,composedReason:b,aboutLine:v,emergencyAnswer:h,setEmergencyAnswer:f,where:k,matchedClinician:T,whereTouched:m}}var ql=/* @__PURE__ */Object.freeze(["pet","where","issues","reason","emergency","clinician","time","review","booked"]),Kl=/* @__PURE__ */Object.freeze({petId:null,state:null,clinicianId:null,slot:null,holdExpiresAt:null,shareHealthRecords:false,idempotencyKey:null});function initialTelevetBookingState(e,t={}){let n=/* @__PURE__ */Object.freeze({...Kl,...t}),r=Gl(0,e);/* @__PURE__ */
|
|
36
|
+
return Object.freeze({index:r,draft:n,furthestIndex:r})}function isSkipped(e,t){return e==="pet"?t.ownedPetCount<=1:e==="issues"?t.withIssues!==true:false}function Yl(e){return ql[e]}function Gl(e,t){for(let n=e;n<ql.length;n+=1){let e=Yl(n);if(e&&!isSkipped(e,t))return n}return ql.length-1}function Jl(e,t){for(let n=e;n>=0;n-=1){let e=Yl(n);if(e&&!isSkipped(e,t))return n}return null}function hasPreviousStep(e,t){return Jl(e.index-1,t)!==null}function televetBookingReducer(e,t,n){switch(t.type){case"patch":{let n={...e.draft,...t.patch};return("petId"in t.patch&&t.patch.petId!==e.draft.petId||"state"in t.patch&&t.patch.state!==e.draft.state||"clinicianId"in t.patch&&t.patch.clinicianId!==e.draft.clinicianId)&&e.draft.slot?/* @__PURE__ */Object.freeze({...e,draft:/* @__PURE__ */Object.freeze({...n,slot:null,holdExpiresAt:null,idempotencyKey:null})}):/* @__PURE__ */Object.freeze({...e,draft:/* @__PURE__ */Object.freeze(n)})}case"next":{let t=Gl(e.index+1,n);/* @__PURE__ */
|
|
37
|
+
return Object.freeze({...e,index:t,furthestIndex:Math.max(e.furthestIndex,t)})}case"back":{if(Yl(e.index)==="booked")return e;let t=Jl(e.index-1,n);return t===null?e:/* @__PURE__ */Object.freeze({...e,index:t})}case"goTo":{let r=ql.indexOf(t.step);if(r<0)return e;let l=isSkipped(t.step,n)?Gl(r,n):r;/* @__PURE__ */
|
|
38
|
+
return Object.freeze({...e,index:l,furthestIndex:Math.max(e.furthestIndex,l)})}default:return e}}function Ql(e){return ql.filter(t=>t!=="booked"&&(e===void 0||!isSkipped(t,e)))}function Xl(e,t,n=false){let r=e==="reason"&&n?"emergency":e,l=r==="booked"||t.includes(r)?t:Ql();return{current:r==="booked"?l.length:l.indexOf(r)+1,total:l.length,steps:l}}function currentStep(e){return Yl(e.index)??"pet"}function canConfirm(e,t){let n=t.trim();return!!e.petId&&!!e.clinicianId&&!!e.slot&&isWellFormedStateCode(e.state)&&n.length>0&&n.length<=g}function isHoldExpired(e,t){if(!e.holdExpiresAt)return false;let n=Date.parse(e.holdExpiresAt);return Number.isNaN(n)?false:n<=t}function Zl(e,t,n){return e.slot?.slotId!==t||e.holdExpiresAt===null||e.idempotencyKey===null?false:!isHoldExpired(e,n)}var ei=/* @__PURE__ */Object.freeze({slot:null,holdExpiresAt:null,idempotencyKey:null}),ti=Ue();function televetBookingKey(e){return`televet.book.${ti()}.${e}`}function attestation(e,t,n){let r=n?.version?.trim()??"";return!e||!t||r.length===0?/* @__PURE__ */Object.freeze({}):/* @__PURE__ */Object.freeze({state_attested:true,cancellation_policy_version:r})}function ni(e){let t=new Date(e);return Number.isNaN(t.getTime())?null:t}function ri(e){let t=ni(e);return t?t.toLocaleTimeString(void 0,{hour:"numeric",minute:"2-digit"}):""}function li(e){let t=ni(e);return t?t.toLocaleDateString(void 0,{month:"long",day:"numeric"}):""}function ii(e){let t=ni(e);return t?t.toLocaleDateString(void 0,{weekday:"short",month:"short",day:"numeric"}):""}var oi=10;function ai(e){let t=ni(e);return t?new Intl.DateTimeFormat(void 0,{timeZoneName:"short"}).formatToParts(t).find(e=>e.type==="timeZoneName")?.value??"":""}function formatVisitRange(e){let t=ni(e);if(!t)return"";let n=new Date(t.getTime()+oi*6e4).toISOString(),r=ai(e),l=`${ri(e)} - ${ri(n)}`;return r&&r!==""?`${l} ${r}`:l}function formatWhen(e){let t=li(e),n=[ri(e),ai(e)].filter(Boolean).join(" ");return[t,n].filter(Boolean).join(", ")}function formatWhenWithDay(e){let t=ni(e);return t?[t.toLocaleDateString(void 0,{weekday:"short"}),formatWhen(e)].filter(Boolean).join(", "):""}function si(e){let t=ni(e);if(!t)return"";let n=t.toLocaleDateString(void 0,{weekday:"short"}),r=t.toLocaleDateString(void 0,{year:"numeric",month:"long",day:"numeric"}),l=[ri(e),ai(e)].filter(Boolean).join(" ");return[n,r,l].filter(Boolean).join(", ")}function ci(e){return[ri(e),ai(e)].filter(Boolean).join(" ")}function di(e){let t=ni(e);return t?`${t.getFullYear()}-${t.getMonth()+1}-${t.getDate()}`:"unknown"}function ui(e){let t=ni(e);return t===null?"":t.toLocaleDateString(void 0,{month:"long"})}function pi(e){let t=ni(e);return t===null?"":t.toLocaleDateString(void 0,{weekday:"long",month:"long",day:"numeric"})}function hi(e){return e.toLocaleDateString(void 0,{weekday:"short",month:"short",day:"numeric"})}function fi(e){let t=ni(e);return t?[hi(t),ci(e)].filter(Boolean).join(" · "):""}function mi(e){return ni(e)?`${pi(e)} at ${ci(e)}`:""}function gi(e,t=false){let n=ni(e);return n?`${hi(n)} at ${t?ci(e):ri(e)}`:""}function yi(e){let t=ni(e),n=t===null?0:t.getHours();return n<12?"morning":n<17?"afternoon":"evening"}function bi(t){let{draft:n,reasonText:r,book:l,stateAttested:i,termsAttested:o,cancellationPolicy:a,triage:s,goTo:c,releaseSlot:d,setFailure:p,setEmergency:h,setBookedConsult:f,onBooked:m,media:g}=t,y=e.useCallback(e=>{let t=n.idempotencyKey;if(!canConfirm(n,r)||!t||g?.sending)return;if(isHoldExpired(n,Date.now())){p("expired"),c("time");return}let y=e=>{let t=televetBookingRefusal(e);if(t.kind==="emergency"){h(t.categories);return}if(t.kind==="rate_limited"){p("rate_limited");return}p(t.kind==="not_entitled"?"not_entitled":t.kind==="slot_taken"?"taken":t.kind==="clinician_unavailable"?"clinician_unavailable":t.kind==="unavailable"?"unavailable":"failed"),t.kind==="slot_taken"&&(d(),c("time"))};p(null),h(null);let b=d=>l.mutate({pet_id:n.petId,clinician_id:n.clinicianId,slot_id:n.slot.slotId,state:n.state,reason_text:r.trim(),species:null,media_refs:d,emergency_acknowledged:e||s.isAcknowledged(r),share_health_records:n.shareHealthRecords,...attestation(i,o,a)},t,{onSuccess:e=>{if(!u(e)){y(gt(e.status));return}f(e),c("booked"),m?.(e)},onError:e=>y(vt(e))});if(!g){b([]);return}g.send().then(b,()=>b([]))},[n,r,l,i,o,a,s,c,d,p,h,f,m,g]),b=e.useCallback(()=>y(false),[y]);return{submitBooking:y,confirm:b}}function vi(e){return e.slot!==null&&e.holdExpiresAt!==null&&e.idempotencyKey!==null?e.slot.slotId:null}function xi({controller:t,draft:n,keep:r}){let l=vi(n),i=e.useRef({controller:t,keep:r});i.current={controller:t,keep:r};let o=e.useRef(null);e.useEffect(()=>{let e=o.current;o.current=l,e!==null&&e!==l&&Ti(i.current,e)},[l]),e.useEffect(()=>()=>{let e=o.current;o.current=null,e!==null&&Ti(i.current,e)},[])}function Ti(e,t){if(e.keep)return;let n=e.controller,r=n?.releaseHold;n==null||r===void 0||r.call(n,t).catch(()=>{}).finally(()=>Vn(n,An))}function ki(e){if(e.httpStatus===409)/* @__PURE__ */return Object.freeze({failure:"taken"});switch(televetBookingRefusal(e).kind){case"slot_taken":/* @__PURE__ */
|
|
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
|
|
43
|
+
return Object.freeze({failure:"failed"})}}function wi(t){let{draft:n,hold:r,dispatch:l,setFailure:i,refetchSlots:o}=t;return e.useCallback(e=>{if(i(null),Zl(n,e.slotId,Date.now())){l({type:"next"});return}r.mutate(e.slotId,{onSuccess:t=>{l({type:"patch",patch:{slot:e,holdExpiresAt:t.expiresAt,idempotencyKey:televetBookingKey(e.slotId)}}),l({type:"next"})},onError:e=>{let t=ki(e);i(t.failure),t.failure==="taken"&&o()}})},[n,r,l,i,o])}function Si(e){let t=e?.triage;return!e||!t?null:async(n,r)=>{let l=await t.call(e,n,r);return l.ok?l.value:null}}function useEarlyTriage(t){let[n,r]=e.useState(false),[l,i]=e.useState(false),[o,a]=e.useState(null),s=e.useRef(null),c=e.useRef(null),d=e.useRef(true);e.useEffect(()=>(d.current=true,()=>{d.current=false,c.current?.abort(),c.current=null}),[]);let u=e.useCallback(()=>{c.current?.abort(),c.current=null,d.current&&i(false)},[]),p=e.useCallback(async e=>{if(c.current!==null)return false;let n=e.trim();if(o!==null&&o===n||!t)return true;let l=s.current!==null&&s.current.reason===n?s.current.emergency:null;if(l===null){let e=new AbortController;c.current=e,i(true);try{let r=await t(n,e.signal);if(e.signal.aborted||!d.current)return!1;r===null?l=!1:(l=r.isEmergency||r.fallback,s.current=/* @__PURE__ */Object.freeze({reason:n,emergency:l}))}catch{if(e.signal.aborted||!d.current)return false;l=false}finally{c.current===e&&(c.current=null,d.current&&i(false))}}return l===true?(r(true),false):true},[o,t]),h=e.useCallback(e=>{a(e.trim()),r(false)},[]),f=e.useCallback(()=>r(false),[]),m=e.useCallback(()=>{u(),s.current=null,a(null),r(false)},[u]),g=e.useCallback(e=>o!==null&&o===e.trim(),[o]);return{open:n,checking:l,check:p,acknowledge:h,close:f,cancel:u,reset:m,isAcknowledged:g}}function ji(e){let t=e?.trim().toUpperCase()??"";return/^[A-Z]{2}$/.test(t)?t:null}function useStateInterest(t,n){let r=ji(t),[l,i]=e.useState(()=>/* @__PURE__ */Object.freeze({})),o=e.useRef(0),a=e.useRef(null),s=e.useCallback(e=>{if(!n||r===null)return null;let t=`${r}:${e}`;a.current!==null&&a.current!==t&&(o.current+=1),a.current=t;let s=l[t]??"idle";return{joined:s==="joined",pending:s==="pending",failed:s==="failed",onPress:()=>{if(s==="pending"||s==="joined")return;let l=o.current+=1;i(e=>/* @__PURE__ */Object.freeze({...e,[t]:"pending"})),(async()=>{let a=false;try{a=await n(r,e)}catch{a=false}o.current===l&&i(e=>/* @__PURE__ */Object.freeze({...e,[t]:a?"joined":"failed"}))})()}}},[r,l,n]);return e.useMemo(()=>({actionFor:s}),[s])}function televetEmptyRosterView(e){/* @__PURE__ */
|
|
44
44
|
return Object.freeze(e==="dark"?{title:ee.noCliniciansTitle,message:ee.noCliniciansBody,retryLabel:ee.noCliniciansRetryCta,interestReason:null}:{title:ee.noCliniciansTitle,message:ee.noCliniciansRegionBody,retryLabel:null,interestReason:"no_licensed_vet"})}function televetEmptyRosterCause(e){return e?"roster":"dark"}var Ci=120;function sanitizeFilename(e){if(!e)return"attachment";let t=e.replace(/[\\/]+/g," ").replace(/[\x00-\x1f\x7f"]/g,"").replace(/\s+/g," ").trim();if(!t)return"attachment";if(t.length<=Ci)return t;let n=t.lastIndexOf(".");if(n===-1||n===t.length-1)return t.slice(0,Ci);let r=t.slice(n);return r.length>=Ci?t.slice(0,Ci):`${t.slice(0,n).slice(0,Ci-r.length)}${r}`}var _i=e=>/* @__PURE__ */Object.freeze({ok:true,value:e}),Ii=e=>/* @__PURE__ */Object.freeze({ok:false,error:e});function Ei(e,t,n,r){/* @__PURE__ */
|
|
45
|
-
return Object.freeze({code:e,retryable:t,filename:n,...{}})}async function uploadAttachmentBytes(e,t,n,r){let l=()=>r?.signal?.aborted===true;if(l())return Ii(Ei("cancelled",true,n.filename));try{return await e.postMultipart(t,n.file,{...r?.signal?{signal:r.signal}:{},...r?.onProgress?{onProgress:r.onProgress}:{}}),_i(void 0)}catch{return l()?Ii(Ei("cancelled",true,n.filename)):Ii(Ei("server",true,n.filename))}}var Di=/* @__PURE__ */Object.freeze({failed:0,refused:/* @__PURE__ */Object.freeze({size:0,type:0,unreadable:0})});function isMediaShortfallEmpty(e){let{failed:t,refused:n}=e;return t<=0&&n.size<=0&&n.type<=0&&n.unreadable<=0}function televetMediaShortfallLines(e){let t=e=>Number.isFinite(e)&&e>0?Math.floor(e):0,n=ee.media;return[{n:t(e.failed),one:n.droppedTemplate,many:n.droppedPluralTemplate},{n:t(e.refused.size),one:n.refusedSizeTemplate,many:n.refusedSizePluralTemplate},{n:t(e.refused.type),one:n.refusedTypeTemplate,many:n.refusedTypePluralTemplate},{n:t(e.refused.unreadable),one:n.refusedUnreadableTemplate,many:n.refusedUnreadablePluralTemplate}].filter(e=>e.n>0).map(e=>Z(e.n===1?e.one:e.many,{n:String(e.n)}))}function mediaShortfallFromUnsentPicks(e){let t=Number.isFinite(e)&&e>0?Math.floor(e):0;return t===0?Di:/* @__PURE__ */Object.freeze({failed:t,refused:Di.refused})}function withUnsentPicks(e,t){let n=mediaShortfallFromUnsentPicks(t);return n.failed===0?e:/* @__PURE__ */Object.freeze({failed:e.failed+n.failed,refused:e.refused})}var Pi=6e4;function Ri(e){let t=dt(e.filename,e.mimeType);return t===null?null:{file:{uri:e.uri,name:e.filename,mimeType:t,sizeBytes:e.fileSize},filename:e.filename,contentType:t,sizeBytes:e.fileSize}}function zi(e,t){if(e?.kind!=="ready")return null;let n=e.policy.expires_in_seconds*1e3;return t-e.at<n-Pi?e.policy:null}function Fi({media:t,controller:n,transport:r}){let[l,i]=e.useState(()=>/* @__PURE__ */new Map),[o,a]=e.useState(false),[s,c]=e.useState(false),d=e.useRef(l),u=e.useRef(t);u.current=t;let p=e.useRef(false),h=e.useRef(false),f=e.useRef(new AbortController);e.useEffect(()=>{let e=new AbortController;return f.current=e,()=>e.abort()},[]);let m=n?.initiateAttachment?.bind(n),g=o||m===void 0,y=e.useCallback((e,t)=>{let n=new Map(d.current);n.set(e,t),d.current=n,i(n)},[]),b=e.useCallback(()=>{p.current=true,a(true)},[]),v=e.useCallback(async(e,t)=>{if(m===void 0)return"dark";let n=await m({filename:t.filename,contentType:t.contentType,fileSize:t.sizeBytes},f.current.signal);if(f.current.signal.aborted)return null;if(n.ok)return y(e.uri,{kind:"ready",policy:n.value,at:Date.now()}),n.value;let r=ft(n.error);return r==="dark"?"dark":(y(e.uri,r==="failed"?{kind:"retry"}:{kind:"refused",cause:r}),null)},[m,y]);e.useEffect(()=>{if(!g)for(let e of t){if(d.current.has(e.uri))continue;let t=ut(e),n=Ri(e);if(t!==null||n===null){y(e.uri,{kind:"refused",cause:t??"type"});continue}y(e.uri,{kind:"checking"}),v(e,n).then(e=>{e==="dark"&&b()})}},[t,g,v,y,b]);let x=e.useCallback(async()=>{if(p.current||m===void 0||h.current)return[];h.current=true,c(true);let e=[];try{for(let t of u.current){let n=d.current.get(t.uri);if(n?.kind==="sent"){e.push(n.s3Key);continue}if(n?.kind==="refused")continue;let l=Ri(t);if(l===null)continue;let i=zi(n,Date.now());if(i===null){let e=await v(t,l);if(e==="dark")return b(),[];if(e===null){d.current.get(t.uri)?.kind==="retry"&&y(t.uri,{kind:"failed"});continue}i=e}if(f.current.signal.aborted)return[];let o=await uploadAttachmentBytes(r,i,l,{signal:f.current.signal});if(f.current.signal.aborted)return[];o.ok?(y(t.uri,{kind:"sent",s3Key:i.s3_key}),e.push(i.s3_key)):y(t.uri,{kind:"failed"})}return e}catch{return e}finally{h.current=false,f.current.signal.aborted||c(false)}},[m,v,y,b,r]),T=e.useMemo(()=>{if(t.length===0)return Di;if(g)return mediaShortfallFromUnsentPicks(t.length);let e={size:0,type:0,unreadable:0},n=0;for(let r of t){let t=l.get(r.uri);t?.kind==="refused"?e[t.cause]+=1:t?.kind==="failed"&&(n+=1)}return n===0&&e.size+e.type+e.unreadable===0?Di:/* @__PURE__ */Object.freeze({failed:n,refused:/* @__PURE__ */Object.freeze(e)})},[t,g,l]),
|
|
46
|
-
return Object.freeze({postMultipart(t,n,r){if(typeof n.uri!="string"||n.uri.length===0)return Promise.reject(new Error(Mi));let{signal:l,onProgress:i}=r,o=()=>Promise.reject(new Error(Hi));return l?.aborted===true?o():Oi({url:t.upload_url,fields:t.upload_fields,file:$i(n),signal:l,fetch:e.fetch}).then(e=>{if(!e)return o();i?.(1)},o)}})}var Wi=/* @__PURE__ */Object.freeze({title:"Vet test mode (sandbox tenants)",create:"Create a simulated visit for this pet",createLabel:"Create",visitTemplate:"Visit {visitRef}: {status}, scheduled {scheduledAt}.",eventsNote:"Raise one of the visit events that is not a status change, to see what a tap on it opens:",advance:/* @__PURE__ */Object.freeze({completed:"Complete it",cancelled:"Cancel it",no_show:"Mark no-show"}),events:/* @__PURE__ */Object.freeze({rescheduled:"Rescheduled",reminder:"Reminder (24h)",followup_sent:"Follow-up sent",message_received:"Vet replied",ended:"Ended"}),resultTemplate:"{label}: {result}.",errorTemplate:"{label}: {message}"});var
|
|
45
|
+
return Object.freeze({code:e,retryable:t,filename:n,...{}})}async function uploadAttachmentBytes(e,t,n,r){let l=()=>r?.signal?.aborted===true;if(l())return Ii(Ei("cancelled",true,n.filename));try{return await e.postMultipart(t,n.file,{...r?.signal?{signal:r.signal}:{},...r?.onProgress?{onProgress:r.onProgress}:{}}),_i(void 0)}catch{return l()?Ii(Ei("cancelled",true,n.filename)):Ii(Ei("server",true,n.filename))}}var Di=/* @__PURE__ */Object.freeze({failed:0,refused:/* @__PURE__ */Object.freeze({size:0,type:0,unreadable:0})});function isMediaShortfallEmpty(e){let{failed:t,refused:n}=e;return t<=0&&n.size<=0&&n.type<=0&&n.unreadable<=0}function televetMediaShortfallLines(e){let t=e=>Number.isFinite(e)&&e>0?Math.floor(e):0,n=ee.media;return[{n:t(e.failed),one:n.droppedTemplate,many:n.droppedPluralTemplate},{n:t(e.refused.size),one:n.refusedSizeTemplate,many:n.refusedSizePluralTemplate},{n:t(e.refused.type),one:n.refusedTypeTemplate,many:n.refusedTypePluralTemplate},{n:t(e.refused.unreadable),one:n.refusedUnreadableTemplate,many:n.refusedUnreadablePluralTemplate}].filter(e=>e.n>0).map(e=>Z(e.n===1?e.one:e.many,{n:String(e.n)}))}function mediaShortfallFromUnsentPicks(e){let t=Number.isFinite(e)&&e>0?Math.floor(e):0;return t===0?Di:/* @__PURE__ */Object.freeze({failed:t,refused:Di.refused})}function withUnsentPicks(e,t){let n=mediaShortfallFromUnsentPicks(t);return n.failed===0?e:/* @__PURE__ */Object.freeze({failed:e.failed+n.failed,refused:e.refused})}var Pi=6e4;function Ri(e){let t=dt(e.filename,e.mimeType);return t===null?null:{file:{uri:e.uri,name:e.filename,mimeType:t,sizeBytes:e.fileSize},filename:e.filename,contentType:t,sizeBytes:e.fileSize}}function zi(e,t){if(e?.kind!=="ready")return null;let n=e.policy.expires_in_seconds*1e3;return t-e.at<n-Pi?e.policy:null}function Fi({media:t,controller:n,transport:r}){let[l,i]=e.useState(()=>/* @__PURE__ */new Map),[o,a]=e.useState(false),[s,c]=e.useState(false),d=e.useRef(l),u=e.useRef(t);u.current=t;let p=e.useRef(false),h=e.useRef(false),f=e.useRef(new AbortController);e.useEffect(()=>{let e=new AbortController;return f.current=e,()=>e.abort()},[]);let m=n?.initiateAttachment?.bind(n),g=o||m===void 0,y=e.useCallback((e,t)=>{let n=new Map(d.current);n.set(e,t),d.current=n,i(n)},[]),b=e.useCallback(()=>{p.current=true,a(true)},[]),v=e.useCallback(async(e,t)=>{if(m===void 0)return"dark";let n=await m({filename:t.filename,contentType:t.contentType,fileSize:t.sizeBytes},f.current.signal);if(f.current.signal.aborted)return null;if(n.ok)return y(e.uri,{kind:"ready",policy:n.value,at:Date.now()}),n.value;let r=ft(n.error);return r==="dark"?"dark":(y(e.uri,r==="failed"?{kind:"retry"}:{kind:"refused",cause:r}),null)},[m,y]);e.useEffect(()=>{if(!g)for(let e of t){if(d.current.has(e.uri))continue;let t=ut(e),n=Ri(e);if(t!==null||n===null){y(e.uri,{kind:"refused",cause:t??"type"});continue}y(e.uri,{kind:"checking"}),v(e,n).then(e=>{e==="dark"&&b()})}},[t,g,v,y,b]);let x=e.useCallback(async()=>{if(p.current||m===void 0||h.current)return[];h.current=true,c(true);let e=[];try{for(let t of u.current){let n=d.current.get(t.uri);if(n?.kind==="sent"){e.push(n.s3Key);continue}if(n?.kind==="refused")continue;let l=Ri(t);if(l===null)continue;let i=zi(n,Date.now());if(i===null){let e=await v(t,l);if(e==="dark")return b(),[];if(e===null){d.current.get(t.uri)?.kind==="retry"&&y(t.uri,{kind:"failed"});continue}i=e}if(f.current.signal.aborted)return[];let o=await uploadAttachmentBytes(r,i,l,{signal:f.current.signal});if(f.current.signal.aborted)return[];o.ok?(y(t.uri,{kind:"sent",s3Key:i.s3_key}),e.push(i.s3_key)):y(t.uri,{kind:"failed"})}return e}catch{return e}finally{h.current=false,f.current.signal.aborted||c(false)}},[m,v,y,b,r]),T=e.useMemo(()=>{if(t.length===0)return Di;if(g)return mediaShortfallFromUnsentPicks(t.length);let e={size:0,type:0,unreadable:0},n=0;for(let r of t){let t=l.get(r.uri);t?.kind==="refused"?e[t.cause]+=1:t?.kind==="failed"&&(n+=1)}return n===0&&e.size+e.type+e.unreadable===0?Di:/* @__PURE__ */Object.freeze({failed:n,refused:/* @__PURE__ */Object.freeze(e)})},[t,g,l]),k=e.useMemo(()=>t.flatMap(e=>{let t=l.get(e.uri);return t?.kind==="sent"?[{key:t.s3Key,pick:e}]:[]}),[t,l]),w=e.useCallback(e=>{if(g)return T;let t=new Set(e.mediaRefs),n=k.filter(e=>!t.has(e.key)).length;return n===0?T:/* @__PURE__ */Object.freeze({failed:T.failed+n,refused:T.refused})},[g,T,k]),S=e.useCallback(e=>{if(g||k.length!==1)return false;let[t]=k;return t===void 0||!e.mediaRefs.includes(t.key)?false:(dt(t.pick.filename,t.pick.mimeType)??"").startsWith("image/")},[g,k]),j=!g&&[...l.values()].some(e=>e.kind==="ready"||e.kind==="sent");return e.useMemo(()=>({shortfall:T,sending:s,live:j,send:x,bookedShortfall:w,sentOnePhoto:S}),[T,s,j,x,w,S])}var Li="file",Ai="multipart upload failed";function Oi(e){let t;try{t=new FormData;for(let[n,r]of Object.entries(e.fields))t.append(n,r);t.append(Li,e.file)}catch{return Promise.reject(new Error(Ai))}return e.fetch!==void 0?Bi(e.fetch,e.url,t,e.signal):Ni(e.url,t,e.signal)}function Vi(e){return e>=200&&e<300}function Ni(e,t,n){return new Promise((r,l)=>{let i=globalThis.XMLHttpRequest;if(typeof i!="function"||n?.aborted===true){l(new Error(Ai));return}let o=null,a=()=>{o!==null&&n?.removeEventListener("abort",o)},s=()=>{a(),l(new Error(Ai))};try{let l=new i;l.open("POST",e),l.withCredentials=!1,l.onload=()=>{a(),r(Vi(l.status))},l.onerror=s,l.ontimeout=s,l.onabort=s,n!==void 0&&(o=()=>{try{l.abort()}finally{s()}},n.addEventListener("abort",o,{once:!0})),l.send(t)}catch{s()}})}function Bi(e,t,n,r){return Promise.resolve().then(()=>e(t,{method:"POST",body:n,credentials:"omit",...r?{signal:r}:{}})).then(e=>e.ok)}var Mi="chat attachment upload: the file handle has no uri",Hi="chat attachment upload failed";function $i(e){return{uri:e.uri,name:sanitizeFilename(e.name),type:e.mimeType}}function createRnChatAttachmentTransport(e={}){/* @__PURE__ */
|
|
46
|
+
return Object.freeze({postMultipart(t,n,r){if(typeof n.uri!="string"||n.uri.length===0)return Promise.reject(new Error(Mi));let{signal:l,onProgress:i}=r,o=()=>Promise.reject(new Error(Hi));return l?.aborted===true?o():Oi({url:t.upload_url,fields:t.upload_fields,file:$i(n),signal:l,fetch:e.fetch}).then(e=>{if(!e)return o();i?.(1)},o)}})}var Wi=/* @__PURE__ */Object.freeze({title:"Vet test mode (sandbox tenants)",create:"Create a simulated visit for this pet",createLabel:"Create",visitTemplate:"Visit {visitRef}: {status}, scheduled {scheduledAt}.",eventsNote:"Raise one of the visit events that is not a status change, to see what a tap on it opens:",advance:/* @__PURE__ */Object.freeze({completed:"Complete it",cancelled:"Cancel it",no_show:"Mark no-show"}),events:/* @__PURE__ */Object.freeze({rescheduled:"Rescheduled",reminder:"Reminder (24h)",followup_sent:"Follow-up sent",message_received:"Vet replied",ended:"Ended"}),resultTemplate:"{label}: {result}.",errorTemplate:"{label}: {message}"});var Ui="/widget/v1/televet/sandbox/visits",qi=128,Ki=64,Yi=/* @__PURE__ */new Set(["booked","cancelled","completed","no_show"]),Gi=/* @__PURE__ */new Set(["applied","already_applied","not_applicable"]),Ji=/* @__PURE__ */new Set(["rescheduled","reminder","followup_sent","message_received","ended"]),Qi=/* @__PURE__ */new Set(["24h","30m"]);function Xi(e){return makeEverfurError("validationFailed",{retryable:false,wireMessage:e})}function Zi(e,t,n){return typeof t!="string"||t.length===0?Xi(`${e} is required and must be a non-empty string`):Pr(t)?Xi(`${e} contains an unpaired surrogate and cannot be encoded`):Rr(t)>n?Xi(`${e} is longer than ${n} characters`):null}function eo(e){if(typeof e!="object"||e===null)return null;let{result:t,visit:n}=e;if(typeof t!="string"||!Gi.has(t)||typeof n!="object"||n===null)return null;let{visit_ref:r,pet_ref:l,status:i,scheduled_at:o}=n;return typeof r!="string"||r.length===0||typeof l!="string"||l.length===0||typeof i!="string"||!Yi.has(i)||typeof o!="string"||o.length===0?null:/* @__PURE__ */Object.freeze({result:t,visit:/* @__PURE__ */Object.freeze({visitRef:r,petRef:l,status:i,scheduledAt:o})})}function to(e){let t=e.funnel??createRequestFunnel({auth:e.auth,...e.errorPolicy?{errorPolicy:e.errorPolicy}:{}}),n=async(e,n,r)=>{let l=await t.send(e,{method:"POST",path:n,body:r},{idempotent:false,maxAttempts:1});if(!l.ok)return err(l.error);let i=eo(l.value);return i===null?err(makeEverfurError("internalError",{retryable:false})):ok(i)};return{createVisit(petRef){let e=Zi("pet_ref",petRef,qi);return e!==null?Promise.resolve(err(e)):n("televet.sandbox.createVisit",Ui,{pet_ref:petRef})},advanceVisit(e,t){let r=Zi("visit_ref",e,Ki);if(r!==null)return Promise.resolve(err(r));if(typeof t!="string"||!Yi.has(t))return Promise.resolve(err(Xi("to must be booked, cancelled, completed or no_show")));let l=`${Ui}/${encodeURIComponent(e)}/advance`;return n("televet.sandbox.advanceVisit",l,{to:t})},simulateVisitEvent(e,t,r){let l=Zi("visit_ref",e,Ki);if(l!==null)return Promise.resolve(err(l));if(typeof t!="string"||!Ji.has(t))return Promise.resolve(err(Xi(`event must be one of ${[...Ji].join(", ")}`)));if(t==="reminder"){if(typeof r!="string"||!Qi.has(r))return Promise.resolve(err(Xi(`stage must be one of ${[...Qi].join(", ")} for a reminder`)))}else if(r!==void 0)return Promise.resolve(err(Xi("stage is only for a reminder")));let i=`${Ui}/${encodeURIComponent(e)}/simulate`;return n("televet.sandbox.simulateVisitEvent",i,r===void 0?{event:t}:{event:t,stage:r})}}}function useEverfurVetVisitSandbox(){let{runtime:t,userRef:userRef,scopeEpoch:n}=Tn();return e.useMemo(()=>{let{services:e}=t.registry;return to({auth:e.authFor(userRef),...e.errorPolicy?{errorPolicy:e.errorPolicy}:{}})},[t,userRef,n])}function no(e,t){return!e||!t.enabled?false:t.data!==null&&t.data.active===false||Kn({error:t.error??null})}var ro=e=>e.livemode===false;function lo(){let t=Tn().runtime.entitlements,n=e.useCallback(()=>ro(t.getSnapshot()),[t]);return e.useSyncExternalStore(t.subscribe,n,n)}function io(e,t){let n=no(lo(),e);return{simulate:n,fundingRefused:t&&!n}}function oo(e,t){return!e||!t.enabled?true:(t.data!==null||(t.error??null)!==null)&&!no(true,t)}function ao(e,t){return oo(lo(),t)?e:null}function so(petRef){let t=useEverfurVetVisitSandbox(),[n,r]=e.useState(null),[l,i]=e.useState(null),[o,a]=e.useState(false),s=e.useRef(false),c=e.useRef(true);e.useEffect(()=>(c.current=true,()=>{c.current=false}),[]);let d=e.useCallback((e,t,n)=>{s.current||(s.current=true,a(true),t().then(t=>{if(s.current=false,!!c.current){if(a(false),!t.ok){i({tone:"danger",text:Z(Wi.errorTemplate,{label:e,message:t.error.displayMessage})});return}n&&r(t.value.visit),i({tone:"ok",text:Z(Wi.resultTemplate,{label:e,result:t.value.result})})}}))},[]),u=e.useCallback(()=>{d(Wi.createLabel,()=>t.createVisit(petRef),true)},[petRef,d,t]),p=e.useCallback(e=>{n!==null&&d(Wi.advance[e],()=>t.advanceVisit(n.visitRef,e),true)},[d,t,n]),h=e.useCallback(e=>{if(n===null)return;let r=e==="reminder"?"24h":void 0;d(Wi.events[e],()=>t.simulateVisitEvent(n.visitRef,e,r),false)},[d,t,n]),f=n===null?null:Z(Wi.visitTemplate,{visitRef:n.visitRef,status:n.status,scheduledAt:n.scheduledAt});return{visit:n,visitLine:f,line:l,busy:o,create:u,advance:p,raise:h}}var co=/* @__PURE__ */Object.freeze(["completed","cancelled","no_show"]),uo=/* @__PURE__ */Object.freeze(["rescheduled","reminder","followup_sent","message_received","ended"]);function parseColor(e){let t=po(e);return t===null?null:vo(t)}function po(e){if(typeof e=="number")return mo(e);if(typeof e!="string")return null;let t=e.trim();if(t.length===0)return null;if(t.startsWith("#"))return ho(t.slice(1));if(t.toLowerCase().startsWith("0x"))return ho(t.slice(2));if(t.toLowerCase().startsWith("rgb"))return fo(t);if(/^[0-9a-fA-F]+$/.test(t)){let e=ho(t);if(e!==null)return e}return/^\d+$/.test(t)?mo(Number.parseInt(t,10)):null}function ho(e){let t=e.trim();if(!/^[0-9a-fA-F]+$/.test(t))return null;if(t.length===3)return{r:yo(t[0]),g:yo(t[1]),b:yo(t[2]),a:1};if(t.length===6)return{r:go(t,0),g:go(t,2),b:go(t,4),a:1};if(t.length===8){let e=go(t,0);return{r:go(t,2),g:go(t,4),b:go(t,6),a:e/255}}return null}function fo(e){let t=e.indexOf("("),n=e.indexOf(")");if(t<0||n<0||n<t)return null;let r=e.slice(t+1,n).split(",").map(e=>e.trim());if(r.length<3)return null;let l=bo(Number(r[0])),i=bo(Number(r[1])),o=bo(Number(r[2]));if(l===null||i===null||o===null)return null;let a=1;if(r.length>=4){let e=Number(r[3]);if(!Number.isFinite(e))return null;a=Math.min(1,Math.max(0,e))}return{r:l,g:i,b:o,a:a}}function mo(e){if(!Number.isFinite(e))return null;let t=Math.trunc(e)>>>0,n=t>>>24&255;return{r:t>>>16&255,g:t>>>8&255,b:t&255,a:n===0?1:n/255}}function go(e,t){return Number.parseInt(e.slice(t,t+2),16)}function yo(e){return Number.parseInt(`${e??"0"}${e??"0"}`,16)}function bo(e){return Number.isFinite(e)?Math.min(255,Math.max(0,Math.round(e))):null}function vo(e){if(e.a>=1)return xo(e.r,e.g,e.b);let t=Math.round(e.a*1e3)/1e3;return`rgba(${e.r},${e.g},${e.b},${t})`}function xo(e,t,n){return`#${To(e)}${To(t)}${To(n)}`.toUpperCase()}function To(e){return e.toString(16).padStart(2,"0")}var ko="#FFFFFF",wo="#000000";function So(e){let t=t=>e.reduce((e,n)=>Math.min(e,contrastRatio(t,n)),Number.POSITIVE_INFINITY);return t(ko)>=t(wo)?ko:wo}function jo(e){let t=Co(e.r/255),n=Co(e.g/255),r=Co(e.b/255);return.2126*t+.7152*n+.0722*r}function Co(e){return e<=.03928?e/12.92:Math.pow((e+.055)/1.055,2.4)}function _o(e,t){let n=Math.max(e,t),r=Math.min(e,t);return(n+.05)/(r+.05)}function contrastRatio(e,t){let n=po(e),r=po(t);if(n===null||r===null)return 1;let l=r.a>=1?r:{...r},i=n.a>=1?n:Io(n,l);return _o(jo(i),jo(l))}function Io(e,t){let n=e.a,r=(e,t)=>Math.round(e*n+t*(1-n));return{r:r(e.r,t.r),g:r(e.g,t.g),b:r(e.b,t.b),a:1}}function Eo(e,t){let n=po(e),r=po(t);if(n===null||r===null)return null;let l=n.a>=1?n:Io(n,{...r});return xo(l.r,l.g,l.b)}function Do(e,t){let n=po(e);if(n===null)return null;let r=Math.min(1,Math.max(0,t));return`rgba(${n.r}, ${n.g}, ${n.b}, ${r})`}var Po=.22,Ro=.5,zo="#FFC3BC";function Fo(e){let t=e.color;return{ink:t.brandInk,text:t.text.primary,muted:t.text.muted,line:t.borderRingCream,mist:t.surfaceSubtle,surface:t.surface,pink:t.highlight,onPink:t.onHighlight,go:t.mark,alert:t.danger,alertWash:t.badgeBgCritical}}function Lo(e){let t=e.color,n=parseColor(t.highlight)===zo,r=Do(t.highlight,n?Po:Ro);return{...Fo(e),pinkSoft:(r===null?null:Eo(r,t.surface))??t.surface}}function Ao(e,t){if(e===void 0)return{};let n={};return e.backgroundColor!==void 0&&(n.backgroundColor=e.backgroundColor),e.borderColor!==void 0&&(n.borderColor=e.borderColor,n.borderWidth=t??1),e.borderRadius!==void 0&&(n.borderRadius=e.borderRadius),n}function Oo(e,t){return e===void 0||e.borderRadius!==void 0||e.backgroundColor===void 0&&e.borderColor===void 0?e:{...e,borderRadius:t}}function Vo(e){return e?.textColor===void 0?{}:{color:e.textColor}}var No=44;function Bo(){let t=useEverfurTheme();return e.useMemo(()=>Mo(t),[t])}function TelevetButton({label:e,onPress:n,kind:l="primary",disabled:i=false,loading:o=false,fullWidth:a=true,accessibilityLabel:s,testID:c,style:d}){let u=Bo(),p=useEverfurTheme(),h=i||o;/* @__PURE__ */
|
|
47
47
|
return r.jsxs(t.Pressable,{onPress:n,disabled:h,accessibilityRole:"button",accessibilityLabel:s??e,accessibilityState:{disabled:h,busy:o},style:({pressed:e})=>[u.button,l==="primary"?u.buttonPrimary:l==="danger"?u.buttonDanger:l==="quiet"?u.buttonQuiet:u.buttonSecondary,a?u.buttonFull:u.buttonAuto,h?u.buttonDisabled:null,e&&!p.motion.reducedMotion?u.buttonPressed:null,d],testID:c,children:[o?/* @__PURE__ */r.jsx(t.ActivityIndicator,{size:"small",color:l==="secondary"||l==="quiet"?p.color.brandInk:l==="danger"?p.color.onDanger:p.color.onPrimary}):null,
|
|
48
48
|
/* @__PURE__ */r.jsx(Text,{tier:"control",style:l==="secondary"||l==="quiet"?u.buttonSecondaryLabel:l==="danger"?u.buttonDangerLabel:u.buttonPrimaryLabel,children:e})]})}function TelevetStateCard({title:e,message:n,actionLabel:l,onAction:i,testID:o}){let a=Bo(),s=typeof l=="string"&&l.length>0&&typeof i=="function";/* @__PURE__ */
|
|
49
49
|
return r.jsxs(t.View,{style:a.stateCard,testID:o,children:[
|
|
@@ -73,26 +73,26 @@ return r.jsx(EntitlementPausedState,{...e?{onCheckAvailability:e}:{}})}function
|
|
|
73
73
|
return r.jsxs(t.View,{testID:"televet-booking-not-entitled",style:l.list,children:[n?n():/* @__PURE__ */r.jsx(TelevetStateCard,{title:ee.bookingPausedTitle}),e?/* @__PURE__ */r.jsx(TelevetButton,{label:ee.checkAvailabilityCta,kind:"secondary",onPress:e,testID:"televet-check-state-availability"}):null]})}function TelevetMediaDropNotice({shortfall:n,testIDPrefix:l}){let i=useEverfurTheme(),o=e.useMemo(()=>$o(i),[i]);if(isMediaShortfallEmpty(n))return null;let a=televetMediaShortfallLines(n);return a.length===0?null:/* @__PURE__ */r.jsx(t.View,{style:o.mediaNotice,testID:`${l}-media-notice`,children:a.map((e,t)=>/* @__PURE__ */r.jsx(Text,{style:o.mediaLine,accessibilityLiveRegion:"polite",testID:`${l}-media-line-${String(t)}`,children:e},e))})}function $o(e){let{color:t,space:n,radius:r,type:l}=e,{size:i,lineHeight:o}=l;return{emergencyPanel:{flex:0,gap:n.sm,padding:n.lg,borderRadius:r.lg,borderWidth:2,borderColor:t.danger,backgroundColor:t.surface},emergencyTitle:{...face(e,"medium"),color:t.danger,fontSize:i.heading,lineHeight:i.heading*o.snug},emergencyLede:{...face(e,"regular"),color:t.text.primary,fontSize:i.subtitle,lineHeight:i.subtitle*o.normal},interestAction:{gap:n.sm,marginTop:n.sm},interestFeedback:{gap:n.xs,marginTop:n.sm},interestBody:{...face(e,"regular"),color:t.text.metaCool},mediaNotice:{gap:n.xs},mediaLine:{...face(e,"regular"),color:t.text.metaCool,fontSize:i.caption,lineHeight:i.caption*o.normal}}}function Wo(e){let{surfaceUnavailable:t,notEntitled:n,policyBlocked:r,triageOpen:l,step:i}=e;return t||n&&i!=="clinician"||r?true:i==="reason"&&l}function TelevetBookingGate({state:e,petName:n,primaryVet:l,onFindEmergencyVet:i,stateInterest:o=null,onCheckAvailability:a,onAcknowledgeEmergency:s,renderUnavailable:c}){let d=Bo(),{surfaceUnavailable:u,notEntitled:p,policyBlocked:h,triageOpen:f,step:m}=e;return u?/* @__PURE__ */r.jsx(t.View,{style:d.stepFill,testID:"televet-booking-unavailable",children:c?c():/* @__PURE__ */r.jsx(TelevetStateCard,{title:ee.bookingPausedTitle})}):p&&m!=="clinician"?/* @__PURE__ */r.jsx(EntitlementPausedState,{...a?{onCheckAvailability:a}:{},...c?{renderUnavailable:c}:{}}):h?
|
|
74
74
|
/* @__PURE__ */r.jsxs(t.View,{testID:"televet-booking-state-blocked",children:[
|
|
75
75
|
/* @__PURE__ */r.jsx(TelevetStateCard,{title:ee.stateBlockedTitle}),
|
|
76
|
-
/* @__PURE__ */r.jsx(TelevetStateInterestAction,{action:o,testIDPrefix:"televet-state-interest-state-blocked"})]}):m==="reason"&&f?/* @__PURE__ */r.jsx(TelevetEarlyEmergency,{...n!==void 0?{petName:n}:{},...l?{primaryVet:l}:{},onFindEmergencyVet:i,onContinue:s}):null}var
|
|
77
|
-
/* @__PURE__ */r.jsx(t.View,{testID:"televet-booking-location-unknown",children:/* @__PURE__ */r.jsx(TelevetStateCard,{title:i==="blocked"?ee.locationBlockedTitle:i==="unavailable"?ee.locationUnavailableTitle:ee.locationUnknownTitle,message:i==="blocked"?ee.locationBlockedBody:i==="unavailable"?ee.locationUnavailableBody:o?ee.locationUnknownBody:void 0,actionLabel:o?i==="blocked"?ee.locationBlockedCta:ee.locationUnknownCta:void 0,onAction:o})}):n.isEmpty?/* @__PURE__ */r.jsx(TelevetClinicianEmptyState,{cause:l,onRetry:a,stateInterest:s}):/* @__PURE__ */r.jsx(EntitlementPausedState,{...c?{renderUnavailable:c}:{}})}function Yo(e){return e.trim().replace(/^dr\.?\s+/i,"").slice(0,1).toUpperCase()}function televetConsultCalendarKey(e){return`televet-consult-${e}`}function TelevetBookedScreen({consult:n,petName:l,onDone:i,onAddToCalendar:o,canJoinInApp:a=false,sharedRecords:s=false,sentPhoto:c=false}){let d=useEverfurTheme(),u=Bo(),p=e.useMemo(()=>Go(d),[d]),[h,f]=e.useState("idle"),m=async()=>{if(!o)return;f("saving");let e=new Date(n.scheduledAt);if(Number.isNaN(e.getTime())){f("failed");return}let t=await
|
|
78
|
-
/* @__PURE__ */r.jsx(t.Animated.View,{style:[p.avatar,{opacity:
|
|
76
|
+
/* @__PURE__ */r.jsx(TelevetStateInterestAction,{action:o,testIDPrefix:"televet-state-interest-state-blocked"})]}):m==="reason"&&f?/* @__PURE__ */r.jsx(TelevetEarlyEmergency,{...n!==void 0?{petName:n}:{},...l?{primaryVet:l}:{},onFindEmergencyVet:i,onContinue:s}):null}var Uo=false;function qo(){if(!Uo){Uo=true;try{globalThis.console?.warn?.("[everfur] The vet booking has no US state for this member, so it cannot list vets. Pass the member's two-letter state as `usState` (on EverfurTelevet, VetVisitButton or EverfurChat as `vetUsState`), or pass `onRequestLocation` so the booking can ask your app to resolve one. The SDK never reads a device location itself.")}catch{}}}function Ko(e){return e.noState?true:e.isPending||e.isError?false:e.isEmpty||e.notEntitled}function TelevetClinicianOutcome({state:n,cause:l,locationStatus:i,onRequestLocation:o,onRetry:a,stateInterest:s=null,renderUnavailable:c}){let d=n.noState&&!o;return e.useEffect(()=>{d&&qo()},[d]),n.noState?
|
|
77
|
+
/* @__PURE__ */r.jsx(t.View,{testID:"televet-booking-location-unknown",children:/* @__PURE__ */r.jsx(TelevetStateCard,{title:i==="blocked"?ee.locationBlockedTitle:i==="unavailable"?ee.locationUnavailableTitle:ee.locationUnknownTitle,message:i==="blocked"?ee.locationBlockedBody:i==="unavailable"?ee.locationUnavailableBody:o?ee.locationUnknownBody:void 0,actionLabel:o?i==="blocked"?ee.locationBlockedCta:ee.locationUnknownCta:void 0,onAction:o})}):n.isEmpty?/* @__PURE__ */r.jsx(TelevetClinicianEmptyState,{cause:l,onRetry:a,stateInterest:s}):/* @__PURE__ */r.jsx(EntitlementPausedState,{...c?{renderUnavailable:c}:{}})}function Yo(e){return e.trim().replace(/^dr\.?\s+/i,"").slice(0,1).toUpperCase()}function televetConsultCalendarKey(e){return`televet-consult-${e}`}function TelevetBookedScreen({consult:n,petName:l,onDone:i,onAddToCalendar:o,canJoinInApp:a=false,sharedRecords:s=false,sentPhoto:c=false}){let d=useEverfurTheme(),u=Bo(),p=e.useMemo(()=>Go(d),[d]),[h,f]=e.useState("idle"),m=async()=>{if(!o)return;f("saving");let e=new Date(n.scheduledAt);if(Number.isNaN(e.getTime())){f("failed");return}let t=await q(o,{key:televetConsultCalendarKey(n.consultId),title:ee.visit.title,startDate:e,endDate:new Date(e.getTime()+oi*6e4),alarmOffsetMinutes:-30});f(t.ok&&t.value===true?"saved":"failed")},g=n.clinicianName?.trim()??"",y=l?.trim()||ee.petFallback.charAt(0).toUpperCase()+ee.petFallback.slice(1),b=[ee.booked.remindPromise,s&&g.length>0?Z(c?ee.booked.recordsPhotoPromiseTemplate:ee.booked.recordsPromiseTemplate,{pet:y,vet:g}):Z(ee.booked.summaryPromise,{pet:y}),...a?[ee.booked.joinPromise]:[]],v=e.useRef(new t.Animated.Value(d.motion.reducedMotion?1:0)).current;return e.useEffect(()=>{d.motion.reducedMotion||t.Animated.spring(v,{toValue:1,damping:14,stiffness:180,mass:1,useNativeDriver:true}).start()},[v,d.motion.reducedMotion]),isTelevetBookingCopyReady()?/* @__PURE__ */r.jsxs(t.View,{style:p.screen,testID:"televet-booked",children:[
|
|
78
|
+
/* @__PURE__ */r.jsx(t.Animated.View,{style:[p.avatar,{opacity:v,transform:[{scale:v.interpolate({inputRange:[0,1],outputRange:[.92,1]})}]}],accessibilityElementsHidden:true,importantForAccessibility:"no-hide-descendants",children:/* @__PURE__ */r.jsx(Text,{tier:"heading",style:p.avatarText,children:g.length>0?Yo(g):""})}),
|
|
79
79
|
/* @__PURE__ */r.jsx(Text,{tier:"heading",style:p.title,accessibilityRole:"header",children:g.length>0?Z(ee.bookedTitleTemplate,{vet:g}):ee.bookedTitle}),
|
|
80
80
|
/* @__PURE__ */r.jsx(Text,{style:p.when,children:l?Z(ee.bookedLeadTemplate,{when:mi(n.scheduledAt),pet:l}):mi(n.scheduledAt)}),
|
|
81
|
-
/* @__PURE__ */r.jsx(t.View,{style:p.steps,accessibilityLabel:ee.booked.stepsLabel,testID:"televet-booked-steps",children:
|
|
81
|
+
/* @__PURE__ */r.jsx(t.View,{style:p.steps,accessibilityLabel:ee.booked.stepsLabel,testID:"televet-booked-steps",children:b.map((e,n)=>/* @__PURE__ */r.jsxs(t.View,{style:[p.step,n===b.length-1?p.stepLast:null],children:[
|
|
82
82
|
/* @__PURE__ */r.jsx(Text,{tier:"badge",style:p.stepNumberText,accessibilityElementsHidden:true,importantForAccessibility:"no",children:String(n+1).padStart(2,"0")}),
|
|
83
83
|
/* @__PURE__ */r.jsx(Text,{style:p.stepText,children:e.trim()})]},e))}),
|
|
84
84
|
/* @__PURE__ */r.jsxs(t.View,{style:p.actions,children:[h==="failed"?/* @__PURE__ */r.jsx(Text,{style:[u.failure,p.calendarNote],accessibilityLiveRegion:"polite",testID:"televet-booked-calendar-failed",children:ee.booked.calendarFailedBody}):null,o?/* @__PURE__ */r.jsx(TelevetButton,{label:h==="saved"?ee.booked.calendarAdded:ee.addToCalendarCta,kind:"secondary",loading:h==="saving",disabled:h==="saving"||h==="saved",onPress:()=>{m()},testID:"televet-booked-calendar"}):null,
|
|
85
|
-
/* @__PURE__ */r.jsx(TelevetButton,{label:ee.doneCta,kind:"primary",onPress:i,testID:"televet-booked-done"})]})]}):/* @__PURE__ */r.jsx(t.View,{style:p.screen,testID:"televet-booked-copy-unapproved"})}function Go(e){let{space:n,radius:r,type:l}=e,{size:i,lineHeight:o}=l,a=Lo(e),s=Vo(e.slots.card);return t.StyleSheet.create({screen:{flex:1,paddingHorizontal:n.xl,paddingTop:n.lg,gap:n.md},avatar:{alignSelf:"center",width:112,height:112,borderRadius:56,backgroundColor:a.mist,borderWidth:4,borderColor:a.go,alignItems:"center",justifyContent:"center"},avatarText:{...face(e,"medium"),color:a.ink,fontSize:38,lineHeight:44},title:{textAlign:"center",...headingFace(e,"medium"),color:a.ink,fontSize:i.heading,lineHeight:i.heading*o.snug,letterSpacing:-.33,paddingTop:n.md},when:{textAlign:"center",...face(e,"regular"),color:a.text,fontSize:i.body,lineHeight:i.body*o.relaxed},steps:{marginTop:n.md,paddingHorizontal:n.lg,borderRadius:r.lg,borderWidth:1,borderColor:a.line,backgroundColor:a.surface,...Ao(e.slots.card,1)},step:{flexDirection:"row",alignItems:"flex-start",gap:n.md,paddingVertical:14,borderBottomWidth:1,borderBottomColor:a.line},stepLast:{borderBottomWidth:0},stepNumberText:{width:28,...face(e,"monoBold"),color:a.ink,fontSize:13,lineHeight:i.body*o.relaxed,...s},stepText:{flex:1,...face(e,"regular"),color:a.text,fontSize:i.body,lineHeight:i.body*o.relaxed,...s},actions:{marginTop:"auto",paddingBottom:n.xl,gap:n.md},calendarNote:{textAlign:"center"}})}function Jo(t){let[n,r]=e.useState(null);return{shown:t!==null&&n!==t,onError:()=>r(t)}}function BrandLogo({logoUrl:e,name:n,barStyle:l,logoStyle:i,testID:o}){let a=Jo(e);return e===null||!a.shown?null:/* @__PURE__ */r.jsx(t.View,{style:l,...o===void 0?{}:{testID:o},children:/* @__PURE__ */r.jsx(t.Image,{source:{uri:e},style:i,resizeMode:"contain",accessible:true,accessibilityRole:"image",accessibilityLabel:n,onError:a.onError})})}function TelevetBookingChrome({step:n,furthestIndex:l,title:i,canGoBack:o,isDirty:a,onBack:s,onClose:c,onConfirmDiscard:d,triageOpen:u=false,stepContext:p,presentation:h="rail"}){let f=useEverfurTheme(),m=e.useMemo(()=>ta(f),[f]),g=e.useMemo(()=>()=>{if(!a){c();return}let e={title:ee.chrome.discardTitle,body:ee.chrome.discardBody,confirmLabel:ee.chrome.discardConfirmCta,keepLabel:ee.chrome.discardKeepCta};if(d){Promise.resolve(d(e)).then(e=>{e&&c()},()=>{});return}t.Alert.alert(e.title,e.body,[{text:e.keepLabel,style:"cancel"},{text:e.confirmLabel,style:"destructive",onPress:c}])},[a,c,d]),y=e.useMemo(()=>()=>o?(s(),true):(g(),true),[o,s,g]);e.useEffect(()=>{let e=t.BackHandler.addEventListener("hardwareBackPress",y);return()=>{e.remove()}},[y]),G(y);let b=e.useMemo(()=>Ql(p),[p]),{current:v,total:x,steps:T}=Xl(n,b,u),
|
|
85
|
+
/* @__PURE__ */r.jsx(TelevetButton,{label:ee.doneCta,kind:"primary",onPress:i,testID:"televet-booked-done"})]})]}):/* @__PURE__ */r.jsx(t.View,{style:p.screen,testID:"televet-booked-copy-unapproved"})}function Go(e){let{space:n,radius:r,type:l}=e,{size:i,lineHeight:o}=l,a=Lo(e),s=Vo(e.slots.card);return t.StyleSheet.create({screen:{flex:1,paddingHorizontal:n.xl,paddingTop:n.lg,gap:n.md},avatar:{alignSelf:"center",width:112,height:112,borderRadius:56,backgroundColor:a.mist,borderWidth:4,borderColor:a.go,alignItems:"center",justifyContent:"center"},avatarText:{...face(e,"medium"),color:a.ink,fontSize:38,lineHeight:44},title:{textAlign:"center",...headingFace(e,"medium"),color:a.ink,fontSize:i.heading,lineHeight:i.heading*o.snug,letterSpacing:-.33,paddingTop:n.md},when:{textAlign:"center",...face(e,"regular"),color:a.text,fontSize:i.body,lineHeight:i.body*o.relaxed},steps:{marginTop:n.md,paddingHorizontal:n.lg,borderRadius:r.lg,borderWidth:1,borderColor:a.line,backgroundColor:a.surface,...Ao(e.slots.card,1)},step:{flexDirection:"row",alignItems:"flex-start",gap:n.md,paddingVertical:14,borderBottomWidth:1,borderBottomColor:a.line},stepLast:{borderBottomWidth:0},stepNumberText:{width:28,...face(e,"monoBold"),color:a.ink,fontSize:13,lineHeight:i.body*o.relaxed,...s},stepText:{flex:1,...face(e,"regular"),color:a.text,fontSize:i.body,lineHeight:i.body*o.relaxed,...s},actions:{marginTop:"auto",paddingBottom:n.xl,gap:n.md},calendarNote:{textAlign:"center"}})}function Jo(t){let[n,r]=e.useState(null);return{shown:t!==null&&n!==t,onError:()=>r(t)}}function BrandLogo({logoUrl:e,name:n,barStyle:l,logoStyle:i,testID:o}){let a=Jo(e);return e===null||!a.shown?null:/* @__PURE__ */r.jsx(t.View,{style:l,...o===void 0?{}:{testID:o},children:/* @__PURE__ */r.jsx(t.Image,{source:{uri:e},style:i,resizeMode:"contain",accessible:true,accessibilityRole:"image",accessibilityLabel:n,onError:a.onError})})}function TelevetBookingChrome({step:n,furthestIndex:l,title:i,canGoBack:o,isDirty:a,onBack:s,onClose:c,onConfirmDiscard:d,triageOpen:u=false,stepContext:p,presentation:h="rail"}){let f=useEverfurTheme(),m=e.useMemo(()=>ta(f),[f]),g=e.useMemo(()=>()=>{if(!a){c();return}let e={title:ee.chrome.discardTitle,body:ee.chrome.discardBody,confirmLabel:ee.chrome.discardConfirmCta,keepLabel:ee.chrome.discardKeepCta};if(d){Promise.resolve(d(e)).then(e=>{e&&c()},()=>{});return}t.Alert.alert(e.title,e.body,[{text:e.keepLabel,style:"cancel"},{text:e.confirmLabel,style:"destructive",onPress:c}])},[a,c,d]),y=e.useMemo(()=>()=>o?(s(),true):(g(),true),[o,s,g]);e.useEffect(()=>{let e=t.BackHandler.addEventListener("hardwareBackPress",y);return()=>{e.remove()}},[y]),G(y);let b=e.useMemo(()=>Ql(p),[p]),{current:v,total:x,steps:T}=Xl(n,b,u),k=n==="booked"?ee.bookedStepLabel:Z(ee.loading.progressTemplate,{step:String(v),total:String(x)});return h==="nav"?/* @__PURE__ */r.jsx(t.View,{style:m.wrap,children:/* @__PURE__ */r.jsxs(t.View,{style:m.navBar,children:[
|
|
86
86
|
/* @__PURE__ */r.jsx(t.Pressable,{onPress:o?s:g,accessibilityRole:"button",accessibilityLabel:Xo,testID:"televet-booking-back",style:m.navIcon,children:/* @__PURE__ */r.jsx(t.View,{style:m.chevron,accessibilityElementsHidden:true,importantForAccessibility:"no"})}),
|
|
87
87
|
/* @__PURE__ */r.jsx(Text,{tier:"compact",numberOfLines:1,style:m.navTitle,accessibilityRole:"header",testID:"televet-booking-title",children:i??ee.navTitle}),
|
|
88
88
|
/* @__PURE__ */r.jsx(t.Pressable,{onPress:g,accessibilityRole:"button",accessibilityLabel:ee.close,accessibilityHint:ee.chrome.closeHint,testID:"televet-booking-close",style:m.navIcon,children:/* @__PURE__ */r.jsx(Text,{tier:"control",style:m.close,accessibilityElementsHidden:true,importantForAccessibility:"no",children:Qo})})]})}):/* @__PURE__ */r.jsxs(t.View,{style:m.wrap,children:[
|
|
89
89
|
/* @__PURE__ */r.jsx(BrandLogo,{logoUrl:f.meta.logoUrl,name:f.meta.displayName,barStyle:m.logoBar,logoStyle:m.logo,testID:"televet-booking-logo"}),
|
|
90
90
|
/* @__PURE__ */r.jsxs(t.View,{style:m.bar,children:[
|
|
91
91
|
/* @__PURE__ */r.jsx(t.Pressable,{onPress:o?s:g,accessibilityRole:"button",accessibilityLabel:Xo,testID:"televet-booking-back",style:m.ring,children:/* @__PURE__ */r.jsx(t.View,{style:m.chevron,accessibilityElementsHidden:true,importantForAccessibility:"no"})}),
|
|
92
|
-
/* @__PURE__ */r.jsxs(t.View,{style:m.center,accessibilityRole:"header",accessibilityLabel:`${i??ee.navTitle}, ${
|
|
93
|
-
/* @__PURE__ */r.jsx(Text,{tier:"compact",style:m.stepLabel,testID:"televet-booking-progress-label",children:
|
|
92
|
+
/* @__PURE__ */r.jsxs(t.View,{style:m.center,accessibilityRole:"header",accessibilityLabel:`${i??ee.navTitle}, ${k}`,children:[
|
|
93
|
+
/* @__PURE__ */r.jsx(Text,{tier:"compact",style:m.stepLabel,testID:"televet-booking-progress-label",children:k}),
|
|
94
94
|
/* @__PURE__ */r.jsx(t.View,{style:m.segments,accessibilityElementsHidden:true,importantForAccessibility:"no-hide-descendants",testID:"televet-booking-rail",children:T.map((e,n)=>/* @__PURE__ */r.jsx(t.View,{style:[m.segment,n<v?m.segmentDone:null]},e))})]}),
|
|
95
|
-
/* @__PURE__ */r.jsx(t.Pressable,{onPress:g,accessibilityRole:"button",accessibilityLabel:ee.close,accessibilityHint:ee.chrome.closeHint,testID:"televet-booking-close",style:m.ring,children:/* @__PURE__ */r.jsx(Text,{tier:"control",style:m.close,accessibilityElementsHidden:true,importantForAccessibility:"no",children:Qo})})]})]})}var Qo="×",Xo="Back",Zo=28,ea=160;function ta(e){let{space:n,type:r}=e,l=Lo(e),i=e.slots.header,o=i?.textColor??l.ink;return t.StyleSheet.create({wrap:{...Ao(Oo(i,e.radius.lg))},logoBar:{alignItems:"center",paddingTop:n.sm},logo:{height:Zo,width:ea},bar:{flexDirection:"row",alignItems:"center",gap:n.md,paddingVertical:n.sm,minHeight:60},ring:{width:No,height:No,borderRadius:No/2,borderWidth:1.5,borderColor:l.line,alignItems:"center",justifyContent:"center"},chevron:{width:10,height:10,marginLeft:4,borderLeftWidth:2,borderBottomWidth:2,borderColor:o,transform:[{rotate:"45deg"}]},close:{...face(e,"regular"),color:o,fontSize:24,lineHeight:26},center:{flex:1,alignItems:"center",gap:6},stepLabel:{...face(e,"monoBold"),color:o,fontSize:12,lineHeight:16,letterSpacing:1.2,textTransform:"uppercase"},segments:{flexDirection:"row",gap:4,alignSelf:"stretch"},segment:{flex:1,height:4,borderRadius:2,backgroundColor:l.mist},segmentDone:{backgroundColor:l.go},title:{...headingFace(e,"medium"),color:o,fontSize:r.size.subtitle},navBar:{flexDirection:"row",alignItems:"center",minHeight:58,paddingHorizontal:n.sm,gap:n.xs},navIcon:{width:No,height:No,alignItems:"center",justifyContent:"center"},navTitle:{...textRole(e,"cardTitle"),fontSize:17*r.typeScale,lineHeight:25.5*r.typeScale,color:o,flex:1,textAlign:"center"}})}var na=/* @__PURE__ */Object.freeze({noteLabel:"Anything the vet should know? (optional)",bookCta:"Book visit",bookAtTemplate:"Book {day}, {time}",today:"Today",tomorrow:"Tomorrow",bookedTitleTemplate:"{pet}’s booked.",whenTemplate:"{day}, {date} at {time}",who:"Video visit with a licensed Everfur vet"});function ra(e){return e?Z(na.bookedTitleTemplate,{pet:e}):ee.bookedTitle}var la=18,ia=78;function oa(e,n=1){let r=e.color,l=e.type.typeScale,i=e=>Math.round(e*l*100)/100,o=e.slots.card,a=e.slots.input,s=e.slots.primaryButton?.borderRadius??999,c=o?.backgroundColor??r.surface,d=Vo(o).color??r.text.primary,u={shadowColor:r.text.primary,shadowOpacity:.06,shadowRadius:3,shadowOffset:{width:0,height:1},elevation:1};return t.StyleSheet.create({screen:{paddingHorizontal:0,gap:0,backgroundColor:r.background},pad:{flex:1,minHeight:0,paddingHorizontal:e.space.xl,paddingTop:e.space.md,gap:e.space.md},bleed:{flex:1,minHeight:0},body:{paddingTop:8,paddingHorizontal:la,paddingBottom:20},scroll:{flex:1},stepLabel:{...textRole(e,"label"),fontSize:i(11),lineHeight:i(16.5),letterSpacing:i(.88),color:r.text.muted},title:{...textRole(e,"display"),lineHeight:i(31.32),marginTop:8,color:r.text.primary},subtitle:{...textRole(e,"body"),lineHeight:i(21.75),marginTop:8,color:r.text.metaCool},options:{gap:10,marginTop:20},option:{flexDirection:"row",alignItems:"center",gap:12,minHeight:56,paddingVertical:12,paddingHorizontal:16,borderRadius:16,backgroundColor:c,borderWidth:2,borderColor:"transparent",...u},optionPicked:{backgroundColor:r.highlight,borderColor:r.text.primary},radio:{width:22,height:22,borderRadius:11,borderWidth:2,borderColor:r.controlEdge},radioPicked:{borderWidth:7,borderColor:r.text.primary},optionLabel:{...textRole(e,"rowTitle"),fontSize:i(16),lineHeight:i(24),color:d,flex:1},optionLabelPicked:{color:r.onHighlight},note:{gap:6,marginTop:18},noteLabel:{...textRole(e,"rowTitle"),fontSize:i(14),lineHeight:i(21),color:r.text.primary},noteInput:{...textRole(e,"body"),fontSize:i(16),lineHeight:i(22.4),minHeight:84,paddingVertical:12,paddingHorizontal:14,borderRadius:a?.borderRadius??14,borderWidth:1,borderColor:a?.borderColor??r.borderRingCream,backgroundColor:a?.backgroundColor??r.surface,color:a?.textColor??r.text.primary,textAlignVertical:"top"},days:{flexDirection:"row",flexWrap:"wrap",gap:8,marginTop:18},day:{flexGrow:1,flexBasis:0,minWidth:Math.ceil(ia*n),minHeight:62,paddingVertical:8,paddingHorizontal:6,borderRadius:14,backgroundColor:c,alignItems:"center",justifyContent:"center",...u},dayPicked:{backgroundColor:r.primary},dayName:{...textRole(e,"cardTitle"),fontSize:i(15),lineHeight:i(22.5),color:d,textAlign:"center"},dayDate:{...face(e,"medium"),fontSize:i(13),lineHeight:i(19.5),color:r.text.muted,textAlign:"center"},dayTextPicked:{color:r.onPrimary},dayDatePicked:{color:r.onPrimary,opacity:.78},slots:{gap:10,marginTop:18},slotRow:{flexDirection:"row",gap:10},slot:{flex:1,minHeight:52,paddingHorizontal:14,borderRadius:999,backgroundColor:c,borderWidth:1.5,borderColor:r.borderRingCream,alignItems:"center",justifyContent:"center"},slotPicked:{backgroundColor:r.accent,borderWidth:2,borderColor:r.text.primary},slotSpacer:{flex:1},slotLabel:{...textRole(e,"rowTitle"),fontSize:i(15.5),lineHeight:i(23.25),color:d,textAlign:"center"},slotLabelPicked:{color:r.onAccent},ticks:{marginTop:18,gap:4},lines:{marginTop:12,gap:8},foot:{paddingTop:12,paddingHorizontal:la,paddingBottom:34,backgroundColor:r.background,borderTopWidth:1,borderTopColor:r.surfaceSubtle,gap:10},button:{minHeight:48,paddingHorizontal:22,borderRadius:s,backgroundColor:r.primary,alignItems:"center",justifyContent:"center",flexDirection:"row",gap:8},buttonGhost:{backgroundColor:"transparent",borderWidth:1.5,borderColor:r.text.primary},buttonDisabled:{opacity:.4},buttonLabel:{...textRole(e,"button"),fontSize:i(16),lineHeight:i(24),color:r.onPrimary,textAlign:"center"},buttonGhostLabel:{color:r.text.primary},fine:{...textRole(e,"caption"),fontSize:i(12.5),lineHeight:i(18.75),color:r.text.muted,textAlign:"center"},done:{paddingTop:40,paddingHorizontal:22,paddingBottom:20,alignItems:"center"},check:{width:76,height:76,borderRadius:38,backgroundColor:r.accent,alignItems:"center",justifyContent:"center"},checkMark:{width:34,height:18,marginTop:-8,borderLeftWidth:4,borderBottomWidth:4,borderColor:r.onAccent,transform:[{rotate:"-45deg"}]},doneTitle:{...textRole(e,"display"),fontSize:i(34),lineHeight:i(39.1),marginTop:20,color:r.text.primary,textAlign:"center"},when:{...textRole(e,"rowTitle"),fontSize:i(16),lineHeight:i(24),marginTop:10,color:r.text.primary,textAlign:"center"},who:{...textRole(e,"body"),marginTop:2,color:r.text.metaCool,textAlign:"center"},note2:{marginTop:22,alignSelf:"stretch"},calendarNote:{...textRole(e,"caption"),color:r.danger,textAlign:"center"}})}function aa(e){let t=[],n=e.breed?.trim();n&&t.push(n);let r=sa(e.ageYears);r!==null&&t.push(`${String(r)} year${r===1?"":"s"}`);let l=e.weightKg;return typeof l=="number"&&Number.isFinite(l)&&l>0&&t.push(`${String(Math.round(l))} kg`),t.join(" · ")}function sa(e){if(typeof e!="number"||!Number.isFinite(e))return null;let t=Math.floor(e);return t>=0?t:null}var ca=/* @__PURE__ */Object.freeze({}),da=100,ua=20;function pa(e,t,n,r){return![e,t,n,r].every(Number.isFinite)||e+n>r+1?null:{chatTop:Math.max(0,e),parentTop:Math.max(0,e-t)}}function ha(n,r){let l=typeof n=="number",i=e.useRef(null),[o,a]=e.useState(null),s=e.useRef(null),c=e.useRef(null),d=e.useRef(true),u=e.useCallback(()=>{c.current!==null&&clearTimeout(c.current),c.current=null},[]);e.useEffect(()=>(d.current=true,()=>{d.current=false,u()}),[u]);let p=e.useCallback(function e(n){i.current?.measureInWindow((r,l)=>{let i=s.current;if(!d.current||i===null)return;let o=pa(l,i.y,i.height,t.Dimensions.get("window").height);if(o!==null){a(e=>e!==null&&e.chatTop===o.chatTop&&e.parentTop===o.parentTop?e:o);return}n>=ua||(c.current=setTimeout(()=>{c.current=null,e(n+1)},da))})},[]),h=e.useCallback(e=>{let{y:t,height:n}=e.nativeEvent.layout;s.current={y:t,height:n},u(),p(0)},[p,u]);return e.useMemo(()=>{if(!r)return{avoidingProps:ca,probeRef:null,topInWindow:null};let e=o?.parentTop??0;return{avoidingProps:e>0?{keyboardVerticalOffset:e,onLayout:h}:{onLayout:h},probeRef:i,topInWindow:o?.chatTop??null}},[r,l,n,o,h])}function KeyboardOffsetProbe({probeRef:e}){return e===null?null:/* @__PURE__ */r.jsx(t.View,{ref:e,collapsable:false,pointerEvents:"none",style:fa})}var fa=/* @__PURE__ */Object.freeze({position:"absolute",top:0,left:0,width:0,height:0});function TelevetIntakeMedia({media:n,onChange:l,onPickMedia:i,meta:o}){let a=useEverfurTheme(),s=e.useMemo(()=>ba(a),[a]),c=y-n.length,[d,u]=e.useState(false);if(!i)return null;let p=async()=>{if(!(d||c<=0)){u(true);try{let e=await
|
|
95
|
+
/* @__PURE__ */r.jsx(t.Pressable,{onPress:g,accessibilityRole:"button",accessibilityLabel:ee.close,accessibilityHint:ee.chrome.closeHint,testID:"televet-booking-close",style:m.ring,children:/* @__PURE__ */r.jsx(Text,{tier:"control",style:m.close,accessibilityElementsHidden:true,importantForAccessibility:"no",children:Qo})})]})]})}var Qo="×",Xo="Back",Zo=28,ea=160;function ta(e){let{space:n,type:r}=e,l=Lo(e),i=e.slots.header,o=i?.textColor??l.ink;return t.StyleSheet.create({wrap:{...Ao(Oo(i,e.radius.lg))},logoBar:{alignItems:"center",paddingTop:n.sm},logo:{height:Zo,width:ea},bar:{flexDirection:"row",alignItems:"center",gap:n.md,paddingVertical:n.sm,minHeight:60},ring:{width:No,height:No,borderRadius:No/2,borderWidth:1.5,borderColor:l.line,alignItems:"center",justifyContent:"center"},chevron:{width:10,height:10,marginLeft:4,borderLeftWidth:2,borderBottomWidth:2,borderColor:o,transform:[{rotate:"45deg"}]},close:{...face(e,"regular"),color:o,fontSize:24,lineHeight:26},center:{flex:1,alignItems:"center",gap:6},stepLabel:{...face(e,"monoBold"),color:o,fontSize:12,lineHeight:16,letterSpacing:1.2,textTransform:"uppercase"},segments:{flexDirection:"row",gap:4,alignSelf:"stretch"},segment:{flex:1,height:4,borderRadius:2,backgroundColor:l.mist},segmentDone:{backgroundColor:l.go},title:{...headingFace(e,"medium"),color:o,fontSize:r.size.subtitle},navBar:{flexDirection:"row",alignItems:"center",minHeight:58,paddingHorizontal:n.sm,gap:n.xs},navIcon:{width:No,height:No,alignItems:"center",justifyContent:"center"},navTitle:{...textRole(e,"cardTitle"),fontSize:17*r.typeScale,lineHeight:25.5*r.typeScale,color:o,flex:1,textAlign:"center"}})}var na=/* @__PURE__ */Object.freeze({noteLabel:"Anything the vet should know? (optional)",bookCta:"Book visit",bookAtTemplate:"Book {day}, {time}",today:"Today",tomorrow:"Tomorrow",bookedTitleTemplate:"{pet}’s booked.",whenTemplate:"{day}, {date} at {time}",who:"Video visit with a licensed Everfur vet"});function ra(e){return e?Z(na.bookedTitleTemplate,{pet:e}):ee.bookedTitle}var la=18,ia=78;function oa(e,n=1){let r=e.color,l=e.type.typeScale,i=e=>Math.round(e*l*100)/100,o=e.slots.card,a=e.slots.input,s=e.slots.primaryButton?.borderRadius??999,c=o?.backgroundColor??r.surface,d=Vo(o).color??r.text.primary,u={shadowColor:r.text.primary,shadowOpacity:.06,shadowRadius:3,shadowOffset:{width:0,height:1},elevation:1};return t.StyleSheet.create({screen:{paddingHorizontal:0,gap:0,backgroundColor:r.background},pad:{flex:1,minHeight:0,paddingHorizontal:e.space.xl,paddingTop:e.space.md,gap:e.space.md},bleed:{flex:1,minHeight:0},body:{paddingTop:8,paddingHorizontal:la,paddingBottom:20},scroll:{flex:1},stepLabel:{...textRole(e,"label"),fontSize:i(11),lineHeight:i(16.5),letterSpacing:i(.88),color:r.text.muted},title:{...textRole(e,"display"),lineHeight:i(31.32),marginTop:8,color:r.text.primary},subtitle:{...textRole(e,"body"),lineHeight:i(21.75),marginTop:8,color:r.text.metaCool},options:{gap:10,marginTop:20},option:{flexDirection:"row",alignItems:"center",gap:12,minHeight:56,paddingVertical:12,paddingHorizontal:16,borderRadius:16,backgroundColor:c,borderWidth:2,borderColor:"transparent",...u},optionPicked:{backgroundColor:r.highlight,borderColor:r.text.primary},radio:{width:22,height:22,borderRadius:11,borderWidth:2,borderColor:r.controlEdge},radioPicked:{borderWidth:7,borderColor:r.text.primary},optionLabel:{...textRole(e,"rowTitle"),fontSize:i(16),lineHeight:i(24),color:d,flex:1},optionLabelPicked:{color:r.onHighlight},note:{gap:6,marginTop:18},noteLabel:{...textRole(e,"rowTitle"),fontSize:i(14),lineHeight:i(21),color:r.text.primary},noteInput:{...textRole(e,"body"),fontSize:i(16),lineHeight:i(22.4),minHeight:84,paddingVertical:12,paddingHorizontal:14,borderRadius:a?.borderRadius??14,borderWidth:1,borderColor:a?.borderColor??r.borderRingCream,backgroundColor:a?.backgroundColor??r.surface,color:a?.textColor??r.text.primary,textAlignVertical:"top"},days:{flexDirection:"row",flexWrap:"wrap",gap:8,marginTop:18},day:{flexGrow:1,flexBasis:0,minWidth:Math.ceil(ia*n),minHeight:62,paddingVertical:8,paddingHorizontal:6,borderRadius:14,backgroundColor:c,alignItems:"center",justifyContent:"center",...u},dayPicked:{backgroundColor:r.primary},dayName:{...textRole(e,"cardTitle"),fontSize:i(15),lineHeight:i(22.5),color:d,textAlign:"center"},dayDate:{...face(e,"medium"),fontSize:i(13),lineHeight:i(19.5),color:r.text.muted,textAlign:"center"},dayTextPicked:{color:r.onPrimary},dayDatePicked:{color:r.onPrimary,opacity:.78},slots:{gap:10,marginTop:18},slotRow:{flexDirection:"row",gap:10},slot:{flex:1,minHeight:52,paddingHorizontal:14,borderRadius:999,backgroundColor:c,borderWidth:1.5,borderColor:r.borderRingCream,alignItems:"center",justifyContent:"center"},slotPicked:{backgroundColor:r.accent,borderWidth:2,borderColor:r.text.primary},slotSpacer:{flex:1},slotLabel:{...textRole(e,"rowTitle"),fontSize:i(15.5),lineHeight:i(23.25),color:d,textAlign:"center"},slotLabelPicked:{color:r.onAccent},ticks:{marginTop:18,gap:4},lines:{marginTop:12,gap:8},foot:{paddingTop:12,paddingHorizontal:la,paddingBottom:34,backgroundColor:r.background,borderTopWidth:1,borderTopColor:r.surfaceSubtle,gap:10},button:{minHeight:48,paddingHorizontal:22,borderRadius:s,backgroundColor:r.primary,alignItems:"center",justifyContent:"center",flexDirection:"row",gap:8},buttonGhost:{backgroundColor:"transparent",borderWidth:1.5,borderColor:r.text.primary},buttonDisabled:{opacity:.4},buttonLabel:{...textRole(e,"button"),fontSize:i(16),lineHeight:i(24),color:r.onPrimary,textAlign:"center"},buttonGhostLabel:{color:r.text.primary},fine:{...textRole(e,"caption"),fontSize:i(12.5),lineHeight:i(18.75),color:r.text.muted,textAlign:"center"},done:{paddingTop:40,paddingHorizontal:22,paddingBottom:20,alignItems:"center"},check:{width:76,height:76,borderRadius:38,backgroundColor:r.accent,alignItems:"center",justifyContent:"center"},checkMark:{width:34,height:18,marginTop:-8,borderLeftWidth:4,borderBottomWidth:4,borderColor:r.onAccent,transform:[{rotate:"-45deg"}]},doneTitle:{...textRole(e,"display"),fontSize:i(34),lineHeight:i(39.1),marginTop:20,color:r.text.primary,textAlign:"center"},when:{...textRole(e,"rowTitle"),fontSize:i(16),lineHeight:i(24),marginTop:10,color:r.text.primary,textAlign:"center"},who:{...textRole(e,"body"),marginTop:2,color:r.text.metaCool,textAlign:"center"},note2:{marginTop:22,alignSelf:"stretch"},calendarNote:{...textRole(e,"caption"),color:r.danger,textAlign:"center"}})}function aa(e){let t=[],n=e.breed?.trim();n&&t.push(n);let r=sa(e.ageYears);r!==null&&t.push(`${String(r)} year${r===1?"":"s"}`);let l=e.weightKg;return typeof l=="number"&&Number.isFinite(l)&&l>0&&t.push(`${String(Math.round(l))} kg`),t.join(" · ")}function sa(e){if(typeof e!="number"||!Number.isFinite(e))return null;let t=Math.floor(e);return t>=0?t:null}var ca=/* @__PURE__ */Object.freeze({}),da=100,ua=20;function pa(e,t,n,r){return![e,t,n,r].every(Number.isFinite)||e+n>r+1?null:{chatTop:Math.max(0,e),parentTop:Math.max(0,e-t)}}function ha(n,r){let l=typeof n=="number",i=e.useRef(null),[o,a]=e.useState(null),s=e.useRef(null),c=e.useRef(null),d=e.useRef(true),u=e.useCallback(()=>{c.current!==null&&clearTimeout(c.current),c.current=null},[]);e.useEffect(()=>(d.current=true,()=>{d.current=false,u()}),[u]);let p=e.useCallback(function e(n){i.current?.measureInWindow((r,l)=>{let i=s.current;if(!d.current||i===null)return;let o=pa(l,i.y,i.height,t.Dimensions.get("window").height);if(o!==null){a(e=>e!==null&&e.chatTop===o.chatTop&&e.parentTop===o.parentTop?e:o);return}n>=ua||(c.current=setTimeout(()=>{c.current=null,e(n+1)},da))})},[]),h=e.useCallback(e=>{let{y:t,height:n}=e.nativeEvent.layout;s.current={y:t,height:n},u(),p(0)},[p,u]);return e.useMemo(()=>{if(!r)return{avoidingProps:ca,probeRef:null,topInWindow:null};let e=o?.parentTop??0;return{avoidingProps:e>0?{keyboardVerticalOffset:e,onLayout:h}:{onLayout:h},probeRef:i,topInWindow:o?.chatTop??null}},[r,l,n,o,h])}function KeyboardOffsetProbe({probeRef:e}){return e===null?null:/* @__PURE__ */r.jsx(t.View,{ref:e,collapsable:false,pointerEvents:"none",style:fa})}var fa=/* @__PURE__ */Object.freeze({position:"absolute",top:0,left:0,width:0,height:0});function TelevetIntakeMedia({media:n,onChange:l,onPickMedia:i,meta:o}){let a=useEverfurTheme(),s=e.useMemo(()=>ba(a),[a]),c=y-n.length,[d,u]=e.useState(false);if(!i)return null;let p=async()=>{if(!(d||c<=0)){u(true);try{let e=await q(i,c);if(!e.ok||e.value===null||e.value.length===0)return;let t=new Set(n.map(e=>e.uri)),r=e.value.filter(e=>typeof e?.uri=="string"&&e.uri.length>0&&!t.has(e.uri));if(r.length===0)return;l([...n,...r].slice(0,y))}finally{u(false)}}};/* @__PURE__ */
|
|
96
96
|
return r.jsxs(t.View,{children:[
|
|
97
97
|
/* @__PURE__ */r.jsxs(t.View,{style:s.row,children:[n.map((e,i)=>/* @__PURE__ */r.jsxs(t.View,{style:s.thumb,children:[
|
|
98
98
|
/* @__PURE__ */r.jsx(t.Image,{source:{uri:e.uri},style:s.thumbImage,resizeMode:"cover"}),e.mimeType?.startsWith("video/")?/* @__PURE__ */r.jsx(t.View,{style:s.videoBadge,testID:`televet-intake-media-video-${String(i)}`,children:/* @__PURE__ */r.jsx(Text,{tier:"badge",style:s.videoBadgeText,children:ga})}):null,
|
|
@@ -103,14 +103,14 @@ return r.jsxs(t.Pressable,{onLayout:n?c.onSelectedDayLayout:void 0,onPress:()=>i
|
|
|
103
103
|
/* @__PURE__ */r.jsx(Text,{tier:"compact",style:[a.dayWeekday,n?a.dayTextSelected:null],children:e.weekday}),
|
|
104
104
|
/* @__PURE__ */r.jsx(Text,{tier:"compact",style:[a.dayNumber,n?a.dayTextSelected:null],children:e.dayNumber})]},e.key)})})]})}var va=/* @__PURE__ */Object.freeze({done:false,viewport:null,content:null,chip:null});function xa(){let t=e.useRef(null),n=e.useRef(va),r=e.useCallback(e=>{let r={...n.current,...e};if(r.done||r.viewport===null||r.content===null||r.chip===null){n.current=r;return}n.current={...r,done:true};let l=r.chip.x-(r.viewport-r.chip.width)/2,i=Math.min(Math.max(0,l),Math.max(0,r.content-r.viewport));i>0&&t.current?.scrollTo({x:i,animated:false})},[]),l=e.useCallback(e=>r({viewport:e.nativeEvent.layout.width}),[r]),i=e.useCallback(e=>r({content:e}),[r]),o=e.useCallback(e=>{let{x:t,width:n}=e.nativeEvent.layout;r({chip:{x:t,width:n}})},[r]);return{scrollRef:t,onStripLayout:l,onContentSize:i,onSelectedDayLayout:o}}function televetDaysFromSlots(e){let t=/* @__PURE__ */new Map;for(let n of e){let e=di(n.startsAt);if(t.has(e))continue;let r=new Date(n.startsAt);Number.isNaN(r.getTime())||t.set(e,
|
|
105
105
|
/* @__PURE__ */Object.freeze({key:e,iso:n.startsAt,weekday:r.toLocaleDateString(void 0,{weekday:"short"}),dayNumber:String(r.getDate())}))}/* @__PURE__ */
|
|
106
|
-
return Object.freeze([...t.values()])}function Ta(e){let{space:n,type:r}=e,{size:l,lineHeight:i}=r,o=Lo(e),a=e.slots.chip,s=Vo(a);return t.StyleSheet.create({month:{...face(e,"bold"),color:o.ink,fontSize:l.body,lineHeight:l.body*i.snug,paddingBottom:n.md},strip:{gap:n.sm,paddingHorizontal:2,paddingVertical:2},day:{width:52,minHeight:64,paddingVertical:n.sm,borderRadius:14,borderWidth:1.5,borderColor:o.line,backgroundColor:o.surface,alignItems:"center",justifyContent:"center",gap:2,...Ao(a,1.5)},daySelected:{backgroundColor:o.pink,borderColor:o.ink},dayWeekday:{...face(e,"monoBold"),color:o.ink,fontSize:11,lineHeight:14,letterSpacing:.88,textTransform:"uppercase",...s},dayNumber:{...face(e,"medium"),color:o.ink,fontSize:l.heading,lineHeight:l.heading*i.tight,...s},dayTextSelected:{color:o.onPink}})}function TelevetSlotPicker({slots:n,busySlotId:l,onPick:i,selectedSlot:o=null,ListHeaderComponent:a,rowTestIdPrefix:s="televet-slot",testID:c="televet-slot-list",periodLabels:d}){let u=useEverfurTheme(),p=e.useMemo(()=>Sa(u),[u]),h=e.useMemo(()=>televetDaysFromSlots(n),[n]),[f,m]=e.useState(null),g=o?di(o.startsAt):null,y=
|
|
106
|
+
return Object.freeze([...t.values()])}function Ta(e){let{space:n,type:r}=e,{size:l,lineHeight:i}=r,o=Lo(e),a=e.slots.chip,s=Vo(a);return t.StyleSheet.create({month:{...face(e,"bold"),color:o.ink,fontSize:l.body,lineHeight:l.body*i.snug,paddingBottom:n.md},strip:{gap:n.sm,paddingHorizontal:2,paddingVertical:2},day:{width:52,minHeight:64,paddingVertical:n.sm,borderRadius:14,borderWidth:1.5,borderColor:o.line,backgroundColor:o.surface,alignItems:"center",justifyContent:"center",gap:2,...Ao(a,1.5)},daySelected:{backgroundColor:o.pink,borderColor:o.ink},dayWeekday:{...face(e,"monoBold"),color:o.ink,fontSize:11,lineHeight:14,letterSpacing:.88,textTransform:"uppercase",...s},dayNumber:{...face(e,"medium"),color:o.ink,fontSize:l.heading,lineHeight:l.heading*i.tight,...s},dayTextSelected:{color:o.onPink}})}function TelevetSlotPicker({slots:n,busySlotId:l,onPick:i,selectedSlot:o=null,ListHeaderComponent:a,rowTestIdPrefix:s="televet-slot",testID:c="televet-slot-list",periodLabels:d}){let u=useEverfurTheme(),p=e.useMemo(()=>Sa(u),[u]),h=e.useMemo(()=>televetDaysFromSlots(n),[n]),[f,m]=e.useState(null),g=o?di(o.startsAt):null,y=wa(h,[f,g])??h[0]?.key??null,b=e.useMemo(()=>y?n.filter(e=>di(e.startsAt)===y):[],[n,y]),v=a,x=e.useMemo(()=>b.map(e=>ai(e.startsAt)),[b]),T=e.useMemo(()=>new Set(x.filter(e=>e.length>0)).size>1,[x]),k=b[0];
|
|
107
107
|
/* @__PURE__ */
|
|
108
108
|
return r.jsxs(t.View,{style:p.root,testID:c,children:[v?/* @__PURE__ */r.jsx(v,{}):null,
|
|
109
|
-
/* @__PURE__ */r.jsx(TelevetDayStrip,{slots:n,selectedDayKey:y,onSelectDay:e=>m(e.key)}),
|
|
110
|
-
/* @__PURE__ */r.jsx(t.ScrollView,{style:p.gridScroll,contentContainerStyle:p.groups,showsVerticalScrollIndicator:false,children:
|
|
109
|
+
/* @__PURE__ */r.jsx(TelevetDayStrip,{slots:n,selectedDayKey:y,onSelectDay:e=>m(e.key)}),k&&!T?/* @__PURE__ */r.jsx(Text,{tier:"compact",style:p.zone,testID:"televet-slot-zone",children:ai(k.startsAt)}):null,
|
|
110
|
+
/* @__PURE__ */r.jsx(t.ScrollView,{style:p.gridScroll,contentContainerStyle:p.groups,showsVerticalScrollIndicator:false,children:ka(b,d).map(e=>/* @__PURE__ */r.jsxs(t.View,{style:p.group,children:[e.label?/* @__PURE__ */r.jsx(Text,{tier:"compact",style:p.period,accessibilityRole:"header",testID:`televet-slot-period-${e.key}`,children:e.label}):null,
|
|
111
111
|
/* @__PURE__ */r.jsx(t.View,{style:p.grid,children:e.slots.map(e=>{let n=b.indexOf(e),a=l===e.slotId,c=l!==null,d=o?.slotId===e.slotId,h=T?x[n]??"":"";/* @__PURE__ */
|
|
112
112
|
return r.jsxs(t.Pressable,{onPress:()=>i(e),disabled:c,accessibilityRole:"button",accessibilityLabel:[ri(e.startsAt),h].filter(e=>e.length>0).join(" "),accessibilityState:{disabled:c,busy:a,selected:d},testID:`${s}-${e.slotId}`,style:({pressed:e})=>[p.chip,d?p.chipPicked:null,a?p.chipBusy:null,c&&!a?p.chipDisabled:null,e&&!u.motion.reducedMotion?p.chipPressed:null],children:[
|
|
113
|
-
/* @__PURE__ */r.jsx(Text,{tier:"compact",style:[p.chipLabel,d?p.chipLabelPicked:null,a?p.chipLabelBusy:null],children:ri(e.startsAt)}),h.length>0?/* @__PURE__ */r.jsx(Text,{tier:"compact",style:[p.chipZone,d?p.chipLabelPicked:null,a?p.chipLabelBusy:null],testID:`${s}-${e.slotId}-zone`,children:h}):null]},e.slotId)})})]},e.key))})]})}function
|
|
113
|
+
/* @__PURE__ */r.jsx(Text,{tier:"compact",style:[p.chipLabel,d?p.chipLabelPicked:null,a?p.chipLabelBusy:null],children:ri(e.startsAt)}),h.length>0?/* @__PURE__ */r.jsx(Text,{tier:"compact",style:[p.chipZone,d?p.chipLabelPicked:null,a?p.chipLabelBusy:null],testID:`${s}-${e.slotId}-zone`,children:h}):null]},e.slotId)})})]},e.key))})]})}function ka(e,t){return t?["morning","afternoon","evening"].map(n=>({key:n,label:t[n],slots:e.filter(e=>yi(e.startsAt)===n)})).filter(e=>e.slots.length>0):[{key:"all",label:null,slots:e}]}function wa(e,t){for(let n of t)if(n!==null&&e.some(e=>e.key===n))return n;return null}function Sa(e){let{color:n,space:r,radius:l,type:i}=e,{size:o,lineHeight:a}=i,s=Lo(e),c=e.slots.chip,d=Vo(c);return t.StyleSheet.create({root:{flex:1,minHeight:0},groups:{gap:r.lg,paddingBottom:r.xl},group:{gap:r.sm},period:{...face(e,"monoBold"),color:s.muted,fontSize:12,lineHeight:16,letterSpacing:.96,textTransform:"uppercase"},gridScroll:{flex:1},zone:{textAlign:"center",...face(e,"mono"),color:n.text.muted,fontSize:o.tiny,lineHeight:o.tiny*a.normal,letterSpacing:.4,paddingVertical:r.md},grid:{flexDirection:"row",flexWrap:"wrap",gap:r.sm},chip:{minWidth:96,flexGrow:1,flexBasis:"auto",minHeight:44,borderRadius:l.pill,borderWidth:1.5,borderColor:s.line,backgroundColor:s.surface,alignItems:"center",justifyContent:"center",paddingHorizontal:r.md,...Ao(c,1.5)},chipPicked:{borderColor:s.ink,backgroundColor:s.pink},chipLabelPicked:{color:s.onPink},chipPressed:{transform:[{scale:.95}]},chipBusy:{backgroundColor:n.primary,borderColor:n.primary},chipDisabled:{opacity:.45},chipLabel:{...face(e,"bold"),color:s.ink,fontSize:o.bodyTight,lineHeight:o.bodyTight*a.snug,fontVariant:["tabular-nums"],...d},chipLabelBusy:{color:n.onPrimary},chipZone:{...face(e,"mono"),color:n.text.muted,fontSize:o.tiny,lineHeight:o.tiny*a.normal,letterSpacing:.4,...d}})}function TelevetSummaryRow({label:n,value:l,last:i=false,action:o,note:a,testID:s}){let c=useEverfurTheme(),d=e.useMemo(()=>Ca(c),[c]);/* @__PURE__ */
|
|
114
114
|
return r.jsxs(t.View,{style:[d.row,i?d.rowLast:null],testID:s,children:[
|
|
115
115
|
/* @__PURE__ */r.jsx(Text,{style:d.rowLabel,children:n}),a?/* @__PURE__ */r.jsxs(t.View,{style:d.rowValueStack,children:[
|
|
116
116
|
/* @__PURE__ */r.jsx(Text,{style:[d.rowValue,d.rowValueStacked],children:l}),
|
|
@@ -118,7 +118,7 @@ return r.jsxs(t.View,{style:[d.row,i?d.rowLast:null],testID:s,children:[
|
|
|
118
118
|
return r.jsxs(t.Pressable,{onPress:()=>i(!l),accessibilityRole:"checkbox",accessibilityLabel:n,accessibilityState:{checked:l},testID:o,style:s.consent,children:[
|
|
119
119
|
/* @__PURE__ */r.jsx(t.View,{style:[s.box,l?s.boxChecked:null],children:l?/* @__PURE__ */r.jsx(Text,{tier:"badge",style:s.tick,children:ja}):null}),
|
|
120
120
|
/* @__PURE__ */r.jsx(Text,{style:s.consentLabel,children:n})]})}var ja="✓";function TelevetSummaryCard({children:n,testID:l}){let i=useEverfurTheme(),o=e.useMemo(()=>Ca(i),[i]);/* @__PURE__ */
|
|
121
|
-
return r.jsx(t.View,{style:o.card,testID:l,children:n})}function Ca(e){let{color:n,space:r,radius:l,type:i}=e,{size:o,lineHeight:a}=i,s=Vo(e.slots.card);return t.StyleSheet.create({card:{borderRadius:l.lg,borderWidth:1,borderColor:n.borderRingCream,backgroundColor:n.surface,paddingHorizontal:r.lg,...Ao(e.slots.card,1)},row:{flexDirection:"row",alignItems:"center",gap:r.md,minHeight:48,paddingVertical:r.md,borderBottomWidth:1,borderBottomColor:n.borderRingCream},rowLast:{borderBottomWidth:0},rowLabel:{width:64,...face(e,"regular"),color:n.text.muted,fontSize:o.bodyTight,lineHeight:o.bodyTight*a.normal,...s},rowValue:{flex:1,...face(e,"bold"),color:n.brandInk,fontSize:o.bodyTight,lineHeight:o.bodyTight*a.normal,...s},rowValueStack:{flex:1,gap:2},rowValueStacked:{flex:0},rowNote:{...face(e,"regular"),color:n.text.muted,fontSize:o.caption,lineHeight:o.caption*a.normal,...s},consent:{flexDirection:"row",alignItems:"flex-start",gap:r.md,minHeight:No,paddingVertical:14,paddingHorizontal:r.lg,borderRadius:l.sm,backgroundColor:n.surfaceSubtle},box:{width:22,height:22,borderRadius:l.xs,borderWidth:1.5,borderColor:n.brandInk,backgroundColor:n.surface,alignItems:"center",justifyContent:"center"},boxChecked:{backgroundColor:n.primary,borderColor:n.primary},tick:{...face(e,"bold"),color:n.onPrimary,fontSize:o.caption,lineHeight:o.caption,includeFontPadding:false},consentLabel:{flex:1,...face(e,"regular"),color:n.text.primary,fontSize:o.bodyTight,lineHeight:o.bodyTight*a.relaxed}})}function ReviewStep({when:n,onChangeWhen:l,stateName:i,about:o,lengthMinutes:a,clinician:s,clinicianRole:c,petName:d,reason:u,shareRecords:p,onToggleShare:h,stateCode:f,stateAttested:m,onToggleStateAttest:g,cancellationTerms:y,termsAttested:b,onToggleTermsAttest:v,canConfirm:x,busy:T,failure:
|
|
121
|
+
return r.jsx(t.View,{style:o.card,testID:l,children:n})}function Ca(e){let{color:n,space:r,radius:l,type:i}=e,{size:o,lineHeight:a}=i,s=Vo(e.slots.card);return t.StyleSheet.create({card:{borderRadius:l.lg,borderWidth:1,borderColor:n.borderRingCream,backgroundColor:n.surface,paddingHorizontal:r.lg,...Ao(e.slots.card,1)},row:{flexDirection:"row",alignItems:"center",gap:r.md,minHeight:48,paddingVertical:r.md,borderBottomWidth:1,borderBottomColor:n.borderRingCream},rowLast:{borderBottomWidth:0},rowLabel:{width:64,...face(e,"regular"),color:n.text.muted,fontSize:o.bodyTight,lineHeight:o.bodyTight*a.normal,...s},rowValue:{flex:1,...face(e,"bold"),color:n.brandInk,fontSize:o.bodyTight,lineHeight:o.bodyTight*a.normal,...s},rowValueStack:{flex:1,gap:2},rowValueStacked:{flex:0},rowNote:{...face(e,"regular"),color:n.text.muted,fontSize:o.caption,lineHeight:o.caption*a.normal,...s},consent:{flexDirection:"row",alignItems:"flex-start",gap:r.md,minHeight:No,paddingVertical:14,paddingHorizontal:r.lg,borderRadius:l.sm,backgroundColor:n.surfaceSubtle},box:{width:22,height:22,borderRadius:l.xs,borderWidth:1.5,borderColor:n.brandInk,backgroundColor:n.surface,alignItems:"center",justifyContent:"center"},boxChecked:{backgroundColor:n.primary,borderColor:n.primary},tick:{...face(e,"bold"),color:n.onPrimary,fontSize:o.caption,lineHeight:o.caption,includeFontPadding:false},consentLabel:{flex:1,...face(e,"regular"),color:n.text.primary,fontSize:o.bodyTight,lineHeight:o.bodyTight*a.relaxed}})}function ReviewStep({when:n,onChangeWhen:l,stateName:i,about:o,lengthMinutes:a,clinician:s,clinicianRole:c,petName:d,reason:u,shareRecords:p,onToggleShare:h,stateCode:f,stateAttested:m,onToggleStateAttest:g,cancellationTerms:y,termsAttested:b,onToggleTermsAttest:v,canConfirm:x,busy:T,failure:k,onConfirm:w,emergency:S,onAcknowledgeEmergency:j,onSeeOtherVets:C,mediaShortfall:_=Di,primaryVet:I,onFindEmergencyVet:E}){let D=Bo(),P=useEverfurTheme(),R=e.useMemo(()=>Da(P),[P]),z=i??f??"",F=d?Z(ee.whereAttestTemplate,{pet:d,state:z}):Z(ee.stateAttestTemplate,{state:z}),L=o??u,A=ee.emergency.lede;/* @__PURE__ */
|
|
122
122
|
return r.jsxs(t.View,{style:D.scrollRoot,testID:"televet-booking-review",children:[
|
|
123
123
|
/* @__PURE__ */r.jsxs(t.ScrollView,{style:D.scrollBody,contentContainerStyle:R.body,keyboardShouldPersistTaps:"handled",showsVerticalScrollIndicator:false,testID:"televet-booking-review-scroll",children:[
|
|
124
124
|
/* @__PURE__ */r.jsx(Text,{tier:"heading",style:D.stepTitle,accessibilityRole:"header",children:ee.reviewHeading}),
|
|
@@ -130,9 +130,9 @@ return r.jsxs(t.View,{style:D.scrollRoot,testID:"televet-booking-review",childre
|
|
|
130
130
|
/* @__PURE__ */r.jsx(Text,{tier:"heading",accessibilityRole:"header",accessibilityLiveRegion:"assertive",style:R.emergencyTitle,children:ee.emergency.bannerTitle}),
|
|
131
131
|
/* @__PURE__ */r.jsx(Text,{style:R.emergencyLede,children:A}),S.length>0?/* @__PURE__ */r.jsx(Text,{style:R.emergencyLede,testID:"televet-review-emergency-categories",children:S.join(", ")}):null,
|
|
132
132
|
/* @__PURE__ */r.jsx(TelevetEmergencyExits,{petName:d,primaryVet:I,onFindEmergencyVet:E}),
|
|
133
|
-
/* @__PURE__ */r.jsx(TelevetButton,{label:ee.emergency.keepBookingCta,kind:"secondary",loading:T,disabled:T,onPress:j,testID:"televet-review-emergency-ack"})]}):null,
|
|
133
|
+
/* @__PURE__ */r.jsx(TelevetButton,{label:ee.emergency.keepBookingCta,kind:"secondary",loading:T,disabled:T,onPress:j,testID:"televet-review-emergency-ack"})]}):null,k==="failed"?/* @__PURE__ */r.jsx(TelevetFailureLine,{message:ee.confirmFailed}):null,k==="clinician_unavailable"?/* @__PURE__ */r.jsxs(t.View,{style:D.list,testID:"televet-review-clinician-unavailable",children:[
|
|
134
134
|
/* @__PURE__ */r.jsx(TelevetFailureLine,{message:ee.confirmFailed}),
|
|
135
|
-
/* @__PURE__ */r.jsx(TelevetButton,{label:ee.seeOtherVetsCta,kind:"secondary",onPress:C,testID:"televet-review-see-other-vets"})]}):null,
|
|
135
|
+
/* @__PURE__ */r.jsx(TelevetButton,{label:ee.seeOtherVetsCta,kind:"secondary",onPress:C,testID:"televet-review-see-other-vets"})]}):null,k==="rate_limited"?/* @__PURE__ */r.jsx(TelevetFailureLine,{message:ee.confirmFailed,testID:"televet-review-rate-limited"}):null,k==="not_entitled"?/* @__PURE__ */r.jsx(TelevetFailureLine,{message:ee.bookingPausedTitle,testID:"televet-review-not-entitled"}):null]}),S?null:/* @__PURE__ */r.jsx(t.View,{style:D.scrollFooter,children:/* @__PURE__ */r.jsx(TelevetButton,{label:T?ee.confirmBusy:ee.confirmCta,kind:"primary",loading:T,disabled:!x||T||!!f&&!m||!!y&&!b,onPress:w,testID:"televet-review-confirm"})})]})}var _a="○";function Ia(e,t){return t?e.find(e=>e.petRef===t||e.petId===t)?.name??null:null}function TelevetStepFrame({heading:n,lead:l,testID:i,scrollTestID:o,scrollRef:a,footer:s,children:c}){let d=Bo(),u=useEverfurTheme(),p=e.useMemo(()=>Da(u),[u]),h=t.Platform.OS==="ios",f=ha(void 0,h);/* @__PURE__ */
|
|
136
136
|
return r.jsx(t.View,{style:d.scrollRoot,testID:i,children:/* @__PURE__ */r.jsxs(t.KeyboardAvoidingView,{behavior:h?"padding":void 0,style:p.avoider,...f.avoidingProps,children:[
|
|
137
137
|
/* @__PURE__ */r.jsx(KeyboardOffsetProbe,{probeRef:f.probeRef}),
|
|
138
138
|
/* @__PURE__ */r.jsxs(t.ScrollView,{...a?{ref:a}:{},style:d.scrollBody,contentContainerStyle:p.body,keyboardShouldPersistTaps:"handled",keyboardDismissMode:h?"interactive":"on-drag",showsVerticalScrollIndicator:false,...o?{testID:o}:{},children:[
|
|
@@ -169,7 +169,7 @@ return r.jsxs(t.Pressable,{onPress:()=>i(e.id),accessibilityRole:"radio",accessi
|
|
|
169
169
|
/* @__PURE__ */r.jsxs(t.View,{style:u.note,children:[
|
|
170
170
|
/* @__PURE__ */r.jsx(Text,{style:u.noteLabel,nativeID:"televet-quick-note-label",children:na.noteLabel}),
|
|
171
171
|
/* @__PURE__ */r.jsx(Cr,{value:o,onChangeText:a,placeholder:s,placeholderTextColor:p.color.text.muted,accessibilityLabel:na.noteLabel,multiline:true,style:u.noteInput,testID:"televet-quick-note"})]})]}),
|
|
172
|
-
/* @__PURE__ */r.jsx(t.View,{style:u.foot,children:/* @__PURE__ */r.jsx(QuickButton,{label:ee.timeHeading,onPress:d,disabled:!l,busy:c,styles:u,testID:"televet-quick-next"})})]})}function Ra(e,t){let n=di(e);if(n===di(new Date(t).toISOString()))return na.today;let r=new Date(t);return r.setDate(r.getDate()+1),n===di(r.toISOString())?na.tomorrow:new Date(e).toLocaleDateString(void 0,{weekday:"short"})}function za(e){return new Date(e).toLocaleDateString(void 0,{month:"short",day:"numeric"})}function Fa(e){try{let t=new Intl.DateTimeFormat(void 0,{timeZoneName:"shortGeneric"}).formatToParts(new Date(e)).find(e=>e.type==="timeZoneName");if(t?.value)return t.value}catch{}return ai(e)}function La(e,t){if(!e)return na.bookCta;let n=Ra(e.startsAt,t),r=n===na.today||n===na.tomorrow?n.toLowerCase():n;return Z(na.bookAtTemplate,{day:r,time:ri(e.startsAt)})}function TelevetQuickTimeStep(n){let{slots:l,subtitle:i,finePrint:o,selectedSlot:a,busySlotId:s,failure:c,onPick:d,renderUnready:u,petName:p,stateCode:h,stateName:f,stateAttested:m,onToggleStateAttest:g,cancellationTerms:y,termsAttested:b,onToggleTermsAttest:v,canConfirm:x,busy:T,onConfirm:
|
|
172
|
+
/* @__PURE__ */r.jsx(t.View,{style:u.foot,children:/* @__PURE__ */r.jsx(QuickButton,{label:ee.timeHeading,onPress:d,disabled:!l,busy:c,styles:u,testID:"televet-quick-next"})})]})}function Ra(e,t){let n=di(e);if(n===di(new Date(t).toISOString()))return na.today;let r=new Date(t);return r.setDate(r.getDate()+1),n===di(r.toISOString())?na.tomorrow:new Date(e).toLocaleDateString(void 0,{weekday:"short"})}function za(e){return new Date(e).toLocaleDateString(void 0,{month:"short",day:"numeric"})}function Fa(e){try{let t=new Intl.DateTimeFormat(void 0,{timeZoneName:"shortGeneric"}).formatToParts(new Date(e)).find(e=>e.type==="timeZoneName");if(t?.value)return t.value}catch{}return ai(e)}function La(e,t){if(!e)return na.bookCta;let n=Ra(e.startsAt,t),r=n===na.today||n===na.tomorrow?n.toLowerCase():n;return Z(na.bookAtTemplate,{day:r,time:ri(e.startsAt)})}function TelevetQuickTimeStep(n){let{slots:l,subtitle:i,finePrint:o,selectedSlot:a,busySlotId:s,failure:c,onPick:d,renderUnready:u,petName:p,stateCode:h,stateName:f,stateAttested:m,onToggleStateAttest:g,cancellationTerms:y,termsAttested:b,onToggleTermsAttest:v,canConfirm:x,busy:T,onConfirm:k,emergency:w,onAcknowledgeEmergency:S,onSeeOtherVets:j,primaryVet:C,onFindEmergencyVet:_}=n,I=Pa(),E=useEverfurTheme(),D=e.useMemo(()=>Da(E),[E]),P=n.nowMs??Date.now(),R=e.useMemo(()=>{let e=/* @__PURE__ */new Map;for(let t of l){if(Number.isNaN(new Date(t.startsAt).getTime()))continue;let n=di(t.startsAt);e.has(n)||e.set(n,t.startsAt)}return[...e.entries()].map(([e,t])=>({key:e,iso:t}))},[l]),[z,F]=e.useState(null),L=a?di(a.startsAt):null,A=[z,L,R[0]?.key].find(e=>e!=null&&R.some(t=>t.key===e))??null,O=l.filter(e=>di(e.startsAt)===A),V=[];for(let e=0;e<O.length;e+=2)V.push(O.slice(e,e+2));let N=f??h??"",B=p?Z(ee.whereAttestTemplate,{pet:p,state:N}):Z(ee.stateAttestTemplate,{state:N}),M=ee.emergency.lede,H=u===null,$=!H||!x||T||!!h&&!m||!!y&&!b;/* @__PURE__ */
|
|
173
173
|
return r.jsxs(t.View,{style:I.bleed,testID:"televet-quick-time",children:[
|
|
174
174
|
/* @__PURE__ */r.jsxs(t.ScrollView,{style:I.scroll,contentContainerStyle:I.body,children:[
|
|
175
175
|
/* @__PURE__ */r.jsx(StepLabel,{step:2,styles:I}),
|
|
@@ -183,12 +183,12 @@ return r.jsxs(t.Pressable,{onPress:()=>F(e.key),accessibilityRole:"radio",access
|
|
|
183
183
|
return r.jsx(t.Pressable,{onPress:()=>d(e),disabled:s!==null||T,accessibilityRole:"radio",accessibilityState:{checked:n,busy:l},style:[I.slot,n?I.slotPicked:null],testID:`televet-slot-${e.slotId}`,children:/* @__PURE__ */r.jsx(Text,{tier:"compact",style:[I.slotLabel,n?I.slotLabelPicked:null],children:ri(e.startsAt)})},e.slotId)}),e.length===1?/* @__PURE__ */r.jsx(t.View,{style:I.slotSpacer}):null]},e[0]?.slotId))})]}),
|
|
184
184
|
/* @__PURE__ */r.jsxs(t.View,{style:I.lines,children:[c==="expired"?/* @__PURE__ */r.jsx(TelevetFailureLine,{message:ee.holdExpired}):null,c==="taken"?/* @__PURE__ */r.jsx(TelevetFailureLine,{message:ee.slotTaken}):null,c==="failed"||c==="rate_limited"?/* @__PURE__ */r.jsx(TelevetFailureLine,{message:ee.confirmFailed,testID:"televet-quick-failed"}):null,c==="not_entitled"?/* @__PURE__ */r.jsx(TelevetFailureLine,{message:ee.bookingPausedTitle}):null,c==="clinician_unavailable"?/* @__PURE__ */r.jsxs(r.Fragment,{children:[
|
|
185
185
|
/* @__PURE__ */r.jsx(TelevetFailureLine,{message:ee.confirmFailed}),
|
|
186
|
-
/* @__PURE__ */r.jsx(TelevetButton,{label:ee.seeOtherVetsCta,kind:"secondary",onPress:j,testID:"televet-quick-see-other-vets"})]}):null]}),H&&a?/* @__PURE__ */r.jsxs(t.View,{style:I.ticks,children:[h?/* @__PURE__ */r.jsx(TelevetConsentCheckbox,{label:B,checked:m,onToggle:g,testID:"televet-quick-state-attest"}):null,y?/* @__PURE__ */r.jsx(TelevetConsentCheckbox,{label:y,checked:b,onToggle:v,testID:"televet-quick-terms-attest"}):null]}):null,
|
|
186
|
+
/* @__PURE__ */r.jsx(TelevetButton,{label:ee.seeOtherVetsCta,kind:"secondary",onPress:j,testID:"televet-quick-see-other-vets"})]}):null]}),H&&a?/* @__PURE__ */r.jsxs(t.View,{style:I.ticks,children:[h?/* @__PURE__ */r.jsx(TelevetConsentCheckbox,{label:B,checked:m,onToggle:g,testID:"televet-quick-state-attest"}):null,y?/* @__PURE__ */r.jsx(TelevetConsentCheckbox,{label:y,checked:b,onToggle:v,testID:"televet-quick-terms-attest"}):null]}):null,w?/* @__PURE__ */r.jsxs(t.View,{style:[D.emergencyBanner,I.ticks],testID:"televet-quick-emergency",children:[
|
|
187
187
|
/* @__PURE__ */r.jsx(Text,{tier:"heading",accessibilityRole:"header",accessibilityLiveRegion:"assertive",style:D.emergencyTitle,children:ee.emergency.bannerTitle}),
|
|
188
|
-
/* @__PURE__ */r.jsx(Text,{style:D.emergencyLede,children:M}),
|
|
188
|
+
/* @__PURE__ */r.jsx(Text,{style:D.emergencyLede,children:M}),w.length>0?/* @__PURE__ */r.jsx(Text,{style:D.emergencyLede,children:w.join(", ")}):null,
|
|
189
189
|
/* @__PURE__ */r.jsx(TelevetEmergencyExits,{petName:p,primaryVet:C,onFindEmergencyVet:_}),
|
|
190
|
-
/* @__PURE__ */r.jsx(TelevetButton,{label:ee.emergency.keepBookingCta,kind:"secondary",loading:T,disabled:T,onPress:S,testID:"televet-quick-emergency-ack"})]}):null]}),
|
|
191
|
-
/* @__PURE__ */r.jsx(QuickButton,{label:T?ee.confirmBusy:La(a,P),onPress:
|
|
190
|
+
/* @__PURE__ */r.jsx(TelevetButton,{label:ee.emergency.keepBookingCta,kind:"secondary",loading:T,disabled:T,onPress:S,testID:"televet-quick-emergency-ack"})]}):null]}),w?null:/* @__PURE__ */r.jsxs(t.View,{style:I.foot,children:[
|
|
191
|
+
/* @__PURE__ */r.jsx(QuickButton,{label:T?ee.confirmBusy:La(a,P),onPress:k,disabled:$,busy:T,styles:I,testID:"televet-quick-book"}),o?/* @__PURE__ */r.jsx(Text,{style:I.fine,testID:"televet-quick-fine",children:o}):null]})]})}function Aa(e,t){let n=Z(na.whenTemplate,{day:Ra(e,t),date:za(e),time:ri(e)}),r=Fa(e);return r?`${n} ${r}`:n}function TelevetQuickBookedScreen({consult:n,petName:l,onDone:i,onAddToCalendar:o,renderNote:a,nowMs:s}){let c=Pa(),[d,u]=e.useState("idle"),p=async()=>{if(!o)return;let e=new Date(n.scheduledAt);if(Number.isNaN(e.getTime())){u("failed");return}u("saving");let t=await q(o,{key:televetConsultCalendarKey(n.consultId),title:ee.visit.title,startDate:e,endDate:new Date(e.getTime()+oi*6e4),alarmOffsetMinutes:-30});u(t.ok&&t.value===true?"saved":"failed")};/* @__PURE__ */
|
|
192
192
|
return r.jsxs(t.View,{style:c.bleed,testID:"televet-quick-booked",children:[
|
|
193
193
|
/* @__PURE__ */r.jsxs(t.ScrollView,{style:c.scroll,contentContainerStyle:c.done,children:[
|
|
194
194
|
/* @__PURE__ */r.jsx(t.View,{style:c.check,accessibilityElementsHidden:true,importantForAccessibility:"no-hide-descendants",children:/* @__PURE__ */r.jsx(t.View,{style:c.checkMark})}),
|
|
@@ -221,25 +221,25 @@ return r.jsxs(TelevetStepFrame,{heading:Z(h.titleTemplate,{pet:n??ee.petFallback
|
|
|
221
221
|
/* @__PURE__ */r.jsx(Text,{style:u.emergencyTitle,accessibilityRole:"header",children:ee.emergency.bannerTitle}),
|
|
222
222
|
/* @__PURE__ */r.jsx(Text,{style:u.emergencyLede,children:f}),
|
|
223
223
|
/* @__PURE__ */r.jsx(TelevetEmergencyExits,{petName:n,primaryVet:s,onFindEmergencyVet:c}),
|
|
224
|
-
/* @__PURE__ */r.jsx(TelevetButton,{label:ee.emergency.keepBookingCta,kind:"quiet",fullWidth:false,onPress:a,testID:"televet-emergency-handled"})]}):null]})}function Oa(e){let{space:n,radius:r,type:l}=e,{size:i,lineHeight:o}=l,a=Lo(e),s=e.slots.chip;return t.StyleSheet.create({pickRow:{flexDirection:"row",flexWrap:"wrap",gap:10},pick:{minHeight:44,flexDirection:"row",alignItems:"center",gap:n.sm,paddingHorizontal:n.lg,borderRadius:r.pill,borderWidth:1,borderColor:a.ink,backgroundColor:a.surface,...Ao(s,1)},pickOn:{backgroundColor:a.pink,borderColor:a.ink},pressed:{transform:[{scale:.97}]},check:{width:12,height:7,marginTop:-3,borderLeftWidth:2,borderBottomWidth:2,borderColor:a.onPink,transform:[{rotate:"-45deg"}]},pickLabel:{...face(e,"bold"),color:a.ink,fontSize:i.bodyTight,lineHeight:i.bodyTight*o.snug,...Vo(s)},pickLabelOn:{color:a.onPink},note:{...face(e,"regular"),color:a.muted,fontSize:i.bodyTight,lineHeight:i.bodyTight*o.relaxed},callout:{padding:n.md,borderRadius:r.sm,backgroundColor:a.mist,overflow:"hidden",...face(e,"regular"),color:a.text,fontSize:i.bodyTight,lineHeight:i.bodyTight*o.relaxed},signs:{gap:n.sm},sign:{flexDirection:"row",gap:n.md,alignItems:"flex-start"},bullet:{width:6,height:6,borderRadius:3,backgroundColor:a.text,marginTop:i.body*.6},signText:{flex:1,...face(e,"regular"),color:a.text,fontSize:i.body,lineHeight:i.body*o.relaxed}})}function EverfurTelevetBooking(n){let{petRef:petRef,usState:l,controller:i,onBooked:o,onExit:a,onAddPet:s,onPickMedia:c,onAddToCalendar:d,onConfirmDiscard:u,onRequestLocation:p,locationStatus:h="unknown",onTriageReason:m,onStateInterest:g,primaryVet:y,onFindEmergencyVet:b,canJoinInApp:v=false,renderUnavailable:x,style:T,testID:
|
|
225
|
-
/* @__PURE__ */r.jsx(TelevetBookingChrome,{step:ie,furthestIndex:z.furthestIndex,canGoBack:!Ve&&(be.open||(L?
|
|
226
|
-
/* @__PURE__ */r.jsx(TelevetClinicianOutcome,{state:We,cause:Me,locationStatus:h,...p?{onRequestLocation:p}:{},onRetry:()=>ue.refetch(),stateInterest:ve,...x?{renderUnavailable:x}:{}}):L&&ie==="booked"?/* @__PURE__ */r.jsx(t.View,{style:j.stepFill,testID:"televet-booking-booked",children:ne?/* @__PURE__ */r.jsx(TelevetQuickBookedScreen,{consult:ne,petName:Ia(D,ne.petId)??Te,onDone:()=>a?.(),renderNote:S?.renderBookedNote,...d?{onAddToCalendar:d}:{}}):null}):ie==="time"?/* @__PURE__ */r.jsx(SlotStep,{slots:pe.data??[],enabled:pe.enabled,isPending:pe.enabled&&pe.isPending&&pe.data===null,isError:pe.isError,error:pe.error,busySlotId:me.isPending?me.variables:null,failure:H,selectedSlot:le.slot,nextOpening:fe,onPick:ze,onRetry:()=>pe.refetch(),onSeeOtherVets:()=>A({type:"goTo",step:"clinician"})}):ie==="review"?/* @__PURE__ */r.jsx(ReviewStep,{when:le.slot?fi(le.slot.startsAt):"",onChangeWhen:()=>A({type:"goTo",step:"time"}),stateName:
|
|
224
|
+
/* @__PURE__ */r.jsx(TelevetButton,{label:ee.emergency.keepBookingCta,kind:"quiet",fullWidth:false,onPress:a,testID:"televet-emergency-handled"})]}):null]})}function Oa(e){let{space:n,radius:r,type:l}=e,{size:i,lineHeight:o}=l,a=Lo(e),s=e.slots.chip;return t.StyleSheet.create({pickRow:{flexDirection:"row",flexWrap:"wrap",gap:10},pick:{minHeight:44,flexDirection:"row",alignItems:"center",gap:n.sm,paddingHorizontal:n.lg,borderRadius:r.pill,borderWidth:1,borderColor:a.ink,backgroundColor:a.surface,...Ao(s,1)},pickOn:{backgroundColor:a.pink,borderColor:a.ink},pressed:{transform:[{scale:.97}]},check:{width:12,height:7,marginTop:-3,borderLeftWidth:2,borderBottomWidth:2,borderColor:a.onPink,transform:[{rotate:"-45deg"}]},pickLabel:{...face(e,"bold"),color:a.ink,fontSize:i.bodyTight,lineHeight:i.bodyTight*o.snug,...Vo(s)},pickLabelOn:{color:a.onPink},note:{...face(e,"regular"),color:a.muted,fontSize:i.bodyTight,lineHeight:i.bodyTight*o.relaxed},callout:{padding:n.md,borderRadius:r.sm,backgroundColor:a.mist,overflow:"hidden",...face(e,"regular"),color:a.text,fontSize:i.bodyTight,lineHeight:i.bodyTight*o.relaxed},signs:{gap:n.sm},sign:{flexDirection:"row",gap:n.md,alignItems:"flex-start"},bullet:{width:6,height:6,borderRadius:3,backgroundColor:a.text,marginTop:i.body*.6},signText:{flex:1,...face(e,"regular"),color:a.text,fontSize:i.body,lineHeight:i.body*o.relaxed}})}function EverfurTelevetBooking(n){let{petRef:petRef,usState:l,controller:i,onBooked:o,onExit:a,onAddPet:s,onPickMedia:c,onAddToCalendar:d,onConfirmDiscard:u,onRequestLocation:p,locationStatus:h="unknown",onTriageReason:m,onStateInterest:g,primaryVet:y,onFindEmergencyVet:b,canJoinInApp:v=false,renderUnavailable:x,style:T,testID:k,variant:w="steps",quick:S}=U(n,["onBooked","onExit","onAddPet","onRequestLocation","onFindEmergencyVet"]),j=Bo(),C=useEverfurTheme(),_=e.useMemo(()=>Da(C),[C]),I=useTelevetBookingController(i),E=useEverfurPets(),D=E.pets,P=D.length,R=e.useMemo(()=>({ownedPetCount:P,withIssues:true}),[P]),[z,F]=e.useReducer((e,t)=>televetBookingReducer(e,t,R),void 0,()=>{let e=initialTelevetBookingState({ownedPetCount:0,withIssues:true},{petId:petRef??null,state:l??null});return w==="quick"&&l?televetBookingReducer(e,{type:"goTo",step:"reason"},{ownedPetCount:0,withIssues:true}):e}),L=w==="quick",A=e.useCallback(e=>F(e),[]),[O,V]=e.useState(""),[N,B]=e.useState(null),M=e.useMemo(()=>S?.reasons!==void 0&&S.reasons.length>0?S.reasons:Vl(),[S?.reasons]),[H,$]=e.useState(null),[W,q]=e.useState(null),[K,Y]=e.useState(false),[G,J]=e.useState(false),[Q,X]=e.useState([]),Z=e.useMemo(()=>createRnChatAttachmentTransport(),[]),te=Fi({media:Q,controller:I,transport:Z}),[ne,re]=e.useState(null),{draft:le}=z,ie=currentStep(z),oe=e.useRef(le.state);oe.current!==le.state&&(oe.current=le.state,K&&Y(false),G&&J(false));let ae=useTelevetStatePolicy(le.state,I),se=useTelevetCancellationPolicy(I),ce=useTelevetBookingEntitlement(I),de=ao(I,ce),ue=useTelevetClinicians(le.state,de),pe=useTelevetSlots(le.clinicianId,de),he=pe.refetch,fe=useTelevetNextSlot(de).data??null,me=useTelevetHoldSlot(I),ge=useTelevetBookConsult(I),ye=e.useMemo(()=>Si(I),[I]),be=useEarlyTriage(m??ye),ve=useStateInterest(le.state,g??null).actionFor("no_licensed_vet"),xe=l??null,Te=Ia(D,le.petId),ke=Ul({reasonText:O,state:le.state,hostState:xe,clinicianId:le.clinicianId,clinicians:ue.data,policy:ae,petName:Te,controller:I,dispatch:A}),{where:we,matchedClinician:Se}=ke,je=M.find(e=>e.id===N)?.label,Ce=L?Nl(je?[je]:[],O):ke.composedReason;e.useEffect(()=>{xe&&!le.state&&!ke.whereTouched.current&&A({type:"patch",patch:{state:xe}})},[xe,le.state,A]),e.useEffect(()=>{petRef&&!le.petId&&A({type:"patch",patch:{petId:petRef}})},[petRef,le.petId,A]);let _e=D.length===1?D[0]?.petRef??null:null;e.useEffect(()=>{_e&&!le.petId&&A({type:"patch",patch:{petId:_e}})},[_e,le.petId,A]);let Ie=e.useRef(ie);Ie.current=ie;let Ee=e.useRef(le.petId);Ee.current=le.petId;let De=e.useRef(0);e.useEffect(()=>{if(P===De.current)return;De.current=P;let e=P>1&&!Ee.current;A({type:"goTo",step:e?"pet":Ie.current})},[P,A]);let Pe=ue.data?.[0]?.clinicianId??null;e.useEffect(()=>{Pe&&!le.clinicianId&&A({type:"patch",patch:{clinicianId:Pe}})},[Pe,le.clinicianId,A]);let Re=e.useCallback(e=>{L&&e.type==="next"||A(e)},[L,A]),ze=wi({draft:le,hold:me,dispatch:Re,setFailure:$,refetchSlots:he});xi({controller:I,draft:le,keep:ie==="booked"||ge.isPending});let{submitBooking:Fe,confirm:Le}=bi({draft:le,reasonText:Ce,book:ge,stateAttested:K,termsAttested:G,cancellationPolicy:se.data??null,triage:be,goTo:e.useCallback(e=>A({type:"goTo",step:e}),[A]),releaseSlot:e.useCallback(()=>{A({type:"patch",patch:ei}),he()},[A,he]),setFailure:$,setEmergency:q,setBookedConsult:re,...o?{onBooked:o}:{},media:te}),Ae=ae.enabled&&ae.data!==null&&!ae.data.wellnessAvailable&&ie!=="pet"&&ie!=="where",Oe=ce.enabled&&ce.data?.active===false||H==="not_entitled",{simulate:Ve,fundingRefused:Ne}=io(ce,Oe),Be=ce.enabled&&ce.data!==null,Me=televetEmptyRosterCause(Be),He=Ce.trim().length>0||!!le.slot,$e=I===null||H==="unavailable"||Kn(ce)||Kn(ae),We={noState:!le.state,isPending:ue.enabled&&ue.isPending,isError:ue.isError,isEmpty:(ue.data?.length??0)===0,notEntitled:Ne},Ue=Ko(We),qe=ie==="clinician"?"time":ie==="time"?"reason":ie==="reason"&&!xe?"where":(ie==="reason"||ie==="where")&&P>1?"pet":null,Ke=e=>A({type:"goTo",step:e==="pet"&&!xe?"where":e==="reason"?"time":"reason"}),Ye=e.useMemo(()=>oa(C),[C]),Ge={surfaceUnavailable:$e,notEntitled:Ne,policyBlocked:Ae,triageOpen:be.open,step:ie},Je=Wo(Ge),Qe=L&&!Ve&&!Je&&(ie==="reason"||ie==="time"&&!Ue||ie==="booked"),Xe=e=>L&&!Qe?/* @__PURE__ */r.jsx(t.View,{style:Ye.pad,children:e}):e;return isTelevetBookingCopyReady()?/* @__PURE__ */r.jsxs(t.View,{style:[j.screen,L?Ye.screen:null,T],testID:k??"televet-booking",children:[
|
|
225
|
+
/* @__PURE__ */r.jsx(TelevetBookingChrome,{step:ie,furthestIndex:z.furthestIndex,canGoBack:!Ve&&(be.open||(L?qe!==null:hasPreviousStep(z,R)))&&ie!=="booked",isDirty:He,onBack:()=>{if(be.open){be.close();return}be.cancel(),L&&qe?A({type:"goTo",step:qe}):L||A({type:"back"})},onClose:()=>a?.(),triageOpen:be.open,stepContext:R,presentation:L?"nav":"rail",...u?{onConfirmDiscard:u}:{}}),Xe(Ve?/* @__PURE__ */r.jsx(TelevetVisitSimulator,{petId:le.petId,roster:E,onAddPet:s,onPickPet:e=>A({type:"patch",patch:{petId:e}})}):Je?/* @__PURE__ */r.jsx(TelevetBookingGate,{state:Ge,petName:Ia(D,le.petId),...y?{primaryVet:y}:{},onFindEmergencyVet:b,stateInterest:ve,...g?{onCheckAvailability:()=>A({type:"goTo",step:"clinician"})}:{},onAcknowledgeEmergency:()=>{be.acknowledge(Ce),L?Ke("reason"):A({type:"next"})},...x?{renderUnavailable:x}:{}}):L&&ie==="reason"?/* @__PURE__ */r.jsx(TelevetQuickReasonStep,{petName:Te,reasons:M,pickedId:N,onPick:B,note:O,onChangeNote:V,notePlaceholder:S?.notePlaceholder??ee.reasonPlaceholder,checking:be.checking,onNext:()=>{be.check(Ce).then(e=>{e&&Ke("reason")})}}):L&&ie==="time"&&!Ue?/* @__PURE__ */r.jsx(TelevetQuickTimeStep,{slots:pe.data??[],subtitle:S?.subtitle??na.who,finePrint:S?.finePrint??null,selectedSlot:le.slot,busySlotId:me.isPending?me.variables:null,failure:H,onPick:ze,renderUnready:!pe.enabled||pe.isPending&&pe.data===null||pe.isError||(pe.data?.length??0)===0?()=>/* @__PURE__ */r.jsx(SlotStep,{slots:pe.data??[],enabled:pe.enabled,isPending:pe.enabled&&pe.isPending&&pe.data===null,isError:pe.isError,error:pe.error,busySlotId:null,failure:null,selectedSlot:le.slot,nextOpening:fe,onPick:ze,onRetry:()=>pe.refetch(),onSeeOtherVets:()=>A({type:"goTo",step:"clinician"})}):null,petName:Te,stateCode:le.state,stateName:we.stateName,stateAttested:K,onToggleStateAttest:Y,cancellationTerms:se.data?.summary??null,termsAttested:G,onToggleTermsAttest:J,canConfirm:canConfirm(le,Ce),busy:ge.isPending||te.sending,onConfirm:Le,emergency:W,onAcknowledgeEmergency:()=>Fe(true),onSeeOtherVets:()=>A({type:"goTo",step:"clinician"}),primaryVet:y,onFindEmergencyVet:b}):L&&ie==="time"?
|
|
226
|
+
/* @__PURE__ */r.jsx(TelevetClinicianOutcome,{state:We,cause:Me,locationStatus:h,...p?{onRequestLocation:p}:{},onRetry:()=>ue.refetch(),stateInterest:ve,...x?{renderUnavailable:x}:{}}):L&&ie==="booked"?/* @__PURE__ */r.jsx(t.View,{style:j.stepFill,testID:"televet-booking-booked",children:ne?/* @__PURE__ */r.jsx(TelevetQuickBookedScreen,{consult:ne,petName:Ia(D,ne.petId)??Te,onDone:()=>a?.(),renderNote:S?.renderBookedNote,...d?{onAddToCalendar:d}:{}}):null}):ie==="time"?/* @__PURE__ */r.jsx(SlotStep,{slots:pe.data??[],enabled:pe.enabled,isPending:pe.enabled&&pe.isPending&&pe.data===null,isError:pe.isError,error:pe.error,busySlotId:me.isPending?me.variables:null,failure:H,selectedSlot:le.slot,nextOpening:fe,onPick:ze,onRetry:()=>pe.refetch(),onSeeOtherVets:()=>A({type:"goTo",step:"clinician"})}):ie==="review"?/* @__PURE__ */r.jsx(ReviewStep,{when:le.slot?fi(le.slot.startsAt):"",onChangeWhen:()=>A({type:"goTo",step:"time"}),stateName:we.stateName,about:ke.aboutLine,lengthMinutes:(le.slot?f(le.slot):null)??oi,petName:Ia(D,le.petId),reason:Ce.trim(),clinician:ue.data?.find(e=>e.clinicianId===le.clinicianId)?.displayName??null,clinicianRole:ue.data?.find(e=>e.clinicianId===le.clinicianId)?.role??null,shareRecords:le.shareHealthRecords,stateCode:le.state,stateAttested:K,onToggleStateAttest:Y,cancellationTerms:se.data?.summary??null,termsAttested:G,onToggleTermsAttest:J,onToggleShare:e=>A({type:"patch",patch:{shareHealthRecords:e}}),canConfirm:canConfirm(le,Ce),busy:ge.isPending||te.sending,failure:H,onConfirm:Le,emergency:W,onAcknowledgeEmergency:()=>Fe(true),onSeeOtherVets:()=>A({type:"goTo",step:"clinician"}),mediaShortfall:te.shortfall,primaryVet:y,onFindEmergencyVet:b}):ie==="booked"?/* @__PURE__ */r.jsx(t.View,{style:j.stepFill,testID:"televet-booking-booked",children:ne?/* @__PURE__ */r.jsxs(r.Fragment,{children:[
|
|
227
227
|
/* @__PURE__ */r.jsx(TelevetBookedScreen,{consult:ne,petName:Ia(D,ne.petId)??Ia(D,le.petId),onDone:()=>a?.(),canJoinInApp:v,sharedRecords:le.shareHealthRecords,sentPhoto:te.sentOnePhoto(ne),...d?{onAddToCalendar:d}:{}}),
|
|
228
|
-
/* @__PURE__ */r.jsx(TelevetMediaDropNotice,{shortfall:te.bookedShortfall(ne),testIDPrefix:"televet-booked"})]}):null}):ie==="clinician"&&
|
|
229
|
-
/* @__PURE__ */r.jsx(TelevetClinicianOutcome,{state:We,cause:Me,locationStatus:h,...p?{onRequestLocation:p}:{},onRetry:()=>ue.refetch(),stateInterest:ve,...x?{renderUnavailable:x}:{}}):ie==="clinician"?/* @__PURE__ */r.jsx(ClinicianStep,{clinicians:ue.data??[],isPending:ue.enabled&&ue.isPending,isError:ue.isError,error:ue.error,selectedId:le.clinicianId,stateCode:le.state,stateName:
|
|
230
|
-
/* @__PURE__ */r.jsx(PetStep,{pets:D,isPending:E.loading,isError:E.error!==null,error:E.error,onRetry:()=>{E.refresh()},onAddPet:s,selectedId:le.petId,onSelect:e=>A({type:"patch",patch:{petId:e}}),onNext:()=>L?Ke("pet"):A({type:"next"})}):ie==="where"?/* @__PURE__ */r.jsx(WhereStep,{petName:Te,where:
|
|
231
|
-
/* @__PURE__ */r.jsx(t.View,{style:_.marker,testID:`televet-booking-step-${ie}`}))]}):/* @__PURE__ */r.jsx(t.View,{style:[j.screen,T],testID:
|
|
232
|
-
return r.jsx(t.View,{style:l.navRow,children:/* @__PURE__ */r.jsx(t.Pressable,{onPress:e,accessibilityRole:"button",accessibilityLabel:Xo,testID:n,style:l.backTap,children:/* @__PURE__ */r.jsx(t.View,{style:l.chevron,accessibilityElementsHidden:true,importantForAccessibility:"no"})})})}function Qa(){let t=useEverfurTheme();return e.useMemo(()=>Xa(t),[t])}function Xa(e){let{color:n,space:r,radius:l,type:i}=e,{size:o,lineHeight:a}=i,s=Lo(e),c=e.slots.header,d=e.slots.card,u=Vo(d);return t.StyleSheet.create({screen:{flex:1,paddingHorizontal:r.xl},body:{gap:r.lg,paddingBottom:r.xl},navRow:{paddingVertical:r.sm,flexDirection:"row",...Ao(Oo(c,l.lg))},backTap:{width:No,height:No,borderRadius:No/2,borderWidth:1.5,borderColor:s.line,alignItems:"center",justifyContent:"center"},chevron:{width:10,height:10,marginLeft:r.xs,borderLeftWidth:2,borderBottomWidth:2,borderColor:c?.textColor??s.ink,transform:[{rotate:"45deg"}]},title:{...headingFace(e,"bold"),color:s.ink,fontSize:o.subtitle,lineHeight:o.subtitle*a.snug},list:{gap:0},card:{gap:14,padding:r.lg,borderRadius:l.lg,borderWidth:1,borderColor:s.line,backgroundColor:s.surface,...Ao(d,1)},cardHead:{flexDirection:"row",alignItems:"center",gap:r.sm},pill:{marginLeft:"auto",height:24,paddingHorizontal:10,borderRadius:l.pill,backgroundColor:s.pink,justifyContent:"center"},pillLine:{backgroundColor:s.surface,borderWidth:1.5,borderColor:s.line},pillText:{...face(e,"monoBold"),color:s.onPink,fontSize:11,letterSpacing:.9,textTransform:"uppercase"},pillLineText:{color:s.muted},visit:{flexDirection:"row",alignItems:"flex-start",gap:r.lg},dateTile:{width:56,paddingVertical:r.sm,borderRadius:14,backgroundColor:s.pinkSoft,alignItems:"center",gap:2},dateTileSmall:{...face(e,"monoBold"),color:s.ink,fontSize:11,letterSpacing:.9,textTransform:"uppercase"},dateTileDay:{...face(e,"medium"),color:s.ink,fontSize:o.heading,lineHeight:o.heading*a.tight},visitMain:{flex:1,gap:2},visitTitle:{...headingFace(e,"bold"),color:s.ink,fontSize:o.body,lineHeight:o.body*a.snug,...u},visitLine:{...face(e,"regular"),color:s.text,fontSize:o.bodyTight,lineHeight:o.bodyTight*a.normal,...u},row:{gap:2,paddingVertical:r.md,borderTopWidth:1,borderTopColor:s.line},rowFirst:{borderTopWidth:0,paddingTop:0},rowHead:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",gap:r.sm},when:{flex:1,...face(e,"bold"),color:s.ink,fontSize:o.body,lineHeight:o.body*a.snug,...u},status:{...face(e,"monoBold"),color:s.muted,fontSize:11,letterSpacing:.9,textTransform:"uppercase",...u},meta:{...face(e,"regular"),color:s.muted,fontSize:o.caption,lineHeight:o.caption*a.normal,...u},bookCard:{gap:r.md,padding:r.lg,borderRadius:l.lg,borderWidth:1,borderColor:s.line,backgroundColor:s.surface,...Ao(d,1)},bookTitle:{...headingFace(e,"bold"),color:s.ink,fontSize:o.subtitle,lineHeight:o.subtitle*a.snug,...u},bookSubtitle:{...face(e,"regular"),color:s.muted,fontSize:o.bodyTight,lineHeight:o.bodyTight*a.normal,...u},footnote:{...face(e,"regular"),color:s.muted,fontSize:o.caption,lineHeight:o.caption*a.relaxed,textAlign:"center"},visitCard:{gap:r.md,padding:r.lg,borderRadius:l.lg,borderWidth:1,borderColor:s.line,backgroundColor:s.surface,...Ao(d,1)},visitWhen:{...headingFace(e,"medium"),color:s.ink,fontSize:o.heading,lineHeight:o.heading*a.snug,...u},visitWho:{...face(e,"bold"),color:s.ink,fontSize:o.body,lineHeight:o.body*a.snug,...u},visitMeta:{...face(e,"regular"),color:s.text,fontSize:o.bodyTight,lineHeight:o.bodyTight*a.normal,...u},reason:{...face(e,"regular"),color:s.muted,fontSize:o.caption,lineHeight:o.caption*a.normal,...u},terms:{padding:r.md,borderRadius:l.sm,backgroundColor:s.mist,...face(e,"regular"),color:s.text,fontSize:o.caption,lineHeight:o.caption*a.normal},noticeTitle:{...headingFace(e,"medium"),color:s.ink,fontSize:o.heading,lineHeight:o.heading*a.snug},noticeBody:{...face(e,"regular"),color:s.muted,fontSize:o.body,lineHeight:o.body*a.normal},receipt:{gap:r.xs,padding:r.md,borderRadius:l.sm,backgroundColor:s.mist},stack:{gap:r.sm},whyHead:{flexDirection:"row",flexWrap:"wrap",alignItems:"baseline",gap:r.sm},whyTitle:{...face(e,"bold"),color:s.ink,fontSize:o.bodyTight,lineHeight:o.bodyTight*a.snug},whyNote:{...face(e,"regular"),color:s.muted,fontSize:o.caption,lineHeight:o.caption*a.normal},hint:{flexDirection:"row",flexWrap:"wrap",alignItems:"center",justifyContent:"space-between",gap:r.sm,paddingVertical:r.sm,paddingHorizontal:r.lg,borderRadius:l.sm,backgroundColor:s.mist},muted:{...face(e,"regular"),color:n.text.primary,fontSize:o.bodyTight}})}function Za(e){let{color:n,space:r,radius:l,type:i}=e,{size:o,lineHeight:a}=i,s=Lo(e),c={...face(e,"regular"),maxWidth:"85%",paddingVertical:10,paddingHorizontal:14,borderRadius:18,fontSize:o.body,lineHeight:o.body*a.normal};return t.StyleSheet.create({head:{gap:2},screenTitle:{...headingFace(e,"medium"),color:s.ink,fontSize:o.heading,lineHeight:o.heading*a.snug},meta:{...face(e,"regular"),color:s.muted,fontSize:o.bodyTight,lineHeight:o.bodyTight*a.normal},log:{gap:r.sm,paddingBottom:r.md},day:{alignSelf:"center",...face(e,"monoBold"),color:s.muted,fontSize:11,letterSpacing:.9,textTransform:"uppercase",paddingTop:r.sm},item:{gap:4,alignItems:"flex-start"},itemMine:{alignItems:"flex-end"},whoRow:{flexDirection:"row",alignItems:"baseline",gap:r.sm},who:{...face(e,"bold"),color:s.ink,fontSize:o.bodyTight},time:{...face(e,"regular"),color:s.muted,fontSize:o.caption},bubbleMine:{...c,backgroundColor:n.bubbleUser,color:n.onPrimary,borderBottomRightRadius:6},bubbleVet:{...c,backgroundColor:n.bubbleVet,color:n.onBubbleVet,borderBottomLeftRadius:6},system:{...face(e,"regular"),color:s.muted,fontSize:o.caption,textAlign:"center",alignSelf:"center"},attachments:{...face(e,"regular"),color:s.muted,fontSize:o.caption},composer:{flexDirection:"row",alignItems:"flex-end",gap:r.sm,padding:r.sm,borderRadius:l.lg,borderWidth:1.5,borderColor:s.line,backgroundColor:s.surface,...Ao(e.slots.input,1.5)},field:{flex:1,minHeight:No,paddingHorizontal:r.sm,paddingVertical:10,...face(e,"regular"),color:s.text,fontSize:o.body,...Vo(e.slots.input)},send:{minWidth:No,height:No,paddingHorizontal:r.md,borderRadius:No/2,backgroundColor:n.primary,alignItems:"center",justifyContent:"center"},sendDisabled:{opacity:.5},sendLabel:{...face(e,"bold"),color:n.onPrimary,fontSize:o.bodyTight},note:{...face(e,"regular"),color:s.muted,fontSize:o.caption,lineHeight:o.caption*a.normal},failure:{...face(e,"bold"),color:s.alert,fontSize:o.caption},label:{...face(e,"monoBold"),color:s.muted,fontSize:11,letterSpacing:.9,textTransform:"uppercase"},body:{...face(e,"regular"),color:s.text,fontSize:o.body,lineHeight:o.body*a.normal},planItem:{flexDirection:"row",gap:r.md,alignItems:"flex-start"},planNumber:{...face(e,"monoBold"),color:s.ink,fontSize:12,letterSpacing:.9,paddingTop:3},planText:{flex:1,...face(e,"regular"),color:s.text,fontSize:o.body,lineHeight:o.body*a.normal},rowPress:{flexDirection:"row",alignItems:"center",gap:r.md,minHeight:No},rowMain:{flex:1,gap:2},rowEnd:{alignItems:"flex-end",gap:4},preview:{...face(e,"regular"),color:s.muted,fontSize:o.caption},link:{minHeight:No,justifyContent:"center",alignSelf:"flex-start"},linkText:{...face(e,"bold"),color:n.linkInk,fontSize:o.bodyTight,textDecorationLine:"underline"}})}function es(){let t=useEverfurTheme();return e.useMemo(()=>Za(t),[t])}function TelevetConsultScreen({consult:n,controller:l,onJoin:i,onReschedule:o,onCancelled:a,onBack:s,revision:d=0,onMessageVet:u,nowMs:p,style:h}){let f=Qa(),m=es(),g=useTelevetBookingController(l),[y,b]=e.useState(0),v=
|
|
228
|
+
/* @__PURE__ */r.jsx(TelevetMediaDropNotice,{shortfall:te.bookedShortfall(ne),testIDPrefix:"televet-booked"})]}):null}):ie==="clinician"&&Ue?
|
|
229
|
+
/* @__PURE__ */r.jsx(TelevetClinicianOutcome,{state:We,cause:Me,locationStatus:h,...p?{onRequestLocation:p}:{},onRetry:()=>ue.refetch(),stateInterest:ve,...x?{renderUnavailable:x}:{}}):ie==="clinician"?/* @__PURE__ */r.jsx(ClinicianStep,{clinicians:ue.data??[],isPending:ue.enabled&&ue.isPending,isError:ue.isError,error:ue.error,selectedId:le.clinicianId,stateCode:le.state,stateName:we.stateName,onRetry:()=>ue.refetch(),onSelect:e=>{A({type:"patch",patch:{clinicianId:e}}),A({type:"next"})}}):ie==="reason"?/* @__PURE__ */r.jsx(ReasonStep,{value:O,composed:Ce,vetName:Se?.displayName??null,onChange:V,media:Q,onChangeMedia:X,mediaLive:te.live,...c?{onPickMedia:c}:{},checking:be.checking,onNext:()=>{be.check(Ce).then(e=>{e&&A({type:"next"})})}}):ie==="pet"?
|
|
230
|
+
/* @__PURE__ */r.jsx(PetStep,{pets:D,isPending:E.loading,isError:E.error!==null,error:E.error,onRetry:()=>{E.refresh()},onAddPet:s,selectedId:le.petId,onSelect:e=>A({type:"patch",patch:{petId:e}}),onNext:()=>L?Ke("pet"):A({type:"next"})}):ie==="where"?/* @__PURE__ */r.jsx(WhereStep,{petName:Te,where:we,onNext:()=>L?Ke("where"):A({type:"next"})}):ie==="issues"?/* @__PURE__ */r.jsx(IssuesStep,{petName:Te,chips:ke.issueChips,selected:ke.concernIds,onToggle:ke.toggleConcern,onNext:()=>A({type:"next"})}):ie==="emergency"?/* @__PURE__ */r.jsx(EmergencyStep,{petName:Te,answer:ke.emergencyAnswer,onAnswer:ke.setEmergencyAnswer,onNext:()=>A({type:"next"}),onHandled:()=>{be.acknowledge(Ce),A({type:"next"})},...y?{primaryVet:y}:{},onFindEmergencyVet:b}):
|
|
231
|
+
/* @__PURE__ */r.jsx(t.View,{style:_.marker,testID:`televet-booking-step-${ie}`}))]}):/* @__PURE__ */r.jsx(t.View,{style:[j.screen,T],testID:k??"televet-booking",children:/* @__PURE__ */r.jsx(t.View,{style:j.stepFill,testID:"televet-booking-copy-unapproved",children:x?x():null})})}var Va=2e4;function Na(t=true,n=Va){let[r,l]=e.useState(()=>Date.now());return e.useEffect(()=>{if(!t)return;l(Date.now());let e=setInterval(()=>l(Date.now()),n);return()=>clearInterval(e)},[t,n]),r}function Ba(e){return e.httpStatus!==void 0&&!isVetMessagesDark(e)}function useVetThreads(t,n=0){let r=t?.listVetThreads,l=r!==void 0,[i,o]=e.useState(()=>({availability:l?"pending":"dark",threads:[],isPending:l,error:null})),[a,s]=e.useState(0);e.useEffect(()=>{if(!t||!r){o({availability:"dark",threads:[],isPending:false,error:null});return}let e=new AbortController,n=true;return o(e=>({...e,isPending:true})),r.call(t,e.signal).then(e=>{n&&(e.ok?o({availability:"lit",threads:e.value,isPending:false,error:null}):isVetMessagesDark(e.error)?o({availability:"dark",threads:[],isPending:false,error:null}):o(t=>({availability:Ba(e.error)?"lit":t.availability,threads:t.threads,isPending:false,error:e.error})))},()=>{n&&o(e=>({...e,isPending:false}))}),()=>{n=false,e.abort()}},[t,r,n,a]);let c=e.useCallback(()=>s(e=>e+1),[]);return e.useMemo(()=>({...i,refetch:c}),[i,c])}function useVetThread(t,petRef,n={}){let r=n.now??Date.now,l=t?.listVetMessages,[i,o]=e.useState([]),[a,s]=e.useState("loading"),[c,d]=e.useState(false),[u,p]=e.useState(false),[h,f]=e.useState(n.ownerCanStart===false),[m,g]=e.useState(false),[y,b]=e.useState(null),[v,x]=e.useState(0),[T,k]=e.useState(0),w=e.useRef(true),S=e.useRef(false),j=e.useRef(false),C=e.useRef(r);C.current=r,e.useEffect(()=>(w.current=true,()=>{w.current=false}),[]),e.useEffect(()=>{n.ownerCanStart===false&&f(true)},[n.ownerCanStart]),e.useEffect(()=>{if(o([]),d(false),!t||!l){s("ready");return}s("loading");let e=new AbortController,n=true;return l.call(t,petRef,{},e.signal).then(e=>{if(n){if(!e.ok){s("error");return}o([...e.value].reverse()),d(e.value.length>=Rt),s("ready")}},()=>{n&&s("error")}),()=>{n=false,e.abort()}},[t,l,petRef,T]);let _=e.useRef(null);e.useEffect(()=>{let e=t?.markVetThreadRead;a!=="ready"||!t||!e||_.current===petRef||(_.current=petRef,e.call(t,petRef,new Date(C.current()).toISOString()).catch(()=>{}))},[a,t,petRef]);let I=e.useCallback(()=>{let e=i[0];if(!t||!l||!c||e===void 0||j.current)return;j.current=true,p(true);let n=new AbortController;l.call(t,petRef,{before:e.createdAt},n.signal).then(e=>{if(j.current=false,!w.current||(p(false),!e.ok))return;let t=new Set(i.map(e=>e.messageId)),n=[...e.value].reverse().filter(e=>!t.has(e.messageId));o(e=>[...n,...e]),d(e.value.length>=Rt)},()=>{j.current=false,w.current&&p(false)})},[t,l,petRef,c,i]),E=e.useCallback(async e=>{let n=t?.sendVetMessage;if(!t||!n||S.current||e.trim().length===0)return false;S.current=true,g(true),b(null);let r=false;try{let l=await n.call(t,petRef,e);if(!w.current)return l.ok;l.ok?(r=!0,o(e=>[...e,l.value]),x(e=>e+1)):isVetThreadVetFirst(l.error)?(f(!0),b("vetWritesFirst")):b("notSent")}catch{w.current&&b("notSent")}finally{S.current=false,w.current&&g(false)}return r},[t,petRef]),D=e.useCallback(()=>k(e=>e+1),[]),P=t?.sendVetMessage!==void 0&&!h;return e.useMemo(()=>({status:a,messages:i,hasOlder:c,loadingOlder:u,loadOlder:I,canWrite:P,sending:m,sendFailure:y,sentCount:v,send:E,retry:D}),[a,i,c,u,I,P,m,y,v,E,D])}function useVisitSummary(t,n){let r=t?.visitSummary,[l,i]=e.useState(()=>({status:r?"loading":"absent",summary:null})),[o,a]=e.useState(0);e.useEffect(()=>{if(!t||!r){i({status:"absent",summary:null});return}i({status:"loading",summary:null});let e=new AbortController,l=true;return r.call(t,n,e.signal).then(e=>{l&&(e.ok?i({status:"ready",summary:e.value}):i({status:isVetMessagesDark(e.error)?"pending":"error",summary:null}))},()=>{l&&i({status:"error",summary:null})}),()=>{l=false,e.abort()}},[t,r,n,o]);let s=e.useCallback(()=>a(e=>e+1),[]);return e.useMemo(()=>({...l,retry:s}),[l,s])}function vetThreadPetRef(e,t){return t?e.find(e=>e.petRef===t||e.petId===t)?.petRef??null:null}var Ma="your vet",Ha="your pet",$a=/* @__PURE__ */Object.freeze({messagesTitle:"Messages",newPillNative:"New",newPillWeb:"New reply",previewOwnerTemplate:"You: {text}",previewVetTemplateWeb:"{vet}: {text}",threadMetaTemplateNative:"With {vet}",threadLogTemplate:"Messages with {vet}",composerLabelTemplateNative:"Message {vet}",composerLabelWeb:"Message",composerPlaceholderTemplate:"Message {vet}…",send:"Send",composerNoteTemplate:"{vet} usually replies within a day. Emergency? Call a vet.",sent:"Sent",bookVisitWeb:"Book a visit",empty:"No messages yet",loading:"Loading",loadFailed:"Could not load",retry:"Try again",notSent:"Not sent",vetWritesFirst:"Your vet will write first. You can reply once they do.",attachmentsTemplate:"{n} attached",runningLateTemplate:"Running late? Message {vet}",sawTitleTemplate:"What {vet} saw",summaryLabel:"Summary",fromVetTemplate:"From {vet}",planTitleTemplate:"{pet}’s plan",wordForWord:"Word for word",fromThisVisitTitle:"From this visit",messageVetTemplate:"Message {vet}",bookFollowUp:"Book a follow-up",summaryFootnoteTemplate:"A summary of your video visit, written by {vet}. In an emergency, go to the nearest emergency animal hospital.",summaryPending:"Summary on its way"});function Wa(e,t){let n=e;for(let[e,r]of Object.entries(t))n=n.split(`{${e}}`).join(r);return n}function Ua(e){return e.length===0?e:e.charAt(0).toUpperCase()+e.slice(1)}function qa(e){let t=e?.trim()??"";return t.length>0?t:Ma}function Ka(e){let t=e?.trim()??"";return t.length>0?t:Ha}function Ya(e){let t=new Date(e);return Number.isNaN(t.getTime())?"":t.toLocaleDateString(void 0,{month:"short",day:"numeric"})}var Ga=/* @__PURE__ */Object.freeze({pastTitle:"Past video visits",upcomingTitle:"Next video visit",bookedPill:"Booked",visitTitleTemplate:"{pet} with {vet}",minutesTemplate:"{n} minutes",emptyTitle:"No visits yet",bookCta:"Find a time",bookCardTitle:"Book a video visit",bookAnotherTitle:"Book another visit",bookCardSubtitle:"Get help for your pet from home.",loadErrorTitle:"Could not load your visits",retryCta:"Try again",statusCompleted:"Completed",statusCancelled:"Cancelled",statusMissed:"Missed",manageCta:"Manage",getReadyCta:"Get ready",joinCta:"Join the visit",joinDisabledReason:"You can join closer to the time.",joinOverReason:"This visit has ended.",vetUnassigned:"Your vet",rescheduleCta:"Reschedule",cancelCta:"Cancel",cancelConfirmTitleTemplate:"Cancel {pet}’s visit?",cancelConfirmTitle:"Cancel this visit?",cancelConfirmBody:"You can book another one afterwards.",cancelConfirmCta:"Cancel the visit",cancelKeepCta:"Keep the visit",cancelWhyTitle:"What changed?",cancelWhyOptional:"Optional",cancelWhyBetterTemplate:"{pet} is better",cancelWhyTime:"The time doesn’t work",cancelWhyRegularVet:"We’ll see our regular vet",cancelWhyOther:"Something else",cancelWhyTimeHint:"Another time might be easier.",cancelMoveInstead:"Move the visit instead",summaryWhen:"When",summaryVet:"Vet",summaryAbout:"About",cancelFailedTitle:"Could not cancel",cancelReason:"Cancelled by the pet parent in the app.",cancelPolicyErrorTitle:"Could not load what you need to agree to",phaseCancelled:"This visit was cancelled",phaseCancelledBody:"You can book another visit when you are ready.",notFoundTitle:"Not found",notFoundBody:"This visit is no longer available.",staleTitle:"Could not load your visits",staleRetry:"Try again"});function Ja(e){switch(e){case"completed":return Ga.statusCompleted;case"cancelled_owner":case"cancelled_ops":return Ga.statusCancelled;case"no_show_owner":case"no_show_vet":return Ga.statusMissed;default:return null}}function TelevetVisitBackRow({onBack:e,testID:n}){let l=Qa();/* @__PURE__ */
|
|
232
|
+
return r.jsx(t.View,{style:l.navRow,children:/* @__PURE__ */r.jsx(t.Pressable,{onPress:e,accessibilityRole:"button",accessibilityLabel:Xo,testID:n,style:l.backTap,children:/* @__PURE__ */r.jsx(t.View,{style:l.chevron,accessibilityElementsHidden:true,importantForAccessibility:"no"})})})}function Qa(){let t=useEverfurTheme();return e.useMemo(()=>Xa(t),[t])}function Xa(e){let{color:n,space:r,radius:l,type:i}=e,{size:o,lineHeight:a}=i,s=Lo(e),c=e.slots.header,d=e.slots.card,u=Vo(d);return t.StyleSheet.create({screen:{flex:1,paddingHorizontal:r.xl},body:{gap:r.lg,paddingBottom:r.xl},navRow:{paddingVertical:r.sm,flexDirection:"row",...Ao(Oo(c,l.lg))},backTap:{width:No,height:No,borderRadius:No/2,borderWidth:1.5,borderColor:s.line,alignItems:"center",justifyContent:"center"},chevron:{width:10,height:10,marginLeft:r.xs,borderLeftWidth:2,borderBottomWidth:2,borderColor:c?.textColor??s.ink,transform:[{rotate:"45deg"}]},title:{...headingFace(e,"bold"),color:s.ink,fontSize:o.subtitle,lineHeight:o.subtitle*a.snug},list:{gap:0},card:{gap:14,padding:r.lg,borderRadius:l.lg,borderWidth:1,borderColor:s.line,backgroundColor:s.surface,...Ao(d,1)},cardHead:{flexDirection:"row",alignItems:"center",gap:r.sm},pill:{marginLeft:"auto",height:24,paddingHorizontal:10,borderRadius:l.pill,backgroundColor:s.pink,justifyContent:"center"},pillLine:{backgroundColor:s.surface,borderWidth:1.5,borderColor:s.line},pillText:{...face(e,"monoBold"),color:s.onPink,fontSize:11,letterSpacing:.9,textTransform:"uppercase"},pillLineText:{color:s.muted},visit:{flexDirection:"row",alignItems:"flex-start",gap:r.lg},dateTile:{width:56,paddingVertical:r.sm,borderRadius:14,backgroundColor:s.pinkSoft,alignItems:"center",gap:2},dateTileSmall:{...face(e,"monoBold"),color:s.ink,fontSize:11,letterSpacing:.9,textTransform:"uppercase"},dateTileDay:{...face(e,"medium"),color:s.ink,fontSize:o.heading,lineHeight:o.heading*a.tight},visitMain:{flex:1,gap:2},visitTitle:{...headingFace(e,"bold"),color:s.ink,fontSize:o.body,lineHeight:o.body*a.snug,...u},visitLine:{...face(e,"regular"),color:s.text,fontSize:o.bodyTight,lineHeight:o.bodyTight*a.normal,...u},row:{gap:2,paddingVertical:r.md,borderTopWidth:1,borderTopColor:s.line},rowFirst:{borderTopWidth:0,paddingTop:0},rowHead:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",gap:r.sm},when:{flex:1,...face(e,"bold"),color:s.ink,fontSize:o.body,lineHeight:o.body*a.snug,...u},status:{...face(e,"monoBold"),color:s.muted,fontSize:11,letterSpacing:.9,textTransform:"uppercase",...u},meta:{...face(e,"regular"),color:s.muted,fontSize:o.caption,lineHeight:o.caption*a.normal,...u},bookCard:{gap:r.md,padding:r.lg,borderRadius:l.lg,borderWidth:1,borderColor:s.line,backgroundColor:s.surface,...Ao(d,1)},bookTitle:{...headingFace(e,"bold"),color:s.ink,fontSize:o.subtitle,lineHeight:o.subtitle*a.snug,...u},bookSubtitle:{...face(e,"regular"),color:s.muted,fontSize:o.bodyTight,lineHeight:o.bodyTight*a.normal,...u},footnote:{...face(e,"regular"),color:s.muted,fontSize:o.caption,lineHeight:o.caption*a.relaxed,textAlign:"center"},visitCard:{gap:r.md,padding:r.lg,borderRadius:l.lg,borderWidth:1,borderColor:s.line,backgroundColor:s.surface,...Ao(d,1)},visitWhen:{...headingFace(e,"medium"),color:s.ink,fontSize:o.heading,lineHeight:o.heading*a.snug,...u},visitWho:{...face(e,"bold"),color:s.ink,fontSize:o.body,lineHeight:o.body*a.snug,...u},visitMeta:{...face(e,"regular"),color:s.text,fontSize:o.bodyTight,lineHeight:o.bodyTight*a.normal,...u},reason:{...face(e,"regular"),color:s.muted,fontSize:o.caption,lineHeight:o.caption*a.normal,...u},terms:{padding:r.md,borderRadius:l.sm,backgroundColor:s.mist,...face(e,"regular"),color:s.text,fontSize:o.caption,lineHeight:o.caption*a.normal},noticeTitle:{...headingFace(e,"medium"),color:s.ink,fontSize:o.heading,lineHeight:o.heading*a.snug},noticeBody:{...face(e,"regular"),color:s.muted,fontSize:o.body,lineHeight:o.body*a.normal},receipt:{gap:r.xs,padding:r.md,borderRadius:l.sm,backgroundColor:s.mist},stack:{gap:r.sm},whyHead:{flexDirection:"row",flexWrap:"wrap",alignItems:"baseline",gap:r.sm},whyTitle:{...face(e,"bold"),color:s.ink,fontSize:o.bodyTight,lineHeight:o.bodyTight*a.snug},whyNote:{...face(e,"regular"),color:s.muted,fontSize:o.caption,lineHeight:o.caption*a.normal},hint:{flexDirection:"row",flexWrap:"wrap",alignItems:"center",justifyContent:"space-between",gap:r.sm,paddingVertical:r.sm,paddingHorizontal:r.lg,borderRadius:l.sm,backgroundColor:s.mist},muted:{...face(e,"regular"),color:n.text.primary,fontSize:o.bodyTight}})}function Za(e){let{color:n,space:r,radius:l,type:i}=e,{size:o,lineHeight:a}=i,s=Lo(e),c={...face(e,"regular"),maxWidth:"85%",paddingVertical:10,paddingHorizontal:14,borderRadius:18,fontSize:o.body,lineHeight:o.body*a.normal};return t.StyleSheet.create({head:{gap:2},screenTitle:{...headingFace(e,"medium"),color:s.ink,fontSize:o.heading,lineHeight:o.heading*a.snug},meta:{...face(e,"regular"),color:s.muted,fontSize:o.bodyTight,lineHeight:o.bodyTight*a.normal},log:{gap:r.sm,paddingBottom:r.md},day:{alignSelf:"center",...face(e,"monoBold"),color:s.muted,fontSize:11,letterSpacing:.9,textTransform:"uppercase",paddingTop:r.sm},item:{gap:4,alignItems:"flex-start"},itemMine:{alignItems:"flex-end"},whoRow:{flexDirection:"row",alignItems:"baseline",gap:r.sm},who:{...face(e,"bold"),color:s.ink,fontSize:o.bodyTight},time:{...face(e,"regular"),color:s.muted,fontSize:o.caption},bubbleMine:{...c,backgroundColor:n.bubbleUser,color:n.onPrimary,borderBottomRightRadius:6},bubbleVet:{...c,backgroundColor:n.bubbleVet,color:n.onBubbleVet,borderBottomLeftRadius:6},system:{...face(e,"regular"),color:s.muted,fontSize:o.caption,textAlign:"center",alignSelf:"center"},attachments:{...face(e,"regular"),color:s.muted,fontSize:o.caption},composer:{flexDirection:"row",alignItems:"flex-end",gap:r.sm,padding:r.sm,borderRadius:l.lg,borderWidth:1.5,borderColor:s.line,backgroundColor:s.surface,...Ao(e.slots.input,1.5)},field:{flex:1,minHeight:No,paddingHorizontal:r.sm,paddingVertical:10,...face(e,"regular"),color:s.text,fontSize:o.body,...Vo(e.slots.input)},send:{minWidth:No,height:No,paddingHorizontal:r.md,borderRadius:No/2,backgroundColor:n.primary,alignItems:"center",justifyContent:"center"},sendDisabled:{opacity:.5},sendLabel:{...face(e,"bold"),color:n.onPrimary,fontSize:o.bodyTight},note:{...face(e,"regular"),color:s.muted,fontSize:o.caption,lineHeight:o.caption*a.normal},failure:{...face(e,"bold"),color:s.alert,fontSize:o.caption},label:{...face(e,"monoBold"),color:s.muted,fontSize:11,letterSpacing:.9,textTransform:"uppercase"},body:{...face(e,"regular"),color:s.text,fontSize:o.body,lineHeight:o.body*a.normal},planItem:{flexDirection:"row",gap:r.md,alignItems:"flex-start"},planNumber:{...face(e,"monoBold"),color:s.ink,fontSize:12,letterSpacing:.9,paddingTop:3},planText:{flex:1,...face(e,"regular"),color:s.text,fontSize:o.body,lineHeight:o.body*a.normal},rowPress:{flexDirection:"row",alignItems:"center",gap:r.md,minHeight:No},rowMain:{flex:1,gap:2},rowEnd:{alignItems:"flex-end",gap:4},preview:{...face(e,"regular"),color:s.muted,fontSize:o.caption},link:{minHeight:No,justifyContent:"center",alignSelf:"flex-start"},linkText:{...face(e,"bold"),color:n.linkInk,fontSize:o.bodyTight,textDecorationLine:"underline"}})}function es(){let t=useEverfurTheme();return e.useMemo(()=>Za(t),[t])}function TelevetConsultScreen({consult:n,controller:l,onJoin:i,onReschedule:o,onCancelled:a,onBack:s,revision:d=0,onMessageVet:u,nowMs:p,style:h}){let f=Qa(),m=es(),g=useTelevetBookingController(l),[y,b]=e.useState(0),v=Un(n.consultId,g,d+y),x=useTelevetCancellationPolicy(g),T=qn(n.consultId,g),{pets:k}=useEverfurPets(),w=useVetThreads(g),[S,j]=e.useState(false),[C,_]=e.useState(null),[I,E]=e.useState(false),[D,P]=e.useState(null),R=v.isError&&v.error?.httpStatus===404,z=R?null:v.data??n,F=z!==null&&c.has(z.status),L=Na(!F),A=televetJoinReadiness(z,p??L),O=z===null?null:Ia(k,z.petId),V=x.data?.summary.trim()||null,N=e.useCallback(()=>{V&&(E(false),T.mutate(C??Ga.cancelReason,{onSuccess:e=>{j(false),P(e),b(e=>e+1),a?.(e)},onError:()=>E(true)}))},[V,T,a,C]);if(z===null)/* @__PURE__ */
|
|
233
233
|
return r.jsxs(t.View,{style:[f.screen,h],testID:"televet-consult-missing",children:[
|
|
234
234
|
/* @__PURE__ */r.jsx(TelevetVisitBackRow,{onBack:s,testID:"televet-consult-back"}),
|
|
235
|
-
/* @__PURE__ */r.jsx(TelevetStateCard,{title:Ga.notFoundTitle,message:Ga.notFoundBody})]});let B=z.status,M=B==="cancelled_owner"||B==="cancelled_ops",H=B==="scheduled"||B==="in_progress",$=canManageTelevetVisit(B)&&D===null,W=z.clinicianName??Ga.vetUnassigned,
|
|
235
|
+
/* @__PURE__ */r.jsx(TelevetStateCard,{title:Ga.notFoundTitle,message:Ga.notFoundBody})]});let B=z.status,M=B==="cancelled_owner"||B==="cancelled_ops",H=B==="scheduled"||B==="in_progress",$=canManageTelevetVisit(B)&&D===null,W=z.clinicianName??Ga.vetUnassigned,U=[O,z.reasonText].filter(Boolean).join(" · "),q=w.availability==="lit"?vetThreadPetRef(k,z.petId):null,K=q===null?void 0:w.threads.find(e=>e.petRef===q),Y=q===null?null:{petRef:q,petName:O,vetName:z.clinicianName,...K?{ownerCanStart:K.ownerCanStart}:{}};/* @__PURE__ */
|
|
236
236
|
return r.jsxs(t.View,{style:[f.screen,h],testID:"televet-consult",children:[
|
|
237
237
|
/* @__PURE__ */r.jsx(TelevetVisitBackRow,{onBack:s,testID:"televet-consult-back"}),
|
|
238
238
|
/* @__PURE__ */r.jsxs(t.ScrollView,{contentContainerStyle:f.body,children:[
|
|
239
239
|
/* @__PURE__ */r.jsxs(t.View,{style:f.visitCard,children:[
|
|
240
240
|
/* @__PURE__ */r.jsx(Text,{style:f.visitWhen,accessibilityRole:"header",testID:"televet-consult-when",children:formatWhenWithDay(z.scheduledAt)}),
|
|
241
241
|
/* @__PURE__ */r.jsxs(t.View,{style:f.stack,children:[
|
|
242
|
-
/* @__PURE__ */r.jsx(Text,{style:f.visitWho,testID:"televet-consult-vet",children:W}),
|
|
242
|
+
/* @__PURE__ */r.jsx(Text,{style:f.visitWho,testID:"televet-consult-vet",children:W}),U?/* @__PURE__ */r.jsx(Text,{style:f.visitMeta,numberOfLines:2,children:U}):null]})]}),H&&D===null?/* @__PURE__ */r.jsxs(r.Fragment,{children:[
|
|
243
243
|
/* @__PURE__ */r.jsx(TelevetButton,{label:Ga.joinCta,disabled:!A.ready,onPress:()=>i(z,O),testID:"televet-consult-join"}),A.ready?null:/* @__PURE__ */r.jsx(Text,{style:f.reason,testID:"televet-consult-join-reason",children:A.reason==="consult_over"?Ga.joinOverReason:Ga.joinDisabledReason}),Y&&u?/* @__PURE__ */r.jsx(t.Pressable,{onPress:()=>u(Y),accessibilityRole:"link",style:m.link,testID:"televet-consult-late",children:/* @__PURE__ */r.jsx(Text,{style:m.linkText,children:Wa($a.runningLateTemplate,{vet:z.clinicianName??Ma})})}):null,$&&o?/* @__PURE__ */r.jsx(TelevetButton,{label:Ga.rescheduleCta,kind:"secondary",onPress:()=>o(z),testID:"televet-consult-reschedule"}):null]}):null,D?/* @__PURE__ */r.jsx(t.View,{style:f.receipt,testID:"televet-consult-cancel-receipt",children:/* @__PURE__ */r.jsx(Text,{style:f.noticeTitle,accessibilityLiveRegion:"polite",children:D.summary??Ga.phaseCancelled})}):M?/* @__PURE__ */r.jsxs(t.View,{style:f.stack,testID:"televet-consult-cancelled",children:[
|
|
244
244
|
/* @__PURE__ */r.jsx(Text,{style:f.noticeTitle,accessibilityRole:"header",children:Ga.phaseCancelled}),
|
|
245
245
|
/* @__PURE__ */r.jsx(Text,{style:f.noticeBody,children:Ga.phaseCancelledBody})]}):null,$?/* @__PURE__ */r.jsxs(t.View,{style:f.stack,children:[V?/* @__PURE__ */r.jsx(Text,{style:f.terms,accessibilityLiveRegion:"polite",testID:"televet-consult-cancellation-policy",children:V}):x.enabled&&x.isPending?/* @__PURE__ */r.jsx(t.View,{testID:"televet-consult-cancellation-policy-loading",children:/* @__PURE__ */r.jsx(TelevetSkeletonBlock,{height:42})}):/* @__PURE__ */r.jsx(TelevetStateCard,{title:Ga.cancelPolicyErrorTitle,actionLabel:Ga.retryCta,onAction:()=>x.refetch(),testID:"televet-consult-cancellation-policy-error"}),S?/* @__PURE__ */r.jsxs(t.View,{style:f.stack,testID:"televet-consult-cancel-confirm",children:[
|
|
@@ -251,34 +251,34 @@ return r.jsxs(t.View,{style:[f.screen,h],testID:"televet-consult",children:[
|
|
|
251
251
|
/* @__PURE__ */r.jsx(TelevetChoiceRow,{title:e.label,selected:C===e.label,onPress:()=>_(C===e.label?null:e.label),testID:`televet-consult-cancel-why-${e.id}`}),e.id==="time"&&C===e.label?/* @__PURE__ */r.jsxs(t.View,{style:f.hint,testID:"televet-consult-cancel-time-hint",children:[
|
|
252
252
|
/* @__PURE__ */r.jsx(Text,{style:f.muted,children:Ga.cancelWhyTimeHint}),o?/* @__PURE__ */r.jsx(TelevetButton,{label:Ga.cancelMoveInstead,kind:"quiet",fullWidth:false,onPress:()=>o(z),testID:"televet-consult-cancel-move"}):null]}):null]},e.id))}),I?/* @__PURE__ */r.jsx(TelevetFailureLine,{message:Ga.cancelFailedTitle,testID:"televet-consult-cancel-failed"}):null,
|
|
253
253
|
/* @__PURE__ */r.jsx(TelevetButton,{label:Ga.cancelConfirmCta,kind:"danger",loading:T.isPending,onPress:N,testID:"televet-consult-cancel-yes"}),
|
|
254
|
-
/* @__PURE__ */r.jsx(TelevetButton,{label:Ga.cancelKeepCta,kind:"secondary",disabled:T.isPending,onPress:()=>{j(false),E(false)},testID:"televet-consult-cancel-keep"})]}):/* @__PURE__ */r.jsx(TelevetButton,{label:Ga.cancelCta,kind:"secondary",disabled:!V,onPress:()=>{E(false),j(true)},testID:"televet-consult-cancel"})]}):null,v.isError&&!R?/* @__PURE__ */r.jsx(TelevetStateCard,{title:Ga.staleTitle,actionLabel:Ga.staleRetry,onAction:()=>v.refetch(),testID:"televet-consult-stale"}):null]})]})}var ts=/* @__PURE__ */Object.freeze({muteCta:"Mute",unmuteCta:"Unmute",cameraOffCta:"Camera off",cameraOnCta:"Camera on",leaveCta:"Leave",switchCameraCta:"Switch camera",speakerOffCta:"Speaker off",speakerOnCta:"Speaker on",lobbyTitleNoName:"Your vet is joining",lobbySubtitle:"",lobbyPrepLabel:"While you wait",lobbyPrepNoPet:"Have your pet nearby and somewhere well lit.",lobbyTitle:e=>{let t=e?.trim()??"";return t.length>0?`${t} is joining`:ts.lobbyTitleNoName},lobbyPrep:e=>{let t=e?.trim()??"";return t.length>0?`Have ${t} nearby and somewhere well lit.`:ts.lobbyPrepNoPet},lobbyDuration:e=>`${e} minutes`,waitingRoomLabel:"Waiting room",leaveWaitingRoomLabel:"Leave the waiting room",lobbyTipsTitle:e=>{let t=e?.trim()??"";return t.length>0?`Before ${t} joins`:ts.lobbyPrepLabel},lobbyTipSpot:"Find a bright, quiet spot.",joinFailedReason:"That did not open. Try again.",recordingNoticeTitle:"This consultation is recorded.",recordingNoticeCta:"Continue to the call",recordingNoticeDecline:"Not now",selfCameraOffLabel:"Your camera is off"});function ns(e){switch(e){case"too_early":return"You can join closer to the time.";case"too_late":return"This visit has ended.";case"room_not_ready":return"The room is still being set up. Try again in a moment.";case"not_joinable":return"This visit is no longer open.";case"unavailable":return"No way to join this visit yet.";default:return"That did not open. Try again."}}var rs="No way to join this visit yet.";function ls(e){return e==="room_not_ready"||e==="unknown"}var is=/* @__PURE__ */Symbol.for("@everfur/sdk/televet");function os(){let e=globalThis,t=e[is];if(t!==void 0)return t;let n={presenter:null,snapshot:/* @__PURE__ */Object.freeze({request:null,serial:0,activeHost:null}),hosts:[],nextHost:1,listeners:/* @__PURE__ */new Set,dailyRegistered:false};return e[is]=n,n}function as(){return os().dailyRegistered}function ss(e){let t=null;return()=>{if(t!==null)return t;let n=e();return t=n,n.then(void 0,()=>{t===n&&(t=null)}),n}}var cs=/* @__PURE__ */Object.freeze({status:"joining"});function useTelevetJoin(t,n){let[r,l]=e.useState(0),[i,o]=e.useState(cs),a=e.useRef(null);e.useEffect(()=>{let e=n?.joinConsult;if(n===null||e===void 0){o(/* @__PURE__ */Object.freeze({status:"refused",refusal:"unavailable",reason:null}));return}let l=`${t}#${String(r)}`,i=a.current;if(i===null||i.key!==l){let r;try{r=e.call(n,t)}catch(e){r=Promise.reject(e)}i={key:l,promise:r},a.current=i}let s=true;return o(cs),i.promise.then(e=>{s&&(e.ok?o(/* @__PURE__ */Object.freeze({status:"ready",credential:e.value})):o(/* @__PURE__ */Object.freeze({status:"refused",refusal:vetCallJoinRefusal(e.error),reason:vetCallJoinReason(e.error)})))},()=>{s&&o(/* @__PURE__ */Object.freeze({status:"refused",refusal:"unknown",reason:null}))}),()=>{s=false}},[t,n,r]);let s=e.useCallback(()=>l(e=>e+1),[]);return{state:i,retry:s}}var ds=/* @__PURE__ */Symbol.for("@everfur/sdk/televet/recording-notice-receipt");function us(){let e=globalThis;return e[ds]??=/* @__PURE__ */new Map}function ps(e){let t=us();t.set(e,(t.get(e)??0)+1)}function hs(e){let t=us(),n=t.get(e)??0;n<=1?t.delete(e):t.set(e,n-1)}var fs=e.createContext(null);function ms(t){let n=e.useContext(fs);e.useEffect(()=>{if(!(n===null||!t))return n.setFullBleed(true),()=>{n.setFullBleed(false)}},[n,t])}var gs=ss(()=>Promise.resolve(a));function TelevetJoinScreen({consultId:e,...n}){let l=Bo(),i=bs();return i===null?/* @__PURE__ */r.jsx(t.View,{style:[l.screen,n.style],testID:"televet-join-checking"}):/* @__PURE__ */r.jsx(TelevetJoinGate,{consultId:e,...n,canHostCall:i},e)}function TelevetJoinGate({canHostCall:t,onLeave:n,style:l,...i}){let[o,a]=e.useState(false);ys(()=>(n(),true),!o);let s=e.useCallback(()=>{a(false),n()},[n]);return t?o?/* @__PURE__ */r.jsx(TelevetJoinRoom,{...i,onLeave:s,style:l}):/* @__PURE__ */r.jsx(TelevetRecordingNotice,{onContinue:()=>a(true),onLeave:n,style:l}):/* @__PURE__ */r.jsx(TelevetJoinUnavailable,{onLeave:n,style:l})}function TelevetJoinRoom({consultId:n,controller:l,clinicianName:i,petName:o,onLeave:a,style:s}){let c=Bo(),d=useTelevetBookingController(l),{state:u,retry:p}=useTelevetJoin(n,d),[h,f]=e.useState(null),[m,g]=e.useState(false),y=u.status==="ready";e.useEffect(()=>{if(!y||h!==null)return;let e=true;return gs().then(t=>{e&&f(()=>t)},()=>{e&&g(true)}),()=>{e=false}},[y,h]);let b=u.status==="ready"?u.credential.roomUrl:null,[v,x]=e.useState(null);e.useEffect(()=>{if(b!==null)return ps(b),x(b),()=>{hs(b)}},[b]);let T=y&&h!==null&&!m;ys(()=>(T||a(),true),true);let
|
|
254
|
+
/* @__PURE__ */r.jsx(TelevetButton,{label:Ga.cancelKeepCta,kind:"secondary",disabled:T.isPending,onPress:()=>{j(false),E(false)},testID:"televet-consult-cancel-keep"})]}):/* @__PURE__ */r.jsx(TelevetButton,{label:Ga.cancelCta,kind:"secondary",disabled:!V,onPress:()=>{E(false),j(true)},testID:"televet-consult-cancel"})]}):null,v.isError&&!R?/* @__PURE__ */r.jsx(TelevetStateCard,{title:Ga.staleTitle,actionLabel:Ga.staleRetry,onAction:()=>v.refetch(),testID:"televet-consult-stale"}):null]})]})}var ts=/* @__PURE__ */Object.freeze({muteCta:"Mute",unmuteCta:"Unmute",cameraOffCta:"Camera off",cameraOnCta:"Camera on",leaveCta:"Leave",switchCameraCta:"Switch camera",speakerOffCta:"Speaker off",speakerOnCta:"Speaker on",lobbyTitleNoName:"Your vet is joining",lobbySubtitle:"",lobbyPrepLabel:"While you wait",lobbyPrepNoPet:"Have your pet nearby and somewhere well lit.",lobbyTitle:e=>{let t=e?.trim()??"";return t.length>0?`${t} is joining`:ts.lobbyTitleNoName},lobbyPrep:e=>{let t=e?.trim()??"";return t.length>0?`Have ${t} nearby and somewhere well lit.`:ts.lobbyPrepNoPet},lobbyDuration:e=>`${e} minutes`,waitingRoomLabel:"Waiting room",leaveWaitingRoomLabel:"Leave the waiting room",lobbyTipsTitle:e=>{let t=e?.trim()??"";return t.length>0?`Before ${t} joins`:ts.lobbyPrepLabel},lobbyTipSpot:"Find a bright, quiet spot.",joinFailedReason:"That did not open. Try again.",recordingNoticeTitle:"This consultation is recorded.",recordingNoticeCta:"Continue to the call",recordingNoticeDecline:"Not now",selfCameraOffLabel:"Your camera is off"});function ns(e){switch(e){case"too_early":return"You can join closer to the time.";case"too_late":return"This visit has ended.";case"room_not_ready":return"The room is still being set up. Try again in a moment.";case"not_joinable":return"This visit is no longer open.";case"unavailable":return"No way to join this visit yet.";default:return"That did not open. Try again."}}var rs="No way to join this visit yet.";function ls(e){return e==="room_not_ready"||e==="unknown"}var is=/* @__PURE__ */Symbol.for("@everfur/sdk/televet");function os(){let e=globalThis,t=e[is];if(t!==void 0)return t;let n={presenter:null,snapshot:/* @__PURE__ */Object.freeze({request:null,serial:0,activeHost:null}),hosts:[],nextHost:1,listeners:/* @__PURE__ */new Set,dailyRegistered:false};return e[is]=n,n}function as(){return os().dailyRegistered}function ss(e){let t=null;return()=>{if(t!==null)return t;let n=e();return t=n,n.then(void 0,()=>{t===n&&(t=null)}),n}}var cs=/* @__PURE__ */Object.freeze({status:"joining"});function useTelevetJoin(t,n){let[r,l]=e.useState(0),[i,o]=e.useState(cs),a=e.useRef(null);e.useEffect(()=>{let e=n?.joinConsult;if(n===null||e===void 0){o(/* @__PURE__ */Object.freeze({status:"refused",refusal:"unavailable",reason:null}));return}let l=`${t}#${String(r)}`,i=a.current;if(i===null||i.key!==l){let r;try{r=e.call(n,t)}catch(e){r=Promise.reject(e)}i={key:l,promise:r},a.current=i}let s=true;return o(cs),i.promise.then(e=>{s&&(e.ok?o(/* @__PURE__ */Object.freeze({status:"ready",credential:e.value})):o(/* @__PURE__ */Object.freeze({status:"refused",refusal:vetCallJoinRefusal(e.error),reason:vetCallJoinReason(e.error)})))},()=>{s&&o(/* @__PURE__ */Object.freeze({status:"refused",refusal:"unknown",reason:null}))}),()=>{s=false}},[t,n,r]);let s=e.useCallback(()=>l(e=>e+1),[]);return{state:i,retry:s}}var ds=/* @__PURE__ */Symbol.for("@everfur/sdk/televet/recording-notice-receipt");function us(){let e=globalThis;return e[ds]??=/* @__PURE__ */new Map}function ps(e){let t=us();t.set(e,(t.get(e)??0)+1)}function hs(e){let t=us(),n=t.get(e)??0;n<=1?t.delete(e):t.set(e,n-1)}var fs=e.createContext(null);function ms(t){let n=e.useContext(fs);e.useEffect(()=>{if(!(n===null||!t))return n.setFullBleed(true),()=>{n.setFullBleed(false)}},[n,t])}var gs=ss(()=>Promise.resolve(a));function TelevetJoinScreen({consultId:e,...n}){let l=Bo(),i=bs();return i===null?/* @__PURE__ */r.jsx(t.View,{style:[l.screen,n.style],testID:"televet-join-checking"}):/* @__PURE__ */r.jsx(TelevetJoinGate,{consultId:e,...n,canHostCall:i},e)}function TelevetJoinGate({canHostCall:t,onLeave:n,style:l,...i}){let[o,a]=e.useState(false);ys(()=>(n(),true),!o);let s=e.useCallback(()=>{a(false),n()},[n]);return t?o?/* @__PURE__ */r.jsx(TelevetJoinRoom,{...i,onLeave:s,style:l}):/* @__PURE__ */r.jsx(TelevetRecordingNotice,{onContinue:()=>a(true),onLeave:n,style:l}):/* @__PURE__ */r.jsx(TelevetJoinUnavailable,{onLeave:n,style:l})}function TelevetJoinRoom({consultId:n,controller:l,clinicianName:i,petName:o,onLeave:a,style:s}){let c=Bo(),d=useTelevetBookingController(l),{state:u,retry:p}=useTelevetJoin(n,d),[h,f]=e.useState(null),[m,g]=e.useState(false),y=u.status==="ready";e.useEffect(()=>{if(!y||h!==null)return;let e=true;return gs().then(t=>{e&&f(()=>t)},()=>{e&&g(true)}),()=>{e=false}},[y,h]);let b=u.status==="ready"?u.credential.roomUrl:null,[v,x]=e.useState(null);e.useEffect(()=>{if(b!==null)return ps(b),x(b),()=>{hs(b)}},[b]);let T=y&&h!==null&&!m;ys(()=>(T||a(),true),true);let k=u.status==="ready"?u.credential:null;if(ms(T&&k!==null&&h.isUsableRoomCredential(k.roomUrl,k.token)&&h.loadEverfurDaily().available),u.status==="refused"||m){let e=u.status==="refused"?u.refusal:"unavailable";/* @__PURE__ */
|
|
255
255
|
return r.jsxs(t.View,{style:[c.screen,c.stepFill,s],testID:"televet-join-refused",children:[
|
|
256
256
|
/* @__PURE__ */r.jsx(TelevetFailureLine,{message:ns(e),testID:"televet-join-refused-message"}),ls(e)&&u.status==="refused"?/* @__PURE__ */r.jsx(TelevetButton,{label:ee.retryCta,kind:"primary",onPress:p,testID:"televet-join-retry"}):null,
|
|
257
257
|
/* @__PURE__ */r.jsx(TelevetButton,{label:ts.leaveCta,kind:"secondary",onPress:a,testID:"televet-join-leave"})]})}if(u.status==="joining"||h===null||v!==u.credential.roomUrl)/* @__PURE__ */
|
|
258
|
-
return r.jsx(TelevetRecordingNotice,{busy:true,onLeave:a,style:s});let{EverfurVetCall:
|
|
259
|
-
return r.jsx(
|
|
258
|
+
return r.jsx(TelevetRecordingNotice,{busy:true,onLeave:a,style:s});let{EverfurVetCall:w}=h;/* @__PURE__ */
|
|
259
|
+
return r.jsx(w,{roomUrl:u.credential.roomUrl,token:u.credential.token,onLeave:a,clinicianName:i??null,petName:o??null,consultMinutes:u.credential.callLimits?.consultMinutes??null,renderUnavailable:()=>/* @__PURE__ */r.jsx(TelevetJoinUnavailable,{onLeave:a,style:s}),style:s})}function TelevetRecordingNotice({onContinue:e,onLeave:n,busy:l=false,style:i}){let o=Bo();/* @__PURE__ */
|
|
260
260
|
return r.jsx(t.View,{style:[o.screen,o.stepFill,i],children:/* @__PURE__ */r.jsxs(t.View,{style:o.stateCard,testID:"everfur-vet-call-recording-notice",accessibilityState:{busy:l},children:[
|
|
261
261
|
/* @__PURE__ */r.jsx(Text,{style:o.stateTitle,accessibilityRole:"header",children:ts.recordingNoticeTitle}),
|
|
262
262
|
/* @__PURE__ */r.jsx(TelevetButton,{label:ts.recordingNoticeCta,kind:"primary",loading:l,onPress:()=>e?.(),testID:"everfur-vet-call-recording-continue"}),
|
|
263
263
|
/* @__PURE__ */r.jsx(TelevetButton,{label:ts.leaveCta,kind:"secondary",onPress:n,testID:"everfur-vet-call-recording-leave"})]})})}function TelevetJoinUnavailable({onLeave:e,style:n}){let l=Bo();/* @__PURE__ */
|
|
264
264
|
return r.jsxs(t.View,{style:[l.screen,l.stepFill,n],testID:"televet-join-call-unavailable",children:[
|
|
265
265
|
/* @__PURE__ */r.jsx(TelevetFailureLine,{message:rs}),
|
|
266
|
-
/* @__PURE__ */r.jsx(TelevetButton,{label:ts.leaveCta,kind:"secondary",onPress:e,testID:"televet-join-unavailable-leave"})]})}function ys(n,r){G(n,r);let l=e.useRef(n);l.current=n,e.useEffect(()=>{if(!r)return;let e=t.BackHandler.addEventListener("hardwareBackPress",()=>l.current());return()=>{e.remove()}},[r])}function bs(){let[t,n]=e.useState(()=>as()?null:false);return e.useEffect(()=>{let e=true;return gs().then(t=>{if(!e)return;let r=t.loadEverfurDaily();if(n(r.available),!r.available)try{globalThis.console?.warn?.(`${t.EVERFUR_DAILY_SETUP} (${r.reason})`)}catch{}},()=>{e&&n(false)}),()=>{e=false}},[]),t}function EverfurTelevetReschedule(n){let{consult:l,onRescheduled:i,onCancel:o,controller:a,style:s,testID:c}=
|
|
266
|
+
/* @__PURE__ */r.jsx(TelevetButton,{label:ts.leaveCta,kind:"secondary",onPress:e,testID:"televet-join-unavailable-leave"})]})}function ys(n,r){G(n,r);let l=e.useRef(n);l.current=n,e.useEffect(()=>{if(!r)return;let e=t.BackHandler.addEventListener("hardwareBackPress",()=>l.current());return()=>{e.remove()}},[r])}function bs(){let[t,n]=e.useState(()=>as()?null:false);return e.useEffect(()=>{let e=true;return gs().then(t=>{if(!e)return;let r=t.loadEverfurDaily();if(n(r.available),!r.available)try{globalThis.console?.warn?.(`${t.EVERFUR_DAILY_SETUP} (${r.reason})`)}catch{}},()=>{e&&n(false)}),()=>{e=false}},[]),t}function EverfurTelevetReschedule(n){let{consult:l,onRescheduled:i,onCancel:o,controller:a,style:s,testID:c}=U(n,["onRescheduled","onCancel"]),d=Bo(),u=useTelevetBookingController(a),p=useTelevetSlots(l?.clinicianId??null,u),h=useTelevetHoldSlot(u),f=useTelevetRescheduleConsult(l?.consultId??null,u),[m,g]=e.useState(null),[y,b]=e.useState(null),{pets:v}=useEverfurPets(),x=useEverfurTheme(),T=e.useMemo(()=>vs(x),[x]),k=e.useCallback(e=>{g(null),h.mutate(e.slotId,{onSuccess:()=>{f.mutate(e.slotId,{onSuccess:e=>i?.(e),onError:e=>g(televetBookingRefusal(e).kind==="unavailable"?"unavailable":"failed")})},onError:e=>g(televetBookingRefusal(e).kind==="unavailable"?"unavailable":"taken")})},[h,f,i]),w=h.isPending||f.isPending;return isTelevetBookingCopyReady()?l?
|
|
267
267
|
/* @__PURE__ */r.jsxs(t.View,{style:[d.screen,d.stepFill,s],testID:c??"televet-reschedule",children:[
|
|
268
268
|
/* @__PURE__ */r.jsxs(t.View,{style:T.bar,children:[
|
|
269
|
-
/* @__PURE__ */r.jsx(t.Pressable,{onPress:()=>o?.(),disabled:
|
|
269
|
+
/* @__PURE__ */r.jsx(t.Pressable,{onPress:()=>o?.(),disabled:w,accessibilityRole:"button",accessibilityLabel:ee.keepExistingCta,testID:"televet-reschedule-keep",style:T.ring,children:/* @__PURE__ */r.jsx(t.View,{style:T.chevron,accessibilityElementsHidden:true,importantForAccessibility:"no"})}),
|
|
270
270
|
/* @__PURE__ */r.jsx(Text,{tier:"compact",style:T.label,children:ee.rescheduleStepLabel})]}),
|
|
271
271
|
/* @__PURE__ */r.jsx(Text,{tier:"heading",style:d.stepTitle,accessibilityRole:"header",children:Z(ee.rescheduleTitleTemplate,{pet:Ia(v,l.petId)??ee.petFallback})}),
|
|
272
272
|
/* @__PURE__ */r.jsxs(t.View,{style:T.now,testID:"televet-reschedule-now",children:[
|
|
273
273
|
/* @__PURE__ */r.jsx(t.View,{style:T.nowPill,children:/* @__PURE__ */r.jsx(Text,{tier:"badge",style:T.nowPillText,children:ee.rescheduleNowLabel})}),
|
|
274
|
-
/* @__PURE__ */r.jsx(Text,{style:T.nowText,accessibilityLabel:Z(ee.rescheduleFromTemplate,{when:fi(l.scheduledAt)}),children:fi(l.scheduledAt)})]}),m==="taken"?/* @__PURE__ */r.jsx(TelevetFailureLine,{message:ee.slotTaken}):null,m==="failed"?/* @__PURE__ */r.jsx(TelevetFailureLine,{message:ee.rescheduleFailed}):null,m==="unavailable"?/* @__PURE__ */r.jsx(TelevetFailureLine,{message:ee.bookingPausedTitle,testID:"televet-reschedule-unavailable"}):null,p.enabled?p.isPending?/* @__PURE__ */r.jsx(t.View,{style:d.list,testID:"televet-reschedule-slots-loading",children:[0,1,2].map(e=>/* @__PURE__ */r.jsx(TelevetSkeletonBlock,{height:48},e))}):p.isError?/* @__PURE__ */r.jsx(TelevetStateCard,{title:ee.slotsErrorTitle,actionLabel:ee.retryCta,onAction:()=>p.refetch(),testID:"televet-reschedule-slots-error"}):(p.data??[]).length===0?/* @__PURE__ */r.jsx(t.View,{testID:"televet-reschedule-empty",children:/* @__PURE__ */r.jsx(TelevetStateCard,{title:ee.noSlotsTitle})}):/* @__PURE__ */r.jsx(TelevetSlotPicker,{slots:p.data??[],busySlotId:
|
|
274
|
+
/* @__PURE__ */r.jsx(Text,{style:T.nowText,accessibilityLabel:Z(ee.rescheduleFromTemplate,{when:fi(l.scheduledAt)}),children:fi(l.scheduledAt)})]}),m==="taken"?/* @__PURE__ */r.jsx(TelevetFailureLine,{message:ee.slotTaken}):null,m==="failed"?/* @__PURE__ */r.jsx(TelevetFailureLine,{message:ee.rescheduleFailed}):null,m==="unavailable"?/* @__PURE__ */r.jsx(TelevetFailureLine,{message:ee.bookingPausedTitle,testID:"televet-reschedule-unavailable"}):null,p.enabled?p.isPending?/* @__PURE__ */r.jsx(t.View,{style:d.list,testID:"televet-reschedule-slots-loading",children:[0,1,2].map(e=>/* @__PURE__ */r.jsx(TelevetSkeletonBlock,{height:48},e))}):p.isError?/* @__PURE__ */r.jsx(TelevetStateCard,{title:ee.slotsErrorTitle,actionLabel:ee.retryCta,onAction:()=>p.refetch(),testID:"televet-reschedule-slots-error"}):(p.data??[]).length===0?/* @__PURE__ */r.jsx(t.View,{testID:"televet-reschedule-empty",children:/* @__PURE__ */r.jsx(TelevetStateCard,{title:ee.noSlotsTitle})}):/* @__PURE__ */r.jsx(TelevetSlotPicker,{slots:p.data??[],busySlotId:w?h.variables:null,onPick:e=>{g(null),b(e)},selectedSlot:y,periodLabels:{morning:ee.timeMorning,afternoon:ee.timeAfternoon,evening:ee.timeEvening},rowTestIdPrefix:"televet-reschedule-slot",testID:"televet-reschedule-slots"}):/* @__PURE__ */r.jsx(t.View,{testID:"televet-reschedule-paused",children:/* @__PURE__ */r.jsx(TelevetStateCard,{title:ee.bookingPausedTitle})}),y?/* @__PURE__ */r.jsx(t.View,{style:d.scrollFooter,children:/* @__PURE__ */r.jsx(TelevetButton,{label:w?ee.rescheduleMoving:Z(ee.rescheduleMoveTemplate,{when:gi(y.startsAt)}),loading:w,onPress:()=>k(y),testID:"televet-reschedule-move"})}):null]}):/* @__PURE__ */r.jsx(t.View,{style:[d.screen,d.list,s],testID:"televet-reschedule-loading",children:[0,1].map(e=>/* @__PURE__ */r.jsx(TelevetSkeletonBlock,{height:48},e))}):/* @__PURE__ */r.jsx(t.View,{style:[d.screen,d.stepFill,s],testID:"televet-reschedule-copy-unapproved"})}function vs(e){let n=Lo(e);return t.StyleSheet.create({bar:{flexDirection:"row",alignItems:"center",gap:14,paddingVertical:e.space.sm},ring:{width:44,height:44,borderRadius:22,borderWidth:1.5,borderColor:n.line,alignItems:"center",justifyContent:"center"},chevron:{width:10,height:10,marginLeft:4,borderLeftWidth:2,borderBottomWidth:2,borderColor:n.ink,transform:[{rotate:"45deg"}]},label:{...face(e,"monoBold"),color:n.muted,fontSize:12,letterSpacing:.96,textTransform:"uppercase"},now:{flexDirection:"row",flexWrap:"wrap",alignItems:"center",gap:10},nowPill:{height:24,paddingHorizontal:10,borderRadius:999,borderWidth:1.5,borderColor:n.line,justifyContent:"center"},nowPillText:{...face(e,"monoBold"),color:n.muted,fontSize:11,letterSpacing:.9,textTransform:"uppercase"},nowText:{...face(e,"regular"),color:n.muted,fontSize:e.type.size.body,textDecorationLine:"line-through"}})}function TelevetVetMessagesCard({threads:e,pets:n,onOpen:l}){let i=Qa(),o=es();/* @__PURE__ */
|
|
275
275
|
return r.jsxs(t.View,{style:i.card,testID:"televet-messages-card",children:[
|
|
276
276
|
/* @__PURE__ */r.jsx(Text,{style:i.title,accessibilityRole:"header",children:$a.messagesTitle}),
|
|
277
|
-
/* @__PURE__ */r.jsx(t.View,{style:i.list,children:e.map((e,a)=>{let s=n.find(t=>t.petRef===e.petRef)?.name??null,c=e.lastMessage?.role==="vet"?e.lastMessage.senderName:null,d=
|
|
277
|
+
/* @__PURE__ */r.jsx(t.View,{style:i.list,children:e.map((e,a)=>{let s=n.find(t=>t.petRef===e.petRef)?.name??null,c=e.lastMessage?.role==="vet"?e.lastMessage.senderName:null,d=Ua(Ka(s)),u=e.lastMessage?xs(e.lastMessage):null,p=Ya(e.lastMessageAt),h=e.unreadCount>0;/* @__PURE__ */
|
|
278
278
|
return r.jsxs(t.Pressable,{onPress:()=>l({petRef:e.petRef,petName:s,vetName:c,ownerCanStart:e.ownerCanStart}),accessibilityRole:"button",accessibilityLabel:[d,u,p,h?$a.newPillNative:null].filter(Boolean).join(", "),style:[i.row,a===0?i.rowFirst:null,o.rowPress],testID:`televet-messages-row-${e.petRef}`,children:[
|
|
279
279
|
/* @__PURE__ */r.jsxs(t.View,{style:o.rowMain,children:[
|
|
280
280
|
/* @__PURE__ */r.jsx(Text,{style:i.when,children:d}),u?/* @__PURE__ */r.jsx(Text,{style:o.preview,numberOfLines:1,children:u}):null]}),
|
|
281
|
-
/* @__PURE__ */r.jsxs(t.View,{style:o.rowEnd,children:[p?/* @__PURE__ */r.jsx(Text,{style:i.meta,children:p}):null,h?/* @__PURE__ */r.jsx(t.View,{style:[i.pill,{marginLeft:0}],children:/* @__PURE__ */r.jsx(Text,{tier:"badge",style:i.pillText,children:$a.newPillNative})}):null]})]},e.petRef)})})]})}function xs(e){let t=e.content.split(`\n`)[0]?.trim()??"";return e.role==="owner"?Wa($a.previewOwnerTemplate,{text:t}):t}function TelevetVisitsScreen({controller:n,onOpenVisit:l,onBook:i,onBack:o,revision:a=0,onOpenThread:s,onOpenSummary:d,joinFirst:u,onJoinFirst:p,nowMs:h,style:f}){let m=Qa(),g=useTelevetBookingController(n),y=Wn(g,a),{pets:b}=useEverfurPets(),v=useVetThreads(g,a),x=v.availability==="lit",T=y.data??[],
|
|
281
|
+
/* @__PURE__ */r.jsxs(t.View,{style:o.rowEnd,children:[p?/* @__PURE__ */r.jsx(Text,{style:i.meta,children:p}):null,h?/* @__PURE__ */r.jsx(t.View,{style:[i.pill,{marginLeft:0}],children:/* @__PURE__ */r.jsx(Text,{tier:"badge",style:i.pillText,children:$a.newPillNative})}):null]})]},e.petRef)})})]})}function xs(e){let t=e.content.split(`\n`)[0]?.trim()??"";return e.role==="owner"?Wa($a.previewOwnerTemplate,{text:t}):t}function TelevetVisitsScreen({controller:n,onOpenVisit:l,onBook:i,onBack:o,revision:a=0,onOpenThread:s,onOpenSummary:d,joinFirst:u,onJoinFirst:p,nowMs:h,style:f}){let m=Qa(),g=useTelevetBookingController(n),y=Wn(g,a),{pets:b}=useEverfurPets(),v=useVetThreads(g,a),x=v.availability==="lit",T=y.data??[],k=T.some(e=>!c.has(e.status)),w=Na(k),S=h??w,{upcoming:j,past:C}=e.useMemo(()=>splitTelevetVisits(T,S),[T,S]),_=y.enabled&&y.isPending,I=y.isError&&y.data===null,E=e.useRef(u??null),D=y.enabled&&!_&&!I;e.useEffect(()=>{let e=E.current;if(e===null||!p||!D)return;E.current=null;let t=j.find(t=>t.consultId===e)??null;p(t,t?Ia(b,t.petId):null)},[D,j,b,p]);let P=e=>{let t=Ia(b,e.petId),n=e.clinicianName;return t&&n?Z(Ga.visitTitleTemplate,{pet:t,vet:n}):t??n},R=(e,n)=>{let i=Ja(e.status),o=P(e);return e.status==="completed"&&x&&d?/* @__PURE__ */r.jsxs(t.Pressable,{onPress:()=>d(e),accessibilityRole:"button",accessibilityLabel:[o??si(e.scheduledAt),i].filter(Boolean).join(", "),style:[m.row,n===0?m.rowFirst:null],testID:`televet-visits-summary-${e.consultId}`,children:[
|
|
282
282
|
/* @__PURE__ */r.jsxs(t.View,{style:m.rowHead,children:[
|
|
283
283
|
/* @__PURE__ */r.jsx(Text,{style:m.when,children:o??si(e.scheduledAt)}),i?/* @__PURE__ */r.jsx(Text,{style:m.status,children:i}):null]}),o?/* @__PURE__ */r.jsx(Text,{style:m.meta,children:si(e.scheduledAt)}):null]},e.consultId):/* @__PURE__ */r.jsxs(t.View,{style:[m.row,n===0?m.rowFirst:null],testID:`televet-visits-row-${e.consultId}`,children:[
|
|
284
284
|
/* @__PURE__ */r.jsxs(t.View,{style:m.rowHead,children:[
|
|
@@ -308,22 +308,21 @@ return r.jsxs(t.View,{style:[m.screen,f],testID:"televet-visits",children:[
|
|
|
308
308
|
return r.jsxs(t.View,{style:l.bookCard,testID:"televet-visits-book-card",children:[
|
|
309
309
|
/* @__PURE__ */r.jsx(Text,{style:l.bookTitle,children:e}),
|
|
310
310
|
/* @__PURE__ */r.jsx(Text,{style:l.bookSubtitle,children:Ga.bookCardSubtitle}),
|
|
311
|
-
/* @__PURE__ */r.jsx(TelevetButton,{label:Ga.bookCta,kind:"primary",onPress:n,testID:"televet-visits-book"})]})}var Ts=48,
|
|
311
|
+
/* @__PURE__ */r.jsx(TelevetButton,{label:Ga.bookCta,kind:"primary",onPress:n,testID:"televet-visits-book"})]})}var Ts=48,ks=/* @__PURE__ */Object.freeze({flex:1,minHeight:0});function TelevetVetThreadScreen({petRef:petRef,petName:n,vetName:l,ownerCanStart:i,controller:o,onBack:a,style:s}){let c=Qa(),d=es(),u=useTelevetBookingController(o),p=useVetThread(u,petRef,{ownerCanStart:i}),[h,f]=e.useState(""),m=e.useRef(null),g=t.Platform.OS==="ios",y=ha(void 0,g),b=l?.trim()||ws(p.messages),v=qa(b),x=p.messages[p.messages.length-1]?.messageId;e.useEffect(()=>{p.status==="ready"&&m.current?.scrollToEnd?.({animated:false})},[p.status,x]);let T=()=>{let e=h;e.trim().length===0||p.sending||p.send(e).then(e=>{e&&f("")})},k=h.trim().length>0&&!p.sending;/* @__PURE__ */
|
|
312
312
|
return r.jsxs(t.View,{style:[c.screen,s],testID:"televet-vet-thread",children:[
|
|
313
313
|
/* @__PURE__ */r.jsx(TelevetVisitBackRow,{onBack:a,testID:"televet-vet-thread-back"}),
|
|
314
314
|
/* @__PURE__ */r.jsxs(t.View,{style:d.head,children:[
|
|
315
|
-
/* @__PURE__ */r.jsx(Text,{style:d.screenTitle,accessibilityRole:"header",children:
|
|
316
|
-
/* @__PURE__ */r.jsxs(t.KeyboardAvoidingView,{behavior:g?"padding":void 0,style:
|
|
315
|
+
/* @__PURE__ */r.jsx(Text,{style:d.screenTitle,accessibilityRole:"header",children:Ua(Ka(n))}),b?/* @__PURE__ */r.jsx(Text,{style:d.meta,children:Wa($a.threadMetaTemplateNative,{vet:b})}):null]}),
|
|
316
|
+
/* @__PURE__ */r.jsxs(t.KeyboardAvoidingView,{behavior:g?"padding":void 0,style:ks,...y.avoidingProps,children:[
|
|
317
317
|
/* @__PURE__ */r.jsx(KeyboardOffsetProbe,{probeRef:y.probeRef}),p.status==="loading"?/* @__PURE__ */r.jsxs(t.View,{style:c.stack,testID:"televet-vet-thread-loading",accessibilityLabel:$a.loading,children:[
|
|
318
318
|
/* @__PURE__ */r.jsx(TelevetSkeletonBlock,{height:56}),
|
|
319
319
|
/* @__PURE__ */r.jsx(TelevetSkeletonBlock,{height:56})]}):p.status==="error"?/* @__PURE__ */r.jsx(TelevetStateCard,{title:$a.loadFailed,actionLabel:$a.retry,onAction:p.retry,testID:"televet-vet-thread-error"}):/* @__PURE__ */r.jsxs(t.ScrollView,{ref:m,accessibilityLabel:Wa($a.threadLogTemplate,{vet:v}),contentContainerStyle:d.log,scrollEventThrottle:64,keyboardShouldPersistTaps:"handled",keyboardDismissMode:g?"interactive":"on-drag",onScroll:e=>{e.nativeEvent.contentOffset.y<=Ts&&p.loadOlder()},testID:"televet-vet-thread-log",children:[p.messages.length===0?/* @__PURE__ */r.jsx(Text,{style:d.system,children:$a.empty}):null,p.messages.map((e,t)=>/* @__PURE__ */r.jsx(ThreadItem,{message:e,previous:p.messages[t-1],vet:v,styles:d},e.messageId))]}),p.status==="ready"&&p.canWrite?/* @__PURE__ */r.jsxs(t.View,{style:c.stack,children:[
|
|
320
320
|
/* @__PURE__ */r.jsxs(t.View,{style:d.composer,children:[
|
|
321
|
-
/* @__PURE__ */r.jsx(Cr,{value:h,onChangeText:f,multiline:true,accessibilityLabel:
|
|
322
|
-
/* @__PURE__ */r.jsx(t.Pressable,{onPress:T,disabled:!
|
|
323
|
-
/* @__PURE__ */r.jsx(Text,{style:d.note,children:qa(Wa($a.composerNoteTemplate,{vet:v}))})]}):null,p.sendFailure==="vetWritesFirst"?/* @__PURE__ */r.jsx(Text,{style:d.note,accessibilityLiveRegion:"polite",testID:"televet-vet-thread-vet-first",children:$a.vetWritesFirst}):null]})]})}function ThreadItem({message:e,previous:n,vet:l,styles:i}){let o=ii(e.createdAt),a=n===void 0||ii(n.createdAt)!==o,s=e.attachmentCount>0?Wa($a.attachmentsTemplate,{n:String(e.attachmentCount)}):null;/* @__PURE__ */
|
|
321
|
+
/* @__PURE__ */r.jsx(Cr,{value:h,onChangeText:f,multiline:true,accessibilityLabel:Ua(Wa($a.composerLabelTemplateNative,{vet:v})),placeholder:Wa($a.composerPlaceholderTemplate,{vet:v}),style:d.field,testID:"televet-vet-thread-field"}),
|
|
322
|
+
/* @__PURE__ */r.jsx(t.Pressable,{onPress:T,disabled:!k,accessibilityRole:"button",accessibilityLabel:$a.send,accessibilityState:{disabled:!k,busy:p.sending},style:[d.send,k?null:d.sendDisabled],testID:"televet-vet-thread-send",children:/* @__PURE__ */r.jsx(Text,{tier:"control",style:d.sendLabel,children:$a.send})})]}),p.sendFailure==="notSent"?/* @__PURE__ */r.jsx(Text,{style:d.failure,accessibilityLiveRegion:"assertive",testID:"televet-vet-thread-failure",children:$a.notSent}):p.sentCount>0?/* @__PURE__ */r.jsx(Text,{style:d.note,accessibilityLiveRegion:"polite",testID:"televet-vet-thread-status",children:$a.sent}):null]}):null,p.sendFailure==="vetWritesFirst"?/* @__PURE__ */r.jsx(Text,{style:d.note,accessibilityLiveRegion:"polite",testID:"televet-vet-thread-vet-first",children:$a.vetWritesFirst}):null]})]})}function ThreadItem({message:e,previous:n,vet:l,styles:i}){let o=ii(e.createdAt),a=n===void 0||ii(n.createdAt)!==o,s=e.attachmentCount>0?Wa($a.attachmentsTemplate,{n:String(e.attachmentCount)}):null;/* @__PURE__ */
|
|
324
323
|
return r.jsxs(r.Fragment,{children:[a?/* @__PURE__ */r.jsx(Text,{style:i.day,children:o}):null,e.role==="system"?/* @__PURE__ */r.jsx(Text,{style:i.system,children:e.content}):/* @__PURE__ */r.jsxs(t.View,{style:[i.item,e.role==="owner"?i.itemMine:null],testID:`televet-vet-thread-message-${e.messageId}`,children:[e.role==="vet"?/* @__PURE__ */r.jsxs(t.View,{style:i.whoRow,children:[
|
|
325
|
-
/* @__PURE__ */r.jsx(Text,{style:i.who,children:e.senderName??
|
|
326
|
-
/* @__PURE__ */r.jsx(Text,{style:i.time,children:ri(e.createdAt)})]}):null,e.content.length>0?/* @__PURE__ */r.jsx(Text,{style:e.role==="owner"?i.bubbleMine:i.bubbleVet,children:e.content}):null,s?/* @__PURE__ */r.jsx(Text,{style:i.attachments,children:s}):null]})]})}function
|
|
324
|
+
/* @__PURE__ */r.jsx(Text,{style:i.who,children:e.senderName??Ua(l)}),
|
|
325
|
+
/* @__PURE__ */r.jsx(Text,{style:i.time,children:ri(e.createdAt)})]}):null,e.content.length>0?/* @__PURE__ */r.jsx(Text,{style:e.role==="owner"?i.bubbleMine:i.bubbleVet,children:e.content}):null,s?/* @__PURE__ */r.jsx(Text,{style:i.attachments,children:s}):null]})]})}function ws(e){for(let t=e.length-1;t>=0;t-=1){let n=e[t]?.role==="vet"?e[t]?.senderName:null;if(n)return n}return null}function TelevetVisitSummaryScreen({consult:e,controller:n,onBack:l,onMessageVet:i,onBook:o,style:a}){let s=Qa(),c=es(),d=useTelevetBookingController(n),u=useVisitSummary(d,e.consultId),{pets:p}=useEverfurPets(),h=Ia(p,e.petId),f=u.summary,m=f?.approvedByName??e.clinicianName,g=qa(m),y=h&&e.clinicianName?Wa(Ga.visitTitleTemplate,{pet:h,vet:e.clinicianName}):Ua(Ka(h)),b=[li(e.scheduledAt),m].filter(Boolean).join(" · "),v=vetThreadPetRef(p,e.petId),x=i&&v!==null?()=>i({petRef:v,petName:h,vetName:m??null}):void 0;/* @__PURE__ */
|
|
327
326
|
return r.jsxs(t.View,{style:[s.screen,a],testID:"televet-visit-summary",children:[
|
|
328
327
|
/* @__PURE__ */r.jsx(TelevetVisitBackRow,{onBack:l,testID:"televet-visit-summary-back"}),
|
|
329
328
|
/* @__PURE__ */r.jsxs(t.ScrollView,{contentContainerStyle:s.body,children:[
|
|
@@ -331,21 +330,21 @@ return r.jsxs(t.View,{style:[s.screen,a],testID:"televet-visit-summary",children
|
|
|
331
330
|
/* @__PURE__ */r.jsx(Text,{style:c.screenTitle,accessibilityRole:"header",children:y}),b?/* @__PURE__ */r.jsx(Text,{style:c.meta,children:b}):null]}),u.status==="loading"?/* @__PURE__ */r.jsxs(t.View,{style:s.stack,testID:"televet-visit-summary-loading",accessibilityLabel:$a.loading,children:[
|
|
332
331
|
/* @__PURE__ */r.jsx(TelevetSkeletonBlock,{height:96}),
|
|
333
332
|
/* @__PURE__ */r.jsx(TelevetSkeletonBlock,{height:96})]}):u.status==="absent"?null:u.status==="pending"?/* @__PURE__ */r.jsx(TelevetStateCard,{title:$a.summaryPending,testID:"televet-visit-summary-pending"}):u.status==="error"||f===null?/* @__PURE__ */r.jsx(TelevetStateCard,{title:$a.loadFailed,actionLabel:$a.retry,onAction:u.retry,testID:"televet-visit-summary-error"}):/* @__PURE__ */r.jsxs(r.Fragment,{children:[f.findingsText.trim().length>0?/* @__PURE__ */r.jsxs(t.View,{style:s.card,children:[
|
|
334
|
-
/* @__PURE__ */r.jsx(Text,{style:s.title,accessibilityRole:"header",children:
|
|
333
|
+
/* @__PURE__ */r.jsx(Text,{style:s.title,accessibilityRole:"header",children:Ua(Wa($a.sawTitleTemplate,{vet:g}))}),
|
|
335
334
|
/* @__PURE__ */r.jsxs(t.View,{style:s.cardHead,children:[
|
|
336
335
|
/* @__PURE__ */r.jsx(Text,{style:c.label,children:$a.summaryLabel}),
|
|
337
|
-
/* @__PURE__ */r.jsx(t.View,{style:[s.pill,s.pillLine],children:/* @__PURE__ */r.jsx(Text,{tier:"badge",style:[s.pillText,s.pillLineText],children:
|
|
336
|
+
/* @__PURE__ */r.jsx(t.View,{style:[s.pill,s.pillLine],children:/* @__PURE__ */r.jsx(Text,{tier:"badge",style:[s.pillText,s.pillLineText],children:Ua(Wa($a.fromVetTemplate,{vet:g}))})})]}),
|
|
338
337
|
/* @__PURE__ */r.jsx(Text,{style:c.body,children:f.findingsText})]}):null,f.nextStepsText.trim().length>0||f.actionItems.length>0?/* @__PURE__ */r.jsxs(t.View,{style:s.card,testID:"televet-visit-summary-plan",children:[
|
|
339
338
|
/* @__PURE__ */r.jsxs(t.View,{style:s.cardHead,children:[
|
|
340
|
-
/* @__PURE__ */r.jsx(Text,{style:s.title,accessibilityRole:"header",children:
|
|
339
|
+
/* @__PURE__ */r.jsx(Text,{style:s.title,accessibilityRole:"header",children:Ua(Wa($a.planTitleTemplate,{pet:Ka(h)}))}),
|
|
341
340
|
/* @__PURE__ */r.jsx(t.View,{style:s.pill,children:/* @__PURE__ */r.jsx(Text,{tier:"badge",style:s.pillText,children:$a.wordForWord})})]}),f.nextStepsText.trim().length>0?/* @__PURE__ */r.jsx(Text,{style:c.body,children:f.nextStepsText}):null,f.actionItems.map((e,n)=>/* @__PURE__ */r.jsxs(t.View,{style:c.planItem,children:[
|
|
342
341
|
/* @__PURE__ */r.jsx(Text,{style:c.planNumber,children:String(n+1).padStart(2,"0")}),
|
|
343
342
|
/* @__PURE__ */r.jsx(Text,{style:c.planText,children:`“${e}”`})]},`${String(n)}-${e}`))]}):null,f.medications.length>0?/* @__PURE__ */r.jsxs(t.View,{style:s.card,testID:"televet-visit-summary-medications",children:[
|
|
344
343
|
/* @__PURE__ */r.jsx(Text,{style:s.title,accessibilityRole:"header",children:$a.fromThisVisitTitle}),f.medications.map((e,n)=>/* @__PURE__ */r.jsxs(t.View,{style:[s.row,n===0?s.rowFirst:null],children:[
|
|
345
|
-
/* @__PURE__ */r.jsx(Text,{style:s.when,children:[e.drug,e.strength].filter(Boolean).join(" ")}),e.sig?/* @__PURE__ */r.jsx(Text,{style:s.meta,children:e.sig}):null]},`${String(n)}-${e.drug}`))]}):null,m||x?/* @__PURE__ */r.jsxs(t.View,{style:s.card,testID:"televet-visit-summary-vet",children:[m?/* @__PURE__ */r.jsx(Text,{style:s.title,children:m}):null,f.credentialsText?/* @__PURE__ */r.jsx(Text,{style:s.meta,children:f.credentialsText}):null,x?/* @__PURE__ */r.jsx(TelevetButton,{label:
|
|
344
|
+
/* @__PURE__ */r.jsx(Text,{style:s.when,children:[e.drug,e.strength].filter(Boolean).join(" ")}),e.sig?/* @__PURE__ */r.jsx(Text,{style:s.meta,children:e.sig}):null]},`${String(n)}-${e.drug}`))]}):null,m||x?/* @__PURE__ */r.jsxs(t.View,{style:s.card,testID:"televet-visit-summary-vet",children:[m?/* @__PURE__ */r.jsx(Text,{style:s.title,children:m}):null,f.credentialsText?/* @__PURE__ */r.jsx(Text,{style:s.meta,children:f.credentialsText}):null,x?/* @__PURE__ */r.jsx(TelevetButton,{label:Ua(Wa($a.messageVetTemplate,{vet:g})),kind:"secondary",fullWidth:false,onPress:x,testID:"televet-visit-summary-message"}):null]}):null,o?/* @__PURE__ */r.jsx(TelevetButton,{label:$a.bookFollowUp,onPress:o,testID:"televet-visit-summary-book"}):null,
|
|
346
345
|
/* @__PURE__ */r.jsx(Text,{style:s.footnote,testID:"televet-visit-summary-footnote",children:Wa($a.summaryFootnoteTemplate,{vet:g})})]})]})]})}var Ss=/* @__PURE__ */Object.freeze({name:"home"}),js=/* @__PURE__ */Object.freeze({name:"visits"}),Cs=/* @__PURE__ */Object.freeze({name:"booking"});function televetScreenForRequest(e){let t=e.consultId?.trim()??"";if(t.length>0)/* @__PURE__ */return Object.freeze({name:"join",consultId:t});let n=e.visitRef?.trim()??"";return n.length>0?/* @__PURE__ */Object.freeze({name:"visit",visitRef:n,intent:e.intent??null}):Ss}function _s(e,t){switch(t.type){case"push":/* @__PURE__ */
|
|
347
|
-
return Object.freeze({stack:/* @__PURE__ */Object.freeze([...e.stack,t.screen])});case"pop":return e.stack.length<=1?e:/* @__PURE__ */Object.freeze({stack:/* @__PURE__ */Object.freeze(e.stack.slice(0,-1))});case"land":return e.stack[0]?.name!=="home"?e:/* @__PURE__ */Object.freeze({stack:/* @__PURE__ */Object.freeze([t.screen,...e.stack.slice(1)])});default:return e}}function EverfurTelevetFlow(e){let{style:t,renderPending:n,...l}=
|
|
348
|
-
return r.jsx(CapabilityGate,{capability:"televet",style:t,...n?{renderPending:n}:{},children:/* @__PURE__ */r.jsx(TelevetFlowBody,{...l,style:t})})}function TelevetFlowBody({petRef:petRef,usState:n,controller:l,onBooked:i,onExit:o,onAddPet:a,onPickMedia:s,onAddToCalendar:c,onConfirmDiscard:d,onRequestLocation:u,locationStatus:p,primaryVet:h,onFindEmergencyVet:f,onTriageReason:m,canJoinInApp:g=false,renderUnavailable:y,initialScreen:b,bookingVariant:v,quickBooking:x,style:T}){let
|
|
346
|
+
return Object.freeze({stack:/* @__PURE__ */Object.freeze([...e.stack,t.screen])});case"pop":return e.stack.length<=1?e:/* @__PURE__ */Object.freeze({stack:/* @__PURE__ */Object.freeze(e.stack.slice(0,-1))});case"land":return e.stack[0]?.name!=="home"?e:/* @__PURE__ */Object.freeze({stack:/* @__PURE__ */Object.freeze([t.screen,...e.stack.slice(1)])});default:return e}}function EverfurTelevetFlow(e){let{style:t,renderPending:n,...l}=U(e,["onExit","onBooked","onAddPet","onRequestLocation","onFindEmergencyVet"]);/* @__PURE__ */
|
|
347
|
+
return r.jsx(CapabilityGate,{capability:"televet",style:t,...n?{renderPending:n}:{},children:/* @__PURE__ */r.jsx(TelevetFlowBody,{...l,style:t})})}function TelevetFlowBody({petRef:petRef,usState:n,controller:l,onBooked:i,onExit:o,onAddPet:a,onPickMedia:s,onAddToCalendar:c,onConfirmDiscard:d,onRequestLocation:u,locationStatus:p,primaryVet:h,onFindEmergencyVet:f,onTriageReason:m,canJoinInApp:g=false,renderUnavailable:y,initialScreen:b,bookingVariant:v,quickBooking:x,style:T}){let k=Bo(),[w,S]=e.useReducer(_s,b??Ss,e=>/* @__PURE__ */Object.freeze({stack:/* @__PURE__ */Object.freeze([e])})),[j,C]=e.useState(()=>b?.name==="join"?b.consultId:null),_=w.stack[w.stack.length-1]??Ss,I=w.stack.length,[E,D]=e.useState(0),P=e.useCallback(()=>D(e=>e+1),[]),R=e.useCallback(()=>I<=1||_.name==="call"||_.name==="booking"?false:(S({type:"pop"}),true),[I,_.name]);e.useEffect(()=>{let e=t.BackHandler.addEventListener("hardwareBackPress",R);return()=>{e.remove()}},[R]),G(R);let z=e.useCallback(()=>y?y():/* @__PURE__ */r.jsx(t.View,{style:k.list,testID:"televet-unavailable",children:isTelevetBookingCopyReady()?/* @__PURE__ */r.jsx(TelevetStateCard,{title:ee.bookingPausedTitle}):null}),[y,k.list]),F=e.useCallback(()=>{I>1?S({type:"pop"}):o?.()},[I,o]),L=e=>S({type:"push",screen:e}),A=e.useCallback(e=>S({type:"land",screen:e==="visits"?js:Cs}),[]),O=/* @__PURE__ */r.jsx(EverfurTelevetBooking,{...petRef!==void 0?{petRef:petRef}:{},...n!==void 0?{usState:n}:{},...l?{controller:l}:{},onBooked:e=>{P(),i?.(e)},onExit:F,...a?{onAddPet:a}:{},...s?{onPickMedia:s}:{},...c?{onAddToCalendar:c}:{},...d?{onConfirmDiscard:d}:{},...u?{onRequestLocation:u}:{},...p?{locationStatus:p}:{},...h?{primaryVet:h}:{},...f?{onFindEmergencyVet:f}:{},...m?{onTriageReason:m}:{},canJoinInApp:g,renderUnavailable:z,...v?{variant:v}:{},...x?{quick:x}:{},style:T}),V=/* @__PURE__ */r.jsx(TelevetVisitsScreen,{...l?{controller:l}:{},revision:E,onOpenVisit:e=>L({name:"consult",consult:e}),onBook:()=>L({name:"booking"}),onBack:F,onOpenThread:e=>L({name:"thread",target:e}),onOpenSummary:e=>L({name:"summary",consult:e}),...j!==null?{joinFirst:j,onJoinFirst:(e,t)=>{C(null),e!==null&&(televetJoinDecision(e,Date.now()).joinable?L({name:"call",consultId:e.consultId,clinicianName:e.clinicianName,petName:t}):L({name:"consult",consult:e}))}}:{},style:T});switch(_.name){case"home":/* @__PURE__ */
|
|
349
348
|
return r.jsx(TelevetLandingScreen,{controller:l,onLand:A,style:T});case"booking":return O;case"visits":case"visit":case"join":return V;case"consult":/* @__PURE__ */
|
|
350
349
|
return r.jsx(TelevetConsultScreen,{consult:_.consult,...l?{controller:l}:{},revision:E,onJoin:(e,t)=>L({name:"call",consultId:e.consultId,clinicianName:e.clinicianName,petName:t}),onReschedule:e=>L({name:"reschedule",consult:e}),onCancelled:P,onBack:F,onMessageVet:e=>L({name:"thread",target:e}),style:T});case"reschedule":/* @__PURE__ */
|
|
351
350
|
return r.jsx(EverfurTelevetReschedule,{consult:_.consult,...l?{controller:l}:{},onRescheduled:()=>{P(),S({type:"pop"})},onCancel:()=>S({type:"pop"}),style:T});case"call":/* @__PURE__ */
|
|
@@ -353,7 +352,7 @@ return r.jsx(TelevetJoinScreen,{consultId:_.consultId,...l?{controller:l}:{},...
|
|
|
353
352
|
return r.jsx(TelevetVetThreadScreen,{petRef:_.target.petRef,petName:_.target.petName,vetName:_.target.vetName,..._.target.ownerCanStart!==void 0?{ownerCanStart:_.target.ownerCanStart}:{},...l?{controller:l}:{},onBack:()=>{P(),F()},style:T});case"summary":/* @__PURE__ */
|
|
354
353
|
return r.jsx(TelevetVisitSummaryScreen,{consult:_.consult,...l?{controller:l}:{},onBack:F,onMessageVet:e=>L({name:"thread",target:e}),onBook:()=>L({name:"booking"}),style:T});default:return assertNever(_)}}function TelevetLandingScreen({controller:n,onLand:l,style:i}){let o=Bo(),a=useTelevetBookingController(n),s=Yn(a);return e.useEffect(()=>{s!=="pending"&&l(s)},[s,l]),/* @__PURE__ */r.jsxs(t.View,{style:[o.screen,o.list,i],testID:"televet-landing-loading",children:[
|
|
355
354
|
/* @__PURE__ */r.jsx(TelevetSkeletonBlock,{height:72}),
|
|
356
|
-
/* @__PURE__ */r.jsx(TelevetSkeletonBlock,{height:72})]})}var Is=EverfurTelevetFlow;function EverfurTelevetModal({request:n,onClose:l,onAddToCalendar:o,onPickMedia:a,primaryVet:s,onFindEmergencyVet:c}){let d=useEverfurTheme(),u=i.useSafeAreaInsets(),p=e.useMemo(()=>K(),[]),h=e.useCallback(()=>{p.dispatch()||l()},[p,l]),[f,m]=e.useState(false),g=e.useMemo(()=>({setFullBleed:m}),[]),y=e.useMemo(()=>televetScreenForRequest(n),[n]),b=f||So([d.color.surface])===
|
|
355
|
+
/* @__PURE__ */r.jsx(TelevetSkeletonBlock,{height:72})]})}var Is=EverfurTelevetFlow;function EverfurTelevetModal({request:n,onClose:l,onAddToCalendar:o,onPickMedia:a,primaryVet:s,onFindEmergencyVet:c}){let d=useEverfurTheme(),u=i.useSafeAreaInsets(),p=e.useMemo(()=>K(),[]),h=e.useCallback(()=>{p.dispatch()||l()},[p,l]),[f,m]=e.useState(false),g=e.useMemo(()=>({setFullBleed:m}),[]),y=e.useMemo(()=>televetScreenForRequest(n),[n]),b=f||So([d.color.surface])===ko;/* @__PURE__ */
|
|
357
356
|
return r.jsxs(t.Modal,{visible:true,animationType:d.motion.reducedMotion?"none":"slide",presentationStyle:"fullScreen",onRequestClose:h,children:[
|
|
358
357
|
/* @__PURE__ */r.jsx(t.StatusBar,{barStyle:b?"light-content":"dark-content",animated:true}),
|
|
359
|
-
/* @__PURE__ */r.jsx(t.View,{testID:"everfur-televet-modal",style:[Es.root,{backgroundColor:d.color.surface},f?null:{paddingTop:u.top,paddingBottom:u.bottom}],children:/* @__PURE__ */r.jsx(Y.Provider,{value:p,children:/* @__PURE__ */r.jsx(fs.Provider,{value:g,children:/* @__PURE__ */r.jsx(Is,{...n.petRef!==void 0?{petRef:n.petRef}:{},...n.usState!==void 0?{usState:n.usState}:{},initialScreen:y,onExit:l,...o?{onAddToCalendar:o}:{},...a?{onPickMedia:a}:{},...s?{primaryVet:s}:{},...c?{onFindEmergencyVet:c}:{},canJoinInApp:as(),style:Es.root})})})})]})}var Es=t.StyleSheet.create({root:{flex:1}});function useUpcomingTelevetVisit(t){let n=useTelevetBookingController(),r=t?.enabled!==false&&n!==null,l=Wn(r?n:null);return e.useMemo(()=>r?{upcoming:l.data===null?null:splitTelevetVisits(l.data,Date.now()).upcoming[0]??null,isPending:l.isPending}:{upcoming:null,isPending:false},[r,l.data,l.isPending])}exports.BACK_LABEL=Xo;exports.CANCELLATION_POLICY_VERSION_MAX=m;exports.CANCEL_REASON_MAX=F;exports.CONSULT_KINDS=p;exports.CONSULT_MINUTES=oi;exports.CONSULT_STATUSES=s;exports.EverfurTelevet=Is;exports.EverfurTelevetBooking=EverfurTelevetBooking;exports.EverfurTelevetFlow=EverfurTelevetFlow;exports.EverfurTelevetModal=EverfurTelevetModal;exports.EverfurTelevetReschedule=EverfurTelevetReschedule;exports.MEDIA_REFS_MAX=y;exports.NO_MEDIA_SHORTFALL=Di;exports.REASON_TEXT_MAX=g;exports.TELEVET_BOOKING_BASE=Zt;exports.TELEVET_BOOKING_COPY=ee;exports.TELEVET_BOOKING_STEPS=
|
|
358
|
+
/* @__PURE__ */r.jsx(t.View,{testID:"everfur-televet-modal",style:[Es.root,{backgroundColor:d.color.surface},f?null:{paddingTop:u.top,paddingBottom:u.bottom}],children:/* @__PURE__ */r.jsx(Y.Provider,{value:p,children:/* @__PURE__ */r.jsx(fs.Provider,{value:g,children:/* @__PURE__ */r.jsx(Is,{...n.petRef!==void 0?{petRef:n.petRef}:{},...n.usState!==void 0?{usState:n.usState}:{},initialScreen:y,onExit:l,...o?{onAddToCalendar:o}:{},...a?{onPickMedia:a}:{},...s?{primaryVet:s}:{},...c?{onFindEmergencyVet:c}:{},canJoinInApp:as(),style:Es.root})})})})]})}var Es=t.StyleSheet.create({root:{flex:1}});function useUpcomingTelevetVisit(t){let n=useTelevetBookingController(),r=t?.enabled!==false&&n!==null,l=Wn(r?n:null);return e.useMemo(()=>r?{upcoming:l.data===null?null:splitTelevetVisits(l.data,Date.now()).upcoming[0]??null,isPending:l.isPending}:{upcoming:null,isPending:false},[r,l.data,l.isPending])}exports.BACK_LABEL=Xo;exports.CANCELLATION_POLICY_VERSION_MAX=m;exports.CANCEL_REASON_MAX=F;exports.CONSULT_KINDS=p;exports.CONSULT_MINUTES=oi;exports.CONSULT_STATUSES=s;exports.EverfurTelevet=Is;exports.EverfurTelevetBooking=EverfurTelevetBooking;exports.EverfurTelevetFlow=EverfurTelevetFlow;exports.EverfurTelevetModal=EverfurTelevetModal;exports.EverfurTelevetReschedule=EverfurTelevetReschedule;exports.MEDIA_REFS_MAX=y;exports.NO_MEDIA_SHORTFALL=Di;exports.REASON_TEXT_MAX=g;exports.TELEVET_BOOKING_BASE=Zt;exports.TELEVET_BOOKING_COPY=ee;exports.TELEVET_BOOKING_STEPS=ql;exports.TELEVET_CONSULT_PAGE_LIMIT=dn;exports.TELEVET_JOIN_CLOSES_MINUTES_AFTER=O;exports.TELEVET_JOIN_OPENS_MINUTES_BEFORE=A;exports.TELEVET_MESSAGE_THREADS_PATH=Dt;exports.TERMINAL_CONSULT_STATUSES=c;exports.TelevetBookedScreen=TelevetBookedScreen;exports.TelevetBookingChrome=TelevetBookingChrome;exports.TelevetClinicianEmptyState=TelevetClinicianEmptyState;exports.TelevetConsentCheckbox=TelevetConsentCheckbox;exports.TelevetConsultScreen=TelevetConsultScreen;exports.TelevetDayStrip=TelevetDayStrip;exports.TelevetEarlyEmergency=TelevetEarlyEmergency;exports.TelevetEmergencyExits=TelevetEmergencyExits;exports.TelevetEntitlementInterestState=TelevetEntitlementInterestState;exports.TelevetIntakeMedia=TelevetIntakeMedia;exports.TelevetJoinScreen=TelevetJoinScreen;exports.TelevetMediaDropNotice=TelevetMediaDropNotice;exports.TelevetSlotPicker=TelevetSlotPicker;exports.TelevetStateInterestAction=TelevetStateInterestAction;exports.TelevetSummaryCard=TelevetSummaryCard;exports.TelevetSummaryRow=TelevetSummaryRow;exports.TelevetVetThreadScreen=TelevetVetThreadScreen;exports.TelevetVisitSummaryScreen=TelevetVisitSummaryScreen;exports.TelevetVisitsScreen=TelevetVisitsScreen;exports.VET_MESSAGES_COPY=$a;exports.VET_MESSAGE_CONTENT_MAX=Pt;exports.VET_MESSAGE_PAGE_DEFAULT=Rt;exports.VET_MESSAGE_PAGE_MAX=zt;exports.attestation=attestation;exports.canConfirm=canConfirm;exports.canManageTelevetVisit=canManageTelevetVisit;exports.createTelevetBookingController=createTelevetBookingController;exports.currentStep=currentStep;exports.emptyTelevetDraft=Kl;exports.formatVisitRange=formatVisitRange;exports.formatWhen=formatWhen;exports.formatWhenWithDay=formatWhenWithDay;exports.hasPreviousStep=hasPreviousStep;exports.initialTelevetBookingState=initialTelevetBookingState;exports.isHoldExpired=isHoldExpired;exports.isMediaShortfallEmpty=isMediaShortfallEmpty;exports.isSkipped=isSkipped;exports.isTelevetBookingCopyReady=isTelevetBookingCopyReady;exports.isVetMessagesDark=isVetMessagesDark;exports.isVetThreadVetFirst=isVetThreadVetFirst;exports.isWellFormedStateCode=isWellFormedStateCode;exports.mediaShortfallFromUnsentPicks=mediaShortfallFromUnsentPicks;exports.parseVetCallCredential=parseVetCallCredential;exports.splitTelevetVisits=splitTelevetVisits;exports.televetBookingKey=televetBookingKey;exports.televetBookingReducer=televetBookingReducer;exports.televetBookingRefusal=televetBookingRefusal;exports.televetCancelCall=televetCancelCall;exports.televetConsultCalendarKey=televetConsultCalendarKey;exports.televetConsultCall=televetConsultCall;exports.televetDaysFromSlots=televetDaysFromSlots;exports.televetEmptyRosterCause=televetEmptyRosterCause;exports.televetEmptyRosterView=televetEmptyRosterView;exports.televetHoldCall=televetHoldCall;exports.televetJoinCall=televetJoinCall;exports.televetJoinOpensAtMs=televetJoinOpensAtMs;exports.televetJoinReadiness=televetJoinReadiness;exports.televetMediaShortfallLines=televetMediaShortfallLines;exports.televetRescheduleCall=televetRescheduleCall;exports.televetScreenForRequest=televetScreenForRequest;exports.televetThreadMessagesCall=televetThreadMessagesCall;exports.televetThreadReadCall=televetThreadReadCall;exports.televetVisitSummaryCall=televetVisitSummaryCall;exports.useEarlyTriage=useEarlyTriage;exports.useStateInterest=useStateInterest;exports.useTelevetBookConsult=useTelevetBookConsult;exports.useTelevetBookingAvailable=useTelevetBookingAvailable;exports.useTelevetBookingController=useTelevetBookingController;exports.useTelevetBookingEntitlement=useTelevetBookingEntitlement;exports.useTelevetCancellationPolicy=useTelevetCancellationPolicy;exports.useTelevetClinicians=useTelevetClinicians;exports.useTelevetHoldSlot=useTelevetHoldSlot;exports.useTelevetJoin=useTelevetJoin;exports.useTelevetNextSlot=useTelevetNextSlot;exports.useTelevetRescheduleConsult=useTelevetRescheduleConsult;exports.useTelevetSlots=useTelevetSlots;exports.useTelevetStatePolicy=useTelevetStatePolicy;exports.useUpcomingTelevetVisit=useUpcomingTelevetVisit;exports.useVetThread=useVetThread;exports.useVetThreads=useVetThreads;exports.useVisitSummary=useVisitSummary;exports.validateBookingBody=validateBookingBody;exports.vetCallJoinReason=vetCallJoinReason;exports.vetCallJoinRefusal=vetCallJoinRefusal;exports.vetThreadPetRef=vetThreadPetRef;exports.withUnsentPicks=withUnsentPicks;
|