@everfur/sdk 0.8.0 → 0.9.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.
- package/CHANGELOG.md +39 -0
- package/README.md +1 -1
- package/dist/{Chat-s2vcPbw3.d.cts → Chat-Cb3Y8VwS.d.cts} +3 -3
- package/dist/{Chat-Cv9EYMYA.d.ts → Chat-ClhB_8sp.d.ts} +3 -3
- package/dist/{DepthViews-CVxUHOJ-.d.ts → DepthViews-BSkuUGBB.d.ts} +1 -1
- package/dist/{DepthViews-DNRY0Ugm.d.ts → DepthViews-CSCS-tZg.d.ts} +1 -1
- package/dist/{DepthViews-Cz7mSW7p.d.cts → DepthViews-CW1z8pnl.d.cts} +1 -1
- package/dist/{DepthViews-DvNixbxg.d.cts → DepthViews-DDiPxyzg.d.cts} +1 -1
- package/dist/animations/index.cjs +1 -1
- package/dist/animations/index.d.cts +3 -3
- package/dist/animations/index.d.ts +3 -3
- package/dist/animations/index.js +1 -1
- package/dist/{attachments-y3EcOX_w.d.cts → attachments-BD70jZZL.d.cts} +2 -2
- package/dist/{attachments-y_aO4hlk.d.ts → attachments-CC7aHpwZ.d.ts} +5 -5
- package/dist/{attachments-BaslXMdS.d.ts → attachments-DAUy3vPR.d.ts} +2 -2
- package/dist/{attachments-DbFwz4iq.d.cts → attachments-DaOaIBNf.d.cts} +5 -5
- package/dist/{bookingCopy-B3UMITD-.d.ts → bookingCopy-CUW9Gdzc.d.ts} +2 -2
- package/dist/{bookingCopy-4i1R7klo.d.cts → bookingCopy-oEjqkiNA.d.cts} +2 -2
- package/dist/{branding-BYEqU855.d.ts → branding-aGleD_ki.d.ts} +99 -6
- package/dist/{branding-BwEu68C8.d.cts → branding-ctD0B2Th.d.cts} +99 -6
- package/dist/{casesRepository-B6Z0XBIb.d.cts → casesRepository-Bzs7aw4t.d.cts} +1 -1
- package/dist/{casesRepository-SI0zp5YH.d.ts → casesRepository-CywqL6mj.d.ts} +1 -1
- package/dist/chat/index.cjs +20 -18
- package/dist/chat/index.d.cts +9 -9
- package/dist/chat/index.d.ts +9 -9
- package/dist/chat/index.js +20 -18
- package/dist/client/index.cjs +7 -7
- package/dist/client/index.d.cts +10 -10
- package/dist/client/index.d.ts +10 -10
- package/dist/client/index.js +7 -7
- package/dist/{config-Cvo47voG.d.ts → config-BysLVhku.d.ts} +1 -1
- package/dist/{config-v5k6NsK_.d.cts → config-EZzEyS-c.d.cts} +1 -1
- package/dist/consent/index.cjs +1 -1
- package/dist/consent/index.d.cts +5 -5
- package/dist/consent/index.d.ts +5 -5
- package/dist/consent/index.js +1 -1
- package/dist/{context-BZOtJbBO.d.cts → context-DUwYArkM.d.cts} +7 -7
- package/dist/{context-cZ7NZ0sG.d.ts → context-DpfgbnOU.d.ts} +7 -7
- package/dist/{copy-ChJupm1p.d.cts → copy-DK4r9oGz.d.cts} +2 -2
- package/dist/{copy-CZBUHbyS.d.ts → copy-LxZGnFXJ.d.ts} +2 -2
- package/dist/core/index.cjs +2 -2
- package/dist/core/index.d.cts +15 -15
- package/dist/core/index.d.ts +15 -15
- package/dist/core/index.js +2 -2
- package/dist/{depth-CRyU7-pf.d.cts → depth-DAd77kRe.d.cts} +2 -2
- package/dist/{depth-vNpwOkZ8.d.ts → depth-Mk7quUNa.d.ts} +2 -2
- package/dist/{entitlementRepository-CUdxbQrP.d.ts → entitlementRepository-CrD0O7VR.d.ts} +3 -3
- package/dist/{entitlementRepository-Bv8nSYRd.d.cts → entitlementRepository-Dra_4FU_.d.cts} +3 -3
- package/dist/{identity-BHaMJ3KK.d.cts → identity-75whJXyP.d.cts} +1 -1
- package/dist/{identity-B8GkH53J.d.ts → identity-BiyMDMrR.d.ts} +1 -1
- package/dist/index.cjs +24 -22
- package/dist/index.d.cts +16 -16
- package/dist/index.d.ts +16 -16
- package/dist/index.js +24 -22
- package/dist/notifications/index.d.cts +2 -2
- package/dist/notifications/index.d.ts +2 -2
- package/dist/{pets-BI7Ji8hi.d.cts → pets-DoXxTw4x.d.cts} +1 -1
- package/dist/{pets-Dnn-DK1T.d.ts → pets-W2BuLYko.d.ts} +1 -1
- package/dist/{petsRepository-B2lO1sKS.d.ts → petsRepository-ByMzq1Z9.d.ts} +1 -1
- package/dist/{petsRepository-BP9nhM1R.d.cts → petsRepository-yyoo0k2I.d.cts} +1 -1
- package/dist/photo/index.cjs +1 -1
- package/dist/photo/index.js +1 -1
- package/dist/{ports-C40S2V14.d.cts → ports-BeVJYP0_.d.cts} +4 -4
- package/dist/{ports-BUXF0Rp3.d.ts → ports-zYl8S_lI.d.ts} +4 -4
- package/dist/records/depth/index.cjs +6 -6
- package/dist/records/depth/index.d.cts +7 -7
- package/dist/records/depth/index.d.ts +7 -7
- package/dist/records/depth/index.js +6 -6
- package/dist/records/index.cjs +30 -30
- package/dist/records/index.d.cts +9 -9
- package/dist/records/index.d.ts +9 -9
- package/dist/records/index.js +30 -30
- package/dist/{requestFunnel-BrOijMcw.d.ts → requestFunnel-BPeBZdKp.d.ts} +2 -2
- package/dist/{requestFunnel-BxNVGyGm.d.cts → requestFunnel-DHeSzCT6.d.cts} +2 -2
- package/dist/{runtimeTypes-CvI1ZH8j.d.ts → runtimeTypes-Cc207nbn.d.ts} +5 -5
- package/dist/{runtimeTypes-DOO3f-W-.d.cts → runtimeTypes-DgMizQKz.d.cts} +5 -5
- package/dist/server/events/index.cjs +1 -1
- package/dist/server/events/index.d.cts +2 -2
- package/dist/server/events/index.d.ts +2 -2
- package/dist/server/events/index.js +1 -1
- package/dist/server/index.cjs +1 -1
- package/dist/server/index.d.cts +3 -3
- package/dist/server/index.d.ts +3 -3
- package/dist/server/index.js +1 -1
- package/dist/televet/booking/index.cjs +15 -13
- package/dist/televet/booking/index.d.cts +6 -6
- package/dist/televet/booking/index.d.ts +6 -6
- package/dist/televet/booking/index.js +15 -13
- package/dist/televet/call/index.cjs +1 -1
- package/dist/televet/call/index.js +1 -1
- package/dist/televet/index.cjs +1 -1
- package/dist/televet/index.js +1 -1
- package/dist/testing/index.d.cts +1 -1
- package/dist/testing/index.d.ts +1 -1
- package/dist/testing/rn/index.cjs +1 -1
- package/dist/testing/rn/index.d.cts +9 -9
- package/dist/testing/rn/index.d.ts +9 -9
- package/dist/testing/rn/index.js +1 -1
- package/dist/testing/web/index.d.cts +9 -9
- package/dist/testing/web/index.d.ts +9 -9
- package/dist/{timelineRows-CEx2TzYB.d.ts → timelineRows-D22vGN9t.d.ts} +1 -1
- package/dist/{timelineRows-Dffceql_.d.cts → timelineRows-DUQIWSjc.d.cts} +1 -1
- package/dist/{tokens-Tzo1KBND.d.cts → tokens-RAKZj7M8.d.cts} +47 -4
- package/dist/{tokens-Tzo1KBND.d.ts → tokens-RAKZj7M8.d.ts} +47 -4
- package/dist/{typeStyle-C3IG9Sft.d.ts → typeStyle-DVj8iCC1.d.ts} +11 -3
- package/dist/{typeStyle-CZ3Tj60N.d.cts → typeStyle-Nt7w0rhE.d.cts} +11 -3
- package/dist/{useRecordsDepth-DuPUJFDQ.d.ts → useRecordsDepth-C0Qfoghi.d.ts} +1 -1
- package/dist/{useRecordsDepth-D6a6-_u_.d.cts → useRecordsDepth-Mbysp548.d.cts} +1 -1
- package/dist/video/index.cjs +1 -1
- package/dist/video/index.js +1 -1
- package/dist/{view-UFwCG1Pn.d.cts → view-CskIgOFV.d.cts} +2 -2
- package/dist/{view-BSmN5RWf.d.ts → view-DqKXtxEZ.d.ts} +2 -2
- package/dist/web/consent/index.cjs +1 -1
- package/dist/web/consent/index.d.cts +5 -5
- package/dist/web/consent/index.d.ts +5 -5
- package/dist/web/consent/index.js +1 -1
- package/dist/web/index.cjs +29 -28
- package/dist/web/index.d.cts +26 -20
- package/dist/web/index.d.ts +26 -20
- package/dist/web/index.js +29 -28
- package/dist/web/notifications/index.d.cts +3 -3
- package/dist/web/notifications/index.d.ts +3 -3
- package/dist/web/records/depth/index.cjs +9 -8
- package/dist/web/records/depth/index.d.cts +7 -7
- package/dist/web/records/depth/index.d.ts +7 -7
- package/dist/web/records/depth/index.js +9 -8
- package/dist/web/records/index.cjs +51 -49
- package/dist/web/records/index.d.cts +9 -9
- package/dist/web/records/index.d.ts +9 -9
- package/dist/web/records/index.js +52 -50
- package/dist/web/televet/booking/index.cjs +21 -19
- package/dist/web/televet/booking/index.d.cts +11 -11
- package/dist/web/televet/booking/index.d.ts +11 -11
- package/dist/web/televet/booking/index.js +21 -19
- package/dist/web/televet/call/index.cjs +1 -1
- package/dist/web/televet/call/index.js +1 -1
- package/dist/web/televet/index.cjs +1 -1
- package/dist/web/televet/index.js +1 -1
- package/package.json +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import{createContext,useMemo,useState,useRef,useCallback,useEffect,useContext,useSyncExternalStore,createElement,Component}from"react";import{z}from"zod";import{jsx,jsxs}from"react/jsx-runtime";function slotBox(slot,borderWidth){if(slot===void 0)return{};let out={};return slot.backgroundColor!==void 0&&(out.backgroundColor=slot.backgroundColor),slot.borderColor!==void 0&&(out.borderColor=slot.borderColor,out.borderWidth=borderWidth??1),slot.borderRadius!==void 0&&(out.borderRadius=slot.borderRadius),out}function slotText(slot){return slot?.textColor===void 0?{}:{color:slot.textColor}}function slotBoxCss(slot,borderWidth){let box=slotBox(slot,borderWidth),out={};return box.backgroundColor!==void 0&&(out.backgroundColor=box.backgroundColor),box.borderColor!==void 0&&(out.border=`${box.borderWidth??1}px solid ${box.borderColor}`),box.borderRadius!==void 0&&(out.borderRadius=box.borderRadius),out}function reportHostFailure(error){let globalConsole=globalThis.console;try{globalConsole?.error?.("[everfur] A host callback threw; the SDK ignored it.",error)}catch{}}function isThenable(value){return(typeof value=="object"||typeof value=="function")&&value!==null&&typeof value.then=="function"}function callHost(fn,...args){if(typeof fn=="function")try{let result=fn(...args);return isThenable(result)&&Promise.resolve(result).then(void 0,reportHostFailure),result}catch(error){reportHostFailure(error);return}}var GUARDED=/* @__PURE__ */new WeakMap;function guardHost(fn){if(typeof fn!="function")return;let cached=GUARDED.get(fn);if(cached!==void 0)return cached;let guarded=(...args)=>{callHost(fn,...args)};return GUARDED.set(fn,guarded),guarded}function ok(value,warning){/* @__PURE__ */
|
|
2
|
+
import{createContext,useMemo,useState,useRef,useCallback,useEffect,useContext,useSyncExternalStore,createElement,Component}from"react";import{z}from"zod";import{jsx,jsxs}from"react/jsx-runtime";function slotBox(slot,borderWidth){if(slot===void 0)return{};let out={};return slot.backgroundColor!==void 0&&(out.backgroundColor=slot.backgroundColor),slot.borderColor!==void 0&&(out.borderColor=slot.borderColor,out.borderWidth=borderWidth??1),slot.borderRadius!==void 0&&(out.borderRadius=slot.borderRadius),out}function slotText(slot){return slot?.textColor===void 0?{}:{color:slot.textColor}}function slotBoxCss(slot,borderWidth){let box=slotBox(slot,borderWidth),out={};return box.backgroundColor!==void 0&&(out.backgroundColor=box.backgroundColor),box.borderColor!==void 0&&(out.border=`${box.borderWidth??1}px solid ${box.borderColor}`),box.borderRadius!==void 0&&(out.borderRadius=box.borderRadius),out}function recordCardSlot(slots){return slots.recordCard??slots.card}function reportHostFailure(error){let globalConsole=globalThis.console;try{globalConsole?.error?.("[everfur] A host callback threw; the SDK ignored it.",error)}catch{}}function isThenable(value){return(typeof value=="object"||typeof value=="function")&&value!==null&&typeof value.then=="function"}function callHost(fn,...args){if(typeof fn=="function")try{let result=fn(...args);return isThenable(result)&&Promise.resolve(result).then(void 0,reportHostFailure),result}catch(error){reportHostFailure(error);return}}var GUARDED=/* @__PURE__ */new WeakMap;function guardHost(fn){if(typeof fn!="function")return;let cached=GUARDED.get(fn);if(cached!==void 0)return cached;let guarded=(...args)=>{callHost(fn,...args)};return GUARDED.set(fn,guarded),guarded}function ok(value,warning){/* @__PURE__ */
|
|
3
3
|
return Object.freeze({ok:true,value:value})}function err(error){/* @__PURE__ */
|
|
4
4
|
return Object.freeze({ok:false,error:error})}var EverfurConfigError=class _EverfurConfigError extends Error{constructor(kind,message){super(message),this.name="EverfurConfigError",this.kind=kind,Object.setPrototypeOf(this,_EverfurConfigError.prototype)}};var EVERFUR_CONTEXT_SYMBOL=/* @__PURE__ */Symbol.for("@everfur/sdk#EverfurContext@v1"),globalContextHost=globalThis,EverfurContext=globalContextHost[EVERFUR_CONTEXT_SYMBOL]??(globalContextHost[EVERFUR_CONTEXT_SYMBOL]=createContext(null));EverfurContext.displayName??="EverfurContext";function useEverfurContext(){let ctx=useContext(EverfurContext);if(ctx===null)throw new EverfurConfigError("not-initialized","Everfur hooks must be called inside <EverfurProvider>. Wrap your tree once, high.");return ctx}var RECORDS_COPY=/* @__PURE__ */Object.freeze({loading:"Loading",empty:"No records yet",upload:"Upload records",consentRequired:"Consent required",allow:"Allow",sessionRequired:"Sign in required",recordUnavailable:"Record unavailable",retry:"Try again",records:"Records",beingReviewed:"being reviewed"}),RECORDS_FOOTNOTE="Everfur summarizes what your vet recorded. It is informational, not diagnostic.";var NAMELESS_PET="your pet";function petNameOr(petName){let trimmed=petName?.trim()??"";return trimmed.length>0?trimmed:NAMELESS_PET}var DASHBOARD_COPY=/* @__PURE__ */Object.freeze({title:"Health records",titleWeb:petName=>{let name=petName?.trim()??"";return name.length>0?`${name}’s Records`:"Health records"},titleNative:petName=>{let name=petName?.trim()??"";return name.length>0?name:"Health records"},openTimeline:"Open timeline",loading:"Loading health records",lead:petName=>`${petNameOr(petName)}’s lab trends`,retryMarkers:"Retry loading lab trends",viewFullRecord:"View full medical record",viewTimeline:"View full timeline",important:disclaimer=>`Important: ${disclaimer}`});function recordsEmptyVariantForError(error){return error?.httpStatus===429?"rate_limited":error?.httpStatus===502?"service_unavailable":"error"}function formatEntityValue(value,unit){return value===null?"":unit?`${value} ${unit}`:value}var MONTHS=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function formatRecordsDate(at){if(!at)return"-";let iso=/^(\d{4})-(\d{2})-(\d{2})/.exec(at);if(iso!==null){let month=MONTHS[Number(iso[2])-1];return month===void 0?"-":`${month} ${Number(iso[3])}, ${iso[1]}`}let ms=Date.parse(at);if(Number.isNaN(ms))return"-";let date=new Date(ms);return`${MONTHS[date.getUTCMonth()]} ${date.getUTCDate()}, ${date.getUTCFullYear()}`}var DEPTH_COPY=/* @__PURE__ */Object.freeze({timeline:"Timeline",loadingTimeline:"Loading timeline",labResults:"Blood & lab work",visits:"Visits",physicalExams:"Physical exams",visitNotes:"Visit notes",visit:"Visit",exam:"Exam",visitNote:"Visit note",notRecorded:"Not recorded",abnormal:"Abnormal",notExamined:"Not examined",normal:"Normal",measured:date=>`Measured ${date}`,uploadedDocument:"Uploaded document",kind:/* @__PURE__ */Object.freeze({visit:"Visit",vaccine:"Vaccine",weight:"Weight",medication:"Medication"}),clinicVisit:"Clinic visit",doctor:name=>`Dr. ${name}`,lot:lot=>`Lot ${lot}`,expires:date=>`Expires ${date}`});function markerStatusLabel(status){switch(status){case"above":return{label:"Above range",outOfRange:true};case"below":return{label:"Below range",outOfRange:true};case"in_range":return{label:"In range",outOfRange:false};default:return{label:"No range on file",outOfRange:false}}}function trajectoryLabel(trajectory,visitCount){return visitCount<2?null:`${trajectory==="flat"?"Holding steady":`Trending ${trajectory==="down"?"down":trajectory==="up"?"up":"steady"}`} over ${visitCount} visits`}function humanize(key){let spaced=key.replace(/_/g," ").trim();return spaced.length===0?key:spaced.charAt(0).toUpperCase()+spaced.slice(1)}var BODY_SYSTEM_LABEL=/* @__PURE__ */Object.freeze({general:"General / attitude",eent:"Eyes, ears, nose & throat",oral_dental:"Oral & dental",cardiovascular:"Cardiovascular",respiratory:"Respiratory",gastrointestinal:"GI / abdomen",urogenital:"Urogenital",musculoskeletal:"Musculoskeletal",neurologic:"Neurologic",integument:"Skin & coat",lymphatic:"Lymph nodes"});function bodySystemLabel(system){return Object.prototype.hasOwnProperty.call(BODY_SYSTEM_LABEL,system)?BODY_SYSTEM_LABEL[system]:humanize(system)}var SOAP_SECTION_LABEL=/* @__PURE__ */Object.freeze({reason_for_visit:"Reason for visit",subjective:"Subjective",objective:"Objective",assessment:"Assessment",plan:"Plan",discharge_instructions:"Discharge instructions",follow_up:"Follow-up",remarks:"Notes"});function soapSectionLabel(section){return Object.prototype.hasOwnProperty.call(SOAP_SECTION_LABEL,section)?SOAP_SECTION_LABEL[section]:humanize(section)}function formatWeightKg(weightKg){return weightKg===null||!Number.isFinite(weightKg)?"-":`${weightKg.toFixed(3).replace(/\.?0+$/,"")} kg`}function formatMarkerReading(value,unit,qualitative){if((value===null||!Number.isFinite(value))&&qualitative)return qualitative;if(value===null||!Number.isFinite(value))return"-";let num3=value.toFixed(3).replace(/\.?0+$/,"");return unit?`${num3} ${unit}`:num3}function labDetailLine(at,trajectory,pointCount){let traj=trajectoryLabel(trajectory,pointCount);return at?`${DEPTH_COPY.measured(formatRecordsDate(at))}${traj?` · ${traj}`:""}`:traj}var KIND_ORDER=/* @__PURE__ */Object.freeze({visit:0,vaccine:1,weight:2,medication:3});function toMillis(iso){if(!iso)return null;let ms=Date.parse(iso);return Number.isNaN(ms)?null:ms}function buildTimelineRows(timeline){let rows=[...timeline.visits.map((visit,index)=>({key:`visit-${index}-${visit.visitId}`,kind:"visit",kindLabel:DEPTH_COPY.kind.visit,at:visit.visitDate,date:formatRecordsDate(visit.visitDate),title:visit.summary??DEPTH_COPY.clinicVisit,detail:visit.veterinarian?DEPTH_COPY.doctor(visit.veterinarian):null,docId:visit.docId})),...timeline.vaccines.map((vaccine,index)=>{let parts=[];return vaccine.lot&&parts.push(DEPTH_COPY.lot(vaccine.lot)),vaccine.expiresOn&&parts.push(DEPTH_COPY.expires(formatRecordsDate(vaccine.expiresOn))),{key:`vaccine-${index}-${vaccine.vaccineId}`,kind:"vaccine",kindLabel:DEPTH_COPY.kind.vaccine,at:vaccine.administeredOn,date:formatRecordsDate(vaccine.administeredOn),title:vaccine.product||DEPTH_COPY.kind.vaccine,detail:parts.length?parts.join(" · "):null,docId:vaccine.docId}}),...timeline.weights.map((weight,index)=>({key:`weight-${index}-${weight.weightId}`,kind:"weight",kindLabel:DEPTH_COPY.kind.weight,at:weight.observedOn,date:formatRecordsDate(weight.observedOn),title:formatWeightKg(weight.weightKg),detail:null,docId:weight.docId})),...timeline.medications.map((medication,index)=>{let parts=[medication.dose,medication.route,medication.frequency].filter(p=>!!p);return{key:`medication-${index}-${medication.medicationId}`,kind:"medication",kindLabel:DEPTH_COPY.kind.medication,at:medication.startedOn,date:formatRecordsDate(medication.startedOn),title:medication.drugName||DEPTH_COPY.kind.medication,detail:parts.length?parts.join(" · "):null,docId:medication.docId}})];/* @__PURE__ */
|
|
5
5
|
return Object.freeze(rows.sort((a,b)=>{let am=toMillis(a.at),bm=toMillis(b.at);return am===null&&bm===null?KIND_ORDER[a.kind]-KIND_ORDER[b.kind]:am===null?1:bm===null?-1:bm!==am?bm-am:KIND_ORDER[a.kind]-KIND_ORDER[b.kind]}))}var CONTRACT_RETRYABILITY=/* @__PURE__ */Object.freeze([
|
|
@@ -104,15 +104,16 @@ return Object.freeze({petRef:pet,available:false,withheld:withheld,labResults:/*
|
|
|
104
104
|
return Object.freeze({petRef:pet,available:true,withheld:false,labResults:/* @__PURE__ */Object.freeze((d.lab_results??[]).map(m=>/* @__PURE__ */Object.freeze({markerId:m.marker_id,name:m.name,loincCode:m.loinc_code??null,unit:m.unit??null,panel:m.panel??null,meaning:m.meaning??null,latest:/* @__PURE__ */Object.freeze({at:m.latest?.at??null,value:m.latest?.value??null,unit:m.latest?.unit??null,qualitativeResult:m.latest?.qualitative_result??null,status:m.latest?.status??null}),trajectory:m.trajectory??null,points:/* @__PURE__ */Object.freeze((m.points??[]).map(point))}))),encounters:/* @__PURE__ */Object.freeze((d.encounters??[]).map(e=>/* @__PURE__ */Object.freeze({encounterId:e.encounter_id,date:e.date??null,type:e.type??null,clinicName:e.clinic_name??null,veterinarian:e.veterinarian??null,docId:e.doc_id??null}))),clinicianNotes:/* @__PURE__ */Object.freeze((d.clinician_notes??[]).map(n=>/* @__PURE__ */Object.freeze({noteId:n.note_id,encounterId:n.encounter_id??null,observedOn:n.observed_on??null,sections:/* @__PURE__ */Object.freeze((n.sections??[]).map(s=>/* @__PURE__ */Object.freeze({section:s.section,text:s.text})))}))),physicalExams:/* @__PURE__ */Object.freeze((d.physical_exams??[]).map(x=>/* @__PURE__ */Object.freeze({examId:x.exam_id,encounterId:x.encounter_id??null,observedOn:x.observed_on??null,docId:x.doc_id??null,systems:/* @__PURE__ */Object.freeze(Object.entries(x.systems??{}).map(([system,field])=>/* @__PURE__ */Object.freeze({system:system,findingStatus:field.finding_status??null,finding:field.finding??null})))}))),completeness:d.completeness?/* @__PURE__ */Object.freeze({hasLabHistory:d.completeness.has_lab_history===true,hasVaccinationHistory:d.completeness.has_vaccination_history===true,hasWeightHistory:d.completeness.has_weight_history===true,hasVitalsHistory:d.completeness.has_vitals_history===true,hasPhysicalExamHistory:d.completeness.has_physical_exam_history===true,hasProcedureHistory:d.completeness.has_procedure_history===true,hasGeneticHistory:d.completeness.has_genetic_history===true,hasReproductiveHistory:d.completeness.has_reproductive_history===true,hasParasitePreventionHistory:d.completeness.has_parasite_prevention_history===true,earliestRecordAt:d.completeness.earliest_record_at??null,latestRecordAt:d.completeness.latest_record_at??null,documentsIngested:d.completeness.documents_ingested??0,documentsInReview:d.completeness.documents_in_review??0,entitiesPendingReview:/* @__PURE__ */Object.freeze({...d.completeness.entities_pending_review??{}}),heldTotal:d.completeness.held_total??0}):null,conflicts:/* @__PURE__ */Object.freeze((d.conflicts??[]).map(c=>/* @__PURE__ */Object.freeze({conflictId:c.conflict_id,entityType:c.entity_type,field:c.field??null,severity:c.severity??"needs_review",candidates:/* @__PURE__ */Object.freeze((c.candidates??[]).map(k=>/* @__PURE__ */Object.freeze({value:k.value,docId:k.source_doc_id??k.doc_id??null,collectedAt:k.collected_at??null})))})))})}function withheldTimeline(pet){/* @__PURE__ */
|
|
105
105
|
return Object.freeze({petRef:pet,withheld:true,isEmpty:false,visits:/* @__PURE__ */Object.freeze([]),vaccines:/* @__PURE__ */Object.freeze([]),weights:/* @__PURE__ */Object.freeze([]),medications:/* @__PURE__ */Object.freeze([]),disclaimer:""})}function mapRecordsTimeline(petRef,wire){let w=isObject2(wire)?wire:{},pet=petOf(w,petRef);if(w.withheld===true)return withheldTimeline(pet);let parsed=timelineSchema.safeParse(w);if(!parsed.success)return withheldTimeline(pet);let t=parsed.data,visits=t.visits.map(v=>/* @__PURE__ */Object.freeze({visitId:v.visit_id,visitDate:v.visit_date??null,veterinarian:v.veterinarian??null,summary:v.summary??null,docId:v.doc_id??null})),vaccines=t.vaccines.map(v=>/* @__PURE__ */Object.freeze({vaccineId:v.vaccine_id,product:v.product??null,lot:v.lot??null,administeredOn:v.administered_on??null,expiresOn:v.expires_on??null,docId:v.doc_id??null})),weights=t.weights.map(v=>/* @__PURE__ */Object.freeze({weightId:v.weight_id,observedOn:v.observed_on??null,weightKg:v.weight_kg??null,docId:v.doc_id??null})),medications=t.medications.map(m=>/* @__PURE__ */Object.freeze({medicationId:m.medication_id,drugName:m.drug_name??null,dose:m.dose??null,route:m.route??null,frequency:m.frequency??null,sig:m.sig??null,rxNumber:m.rx_number??null,startedOn:m.started_on??null,stoppedOn:m.stopped_on??null,docId:m.doc_id??null}));/* @__PURE__ */
|
|
106
106
|
return Object.freeze({petRef:pet,withheld:false,isEmpty:visits.length===0&&vaccines.length===0&&weights.length===0&&medications.length===0,visits:/* @__PURE__ */Object.freeze(visits),vaccines:/* @__PURE__ */Object.freeze(vaccines),weights:/* @__PURE__ */Object.freeze(weights),medications:/* @__PURE__ */Object.freeze(medications),disclaimer:t.disclaimer??""})}function mapDocumentContributions(petRef,wire){let w=isObject2(wire)?wire:{},pet=petOf(w,petRef),withheld=()=>/* @__PURE__ */Object.freeze({petRef:pet,withheld:true,document:null,contributions:/* @__PURE__ */Object.freeze([]),contributionCount:0});if(w.withheld===true)return withheld();let parsed=contributionsSchema.safeParse(w);if(!parsed.success)return withheld();let contributions=/* @__PURE__ */Object.freeze(parsed.data.contributions.map(mapEntityRow));/* @__PURE__ */
|
|
107
|
-
return Object.freeze({petRef:pet,withheld:false,document:mapDocumentRow(parsed.data.document),contributions:contributions,contributionCount:parsed.data.contribution_count??contributions.length})}var BASE="/widget/v1/records/pets";function createRecordsDepthClient(deps){let funnel=deps.funnel??createRequestFunnel({auth:deps.auth,...deps.errorPolicy?{errorPolicy:deps.errorPolicy}:{}}),segment=(value,max)=>typeof value=="string"&&value.length>0&&!hasLoneSurrogate(value)&&[...value].length<=max,read=async(call,petRef,path,map)=>{if(!segment(petRef,PET_REF_MAX))return invalid();let result=await funnel.send(call,{method:"GET",path:path});if(!result.ok)return result;let view=map(result.value);return view.petRef===petRef?ok(view):err(makeEverfurError("internalError",{retryable:false}))},pet=petRef=>`${BASE}/${encodeURIComponent(petRef)}`,record=petRef=>`${pet(petRef)}/everfur_record`,parsed=async(call,req,map)=>{let result=await funnel.send(call,req,req.method==="POST"?{idempotent:false,maxAttempts:1}:void 0);if(!result.ok)return result;let value=map(result.value);return value===null?err(makeEverfurError("internalError",{retryable:false})):ok(value)},factBody=(input,corrected)=>!segment(input.entityType,FACT_ENTITY_TYPE_MAX)||!segment(input.canonicalKey,FACT_CANONICAL_KEY_MAX)||input.idempotencyKey!==void 0&&!segment(input.idempotencyKey,IDEMPOTENCY_KEY_MAX)||corrected!==void 0&&Object.keys(corrected).length===0?null:{entity_type:input.entityType,canonical_key:input.canonicalKey,...corrected!==void 0?{corrected_fields:corrected}:{},...input.idempotencyKey!==void 0?{idempotency_key:input.idempotencyKey}:{}};return{getRecordDepth:petRef=>read("records.depth.record",petRef,`${pet(petRef)}/record`,wire=>mapRecordDepth(petRef,wire)),getTimeline:petRef=>read("records.depth.timeline",petRef,`${pet(petRef)}/timeline`,wire=>mapRecordsTimeline(petRef,wire)),getDocumentContributions(petRef,docId){return segment(docId,64)?read("records.depth.contributions",petRef,`${pet(petRef)}/documents/${encodeURIComponent(docId)}/contributions`,wire=>mapDocumentContributions(petRef,wire)):invalid()},getMarkers:petRef=>read("records.depth.markers",petRef,`${pet(petRef)}/markers`,wire=>mapRecordMarkers(petRef,wire)),createShare(petRef,opts){if(!segment(petRef,PET_REF_MAX))return invalid();let audience=opts?.audience;return audience!==void 0&&!RECORD_SHARE_AUDIENCES.includes(audience)?invalid():parsed("records.share.create",{method:"POST",path:`${record(petRef)}/share`,...audience!==void 0?{body:{audience:audience}}:{}},wire=>mapRecordShareLink(wire,deps.apiBaseUrl))},emailShare(petRef,input){let kind=input.recipientKind,email=typeof input.recipientEmail=="string"?input.recipientEmail.trim():"",kindOk=kind==="other"||RECORD_SHARE_AUDIENCES.includes(kind);return!segment(petRef,PET_REF_MAX)||!kindOk||!isShareRecipientEmail(email)||hasLoneSurrogate(email)?invalid():parsed("records.share.email",{method:"POST",path:`${record(petRef)}/share/email`,body:{recipient_email:email,recipient_kind:kind}},mapRecordShareEmailReceipt)},async readFeatures(){try{let result=await funnel.send("records.getFeatures",{method:"GET",path:"/widget/v1/records/features"});return result.ok?mapRecordsFeatures(result.value):RECORDS_FEATURES_PDF_ONLY}catch{return RECORDS_FEATURES_PDF_ONLY}},listShares(petRef){return segment(petRef,PET_REF_MAX)?parsed("records.share.list",{method:"GET",path:`${record(petRef)}/shares`},mapRecordShareList):invalid()},async revokeShare(petRef,shareId){if(!segment(petRef,PET_REF_MAX)||!segment(shareId,64))return invalid();let result=await funnel.send("records.share.revoke",{method:"DELETE",path:`${record(petRef)}/shares/${encodeURIComponent(shareId)}`},{idempotent:false,maxAttempts:1});return result.ok?ok(void 0):result},getPdfLink(petRef){return segment(petRef,PET_REF_MAX)?parsed("records.pdf.link",{method:"GET",path:`${record(petRef)}/pdf-link`},mapRecordPdfLink):invalid()},async editFact(petRef,input){let body=segment(petRef,PET_REF_MAX)?factBody(input,input.correctedFields):null;if(body===null)return invalid();let result=await funnel.send("records.fact.edit",{method:"POST",path:`${record(petRef)}/facts/edit`,body:body},{idempotent:false,maxAttempts:1});return result.ok?ok(void 0):result},async removeFact(petRef,input){let body=segment(petRef,PET_REF_MAX)?factBody(input):null;if(body===null)return invalid();let result=await funnel.send("records.fact.remove",{method:"POST",path:`${record(petRef)}/facts/remove`,body:body},{idempotent:false,maxAttempts:1});return result.ok?ok(void 0):result},listRequestDocuments(requestId){return segment(requestId,64)?parsed("records.request.documents",{method:"GET",path:`/widget/v1/records/requests/${encodeURIComponent(requestId)}/documents`},mapRequestDocuments):invalid()},listAuthorizationSignatures:()=>parsed("records.signatures.list",{method:"GET",path:"/widget/v1/records/authorization-signatures"},mapSignatureSuggestions)}}function invalid(){return Promise.resolve(err(makeEverfurError("validationFailed",{retryable:false})))}var epochs=/* @__PURE__ */new Map,listeners=/* @__PURE__ */new Set;function recordsConsentEpochOf(petRef){return epochs.get(petRef)??0}function subscribe(onStoreChange){return listeners.add(onStoreChange),()=>{listeners.delete(onStoreChange)}}function useRecordsConsentEpoch(petRef){let snapshot=useCallback(()=>recordsConsentEpochOf(petRef),[petRef]);return useSyncExternalStore(subscribe,snapshot,snapshot)}function useEverfurRecordsDepthClient(){let{runtime:runtime,userRef:userRef,scopeEpoch:scopeEpoch}=useEverfurContext();return useMemo(()=>{let{services:services}=runtime.registry;return createRecordsDepthClient({auth:services.authFor(userRef),...services.errorPolicy?{errorPolicy:services.errorPolicy}:{},...typeof services.apiBaseUrl=="string"?{apiBaseUrl:services.apiBaseUrl}:{}})},[runtime,userRef,scopeEpoch])}function useRecordsDepthRead(petRef,read,isEmpty,extraKey=""){let client=useEverfurRecordsDepthClient(),{userRef:userRef}=useEverfurContext(),consentEpoch=useRecordsConsentEpoch(petRef),scope=useMemo(()=>({}),[client,petRef,extraKey,consentEpoch]),[state,setState]=useState({scope:scope,value:null,error:null,loading:true}),generation=useRef(0),load=useCallback(async()=>{let gen=generation.current+=1;if(setState({scope:scope,value:null,error:null,loading:true}),userRef===null){setState({scope:scope,value:null,error:null,loading:false});return}let result=await read(client,petRef);gen===generation.current&&(result.ok?setState({scope:scope,value:result.value,error:null,loading:false}):setState({scope:scope,value:null,error:result.error,loading:false}))},[client,petRef,read,scope,userRef]);useEffect(()=>(load(),()=>{generation.current+=1}),[load]);let current=state.scope===scope?state:{value:null,error:null,loading:true},refresh=useCallback(()=>{load()},[load]),available=current.error===null||current.error.httpStatus!==404,error=available?current.error:null,status=current.loading?"loading":error!==null?"error":current.value===null?"empty":current.value.withheld?"populated":isEmpty(current.value)?"empty":"populated";return useMemo(()=>({status:status,value:current.value,error:error,available:available,refresh:refresh}),[status,current.value,error,available,refresh])}var HostRenderBoundary=class extends Component{constructor(){super(...arguments);this.state={failed:false,key:this.props.resetKey}}static getDerivedStateFromError(){return{failed:true}}static getDerivedStateFromProps(props,state){return Object.is(props.resetKey,state.key)?null:{failed:false,key:props.resetKey}}render(){return this.state.failed?this.props.fallback:this.props.children}};function RenderHost({render:render}){return render()}function HostRender({render:render,fallback:fallback,resetKey:resetKey}){return createElement(HostRenderBoundary,{fallback:fallback,resetKey:resetKey,children:createElement(RenderHost,{render:render})})}var freezeInPlace=Object.freeze;function deepFreeze(value){if(value!==null&&typeof value=="object"&&!Object.isFrozen(value)){freezeInPlace(value);for(let key of Object.keys(value))deepFreeze(value[key])}return value}var TEXT_SCALE_TIER_CAPS=/* @__PURE__ */Object.freeze({content:0,heading:2,control:1.8,compact:1.5,badge:1.3}),SPACE={xs:4,sm:8,md:12,lg:16,xl:24,xxl:32},RADIUS={tile:5,xs:6,sm:10,md:14,lg:20,xl:28,pill:500},TYPE_SIZE={nano:8,small:9,micro:10,tiny:11,caption:13,bodyTight:15,body:17,subtitle:20,heading:22,verdict:24},LINE_HEIGHT={tight:1.15,snug:1.3,normal:1.4,relaxed:1.55},WEIGHT={regular:"400",medium:"500",bold:"700"},LETTER_SPACING={eyebrow:1,monoWide:.9,headerBrand:-.42,tight:-.35},DEFAULT_MAX_FONT_SCALE=0,SYSTEM_FONT_FAMILY="System",SYSTEM_MONO_FAMILY="monospace",TIERS=["content","heading","control","compact","badge"];function authoredTierSizes(size){let out={};for(let tier of TIERS)out[tier]=size;return out}function baseType(){return{family:SYSTEM_FONT_FAMILY,mono:SYSTEM_MONO_FAMILY,fontUrl:null,families:{regular:SYSTEM_FONT_FAMILY,medium:SYSTEM_FONT_FAMILY,bold:SYSTEM_FONT_FAMILY,mono:SYSTEM_MONO_FAMILY,monoMedium:SYSTEM_MONO_FAMILY,monoBold:SYSTEM_MONO_FAMILY},namedFaces:{regular:false,medium:false,bold:false,mono:false,monoMedium:false,monoBold:false},fontUrls:{},size:TYPE_SIZE,tierSizes:authoredTierSizes(TYPE_SIZE),lineHeight:LINE_HEIGHT,weight:WEIGHT,letterSpacing:LETTER_SPACING,scale:1,maxScale:DEFAULT_MAX_FONT_SCALE,scaleCaps:TEXT_SCALE_TIER_CAPS}}var NO_SLOTS={},EASING_CURVES=/* @__PURE__ */Object.freeze({standard:/* @__PURE__ */Object.freeze([.2,0,0,1]),emphasized:/* @__PURE__ */Object.freeze([.2,.8,.2,1]),exit:/* @__PURE__ */Object.freeze([.4,0,1,1])});function cssCubicBezier(curve){return`cubic-bezier(${curve.join(", ")})`}var MOTION={duration:{instant:80,fast:140,normal:220,slow:320},spring:{gentle:{damping:18,stiffness:200}},easing:{standard:cssCubicBezier(EASING_CURVES.standard),emphasized:cssCubicBezier(EASING_CURVES.emphasized),exit:cssCubicBezier(EASING_CURVES.exit)},reducedMotion:false},LIGHT_COLOR={brand:"#10462E",brandSoft:"rgba(16,70,46,0.10)",brandSofter:"rgba(16,70,46,0.15)",brandBorder:"rgba(16,70,46,0.18)",borderHairlineGreen:"rgba(16,70,46,0.25)",brandBorderStrong:"rgba(16,70,46,0.55)",brandInk:"#10462E",linkInk:"#10462E",surface:"#FFFFFF",surfaceCream:"#FFFFFF",surfaceSubtle:"#F1F5F2",background:"#FFFFFF",borderRingCream:"#E4E4E4",chatGround:"#FFFFFF",composerFill:"#FFFFFF",composerBorder:"rgba(16,70,46,0.75)",shadow:"#0B3421",text:{primary:"#000000",secondary:"#0E462E",muted:"#6B6B6B",placeholder:"rgba(61,61,61,0.75)",onBrand:"#FFFFFF",metaCool:"#3D3D3D",timestamp:"rgba(61,61,61,0.75)"},primary:"#10462E",onPrimary:"#FFFFFF",accent:"#10462E",onAccent:"#FFFFFF",accentEdge:"#07C168",success:"#07C168",danger:"#C03410",onDanger:"#FFFFFF",errorRed:"#C03410",warningStrong:"#A45610",cautionAccent:"#D9821D",riskConcern:"#EFA700",sentiment:{up:"#07C168",neutral:"#FBC558",down:"#FF1B00"},badgeBgPositive:"rgba(7,193,104,0.12)",badgeBgCaution:"rgba(217,130,29,0.14)",badgeBgCritical:"rgba(192,52,16,0.06)",badgeBgNeutral:"rgba(107,107,107,0.12)",bubbleUser:"#10462E",bubbleAssistant:"#FFFFFF",bubbleVet:"#FFC3BC",onBubbleVet:"#000000",skeleton:"#E9F1E9",scanButtonPink:"#FFC3BC",highlight:"#FFC3BC",onHighlight:"#000000",mark:"#07C168",controlEdge:"rgba(16,70,46,0.18)",structureEdge:"rgba(16,70,46,0.25)",primaryEdge:"#10462E",checkupCardLowRiskBg:"rgba(7,193,104,0.10)",checkupCardConcernBg:"rgba(239,167,0,0.10)"},EVERFUR_LIGHT=deepFreeze({brightness:"light",highContrast:false,meta:{displayName:"Everfur",logoUrl:null,placeholder:null,hidePoweredBy:false},color:LIGHT_COLOR,space:SPACE,radius:RADIUS,type:baseType(),motion:MOTION,slots:NO_SLOTS}),DARK_COLOR={brand:"#6BD39A",brandSoft:"rgba(107,211,154,0.12)",brandSofter:"rgba(107,211,154,0.18)",brandBorder:"rgba(107,211,154,0.22)",borderHairlineGreen:"rgba(107,211,154,0.28)",brandBorderStrong:"rgba(107,211,154,0.55)",brandInk:"#6BD39A",linkInk:"#6BD39A",surface:"#1C1F23",surfaceCream:"#23272C",surfaceSubtle:"#23272C",background:"#15171A",borderRingCream:"#3A3F45",chatGround:"#1C1F23",composerFill:"#23272C",composerBorder:"rgba(107,211,154,0.75)",shadow:"#000000",text:{primary:"#F5F3F0",secondary:"#A9E4C4",muted:"#9A9A9A",placeholder:"rgba(255,255,255,0.55)",onBrand:"#0E1F17",metaCool:"#C9C9C9",timestamp:"rgba(245,243,240,0.7)"},primary:"#6BD39A",onPrimary:"#0E1F17",accent:"#6BD39A",onAccent:"#0E1F17",accentEdge:"#34D888",success:"#07C168",danger:"#F87171",onDanger:"#0E1F17",errorRed:"#FF6B5B",warningStrong:"#F0A35E",cautionAccent:"#D9821D",riskConcern:"#EFA700",sentiment:{up:"#07C168",neutral:"#FBC558",down:"#FF1B00"},badgeBgPositive:"rgba(7,193,104,0.18)",badgeBgCaution:"rgba(217,130,29,0.20)",badgeBgCritical:"rgba(185,28,28,0.22)",badgeBgNeutral:"rgba(255,255,255,0.10)",bubbleUser:"#6BD39A",bubbleAssistant:"#1C1F23",bubbleVet:"#FFC3BC",onBubbleVet:"#000000",skeleton:"#23272C",scanButtonPink:"#FFC3BC",highlight:"#605051",onHighlight:"#F5F3F0",mark:"#07C168",controlEdge:"rgba(107,211,154,0.22)",structureEdge:"rgba(107,211,154,0.28)",primaryEdge:"#6BD39A",checkupCardLowRiskBg:"rgba(7,193,104,0.16)",checkupCardConcernBg:"rgba(239,167,0,0.16)"};deepFreeze({brightness:"dark",highContrast:false,meta:{displayName:"Everfur",logoUrl:null,placeholder:null,hidePoweredBy:false},color:DARK_COLOR,space:SPACE,radius:RADIUS,type:baseType(),motion:MOTION,slots:NO_SLOTS});var EVERFUR_THEME_CONTEXT_SYMBOL=/* @__PURE__ */Symbol.for("@everfur/sdk#EverfurThemeContext@v1"),globalThemeHost=globalThis,EverfurThemeContext=globalThemeHost[EVERFUR_THEME_CONTEXT_SYMBOL]??(globalThemeHost[EVERFUR_THEME_CONTEXT_SYMBOL]=createContext(EVERFUR_LIGHT));EverfurThemeContext.displayName??="EverfurThemeContext";function useEverfurTheme(){return useContext(EverfurThemeContext)}var FACE_WEIGHT=/* @__PURE__ */Object.freeze({regular:"regular",medium:"medium",bold:"bold",mono:"regular",monoMedium:"medium",monoBold:"bold"});var SYSTEM_UI_STACK='system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif',RN_SYSTEM_FAMILY="System";function cssFontFamily(family){let named=family.trim();return named.length===0||named===RN_SYSTEM_FAMILY?SYSTEM_UI_STACK:`${quote(named)}, ${SYSTEM_UI_STACK}`}function cssMonoFamily(mono){let named=mono.trim();return named.length===0||named==="monospace"?"ui-monospace, Menlo, Consolas, monospace":`${quote(named)}, ui-monospace, Menlo, Consolas, monospace`}function quote(family){return`"${family.replace(/[\\"]/g,"\\$&")}"`}function faceCss(theme,weight){let type=theme.type,family=type.families[weight];return{fontFamily:weight==="mono"||weight==="monoMedium"||weight==="monoBold"?cssMonoFamily(family):cssFontFamily(family),fontWeight:type.namedFaces[weight]?type.weight.regular:type.weight[FACE_WEIGHT[weight]]}}var SURFACE_ROOT_RESET=/* @__PURE__ */Object.freeze({textAlign:"start"});var REQUIRES=/* @__PURE__ */Object.freeze({chat:/* @__PURE__ */Object.freeze(["chat.message.create"]),records:/* @__PURE__ */Object.freeze(["records.upload.create","records.record.read"]),recordsClinic:/* @__PURE__ */Object.freeze(["records.clinic.create"]),video:/* @__PURE__ */Object.freeze(["video.gait.execute"]),photo:/* @__PURE__ */Object.freeze(["photo.checkup.execute"]),animations:/* @__PURE__ */Object.freeze(["animations.state.read"]),televet:/* @__PURE__ */Object.freeze(["televet.visit.create"])});function requires(name){return REQUIRES[name]}function decideCapability(name,decisions,opts){let keys=requires(name),byResource=/* @__PURE__ */new Map;for(let decision of decisions)byResource.set(decision.resource,decision);if(opts?.isPending===true&&keys.some(key=>!byResource.has(key)))return freezeDecision({name:name,enabled:false,isPending:true,limits:{}});let limits=mergeLimits(keys,byResource);return keys.filter(key=>byResource.get(key)?.granted!==true).length===0?freezeDecision({name:name,enabled:true,isPending:false,limits:limits}):freezeDecision({name:name,enabled:false,isPending:false,limits:limits,disabled:disabledFor(keys,byResource)})}function mergeLimits(keys,byResource){let out={};for(let key of keys){let decisionLimits=byResource.get(key)?.limits;if(decisionLimits)for(let[limitKey,limitValue]of Object.entries(decisionLimits)){let existing=out[limitKey];out[limitKey]=existing===void 0?limitValue:Math.min(existing,limitValue)}}return out}function disabledFor(keys,byResource){for(let key of keys){let explicit=byResource.get(key)?.disabled;if(explicit)/* @__PURE__ */
|
|
107
|
+
return Object.freeze({petRef:pet,withheld:false,document:mapDocumentRow(parsed.data.document),contributions:contributions,contributionCount:parsed.data.contribution_count??contributions.length})}var BASE="/widget/v1/records/pets";function createRecordsDepthClient(deps){let funnel=deps.funnel??createRequestFunnel({auth:deps.auth,...deps.errorPolicy?{errorPolicy:deps.errorPolicy}:{}}),segment=(value,max)=>typeof value=="string"&&value.length>0&&!hasLoneSurrogate(value)&&[...value].length<=max,read=async(call,petRef,path,map)=>{if(!segment(petRef,PET_REF_MAX))return invalid();let result=await funnel.send(call,{method:"GET",path:path});if(!result.ok)return result;let view=map(result.value);return view.petRef===petRef?ok(view):err(makeEverfurError("internalError",{retryable:false}))},pet=petRef=>`${BASE}/${encodeURIComponent(petRef)}`,record=petRef=>`${pet(petRef)}/everfur_record`,parsed=async(call,req,map)=>{let result=await funnel.send(call,req,req.method==="POST"?{idempotent:false,maxAttempts:1}:void 0);if(!result.ok)return result;let value=map(result.value);return value===null?err(makeEverfurError("internalError",{retryable:false})):ok(value)},factBody=(input,corrected)=>!segment(input.entityType,FACT_ENTITY_TYPE_MAX)||!segment(input.canonicalKey,FACT_CANONICAL_KEY_MAX)||input.idempotencyKey!==void 0&&!segment(input.idempotencyKey,IDEMPOTENCY_KEY_MAX)||corrected!==void 0&&Object.keys(corrected).length===0?null:{entity_type:input.entityType,canonical_key:input.canonicalKey,...corrected!==void 0?{corrected_fields:corrected}:{},...input.idempotencyKey!==void 0?{idempotency_key:input.idempotencyKey}:{}};return{getRecordDepth:petRef=>read("records.depth.record",petRef,`${pet(petRef)}/record`,wire=>mapRecordDepth(petRef,wire)),getTimeline:petRef=>read("records.depth.timeline",petRef,`${pet(petRef)}/timeline`,wire=>mapRecordsTimeline(petRef,wire)),getDocumentContributions(petRef,docId){return segment(docId,64)?read("records.depth.contributions",petRef,`${pet(petRef)}/documents/${encodeURIComponent(docId)}/contributions`,wire=>mapDocumentContributions(petRef,wire)):invalid()},getMarkers:petRef=>read("records.depth.markers",petRef,`${pet(petRef)}/markers`,wire=>mapRecordMarkers(petRef,wire)),createShare(petRef,opts){if(!segment(petRef,PET_REF_MAX))return invalid();let audience=opts?.audience;return audience!==void 0&&!RECORD_SHARE_AUDIENCES.includes(audience)?invalid():parsed("records.share.create",{method:"POST",path:`${record(petRef)}/share`,...audience!==void 0?{body:{audience:audience}}:{}},wire=>mapRecordShareLink(wire,deps.apiBaseUrl))},emailShare(petRef,input){let kind=input.recipientKind,email=typeof input.recipientEmail=="string"?input.recipientEmail.trim():"",kindOk=kind==="other"||RECORD_SHARE_AUDIENCES.includes(kind);return!segment(petRef,PET_REF_MAX)||!kindOk||!isShareRecipientEmail(email)||hasLoneSurrogate(email)?invalid():parsed("records.share.email",{method:"POST",path:`${record(petRef)}/share/email`,body:{recipient_email:email,recipient_kind:kind}},mapRecordShareEmailReceipt)},async readFeatures(){try{let result=await funnel.send("records.getFeatures",{method:"GET",path:"/widget/v1/records/features"});return result.ok?mapRecordsFeatures(result.value):RECORDS_FEATURES_PDF_ONLY}catch{return RECORDS_FEATURES_PDF_ONLY}},listShares(petRef){return segment(petRef,PET_REF_MAX)?parsed("records.share.list",{method:"GET",path:`${record(petRef)}/shares`},mapRecordShareList):invalid()},async revokeShare(petRef,shareId){if(!segment(petRef,PET_REF_MAX)||!segment(shareId,64))return invalid();let result=await funnel.send("records.share.revoke",{method:"DELETE",path:`${record(petRef)}/shares/${encodeURIComponent(shareId)}`},{idempotent:false,maxAttempts:1});return result.ok?ok(void 0):result},getPdfLink(petRef){return segment(petRef,PET_REF_MAX)?parsed("records.pdf.link",{method:"GET",path:`${record(petRef)}/pdf-link`},mapRecordPdfLink):invalid()},async editFact(petRef,input){let body=segment(petRef,PET_REF_MAX)?factBody(input,input.correctedFields):null;if(body===null)return invalid();let result=await funnel.send("records.fact.edit",{method:"POST",path:`${record(petRef)}/facts/edit`,body:body},{idempotent:false,maxAttempts:1});return result.ok?ok(void 0):result},async removeFact(petRef,input){let body=segment(petRef,PET_REF_MAX)?factBody(input):null;if(body===null)return invalid();let result=await funnel.send("records.fact.remove",{method:"POST",path:`${record(petRef)}/facts/remove`,body:body},{idempotent:false,maxAttempts:1});return result.ok?ok(void 0):result},listRequestDocuments(requestId){return segment(requestId,64)?parsed("records.request.documents",{method:"GET",path:`/widget/v1/records/requests/${encodeURIComponent(requestId)}/documents`},mapRequestDocuments):invalid()},listAuthorizationSignatures:()=>parsed("records.signatures.list",{method:"GET",path:"/widget/v1/records/authorization-signatures"},mapSignatureSuggestions)}}function invalid(){return Promise.resolve(err(makeEverfurError("validationFailed",{retryable:false})))}var epochs=/* @__PURE__ */new Map,listeners=/* @__PURE__ */new Set;function recordsConsentEpochOf(petRef){return epochs.get(petRef)??0}function subscribe(onStoreChange){return listeners.add(onStoreChange),()=>{listeners.delete(onStoreChange)}}function useRecordsConsentEpoch(petRef){let snapshot=useCallback(()=>recordsConsentEpochOf(petRef),[petRef]);return useSyncExternalStore(subscribe,snapshot,snapshot)}function useEverfurRecordsDepthClient(){let{runtime:runtime,userRef:userRef,scopeEpoch:scopeEpoch}=useEverfurContext();return useMemo(()=>{let{services:services}=runtime.registry;return createRecordsDepthClient({auth:services.authFor(userRef),...services.errorPolicy?{errorPolicy:services.errorPolicy}:{},...typeof services.apiBaseUrl=="string"?{apiBaseUrl:services.apiBaseUrl}:{}})},[runtime,userRef,scopeEpoch])}function useRecordsDepthRead(petRef,read,isEmpty,extraKey=""){let client=useEverfurRecordsDepthClient(),{userRef:userRef}=useEverfurContext(),consentEpoch=useRecordsConsentEpoch(petRef),scope=useMemo(()=>({}),[client,petRef,extraKey,consentEpoch]),[state,setState]=useState({scope:scope,value:null,error:null,loading:true}),generation=useRef(0),load=useCallback(async()=>{let gen=generation.current+=1;if(setState({scope:scope,value:null,error:null,loading:true}),userRef===null){setState({scope:scope,value:null,error:null,loading:false});return}let result=await read(client,petRef);gen===generation.current&&(result.ok?setState({scope:scope,value:result.value,error:null,loading:false}):setState({scope:scope,value:null,error:result.error,loading:false}))},[client,petRef,read,scope,userRef]);useEffect(()=>(load(),()=>{generation.current+=1}),[load]);let current=state.scope===scope?state:{value:null,error:null,loading:true},refresh=useCallback(()=>{load()},[load]),available=current.error===null||current.error.httpStatus!==404,error=available?current.error:null,status=current.loading?"loading":error!==null?"error":current.value===null?"empty":current.value.withheld?"populated":isEmpty(current.value)?"empty":"populated";return useMemo(()=>({status:status,value:current.value,error:error,available:available,refresh:refresh}),[status,current.value,error,available,refresh])}var HostRenderBoundary=class extends Component{constructor(){super(...arguments);this.state={failed:false,key:this.props.resetKey}}static getDerivedStateFromError(){return{failed:true}}static getDerivedStateFromProps(props,state){return Object.is(props.resetKey,state.key)?null:{failed:false,key:props.resetKey}}render(){return this.state.failed?this.props.fallback:this.props.children}};function RenderHost({render:render}){return render()}function HostRender({render:render,fallback:fallback,resetKey:resetKey}){return createElement(HostRenderBoundary,{fallback:fallback,resetKey:resetKey,children:createElement(RenderHost,{render:render})})}var freezeInPlace=Object.freeze;function deepFreeze(value){if(value!==null&&typeof value=="object"&&!Object.isFrozen(value)){freezeInPlace(value);for(let key of Object.keys(value))deepFreeze(value[key])}return value}var TEXT_SCALE_TIER_CAPS=/* @__PURE__ */Object.freeze({content:0,heading:2,control:1.8,compact:1.5,badge:1.3}),SPACE={xs:4,sm:8,md:12,lg:16,xl:24,xxl:32},RADIUS={tile:5,xs:6,sm:10,md:14,lg:20,xl:28,pill:500},TYPE_SIZE={nano:8,small:9,micro:10,tiny:11,caption:13,bodyTight:15,body:17,subtitle:20,heading:22,verdict:24},LINE_HEIGHT={tight:1.15,snug:1.3,normal:1.4,relaxed:1.55},WEIGHT={regular:"400",medium:"500",bold:"700"},LETTER_SPACING={eyebrow:1,monoWide:.9,headerBrand:-.42,tight:-.35},DEFAULT_MAX_FONT_SCALE=0,SYSTEM_FONT_FAMILY="System",SYSTEM_MONO_FAMILY="monospace",TIERS=["content","heading","control","compact","badge"];function authoredTierSizes(size){let out={};for(let tier of TIERS)out[tier]=size;return out}var NO_FONT_SOURCES=[];function baseType(){return{family:SYSTEM_FONT_FAMILY,mono:SYSTEM_MONO_FAMILY,fontUrl:null,families:{regular:SYSTEM_FONT_FAMILY,medium:SYSTEM_FONT_FAMILY,bold:SYSTEM_FONT_FAMILY,mono:SYSTEM_MONO_FAMILY,monoMedium:SYSTEM_MONO_FAMILY,monoBold:SYSTEM_MONO_FAMILY},namedFaces:{regular:false,medium:false,bold:false,mono:false,monoMedium:false,monoBold:false},fontUrls:{},size:TYPE_SIZE,tierSizes:authoredTierSizes(TYPE_SIZE),lineHeight:LINE_HEIGHT,weight:WEIGHT,letterSpacing:LETTER_SPACING,scale:1,maxScale:DEFAULT_MAX_FONT_SCALE,scaleCaps:TEXT_SCALE_TIER_CAPS,headingFamily:null,headingWeight:null,fontSources:NO_FONT_SOURCES}}var NO_SLOTS={},EASING_CURVES=/* @__PURE__ */Object.freeze({standard:/* @__PURE__ */Object.freeze([.2,0,0,1]),emphasized:/* @__PURE__ */Object.freeze([.2,.8,.2,1]),exit:/* @__PURE__ */Object.freeze([.4,0,1,1])});function cssCubicBezier(curve){return`cubic-bezier(${curve.join(", ")})`}var MOTION={duration:{instant:80,fast:140,normal:220,slow:320},spring:{gentle:{damping:18,stiffness:200}},easing:{standard:cssCubicBezier(EASING_CURVES.standard),emphasized:cssCubicBezier(EASING_CURVES.emphasized),exit:cssCubicBezier(EASING_CURVES.exit)},reducedMotion:false},LIGHT_COLOR={brand:"#10462E",brandSoft:"rgba(16,70,46,0.10)",brandSofter:"rgba(16,70,46,0.15)",brandBorder:"rgba(16,70,46,0.18)",borderHairlineGreen:"rgba(16,70,46,0.25)",brandBorderStrong:"rgba(16,70,46,0.55)",brandInk:"#10462E",linkInk:"#10462E",surface:"#FFFFFF",surfaceCream:"#FFFFFF",surfaceSubtle:"#F1F5F2",background:"#FFFFFF",borderRingCream:"#E4E4E4",chatGround:"#FFFFFF",composerFill:"#FFFFFF",composerBorder:"rgba(16,70,46,0.75)",shadow:"#0B3421",text:{primary:"#000000",secondary:"#0E462E",muted:"#6B6B6B",placeholder:"rgba(61,61,61,0.75)",onBrand:"#FFFFFF",metaCool:"#3D3D3D",timestamp:"rgba(61,61,61,0.75)"},primary:"#10462E",onPrimary:"#FFFFFF",accent:"#10462E",onAccent:"#FFFFFF",accentEdge:"#07C168",success:"#07C168",danger:"#C03410",onDanger:"#FFFFFF",errorRed:"#C03410",warningStrong:"#A45610",cautionAccent:"#D9821D",riskConcern:"#EFA700",sentiment:{up:"#07C168",neutral:"#FBC558",down:"#FF1B00"},badgeBgPositive:"rgba(7,193,104,0.12)",badgeBgCaution:"rgba(217,130,29,0.14)",badgeBgCritical:"rgba(192,52,16,0.06)",badgeBgNeutral:"rgba(107,107,107,0.12)",bubbleUser:"#10462E",bubbleAssistant:"#FFFFFF",bubbleVet:"#FFC3BC",onBubbleVet:"#000000",skeleton:"#E9F1E9",scanButtonPink:"#FFC3BC",highlight:"#FFC3BC",onHighlight:"#000000",mark:"#07C168",controlEdge:"rgba(16,70,46,0.18)",structureEdge:"rgba(16,70,46,0.25)",primaryEdge:"#10462E",checkupCardLowRiskBg:"rgba(7,193,104,0.10)",checkupCardConcernBg:"rgba(239,167,0,0.10)",info:"#10462E",badgeBgInfo:"rgba(16,70,46,0.10)",infoEdge:"rgba(16,70,46,0.25)"},EVERFUR_LIGHT=deepFreeze({brightness:"light",highContrast:false,meta:{displayName:"Everfur",logoUrl:null,placeholder:null,hidePoweredBy:false,assistantAvatarUrl:null},color:LIGHT_COLOR,space:SPACE,radius:RADIUS,type:baseType(),motion:MOTION,slots:NO_SLOTS}),DARK_COLOR={brand:"#6BD39A",brandSoft:"rgba(107,211,154,0.12)",brandSofter:"rgba(107,211,154,0.18)",brandBorder:"rgba(107,211,154,0.22)",borderHairlineGreen:"rgba(107,211,154,0.28)",brandBorderStrong:"rgba(107,211,154,0.55)",brandInk:"#6BD39A",linkInk:"#6BD39A",surface:"#1C1F23",surfaceCream:"#23272C",surfaceSubtle:"#23272C",background:"#15171A",borderRingCream:"#3A3F45",chatGround:"#1C1F23",composerFill:"#23272C",composerBorder:"rgba(107,211,154,0.75)",shadow:"#000000",text:{primary:"#F5F3F0",secondary:"#A9E4C4",muted:"#9A9A9A",placeholder:"rgba(255,255,255,0.55)",onBrand:"#0E1F17",metaCool:"#C9C9C9",timestamp:"rgba(245,243,240,0.7)"},primary:"#6BD39A",onPrimary:"#0E1F17",accent:"#6BD39A",onAccent:"#0E1F17",accentEdge:"#34D888",success:"#07C168",danger:"#F87171",onDanger:"#0E1F17",errorRed:"#FF6B5B",warningStrong:"#F0A35E",cautionAccent:"#D9821D",riskConcern:"#EFA700",sentiment:{up:"#07C168",neutral:"#FBC558",down:"#FF1B00"},badgeBgPositive:"rgba(7,193,104,0.18)",badgeBgCaution:"rgba(217,130,29,0.20)",badgeBgCritical:"rgba(185,28,28,0.22)",badgeBgNeutral:"rgba(255,255,255,0.10)",bubbleUser:"#6BD39A",bubbleAssistant:"#1C1F23",bubbleVet:"#FFC3BC",onBubbleVet:"#000000",skeleton:"#23272C",scanButtonPink:"#FFC3BC",highlight:"#605051",onHighlight:"#F5F3F0",mark:"#07C168",controlEdge:"rgba(107,211,154,0.22)",structureEdge:"rgba(107,211,154,0.28)",primaryEdge:"#6BD39A",checkupCardLowRiskBg:"rgba(7,193,104,0.16)",checkupCardConcernBg:"rgba(239,167,0,0.16)",info:"#6BD39A",badgeBgInfo:"rgba(107,211,154,0.12)",infoEdge:"rgba(107,211,154,0.28)"},EVERFUR_DARK=deepFreeze({brightness:"dark",highContrast:false,meta:{displayName:"Everfur",logoUrl:null,placeholder:null,hidePoweredBy:false,assistantAvatarUrl:null},color:DARK_COLOR,space:SPACE,radius:RADIUS,type:baseType(),motion:MOTION,slots:NO_SLOTS});var EVERFUR_THEME_CONTEXT_SYMBOL=/* @__PURE__ */Symbol.for("@everfur/sdk#EverfurThemeContext@v1"),globalThemeHost=globalThis,EverfurThemeContext=globalThemeHost[EVERFUR_THEME_CONTEXT_SYMBOL]??(globalThemeHost[EVERFUR_THEME_CONTEXT_SYMBOL]=createContext(EVERFUR_LIGHT));EverfurThemeContext.displayName??="EverfurThemeContext";function useEverfurTheme(){return useContext(EverfurThemeContext)}var FACE_WEIGHT=/* @__PURE__ */Object.freeze({regular:"regular",medium:"medium",bold:"bold",mono:"regular",monoMedium:"medium",monoBold:"bold"});var SYSTEM_UI_STACK='system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif',RN_SYSTEM_FAMILY="System";function cssFontFamily(family){let named=family.trim();return named.length===0||named===RN_SYSTEM_FAMILY?SYSTEM_UI_STACK:`${quote(named)}, ${SYSTEM_UI_STACK}`}function cssMonoFamily(mono){let named=mono.trim();return named.length===0||named==="monospace"?"ui-monospace, Menlo, Consolas, monospace":`${quote(named)}, ui-monospace, Menlo, Consolas, monospace`}function quote(family){return`"${family.replace(/[\\"]/g,"\\$&")}"`}function faceCss(theme,weight){let type=theme.type,family=type.families[weight];return{fontFamily:weight==="mono"||weight==="monoMedium"||weight==="monoBold"?cssMonoFamily(family):cssFontFamily(family),fontWeight:type.namedFaces[weight]?type.weight.regular:type.weight[FACE_WEIGHT[weight]]}}function headingFaceCss(theme,fallback="bold"){let{headingFamily:headingFamily,headingWeight:headingWeight}=theme.type,base=faceCss(theme,fallback);return headingFamily===null&&headingWeight===null?base:headingFamily!==null?{fontFamily:cssFontFamily(headingFamily),fontWeight:headingWeight??theme.type.weight[FACE_WEIGHT[fallback]]}:theme.type.namedFaces[fallback]||headingWeight===null?base:{fontFamily:base.fontFamily,fontWeight:headingWeight}}var SURFACE_ROOT_RESET=/* @__PURE__ */Object.freeze({textAlign:"start"});var REQUIRES=/* @__PURE__ */Object.freeze({chat:/* @__PURE__ */Object.freeze(["chat.message.create"]),records:/* @__PURE__ */Object.freeze(["records.upload.create","records.record.read"]),recordsClinic:/* @__PURE__ */Object.freeze(["records.clinic.create"]),video:/* @__PURE__ */Object.freeze(["video.gait.execute"]),photo:/* @__PURE__ */Object.freeze(["photo.checkup.execute"]),animations:/* @__PURE__ */Object.freeze(["animations.state.read"]),televet:/* @__PURE__ */Object.freeze(["televet.visit.create"])});function requires(name){return REQUIRES[name]}function decideCapability(name,decisions,opts){let keys=requires(name),byResource=/* @__PURE__ */new Map;for(let decision of decisions)byResource.set(decision.resource,decision);if(opts?.isPending===true&&keys.some(key=>!byResource.has(key)))return freezeDecision({name:name,enabled:false,isPending:true,limits:{}});let limits=mergeLimits(keys,byResource);return keys.filter(key=>byResource.get(key)?.granted!==true).length===0?freezeDecision({name:name,enabled:true,isPending:false,limits:limits}):freezeDecision({name:name,enabled:false,isPending:false,limits:limits,disabled:disabledFor(keys,byResource)})}function mergeLimits(keys,byResource){let out={};for(let key of keys){let decisionLimits=byResource.get(key)?.limits;if(decisionLimits)for(let[limitKey,limitValue]of Object.entries(decisionLimits)){let existing=out[limitKey];out[limitKey]=existing===void 0?limitValue:Math.min(existing,limitValue)}}return out}function disabledFor(keys,byResource){for(let key of keys){let explicit=byResource.get(key)?.disabled;if(explicit)/* @__PURE__ */
|
|
108
108
|
return Object.freeze({reason:explicit.reason,level:explicit.level,recoverable:explicit.recoverable})}/* @__PURE__ */
|
|
109
109
|
return Object.freeze({reason:userFacingError("accessDenied"),level:"user_entitlement",recoverable:false})}function freezeDecision(d){let base={name:d.name,enabled:d.enabled,isPending:d.isPending,limits:/* @__PURE__ */Object.freeze({...d.limits})};return d.disabled!==void 0&&(base.disabled=d.disabled),/* @__PURE__ */Object.freeze(base)}function useCapability(name){let{runtime:runtime}=useEverfurContext(),store=runtime.entitlements,snapshot=useSyncExternalStore(store.subscribe,store.getSnapshot,store.getSnapshot);return useMemo(()=>decideCapability(name,snapshot.decisions,{isPending:snapshot.isPending}),[name,snapshot])}var MIN_OFFSTATE_HEIGHT=48;function selectView(decision){return decision.isPending?"pending":decision.enabled?"enabled":"disabled"}function CapabilityGate(props){let{capability:capability,children:children,renderDisabled:renderDisabled,renderPending:renderPending,style:style,className:className}=props,decision=useCapability(capability),view=useMemo(()=>selectView(decision),[decision]);switch(view){case"enabled":return children;case"pending":return renderPending?/* @__PURE__ */jsx(HostRender,{render:renderPending,fallback:/* @__PURE__ */jsx(PendingSkeleton,{capability:capability,style:style,className:className})}):/* @__PURE__ */jsx(PendingSkeleton,{capability:capability,style:style,className:className});case"disabled":return renderDisabled?/* @__PURE__ */jsx(HostRender,{render:()=>renderDisabled(decision),fallback:/* @__PURE__ */jsx(OffState,{decision:decision,style:style,className:className}),resetKey:decision}):/* @__PURE__ */jsx(OffState,{decision:decision,style:style,className:className});default:return assertNever(view)}}function PendingSkeleton({capability:capability,style:style,className:className}){let theme=useEverfurTheme(),styles=useMemo(()=>makeStyles(theme),[theme]);/* @__PURE__ */
|
|
110
110
|
return jsx("div",{role:"status","aria-busy":"true","aria-label":`Loading ${capability}`,className:className,style:{...styles.offstate,...style},children:/* @__PURE__ */jsx("div",{style:styles.skeletonBar})})}function OffState({decision:decision,style:style,className:className}){let theme=useEverfurTheme(),styles=useMemo(()=>makeStyles(theme),[theme]),message=decision.disabled?.reason??"";/* @__PURE__ */
|
|
111
|
-
return jsx("div",{className:className,style:{...styles.offstate,...style},children:message.length>0?/* @__PURE__ */jsx("p",{style:styles.offstateText,children:message}):null})}function makeStyles(theme){let{color:color,space:space,radius:radius,type:type}=theme;return{offstate:{...SURFACE_ROOT_RESET,boxSizing:"border-box",minHeight:MIN_OFFSTATE_HEIGHT,display:"flex",flexDirection:"column",justifyContent:"center",padding:`${space.md}px ${space.lg}px`,backgroundColor:color.surfaceCream,borderRadius:radius.md,border:`1px solid ${color.brandBorder}`},offstateText:{margin:0,...faceCss(theme,"regular"),fontSize:type.size.body,lineHeight:`${Math.round(type.size.body*type.lineHeight.normal)}px`,color:color.text.muted},skeletonBar:{height:space.md,borderRadius:radius.xs,backgroundColor:color.brandSofter}}}var RecordsFootnoteDrawnAbove=createContext(false);function RecordsFootnote(props){let theme=useEverfurTheme(),style=useMemo(()=>footnoteStyle(theme),[theme]);return useContext(RecordsFootnoteDrawnAbove)?null:/* @__PURE__ */jsx("p",{role:"note",className:props.className,style:{...style,...props.style},"data-testid":"records-footnote",children:RECORDS_FOOTNOTE})}function footnoteStyle(theme){let{color:color,space:space,type:type}=theme;return{...SURFACE_ROOT_RESET,boxSizing:"border-box",margin:0,padding:`${space.md}px ${space.lg}px ${space.lg}px`,textAlign:"center",...faceCss(theme,"regular"),fontSize:type.size.caption,lineHeight:`${Math.round(type.size.caption*type.lineHeight.normal)}px`,color:color.text.muted,backgroundColor:color.background}}var MIN_HEIGHT=120,MIN_TARGET=44;function RecordsGateOffState({reason:reason,onExit:onExit,exitLabel:exitLabel,style:style,className:className}){let{color:color,space:space,radius:radius,type:type}=useEverfurTheme();/* @__PURE__ */
|
|
111
|
+
return jsx("div",{className:className,style:{...styles.offstate,...style},children:message.length>0?/* @__PURE__ */jsx("p",{style:styles.offstateText,children:message}):null})}function makeStyles(theme){let{color:color,space:space,radius:radius,type:type}=theme;return{offstate:{...SURFACE_ROOT_RESET,boxSizing:"border-box",minHeight:MIN_OFFSTATE_HEIGHT,display:"flex",flexDirection:"column",justifyContent:"center",padding:`${space.md}px ${space.lg}px`,backgroundColor:color.surfaceCream,borderRadius:radius.md,border:`1px solid ${color.brandBorder}`},offstateText:{margin:0,...faceCss(theme,"regular"),fontSize:type.size.body,lineHeight:`${Math.round(type.size.body*type.lineHeight.normal)}px`,color:color.text.muted},skeletonBar:{height:space.md,borderRadius:radius.xs,backgroundColor:color.brandSofter}}}var RecordsFootnoteDrawnAbove=createContext(false);function RecordsFootnote(props){let theme=useEverfurTheme(),style=useMemo(()=>footnoteStyle(theme),[theme]);return useContext(RecordsFootnoteDrawnAbove)?null:/* @__PURE__ */jsx("p",{role:"note",className:props.className,style:{...style,...props.style},"data-testid":"records-footnote",children:RECORDS_FOOTNOTE})}function footnoteStyle(theme){let{color:color,space:space,type:type}=theme;return{...SURFACE_ROOT_RESET,boxSizing:"border-box",margin:0,padding:`${space.md}px ${space.lg}px ${space.lg}px`,textAlign:"center",...faceCss(theme,"regular"),fontSize:type.size.caption,lineHeight:`${Math.round(type.size.caption*type.lineHeight.normal)}px`,color:color.text.muted,backgroundColor:color.background}}function slotCss(slot,borderWidth){return{...slotBoxCss(slot,borderWidth),...slotText(slot)}}var MIN_HEIGHT=120,MIN_TARGET=44;function RecordsGateOffState({reason:reason,onExit:onExit,exitLabel:exitLabel,style:style,className:className}){let{color:color,space:space,radius:radius,type:type}=useEverfurTheme();/* @__PURE__ */
|
|
112
112
|
return jsxs("div",{className:className,"data-testid":"records-gate-off",style:{boxSizing:"border-box",minHeight:MIN_HEIGHT,display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"flex-start",gap:space.md,padding:space.lg,borderRadius:radius.md,border:`1px solid ${color.brandBorder}`,backgroundColor:color.surfaceCream,color:color.text.primary,...style},children:[reason.length>0?/* @__PURE__ */jsx("p",{style:{margin:0,fontSize:type.size.bodyTight,color:color.text.muted},children:reason}):null,
|
|
113
|
-
/* @__PURE__ */jsx("button",{type:"button",onClick:onExit,"data-testid":"records-gate-off-exit",style:{minHeight:MIN_TARGET,padding:`0 ${space.lg}px`,borderRadius:radius.pill,border:`1.5px solid ${color.brandInk}`,backgroundColor:"transparent",color:color.brandInk,font:"inherit",fontSize:type.size.body,cursor:"pointer"},children:exitLabel})]})}function recordsGateExit(onExit,exitLabel){return onExit===void 0?{}:{renderDisabled:decision=>/* @__PURE__ */jsx(RecordsGateOffState,{reason:decision.disabled?.reason??"",onExit:onExit,exitLabel:exitLabel})}}
|
|
114
|
-
return
|
|
115
|
-
/* @__PURE__ */jsx("div",{style:styles.headerRight,children:right??/* @__PURE__ */jsx("span",{style:styles.iconButton})})]})}function makeScreenStyles(theme){let{color:color,space:space,radius:radius,type:type,slots:slots}=theme,lh=(size,multiplier)=>`${Math.round(size*multiplier)}px`,text=(size,multiplier,fg,weight="regular")=>({margin:0,...faceCss(theme,weight),fontSize:size,lineHeight:lh(size,multiplier),color:fg}),cardText=slotText(slots.recordCard),errorColor=theme.brightness==="dark"?color.errorRed:color.danger,tone=(bg,fg)=>({backgroundColor:bg,color:fg,border:"1.5px solid transparent"}),edge=(line,fg)=>({backgroundColor:color.surface,color:fg,border:`1.5px solid ${line}`}),cardEdge=`1px solid ${color.borderRingCream}`,button={boxSizing:"border-box",minHeight:BUTTON_HEIGHT,minWidth:MIN_TOUCH_TARGET,padding:`${space.md}px ${space.lg+space.xs/2}px`,borderRadius:radius.pill,...faceCss(theme,"bold"),fontSize:type.size.body,cursor:"pointer",display:"inline-flex",alignItems:"center",justifyContent:"center",gap:space.sm,textDecoration:"none"};return{chipTones:{neutral:edge(color.brandBorderStrong,color.text.primary),info:tone(color.brandSoft,color.brandInk),warning:edge(color.cautionAccent,color.text.primary),critical:edge(color.danger,color.danger),positive:edge(color.success,color.brandInk)},root:{...SURFACE_ROOT_RESET,boxSizing:"border-box",display:"flex",flexDirection:"column",minHeight:MIN_SURFACE_HEIGHT,height:"100%",backgroundColor:color.background,color:color.text.primary,...faceCss(theme,"regular")},body:{flex:"1 1 auto",minHeight:0,display:"flex",flexDirection:"column",overflowY:"auto"},content:{display:"flex",flexDirection:"column",gap:space.lg,padding:`0 ${space.lg}px ${space.xxl}px`},contentTight:{display:"flex",flexDirection:"column",gap:space.lg,padding:`0 ${space.sm}px ${space.xxl}px`},inset:{padding:`0 ${space.sm}px`},headerRow:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:space.sm,padding:`${space.xs}px ${space.lg}px ${space.md}px`},iconButton:{boxSizing:"border-box",width:MIN_TOUCH_TARGET,height:MIN_TOUCH_TARGET,display:"inline-flex",alignItems:"center",justifyContent:"center",border:0,background:"transparent",cursor:"pointer",padding:0,color:color.brandInk,flexShrink:0},backChevron:{display:"block",width:space.md,height:space.md,borderLeft:`2px solid ${color.brandInk}`,borderBottom:`2px solid ${color.brandInk}`,transform:"rotate(45deg)",marginLeft:space.xs},headerTitle:{...text(type.size.heading,type.lineHeight.tight,color.brandInk,"bold"),flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},documentTitle:{...text(type.size.subtitle,type.lineHeight.snug,color.text.primary,"bold"),flex:1,textAlign:"center"},headerRight:{display:"flex",alignItems:"center",gap:space.sm+space.xs/2},section:{display:"flex",flexDirection:"column",gap:space.sm+space.xs/2},sectionHeader:{display:"flex",alignItems:"center",gap:space.sm,padding:`0 ${space.xs}px`},sectionTitle:{...text(type.size.subtitle,type.lineHeight.snug,color.text.primary,"bold"),letterSpacing:"-0.02em"},sectionCount:{...text(type.size.bodyTight,type.lineHeight.snug,color.text.muted,"medium")},card:{boxSizing:"border-box",borderRadius:radius.lg,border:cardEdge,backgroundColor:color.surface,padding:`${space.xs}px ${space.lg}px`,margin:0,listStyle:"none",...slotBoxCss(slots.recordCard,1)},creamCard:{boxSizing:"border-box",borderRadius:radius.lg,border:cardEdge,backgroundColor:color.surfaceCream,padding:space.lg,display:"flex",flexDirection:"column",gap:space.md,...slotBoxCss(slots.recordCard,1)},row:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:space.md,padding:`${space.md}px 0`},rowDivider:{borderTop:`1px solid ${color.borderHairlineGreen}`},rowMain:{flex:1,minWidth:0},rowRight:{display:"flex",flexDirection:"column",alignItems:"flex-end",gap:space.xs+space.xs/2},rowTitle:{...text(type.size.body,type.lineHeight.snug,color.text.primary,"medium"),...cardText},rowDetail:{...text(type.size.caption,type.lineHeight.normal,color.text.secondary),marginTop:space.xs/2,...cardText},rowValue:{...text(type.size.body+1,type.lineHeight.snug,color.text.primary,"bold"),marginTop:space.xs/2,...cardText},rowMuted:{...text(type.size.caption,type.lineHeight.normal,color.text.muted),...cardText},chip:{boxSizing:"border-box",display:"inline-flex",alignItems:"center",minHeight:24,borderRadius:radius.pill,padding:`0 ${space.sm+space.xs/2}px`,...faceCss(theme,"monoBold"),fontSize:type.size.tiny+1,lineHeight:lh(type.size.tiny+1,type.lineHeight.snug),letterSpacing:"0.06em",textTransform:"uppercase",whiteSpace:"nowrap"},pill:button,pillPrimary:{border:0,backgroundColor:color.brand,color:color.onPrimary,...slotBoxCss(slots.primaryButton),...slotText(slots.primaryButton)},pillOutline:{border:`1.5px solid ${color.brandInk}`,backgroundColor:"transparent",color:color.brandInk},pillDanger:{border:`1.4px solid ${color.danger}`,backgroundColor:color.surface,color:color.danger,fontSize:type.size.bodyTight},pillAsk:{border:`1px solid ${color.borderRingCream}`,backgroundColor:color.surface,color:color.text.primary},pillLink:{minHeight:MIN_TOUCH_TARGET,border:0,backgroundColor:"transparent",color:color.linkInk,padding:`${space.sm}px`},pillDisabled:{opacity:.5,cursor:"default"},infoNote:{display:"flex",gap:space.sm,borderRadius:radius.md-space.xs/2,backgroundColor:color.brandSoft,padding:`${space.sm+space.xs/2}px ${space.md}px`,...text(type.size.bodyTight,type.lineHeight.normal,color.text.primary)},cautionNote:{display:"flex",gap:space.sm,borderRadius:radius.md-space.xs/2,backgroundColor:color.badgeBgCaution,padding:`${space.sm+space.xs/2}px ${space.md}px`,...text(type.size.bodyTight,type.lineHeight.normal,color.warningStrong)},statusCard:{borderRadius:radius.md,backgroundColor:color.brandSoft,padding:space.md+space.xs/2,...text(type.size.bodyTight,type.lineHeight.relaxed,color.text.primary)},errorBanner:{display:"flex",gap:space.sm,borderRadius:radius.md-space.xs/2,backgroundColor:color.badgeBgCritical,padding:space.md,...text(type.size.bodyTight,type.lineHeight.normal,errorColor)},errorText:text(type.size.bodyTight,type.lineHeight.normal,errorColor),band:{display:"flex",alignItems:"flex-start",gap:space.sm,borderRadius:radius.md-space.xs/2,padding:space.md,backgroundColor:color.brandSoft,margin:0},bandText:{flex:1,...text(type.size.caption,type.lineHeight.normal,color.text.secondary)},infoGlyph:{boxSizing:"border-box",flexShrink:0,width:space.md+space.xs/2,height:space.md+space.xs/2,borderRadius:radius.pill,border:`1px solid ${color.text.secondary}`,display:"inline-flex",alignItems:"center",justifyContent:"center",...faceCss(theme,"bold"),fontSize:type.size.small,color:color.text.secondary},chevron:{display:"inline-block",width:space.sm,height:space.sm,borderTop:`2px solid ${color.text.muted}`,borderRight:`2px solid ${color.text.muted}`,flexShrink:0},chipSentence:{...faceCss(theme,"medium"),fontSize:type.size.caption,lineHeight:lh(type.size.caption,type.lineHeight.normal),letterSpacing:"normal",textTransform:"none",whiteSpace:"normal",borderRadius:radius.md,padding:`${space.xs}px ${space.sm+space.xs/2}px`},lead:{...text(type.size.body+1,type.lineHeight.snug,color.text.primary,"bold"),padding:`0 ${space.sm}px`},subLead:{...text(type.size.body,type.lineHeight.normal,color.text.muted),padding:`0 ${space.lg}px ${space.md}px`},field:{boxSizing:"border-box",display:"block",width:"100%",minHeight:MIN_TOUCH_TARGET,padding:`${space.sm}px ${space.md}px`,border:`1px solid ${color.borderHairlineGreen}`,borderRadius:radius.sm,color:color.text.primary,backgroundColor:color.surface,...faceCss(theme,"regular"),fontSize:type.size.body},fieldLabel:{...text(type.size.bodyTight,type.lineHeight.normal,color.text.secondary,"medium"),display:"block",marginBottom:space.xs},muted:text(type.size.caption,type.lineHeight.normal,color.text.muted),bodyText:text(type.size.body,type.lineHeight.normal,color.text.primary),mono:faceCss(theme,"mono"),plainList:{listStyle:"none",margin:0,padding:0,display:"flex",flexDirection:"column"},dialogFrame:{boxSizing:"border-box",position:"fixed",top:0,right:0,bottom:0,left:0,width:"100%",height:"100%",maxWidth:"100%",maxHeight:"100%",margin:0,padding:0,border:0,backgroundColor:"transparent",overflow:"hidden"},dialogScrim:{boxSizing:"border-box",display:"flex",alignItems:"center",justifyContent:"center",width:"100%",height:"100%",padding:space.lg,backgroundColor:"rgba(0,0,0,0.4)"},dialogScrimSide:{boxSizing:"border-box",display:"flex",alignItems:"stretch",justifyContent:"flex-end",width:"100%",height:"100%",backgroundColor:"rgba(0,0,0,0.4)"},dialogPanel:{boxSizing:"border-box",width:"100%",maxWidth:560,maxHeight:"100%",overflowY:"auto",backgroundColor:color.surface,borderRadius:radius.xl-1,padding:`${space.lg}px ${space.lg+space.xs+space.xs/2}px`,display:"flex",flexDirection:"column",gap:space.md,...faceCss(theme,"regular"),color:color.text.primary},dialogPanelSide:{boxSizing:"border-box",width:"min(100vw, 480px)",height:"100%",maxHeight:"100%",overflowY:"auto",backgroundColor:color.surface,padding:`${space.lg}px ${space.lg+space.xs+space.xs/2}px`,display:"flex",flexDirection:"column",gap:space.md,...faceCss(theme,"regular"),color:color.text.primary},sheetHeader:{display:"flex",alignItems:"flex-start",justifyContent:"space-between",gap:space.sm},sheetTitle:{...text(type.size.heading,type.lineHeight.snug,color.text.primary,"bold")},sheetHelper:text(type.size.bodyTight,type.lineHeight.normal,color.text.muted),closeGlyph:{fontSize:type.size.verdict,lineHeight:1,color:color.text.primary}}}var RECORDS_EMPTY_COPY=/* @__PURE__ */Object.freeze({idle:/* @__PURE__ */Object.freeze({title:"Find your pet’s clinic",body:"Search for the clinic that holds your pet’s records. We’ll request them on your behalf once you sign the authorization.",action:null}),no_requests:/* @__PURE__ */Object.freeze({title:"No record requests yet",body:"When you request records from a clinic, you’ll be able to track every step here.",action:null}),no_records:/* @__PURE__ */Object.freeze({title:"Nothing to show just yet",body:"Once your pet’s records arrive and our team reviews them, lab trends and visits will appear here.",action:null}),rate_limited:/* @__PURE__ */Object.freeze({title:"Slow down a moment",body:"You’ve made a lot of requests just now. You can try again shortly.",action:"Try again"}),service_unavailable:/* @__PURE__ */Object.freeze({title:"Records search is temporarily down",body:"We’re working on it. Please try again in a few minutes.",action:"Try again"}),error:/* @__PURE__ */Object.freeze({title:"Couldn’t reach Everfur",body:"Check your connection and try again.",action:"Try again"})}),RATE_LIMIT_COOLDOWN_S=60;function coolingActionLabel(seconds){return`Try again in ${seconds}s`}var COOLING_A11Y_LABEL="Try again, available shortly";function SkeletonBlock({width:width,height:height,radius:radius,style:style}){let{color:color,radius:radii}=useEverfurTheme();/* @__PURE__ */
|
|
113
|
+
/* @__PURE__ */jsx("button",{type:"button",onClick:onExit,"data-testid":"records-gate-off-exit",style:{minHeight:MIN_TARGET,padding:`0 ${space.lg}px`,borderRadius:radius.pill,border:`1.5px solid ${color.brandInk}`,backgroundColor:"transparent",color:color.brandInk,font:"inherit",fontSize:type.size.body,cursor:"pointer"},children:exitLabel})]})}function recordsGateExit(onExit,exitLabel){return onExit===void 0?{}:{renderDisabled:decision=>/* @__PURE__ */jsx(RecordsGateOffState,{reason:decision.disabled?.reason??"",onExit:onExit,exitLabel:exitLabel})}}function parseColor(value){let rgba=toRgba(value);return rgba===null?null:normalizeRgba(rgba)}function toRgba(value){if(typeof value=="number")return argbIntToRgba(value);if(typeof value!="string")return null;let s=value.trim();if(s.length===0)return null;if(s.startsWith("#"))return fromHex(s.slice(1));if(s.toLowerCase().startsWith("0x"))return fromHex(s.slice(2));if(s.toLowerCase().startsWith("rgb"))return fromRgbFunc(s);if(/^[0-9a-fA-F]+$/.test(s)){let hex=fromHex(s);if(hex!==null)return hex}return/^\d+$/.test(s)?argbIntToRgba(Number.parseInt(s,10)):null}function fromHex(hex){let h=hex.trim();if(!/^[0-9a-fA-F]+$/.test(h))return null;if(h.length===3)return{r:dup(h[0]),g:dup(h[1]),b:dup(h[2]),a:1};if(h.length===6)return{r:byte(h,0),g:byte(h,2),b:byte(h,4),a:1};if(h.length===8){let a=byte(h,0);return{r:byte(h,2),g:byte(h,4),b:byte(h,6),a:a/255}}return null}function fromRgbFunc(input){let open=input.indexOf("("),close=input.indexOf(")");if(open<0||close<0||close<open)return null;let parts=input.slice(open+1,close).split(",").map(p=>p.trim());if(parts.length<3)return null;let r=clampByte(Number(parts[0])),g=clampByte(Number(parts[1])),b=clampByte(Number(parts[2]));if(r===null||g===null||b===null)return null;let a=1;if(parts.length>=4){let alpha=Number(parts[3]);if(!Number.isFinite(alpha))return null;a=Math.min(1,Math.max(0,alpha))}return{r:r,g:g,b:b,a:a}}function argbIntToRgba(n){if(!Number.isFinite(n))return null;let int=Math.trunc(n)>>>0,a=int>>>24&255;return{r:int>>>16&255,g:int>>>8&255,b:int&255,a:a===0?1:a/255}}function byte(hex,at){return Number.parseInt(hex.slice(at,at+2),16)}function dup(nibble){return Number.parseInt(`${nibble??"0"}${nibble??"0"}`,16)}function clampByte(n){return Number.isFinite(n)?Math.min(255,Math.max(0,Math.round(n))):null}function normalizeRgba(rgba){if(rgba.a>=1)return rgbToHex(rgba.r,rgba.g,rgba.b);let a=Math.round(rgba.a*1e3)/1e3;return`rgba(${rgba.r},${rgba.g},${rgba.b},${a})`}function rgbToHex(r,g,b){return`#${hex2(r)}${hex2(g)}${hex2(b)}`.toUpperCase()}function hex2(n){return n.toString(16).padStart(2,"0")}function brandedStatus(theme){let compiled=(theme.brightness==="dark"?EVERFUR_DARK:EVERFUR_LIGHT).color,c=theme.color,same=(a,b)=>parseColor(a)===parseColor(b);return{success:!same(c.success,compiled.success),warning:!same(c.warningStrong,compiled.warningStrong)||!same(c.cautionAccent,compiled.cautionAccent),info:!(same(c.info,c.brandInk)&&same(c.badgeBgInfo,c.brandSoft)&&same(c.infoEdge,c.structureEdge))}}function BrandImage({src:src,alt:alt,decorative:decorative=false,style:style,height:height,fallback:fallback=null,onFailed:onFailed}){let[failed,setFailed]=useState(null);return src===null||failed===src?fallback:/* @__PURE__ */jsx("img",{src:src,alt:decorative?"":alt,...decorative?{"aria-hidden":true}:{},...height===void 0?{}:{height:height},style:style,decoding:"async",referrerPolicy:"no-referrer",onError:()=>{setFailed(src),onFailed?.()}})}var LOGO_HEIGHT=28,LOGO_MAX_WIDTH=160,LOGO_STYLE=/* @__PURE__ */Object.freeze({display:"block",height:LOGO_HEIGHT,width:"auto",maxWidth:LOGO_MAX_WIDTH,objectFit:"contain"});function BrandLogo({logoUrl:logoUrl,name:name,styles:styles}){/* @__PURE__ */
|
|
114
|
+
return jsx(BrandImage,{src:logoUrl,alt:name,height:LOGO_HEIGHT,style:styles?.logo??LOGO_STYLE})}var SCREEN_HEADING_ATTR="data-ef-screen-heading";var MIN_SURFACE_HEIGHT=120,MIN_TOUCH_TARGET=44,BUTTON_HEIGHT=52,BACK_LABEL="Back";function useScreenStyles(){let theme=useEverfurTheme(),styles=useMemo(()=>makeScreenStyles(theme),[theme]);return{theme:theme,styles:styles}}function ScreenHeader({title:title,onBack:onBack,right:right,testID:testID,variant:variant="brand"}){let{theme:theme,styles:styles}=useScreenStyles();/* @__PURE__ */
|
|
115
|
+
return jsxs("header",{style:styles.headerRow,"data-testid":testID,children:[onBack?/* @__PURE__ */jsx("button",{type:"button",onClick:onBack,"aria-label":BACK_LABEL,style:{...styles.iconButton,...styles.headerText},"data-testid":testID?`${testID}-back`:void 0,children:/* @__PURE__ */jsx("span",{"aria-hidden":"true",style:styles.backChevron})}):/* @__PURE__ */jsx("span",{style:styles.iconButton}),title.trim().length>0?/* @__PURE__ */jsx("h2",{tabIndex:-1,[SCREEN_HEADING_ATTR]:"",style:variant==="document"?styles.documentTitle:styles.headerTitle,children:title}):/* @__PURE__ */jsx("span",{"aria-hidden":"true",style:styles.headerTitle,"data-testid":testID?`${testID}-spacer`:void 0}),
|
|
116
|
+
/* @__PURE__ */jsxs("div",{style:styles.headerRight,children:[variant==="brand"?/* @__PURE__ */jsx(BrandLogo,{logoUrl:theme.meta.logoUrl,name:theme.meta.displayName,styles:styles.headerLogo}):null,right??/* @__PURE__ */jsx("span",{style:styles.iconButton})]})]})}function makeScreenStyles(theme){let{color:color,space:space,radius:radius,type:type,slots:slots}=theme,lh=(size,multiplier)=>`${Math.round(size*multiplier)}px`,text=(size,multiplier,fg,weight="regular")=>({margin:0,...faceCss(theme,weight),fontSize:size,lineHeight:lh(size,multiplier),color:fg}),recordCard=recordCardSlot(slots),cardText=slotText(recordCard),headerInk=slots.header?.textColor??color.brandInk,bannerText=slotText(slots.banner),dialogText=slotText(slots.dialog),errorColor=theme.brightness==="dark"?color.errorRed:color.danger,tone=(bg,fg)=>({backgroundColor:bg,color:fg,border:"1.5px solid transparent"}),edge=(line,fg)=>({backgroundColor:color.surface,color:fg,border:`1.5px solid ${line}`}),cardEdge=`1px solid ${color.borderRingCream}`,button={boxSizing:"border-box",minHeight:BUTTON_HEIGHT,minWidth:MIN_TOUCH_TARGET,padding:`${space.md}px ${space.lg+space.xs/2}px`,borderRadius:radius.pill,...faceCss(theme,"bold"),fontSize:type.size.body,cursor:"pointer",display:"inline-flex",alignItems:"center",justifyContent:"center",gap:space.sm,textDecoration:"none"};return{chipTones:{neutral:edge(color.brandBorderStrong,color.text.primary),info:tone(color.brandSoft,color.brandInk),warning:edge(color.cautionAccent,color.text.primary),critical:edge(color.danger,color.danger),positive:edge(color.success,brandedStatus(theme).success?color.success:color.brandInk)},root:{...SURFACE_ROOT_RESET,boxSizing:"border-box",display:"flex",flexDirection:"column",minHeight:MIN_SURFACE_HEIGHT,height:"100%",backgroundColor:color.background,color:color.text.primary,...faceCss(theme,"regular")},body:{flex:"1 1 auto",minHeight:0,display:"flex",flexDirection:"column",overflowY:"auto"},content:{display:"flex",flexDirection:"column",gap:space.lg,padding:`0 ${space.lg}px ${space.xxl}px`},contentTight:{display:"flex",flexDirection:"column",gap:space.lg,padding:`0 ${space.sm}px ${space.xxl}px`},inset:{padding:`0 ${space.sm}px`},headerRow:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:space.sm,padding:`${space.xs}px ${space.lg}px ${space.md}px`,...slotCss(slots.header)},headerText:slotText(slots.header),headerSlot:slotCss(slots.header,1),headerInk:headerInk,headerLogo:{logo:{display:"block",height:28,width:"auto",maxWidth:96,objectFit:"contain",flexShrink:0}},pageLogo:{logo:{display:"block",height:28,width:"auto",maxWidth:160,objectFit:"contain",alignSelf:"flex-start"}},iconButton:{boxSizing:"border-box",width:MIN_TOUCH_TARGET,height:MIN_TOUCH_TARGET,display:"inline-flex",alignItems:"center",justifyContent:"center",border:0,background:"transparent",cursor:"pointer",padding:0,color:color.brandInk,flexShrink:0},backChevron:{display:"block",width:space.md,height:space.md,borderLeft:`2px solid ${headerInk}`,borderBottom:`2px solid ${headerInk}`,transform:"rotate(45deg)",marginLeft:space.xs},headerTitle:{...text(type.size.heading,type.lineHeight.tight,color.brandInk,"bold"),...headingFaceCss(theme,"bold"),flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",...slotText(slots.header)},documentTitle:{...text(type.size.subtitle,type.lineHeight.snug,color.text.primary,"bold"),...headingFaceCss(theme,"bold"),flex:1,textAlign:"center",...slotText(slots.header)},headerRight:{display:"flex",alignItems:"center",gap:space.sm+space.xs/2},section:{display:"flex",flexDirection:"column",gap:space.sm+space.xs/2},sectionHeader:{display:"flex",alignItems:"center",gap:space.sm,padding:`0 ${space.xs}px`},sectionTitle:{...text(type.size.subtitle,type.lineHeight.snug,color.text.primary,"bold"),...headingFaceCss(theme,"bold"),letterSpacing:"-0.02em"},sectionCount:{...text(type.size.bodyTight,type.lineHeight.snug,color.text.muted,"medium")},card:{boxSizing:"border-box",borderRadius:radius.lg,border:cardEdge,backgroundColor:color.surface,padding:`${space.xs}px ${space.lg}px`,margin:0,listStyle:"none",...slotBoxCss(recordCard,1)},creamCard:{boxSizing:"border-box",borderRadius:radius.lg,border:cardEdge,backgroundColor:color.surfaceCream,padding:space.lg,display:"flex",flexDirection:"column",gap:space.md,...slotBoxCss(recordCard,1)},cardSlot:slotBoxCss(recordCard,1),cardInk:cardText,row:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:space.md,padding:`${space.md}px 0`},rowDivider:{borderTop:`1px solid ${color.borderHairlineGreen}`},rowMain:{flex:1,minWidth:0},rowRight:{display:"flex",flexDirection:"column",alignItems:"flex-end",gap:space.xs+space.xs/2},rowTitle:{...text(type.size.body,type.lineHeight.snug,color.text.primary,"medium"),...cardText},rowDetail:{...text(type.size.caption,type.lineHeight.normal,color.text.secondary),marginTop:space.xs/2,...cardText},rowValue:{...text(type.size.body+1,type.lineHeight.snug,color.text.primary,"bold"),marginTop:space.xs/2,...cardText},rowMuted:{...text(type.size.caption,type.lineHeight.normal,color.text.muted),...cardText},chip:{boxSizing:"border-box",display:"inline-flex",alignItems:"center",minHeight:24,borderRadius:radius.pill,padding:`0 ${space.sm+space.xs/2}px`,...faceCss(theme,"monoBold"),fontSize:type.size.tiny+1,lineHeight:lh(type.size.tiny+1,type.lineHeight.snug),letterSpacing:"0.06em",textTransform:"uppercase",whiteSpace:"nowrap"},pill:button,pillPrimary:{border:0,backgroundColor:color.brand,color:color.onPrimary,...slotBoxCss(slots.primaryButton),...slotText(slots.primaryButton)},pillOutline:{border:`1.5px solid ${color.brandInk}`,backgroundColor:"transparent",color:color.brandInk},pillDanger:{border:`1.4px solid ${color.danger}`,backgroundColor:color.surface,color:color.danger,fontSize:type.size.bodyTight},pillAsk:{border:`1px solid ${color.borderRingCream}`,backgroundColor:color.surface,color:color.text.primary},pillLink:{minHeight:MIN_TOUCH_TARGET,border:0,backgroundColor:"transparent",color:color.linkInk,padding:`${space.sm}px`},pillDisabled:{opacity:.5,cursor:"default"},infoNote:{display:"flex",gap:space.sm,borderRadius:radius.md-space.xs/2,backgroundColor:color.brandSoft,padding:`${space.sm+space.xs/2}px ${space.md}px`,...text(type.size.bodyTight,type.lineHeight.normal,color.text.primary),...slotCss(slots.banner)},cautionNote:{display:"flex",gap:space.sm,borderRadius:radius.md-space.xs/2,backgroundColor:color.badgeBgCaution,padding:`${space.sm+space.xs/2}px ${space.md}px`,...text(type.size.bodyTight,type.lineHeight.normal,color.warningStrong)},statusCard:{borderRadius:radius.md,backgroundColor:color.brandSoft,padding:space.md+space.xs/2,...text(type.size.bodyTight,type.lineHeight.relaxed,color.text.primary)},errorBanner:{display:"flex",gap:space.sm,borderRadius:radius.md-space.xs/2,backgroundColor:color.badgeBgCritical,padding:space.md,...text(type.size.bodyTight,type.lineHeight.normal,errorColor)},errorText:text(type.size.bodyTight,type.lineHeight.normal,errorColor),band:{display:"flex",alignItems:"flex-start",gap:space.sm,borderRadius:radius.md-space.xs/2,padding:space.md,backgroundColor:color.brandSoft,margin:0,...slotCss(slots.banner)},bandText:{flex:1,...text(type.size.caption,type.lineHeight.normal,color.text.secondary),...bannerText},infoGlyph:{boxSizing:"border-box",flexShrink:0,width:space.md+space.xs/2,height:space.md+space.xs/2,borderRadius:radius.pill,border:`1px solid ${slots.banner?.textColor??color.text.secondary}`,display:"inline-flex",alignItems:"center",justifyContent:"center",...faceCss(theme,"bold"),fontSize:type.size.small,color:color.text.secondary,...bannerText},chevron:{display:"inline-block",width:space.sm,height:space.sm,borderTop:`2px solid ${color.text.muted}`,borderRight:`2px solid ${color.text.muted}`,flexShrink:0},chipSentence:{...faceCss(theme,"medium"),fontSize:type.size.caption,lineHeight:lh(type.size.caption,type.lineHeight.normal),letterSpacing:"normal",textTransform:"none",whiteSpace:"normal",borderRadius:radius.md,padding:`${space.xs}px ${space.sm+space.xs/2}px`},lead:{...text(type.size.body+1,type.lineHeight.snug,color.text.primary,"bold"),padding:`0 ${space.sm}px`},subLead:{...text(type.size.body,type.lineHeight.normal,color.text.muted),padding:`0 ${space.lg}px ${space.md}px`},field:{boxSizing:"border-box",display:"block",width:"100%",minHeight:MIN_TOUCH_TARGET,padding:`${space.sm}px ${space.md}px`,border:`1px solid ${color.borderHairlineGreen}`,borderRadius:radius.sm,color:color.text.primary,backgroundColor:color.surface,...faceCss(theme,"regular"),fontSize:type.size.body,...slotCss(slots.input,1)},inputSlot:slotCss(slots.input,1),inputText:slotText(slots.input),fieldLabel:{...text(type.size.bodyTight,type.lineHeight.normal,color.text.secondary,"medium"),display:"block",marginBottom:space.xs},muted:text(type.size.caption,type.lineHeight.normal,color.text.muted),bodyText:text(type.size.body,type.lineHeight.normal,color.text.primary),mono:faceCss(theme,"mono"),plainList:{listStyle:"none",margin:0,padding:0,display:"flex",flexDirection:"column"},dialogFrame:{boxSizing:"border-box",position:"fixed",top:0,right:0,bottom:0,left:0,width:"100%",height:"100%",maxWidth:"100%",maxHeight:"100%",margin:0,padding:0,border:0,backgroundColor:"transparent",overflow:"hidden"},dialogScrim:{boxSizing:"border-box",display:"flex",alignItems:"center",justifyContent:"center",width:"100%",height:"100%",padding:space.lg,backgroundColor:"rgba(0,0,0,0.4)"},dialogScrimSide:{boxSizing:"border-box",display:"flex",alignItems:"stretch",justifyContent:"flex-end",width:"100%",height:"100%",backgroundColor:"rgba(0,0,0,0.4)"},dialogPanel:{boxSizing:"border-box",width:"100%",maxWidth:560,maxHeight:"100%",overflowY:"auto",backgroundColor:color.surface,borderRadius:radius.xl-1,padding:`${space.lg}px ${space.lg+space.xs+space.xs/2}px`,display:"flex",flexDirection:"column",gap:space.md,...faceCss(theme,"regular"),color:color.text.primary},dialogPanelSide:{boxSizing:"border-box",width:"min(100vw, 480px)",height:"100%",maxHeight:"100%",overflowY:"auto",backgroundColor:color.surface,padding:`${space.lg}px ${space.lg+space.xs+space.xs/2}px`,display:"flex",flexDirection:"column",gap:space.md,...faceCss(theme,"regular"),color:color.text.primary},dialogSlot:slotCss(slots.dialog),dialogSlotSide:{...slotCss(slots.dialog),...slots.dialog?.borderRadius===void 0?null:{borderRadius:`${slots.dialog.borderRadius}px 0 0 ${slots.dialog.borderRadius}px`}},sheetHeader:{display:"flex",alignItems:"flex-start",justifyContent:"space-between",gap:space.sm},sheetTitle:{...text(type.size.heading,type.lineHeight.snug,color.text.primary,"bold"),...headingFaceCss(theme,"bold"),...dialogText},sheetHelper:{...text(type.size.bodyTight,type.lineHeight.normal,color.text.muted),...dialogText},closeGlyph:{fontSize:type.size.verdict,lineHeight:1,color:color.text.primary,...dialogText}}}var RECORDS_EMPTY_COPY=/* @__PURE__ */Object.freeze({idle:/* @__PURE__ */Object.freeze({title:"Find your pet’s clinic",body:"Search for the clinic that holds your pet’s records. We’ll request them on your behalf once you sign the authorization.",action:null}),no_requests:/* @__PURE__ */Object.freeze({title:"No record requests yet",body:"When you request records from a clinic, you’ll be able to track every step here.",action:null}),no_records:/* @__PURE__ */Object.freeze({title:"Nothing to show just yet",body:"Once your pet’s records arrive and our team reviews them, lab trends and visits will appear here.",action:null}),rate_limited:/* @__PURE__ */Object.freeze({title:"Slow down a moment",body:"You’ve made a lot of requests just now. You can try again shortly.",action:"Try again"}),service_unavailable:/* @__PURE__ */Object.freeze({title:"Records search is temporarily down",body:"We’re working on it. Please try again in a few minutes.",action:"Try again"}),error:/* @__PURE__ */Object.freeze({title:"Couldn’t reach Everfur",body:"Check your connection and try again.",action:"Try again"})}),RATE_LIMIT_COOLDOWN_S=60;function coolingActionLabel(seconds){return`Try again in ${seconds}s`}var COOLING_A11Y_LABEL="Try again, available shortly";function SkeletonBlock({width:width,height:height,radius:radius,style:style}){let{color:color,radius:radii}=useEverfurTheme();/* @__PURE__ */
|
|
116
117
|
return jsx("span",{"aria-hidden":"true",style:{display:"block",width:width,height:height,borderRadius:radius??radii.xs,backgroundColor:color.skeleton,flexShrink:0,...style}})}var DISCLAIMER_H=44,TIMELINE_SEPARATOR_INSET=62;function TimelineSkeleton({testID:testID}){let s=useStyles();/* @__PURE__ */
|
|
117
118
|
return jsxs("div",{role:"progressbar","aria-label":DEPTH_COPY.loadingTimeline,"aria-busy":"true",style:s.timeline,"data-testid":testID,children:[
|
|
118
119
|
/* @__PURE__ */jsx("div",{style:s.timelineDisclaimer,children:/* @__PURE__ */jsx(SkeletonBlock,{width:"100%",height:DISCLAIMER_H,radius:12})}),Array.from({length:6},(_,index)=>/* @__PURE__ */jsxs("div",{children:[index>0?/* @__PURE__ */jsx("div",{style:s.timelineSeparator}):null,
|
|
@@ -126,7 +127,7 @@ return jsxs("div",{role:"progressbar","aria-label":DEPTH_COPY.loadingTimeline,"a
|
|
|
126
127
|
return jsxs("section",{role:"status",style:s.empty,"data-testid":testID,children:[
|
|
127
128
|
/* @__PURE__ */jsx("span",{"aria-hidden":"true",style:s.emptyGlyph}),
|
|
128
129
|
/* @__PURE__ */jsx("h3",{style:s.emptyTitle,children:copy.title}),
|
|
129
|
-
/* @__PURE__ */jsx("p",{style:s.emptyBody,children:message??copy.body}),label!==null&&onAction?/* @__PURE__ */jsx("button",{type:"button",onClick:onAction,disabled:cooling,"aria-label":cooling?COOLING_A11Y_LABEL:label,style:{...s.emptyAction,...cooling?s.emptyActionDisabled:{}},"data-testid":testID?`${testID}-action`:`records-empty-${variant}-action`,children:label}):null]})}function useStyles(){let theme=useEverfurTheme();return useMemo(()=>makeStyles2(theme),[theme])}function makeStyles2(theme){let{color:color,space:space,radius:radius,type:type}=theme,hairline=`1px solid ${color.brandBorder}`;return{dashboard:{display:"flex",flexDirection:"column",gap:space.lg,padding:`${space.xs}px ${space.sm}px 0`,backgroundColor:color.background},inset:{padding:`0 ${space.sm}px`},summaryCard:{display:"flex",flexDirection:"column",alignItems:"center",gap:space.md+space.xs/2,borderRadius:radius.lg-space.xs,border:hairline,backgroundColor:color.surface,padding:`${space.lg+space.xs}px ${space.lg}px`},badges:{display:"flex",gap:space.md},carouselCard:{borderRadius:radius.lg-space.xs,border:hairline,backgroundColor:color.surface,padding:space.lg},dots:{display:"flex",alignItems:"center",justifyContent:"center",gap:space.xs+space.xs/2},centered:{display:"flex",justifyContent:"center"},actions:{display:"flex",flexDirection:"column",gap:space.sm+space.xs/2},actionRow:{display:"flex",alignItems:"center",justifyContent:"space-between",borderRadius:radius.md,border:hairline,backgroundColor:color.surface,padding:space.lg},actionLeft:{flex:1,display:"flex",alignItems:"center",gap:space.md},request:{display:"flex",flexDirection:"column",gap:space.lg+space.xs/2,padding:`${space.xs}px ${space.lg}px 0`},railRow:{display:"flex",alignItems:"flex-start",gap:space.md},railColumn:{display:"flex",flexDirection:"column",alignItems:"center",gap:space.xs/2,width:24},railBody:{flex:1,display:"flex",flexDirection:"column",gap:space.xs+space.xs/2,paddingBottom:space.lg+space.xs/2},statusCard:{display:"flex",flexDirection:"column",gap:space.sm,borderRadius:radius.md,backgroundColor:color.brandSoft,padding:space.md+space.xs/2},timeline:{backgroundColor:color.background},timelineDisclaimer:{padding:`${space.xs}px ${space.lg}px ${space.md}px`},timelineRow:{display:"flex",gap:space.md,padding:`${space.md+space.xs/2}px ${space.lg}px`},timelineBody:{flex:1,display:"flex",flexDirection:"column",gap:space.xs-1},timelineTop:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:space.sm},timelineSeparator:{height:1,backgroundColor:color.brandBorder,marginLeft:TIMELINE_SEPARATOR_INSET},clinics:{display:"flex",flexDirection:"column",gap:space.md},clinicRow:{display:"flex",flexDirection:"column",gap:space.sm,borderRadius:radius.lg-space.xs/2,border:hairline,backgroundColor:color.surface,padding:`${space.md+space.xs/2}px`},shares:{display:"flex",flexDirection:"column",gap:space.md,padding:space.md,borderRadius:radius.md,backgroundColor:color.surfaceCream,border:hairline},shareRow:{display:"flex",flexDirection:"column",gap:space.xs+space.xs/2},empty:{display:"flex",flexDirection:"column",alignItems:"center",gap:space.sm+space.xs/2,padding:`${space.xxl}px ${space.xl}px`,textAlign:"center"},emptyGlyph:{boxSizing:"border-box",width:22,height:22,borderRadius:11,backgroundColor:color.brandSoft,border:hairline,marginBottom:space.xs},emptyTitle:{margin:0,...
|
|
130
|
+
/* @__PURE__ */jsx("p",{style:s.emptyBody,children:message??copy.body}),label!==null&&onAction?/* @__PURE__ */jsx("button",{type:"button",onClick:onAction,disabled:cooling,"aria-label":cooling?COOLING_A11Y_LABEL:label,style:{...s.emptyAction,...cooling?s.emptyActionDisabled:{}},"data-testid":testID?`${testID}-action`:`records-empty-${variant}-action`,children:label}):null]})}function useStyles(){let theme=useEverfurTheme();return useMemo(()=>makeStyles2(theme),[theme])}function makeStyles2(theme){let{color:color,space:space,radius:radius,type:type}=theme,hairline=`1px solid ${color.brandBorder}`;return{dashboard:{display:"flex",flexDirection:"column",gap:space.lg,padding:`${space.xs}px ${space.sm}px 0`,backgroundColor:color.background},inset:{padding:`0 ${space.sm}px`},summaryCard:{display:"flex",flexDirection:"column",alignItems:"center",gap:space.md+space.xs/2,borderRadius:radius.lg-space.xs,border:hairline,backgroundColor:color.surface,padding:`${space.lg+space.xs}px ${space.lg}px`},badges:{display:"flex",gap:space.md},carouselCard:{borderRadius:radius.lg-space.xs,border:hairline,backgroundColor:color.surface,padding:space.lg},dots:{display:"flex",alignItems:"center",justifyContent:"center",gap:space.xs+space.xs/2},centered:{display:"flex",justifyContent:"center"},actions:{display:"flex",flexDirection:"column",gap:space.sm+space.xs/2},actionRow:{display:"flex",alignItems:"center",justifyContent:"space-between",borderRadius:radius.md,border:hairline,backgroundColor:color.surface,padding:space.lg},actionLeft:{flex:1,display:"flex",alignItems:"center",gap:space.md},request:{display:"flex",flexDirection:"column",gap:space.lg+space.xs/2,padding:`${space.xs}px ${space.lg}px 0`},railRow:{display:"flex",alignItems:"flex-start",gap:space.md},railColumn:{display:"flex",flexDirection:"column",alignItems:"center",gap:space.xs/2,width:24},railBody:{flex:1,display:"flex",flexDirection:"column",gap:space.xs+space.xs/2,paddingBottom:space.lg+space.xs/2},statusCard:{display:"flex",flexDirection:"column",gap:space.sm,borderRadius:radius.md,backgroundColor:color.brandSoft,padding:space.md+space.xs/2},timeline:{backgroundColor:color.background},timelineDisclaimer:{padding:`${space.xs}px ${space.lg}px ${space.md}px`},timelineRow:{display:"flex",gap:space.md,padding:`${space.md+space.xs/2}px ${space.lg}px`},timelineBody:{flex:1,display:"flex",flexDirection:"column",gap:space.xs-1},timelineTop:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:space.sm},timelineSeparator:{height:1,backgroundColor:color.brandBorder,marginLeft:TIMELINE_SEPARATOR_INSET},clinics:{display:"flex",flexDirection:"column",gap:space.md},clinicRow:{display:"flex",flexDirection:"column",gap:space.sm,borderRadius:radius.lg-space.xs/2,border:hairline,backgroundColor:color.surface,padding:`${space.md+space.xs/2}px`},shares:{display:"flex",flexDirection:"column",gap:space.md,padding:space.md,borderRadius:radius.md,backgroundColor:color.surfaceCream,border:hairline},shareRow:{display:"flex",flexDirection:"column",gap:space.xs+space.xs/2},empty:{display:"flex",flexDirection:"column",alignItems:"center",gap:space.sm+space.xs/2,padding:`${space.xxl}px ${space.xl}px`,textAlign:"center"},emptyGlyph:{boxSizing:"border-box",width:22,height:22,borderRadius:11,backgroundColor:color.brandSoft,border:hairline,marginBottom:space.xs},emptyTitle:{margin:0,...headingFaceCss(theme,"bold"),fontSize:type.size.subtitle,lineHeight:`${Math.round(type.size.subtitle*type.lineHeight.snug)-1}px`,color:color.brandInk},emptyBody:{margin:0,...faceCss(theme,"regular"),fontSize:type.size.bodyTight,lineHeight:`${Math.round(type.size.bodyTight*type.lineHeight.normal)}px`,color:color.text.muted,maxWidth:320},emptyAction:{boxSizing:"border-box",marginTop:space.sm,minHeight:40,borderRadius:radius.pill,padding:`0 ${space.lg+space.xs/2}px`,backgroundColor:color.brand,color:color.onPrimary,border:0,cursor:"pointer",...faceCss(theme,"bold"),fontSize:type.size.bodyTight},emptyActionDisabled:{opacity:.5,cursor:"default"}}}var SPINNER_DELAY_MS=300,MIN_SURFACE_HEIGHT2=120,MIN_TOUCH_TARGET2=44,readTimeline=(client,petRef)=>client.getTimeline(petRef),timelineEmpty=value=>value.isEmpty,readDepth=(client,petRef)=>client.getRecordDepth(petRef),depthEmpty=value=>!value.available||value.labResults.length+value.encounters.length+value.clinicianNotes.length+value.physicalExams.length===0,contributionsEmpty=value=>value.contributions.length===0;function EverfurRecordsTimeline({petRef:petRef,style:style,className:className,onBack:onBack}){let state=useRecordsDepthRead(petRef,readTimeline,timelineEmpty);/* @__PURE__ */
|
|
130
131
|
return jsx(DepthSurface,{state:state,style:style,className:className,onBack:onBack,header:/* @__PURE__ */jsx(ScreenHeader,{title:DEPTH_COPY.timeline,onBack:guardHost(onBack),testID:"timeline-header"}),loading:/* @__PURE__ */jsx(TimelineSkeleton,{testID:"timeline-loading"}),empty:/* @__PURE__ */jsx(RecordsEmptyState,{variant:"no_records",testID:"timeline-empty"}),render:timeline=>/* @__PURE__ */jsx(TimelineBody,{timeline:timeline})})}function EverfurRecordDepth({petRef:petRef,style:style,className:className,onBack:onBack}){let state=useRecordsDepthRead(petRef,readDepth,depthEmpty);/* @__PURE__ */
|
|
131
132
|
return jsx(DepthSurface,{state:state,style:style,className:className,onBack:onBack,header:onBack?/* @__PURE__ */jsx(ScreenHeader,{title:RECORDS_COPY.records,onBack:guardHost(onBack)}):null,render:depth=>/* @__PURE__ */jsx(DepthBody,{depth:depth})})}function EverfurDocumentContributions({petRef:petRef,docId:docId,style:style,className:className,onBack:onBack}){let read=useCallback((client,pet)=>client.getDocumentContributions(pet,docId),[docId]),state=useRecordsDepthRead(petRef,read,contributionsEmpty,docId),title=state.value?.document?.title?.trim()||DEPTH_COPY.uploadedDocument;/* @__PURE__ */
|
|
132
133
|
return jsx(DepthSurface,{state:state,style:style,className:className,onBack:onBack,header:/* @__PURE__ */jsx(ScreenHeader,{title:title,onBack:guardHost(onBack),testID:"contributions-header"}),empty:/* @__PURE__ */jsx(RecordsEmptyState,{variant:"no_records",testID:"contributions-empty"}),render:view=>/* @__PURE__ */jsx(ContributionsBody,{view:view})})}function DepthSurface({state:state,style:style,className:className,header:header,loading:loading,empty:empty,render:render,onBack:onBack}){let{styles:styles}=useDepthTheme(),{userRef:userRef}=useEverfurContext();/* @__PURE__ */
|
|
@@ -166,4 +167,4 @@ return jsxs("li",{style:styles.row,children:[
|
|
|
166
167
|
return jsxs("section",{"aria-label":RECORDS_COPY.records,style:styles.list,children:[view.document?.receivedAt?/* @__PURE__ */jsx("p",{style:styles.rowDetail,children:formatRecordsDate(view.document.receivedAt)}):null,
|
|
167
168
|
/* @__PURE__ */jsx("dl",{style:styles.card,children:view.contributions.map(entity=>/* @__PURE__ */jsxs("div",{style:styles.row,children:[
|
|
168
169
|
/* @__PURE__ */jsx("dt",{style:styles.rowTitle,children:entity.label}),
|
|
169
|
-
/* @__PURE__ */jsx("dd",{style:styles.rowValue,children:formatEntityValue(entity.value,entity.unit)}),entity.observedAt?/* @__PURE__ */jsx("dd",{style:styles.rowDetail,children:formatRecordsDate(entity.observedAt)}):null]},entity.key))})]})}function useDepthTheme(){let theme=useEverfurTheme(),styles=useMemo(()=>makeStyles3(theme),[theme]);return{theme:theme,styles:styles}}function makeStyles3(theme){let{color:color,space:space,radius:radius,type:type,slots:slots}=theme,lh=(size,multiplier)=>`${Math.round(size*multiplier)}px`,text=(size,multiplier,fg,weight="regular")=>({margin:0,...faceCss(theme,weight),fontSize:size,lineHeight:lh(size,multiplier),color:fg}),cardText=slotText(
|
|
170
|
+
/* @__PURE__ */jsx("dd",{style:styles.rowValue,children:formatEntityValue(entity.value,entity.unit)}),entity.observedAt?/* @__PURE__ */jsx("dd",{style:styles.rowDetail,children:formatRecordsDate(entity.observedAt)}):null]},entity.key))})]})}function useDepthTheme(){let theme=useEverfurTheme(),styles=useMemo(()=>makeStyles3(theme),[theme]);return{theme:theme,styles:styles}}function makeStyles3(theme){let{color:color,space:space,radius:radius,type:type,slots:slots}=theme,lh=(size,multiplier)=>`${Math.round(size*multiplier)}px`,text=(size,multiplier,fg,weight="regular")=>({margin:0,...faceCss(theme,weight),fontSize:size,lineHeight:lh(size,multiplier),color:fg}),recordCard=recordCardSlot(slots),cardText=slotText(recordCard),inCard=(size,multiplier,fg,weight="regular")=>({...text(size,multiplier,fg,weight),...cardText}),hairline=`1px solid ${color.brandBorder}`,errorColor=theme.brightness==="dark"?color.errorRed:color.danger;return{container:{boxSizing:"border-box",display:"flex",flexDirection:"column",minHeight:MIN_SURFACE_HEIGHT2,height:"100%",backgroundColor:color.background,color:color.text.primary,...faceCss(theme,"regular")},body:{flex:"1 1 auto",minHeight:0,display:"flex",flexDirection:"column",overflowY:"auto"},centered:{boxSizing:"border-box",flex:"1 1 auto",minHeight:MIN_SURFACE_HEIGHT2,display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:space.lg,padding:space.xl,textAlign:"center"},spinner:{boxSizing:"border-box",width:24,height:24,borderRadius:radius.pill,border:`3px solid ${color.brandSofter}`,borderTopColor:color.brandInk},emptyGlyph:{boxSizing:"border-box",width:40,height:40,borderRadius:radius.lg,backgroundColor:color.brandSoft,border:hairline},alertText:text(type.size.subtitle,type.lineHeight.snug,color.text.secondary),errorText:text(type.size.subtitle,type.lineHeight.snug,errorColor),primaryButton:{boxSizing:"border-box",minHeight:MIN_TOUCH_TARGET2,minWidth:MIN_TOUCH_TARGET2,padding:`${space.md}px ${space.xl}px`,borderRadius:radius.pill,...faceCss(theme,"bold"),fontSize:type.size.body,border:0,cursor:"pointer",backgroundColor:color.primary,color:color.onPrimary,...slotBoxCss(slots.primaryButton),...slotText(slots.primaryButton)},list:{display:"flex",flexDirection:"column",gap:space.md,padding:space.lg},section:{display:"flex",flexDirection:"column",gap:space.sm},heading:{...text(type.size.heading,type.lineHeight.snug,color.text.primary,"bold"),...headingFaceCss(theme,"bold")},card:{boxSizing:"border-box",listStyle:"none",display:"flex",flexDirection:"column",gap:space.sm,margin:0,padding:space.md,borderRadius:radius.md,backgroundColor:color.surfaceCream,border:hairline,...slotBoxCss(recordCard,1)},plainList:{listStyle:"none",margin:0,padding:0,display:"flex",flexDirection:"column",gap:space.sm},row:{display:"flex",flexDirection:"column",gap:space.xs,padding:`${space.xs}px 0`,borderBottom:`1px solid ${color.borderHairlineGreen}`},topLine:{display:"flex",justifyContent:"space-between",gap:space.md},kindLabel:{...inCard(type.size.caption,type.lineHeight.normal,color.text.muted,"medium")},date:inCard(type.size.caption,type.lineHeight.normal,color.text.muted),rowTitle:{...inCard(type.size.body,type.lineHeight.normal,color.text.primary,"bold")},rowValue:{...inCard(type.size.body,type.lineHeight.normal,color.text.primary,"medium")},rowDetail:inCard(type.size.bodyTight,type.lineHeight.normal,color.text.muted),rowMuted:{...inCard(type.size.bodyTight,type.lineHeight.normal,color.text.muted),opacity:.7},chip:{...text(type.size.caption,type.lineHeight.normal,color.text.primary),alignSelf:"flex-start",padding:`${space.xs}px ${space.sm}px`,borderRadius:radius.pill},chipNeutral:{backgroundColor:color.badgeBgNeutral},chipCaution:{backgroundColor:color.badgeBgCaution},chipCritical:{backgroundColor:color.badgeBgCritical},disclaimer:text(type.size.caption,type.lineHeight.normal,color.text.muted),timelineList:{display:"flex",flexDirection:"column",paddingBottom:space.xxl},timelineBand:{...text(type.size.caption,type.lineHeight.normal,color.text.secondary),borderRadius:radius.md-space.xs/2,padding:space.md,backgroundColor:color.brandSoft,margin:`${space.xs}px ${space.lg}px ${space.md}px`,...slotCss(slots.banner)},timelineSeparated:{borderTop:`1px solid ${color.brandBorder}`,marginLeft:TIMELINE_SEPARATOR_INSET,paddingLeft:0},timelineRow:{display:"flex",gap:space.md,padding:`${space.md+space.xs/2}px ${space.lg}px`},timelineBubble:{boxSizing:"border-box",flexShrink:0,width:34,height:34,borderRadius:radius.pill,backgroundColor:color.brandSoft,border:hairline},timelineBody:{flex:1,display:"flex",flexDirection:"column",gap:space.xs-1,minWidth:0},timelineKind:{...faceCss(theme,"mono"),fontSize:type.size.micro,lineHeight:`${type.size.bodyTight}px`,letterSpacing:type.letterSpacing.eyebrow/3,textTransform:"uppercase",color:color.text.secondary},timelineTitle:{...text(type.size.body,type.lineHeight.normal,color.text.primary,"medium")}}}export{EverfurDocumentContributions,EverfurRecordDepth,EverfurRecordsTimeline,buildTimelineRows,mapDocumentContributions,mapRecordDepth,mapRecordsTimeline,useEverfurRecordsDepthClient,useRecordsDepthRead};
|