@everfur/sdk 0.17.0 → 0.18.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +167 -26
- package/care/package.json +8 -0
- package/dist/{Chat.d-uETscjrL.d.ts → Chat.d-Bz4iJ7d2.d.ts} +1 -1
- package/dist/{Chat.d-BYY1U61e.d.cts → Chat.d-C2ddC2u7.d.cts} +1 -1
- package/dist/{DepthViews.d-BsZ73mzL.d.ts → DepthViews.d-C6-Kzs6H.d.ts} +1 -1
- package/dist/{DepthViews.d-D_Qp4glO.d.cts → DepthViews.d-Chjs8H9V.d.cts} +1 -1
- package/dist/{DepthViews.d-DL8MP_kA.d.cts → DepthViews.d-pFL_ZBZT.d.cts} +1 -1
- package/dist/{DepthViews.d-B4SE5GUD.d.ts → DepthViews.d-qXt9OMgz.d.ts} +1 -1
- package/dist/{RecordsPage.d-CYotk2R9.d.cts → RecordsPage.d-Cmny6Q7g.d.cts} +2 -2
- package/dist/{RecordsPage.d-D4gP4leq.d.ts → RecordsPage.d-sNRolVdy.d.ts} +2 -2
- package/dist/animations/index.d.cts +5 -5
- package/dist/animations/index.d.ts +5 -5
- package/dist/{appStateLifecycle.d-DJXdDOJY.d.cts → appStateLifecycle.d-Bt70TQog.d.cts} +7 -7
- package/dist/{appStateLifecycle.d-CXJzBS3c.d.ts → appStateLifecycle.d-Jdg9_PFt.d.ts} +7 -7
- package/dist/{attachments.d-B8kOCb6q.d.cts → attachments.d-BVp3r6Ms.d.cts} +5 -5
- package/dist/{attachments.d-C61URT8r.d.cts → attachments.d-CF4_n-DZ.d.cts} +2 -2
- package/dist/{attachments.d-BTIGzXWD.d.ts → attachments.d-DnSCMjH0.d.ts} +5 -5
- package/dist/{attachments.d-BgatKf7d.d.ts → attachments.d-DsUZpMad.d.ts} +2 -2
- package/dist/{bookingCopy.d-B-bSYgqS.d.cts → bookingCopy.d-BHqE9Ozq.d.cts} +16 -16
- package/dist/{bookingCopy.d-JQW2SLM-.d.ts → bookingCopy.d-Ca4AQGZ7.d.ts} +16 -16
- package/dist/{branding.d-Bbc6p1XY.d.cts → branding.d-BFauULV6.d.cts} +1 -1
- package/dist/{branding.d-y6c0UwhE.d.ts → branding.d-DpNGEdDL.d.ts} +1 -1
- package/dist/care/index.cjs +3 -0
- package/dist/care/index.d.cts +434 -0
- package/dist/care/index.d.ts +434 -0
- package/dist/care/index.js +3 -0
- package/dist/{casesRepository.d-CVG2EXcg.d.cts → casesRepository.d-DFwD2kiS.d.cts} +1 -1
- package/dist/{casesRepository.d-CHEjzT4h.d.ts → casesRepository.d-VzxEyq2N.d.ts} +1 -1
- package/dist/chat/index.cjs +14 -13
- package/dist/chat/index.d.cts +13 -13
- package/dist/chat/index.d.ts +13 -13
- package/dist/chat/index.js +14 -13
- package/dist/chat/lite/index.cjs +14 -13
- package/dist/chat/lite/index.d.cts +13 -13
- package/dist/chat/lite/index.d.ts +13 -13
- package/dist/chat/lite/index.js +14 -13
- package/dist/chunk-Y3Q4GW47.js +31 -0
- package/dist/client/index.cjs +1 -1
- package/dist/client/index.d.cts +10 -10
- package/dist/client/index.d.ts +10 -10
- package/dist/client/index.js +1 -1
- package/dist/{clinicBatch.d-DdlFy4pD.d.cts → clinicBatch.d-CLqaih2C.d.cts} +2 -2
- package/dist/{clinicBatch.d-oNwH_dbI.d.ts → clinicBatch.d-DXDIL1lC.d.ts} +2 -2
- package/dist/{config.d-Cy_hJBJG.d.cts → config.d-7bCXvOGn.d.cts} +1 -1
- package/dist/{config.d-DopRLD4f.d.ts → config.d-cqyvpzDb.d.ts} +1 -1
- package/dist/consent/index.d.cts +5 -5
- package/dist/consent/index.d.ts +5 -5
- package/dist/{context.d-C42juGn6.d.cts → context.d-BeRanUXQ.d.cts} +7 -7
- package/dist/{context.d-Ban-Hhqu.d.ts → context.d-DAnmDYGr.d.ts} +7 -7
- package/dist/{copy.d-BTS5l6Ri.d.cts → copy.d-BPqs8swm.d.cts} +2 -2
- package/dist/{copy.d-qdbygul9.d.ts → copy.d-CxFzeuvo.d.ts} +2 -2
- package/dist/core/index.cjs +1 -1
- package/dist/core/index.d.cts +17 -17
- package/dist/core/index.d.ts +17 -17
- package/dist/core/index.js +1 -1
- package/dist/{depth.d-BGkHm2Se.d.ts → depth.d-C6XbnFig.d.ts} +2 -2
- package/dist/{depth.d-BfVrhq9o.d.cts → depth.d-qHdXHDd-.d.cts} +2 -2
- package/dist/{entitlementRepository.d-npT7L_7_.d.cts → entitlementRepository.d-C6uTDswj.d.cts} +4 -4
- package/dist/{entitlementRepository.d-CjwqCyhS.d.ts → entitlementRepository.d-D_cc7g4l.d.ts} +4 -4
- package/dist/{focus.d-S0nq_k1A.d.ts → focus.d-DiWvQR2j.d.ts} +193 -21
- package/dist/{focus.d-DS7Ze1Pp.d.cts → focus.d-HSkMHd-i.d.cts} +193 -21
- package/dist/health-plan/index.cjs +261 -176
- package/dist/health-plan/index.d.cts +627 -19
- package/dist/health-plan/index.d.ts +627 -19
- package/dist/health-plan/index.js +261 -176
- package/dist/{idempotency.d-COIrwuCb.d.ts → idempotency.d-CF5AvlYp.d.ts} +18 -639
- package/dist/{idempotency.d-gfiN4Qnp.d.cts → idempotency.d-DrO2zEZO.d.cts} +18 -639
- package/dist/{identity.d-D76vXtkJ.d.cts → identity.d-84x0dV7-.d.cts} +1 -1
- package/dist/{identity.d-B3mFvvRq.d.ts → identity.d-BXztMVYM.d.ts} +1 -1
- package/dist/index.cjs +12 -11
- package/dist/index.d.cts +21 -21
- package/dist/index.d.ts +21 -21
- package/dist/index.js +12 -11
- package/dist/{introEvents.d-3FLEemX3.d.cts → introEvents.d-Cwv72ER-.d.cts} +11 -11
- package/dist/{introEvents.d-BYnr37bd.d.ts → introEvents.d-DYU3znJs.d.ts} +11 -11
- package/dist/notifications/index.d.cts +4 -4
- package/dist/notifications/index.d.ts +4 -4
- package/dist/omsErrors.d-VF5tnr20.d.cts +633 -0
- package/dist/omsErrors.d-VF5tnr20.d.ts +633 -0
- package/dist/omsFields.d-BHntKIAH.d.cts +153 -0
- package/dist/omsFields.d-Cvfw8wWU.d.ts +153 -0
- package/dist/{optInView.d-DXRUGDiD.d.cts → optInView.d-4Hl4HbQh.d.cts} +3 -3
- package/dist/{optInView.d-BqFMcum4.d.ts → optInView.d-pq8tUTf6.d.ts} +3 -3
- package/dist/{parse.d-CY22hFxb.d.ts → parse.d-BJhhYfkv.d.ts} +1 -1
- package/dist/{parse.d-rvA_aRSO.d.cts → parse.d-D0v06qxx.d.cts} +1 -1
- package/dist/{pets.d-Cicz-aIO.d.ts → pets.d-1_CHpfgB.d.ts} +1 -1
- package/dist/{pets.d-RoHTZsaV.d.cts → pets.d-C4n-MDC4.d.cts} +1 -1
- package/dist/{petsRepository.d-DtAZf_Ja.d.ts → petsRepository.d-BuomdFjZ.d.ts} +1 -1
- package/dist/{petsRepository.d-BxMyt6Aj.d.cts → petsRepository.d-Dd95xh-M.d.cts} +1 -1
- package/dist/{ports.d-D7cjFUoL.d.cts → ports.d-Bf3tp7Pn.d.cts} +4 -4
- package/dist/{ports.d-DrgKa73F.d.ts → ports.d-ChZHFd-q.d.ts} +4 -4
- package/dist/{presentation.d-vy8kTGfR.d.cts → presentation.d-Bs8xQ4gD.d.cts} +4 -4
- package/dist/{presentation.d-vy8kTGfR.d.ts → presentation.d-Bs8xQ4gD.d.ts} +4 -4
- package/dist/records/depth/index.d.cts +9 -9
- package/dist/records/depth/index.d.ts +9 -9
- package/dist/records/index.cjs +11 -10
- package/dist/records/index.d.cts +24 -23
- package/dist/records/index.d.ts +24 -23
- package/dist/records/index.js +11 -10
- package/dist/{requestFunnel.d-BdQf53zs.d.cts → requestFunnel.d-CWI2pD3V.d.cts} +2 -2
- package/dist/{requestFunnel.d-B5y7Py8Z.d.ts → requestFunnel.d-DcQIAs45.d.ts} +2 -2
- package/dist/{resolve.d-CoQWUy1Y.d.cts → resolve.d-BTC3b6FW.d.cts} +1 -1
- package/dist/{resolve.d-CoQWUy1Y.d.ts → resolve.d-BTC3b6FW.d.ts} +1 -1
- package/dist/{runtimeTypes.d-r4Q5vASZ.d.cts → runtimeTypes.d-CIOVzjEK.d.cts} +6 -6
- package/dist/{runtimeTypes.d-D5EDgS3Y.d.ts → runtimeTypes.d-rbuONrIv.d.ts} +6 -6
- package/dist/{screenProps.d-v4a4kzxA.d.cts → screenProps.d-CFZe27oI.d.cts} +1 -1
- package/dist/{screenProps.d-KLCrP43b.d.ts → screenProps.d-yUA4k6yK.d.ts} +1 -1
- package/dist/server/events/index.cjs +2 -2
- package/dist/server/events/index.d.cts +49 -6
- package/dist/server/events/index.d.ts +49 -6
- package/dist/server/events/index.js +2 -2
- 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/shop/index.cjs +6 -6
- package/dist/shop/index.d.cts +9 -8
- package/dist/shop/index.d.ts +9 -8
- package/dist/shop/index.js +6 -6
- package/dist/shop/orders-v2/index.d.cts +2 -2
- package/dist/shop/orders-v2/index.d.ts +2 -2
- package/dist/tabs/index.cjs +4 -4
- package/dist/tabs/index.d.cts +14 -14
- package/dist/tabs/index.d.ts +14 -14
- package/dist/tabs/index.js +4 -4
- package/dist/{tabsModel.d-B7QMug1u.d.ts → tabsModel.d-D9GWPFrL.d.cts} +1 -1
- package/dist/{tabsModel.d-B7QMug1u.d.cts → tabsModel.d-D9GWPFrL.d.ts} +1 -1
- package/dist/televet/booking/index.d.cts +6 -6
- package/dist/televet/booking/index.d.ts +6 -6
- package/dist/testing/index.cjs +1 -1
- package/dist/testing/index.d.cts +85 -2
- package/dist/testing/index.d.ts +85 -2
- package/dist/testing/index.js +1 -1
- package/dist/testing/rn/index.d.cts +10 -10
- package/dist/testing/rn/index.d.ts +10 -10
- package/dist/testing/web/index.d.cts +10 -10
- package/dist/testing/web/index.d.ts +10 -10
- package/dist/texting/index.d.cts +6 -6
- package/dist/texting/index.d.ts +6 -6
- package/dist/{threadOptions.d-EFJaNBP1.d.cts → threadOptions.d-CRbFXnlq.d.cts} +66 -11
- package/dist/{threadOptions.d-GPJPprkn.d.cts → threadOptions.d-CW51PyVd.d.cts} +28 -1
- package/dist/{threadOptions.d-GPJPprkn.d.ts → threadOptions.d-CW51PyVd.d.ts} +28 -1
- package/dist/{threadOptions.d-B0folrKm.d.cts → threadOptions.d-U5YBUKM-.d.ts} +2 -2
- package/dist/{threadOptions.d-Crh_LiDe.d.ts → threadOptions.d-aK8FkszA.d.ts} +66 -11
- package/dist/{threadOptions.d-DTsJFkL-.d.ts → threadOptions.d-bEAFkIsC.d.cts} +2 -2
- package/dist/{timelineRows.d-DpSis9HR.d.ts → timelineRows.d-BbCLvjy1.d.ts} +1 -1
- package/dist/{timelineRows.d-6-Cw8xGd.d.cts → timelineRows.d-BvA_BoOe.d.cts} +1 -1
- package/dist/{typeStyle.d-B3Kdtjie.d.ts → typeStyle.d-B9Jo5mDX.d.ts} +1 -1
- package/dist/{typeStyle.d-DmlwyJq-.d.cts → typeStyle.d-Ckdh_S-t.d.cts} +1 -1
- package/dist/types.d-d3RdaeAA.d.cts +317 -0
- package/dist/types.d-d3RdaeAA.d.ts +317 -0
- package/dist/ui/index.cjs +68 -0
- package/dist/ui/index.d.cts +73 -0
- package/dist/ui/index.d.ts +73 -0
- package/dist/ui/index.js +68 -0
- package/dist/useHealthPlanSubscription.d-BN40CVK6.d.cts +756 -0
- package/dist/useHealthPlanSubscription.d-BYehTI7R.d.ts +756 -0
- package/dist/{usePresentation.d-CRG3Gaaq.d.ts → usePresentation.d-BfcyAEFt.d.ts} +66 -7
- package/dist/{usePresentation.d-C8rqY56C.d.cts → usePresentation.d-C39kKhoO.d.cts} +66 -7
- package/dist/{useRecordsDepth.d-DlRda5jp.d.ts → useRecordsDepth.d-B2ewVbRm.d.ts} +1 -1
- package/dist/{useRecordsDepth.d-BYk7m7gF.d.cts → useRecordsDepth.d-CKXAAHXI.d.cts} +1 -1
- package/dist/{view.d-DuIXHr08.d.ts → view.d-BnUDSQXz.d.ts} +3 -3
- package/dist/{view.d-B31M8rCG.d.cts → view.d-CbcJKNJj.d.cts} +1 -1
- package/dist/{view.d-B31M8rCG.d.ts → view.d-CbcJKNJj.d.ts} +1 -1
- package/dist/{view.d-CLpEHKOp.d.cts → view.d-DTNPjiZ1.d.cts} +3 -3
- package/dist/web/consent/index.d.cts +5 -5
- package/dist/web/consent/index.d.ts +5 -5
- package/dist/web/health-plan/index.cjs +335 -180
- package/dist/web/health-plan/index.d.cts +576 -19
- package/dist/web/health-plan/index.d.ts +576 -19
- package/dist/web/health-plan/index.js +297 -162
- package/dist/web/health-plan/styles.css +233 -0
- package/dist/web/health-plan/today/index.cjs +7 -0
- package/dist/web/health-plan/today/index.d.cts +15 -0
- package/dist/web/health-plan/today/index.d.ts +15 -0
- package/dist/web/health-plan/today/index.js +7 -0
- package/dist/web/index.cjs +36 -33
- package/dist/web/index.d.cts +60 -37
- package/dist/web/index.d.ts +60 -37
- package/dist/web/index.js +36 -33
- package/dist/web/intro/index.cjs +2 -2
- package/dist/web/intro/index.d.cts +8 -8
- package/dist/web/intro/index.d.ts +8 -8
- package/dist/web/intro/index.js +2 -2
- package/dist/web/notifications/index.d.cts +3 -3
- package/dist/web/notifications/index.d.ts +3 -3
- package/dist/web/records/depth/index.d.cts +9 -9
- package/dist/web/records/depth/index.d.ts +9 -9
- package/dist/web/records/index.cjs +1 -1
- package/dist/web/records/index.d.cts +11 -11
- package/dist/web/records/index.d.ts +11 -11
- package/dist/web/records/index.js +1 -1
- package/dist/web/records-sheet/index.cjs +13 -12
- package/dist/web/records-sheet/index.d.cts +13 -10
- package/dist/web/records-sheet/index.d.ts +13 -10
- package/dist/web/records-sheet/index.js +13 -12
- package/dist/web/shop/index.cjs +6 -6
- package/dist/web/shop/index.d.cts +8 -7
- package/dist/web/shop/index.d.ts +8 -7
- package/dist/web/shop/index.js +6 -6
- package/dist/web/shop/orders-v2/index.d.cts +1 -1
- package/dist/web/shop/orders-v2/index.d.ts +1 -1
- package/dist/web/televet/booking/index.cjs +1 -1
- package/dist/web/televet/booking/index.d.cts +6 -6
- package/dist/web/televet/booking/index.d.ts +6 -6
- package/dist/web/televet/booking/index.js +1 -1
- package/dist/web/texting/index.cjs +1 -1
- package/dist/web/texting/index.d.cts +6 -6
- package/dist/web/texting/index.d.ts +6 -6
- package/dist/web/texting/index.js +1 -1
- package/dist/web/ui/index.cjs +70 -0
- package/dist/web/ui/index.d.cts +78 -0
- package/dist/web/ui/index.d.ts +78 -0
- package/dist/web/ui/index.js +48 -0
- package/dist/web/ui/styles.css +244 -0
- package/package.json +71 -5
- package/ui/package.json +8 -0
- package/web/health-plan/today/native-blocked.cjs +12 -0
- package/web/health-plan/today/package.json +8 -0
- package/web/ui/native-blocked.cjs +12 -0
- package/web/ui/package.json +8 -0
- package/dist/useHealthPlanSubscription.d-DD30EkUR.d.ts +0 -205
- package/dist/useHealthPlanSubscription.d-DWrzUXf4.d.cts +0 -205
|
@@ -391,7 +391,7 @@ return jsxRuntime.jsxs("div",{style:row(index),children:[
|
|
|
391
391
|
/* @__PURE__ */jsxRuntime.jsx("span",{style:s.fieldValue,children:system.finding})]},system.system))]},exam.examId)),"record-document-exams"):null,depth&&depth.clinicianNotes.length>0?section(COPY.clinicianNotes,depth.clinicianNotes.map((note,index)=>/* @__PURE__ */jsxRuntime.jsxs("div",{style:{...s.block,...index>0?s.rowDivider:{}},children:[note.observedOn?/* @__PURE__ */jsxRuntime.jsx("span",{style:s.blockDate,children:formatRecordsDate(note.observedOn)}):null,note.sections.filter(sec=>sec.text).map((sec,i)=>/* @__PURE__ */jsxRuntime.jsxs("div",{style:s.noteSection,children:[
|
|
392
392
|
/* @__PURE__ */jsxRuntime.jsx("span",{style:s.noteLabel,children:soapSectionLabel(sec.section)}),
|
|
393
393
|
/* @__PURE__ */jsxRuntime.jsx("p",{style:s.noteBody,children:sec.text})]},`${sec.section}-${i}`))]},note.noteId)),"record-document-notes"):null,disclaimerRepeatsFootnote(record.disclaimer)?null:/* @__PURE__ */jsxRuntime.jsx("p",{style:s.disclaimer,children:record.disclaimer})]})}function useDocStyles(){let theme=useEverfurTheme();return react.useMemo(()=>makeDocStyles(theme),[theme])}function makeDocStyles(theme){let{color:color,space:space,radius:radius,type:type}=theme,text3=(size,multiplier,fg,weight="regular")=>({margin:0,...faceCss(theme,weight),fontSize:size,lineHeight:`${Math.round(size*multiplier)}px`,color:fg}),monoText=(size,fg)=>({margin:0,...faceCss(theme,"mono"),fontSize:size,lineHeight:`${size+space.xs-1}px`,color:fg,letterSpacing:type.letterSpacing.eyebrow/2,textTransform:"uppercase"}),hairline=`1px solid ${color.borderHairlineGreen}`;return{empty:{...text3(type.size.body,type.lineHeight.normal,color.text.muted,"medium"),textAlign:"center",padding:`${space.xxl}px ${space.xxl}px`},page:{padding:`0 ${space.lg+space.xs}px ${space.xxl+space.lg}px`,...faceCss(theme,"regular")},letterhead:{display:"flex",flexDirection:"column",alignItems:"center",gap:space.xs+space.xs/2,padding:`${space.md}px 0 ${space.lg+space.xs+space.xs/2}px`,borderBottom:`2px solid ${color.brandInk}`,marginBottom:space.sm},wordmark:{...text3(type.size.heading,type.lineHeight.snug,color.brandInk,"bold"),letterSpacing:type.letterSpacing.headerBrand},docTitle:{...monoText(type.size.caption,color.brandInk),marginTop:space.sm+space.xs/2,letterSpacing:type.letterSpacing.eyebrow+.4},petName:text3(type.size.verdict+space.xs/2,type.lineHeight.tight,color.text.primary),generated:{...monoText(type.size.tiny,color.text.muted),textTransform:"none"},section:{marginTop:space.lg+space.xs+space.xs/2},sectionHeader:{display:"flex",alignItems:"center",gap:space.sm+space.xs/2,marginBottom:space.sm},sectionTitle:monoText(type.size.tiny,color.brandInk),rule:{flex:1,height:1,backgroundColor:color.borderHairlineGreen},row:{display:"flex",alignItems:"flex-start",justifyContent:"space-between",gap:space.md+space.xs/2,padding:`${space.sm+1}px 0`},rowDivider:{borderTop:hairline},rowFlag:{backgroundColor:color.badgeBgCritical,margin:`0 -${space.sm}px`,padding:`${space.sm+1}px ${space.sm}px`,borderRadius:radius.xs},rowMain:{display:"flex",flexDirection:"column",minWidth:0},rowRight:{display:"flex",flexDirection:"column",alignItems:"flex-end",gap:space.xs/2},rowLabel:{...text3(type.size.body,type.lineHeight.normal,color.text.primary,"medium")},rowValue:{...text3(type.size.body,type.lineHeight.normal,color.text.primary,"bold"),textAlign:"right"},alert:{color:color.danger},rowMeta:{marginTop:space.xs/2,...faceCss(theme,"mono"),fontSize:type.size.tiny,lineHeight:`${type.size.body}px`,color:color.text.muted},markerStatus:monoText(type.size.micro,color.text.muted),block:{padding:`${space.sm+space.xs/2}px 0`},blockDate:{...monoText(type.size.tiny,color.text.muted),display:"block",marginBottom:space.xs+space.xs/2},fieldRow:{display:"flex",alignItems:"flex-start",gap:space.md+space.xs/2,padding:`${space.xs-1}px 0`},fieldLabel:{width:120,flexShrink:0,...text3(type.size.bodyTight,type.lineHeight.normal,color.text.muted,"medium")},fieldValue:{flex:1,...text3(type.size.bodyTight,type.lineHeight.normal,color.text.primary,"medium")},noteSection:{marginTop:space.sm},noteLabel:{...monoText(type.size.tiny,color.brandInk),display:"block",marginBottom:space.xs/2},noteBody:text3(type.size.bodyTight,type.lineHeight.relaxed,color.text.primary),disclaimer:{...text3(type.size.tiny,type.lineHeight.relaxed,color.text.muted),marginTop:radius.xl,paddingTop:space.md+space.xs/2,borderTop:hairline}}}var FACT_EDIT_COPY=/* @__PURE__ */Object.freeze({editA11y:label=>`Edit ${label}. Correct or remove this record detail.`,title:label=>`Edit ${label}`,helper:"Corrects your record. Your vet can still review it.",close:"Close",closeEditorA11y:"Close editor",save:"Save changes",saving:"Saving...",remove:"Remove this detail",confirmRemove:"Remove this detail from your record? This can't be undone.",removeConfirm:"Remove",removing:"Removing...",keep:"Keep",noChange:"Change a value before saving.",saved:"Saved.",removed:"Removed.",detail:"record detail"});function factEditErrorMessage(error,mode){return isRecordsConsentRequired(error)?mode==="remove"?"Records access for this pet is off, so this detail cannot be removed.":"Records access for this pet is off, so this detail cannot be changed.":isFactReviewerLocked(error)?mode==="remove"?"A clinician already reviewed this detail, so it can't be removed here.":"A clinician already reviewed this detail, so it can't be changed here.":mode==="remove"?"Couldn't remove that. Please check your connection and try again.":"Couldn't save that. Please check your connection and try again."}var EMPTY_FACT_OVERLAY=/* @__PURE__ */Object.freeze({edits:/* @__PURE__ */Object.freeze({}),removed:/* @__PURE__ */Object.freeze([])});function applyFactOverlay(entities,overlay){if(Object.keys(overlay.edits).length===0&&overlay.removed.length===0)return entities;let out=[];for(let entity of entities){let key=entity.canonicalKey??null;if(key!==null&&overlay.removed.includes(key))continue;let edited=key!==null?overlay.edits[key]:void 0;out.push(edited===void 0?entity:/* @__PURE__ */Object.freeze({...entity,value:edited}))}/* @__PURE__ */
|
|
394
|
-
return Object.freeze(out)}function isFactEditable(entity){return typeof entity.canonicalKey=="string"&&entity.canonicalKey.length>0}function defaultFactKey(){return`records-fact-${Date.now().toString(36)}`}function useRecordFactEdit(petRef,opts={}){let client=useEverfurRecordsDepthClient(),{userRef:userRef}=useEverfurContext(),[overlay,setOverlay]=react.useState(EMPTY_FACT_OVERLAY),[busy,setBusy]=react.useState(false),[error,setError]=react.useState(null),scope=react.useMemo(()=>({}),[client,petRef,userRef]),[darkScope,setDarkScope]=react.useState(null),markDark=react.useCallback(()=>setDarkScope(scope),[scope]),[refused,setRefused]=react.useState(null);react.useEffect(()=>{if(userRef===null||client.readFeatures===void 0)return;let current=true;return client.readFeatures().then(value=>{current&&value.features.fact_edit===false&&setRefused(scope)},()=>{}),()=>{current=false}},[client,userRef,scope]);let available=userRef!==null&&darkScope!==scope&&refused!==scope,locked=react.useRef(false),mintRef=react.useRef(opts.newIdempotencyKey);mintRef.current=opts.newIdempotencyKey;let mint=react.useCallback(()=>(mintRef.current??defaultFactKey)(),[]),settle=react.useCallback((result,rollback,mode)=>{if(setBusy(false),!result.ok){if(rollback(),isDarkRouteError(result.error)){markDark();return}setError(factEditErrorMessage(result.error,mode))}},[markDark]),edit=react.useCallback(async(entity,value)=>{let key=entity.canonicalKey??"",next=value.trim();if(locked.current||key.length===0||next.length===0)return err(makeEverfurError("validationFailed",{retryable:false}));locked.current=true,setBusy(true),setError(null);let snapshot=overlay;setOverlay(current=>({...current,edits:{...current.edits,[key]:next}}));let result=await client.editFact(petRef,{entityType:entity.category,canonicalKey:key,correctedFields:factCorrectionFor(entity.value,next),idempotencyKey:mint()});return locked.current=false,settle(result,()=>setOverlay(snapshot),"edit"),result},[client,petRef,overlay,settle,mint]),remove=react.useCallback(async entity=>{let key=entity.canonicalKey??"";if(locked.current||key.length===0)return err(makeEverfurError("validationFailed",{retryable:false}));locked.current=true,setBusy(true),setError(null);let snapshot=overlay;setOverlay(current=>({...current,removed:[...current.removed,key]}));let result=await client.removeFact(petRef,{entityType:entity.category,canonicalKey:key,idempotencyKey:mint()});return locked.current=false,settle(result,()=>setOverlay(snapshot),"remove"),result},[client,petRef,overlay,settle,mint]),clearError=react.useCallback(()=>setError(null),[]);return react.useMemo(()=>({overlay:overlay,busy:busy,error:error,available:available,edit:edit,remove:remove,clearError:clearError}),[overlay,busy,error,available,edit,remove,clearError])}var FALLBACK_TITLE=/* @__PURE__ */Object.freeze({vaccination:"Vaccination",medication:"Medication",problem:"Problem",body_weight:"Weight",allergy:"Allergy",vital:"Vital",lab_result:"Lab result",parasite_prevention:"Preventive"}),GIVEN_PREFIX="Given",ISO_DATE_PREFIX=/^\d{4}-\d{2}-\d{2}/,DETAIL_SEPARATOR=" · ";function joinDetail(parts){let kept=parts.filter(part=>part!==null&&part.trim().length>0);return kept.length>0?kept.join(DETAIL_SEPARATOR):null}function rowTitle(facts,humanizeCategory){let label=facts.label.trim();if(label.length>0)return label;let fallback=FALLBACK_TITLE[facts.category];return fallback!==void 0?fallback:humanizeCategory(facts.category)}function entityRowSummary(facts,fmt){let title=rowTitle(facts,fmt.humanize),value=fmt.formatEntityValue(facts.value,facts.unit),shownValue=value.trim().length>0?value:null,rawDate=facts.observedAt!==null&&facts.observedAt.trim().length>0?fmt.formatRecordsDate(facts.observedAt):null,observed=rawDate!==null&&rawDate!=="-"?rawDate:null;switch(facts.category){case"vaccination":{let valueIsDate=facts.value!==null&&ISO_DATE_PREFIX.test(facts.value.trim()),givenOn=valueIsDate?fmt.formatRecordsDate(facts.value):observed;return givenOn!==null&&givenOn!=="-"?{title:title,detail:joinDetail([`${GIVEN_PREFIX} ${givenOn}`,valueIsDate?null:shownValue])}:{title:title,detail:joinDetail([shownValue])}}case"medication":return{title:title,detail:joinDetail([observed])};case"problem":return{title:title,detail:joinDetail([observed])};case"body_weight":return{title:title,detail:joinDetail([observed])};case"allergy":return{title:title,detail:joinDetail([observed])};case"vital":return{title:title,detail:joinDetail([shownValue,observed])};case"lab_result":return{title:title,detail:joinDetail([shownValue,observed])};default:return{title:title,detail:joinDetail([shownValue,observed])}}}function markerStatusTone(status){return status==="above"||status==="below"?"critical":status==="in_range"?"positive":"neutral"}function markerStatusSpoken(status){switch(status){case"above":return"above the reference range";case"below":return"below the reference range";case"in_range":return"within range";default:return"no reference range on file"}}function rangePhrase(point){return point.refLow!==null&&point.refHigh!==null?`, reference range ${point.refLow} to ${point.refHigh}`:point.refLow!==null?`, reference range at least ${point.refLow}`:point.refHigh!==null?`, reference range up to ${point.refHigh}`:""}function formatReferenceRange(point,unit){let u=unit?` ${unit}`:"";return point.refLow!==null&&point.refHigh!==null?`${point.refLow}-${point.refHigh}${u}`:point.refLow!==null?`≥ ${point.refLow}${u}`:point.refHigh!==null?`≤ ${point.refHigh}${u}`:"-"}function markerPointSpoken(marker,point){let reviewed=point.reviewed?", reviewed by our team":"",clinic=point.sourceClinic?`, from ${point.sourceClinic}`:"";return`${formatRecordsDate(point.at)}: ${formatMarkerReading(point.value,marker.unit,point.qualitativeResult)}, ${markerStatusSpoken(point.status)}${rangePhrase(point)}${clinic}${reviewed}`}function markersFeaturedFirst(markers,featuredMarkerId){if(!featuredMarkerId)return markers;let at=markers.findIndex(marker=>marker.markerId===featuredMarkerId);return at<=0?markers:[markers[at],...markers.slice(0,at),...markers.slice(at+1)]}var MARKER_CAROUSEL_MAX_DOTS=7;function markerDotWindow(activeIndex,total,max=MARKER_CAROUSEL_MAX_DOTS){let count=Math.max(0,Math.min(total,max)),start=total<=max?0:Math.max(0,Math.min(activeIndex-Math.floor(max/2),total-max));return Array.from({length:count},(_,i)=>start+i)}function lead(petName){return petName?.trim()||"my pet"}function clause(text3){let t=text3.trim();return/[.!?]$/.test(t)?t:`${t}.`}function buildMarkerAskPrompt(petName,input){let name=input.canonicalName.trim()||"a lab marker",parts=[`I'm looking at ${lead(petName)}'s ${name}`],stats=[input.latestValueText?.trim(),input.statusText?.trim(),input.trajectoryText?.trim()].filter(Boolean).join(", ");return parts[0]+=stats?`: ${stats}.`:".",input.meaningText?.trim()&&parts.push(clause(input.meaningText)),parts.push(`What does this trend tell me, and should I do anything differently for ${lead(petName)}?`),{prompt:parts.join(" "),entityRef:{type:"marker",id:input.markerId,payload:{marker:name,...input.statusText?.trim()?{status:input.statusText.trim()}:{}}}}}function buildMarkerSummaryAskPrompt(petName,summary,petId){let{totalMarkers:totalMarkers,inRangeCount:inRangeCount,outOfRangeCount:outOfRangeCount,unknownCount:unknownCount}=summary;if(totalMarkers===0)return{prompt:`I'm looking at ${lead(petName)}'s lab markers, but there aren't any on file yet. What lab work is worth running for ${lead(petName)}?`,entityRef:{type:"marker_summary",id:petId,payload:{total:0}}};let tail=unknownCount>0?`, ${unknownCount} without a reference range`:"";return{prompt:`I'm looking at ${lead(petName)}'s lab markers: ${totalMarkers} total, ${inRangeCount} in range, ${outOfRangeCount} out of range${tail}. What should I focus on?`,entityRef:{type:"marker_summary",id:petId,payload:{total:totalMarkers,inRange:inRangeCount,outOfRange:outOfRangeCount,unknown:unknownCount}}}}function buildMarkerReadingAskPrompt(petName,input){let name=input.canonicalName.trim()||"a lab marker",bits=[`${name}: ${input.valueText.trim()}`];input.collectedAt?.trim()&&bits.push(`collected ${input.collectedAt.trim()}`),input.sourceClinic?.trim()&&bits.push(`from ${input.sourceClinic.trim()}`),input.referenceText?.trim()&&bits.push(`reference range ${input.referenceText.trim()}`),input.flagged&&bits.push(`flagged ${input.flagged}`);let payload={marker:name};return input.flagged&&(payload.status=input.flagged),input.reviewed!==void 0&&(payload.reviewed=input.reviewed),{prompt:`I'm looking at ${lead(petName)}'s ${bits.join(", ")}. What does this mean, and should I be concerned?`,entityRef:{type:"lab_reading",id:input.entityId,payload:payload}}}function buildRecordsRequestAskPrompt(petName,input,requestId2){let clinic=input.clinicName?.trim(),held=input.heldItemCount??0,heldPhrase=held>0?`, ${held} fact${held===1?"":"s"} being verified`:"";return{prompt:`I'm looking at ${lead(petName)}'s records request${clinic?` to ${clinic}`:""}, status: ${input.statusLabel.trim()}${heldPhrase}. What does this status mean, and what happens next?`,entityRef:{type:"records_request",id:requestId2,payload:{status:input.status,held:held,...clinic?{clinic:clinic}:{}}}}}var ENTITY_TYPE_MAP=/* @__PURE__ */Object.freeze({vaccination:"vaccine",medication:"medication",body_weight:"weight",vital:"weight"});function buildEntityRowAskPrompt(petName,input,entityType,entityId){let kind=input.entityTypeLabel.trim()||"record",title=input.title.trim()||kind,detail=input.detail?.trim();return{prompt:`I'm looking at ${lead(petName)}'s ${kind.toLowerCase()}: ${title}${detail?`, ${detail}`:""}. What does this mean, and what should I keep on top of for ${lead(petName)}?`,entityRef:{type:ENTITY_TYPE_MAP[entityType]??entityType,id:entityId,payload:{kind:kind,title:title,...detail?{detail:detail}:{}}}}}function buildUpcomingCareAskPrompt(petName,items,petId){let list=items.filter(i=>i.label.trim()),entityRef={type:"upcoming_care",id:petId};if(list.length===0)return{prompt:`I'm looking at ${lead(petName)}'s upcoming care, but nothing is scheduled yet. What preventive care and checkups should ${lead(petName)} be on?`,entityRef:entityRef};let named=[...list].sort((a,b)=>(a.tone==="overdue"?0:1)-(b.tone==="overdue"?0:1)).slice(0,4).map(i=>i.relativeText.trim()?`${i.label.trim()} (${i.relativeText.trim().toLowerCase()})`:i.label.trim());return{prompt:`I'm looking at ${lead(petName)}'s upcoming care: ${named.join(", ")}. What should I prioritize for ${lead(petName)}, and how do I stay on top of these?`,entityRef:entityRef}}function buildPhysicalExamAskPrompt(petName,input,examId){let parts=[`I'm looking at ${lead(petName)}'s physical exam${input.observedOn?.trim()?` from ${input.observedOn.trim()}`:""}.`],abnormal=input.abnormal.filter(a=>a.system.trim());return abnormal.length>0?(parts.push(`Abnormal: ${abnormal.slice(0,6).map(a=>`${a.system.trim()}: ${a.finding.trim()}`).join("; ")}.`),parts.push(`What do these findings mean, and what should I follow up on for ${lead(petName)}?`)):parts.push(`Everything examined came back normal. What does this tell me about ${lead(petName)}'s health?`),{prompt:parts.join(" "),entityRef:{type:"physical_exam",id:examId}}}function buildVisitNoteAskPrompt(petName,input,noteId){let parts=[`I'm looking at ${lead(petName)}'s visit notes${input.observedOn?.trim()?` from ${input.observedOn.trim()}`:""}.`];for(let s of input.sections.filter(section=>section.text.trim()).slice(0,3))parts.push(`${s.label.trim()||"Note"}: ${clause(s.text)}`);return parts.push(`Can you summarize what happened and what I should follow up on for ${lead(petName)}?`),{prompt:parts.join(" "),entityRef:{type:"visit",id:noteId}}}function buildConflictAskPrompt(petName,input,conflictId){let scope=input.scopeLabel.trim()||"a detail",cands=input.candidates.filter(c=>c.value.trim()),rendered=cands.slice(0,3).map(c=>`"${c.value.trim()}"${c.clinicName?.trim()?` (${c.clinicName.trim()})`:""}`).join(" vs ");return{prompt:`Two of ${lead(petName)}'s documents disagree on ${scope}: ${rendered}. Which is likely correct, and what should I ask my vet?`,entityRef:{type:"conflict",id:conflictId,payload:{field:scope,severity:input.severity,values:cands.map(c=>c.value.trim()).join(" | ")}}}}var FOCUSABLE='button:not([disabled]), input:not([disabled]), textarea:not([disabled]), select:not([disabled]), a[href], [tabindex]:not([tabindex="-1"])';function isDialogElement(node){return node.tagName==="DIALOG"}function useModalDialog(open,onClose,returnFocusTo,options){let escapeAtKeyDown=options?.escapeAtKeyDown===true,dialogRef=react.useRef(null),wasOpen=react.useRef(false),opener=react.useRef(null),trigger=react.useRef(returnFocusTo);trigger.current=returnFocusTo;let restoreFocus=react.useCallback(()=>{if(!wasOpen.current)return;wasOpen.current=false;let target=trigger.current===void 0?opener.current:trigger.current.current;target&&target.isConnected&&target.focus(),(!target||!target.isConnected||document.activeElement===target)&&(opener.current=null)},[]);react.useEffect(()=>{let node=dialogRef.current;if(!wasOpen.current){let active=typeof document>"u"?null:document.activeElement;active!==null&&node!==null&&node.contains(active)||(opener.current=active instanceof HTMLElement?active:null)}if(wasOpen.current=true,node===null)return;if(!isDialogElement(node)){node.contains(document.activeElement)||(node.querySelector(FOCUSABLE)??node).focus();return}let dialog=node;typeof dialog.showModal=="function"?dialog.open||dialog.showModal():dialog.setAttribute("open","")},[open,restoreFocus]),react.useEffect(()=>restoreFocus,[restoreFocus]),react.useEffect(()=>{let node=dialogRef.current;if(node===null||!isDialogElement(node))return;let dialog=node;if(typeof dialog.showModal!="function")return;let lastFocused=null,onFocusIn=event=>{event.target instanceof HTMLElement&&(lastFocused=event.target)},onNativeClose=()=>{if(!dialog.isConnected||dialog.open)return;let back=lastFocused;dialog.showModal(),back!==null&&back.isConnected&&dialog.contains(back)&&document.activeElement!==back&&back.focus()};return dialog.addEventListener("focusin",onFocusIn),dialog.addEventListener("close",onNativeClose),()=>{dialog.removeEventListener("focusin",onFocusIn),dialog.removeEventListener("close",onNativeClose)}},[open]);let onKeyDown=react.useCallback(event=>{let node=dialogRef.current;if(node===null)return;if(event.key==="Escape"&&!isDialogElement(node)){event.preventDefault(),event.stopPropagation(),onClose();return}if(event.key==="Escape"&&escapeAtKeyDown);if(event.key!=="Tab")return;let focusable=Array.from(node.querySelectorAll(FOCUSABLE)),first=focusable[0],last=focusable[focusable.length-1];if(!first||!last){event.preventDefault();return}let active=document.activeElement;event.shiftKey&&(active===first||!node.contains(active))?(event.preventDefault(),last.focus()):!event.shiftKey&&(active===last||!node.contains(active))&&(event.preventDefault(),first.focus())},[onClose,escapeAtKeyDown]),onCancel=react.useCallback(event=>{event.target===event.currentTarget&&(event.preventDefault(),onClose())},[onClose]);return{dialogRef:dialogRef,onKeyDown:onKeyDown,onCancel:onCancel}}var FOCUSABLE2='button:not([disabled]), input:not([disabled]), textarea:not([disabled]), select:not([disabled]), a[href], [tabindex]:not([tabindex="-1"])';function RecordsDialog({label:label,onClose:onClose,shape:shape="modal",returnFocusTo:returnFocusTo,panelStyle:panelStyle,testID:testID,children:children}){let{styles:styles}=useScreenStyles(),dialog=useModalDialog(true,onClose,returnFocusTo);react.useEffect(()=>{let node=dialog.dialogRef.current;node===null||node.contains(document.activeElement)||(node.querySelector(FOCUSABLE2)??node).focus()},[dialog.dialogRef]);let side=shape==="side";/* @__PURE__ */
|
|
394
|
+
return Object.freeze(out)}function isFactEditable(entity){return typeof entity.canonicalKey=="string"&&entity.canonicalKey.length>0}function defaultFactKey(){return`records-fact-${Date.now().toString(36)}`}function useRecordFactEdit(petRef,opts={}){let client=useEverfurRecordsDepthClient(),{userRef:userRef}=useEverfurContext(),[overlay,setOverlay]=react.useState(EMPTY_FACT_OVERLAY),[busy,setBusy]=react.useState(false),[error,setError]=react.useState(null),scope=react.useMemo(()=>({}),[client,petRef,userRef]),[darkScope,setDarkScope]=react.useState(null),markDark=react.useCallback(()=>setDarkScope(scope),[scope]),[refused,setRefused]=react.useState(null);react.useEffect(()=>{if(userRef===null||client.readFeatures===void 0)return;let current=true;return client.readFeatures().then(value=>{current&&value.features.fact_edit===false&&setRefused(scope)},()=>{}),()=>{current=false}},[client,userRef,scope]);let available=userRef!==null&&darkScope!==scope&&refused!==scope,locked=react.useRef(false),mintRef=react.useRef(opts.newIdempotencyKey);mintRef.current=opts.newIdempotencyKey;let mint=react.useCallback(()=>(mintRef.current??defaultFactKey)(),[]),settle=react.useCallback((result,rollback,mode)=>{if(setBusy(false),!result.ok){if(rollback(),isDarkRouteError(result.error)){markDark();return}setError(factEditErrorMessage(result.error,mode))}},[markDark]),edit=react.useCallback(async(entity,value)=>{let key=entity.canonicalKey??"",next=value.trim();if(locked.current||key.length===0||next.length===0)return err(makeEverfurError("validationFailed",{retryable:false}));locked.current=true,setBusy(true),setError(null);let snapshot=overlay;setOverlay(current=>({...current,edits:{...current.edits,[key]:next}}));let result=await client.editFact(petRef,{entityType:entity.category,canonicalKey:key,correctedFields:factCorrectionFor(entity.value,next),idempotencyKey:mint()});return locked.current=false,settle(result,()=>setOverlay(snapshot),"edit"),result},[client,petRef,overlay,settle,mint]),remove=react.useCallback(async entity=>{let key=entity.canonicalKey??"";if(locked.current||key.length===0)return err(makeEverfurError("validationFailed",{retryable:false}));locked.current=true,setBusy(true),setError(null);let snapshot=overlay;setOverlay(current=>({...current,removed:[...current.removed,key]}));let result=await client.removeFact(petRef,{entityType:entity.category,canonicalKey:key,idempotencyKey:mint()});return locked.current=false,settle(result,()=>setOverlay(snapshot),"remove"),result},[client,petRef,overlay,settle,mint]),clearError=react.useCallback(()=>setError(null),[]);return react.useMemo(()=>({overlay:overlay,busy:busy,error:error,available:available,edit:edit,remove:remove,clearError:clearError}),[overlay,busy,error,available,edit,remove,clearError])}var FALLBACK_TITLE=/* @__PURE__ */Object.freeze({vaccination:"Vaccination",medication:"Medication",problem:"Problem",body_weight:"Weight",allergy:"Allergy",vital:"Vital",lab_result:"Lab result",parasite_prevention:"Preventive"}),GIVEN_PREFIX="Given",ISO_DATE_PREFIX=/^\d{4}-\d{2}-\d{2}/,DETAIL_SEPARATOR=" · ";function joinDetail(parts){let kept=parts.filter(part=>part!==null&&part.trim().length>0);return kept.length>0?kept.join(DETAIL_SEPARATOR):null}function rowTitle(facts,humanizeCategory){let label=facts.label.trim();if(label.length>0)return label;let fallback=FALLBACK_TITLE[facts.category];return fallback!==void 0?fallback:humanizeCategory(facts.category)}function entityRowSummary(facts,fmt){let title=rowTitle(facts,fmt.humanize),value=fmt.formatEntityValue(facts.value,facts.unit),shownValue=value.trim().length>0?value:null,rawDate=facts.observedAt!==null&&facts.observedAt.trim().length>0?fmt.formatRecordsDate(facts.observedAt):null,observed=rawDate!==null&&rawDate!=="-"?rawDate:null;switch(facts.category){case"vaccination":{let valueIsDate=facts.value!==null&&ISO_DATE_PREFIX.test(facts.value.trim()),givenOn=valueIsDate?fmt.formatRecordsDate(facts.value):observed;return givenOn!==null&&givenOn!=="-"?{title:title,detail:joinDetail([`${GIVEN_PREFIX} ${givenOn}`,valueIsDate?null:shownValue])}:{title:title,detail:joinDetail([shownValue])}}case"medication":return{title:title,detail:joinDetail([observed])};case"problem":return{title:title,detail:joinDetail([observed])};case"body_weight":return{title:title,detail:joinDetail([observed])};case"allergy":return{title:title,detail:joinDetail([observed])};case"vital":return{title:title,detail:joinDetail([shownValue,observed])};case"lab_result":return{title:title,detail:joinDetail([shownValue,observed])};default:return{title:title,detail:joinDetail([shownValue,observed])}}}function markerStatusTone(status){return status==="above"||status==="below"?"critical":status==="in_range"?"positive":"neutral"}function markerStatusSpoken(status){switch(status){case"above":return"above the reference range";case"below":return"below the reference range";case"in_range":return"within range";default:return"no reference range on file"}}function rangePhrase(point){return point.refLow!==null&&point.refHigh!==null?`, reference range ${point.refLow} to ${point.refHigh}`:point.refLow!==null?`, reference range at least ${point.refLow}`:point.refHigh!==null?`, reference range up to ${point.refHigh}`:""}function formatReferenceRange(point,unit){let u=unit?` ${unit}`:"";return point.refLow!==null&&point.refHigh!==null?`${point.refLow}-${point.refHigh}${u}`:point.refLow!==null?`≥ ${point.refLow}${u}`:point.refHigh!==null?`≤ ${point.refHigh}${u}`:"-"}function markerPointSpoken(marker,point){let reviewed=point.reviewed?", reviewed by our team":"",clinic=point.sourceClinic?`, from ${point.sourceClinic}`:"";return`${formatRecordsDate(point.at)}: ${formatMarkerReading(point.value,marker.unit,point.qualitativeResult)}, ${markerStatusSpoken(point.status)}${rangePhrase(point)}${clinic}${reviewed}`}function markersFeaturedFirst(markers,featuredMarkerId){if(!featuredMarkerId)return markers;let at=markers.findIndex(marker=>marker.markerId===featuredMarkerId);return at<=0?markers:[markers[at],...markers.slice(0,at),...markers.slice(at+1)]}var MARKER_CAROUSEL_MAX_DOTS=7;function markerDotWindow(activeIndex,total,max=MARKER_CAROUSEL_MAX_DOTS){let count=Math.max(0,Math.min(total,max)),start=total<=max?0:Math.max(0,Math.min(activeIndex-Math.floor(max/2),total-max));return Array.from({length:count},(_,i)=>start+i)}function lead(petName){return petName?.trim()||"my pet"}function clause(text3){let t=text3.trim();return/[.!?]$/.test(t)?t:`${t}.`}function buildMarkerAskPrompt(petName,input){let name=input.canonicalName.trim()||"a lab marker",parts=[`I'm looking at ${lead(petName)}'s ${name}`],stats=[input.latestValueText?.trim(),input.statusText?.trim(),input.trajectoryText?.trim()].filter(Boolean).join(", ");return parts[0]+=stats?`: ${stats}.`:".",input.meaningText?.trim()&&parts.push(clause(input.meaningText)),parts.push(`What does this trend tell me, and should I do anything differently for ${lead(petName)}?`),{prompt:parts.join(" "),entityRef:{type:"marker",id:input.markerId,payload:{marker:name,...input.statusText?.trim()?{status:input.statusText.trim()}:{}}}}}function buildMarkerSummaryAskPrompt(petName,summary,petId){let{totalMarkers:totalMarkers,inRangeCount:inRangeCount,outOfRangeCount:outOfRangeCount,unknownCount:unknownCount}=summary;if(totalMarkers===0)return{prompt:`I'm looking at ${lead(petName)}'s lab markers, but there aren't any on file yet. What lab work is worth running for ${lead(petName)}?`,entityRef:{type:"marker_summary",id:petId,payload:{total:0}}};let tail=unknownCount>0?`, ${unknownCount} without a reference range`:"";return{prompt:`I'm looking at ${lead(petName)}'s lab markers: ${totalMarkers} total, ${inRangeCount} in range, ${outOfRangeCount} out of range${tail}. What should I focus on?`,entityRef:{type:"marker_summary",id:petId,payload:{total:totalMarkers,inRange:inRangeCount,outOfRange:outOfRangeCount,unknown:unknownCount}}}}function buildMarkerReadingAskPrompt(petName,input){let name=input.canonicalName.trim()||"a lab marker",bits=[`${name}: ${input.valueText.trim()}`];input.collectedAt?.trim()&&bits.push(`collected ${input.collectedAt.trim()}`),input.sourceClinic?.trim()&&bits.push(`from ${input.sourceClinic.trim()}`),input.referenceText?.trim()&&bits.push(`reference range ${input.referenceText.trim()}`),input.flagged&&bits.push(`flagged ${input.flagged}`);let payload={marker:name};return input.flagged&&(payload.status=input.flagged),input.reviewed!==void 0&&(payload.reviewed=input.reviewed),{prompt:`I'm looking at ${lead(petName)}'s ${bits.join(", ")}. What does this mean, and should I be concerned?`,entityRef:{type:"lab_reading",id:input.entityId,payload:payload}}}function buildRecordsRequestAskPrompt(petName,input,requestId2){let clinic=input.clinicName?.trim(),held=input.heldItemCount??0,heldPhrase=held>0?`, ${held} fact${held===1?"":"s"} being verified`:"";return{prompt:`I'm looking at ${lead(petName)}'s records request${clinic?` to ${clinic}`:""}, status: ${input.statusLabel.trim()}${heldPhrase}. What does this status mean, and what happens next?`,entityRef:{type:"records_request",id:requestId2,payload:{status:input.status,held:held,...clinic?{clinic:clinic}:{}}}}}var ENTITY_TYPE_MAP=/* @__PURE__ */Object.freeze({vaccination:"vaccine",medication:"medication",body_weight:"weight",vital:"weight"});function buildEntityRowAskPrompt(petName,input,entityType,entityId){let kind=input.entityTypeLabel.trim()||"record",title=input.title.trim()||kind,detail=input.detail?.trim();return{prompt:`I'm looking at ${lead(petName)}'s ${kind.toLowerCase()}: ${title}${detail?`, ${detail}`:""}. What does this mean, and what should I keep on top of for ${lead(petName)}?`,entityRef:{type:ENTITY_TYPE_MAP[entityType]??entityType,id:entityId,payload:{kind:kind,title:title,...detail?{detail:detail}:{}}}}}function buildUpcomingCareAskPrompt(petName,items,petId){let list=items.filter(i=>i.label.trim()),entityRef={type:"upcoming_care",id:petId};if(list.length===0)return{prompt:`I'm looking at ${lead(petName)}'s upcoming care, but nothing is scheduled yet. What preventive care and checkups should ${lead(petName)} be on?`,entityRef:entityRef};let named=[...list].sort((a,b)=>(a.tone==="overdue"?0:1)-(b.tone==="overdue"?0:1)).slice(0,4).map(i=>i.relativeText.trim()?`${i.label.trim()} (${i.relativeText.trim().toLowerCase()})`:i.label.trim());return{prompt:`I'm looking at ${lead(petName)}'s upcoming care: ${named.join(", ")}. What should I prioritize for ${lead(petName)}, and how do I stay on top of these?`,entityRef:entityRef}}function buildPhysicalExamAskPrompt(petName,input,examId){let parts=[`I'm looking at ${lead(petName)}'s physical exam${input.observedOn?.trim()?` from ${input.observedOn.trim()}`:""}.`],abnormal=input.abnormal.filter(a=>a.system.trim());return abnormal.length>0?(parts.push(`Abnormal: ${abnormal.slice(0,6).map(a=>`${a.system.trim()}: ${a.finding.trim()}`).join("; ")}.`),parts.push(`What do these findings mean, and what should I follow up on for ${lead(petName)}?`)):parts.push(`Everything examined came back normal. What does this tell me about ${lead(petName)}'s health?`),{prompt:parts.join(" "),entityRef:{type:"physical_exam",id:examId}}}function buildVisitNoteAskPrompt(petName,input,noteId){let parts=[`I'm looking at ${lead(petName)}'s visit notes${input.observedOn?.trim()?` from ${input.observedOn.trim()}`:""}.`];for(let s of input.sections.filter(section=>section.text.trim()).slice(0,3))parts.push(`${s.label.trim()||"Note"}: ${clause(s.text)}`);return parts.push(`Can you summarize what happened and what I should follow up on for ${lead(petName)}?`),{prompt:parts.join(" "),entityRef:{type:"visit",id:noteId}}}function buildConflictAskPrompt(petName,input,conflictId){let scope=input.scopeLabel.trim()||"a detail",cands=input.candidates.filter(c=>c.value.trim()),rendered=cands.slice(0,3).map(c=>`"${c.value.trim()}"${c.clinicName?.trim()?` (${c.clinicName.trim()})`:""}`).join(" vs ");return{prompt:`Two of ${lead(petName)}'s documents disagree on ${scope}: ${rendered}. Which is likely correct, and what should I ask my vet?`,entityRef:{type:"conflict",id:conflictId,payload:{field:scope,severity:input.severity,values:cands.map(c=>c.value.trim()).join(" | ")}}}}var FOCUSABLE='button:not([disabled]), input:not([disabled]), textarea:not([disabled]), select:not([disabled]), a[href], [tabindex]:not([tabindex="-1"])';function isDialogElement(node){return node.tagName==="DIALOG"}function activeIn(node){if(typeof document>"u")return null;let root=node?.getRootNode();return root&&root!==document&&"activeElement"in root?root.activeElement:document.activeElement}function useModalDialog(open,onClose,returnFocusTo,options){let escapeAtKeyDown=options?.escapeAtKeyDown===true,dialogRef=react.useRef(null),wasOpen=react.useRef(false),opener=react.useRef(null),trigger=react.useRef(returnFocusTo);trigger.current=returnFocusTo;let restoreFocus=react.useCallback(()=>{if(!wasOpen.current)return;wasOpen.current=false;let target=trigger.current===void 0?opener.current:trigger.current.current;target&&target.isConnected&&target.focus(),(!target||!target.isConnected||activeIn(target)===target)&&(opener.current=null)},[]);react.useEffect(()=>{let node=dialogRef.current;if(!wasOpen.current){let active=activeIn(node);active!==null&&node!==null&&node.contains(active)||(opener.current=active instanceof HTMLElement?active:null)}if(wasOpen.current=true,node===null)return;if(!isDialogElement(node)){node.contains(activeIn(node))||(node.querySelector(FOCUSABLE)??node).focus();return}let dialog=node;typeof dialog.showModal=="function"?dialog.open||dialog.showModal():dialog.setAttribute("open","")},[open,restoreFocus]),react.useEffect(()=>restoreFocus,[restoreFocus]),react.useEffect(()=>{let node=dialogRef.current;if(node===null||!isDialogElement(node))return;let dialog=node;if(typeof dialog.showModal!="function")return;let lastFocused=null,onFocusIn=event=>{event.target instanceof HTMLElement&&(lastFocused=event.target)},onNativeClose=()=>{if(!dialog.isConnected||dialog.open)return;let back=lastFocused;dialog.showModal(),back!==null&&back.isConnected&&dialog.contains(back)&&activeIn(dialog)!==back&&back.focus()};return dialog.addEventListener("focusin",onFocusIn),dialog.addEventListener("close",onNativeClose),()=>{dialog.removeEventListener("focusin",onFocusIn),dialog.removeEventListener("close",onNativeClose)}},[open]);let onKeyDown=react.useCallback(event=>{let node=dialogRef.current;if(node===null)return;if(event.key==="Escape"&&!isDialogElement(node)){event.preventDefault(),event.stopPropagation(),onClose();return}if(event.key==="Escape"&&escapeAtKeyDown);if(event.key!=="Tab")return;let focusable=Array.from(node.querySelectorAll(FOCUSABLE)),first=focusable[0],last=focusable[focusable.length-1];if(!first||!last){event.preventDefault();return}let active=activeIn(node);event.shiftKey&&(active===first||!node.contains(active))?(event.preventDefault(),last.focus()):!event.shiftKey&&(active===last||!node.contains(active))&&(event.preventDefault(),first.focus())},[onClose,escapeAtKeyDown]),onCancel=react.useCallback(event=>{event.target===event.currentTarget&&(event.preventDefault(),onClose())},[onClose]);return{dialogRef:dialogRef,onKeyDown:onKeyDown,onCancel:onCancel}}var FOCUSABLE2='button:not([disabled]), input:not([disabled]), textarea:not([disabled]), select:not([disabled]), a[href], [tabindex]:not([tabindex="-1"])';function RecordsDialog({label:label,onClose:onClose,shape:shape="modal",returnFocusTo:returnFocusTo,panelStyle:panelStyle,testID:testID,children:children}){let{styles:styles}=useScreenStyles(),dialog=useModalDialog(true,onClose,returnFocusTo);react.useEffect(()=>{let node=dialog.dialogRef.current;node===null||node.contains(document.activeElement)||(node.querySelector(FOCUSABLE2)??node).focus()},[dialog.dialogRef]);let side=shape==="side";/* @__PURE__ */
|
|
395
395
|
return jsxRuntime.jsx("dialog",{ref:dialog.dialogRef,"aria-label":label,"aria-modal":"true",onCancel:dialog.onCancel,onKeyDown:dialog.onKeyDown,style:styles.dialogFrame,"data-testid":testID,children:/* @__PURE__ */jsxRuntime.jsx("div",{style:side?styles.dialogScrimSide:styles.dialogScrim,onClick:event=>{event.target===event.currentTarget&&onClose()},"data-testid":testID?`${testID}-scrim`:void 0,children:/* @__PURE__ */jsxRuntime.jsx("div",{style:{...side?styles.dialogPanelSide:styles.dialogPanel,...panelStyle,...side?styles.dialogSlotSide:styles.dialogSlot},children:children})})})}function FactEditAffordance({entity:entity,factEdit:factEdit,children:children}){let{theme:theme,styles:styles}=useScreenStyles(),[open,setOpen]=react.useState(false),trigger=react.useRef(null),label=entity.label.trim()||FACT_EDIT_COPY.detail;/* @__PURE__ */
|
|
396
396
|
return jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"center",gap:theme.space.sm},children:[
|
|
397
397
|
/* @__PURE__ */jsxRuntime.jsx("div",{style:{flex:1,minWidth:0},children:children}),
|
|
@@ -1,35 +1,35 @@
|
|
|
1
1
|
/*! @everfur/sdk. Copyright (c) 2026 Strand Health Inc. dba Everfur. All rights reserved. Use is subject to the Everfur SDK License: https://docs.everfur.com/license */
|
|
2
2
|
import { R as RecordsController } from '../../useRecords.d-BYNX01El.cjs';
|
|
3
3
|
export { a as RecordsStatus, b as UploadDocumentInput, c as UploadQueueItem, d as UploadSkipReason, U as UseEverfurRecordsState, u as useEverfurRecords } from '../../useRecords.d-BYNX01El.cjs';
|
|
4
|
-
export { a as EverfurRecordsPage, E as EverfurRecordsPageProps } from '../../RecordsPage.d-
|
|
4
|
+
export { a as EverfurRecordsPage, E as EverfurRecordsPageProps } from '../../RecordsPage.d-Cmny6Q7g.cjs';
|
|
5
5
|
export { E as EverfurRecordsSheet, a as EverfurRecordsSheetLabRenderArgs, b as EverfurRecordsSheetRenderArgs } from '../../sheetSeam.d-BBuEIVsa.cjs';
|
|
6
6
|
import { CSSProperties, ReactNode, PointerEvent } from 'react';
|
|
7
7
|
import { P as PetRef, R as RecordsRequestId } from '../../ids.d-B2GAAifq.cjs';
|
|
8
8
|
export { B as Brand, D as DocumentId, _ as __brand } from '../../ids.d-B2GAAifq.cjs';
|
|
9
9
|
import { R as RecordsClinicController, C as CaptureRecordsSignature, a as ClinicRequestBaseProps, b as CapturedRecordsSignature } from '../../clinicRequestProps.d-1dCtouGA.cjs';
|
|
10
10
|
export { c as RecordsSignatureContext } from '../../clinicRequestProps.d-1dCtouGA.cjs';
|
|
11
|
-
import { R as RecordsHostSeams, b as RecordsScreen, c as RecordsScreenBaseProps, C as ClinicDraft, e as ClinicBatchBaseProps } from '../../screenProps.d-
|
|
12
|
-
export { a as ClinicLocation, f as RecordsNavAction, g as RecordsNavState, d as RecordsUrlKind, h as RegisterSignaturePng, i as currentRecordsScreen, j as initialRecordsNav, p as popRecordsNav, k as pushRecordsNav, r as recordsNavReducer, l as replaceRecordsNav, m as resetRecordsNav, t as transitionRecordsNav } from '../../screenProps.d-
|
|
11
|
+
import { R as RecordsHostSeams, b as RecordsScreen, c as RecordsScreenBaseProps, C as ClinicDraft, e as ClinicBatchBaseProps } from '../../screenProps.d-CFZe27oI.cjs';
|
|
12
|
+
export { a as ClinicLocation, f as RecordsNavAction, g as RecordsNavState, d as RecordsUrlKind, h as RegisterSignaturePng, i as currentRecordsScreen, j as initialRecordsNav, p as popRecordsNav, k as pushRecordsNav, r as recordsNavReducer, l as replaceRecordsNav, m as resetRecordsNav, t as transitionRecordsNav } from '../../screenProps.d-CFZe27oI.cjs';
|
|
13
13
|
import { d as RecordsRequestView } from '../../models.d-BSqvbTE1.cjs';
|
|
14
14
|
export { g as ConsentState, C as CreateUploadRequestInput, G as GrantConsentInput, k as RECORDS_TERMINAL, R as RecordDocumentMeta, a as RecordEntity, c as RecordForwardItem, l as RecordIdentityField, b as RecordOrigin, m as RecordSeries, n as RecordSeriesPoint, h as RecordsDenialReason, e as RecordsRequestGroupView, i as RecordsRequestStatus, j as RecordsSimpleStatus, f as RecordsView, U as UploadedDocument, o as isTerminalStatus, r as recordsDenialReasonOf } from '../../models.d-BSqvbTE1.cjs';
|
|
15
15
|
import { E as EverfurError } from '../../EverfurError.d-8NHtlgzA.cjs';
|
|
16
16
|
export { a as EverfurErrorCategory, b as EverfurErrorCode } from '../../EverfurError.d-8NHtlgzA.cjs';
|
|
17
|
-
export { w as FactFieldValue, R as RecordClinicianNote, a as RecordClinicianNoteSection, b as RecordCompleteness, c as RecordConflict, d as RecordConflictCandidate, e as RecordDepthView, f as RecordDocumentContributionsView, g as RecordEncounter, h as RecordExamSystem, y as RecordFactEditInput, z as RecordFactRemoveInput, i as RecordLabMarker, j as RecordLabPoint, A as RecordMarker, B as RecordMarkerLatest, C as RecordMarkerPoint, D as RecordMarkerSummary, E as RecordMarkersView, k as RecordPhysicalExam, l as RecordsDepthClient, m as RecordsRequestDocument, G as RecordsSignatureSuggestion, n as RecordsTimelineMedication, o as RecordsTimelineVaccine, p as RecordsTimelineView, q as RecordsTimelineVisit, r as RecordsTimelineWeight } from '../../depth.d-
|
|
17
|
+
export { w as FactFieldValue, R as RecordClinicianNote, a as RecordClinicianNoteSection, b as RecordCompleteness, c as RecordConflict, d as RecordConflictCandidate, e as RecordDepthView, f as RecordDocumentContributionsView, g as RecordEncounter, h as RecordExamSystem, y as RecordFactEditInput, z as RecordFactRemoveInput, i as RecordLabMarker, j as RecordLabPoint, A as RecordMarker, B as RecordMarkerLatest, C as RecordMarkerPoint, D as RecordMarkerSummary, E as RecordMarkersView, k as RecordPhysicalExam, l as RecordsDepthClient, m as RecordsRequestDocument, G as RecordsSignatureSuggestion, n as RecordsTimelineMedication, o as RecordsTimelineVaccine, p as RecordsTimelineView, q as RecordsTimelineVisit, r as RecordsTimelineWeight } from '../../depth.d-qHdXHDd-.cjs';
|
|
18
18
|
export { b as RecordsAsk, R as RecordsAskEntityRef, a as RecordsAskHandler } from '../../recordsAsk.d-C5CGSi3j.cjs';
|
|
19
|
-
export { C as ClinicCall, F as FactOverlay, R as REQUEST_TIMELINE_TITLES, a as RecordSharesStatus, b as RecordsDashboardState, c as RecordsDashboardView, d as RecordsEmptyVariant, e as RequestTimelineEvent, f as RequestTimelineEventKey, g as RequestTimelineEventState, S as ShareRowView, U as UseRecordFactEditState, h as UseRecordPdfLinkState, i as UseRecordSharesState, j as UseRecordsMarkersState, k as applyFactOverlay, l as buildRequestTimeline, m as deriveRecordsDashboardState, n as isFactEditable, p as pickPetRecordsRequest, s as selectClinicCall, o as selectDashboardView, q as selectPrimaryLabel, r as selectRequestList, t as selectRequestTitle, u as useEverfurRecordsClinic, v as useEverfurRecordsClinicBatch, w as useRecordFactEdit, x as useRecordPdfLink, y as useRecordShares, z as useRecordsMarkers } from '../../view.d-
|
|
20
|
-
export { R as RecordsDepthStatus } from '../../useRecordsDepth.d-
|
|
19
|
+
export { C as ClinicCall, F as FactOverlay, R as REQUEST_TIMELINE_TITLES, a as RecordSharesStatus, b as RecordsDashboardState, c as RecordsDashboardView, d as RecordsEmptyVariant, e as RequestTimelineEvent, f as RequestTimelineEventKey, g as RequestTimelineEventState, S as ShareRowView, U as UseRecordFactEditState, h as UseRecordPdfLinkState, i as UseRecordSharesState, j as UseRecordsMarkersState, k as applyFactOverlay, l as buildRequestTimeline, m as deriveRecordsDashboardState, n as isFactEditable, p as pickPetRecordsRequest, s as selectClinicCall, o as selectDashboardView, q as selectPrimaryLabel, r as selectRequestList, t as selectRequestTitle, u as useEverfurRecordsClinic, v as useEverfurRecordsClinicBatch, w as useRecordFactEdit, x as useRecordPdfLink, y as useRecordShares, z as useRecordsMarkers } from '../../view.d-DTNPjiZ1.cjs';
|
|
20
|
+
export { R as RecordsDepthStatus } from '../../useRecordsDepth.d-CKXAAHXI.cjs';
|
|
21
21
|
export { g as RecordPdfLink, f as RecordShare, R as RecordShareAudience, i as RecordShareAudienceScope, d as RecordShareEmailInput, e as RecordShareEmailReceipt, c as RecordShareLink, j as RecordShareRecipientKind, a as RecordsFeatures, q as RecordsPhotoContentType, b as RecordsUploadContentType, s as acceptsPhotos } from '../../features.d-DrQxTw3-.cjs';
|
|
22
|
-
export { a as EverfurDocumentContributionsProps, c as EverfurRecordsDepthProps } from '../../DepthViews.d-
|
|
23
|
-
export { C as CreateClinicRequestBatchInput, b as RECORDS_CLINIC_BATCH_MAX, R as RecordsClinicBatch, a as RecordsClinicBatchClient, c as RecordsClinicBatchItem, d as RecordsClinicBatchResult } from '../../clinicBatch.d-
|
|
22
|
+
export { a as EverfurDocumentContributionsProps, c as EverfurRecordsDepthProps } from '../../DepthViews.d-pFL_ZBZT.cjs';
|
|
23
|
+
export { C as CreateClinicRequestBatchInput, b as RECORDS_CLINIC_BATCH_MAX, R as RecordsClinicBatch, a as RecordsClinicBatchClient, c as RecordsClinicBatchItem, d as RecordsClinicBatchResult } from '../../clinicBatch.d-CLqaih2C.cjs';
|
|
24
24
|
export { C as CreateClinicRequestInput, f as RecordsAuthorizationCopy, b as RecordsAuthorizationSignature, R as RecordsClinic, c as RecordsClinicSearchInput, d as RecordsClinicSearchPage, a as RecordsClinicTarget, e as RecordsRecentClinicsInput, g as RecordsSignatureUploadPolicy } from '../../clinicModels.d-BXgKZqDb.cjs';
|
|
25
25
|
export { WebRecordsUploadTransportOptions, createWebRecordsUploadTransport } from './upload/index.cjs';
|
|
26
26
|
import { F as FileHandle } from '../../ports.d-BX4f4UsB.cjs';
|
|
27
27
|
export { a as UploadPolicyWire, U as UploadTransport } from '../../ports.d-BX4f4UsB.cjs';
|
|
28
28
|
export { E as EverfurResult } from '../../EverfurResult.d-BFH-3s6E.cjs';
|
|
29
29
|
import '../../ErrorPolicyPort.d-DirW9hgO.cjs';
|
|
30
|
-
import '../../requestFunnel.d-
|
|
31
|
-
import '../../config.d-
|
|
32
|
-
import '../../identity.d-
|
|
30
|
+
import '../../requestFunnel.d-CWI2pD3V.cjs';
|
|
31
|
+
import '../../config.d-7bCXvOGn.cjs';
|
|
32
|
+
import '../../identity.d-84x0dV7-.cjs';
|
|
33
33
|
|
|
34
34
|
type RecordsHistoryMode = 'memory' | 'browser';
|
|
35
35
|
interface EverfurRecordsProps extends RecordsHostSeams {
|
|
@@ -1,35 +1,35 @@
|
|
|
1
1
|
/*! @everfur/sdk. Copyright (c) 2026 Strand Health Inc. dba Everfur. All rights reserved. Use is subject to the Everfur SDK License: https://docs.everfur.com/license */
|
|
2
2
|
import { R as RecordsController } from '../../useRecords.d-DWk61a4c.js';
|
|
3
3
|
export { a as RecordsStatus, b as UploadDocumentInput, c as UploadQueueItem, d as UploadSkipReason, U as UseEverfurRecordsState, u as useEverfurRecords } from '../../useRecords.d-DWk61a4c.js';
|
|
4
|
-
export { a as EverfurRecordsPage, E as EverfurRecordsPageProps } from '../../RecordsPage.d-
|
|
4
|
+
export { a as EverfurRecordsPage, E as EverfurRecordsPageProps } from '../../RecordsPage.d-sNRolVdy.js';
|
|
5
5
|
export { E as EverfurRecordsSheet, a as EverfurRecordsSheetLabRenderArgs, b as EverfurRecordsSheetRenderArgs } from '../../sheetSeam.d-B09jf4YC.js';
|
|
6
6
|
import { CSSProperties, ReactNode, PointerEvent } from 'react';
|
|
7
7
|
import { P as PetRef, R as RecordsRequestId } from '../../ids.d-B2GAAifq.js';
|
|
8
8
|
export { B as Brand, D as DocumentId, _ as __brand } from '../../ids.d-B2GAAifq.js';
|
|
9
9
|
import { R as RecordsClinicController, C as CaptureRecordsSignature, a as ClinicRequestBaseProps, b as CapturedRecordsSignature } from '../../clinicRequestProps.d-CjsMg_OD.js';
|
|
10
10
|
export { c as RecordsSignatureContext } from '../../clinicRequestProps.d-CjsMg_OD.js';
|
|
11
|
-
import { R as RecordsHostSeams, b as RecordsScreen, c as RecordsScreenBaseProps, C as ClinicDraft, e as ClinicBatchBaseProps } from '../../screenProps.d-
|
|
12
|
-
export { a as ClinicLocation, f as RecordsNavAction, g as RecordsNavState, d as RecordsUrlKind, h as RegisterSignaturePng, i as currentRecordsScreen, j as initialRecordsNav, p as popRecordsNav, k as pushRecordsNav, r as recordsNavReducer, l as replaceRecordsNav, m as resetRecordsNav, t as transitionRecordsNav } from '../../screenProps.d-
|
|
11
|
+
import { R as RecordsHostSeams, b as RecordsScreen, c as RecordsScreenBaseProps, C as ClinicDraft, e as ClinicBatchBaseProps } from '../../screenProps.d-yUA4k6yK.js';
|
|
12
|
+
export { a as ClinicLocation, f as RecordsNavAction, g as RecordsNavState, d as RecordsUrlKind, h as RegisterSignaturePng, i as currentRecordsScreen, j as initialRecordsNav, p as popRecordsNav, k as pushRecordsNav, r as recordsNavReducer, l as replaceRecordsNav, m as resetRecordsNav, t as transitionRecordsNav } from '../../screenProps.d-yUA4k6yK.js';
|
|
13
13
|
import { d as RecordsRequestView } from '../../models.d-DOwnr8fi.js';
|
|
14
14
|
export { g as ConsentState, C as CreateUploadRequestInput, G as GrantConsentInput, k as RECORDS_TERMINAL, R as RecordDocumentMeta, a as RecordEntity, c as RecordForwardItem, l as RecordIdentityField, b as RecordOrigin, m as RecordSeries, n as RecordSeriesPoint, h as RecordsDenialReason, e as RecordsRequestGroupView, i as RecordsRequestStatus, j as RecordsSimpleStatus, f as RecordsView, U as UploadedDocument, o as isTerminalStatus, r as recordsDenialReasonOf } from '../../models.d-DOwnr8fi.js';
|
|
15
15
|
import { E as EverfurError } from '../../EverfurError.d-8NHtlgzA.js';
|
|
16
16
|
export { a as EverfurErrorCategory, b as EverfurErrorCode } from '../../EverfurError.d-8NHtlgzA.js';
|
|
17
|
-
export { w as FactFieldValue, R as RecordClinicianNote, a as RecordClinicianNoteSection, b as RecordCompleteness, c as RecordConflict, d as RecordConflictCandidate, e as RecordDepthView, f as RecordDocumentContributionsView, g as RecordEncounter, h as RecordExamSystem, y as RecordFactEditInput, z as RecordFactRemoveInput, i as RecordLabMarker, j as RecordLabPoint, A as RecordMarker, B as RecordMarkerLatest, C as RecordMarkerPoint, D as RecordMarkerSummary, E as RecordMarkersView, k as RecordPhysicalExam, l as RecordsDepthClient, m as RecordsRequestDocument, G as RecordsSignatureSuggestion, n as RecordsTimelineMedication, o as RecordsTimelineVaccine, p as RecordsTimelineView, q as RecordsTimelineVisit, r as RecordsTimelineWeight } from '../../depth.d-
|
|
17
|
+
export { w as FactFieldValue, R as RecordClinicianNote, a as RecordClinicianNoteSection, b as RecordCompleteness, c as RecordConflict, d as RecordConflictCandidate, e as RecordDepthView, f as RecordDocumentContributionsView, g as RecordEncounter, h as RecordExamSystem, y as RecordFactEditInput, z as RecordFactRemoveInput, i as RecordLabMarker, j as RecordLabPoint, A as RecordMarker, B as RecordMarkerLatest, C as RecordMarkerPoint, D as RecordMarkerSummary, E as RecordMarkersView, k as RecordPhysicalExam, l as RecordsDepthClient, m as RecordsRequestDocument, G as RecordsSignatureSuggestion, n as RecordsTimelineMedication, o as RecordsTimelineVaccine, p as RecordsTimelineView, q as RecordsTimelineVisit, r as RecordsTimelineWeight } from '../../depth.d-C6XbnFig.js';
|
|
18
18
|
export { b as RecordsAsk, R as RecordsAskEntityRef, a as RecordsAskHandler } from '../../recordsAsk.d-C5CGSi3j.js';
|
|
19
|
-
export { C as ClinicCall, F as FactOverlay, R as REQUEST_TIMELINE_TITLES, a as RecordSharesStatus, b as RecordsDashboardState, c as RecordsDashboardView, d as RecordsEmptyVariant, e as RequestTimelineEvent, f as RequestTimelineEventKey, g as RequestTimelineEventState, S as ShareRowView, U as UseRecordFactEditState, h as UseRecordPdfLinkState, i as UseRecordSharesState, j as UseRecordsMarkersState, k as applyFactOverlay, l as buildRequestTimeline, m as deriveRecordsDashboardState, n as isFactEditable, p as pickPetRecordsRequest, s as selectClinicCall, o as selectDashboardView, q as selectPrimaryLabel, r as selectRequestList, t as selectRequestTitle, u as useEverfurRecordsClinic, v as useEverfurRecordsClinicBatch, w as useRecordFactEdit, x as useRecordPdfLink, y as useRecordShares, z as useRecordsMarkers } from '../../view.d-
|
|
20
|
-
export { R as RecordsDepthStatus } from '../../useRecordsDepth.d-
|
|
19
|
+
export { C as ClinicCall, F as FactOverlay, R as REQUEST_TIMELINE_TITLES, a as RecordSharesStatus, b as RecordsDashboardState, c as RecordsDashboardView, d as RecordsEmptyVariant, e as RequestTimelineEvent, f as RequestTimelineEventKey, g as RequestTimelineEventState, S as ShareRowView, U as UseRecordFactEditState, h as UseRecordPdfLinkState, i as UseRecordSharesState, j as UseRecordsMarkersState, k as applyFactOverlay, l as buildRequestTimeline, m as deriveRecordsDashboardState, n as isFactEditable, p as pickPetRecordsRequest, s as selectClinicCall, o as selectDashboardView, q as selectPrimaryLabel, r as selectRequestList, t as selectRequestTitle, u as useEverfurRecordsClinic, v as useEverfurRecordsClinicBatch, w as useRecordFactEdit, x as useRecordPdfLink, y as useRecordShares, z as useRecordsMarkers } from '../../view.d-BnUDSQXz.js';
|
|
20
|
+
export { R as RecordsDepthStatus } from '../../useRecordsDepth.d-B2ewVbRm.js';
|
|
21
21
|
export { g as RecordPdfLink, f as RecordShare, R as RecordShareAudience, i as RecordShareAudienceScope, d as RecordShareEmailInput, e as RecordShareEmailReceipt, c as RecordShareLink, j as RecordShareRecipientKind, a as RecordsFeatures, q as RecordsPhotoContentType, b as RecordsUploadContentType, s as acceptsPhotos } from '../../features.d-DrQxTw3-.js';
|
|
22
|
-
export { a as EverfurDocumentContributionsProps, c as EverfurRecordsDepthProps } from '../../DepthViews.d-
|
|
23
|
-
export { C as CreateClinicRequestBatchInput, b as RECORDS_CLINIC_BATCH_MAX, R as RecordsClinicBatch, a as RecordsClinicBatchClient, c as RecordsClinicBatchItem, d as RecordsClinicBatchResult } from '../../clinicBatch.d-
|
|
22
|
+
export { a as EverfurDocumentContributionsProps, c as EverfurRecordsDepthProps } from '../../DepthViews.d-qXt9OMgz.js';
|
|
23
|
+
export { C as CreateClinicRequestBatchInput, b as RECORDS_CLINIC_BATCH_MAX, R as RecordsClinicBatch, a as RecordsClinicBatchClient, c as RecordsClinicBatchItem, d as RecordsClinicBatchResult } from '../../clinicBatch.d-DXDIL1lC.js';
|
|
24
24
|
export { C as CreateClinicRequestInput, f as RecordsAuthorizationCopy, b as RecordsAuthorizationSignature, R as RecordsClinic, c as RecordsClinicSearchInput, d as RecordsClinicSearchPage, a as RecordsClinicTarget, e as RecordsRecentClinicsInput, g as RecordsSignatureUploadPolicy } from '../../clinicModels.d-CaS64-P-.js';
|
|
25
25
|
export { WebRecordsUploadTransportOptions, createWebRecordsUploadTransport } from './upload/index.js';
|
|
26
26
|
import { F as FileHandle } from '../../ports.d-BX4f4UsB.js';
|
|
27
27
|
export { a as UploadPolicyWire, U as UploadTransport } from '../../ports.d-BX4f4UsB.js';
|
|
28
28
|
export { E as EverfurResult } from '../../EverfurResult.d-D_-254ZY.js';
|
|
29
29
|
import '../../ErrorPolicyPort.d-68yrE3BE.js';
|
|
30
|
-
import '../../requestFunnel.d-
|
|
31
|
-
import '../../config.d-
|
|
32
|
-
import '../../identity.d-
|
|
30
|
+
import '../../requestFunnel.d-DcQIAs45.js';
|
|
31
|
+
import '../../config.d-cqyvpzDb.js';
|
|
32
|
+
import '../../identity.d-BXztMVYM.js';
|
|
33
33
|
|
|
34
34
|
type RecordsHistoryMode = 'memory' | 'browser';
|
|
35
35
|
interface EverfurRecordsProps extends RecordsHostSeams {
|
|
@@ -391,7 +391,7 @@ return jsxs("div",{style:row(index),children:[
|
|
|
391
391
|
/* @__PURE__ */jsx("span",{style:s.fieldValue,children:system.finding})]},system.system))]},exam.examId)),"record-document-exams"):null,depth&&depth.clinicianNotes.length>0?section(COPY.clinicianNotes,depth.clinicianNotes.map((note,index)=>/* @__PURE__ */jsxs("div",{style:{...s.block,...index>0?s.rowDivider:{}},children:[note.observedOn?/* @__PURE__ */jsx("span",{style:s.blockDate,children:formatRecordsDate(note.observedOn)}):null,note.sections.filter(sec=>sec.text).map((sec,i)=>/* @__PURE__ */jsxs("div",{style:s.noteSection,children:[
|
|
392
392
|
/* @__PURE__ */jsx("span",{style:s.noteLabel,children:soapSectionLabel(sec.section)}),
|
|
393
393
|
/* @__PURE__ */jsx("p",{style:s.noteBody,children:sec.text})]},`${sec.section}-${i}`))]},note.noteId)),"record-document-notes"):null,disclaimerRepeatsFootnote(record.disclaimer)?null:/* @__PURE__ */jsx("p",{style:s.disclaimer,children:record.disclaimer})]})}function useDocStyles(){let theme=useEverfurTheme();return useMemo(()=>makeDocStyles(theme),[theme])}function makeDocStyles(theme){let{color:color,space:space,radius:radius,type:type}=theme,text3=(size,multiplier,fg,weight="regular")=>({margin:0,...faceCss(theme,weight),fontSize:size,lineHeight:`${Math.round(size*multiplier)}px`,color:fg}),monoText=(size,fg)=>({margin:0,...faceCss(theme,"mono"),fontSize:size,lineHeight:`${size+space.xs-1}px`,color:fg,letterSpacing:type.letterSpacing.eyebrow/2,textTransform:"uppercase"}),hairline=`1px solid ${color.borderHairlineGreen}`;return{empty:{...text3(type.size.body,type.lineHeight.normal,color.text.muted,"medium"),textAlign:"center",padding:`${space.xxl}px ${space.xxl}px`},page:{padding:`0 ${space.lg+space.xs}px ${space.xxl+space.lg}px`,...faceCss(theme,"regular")},letterhead:{display:"flex",flexDirection:"column",alignItems:"center",gap:space.xs+space.xs/2,padding:`${space.md}px 0 ${space.lg+space.xs+space.xs/2}px`,borderBottom:`2px solid ${color.brandInk}`,marginBottom:space.sm},wordmark:{...text3(type.size.heading,type.lineHeight.snug,color.brandInk,"bold"),letterSpacing:type.letterSpacing.headerBrand},docTitle:{...monoText(type.size.caption,color.brandInk),marginTop:space.sm+space.xs/2,letterSpacing:type.letterSpacing.eyebrow+.4},petName:text3(type.size.verdict+space.xs/2,type.lineHeight.tight,color.text.primary),generated:{...monoText(type.size.tiny,color.text.muted),textTransform:"none"},section:{marginTop:space.lg+space.xs+space.xs/2},sectionHeader:{display:"flex",alignItems:"center",gap:space.sm+space.xs/2,marginBottom:space.sm},sectionTitle:monoText(type.size.tiny,color.brandInk),rule:{flex:1,height:1,backgroundColor:color.borderHairlineGreen},row:{display:"flex",alignItems:"flex-start",justifyContent:"space-between",gap:space.md+space.xs/2,padding:`${space.sm+1}px 0`},rowDivider:{borderTop:hairline},rowFlag:{backgroundColor:color.badgeBgCritical,margin:`0 -${space.sm}px`,padding:`${space.sm+1}px ${space.sm}px`,borderRadius:radius.xs},rowMain:{display:"flex",flexDirection:"column",minWidth:0},rowRight:{display:"flex",flexDirection:"column",alignItems:"flex-end",gap:space.xs/2},rowLabel:{...text3(type.size.body,type.lineHeight.normal,color.text.primary,"medium")},rowValue:{...text3(type.size.body,type.lineHeight.normal,color.text.primary,"bold"),textAlign:"right"},alert:{color:color.danger},rowMeta:{marginTop:space.xs/2,...faceCss(theme,"mono"),fontSize:type.size.tiny,lineHeight:`${type.size.body}px`,color:color.text.muted},markerStatus:monoText(type.size.micro,color.text.muted),block:{padding:`${space.sm+space.xs/2}px 0`},blockDate:{...monoText(type.size.tiny,color.text.muted),display:"block",marginBottom:space.xs+space.xs/2},fieldRow:{display:"flex",alignItems:"flex-start",gap:space.md+space.xs/2,padding:`${space.xs-1}px 0`},fieldLabel:{width:120,flexShrink:0,...text3(type.size.bodyTight,type.lineHeight.normal,color.text.muted,"medium")},fieldValue:{flex:1,...text3(type.size.bodyTight,type.lineHeight.normal,color.text.primary,"medium")},noteSection:{marginTop:space.sm},noteLabel:{...monoText(type.size.tiny,color.brandInk),display:"block",marginBottom:space.xs/2},noteBody:text3(type.size.bodyTight,type.lineHeight.relaxed,color.text.primary),disclaimer:{...text3(type.size.tiny,type.lineHeight.relaxed,color.text.muted),marginTop:radius.xl,paddingTop:space.md+space.xs/2,borderTop:hairline}}}var FACT_EDIT_COPY=/* @__PURE__ */Object.freeze({editA11y:label=>`Edit ${label}. Correct or remove this record detail.`,title:label=>`Edit ${label}`,helper:"Corrects your record. Your vet can still review it.",close:"Close",closeEditorA11y:"Close editor",save:"Save changes",saving:"Saving...",remove:"Remove this detail",confirmRemove:"Remove this detail from your record? This can't be undone.",removeConfirm:"Remove",removing:"Removing...",keep:"Keep",noChange:"Change a value before saving.",saved:"Saved.",removed:"Removed.",detail:"record detail"});function factEditErrorMessage(error,mode){return isRecordsConsentRequired(error)?mode==="remove"?"Records access for this pet is off, so this detail cannot be removed.":"Records access for this pet is off, so this detail cannot be changed.":isFactReviewerLocked(error)?mode==="remove"?"A clinician already reviewed this detail, so it can't be removed here.":"A clinician already reviewed this detail, so it can't be changed here.":mode==="remove"?"Couldn't remove that. Please check your connection and try again.":"Couldn't save that. Please check your connection and try again."}var EMPTY_FACT_OVERLAY=/* @__PURE__ */Object.freeze({edits:/* @__PURE__ */Object.freeze({}),removed:/* @__PURE__ */Object.freeze([])});function applyFactOverlay(entities,overlay){if(Object.keys(overlay.edits).length===0&&overlay.removed.length===0)return entities;let out=[];for(let entity of entities){let key=entity.canonicalKey??null;if(key!==null&&overlay.removed.includes(key))continue;let edited=key!==null?overlay.edits[key]:void 0;out.push(edited===void 0?entity:/* @__PURE__ */Object.freeze({...entity,value:edited}))}/* @__PURE__ */
|
|
394
|
-
return Object.freeze(out)}function isFactEditable(entity){return typeof entity.canonicalKey=="string"&&entity.canonicalKey.length>0}function defaultFactKey(){return`records-fact-${Date.now().toString(36)}`}function useRecordFactEdit(petRef,opts={}){let client=useEverfurRecordsDepthClient(),{userRef:userRef}=useEverfurContext(),[overlay,setOverlay]=useState(EMPTY_FACT_OVERLAY),[busy,setBusy]=useState(false),[error,setError]=useState(null),scope=useMemo(()=>({}),[client,petRef,userRef]),[darkScope,setDarkScope]=useState(null),markDark=useCallback(()=>setDarkScope(scope),[scope]),[refused,setRefused]=useState(null);useEffect(()=>{if(userRef===null||client.readFeatures===void 0)return;let current=true;return client.readFeatures().then(value=>{current&&value.features.fact_edit===false&&setRefused(scope)},()=>{}),()=>{current=false}},[client,userRef,scope]);let available=userRef!==null&&darkScope!==scope&&refused!==scope,locked=useRef(false),mintRef=useRef(opts.newIdempotencyKey);mintRef.current=opts.newIdempotencyKey;let mint=useCallback(()=>(mintRef.current??defaultFactKey)(),[]),settle=useCallback((result,rollback,mode)=>{if(setBusy(false),!result.ok){if(rollback(),isDarkRouteError(result.error)){markDark();return}setError(factEditErrorMessage(result.error,mode))}},[markDark]),edit=useCallback(async(entity,value)=>{let key=entity.canonicalKey??"",next=value.trim();if(locked.current||key.length===0||next.length===0)return err(makeEverfurError("validationFailed",{retryable:false}));locked.current=true,setBusy(true),setError(null);let snapshot=overlay;setOverlay(current=>({...current,edits:{...current.edits,[key]:next}}));let result=await client.editFact(petRef,{entityType:entity.category,canonicalKey:key,correctedFields:factCorrectionFor(entity.value,next),idempotencyKey:mint()});return locked.current=false,settle(result,()=>setOverlay(snapshot),"edit"),result},[client,petRef,overlay,settle,mint]),remove=useCallback(async entity=>{let key=entity.canonicalKey??"";if(locked.current||key.length===0)return err(makeEverfurError("validationFailed",{retryable:false}));locked.current=true,setBusy(true),setError(null);let snapshot=overlay;setOverlay(current=>({...current,removed:[...current.removed,key]}));let result=await client.removeFact(petRef,{entityType:entity.category,canonicalKey:key,idempotencyKey:mint()});return locked.current=false,settle(result,()=>setOverlay(snapshot),"remove"),result},[client,petRef,overlay,settle,mint]),clearError=useCallback(()=>setError(null),[]);return useMemo(()=>({overlay:overlay,busy:busy,error:error,available:available,edit:edit,remove:remove,clearError:clearError}),[overlay,busy,error,available,edit,remove,clearError])}var FALLBACK_TITLE=/* @__PURE__ */Object.freeze({vaccination:"Vaccination",medication:"Medication",problem:"Problem",body_weight:"Weight",allergy:"Allergy",vital:"Vital",lab_result:"Lab result",parasite_prevention:"Preventive"}),GIVEN_PREFIX="Given",ISO_DATE_PREFIX=/^\d{4}-\d{2}-\d{2}/,DETAIL_SEPARATOR=" · ";function joinDetail(parts){let kept=parts.filter(part=>part!==null&&part.trim().length>0);return kept.length>0?kept.join(DETAIL_SEPARATOR):null}function rowTitle(facts,humanizeCategory){let label=facts.label.trim();if(label.length>0)return label;let fallback=FALLBACK_TITLE[facts.category];return fallback!==void 0?fallback:humanizeCategory(facts.category)}function entityRowSummary(facts,fmt){let title=rowTitle(facts,fmt.humanize),value=fmt.formatEntityValue(facts.value,facts.unit),shownValue=value.trim().length>0?value:null,rawDate=facts.observedAt!==null&&facts.observedAt.trim().length>0?fmt.formatRecordsDate(facts.observedAt):null,observed=rawDate!==null&&rawDate!=="-"?rawDate:null;switch(facts.category){case"vaccination":{let valueIsDate=facts.value!==null&&ISO_DATE_PREFIX.test(facts.value.trim()),givenOn=valueIsDate?fmt.formatRecordsDate(facts.value):observed;return givenOn!==null&&givenOn!=="-"?{title:title,detail:joinDetail([`${GIVEN_PREFIX} ${givenOn}`,valueIsDate?null:shownValue])}:{title:title,detail:joinDetail([shownValue])}}case"medication":return{title:title,detail:joinDetail([observed])};case"problem":return{title:title,detail:joinDetail([observed])};case"body_weight":return{title:title,detail:joinDetail([observed])};case"allergy":return{title:title,detail:joinDetail([observed])};case"vital":return{title:title,detail:joinDetail([shownValue,observed])};case"lab_result":return{title:title,detail:joinDetail([shownValue,observed])};default:return{title:title,detail:joinDetail([shownValue,observed])}}}function markerStatusTone(status){return status==="above"||status==="below"?"critical":status==="in_range"?"positive":"neutral"}function markerStatusSpoken(status){switch(status){case"above":return"above the reference range";case"below":return"below the reference range";case"in_range":return"within range";default:return"no reference range on file"}}function rangePhrase(point){return point.refLow!==null&&point.refHigh!==null?`, reference range ${point.refLow} to ${point.refHigh}`:point.refLow!==null?`, reference range at least ${point.refLow}`:point.refHigh!==null?`, reference range up to ${point.refHigh}`:""}function formatReferenceRange(point,unit){let u=unit?` ${unit}`:"";return point.refLow!==null&&point.refHigh!==null?`${point.refLow}-${point.refHigh}${u}`:point.refLow!==null?`≥ ${point.refLow}${u}`:point.refHigh!==null?`≤ ${point.refHigh}${u}`:"-"}function markerPointSpoken(marker,point){let reviewed=point.reviewed?", reviewed by our team":"",clinic=point.sourceClinic?`, from ${point.sourceClinic}`:"";return`${formatRecordsDate(point.at)}: ${formatMarkerReading(point.value,marker.unit,point.qualitativeResult)}, ${markerStatusSpoken(point.status)}${rangePhrase(point)}${clinic}${reviewed}`}function markersFeaturedFirst(markers,featuredMarkerId){if(!featuredMarkerId)return markers;let at=markers.findIndex(marker=>marker.markerId===featuredMarkerId);return at<=0?markers:[markers[at],...markers.slice(0,at),...markers.slice(at+1)]}var MARKER_CAROUSEL_MAX_DOTS=7;function markerDotWindow(activeIndex,total,max=MARKER_CAROUSEL_MAX_DOTS){let count=Math.max(0,Math.min(total,max)),start=total<=max?0:Math.max(0,Math.min(activeIndex-Math.floor(max/2),total-max));return Array.from({length:count},(_,i)=>start+i)}function lead(petName){return petName?.trim()||"my pet"}function clause(text3){let t=text3.trim();return/[.!?]$/.test(t)?t:`${t}.`}function buildMarkerAskPrompt(petName,input){let name=input.canonicalName.trim()||"a lab marker",parts=[`I'm looking at ${lead(petName)}'s ${name}`],stats=[input.latestValueText?.trim(),input.statusText?.trim(),input.trajectoryText?.trim()].filter(Boolean).join(", ");return parts[0]+=stats?`: ${stats}.`:".",input.meaningText?.trim()&&parts.push(clause(input.meaningText)),parts.push(`What does this trend tell me, and should I do anything differently for ${lead(petName)}?`),{prompt:parts.join(" "),entityRef:{type:"marker",id:input.markerId,payload:{marker:name,...input.statusText?.trim()?{status:input.statusText.trim()}:{}}}}}function buildMarkerSummaryAskPrompt(petName,summary,petId){let{totalMarkers:totalMarkers,inRangeCount:inRangeCount,outOfRangeCount:outOfRangeCount,unknownCount:unknownCount}=summary;if(totalMarkers===0)return{prompt:`I'm looking at ${lead(petName)}'s lab markers, but there aren't any on file yet. What lab work is worth running for ${lead(petName)}?`,entityRef:{type:"marker_summary",id:petId,payload:{total:0}}};let tail=unknownCount>0?`, ${unknownCount} without a reference range`:"";return{prompt:`I'm looking at ${lead(petName)}'s lab markers: ${totalMarkers} total, ${inRangeCount} in range, ${outOfRangeCount} out of range${tail}. What should I focus on?`,entityRef:{type:"marker_summary",id:petId,payload:{total:totalMarkers,inRange:inRangeCount,outOfRange:outOfRangeCount,unknown:unknownCount}}}}function buildMarkerReadingAskPrompt(petName,input){let name=input.canonicalName.trim()||"a lab marker",bits=[`${name}: ${input.valueText.trim()}`];input.collectedAt?.trim()&&bits.push(`collected ${input.collectedAt.trim()}`),input.sourceClinic?.trim()&&bits.push(`from ${input.sourceClinic.trim()}`),input.referenceText?.trim()&&bits.push(`reference range ${input.referenceText.trim()}`),input.flagged&&bits.push(`flagged ${input.flagged}`);let payload={marker:name};return input.flagged&&(payload.status=input.flagged),input.reviewed!==void 0&&(payload.reviewed=input.reviewed),{prompt:`I'm looking at ${lead(petName)}'s ${bits.join(", ")}. What does this mean, and should I be concerned?`,entityRef:{type:"lab_reading",id:input.entityId,payload:payload}}}function buildRecordsRequestAskPrompt(petName,input,requestId2){let clinic=input.clinicName?.trim(),held=input.heldItemCount??0,heldPhrase=held>0?`, ${held} fact${held===1?"":"s"} being verified`:"";return{prompt:`I'm looking at ${lead(petName)}'s records request${clinic?` to ${clinic}`:""}, status: ${input.statusLabel.trim()}${heldPhrase}. What does this status mean, and what happens next?`,entityRef:{type:"records_request",id:requestId2,payload:{status:input.status,held:held,...clinic?{clinic:clinic}:{}}}}}var ENTITY_TYPE_MAP=/* @__PURE__ */Object.freeze({vaccination:"vaccine",medication:"medication",body_weight:"weight",vital:"weight"});function buildEntityRowAskPrompt(petName,input,entityType,entityId){let kind=input.entityTypeLabel.trim()||"record",title=input.title.trim()||kind,detail=input.detail?.trim();return{prompt:`I'm looking at ${lead(petName)}'s ${kind.toLowerCase()}: ${title}${detail?`, ${detail}`:""}. What does this mean, and what should I keep on top of for ${lead(petName)}?`,entityRef:{type:ENTITY_TYPE_MAP[entityType]??entityType,id:entityId,payload:{kind:kind,title:title,...detail?{detail:detail}:{}}}}}function buildUpcomingCareAskPrompt(petName,items,petId){let list=items.filter(i=>i.label.trim()),entityRef={type:"upcoming_care",id:petId};if(list.length===0)return{prompt:`I'm looking at ${lead(petName)}'s upcoming care, but nothing is scheduled yet. What preventive care and checkups should ${lead(petName)} be on?`,entityRef:entityRef};let named=[...list].sort((a,b)=>(a.tone==="overdue"?0:1)-(b.tone==="overdue"?0:1)).slice(0,4).map(i=>i.relativeText.trim()?`${i.label.trim()} (${i.relativeText.trim().toLowerCase()})`:i.label.trim());return{prompt:`I'm looking at ${lead(petName)}'s upcoming care: ${named.join(", ")}. What should I prioritize for ${lead(petName)}, and how do I stay on top of these?`,entityRef:entityRef}}function buildPhysicalExamAskPrompt(petName,input,examId){let parts=[`I'm looking at ${lead(petName)}'s physical exam${input.observedOn?.trim()?` from ${input.observedOn.trim()}`:""}.`],abnormal=input.abnormal.filter(a=>a.system.trim());return abnormal.length>0?(parts.push(`Abnormal: ${abnormal.slice(0,6).map(a=>`${a.system.trim()}: ${a.finding.trim()}`).join("; ")}.`),parts.push(`What do these findings mean, and what should I follow up on for ${lead(petName)}?`)):parts.push(`Everything examined came back normal. What does this tell me about ${lead(petName)}'s health?`),{prompt:parts.join(" "),entityRef:{type:"physical_exam",id:examId}}}function buildVisitNoteAskPrompt(petName,input,noteId){let parts=[`I'm looking at ${lead(petName)}'s visit notes${input.observedOn?.trim()?` from ${input.observedOn.trim()}`:""}.`];for(let s of input.sections.filter(section=>section.text.trim()).slice(0,3))parts.push(`${s.label.trim()||"Note"}: ${clause(s.text)}`);return parts.push(`Can you summarize what happened and what I should follow up on for ${lead(petName)}?`),{prompt:parts.join(" "),entityRef:{type:"visit",id:noteId}}}function buildConflictAskPrompt(petName,input,conflictId){let scope=input.scopeLabel.trim()||"a detail",cands=input.candidates.filter(c=>c.value.trim()),rendered=cands.slice(0,3).map(c=>`"${c.value.trim()}"${c.clinicName?.trim()?` (${c.clinicName.trim()})`:""}`).join(" vs ");return{prompt:`Two of ${lead(petName)}'s documents disagree on ${scope}: ${rendered}. Which is likely correct, and what should I ask my vet?`,entityRef:{type:"conflict",id:conflictId,payload:{field:scope,severity:input.severity,values:cands.map(c=>c.value.trim()).join(" | ")}}}}var FOCUSABLE='button:not([disabled]), input:not([disabled]), textarea:not([disabled]), select:not([disabled]), a[href], [tabindex]:not([tabindex="-1"])';function isDialogElement(node){return node.tagName==="DIALOG"}function useModalDialog(open,onClose,returnFocusTo,options){let escapeAtKeyDown=options?.escapeAtKeyDown===true,dialogRef=useRef(null),wasOpen=useRef(false),opener=useRef(null),trigger=useRef(returnFocusTo);trigger.current=returnFocusTo;let restoreFocus=useCallback(()=>{if(!wasOpen.current)return;wasOpen.current=false;let target=trigger.current===void 0?opener.current:trigger.current.current;target&&target.isConnected&&target.focus(),(!target||!target.isConnected||document.activeElement===target)&&(opener.current=null)},[]);useEffect(()=>{let node=dialogRef.current;if(!wasOpen.current){let active=typeof document>"u"?null:document.activeElement;active!==null&&node!==null&&node.contains(active)||(opener.current=active instanceof HTMLElement?active:null)}if(wasOpen.current=true,node===null)return;if(!isDialogElement(node)){node.contains(document.activeElement)||(node.querySelector(FOCUSABLE)??node).focus();return}let dialog=node;typeof dialog.showModal=="function"?dialog.open||dialog.showModal():dialog.setAttribute("open","")},[open,restoreFocus]),useEffect(()=>restoreFocus,[restoreFocus]),useEffect(()=>{let node=dialogRef.current;if(node===null||!isDialogElement(node))return;let dialog=node;if(typeof dialog.showModal!="function")return;let lastFocused=null,onFocusIn=event=>{event.target instanceof HTMLElement&&(lastFocused=event.target)},onNativeClose=()=>{if(!dialog.isConnected||dialog.open)return;let back=lastFocused;dialog.showModal(),back!==null&&back.isConnected&&dialog.contains(back)&&document.activeElement!==back&&back.focus()};return dialog.addEventListener("focusin",onFocusIn),dialog.addEventListener("close",onNativeClose),()=>{dialog.removeEventListener("focusin",onFocusIn),dialog.removeEventListener("close",onNativeClose)}},[open]);let onKeyDown=useCallback(event=>{let node=dialogRef.current;if(node===null)return;if(event.key==="Escape"&&!isDialogElement(node)){event.preventDefault(),event.stopPropagation(),onClose();return}if(event.key==="Escape"&&escapeAtKeyDown);if(event.key!=="Tab")return;let focusable=Array.from(node.querySelectorAll(FOCUSABLE)),first=focusable[0],last=focusable[focusable.length-1];if(!first||!last){event.preventDefault();return}let active=document.activeElement;event.shiftKey&&(active===first||!node.contains(active))?(event.preventDefault(),last.focus()):!event.shiftKey&&(active===last||!node.contains(active))&&(event.preventDefault(),first.focus())},[onClose,escapeAtKeyDown]),onCancel=useCallback(event=>{event.target===event.currentTarget&&(event.preventDefault(),onClose())},[onClose]);return{dialogRef:dialogRef,onKeyDown:onKeyDown,onCancel:onCancel}}var FOCUSABLE2='button:not([disabled]), input:not([disabled]), textarea:not([disabled]), select:not([disabled]), a[href], [tabindex]:not([tabindex="-1"])';function RecordsDialog({label:label,onClose:onClose,shape:shape="modal",returnFocusTo:returnFocusTo,panelStyle:panelStyle,testID:testID,children:children}){let{styles:styles}=useScreenStyles(),dialog=useModalDialog(true,onClose,returnFocusTo);useEffect(()=>{let node=dialog.dialogRef.current;node===null||node.contains(document.activeElement)||(node.querySelector(FOCUSABLE2)??node).focus()},[dialog.dialogRef]);let side=shape==="side";/* @__PURE__ */
|
|
394
|
+
return Object.freeze(out)}function isFactEditable(entity){return typeof entity.canonicalKey=="string"&&entity.canonicalKey.length>0}function defaultFactKey(){return`records-fact-${Date.now().toString(36)}`}function useRecordFactEdit(petRef,opts={}){let client=useEverfurRecordsDepthClient(),{userRef:userRef}=useEverfurContext(),[overlay,setOverlay]=useState(EMPTY_FACT_OVERLAY),[busy,setBusy]=useState(false),[error,setError]=useState(null),scope=useMemo(()=>({}),[client,petRef,userRef]),[darkScope,setDarkScope]=useState(null),markDark=useCallback(()=>setDarkScope(scope),[scope]),[refused,setRefused]=useState(null);useEffect(()=>{if(userRef===null||client.readFeatures===void 0)return;let current=true;return client.readFeatures().then(value=>{current&&value.features.fact_edit===false&&setRefused(scope)},()=>{}),()=>{current=false}},[client,userRef,scope]);let available=userRef!==null&&darkScope!==scope&&refused!==scope,locked=useRef(false),mintRef=useRef(opts.newIdempotencyKey);mintRef.current=opts.newIdempotencyKey;let mint=useCallback(()=>(mintRef.current??defaultFactKey)(),[]),settle=useCallback((result,rollback,mode)=>{if(setBusy(false),!result.ok){if(rollback(),isDarkRouteError(result.error)){markDark();return}setError(factEditErrorMessage(result.error,mode))}},[markDark]),edit=useCallback(async(entity,value)=>{let key=entity.canonicalKey??"",next=value.trim();if(locked.current||key.length===0||next.length===0)return err(makeEverfurError("validationFailed",{retryable:false}));locked.current=true,setBusy(true),setError(null);let snapshot=overlay;setOverlay(current=>({...current,edits:{...current.edits,[key]:next}}));let result=await client.editFact(petRef,{entityType:entity.category,canonicalKey:key,correctedFields:factCorrectionFor(entity.value,next),idempotencyKey:mint()});return locked.current=false,settle(result,()=>setOverlay(snapshot),"edit"),result},[client,petRef,overlay,settle,mint]),remove=useCallback(async entity=>{let key=entity.canonicalKey??"";if(locked.current||key.length===0)return err(makeEverfurError("validationFailed",{retryable:false}));locked.current=true,setBusy(true),setError(null);let snapshot=overlay;setOverlay(current=>({...current,removed:[...current.removed,key]}));let result=await client.removeFact(petRef,{entityType:entity.category,canonicalKey:key,idempotencyKey:mint()});return locked.current=false,settle(result,()=>setOverlay(snapshot),"remove"),result},[client,petRef,overlay,settle,mint]),clearError=useCallback(()=>setError(null),[]);return useMemo(()=>({overlay:overlay,busy:busy,error:error,available:available,edit:edit,remove:remove,clearError:clearError}),[overlay,busy,error,available,edit,remove,clearError])}var FALLBACK_TITLE=/* @__PURE__ */Object.freeze({vaccination:"Vaccination",medication:"Medication",problem:"Problem",body_weight:"Weight",allergy:"Allergy",vital:"Vital",lab_result:"Lab result",parasite_prevention:"Preventive"}),GIVEN_PREFIX="Given",ISO_DATE_PREFIX=/^\d{4}-\d{2}-\d{2}/,DETAIL_SEPARATOR=" · ";function joinDetail(parts){let kept=parts.filter(part=>part!==null&&part.trim().length>0);return kept.length>0?kept.join(DETAIL_SEPARATOR):null}function rowTitle(facts,humanizeCategory){let label=facts.label.trim();if(label.length>0)return label;let fallback=FALLBACK_TITLE[facts.category];return fallback!==void 0?fallback:humanizeCategory(facts.category)}function entityRowSummary(facts,fmt){let title=rowTitle(facts,fmt.humanize),value=fmt.formatEntityValue(facts.value,facts.unit),shownValue=value.trim().length>0?value:null,rawDate=facts.observedAt!==null&&facts.observedAt.trim().length>0?fmt.formatRecordsDate(facts.observedAt):null,observed=rawDate!==null&&rawDate!=="-"?rawDate:null;switch(facts.category){case"vaccination":{let valueIsDate=facts.value!==null&&ISO_DATE_PREFIX.test(facts.value.trim()),givenOn=valueIsDate?fmt.formatRecordsDate(facts.value):observed;return givenOn!==null&&givenOn!=="-"?{title:title,detail:joinDetail([`${GIVEN_PREFIX} ${givenOn}`,valueIsDate?null:shownValue])}:{title:title,detail:joinDetail([shownValue])}}case"medication":return{title:title,detail:joinDetail([observed])};case"problem":return{title:title,detail:joinDetail([observed])};case"body_weight":return{title:title,detail:joinDetail([observed])};case"allergy":return{title:title,detail:joinDetail([observed])};case"vital":return{title:title,detail:joinDetail([shownValue,observed])};case"lab_result":return{title:title,detail:joinDetail([shownValue,observed])};default:return{title:title,detail:joinDetail([shownValue,observed])}}}function markerStatusTone(status){return status==="above"||status==="below"?"critical":status==="in_range"?"positive":"neutral"}function markerStatusSpoken(status){switch(status){case"above":return"above the reference range";case"below":return"below the reference range";case"in_range":return"within range";default:return"no reference range on file"}}function rangePhrase(point){return point.refLow!==null&&point.refHigh!==null?`, reference range ${point.refLow} to ${point.refHigh}`:point.refLow!==null?`, reference range at least ${point.refLow}`:point.refHigh!==null?`, reference range up to ${point.refHigh}`:""}function formatReferenceRange(point,unit){let u=unit?` ${unit}`:"";return point.refLow!==null&&point.refHigh!==null?`${point.refLow}-${point.refHigh}${u}`:point.refLow!==null?`≥ ${point.refLow}${u}`:point.refHigh!==null?`≤ ${point.refHigh}${u}`:"-"}function markerPointSpoken(marker,point){let reviewed=point.reviewed?", reviewed by our team":"",clinic=point.sourceClinic?`, from ${point.sourceClinic}`:"";return`${formatRecordsDate(point.at)}: ${formatMarkerReading(point.value,marker.unit,point.qualitativeResult)}, ${markerStatusSpoken(point.status)}${rangePhrase(point)}${clinic}${reviewed}`}function markersFeaturedFirst(markers,featuredMarkerId){if(!featuredMarkerId)return markers;let at=markers.findIndex(marker=>marker.markerId===featuredMarkerId);return at<=0?markers:[markers[at],...markers.slice(0,at),...markers.slice(at+1)]}var MARKER_CAROUSEL_MAX_DOTS=7;function markerDotWindow(activeIndex,total,max=MARKER_CAROUSEL_MAX_DOTS){let count=Math.max(0,Math.min(total,max)),start=total<=max?0:Math.max(0,Math.min(activeIndex-Math.floor(max/2),total-max));return Array.from({length:count},(_,i)=>start+i)}function lead(petName){return petName?.trim()||"my pet"}function clause(text3){let t=text3.trim();return/[.!?]$/.test(t)?t:`${t}.`}function buildMarkerAskPrompt(petName,input){let name=input.canonicalName.trim()||"a lab marker",parts=[`I'm looking at ${lead(petName)}'s ${name}`],stats=[input.latestValueText?.trim(),input.statusText?.trim(),input.trajectoryText?.trim()].filter(Boolean).join(", ");return parts[0]+=stats?`: ${stats}.`:".",input.meaningText?.trim()&&parts.push(clause(input.meaningText)),parts.push(`What does this trend tell me, and should I do anything differently for ${lead(petName)}?`),{prompt:parts.join(" "),entityRef:{type:"marker",id:input.markerId,payload:{marker:name,...input.statusText?.trim()?{status:input.statusText.trim()}:{}}}}}function buildMarkerSummaryAskPrompt(petName,summary,petId){let{totalMarkers:totalMarkers,inRangeCount:inRangeCount,outOfRangeCount:outOfRangeCount,unknownCount:unknownCount}=summary;if(totalMarkers===0)return{prompt:`I'm looking at ${lead(petName)}'s lab markers, but there aren't any on file yet. What lab work is worth running for ${lead(petName)}?`,entityRef:{type:"marker_summary",id:petId,payload:{total:0}}};let tail=unknownCount>0?`, ${unknownCount} without a reference range`:"";return{prompt:`I'm looking at ${lead(petName)}'s lab markers: ${totalMarkers} total, ${inRangeCount} in range, ${outOfRangeCount} out of range${tail}. What should I focus on?`,entityRef:{type:"marker_summary",id:petId,payload:{total:totalMarkers,inRange:inRangeCount,outOfRange:outOfRangeCount,unknown:unknownCount}}}}function buildMarkerReadingAskPrompt(petName,input){let name=input.canonicalName.trim()||"a lab marker",bits=[`${name}: ${input.valueText.trim()}`];input.collectedAt?.trim()&&bits.push(`collected ${input.collectedAt.trim()}`),input.sourceClinic?.trim()&&bits.push(`from ${input.sourceClinic.trim()}`),input.referenceText?.trim()&&bits.push(`reference range ${input.referenceText.trim()}`),input.flagged&&bits.push(`flagged ${input.flagged}`);let payload={marker:name};return input.flagged&&(payload.status=input.flagged),input.reviewed!==void 0&&(payload.reviewed=input.reviewed),{prompt:`I'm looking at ${lead(petName)}'s ${bits.join(", ")}. What does this mean, and should I be concerned?`,entityRef:{type:"lab_reading",id:input.entityId,payload:payload}}}function buildRecordsRequestAskPrompt(petName,input,requestId2){let clinic=input.clinicName?.trim(),held=input.heldItemCount??0,heldPhrase=held>0?`, ${held} fact${held===1?"":"s"} being verified`:"";return{prompt:`I'm looking at ${lead(petName)}'s records request${clinic?` to ${clinic}`:""}, status: ${input.statusLabel.trim()}${heldPhrase}. What does this status mean, and what happens next?`,entityRef:{type:"records_request",id:requestId2,payload:{status:input.status,held:held,...clinic?{clinic:clinic}:{}}}}}var ENTITY_TYPE_MAP=/* @__PURE__ */Object.freeze({vaccination:"vaccine",medication:"medication",body_weight:"weight",vital:"weight"});function buildEntityRowAskPrompt(petName,input,entityType,entityId){let kind=input.entityTypeLabel.trim()||"record",title=input.title.trim()||kind,detail=input.detail?.trim();return{prompt:`I'm looking at ${lead(petName)}'s ${kind.toLowerCase()}: ${title}${detail?`, ${detail}`:""}. What does this mean, and what should I keep on top of for ${lead(petName)}?`,entityRef:{type:ENTITY_TYPE_MAP[entityType]??entityType,id:entityId,payload:{kind:kind,title:title,...detail?{detail:detail}:{}}}}}function buildUpcomingCareAskPrompt(petName,items,petId){let list=items.filter(i=>i.label.trim()),entityRef={type:"upcoming_care",id:petId};if(list.length===0)return{prompt:`I'm looking at ${lead(petName)}'s upcoming care, but nothing is scheduled yet. What preventive care and checkups should ${lead(petName)} be on?`,entityRef:entityRef};let named=[...list].sort((a,b)=>(a.tone==="overdue"?0:1)-(b.tone==="overdue"?0:1)).slice(0,4).map(i=>i.relativeText.trim()?`${i.label.trim()} (${i.relativeText.trim().toLowerCase()})`:i.label.trim());return{prompt:`I'm looking at ${lead(petName)}'s upcoming care: ${named.join(", ")}. What should I prioritize for ${lead(petName)}, and how do I stay on top of these?`,entityRef:entityRef}}function buildPhysicalExamAskPrompt(petName,input,examId){let parts=[`I'm looking at ${lead(petName)}'s physical exam${input.observedOn?.trim()?` from ${input.observedOn.trim()}`:""}.`],abnormal=input.abnormal.filter(a=>a.system.trim());return abnormal.length>0?(parts.push(`Abnormal: ${abnormal.slice(0,6).map(a=>`${a.system.trim()}: ${a.finding.trim()}`).join("; ")}.`),parts.push(`What do these findings mean, and what should I follow up on for ${lead(petName)}?`)):parts.push(`Everything examined came back normal. What does this tell me about ${lead(petName)}'s health?`),{prompt:parts.join(" "),entityRef:{type:"physical_exam",id:examId}}}function buildVisitNoteAskPrompt(petName,input,noteId){let parts=[`I'm looking at ${lead(petName)}'s visit notes${input.observedOn?.trim()?` from ${input.observedOn.trim()}`:""}.`];for(let s of input.sections.filter(section=>section.text.trim()).slice(0,3))parts.push(`${s.label.trim()||"Note"}: ${clause(s.text)}`);return parts.push(`Can you summarize what happened and what I should follow up on for ${lead(petName)}?`),{prompt:parts.join(" "),entityRef:{type:"visit",id:noteId}}}function buildConflictAskPrompt(petName,input,conflictId){let scope=input.scopeLabel.trim()||"a detail",cands=input.candidates.filter(c=>c.value.trim()),rendered=cands.slice(0,3).map(c=>`"${c.value.trim()}"${c.clinicName?.trim()?` (${c.clinicName.trim()})`:""}`).join(" vs ");return{prompt:`Two of ${lead(petName)}'s documents disagree on ${scope}: ${rendered}. Which is likely correct, and what should I ask my vet?`,entityRef:{type:"conflict",id:conflictId,payload:{field:scope,severity:input.severity,values:cands.map(c=>c.value.trim()).join(" | ")}}}}var FOCUSABLE='button:not([disabled]), input:not([disabled]), textarea:not([disabled]), select:not([disabled]), a[href], [tabindex]:not([tabindex="-1"])';function isDialogElement(node){return node.tagName==="DIALOG"}function activeIn(node){if(typeof document>"u")return null;let root=node?.getRootNode();return root&&root!==document&&"activeElement"in root?root.activeElement:document.activeElement}function useModalDialog(open,onClose,returnFocusTo,options){let escapeAtKeyDown=options?.escapeAtKeyDown===true,dialogRef=useRef(null),wasOpen=useRef(false),opener=useRef(null),trigger=useRef(returnFocusTo);trigger.current=returnFocusTo;let restoreFocus=useCallback(()=>{if(!wasOpen.current)return;wasOpen.current=false;let target=trigger.current===void 0?opener.current:trigger.current.current;target&&target.isConnected&&target.focus(),(!target||!target.isConnected||activeIn(target)===target)&&(opener.current=null)},[]);useEffect(()=>{let node=dialogRef.current;if(!wasOpen.current){let active=activeIn(node);active!==null&&node!==null&&node.contains(active)||(opener.current=active instanceof HTMLElement?active:null)}if(wasOpen.current=true,node===null)return;if(!isDialogElement(node)){node.contains(activeIn(node))||(node.querySelector(FOCUSABLE)??node).focus();return}let dialog=node;typeof dialog.showModal=="function"?dialog.open||dialog.showModal():dialog.setAttribute("open","")},[open,restoreFocus]),useEffect(()=>restoreFocus,[restoreFocus]),useEffect(()=>{let node=dialogRef.current;if(node===null||!isDialogElement(node))return;let dialog=node;if(typeof dialog.showModal!="function")return;let lastFocused=null,onFocusIn=event=>{event.target instanceof HTMLElement&&(lastFocused=event.target)},onNativeClose=()=>{if(!dialog.isConnected||dialog.open)return;let back=lastFocused;dialog.showModal(),back!==null&&back.isConnected&&dialog.contains(back)&&activeIn(dialog)!==back&&back.focus()};return dialog.addEventListener("focusin",onFocusIn),dialog.addEventListener("close",onNativeClose),()=>{dialog.removeEventListener("focusin",onFocusIn),dialog.removeEventListener("close",onNativeClose)}},[open]);let onKeyDown=useCallback(event=>{let node=dialogRef.current;if(node===null)return;if(event.key==="Escape"&&!isDialogElement(node)){event.preventDefault(),event.stopPropagation(),onClose();return}if(event.key==="Escape"&&escapeAtKeyDown);if(event.key!=="Tab")return;let focusable=Array.from(node.querySelectorAll(FOCUSABLE)),first=focusable[0],last=focusable[focusable.length-1];if(!first||!last){event.preventDefault();return}let active=activeIn(node);event.shiftKey&&(active===first||!node.contains(active))?(event.preventDefault(),last.focus()):!event.shiftKey&&(active===last||!node.contains(active))&&(event.preventDefault(),first.focus())},[onClose,escapeAtKeyDown]),onCancel=useCallback(event=>{event.target===event.currentTarget&&(event.preventDefault(),onClose())},[onClose]);return{dialogRef:dialogRef,onKeyDown:onKeyDown,onCancel:onCancel}}var FOCUSABLE2='button:not([disabled]), input:not([disabled]), textarea:not([disabled]), select:not([disabled]), a[href], [tabindex]:not([tabindex="-1"])';function RecordsDialog({label:label,onClose:onClose,shape:shape="modal",returnFocusTo:returnFocusTo,panelStyle:panelStyle,testID:testID,children:children}){let{styles:styles}=useScreenStyles(),dialog=useModalDialog(true,onClose,returnFocusTo);useEffect(()=>{let node=dialog.dialogRef.current;node===null||node.contains(document.activeElement)||(node.querySelector(FOCUSABLE2)??node).focus()},[dialog.dialogRef]);let side=shape==="side";/* @__PURE__ */
|
|
395
395
|
return jsx("dialog",{ref:dialog.dialogRef,"aria-label":label,"aria-modal":"true",onCancel:dialog.onCancel,onKeyDown:dialog.onKeyDown,style:styles.dialogFrame,"data-testid":testID,children:/* @__PURE__ */jsx("div",{style:side?styles.dialogScrimSide:styles.dialogScrim,onClick:event=>{event.target===event.currentTarget&&onClose()},"data-testid":testID?`${testID}-scrim`:void 0,children:/* @__PURE__ */jsx("div",{style:{...side?styles.dialogPanelSide:styles.dialogPanel,...panelStyle,...side?styles.dialogSlotSide:styles.dialogSlot},children:children})})})}function FactEditAffordance({entity:entity,factEdit:factEdit,children:children}){let{theme:theme,styles:styles}=useScreenStyles(),[open,setOpen]=useState(false),trigger=useRef(null),label=entity.label.trim()||FACT_EDIT_COPY.detail;/* @__PURE__ */
|
|
396
396
|
return jsxs("div",{style:{display:"flex",alignItems:"center",gap:theme.space.sm},children:[
|
|
397
397
|
/* @__PURE__ */jsx("div",{style:{flex:1,minWidth:0},children:children}),
|