@everfur/sdk 0.4.0 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (159) hide show
  1. package/CHANGELOG.md +182 -0
  2. package/README.md +9 -8
  3. package/dist/{Chat-BZZ-Py5l.d.ts → Chat-BOX-03ho.d.ts} +17 -3
  4. package/dist/{Chat-Dq4fffIO.d.cts → Chat-TA-aTcVF.d.cts} +17 -3
  5. package/dist/{DepthViews-CkYri51q.d.ts → DepthViews-CgjX2AJ5.d.ts} +1 -1
  6. package/dist/{DepthViews-CL75jyRA.d.cts → DepthViews-Cviea-ri.d.cts} +1 -1
  7. package/dist/{DepthViews-BG3E25MD.d.ts → DepthViews-D2dRqWRq.d.ts} +1 -1
  8. package/dist/{DepthViews-B_hIypI6.d.cts → DepthViews-DSFyaSeL.d.cts} +1 -1
  9. package/dist/{ErrorPolicyPort-CwbfmxzJ.d.ts → ErrorPolicyPort-D22LUVrK.d.ts} +1 -1
  10. package/dist/{ErrorPolicyPort-CNf4uQZP.d.cts → ErrorPolicyPort-D6CybiqJ.d.cts} +1 -1
  11. package/dist/{EverfurResult-DN9pL2Ab.d.cts → EverfurError-DmELDpXp.d.cts} +1 -67
  12. package/dist/{EverfurResult-DN9pL2Ab.d.ts → EverfurError-DmELDpXp.d.ts} +1 -67
  13. package/dist/EverfurResult-SGvHKsCB.d.ts +69 -0
  14. package/dist/EverfurResult-ZtH-YV1h.d.cts +69 -0
  15. package/dist/animations/index.d.cts +6 -5
  16. package/dist/animations/index.d.ts +6 -5
  17. package/dist/{attachments-BrUWQYNK.d.ts → attachments-C_vtFu2f.d.ts} +7 -6
  18. package/dist/{attachments-D_SECjr1.d.cts → attachments-DHvnITuE.d.cts} +7 -6
  19. package/dist/{attachments-DpldrvIW.d.ts → attachments-oD5U2fXI.d.ts} +3 -3
  20. package/dist/{attachments-BorG422I.d.cts → attachments-pIdGOQfm.d.cts} +3 -3
  21. package/dist/{bookingCopy-CqtDYvCR.d.ts → bookingCopy-CJir9mjb.d.ts} +417 -14
  22. package/dist/{bookingCopy-SREvkG19.d.cts → bookingCopy-DfuA13dh.d.cts} +417 -14
  23. package/dist/branding-Xb_wL8N1.d.cts +212 -0
  24. package/dist/branding-xpQ056sM.d.ts +212 -0
  25. package/dist/callCopy-rDH9JTFo.d.cts +45 -0
  26. package/dist/callCopy-rDH9JTFo.d.ts +45 -0
  27. package/dist/callRoom-7wrE3RP2.d.ts +62 -0
  28. package/dist/callRoom-B_EqaUzx.d.cts +62 -0
  29. package/dist/{casesRepository-DwtZVsbj.d.cts → casesRepository-B-Eg8ZJ3.d.cts} +14 -2
  30. package/dist/{casesRepository-v6QczS9N.d.ts → casesRepository-DHgIYKN9.d.ts} +14 -2
  31. package/dist/chat/index.cjs +1 -1
  32. package/dist/chat/index.d.cts +12 -11
  33. package/dist/chat/index.d.ts +12 -11
  34. package/dist/chat/index.js +1 -1
  35. package/dist/client/index.cjs +5 -5
  36. package/dist/client/index.d.cts +14 -12
  37. package/dist/client/index.d.ts +14 -12
  38. package/dist/client/index.js +5 -5
  39. package/dist/{config--Wu1Umhd.d.cts → config-ClI7QxB0.d.ts} +3 -2
  40. package/dist/{config-C7eb_IMD.d.ts → config-DAFbf721.d.cts} +3 -2
  41. package/dist/consent/index.d.cts +9 -8
  42. package/dist/consent/index.d.ts +9 -8
  43. package/dist/{context-CL3lyuy1.d.cts → context-B-dUM1Qf.d.cts} +9 -8
  44. package/dist/{context-CahAEha8.d.ts → context-CZbgF_OH.d.ts} +9 -8
  45. package/dist/{copy-DdVFDL01.d.ts → copy-CeRH3NXy.d.ts} +5 -4
  46. package/dist/{copy-UeUJVk8X.d.cts → copy-CneuYdrO.d.cts} +5 -4
  47. package/dist/core/index.cjs +9 -9
  48. package/dist/core/index.d.cts +19 -17
  49. package/dist/core/index.d.ts +19 -17
  50. package/dist/core/index.js +9 -9
  51. package/dist/{depth-D5HwcvKC.d.cts → depth-B3NFKlF9.d.cts} +6 -5
  52. package/dist/{depth-DvPwPuT_.d.ts → depth-DO3Ko_qs.d.ts} +6 -5
  53. package/dist/{entitlementRepository-B7egEdW6.d.ts → entitlementRepository-74kW5mK0.d.ts} +4 -4
  54. package/dist/{entitlementRepository-BpJ7tiwl.d.cts → entitlementRepository-m6zLUmiB.d.cts} +4 -4
  55. package/dist/{identity-C2-08BZW.d.cts → identity-C7uxGwfT.d.cts} +2 -2
  56. package/dist/{identity-CEi9GRFZ.d.ts → identity-CLAUq-K4.d.ts} +2 -2
  57. package/dist/index.cjs +6 -6
  58. package/dist/index.d.cts +19 -17
  59. package/dist/index.d.ts +19 -17
  60. package/dist/index.js +6 -6
  61. package/dist/{models-D2EUxPZY.d.cts → models-Bn2z0NNo.d.cts} +1 -1
  62. package/dist/{models-B-Uh2LTf.d.ts → models-DSqA5Ahs.d.ts} +1 -1
  63. package/dist/notifications/index.d.cts +5 -4
  64. package/dist/notifications/index.d.ts +5 -4
  65. package/dist/{pets-JVCXgRgR.d.cts → pets-BoB5B7kp.d.cts} +2 -2
  66. package/dist/{pets-DJv2sj2H.d.ts → pets-w4M9d-Dn.d.ts} +2 -2
  67. package/dist/{petsRepository-Bk6GDwLs.d.ts → petsRepository-BjKJ8UsN.d.ts} +2 -2
  68. package/dist/{petsRepository-B_gKbAzJ.d.cts → petsRepository-DZZoEG3r.d.cts} +2 -2
  69. package/dist/photo/index.d.cts +3 -2
  70. package/dist/photo/index.d.ts +3 -2
  71. package/dist/{ports-D7YW8qz9.d.ts → ports-BO3bzTJg.d.ts} +13 -6
  72. package/dist/{ports-BY2ph0_y.d.cts → ports-C2EVK416.d.cts} +13 -6
  73. package/dist/records/depth/index.d.cts +11 -10
  74. package/dist/records/depth/index.d.ts +11 -10
  75. package/dist/records/index.cjs +3 -3
  76. package/dist/records/index.d.cts +25 -14
  77. package/dist/records/index.d.ts +25 -14
  78. package/dist/records/index.js +3 -3
  79. package/dist/{requestFunnel-DFMGcluw.d.ts → requestFunnel-D7ipek3e.d.ts} +5 -4
  80. package/dist/{requestFunnel-BjDpqqvm.d.cts → requestFunnel-Djjwgoe9.d.cts} +5 -4
  81. package/dist/{runtimeTypes-w5KqBMcs.d.ts → runtimeTypes-CTL3yToK.d.ts} +7 -7
  82. package/dist/{runtimeTypes-gZEJu-da.d.cts → runtimeTypes-D2C9uD85.d.cts} +7 -7
  83. package/dist/server/events/index.cjs +1 -1
  84. package/dist/server/events/index.d.cts +4 -3
  85. package/dist/server/events/index.d.ts +4 -3
  86. package/dist/server/events/index.js +1 -1
  87. package/dist/server/index.cjs +1 -1
  88. package/dist/server/index.d.cts +5 -4
  89. package/dist/server/index.d.ts +5 -4
  90. package/dist/server/index.js +1 -1
  91. package/dist/televet/booking/index.cjs +1 -1
  92. package/dist/televet/booking/index.d.cts +303 -31
  93. package/dist/televet/booking/index.d.ts +303 -31
  94. package/dist/televet/booking/index.js +1 -1
  95. package/dist/televet/call/index.cjs +1 -1
  96. package/dist/televet/call/index.d.cts +25 -5
  97. package/dist/televet/call/index.d.ts +25 -5
  98. package/dist/televet/call/index.js +1 -1
  99. package/dist/televet/index.cjs +1 -1
  100. package/dist/televet/index.d.cts +41 -71
  101. package/dist/televet/index.d.ts +41 -71
  102. package/dist/televet/index.js +1 -1
  103. package/dist/televetGlobal-CEk0_cW9.d.cts +34 -0
  104. package/dist/televetGlobal-Cs9Wbqsy.d.ts +34 -0
  105. package/dist/testing/index.cjs +4 -4
  106. package/dist/testing/index.d.cts +3 -2
  107. package/dist/testing/index.d.ts +3 -2
  108. package/dist/testing/index.js +4 -4
  109. package/dist/testing/rn/index.cjs +1 -1
  110. package/dist/testing/rn/index.d.cts +13 -11
  111. package/dist/testing/rn/index.d.ts +13 -11
  112. package/dist/testing/rn/index.js +1 -1
  113. package/dist/testing/web/index.d.cts +14 -13
  114. package/dist/testing/web/index.d.ts +14 -13
  115. package/dist/{timelineRows-C15jxFFH.d.ts → timelineRows-7yFNK_rU.d.ts} +1 -1
  116. package/dist/{timelineRows-odO8g9r2.d.cts → timelineRows-CzR1T2DR.d.cts} +1 -1
  117. package/dist/{branding-CsRdeNwK.d.cts → tokens-CIngRkvt.d.cts} +7 -211
  118. package/dist/{branding-CsRdeNwK.d.ts → tokens-CIngRkvt.d.ts} +7 -211
  119. package/dist/{typeStyle-DmoyacDG.d.ts → typeStyle-DHJzDaUo.d.cts} +2 -1
  120. package/dist/{typeStyle-CKqVYD6L.d.cts → typeStyle-YPS_MXeI.d.ts} +2 -1
  121. package/dist/{useRecordsDepth-C6rjEaLn.d.cts → useRecordsDepth-Bnw36jPr.d.cts} +24 -5
  122. package/dist/{useRecordsDepth-crhBllQK.d.ts → useRecordsDepth-DFF7Faxx.d.ts} +24 -5
  123. package/dist/{useVetVisit-CjmMa896.d.ts → useVetVisit-BsjoDO-n.d.ts} +21 -6
  124. package/dist/{useVetVisit-Bc84hWUU.d.cts → useVetVisit-Ds8f1peV.d.cts} +21 -6
  125. package/dist/video/index.d.cts +3 -2
  126. package/dist/video/index.d.ts +3 -2
  127. package/dist/{view-Bxwxp4xD.d.ts → view-BqcOYFTr.d.ts} +5 -4
  128. package/dist/{view-DyitEO0m.d.cts → view-CaJs8WFH.d.cts} +5 -4
  129. package/dist/web/consent/index.d.cts +9 -8
  130. package/dist/web/consent/index.d.ts +9 -8
  131. package/dist/web/index.cjs +10 -10
  132. package/dist/web/index.d.cts +42 -19
  133. package/dist/web/index.d.ts +42 -19
  134. package/dist/web/index.js +10 -10
  135. package/dist/web/notifications/index.d.cts +7 -6
  136. package/dist/web/notifications/index.d.ts +7 -6
  137. package/dist/web/records/depth/index.cjs +2 -2
  138. package/dist/web/records/depth/index.d.cts +11 -10
  139. package/dist/web/records/depth/index.d.ts +11 -10
  140. package/dist/web/records/depth/index.js +2 -2
  141. package/dist/web/records/index.cjs +3 -3
  142. package/dist/web/records/index.d.cts +53 -35
  143. package/dist/web/records/index.d.ts +53 -35
  144. package/dist/web/records/index.js +3 -3
  145. package/dist/web/televet/booking/index.cjs +2 -1
  146. package/dist/web/televet/booking/index.d.cts +453 -32
  147. package/dist/web/televet/booking/index.d.ts +453 -32
  148. package/dist/web/televet/booking/index.js +2 -1
  149. package/dist/web/televet/call/index.cjs +1 -1
  150. package/dist/web/televet/call/index.d.cts +3 -1
  151. package/dist/web/televet/call/index.d.ts +3 -1
  152. package/dist/web/televet/call/index.js +1 -1
  153. package/dist/web/televet/index.cjs +1 -1
  154. package/dist/web/televet/index.d.cts +40 -74
  155. package/dist/web/televet/index.d.ts +40 -74
  156. package/dist/web/televet/index.js +1 -1
  157. package/package.json +3 -2
  158. package/dist/callCopy-DoQKG3-L.d.cts +0 -40
  159. package/dist/callCopy-DoQKG3-L.d.ts +0 -40
@@ -1 +1 @@
1
- import {createContext,forwardRef,createElement,useMemo,useState,useEffect,useReducer,useCallback,useRef,useContext,Component,useSyncExternalStore}from'react';import {TextInput,Linking,View,StyleSheet,Alert,BackHandler,Pressable,Image,ActivityIndicator,ScrollView,Text}from'react-native';import {jsxs,jsx}from'react/jsx-runtime';var Wi=Object.defineProperty;var o=(e,t)=>Wi(e,"name",{value:t,configurable:true});function mt(e){throw new Error(`assertNever: unhandled discriminated-union member ${JSON.stringify(e)}`)}o(mt,"assertNever");function un(e){return Object.freeze({kind:"error",terminal:true,code:e.code,retryable:e.retryable,wireMessage:e.wireMessage,synthesized:e.synthesized,lastEventId:e.lastEventId,serverRequestId:e.serverRequestId??null})}o(un,"errorFrame");function Zt(e){let t=globalThis.console;try{t?.error?.("[everfur] A host callback threw; the SDK ignored it.",e);}catch{}}o(Zt,"reportHostFailure");function $i(e){return (typeof e=="object"||typeof e=="function")&&e!==null&&typeof e.then=="function"}o($i,"isThenable");function Qe(e,...t){if(typeof e=="function")try{let r=e(...t);return $i(r)&&Promise.resolve(r).then(void 0,Zt),r}catch(r){Zt(r);return}}o(Qe,"callHost");var cn=new WeakMap;function Yi(e){if(typeof e!="function")return;let t=cn.get(e);if(t!==void 0)return t;let r=o((...n)=>{Qe(e,...n);},"guarded");return cn.set(e,r),r}o(Yi,"guardHost");function je(e,t){let r=null;for(let n of t){let i=e[n];typeof i=="function"&&(r??={...e},r[n]=Yi(i));}return r??e}o(je,"guardHostProps");function gt(e,...t){let r;try{r=e(...t);}catch(n){return Zt(n),Promise.resolve({ok:false,error:n})}return Promise.resolve(r).then(n=>({ok:true,value:n}),n=>({ok:false,error:n}))}o(gt,"callHostAsync");var m=o(e=>e,"DRAFT"),Gi=["[PLACEHOLDER","[PLAN NAME]","[LINK]","[Last]","TODO","TBD"];function Xi(e){return Gi.some(t=>e.toUpperCase().includes(t.toUpperCase()))}o(Xi,"isPlaceholderCopy");function ue(e,t){let r=e;for(let[n,i]of Object.entries(t))r=r.split(`{${n}}`).join(i);return r}o(ue,"fill");var c=Object.freeze({stateBlockedTitle:m("Not available in this state yet"),noCliniciansTitle:m("No vets available right now"),noCliniciansBody:m("Nobody is free in your area at the moment. This changes through the day."),noCliniciansRetryCta:m("Check again"),yourVetTitle:m("Your Vet"),reviewsLabel:m("reviews"),rescheduleFromTemplate:m("Moving your visit on {when}"),rescheduleFailed:m("That did not move. Your original time is unchanged."),keepExistingCta:m("Keep my current time"),bookingPausedTitle:m("Booking is not available right now."),slotsErrorTitle:m("Could not load times"),noSlotsTitle:m("No times available"),nextOpeningTemplate:m("Next opening across our vets: {when}"),seeOtherVetsCta:m("See other vets"),retryCta:m("Try again"),holdExpired:m("That time is no longer held. Pick another."),slotTaken:m("That time was just taken. Pick another."),reasonPlaceholder:m("What is going on with your pet?"),reasonTooLong:m("That is too long. Please shorten it."),shareRecordsOff:m("Share health records with this vet"),confirmNotEntitled:m("A Pro membership is needed to book a video visit."),confirmFailed:m("That did not book. Try again."),navTitle:m("Book a visit"),rescheduleNavTitle:m("Change your visit"),close:m("Close"),continueCta:m("Continue"),petSelectTitle:m("Who is this visit for?"),addPetCta:m("Add a pet"),locationUnknownTitle:m("We need your location to find a vet"),locationUnknownBody:m("Turn on location for Everfur, then try again."),locationUnknownCta:m("Allow location"),locationBlockedTitle:m("Location is turned off"),locationBlockedBody:m("Everfur needs your location to match you with a vet in your area."),locationBlockedCta:m("Open Settings"),locationUnavailableTitle:m("We could not read your location"),locationUnavailableBody:m("Try again in a moment."),stateAttestTemplate:m("I confirm my pet and I are in {state} right now."),describeHeading:m("or Type to the vet what you're seeing"),describeHelpLong:m("A few sentences is plenty. When it started, what changed, anything you've already tried."),addPhotoCta:m("ADD PHOTO OR VIDEO"),removePhotoLabel:m("Remove photo"),summaryPet:m("Pet"),summaryVet:m("Vet"),summaryWhen:m("When"),summaryLength:m("Length"),summaryReason:m("Reason"),summaryLengthTemplate:m("{n} minutes"),confirmCta:m("Confirm visit"),bookedTitle:m("You are booked."),addToCalendarCta:m("Add to calendar"),doneCta:m("Done"),booked:Object.freeze({remindPromise:m("We will notify you 30 minutes before."),summaryPromise:m("{pet}'s summary goes to the vet ahead of the call."),joinPromise:m("Join right here in the app. No links to hunt for."),backToPet:m("Back to {pet}"),calendarAdded:m("Added to your calendar"),calendarFailedBody:m("That did not save to your calendar.")}),chrome:Object.freeze({closeHint:m("Closes without saving"),discardTitle:m("Leave without booking?"),discardBody:m("Your answers will not be saved."),discardConfirmCta:m("Leave"),discardKeepCta:m("Keep going"),noPetsTitle:m("No pets on this account"),loadFailedTitle:m("Could not load"),retryCta:m("Try again")}),emergency:Object.freeze({bannerTitle:m("This cannot wait for a scheduled call."),keepBookingCta:m("I have handled this, keep booking"),lede:m("What you are describing is the kind of thing vets want to see in person, now. Please call one of these first.")}),visit:Object.freeze({title:m("Your visit")}),loading:Object.freeze({pets:"Loading pets. Nothing to read yet.",clinicians:"Loading vets. Nothing to read yet.",slots:"Loading times. Nothing to read yet.",consult:"Loading your visit. Nothing to read yet.",progressTemplate:"Step {step} of {total}"})});function fn(e=c){return typeof e=="string"?[e]:typeof e!="object"||e===null?[]:Object.values(e).flatMap(t=>fn(t))}o(fn,"televetBookingCopyValues");function ce(){return fn().every(e=>e.trim().length>0&&!Xi(e))}o(ce,"isTelevetBookingCopyReady");function tr(e){if(e!==null&&typeof e=="object"&&!Object.isFrozen(e)){Object.freeze(e);for(let t of Object.keys(e))tr(e[t]);}return e}o(tr,"deepFreeze");var Zi=Object.freeze({content:0,heading:2,control:1.8,compact:1.5,badge:1.3}),yn={xs:4,sm:8,md:12,lg:16,xl:24,xxl:32},mn={tile:5,xs:6,sm:10,md:14,lg:20,xl:28,pill:500},pn={nano:8,small:9,micro:10,tiny:11,caption:12,bodyTight:13,body:14,subtitle:16,heading:18,verdict:24},Ji={tight:1.15,snug:1.3,normal:1.4,relaxed:1.55},el={regular:"400",medium:"500",bold:"700"},tl={eyebrow:1,monoWide:.9,headerBrand:-0.42,tight:-0.35},rl=0,vt="System",bt="monospace",nl=["content","heading","control","compact","badge"];function ol(e){let t={};for(let r of nl)t[r]=e;return t}o(ol,"authoredTierSizes");function gn(){return {family:vt,mono:bt,fontUrl:null,families:{regular:vt,medium:vt,bold:vt,mono:bt,monoMedium:bt,monoBold:bt},namedFaces:{regular:false,medium:false,bold:false,mono:false,monoMedium:false,monoBold:false},fontUrls:{},size:pn,tierSizes:ol(pn),lineHeight:Ji,weight:el,letterSpacing:tl,scale:1,maxScale:rl,scaleCaps:Zi}}o(gn,"baseType");var vn={},Jt=Object.freeze({standard:Object.freeze([.2,0,0,1]),emphasized:Object.freeze([.2,.8,.2,1]),exit:Object.freeze([.4,0,1,1])});function er(e){return `cubic-bezier(${e.join(", ")})`}o(er,"cssCubicBezier");var bn={duration:{instant:80,fast:140,normal:220,slow:320},spring:{gentle:{damping:18,stiffness:200}},easing:{standard:er(Jt.standard),emphasized:er(Jt.emphasized),exit:er(Jt.exit)},reducedMotion:false},il={brand:"#10462E",brandSoft:"rgba(16,70,46,0.10)",brandSofter:"rgba(16,70,46,0.15)",brandBorder:"rgba(16,70,46,0.18)",borderHairlineGreen:"rgba(16,70,46,0.25)",brandBorderStrong:"rgba(16,70,46,0.55)",brandInk:"#10462E",linkInk:"#10462E",surface:"#FFFFFF",surfaceCream:"#FDFBF8",surfaceSubtle:"#EFE9E3",background:"#FFFFFF",borderRingCream:"#D8D2C8",chatGround:"#FFFFFF",composerFill:"#FDFBF8",composerBorder:"rgba(16,70,46,0.75)",shadow:"#0B3421",text:{primary:"#111111",secondary:"#0E462E",muted:"#6E6660",placeholder:"rgba(61,61,61,0.75)",onBrand:"#FFFFFF",metaCool:"#3D3D3D",timestamp:"rgba(61,61,61,0.75)"},primary:"#10462E",onPrimary:"#FFFFFF",accent:"#10462E",onAccent:"#FFFFFF",accentEdge:"#07C168",success:"#07C168",danger:"#B91C1C",errorRed:"#FF1B00",warningStrong:"#A45610",cautionAccent:"#D9821D",riskConcern:"#EFA700",sentiment:{up:"#07C168",neutral:"#FBC558",down:"#FF1B00"},badgeBgPositive:"rgba(7,193,104,0.12)",badgeBgCaution:"rgba(217,130,29,0.14)",badgeBgCritical:"rgba(185,28,28,0.12)",badgeBgNeutral:"rgba(110,102,96,0.12)",bubbleUser:"#10462E",bubbleAssistant:"#FFFFFF",skeleton:"#EFE9E3",scanButtonPink:"#FFC3BC",checkupCardLowRiskBg:"rgba(7,193,104,0.10)",checkupCardConcernBg:"rgba(239,167,0,0.10)"},hn=tr({brightness:"light",highContrast:false,meta:{displayName:"Everfur",logoUrl:null,placeholder:null,hidePoweredBy:false},color:il,space:yn,radius:mn,type:gn(),motion:bn,slots:vn}),ll={brand:"#6BD39A",brandSoft:"rgba(107,211,154,0.12)",brandSofter:"rgba(107,211,154,0.18)",brandBorder:"rgba(107,211,154,0.22)",borderHairlineGreen:"rgba(107,211,154,0.28)",brandBorderStrong:"rgba(107,211,154,0.55)",brandInk:"#6BD39A",linkInk:"#6BD39A",surface:"#1C1F23",surfaceCream:"#23272C",surfaceSubtle:"#23272C",background:"#15171A",borderRingCream:"#3A3F45",chatGround:"#1C1F23",composerFill:"#23272C",composerBorder:"rgba(107,211,154,0.75)",shadow:"#000000",text:{primary:"#F5F3F0",secondary:"#A9E4C4",muted:"#9A938C",placeholder:"rgba(255,255,255,0.55)",onBrand:"#0E1F17",metaCool:"#C9C9C9",timestamp:"rgba(245,243,240,0.7)"},primary:"#6BD39A",onPrimary:"#0E1F17",accent:"#6BD39A",onAccent:"#0E1F17",accentEdge:"#34D888",success:"#07C168",danger:"#F87171",errorRed:"#FF6B5B",warningStrong:"#F0A35E",cautionAccent:"#D9821D",riskConcern:"#EFA700",sentiment:{up:"#07C168",neutral:"#FBC558",down:"#FF1B00"},badgeBgPositive:"rgba(7,193,104,0.18)",badgeBgCaution:"rgba(217,130,29,0.20)",badgeBgCritical:"rgba(185,28,28,0.22)",badgeBgNeutral:"rgba(255,255,255,0.10)",bubbleUser:"#6BD39A",bubbleAssistant:"#1C1F23",skeleton:"#23272C",scanButtonPink:"#FFC3BC",checkupCardLowRiskBg:"rgba(7,193,104,0.16)",checkupCardConcernBg:"rgba(239,167,0,0.16)"};tr({brightness:"dark",highContrast:false,meta:{displayName:"Everfur",logoUrl:null,placeholder:null,hidePoweredBy:false},color:ll,space:yn,radius:mn,type:gn(),motion:bn,slots:vn});var Tn=Symbol.for("@everfur/sdk#EverfurThemeContext@v1"),En=globalThis,rr=En[Tn]??(En[Tn]=createContext(hn));rr.displayName??="EverfurThemeContext";function C(){return useContext(rr)}o(C,"useEverfurTheme");function fl(e,t){let r=e.scaleCaps[t];return r>0?r:void 0}o(fl,"tierMultiplier");function b({tier:e="content",...t}){let{type:r}=C(),n=fl(r,e);return createElement(Text,n===void 0?t:{maxFontSizeMultiplier:n,...t})}o(b,"Text");var _n=forwardRef(o(function(t,r){return createElement(TextInput,{...t,...r===null?{}:{ref:r}})},"TextInput"));var pl=Object.freeze({regular:"regular",medium:"medium",bold:"bold",mono:"regular",monoMedium:"medium",monoBold:"bold"});function E(e,t){let r=e.type,n=r.families[t];return t==="mono"||r.namedFaces[t]?{fontFamily:n}:{fontFamily:n,fontWeight:r.weight[pl[t]]}}o(E,"face");var ir=class ir extends Component{constructor(){super(...arguments);this.state={failed:false,key:this.props.resetKey};}static getDerivedStateFromError(){return {failed:true}}static getDerivedStateFromProps(r,n){return Object.is(r.resetKey,n.key)?null:{failed:false,key:r.resetKey}}render(){return this.state.failed?this.props.fallback:this.props.children}};o(ir,"HostRenderBoundary");var nr=ir;function ml({render:e}){return e()}o(ml,"RenderHost");function or({render:e,fallback:t,resetKey:r}){return createElement(nr,{fallback:t,resetKey:r,children:createElement(ml,{render:e})})}o(or,"HostRender");var lr=Object.freeze([Object.freeze({wireCode:"AccessDeniedException",envelope:"http_envelope",httpStatus:403,retryable:false}),Object.freeze({wireCode:"AuthorizationException",envelope:"http_envelope",httpStatus:401,retryable:false}),Object.freeze({wireCode:"ConflictException",envelope:"http_envelope",httpStatus:409,retryable:true}),Object.freeze({wireCode:"DAILY_QUOTA_EXCEEDED",envelope:"http_envelope",httpStatus:429,retryable:true}),Object.freeze({wireCode:"FILE_TOO_LARGE",envelope:"http_envelope",httpStatus:400,retryable:false}),Object.freeze({wireCode:"IDEMPOTENCY_KEY_IN_FLIGHT",envelope:"http_envelope",httpStatus:409,retryable:true}),Object.freeze({wireCode:"IDEMPOTENCY_KEY_REUSED_DIFFERENT_REQUEST",envelope:"http_envelope",httpStatus:409,retryable:false}),Object.freeze({wireCode:"INVALID_CONTENT_TYPE",envelope:"http_envelope",httpStatus:400,retryable:false}),Object.freeze({wireCode:"InternalFailureException",envelope:"http_envelope",httpStatus:500,retryable:true}),Object.freeze({wireCode:"MethodNotAllowedException",envelope:"http_envelope",httpStatus:405,retryable:false}),Object.freeze({wireCode:"NotImplementedException",envelope:"http_envelope",httpStatus:501,retryable:false}),Object.freeze({wireCode:"PaymentRequiredException",envelope:"http_envelope",httpStatus:402,retryable:false}),Object.freeze({wireCode:"ResourceNotFoundException",envelope:"http_envelope",httpStatus:404,retryable:false}),Object.freeze({wireCode:"ServiceUnavailableException",envelope:"http_envelope",httpStatus:503,retryable:true}),Object.freeze({wireCode:"TIER_UPGRADE_REQUIRED",envelope:"http_envelope",httpStatus:402,retryable:false}),Object.freeze({wireCode:"ThrottlingException",envelope:"http_envelope",httpStatus:429,retryable:true}),Object.freeze({wireCode:"ValidationException",envelope:"http_envelope",httpStatus:400,retryable:false}),Object.freeze({wireCode:"accessDenied",envelope:"http_envelope",httpStatus:403,retryable:false}),Object.freeze({wireCode:"access_denied",envelope:"oauth_error",httpStatus:302,retryable:false}),Object.freeze({wireCode:"attachment_unreadable",envelope:"http_envelope",httpStatus:400,retryable:false}),Object.freeze({wireCode:"authExpired",envelope:"http_envelope",httpStatus:401,retryable:true}),Object.freeze({wireCode:"authRejected",envelope:"http_envelope",httpStatus:401,retryable:false}),Object.freeze({wireCode:"consent_invalid",envelope:"http_envelope",httpStatus:422,retryable:false}),Object.freeze({wireCode:"consent_required",envelope:"http_envelope",httpStatus:422,retryable:false}),Object.freeze({wireCode:"consent_scope_wrong_route",envelope:"http_envelope",httpStatus:400,retryable:false}),Object.freeze({wireCode:"device_cipher_unavailable",envelope:"http_envelope",httpStatus:503,retryable:true}),Object.freeze({wireCode:"email_invalid",envelope:"http_envelope",httpStatus:422,retryable:false}),Object.freeze({wireCode:"event_cursor_invalid",envelope:"http_envelope",httpStatus:400,retryable:false}),Object.freeze({wireCode:"event_filter_invalid",envelope:"http_envelope",httpStatus:400,retryable:false}),Object.freeze({wireCode:"event_payload_invalid",envelope:"http_envelope",httpStatus:400,retryable:false}),Object.freeze({wireCode:"event_type_not_available",envelope:"http_envelope",httpStatus:400,retryable:false}),Object.freeze({wireCode:"event_type_unknown",envelope:"http_envelope",httpStatus:400,retryable:false}),Object.freeze({wireCode:"idempotency_key_invalid",envelope:"http_envelope",httpStatus:400,retryable:false}),Object.freeze({wireCode:"idempotency_key_required",envelope:"http_envelope",httpStatus:400,retryable:false}),Object.freeze({wireCode:"idempotency_key_reused",envelope:"http_envelope",httpStatus:409,retryable:false}),Object.freeze({wireCode:"insufficientCapability",envelope:"http_envelope",httpStatus:403,retryable:false}),Object.freeze({wireCode:"insufficient_scope",envelope:"http_envelope",httpStatus:403,retryable:false}),Object.freeze({wireCode:"internal_error",envelope:"sse_frame",httpStatus:200,retryable:false}),Object.freeze({wireCode:"invalidRequest",envelope:"http_envelope",httpStatus:400,retryable:false}),Object.freeze({wireCode:"invalid_client",envelope:"oauth_error",httpStatus:401,retryable:false}),Object.freeze({wireCode:"invalid_client_metadata",envelope:"oauth_error",httpStatus:400,retryable:false}),Object.freeze({wireCode:"invalid_grant",envelope:"oauth_error",httpStatus:400,retryable:false}),Object.freeze({wireCode:"invalid_redirect_uri",envelope:"oauth_error",httpStatus:400,retryable:false}),Object.freeze({wireCode:"invalid_request",envelope:"oauth_error",httpStatus:400,retryable:false}),Object.freeze({wireCode:"invalid_scope",envelope:"oauth_error",httpStatus:400,retryable:false}),Object.freeze({wireCode:"invalid_target",envelope:"oauth_error",httpStatus:400,retryable:false}),Object.freeze({wireCode:"mcp_connection_not_found",envelope:"http_envelope",httpStatus:404,retryable:false}),Object.freeze({wireCode:"mcp_request_conflict",envelope:"http_envelope",httpStatus:409,retryable:false}),Object.freeze({wireCode:"mcp_request_gone",envelope:"http_envelope",httpStatus:410,retryable:false}),Object.freeze({wireCode:"mcp_request_not_found",envelope:"http_envelope",httpStatus:404,retryable:false}),Object.freeze({wireCode:"not_found",envelope:"sse_frame",httpStatus:200,retryable:false}),Object.freeze({wireCode:"partner_visit_link_conflict",envelope:"http_envelope",httpStatus:409,retryable:false}),Object.freeze({wireCode:"partner_visit_owner_only",envelope:"http_envelope",httpStatus:403,retryable:false}),Object.freeze({wireCode:"partner_visit_pet_already_mapped",envelope:"http_envelope",httpStatus:409,retryable:false}),Object.freeze({wireCode:"payload_too_large",envelope:"http_envelope",httpStatus:413,retryable:false}),Object.freeze({wireCode:"petRefInUse",envelope:"http_envelope",httpStatus:409,retryable:false}),Object.freeze({wireCode:"pet_health_list_removals_unconfirmed",envelope:"http_envelope",httpStatus:422,retryable:false}),Object.freeze({wireCode:"pet_health_species_unsupported",envelope:"http_envelope",httpStatus:422,retryable:false}),Object.freeze({wireCode:"pet_not_registered",envelope:"http_envelope",httpStatus:404,retryable:false}),Object.freeze({wireCode:"provider_unsupported",envelope:"http_envelope",httpStatus:422,retryable:false}),Object.freeze({wireCode:"rateLimited",envelope:"http_envelope",httpStatus:429,retryable:true}),Object.freeze({wireCode:"record_species_unsupported",envelope:"http_envelope",httpStatus:422,retryable:false}),Object.freeze({wireCode:"record_subject_not_found",envelope:"http_envelope",httpStatus:404,retryable:false}),Object.freeze({wireCode:"record_upload_invalid",envelope:"http_envelope",httpStatus:400,retryable:false}),Object.freeze({wireCode:"records_consent_required",envelope:"http_envelope",httpStatus:409,retryable:false}),Object.freeze({wireCode:"sandbox_only",envelope:"http_envelope",httpStatus:403,retryable:false}),Object.freeze({wireCode:"session_required",envelope:"http_envelope",httpStatus:403,retryable:false}),Object.freeze({wireCode:"share_limit_reached",envelope:"http_envelope",httpStatus:429,retryable:false}),Object.freeze({wireCode:"slow_down",envelope:"oauth_error",httpStatus:429,retryable:true}),Object.freeze({wireCode:"species_unsupported",envelope:"http_envelope",httpStatus:422,retryable:false}),Object.freeze({wireCode:"tenant_filter_invalid",envelope:"http_envelope",httpStatus:400,retryable:false}),Object.freeze({wireCode:"tenant_has_no_capabilities",envelope:"http_envelope",httpStatus:409,retryable:false}),Object.freeze({wireCode:"tenant_resource_not_found",envelope:"http_envelope",httpStatus:404,retryable:false}),Object.freeze({wireCode:"tenant_surface_not_enabled",envelope:"http_envelope",httpStatus:409,retryable:false}),Object.freeze({wireCode:"timeout",envelope:"sse_frame",httpStatus:200,retryable:true}),Object.freeze({wireCode:"token_invalid",envelope:"http_envelope",httpStatus:422,retryable:false}),Object.freeze({wireCode:"unavailable",envelope:"sse_frame",httpStatus:200,retryable:true}),Object.freeze({wireCode:"unavailable",envelope:"http_envelope",httpStatus:503,retryable:true}),Object.freeze({wireCode:"unsupported_grant_type",envelope:"oauth_error",httpStatus:400,retryable:false}),Object.freeze({wireCode:"unsupported_response_type",envelope:"oauth_error",httpStatus:302,retryable:false}),Object.freeze({wireCode:"verify_mint_rate_limited",envelope:"http_envelope",httpStatus:429,retryable:true}),Object.freeze({wireCode:"verify_mint_refused",envelope:"http_envelope",httpStatus:403,retryable:false}),Object.freeze({wireCode:"verify_mint_unavailable",envelope:"http_envelope",httpStatus:503,retryable:true}),Object.freeze({wireCode:"verify_user_ref_invalid",envelope:"http_envelope",httpStatus:422,retryable:false}),Object.freeze({wireCode:"webhook_endpoint_update_empty",envelope:"http_envelope",httpStatus:400,retryable:false}),Object.freeze({wireCode:"webhook_endpoint_update_invalid",envelope:"http_envelope",httpStatus:400,retryable:false}),Object.freeze({wireCode:"webhook_url_rejected",envelope:"http_envelope",httpStatus:400,retryable:false})]);Object.freeze(lr.map(e=>e.wireCode));var gl=Object.freeze({ValidationException:"validationFailed",AuthorizationException:"authRejected",PaymentRequiredException:"paymentRequired",AccessDeniedException:"accessDenied",ResourceNotFoundException:"resourceNotFound",ConflictException:"conflict",ThrottlingException:"rateLimited",InternalFailureException:"internalError",NotImplementedException:"notImplemented",ServiceUnavailableException:"serviceUnavailable",MethodNotAllowedException:"validationFailed",authExpired:"authExpired",unavailable:"serviceUnavailable",session_required:"sessionRequired",accessDenied:"accessDenied",invalidRequest:"sdkUpdateRequired",authRejected:"authRejected",rateLimited:"rateLimited",insufficientCapability:"accessDenied",event_cursor_invalid:"validationFailed",event_filter_invalid:"validationFailed",event_payload_invalid:"validationFailed",event_type_unknown:"validationFailed",idempotency_key_invalid:"validationFailed",idempotency_key_required:"validationFailed",idempotency_key_reused:"idempotencyConflict",payload_too_large:"validationFailed",webhook_url_rejected:"validationFailed",webhook_endpoint_update_empty:"validationFailed",webhook_endpoint_update_invalid:"validationFailed",event_type_not_available:"conflict",record_subject_not_found:"resourceNotFound",records_consent_required:"conflict",record_species_unsupported:"validationFailed",record_upload_invalid:"validationFailed",FILE_TOO_LARGE:"validationFailed",INVALID_CONTENT_TYPE:"validationFailed",attachment_unreadable:"validationFailed",provider_unsupported:"validationFailed",token_invalid:"validationFailed",device_cipher_unavailable:"serviceUnavailable",email_invalid:"validationFailed",consent_required:"validationFailed",consent_invalid:"validationFailed",consent_scope_wrong_route:"validationFailed",IDEMPOTENCY_KEY_IN_FLIGHT:"idempotencyInFlight",IDEMPOTENCY_KEY_REUSED_DIFFERENT_REQUEST:"idempotencyConflict",DAILY_QUOTA_EXCEEDED:"quotaExceeded",TIER_UPGRADE_REQUIRED:"paymentRequired",not_found:"conversationNotFound",timeout:"streamTimeout",internal_error:"internalError",invalid_request:"validationFailed",invalid_client:"authRejected",invalid_grant:"authRejected",unsupported_grant_type:"validationFailed",invalid_scope:"validationFailed",invalid_target:"validationFailed",invalid_redirect_uri:"validationFailed",invalid_client_metadata:"validationFailed",unsupported_response_type:"validationFailed",access_denied:"accessDenied",slow_down:"rateLimited",mcp_request_not_found:"resourceNotFound",mcp_request_gone:"resourceNotFound",mcp_connection_not_found:"resourceNotFound",mcp_request_conflict:"conflict",sandbox_only:"accessDenied",tenant_has_no_capabilities:"conflict",verify_mint_refused:"accessDenied",verify_mint_rate_limited:"rateLimited",verify_mint_unavailable:"serviceUnavailable",verify_user_ref_invalid:"validationFailed",insufficient_scope:"accessDenied",tenant_filter_invalid:"validationFailed",tenant_resource_not_found:"resourceNotFound",tenant_surface_not_enabled:"conflict",pet_health_species_unsupported:"validationFailed",pet_health_list_removals_unconfirmed:"validationFailed",petRefInUse:"conflict",share_limit_reached:"conflict",pet_not_registered:"resourceNotFound",species_unsupported:"validationFailed",partner_visit_owner_only:"accessDenied",partner_visit_link_conflict:"conflict",partner_visit_pet_already_mapped:"conflict"}),Cn=Object.freeze(lr.map(e=>Object.freeze({wireCode:e.wireCode,envelope:e.envelope,retryable:e.retryable,normalized:gl[e.wireCode]}))),vl=new Map(Cn.map(e=>[e.envelope+e.wireCode.toUpperCase(),e])),bl=Object.freeze(["http_envelope",...[...new Set(Cn.map(e=>e.envelope))].filter(e=>e!=="http_envelope").sort()]);function ht(e,t){if(typeof e!="string")return;let r=e.trim().toUpperCase();if(r.length!==0)for(let n of [t??"http_envelope",...bl]){let i=vl.get(n+r);if(i)return i}}o(ht,"contractErrorFor");function hl(e){return e.envelope==="sse_frame"?`/errors#sse-${e.wireCode}`:e.envelope==="oauth_error"?`/errors#oauth-${e.wireCode}`:`/errors#${e.wireCode}`}o(hl,"contractDocUrl");function xn(e){return null}o(xn,"publishedDocUrl");var Tl=Object.freeze({authExpired:"authentication",authRejected:"authentication",sessionRequired:"authentication",accessDenied:"authorization",paymentRequired:"entitlement",quotaExceeded:"rateLimit",rateLimited:"rateLimit",validationFailed:"invalidRequest",sdkUpdateRequired:"invalidRequest",conversationNotFound:"notFound",petNotFound:"notFound",resourceNotFound:"notFound",conflict:"conflict",idempotencyConflict:"conflict",idempotencyInFlight:"conflict",streamTimeout:"connection",streamIncomplete:"connection",upstreamLlmTimeout:"connection",serviceUnavailable:"connection",internalError:"server",notImplemented:"server",mediaUploadFailed:"media",moderationBlocked:"policy",unknown:"unknown"});function wn(e){return Tl[e]}o(wn,"categoryFor");function Pn(e){let t=ht(e);if(t)return t.normalized;let r=(e??"").trim().toUpperCase(),n=r.replace(/[^A-Z0-9]/g,"");if(n==="AUTHREJECTED")return "authRejected";if(r.startsWith("AUTH"))return "authExpired";switch(n){case "DAILYQUOTAEXCEEDED":case "QUOTAEXCEEDED":return "quotaExceeded";case "RATELIMITED":case "TOOMANYREQUESTS":return "rateLimited";case "IDEMPOTENCYKEYCONFLICT":case "IDEMPOTENCYCONFLICT":return "idempotencyConflict";case "ACCESSDENIED":case "FORBIDDEN":return "accessDenied";case "NOTFOUND":case "CONVERSATIONNOTFOUND":return "conversationNotFound";case "PETNOTFOUND":return "petNotFound";case "TIMEOUT":case "STREAMTIMEOUT":return "streamTimeout";case "MEDIAUPLOADFAILED":case "UNRECOGNIZEDVIDEOFORMAT":case "FILETOOSMALL":return "mediaUploadFailed";case "MODERATIONBLOCKED":return "moderationBlocked";case "UPSTREAMLLMTIMEOUT":return "upstreamLlmTimeout";case "INTERNALERROR":case "INTERNALSERVERERROR":return "internalError";case "STREAMINCOMPLETE":case "CHATSTREAMINCOMPLETE":return "streamIncomplete";case "INVALIDANALYSISTYPE":case "INVALIDUPLOADPURPOSE":return "unknown";default:return "unknown"}}o(Pn,"fromWire");var El=new Set(["streamTimeout","rateLimited","internalError","upstreamLlmTimeout","streamIncomplete"]);function ar(e){return El.has(e)}o(ar,"isAutoRetryable");var kl=new Set(["serviceUnavailable","conflict","idempotencyInFlight"]);function In(e){return ar(e)||kl.has(e)}o(In,"isRetryableCode");var _l=500,sr=8e3,On=4;function An(e,t=Math.random){let r=Math.max(0,e),n=Math.min(_l*2**r,sr);return Math.floor(t()*n)}o(An,"backoffDelayMs");var Sl=Object.freeze({authExpired:"Please sign in again to continue.",authRejected:"Please sign in again to continue.",sessionRequired:"This app needs to be updated to keep using Everfur.",accessDenied:"This feature isn't available on your account right now.",paymentRequired:"This is part of a paid plan.",quotaExceeded:"You have used today's messages. This resets tomorrow.",rateLimited:"You are sending messages quickly. Try again in a few seconds.",validationFailed:"Something in that request was not right. Check the details and try again.",sdkUpdateRequired:"This app needs to be updated to keep using Everfur.",conflict:"That is already running. Wait for it to finish, then try again.",idempotencyConflict:"That message was already delivered.",idempotencyInFlight:"That is still processing. Give it a moment.",conversationNotFound:"This conversation is no longer available.",petNotFound:"We could not find that pet. Please pick a pet and try again.",resourceNotFound:"We could not find that.",streamTimeout:"The response timed out. Tap retry to try again.",mediaUploadFailed:"We could not upload that photo. Please attach it again.",moderationBlocked:"This request cannot be answered here.",upstreamLlmTimeout:"The response timed out. Tap retry to try again.",internalError:"We hit a snag on our end. Please try again.",notImplemented:"That is not available yet.",serviceUnavailable:"That service is briefly unavailable. Try again shortly.",streamIncomplete:"The connection dropped mid-answer. Tap retry to continue.",unknown:"Something went wrong. Please try again."});function dr(e){return Sl[e]}o(dr,"userFacingError");function Fn(e,t,r){Object.defineProperty(e,t,{value:r,enumerable:false,writable:false,configurable:false});}o(Fn,"defineHidden");var Rl=/^[a-z][a-z0-9_]{0,63}$/;function U(e,t){let r=ht(t?.wireCode,t?.wireEnvelope),n={code:e,category:wn(e),retryable:t?.retryable??In(e),displayMessage:dr(e)};if(t?.httpStatus!==void 0&&(n.httpStatus=t.httpStatus),t?.requestId&&(n.requestId=t.requestId),typeof t?.reasonCode=="string"&&Rl.test(t.reasonCode)&&(n.reasonCode=t.reasonCode),r);return t?.wireMessage&&Fn(n,"wireMessage",t.wireMessage),t?.raw!==void 0&&t.raw!==null&&Fn(n,"raw",t.raw),Object.freeze(n)}o(U,"makeEverfurError");var Cl=Object.freeze({chat:Object.freeze(["chat.message.create"]),records:Object.freeze(["records.upload.create","records.record.read"]),recordsClinic:Object.freeze(["records.clinic.create"]),video:Object.freeze(["video.gait.execute"]),photo:Object.freeze(["photo.checkup.execute"]),animations:Object.freeze(["animations.state.read"]),televet:Object.freeze(["televet.visit.create"])});function xl(e){return Cl[e]}o(xl,"requires");function Dn(e,t,r){let n=xl(e),i=new Map;for(let s of t)i.set(s.resource,s);if(r?.isPending===true&&n.some(s=>!i.has(s)))return ur({name:e,enabled:false,isPending:true,limits:{}});let l=wl(n,i);return n.filter(s=>i.get(s)?.granted!==true).length===0?ur({name:e,enabled:true,isPending:false,limits:l}):ur({name:e,enabled:false,isPending:false,limits:l,disabled:Pl(n,i)})}o(Dn,"decideCapability");function wl(e,t){let r={};for(let n of e){let i=t.get(n)?.limits;if(i)for(let[l,a]of Object.entries(i)){let s=r[l];r[l]=s===void 0?a:Math.min(s,a);}}return r}o(wl,"mergeLimits");function Pl(e,t){for(let r of e){let n=t.get(r)?.disabled;if(n)return Object.freeze({reason:n.reason,level:n.level,recoverable:n.recoverable})}return Object.freeze({reason:dr("accessDenied"),level:"user_entitlement",recoverable:false})}o(Pl,"disabledFor");function ur(e){let t={name:e.name,enabled:e.enabled,isPending:e.isPending,limits:Object.freeze({...e.limits})};return e.disabled!==void 0&&(t.disabled=e.disabled),Object.freeze(t)}o(ur,"freezeDecision");function F(e,t){return Object.freeze(t===void 0?{ok:true,value:e}:{ok:true,value:e,warning:t})}o(F,"ok");function R(e){return Object.freeze({ok:false,error:e})}o(R,"err");var Tt=class Tt extends Error{constructor(t,r){super(r),this.name="EverfurConfigError",this.kind=t,Object.setPrototypeOf(this,Tt.prototype);}};o(Tt,"EverfurConfigError");var Ze=Tt;var Vn=Symbol.for("@everfur/sdk#EverfurContext@v1"),Bn=globalThis,Nn=Bn[Vn]??(Bn[Vn]=createContext(null));Nn.displayName??="EverfurContext";function fe(){let e=useContext(Nn);if(e===null)throw new Ze("not-initialized","Everfur hooks must be called inside <EverfurProvider>. Wrap your tree once, high.");return e}o(fe,"useEverfurContext");function we(e){let{runtime:t}=fe(),r=t.entitlements,n=useSyncExternalStore(r.subscribe,r.getSnapshot,r.getSnapshot);return useMemo(()=>Dn(e,n.decisions,{isPending:n.isPending}),[e,n])}o(we,"useCapability");var Dl=48;function Vl(e){return e.isPending?"pending":e.enabled?"enabled":"disabled"}o(Vl,"selectView");function Mn(e){let{capability:t,children:r,renderDisabled:n,renderPending:i,style:l}=e,a=we(t),s=useMemo(()=>Vl(a),[a]);switch(s){case "enabled":return r;case "pending":return i?jsx(or,{render:i,fallback:jsx(zn,{capability:t,style:l})}):jsx(zn,{capability:t,style:l});case "disabled":return n?jsx(or,{render:()=>n(a),fallback:jsx(jn,{decision:a,style:l}),resetKey:a}):jsx(jn,{decision:a,style:l});default:return mt(s)}}o(Mn,"CapabilityGate");function zn({capability:e,style:t}){let r=C(),n=useMemo(()=>Hn(r),[r]);return jsx(View,{style:[n.offstate,t],accessible:true,accessibilityState:{busy:true},accessibilityLabel:`Loading ${e}`,children:jsx(View,{style:n.skeletonBar})})}o(zn,"PendingSkeleton");function jn({decision:e,style:t}){let r=C(),n=useMemo(()=>Hn(r),[r]),i=e.disabled?.reason??"";return jsx(View,{style:[n.offstate,t],accessible:true,accessibilityRole:"text",accessibilityLabel:i,children:i.length>0?jsx(b,{style:n.offstateText,children:i}):null})}o(jn,"OffState");function Hn(e){let{color:t,space:r,radius:n,type:i}=e;return StyleSheet.create({offstate:{minHeight:Dl,justifyContent:"center",paddingHorizontal:r.lg,paddingVertical:r.md,backgroundColor:t.surfaceCream,borderRadius:n.md,borderWidth:StyleSheet.hairlineWidth,borderColor:t.brandBorder},offstateText:{...E(e,"regular"),fontSize:i.size.body,lineHeight:Math.round(i.size.body*i.lineHeight.normal),color:t.text.muted},skeletonBar:{height:r.md,borderRadius:n.xs,backgroundColor:t.brandSofter}})}o(Hn,"makeStyles");function Et(e){let t=e.raw;if(typeof t!="object"||t===null)return null;let r=t,n=r.detail??r.error;return typeof n=="object"&&n!==null?n:r}o(Et,"details");function Bl(e){let t=Et(e)?.categories;return Array.isArray(t)?Object.freeze(t.filter(r=>typeof r=="string")):Object.freeze([])}o(Bl,"categoriesOf");function Un(e){let t=Et(e)?.retry_after_seconds;return typeof t=="number"&&Number.isFinite(t)&&t>0?t:null}o(Un,"retryAfterOf");function Wn(e){let t=e.wireMessage;if(typeof t=="string"&&t.trim().length>0)return t.trim();let r=Et(e)?.message;return typeof r=="string"&&r.trim().length>0?r.trim():null}o(Wn,"messageOf");function Nl(e){let t=e.reasonCode;if(typeof t=="string"&&t.length>0)return t;let r=Et(e),n=r?.code??r?.error_code;return typeof n=="string"&&n.length>0?n:null}o(Nl,"codeOf");function Pe(e){let t=e.httpStatus;if(t===402)return Object.freeze({kind:"not_entitled"});if(t===429||e.code==="rateLimited"||e.code==="quotaExceeded")return Object.freeze({kind:"rate_limited",retryAfterSeconds:Un(e),message:Wn(e)});if(t===404)return Object.freeze({kind:"unavailable"});switch(Nl(e)){case "televet_rate_limited":return Object.freeze({kind:"rate_limited",retryAfterSeconds:Un(e),message:Wn(e)});case "televet_emergency_ack_required":return Object.freeze({kind:"emergency",categories:Bl(e)});case "televet_not_entitled":return Object.freeze({kind:"not_entitled"});case "televet_slot_conflict":return Object.freeze({kind:"slot_taken"});case "televet_hold_invalid":return Object.freeze({kind:"slot_taken"});case "televet_clinician_cannot_prescribe":case "televet_clinician_unavailable":case "televet_clinician_not_bookable":return Object.freeze({kind:"clinician_unavailable"});case "televet_membership_conflict":return Object.freeze({kind:"not_entitled"});case "televet_registry_unavailable":return Object.freeze({kind:"failed"});}return Object.freeze({kind:"failed"})}o(Pe,"televetBookingRefusal");function Ll(e){let t={};return e.mode==="personalized"?t.authorization=`Bearer ${e.token}`:t["x-everfur-partner-key"]=e.publishableKey,e.userRef&&(t["x-everfur-user-ref"]=e.userRef),e.sessionId&&(t["x-everfur-session-id"]=e.sessionId),t}o(Ll,"authHeaders");function Je(e,t){return {...e,headers:{...zl(e.headers),...Ll(t)}}}o(Je,"withAuthHeaders");function zl(e){if(!e)return {};let t={};for(let[r,n]of Object.entries(e)){let i=r.toLowerCase();i==="authorization"||i==="x-everfur-partner-key"||(t[r]=n);}return t}o(zl,"stripAuthHeaders");async function qn(e,t){if(t.mode==="anonymous")return t.transport.request(Je(e,{mode:"anonymous",publishableKey:t.publishableKey,userRef:t.userRef,...t.sessionId?{sessionId:t.sessionId}:{}}));let r;try{r=await t.identity.currentToken();}catch{return R(pr())}let n=await t.transport.request(Je(e,{mode:"personalized",token:r,userRef:t.userRef,...t.sessionId?{sessionId:t.sessionId}:{}}));if(n.ok||n.error.httpStatus!==401)return n;let i;try{i=await t.identity.currentToken({forceRefresh:!0});}catch{return R(pr())}let l=await t.transport.request(Je(e,{mode:"personalized",token:i,userRef:t.userRef,...t.sessionId?{sessionId:t.sessionId}:{}}));return !l.ok&&l.error.httpStatus===401?R(pr(l.error.httpStatus)):l}o(qn,"authedSend");function pr(e){return U("authRejected",{retryable:false,...e!==void 0?{httpStatus:e}:{}})}o(pr,"authRejectedError");function Kn(e){return U("internalError",{retryable:true,wireMessage:jl(e)})}o(Kn,"networkError");function jl(e){return e instanceof Error?e.message:typeof e=="string"?e:"network request failed"}o(jl,"describeCause");var Ml=3e4,Hl=sr*2,Ul="idempotency-key",Wl=new Set(["POST","PUT","PATCH","DELETE"]),ql=Object.freeze({onEvent(){}}),Kl=Object.freeze({setTimeout:o((e,t)=>setTimeout(e,t),"setTimeout"),clearTimeout:o(e=>clearTimeout(e),"clearTimeout"),now:o(()=>Date.now(),"now")});function $l(e){let t=e.trim().replace(/[^A-Za-z0-9_.:-]/g,"-");return t.length===0?null:`efs_${t}`.slice(0,128)}o($l,"seededIdempotencyKey");function Ie(e){let t=e.observer??ql,r=e.timers??Kl,n=e.rng??Math.random,i=e.sleep??((p,y)=>la(p,r,y)),l=e.maxAttempts??On,a=e.unaryTimeoutMs??Ml,s=e.newIdempotencyKey??Gl(),u=o(p=>{try{t.onEvent(p);}catch{}},"emit");async function d(p,y,h){let x=h?.maxAttempts,T=Math.max(1,x??l),_=h?.idempotent??Wl.has(y.method),V=h?.idempotencyKey===void 0?null:$l(h.idempotencyKey),w=_?V??s():null,O=Yl(y,w),P=0;for(;;){let I=o(ee=>Object.freeze({call:p,method:y.method,path:y.path,attempt:P,...w?{idempotencyKey:w}:{},...ee}),"stamp");u(I({phase:"attempt"}));let te=oa(a,r),Q=ia(te.signal,y.signal),B;try{B=await qn({...O,signal:Q.signal},e.auth);}catch(ee){B=R(Kn(ee));}finally{Q.dispose(),te.cancel();}if(B.ok)return u(I({phase:"settled",ok:true,reason:"ok"})),B;let k=B.error,A=Ql(k,P,{maxAttempts:T,rng:n,now:r.now(),aborted:y.signal?.aborted===true,...x!==void 0?{perCallMaxAttempts:x}:{},...e.errorPolicy!==void 0?{policy:e.errorPolicy}:{}}),Z={ok:false,code:k.code,reason:A.reason,...k.httpStatus!==void 0?{httpStatus:k.httpStatus}:{},...k.requestId!==void 0?{requestId:k.requestId}:{}};if(!A.retry)return u(I({phase:"settled",...Z})),R(k);if(u(I({phase:"retry",...Z,delayMs:A.delayMs})),await i(A.delayMs,y.signal),y.signal?.aborted===true)return u(I({phase:"settled",...Z,reason:"aborted"})),R(k);P+=1;}}o(d,"send");async function f(p){return Je(p,await na(e.auth))}o(f,"authorize");async function*v(p,y,h){u(Object.freeze({call:p,phase:"stream.open",method:y.method,path:y.path,attempt:0}));try{yield*e.auth.transport.stream(y,h);}catch{yield un({code:"internal_error",retryable:true,wireMessage:null,synthesized:true,lastEventId:null,serverRequestId:null});}}return o(v,"stream"),Object.freeze({send:d,authorize:f,stream:v})}o(Ie,"createRequestFunnel");function Yl(e,t){let r={};for(let[n,i]of Object.entries(e.headers??{}))n.toLowerCase()!==Ul&&(r[n]=i);return t!==null&&(r["Idempotency-Key"]=t),{...e,headers:r}}o(Yl,"assembleHeaders");function Gl(){let e=0;return ()=>`efk_${Date.now().toString(36)}_${(e++).toString(36)}_${Math.random().toString(36).slice(2,12)}`}o(Gl,"defaultIdempotencyKeyFactory");var Xl=10;function Ql(e,t,r){if(r.aborted)return {retry:false,reason:"aborted"};let n=Zl(e);if(n==="quota")return {retry:false,reason:"daily-quota-exhausted"};if(n!=="burst"&&!ar(e.code))return {retry:false,reason:"terminal-code"};let i=n==="burst"?"burst-throttle":"retryable-code";if(o(()=>{if(r.policy===void 0)return false;try{return !r.policy.shouldRetry(e.code,t)}catch{return false}},"policyVetoedRetry")())return {retry:false,reason:"terminal-code"};let a=o(()=>{if(r.policy===void 0)return null;let d;try{d=r.policy.maxAttempts(e.code);}catch{return null}return typeof d!="number"||!Number.isFinite(d)?null:Math.max(1,Math.min(Xl,Math.floor(d)))},"policyCeiling"),s=r.perCallMaxAttempts??a()??r.maxAttempts;if(t+1>=s)return {retry:false,reason:"attempts-exhausted"};let u=Jl(e,r.now);return u!==null?u>Hl?{retry:false,reason:"server-reset-beyond-budget"}:{retry:true,reason:i,delayMs:u}:{retry:true,reason:i,delayMs:An(t,r.rng)}}o(Ql,"decideRetry");function Zl(e){let t=e.code==="unknown"?Pn(ra(e.raw)):e.code;return t==="quotaExceeded"?"quota":t==="rateLimited"||e.httpStatus===429?"burst":null}o(Zl,"throttleKind");function Jl(e,t){let r=ea(e.raw);if(r===null)return null;let n=r-t;return n>0?n:0}o(Jl,"retryOverrideMs");function ea(e){for(let t of Yn(e)){let r=t.resets_at,n=ta(r);if(n!==null)return n}return null}o(ea,"findResetsAt");function Yn(e){if(!$n(e))return [];let t=[e];for(let r of ["error","detail"]){let n=e[r];$n(n)&&t.push(n);}return t}o(Yn,"candidateScopes");function ta(e){if(typeof e=="number"&&Number.isFinite(e))return e<1e11?Math.round(e*1e3):Math.round(e);if(typeof e=="string"&&e.trim().length>0){let t=Date.parse(e);return Number.isFinite(t)?t:null}return null}o(ta,"parseInstantMs");function ra(e){for(let t of Yn(e)){let r=t.code;if(typeof r=="string"&&r.length>0)return r}return null}o(ra,"rawWireCode");function $n(e){return typeof e=="object"&&e!==null}o($n,"isRecord");async function na(e){return e.mode==="anonymous"?{mode:"anonymous",publishableKey:e.publishableKey,userRef:e.userRef,...e.sessionId?{sessionId:e.sessionId}:{}}:{mode:"personalized",token:await e.identity.currentToken(),userRef:e.userRef,...e.sessionId?{sessionId:e.sessionId}:{}}}o(na,"resolveDeviceAuth");function oa(e,t){let r=new AbortController,n=t.setTimeout(()=>r.abort(),e);return {signal:r.signal,cancel:o(()=>t.clearTimeout(n),"cancel")}}o(oa,"boundedSignal");function ia(e,t){let r=o(()=>{},"noop");if(!t)return {signal:e,dispose:r};let n=new AbortController;if(e.aborted||t.aborted)return n.abort(),{signal:n.signal,dispose:r};let i=o(()=>n.abort(),"onAbort");return e.addEventListener("abort",i,{once:true}),t.addEventListener("abort",i,{once:true}),{signal:n.signal,dispose:o(()=>{e.removeEventListener("abort",i),t.removeEventListener("abort",i);},"dispose")}}o(ia,"mergeSignals");function la(e,t,r){return e<=0||r?.aborted===true?Promise.resolve():new Promise(n=>{let i=t.setTimeout(()=>{r?.removeEventListener("abort",l),n();},e),l=o(()=>{t.clearTimeout(i),n();},"onAbort");r?.addEventListener("abort",l,{once:true});})}o(la,"delayAbortable");function kt(e){for(let t=0;t<e.length;t+=1){let r=e.charCodeAt(t);if(r>=55296&&r<=56319){let n=e.charCodeAt(t+1);if(!(n>=56320&&n<=57343))return true;t+=1;}else if(r>=56320&&r<=57343)return true}return false}o(kt,"hasLoneSurrogate");function _t(e){return [...e].length}o(_t,"serverLength");var Gn=Object.freeze({dog:"dog",canine:"dog",k9:"dog",puppy:"dog",cat:"cat",feline:"cat",kitten:"cat"});function Xn(e){if(typeof e!="string")return null;let t=e.trim().toLowerCase();return Object.prototype.hasOwnProperty.call(Gn,t)?Gn[t]:null}o(Xn,"canonicalPetSpecies");var Qn=50,aa=128,yr=120,Zn=120,sa=2e3,Jn=120,da=80,ro=new Set(["male","female","unknown"]),no=new Set(["day","month","year"]),oo=new Set(["low","medium","high","athletic"]),io=new Set(["indoor","outdoor","both"]),lo=new Set(["mild","moderate","severe"]),ua=/^(\d{4})-(\d{2})-(\d{2})$/,ao=[["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"]],so=[["allergies","allergies"],["medications","medications"],["supplements","supplements"],["conditions","conditions"]];Object.freeze([...ao,...so].map(([e])=>e));function ca(e){let t=ua.exec(e);if(t===null)return false;let[r,n,i]=[Number(t[1]),Number(t[2]),Number(t[3])],l=new Date(Date.UTC(r,n-1,i));return l.getUTCFullYear()===r&&l.getUTCMonth()===n-1&&l.getUTCDate()===i}o(ca,"isRealDate");var tt=o(e=>(t,r)=>typeof r=="string"&&e.has(r)?null:`${t} must be one of ${[...e].join(", ")}`,"oneOf"),fa=o((e,t)=>typeof t=="boolean"?null:`${e} must be true or false`,"boolean"),Rt=o((e,t)=>typeof t=="string"&&ca(t)?null:`${e} must be a real date written YYYY-MM-DD`,"date"),oe=o((e,t={})=>(r,n)=>{if(typeof n!="string")return `${r} must be a string`;if(kt(n))return `${r} contains an unpaired surrogate and cannot be encoded`;let i=t.trimmed?n.trim():n;if(t.required&&i.length===0)return `${r} is required and must not be blank`;let l=_t(i);return l<=e?null:`${r} is ${l} characters; the server accepts at most ${e}`},"text"),pa={sex:tt(ro),spayedNeutered:fa,birthDate:Rt,birthDatePrecision:tt(no),activityLevel:tt(oo),indoorOutdoor:tt(io),foodBrand:oe(Jn),foodType:oe(Jn),microchipId:oe(da)},mr=["ref","ref",false,oe(aa,{required:true,trimmed:true})],gr=["notes","notes",false,oe(sa,{trimmed:true})],eo=[mr,["name","name",true,oe(yr,{required:true,trimmed:true})],["dose","dose",false,oe(Zn,{trimmed:true})],["frequency","frequency",false,oe(Zn,{trimmed:true})],["startDate","start_date",false,Rt],["endDate","end_date",false,Rt],gr],ya={allergies:[mr,["allergen","allergen",true,oe(yr,{required:true,trimmed:true})],["severity","severity",false,tt(lo)],gr],medications:eo,supplements:eo,conditions:[mr,["conditionName","condition_name",true,oe(yr,{required:true,trimmed:true})],["diagnosedDate","diagnosed_date",false,Rt],gr]};function ma(e,t,r){let n=`${e}[${t}]`;if(typeof r!="object"||r===null||Array.isArray(r))return {error:`${n} must be an object`};let i=r,l={};for(let[u,d,f,v]of ya[e]){let p=i[u];if(p==null){if(f)return {error:`${n}.${u} is required`};p===null&&(l[d]=null);continue}let y=v(`${n}.${u}`,p);if(y!==null)return {error:y};l[d]=p;}let a=l.start_date,s=l.end_date;return typeof a=="string"&&typeof s=="string"&&s<a?{error:`${n}.endDate must not be before startDate`}:{item:l}}o(ma,"itemToWire");function ga(e,t){if(!Array.isArray(t))return {error:`${e} must be an array (send [] to clear it)`};if(t.length>Qn)return {error:`${e} has ${t.length} items; the server accepts at most ${Qn}`};let r=[],n=new Set;for(let i=0;i<t.length;i+=1){let l=ma(e,i,t[i]);if("error"in l)return l;let a=l.item.ref;if(typeof a=="string"){let s=a.trim();if(n.has(s))return {error:`${e}: ref ${JSON.stringify(s)} is used twice; a ref names one item`};n.add(s);}r.push(l.item);}return {items:r}}o(ga,"listToWire");function uo(e,t){let r=e,n={};for(let[a,s]of ao){let u=r[a];if(u!==void 0){if(u!==null){let d=pa[a](a,u);if(d!==null)return {error:d}}n[s]=u;}}let i=r.birthDate!==void 0,l=r.birthDatePrecision!==void 0;if(i!==l||i&&r.birthDate===null!=(r.birthDatePrecision===null))return {error:"birthDate and birthDatePrecision must be sent together, both set or both null"};for(let[a,s]of so){let u=r[a];if(u===void 0)continue;let d=ga(a,u);if("error"in d)return d;n[s]=d.items;}return Object.keys(n).length>0&&t!==void 0&&Xn(t)===null?{error:"health fields need a pet Everfur reads as a dog or a cat (dog, canine, k9, puppy, cat, feline, kitten)"}:{body:n}}o(uo,"petHealthToWire");var z=o(e=>typeof e=="string"?e:null,"str"),et=o((e,t)=>typeof t=="string"&&e.has(t)?t:null,"pick"),va=o(e=>typeof e=="boolean"?e:null,"bool");function St(e,t){return Array.isArray(e)?Object.freeze(e.flatMap(r=>{if(typeof r!="object"||r===null||Array.isArray(r))return [];let n=t(r);return n===null?[]:[n]})):Object.freeze([])}o(St,"itemsFromWire");function to(e){let t=z(e.name);return t===null||t.length===0?null:Object.freeze({ref:z(e.ref),name:t,dose:z(e.dose),frequency:z(e.frequency),startDate:z(e.start_date),endDate:z(e.end_date),notes:z(e.notes)})}o(to,"medicationFromWire");function co(e){let t=e.profile_version;return Object.freeze({profileVersion:typeof t=="number"&&Number.isInteger(t)&&t>=0?t:0,sex:et(ro,e.sex),spayedNeutered:va(e.spayed_neutered),birthDate:z(e.birth_date),birthDatePrecision:et(no,e.birth_date_precision),activityLevel:et(oo,e.activity_level),indoorOutdoor:et(io,e.indoor_outdoor),foodBrand:z(e.food_brand),foodType:z(e.food_type),microchipId:z(e.microchip_id),allergies:St(e.allergies,r=>{let n=z(r.allergen);return n===null||n.length===0?null:Object.freeze({ref:z(r.ref),allergen:n,severity:et(lo,r.severity),notes:z(r.notes)})}),medications:St(e.medications,to),supplements:St(e.supplements,to),conditions:St(e.conditions,r=>{let n=z(r.condition_name);return n===null||n.length===0?null:Object.freeze({ref:z(r.ref),conditionName:n,diagnosedDate:z(r.diagnosed_date),notes:z(r.notes)})})})}o(co,"petHealthFromWire");var yo=100,mo=50,go=100,vo=50,bo=500,ba=128,ha=6e4;function le(e){return U("validationFailed",{retryable:false,wireMessage:e})}o(le,"invalid");function Oe(e,t,r){if(typeof t!="string")return le(`${e} must be a string`);let n=_t(t);return n<=r?null:le(`${e} is ${n} characters; the server accepts at most ${r}`)}o(Oe,"checkString");function Ct(e,t,r){return typeof t=="number"&&Number.isFinite(t)&&t>=0&&t<=r?null:le(`${e} must be a finite number between 0 and ${r}`)}o(Ct,"outOfRange");function fo(e,t){if(typeof e!="string")return le("pet_ref must be a string");if(e.trim().length===0)return le("pet_ref must not be blank");if(kt(e))return le("pet_ref contains an unpaired surrogate and cannot be encoded");if(t!=null&&typeof t!="object")return le("profile must be an object");let r=[Oe("pet_ref",e,ba)];return t?.name!==void 0&&r.push(Oe("name",t.name,yo)),t?.species!==void 0&&r.push(Oe("species",t.species,mo)),t?.breed!==void 0&&r.push(Oe("breed",t.breed,go)),t?.ageYears!==void 0&&r.push(Ct("age_years",t.ageYears,vo)),t?.weightKg!==void 0&&r.push(Ct("weight_kg",t.weightKg,bo)),r.find(n=>n!==null)??null}o(fo,"validate");function ho(e,t){let r=uo(e,t);return "error"in r?{error:le(r.error)}:r}o(ho,"healthToWire");function Ta(e){if(typeof e!="object"||e===null)return {error:le("patch must be an object")};let t=e,r=[["name","name",l=>Oe("name",l,yo)],["species","species",l=>Oe("species",l,mo)],["breed","breed",l=>Oe("breed",l,go)],["ageYears","age_years",l=>Ct("age_years",l,vo)],["weightKg","weight_kg",l=>Ct("weight_kg",l,bo)]],n={};for(let[l,a,s]of r){let u=t[l];if(u!==void 0){if(u!==null){let d=s(u);if(d!==null)return {error:d}}n[a]=u;}}let i=ho(t,t.species);return "error"in i?i:(Object.assign(n,i.body),Object.keys(n).length===0?{error:le("patch must change at least one field")}:{body:n})}o(Ta,"patchToWire");function Ea(e){if(e==null)return {body:{}};let t=ho(e,e.species);return "error"in t?t:{body:{...e.name!==void 0?{name:e.name}:{},...e.species!==void 0?{species:e.species}:{},...e.breed!==void 0?{breed:e.breed}:{},...e.ageYears!==void 0?{age_years:e.ageYears}:{},...e.weightKg!==void 0?{weight_kg:e.weightKg}:{},...t.body}}}o(Ea,"toWire");var ie=o(e=>typeof e=="string"?e:null,"str"),xt=o(e=>typeof e=="number"&&Number.isFinite(e)?e:null,"num");function po(e,t){let r=typeof e=="object"&&e!==null?e:{};return Object.freeze({petRef:ie(r.pet_ref)??t,name:ie(r.name),species:ie(r.species),breed:ie(r.breed),ageYears:xt(r.age_years),weightKg:xt(r.weight_kg)})}o(po,"fromWire");function To(e){if(typeof e!="object"||e===null)return null;let t=e,r=ie(t.pet_ref);return r===null||r.length===0?null:Object.freeze({petId:ie(t.pet_id),petRef:r,name:ie(t.name),species:ie(t.species),breed:ie(t.breed),ageYears:xt(t.age_years),weightKg:xt(t.weight_kg),updatedAt:ie(t.updated_at)})}o(To,"widgetPetFromWire");function ka(e){let t=To(e);return t===null?null:Object.freeze({...t,...co(e)})}o(ka,"widgetPetProfileFromWire");function _a(e){let t=Array.isArray(e)?e:typeof e=="object"&&e!==null&&Array.isArray(e.pets)?e.pets:[];return Object.freeze(t.flatMap(r=>{let n=To(r);return n===null?[]:[n]}))}o(_a,"petListFromWire");function Eo(e){return Sa(Ie({auth:e}),Ie({auth:e,unaryTimeoutMs:ha}))}o(Eo,"createPetsRepository");function Sa(e,t=e){let r=o((i,l)=>l?{...i,signal:l}:i,"withSignal"),n=o(i=>fo(i,void 0)??`/widget/v1/pets/${encodeURIComponent(i)}`,"petPath");return {async list(i){let l=await e.send("pets.list",r({method:"GET",path:"/widget/v1/pets"},i?.signal));return l.ok?F(_a(l.value)):R(l.error)},async registerPet(i,l,a){let s=fo(i,l);if(s!==null)return R(s);let u=Ea(l);if("error"in u)return R(u.error);let f={method:"POST",path:`/widget/v1/pets/${encodeURIComponent(i)}`,body:u.body},v=await e.send("pets.registerPet",a?.signal?{...f,signal:a.signal}:f);return v.ok?F(po(v.value,i)):R(v.error)},async updatePet(i,l,a){let s=n(i);if(typeof s!="string")return R(s);let u=Ta(l);if("error"in u)return R(u.error);let d=await e.send("pets.updatePet",r({method:"PATCH",path:s,body:u.body},a?.signal));return d.ok?F(po(d.value,i)):R(d.error)},async getPetProfile(i,l){let a=n(i);if(typeof a!="string")return R(a);let s=await e.send("pets.getPetProfile",r({method:"GET",path:`${a}/profile`},l?.signal));if(!s.ok)return R(s.error);let u=ka(s.value);return u===null?R(U("internalError",{retryable:false,httpStatus:502,wireMessage:"the pet profile response carried no pet_ref"})):F(u)},async deletePet(i,l){let a=n(i);if(typeof a!="string")return R(a);let s=await e.send("pets.deletePet",r({method:"DELETE",path:a},l?.signal));return s.ok?F(void 0):R(s.error)},async eraseUserData(i){let l=await t.send("pets.eraseUserData",r({method:"DELETE",path:"/widget/v1/me"},i?.signal),{maxAttempts:1});return l.ok?F(void 0):R(l.error)}}}o(Sa,"createPetsRepositoryOver");function ko(){let{runtime:e,userRef:t,activePet:r,scopeEpoch:n}=fe(),i=useMemo(()=>Eo(e.registry.services.authFor(t)),[e,t,n]),[l,a]=useState({repository:i,pets:[],loading:true,error:null}),s=l.repository===i?l:{pets:[],loading:true,error:null},u=useRef(0),d=useCallback(async()=>{let v=++u.current;a(y=>({...y,repository:i,loading:true,error:null,pets:y.repository===i?y.pets:[]}));let p=await i.list();v===u.current&&a(p.ok?{repository:i,pets:p.value,loading:false,error:null}:y=>({repository:i,pets:y.repository===i?y.pets:[],loading:false,error:p.error}));},[i]);useEffect(()=>(d(),()=>{u.current+=1;}),[d]);let f=useMemo(()=>r===null?null:s.pets.find(v=>v.petRef===r)??null,[r,s.pets]);return useMemo(()=>({pets:s.pets,activePet:f,loading:s.loading,error:s.error,refresh:d}),[s.pets,s.loading,s.error,f,d])}o(ko,"useEverfurPets");var Ro=["scheduled","in_progress","awaiting_summary","completed","cancelled_owner","cancelled_ops","no_show_owner","no_show_vet"],Pa=new Set(["completed","cancelled_owner","cancelled_ops","no_show_owner","no_show_vet"]),Co=["wellness","prescription"],wt=64,pe=2e3,Pt=10;function ae(e){return typeof e=="string"&&/^[A-Za-z]{2}$/.test(e.trim())}o(ae,"isWellFormedStateCode");function he(e){return typeof e=="object"&&e!==null?e:null}o(he,"row");function W(e){return typeof e=="string"&&e.length>0?e:null}o(W,"str");function Ae(e){return typeof e=="string"&&e.trim().length>0?e.trim():null}o(Ae,"trimmedOrNull");function rt(e,t){return typeof e=="boolean"?e:t}o(rt,"bool");function _o(e){return typeof e=="number"&&Number.isFinite(e)?e:null}o(_o,"num");function So(e,t){return typeof t=="string"&&e.includes(t)?t:"unknown"}o(So,"closed");function nt(e,t){if(!Array.isArray(e))return Object.freeze([]);let r=[];for(let n of e){let i=t(n);i!==null&&r.push(i);}return Object.freeze(r)}o(nt,"parseList");function xo(e,t){let r=he(e);return r===null?null:Object.freeze({state:W(r.state)??t,wellnessAvailable:rt(r.wellness_available,false),prescriptionsAvailable:rt(r.prescriptions_available,false),cancellationPolicyText:Ae(r.cancellation_policy_text)})}o(xo,"parseStatePolicy");function wo(e){let t=he(e);if(t===null)return null;let r=Ae(t.summary),n=Ae(t.version);return r===null||n===null?null:Object.freeze({summary:r,version:n})}o(wo,"parseCancellationPolicy");function Po(e){let t=he(e);if(t===null)return null;let r=W(t.clinician_id),n=W(t.display_name);return r===null||n===null?null:Object.freeze({clinicianId:r,displayName:n,credentials:Ae(t.credentials_text),rating:_o(t.rating),ratingCount:_o(t.rating_count),bio:Ae(t.bio),photoRef:W(t.photo_ref),licensedStates:nt(t.licensed_states,i=>{let l=he(i),a=l===null?null:W(l.state);return a===null?null:Object.freeze({state:a,canPrescribe:rt(l?.can_prescribe,false)})})})}o(Po,"parseClinician");function br(e){let t=he(e);if(t===null)return null;let r=W(t.slot_id),n=W(t.starts_at);return r===null||n===null?null:Object.freeze({slotId:r,startsAt:n,endsAt:W(t.ends_at)??n})}o(br,"parseSlot");function Io(e){let t=he(e);if(t===null)return null;let r=W(t.slot_id),n=W(t.hold_expires_at);return r===null||n===null?null:Object.freeze({slotId:r,expiresAt:n})}o(Io,"parseSlotHold");function hr(e){let t=he(e);if(t===null)return null;let r=W(t.consult_id),n=W(t.scheduled_at);return r===null||n===null?null:Object.freeze({consultId:r,petId:W(t.pet_id)??"",clinicianId:W(t.clinician_id)??"",clinicianName:Ae(t.display_name),reasonText:Ae(t.reason_text),mediaRefs:nt(t.media_refs,i=>W(i)),status:So(Ro,t.status),kind:So(Co,t.kind),scheduledAt:n,emergencyFlagged:rt(t.emergency_flagged,false)})}o(hr,"parseConsult");function Oo(e){let t=he(e);return Object.freeze({active:rt(t?.active,false)})}o(Oo,"parseBookingEntitlement");var Fe=Object.freeze(["pet","reason","clinician","time","review","booked"]),Ao=Object.freeze({petId:null,state:null,clinicianId:null,slot:null,holdExpiresAt:null,shareHealthRecords:false,idempotencyKey:null});function Er(e,t={}){let r=Object.freeze({...Ao,...t}),n=Tr(0,e);return Object.freeze({index:n,draft:r,furthestIndex:n})}o(Er,"initialTelevetBookingState");function It(e,t){return e==="pet"?t.ownedPetCount<=1:false}o(It,"isSkipped");function Ot(e){return Fe[e]}o(Ot,"stepAt");function Tr(e,t){for(let r=e;r<Fe.length;r+=1){let n=Ot(r);if(n&&!It(n,t))return r}return Fe.length-1}o(Tr,"nextVisible");function Fo(e,t){for(let r=e;r>=0;r-=1){let n=Ot(r);if(n&&!It(n,t))return r}return null}o(Fo,"previousVisible");function kr(e,t){return Fo(e.index-1,t)!==null}o(kr,"hasPreviousStep");function _r(e,t,r){switch(t.type){case "patch":{let n={...e.draft,...t.patch};return ("petId"in t.patch&&t.patch.petId!==e.draft.petId||"state"in t.patch&&t.patch.state!==e.draft.state||"clinicianId"in t.patch&&t.patch.clinicianId!==e.draft.clinicianId)&&e.draft.slot?Object.freeze({...e,draft:Object.freeze({...n,slot:null,holdExpiresAt:null,idempotencyKey:null})}):Object.freeze({...e,draft:Object.freeze(n)})}case "next":{let n=Tr(e.index+1,r);return Object.freeze({...e,index:n,furthestIndex:Math.max(e.furthestIndex,n)})}case "back":{if(Ot(e.index)==="booked")return e;let n=Fo(e.index-1,r);return n===null?e:Object.freeze({...e,index:n})}case "goTo":{let n=Fe.indexOf(t.step);if(n<0)return e;let i=It(t.step,r)?Tr(n,r):n;return Object.freeze({...e,index:i,furthestIndex:Math.max(e.furthestIndex,i)})}default:return e}}o(_r,"televetBookingReducer");function Sr(e){return Ot(e.index)??"pet"}o(Sr,"currentStep");function At(e,t){let r=t.trim();return !!e.petId&&!!e.clinicianId&&!!e.slot&&ae(e.state)&&r.length>0&&r.length<=pe}o(At,"canConfirm");function Rr(e,t){if(!e.holdExpiresAt)return false;let r=Date.parse(e.holdExpiresAt);return Number.isNaN(r)?false:r<=t}o(Rr,"isHoldExpired");function Cr(e){return `televet.book.${e}`}o(Cr,"televetBookingKey");function xr(e,t,r){let n=r?.version?.trim()??"";return !e||!t||n.length===0?Object.freeze({}):Object.freeze({state_attested:true,cancellation_policy_version:n})}o(xr,"attestation");function Te(e){let t=new Date(e);return Number.isNaN(t.getTime())?null:t}o(Te,"parse");function Me(e){let t=Te(e);return t?t.toLocaleTimeString(void 0,{hour:"numeric",minute:"2-digit"}):""}o(Me,"formatClock");function Ia(e){let t=Te(e);return t?t.toLocaleDateString(void 0,{month:"long",day:"numeric"}):""}o(Ia,"formatDate");var He=10;function ot(e){let t=Te(e);return t?new Intl.DateTimeFormat(void 0,{timeZoneName:"short"}).formatToParts(t).find(n=>n.type==="timeZoneName")?.value??"":""}o(ot,"formatZone");function Oa(e){let t=Te(e);if(!t)return "";let r=new Date(t.getTime()+He*6e4).toISOString(),n=ot(e),i=`${Me(e)} - ${Me(r)}`;return n&&n!==""?`${i} ${n}`:i}o(Oa,"formatVisitRange");function Do(e){let t=Ia(e),r=[Me(e),ot(e)].filter(Boolean).join(" ");return [t,r].filter(Boolean).join(", ")}o(Do,"formatWhen");function ye(e){let t=Te(e);return t?[t.toLocaleDateString(void 0,{weekday:"short"}),Do(e)].filter(Boolean).join(", "):""}o(ye,"formatWhenWithDay");function Ft(e){let t=Te(e);return t?`${t.getFullYear()}-${t.getMonth()+1}-${t.getDate()}`:"unknown"}o(Ft,"localDayKey");function Vo(e){let t=Te(e);return t===null?"":t.toLocaleDateString(void 0,{month:"long"})}o(Vo,"formatMonthLabel");function Bo(e){let t=Te(e);return t===null?"":t.toLocaleDateString(void 0,{weekday:"long",month:"long",day:"numeric"})}o(Bo,"formatFullDayLabel");var ke="/widget/v1/televet",Aa=`${ke}/state-policy`,Fa=`${ke}/vets`,Lo=`${ke}/slots`,Da=`${ke}/slots/next`,zo=`${ke}/consults`,Va=`${ke}/entitlement`,Ba=`${ke}/cancellation-policy`;function jo(e){return `${Lo}/${encodeURIComponent(e)}/hold`}o(jo,"televetHoldCall");function Mo(e){return `${zo}/${encodeURIComponent(e)}/reschedule`}o(Mo,"televetRescheduleCall");function Ee(e){return R(U("validationFailed",{retryable:false,wireMessage:e}))}o(Ee,"invalid");function Dt(e){return R(U("internalError",{retryable:false,httpStatus:502,wireMessage:e}))}o(Dt,"unusable");function Vt(e){return e.httpStatus===404}o(Vt,"isDark");function wr(e,t,r){try{e?.track(t,r);}catch{}}o(wr,"safeTrack");function Ho(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(!ae(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>pe?`reason_text must be at most ${pe} characters`:Na(e)}o(Ho,"validateBookingBody");function Na(e){let t=e.state_attested===true,r=e.cancellation_policy_version?.trim()??"";return t!==r.length>0?"state_attested and cancellation_policy_version must be sent together or omitted together":r.length>wt?`cancellation_policy_version must be at most ${wt} characters`:null}o(Na,"attestationRefusal");function Pr(e){let t=e.funnel??Ie({auth:e.auth,...e.errorPolicy?{errorPolicy:e.errorPolicy}:{}}),r=e.telemetry;return {async statePolicy(n,i){let l=n.trim();if(!ae(l))return Ee("state must be a two-letter US state code");let a=await t.send("televet.booking.state_policy",{method:"GET",path:`${Aa}/${encodeURIComponent(l)}`,...i?{signal:i}:{}});if(!a.ok)return Vt(a.error)?F(Object.freeze({state:l,wellnessAvailable:false,prescriptionsAvailable:false,cancellationPolicyText:null})):R(a.error);let s=xo(a.value,l);return s===null?Dt("the state policy response was unreadable"):F(s)},async entitlement(n){let i=await t.send("televet.booking.entitlement",{method:"GET",path:Va,...n?{signal:n}:{}});return i.ok?F(Oo(i.value)):Vt(i.error)?F(Object.freeze({active:false})):R(i.error)},async cancellationPolicy(n){let i=await t.send("televet.booking.cancellation_policy",{method:"GET",path:Ba,...n?{signal:n}:{}});return i.ok?F(wo(i.value)):F(null)},async clinicians(n,i){let l=n.trim();if(!ae(l))return Ee("state must be a two-letter US state code");let a=await t.send("televet.booking.clinicians",{method:"GET",path:Fa,query:{state:l},...i?{signal:i}:{}});return a.ok?F(nt(No(a.value,"vets"),Po)):Vt(a.error)?F(Object.freeze([])):R(a.error)},async slots(n,i){let l=n.trim();if(l.length===0)return Ee("clinicianId is required");let a=await t.send("televet.booking.slots",{method:"GET",path:Lo,query:{clinician_id:l},...i?{signal:i}:{}});return a.ok?F(nt(No(a.value,"slots"),br)):Vt(a.error)?F(Object.freeze([])):R(a.error)},async nextSlot(n){let i=await t.send("televet.booking.next_slot",{method:"GET",path:Da,...n?{signal:n}:{}});return i.ok?F(br(za(i.value,"slot"))):F(null)},async holdSlot(n){let i=n.trim();if(i.length===0)return Ee("slotId is required");let l=await t.send("televet.booking.hold",{method:"POST",path:jo(i)},{idempotent:false,maxAttempts:1});if(!l.ok)return wr(r,"televet.booking.hold_failed",{status:l.error.httpStatus??null}),R(l.error);let a=Io(l.value);return a===null?Dt("the hold response carried no usable expiry"):F(a)},async book(n,i){let l=Ho(n);if(l!==null)return Ee(l);let a=i.trim();if(a.length===0)return Ee("idempotencyKey is required");let s=await t.send("televet.booking.book",{method:"POST",path:zo,body:La(n)},{idempotent:true,idempotencyKey:a,maxAttempts:1});if(!s.ok)return wr(r,"televet.booking.book_failed",{status:s.error.httpStatus??null}),R(s.error);let u=hr(s.value);return u===null?Dt("the booking response was unreadable"):F(u)},async reschedule(n,i){let l=n.trim(),a=i.trim();if(l.length===0)return Ee("consultId is required");if(a.length===0)return Ee("slotId is required");let s=await t.send("televet.booking.reschedule",{method:"POST",path:Mo(l),body:{new_slot_id:a}},{idempotent:false,maxAttempts:1});if(!s.ok)return wr(r,"televet.booking.reschedule_failed",{status:s.error.httpStatus??null}),R(s.error);let u=hr(s.value);return u===null?Dt("the reschedule response was unreadable"):F(u)}}}o(Pr,"createTelevetBookingController");function La(e){let t=e.cancellation_policy_version?.trim()??"",r=e.state_attested===true&&t.length>0;return {pet_id:e.pet_id,clinician_id:e.clinician_id,slot_id:e.slot_id,state:e.state,reason_text:e.reason_text.trim(),species:e.species,media_refs:[...e.media_refs],emergency_acknowledged:e.emergency_acknowledged,share_health_records:e.share_health_records,...r?{state_attested:true,cancellation_policy_version:t}:{}}}o(La,"bookingWireBody");function No(e,t){if(Array.isArray(e))return e;if(typeof e=="object"&&e!==null){let r=e,n=r[t]??r.items??r.data;if(Array.isArray(n))return n}return e}o(No,"rows");function za(e,t){if(typeof e=="object"&&e!==null&&!Array.isArray(e)){let r=e,n=r[t]??r.data;if(typeof n=="object"&&n!==null)return n}return e}o(za,"unwrap");function it(e){let{runtime:t,userRef:r,scopeEpoch:n}=fe();return useMemo(()=>{if(e)return e;if(r===null)return null;let{services:i}=t.registry;return Pr({auth:i.authFor(r),telemetry:i.telemetry,...i.errorPolicy?{errorPolicy:i.errorPolicy}:{}})},[t,r,n,e])}o(it,"useTelevetBookingController");function ja(){let{userRef:e}=fe(),t=we("televet");return useMemo(()=>({available:t.enabled&&e!==null,isPending:t.isPending}),[t.enabled,t.isPending,e])}o(ja,"useTelevetBookingAvailable");function Ue(e,t,r){let[n,i]=useState(()=>({key:e,data:null,isPending:t&&r!==null,error:null})),[l,a]=useState(0),s=useRef(r);s.current=r,useEffect(()=>{let f=s.current;if(!t||f===null){i({key:e,data:null,isPending:false,error:null});return}let v=new AbortController,p=true;return i(y=>y.key===e?{...y,isPending:true,error:null}:{key:e,data:null,isPending:true,error:null}),(async()=>{let y;try{y=await f(v.signal);}catch{p&&i({key:e,data:null,isPending:false,error:null});return}p&&(y.ok?i({key:e,data:y.value,isPending:false,error:null}):i({key:e,data:null,isPending:false,error:y.error}));})(),()=>{p=false,v.abort();}},[e,t,l]);let u=useCallback(()=>a(f=>f+1),[]),d=n.key===e;return useMemo(()=>({enabled:t,data:d?n.data:null,isPending:t&&(!d||n.isPending),isError:d&&n.error!==null,error:d?n.error:null,refetch:u}),[t,d,n.data,n.isPending,n.error,u])}o(Ue,"useTelevetRead");function Or(e,t){let r=e?.trim()??"",n=t?.statePolicy!==void 0&&ae(r),i=t?.statePolicy;return Ue(`state-policy:${r}`,n,n&&i?l=>i.call(t,r,l):null)}o(Or,"useTelevetStatePolicy");function Ar(e){let t=e?.entitlement!==void 0,r=e?.entitlement;return Ue("entitlement",t,t&&r?n=>r.call(e,n):null)}o(Ar,"useTelevetBookingEntitlement");function Fr(e){let t=e?.cancellationPolicy!==void 0,r=e?.cancellationPolicy;return Ue("cancellation-policy",t,t&&r?n=>r.call(e,n):null)}o(Fr,"useTelevetCancellationPolicy");function Dr(e,t){let r=e?.trim()??"",n=t?.clinicians!==void 0&&ae(r),i=t?.clinicians;return Ue(`clinicians:${r}`,n,n&&i?l=>i.call(t,r,l):null)}o(Dr,"useTelevetClinicians");function lt(e,t){let r=e?.trim()??"",n=t!==null&&r.length>0;return Ue(`slots:${r}`,n,n&&t?i=>t.slots(r,i):null)}o(lt,"useTelevetSlots");function Vr(e){let t=e?.nextSlot!==void 0,r=e?.nextSlot;return Ue("next-slot",t,t&&r?n=>r.call(e,n):null)}o(Vr,"useTelevetNextSlot");function Br(e){let[t,r]=useState(null),n=useRef(true),i=useRef(false),l=useRef(e);l.current=e,useEffect(()=>(n.current=true,()=>{n.current=false;}),[]);let a=useCallback((...s)=>{let u=l.current;if(u===null||i.current)return;let d=s[s.length-1],f=typeof d=="object"&&d!==null&&("onSuccess"in d||"onError"in d),v=f?d:void 0,p=f?s.slice(0,-1):s;i.current=true,r({variables:p[0]??null}),(async()=>{let y=null;try{y=await u(...p);}catch{y=null;}i.current=false,n.current&&r(null),y!==null&&(y.ok?v?.onSuccess?.(y.value):v?.onError?.(y.error));})();},[]);return useMemo(()=>({isPending:t!==null,variables:t?.variables??null,mutate:a}),[t,a])}o(Br,"useTelevetWrite");function at(e){return Br(e?t=>e.holdSlot(t):null)}o(at,"useTelevetHoldSlot");function Nr(e){return Br(e?(t,r)=>e.book(t,r):null)}o(Nr,"useTelevetBookConsult");function Lr(e,t){return Br(t&&e?r=>t.reschedule(e,r):null)}o(Lr,"useTelevetRescheduleConsult");function qo(e,t){if(e===void 0)return {};let r={};return e.backgroundColor!==void 0&&(r.backgroundColor=e.backgroundColor),e.borderColor!==void 0&&(r.borderColor=e.borderColor,r.borderWidth=t??1),e.borderRadius!==void 0&&(r.borderRadius=e.borderRadius),r}o(qo,"slotBox");function Ko(e){return e?.textColor===void 0?{}:{color:e.textColor}}o(Ko,"slotText");var $o=Object.freeze({visitButton:"Talk to a vet"});var Yo=null;function Go(){return Yo!==null}o(Go,"hasEverfurTelevetFlow");function Xo(e){return false;}o(Xo,"presentEverfurTelevetFlow");var zr=Object.freeze(["visit","join","summary","messages"]);function jr(e){return typeof e=="string"&&zr.includes(e)}o(jr,"isVetVisitIntent");var Ma="/widget/v1/televet/handoffs",Ha="/widget/v1/televet/availability",Ua="/widget/v1/televet/chat-entry",Wa=/^[a-z0-9][a-z0-9_-]{0,39}$/,qa=/^[A-Za-z0-9_-]{22}$/;var Qo=32,Zo=128,Jo=64;function Hr(e){let t=e.httpStatus;switch(e.code){case "sessionRequired":return "sessionRequired";case "authExpired":case "authRejected":return "authRejected";case "sdkUpdateRequired":return "sdkUpdateRequired";case "validationFailed":return "invalidRequest";case "rateLimited":case "quotaExceeded":return "rateLimited";}return t===void 0?e.code==="internalError"?"network":"unknown":t===429?"rateLimited":t===404?"unavailable":t===403?"accessDenied":t===401?"authRejected":t===400||t===422?"invalidRequest":t>=500?"serverError":"unknown"}o(Hr,"vetVisitErrorReasonOf");function ei(e){return R(U("validationFailed",{retryable:false,wireMessage:e}))}o(ei,"invalid");function Mr(e){return R(U("internalError",{retryable:false,httpStatus:502,wireMessage:e}))}o(Mr,"unusable");function Ka(e,t){let r={};e!==void 0&&(r.pet_ref=e);let n=t?.returnTo;if(n!=null){if(typeof n!="string"||!Wa.test(n))return {ok:false,message:"returnTo must be a registered return destination key"};r.return_to=n;}let i=t?.entry;if(i!=null){if(i!=="chat"||e===void 0)return {ok:false,message:"entry 'chat' needs the pet the chat is about"};r.entry=i;}let l=t?.visitRef,a=t?.intent,s=l!=null;if(s){let u=typeof l=="string"?l.trim():"";if(u.length<1||[...u].length>Jo)return {ok:false,message:`visitRef must be 1..${Jo} characters`};r.visit_ref=u;}if(a!=null){if(!s)return {ok:false,message:"intent needs the visitRef it opens"};if(!jr(a))return {ok:false,message:`intent must be one of ${zr.join(", ")}`};r.intent=a;}return {ok:true,body:r}}o(Ka,"handoffBody");function $a(e){if(typeof e!="object"||e===null)return null;let{visit_ref:t,intent:r}=e;return typeof t!="string"||t.length===0||!jr(r)?null:Object.freeze({visitRef:t,intent:r})}o($a,"parseVisitEcho");function ri(e){let t=e.funnel??Ie({auth:e.auth,...e.errorPolicy?{errorPolicy:e.errorPolicy}:{}}),r=e.telemetry,n=o(i=>(ti(r,"televet.visit.handoff_failed",{reason:Hr(i)}),R(i)),"failed");return {async createHandoff(i,l){let a;if(i!=null){let T=typeof i=="string"?[...i].length:0;if(T<1||T>Zo)return n(U("validationFailed",{retryable:false,wireMessage:`pet_ref must be 1..${Zo} characters`}));a=i;}let s=Ka(a,l);if(!s.ok){let T=ei(s.message);return T.ok?T:n(T.error)}let u=s.body,d=await t.send("televet.visit.handoff",{method:"POST",path:Ma,body:u},{idempotent:false,maxAttempts:1});if(!d.ok)return n(d.error);let f=Ya(d.value),v=u.return_to!==void 0,p=v?d.value?.flow_id:void 0;if(v&&(typeof p!="string"||!qa.test(p))){let T=Mr("the handoff response carried no usable return flow id");return T.ok?T:n(T.error)}let y=u.visit_ref!==void 0,h=y?$a(d.value?.visit):null;if(y&&h===null){let T=Mr("the handoff response did not confirm the visit it opens");return T.ok?T:n(T.error)}let x=f===null?null:Object.freeze({...f,...v?{flowId:p}:{},...h!==null?{visit:h}:{}});return x===null?n(U("internalError",{retryable:false,httpStatus:502,wireMessage:"the handoff response carried no usable visit url"})):(ti(r,"televet.visit.handoff_created",{pet_scoped:u.pet_ref!==void 0}),F(x))},async checkAvailability(i){if(typeof i!="string"||i.length>Qo)return ei(`state must be at most ${Qo} characters`);let l=await t.send("televet.visit.availability",{method:"POST",path:Ha,body:{state:i}},{idempotent:false,maxAttempts:1});if(!l.ok)return R(l.error);let a=l.value?.available;return typeof a!="boolean"?Mr("the availability response carried no usable answer"):F(Object.freeze({available:a}))},async chatEntryOpen(){try{let i=await t.send("televet.visit.chat_entry",{method:"GET",path:Ua},{maxAttempts:1});return i.ok&&i.value?.open===!0}catch{return false}}}}o(ri,"createVetVisitController");function Ya(e){if(typeof e!="object"||e===null)return null;let{url:t,expires_at:r}=e;return typeof t!="string"||typeof r!="string"||r.length===0||!Za(t)?null:Object.freeze({url:t,expiresAt:r})}o(Ya,"parseHandoff");var Ga=new Set(["localhost","127.0.0.1","[::1]"]),Xa=/^([A-Za-z][A-Za-z0-9+.-]*):\/\/([^/?#]*)/,Qa=/[\s\u0000-\u001f\u007f]/;function Za(e){if(Qa.test(e))return false;let t=Xa.exec(e);if(t===null)return false;let r=(t[1]??"").toLowerCase(),n=t[2]??"";if(n.length===0||n.includes("@"))return false;let i=n.replace(/:\d+$/,"").toLowerCase(),l=r==="https",a=r==="http"&&Ga.has(i);if(!l&&!a)return false;let s=e.indexOf("#");if(s<0)return false;let u=e.slice(s);return u.startsWith("#h=")&&u.length>3}o(Za,"isOpenableVisitUrl");function ti(e,t,r){if(e)try{e.track(t,r);}catch{}}o(ti,"safeTrack");var oi=Object.freeze({status:"idle",error:null,errorReason:null});function es(e,t,r){let{usState:n,chat:i,scope:l}=r,a=t&&(n!==null||i),s=`${n??""}|${i?"chat":""}`,[u,d]=useState(null);if(useEffect(()=>{if(!a)return;let v=true,p=e.current;return d(null),o(async()=>{try{if(i&&!(p.chatEntryOpen&&await p.chatEntryOpen()))return !1;if(n===null)return !0;if(!p.checkAvailability)return !1;let h=await p.checkAvailability(n);return h.ok&&h.value.available}catch{return false}},"ask")().then(h=>{v&&d({key:s,open:h});}),()=>{v=false;}},[a,s,n,i,l,e]),!a)return null;let f=u!==null&&u.key===s;return {open:f&&u.open,pending:!f}}o(es,"usePreflight");var ts=Object.freeze({status:"opening",error:null,errorReason:null});function li(e,t={}){let{runtime:r,userRef:n,scopeEpoch:i}=fe(),l=we("televet"),a=l.enabled&&n!==null,s=t.usState??null,u=t.entry==="chat",d=t.petRef??null,f=useMemo(()=>{if(t.controller)return t.controller;let{services:B}=r.registry;return ri({auth:B.authFor(n),telemetry:B.telemetry,...B.errorPolicy?{errorPolicy:B.errorPolicy}:{}})},[r,n,i,t.controller]),v=useRef(f);v.current=f;let p=useMemo(()=>({runtime:r,userRef:n,scopeEpoch:i}),[r,n,i]),y=es(v,a,{usState:s,chat:u,scope:p}),h=a&&(y===null||y.open)&&(!u||d!==null),x=t.returnTo??null,[T,_]=useState(oi),V=useRef(null),w=useRef({runtime:r,userRef:n,scopeEpoch:i});w.current={runtime:r,userRef:n,scopeEpoch:i};let O=useRef(f);O.current=f;let P=useRef(h);P.current=h;let I=useCallback((B,k)=>{if(V.current)return V.current;let A=o((K,ve)=>(_({status:K==="cancelled"?"idle":"error",error:ve,errorReason:K==="cancelled"?null:K}),Object.freeze({opened:false,reason:K,error:ve})),"fail");if(!P.current)return Promise.resolve(A("unavailable",null));let Z=e.prepare();if(!Z.ok)return Promise.resolve(A(Z.reason,null));let ee=w.current,se=O.current;_(ts);let Ye=(async()=>{let K,ve={...x!==null?{returnTo:x}:{},...u?{entry:"chat"}:{},...k!==null?{visitRef:k.visitRef}:{},...k!==null&&k.intent!==null&&k.intent!==void 0?{intent:k.intent}:{}},Ce=Object.keys(ve).length===0?void 0:ve,Ge=B===void 0?d:B;try{K=await(Ce===void 0?se.createHandoff(Ge):se.createHandoff(Ge,Ce));}catch{return e.abandon(Z.value),A("unknown",null)}let be=w.current;if(be.runtime!==ee.runtime||be.userRef!==ee.userRef||be.scopeEpoch!==ee.scopeEpoch)return e.abandon(Z.value),A("cancelled",null);if(!K.ok)return e.abandon(Z.value),A(Hr(K.error),K.error);let Xe=await e.finish(Z.value,K.value);return Xe!==null?A(Xe,null):(_(oi),Object.freeze(K.value.flowId===void 0?{opened:true}:{opened:true,flowId:K.value.flowId}))})().finally(()=>{V.current===Ye&&(V.current=null);});return V.current=Ye,Ye},[e,d,x,u]),te=useCallback(B=>I(B,null),[I]),Q=useCallback((B,k)=>I(void 0,{visitRef:B,intent:k??null}),[I]);return {available:h,isPending:l.isPending||(y?.pending??false),status:T.status,error:T.error,errorReason:T.errorReason,open:te,openVisit:Q}}o(li,"useVetVisitWith");var os=o(e=>Linking.openURL(e),"defaultOpenUrl");function ai(e={}){let{openUrl:t,...r}=e,n=useMemo(()=>{let i=t??os;return {prepare:o(()=>({ok:true,value:null}),"prepare"),async finish(l,a){try{return await i(a.url),null}catch{return "openFailed"}},abandon:o(()=>{},"abandon")}},[t]);return li(n,r)}o(ai,"useVetVisit");var si=44,ds=.6;function Lt(e){let{petRef:t,label:r,openUrl:n,onOpened:i,onError:l,style:a,labelStyle:s,controller:u,returnTo:d,usState:f,entry:v,visitRef:p,intent:y,onStartInApp:h,prefer:x}=e,T=ai({...d!==void 0?{returnTo:d}:{},...f!==void 0?{usState:f}:{},...v!==void 0?{entry:v}:{},...t!==void 0?{petRef:t}:{},...n!==void 0?{openUrl:n}:{},...u!==void 0?{controller:u}:{}}),_=C(),V=useMemo(()=>us(_),[_]),w=useRef(false);if(!T.available)return null;let O=T.status==="opening",P=r??$o.visitButton,I=p!=null,te=x==="redirect"||I,Q=!te&&h!==void 0;return jsx(Pressable,{onPress:o(()=>{if(!(O||w.current)){if(Q){Qe(h);return}(w.current=true,(p==null?T.open():T.openVisit(p,y??null)).then(A=>{A.opened?Qe(i,A.flowId??null):A.reason!=="cancelled"&&Qe(l,A.reason,A.error);}).finally(()=>{w.current=false;}));}},"onPress"),accessibilityRole:"button",accessibilityLabel:P,accessibilityState:{busy:O,disabled:O},style:[V.button,O?V.busy:null,a],children:jsx(b,{style:[V.label,s],children:P})})}o(Lt,"VetVisitButton");function us(e){let{color:t,space:r,radius:n,type:i,slots:l}=e;return StyleSheet.create({button:{minHeight:si,minWidth:si,alignItems:"center",justifyContent:"center",paddingHorizontal:r.xl,paddingVertical:r.sm,borderRadius:n.pill,backgroundColor:t.primary,...qo(l.vetVisitButton)},busy:{opacity:ds},label:{...E(e,"medium"),color:t.onPrimary,fontSize:i.size.body,lineHeight:i.size.body*i.lineHeight.snug,...Ko(l.vetVisitButton)}})}o(us,"makeStyles");var Y=44;function j(){let e=C();return useMemo(()=>ms(e),[e])}o(j,"useBookingStyles");function $({label:e,onPress:t,kind:r="primary",disabled:n=false,loading:i=false,fullWidth:l=true,accessibilityLabel:a,testID:s,style:u}){let d=j(),f=C(),v=n||i;return jsxs(Pressable,{onPress:t,disabled:v,accessibilityRole:"button",accessibilityLabel:a??e,accessibilityState:{disabled:v,busy:i},style:[d.button,r==="primary"?d.buttonPrimary:d.buttonSecondary,l?d.buttonFull:d.buttonAuto,v?d.buttonDisabled:null,u],testID:s,children:[i?jsx(ActivityIndicator,{size:"small",color:r==="primary"?f.color.onPrimary:f.color.brand}):null,jsx(b,{tier:"control",style:r==="primary"?d.buttonPrimaryLabel:d.buttonSecondaryLabel,children:e})]})}o($,"TelevetButton");function L({title:e,message:t,actionLabel:r,onAction:n,testID:i}){let l=j(),a=typeof r=="string"&&r.length>0&&typeof n=="function";return jsxs(View,{style:l.stateCard,testID:i,children:[jsx(b,{style:l.stateTitle,accessibilityRole:"header",children:e}),t?jsx(b,{style:l.stateMessage,children:t}):null,a?jsx($,{label:r,onPress:n,kind:"secondary",fullWidth:false}):null]})}o(L,"TelevetStateCard");function Ve({height:e,width:t="100%",testID:r}){let n=j();return jsx(View,{style:[n.skeleton,{height:e,width:t}],testID:r,accessibilityElementsHidden:true,importantForAccessibility:"no"})}o(Ve,"TelevetSkeletonBlock");function G({message:e,assertive:t=false,testID:r,style:n}){let i=j();return jsx(b,{style:[i.failure,n],accessibilityLiveRegion:t?"assertive":"polite",testID:r,children:e})}o(G,"TelevetFailureLine");function ms(e){let{color:t,space:r,radius:n,type:i}=e,{size:l,lineHeight:a}=i;return StyleSheet.create({screen:{flex:1,paddingHorizontal:r.xl,gap:r.md},stepFill:{flex:1,minHeight:0,gap:r.md},list:{gap:r.sm},button:{minHeight:Y,flexDirection:"row",alignItems:"center",justifyContent:"center",gap:r.sm,paddingHorizontal:r.xl,paddingVertical:r.sm,borderRadius:n.pill},buttonFull:{alignSelf:"stretch"},buttonAuto:{alignSelf:"flex-start",minWidth:Y},buttonPrimary:{backgroundColor:t.primary},buttonSecondary:{borderWidth:1,borderColor:t.brandBorder,backgroundColor:"transparent"},buttonDisabled:{opacity:.45},buttonPrimaryLabel:{...E(e,"medium"),color:t.onPrimary,fontSize:l.body,lineHeight:l.body*a.snug},buttonSecondaryLabel:{...E(e,"medium"),color:t.brand,fontSize:l.body,lineHeight:l.body*a.snug},stateCard:{minHeight:140,justifyContent:"center",gap:r.sm,padding:r.lg,borderRadius:n.lg,borderWidth:1,borderColor:t.brandBorder},stateTitle:{...E(e,"medium"),color:t.brand,fontSize:l.subtitle,lineHeight:l.subtitle*a.snug},stateMessage:{...E(e,"regular"),color:t.text.metaCool,fontSize:l.body,lineHeight:l.body*a.normal},skeleton:{borderRadius:n.md,backgroundColor:t.skeleton},failure:{...E(e,"regular"),color:t.danger,fontSize:l.caption,lineHeight:l.caption*a.normal},stepTitle:{...E(e,"bold"),color:t.brand,fontSize:l.heading,lineHeight:l.heading*a.snug},stepHelp:{...E(e,"regular"),color:t.text.metaCool,fontSize:l.body,lineHeight:l.body*a.normal},divider:{height:1,backgroundColor:t.brandBorder},scrollRoot:{flex:1,minHeight:0},scrollBody:{flex:1},scrollFooter:{paddingTop:r.md,paddingBottom:r.lg}})}o(ms,"makeBookingStyles");function fi(e){return `televet-consult-${e}`}o(fi,"televetConsultCalendarKey");function qr({consult:e,petName:t,onDone:r,onAddToCalendar:n,canJoinInApp:i=false}){let l=C(),a=j(),s=useMemo(()=>hs(l),[l]),[u,d]=useState("idle"),f=o(async()=>{if(!n)return;d("saving");let p=new Date(e.scheduledAt);if(Number.isNaN(p.getTime())){d("failed");return}let y=await gt(n,{key:fi(e.consultId),title:c.visit.title,startDate:p,endDate:new Date(p.getTime()+He*6e4),alarmOffsetMinutes:-30});d(y.ok&&y.value===true?"saved":"failed");},"addToCalendar"),v=[c.booked.remindPromise,ue(c.booked.summaryPromise,{pet:t??""}),...i?[c.booked.joinPromise]:[]];return ce()?jsxs(View,{style:s.screen,testID:"televet-booked",children:[jsx(View,{style:s.header,children:jsx($,{label:c.doneCta,kind:"secondary",fullWidth:false,onPress:r,testID:"televet-booked-done"})}),jsx(View,{style:s.avatar,accessibilityElementsHidden:true,importantForAccessibility:"no"}),jsx(b,{tier:"heading",style:s.title,accessibilityRole:"header",children:c.bookedTitle}),jsx(b,{style:s.when,children:ye(e.scheduledAt)}),jsx(View,{style:s.steps,testID:"televet-booked-steps",children:v.map((p,y)=>jsxs(View,{style:s.step,children:[jsx(View,{style:s.stepNumber,accessibilityElementsHidden:true,importantForAccessibility:"no",children:jsx(b,{tier:"badge",style:s.stepNumberText,children:String(y+1)})}),jsx(b,{style:s.stepText,children:p.trim()})]},p))}),jsxs(View,{style:s.actions,children:[n?jsx($,{label:u==="saved"?c.booked.calendarAdded:c.addToCalendarCta,kind:"primary",loading:u==="saving",disabled:u==="saving"||u==="saved",onPress:()=>{f();},testID:"televet-booked-calendar"}):null,u==="failed"?jsx(b,{style:[a.failure,s.calendarNote],accessibilityLiveRegion:"polite",testID:"televet-booked-calendar-failed",children:c.booked.calendarFailedBody}):null,jsx($,{label:t?ue(c.booked.backToPet,{pet:t}):c.doneCta,kind:"secondary",onPress:r,testID:"televet-booked-back"})]})]}):jsx(View,{style:s.screen,testID:"televet-booked-copy-unapproved"})}o(qr,"TelevetBookedScreen");function hs(e){let{color:t,space:r,radius:n,type:i}=e,{size:l,lineHeight:a}=i;return StyleSheet.create({screen:{flex:1,paddingHorizontal:r.xl,gap:r.md},header:{alignItems:"flex-end",paddingBottom:r.lg},avatar:{alignSelf:"center",width:120,height:120,borderRadius:60,backgroundColor:t.surfaceSubtle,borderWidth:2,borderColor:t.success},title:{textAlign:"center",...E(e,"bold"),color:t.brand,fontSize:l.verdict,lineHeight:l.verdict*a.tight,letterSpacing:-0.7,paddingTop:r.lg},when:{textAlign:"center",...E(e,"regular"),color:t.text.metaCool,fontSize:l.subtitle,lineHeight:l.subtitle*a.normal},steps:{marginTop:r.xl,padding:r.lg,borderRadius:n.lg,borderWidth:1,borderColor:t.brandBorder,gap:r.lg},step:{flexDirection:"row",alignItems:"flex-start",gap:r.md},stepNumber:{width:26,height:26,borderRadius:13,backgroundColor:t.primary,alignItems:"center",justifyContent:"center"},stepNumberText:{...E(e,"medium"),color:t.onPrimary,fontSize:l.caption,lineHeight:l.caption,includeFontPadding:false},stepText:{flex:1,...E(e,"regular"),color:t.brand,fontSize:l.body,lineHeight:l.body*a.normal},actions:{marginTop:"auto",paddingBottom:r.xl,gap:r.md},calendarNote:{textAlign:"center"}})}o(hs,"makeStyles");function Kr({step:e,furthestIndex:t,title:r,canGoBack:n,isDirty:i,onBack:l,onClose:a,onConfirmDiscard:s}){let u=C(),d=useMemo(()=>Ss(u),[u]),f=useMemo(()=>()=>{if(!i){a();return}let h={title:c.chrome.discardTitle,body:c.chrome.discardBody,confirmLabel:c.chrome.discardConfirmCta,keepLabel:c.chrome.discardKeepCta};if(s){Promise.resolve(s(h)).then(x=>{x&&a();},()=>{});return}Alert.alert(h.title,h.body,[{text:h.keepLabel,style:"cancel"},{text:h.confirmLabel,style:"destructive",onPress:a}]);},[i,a,s]);useEffect(()=>{let h=o(()=>n?(l(),true):(f(),true),"onBackPress"),x=BackHandler.addEventListener("hardwareBackPress",h);return ()=>{x.remove();}},[n,l,f]);let v=Fe.length,y=e==="booked"?1:Math.min(1,(t+1)/v);return jsxs(View,{style:d.wrap,children:[jsxs(View,{style:d.bar,children:[jsx(View,{style:d.side,children:jsx(Pressable,{onPress:n?l:f,accessibilityRole:"button",accessibilityLabel:gi,testID:"televet-booking-back",style:d.tap,children:jsx(View,{style:d.chevron,accessibilityElementsHidden:true,importantForAccessibility:"no"})})}),jsx(b,{tier:"heading",style:d.title,accessibilityRole:"header",children:r??c.navTitle}),jsx(View,{style:[d.side,d.sideRight],children:jsx(Pressable,{onPress:f,accessibilityRole:"button",accessibilityLabel:c.close,accessibilityHint:c.chrome.closeHint,testID:"televet-booking-close",style:d.tap,children:jsx(b,{tier:"control",style:d.close,children:c.close})})})]}),jsx(View,{style:d.railTrack,accessibilityElementsHidden:true,importantForAccessibility:"no-hide-descendants",children:jsx(View,{style:[d.railFill,{width:`${Math.round(y*100)}%`}],testID:"televet-booking-rail"})})]})}o(Kr,"TelevetBookingChrome");var gi="Back";function Ss(e){let{color:t,space:r,type:n}=e,{size:i,lineHeight:l}=n;return StyleSheet.create({wrap:{backgroundColor:t.surface},bar:{flexDirection:"row",alignItems:"center",paddingHorizontal:r.lg,minHeight:56},side:{minWidth:64,justifyContent:"center"},sideRight:{alignItems:"flex-end"},tap:{minHeight:Y,minWidth:Y,justifyContent:"center",paddingHorizontal:r.xs},chevron:{width:10,height:10,borderLeftWidth:2,borderBottomWidth:2,borderColor:t.brand,transform:[{rotate:"45deg"}]},title:{flex:1,textAlign:"center",...E(e,"medium"),color:t.brand,fontSize:i.subtitle,lineHeight:i.subtitle*l.normal},close:{...E(e,"medium"),color:t.brand,fontSize:i.subtitle,lineHeight:i.subtitle*l.normal},railTrack:{height:4,backgroundColor:t.surfaceSubtle},railFill:{height:4,backgroundColor:t.success}})}o(Ss,"makeStyles");function vi(e){let t=[],r=Rs(e.ageYears);r!==null&&t.push(`${String(r)} yr${r===1?"":"s"} old`);let n=e.weightKg;typeof n=="number"&&Number.isFinite(n)&&n>0&&t.push(`${String(Math.round(n))} kg`);let i=e.breed?.trim();return i&&t.push(i),t.join(" \xB7 ")}o(vi,"formatTelevetPetMetaLine");function Rs(e){if(typeof e!="number"||!Number.isFinite(e))return null;let t=Math.floor(e);return t>=0?t:null}o(Rs,"wholeYears");function Yr({media:e,onChange:t,onPickMedia:r}){let n=C(),i=useMemo(()=>Fs(n),[n]),l=Pt-e.length,[a,s]=useState(false);if(!r)return null;let u=o(async()=>{if(!(a||l<=0)){s(true);try{let d=await gt(r,l);if(!d.ok||d.value===null||d.value.length===0)return;let f=new Set(e.map(p=>p.uri)),v=d.value.filter(p=>typeof p?.uri=="string"&&p.uri.length>0&&!f.has(p.uri));if(v.length===0)return;t([...e,...v].slice(0,Pt));}finally{s(false);}}},"pick");return jsxs(View,{style:i.row,children:[e.map((d,f)=>jsxs(View,{style:i.thumb,children:[jsx(Image,{source:{uri:d.uri},style:i.thumbImage,resizeMode:"cover"}),d.mimeType?.startsWith("video/")?jsx(View,{style:i.videoBadge,testID:`televet-intake-media-video-${String(f)}`,children:jsx(b,{tier:"badge",style:i.videoBadgeText,children:As})}):null,jsx(Pressable,{onPress:()=>t(e.filter((v,p)=>p!==f)),accessibilityRole:"button",accessibilityLabel:c.removePhotoLabel,testID:`televet-intake-media-remove-${String(f)}`,style:i.remove,children:jsx(b,{tier:"control",style:i.removeGlyph,children:Os})})]},`${d.uri}-${String(f)}`)),l>0?jsx(Pressable,{onPress:()=>{u();},disabled:a,accessibilityRole:"button",accessibilityLabel:c.addPhotoCta,accessibilityState:{busy:a,disabled:a},testID:"televet-intake-add-media",style:[i.dropzone,a?i.dropzoneBusy:null],children:a?jsx(ActivityIndicator,{testID:"televet-intake-media-busy"}):jsx(b,{tier:"compact",style:i.dropzoneText,children:c.addPhotoCta})}):null]})}o(Yr,"TelevetIntakeMedia");var Os="\xD7",As="\u25B6",zt=92;function Fs(e){let{color:t,space:r,radius:n,type:i}=e,{size:l,lineHeight:a}=i;return StyleSheet.create({row:{flexDirection:"row",flexWrap:"wrap",gap:r.md,paddingTop:r.sm},thumb:{width:zt,height:zt,borderRadius:n.md,backgroundColor:t.surfaceSubtle},thumbImage:{width:"100%",height:"100%",borderRadius:n.md},videoBadge:{position:"absolute",left:6,bottom:6,paddingHorizontal:6,paddingVertical:2,borderRadius:n.sm,backgroundColor:t.shadow},videoBadgeText:{color:t.text.onBrand,fontSize:l.nano},remove:{position:"absolute",top:-8,right:-8,width:Y-16,height:Y-16,borderRadius:Y/2,backgroundColor:t.text.metaCool,alignItems:"center",justifyContent:"center"},removeGlyph:{...E(e,"medium"),color:t.surface,fontSize:l.subtitle,lineHeight:l.subtitle,includeFontPadding:false},dropzone:{width:zt,height:zt,borderRadius:n.md,borderWidth:1,borderStyle:"dashed",borderColor:t.brandBorder,alignItems:"center",justifyContent:"center",paddingHorizontal:r.sm},dropzoneBusy:{opacity:.6},dropzoneText:{...E(e,"mono"),color:t.text.metaCool,fontSize:l.nano,lineHeight:l.nano*a.normal,letterSpacing:.3,textAlign:"center"}})}o(Fs,"makeStyles");function Ne({label:e,value:t,last:r=false,testID:n}){let i=C(),l=useMemo(()=>Zr(i),[i]);return jsxs(View,{style:[l.row,r?l.rowLast:null],testID:n,children:[jsx(b,{style:l.rowLabel,children:e}),jsx(b,{style:l.rowValue,children:t})]})}o(Ne,"TelevetSummaryRow");function dt({label:e,checked:t,onToggle:r,testID:n}){let i=C(),l=useMemo(()=>Zr(i),[i]);return jsxs(Pressable,{onPress:()=>r(!t),accessibilityRole:"checkbox",accessibilityLabel:e,accessibilityState:{checked:t},testID:n,style:l.consent,children:[jsx(View,{style:[l.box,t?l.boxChecked:null],children:t?jsx(b,{tier:"badge",style:l.tick,children:Bs}):null}),jsx(b,{style:l.consentLabel,children:e})]})}o(dt,"TelevetConsentCheckbox");var Bs="\u2713";function Qr({children:e,testID:t}){let r=C(),n=useMemo(()=>Zr(r),[r]);return jsx(View,{style:n.card,testID:t,children:e})}o(Qr,"TelevetSummaryCard");function Zr(e){let{color:t,space:r,radius:n,type:i}=e,{size:l,lineHeight:a}=i;return StyleSheet.create({card:{borderRadius:n.lg,borderWidth:1,borderColor:t.brandBorder,paddingHorizontal:r.lg},row:{flexDirection:"row",alignItems:"flex-start",justifyContent:"space-between",gap:r.lg,paddingVertical:r.lg,borderBottomWidth:1,borderBottomColor:t.brandBorder},rowLast:{borderBottomWidth:0},rowLabel:{...E(e,"regular"),color:t.brand,fontSize:l.subtitle,lineHeight:l.subtitle*a.snug},rowValue:{flexShrink:1,textAlign:"right",...E(e,"medium"),color:t.brand,fontSize:l.subtitle,lineHeight:l.subtitle*a.snug},consent:{flexDirection:"row",alignItems:"flex-start",gap:r.md,minHeight:Y,padding:r.lg,borderRadius:n.md,backgroundColor:t.surfaceSubtle},box:{width:22,height:22,borderRadius:n.xs,borderWidth:1.5,borderColor:t.brand,backgroundColor:t.surface,alignItems:"center",justifyContent:"center"},boxChecked:{backgroundColor:t.primary,borderColor:t.primary},tick:{...E(e,"bold"),color:t.onPrimary,fontSize:l.caption,lineHeight:l.caption,includeFontPadding:false},consentLabel:{flex:1,...E(e,"regular"),color:t.text.metaCool,fontSize:l.body,lineHeight:l.body*a.normal}})}o(Zr,"makeStyles");function Jr({slots:e,selectedDayKey:t,onSelectDay:r}){let n=C(),i=useMemo(()=>Ms(n),[n]),l=useMemo(()=>Mt(e),[e]),a=l[0];return a===void 0?null:jsxs(View,{children:[jsx(b,{tier:"compact",style:i.month,testID:"televet-day-strip-month",children:Vo(a.iso)}),jsx(ScrollView,{horizontal:true,showsHorizontalScrollIndicator:false,contentContainerStyle:i.strip,testID:"televet-day-strip",children:l.map(s=>{let u=s.key===t;return jsxs(Pressable,{onPress:()=>r(s),accessibilityRole:"button",accessibilityLabel:Bo(s.iso),accessibilityState:{selected:u},testID:`televet-day-${s.key}`,style:[i.day,u?i.daySelected:null],children:[jsx(b,{tier:"compact",style:[i.dayWeekday,u?i.dayTextSelected:null],children:s.weekday}),jsx(b,{tier:"compact",style:[i.dayNumber,u?i.dayTextSelected:null],children:s.dayNumber})]},s.key)})})]})}o(Jr,"TelevetDayStrip");function Mt(e){let t=new Map;for(let r of e){let n=Ft(r.startsAt);if(t.has(n))continue;let i=new Date(r.startsAt);Number.isNaN(i.getTime())||t.set(n,Object.freeze({key:n,iso:r.startsAt,weekday:i.toLocaleDateString(void 0,{weekday:"short"}),dayNumber:String(i.getDate())}));}return Object.freeze([...t.values()])}o(Mt,"televetDaysFromSlots");function Ms(e){let{color:t,space:r,radius:n,type:i}=e,{size:l,lineHeight:a}=i;return StyleSheet.create({month:{textAlign:"center",...E(e,"medium"),color:t.brand,fontSize:l.subtitle,lineHeight:l.subtitle*a.snug,paddingBottom:r.md},strip:{gap:r.sm,paddingHorizontal:r.xs},day:{width:52,minHeight:Y,paddingVertical:r.md,borderRadius:n.md,borderWidth:1,borderColor:t.brandBorder,alignItems:"center",justifyContent:"center",gap:2},daySelected:{backgroundColor:t.primary,borderColor:t.primary},dayWeekday:{...E(e,"mono"),color:t.text.secondary,fontSize:l.tiny,lineHeight:l.tiny*a.tight},dayNumber:{...E(e,"medium"),color:t.brand,fontSize:l.heading,lineHeight:l.heading*a.tight},dayTextSelected:{color:t.onPrimary}})}o(Ms,"makeStyles");function ct({slots:e,busySlotId:t,onPick:r,ListHeaderComponent:n,rowTestIdPrefix:i="televet-slot",testID:l="televet-slot-list"}){let a=C(),s=useMemo(()=>$s(a),[a]),u=useMemo(()=>Mt(e),[e]),[d,f]=useState(null),v=d??u[0]?.key??null,p=useMemo(()=>v?e.filter(_=>Ft(_.startsAt)===v):[],[e,v]),y=n,h=useMemo(()=>p.map(_=>ot(_.startsAt)),[p]),x=useMemo(()=>new Set(h.filter(_=>_.length>0)).size>1,[h]),T=p[0];return jsxs(View,{style:s.root,testID:l,children:[y?jsx(y,{}):null,jsx(Jr,{slots:e,selectedDayKey:v,onSelectDay:_=>f(_.key)}),T&&!x?jsx(b,{tier:"compact",style:s.zone,testID:"televet-slot-zone",children:ot(T.startsAt)}):null,jsx(ScrollView,{style:s.gridScroll,contentContainerStyle:s.grid,showsVerticalScrollIndicator:false,children:p.map((_,V)=>{let w=t===_.slotId,O=t!==null,P=x?h[V]??"":"";return jsxs(Pressable,{onPress:()=>r(_),disabled:O,accessibilityRole:"button",accessibilityLabel:[Me(_.startsAt),P].filter(I=>I.length>0).join(" "),accessibilityState:{disabled:O,busy:w},testID:`${i}-${_.slotId}`,style:[s.chip,w?s.chipBusy:null,O&&!w?s.chipDisabled:null],children:[jsx(b,{tier:"compact",style:[s.chipLabel,w?s.chipLabelBusy:null],children:Me(_.startsAt)}),P.length>0?jsx(b,{tier:"compact",style:[s.chipZone,w?s.chipLabelBusy:null],testID:`${i}-${_.slotId}-zone`,children:P}):null]},_.slotId)})})]})}o(ct,"TelevetSlotPicker");function $s(e){let{color:t,space:r,radius:n,type:i}=e,{size:l,lineHeight:a}=i;return StyleSheet.create({root:{flex:1,minHeight:0},gridScroll:{flex:1},zone:{textAlign:"center",...E(e,"mono"),color:t.text.muted,fontSize:l.tiny,lineHeight:l.tiny*a.normal,letterSpacing:.4,paddingVertical:r.md},grid:{flexDirection:"row",flexWrap:"wrap",gap:r.md,paddingBottom:r.xl},chip:{minWidth:96,flexGrow:1,flexBasis:"28%",minHeight:48,borderRadius:n.pill,borderWidth:1,borderColor:t.brandBorder,alignItems:"center",justifyContent:"center",paddingHorizontal:r.md},chipBusy:{backgroundColor:t.primary,borderColor:t.primary},chipDisabled:{opacity:.45},chipLabel:{...E(e,"regular"),color:t.brand,fontSize:l.subtitle,lineHeight:l.subtitle*a.tight},chipLabelBusy:{color:t.onPrimary},chipZone:{...E(e,"mono"),color:t.text.muted,fontSize:l.tiny,lineHeight:l.tiny*a.normal,letterSpacing:.4}})}o($s,"makeStyles");function Ht(e,t){return t?e.find(n=>n.petRef===t||n.petId===t)?.name??null:null}o(Ht,"nameOf");function Ri({pets:e,isPending:t,isError:r,onRetry:n,selectedId:i,onSelect:l,onAddPet:a}){let s=j(),u=C(),d=useMemo(()=>Le(u),[u]);return t?jsx(View,{style:s.list,testID:"televet-pets-loading",children:[0,1].map(f=>jsx(Ve,{height:64},f))}):r?jsx(View,{testID:"televet-pets-error",children:jsx(L,{title:c.chrome.loadFailedTitle,actionLabel:c.chrome.retryCta,onAction:n})}):e.length===0?jsx(View,{testID:"televet-pets-empty",children:jsx(L,{title:c.chrome.noPetsTitle,actionLabel:c.addPetCta,onAction:a})}):jsxs(View,{style:s.stepFill,children:[jsx(b,{tier:"heading",style:s.stepTitle,accessibilityRole:"header",children:c.petSelectTitle}),jsxs(ScrollView,{contentContainerStyle:s.list,testID:"televet-pets",children:[e.map(f=>{let v=i===f.petRef,p=vi(f),y=f.name??"";return jsx(Si,{name:y,meta:p,selected:v,onPress:()=>l(f.petRef),testID:`televet-pet-${f.petRef}`},f.petRef)}),a?jsx(Si,{name:c.addPetCta,meta:"",selected:false,onPress:a,testID:"televet-pet-add",glyph:Xs}):null]}),jsx(View,{style:d.spacer})]})}o(Ri,"PetStep");function Si({name:e,meta:t,selected:r,onPress:n,testID:i,glyph:l}){let a=C(),s=useMemo(()=>Le(a),[a]);return jsxs(View,{style:[s.petRow,r?s.petRowSelected:null],children:[jsx($,{label:e,onPress:n,kind:"secondary",accessibilityLabel:e,testID:i,style:s.petRowButton}),jsxs(View,{style:s.petRowText,pointerEvents:"none",children:[jsx(View,{style:s.petDisc,children:jsx(b,{tier:"compact",style:s.petDiscGlyph,children:l??Ci(e)})}),t?jsx(b,{tier:"compact",style:s.petRowMeta,children:t}):null]})]})}o(Si,"PetRow");function Ci(e){let t=e.trim();return t.length===0?Gs:t.slice(0,1).toUpperCase()}o(Ci,"initialOf");function xi({clinicians:e,isPending:t,isError:r,selectedId:n,onSelect:i,onRetry:l}){let a=j(),s=C(),u=useMemo(()=>Le(s),[s]);if(t)return jsx(View,{style:a.list,testID:"televet-clinicians-loading",children:jsx(Ve,{height:96})});if(r)return jsx(View,{testID:"televet-clinicians-error",children:jsx(L,{title:c.chrome.loadFailedTitle,actionLabel:c.chrome.retryCta,onAction:l})});if(e.length===0)return jsx(View,{testID:"televet-clinicians-empty",children:jsx(L,{title:c.noCliniciansTitle,message:c.noCliniciansBody,actionLabel:c.noCliniciansRetryCta,onAction:l})});let d=e.find(f=>f.clinicianId===n)??e[0];return d===void 0?null:jsxs(View,{style:a.list,testID:"televet-clinicians",children:[jsx(b,{tier:"heading",style:a.stepTitle,accessibilityRole:"header",children:c.yourVetTitle}),jsxs(View,{style:u.vetRow,children:[jsx(View,{style:u.vetAvatar,children:jsx(b,{tier:"heading",style:u.vetAvatarText,children:Ci(d.displayName)})}),jsxs(View,{style:u.vetIdentity,children:[jsx(b,{style:u.vetName,children:d.displayName}),d.credentials?jsx(b,{style:u.vetCredentials,children:d.credentials}):null,d.rating!==null&&d.ratingCount!==null?jsx(b,{tier:"compact",style:u.vetRating,testID:"televet-vet-rating",children:`\u2605 ${String(d.rating)} \xB7 ${String(d.ratingCount)} ${c.reviewsLabel}`}):null]})]}),d.bio?jsx(b,{style:u.vetBio,testID:"televet-vet-bio",children:d.bio}):null,jsx(View,{style:a.divider}),jsx($,{label:c.continueCta,kind:"primary",onPress:()=>i(d.clinicianId),testID:`televet-clinician-${d.clinicianId}`})]})}o(xi,"ClinicianStep");function wi({slots:e,enabled:t,isPending:r,isError:n,busySlotId:i,failure:l,nextOpening:a,onPick:s,onRetry:u,onSeeOtherVets:d}){let f=j();return t?r?jsx(View,{style:f.list,testID:"televet-slots-loading",children:[0,1,2].map(v=>jsx(Ve,{height:48},v))}):n?jsx(L,{title:c.slotsErrorTitle,actionLabel:c.retryCta,onAction:u,testID:"televet-slots-error"}):e.length===0?jsx(View,{testID:"televet-slots-empty",children:jsx(L,{title:c.noSlotsTitle,message:a?ue(c.nextOpeningTemplate,{when:ye(a.startsAt)}):void 0,actionLabel:a?c.seeOtherVetsCta:void 0,onAction:a?d:void 0})}):jsxs(View,{style:f.stepFill,testID:"televet-slots",children:[l==="expired"?jsx(G,{message:c.holdExpired}):null,l==="taken"?jsx(G,{message:c.slotTaken}):null,jsx(ct,{slots:e,busySlotId:i,onPick:s})]}):jsx(View,{testID:"televet-slots-unavailable",children:jsx(L,{title:c.bookingPausedTitle})})}o(wi,"SlotStep");function Pi({value:e,onChange:t,onNext:r,media:n,onChangeMedia:i,onPickMedia:l}){let a=j(),s=C(),u=useMemo(()=>Le(s),[s]),d=e.trim(),f=d.length>0&&d.length<=pe;return jsxs(View,{style:a.scrollRoot,testID:"televet-booking-reason",children:[jsxs(ScrollView,{style:a.scrollBody,contentContainerStyle:a.list,keyboardShouldPersistTaps:"handled",keyboardDismissMode:"interactive",showsVerticalScrollIndicator:false,testID:"televet-booking-reason-scroll",children:[jsx(b,{tier:"heading",style:a.stepTitle,accessibilityRole:"header",children:c.describeHeading}),jsx(b,{style:a.stepHelp,children:c.describeHelpLong}),jsx(_n,{value:e,onChangeText:t,multiline:true,placeholder:c.reasonPlaceholder,placeholderTextColor:s.color.text.placeholder,style:u.reasonInput,testID:"televet-reason-input"}),d.length>pe?jsx(G,{message:c.reasonTooLong}):null,jsx(Yr,{media:n,onChange:i,...l?{onPickMedia:l}:{}})]}),jsx(View,{style:a.scrollFooter,children:jsx($,{label:c.continueCta,kind:"primary",disabled:!f,onPress:r,testID:"televet-reason-next"})})]})}o(Pi,"ReasonStep");function Ii({when:e,clinician:t,petName:r,reason:n,shareRecords:i,onToggleShare:l,stateCode:a,stateAttested:s,onToggleStateAttest:u,cancellationTerms:d,termsAttested:f,onToggleTermsAttest:v,canConfirm:p,busy:y,failure:h,rateLimitMessage:x,onConfirm:T,emergency:_,onAcknowledgeEmergency:V,onSeeOtherVets:w}){let O=j(),P=C(),I=useMemo(()=>Le(P),[P]);return jsxs(View,{style:O.scrollRoot,testID:"televet-booking-review",children:[jsxs(ScrollView,{style:O.scrollBody,contentContainerStyle:O.list,keyboardShouldPersistTaps:"handled",showsVerticalScrollIndicator:false,testID:"televet-booking-review-scroll",children:[jsxs(Qr,{testID:"televet-review-summary",children:[r?jsx(Ne,{label:c.summaryPet,value:r,testID:"televet-review-row-pet"}):null,t?jsx(Ne,{label:c.summaryVet,value:t,testID:"televet-review-row-vet"}):null,jsx(Ne,{label:c.summaryWhen,value:e,testID:"televet-review-row-when"}),jsx(Ne,{label:c.summaryLength,value:ue(c.summaryLengthTemplate,{n:String(He)}),testID:"televet-review-row-length"}),n?jsx(Ne,{label:c.summaryReason,value:n,last:true,testID:"televet-review-row-reason"}):null]}),jsx(dt,{label:c.shareRecordsOff,checked:i,onToggle:l,testID:"televet-review-share-records"}),d?jsx(dt,{label:d,checked:f,onToggle:v,testID:"televet-review-terms-attest"}):null,a?jsx(dt,{label:ue(c.stateAttestTemplate,{state:a}),checked:s,onToggle:u,testID:"televet-review-state-attest"}):null,_?jsxs(View,{style:I.emergencyBanner,testID:"televet-review-emergency",children:[jsx(b,{tier:"heading",accessibilityRole:"header",accessibilityLiveRegion:"assertive",style:I.emergencyTitle,children:c.emergency.bannerTitle}),jsx(b,{style:I.emergencyLede,children:c.emergency.lede}),_.length>0?jsx(b,{style:I.emergencyLede,testID:"televet-review-emergency-categories",children:_.join(", ")}):null,jsx($,{label:c.emergency.keepBookingCta,kind:"secondary",loading:y,disabled:y,onPress:V,testID:"televet-review-emergency-ack"})]}):null,h==="failed"?jsx(G,{message:c.confirmFailed}):null,h==="clinician_unavailable"?jsxs(View,{style:O.list,testID:"televet-review-clinician-unavailable",children:[jsx(G,{message:c.confirmFailed}),jsx($,{label:c.seeOtherVetsCta,kind:"secondary",onPress:w,testID:"televet-review-see-other-vets"})]}):null,h==="rate_limited"&&x?jsx(G,{message:x,testID:"televet-review-rate-limited"}):null,h==="rate_limited"&&!x?jsx(G,{message:c.confirmFailed}):null,h==="not_entitled"?jsx(G,{message:c.confirmNotEntitled,testID:"televet-review-not-entitled"}):null]}),_?null:jsx(View,{style:O.scrollFooter,children:jsx($,{label:c.confirmCta,kind:"primary",loading:y,disabled:!p||y||!!a&&!s||!!d&&!f,onPress:T,testID:"televet-review-confirm"})})]})}o(Ii,"ReviewStep");var Gs="\u25CB",Xs="+";function Le(e){let{color:t,space:r,radius:n,type:i}=e,{size:l,lineHeight:a}=i;return StyleSheet.create({marker:{minHeight:1},spacer:{height:r.md},petRow:{gap:r.xs,paddingVertical:r.xs},petRowSelected:{opacity:1},petRowButton:{alignSelf:"stretch",justifyContent:"flex-start"},petRowText:{flexDirection:"row",alignItems:"center",gap:r.sm,paddingHorizontal:r.md},petDisc:{width:28,height:28,borderRadius:14,backgroundColor:t.surfaceSubtle,alignItems:"center",justifyContent:"center"},petDiscGlyph:{...E(e,"medium"),color:t.brand,fontSize:l.caption,lineHeight:l.caption},petRowMeta:{flexShrink:1,...E(e,"regular"),color:t.text.metaCool,fontSize:l.caption,lineHeight:l.caption*a.normal},vetRow:{flexDirection:"row",alignItems:"center",gap:r.md},vetAvatar:{width:64,height:64,borderRadius:32,backgroundColor:t.surfaceSubtle,alignItems:"center",justifyContent:"center"},vetAvatarText:{...E(e,"medium"),color:t.brand,fontSize:l.heading,lineHeight:l.heading},vetIdentity:{flex:1,gap:2},vetName:{...E(e,"medium"),color:t.brand,fontSize:l.subtitle,lineHeight:l.subtitle*a.snug},vetCredentials:{...E(e,"regular"),color:t.text.metaCool,fontSize:l.caption,lineHeight:l.caption*a.normal},vetRating:{...E(e,"regular"),color:t.text.secondary,fontSize:l.caption,lineHeight:l.caption*a.normal},vetBio:{...E(e,"regular"),color:t.brand,fontSize:l.body,lineHeight:l.body*a.normal},reasonInput:{minHeight:120,textAlignVertical:"top",borderWidth:1,borderColor:t.brandBorder,borderRadius:n.md,padding:r.md,...E(e,"regular"),color:t.text.primary,fontSize:l.body,lineHeight:l.body*a.normal},emergencyBanner:{gap:r.md,padding:r.lg,borderRadius:n.lg,borderWidth:1,borderColor:t.errorRed,backgroundColor:t.badgeBgCritical},emergencyTitle:{...E(e,"bold"),color:t.errorRed,fontSize:l.subtitle,lineHeight:l.subtitle*a.snug},emergencyLede:{...E(e,"regular"),color:t.text.primary,fontSize:l.body,lineHeight:l.body*a.normal}})}o(Le,"makeLocalStyles");function rn(e){let{petRef:t,usState:r,controller:n,onBooked:i,onExit:l,onAddPet:a,onPickMedia:s,onAddToCalendar:u,onConfirmDiscard:d,onRequestLocation:f,locationStatus:v="unknown",canJoinInApp:p=false,renderUnavailable:y,style:h,testID:x}=je(e,["onBooked","onExit","onAddPet","onRequestLocation"]),T=j(),_=C(),V=useMemo(()=>Le(_),[_]),w=it(n),O=ko(),P=O.pets,I=P.length,te=useMemo(()=>({ownedPetCount:I}),[I]),[Q,B]=useReducer((M,re)=>_r(M,re,te),void 0,()=>Er({ownedPetCount:0},{petId:t??null,state:r??null})),k=useCallback(M=>B(M),[]),[A,Z]=useState(""),[ee,se]=useState(null),[on,Ye]=useState(null),[K,ve]=useState(null),[Ce,Ge]=useState(false),[be,Xe]=useState(false),[Di,Vi]=useState([]),[Wt,Bi]=useState(null),{draft:S}=Q,J=Sr(Q),ln=useRef(S.state);ln.current!==S.state&&(ln.current=S.state,Ce&&Ge(false),be&&Xe(false));let qt=Or(S.state,w),Kt=Fr(w),an=Ar(w),xe=Dr(S.state,w),ze=lt(S.clinicianId,w),Ni=Vr(w).data??null,yt=at(w),$t=Nr(w),Yt=r??null;useEffect(()=>{Yt&&!S.state&&k({type:"patch",patch:{state:Yt}});},[Yt,S.state,k]),useEffect(()=>{t&&!S.petId&&k({type:"patch",patch:{petId:t}});},[t,S.petId,k]);let Gt=P.length===1?P[0]?.petRef??null:null;useEffect(()=>{Gt&&!S.petId&&k({type:"patch",patch:{petId:Gt}});},[Gt,S.petId,k]);let sn=useRef(J);sn.current=J;let dn=useRef(0);useEffect(()=>{I!==dn.current&&(dn.current=I,k({type:"goTo",step:sn.current}));},[I,k]);let Xt=xe.data?.[0]?.clinicianId??null;useEffect(()=>{Xt&&!S.clinicianId&&k({type:"patch",patch:{clinicianId:Xt}});},[Xt,S.clinicianId,k]);let Li=useCallback(M=>{se(null),yt.mutate(M.slotId,{onSuccess:o(re=>{k({type:"patch",patch:{slot:M,holdExpiresAt:re.expiresAt,idempotencyKey:Cr(M.slotId)}}),k({type:"next"});},"onSuccess"),onError:o(re=>se(Pe(re).kind==="unavailable"?"unavailable":"taken"),"onError")});},[yt,k]),Qt=useCallback(M=>{if(!(!At(S,A)||!S.idempotencyKey)){if(Rr(S,Date.now())){se("expired"),k({type:"goTo",step:"time"});return}se(null),ve(null),$t.mutate({pet_id:S.petId,clinician_id:S.clinicianId,slot_id:S.slot.slotId,state:S.state,reason_text:A.trim(),species:null,media_refs:[],emergency_acknowledged:M,share_health_records:S.shareHealthRecords,...xr(Ce,be,Kt.data)},S.idempotencyKey,{onSuccess:o(re=>{Bi(re),k({type:"goTo",step:"booked"}),i?.(re);},"onSuccess"),onError:o(re=>{let de=Pe(re);if(de.kind==="emergency"){ve(de.categories);return}if(de.kind==="rate_limited"){Ye(de.message),se("rate_limited");return}se(de.kind==="not_entitled"?"not_entitled":de.kind==="slot_taken"?"taken":de.kind==="clinician_unavailable"?"clinician_unavailable":de.kind==="unavailable"?"unavailable":"failed"),de.kind==="slot_taken"&&k({type:"goTo",step:"time"});},"onError")});}},[S,A,$t,k,i,Ce,be,Kt.data]),zi=useCallback(()=>Qt(false),[Qt]),ji=qt.enabled&&qt.data!==null&&!qt.data.wellnessAvailable,Mi=an.enabled&&an.data?.active===false,Hi=A.trim().length>0||!!S.slot||!!S.clinicianId,Ui=w===null||ee==="unavailable";return ce()?jsxs(View,{style:[T.screen,h],testID:x??"televet-booking",children:[jsx(Kr,{step:J,furthestIndex:Q.furthestIndex,canGoBack:kr(Q,te)&&J!=="booked",isDirty:Hi,onBack:()=>k({type:"back"}),onClose:()=>l?.(),...d?{onConfirmDiscard:d}:{}}),Ui?jsx(View,{style:T.stepFill,testID:"televet-booking-unavailable",children:y?y():jsx(L,{title:c.bookingPausedTitle})}):Mi?jsx(View,{testID:"televet-booking-not-entitled",children:jsx(L,{title:c.confirmNotEntitled})}):ji?jsx(View,{testID:"televet-booking-state-blocked",children:jsx(L,{title:c.stateBlockedTitle})}):J==="time"?jsx(wi,{slots:ze.data??[],enabled:ze.enabled,isPending:ze.enabled&&ze.isPending,isError:ze.isError,busySlotId:yt.isPending?yt.variables:null,failure:ee,nextOpening:Ni,onPick:Li,onRetry:()=>ze.refetch(),onSeeOtherVets:()=>k({type:"goTo",step:"clinician"})}):J==="review"?jsx(Ii,{when:S.slot?ye(S.slot.startsAt):"",petName:Ht(P,S.petId),reason:A.trim(),clinician:xe.data?.find(M=>M.clinicianId===S.clinicianId)?.displayName??null,shareRecords:S.shareHealthRecords,stateCode:S.state,stateAttested:Ce,onToggleStateAttest:Ge,cancellationTerms:Kt.data?.summary??null,termsAttested:be,onToggleTermsAttest:Xe,onToggleShare:M=>k({type:"patch",patch:{shareHealthRecords:M}}),canConfirm:At(S,A),busy:$t.isPending,failure:ee,rateLimitMessage:on,onConfirm:zi,emergency:K,onAcknowledgeEmergency:()=>Qt(true),onSeeOtherVets:()=>k({type:"goTo",step:"clinician"})}):J==="booked"?jsx(View,{style:T.stepFill,testID:"televet-booking-booked",children:Wt?jsx(qr,{consult:Wt,petName:Ht(P,Wt.petId)??Ht(P,S.petId),onDone:()=>l?.(),canJoinInApp:p,...u?{onAddToCalendar:u}:{}}):null}):J==="clinician"&&!S.state?jsx(View,{testID:"televet-booking-location-unknown",children:jsx(L,{title:v==="blocked"?c.locationBlockedTitle:v==="unavailable"?c.locationUnavailableTitle:c.locationUnknownTitle,message:v==="blocked"?c.locationBlockedBody:v==="unavailable"?c.locationUnavailableBody:c.locationUnknownBody,actionLabel:f?v==="blocked"?c.locationBlockedCta:c.locationUnknownCta:void 0,onAction:f})}):J==="clinician"?jsx(xi,{clinicians:xe.data??[],isPending:xe.enabled&&xe.isPending,isError:xe.isError,selectedId:S.clinicianId,onRetry:()=>xe.refetch(),onSelect:M=>{k({type:"patch",patch:{clinicianId:M}}),k({type:"next"});}}):J==="reason"?jsx(Pi,{value:A,onChange:Z,media:Di,onChangeMedia:Vi,...s?{onPickMedia:s}:{},onNext:()=>k({type:"next"})}):J==="pet"?jsx(Ri,{pets:P,isPending:O.loading,isError:O.error!==null,onRetry:()=>{O.refresh();},onAddPet:a,selectedId:S.petId,onSelect:M=>{k({type:"patch",patch:{petId:M}}),k({type:"next"});}}):jsx(View,{style:V.marker,testID:`televet-booking-step-${J}`})]}):jsx(View,{style:[T.screen,h],testID:x??"televet-booking",children:jsx(View,{style:T.stepFill,testID:"televet-booking-copy-unapproved",children:y?y():jsx(Lt,{...t!==void 0?{petRef:t}:{},...r!==void 0?{usState:r}:{}})})})}o(rn,"EverfurTelevetBooking");function nn(e){let{consult:t,onRescheduled:r,onCancel:n,controller:i,style:l,testID:a}=je(e,["onRescheduled","onCancel"]),s=j(),u=it(i),d=lt(t?.clinicianId??null,u),f=at(u),v=Lr(t?.consultId??null,u),[p,y]=useState(null),h=useCallback(T=>{y(null),f.mutate(T.slotId,{onSuccess:o(()=>{v.mutate(T.slotId,{onSuccess:o(_=>r?.(_),"onSuccess"),onError:o(_=>y(Pe(_).kind==="unavailable"?"unavailable":"failed"),"onError")});},"onSuccess"),onError:o(_=>y(Pe(_).kind==="unavailable"?"unavailable":"taken"),"onError")});},[f,v,r]),x=f.isPending||v.isPending;return ce()?t?jsxs(View,{style:[s.stepFill,l],testID:a??"televet-reschedule",children:[jsx(b,{tier:"compact",style:s.stepHelp,children:ue(c.rescheduleFromTemplate,{when:ye(t.scheduledAt)})}),p==="taken"?jsx(G,{message:c.slotTaken}):null,p==="failed"?jsx(G,{message:c.rescheduleFailed}):null,p==="unavailable"?jsx(G,{message:c.bookingPausedTitle,testID:"televet-reschedule-unavailable"}):null,d.enabled?d.isPending?jsx(View,{style:s.list,testID:"televet-reschedule-slots-loading",children:[0,1,2].map(T=>jsx(Ve,{height:48},T))}):d.isError?jsx(L,{title:c.slotsErrorTitle,actionLabel:c.retryCta,onAction:()=>d.refetch(),testID:"televet-reschedule-slots-error"}):(d.data??[]).length===0?jsx(View,{testID:"televet-reschedule-empty",children:jsx(L,{title:c.noSlotsTitle})}):jsx(ct,{slots:d.data??[],busySlotId:x?f.variables:null,onPick:h,rowTestIdPrefix:"televet-reschedule-slot",testID:"televet-reschedule-slots"}):jsx(View,{testID:"televet-reschedule-paused",children:jsx(L,{title:c.bookingPausedTitle})}),jsx($,{label:c.keepExistingCta,kind:"secondary",disabled:x,onPress:()=>n?.(),testID:"televet-reschedule-keep"})]}):jsx(View,{style:[s.list,l],testID:"televet-reschedule-loading",children:[0,1].map(T=>jsx(Ve,{height:48},T))}):jsx(View,{style:[s.stepFill,l],testID:"televet-reschedule-copy-unapproved"})}o(nn,"EverfurTelevetReschedule");var Ai=Object.freeze({name:"booking"});function ad(e,t){switch(t.type){case "push":return Object.freeze({stack:Object.freeze([...e.stack,t.screen])});case "pop":return e.stack.length<=1?e:Object.freeze({stack:Object.freeze(e.stack.slice(0,-1))});default:return e}}o(ad,"navReducer");function Fi(e){let{style:t,renderPending:r,...n}=je(e,["onExit","onBooked","onAddPet","onRequestLocation"]);return jsx(Mn,{capability:"televet",style:t,...r?{renderPending:r}:{},children:jsx(sd,{...n,style:t})})}o(Fi,"EverfurTelevetFlow");function sd({petRef:e,usState:t,controller:r,onBooked:n,onExit:i,onAddPet:l,onPickMedia:a,onAddToCalendar:s,onConfirmDiscard:u,onRequestLocation:d,locationStatus:f,canJoinInApp:v=false,renderUnavailable:p,initialScreen:y,style:h}){let x=j(),[T,_]=useReducer(ad,y??Ai,P=>Object.freeze({stack:Object.freeze([P])})),V=T.stack[T.stack.length-1]??Ai,w=T.stack.length;useEffect(()=>{let P=o(()=>w<=1?false:(_({type:"pop"}),true),"onBackPress"),I=BackHandler.addEventListener("hardwareBackPress",P);return ()=>{I.remove();}},[w]);let O=useCallback(()=>p?p():jsxs(View,{style:x.list,testID:"televet-hosted-fallback",children:[ce()?jsx(L,{title:c.bookingPausedTitle}):null,jsx(Lt,{...e!==void 0?{petRef:e}:{},...t!==void 0?{usState:t}:{}})]}),[p,x.list,e,t]);switch(V.name){case "booking":return jsx(rn,{...e!==void 0?{petRef:e}:{},...t!==void 0?{usState:t}:{},...r?{controller:r}:{},...n?{onBooked:n}:{},...i?{onExit:i}:{},...l?{onAddPet:l}:{},...a?{onPickMedia:a}:{},...s?{onAddToCalendar:s}:{},...u?{onConfirmDiscard:u}:{},...d?{onRequestLocation:d}:{},...f?{locationStatus:f}:{},canJoinInApp:v,renderUnavailable:O,style:h});case "reschedule":return jsx(nn,{consult:V.consult,...r?{controller:r}:{},onRescheduled:()=>_({type:"pop"}),onCancel:()=>_({type:"pop"}),style:h});default:return mt(V)}}o(sd,"TelevetFlowBody");var dd=Fi;export{gi as BACK_LABEL,wt as CANCELLATION_POLICY_VERSION_MAX,Co as CONSULT_KINDS,He as CONSULT_MINUTES,Ro as CONSULT_STATUSES,dd as EverfurTelevet,rn as EverfurTelevetBooking,Fi as EverfurTelevetFlow,nn as EverfurTelevetReschedule,Pt as MEDIA_REFS_MAX,pe as REASON_TEXT_MAX,ke as TELEVET_BOOKING_BASE,c as TELEVET_BOOKING_COPY,Fe as TELEVET_BOOKING_STEPS,Pa as TERMINAL_CONSULT_STATUSES,qr as TelevetBookedScreen,Kr as TelevetBookingChrome,dt as TelevetConsentCheckbox,Jr as TelevetDayStrip,Yr as TelevetIntakeMedia,ct as TelevetSlotPicker,Qr as TelevetSummaryCard,Ne as TelevetSummaryRow,xr as attestation,At as canConfirm,Pr as createTelevetBookingController,Sr as currentStep,Ao as emptyTelevetDraft,Oa as formatVisitRange,Do as formatWhen,ye as formatWhenWithDay,kr as hasPreviousStep,Er as initialTelevetBookingState,Rr as isHoldExpired,It as isSkipped,ce as isTelevetBookingCopyReady,ae as isWellFormedStateCode,Cr as televetBookingKey,_r as televetBookingReducer,Pe as televetBookingRefusal,fi as televetConsultCalendarKey,Mt as televetDaysFromSlots,jo as televetHoldCall,Mo as televetRescheduleCall,Nr as useTelevetBookConsult,ja as useTelevetBookingAvailable,it as useTelevetBookingController,Ar as useTelevetBookingEntitlement,Fr as useTelevetCancellationPolicy,Dr as useTelevetClinicians,at as useTelevetHoldSlot,Vr as useTelevetNextSlot,Lr as useTelevetRescheduleConsult,lt as useTelevetSlots,Or as useTelevetStatePolicy,Ho as validateBookingBody};
1
+ import {createContext,forwardRef,useMemo,createElement,useState,useRef,useEffect,useCallback,useReducer,useContext,useSyncExternalStore,Component}from'react';import {StyleSheet,TextInput,Pressable,View,Alert,BackHandler,Image,ActivityIndicator,ScrollView,Modal,Text}from'react-native';import {jsxs,Fragment,jsx}from'react/jsx-runtime';import {useSafeAreaInsets}from'react-native-safe-area-context';var Da=Object.defineProperty;var o=(e,t)=>Da(e,"name",{value:t,configurable:true});function Gt(e){throw new Error(`assertNever: unhandled discriminated-union member ${JSON.stringify(e)}`)}o(Gt,"assertNever");function Do(e){return Object.freeze({kind:"error",terminal:true,code:e.code,retryable:e.retryable,wireMessage:e.wireMessage,synthesized:e.synthesized,lastEventId:e.lastEventId,serverRequestId:e.serverRequestId??null})}o(Do,"errorFrame");function zn(e){let t=globalThis.console;try{t?.error?.("[everfur] A host callback threw; the SDK ignored it.",e);}catch{}}o(zn,"reportHostFailure");function La(e){return (typeof e=="object"||typeof e=="function")&&e!==null&&typeof e.then=="function"}o(La,"isThenable");function Jt(e,...t){if(typeof e=="function")try{let n=e(...t);return La(n)&&Promise.resolve(n).then(void 0,zn),n}catch(n){zn(n);return}}o(Jt,"callHost");var Fo=new WeakMap;function Va(e){if(typeof e!="function")return;let t=Fo.get(e);if(t!==void 0)return t;let n=o((...r)=>{Jt(e,...r);},"guarded");return Fo.set(e,n),n}o(Va,"guardHost");function nt(e,t){let n=null;for(let r of t){let i=e[r];typeof i=="function"&&(n??={...e},n[r]=Va(i));}return n??e}o(nt,"guardHostProps");function Xt(e,...t){let n;try{n=e(...t);}catch(r){return zn(r),Promise.resolve({ok:false,error:r})}return Promise.resolve(n).then(r=>({ok:true,value:r}),r=>({ok:false,error:r}))}o(Xt,"callHostAsync");function No(){let e=[];return {register(t){return e=[...e,t],()=>{e=e.filter(n=>n!==t);}},dispatch(){for(let t of [...e].reverse())try{if(t())return !0}catch{}return false}}}o(No,"createTelevetBackChannel");var Mn=createContext(null);function rt(e,t=true){let n=useContext(Mn),r=useRef(e);r.current=e,useEffect(()=>{if(!(n===null||!t))return n.register(()=>r.current())},[n,t]);}o(rt,"useTelevetBackChannel");var m=o(e=>e,"DRAFT"),Ua=["[PLACEHOLDER","[PLAN NAME]","[LINK]","[Last]","TODO","TBD"];function Wa(e){return Ua.some(t=>e.toUpperCase().includes(t.toUpperCase()))}o(Wa,"isPlaceholderCopy");function ne(e,t){let n=e;for(let[r,i]of Object.entries(t))n=n.split(`{${r}}`).join(i);return n}o(ne,"fill");var u=Object.freeze({stateBlockedTitle:m("Not available in this state yet"),noCliniciansTitle:m("No vets available right now"),noCliniciansBody:m("Nobody is free in your area at the moment. This changes through the day."),noCliniciansRetryCta:m("Check again"),noCliniciansRegionBody:m("Video visits have to be with a vet licensed in your state, and we don\u2019t have one there yet."),yourVetTitle:m("Your Vet"),reviewsLabel:m("reviews"),rescheduleFromTemplate:m("Moving your visit on {when}"),rescheduleFailed:m("That did not move. Your original time is unchanged."),keepExistingCta:m("Keep my current time"),bookingPausedTitle:m("Booking is not available right now."),slotsErrorTitle:m("Could not load times"),noSlotsTitle:m("No times available"),nextOpeningTemplate:m("Next opening across our vets: {when}"),seeOtherVetsCta:m("See other vets"),retryCta:m("Try again"),holdExpired:m("That time is no longer held. Pick another."),slotTaken:m("That time was just taken. Pick another."),reasonPlaceholder:m("What is going on with your pet?"),reasonTooLong:m("That is too long. Please shorten it."),shareRecordsOff:m("Share health records with this vet"),confirmNotEntitled:m("A Pro membership is needed to book a video visit."),confirmFailed:m("That did not book. Try again."),checkAvailabilityCta:m("Check availability"),stateInterest:Object.freeze({cta:m("Add me to the list"),submitting:m("Adding you to the list\u2026"),joinedTitle:m("You are on the list"),joinedBody:m("We will let you know when this changes."),failed:m("That did not save. Try again.")}),media:Object.freeze({droppedTemplate:m("{n} attachment did not upload."),droppedPluralTemplate:m("{n} attachments did not upload."),refusedSizeTemplate:m("{n} attachment was too large to send."),refusedSizePluralTemplate:m("{n} attachments were too large to send."),refusedTypeTemplate:m("{n} attachment is a file type that cannot be sent."),refusedTypePluralTemplate:m("{n} attachments are file types that cannot be sent."),refusedUnreadableTemplate:m("{n} attachment could not be read."),refusedUnreadablePluralTemplate:m("{n} attachments could not be read.")}),navTitle:m("Book a visit"),rescheduleNavTitle:m("Change your visit"),close:m("Close"),continueCta:m("Continue"),petSelectTitle:m("Who is this visit for?"),addPetCta:m("Add a pet"),locationUnknownTitle:m("We need your location to find a vet"),locationUnknownBody:m("Turn on location for Everfur, then try again."),locationUnknownCta:m("Allow location"),locationBlockedTitle:m("Location is turned off"),locationBlockedBody:m("Everfur needs your location to match you with a vet in your area."),locationBlockedCta:m("Open Settings"),locationUnavailableTitle:m("We could not read your location"),locationUnavailableBody:m("Try again in a moment."),stateAttestTemplate:m("I confirm my pet and I are in {state} right now."),describeHeading:m("Tell the vet what you are seeing"),describeHelpLong:m("A few sentences is plenty. When it started, what changed, anything you've already tried."),addPhotoCta:m("ADD PHOTO OR VIDEO"),removePhotoLabel:m("Remove photo"),summaryPet:m("Pet"),summaryVet:m("Vet"),summaryWhen:m("When"),summaryLength:m("Length"),summaryReason:m("Reason"),summaryLengthTemplate:m("{n} minutes"),confirmCta:m("Confirm visit"),bookedTitle:m("You are booked."),addToCalendarCta:m("Add to calendar"),doneCta:m("Done"),booked:Object.freeze({remindPromise:m("We will notify you 30 minutes before."),summaryPromise:m("{pet}'s summary goes to the vet ahead of the call."),joinPromise:m("Join right here in the app. No links to hunt for."),backToPet:m("Back to {pet}"),calendarAdded:m("Added to your calendar"),calendarFailedBody:m("That did not save to your calendar.")}),chrome:Object.freeze({closeHint:m("Closes without saving"),discardTitle:m("Leave without booking?"),discardBody:m("Your answers will not be saved."),discardConfirmCta:m("Leave"),discardKeepCta:m("Keep going"),noPetsTitle:m("No pets on this account"),loadFailedTitle:m("Could not load"),retryCta:m("Try again")}),emergency:Object.freeze({bannerTitle:m("This cannot wait for a scheduled call."),keepBookingCta:m("I have handled this, keep booking"),lede:m("What you are describing is the kind of thing vets want to see in person, now."),exitPrimaryVetTitle:m("Call {petName}'s primary vet"),exitFindErTitle:m("Find an emergency vet near you"),startCallHint:m("Starts a phone call")}),visit:Object.freeze({title:m("Your visit")}),loading:Object.freeze({pets:"Loading pets. Nothing to read yet.",clinicians:"Loading vets. Nothing to read yet.",slots:"Loading times. Nothing to read yet.",consult:"Loading your visit. Nothing to read yet.",progressTemplate:"Step {step} of {total}"})});function Lo(e=u){return typeof e=="string"?[e]:typeof e!="object"||e===null?[]:Object.values(e).flatMap(t=>Lo(t))}o(Lo,"televetBookingCopyValues");function Se(){return Lo().every(e=>e.trim().length>0&&!Wa(e))}o(Se,"isTelevetBookingCopyReady");var jn=Object.freeze([Object.freeze({wireCode:"AccessDeniedException",envelope:"http_envelope",httpStatus:403,retryable:false}),Object.freeze({wireCode:"AuthorizationException",envelope:"http_envelope",httpStatus:401,retryable:false}),Object.freeze({wireCode:"ConflictException",envelope:"http_envelope",httpStatus:409,retryable:true}),Object.freeze({wireCode:"DAILY_QUOTA_EXCEEDED",envelope:"http_envelope",httpStatus:429,retryable:true}),Object.freeze({wireCode:"FILE_TOO_LARGE",envelope:"http_envelope",httpStatus:400,retryable:false}),Object.freeze({wireCode:"IDEMPOTENCY_KEY_IN_FLIGHT",envelope:"http_envelope",httpStatus:409,retryable:true}),Object.freeze({wireCode:"IDEMPOTENCY_KEY_REUSED_DIFFERENT_REQUEST",envelope:"http_envelope",httpStatus:409,retryable:false}),Object.freeze({wireCode:"INVALID_CONTENT_TYPE",envelope:"http_envelope",httpStatus:400,retryable:false}),Object.freeze({wireCode:"InternalFailureException",envelope:"http_envelope",httpStatus:500,retryable:true}),Object.freeze({wireCode:"MethodNotAllowedException",envelope:"http_envelope",httpStatus:405,retryable:false}),Object.freeze({wireCode:"NotImplementedException",envelope:"http_envelope",httpStatus:501,retryable:false}),Object.freeze({wireCode:"PaymentRequiredException",envelope:"http_envelope",httpStatus:402,retryable:false}),Object.freeze({wireCode:"ResourceNotFoundException",envelope:"http_envelope",httpStatus:404,retryable:false}),Object.freeze({wireCode:"ServiceUnavailableException",envelope:"http_envelope",httpStatus:503,retryable:true}),Object.freeze({wireCode:"TIER_UPGRADE_REQUIRED",envelope:"http_envelope",httpStatus:402,retryable:false}),Object.freeze({wireCode:"ThrottlingException",envelope:"http_envelope",httpStatus:429,retryable:true}),Object.freeze({wireCode:"ValidationException",envelope:"http_envelope",httpStatus:400,retryable:false}),Object.freeze({wireCode:"accessDenied",envelope:"http_envelope",httpStatus:403,retryable:false}),Object.freeze({wireCode:"access_denied",envelope:"oauth_error",httpStatus:302,retryable:false}),Object.freeze({wireCode:"attachment_unreadable",envelope:"http_envelope",httpStatus:400,retryable:false}),Object.freeze({wireCode:"authExpired",envelope:"http_envelope",httpStatus:401,retryable:true}),Object.freeze({wireCode:"authRejected",envelope:"http_envelope",httpStatus:401,retryable:false}),Object.freeze({wireCode:"consent_invalid",envelope:"http_envelope",httpStatus:422,retryable:false}),Object.freeze({wireCode:"consent_required",envelope:"http_envelope",httpStatus:422,retryable:false}),Object.freeze({wireCode:"consent_scope_wrong_route",envelope:"http_envelope",httpStatus:400,retryable:false}),Object.freeze({wireCode:"device_cipher_unavailable",envelope:"http_envelope",httpStatus:503,retryable:true}),Object.freeze({wireCode:"email_invalid",envelope:"http_envelope",httpStatus:422,retryable:false}),Object.freeze({wireCode:"event_cursor_invalid",envelope:"http_envelope",httpStatus:400,retryable:false}),Object.freeze({wireCode:"event_filter_invalid",envelope:"http_envelope",httpStatus:400,retryable:false}),Object.freeze({wireCode:"event_payload_invalid",envelope:"http_envelope",httpStatus:400,retryable:false}),Object.freeze({wireCode:"event_type_not_available",envelope:"http_envelope",httpStatus:400,retryable:false}),Object.freeze({wireCode:"event_type_unknown",envelope:"http_envelope",httpStatus:400,retryable:false}),Object.freeze({wireCode:"idempotency_key_invalid",envelope:"http_envelope",httpStatus:400,retryable:false}),Object.freeze({wireCode:"idempotency_key_required",envelope:"http_envelope",httpStatus:400,retryable:false}),Object.freeze({wireCode:"idempotency_key_reused",envelope:"http_envelope",httpStatus:409,retryable:false}),Object.freeze({wireCode:"insufficientCapability",envelope:"http_envelope",httpStatus:403,retryable:false}),Object.freeze({wireCode:"insufficient_scope",envelope:"http_envelope",httpStatus:403,retryable:false}),Object.freeze({wireCode:"internal_error",envelope:"sse_frame",httpStatus:200,retryable:false}),Object.freeze({wireCode:"invalidRequest",envelope:"http_envelope",httpStatus:400,retryable:false}),Object.freeze({wireCode:"invalid_client",envelope:"oauth_error",httpStatus:401,retryable:false}),Object.freeze({wireCode:"invalid_client_metadata",envelope:"oauth_error",httpStatus:400,retryable:false}),Object.freeze({wireCode:"invalid_grant",envelope:"oauth_error",httpStatus:400,retryable:false}),Object.freeze({wireCode:"invalid_redirect_uri",envelope:"oauth_error",httpStatus:400,retryable:false}),Object.freeze({wireCode:"invalid_request",envelope:"oauth_error",httpStatus:400,retryable:false}),Object.freeze({wireCode:"invalid_scope",envelope:"oauth_error",httpStatus:400,retryable:false}),Object.freeze({wireCode:"invalid_target",envelope:"oauth_error",httpStatus:400,retryable:false}),Object.freeze({wireCode:"mcp_connection_not_found",envelope:"http_envelope",httpStatus:404,retryable:false}),Object.freeze({wireCode:"mcp_request_conflict",envelope:"http_envelope",httpStatus:409,retryable:false}),Object.freeze({wireCode:"mcp_request_gone",envelope:"http_envelope",httpStatus:410,retryable:false}),Object.freeze({wireCode:"mcp_request_not_found",envelope:"http_envelope",httpStatus:404,retryable:false}),Object.freeze({wireCode:"not_found",envelope:"sse_frame",httpStatus:200,retryable:false}),Object.freeze({wireCode:"partner_visit_link_conflict",envelope:"http_envelope",httpStatus:409,retryable:false}),Object.freeze({wireCode:"partner_visit_owner_only",envelope:"http_envelope",httpStatus:403,retryable:false}),Object.freeze({wireCode:"partner_visit_pet_already_mapped",envelope:"http_envelope",httpStatus:409,retryable:false}),Object.freeze({wireCode:"payload_too_large",envelope:"http_envelope",httpStatus:413,retryable:false}),Object.freeze({wireCode:"petRefInUse",envelope:"http_envelope",httpStatus:409,retryable:false}),Object.freeze({wireCode:"pet_health_list_removals_unconfirmed",envelope:"http_envelope",httpStatus:422,retryable:false}),Object.freeze({wireCode:"pet_health_species_unsupported",envelope:"http_envelope",httpStatus:422,retryable:false}),Object.freeze({wireCode:"pet_not_registered",envelope:"http_envelope",httpStatus:404,retryable:false}),Object.freeze({wireCode:"provider_unsupported",envelope:"http_envelope",httpStatus:422,retryable:false}),Object.freeze({wireCode:"rateLimited",envelope:"http_envelope",httpStatus:429,retryable:true}),Object.freeze({wireCode:"record_species_unsupported",envelope:"http_envelope",httpStatus:422,retryable:false}),Object.freeze({wireCode:"record_subject_not_found",envelope:"http_envelope",httpStatus:404,retryable:false}),Object.freeze({wireCode:"record_upload_invalid",envelope:"http_envelope",httpStatus:400,retryable:false}),Object.freeze({wireCode:"records_consent_required",envelope:"http_envelope",httpStatus:409,retryable:false}),Object.freeze({wireCode:"sandbox_only",envelope:"http_envelope",httpStatus:403,retryable:false}),Object.freeze({wireCode:"session_required",envelope:"http_envelope",httpStatus:403,retryable:false}),Object.freeze({wireCode:"share_limit_reached",envelope:"http_envelope",httpStatus:429,retryable:false}),Object.freeze({wireCode:"slow_down",envelope:"oauth_error",httpStatus:429,retryable:true}),Object.freeze({wireCode:"species_unsupported",envelope:"http_envelope",httpStatus:422,retryable:false}),Object.freeze({wireCode:"tenant_filter_invalid",envelope:"http_envelope",httpStatus:400,retryable:false}),Object.freeze({wireCode:"tenant_has_no_capabilities",envelope:"http_envelope",httpStatus:409,retryable:false}),Object.freeze({wireCode:"tenant_resource_not_found",envelope:"http_envelope",httpStatus:404,retryable:false}),Object.freeze({wireCode:"tenant_surface_not_enabled",envelope:"http_envelope",httpStatus:409,retryable:false}),Object.freeze({wireCode:"timeout",envelope:"sse_frame",httpStatus:200,retryable:true}),Object.freeze({wireCode:"token_invalid",envelope:"http_envelope",httpStatus:422,retryable:false}),Object.freeze({wireCode:"unavailable",envelope:"sse_frame",httpStatus:200,retryable:true}),Object.freeze({wireCode:"unavailable",envelope:"http_envelope",httpStatus:503,retryable:true}),Object.freeze({wireCode:"unsupported_grant_type",envelope:"oauth_error",httpStatus:400,retryable:false}),Object.freeze({wireCode:"unsupported_response_type",envelope:"oauth_error",httpStatus:302,retryable:false}),Object.freeze({wireCode:"verify_mint_rate_limited",envelope:"http_envelope",httpStatus:429,retryable:true}),Object.freeze({wireCode:"verify_mint_refused",envelope:"http_envelope",httpStatus:403,retryable:false}),Object.freeze({wireCode:"verify_mint_unavailable",envelope:"http_envelope",httpStatus:503,retryable:true}),Object.freeze({wireCode:"verify_user_ref_invalid",envelope:"http_envelope",httpStatus:422,retryable:false}),Object.freeze({wireCode:"webhook_endpoint_update_empty",envelope:"http_envelope",httpStatus:400,retryable:false}),Object.freeze({wireCode:"webhook_endpoint_update_invalid",envelope:"http_envelope",httpStatus:400,retryable:false}),Object.freeze({wireCode:"webhook_url_rejected",envelope:"http_envelope",httpStatus:400,retryable:false})]);Object.freeze(jn.map(e=>e.wireCode));var $a=Object.freeze({ValidationException:"validationFailed",AuthorizationException:"authRejected",PaymentRequiredException:"paymentRequired",AccessDeniedException:"accessDenied",ResourceNotFoundException:"resourceNotFound",ConflictException:"conflict",ThrottlingException:"rateLimited",InternalFailureException:"internalError",NotImplementedException:"notImplemented",ServiceUnavailableException:"serviceUnavailable",MethodNotAllowedException:"validationFailed",authExpired:"authExpired",unavailable:"serviceUnavailable",session_required:"sessionRequired",accessDenied:"accessDenied",invalidRequest:"sdkUpdateRequired",authRejected:"authRejected",rateLimited:"rateLimited",insufficientCapability:"accessDenied",event_cursor_invalid:"validationFailed",event_filter_invalid:"validationFailed",event_payload_invalid:"validationFailed",event_type_unknown:"validationFailed",idempotency_key_invalid:"validationFailed",idempotency_key_required:"validationFailed",idempotency_key_reused:"idempotencyConflict",payload_too_large:"validationFailed",webhook_url_rejected:"validationFailed",webhook_endpoint_update_empty:"validationFailed",webhook_endpoint_update_invalid:"validationFailed",event_type_not_available:"conflict",record_subject_not_found:"resourceNotFound",records_consent_required:"conflict",record_species_unsupported:"validationFailed",record_upload_invalid:"validationFailed",FILE_TOO_LARGE:"validationFailed",INVALID_CONTENT_TYPE:"validationFailed",attachment_unreadable:"validationFailed",provider_unsupported:"validationFailed",token_invalid:"validationFailed",device_cipher_unavailable:"serviceUnavailable",email_invalid:"validationFailed",consent_required:"validationFailed",consent_invalid:"validationFailed",consent_scope_wrong_route:"validationFailed",IDEMPOTENCY_KEY_IN_FLIGHT:"idempotencyInFlight",IDEMPOTENCY_KEY_REUSED_DIFFERENT_REQUEST:"idempotencyConflict",DAILY_QUOTA_EXCEEDED:"quotaExceeded",TIER_UPGRADE_REQUIRED:"paymentRequired",not_found:"conversationNotFound",timeout:"streamTimeout",internal_error:"internalError",invalid_request:"validationFailed",invalid_client:"authRejected",invalid_grant:"authRejected",unsupported_grant_type:"validationFailed",invalid_scope:"validationFailed",invalid_target:"validationFailed",invalid_redirect_uri:"validationFailed",invalid_client_metadata:"validationFailed",unsupported_response_type:"validationFailed",access_denied:"accessDenied",slow_down:"rateLimited",mcp_request_not_found:"resourceNotFound",mcp_request_gone:"resourceNotFound",mcp_connection_not_found:"resourceNotFound",mcp_request_conflict:"conflict",sandbox_only:"accessDenied",tenant_has_no_capabilities:"conflict",verify_mint_refused:"accessDenied",verify_mint_rate_limited:"rateLimited",verify_mint_unavailable:"serviceUnavailable",verify_user_ref_invalid:"validationFailed",insufficient_scope:"accessDenied",tenant_filter_invalid:"validationFailed",tenant_resource_not_found:"resourceNotFound",tenant_surface_not_enabled:"conflict",pet_health_species_unsupported:"validationFailed",pet_health_list_removals_unconfirmed:"validationFailed",petRefInUse:"conflict",share_limit_reached:"conflict",pet_not_registered:"resourceNotFound",species_unsupported:"validationFailed",partner_visit_owner_only:"accessDenied",partner_visit_link_conflict:"conflict",partner_visit_pet_already_mapped:"conflict"}),zo=Object.freeze(jn.map(e=>Object.freeze({wireCode:e.wireCode,envelope:e.envelope,retryable:e.retryable,normalized:$a[e.wireCode]}))),Ka=new Map(zo.map(e=>[e.envelope+e.wireCode.toUpperCase(),e])),Ya=Object.freeze(["http_envelope",...[...new Set(zo.map(e=>e.envelope))].filter(e=>e!=="http_envelope").sort()]);function Qt(e,t){if(typeof e!="string")return;let n=e.trim().toUpperCase();if(n.length!==0)for(let r of [t??"http_envelope",...Ya]){let i=Ka.get(r+n);if(i)return i}}o(Qt,"contractErrorFor");function Ga(e){return e.envelope==="sse_frame"?`/errors#sse-${e.wireCode}`:e.envelope==="oauth_error"?`/errors#oauth-${e.wireCode}`:`/errors#${e.wireCode}`}o(Ga,"contractDocUrl");function Mo(e){return null}o(Mo,"publishedDocUrl");var Ja=Object.freeze({authExpired:"authentication",authRejected:"authentication",sessionRequired:"authentication",accessDenied:"authorization",paymentRequired:"entitlement",quotaExceeded:"rateLimit",rateLimited:"rateLimit",validationFailed:"invalidRequest",sdkUpdateRequired:"invalidRequest",conversationNotFound:"notFound",petNotFound:"notFound",resourceNotFound:"notFound",conflict:"conflict",idempotencyConflict:"conflict",idempotencyInFlight:"conflict",streamTimeout:"connection",streamIncomplete:"connection",upstreamLlmTimeout:"connection",serviceUnavailable:"connection",internalError:"server",notImplemented:"server",mediaUploadFailed:"media",moderationBlocked:"policy",unknown:"unknown"});function jo(e){return Ja[e]}o(jo,"categoryFor");function Ho(e){let t=Qt(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":return "rateLimited";case "IDEMPOTENCYKEYCONFLICT":case "IDEMPOTENCYCONFLICT":return "idempotencyConflict";case "ACCESSDENIED":case "FORBIDDEN":return "accessDenied";case "NOTFOUND":case "CONVERSATIONNOTFOUND":return "conversationNotFound";case "PETNOTFOUND":return "petNotFound";case "TIMEOUT":case "STREAMTIMEOUT":return "streamTimeout";case "MEDIAUPLOADFAILED":case "UNRECOGNIZEDVIDEOFORMAT":case "FILETOOSMALL":return "mediaUploadFailed";case "MODERATIONBLOCKED":return "moderationBlocked";case "UPSTREAMLLMTIMEOUT":return "upstreamLlmTimeout";case "INTERNALERROR":case "INTERNALSERVERERROR":return "internalError";case "STREAMINCOMPLETE":case "CHATSTREAMINCOMPLETE":return "streamIncomplete";case "INVALIDANALYSISTYPE":case "INVALIDUPLOADPURPOSE":return "unknown";default:return "unknown"}}o(Ho,"fromWire");var Xa=new Set(["streamTimeout","rateLimited","internalError","upstreamLlmTimeout","streamIncomplete"]);function Hn(e){return Xa.has(e)}o(Hn,"isAutoRetryable");var Qa=new Set(["serviceUnavailable","conflict","idempotencyInFlight"]);function Uo(e){return Hn(e)||Qa.has(e)}o(Uo,"isRetryableCode");var Za=500,Un=8e3,Wo=4;function qo(e,t=Math.random){let n=Math.max(0,e),r=Math.min(Za*2**n,Un);return Math.floor(t()*r)}o(qo,"backoffDelayMs");var es=Object.freeze({authExpired:"Please sign in again to continue.",authRejected:"Please sign in again to continue.",sessionRequired:"This app needs to be updated to keep using Everfur.",accessDenied:"This feature isn't available on your account right now.",paymentRequired:"This is part of a paid plan.",quotaExceeded:"You have used today's messages. This resets tomorrow.",rateLimited:"You are sending messages quickly. Try again in a few seconds.",validationFailed:"Something in that request was not right. Check the details and try again.",sdkUpdateRequired:"This app needs to be updated to keep using Everfur.",conflict:"That is already running. Wait for it to finish, then try again.",idempotencyConflict:"That message was already delivered.",idempotencyInFlight:"That is still processing. Give it a moment.",conversationNotFound:"This conversation is no longer available.",petNotFound:"We could not find that pet. Please pick a pet and try again.",resourceNotFound:"We could not find that.",streamTimeout:"The response timed out. Tap retry to try again.",mediaUploadFailed:"We could not upload that photo. Please attach it again.",moderationBlocked:"This request cannot be answered here.",upstreamLlmTimeout:"The response timed out. Tap retry to try again.",internalError:"We hit a snag on our end. Please try again.",notImplemented:"That is not available yet.",serviceUnavailable:"That service is briefly unavailable. Try again shortly.",streamIncomplete:"The connection dropped mid-answer. Tap retry to continue.",unknown:"Something went wrong. Please try again."});function Wn(e){return es[e]}o(Wn,"userFacingError");function $o(e,t,n){Object.defineProperty(e,t,{value:n,enumerable:false,writable:false,configurable:false});}o($o,"defineHidden");var ts=/^[a-z][a-z0-9_]{0,63}$/;function ye(e,t){let n=Qt(t?.wireCode,t?.wireEnvelope),r={code:e,category:jo(e),retryable:t?.retryable??Uo(e),displayMessage:Wn(e)};if(t?.httpStatus!==void 0&&(r.httpStatus=t.httpStatus),t?.requestId&&(r.requestId=t.requestId),typeof t?.reasonCode=="string"&&ts.test(t.reasonCode)&&(r.reasonCode=t.reasonCode),n);return t?.wireMessage&&$o(r,"wireMessage",t.wireMessage),t?.raw!==void 0&&t.raw!==null&&$o(r,"raw",t.raw),Object.freeze(r)}o(ye,"makeEverfurError");function L(e,t){return Object.freeze(t===void 0?{ok:true,value:e}:{ok:true,value:e,warning:t})}o(L,"ok");function w(e){return Object.freeze({ok:false,error:e})}o(w,"err");var Zt=class Zt extends Error{constructor(t,n){super(n),this.name="EverfurConfigError",this.kind=t,Object.setPrototypeOf(this,Zt.prototype);}};o(Zt,"EverfurConfigError");var bt=Zt;function ns(e){let t={};return e.mode==="personalized"?t.authorization=`Bearer ${e.token}`:t["x-everfur-partner-key"]=e.publishableKey,e.userRef&&(t["x-everfur-user-ref"]=e.userRef),e.sessionId&&(t["x-everfur-session-id"]=e.sessionId),t}o(ns,"authHeaders");function ht(e,t){return {...e,headers:{...rs(e.headers),...ns(t)}}}o(ht,"withAuthHeaders");function rs(e){if(!e)return {};let t={};for(let[n,r]of Object.entries(e)){let i=n.toLowerCase();i==="authorization"||i==="x-everfur-partner-key"||(t[n]=r);}return t}o(rs,"stripAuthHeaders");async function Ko(e,t){if(t.mode==="anonymous")return t.transport.request(ht(e,{mode:"anonymous",publishableKey:t.publishableKey,userRef:t.userRef,...t.sessionId?{sessionId:t.sessionId}:{}}));let n;try{n=await t.identity.currentToken();}catch{return w(qn())}let r=await t.transport.request(ht(e,{mode:"personalized",token:n,userRef:t.userRef,...t.sessionId?{sessionId:t.sessionId}:{}}));if(r.ok||r.error.httpStatus!==401)return r;let i;try{i=await t.identity.currentToken({forceRefresh:!0});}catch{return w(qn())}let l=await t.transport.request(ht(e,{mode:"personalized",token:i,userRef:t.userRef,...t.sessionId?{sessionId:t.sessionId}:{}}));return !l.ok&&l.error.httpStatus===401?w(qn(l.error.httpStatus)):l}o(Ko,"authedSend");function qn(e){return ye("authRejected",{retryable:false,...e!==void 0?{httpStatus:e}:{}})}o(qn,"authRejectedError");function Yo(e){return ye("internalError",{retryable:true,wireMessage:os(e)})}o(Yo,"networkError");function os(e){return e instanceof Error?e.message:typeof e=="string"?e:"network request failed"}o(os,"describeCause");var ls=3e4,is=Un*2,as="idempotency-key",ss=new Set(["POST","PUT","PATCH","DELETE"]),ds=Object.freeze({onEvent(){}}),cs=Object.freeze({setTimeout:o((e,t)=>setTimeout(e,t),"setTimeout"),clearTimeout:o(e=>clearTimeout(e),"clearTimeout"),now:o(()=>Date.now(),"now")});function us(e){let t=e.trim().replace(/[^A-Za-z0-9_.:-]/g,"-");return t.length===0?null:`efs_${t}`.slice(0,128)}o(us,"seededIdempotencyKey");function Tt(e){let t=e.observer??ds,n=e.timers??cs,r=e.rng??Math.random,i=e.sleep??((f,y)=>Ss(f,n,y)),l=e.maxAttempts??Wo,a=e.unaryTimeoutMs??ls,s=e.newIdempotencyKey??fs(),c=o(f=>{try{t.onEvent(f);}catch{}},"emit");async function d(f,y,E){let _=E?.maxAttempts,P=Math.max(1,_??l),h=E?.idempotent??ss.has(y.method),T=E?.idempotencyKey===void 0?null:us(E.idempotencyKey),R=h?T??s():null,O=ps(y,R),C=0;for(;;){let q=o(oe=>Object.freeze({call:f,method:y.method,path:y.path,attempt:C,...R?{idempotencyKey:R}:{},...oe}),"stamp");c(q({phase:"attempt"}));let D=ks(a,n),z=Cs(D.signal,y.signal),N;try{N=await Ko({...O,signal:z.signal},e.auth);}catch(oe){N=w(Yo(oe));}finally{z.dispose(),D.cancel();}if(N.ok)return c(q({phase:"settled",ok:true,reason:"ok"})),N;let K=N.error,fe=ms(K,C,{maxAttempts:P,rng:r,now:n.now(),aborted:y.signal?.aborted===true,..._!==void 0?{perCallMaxAttempts:_}:{},...e.errorPolicy!==void 0?{policy:e.errorPolicy}:{}}),Q={ok:false,code:K.code,reason:fe.reason,...K.httpStatus!==void 0?{httpStatus:K.httpStatus}:{},...K.requestId!==void 0?{requestId:K.requestId}:{}};if(!fe.retry)return c(q({phase:"settled",...Q})),w(K);if(c(q({phase:"retry",...Q,delayMs:fe.delayMs})),await i(fe.delayMs,y.signal),y.signal?.aborted===true)return c(q({phase:"settled",...Q,reason:"aborted"})),w(K);C+=1;}}o(d,"send");async function p(f){return ht(f,await Es(e.auth))}o(p,"authorize");async function*g(f,y,E){c(Object.freeze({call:f,phase:"stream.open",method:y.method,path:y.path,attempt:0}));try{yield*e.auth.transport.stream(y,E);}catch{yield Do({code:"internal_error",retryable:true,wireMessage:null,synthesized:true,lastEventId:null,serverRequestId:null});}}return o(g,"stream"),Object.freeze({send:d,authorize:p,stream:g})}o(Tt,"createRequestFunnel");function ps(e,t){let n={};for(let[r,i]of Object.entries(e.headers??{}))r.toLowerCase()!==as&&(n[r]=i);return t!==null&&(n["Idempotency-Key"]=t),{...e,headers:n}}o(ps,"assembleHeaders");function fs(){let e=0;return ()=>`efk_${Date.now().toString(36)}_${(e++).toString(36)}_${Math.random().toString(36).slice(2,12)}`}o(fs,"defaultIdempotencyKeyFactory");var ys=10;function ms(e,t,n){if(n.aborted)return {retry:false,reason:"aborted"};let r=vs(e);if(r==="quota")return {retry:false,reason:"daily-quota-exhausted"};if(r!=="burst"&&!Hn(e.code))return {retry:false,reason:"terminal-code"};let i=r==="burst"?"burst-throttle":"retryable-code";if(o(()=>{if(n.policy===void 0)return false;try{return !n.policy.shouldRetry(e.code,t)}catch{return false}},"policyVetoedRetry")())return {retry:false,reason:"terminal-code"};let a=o(()=>{if(n.policy===void 0)return null;let d;try{d=n.policy.maxAttempts(e.code);}catch{return null}return typeof d!="number"||!Number.isFinite(d)?null:Math.max(1,Math.min(ys,Math.floor(d)))},"policyCeiling"),s=n.perCallMaxAttempts??a()??n.maxAttempts;if(t+1>=s)return {retry:false,reason:"attempts-exhausted"};let c=gs(e,n.now);return c!==null?c>is?{retry:false,reason:"server-reset-beyond-budget"}:{retry:true,reason:i,delayMs:c}:{retry:true,reason:i,delayMs:qo(t,n.rng)}}o(ms,"decideRetry");function vs(e){let t=e.code==="unknown"?Ho(Ts(e.raw)):e.code;return t==="quotaExceeded"?"quota":t==="rateLimited"||e.httpStatus===429?"burst":null}o(vs,"throttleKind");function gs(e,t){let n=bs(e.raw);if(n===null)return null;let r=n-t;return r>0?r:0}o(gs,"retryOverrideMs");function bs(e){for(let t of Jo(e)){let n=t.resets_at,r=hs(n);if(r!==null)return r}return null}o(bs,"findResetsAt");function Jo(e){if(!Go(e))return [];let t=[e];for(let n of ["error","detail"]){let r=e[n];Go(r)&&t.push(r);}return t}o(Jo,"candidateScopes");function hs(e){if(typeof e=="number"&&Number.isFinite(e))return e<1e11?Math.round(e*1e3):Math.round(e);if(typeof e=="string"&&e.trim().length>0){let t=Date.parse(e);return Number.isFinite(t)?t:null}return null}o(hs,"parseInstantMs");function Ts(e){for(let t of Jo(e)){let n=t.code;if(typeof n=="string"&&n.length>0)return n}return null}o(Ts,"rawWireCode");function Go(e){return typeof e=="object"&&e!==null}o(Go,"isRecord");async function Es(e){return e.mode==="anonymous"?{mode:"anonymous",publishableKey:e.publishableKey,userRef:e.userRef,...e.sessionId?{sessionId:e.sessionId}:{}}:{mode:"personalized",token:await e.identity.currentToken(),userRef:e.userRef,...e.sessionId?{sessionId:e.sessionId}:{}}}o(Es,"resolveDeviceAuth");function ks(e,t){let n=new AbortController,r=t.setTimeout(()=>n.abort(),e);return {signal:n.signal,cancel:o(()=>t.clearTimeout(r),"cancel")}}o(ks,"boundedSignal");function Cs(e,t){let n=o(()=>{},"noop");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 i=o(()=>r.abort(),"onAbort");return e.addEventListener("abort",i,{once:true}),t.addEventListener("abort",i,{once:true}),{signal:r.signal,dispose:o(()=>{e.removeEventListener("abort",i),t.removeEventListener("abort",i);},"dispose")}}o(Cs,"mergeSignals");function Ss(e,t,n){return e<=0||n?.aborted===true?Promise.resolve():new Promise(r=>{let i=t.setTimeout(()=>{n?.removeEventListener("abort",l),r();},e),l=o(()=>{t.clearTimeout(i),r();},"onAbort");n?.addEventListener("abort",l,{once:true});})}o(Ss,"delayAbortable");function Rs(e){try{return new URL(e.trim()).protocol==="https:"}catch{return false}}o(Rs,"isSafeRoomUrl");function _s(e,t){return Rs(e)&&t.trim().length>0}o(_s,"isUsableRoomCredential");function en(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}o(en,"isRecord");function $n(e,t){return typeof e=="number"&&Number.isInteger(e)&&e>=t?e:null}o($n,"wholeNumber");function xs(e){if(!en(e))return null;let t=$n(e.consult_minutes,1),n=$n(e.auto_end_minutes,0),r=$n(e.warn_before_seconds,0);return t===null||n===null||r===null?null:Object.freeze({consultMinutes:t,autoEndMinutes:n,warnBeforeSeconds:r})}o(xs,"parseCallLimits");function Kn(e){if(!en(e))return null;let t=e.room_url??e.url,n=e.token;if(typeof t!="string"||typeof n!="string"||!_s(t,n))return null;let r=e.recording_notice;return Object.freeze({roomUrl:t.trim(),token:n,recordingNotice:typeof r=="boolean"?r:true,callLimits:xs(e.call_limits)})}o(Kn,"parseVetCallCredential");function Yn(e){let t=Xo(e.raw);return t!==null&&t.length>0?t:null}o(Yn,"vetCallJoinReason");function Xo(e){if(!en(e))return null;let t=e.detail??e.error,r=(en(t)?t:e).reason;return typeof r=="string"?r:null}o(Xo,"reasonOf");function Gn(e){if(e.httpStatus===404)return "unavailable";let t=Xo(e.raw);return t==="too_early"||t==="too_late"||t==="room_not_ready"?t:t!==null&&t.startsWith("status_")?"not_joinable":"unknown"}o(Gn,"vetCallJoinRefusal");var Zo=["scheduled","in_progress","awaiting_summary","completed","cancelled_owner","cancelled_ops","no_show_owner","no_show_vet"],$e=new Set(["completed","cancelled_owner","cancelled_ops","no_show_owner","no_show_vet"]),el=["wellness","prescription"],tn=64,_e=2e3,nn=10;function me(e){return typeof e=="string"&&/^[A-Za-z]{2}$/.test(e.trim())}o(me,"isWellFormedStateCode");function Re(e){return typeof e=="object"&&e!==null?e:null}o(Re,"row");function Z(e){return typeof e=="string"&&e.length>0?e:null}o(Z,"str");function Fe(e){return typeof e=="string"&&e.trim().length>0?e.trim():null}o(Fe,"trimmedOrNull");function ot(e,t){return typeof e=="boolean"?e:t}o(ot,"bool");function Jn(e){return typeof e=="number"&&Number.isFinite(e)?e:null}o(Jn,"num");function Qo(e,t){return typeof t=="string"&&e.includes(t)?t:"unknown"}o(Qo,"closed");function lt(e,t){if(!Array.isArray(e))return Object.freeze([]);let n=[];for(let r of e){let i=t(r);i!==null&&n.push(i);}return Object.freeze(n)}o(lt,"parseList");function tl(e,t){let n=Re(e);return n===null?null:Object.freeze({state:Z(n.state)??t,wellnessAvailable:ot(n.wellness_available,false),prescriptionsAvailable:ot(n.prescriptions_available,false),cancellationPolicyText:Fe(n.cancellation_policy_text)})}o(tl,"parseStatePolicy");function nl(e){let t=Re(e);if(t===null)return null;let n=Fe(t.summary),r=Fe(t.version);return n===null||r===null?null:Object.freeze({summary:n,version:r})}o(nl,"parseCancellationPolicy");function rl(e){let t=Re(e);if(t===null)return null;let n=Z(t.clinician_id),r=Z(t.display_name);return n===null||r===null?null:Object.freeze({clinicianId:n,displayName:r,credentials:Fe(t.credentials_text),rating:Jn(t.rating),ratingCount:Jn(t.rating_count),bio:Fe(t.bio),photoRef:Z(t.photo_ref),licensedStates:lt(t.licensed_states,i=>{let l=Re(i),a=l===null?null:Z(l.state);return a===null?null:Object.freeze({state:a,canPrescribe:ot(l?.can_prescribe,false)})})})}o(rl,"parseClinician");function Xn(e){let t=Re(e);if(t===null)return null;let n=Z(t.slot_id),r=Z(t.starts_at);return n===null||r===null?null:Object.freeze({slotId:n,startsAt:r,endsAt:Z(t.ends_at)??r})}o(Xn,"parseSlot");function ol(e){let t=Re(e);if(t===null)return null;let n=Z(t.slot_id),r=Z(t.hold_expires_at);return n===null||r===null?null:Object.freeze({slotId:n,expiresAt:r})}o(ol,"parseSlotHold");function Et(e){let t=Re(e);if(t===null)return null;let n=Z(t.consult_id),r=Z(t.scheduled_at);return n===null||r===null?null:Object.freeze({consultId:n,petId:Z(t.pet_id)??"",clinicianId:Z(t.clinician_id)??"",clinicianName:Fe(t.display_name),reasonText:Fe(t.reason_text),mediaRefs:lt(t.media_refs,i=>Z(i)),status:Qo(Zo,t.status),kind:Qo(el,t.kind),scheduledAt:r,emergencyFlagged:ot(t.emergency_flagged,false),hasRoom:Z(t.meeting_url)!==null})}o(Et,"parseConsult");function ll(e){let t=Re(e);return Object.freeze({active:ot(t?.active,false)})}o(ll,"parseBookingEntitlement");var rn=240;function il(e){let t=Re(e);if(t===null)return null;let n=Jn(t.fee_cents);return n===null||n<0?null:Object.freeze({feeCents:n,currency:Z(t.currency)??"usd",feeRecorded:ot(t.fee_recorded,n>0),summary:Fe(t.summary)})}o(il,"parseCancelReceipt");var Ne="/widget/v1/televet",ws=`${Ne}/state-policy`,Ps=`${Ne}/vets`,al=`${Ne}/slots`,Is=`${Ne}/slots/next`,on=`${Ne}/consults`,Os=`${Ne}/entitlement`,As=`${Ne}/cancellation-policy`;function sl(e){return `${al}/${encodeURIComponent(e)}/hold`}o(sl,"televetHoldCall");function dl(e){return `${on}/${encodeURIComponent(e)}/reschedule`}o(dl,"televetRescheduleCall");function ln(e){return `${on}/${encodeURIComponent(e)}`}o(ln,"televetConsultCall");function cl(e){return `${ln(e)}/join`}o(cl,"televetJoinCall");function ul(e){return `${ln(e)}/cancel`}o(ul,"televetCancelCall");var pl=100;function ie(e){return w(ye("validationFailed",{retryable:false,wireMessage:e}))}o(ie,"invalid");function Ke(e){return w(ye("internalError",{retryable:false,httpStatus:502,wireMessage:e}))}o(Ke,"unusable");function Qn(e){return e.httpStatus===404}o(Qn,"isDark");function kt(e,t,n){try{e?.track(t,n);}catch{}}o(kt,"safeTrack");function fl(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(!me(e.state))return "state must be a two-letter US state code";let t=e.reason_text.trim();return t.length===0?"reason_text is required":t.length>_e?`reason_text must be at most ${_e} characters`:Bs(e)}o(fl,"validateBookingBody");function Bs(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>tn?`cancellation_policy_version must be at most ${tn} characters`:null}o(Bs,"attestationRefusal");function er(e){let t=e.funnel??Tt({auth:e.auth,...e.errorPolicy?{errorPolicy:e.errorPolicy}:{}}),n=e.telemetry;return {async statePolicy(r,i){let l=r.trim();if(!me(l))return ie("state must be a two-letter US state code");let a=await t.send("televet.booking.state_policy",{method:"GET",path:`${ws}/${encodeURIComponent(l)}`,...i?{signal:i}:{}});if(!a.ok)return w(a.error);let s=tl(a.value,l);return s===null?Ke("the state policy response was unreadable"):L(s)},async entitlement(r){let i=await t.send("televet.booking.entitlement",{method:"GET",path:Os,...r?{signal:r}:{}});return i.ok?L(ll(i.value)):w(i.error)},async cancellationPolicy(r){let i=await t.send("televet.booking.cancellation_policy",{method:"GET",path:As,...r?{signal:r}:{}});return i.ok?L(nl(i.value)):L(null)},async clinicians(r,i){let l=r.trim();if(!me(l))return ie("state must be a two-letter US state code");let a=await t.send("televet.booking.clinicians",{method:"GET",path:Ps,query:{state:l},...i?{signal:i}:{}});return a.ok?L(lt(Zn(a.value,"vets"),rl)):Qn(a.error)?L(Object.freeze([])):w(a.error)},async slots(r,i){let l=r.trim();if(l.length===0)return ie("clinicianId is required");let a=await t.send("televet.booking.slots",{method:"GET",path:al,query:{clinician_id:l},...i?{signal:i}:{}});return a.ok?L(lt(Zn(a.value,"slots"),Xn)):Qn(a.error)?L(Object.freeze([])):w(a.error)},async nextSlot(r){let i=await t.send("televet.booking.next_slot",{method:"GET",path:Is,...r?{signal:r}:{}});return i.ok?L(Xn(Fs(i.value,"slot"))):L(null)},async holdSlot(r){let i=r.trim();if(i.length===0)return ie("slotId is required");let l=await t.send("televet.booking.hold",{method:"POST",path:sl(i)},{idempotent:false,maxAttempts:1});if(!l.ok)return kt(n,"televet.booking.hold_failed",{status:l.error.httpStatus??null}),w(l.error);let a=ol(l.value);return a===null?Ke("the hold response carried no usable expiry"):L(a)},async book(r,i){let l=fl(r);if(l!==null)return ie(l);let a=i.trim();if(a.length===0)return ie("idempotencyKey is required");let s=await t.send("televet.booking.book",{method:"POST",path:on,body:Ds(r)},{idempotent:true,idempotencyKey:a,maxAttempts:1});if(!s.ok)return kt(n,"televet.booking.book_failed",{status:s.error.httpStatus??null}),w(s.error);let c=Et(s.value);return c===null?Ke("the booking response was unreadable"):L(c)},async reschedule(r,i){let l=r.trim(),a=i.trim();if(l.length===0)return ie("consultId is required");if(a.length===0)return ie("slotId is required");let s=await t.send("televet.booking.reschedule",{method:"POST",path:dl(l),body:{new_slot_id:a}},{idempotent:false,maxAttempts:1});if(!s.ok)return kt(n,"televet.booking.reschedule_failed",{status:s.error.httpStatus??null}),w(s.error);let c=Et(s.value);return c===null?Ke("the reschedule response was unreadable"):L(c)},async listConsults(r){let i=await t.send("televet.booking.consults",{method:"GET",path:on,query:{limit:String(pl)},...r?{signal:r}:{}});return i.ok?L(lt(Zn(i.value,"consults"),Et)):Qn(i.error)?L(Object.freeze([])):w(i.error)},async getConsult(r,i){let l=r.trim();if(l.length===0)return ie("consultId is required");let a=await t.send("televet.booking.consult",{method:"GET",path:ln(l),...i?{signal:i}:{}});if(!a.ok)return w(a.error);let s=Et(a.value);return s===null?Ke("the consult response was unreadable"):L(s)},async joinConsult(r){let i=r.trim();if(i.length===0)return ie("consultId is required");let l=await t.send("televet.booking.join",{method:"POST",path:cl(i)},{idempotent:false,maxAttempts:1});if(!l.ok)return kt(n,"televet.booking.join_failed",{status:l.error.httpStatus??null}),w(l.error);let a=Kn(l.value);return a===null?Ke("the join response carried no usable room credential"):L(a)},async cancelConsult(r,i){let l=r.trim(),a=i.trim();if(l.length===0)return ie("consultId is required");if(a.length===0)return ie("reason is required");if(a.length>rn)return ie(`reason must be at most ${rn} characters`);let s=await t.send("televet.booking.cancel",{method:"POST",path:ul(l),body:{reason:a}},{idempotent:false,maxAttempts:1});if(!s.ok)return kt(n,"televet.booking.cancel_failed",{status:s.error.httpStatus??null}),w(s.error);let c=il(s.value);return c===null?Ke("the cancel response was unreadable"):L(c)}}}o(er,"createTelevetBookingController");function Ds(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}:{}}}o(Ds,"bookingWireBody");function Zn(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}o(Zn,"rows");function Fs(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}o(Fs,"unwrap");var yl=Symbol.for("@everfur/sdk#EverfurContext@v1"),ml=globalThis,vl=ml[yl]??(ml[yl]=createContext(null));vl.displayName??="EverfurContext";function Ye(){let e=useContext(vl);if(e===null)throw new bt("not-initialized","Everfur hooks must be called inside <EverfurProvider>. Wrap your tree once, high.");return e}o(Ye,"useEverfurContext");var Vs=Object.freeze({chat:Object.freeze(["chat.message.create"]),records:Object.freeze(["records.upload.create","records.record.read"]),recordsClinic:Object.freeze(["records.clinic.create"]),video:Object.freeze(["video.gait.execute"]),photo:Object.freeze(["photo.checkup.execute"]),animations:Object.freeze(["animations.state.read"]),televet:Object.freeze(["televet.visit.create"])});function zs(e){return Vs[e]}o(zs,"requires");function gl(e,t,n){let r=zs(e),i=new Map;for(let s of t)i.set(s.resource,s);if(n?.isPending===true&&r.some(s=>!i.has(s)))return tr({name:e,enabled:false,isPending:true,limits:{}});let l=Ms(r,i);return r.filter(s=>i.get(s)?.granted!==true).length===0?tr({name:e,enabled:true,isPending:false,limits:l}):tr({name:e,enabled:false,isPending:false,limits:l,disabled:js(r,i)})}o(gl,"decideCapability");function Ms(e,t){let n={};for(let r of e){let i=t.get(r)?.limits;if(i)for(let[l,a]of Object.entries(i)){let s=n[l];n[l]=s===void 0?a:Math.min(s,a);}}return n}o(Ms,"mergeLimits");function js(e,t){for(let n of e){let r=t.get(n)?.disabled;if(r)return Object.freeze({reason:r.reason,level:r.level,recoverable:r.recoverable})}return Object.freeze({reason:Wn("accessDenied"),level:"user_entitlement",recoverable:false})}o(js,"disabledFor");function tr(e){let t={name:e.name,enabled:e.enabled,isPending:e.isPending,limits:Object.freeze({...e.limits})};return e.disabled!==void 0&&(t.disabled=e.disabled),Object.freeze(t)}o(tr,"freezeDecision");function Ct(e){let{runtime:t}=Ye(),n=t.entitlements,r=useSyncExternalStore(n.subscribe,n.getSnapshot,n.getSnapshot);return useMemo(()=>gl(e,r.decisions,{isPending:r.isPending}),[e,r])}o(Ct,"useCapability");function ae(e){let{runtime:t,userRef:n,scopeEpoch:r}=Ye();return useMemo(()=>{if(e)return e;if(n===null)return null;let{services:i}=t.registry;return er({auth:i.authFor(n),telemetry:i.telemetry,...i.errorPolicy?{errorPolicy:i.errorPolicy}:{}})},[t,n,r,e])}o(ae,"useTelevetBookingController");function Ws(){let{userRef:e}=Ye(),t=Ct("televet");return useMemo(()=>({available:t.enabled&&e!==null,isPending:t.isPending}),[t.enabled,t.isPending,e])}o(Ws,"useTelevetBookingAvailable");function Le(e,t,n){let[r,i]=useState(()=>({key:e,data:null,isPending:t&&n!==null,error:null})),[l,a]=useState(0),s=useRef(n);s.current=n,useEffect(()=>{let p=s.current;if(!t||p===null){i({key:e,data:null,isPending:false,error:null});return}let g=new AbortController,f=true;return i(y=>y.key===e?{...y,isPending:true,error:null}:{key:e,data:null,isPending:true,error:null}),(async()=>{let y;try{y=await p(g.signal);}catch{f&&i({key:e,data:null,isPending:false,error:null});return}f&&(y.ok?i({key:e,data:y.value,isPending:false,error:null}):i({key:e,data:null,isPending:false,error:y.error}));})(),()=>{f=false,g.abort();}},[e,t,l]);let c=useCallback(()=>a(p=>p+1),[]),d=r.key===e;return useMemo(()=>({enabled:t,data:d?r.data:null,isPending:t&&(!d||r.isPending),isError:d&&r.error!==null,error:d?r.error:null,refetch:c}),[t,d,r.data,r.isPending,r.error,c])}o(Le,"useTelevetRead");function rr(e,t){let n=e?.trim()??"",r=t?.statePolicy!==void 0&&me(n),i=t?.statePolicy;return Le(`state-policy:${n}`,r,r&&i?l=>i.call(t,n,l):null)}o(rr,"useTelevetStatePolicy");function or(e){let t=e?.entitlement!==void 0,n=e?.entitlement;return Le("entitlement",t,t&&n?r=>n.call(e,r):null)}o(or,"useTelevetBookingEntitlement");function St(e){let t=e?.cancellationPolicy!==void 0,n=e?.cancellationPolicy;return Le("cancellation-policy",t,t&&n?r=>n.call(e,r):null)}o(St,"useTelevetCancellationPolicy");function lr(e,t){let n=e?.trim()??"",r=t?.clinicians!==void 0&&me(n),i=t?.clinicians;return Le(`clinicians:${n}`,r,r&&i?l=>i.call(t,n,l):null)}o(lr,"useTelevetClinicians");function Rt(e,t){let n=e?.trim()??"",r=t!==null&&n.length>0;return Le(`slots:${n}`,r,r&&t?i=>t.slots(n,i):null)}o(Rt,"useTelevetSlots");function ir(e){let t=e?.nextSlot!==void 0,n=e?.nextSlot;return Le("next-slot",t,t&&n?r=>n.call(e,r):null)}o(ir,"useTelevetNextSlot");function dn(e){let[t,n]=useState(null),r=useRef(true),i=useRef(false),l=useRef(e);l.current=e,useEffect(()=>(r.current=true,()=>{r.current=false;}),[]);let a=useCallback((...s)=>{let c=l.current;if(c===null||i.current)return;let d=s[s.length-1],p=typeof d=="object"&&d!==null&&("onSuccess"in d||"onError"in d),g=p?d:void 0,f=p?s.slice(0,-1):s;i.current=true,n({variables:f[0]??null}),(async()=>{let y=null;try{y=await c(...f);}catch{y=null;}i.current=false,r.current&&n(null),y!==null&&(y.ok?g?.onSuccess?.(y.value):g?.onError?.(y.error));})();},[]);return useMemo(()=>({isPending:t!==null,variables:t?.variables??null,mutate:a}),[t,a])}o(dn,"useTelevetWrite");function _t(e){return dn(e?t=>e.holdSlot(t):null)}o(_t,"useTelevetHoldSlot");function ar(e){return dn(e?(t,n)=>e.book(t,n):null)}o(ar,"useTelevetBookConsult");function sr(e,t){return dn(t&&e?n=>t.reschedule(e,n):null)}o(sr,"useTelevetRescheduleConsult");function cn(e,t=0){let n=e?.listConsults!==void 0,r=e?.listConsults;return Le(`consults:${t}`,n,n&&r?i=>r.call(e,i):null)}o(cn,"useTelevetConsults");function Tl(e,t,n=0){let r=e?.trim()??"",i=t?.getConsult!==void 0&&r.length>0,l=t?.getConsult;return Le(`consult:${r}:${n}`,i,i&&l?a=>l.call(t,r,a):null)}o(Tl,"useTelevetConsult");function El(e,t){let n=t?.cancelConsult;return dn(t&&n&&e?r=>n.call(t,e,r):null)}o(El,"useTelevetCancelConsult");function dr(e){return e.error!==null&&e.error.httpStatus===404}o(dr,"televetReadIsDark");var cr=15,ur=250,qs=new Set(["scheduled","in_progress"]);function Ge(e){let t=Date.parse(e.scheduledAt);return Number.isNaN(t)?null:t}o(Ge,"startsAtMs");function $s(e){let t=Ge(e);return t===null?null:t-cr*6e4}o($s,"televetJoinOpensAtMs");function pr(e,t){if(e===null)return {ready:false,reason:"not_open_yet"};if($e.has(e.status))return {ready:false,reason:"consult_over"};if(e.status==="in_progress")return {ready:true};let n=Ge(e);return n===null?{ready:false,reason:"not_open_yet"}:t<n-cr*6e4?{ready:false,reason:"not_open_yet"}:t>n+ur*6e4?{ready:false,reason:"consult_over"}:{ready:true}}o(pr,"televetJoinReadiness");function xt(e,t){let n=[],r=[];for(let i of e){let l=Ge(i);(qs.has(i.status)&&l!==null&&l+ur*6e4>t?n:r).push(i);}return n.sort((i,l)=>(Ge(i)??0)-(Ge(l)??0)),r.sort((i,l)=>(Ge(l)??0)-(Ge(i)??0)),Object.freeze({upcoming:Object.freeze(n),past:Object.freeze(r)})}o(xt,"splitTelevetVisits");function fr(e){return e==="scheduled"}o(fr,"canManageTelevetVisit");function kl(e){let t=cn(e);return t.enabled?t.isPending?"pending":t.isError||xt(t.data??[],Date.now()).upcoming.length>0?"visits":"booking":"booking"}o(kl,"useTelevetLanding");function vr(e){if(e!==null&&typeof e=="object"&&!Object.isFrozen(e)){Object.freeze(e);for(let t of Object.keys(e))vr(e[t]);}return e}o(vr,"deepFreeze");var Ks=Object.freeze({content:0,heading:2,control:1.8,compact:1.5,badge:1.3}),Sl={xs:4,sm:8,md:12,lg:16,xl:24,xxl:32},Rl={tile:5,xs:6,sm:10,md:14,lg:20,xl:28,pill:500},Cl={nano:8,small:9,micro:10,tiny:11,caption:12,bodyTight:13,body:14,subtitle:16,heading:18,verdict:24},Ys={tight:1.15,snug:1.3,normal:1.4,relaxed:1.55},Gs={regular:"400",medium:"500",bold:"700"},Js={eyebrow:1,monoWide:.9,headerBrand:-0.42,tight:-0.35},Xs=0,un="System",pn="monospace",Qs=["content","heading","control","compact","badge"];function Zs(e){let t={};for(let n of Qs)t[n]=e;return t}o(Zs,"authoredTierSizes");function _l(){return {family:un,mono:pn,fontUrl:null,families:{regular:un,medium:un,bold:un,mono:pn,monoMedium:pn,monoBold:pn},namedFaces:{regular:false,medium:false,bold:false,mono:false,monoMedium:false,monoBold:false},fontUrls:{},size:Cl,tierSizes:Zs(Cl),lineHeight:Ys,weight:Gs,letterSpacing:Js,scale:1,maxScale:Xs,scaleCaps:Ks}}o(_l,"baseType");var xl={},yr=Object.freeze({standard:Object.freeze([.2,0,0,1]),emphasized:Object.freeze([.2,.8,.2,1]),exit:Object.freeze([.4,0,1,1])});function mr(e){return `cubic-bezier(${e.join(", ")})`}o(mr,"cssCubicBezier");var wl={duration:{instant:80,fast:140,normal:220,slow:320},spring:{gentle:{damping:18,stiffness:200}},easing:{standard:mr(yr.standard),emphasized:mr(yr.emphasized),exit:mr(yr.exit)},reducedMotion:false},ed={brand:"#10462E",brandSoft:"rgba(16,70,46,0.10)",brandSofter:"rgba(16,70,46,0.15)",brandBorder:"rgba(16,70,46,0.18)",borderHairlineGreen:"rgba(16,70,46,0.25)",brandBorderStrong:"rgba(16,70,46,0.55)",brandInk:"#10462E",linkInk:"#10462E",surface:"#FFFFFF",surfaceCream:"#FDFBF8",surfaceSubtle:"#EFE9E3",background:"#FFFFFF",borderRingCream:"#D8D2C8",chatGround:"#FFFFFF",composerFill:"#FDFBF8",composerBorder:"rgba(16,70,46,0.75)",shadow:"#0B3421",text:{primary:"#111111",secondary:"#0E462E",muted:"#6E6660",placeholder:"rgba(61,61,61,0.75)",onBrand:"#FFFFFF",metaCool:"#3D3D3D",timestamp:"rgba(61,61,61,0.75)"},primary:"#10462E",onPrimary:"#FFFFFF",accent:"#10462E",onAccent:"#FFFFFF",accentEdge:"#07C168",success:"#07C168",danger:"#B91C1C",errorRed:"#FF1B00",warningStrong:"#A45610",cautionAccent:"#D9821D",riskConcern:"#EFA700",sentiment:{up:"#07C168",neutral:"#FBC558",down:"#FF1B00"},badgeBgPositive:"rgba(7,193,104,0.12)",badgeBgCaution:"rgba(217,130,29,0.14)",badgeBgCritical:"rgba(185,28,28,0.12)",badgeBgNeutral:"rgba(110,102,96,0.12)",bubbleUser:"#10462E",bubbleAssistant:"#FFFFFF",skeleton:"#EFE9E3",scanButtonPink:"#FFC3BC",checkupCardLowRiskBg:"rgba(7,193,104,0.10)",checkupCardConcernBg:"rgba(239,167,0,0.10)"},Pl=vr({brightness:"light",highContrast:false,meta:{displayName:"Everfur",logoUrl:null,placeholder:null,hidePoweredBy:false},color:ed,space:Sl,radius:Rl,type:_l(),motion:wl,slots:xl}),td={brand:"#6BD39A",brandSoft:"rgba(107,211,154,0.12)",brandSofter:"rgba(107,211,154,0.18)",brandBorder:"rgba(107,211,154,0.22)",borderHairlineGreen:"rgba(107,211,154,0.28)",brandBorderStrong:"rgba(107,211,154,0.55)",brandInk:"#6BD39A",linkInk:"#6BD39A",surface:"#1C1F23",surfaceCream:"#23272C",surfaceSubtle:"#23272C",background:"#15171A",borderRingCream:"#3A3F45",chatGround:"#1C1F23",composerFill:"#23272C",composerBorder:"rgba(107,211,154,0.75)",shadow:"#000000",text:{primary:"#F5F3F0",secondary:"#A9E4C4",muted:"#9A938C",placeholder:"rgba(255,255,255,0.55)",onBrand:"#0E1F17",metaCool:"#C9C9C9",timestamp:"rgba(245,243,240,0.7)"},primary:"#6BD39A",onPrimary:"#0E1F17",accent:"#6BD39A",onAccent:"#0E1F17",accentEdge:"#34D888",success:"#07C168",danger:"#F87171",errorRed:"#FF6B5B",warningStrong:"#F0A35E",cautionAccent:"#D9821D",riskConcern:"#EFA700",sentiment:{up:"#07C168",neutral:"#FBC558",down:"#FF1B00"},badgeBgPositive:"rgba(7,193,104,0.18)",badgeBgCaution:"rgba(217,130,29,0.20)",badgeBgCritical:"rgba(185,28,28,0.22)",badgeBgNeutral:"rgba(255,255,255,0.10)",bubbleUser:"#6BD39A",bubbleAssistant:"#1C1F23",skeleton:"#23272C",scanButtonPink:"#FFC3BC",checkupCardLowRiskBg:"rgba(7,193,104,0.16)",checkupCardConcernBg:"rgba(239,167,0,0.16)"};vr({brightness:"dark",highContrast:false,meta:{displayName:"Everfur",logoUrl:null,placeholder:null,hidePoweredBy:false},color:td,space:Sl,radius:Rl,type:_l(),motion:wl,slots:xl});var Il=Symbol.for("@everfur/sdk#EverfurThemeContext@v1"),Ol=globalThis,gr=Ol[Il]??(Ol[Il]=createContext(Pl));gr.displayName??="EverfurThemeContext";function S(){return useContext(gr)}o(S,"useEverfurTheme");function ad(e,t){let n=e.scaleCaps[t];return n>0?n:void 0}o(ad,"tierMultiplier");function v({tier:e="content",...t}){let{type:n}=S(),r=ad(n,e);return createElement(Text,r===void 0?t:{maxFontSizeMultiplier:r,...t})}o(v,"Text");var Bl=forwardRef(o(function(t,n){return createElement(TextInput,{...t,...n===null?{}:{ref:n}})},"TextInput"));var sd=Object.freeze({regular:"regular",medium:"medium",bold:"bold",mono:"regular",monoMedium:"medium",monoBold:"bold"});function b(e,t){let n=e.type,r=n.families[t];return t==="mono"||n.namedFaces[t]?{fontFamily:r}:{fontFamily:r,fontWeight:n.weight[sd[t]]}}o(b,"face");var Tr=class Tr extends Component{constructor(){super(...arguments);this.state={failed:false,key:this.props.resetKey};}static getDerivedStateFromError(){return {failed:true}}static getDerivedStateFromProps(n,r){return Object.is(n.resetKey,r.key)?null:{failed:false,key:n.resetKey}}render(){return this.state.failed?this.props.fallback:this.props.children}};o(Tr,"HostRenderBoundary");var br=Tr;function cd({render:e}){return e()}o(cd,"RenderHost");function hr({render:e,fallback:t,resetKey:n}){return createElement(br,{fallback:t,resetKey:n,children:createElement(cd,{render:e})})}o(hr,"HostRender");var ud=48;function pd(e){return e.isPending?"pending":e.enabled?"enabled":"disabled"}o(pd,"selectView");function Vl(e){let{capability:t,children:n,renderDisabled:r,renderPending:i,style:l}=e,a=Ct(t),s=useMemo(()=>pd(a),[a]);switch(s){case "enabled":return n;case "pending":return i?jsx(hr,{render:i,fallback:jsx(Nl,{capability:t,style:l})}):jsx(Nl,{capability:t,style:l});case "disabled":return r?jsx(hr,{render:()=>r(a),fallback:jsx(Ll,{decision:a,style:l}),resetKey:a}):jsx(Ll,{decision:a,style:l});default:return Gt(s)}}o(Vl,"CapabilityGate");function Nl({capability:e,style:t}){let n=S(),r=useMemo(()=>zl(n),[n]);return jsx(View,{style:[r.offstate,t],accessible:true,accessibilityState:{busy:true},accessibilityLabel:`Loading ${e}`,children:jsx(View,{style:r.skeletonBar})})}o(Nl,"PendingSkeleton");function Ll({decision:e,style:t}){let n=S(),r=useMemo(()=>zl(n),[n]),i=e.disabled?.reason??"";return jsx(View,{style:[r.offstate,t],accessible:true,accessibilityRole:"text",accessibilityLabel:i,children:i.length>0?jsx(v,{style:r.offstateText,children:i}):null})}o(Ll,"OffState");function zl(e){let{color:t,space:n,radius:r,type:i}=e;return StyleSheet.create({offstate:{minHeight:ud,justifyContent:"center",paddingHorizontal:n.lg,paddingVertical:n.md,backgroundColor:t.surfaceCream,borderRadius:r.md,borderWidth:StyleSheet.hairlineWidth,borderColor:t.brandBorder},offstateText:{...b(e,"regular"),fontSize:i.size.body,lineHeight:Math.round(i.size.body*i.lineHeight.normal),color:t.text.muted},skeletonBar:{height:n.md,borderRadius:r.xs,backgroundColor:t.brandSofter}})}o(zl,"makeStyles");function fn(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}o(fn,"details");function fd(e){let t=fn(e)?.categories;return Array.isArray(t)?Object.freeze(t.filter(n=>typeof n=="string")):Object.freeze([])}o(fd,"categoriesOf");function Ml(e){let t=fn(e)?.retry_after_seconds;return typeof t=="number"&&Number.isFinite(t)&&t>0?t:null}o(Ml,"retryAfterOf");function jl(e){let t=e.wireMessage;if(typeof t=="string"&&t.trim().length>0)return t.trim();let n=fn(e)?.message;return typeof n=="string"&&n.trim().length>0?n.trim():null}o(jl,"messageOf");function yd(e){let t=e.reasonCode;if(typeof t=="string"&&t.length>0)return t;let n=fn(e),r=n?.code??n?.error_code;return typeof r=="string"&&r.length>0?r:null}o(yd,"codeOf");function Ve(e){let t=e.httpStatus;if(t===402)return Object.freeze({kind:"not_entitled"});if(t===429||e.code==="rateLimited"||e.code==="quotaExceeded")return Object.freeze({kind:"rate_limited",retryAfterSeconds:Ml(e),message:jl(e)});if(t===404)return Object.freeze({kind:"unavailable"});switch(yd(e)){case "televet_rate_limited":return Object.freeze({kind:"rate_limited",retryAfterSeconds:Ml(e),message:jl(e)});case "televet_emergency_ack_required":return Object.freeze({kind:"emergency",categories:fd(e)});case "televet_not_entitled":return Object.freeze({kind:"not_entitled"});case "televet_slot_conflict":return Object.freeze({kind:"slot_taken"});case "televet_hold_invalid":return Object.freeze({kind:"slot_taken"});case "televet_clinician_cannot_prescribe":case "televet_clinician_unavailable":case "televet_clinician_not_bookable":return Object.freeze({kind:"clinician_unavailable"});case "televet_membership_conflict":return Object.freeze({kind:"not_entitled"});case "televet_registry_unavailable":return Object.freeze({kind:"failed"});}return Object.freeze({kind:"failed"})}o(Ve,"televetBookingRefusal");function yn(e){for(let t=0;t<e.length;t+=1){let n=e.charCodeAt(t);if(n>=55296&&n<=56319){let r=e.charCodeAt(t+1);if(!(r>=56320&&r<=57343))return true;t+=1;}else if(n>=56320&&n<=57343)return true}return false}o(yn,"hasLoneSurrogate");function mn(e){return [...e].length}o(mn,"serverLength");var Hl=Object.freeze({dog:"dog",canine:"dog",k9:"dog",puppy:"dog",cat:"cat",feline:"cat",kitten:"cat"});function Ul(e){if(typeof e!="string")return null;let t=e.trim().toLowerCase();return Object.prototype.hasOwnProperty.call(Hl,t)?Hl[t]:null}o(Ul,"canonicalPetSpecies");var Wl=50,md=128,Cr=120,ql=120,vd=2e3,$l=120,gd=80,Gl=new Set(["male","female","unknown"]),Jl=new Set(["day","month","year"]),Xl=new Set(["low","medium","high","athletic"]),Ql=new Set(["indoor","outdoor","both"]),Zl=new Set(["mild","moderate","severe"]),bd=/^(\d{4})-(\d{2})-(\d{2})$/,ei=[["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"]],ti=[["allergies","allergies"],["medications","medications"],["supplements","supplements"],["conditions","conditions"]];Object.freeze([...ei,...ti].map(([e])=>e));function hd(e){let t=bd.exec(e);if(t===null)return false;let[n,r,i]=[Number(t[1]),Number(t[2]),Number(t[3])],l=new Date(Date.UTC(n,r-1,i));return l.getUTCFullYear()===n&&l.getUTCMonth()===r-1&&l.getUTCDate()===i}o(hd,"isRealDate");var Pt=o(e=>(t,n)=>typeof n=="string"&&e.has(n)?null:`${t} must be one of ${[...e].join(", ")}`,"oneOf"),Td=o((e,t)=>typeof t=="boolean"?null:`${e} must be true or false`,"boolean"),gn=o((e,t)=>typeof t=="string"&&hd(t)?null:`${e} must be a real date written YYYY-MM-DD`,"date"),ge=o((e,t={})=>(n,r)=>{if(typeof r!="string")return `${n} must be a string`;if(yn(r))return `${n} contains an unpaired surrogate and cannot be encoded`;let i=t.trimmed?r.trim():r;if(t.required&&i.length===0)return `${n} is required and must not be blank`;let l=mn(i);return l<=e?null:`${n} is ${l} characters; the server accepts at most ${e}`},"text"),Ed={sex:Pt(Gl),spayedNeutered:Td,birthDate:gn,birthDatePrecision:Pt(Jl),activityLevel:Pt(Xl),indoorOutdoor:Pt(Ql),foodBrand:ge($l),foodType:ge($l),microchipId:ge(gd)},Sr=["ref","ref",false,ge(md,{required:true,trimmed:true})],Rr=["notes","notes",false,ge(vd,{trimmed:true})],Kl=[Sr,["name","name",true,ge(Cr,{required:true,trimmed:true})],["dose","dose",false,ge(ql,{trimmed:true})],["frequency","frequency",false,ge(ql,{trimmed:true})],["startDate","start_date",false,gn],["endDate","end_date",false,gn],Rr],kd={allergies:[Sr,["allergen","allergen",true,ge(Cr,{required:true,trimmed:true})],["severity","severity",false,Pt(Zl)],Rr],medications:Kl,supplements:Kl,conditions:[Sr,["conditionName","condition_name",true,ge(Cr,{required:true,trimmed:true})],["diagnosedDate","diagnosed_date",false,gn],Rr]};function Cd(e,t,n){let r=`${e}[${t}]`;if(typeof n!="object"||n===null||Array.isArray(n))return {error:`${r} must be an object`};let i=n,l={};for(let[c,d,p,g]of kd[e]){let f=i[c];if(f==null){if(p)return {error:`${r}.${c} is required`};f===null&&(l[d]=null);continue}let y=g(`${r}.${c}`,f);if(y!==null)return {error:y};l[d]=f;}let a=l.start_date,s=l.end_date;return typeof a=="string"&&typeof s=="string"&&s<a?{error:`${r}.endDate must not be before startDate`}:{item:l}}o(Cd,"itemToWire");function Sd(e,t){if(!Array.isArray(t))return {error:`${e} must be an array (send [] to clear it)`};if(t.length>Wl)return {error:`${e} has ${t.length} items; the server accepts at most ${Wl}`};let n=[],r=new Set;for(let i=0;i<t.length;i+=1){let l=Cd(e,i,t[i]);if("error"in l)return l;let a=l.item.ref;if(typeof a=="string"){let s=a.trim();if(r.has(s))return {error:`${e}: ref ${JSON.stringify(s)} is used twice; a ref names one item`};r.add(s);}n.push(l.item);}return {items:n}}o(Sd,"listToWire");function ni(e,t){let n=e,r={};for(let[a,s]of ei){let c=n[a];if(c!==void 0){if(c!==null){let d=Ed[a](a,c);if(d!==null)return {error:d}}r[s]=c;}}let i=n.birthDate!==void 0,l=n.birthDatePrecision!==void 0;if(i!==l||i&&n.birthDate===null!=(n.birthDatePrecision===null))return {error:"birthDate and birthDatePrecision must be sent together, both set or both null"};for(let[a,s]of ti){let c=n[a];if(c===void 0)continue;let d=Sd(a,c);if("error"in d)return d;r[s]=d.items;}return Object.keys(r).length>0&&t!==void 0&&Ul(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}}o(ni,"petHealthToWire");var J=o(e=>typeof e=="string"?e:null,"str"),wt=o((e,t)=>typeof t=="string"&&e.has(t)?t:null,"pick"),Rd=o(e=>typeof e=="boolean"?e:null,"bool");function vn(e,t){return Array.isArray(e)?Object.freeze(e.flatMap(n=>{if(typeof n!="object"||n===null||Array.isArray(n))return [];let r=t(n);return r===null?[]:[r]})):Object.freeze([])}o(vn,"itemsFromWire");function Yl(e){let t=J(e.name);return t===null||t.length===0?null:Object.freeze({ref:J(e.ref),name:t,dose:J(e.dose),frequency:J(e.frequency),startDate:J(e.start_date),endDate:J(e.end_date),notes:J(e.notes)})}o(Yl,"medicationFromWire");function ri(e){let t=e.profile_version;return Object.freeze({profileVersion:typeof t=="number"&&Number.isInteger(t)&&t>=0?t:0,sex:wt(Gl,e.sex),spayedNeutered:Rd(e.spayed_neutered),birthDate:J(e.birth_date),birthDatePrecision:wt(Jl,e.birth_date_precision),activityLevel:wt(Xl,e.activity_level),indoorOutdoor:wt(Ql,e.indoor_outdoor),foodBrand:J(e.food_brand),foodType:J(e.food_type),microchipId:J(e.microchip_id),allergies:vn(e.allergies,n=>{let r=J(n.allergen);return r===null||r.length===0?null:Object.freeze({ref:J(n.ref),allergen:r,severity:wt(Zl,n.severity),notes:J(n.notes)})}),medications:vn(e.medications,Yl),supplements:vn(e.supplements,Yl),conditions:vn(e.conditions,n=>{let r=J(n.condition_name);return r===null||r.length===0?null:Object.freeze({ref:J(n.ref),conditionName:r,diagnosedDate:J(n.diagnosed_date),notes:J(n.notes)})})})}o(ri,"petHealthFromWire");var ii=100,ai=50,si=100,di=50,ci=500,_d=128,xd=6e4;function he(e){return ye("validationFailed",{retryable:false,wireMessage:e})}o(he,"invalid");function Je(e,t,n){if(typeof t!="string")return he(`${e} must be a string`);let r=mn(t);return r<=n?null:he(`${e} is ${r} characters; the server accepts at most ${n}`)}o(Je,"checkString");function bn(e,t,n){return typeof t=="number"&&Number.isFinite(t)&&t>=0&&t<=n?null:he(`${e} must be a finite number between 0 and ${n}`)}o(bn,"outOfRange");function oi(e,t){if(typeof e!="string")return he("pet_ref must be a string");if(e.trim().length===0)return he("pet_ref must not be blank");if(yn(e))return he("pet_ref contains an unpaired surrogate and cannot be encoded");if(t!=null&&typeof t!="object")return he("profile must be an object");let n=[Je("pet_ref",e,_d)];return t?.name!==void 0&&n.push(Je("name",t.name,ii)),t?.species!==void 0&&n.push(Je("species",t.species,ai)),t?.breed!==void 0&&n.push(Je("breed",t.breed,si)),t?.ageYears!==void 0&&n.push(bn("age_years",t.ageYears,di)),t?.weightKg!==void 0&&n.push(bn("weight_kg",t.weightKg,ci)),n.find(r=>r!==null)??null}o(oi,"validate");function ui(e,t){let n=ni(e,t);return "error"in n?{error:he(n.error)}:n}o(ui,"healthToWire");function wd(e){if(typeof e!="object"||e===null)return {error:he("patch must be an object")};let t=e,n=[["name","name",l=>Je("name",l,ii)],["species","species",l=>Je("species",l,ai)],["breed","breed",l=>Je("breed",l,si)],["ageYears","age_years",l=>bn("age_years",l,di)],["weightKg","weight_kg",l=>bn("weight_kg",l,ci)]],r={};for(let[l,a,s]of n){let c=t[l];if(c!==void 0){if(c!==null){let d=s(c);if(d!==null)return {error:d}}r[a]=c;}}let i=ui(t,t.species);return "error"in i?i:(Object.assign(r,i.body),Object.keys(r).length===0?{error:he("patch must change at least one field")}:{body:r})}o(wd,"patchToWire");function Pd(e){if(e==null)return {body:{}};let t=ui(e,e.species);return "error"in t?t:{body:{...e.name!==void 0?{name:e.name}:{},...e.species!==void 0?{species:e.species}:{},...e.breed!==void 0?{breed:e.breed}:{},...e.ageYears!==void 0?{age_years:e.ageYears}:{},...e.weightKg!==void 0?{weight_kg:e.weightKg}:{},...t.body}}}o(Pd,"toWire");var be=o(e=>typeof e=="string"?e:null,"str"),hn=o(e=>typeof e=="number"&&Number.isFinite(e)?e:null,"num");function li(e,t){let n=typeof e=="object"&&e!==null?e:{};return Object.freeze({petRef:be(n.pet_ref)??t,name:be(n.name),species:be(n.species),breed:be(n.breed),ageYears:hn(n.age_years),weightKg:hn(n.weight_kg)})}o(li,"fromWire");function pi(e){if(typeof e!="object"||e===null)return null;let t=e,n=be(t.pet_ref);return n===null||n.length===0?null:Object.freeze({petId:be(t.pet_id),petRef:n,name:be(t.name),species:be(t.species),breed:be(t.breed),ageYears:hn(t.age_years),weightKg:hn(t.weight_kg),updatedAt:be(t.updated_at)})}o(pi,"widgetPetFromWire");function Id(e){let t=pi(e);return t===null?null:Object.freeze({...t,...ri(e)})}o(Id,"widgetPetProfileFromWire");function Od(e){let t=Array.isArray(e)?e:typeof e=="object"&&e!==null&&Array.isArray(e.pets)?e.pets:[];return Object.freeze(t.flatMap(n=>{let r=pi(n);return r===null?[]:[r]}))}o(Od,"petListFromWire");function fi(e){return Ad(Tt({auth:e}),Tt({auth:e,unaryTimeoutMs:xd}))}o(fi,"createPetsRepository");function Ad(e,t=e){let n=o((i,l)=>l?{...i,signal:l}:i,"withSignal"),r=o(i=>oi(i,void 0)??`/widget/v1/pets/${encodeURIComponent(i)}`,"petPath");return {async list(i){let l=await e.send("pets.list",n({method:"GET",path:"/widget/v1/pets"},i?.signal));return l.ok?L(Od(l.value)):w(l.error)},async registerPet(i,l,a){let s=oi(i,l);if(s!==null)return w(s);let c=Pd(l);if("error"in c)return w(c.error);let p={method:"POST",path:`/widget/v1/pets/${encodeURIComponent(i)}`,body:c.body},g=await e.send("pets.registerPet",a?.signal?{...p,signal:a.signal}:p);return g.ok?L(li(g.value,i)):w(g.error)},async updatePet(i,l,a){let s=r(i);if(typeof s!="string")return w(s);let c=wd(l);if("error"in c)return w(c.error);let d=await e.send("pets.updatePet",n({method:"PATCH",path:s,body:c.body},a?.signal));return d.ok?L(li(d.value,i)):w(d.error)},async getPetProfile(i,l){let a=r(i);if(typeof a!="string")return w(a);let s=await e.send("pets.getPetProfile",n({method:"GET",path:`${a}/profile`},l?.signal));if(!s.ok)return w(s.error);let c=Id(s.value);return c===null?w(ye("internalError",{retryable:false,httpStatus:502,wireMessage:"the pet profile response carried no pet_ref"})):L(c)},async deletePet(i,l){let a=r(i);if(typeof a!="string")return w(a);let s=await e.send("pets.deletePet",n({method:"DELETE",path:a},l?.signal));return s.ok?L(void 0):w(s.error)},async eraseUserData(i){let l=await t.send("pets.eraseUserData",n({method:"DELETE",path:"/widget/v1/me"},i?.signal),{maxAttempts:1});return l.ok?L(void 0):w(l.error)}}}o(Ad,"createPetsRepositoryOver");function it(){let{runtime:e,userRef:t,activePet:n,scopeEpoch:r}=Ye(),i=useMemo(()=>fi(e.registry.services.authFor(t)),[e,t,r]),[l,a]=useState({repository:i,pets:[],loading:true,error:null}),s=l.repository===i?l:{pets:[],loading:true,error:null},c=useRef(0),d=useCallback(async()=>{let g=++c.current;a(y=>({...y,repository:i,loading:true,error:null,pets:y.repository===i?y.pets:[]}));let f=await i.list();g===c.current&&a(f.ok?{repository:i,pets:f.value,loading:false,error:null}:y=>({repository:i,pets:y.repository===i?y.pets:[],loading:false,error:f.error}));},[i]);useEffect(()=>(d(),()=>{c.current+=1;}),[d]);let p=useMemo(()=>n===null?null:s.pets.find(g=>g.petRef===n)??null,[n,s.pets]);return useMemo(()=>({pets:s.pets,activePet:p,loading:s.loading,error:s.error,refresh:d}),[s.pets,s.loading,s.error,p,d])}o(it,"useEverfurPets");var ze=Object.freeze(["pet","issues","reason","clinician","time","review","booked"]),yi=Object.freeze({petId:null,state:null,clinicianId:null,slot:null,holdExpiresAt:null,shareHealthRecords:false,idempotencyKey:null});function wr(e,t={}){let n=Object.freeze({...yi,...t}),r=xr(0,e);return Object.freeze({index:r,draft:n,furthestIndex:r})}o(wr,"initialTelevetBookingState");function Tn(e,t){return e==="pet"?t.ownedPetCount<=1:e==="issues"?t.withIssues!==true:false}o(Tn,"isSkipped");function En(e){return ze[e]}o(En,"stepAt");function xr(e,t){for(let n=e;n<ze.length;n+=1){let r=En(n);if(r&&!Tn(r,t))return n}return ze.length-1}o(xr,"nextVisible");function mi(e,t){for(let n=e;n>=0;n-=1){let r=En(n);if(r&&!Tn(r,t))return n}return null}o(mi,"previousVisible");function Pr(e,t){return mi(e.index-1,t)!==null}o(Pr,"hasPreviousStep");function Ir(e,t,n){switch(t.type){case "patch":{let r={...e.draft,...t.patch};return ("petId"in t.patch&&t.patch.petId!==e.draft.petId||"state"in t.patch&&t.patch.state!==e.draft.state||"clinicianId"in t.patch&&t.patch.clinicianId!==e.draft.clinicianId)&&e.draft.slot?Object.freeze({...e,draft:Object.freeze({...r,slot:null,holdExpiresAt:null,idempotencyKey:null})}):Object.freeze({...e,draft:Object.freeze(r)})}case "next":{let r=xr(e.index+1,n);return Object.freeze({...e,index:r,furthestIndex:Math.max(e.furthestIndex,r)})}case "back":{if(En(e.index)==="booked")return e;let r=mi(e.index-1,n);return r===null?e:Object.freeze({...e,index:r})}case "goTo":{let r=ze.indexOf(t.step);if(r<0)return e;let i=Tn(t.step,n)?xr(r,n):r;return Object.freeze({...e,index:i,furthestIndex:Math.max(e.furthestIndex,i)})}default:return e}}o(Ir,"televetBookingReducer");function Or(e){return En(e.index)??"pet"}o(Or,"currentStep");function It(e,t){let n=t.trim();return !!e.petId&&!!e.clinicianId&&!!e.slot&&me(e.state)&&n.length>0&&n.length<=_e}o(It,"canConfirm");function Ar(e,t){if(!e.holdExpiresAt)return false;let n=Date.parse(e.holdExpiresAt);return Number.isNaN(n)?false:n<=t}o(Ar,"isHoldExpired");function Br(e){return `televet.book.${e}`}o(Br,"televetBookingKey");function Dr(e,t,n){let r=n?.version?.trim()??"";return !e||!t||r.length===0?Object.freeze({}):Object.freeze({state_attested:true,cancellation_policy_version:r})}o(Dr,"attestation");function xe(e){let t=new Date(e);return Number.isNaN(t.getTime())?null:t}o(xe,"parse");function Xe(e){let t=xe(e);return t?t.toLocaleTimeString(void 0,{hour:"numeric",minute:"2-digit"}):""}o(Xe,"formatClock");function Ld(e){let t=xe(e);return t?t.toLocaleDateString(void 0,{month:"long",day:"numeric"}):""}o(Ld,"formatDate");var at=10;function st(e){let t=xe(e);return t?new Intl.DateTimeFormat(void 0,{timeZoneName:"short"}).formatToParts(t).find(r=>r.type==="timeZoneName")?.value??"":""}o(st,"formatZone");function Vd(e){let t=xe(e);if(!t)return "";let n=new Date(t.getTime()+at*6e4).toISOString(),r=st(e),i=`${Xe(e)} - ${Xe(n)}`;return r&&r!==""?`${i} ${r}`:i}o(Vd,"formatVisitRange");function vi(e){let t=Ld(e),n=[Xe(e),st(e)].filter(Boolean).join(" ");return [t,n].filter(Boolean).join(", ")}o(vi,"formatWhen");function pe(e){let t=xe(e);return t?[t.toLocaleDateString(void 0,{weekday:"short"}),vi(e)].filter(Boolean).join(", "):""}o(pe,"formatWhenWithDay");function gi(e){let t=xe(e);if(!t)return "";let n=t.toLocaleDateString(void 0,{weekday:"short"}),r=t.toLocaleDateString(void 0,{year:"numeric",month:"long",day:"numeric"}),i=[Xe(e),st(e)].filter(Boolean).join(" ");return [n,r,i].filter(Boolean).join(", ")}o(gi,"formatRecordWhen");function kn(e){let t=xe(e);return t?`${t.getFullYear()}-${t.getMonth()+1}-${t.getDate()}`:"unknown"}o(kn,"localDayKey");function bi(e){let t=xe(e);return t===null?"":t.toLocaleDateString(void 0,{month:"long"})}o(bi,"formatMonthLabel");function hi(e){let t=xe(e);return t===null?"":t.toLocaleDateString(void 0,{weekday:"long",month:"long",day:"numeric"})}o(hi,"formatFullDayLabel");function Ei(e){let{draft:t,reasonText:n,book:r,stateAttested:i,termsAttested:l,cancellationPolicy:a,triage:s,goTo:c,setFailure:d,setRateLimitMessage:p,setEmergency:g,setBookedConsult:f,onBooked:y}=e,E=useCallback(P=>{if(!(!It(t,n)||!t.idempotencyKey)){if(Ar(t,Date.now())){d("expired"),c("time");return}d(null),g(null),r.mutate({pet_id:t.petId,clinician_id:t.clinicianId,slot_id:t.slot.slotId,state:t.state,reason_text:n.trim(),species:null,media_refs:[],emergency_acknowledged:P||s.isAcknowledged(n),share_health_records:t.shareHealthRecords,...Dr(i,l,a)},t.idempotencyKey,{onSuccess:o(h=>{f(h),c("booked"),y?.(h);},"onSuccess"),onError:o(h=>{let T=Ve(h);if(T.kind==="emergency"){g(T.categories);return}if(T.kind==="rate_limited"){p(T.message),d("rate_limited");return}d(T.kind==="not_entitled"?"not_entitled":T.kind==="slot_taken"?"taken":T.kind==="clinician_unavailable"?"clinician_unavailable":T.kind==="unavailable"?"unavailable":"failed"),T.kind==="slot_taken"&&c("time");},"onError")});}},[t,n,r,i,l,a,s,c,d,p,g,f,y]),_=useCallback(()=>E(false),[E]);return {submitBooking:E,confirm:_}}o(Ei,"useBookingSubmit");function Lr(e){let[t,n]=useState(false),[r,i]=useState(false),[l,a]=useState(null),s=useRef(null),c=useRef(null),d=useRef(true);useEffect(()=>(d.current=true,()=>{d.current=false,c.current?.abort(),c.current=null;}),[]);let p=useCallback(()=>{c.current?.abort(),c.current=null,d.current&&i(false);},[]),g=useCallback(async P=>{if(c.current!==null)return false;let h=P.trim();if(l!==null&&l===h||!e)return true;let T=s.current!==null&&s.current.reason===h?s.current.emergency:null;if(T===null){let R=new AbortController;c.current=R,i(true);try{let O=await e(h,R.signal);if(R.signal.aborted||!d.current)return !1;O===null?T=!1:(T=O.isEmergency||O.fallback,s.current=Object.freeze({reason:h,emergency:T}));}catch{if(R.signal.aborted||!d.current)return false;T=false;}finally{c.current===R&&(c.current=null,d.current&&i(false));}}return T===true?(n(true),false):true},[l,e]),f=useCallback(P=>{a(P.trim()),n(false);},[]),y=useCallback(()=>n(false),[]),E=useCallback(()=>{p(),s.current=null,a(null),n(false);},[p]),_=useCallback(P=>l!==null&&l===P.trim(),[l]);return {open:t,checking:r,check:g,acknowledge:f,close:y,cancel:p,reset:E,isAcknowledged:_}}o(Lr,"useEarlyTriage");function Ud(e){let t=e?.trim().toUpperCase()??"";return /^[A-Z]{2}$/.test(t)?t:null}o(Ud,"normalizeStateCode");function Vr(e,t){let n=Ud(e),[r,i]=useState(()=>Object.freeze({})),l=useRef(0),a=useRef(null),s=useCallback(c=>{if(!t||n===null)return null;let d=`${n}:${c}`;a.current!==null&&a.current!==d&&(l.current+=1),a.current=d;let p=r[d]??"idle";return {joined:p==="joined",pending:p==="pending",failed:p==="failed",onPress:o(()=>{if(p==="pending"||p==="joined")return;let g=l.current+=1;i(f=>Object.freeze({...f,[d]:"pending"})),(async()=>{let f=false;try{f=await t(n,c);}catch{f=false;}l.current===g&&i(y=>Object.freeze({...y,[d]:f?"joined":"failed"}));})();},"onPress")}},[n,r,t]);return useMemo(()=>({actionFor:s}),[s])}o(Vr,"useStateInterest");function zr(e){return Object.freeze(e==="dark"?{title:u.noCliniciansTitle,message:u.noCliniciansBody,retryLabel:u.noCliniciansRetryCta,interestReason:null}:{title:u.noCliniciansTitle,message:u.noCliniciansRegionBody,retryLabel:null,interestReason:"no_licensed_vet"})}o(zr,"televetEmptyRosterView");function Mr(e){return e?"roster":"dark"}o(Mr,"televetEmptyRosterCause");var Ot=Object.freeze({failed:0,refused:Object.freeze({size:0,type:0,unreadable:0})});function jr(e){let{failed:t,refused:n}=e;return t<=0&&n.size<=0&&n.type<=0&&n.unreadable<=0}o(jr,"isMediaShortfallEmpty");function Hr(e){let t=o(r=>Number.isFinite(r)&&r>0?Math.floor(r):0,"count"),n=u.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(r=>r.n>0).map(r=>ne(r.n===1?r.one:r.many,{n:String(r.n)}))}o(Hr,"televetMediaShortfallLines");function Cn(e){let t=Number.isFinite(e)&&e>0?Math.floor(e):0;return t===0?Ot:Object.freeze({failed:t,refused:Ot.refused})}o(Cn,"mediaShortfallFromUnsentPicks");function Wd(e,t){let n=Cn(t);return n.failed===0?e:Object.freeze({failed:e.failed+n.failed,refused:e.refused})}o(Wd,"withUnsentPicks");var X=44;function V(){let e=S();return useMemo(()=>Gd(e),[e])}o(V,"useBookingStyles");function A({label:e,onPress:t,kind:n="primary",disabled:r=false,loading:i=false,fullWidth:l=true,accessibilityLabel:a,testID:s,style:c}){let d=V(),p=S(),g=r||i;return jsxs(Pressable,{onPress:t,disabled:g,accessibilityRole:"button",accessibilityLabel:a??e,accessibilityState:{disabled:g,busy:i},style:[d.button,n==="primary"?d.buttonPrimary:n==="danger"?d.buttonDanger:d.buttonSecondary,l?d.buttonFull:d.buttonAuto,g?d.buttonDisabled:null,c],testID:s,children:[i?jsx(ActivityIndicator,{size:"small",color:n==="secondary"?p.color.brand:p.color.onPrimary}):null,jsx(v,{tier:"control",style:n==="secondary"?d.buttonSecondaryLabel:d.buttonPrimaryLabel,children:e})]})}o(A,"TelevetButton");function F({title:e,message:t,actionLabel:n,onAction:r,testID:i}){let l=V(),a=typeof n=="string"&&n.length>0&&typeof r=="function";return jsxs(View,{style:l.stateCard,testID:i,children:[jsx(v,{style:l.stateTitle,accessibilityRole:"header",children:e}),t?jsx(v,{style:l.stateMessage,children:t}):null,a?jsx(A,{label:n,onPress:r,kind:"secondary",fullWidth:false}):null]})}o(F,"TelevetStateCard");function ee({height:e,width:t="100%",testID:n}){let r=V();return jsx(View,{style:[r.skeleton,{height:e,width:t}],testID:n,accessibilityElementsHidden:true,importantForAccessibility:"no"})}o(ee,"TelevetSkeletonBlock");function $({message:e,assertive:t=false,testID:n,style:r}){let i=V();return jsx(v,{style:[i.failure,r],accessibilityLiveRegion:t?"assertive":"polite",testID:n,children:e})}o($,"TelevetFailureLine");function Gd(e){let{color:t,space:n,radius:r,type:i}=e,{size:l,lineHeight:a}=i;return StyleSheet.create({screen:{flex:1,paddingHorizontal:n.xl,gap:n.md},stepFill:{flex:1,minHeight:0,gap:n.md},list:{gap:n.sm},button:{minHeight:X,flexDirection:"row",alignItems:"center",justifyContent:"center",gap:n.sm,paddingHorizontal:n.xl,paddingVertical:n.sm,borderRadius:r.pill},buttonFull:{alignSelf:"stretch"},buttonAuto:{alignSelf:"flex-start",minWidth:X},buttonPrimary:{backgroundColor:t.primary},buttonSecondary:{borderWidth:1,borderColor:t.brandBorder,backgroundColor:"transparent"},buttonDanger:{backgroundColor:t.danger},buttonDisabled:{opacity:.45},buttonPrimaryLabel:{...b(e,"medium"),color:t.onPrimary,fontSize:l.body,lineHeight:l.body*a.snug},buttonSecondaryLabel:{...b(e,"medium"),color:t.brand,fontSize:l.body,lineHeight:l.body*a.snug},stateCard:{minHeight:140,justifyContent:"center",gap:n.sm,padding:n.lg,borderRadius:r.lg,borderWidth:1,borderColor:t.brandBorder},stateTitle:{...b(e,"medium"),color:t.brand,fontSize:l.subtitle,lineHeight:l.subtitle*a.snug},stateMessage:{...b(e,"regular"),color:t.text.metaCool,fontSize:l.body,lineHeight:l.body*a.normal},skeleton:{borderRadius:r.md,backgroundColor:t.skeleton},failure:{...b(e,"regular"),color:t.danger,fontSize:l.caption,lineHeight:l.caption*a.normal},stepTitle:{...b(e,"bold"),color:t.brand,fontSize:l.heading,lineHeight:l.heading*a.snug},stepHelp:{...b(e,"regular"),color:t.text.metaCool,fontSize:l.body,lineHeight:l.body*a.normal},divider:{height:1,backgroundColor:t.brandBorder},scrollRoot:{flex:1,minHeight:0},scrollBody:{flex:1},scrollFooter:{paddingTop:n.md,paddingBottom:n.lg}})}o(Gd,"makeBookingStyles");function At({petName:e,primaryVet:t,onFindEmergencyVet:n}){let r=S(),i=useMemo(()=>xi(r),[r]),l=e?.trim()??"";return jsxs(Fragment,{children:[n?jsx(Pressable,{accessibilityRole:"button",accessibilityLabel:u.emergency.exitFindErTitle,onPress:()=>{Jt(n);},style:i.vetCard,testID:"televet-emergency-find-vet",children:jsx(View,{style:i.vetRow,children:jsx(v,{tier:"control",style:i.vetTitle,children:u.emergency.exitFindErTitle})})}):null,t!=null&&l.length>0?jsx(Jd,{petName:l,vet:t}):null]})}o(At,"TelevetEmergencyExits");function Jd({petName:e,vet:t}){let n=S(),r=useMemo(()=>xi(n),[n]),i=ne(u.emergency.exitPrimaryVetTitle,{petName:e}),l=t.detail?.trim()??"",a=jsx(View,{style:r.vetRow,children:jsxs(View,{style:r.vetText,children:[jsx(v,{tier:"control",style:r.vetTitle,children:i}),l.length>0?jsx(v,{style:r.vetDetail,children:l}):null]})});if(!t.dial)return jsx(View,{style:r.vetCard,testID:"televet-early-emergency-primary-vet",children:a});let s=t.dial;return jsx(Pressable,{accessibilityRole:"link",accessibilityLabel:l.length>0?`${i}, ${l}`:i,accessibilityHint:u.emergency.startCallHint,onPress:()=>{Jt(s);},style:r.vetCard,testID:"televet-early-emergency-primary-vet-call",children:a})}o(Jd,"PrimaryVetCard");function xi(e){let{color:t,space:n,radius:r,type:i}=e,{size:l,lineHeight:a}=i;return {vetCard:{minHeight:X,justifyContent:"center",padding:n.lg,borderRadius:r.lg,borderWidth:1,borderColor:t.brandBorder,backgroundColor:t.surface},vetRow:{flexDirection:"row",alignItems:"center",gap:n.sm},vetText:{flexShrink:1,gap:n.xs},vetTitle:{...b(e,"medium"),color:t.text.primary,fontSize:l.body,lineHeight:l.body*a.normal},vetDetail:{...b(e,"regular"),color:t.text.metaCool,fontSize:l.caption,lineHeight:l.caption*a.normal}}}o(xi,"makeExitStyles");function Ii({petName:e,primaryVet:t,onFindEmergencyVet:n,onContinue:r}){let i=S(),l=V(),a=useMemo(()=>$r(i),[i]);return jsxs(View,{style:[l.stepFill,a.emergencyPanel],testID:"televet-early-emergency",children:[jsx(v,{tier:"heading",accessibilityRole:"header",accessibilityLiveRegion:"assertive",style:a.emergencyTitle,children:u.emergency.bannerTitle}),jsx(v,{style:a.emergencyLede,children:u.emergency.lede}),jsx(At,{petName:e,primaryVet:t,onFindEmergencyVet:n}),jsx(A,{label:u.emergency.keepBookingCta,kind:"secondary",onPress:r,testID:"televet-early-emergency-continue"})]})}o(Ii,"TelevetEarlyEmergency");function Wr({action:e,testIDPrefix:t}){let n=S(),r=useMemo(()=>$r(n),[n]);return e===null?null:e.joined?jsxs(View,{testID:`${t}-joined`,style:r.interestFeedback,children:[jsx(v,{tier:"control",accessibilityRole:"header",children:u.stateInterest.joinedTitle}),jsx(v,{style:r.interestBody,children:u.stateInterest.joinedBody})]}):jsxs(View,{testID:t,style:r.interestAction,children:[jsx(A,{label:u.stateInterest.cta,kind:"secondary",loading:e.pending,disabled:e.pending,onPress:e.onPress,testID:`${t}-submit`}),e.failed?jsx($,{message:u.stateInterest.failed,testID:`${t}-error`}):null]})}o(Wr,"TelevetStateInterestAction");function Oi({cause:e,onRetry:t,stateInterest:n=null}){let r=zr(e);return jsxs(View,{testID:"televet-clinicians-empty",children:[jsx(F,{title:r.title,message:r.message,...r.retryLabel!==null&&t?{actionLabel:r.retryLabel,onAction:t}:{}}),r.interestReason!==null?jsx(Wr,{action:n??null,testIDPrefix:"televet-state-interest-no-licensed-vet"}):null]})}o(Oi,"TelevetClinicianEmptyState");function qr({onCheckAvailability:e}){let t=V();return jsxs(View,{testID:"televet-booking-not-entitled",style:t.list,children:[jsx(F,{title:u.confirmNotEntitled}),e?jsx(A,{label:u.checkAvailabilityCta,kind:"secondary",onPress:e,testID:"televet-check-state-availability"}):null]})}o(qr,"TelevetEntitlementInterestState");function Bt({shortfall:e,testIDPrefix:t}){let n=S(),r=useMemo(()=>$r(n),[n]);if(jr(e))return null;let i=Hr(e);return i.length===0?null:jsx(View,{style:r.mediaNotice,testID:`${t}-media-notice`,children:i.map((l,a)=>jsx(v,{style:r.mediaLine,accessibilityLiveRegion:"polite",testID:`${t}-media-line-${String(a)}`,children:l},l))})}o(Bt,"TelevetMediaDropNotice");function $r(e){let{color:t,space:n,radius:r,type:i}=e,{size:l,lineHeight:a}=i;return {emergencyPanel:{gap:n.sm,padding:n.lg,borderRadius:r.lg,borderWidth:2,borderColor:t.danger,backgroundColor:t.surface},emergencyTitle:{...b(e,"medium"),color:t.danger,fontSize:l.heading,lineHeight:l.heading*a.snug},emergencyLede:{...b(e,"regular"),color:t.text.primary,fontSize:l.subtitle,lineHeight:l.subtitle*a.normal},interestAction:{gap:n.sm,marginTop:n.sm},interestFeedback:{gap:n.xs,marginTop:n.sm},interestBody:{...b(e,"regular"),color:t.text.metaCool},mediaNotice:{gap:n.xs},mediaLine:{...b(e,"regular"),color:t.text.metaCool,fontSize:l.caption,lineHeight:l.caption*a.normal}}}o($r,"makeEdgeStyles");function Ai(e){let{surfaceUnavailable:t,notEntitled:n,policyBlocked:r,triageOpen:i,step:l}=e;return t||n&&l!=="clinician"||r?true:l==="reason"&&i}o(Ai,"televetBookingGateApplies");function Bi({state:e,petName:t,primaryVet:n,onFindEmergencyVet:r,stateInterest:i=null,onCheckAvailability:l,onAcknowledgeEmergency:a,renderUnavailable:s}){let c=V(),{surfaceUnavailable:d,notEntitled:p,policyBlocked:g,triageOpen:f,step:y}=e;return d?jsx(View,{style:c.stepFill,testID:"televet-booking-unavailable",children:s?s():jsx(F,{title:u.bookingPausedTitle})}):p&&y!=="clinician"?jsx(qr,{...l?{onCheckAvailability:l}:{}}):g?jsxs(View,{testID:"televet-booking-state-blocked",children:[jsx(F,{title:u.stateBlockedTitle}),jsx(Wr,{action:i,testIDPrefix:"televet-state-interest-state-blocked"})]}):y==="reason"&&f?jsx(Ii,{...t!==void 0?{petName:t}:{},...n?{primaryVet:n}:{},onFindEmergencyVet:r,onContinue:a}):null}o(Bi,"TelevetBookingGate");var Pi=false;function Zd(){if(!Pi){Pi=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{}}}o(Zd,"warnNoStateSeamOnce");function Di(e){return e.noState?true:e.isPending||e.isError?false:e.isEmpty||e.notEntitled}o(Di,"televetClinicianOutcomeApplies");function Fi({state:e,cause:t,locationStatus:n,onRequestLocation:r,onRetry:i,stateInterest:l=null}){let a=e.noState&&!r;return useEffect(()=>{a&&Zd();},[a]),e.noState?jsx(View,{testID:"televet-booking-location-unknown",children:jsx(F,{title:n==="blocked"?u.locationBlockedTitle:n==="unavailable"?u.locationUnavailableTitle:u.locationUnknownTitle,message:n==="blocked"?u.locationBlockedBody:n==="unavailable"?u.locationUnavailableBody:r?u.locationUnknownBody:void 0,actionLabel:r?n==="blocked"?u.locationBlockedCta:u.locationUnknownCta:void 0,onAction:r})}):e.isEmpty?jsx(Oi,{cause:t,onRetry:i,stateInterest:l}):jsx(qr,{})}o(Fi,"TelevetClinicianOutcome");function Ni(e){return `televet-consult-${e}`}o(Ni,"televetConsultCalendarKey");function Yr({consult:e,petName:t,onDone:n,onAddToCalendar:r,canJoinInApp:i=false}){let l=S(),a=V(),s=useMemo(()=>rc(l),[l]),[c,d]=useState("idle"),p=o(async()=>{if(!r)return;d("saving");let f=new Date(e.scheduledAt);if(Number.isNaN(f.getTime())){d("failed");return}let y=await Xt(r,{key:Ni(e.consultId),title:u.visit.title,startDate:f,endDate:new Date(f.getTime()+at*6e4),alarmOffsetMinutes:-30});d(y.ok&&y.value===true?"saved":"failed");},"addToCalendar"),g=[u.booked.remindPromise,ne(u.booked.summaryPromise,{pet:t??""}),...i?[u.booked.joinPromise]:[]];return Se()?jsxs(View,{style:s.screen,testID:"televet-booked",children:[jsx(View,{style:s.header,children:jsx(A,{label:u.doneCta,kind:"secondary",fullWidth:false,onPress:n,testID:"televet-booked-done"})}),jsx(View,{style:s.avatar,accessibilityElementsHidden:true,importantForAccessibility:"no"}),jsx(v,{tier:"heading",style:s.title,accessibilityRole:"header",children:u.bookedTitle}),jsx(v,{style:s.when,children:pe(e.scheduledAt)}),jsx(View,{style:s.steps,testID:"televet-booked-steps",children:g.map((f,y)=>jsxs(View,{style:s.step,children:[jsx(View,{style:s.stepNumber,accessibilityElementsHidden:true,importantForAccessibility:"no",children:jsx(v,{tier:"badge",style:s.stepNumberText,children:String(y+1)})}),jsx(v,{style:s.stepText,children:f.trim()})]},f))}),jsxs(View,{style:s.actions,children:[r?jsx(A,{label:c==="saved"?u.booked.calendarAdded:u.addToCalendarCta,kind:"primary",loading:c==="saving",disabled:c==="saving"||c==="saved",onPress:()=>{p();},testID:"televet-booked-calendar"}):null,c==="failed"?jsx(v,{style:[a.failure,s.calendarNote],accessibilityLiveRegion:"polite",testID:"televet-booked-calendar-failed",children:u.booked.calendarFailedBody}):null,jsx(A,{label:t?ne(u.booked.backToPet,{pet:t}):u.doneCta,kind:"secondary",onPress:n,testID:"televet-booked-back"})]})]}):jsx(View,{style:s.screen,testID:"televet-booked-copy-unapproved"})}o(Yr,"TelevetBookedScreen");function rc(e){let{color:t,space:n,radius:r,type:i}=e,{size:l,lineHeight:a}=i;return StyleSheet.create({screen:{flex:1,paddingHorizontal:n.xl,gap:n.md},header:{alignItems:"flex-end",paddingBottom:n.lg},avatar:{alignSelf:"center",width:120,height:120,borderRadius:60,backgroundColor:t.surfaceSubtle,borderWidth:2,borderColor:t.success},title:{textAlign:"center",...b(e,"bold"),color:t.brand,fontSize:l.verdict,lineHeight:l.verdict*a.tight,letterSpacing:-0.7,paddingTop:n.lg},when:{textAlign:"center",...b(e,"regular"),color:t.text.metaCool,fontSize:l.subtitle,lineHeight:l.subtitle*a.normal},steps:{marginTop:n.xl,padding:n.lg,borderRadius:r.lg,borderWidth:1,borderColor:t.brandBorder,gap:n.lg},step:{flexDirection:"row",alignItems:"flex-start",gap:n.md},stepNumber:{width:26,height:26,borderRadius:13,backgroundColor:t.primary,alignItems:"center",justifyContent:"center"},stepNumberText:{...b(e,"medium"),color:t.onPrimary,fontSize:l.caption,lineHeight:l.caption,includeFontPadding:false},stepText:{flex:1,...b(e,"regular"),color:t.brand,fontSize:l.body,lineHeight:l.body*a.normal},actions:{marginTop:"auto",paddingBottom:n.xl,gap:n.md},calendarNote:{textAlign:"center"}})}o(rc,"makeStyles");function Jr({step:e,furthestIndex:t,title:n,canGoBack:r,isDirty:i,onBack:l,onClose:a,onConfirmDiscard:s}){let c=S(),d=useMemo(()=>sc(c),[c]),p=useMemo(()=>()=>{if(!i){a();return}let T={title:u.chrome.discardTitle,body:u.chrome.discardBody,confirmLabel:u.chrome.discardConfirmCta,keepLabel:u.chrome.discardKeepCta};if(s){Promise.resolve(s(T)).then(R=>{R&&a();},()=>{});return}Alert.alert(T.title,T.body,[{text:T.keepLabel,style:"cancel"},{text:T.confirmLabel,style:"destructive",onPress:a}]);},[i,a,s]),g=useMemo(()=>()=>r?(l(),true):(p(),true),[r,l,p]);useEffect(()=>{let T=BackHandler.addEventListener("hardwareBackPress",g);return ()=>{T.remove();}},[g]),rt(g);let f=ze.filter(T=>T!=="issues"),y=f.length,E=ze[t],_=E===void 0?0:Math.max(0,f.indexOf(E==="issues"?"reason":E)),h=e==="booked"?1:Math.min(1,(_+1)/y);return jsxs(View,{style:d.wrap,children:[jsxs(View,{style:d.bar,children:[jsx(View,{style:d.side,children:jsx(Pressable,{onPress:r?l:p,accessibilityRole:"button",accessibilityLabel:Rn,testID:"televet-booking-back",style:d.tap,children:jsx(View,{style:d.chevron,accessibilityElementsHidden:true,importantForAccessibility:"no"})})}),jsx(v,{tier:"heading",style:d.title,accessibilityRole:"header",children:n??u.navTitle}),jsx(View,{style:[d.side,d.sideRight],children:jsx(Pressable,{onPress:p,accessibilityRole:"button",accessibilityLabel:u.close,accessibilityHint:u.chrome.closeHint,testID:"televet-booking-close",style:d.tap,children:jsx(v,{tier:"control",style:d.close,children:u.close})})})]}),jsx(View,{style:d.railTrack,accessibilityElementsHidden:true,importantForAccessibility:"no-hide-descendants",children:jsx(View,{style:[d.railFill,{width:`${Math.round(h*100)}%`}],testID:"televet-booking-rail"})})]})}o(Jr,"TelevetBookingChrome");var Rn="Back";function sc(e){let{color:t,space:n,type:r}=e,{size:i,lineHeight:l}=r;return StyleSheet.create({wrap:{backgroundColor:t.surface},bar:{flexDirection:"row",alignItems:"center",paddingHorizontal:n.lg,minHeight:56},side:{minWidth:64,justifyContent:"center"},sideRight:{alignItems:"flex-end"},tap:{minHeight:X,minWidth:X,justifyContent:"center",paddingHorizontal:n.xs},chevron:{width:10,height:10,borderLeftWidth:2,borderBottomWidth:2,borderColor:t.brand,transform:[{rotate:"45deg"}]},title:{flex:1,textAlign:"center",...b(e,"medium"),color:t.brand,fontSize:i.subtitle,lineHeight:i.subtitle*l.normal},close:{...b(e,"medium"),color:t.brand,fontSize:i.subtitle,lineHeight:i.subtitle*l.normal},railTrack:{height:4,backgroundColor:t.surfaceSubtle},railFill:{height:4,backgroundColor:t.success}})}o(sc,"makeStyles");function zi(e){let t=[],n=dc(e.ageYears);n!==null&&t.push(`${String(n)} yr${n===1?"":"s"} old`);let r=e.weightKg;typeof r=="number"&&Number.isFinite(r)&&r>0&&t.push(`${String(Math.round(r))} kg`);let i=e.breed?.trim();return i&&t.push(i),t.join(" \xB7 ")}o(zi,"formatTelevetPetMetaLine");function dc(e){if(typeof e!="number"||!Number.isFinite(e))return null;let t=Math.floor(e);return t>=0?t:null}o(dc,"wholeYears");function Qr({media:e,onChange:t,onPickMedia:n}){let r=S(),i=useMemo(()=>gc(r),[r]),l=nn-e.length,[a,s]=useState(false);if(!n)return null;let c=o(async()=>{if(!(a||l<=0)){s(true);try{let d=await Xt(n,l);if(!d.ok||d.value===null||d.value.length===0)return;let p=new Set(e.map(f=>f.uri)),g=d.value.filter(f=>typeof f?.uri=="string"&&f.uri.length>0&&!p.has(f.uri));if(g.length===0)return;t([...e,...g].slice(0,nn));}finally{s(false);}}},"pick");return jsxs(View,{style:i.row,children:[e.map((d,p)=>jsxs(View,{style:i.thumb,children:[jsx(Image,{source:{uri:d.uri},style:i.thumbImage,resizeMode:"cover"}),d.mimeType?.startsWith("video/")?jsx(View,{style:i.videoBadge,testID:`televet-intake-media-video-${String(p)}`,children:jsx(v,{tier:"badge",style:i.videoBadgeText,children:vc})}):null,jsx(Pressable,{onPress:()=>t(e.filter((g,f)=>f!==p)),accessibilityRole:"button",accessibilityLabel:u.removePhotoLabel,testID:`televet-intake-media-remove-${String(p)}`,style:i.remove,children:jsx(v,{tier:"control",style:i.removeGlyph,children:mc})})]},`${d.uri}-${String(p)}`)),l>0?jsx(Pressable,{onPress:()=>{c();},disabled:a,accessibilityRole:"button",accessibilityLabel:u.addPhotoCta,accessibilityState:{busy:a,disabled:a},testID:"televet-intake-add-media",style:[i.dropzone,a?i.dropzoneBusy:null],children:a?jsx(ActivityIndicator,{testID:"televet-intake-media-busy"}):jsx(v,{tier:"compact",style:i.dropzoneText,children:u.addPhotoCta})}):null]})}o(Qr,"TelevetIntakeMedia");var mc="\xD7",vc="\u25B6",_n=92;function gc(e){let{color:t,space:n,radius:r,type:i}=e,{size:l,lineHeight:a}=i;return StyleSheet.create({row:{flexDirection:"row",flexWrap:"wrap",gap:n.md,paddingTop:n.sm},thumb:{width:_n,height:_n,borderRadius:r.md,backgroundColor:t.surfaceSubtle},thumbImage:{width:"100%",height:"100%",borderRadius:r.md},videoBadge:{position:"absolute",left:6,bottom:6,paddingHorizontal:6,paddingVertical:2,borderRadius:r.sm,backgroundColor:t.shadow},videoBadgeText:{color:t.text.onBrand,fontSize:l.nano},remove:{position:"absolute",top:-8,right:-8,width:X-16,height:X-16,borderRadius:X/2,backgroundColor:t.text.metaCool,alignItems:"center",justifyContent:"center"},removeGlyph:{...b(e,"medium"),color:t.surface,fontSize:l.subtitle,lineHeight:l.subtitle,includeFontPadding:false},dropzone:{width:_n,height:_n,borderRadius:r.md,borderWidth:1,borderStyle:"dashed",borderColor:t.brandBorder,alignItems:"center",justifyContent:"center",paddingHorizontal:n.sm},dropzoneBusy:{opacity:.6},dropzoneText:{...b(e,"mono"),color:t.text.metaCool,fontSize:l.nano,lineHeight:l.nano*a.normal,letterSpacing:.3,textAlign:"center"}})}o(gc,"makeStyles");function Zr({slots:e,selectedDayKey:t,onSelectDay:n}){let r=S(),i=useMemo(()=>kc(r),[r]),l=useMemo(()=>wn(e),[e]),a=l[0];return a===void 0?null:jsxs(View,{children:[jsx(v,{tier:"compact",style:i.month,testID:"televet-day-strip-month",children:bi(a.iso)}),jsx(ScrollView,{horizontal:true,showsHorizontalScrollIndicator:false,contentContainerStyle:i.strip,testID:"televet-day-strip",children:l.map(s=>{let c=s.key===t;return jsxs(Pressable,{onPress:()=>n(s),accessibilityRole:"button",accessibilityLabel:hi(s.iso),accessibilityState:{selected:c},testID:`televet-day-${s.key}`,style:[i.day,c?i.daySelected:null],children:[jsx(v,{tier:"compact",style:[i.dayWeekday,c?i.dayTextSelected:null],children:s.weekday}),jsx(v,{tier:"compact",style:[i.dayNumber,c?i.dayTextSelected:null],children:s.dayNumber})]},s.key)})})]})}o(Zr,"TelevetDayStrip");function wn(e){let t=new Map;for(let n of e){let r=kn(n.startsAt);if(t.has(r))continue;let i=new Date(n.startsAt);Number.isNaN(i.getTime())||t.set(r,Object.freeze({key:r,iso:n.startsAt,weekday:i.toLocaleDateString(void 0,{weekday:"short"}),dayNumber:String(i.getDate())}));}return Object.freeze([...t.values()])}o(wn,"televetDaysFromSlots");function kc(e){let{color:t,space:n,radius:r,type:i}=e,{size:l,lineHeight:a}=i;return StyleSheet.create({month:{textAlign:"center",...b(e,"medium"),color:t.brand,fontSize:l.subtitle,lineHeight:l.subtitle*a.snug,paddingBottom:n.md},strip:{gap:n.sm,paddingHorizontal:n.xs},day:{width:52,minHeight:X,paddingVertical:n.md,borderRadius:r.md,borderWidth:1,borderColor:t.brandBorder,alignItems:"center",justifyContent:"center",gap:2},daySelected:{backgroundColor:t.primary,borderColor:t.primary},dayWeekday:{...b(e,"mono"),color:t.text.secondary,fontSize:l.tiny,lineHeight:l.tiny*a.tight},dayNumber:{...b(e,"medium"),color:t.brand,fontSize:l.heading,lineHeight:l.heading*a.tight},dayTextSelected:{color:t.onPrimary}})}o(kc,"makeStyles");function Ft({slots:e,busySlotId:t,onPick:n,ListHeaderComponent:r,rowTestIdPrefix:i="televet-slot",testID:l="televet-slot-list"}){let a=S(),s=useMemo(()=>wc(a),[a]),c=useMemo(()=>wn(e),[e]),[d,p]=useState(null),g=d??c[0]?.key??null,f=useMemo(()=>g?e.filter(h=>kn(h.startsAt)===g):[],[e,g]),y=r,E=useMemo(()=>f.map(h=>st(h.startsAt)),[f]),_=useMemo(()=>new Set(E.filter(h=>h.length>0)).size>1,[E]),P=f[0];return jsxs(View,{style:s.root,testID:l,children:[y?jsx(y,{}):null,jsx(Zr,{slots:e,selectedDayKey:g,onSelectDay:h=>p(h.key)}),P&&!_?jsx(v,{tier:"compact",style:s.zone,testID:"televet-slot-zone",children:st(P.startsAt)}):null,jsx(ScrollView,{style:s.gridScroll,contentContainerStyle:s.grid,showsVerticalScrollIndicator:false,children:f.map((h,T)=>{let R=t===h.slotId,O=t!==null,C=_?E[T]??"":"";return jsxs(Pressable,{onPress:()=>n(h),disabled:O,accessibilityRole:"button",accessibilityLabel:[Xe(h.startsAt),C].filter(q=>q.length>0).join(" "),accessibilityState:{disabled:O,busy:R},testID:`${i}-${h.slotId}`,style:[s.chip,R?s.chipBusy:null,O&&!R?s.chipDisabled:null],children:[jsx(v,{tier:"compact",style:[s.chipLabel,R?s.chipLabelBusy:null],children:Xe(h.startsAt)}),C.length>0?jsx(v,{tier:"compact",style:[s.chipZone,R?s.chipLabelBusy:null],testID:`${i}-${h.slotId}-zone`,children:C}):null]},h.slotId)})})]})}o(Ft,"TelevetSlotPicker");function wc(e){let{color:t,space:n,radius:r,type:i}=e,{size:l,lineHeight:a}=i;return StyleSheet.create({root:{flex:1,minHeight:0},gridScroll:{flex:1},zone:{textAlign:"center",...b(e,"mono"),color:t.text.muted,fontSize:l.tiny,lineHeight:l.tiny*a.normal,letterSpacing:.4,paddingVertical:n.md},grid:{flexDirection:"row",flexWrap:"wrap",gap:n.md,paddingBottom:n.xl},chip:{minWidth:96,flexGrow:1,flexBasis:"28%",minHeight:48,borderRadius:r.pill,borderWidth:1,borderColor:t.brandBorder,alignItems:"center",justifyContent:"center",paddingHorizontal:n.md},chipBusy:{backgroundColor:t.primary,borderColor:t.primary},chipDisabled:{opacity:.45},chipLabel:{...b(e,"regular"),color:t.brand,fontSize:l.subtitle,lineHeight:l.subtitle*a.tight},chipLabelBusy:{color:t.onPrimary},chipZone:{...b(e,"mono"),color:t.text.muted,fontSize:l.tiny,lineHeight:l.tiny*a.normal,letterSpacing:.4}})}o(wc,"makeStyles");function et({label:e,value:t,last:n=false,testID:r}){let i=S(),l=useMemo(()=>ro(i),[i]);return jsxs(View,{style:[l.row,n?l.rowLast:null],testID:r,children:[jsx(v,{style:l.rowLabel,children:e}),jsx(v,{style:l.rowValue,children:t})]})}o(et,"TelevetSummaryRow");function Nt({label:e,checked:t,onToggle:n,testID:r}){let i=S(),l=useMemo(()=>ro(i),[i]);return jsxs(Pressable,{onPress:()=>n(!t),accessibilityRole:"checkbox",accessibilityLabel:e,accessibilityState:{checked:t},testID:r,style:l.consent,children:[jsx(View,{style:[l.box,t?l.boxChecked:null],children:t?jsx(v,{tier:"badge",style:l.tick,children:Oc}):null}),jsx(v,{style:l.consentLabel,children:e})]})}o(Nt,"TelevetConsentCheckbox");var Oc="\u2713";function no({children:e,testID:t}){let n=S(),r=useMemo(()=>ro(n),[n]);return jsx(View,{style:r.card,testID:t,children:e})}o(no,"TelevetSummaryCard");function ro(e){let{color:t,space:n,radius:r,type:i}=e,{size:l,lineHeight:a}=i;return StyleSheet.create({card:{borderRadius:r.lg,borderWidth:1,borderColor:t.brandBorder,paddingHorizontal:n.lg},row:{flexDirection:"row",alignItems:"flex-start",justifyContent:"space-between",gap:n.lg,paddingVertical:n.lg,borderBottomWidth:1,borderBottomColor:t.brandBorder},rowLast:{borderBottomWidth:0},rowLabel:{...b(e,"regular"),color:t.brand,fontSize:l.subtitle,lineHeight:l.subtitle*a.snug},rowValue:{flexShrink:1,textAlign:"right",...b(e,"medium"),color:t.brand,fontSize:l.subtitle,lineHeight:l.subtitle*a.snug},consent:{flexDirection:"row",alignItems:"flex-start",gap:n.md,minHeight:X,padding:n.lg,borderRadius:r.md,backgroundColor:t.surfaceSubtle},box:{width:22,height:22,borderRadius:r.xs,borderWidth:1.5,borderColor:t.brand,backgroundColor:t.surface,alignItems:"center",justifyContent:"center"},boxChecked:{backgroundColor:t.primary,borderColor:t.primary},tick:{...b(e,"bold"),color:t.onPrimary,fontSize:l.caption,lineHeight:l.caption,includeFontPadding:false},consentLabel:{flex:1,...b(e,"regular"),color:t.text.metaCool,fontSize:l.body,lineHeight:l.body*a.normal}})}o(ro,"makeStyles");function oo({when:e,clinician:t,petName:n,reason:r,shareRecords:i,onToggleShare:l,stateCode:a,stateAttested:s,onToggleStateAttest:c,cancellationTerms:d,termsAttested:p,onToggleTermsAttest:g,canConfirm:f,busy:y,failure:E,rateLimitMessage:_,onConfirm:P,emergency:h,onAcknowledgeEmergency:T,onSeeOtherVets:R,mediaShortfall:O=Ot,primaryVet:C,onFindEmergencyVet:q}){let D=V(),z=S(),N=useMemo(()=>He(z),[z]);return jsxs(View,{style:D.scrollRoot,testID:"televet-booking-review",children:[jsxs(ScrollView,{style:D.scrollBody,contentContainerStyle:D.list,keyboardShouldPersistTaps:"handled",showsVerticalScrollIndicator:false,testID:"televet-booking-review-scroll",children:[jsxs(no,{testID:"televet-review-summary",children:[n?jsx(et,{label:u.summaryPet,value:n,testID:"televet-review-row-pet"}):null,t?jsx(et,{label:u.summaryVet,value:t,testID:"televet-review-row-vet"}):null,jsx(et,{label:u.summaryWhen,value:e,testID:"televet-review-row-when"}),jsx(et,{label:u.summaryLength,value:ne(u.summaryLengthTemplate,{n:String(at)}),testID:"televet-review-row-length"}),r?jsx(et,{label:u.summaryReason,value:r,last:true,testID:"televet-review-row-reason"}):null]}),jsx(Nt,{label:u.shareRecordsOff,checked:i,onToggle:l,testID:"televet-review-share-records"}),d?jsx(Nt,{label:d,checked:p,onToggle:g,testID:"televet-review-terms-attest"}):null,a?jsx(Nt,{label:ne(u.stateAttestTemplate,{state:a}),checked:s,onToggle:c,testID:"televet-review-state-attest"}):null,jsx(Bt,{shortfall:O,testIDPrefix:"televet-review"}),h?jsxs(View,{style:N.emergencyBanner,testID:"televet-review-emergency",children:[jsx(v,{tier:"heading",accessibilityRole:"header",accessibilityLiveRegion:"assertive",style:N.emergencyTitle,children:u.emergency.bannerTitle}),jsx(v,{style:N.emergencyLede,children:u.emergency.lede}),h.length>0?jsx(v,{style:N.emergencyLede,testID:"televet-review-emergency-categories",children:h.join(", ")}):null,jsx(At,{petName:n,primaryVet:C,onFindEmergencyVet:q}),jsx(A,{label:u.emergency.keepBookingCta,kind:"secondary",loading:y,disabled:y,onPress:T,testID:"televet-review-emergency-ack"})]}):null,E==="failed"?jsx($,{message:u.confirmFailed}):null,E==="clinician_unavailable"?jsxs(View,{style:D.list,testID:"televet-review-clinician-unavailable",children:[jsx($,{message:u.confirmFailed}),jsx(A,{label:u.seeOtherVetsCta,kind:"secondary",onPress:R,testID:"televet-review-see-other-vets"})]}):null,E==="rate_limited"&&_?jsx($,{message:_,testID:"televet-review-rate-limited"}):null,E==="rate_limited"&&!_?jsx($,{message:u.confirmFailed}):null,E==="not_entitled"?jsx($,{message:u.confirmNotEntitled,testID:"televet-review-not-entitled"}):null]}),h?null:jsx(View,{style:D.scrollFooter,children:jsx(A,{label:u.confirmCta,kind:"primary",loading:y,disabled:!f||y||!!a&&!s||!!d&&!p,onPress:P,testID:"televet-review-confirm"})})]})}o(oo,"ReviewStep");var Fc="\u25CB",Nc="+";function Oe(e,t){return t?e.find(r=>r.petRef===t||r.petId===t)?.name??null:null}o(Oe,"nameOf");function Yi({pets:e,isPending:t,isError:n,onRetry:r,selectedId:i,onSelect:l,onAddPet:a}){let s=V(),c=S(),d=useMemo(()=>He(c),[c]);return t?jsx(View,{style:s.list,testID:"televet-pets-loading",children:[0,1].map(p=>jsx(ee,{height:64},p))}):n?jsx(View,{testID:"televet-pets-error",children:jsx(F,{title:u.chrome.loadFailedTitle,actionLabel:u.chrome.retryCta,onAction:r})}):e.length===0?jsx(View,{testID:"televet-pets-empty",children:jsx(F,{title:u.chrome.noPetsTitle,actionLabel:u.addPetCta,onAction:a})}):jsxs(View,{style:s.stepFill,children:[jsx(v,{tier:"heading",style:s.stepTitle,accessibilityRole:"header",children:u.petSelectTitle}),jsxs(ScrollView,{contentContainerStyle:s.list,testID:"televet-pets",children:[e.map(p=>{let g=i===p.petRef,f=zi(p),y=p.name??"";return jsx($i,{name:y,meta:f,selected:g,onPress:()=>l(p.petRef),testID:`televet-pet-${p.petRef}`},p.petRef)}),a?jsx($i,{name:u.addPetCta,meta:"",selected:false,onPress:a,testID:"televet-pet-add",glyph:Nc}):null]}),jsx(View,{style:d.spacer})]})}o(Yi,"PetStep");function $i({name:e,meta:t,selected:n,onPress:r,testID:i,glyph:l}){let a=S(),s=useMemo(()=>He(a),[a]);return jsxs(View,{style:[s.petRow,n?s.petRowSelected:null],children:[jsx(A,{label:e,onPress:r,kind:"secondary",accessibilityLabel:e,testID:i,style:s.petRowButton}),jsxs(View,{style:s.petRowText,pointerEvents:"none",children:[jsx(View,{style:s.petDisc,children:jsx(v,{tier:"compact",style:s.petDiscGlyph,children:l??Gi(e)})}),t?jsx(v,{tier:"compact",style:s.petRowMeta,children:t}):null]})]})}o($i,"PetRow");function Gi(e){let t=e.trim();return t.length===0?Fc:t.slice(0,1).toUpperCase()}o(Gi,"initialOf");function Ji({clinicians:e,isPending:t,isError:n,selectedId:r,onSelect:i,onRetry:l}){let a=V(),s=S(),c=useMemo(()=>He(s),[s]);if(t)return jsx(View,{style:a.list,testID:"televet-clinicians-loading",children:jsx(ee,{height:96})});if(n)return jsx(View,{testID:"televet-clinicians-error",children:jsx(F,{title:u.chrome.loadFailedTitle,actionLabel:u.chrome.retryCta,onAction:l})});if(e.length===0)return jsx(View,{testID:"televet-clinicians-empty",children:jsx(F,{title:u.noCliniciansTitle,message:u.noCliniciansBody,actionLabel:u.noCliniciansRetryCta,onAction:l})});let d=e.find(p=>p.clinicianId===r)??e[0];return d===void 0?null:jsxs(View,{style:a.list,testID:"televet-clinicians",children:[jsx(v,{tier:"heading",style:a.stepTitle,accessibilityRole:"header",children:u.yourVetTitle}),jsxs(View,{style:c.vetRow,children:[jsx(View,{style:c.vetAvatar,children:jsx(v,{tier:"heading",style:c.vetAvatarText,children:Gi(d.displayName)})}),jsxs(View,{style:c.vetIdentity,children:[jsx(v,{style:c.vetName,children:d.displayName}),d.credentials?jsx(v,{style:c.vetCredentials,children:d.credentials}):null,d.rating!==null&&d.ratingCount!==null?jsx(v,{tier:"compact",style:c.vetRating,testID:"televet-vet-rating",children:`\u2605 ${String(d.rating)} \xB7 ${String(d.ratingCount)} ${u.reviewsLabel}`}):null]})]}),d.bio?jsx(v,{style:c.vetBio,testID:"televet-vet-bio",children:d.bio}):null,jsx(View,{style:a.divider}),jsx(A,{label:u.continueCta,kind:"primary",onPress:()=>i(d.clinicianId),testID:`televet-clinician-${d.clinicianId}`})]})}o(Ji,"ClinicianStep");function Xi({slots:e,enabled:t,isPending:n,isError:r,busySlotId:i,failure:l,nextOpening:a,onPick:s,onRetry:c,onSeeOtherVets:d}){let p=V();return t?n?jsx(View,{style:p.list,testID:"televet-slots-loading",children:[0,1,2].map(g=>jsx(ee,{height:48},g))}):r?jsx(F,{title:u.slotsErrorTitle,actionLabel:u.retryCta,onAction:c,testID:"televet-slots-error"}):e.length===0?jsx(View,{testID:"televet-slots-empty",children:jsx(F,{title:u.noSlotsTitle,message:a?ne(u.nextOpeningTemplate,{when:pe(a.startsAt)}):void 0,actionLabel:a?u.seeOtherVetsCta:void 0,onAction:a?d:void 0})}):jsxs(View,{style:p.stepFill,testID:"televet-slots",children:[l==="expired"?jsx($,{message:u.holdExpired}):null,l==="taken"?jsx($,{message:u.slotTaken}):null,jsx(Ft,{slots:e,busySlotId:i,onPick:s})]}):jsx(View,{testID:"televet-slots-unavailable",children:jsx(F,{title:u.bookingPausedTitle})})}o(Xi,"SlotStep");function Qi({value:e,onChange:t,onNext:n,media:r,onChangeMedia:i,onPickMedia:l,checking:a=false}){let s=V(),c=S(),d=useMemo(()=>He(c),[c]),p=e.trim(),g=p.length>0&&p.length<=_e;return jsxs(View,{style:s.scrollRoot,testID:"televet-booking-reason",children:[jsxs(ScrollView,{style:s.scrollBody,contentContainerStyle:s.list,keyboardShouldPersistTaps:"handled",keyboardDismissMode:"interactive",showsVerticalScrollIndicator:false,testID:"televet-booking-reason-scroll",children:[jsx(v,{tier:"heading",style:s.stepTitle,accessibilityRole:"header",children:u.describeHeading}),jsx(v,{style:s.stepHelp,children:u.describeHelpLong}),jsx(Bl,{value:e,onChangeText:t,multiline:true,placeholder:u.reasonPlaceholder,placeholderTextColor:c.color.text.placeholder,style:d.reasonInput,testID:"televet-reason-input"}),p.length>_e?jsx($,{message:u.reasonTooLong}):null,jsx(Qr,{media:r,onChange:i,...l?{onPickMedia:l}:{}})]}),jsx(View,{style:s.scrollFooter,children:jsx(A,{label:u.continueCta,kind:"primary",disabled:!g,loading:a,onPress:n,testID:"televet-reason-next"})})]})}o(Qi,"ReasonStep");function He(e){let{color:t,space:n,radius:r,type:i}=e,{size:l,lineHeight:a}=i;return StyleSheet.create({marker:{minHeight:1},spacer:{height:n.md},petRow:{gap:n.xs,paddingVertical:n.xs},petRowSelected:{opacity:1},petRowButton:{alignSelf:"stretch",justifyContent:"flex-start"},petRowText:{flexDirection:"row",alignItems:"center",gap:n.sm,paddingHorizontal:n.md},petDisc:{width:28,height:28,borderRadius:14,backgroundColor:t.surfaceSubtle,alignItems:"center",justifyContent:"center"},petDiscGlyph:{...b(e,"medium"),color:t.brand,fontSize:l.caption,lineHeight:l.caption},petRowMeta:{flexShrink:1,...b(e,"regular"),color:t.text.metaCool,fontSize:l.caption,lineHeight:l.caption*a.normal},vetRow:{flexDirection:"row",alignItems:"center",gap:n.md},vetAvatar:{width:64,height:64,borderRadius:32,backgroundColor:t.surfaceSubtle,alignItems:"center",justifyContent:"center"},vetAvatarText:{...b(e,"medium"),color:t.brand,fontSize:l.heading,lineHeight:l.heading},vetIdentity:{flex:1,gap:2},vetName:{...b(e,"medium"),color:t.brand,fontSize:l.subtitle,lineHeight:l.subtitle*a.snug},vetCredentials:{...b(e,"regular"),color:t.text.metaCool,fontSize:l.caption,lineHeight:l.caption*a.normal},vetRating:{...b(e,"regular"),color:t.text.secondary,fontSize:l.caption,lineHeight:l.caption*a.normal},vetBio:{...b(e,"regular"),color:t.brand,fontSize:l.body,lineHeight:l.body*a.normal},reasonInput:{minHeight:120,textAlignVertical:"top",borderWidth:1,borderColor:t.brandBorder,borderRadius:r.md,padding:n.md,...b(e,"regular"),color:t.text.primary,fontSize:l.body,lineHeight:l.body*a.normal},emergencyBanner:{gap:n.md,padding:n.lg,borderRadius:r.lg,borderWidth:1,borderColor:t.errorRed,backgroundColor:t.badgeBgCritical},emergencyTitle:{...b(e,"bold"),color:t.errorRed,fontSize:l.subtitle,lineHeight:l.subtitle*a.snug},emergencyLede:{...b(e,"regular"),color:t.text.primary,fontSize:l.body,lineHeight:l.body*a.normal}})}o(He,"makeLocalStyles");function ao(e){let{petRef:t,usState:n,controller:r,onBooked:i,onExit:l,onAddPet:a,onPickMedia:s,onAddToCalendar:c,onConfirmDiscard:d,onRequestLocation:p,locationStatus:g="unknown",onTriageReason:f,onStateInterest:y,primaryVet:E,onFindEmergencyVet:_,canJoinInApp:P=false,renderUnavailable:h,style:T,testID:R}=nt(e,["onBooked","onExit","onAddPet","onRequestLocation","onFindEmergencyVet"]),O=V(),C=S(),q=useMemo(()=>He(C),[C]),D=ae(r),z=it(),N=z.pets,K=N.length,fe=useMemo(()=>({ownedPetCount:K}),[K]),[Q,oe]=useReducer((G,gt)=>Ir(G,gt,fe),void 0,()=>wr({ownedPetCount:0},{petId:t??null,state:n??null})),I=useCallback(G=>oe(G),[]),[ue,ke]=useState(""),[M,qe]=useState(null),[Wt,Bn]=useState(null),[qt,$t]=useState(null),[mt,Eo]=useState(false),[Dn,ko]=useState(false),[Co,Ea]=useState([]),[Fn,ka]=useState(null),{draft:B}=Q,le=Or(Q),So=useRef(B.state);So.current!==B.state&&(So.current=B.state,mt&&Eo(false),Dn&&ko(false));let Kt=rr(B.state,D),Ro=St(D),vt=or(D),de=lr(B.state,D),tt=Rt(B.clinicianId,D),Ca=ir(D).data??null,Yt=_t(D),_o=ar(D),Ce=Lr(f??null),xo=Vr(B.state,y??null).actionFor("no_licensed_vet"),Nn=n??null;useEffect(()=>{Nn&&!B.state&&I({type:"patch",patch:{state:Nn}});},[Nn,B.state,I]),useEffect(()=>{t&&!B.petId&&I({type:"patch",patch:{petId:t}});},[t,B.petId,I]);let Ln=N.length===1?N[0]?.petRef??null:null;useEffect(()=>{Ln&&!B.petId&&I({type:"patch",patch:{petId:Ln}});},[Ln,B.petId,I]);let wo=useRef(le);wo.current=le;let Po=useRef(0);useEffect(()=>{K!==Po.current&&(Po.current=K,I({type:"goTo",step:wo.current}));},[K,I]);let Vn=de.data?.[0]?.clinicianId??null;useEffect(()=>{Vn&&!B.clinicianId&&I({type:"patch",patch:{clinicianId:Vn}});},[Vn,B.clinicianId,I]);let Sa=useCallback(G=>{qe(null),Yt.mutate(G.slotId,{onSuccess:o(gt=>{I({type:"patch",patch:{slot:G,holdExpiresAt:gt.expiresAt,idempotencyKey:Br(G.slotId)}}),I({type:"next"});},"onSuccess"),onError:o(gt=>qe(Ve(gt).kind==="unavailable"?"unavailable":"taken"),"onError")});},[Yt,I]),{submitBooking:Ra,confirm:_a}=Ei({draft:B,reasonText:ue,book:_o,stateAttested:mt,termsAttested:Dn,cancellationPolicy:Ro.data??null,triage:Ce,goTo:useCallback(G=>I({type:"goTo",step:G}),[I]),setFailure:qe,setRateLimitMessage:Bn,setEmergency:$t,setBookedConsult:ka,...i?{onBooked:i}:{}}),xa=Kt.enabled&&Kt.data!==null&&!Kt.data.wellnessAvailable,Io=vt.enabled&&vt.data?.active===false,wa=vt.enabled&&vt.data!==null,Pa=Mr(wa),Oo=Cn(Co.length),Ia=ue.trim().length>0||!!B.slot||!!B.clinicianId,Oa=D===null||M==="unavailable"||dr(vt)||dr(Kt),Ao={noState:!B.state,isPending:de.enabled&&de.isPending,isError:de.isError,isEmpty:(de.data?.length??0)===0,notEntitled:Io},Aa=Di(Ao),Bo={surfaceUnavailable:Oa,notEntitled:Io,policyBlocked:xa,triageOpen:Ce.open,step:le},Ba=Ai(Bo);return Se()?jsxs(View,{style:[O.screen,T],testID:R??"televet-booking",children:[jsx(Jr,{step:le,furthestIndex:Q.furthestIndex,canGoBack:(Ce.open||Pr(Q,fe))&&le!=="booked",isDirty:Ia,onBack:()=>{if(Ce.open){Ce.close();return}Ce.cancel(),I({type:"back"});},onClose:()=>l?.(),...d?{onConfirmDiscard:d}:{}}),Ba?jsx(Bi,{state:Bo,petName:Oe(N,B.petId),...E?{primaryVet:E}:{},onFindEmergencyVet:_,stateInterest:xo,...y?{onCheckAvailability:o(()=>I({type:"goTo",step:"clinician"}),"onCheckAvailability")}:{},onAcknowledgeEmergency:()=>{Ce.acknowledge(ue),I({type:"next"});},...h?{renderUnavailable:h}:{}}):le==="time"?jsx(Xi,{slots:tt.data??[],enabled:tt.enabled,isPending:tt.enabled&&tt.isPending,isError:tt.isError,busySlotId:Yt.isPending?Yt.variables:null,failure:M,nextOpening:Ca,onPick:Sa,onRetry:()=>tt.refetch(),onSeeOtherVets:()=>I({type:"goTo",step:"clinician"})}):le==="review"?jsx(oo,{when:B.slot?pe(B.slot.startsAt):"",petName:Oe(N,B.petId),reason:ue.trim(),clinician:de.data?.find(G=>G.clinicianId===B.clinicianId)?.displayName??null,shareRecords:B.shareHealthRecords,stateCode:B.state,stateAttested:mt,onToggleStateAttest:Eo,cancellationTerms:Ro.data?.summary??null,termsAttested:Dn,onToggleTermsAttest:ko,onToggleShare:G=>I({type:"patch",patch:{shareHealthRecords:G}}),canConfirm:It(B,ue),busy:_o.isPending,failure:M,rateLimitMessage:Wt,onConfirm:_a,emergency:qt,onAcknowledgeEmergency:()=>Ra(true),onSeeOtherVets:()=>I({type:"goTo",step:"clinician"}),mediaShortfall:Oo,primaryVet:E,onFindEmergencyVet:_}):le==="booked"?jsx(View,{style:O.stepFill,testID:"televet-booking-booked",children:Fn?jsxs(Fragment,{children:[jsx(Yr,{consult:Fn,petName:Oe(N,Fn.petId)??Oe(N,B.petId),onDone:()=>l?.(),canJoinInApp:P,...c?{onAddToCalendar:c}:{}}),jsx(Bt,{shortfall:Oo,testIDPrefix:"televet-booked"})]}):null}):le==="clinician"&&Aa?jsx(Fi,{state:Ao,cause:Pa,locationStatus:g,...p?{onRequestLocation:p}:{},onRetry:()=>de.refetch(),stateInterest:xo}):le==="clinician"?jsx(Ji,{clinicians:de.data??[],isPending:de.enabled&&de.isPending,isError:de.isError,selectedId:B.clinicianId,onRetry:()=>de.refetch(),onSelect:G=>{I({type:"patch",patch:{clinicianId:G}}),I({type:"next"});}}):le==="reason"?jsx(Qi,{value:ue,onChange:ke,media:Co,onChangeMedia:Ea,...s?{onPickMedia:s}:{},checking:Ce.checking,onNext:()=>{Ce.check(ue).then(G=>{G&&I({type:"next"});});}}):le==="pet"?jsx(Yi,{pets:N,isPending:z.loading,isError:z.error!==null,onRetry:()=>{z.refresh();},onAddPet:a,selectedId:B.petId,onSelect:G=>{I({type:"patch",patch:{petId:G}}),I({type:"next"});}}):jsx(View,{style:q.marker,testID:`televet-booking-step-${le}`})]}):jsx(View,{style:[O.screen,T],testID:R??"televet-booking",children:jsx(View,{style:O.stepFill,testID:"televet-booking-copy-unapproved",children:h?h():null})})}o(ao,"EverfurTelevetBooking");var jc=2e4;function On(e=true,t=jc){let[n,r]=useState(()=>Date.now());return useEffect(()=>{if(!e)return;r(Date.now());let i=setInterval(()=>r(Date.now()),t);return ()=>clearInterval(i)},[e,t]),n}o(On,"useNowMs");var x=Object.freeze({pastTitle:"Past visits",upcomingTitle:"Upcoming visits",emptyTitle:"No visits yet",bookCta:"Find a time",bookCardTitle:"Book a video 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",joinCta:"Join call",joinDisabledReason:"You can join closer to the time.",joinOverReason:"This visit has ended.",vetUnassigned:"Your vet",rescheduleCta:"Reschedule",cancelCta:"Cancel visit",cancelConfirmTitle:"Cancel this visit?",cancelConfirmBody:"You can book another one afterwards.",cancelConfirmCta:"Cancel visit",cancelKeepCta:"Keep visit",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 ta(e){switch(e){case "completed":return x.statusCompleted;case "cancelled_owner":case "cancelled_ops":return x.statusCancelled;case "no_show_owner":case "no_show_vet":return x.statusMissed;default:return null}}o(ta,"televetVisitStatusNative");function Mt({onBack:e,testID:t}){let n=ft();return jsx(View,{style:n.navRow,children:jsx(Pressable,{onPress:e,accessibilityRole:"button",accessibilityLabel:Rn,testID:t,style:n.backTap,children:jsx(View,{style:n.chevron,accessibilityElementsHidden:true,importantForAccessibility:"no"})})})}o(Mt,"TelevetVisitBackRow");function ft(){let e=S();return useMemo(()=>Wc(e),[e])}o(ft,"useVisitStyles");function Wc(e){let{color:t,space:n,radius:r,type:i}=e,{size:l,lineHeight:a}=i;return StyleSheet.create({screen:{flex:1,paddingHorizontal:n.xl},body:{gap:n.sm,paddingBottom:n.xl},navRow:{paddingVertical:n.sm,flexDirection:"row"},backTap:{minHeight:X,minWidth:X,justifyContent:"center"},chevron:{width:10,height:10,marginLeft:n.xs,borderLeftWidth:2,borderBottomWidth:2,borderColor:t.brand,transform:[{rotate:"45deg"}]},title:{...b(e,"medium"),color:t.brand,fontSize:l.heading,lineHeight:l.heading*a.snug,marginBottom:n.md},list:{gap:n.sm},row:{gap:n.xs,padding:n.md,borderRadius:r.md,borderWidth:1,borderColor:t.brandBorder,backgroundColor:t.surface},rowHead:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",gap:n.sm},when:{flex:1,...b(e,"medium"),color:t.text.primary,fontSize:l.subtitle,lineHeight:l.subtitle*a.snug},status:{...b(e,"mono"),color:t.text.metaCool,fontSize:l.micro,letterSpacing:1},meta:{...b(e,"mono"),color:t.text.metaCool,fontSize:l.caption,lineHeight:l.caption*a.normal},bookCard:{gap:n.md,padding:n.xl,borderRadius:r.sm,borderWidth:StyleSheet.hairlineWidth,borderColor:t.brand,backgroundColor:t.surface},bookTitle:{...b(e,"medium"),color:t.brand,fontSize:l.subtitle,lineHeight:l.subtitle*a.snug},bookSubtitle:{...b(e,"regular"),color:t.text.metaCool,fontSize:l.body,lineHeight:l.body*a.normal},visitCard:{gap:n.md,padding:n.lg,borderRadius:r.lg,borderWidth:1,borderColor:t.brandBorder},visitWhen:{...b(e,"medium"),color:t.brand,fontSize:l.heading,lineHeight:l.heading*a.snug},visitWho:{...b(e,"regular"),color:t.text.primary,fontSize:l.subtitle,lineHeight:l.subtitle*a.snug},visitMeta:{...b(e,"regular"),color:t.text.metaCool,fontSize:l.caption,lineHeight:l.caption*a.normal},reason:{...b(e,"regular"),color:t.text.metaCool,fontSize:l.caption,lineHeight:l.caption*a.normal},terms:{padding:n.md,borderRadius:r.sm,backgroundColor:t.surfaceSubtle,...b(e,"regular"),color:t.text.metaCool,fontSize:l.caption,lineHeight:l.caption*a.normal},noticeTitle:{...b(e,"bold"),color:t.text.primary,fontSize:l.subtitle,lineHeight:l.subtitle*a.snug},noticeBody:{...b(e,"regular"),color:t.text.metaCool,fontSize:l.body,lineHeight:l.body*a.normal},receipt:{gap:n.xs,padding:n.md,borderRadius:r.sm,backgroundColor:t.surfaceSubtle},stack:{gap:n.xs}})}o(Wc,"makeVisitStyles");function co({consult:e,controller:t,onJoin:n,onReschedule:r,onCancelled:i,onBack:l,revision:a=0,nowMs:s,style:c}){let d=ft(),p=ae(t),[g,f]=useState(0),y=Tl(e.consultId,p,a+g),E=St(p),_=El(e.consultId,p),{pets:P}=it(),[h,T]=useState(false),[R,O]=useState(false),[C,q]=useState(null),D=y.isError&&y.error?.httpStatus===404,z=D?null:y.data??e,N=z!==null&&$e.has(z.status),K=On(!N),Q=pr(z,s??K),oe=z===null?null:Oe(P,z.petId),I=E.data?.summary.trim()||null,ue=useCallback(()=>{I&&(O(false),_.mutate(x.cancelReason,{onSuccess:o($t=>{T(false),q($t),f(mt=>mt+1),i?.($t);},"onSuccess"),onError:o(()=>O(true),"onError")}));},[I,_,i]);if(z===null)return jsxs(View,{style:[d.screen,c],testID:"televet-consult-missing",children:[jsx(Mt,{onBack:l,testID:"televet-consult-back"}),jsx(F,{title:x.notFoundTitle,message:x.notFoundBody})]});let ke=z.status,M=ke==="cancelled_owner"||ke==="cancelled_ops",qe=ke==="scheduled"||ke==="in_progress",Wt=fr(ke)&&C===null,Bn=z.clinicianName??x.vetUnassigned,qt=[oe,z.reasonText].filter(Boolean).join(" \xB7 ");return jsxs(View,{style:[d.screen,c],testID:"televet-consult",children:[jsx(Mt,{onBack:l,testID:"televet-consult-back"}),jsxs(ScrollView,{contentContainerStyle:d.body,children:[jsxs(View,{style:d.visitCard,children:[jsx(v,{style:d.visitWhen,accessibilityRole:"header",testID:"televet-consult-when",children:pe(z.scheduledAt)}),jsxs(View,{style:d.stack,children:[jsx(v,{style:d.visitWho,testID:"televet-consult-vet",children:Bn}),qt?jsx(v,{style:d.visitMeta,numberOfLines:2,children:qt}):null]})]}),qe&&C===null?jsxs(Fragment,{children:[jsx(A,{label:x.joinCta,disabled:!Q.ready,onPress:()=>n(z,oe),testID:"televet-consult-join"}),Q.ready?null:jsx(v,{style:d.reason,testID:"televet-consult-join-reason",children:Q.reason==="consult_over"?x.joinOverReason:x.joinDisabledReason}),Wt&&r?jsx(A,{label:x.rescheduleCta,kind:"secondary",onPress:()=>r(z),testID:"televet-consult-reschedule"}):null]}):null,C?jsx(View,{style:d.receipt,testID:"televet-consult-cancel-receipt",children:jsx(v,{style:d.noticeTitle,accessibilityLiveRegion:"polite",children:C.summary??x.phaseCancelled})}):M?jsxs(View,{style:d.stack,testID:"televet-consult-cancelled",children:[jsx(v,{style:d.noticeTitle,accessibilityRole:"header",children:x.phaseCancelled}),jsx(v,{style:d.noticeBody,children:x.phaseCancelledBody})]}):null,Wt?jsxs(View,{style:d.stack,children:[I?jsx(v,{style:d.terms,accessibilityLiveRegion:"polite",testID:"televet-consult-cancellation-policy",children:I}):E.enabled&&E.isPending?jsx(View,{testID:"televet-consult-cancellation-policy-loading",children:jsx(ee,{height:42})}):jsx(F,{title:x.cancelPolicyErrorTitle,actionLabel:x.retryCta,onAction:()=>E.refetch(),testID:"televet-consult-cancellation-policy-error"}),h?jsxs(View,{style:d.stack,testID:"televet-consult-cancel-confirm",children:[jsx(v,{style:d.noticeTitle,children:x.cancelConfirmTitle}),jsx(v,{style:d.noticeBody,children:x.cancelConfirmBody}),R?jsx($,{message:x.cancelFailedTitle,testID:"televet-consult-cancel-failed"}):null,jsx(A,{label:x.cancelConfirmCta,kind:"danger",loading:_.isPending,onPress:ue,testID:"televet-consult-cancel-yes"}),jsx(A,{label:x.cancelKeepCta,kind:"secondary",disabled:_.isPending,onPress:()=>{T(false),O(false);},testID:"televet-consult-cancel-keep"})]}):jsx(A,{label:x.cancelCta,kind:"secondary",disabled:!I,onPress:()=>{O(false),T(true);},testID:"televet-consult-cancel"})]}):null,y.isError&&!D?jsx(F,{title:x.staleTitle,actionLabel:x.staleRetry,onAction:()=>y.refetch(),testID:"televet-consult-stale"}):null]})]})}o(co,"TelevetConsultScreen");var jt=Object.freeze({muteCta:"Mute",unmuteCta:"Unmute",cameraOffCta:"Camera off",cameraOnCta:"Camera on",leaveCta:"Leave",switchCameraCta:"Switch camera",speakerOffCta:"Speaker off",speakerOnCta:"Speaker on",lobbyTitleNoName:"Your vet is joining",lobbySubtitle:"Usually under a minute",lobbyPrepLabel:"WHILE YOU WAIT",lobbyPrepNoPet:"Have your pet nearby and somewhere well lit.",lobbyTitle:o(e=>{let t=e?.trim()??"";return t.length>0?`${t} is joining`:jt.lobbyTitleNoName},"lobbyTitle"),lobbyPrep:o(e=>{let t=e?.trim()??"";return t.length>0?`Have ${t} nearby and somewhere well lit.`:jt.lobbyPrepNoPet},"lobbyPrep"),lobbyDuration:o(e=>`${e} MINUTE VISIT`,"lobbyDuration"),joinFailedReason:"That did not open. Try again.",recordingNoticeTitle:"This consultation is recorded.",recordingNoticeCta:"Continue to the call",recordingNoticeDecline:"Not now",selfCameraOffLabel:"Your camera is off"});function oa(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."}}o(oa,"televetJoinRefusalNativeCopy");var la="No way to join this visit yet.";function ia(e){return e==="room_not_ready"||e==="unknown"}o(ia,"televetJoinIsRetryable");var aa=Symbol.for("@everfur/sdk/televet");function Yc(){let e=globalThis,t=e[aa];if(t!==void 0)return t;let n={presenter:null,snapshot:Object.freeze({request:null,serial:0,activeHost:null}),hosts:[],nextHost:1,listeners:new Set,dailyRegistered:false};return e[aa]=n,n}o(Yc,"televetGlobal");function sa(){return Yc().dailyRegistered}o(sa,"isEverfurDailyRegistered");function da(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}}o(da,"memoizeTelevetLoader");var ua=Object.freeze({status:"joining"});function uo(e,t){let[n,r]=useState(0),[i,l]=useState(ua),a=useRef(null);useEffect(()=>{let c=t?.joinConsult;if(t===null||c===void 0){l(Object.freeze({status:"refused",refusal:"unavailable",reason:null}));return}let d=`${e}#${String(n)}`,p=a.current;if(p===null||p.key!==d){let f;try{f=c.call(t,e);}catch(y){f=Promise.reject(y);}p={key:d,promise:f},a.current=p;}let g=true;return l(ua),p.promise.then(f=>{g&&(f.ok?l(Object.freeze({status:"ready",credential:f.value})):l(Object.freeze({status:"refused",refusal:Gn(f.error),reason:Yn(f.error)})));},()=>{g&&l(Object.freeze({status:"refused",refusal:"unknown",reason:null}));}),()=>{g=false;}},[e,t,n]);let s=useCallback(()=>r(c=>c+1),[]);return {state:i,retry:s}}o(uo,"useTelevetJoin");var po=createContext(null);function pa(e){let t=useContext(po);useEffect(()=>{if(!(t===null||!e))return t.setFullBleed(true),()=>{t.setFullBleed(false);}},[t,e]);}o(pa,"useTelevetModalFullBleed");var ru=da(()=>import('@everfur/sdk/televet/call'));function yo({consultId:e,controller:t,clinicianName:n,petName:r,onLeave:i,style:l}){let a=V(),s=ae(t),{state:c,retry:d}=uo(e,s),[p,g]=useState(null),[f,y]=useState(false),E=c.status==="ready";useEffect(()=>{if(!E||p!==null)return;let R=true;return ru().then(O=>{R&&g(()=>O);},()=>{R&&y(true);}),()=>{R=false;}},[E,p]);let _=E&&p!==null&&!f,P=o(()=>(_||i(),true),"onBackPress");rt(P);let h=useRef(P);if(h.current=P,useEffect(()=>{let R=BackHandler.addEventListener("hardwareBackPress",()=>h.current());return ()=>{R.remove();}},[]),pa(_),c.status==="refused"||f){let R=c.status==="refused"?c.refusal:"unavailable";return jsxs(View,{style:[a.stepFill,l],testID:"televet-join-refused",children:[jsx($,{message:oa(R),testID:"televet-join-refused-message"}),ia(R)&&c.status==="refused"?jsx(A,{label:u.retryCta,kind:"primary",onPress:d,testID:"televet-join-retry"}):null,jsx(A,{label:jt.leaveCta,kind:"secondary",onPress:i,testID:"televet-join-leave"})]})}if(c.status==="joining"||p===null)return jsx(View,{style:[a.list,l],testID:"televet-join-loading",accessibilityLabel:u.loading.consult,children:jsx(ee,{height:48})});let{EverfurVetCall:T}=p;return jsx(T,{roomUrl:c.credential.roomUrl,token:c.credential.token,onLeave:i,clinicianName:n??null,petName:r??null,renderUnavailable:()=>jsxs(View,{style:[a.stepFill,l],testID:"televet-join-call-unavailable",children:[jsx($,{message:la}),jsx(A,{label:jt.leaveCta,kind:"secondary",onPress:i,testID:"televet-join-unavailable-leave"})]}),style:l})}o(yo,"TelevetJoinScreen");function mo(e){let{consult:t,onRescheduled:n,onCancel:r,controller:i,style:l,testID:a}=nt(e,["onRescheduled","onCancel"]),s=V(),c=ae(i),d=Rt(t?.clinicianId??null,c),p=_t(c),g=sr(t?.consultId??null,c),[f,y]=useState(null),E=useCallback(P=>{y(null),p.mutate(P.slotId,{onSuccess:o(()=>{g.mutate(P.slotId,{onSuccess:o(h=>n?.(h),"onSuccess"),onError:o(h=>y(Ve(h).kind==="unavailable"?"unavailable":"failed"),"onError")});},"onSuccess"),onError:o(h=>y(Ve(h).kind==="unavailable"?"unavailable":"taken"),"onError")});},[p,g,n]),_=p.isPending||g.isPending;return Se()?t?jsxs(View,{style:[s.stepFill,l],testID:a??"televet-reschedule",children:[jsx(v,{tier:"compact",style:s.stepHelp,children:ne(u.rescheduleFromTemplate,{when:pe(t.scheduledAt)})}),f==="taken"?jsx($,{message:u.slotTaken}):null,f==="failed"?jsx($,{message:u.rescheduleFailed}):null,f==="unavailable"?jsx($,{message:u.bookingPausedTitle,testID:"televet-reschedule-unavailable"}):null,d.enabled?d.isPending?jsx(View,{style:s.list,testID:"televet-reschedule-slots-loading",children:[0,1,2].map(P=>jsx(ee,{height:48},P))}):d.isError?jsx(F,{title:u.slotsErrorTitle,actionLabel:u.retryCta,onAction:()=>d.refetch(),testID:"televet-reschedule-slots-error"}):(d.data??[]).length===0?jsx(View,{testID:"televet-reschedule-empty",children:jsx(F,{title:u.noSlotsTitle})}):jsx(Ft,{slots:d.data??[],busySlotId:_?p.variables:null,onPick:E,rowTestIdPrefix:"televet-reschedule-slot",testID:"televet-reschedule-slots"}):jsx(View,{testID:"televet-reschedule-paused",children:jsx(F,{title:u.bookingPausedTitle})}),jsx(A,{label:u.keepExistingCta,kind:"secondary",disabled:_,onPress:()=>r?.(),testID:"televet-reschedule-keep"})]}):jsx(View,{style:[s.list,l],testID:"televet-reschedule-loading",children:[0,1].map(P=>jsx(ee,{height:48},P))}):jsx(View,{style:[s.stepFill,l],testID:"televet-reschedule-copy-unapproved"})}o(mo,"EverfurTelevetReschedule");function vo({controller:e,onOpenVisit:t,onBook:n,onBack:r,revision:i=0,nowMs:l,style:a}){let s=ft(),c=ae(e),d=cn(c,i),{pets:p}=it(),g=d.data??[],f=g.some(C=>!$e.has(C.status)),y=On(f),E=l??y,{upcoming:_,past:P}=useMemo(()=>xt(g,E),[g,E]),h=d.enabled&&d.isPending,T=d.isError&&d.data===null,R=!h&&!T&&g.length>0,O=o(C=>{let q=ta(C.status),D=[C.clinicianName,Oe(p,C.petId)].filter(Boolean).join(" \xB7 ");return jsxs(View,{style:s.row,testID:`televet-visits-row-${C.consultId}`,children:[jsxs(View,{style:s.rowHead,children:[jsx(v,{style:s.when,children:gi(C.scheduledAt)}),q?jsx(v,{style:s.status,testID:`televet-visits-status-${C.consultId}`,children:q}):null]}),D?jsx(v,{style:s.meta,children:D}):null,C.status==="completed"?null:jsx(A,{label:x.manageCta,kind:"secondary",onPress:()=>t(C),testID:`televet-visits-open-${C.consultId}`})]},C.consultId)},"renderRow");return jsxs(View,{style:[s.screen,a],testID:"televet-visits",children:[jsx(Mt,{onBack:r,testID:"televet-visits-back"}),jsxs(ScrollView,{contentContainerStyle:s.body,children:[R?null:jsx(v,{style:s.title,accessibilityRole:"header",children:x.pastTitle}),T?jsxs(View,{style:s.list,children:[jsx(F,{title:x.loadErrorTitle,actionLabel:x.retryCta,onAction:()=>d.refetch(),testID:"televet-visits-error"}),n?jsx(va,{onBook:n}):null]}):h?jsx(View,{style:s.list,testID:"televet-visits-loading",children:[0,1,2].map(C=>jsx(ee,{height:72},C))}):g.length===0?jsxs(View,{style:s.list,testID:"televet-visits-empty",children:[jsx(F,{title:x.emptyTitle}),n?jsx(A,{label:x.bookCta,onPress:n,testID:"televet-visits-book"}):null]}):jsxs(View,{style:s.list,children:[_.length>0?jsxs(Fragment,{children:[jsx(v,{style:s.title,accessibilityRole:"header",children:x.upcomingTitle}),jsx(View,{style:s.list,testID:"televet-visits-upcoming",children:_.map(O)})]}):null,n?jsx(va,{onBook:n}):null,jsx(v,{style:s.title,accessibilityRole:"header",children:x.pastTitle}),P.length>0?jsx(View,{style:s.list,testID:"televet-visits-past",children:P.map(O)}):null]})]})]})}o(vo,"TelevetVisitsScreen");function va({onBook:e}){let t=ft();return jsxs(View,{style:t.bookCard,testID:"televet-visits-book-card",children:[jsx(v,{style:t.bookTitle,children:x.bookCardTitle}),jsx(v,{style:t.bookSubtitle,children:x.bookCardSubtitle}),jsx(A,{label:x.bookCta,kind:"primary",onPress:e,testID:"televet-visits-book"})]})}o(va,"BookCard");var go=Object.freeze({name:"home"}),fu=Object.freeze({name:"visits"}),yu=Object.freeze({name:"booking"});function bo(e){let t=e.visitRef?.trim()??"";return t.length>0?Object.freeze({name:"visit",visitRef:t,intent:e.intent??null}):go}o(bo,"televetScreenForRequest");function mu(e,t){switch(t.type){case "push":return Object.freeze({stack:Object.freeze([...e.stack,t.screen])});case "pop":return e.stack.length<=1?e:Object.freeze({stack:Object.freeze(e.stack.slice(0,-1))});case "land":return e.stack[0]?.name!=="home"?e:Object.freeze({stack:Object.freeze([t.screen,...e.stack.slice(1)])});default:return e}}o(mu,"navReducer");function ha(e){let{style:t,renderPending:n,...r}=nt(e,["onExit","onBooked","onAddPet","onRequestLocation","onFindEmergencyVet"]);return jsx(Vl,{capability:"televet",style:t,...n?{renderPending:n}:{},children:jsx(vu,{...r,style:t})})}o(ha,"EverfurTelevetFlow");function vu({petRef:e,usState:t,controller:n,onBooked:r,onExit:i,onAddPet:l,onPickMedia:a,onAddToCalendar:s,onConfirmDiscard:c,onRequestLocation:d,locationStatus:p,primaryVet:g,onFindEmergencyVet:f,onTriageReason:y,canJoinInApp:E=false,renderUnavailable:_,initialScreen:P,style:h}){let T=V(),[R,O]=useReducer(mu,P??go,M=>Object.freeze({stack:Object.freeze([M])})),C=R.stack[R.stack.length-1]??go,q=R.stack.length,[D,z]=useState(0),N=useCallback(()=>z(M=>M+1),[]),K=useCallback(()=>q<=1||C.name==="call"||C.name==="booking"?false:(O({type:"pop"}),true),[q,C.name]);useEffect(()=>{let M=BackHandler.addEventListener("hardwareBackPress",K);return ()=>{M.remove();}},[K]),rt(K);let fe=useCallback(()=>_?_():jsx(View,{style:T.list,testID:"televet-unavailable",children:Se()?jsx(F,{title:u.bookingPausedTitle}):null}),[_,T.list]),Q=useCallback(()=>{q>1?O({type:"pop"}):i?.();},[q,i]),oe=o(M=>O({type:"push",screen:M}),"push"),I=useCallback(M=>O({type:"land",screen:M==="visits"?fu:yu}),[]),ue=jsx(ao,{...e!==void 0?{petRef:e}:{},...t!==void 0?{usState:t}:{},...n?{controller:n}:{},onBooked:M=>{N(),r?.(M);},onExit:Q,...l?{onAddPet:l}:{},...a?{onPickMedia:a}:{},...s?{onAddToCalendar:s}:{},...c?{onConfirmDiscard:c}:{},...d?{onRequestLocation:d}:{},...p?{locationStatus:p}:{},...g?{primaryVet:g}:{},...f?{onFindEmergencyVet:f}:{},...y?{onTriageReason:y}:{},canJoinInApp:E,renderUnavailable:fe,style:h}),ke=jsx(vo,{...n?{controller:n}:{},revision:D,onOpenVisit:M=>oe({name:"consult",consult:M}),onBook:()=>oe({name:"booking"}),onBack:Q,style:h});switch(C.name){case "home":return jsx(gu,{controller:n,onLand:I,style:h});case "booking":return ue;case "visits":case "visit":return ke;case "consult":return jsx(co,{consult:C.consult,...n?{controller:n}:{},revision:D,onJoin:(M,qe)=>oe({name:"call",consultId:M.consultId,clinicianName:M.clinicianName,petName:qe}),onReschedule:M=>oe({name:"reschedule",consult:M}),onCancelled:N,onBack:Q,style:h});case "reschedule":return jsx(mo,{consult:C.consult,...n?{controller:n}:{},onRescheduled:()=>{N(),O({type:"pop"});},onCancel:()=>O({type:"pop"}),style:h});case "call":return jsx(yo,{consultId:C.consultId,...n?{controller:n}:{},...C.clinicianName!==void 0?{clinicianName:C.clinicianName}:{},...C.petName!==void 0?{petName:C.petName}:{},onLeave:()=>{N(),Q();},style:h});default:return Gt(C)}}o(vu,"TelevetFlowBody");function gu({controller:e,onLand:t,style:n}){let r=V(),i=ae(e),l=kl(i);return useEffect(()=>{l!=="pending"&&t(l);},[l,t]),jsxs(View,{style:[r.screen,r.list,n],testID:"televet-landing-loading",children:[jsx(ee,{height:72}),jsx(ee,{height:72})]})}o(gu,"TelevetLandingScreen");var ho=ha;function Ru({request:e,onClose:t}){let n=S(),r=useSafeAreaInsets(),i=useMemo(()=>No(),[]),l=useCallback(()=>{i.dispatch()||t();},[i,t]),[a,s]=useState(false),c=useMemo(()=>({setFullBleed:s}),[]),d=useMemo(()=>bo(e),[e]);return jsx(Modal,{visible:true,animationType:n.motion.reducedMotion?"none":"slide",presentationStyle:"fullScreen",onRequestClose:l,children:jsx(View,{testID:"everfur-televet-modal",style:[Ta.root,{backgroundColor:n.color.surface},a?null:{paddingTop:r.top,paddingBottom:r.bottom}],children:jsx(Mn.Provider,{value:i,children:jsx(po.Provider,{value:c,children:jsx(ho,{...e.petRef!==void 0?{petRef:e.petRef}:{},...e.usState!==void 0?{usState:e.usState}:{},initialScreen:d,onExit:t,canJoinInApp:sa(),style:Ta.root})})})})})}o(Ru,"EverfurTelevetModal");var Ta=StyleSheet.create({root:{flex:1}});export{Rn as BACK_LABEL,tn as CANCELLATION_POLICY_VERSION_MAX,rn as CANCEL_REASON_MAX,el as CONSULT_KINDS,at as CONSULT_MINUTES,Zo as CONSULT_STATUSES,ho as EverfurTelevet,ao as EverfurTelevetBooking,ha as EverfurTelevetFlow,Ru as EverfurTelevetModal,mo as EverfurTelevetReschedule,nn as MEDIA_REFS_MAX,Ot as NO_MEDIA_SHORTFALL,_e as REASON_TEXT_MAX,Ne as TELEVET_BOOKING_BASE,u as TELEVET_BOOKING_COPY,ze as TELEVET_BOOKING_STEPS,pl as TELEVET_CONSULT_PAGE_LIMIT,ur as TELEVET_JOIN_CLOSES_MINUTES_AFTER,cr as TELEVET_JOIN_OPENS_MINUTES_BEFORE,$e as TERMINAL_CONSULT_STATUSES,Yr as TelevetBookedScreen,Jr as TelevetBookingChrome,Oi as TelevetClinicianEmptyState,Nt as TelevetConsentCheckbox,co as TelevetConsultScreen,Zr as TelevetDayStrip,Ii as TelevetEarlyEmergency,At as TelevetEmergencyExits,qr as TelevetEntitlementInterestState,Qr as TelevetIntakeMedia,yo as TelevetJoinScreen,Bt as TelevetMediaDropNotice,Ft as TelevetSlotPicker,Wr as TelevetStateInterestAction,no as TelevetSummaryCard,et as TelevetSummaryRow,vo as TelevetVisitsScreen,Dr as attestation,It as canConfirm,fr as canManageTelevetVisit,er as createTelevetBookingController,Or as currentStep,yi as emptyTelevetDraft,Vd as formatVisitRange,vi as formatWhen,pe as formatWhenWithDay,Pr as hasPreviousStep,wr as initialTelevetBookingState,Ar as isHoldExpired,jr as isMediaShortfallEmpty,Tn as isSkipped,Se as isTelevetBookingCopyReady,me as isWellFormedStateCode,Cn as mediaShortfallFromUnsentPicks,Kn as parseVetCallCredential,xt as splitTelevetVisits,Br as televetBookingKey,Ir as televetBookingReducer,Ve as televetBookingRefusal,ul as televetCancelCall,Ni as televetConsultCalendarKey,ln as televetConsultCall,wn as televetDaysFromSlots,Mr as televetEmptyRosterCause,zr as televetEmptyRosterView,sl as televetHoldCall,cl as televetJoinCall,$s as televetJoinOpensAtMs,pr as televetJoinReadiness,Hr as televetMediaShortfallLines,dl as televetRescheduleCall,bo as televetScreenForRequest,Lr as useEarlyTriage,Vr as useStateInterest,ar as useTelevetBookConsult,Ws as useTelevetBookingAvailable,ae as useTelevetBookingController,or as useTelevetBookingEntitlement,St as useTelevetCancellationPolicy,lr as useTelevetClinicians,_t as useTelevetHoldSlot,uo as useTelevetJoin,ir as useTelevetNextSlot,sr as useTelevetRescheduleConsult,Rt as useTelevetSlots,rr as useTelevetStatePolicy,fl as validateBookingBody,Yn as vetCallJoinReason,Gn as vetCallJoinRefusal,Wd as withUnsentPicks};