@openmrs/esm-devtools-app 11.0.1-pre.5904 → 11.0.1-pre.5908
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/.turbo/turbo-build.log +2 -2
- package/dist/11.js +1 -0
- package/dist/11.js.map +1 -0
- package/dist/195.js +1 -1
- package/dist/335.js +1 -1
- package/dist/335.js.map +1 -1
- package/dist/392.js +1 -0
- package/dist/392.js.map +1 -0
- package/dist/449.js +1 -0
- package/dist/449.js.map +1 -0
- package/dist/483.js +1 -0
- package/dist/483.js.map +1 -0
- package/dist/{165.js → 536.js} +1 -1
- package/dist/536.js.map +1 -0
- package/dist/575.js +9 -9
- package/dist/575.js.map +1 -1
- package/dist/807.js +1 -1
- package/dist/807.js.map +1 -1
- package/dist/827.js +1 -1
- package/dist/827.js.map +1 -1
- package/dist/830.js +1 -0
- package/dist/830.js.map +1 -0
- package/dist/openmrs-esm-devtools-app.js +2 -2
- package/dist/openmrs-esm-devtools-app.js.map +1 -1
- package/dist/routes.json +1 -1
- package/package.json +3 -3
- package/tsconfig.json +1 -1
- package/dist/165.js.map +0 -1
- package/dist/250.js +0 -1
- package/dist/250.js.map +0 -1
package/dist/575.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
"use strict";(globalThis.webpackChunk_openmrs_esm_devtools_app=globalThis.webpackChunk_openmrs_esm_devtools_app||[]).push([["575"],{9882(e,t,n){let o,r,i;n.r(t),n.d(t,{GenderUnknownIcon:()=>aS,evaluateAsNumber:()=>oc,getImportMapOverrideMap:()=>no,StockManagementPictogram:()=>dg,ChemistryIcon:()=>ai,BabyIcon:()=>s6,DashboardExtension:()=>lS,openmrsComponentDecorator:()=>is,tryRegisterExtension:()=>sS,pictogramIds:()=>uq,ActivityIcon:()=>sZ,compile:()=>of,removeRouteMapOverride:()=>nR,TableBatchActions:()=>sU,getAsyncLifecycle:()=>il,subscribeOpenmrsEvent:()=>nG,PasswordIcon:()=>aq,Assessment2Pictogram:()=>uY,CloseIcon:()=>au,setupRouteMapOverrides:()=>nM,useFeatureFlag:()=>iB,reset:()=>ry,ConceptDictionaryPictogram:()=>u1,LabOrderIcon:()=>aR,VisitMode:()=>nY,useLocations:()=>i4,getLifecycle:()=>ia,formatDatetime:()=>l7,getVisitsForPatient:()=>n8,formatPartialDate:()=>l6,CustomOverflowMenu:()=>sq,LocationIcon:()=>aT,GroupIcon:()=>aj,createUseStore:()=>rZ,VisitStatus:()=>nZ,getSessionLocation:()=>tF,getCurrentImportMap:()=>ng,usePatient:()=>sr,useRenderableExtensions:()=>ss,getOpenedWindowIndexByWorkspace:()=>rI,setLeftNav:()=>rx,clearHistory:()=>tb,clearConfigErrors:()=>e0,formatTime:()=>l4,isDevEnabled:()=>tY,CohortsPictogram:()=>u0,closeWorkspaceGroup2:()=>dD,getCurrentRouteMap:()=>nC,ConfigurableLink:()=>rG,sessionStore:()=>tA,setSessionLocale:()=>tV,subscribeSnackbarShown:()=>w,getLoggedInUser:()=>tB,GenderMaleIcon:()=>ab,getExtensionSlotConfigFromStore:()=>ei,evaluateAsNumberAsync:()=>ou,getImportMapDefaultMap:()=>nt,unregisterExtensionRendering:()=>oX,implementerToolsConfigStore:()=>e_,Type:()=>G,InPatientPictogram:()=>de,cleanupObsoleteFeatureFlags:()=>oT,getAttachmentsUrl:()=>nU,showSnackbar:()=>dI,PatientBannerActionsMenu:()=>uU,PatientSearchPictogram:()=>da,DocumentAttachmentIcon:()=>ap,Snackbar:()=>dj,CardiologyPictogram:()=>uQ,ImageMedicalIcon:()=>aC,ActionableNotificationComponent:()=>ui,DiagnosisTags:()=>cV,openChildWorkspaceInWindow:()=>dq,iconIds:()=>sY,PatientsPictogram:()=>dl,interpolateUrl:()=>tf,setupHistory:()=>t_,subscribeToastShown:()=>h,detachAll:()=>rg,convertToLocaleCalendar:()=>l9,DocumentIcon:()=>af,configInternalStore:()=>Q,ActionMenuButton2:()=>mc,setupDynamicOfflineDataHandler:()=>mR,makeUrl:()=>tC,oneOf:()=>e4,selectPreferredName:()=>uC,MobileCheckIcon:()=>aB,createErrorHandler:()=>y,parseDate:()=>lZ,getAttachmentByUuid:()=>nW,LeftNavMenu:()=>cY,getExtensionRegistration:()=>rd,ShoppingCartAddItemIcon:()=>ly,ReferralOrderIcon:()=>aQ,ReportIcon:()=>a1,dispatchToastShown:()=>f,getImportMapNextPageMap:()=>nn,registerExtension:()=>rm,setupOfflineSync:()=>mO,DownloadIcon:()=>ag,useConnectivity:()=>mW,provide:()=>e$,ShoppingCartArrowDownIcon:()=>a7,featureFlagsStore:()=>oR,jsep:()=>n3.A,GeriatricsPictogram:()=>u7,SearchIcon:()=>a6,reportError:()=>v,slugify:()=>nm,isOmrsDateToday:()=>lK,getExtensionStore:()=>oY,BloodBankPictogram:()=>uZ,TriagePictogram:()=>d_,Workspace2:()=>d5,refetchCurrentUser:()=>tW,CheckmarkOutlineIcon:()=>ar,registerExtensionSlot:()=>rv,AllergiesIcon:()=>lh,ArrowDownIcon:()=>s0,useOpenmrsInfinite:()=>iK,getExtensionConfigFromExtensionSlotStore:()=>el,OpenmrsDatePicker:()=>cB,getExtensionConfigFromStore:()=>ea,getDynamicOfflineDataEntries:()=>m$,getLocaleDisplayName:()=>lU,messageOmrsServiceWorker:()=>mM,navigate:()=>tg,launchWorkspace2:()=>dU,getGroupByWindowName:()=>rP,CustomOverflowMenuItem:()=>sJ,isUrl:()=>e3,CaretDownIcon:()=>s4,ArrowLeftIcon:()=>s1,FacilityPictogram:()=>u4,ViewOffIcon:()=>lf,updateInternalExtensionStore:()=>oV,dispatchActionableNotificationShown:()=>d,resetRouteMapOverrides:()=>n$,formatDurationBetween:()=>ca,defaultVisitCustomRepresentation:()=>nQ,getBreadcrumbsFor:()=>ts,useOpenmrsPagination:()=>iH,Pagination:()=>uS,CheckmarkFilledIcon:()=>ao,clearCurrentUser:()=>tD,showModal:()=>ut,ChevronUpIcon:()=>ac,saveVisit:()=>n5,useAttachments:()=>iN,Pictogram:()=>dS,useExtensionSlot:()=>r6,ChevronDownIcon:()=>as,OpenmrsDateRangePicker:()=>cF,deleteAttachmentPermanently:()=>nF,getVisitTypes:()=>nX,OverflowMenuHorizontalIcon:()=>aG,EventScheduleIcon:()=>a_,getSessionStore:()=>tM,ProcedureOrderIcon:()=>aY,preloadImport:()=>np,registerWorkspaceWindows2:()=>rO,useOnVisible:()=>i9,setSessionLocation:()=>tH,userHasAccess:()=>tU,ChartAverageIcon:()=>at,getFeatureFlag:()=>oM,UserAvatarIcon:()=>lc,renderExtension:()=>rB,useFhirInfinite:()=>i0,toVisitTypeObject:()=>nJ,useSession:()=>sa,EmergencyDepartmentPictogram:()=>u3,Notification:()=>uo,dispatchSnackbarShown:()=>m,formatDate:()=>l8,workspace2StoreActions:()=>dX,SwitcherIcon:()=>a3,esmStyleGuideSchema:()=>sL,getImportMapDisabledOverrides:()=>nr,useAssignedExtensionIds:()=>ik,CaretRightIcon:()=>s9,evaluateAsType:()=>od,PageHeader:()=>ub,TranslateIcon:()=>li,setUserProperties:()=>tG,MovementIcon:()=>aV,renderInlineNotifications:()=>um,subscribePrecacheStaticDependencies:()=>mL,PaymentsDeskPictogram:()=>dc,usePrimaryIdentifierCode:()=>si,useLayoutType:()=>i2,getCurrentUser:()=>tT,closeWorkspaceInWindow:()=>dz,XrayPictogram:()=>dv,CaretUpIcon:()=>ae,renderActionableNotifications:()=>up,OpenmrsAppContext:()=>iv,setupModals:()=>ue,getDefaultsFromConfigSchema:()=>function e(t){let n={};for(let o of Object.keys(t))if(mN(t[o])&&t[o].hasOwnProperty("_default"))n[o]=t[o]._default;else{if(o.startsWith("_"))continue;mN(t[o])?n[o]=e(t[o]):n[o]=t[o]}return n},subscribeTo:()=>L,recordConfigDerivationError:()=>eh,useAbortController:()=>ib,Extension:()=>rz,getFhirServerPaginationHandlers:()=>iq,useConnectedExtensions:()=>iO,registerApp:()=>sj,HospitalBedIcon:()=>aE,useExtensionInternalStore:()=>iW,configExtensionStore:()=>et,getSynchronizationItems:()=>mT,getExtensionSlotsConfigStore:()=>eo,registerExtensionRendering:()=>oK,RenderIfValueIsTruthy:()=>iy,registerFeatureFlag:()=>o$,useFhirFetchAll:()=>iQ,restBaseUrl:()=>tj,CalendarHeatMapIcon:()=>s8,isImportMapOverrideDisabled:()=>ni,resetConfigSystem:()=>e1,getExtensionInternalStore:()=>oF,registerGlobalStore:()=>T,evaluateAsBoolean:()=>oa,PatientBannerPatientInfo:()=>uW,addRouteMapOverride:()=>nO,getDefaultCalendar:()=>l2,SettingsIcon:()=>a8,DrugOrderIcon:()=>ah,ProgramsIcon:()=>aZ,useAssignedExtensions:()=>r5,CloseFilledIcon:()=>ad,canAccessStorage:()=>mj,registerDefaultCalendar:()=>l1,TreeViewAltIcon:()=>la,OverflowMenuVerticalIcon:()=>az,clearConfigDerivationError:()=>ew,getConfigStore:()=>en,InformationSquareIcon:()=>aA,EmptyCard:()=>cJ,ChevronLeftIcon:()=>aa,RadiologyIcon:()=>lv,useCandidateExtensions:()=>ij,renderToasts:()=>dT,isDesktop:()=>i5,integrateBreakpoints:()=>sI,RegistrationPictogram:()=>dm,CardHeader:()=>s$,getExtensionRegistrationFrom:()=>ru,InformationIcon:()=>aP,SystemAdministrationPictogram:()=>dh,TrashCanIcon:()=>ls,useShallowStableValue:()=>rq,PatientDocumentsPictogram:()=>ds,useOpenmrsSWR:()=>se,Assessment1Pictogram:()=>uX,finishRegisteringAllApps:()=>sN,importDynamic:()=>nf,useFhirPagination:()=>iz,useVisitContextStore:()=>sg,ArrowUpIcon:()=>s5,showActionableNotification:()=>ug,useForceUpdate:()=>iF,useVisit:()=>sh,PatientBannerPatientIdentifiers:()=>u$,TransferPictogram:()=>dw,usePagination:()=>st,Breakpoint:()=>sE,PatientBannerToggleContactDetailsButton:()=>mu,CloseOutlineIcon:()=>am,ObstetricsPictogram:()=>di,parseDateInput:()=>ct,ReportsPictogram:()=>df,getConfig:()=>eM,attach:()=>rf,getLocale:()=>lB,isUrlWithTemplateParameters:()=>e8,useEmrConfiguration:()=>iM,useLeftNav:()=>i6,ToolsIcon:()=>lr,ErrorState:()=>cK,detach:()=>rp,setCurrentVisit:()=>n2,ConditionsIcon:()=>l_,SaveIcon:()=>a5,useConfig:()=>iA,validator:()=>z,CalendarIcon:()=>s3,getHistory:()=>tv,StickyNoteAddIcon:()=>a9,useWorkspace2Store:()=>dY,getPatientName:()=>uk,getVisitStore:()=>n1,getCoreTranslation:()=>tm,registerModuleWithConfigSystem:()=>eI,updateOpenedWorkspaceInWindow:()=>dJ,registerModuleLoad:()=>eA,getBreadcrumbs:()=>to,extractVariableNames:()=>oI,translateFrom:()=>td,useStoreWithActions:()=>rY,EditIcon:()=>aw,getCandidateExtensions:()=>r_,shallowEqual:()=>x,subscribeNotificationShown:()=>p,MaximizeIcon:()=>aL,promptForClosingWorkspaces:()=>dV,WarningIcon:()=>lg,fhirBaseUrl:()=>tN,matchLocale:()=>mk,usePatientPhoto:()=>uH,registerBreadcrumb:()=>tt,EventsIcon:()=>av,createGlobalStore:()=>R,subscribeToFeatureFlag:()=>oL,useExtensionStore:()=>iU,createAttachment:()=>nB,useLeftNavStore:()=>i8,TableIcon:()=>ln,Icon:()=>lx,InformationFilledIcon:()=>aI,getCurrentPageMap:()=>ne,LaboratoryPictogram:()=>dt,temporaryConfigStore:()=>ee,toDateObjectStrict:()=>lX,defineConfigSchema:()=>eP,filterBreadcrumbs:()=>ti,invalidateImplementerToolsConfig:()=>ep,PatientBannerContactDetails:()=>mh,getAssignedExtensions:()=>rw,promptForClosingWorkspacesInWindow:()=>dG,PatientPhoto:()=>uz,MaterialOrderIcon:()=>aM,MicroscopeIcon:()=>aU,visitTypesUrl:()=>nK,getOpenedWindowWidth:()=>d0,scheduleRecomputation:()=>o2,PharmacyPictogram:()=>du,AttachmentIcon:()=>lw,MoneyIcon:()=>aF,getAttachments:()=>nD,PageHeaderContent:()=>ux,MedicationIcon:()=>aW,PrinterIcon:()=>aX,PatientListsPictogram:()=>db,useAppContext:()=>ix,isOpenmrsRoutes:()=>n_,AppointmentsAltPictogram:()=>uK,GenericOrderTypeIcon:()=>ak,batchExtensionUpdates:()=>o0,useExtensionSlotStore:()=>r1,ViewIcon:()=>lp,formattedName:()=>uE,sessionEndpoint:()=>tE,duration:()=>ci,resetImportMapOverrides:()=>nl,TableOfContentsIcon:()=>lt,CaretLeftIcon:()=>s7,getTranslationOverrides:()=>eL,isVersionSatisfied:()=>mP,EmptyCardIllustration:()=>cq,PenIcon:()=>aK,verifyTotpCode:()=>tz,validators:()=>e7,setupImportMapOverrides:()=>nd,showToast:()=>dM,useDefineAppContext:()=>i_,getGlobalStore:()=>M,useOnClickOutside:()=>i7,getWindowByWorkspaceName:()=>rC,ArrowRightIcon:()=>s2,loadLifeCycles:()=>sy,registerBreadcrumbs:()=>tn,MotherIcon:()=>aH,fetchCurrentPatient:()=>nH,Toast:()=>dA,MessageQueueIcon:()=>aD,TwoFactorAuthenticationIcon:()=>ll,Pharmacy2Pictogram:()=>dd,goBackInHistory:()=>ty,GroupAccessIcon:()=>aN,getExtensionRenderingsStore:()=>oH,setImplementerToolsConfigRecomputer:()=>ef,getAsyncExtensionLifecycle:()=>iu,setupApiModule:()=>tQ,renderLoadingSpinner:()=>mw,showNotification:()=>uf,getModalRegistration:()=>rN,ListCheckedIcon:()=>a$,ResponsiveWrapper:()=>dk,GynaecologyPictogram:()=>u9,ShoppingCartIcon:()=>a4,getRouteMapNextPageMap:()=>nI,MetadataExportPictogram:()=>dr,updateVisit:()=>n6,backendDependencies:()=>tZ,MaybePictogram:()=>dx,createParcelMounter:()=>rD,openmrsFetch:()=>tP,useStore:()=>rX,isOpenmrsAppRoutes:()=>nw,ExportedWorkspace:()=>mo,DentistryPictogram:()=>u6,HomePictogram:()=>dy,ServiceQueuesPictogram:()=>dp,createExportedWorkspaceWindow:()=>d2,setFeatureFlag:()=>oW,toLanguageTag:()=>lD,DigitalTrustPictogram:()=>u8,NumericObservation:()=>uv,attachmentUrl:()=>nL,interpolateString:()=>tp,inRange:()=>e6,useExtensionSlotMeta:()=>iD,AppointmentsPictogram:()=>uJ,renderSnackbars:()=>dP,getRegisteredWorkspace2Names:()=>dQ,logout:()=>tq,toLocationObject:()=>nz,ChartLineIcon:()=>an,UserHasAccess:()=>sl,evaluateAsBooleanAsync:()=>ol,createDashboard:()=>lk,getLocations:()=>nq,useExtensionContext:()=>iL,getExtensionsConfigStore:()=>es,getRouteMapDefaultMap:()=>nP,age:()=>uI,isOmrsDateStrict:()=>lJ,registerWorkspaceGroups2:()=>rA,usePaginationInfo:()=>sn,evaluateAsync:()=>os,useOpenmrsFetchAll:()=>iY,removeImportMapOverride:()=>na,useVisitTypes:()=>s_,ageAsDuration:()=>uP,getExtensionNameFromId:()=>rc,DataEntryPictogram:()=>u5,renderParcel:()=>rW,ResetIcon:()=>a2,RenewIcon:()=>a0,useWorkspace2Context:()=>dZ,subscribeActionableNotificationShown:()=>g,ErrorCard:()=>cX,GenderFemaleIcon:()=>ay,enableImportMapOverride:()=>nc,retry:()=>mI,ComponentContext:()=>rV,ExtensionSlot:()=>r3,unsetLeftNav:()=>rS,addImportMapOverride:()=>ns,MaybeIcon:()=>lb,useCustomOverflowMenu:()=>sz,PedestrianFamilyIcon:()=>aJ,CtScanPictogram:()=>u2,dispatchNotificationShown:()=>u,leftNavStore:()=>rb,OpenmrsFetchError:()=>tI,UserFollowIcon:()=>lu,launchWorkspaceGroup2:()=>dW,ChevronRightIcon:()=>al,UserXrayIcon:()=>ld,GenderOtherIcon:()=>ax,formatDuration:()=>ce,toOmrsIsoString:()=>lY,Labs2Pictogram:()=>dn,workspace2Store:()=>rE,setUserLanguage:()=>tL,useBodyScrollLock:()=>iE,SyringeIcon:()=>le,LocationPicker:()=>cZ,useDebounce:()=>iR,TimeIcon:()=>lo,getExtensionSlotConfig:()=>er,AddIcon:()=>sQ,getRouteMapOverrideMap:()=>nA,processConfig:()=>eW,InventoryManagementIcon:()=>aO,registerWorkspaces2:()=>rR,UserIcon:()=>lm,formatPatientName:()=>uN,fireOpenmrsEvent:()=>nV,registerModal:()=>rj,registerTranslationNamespace:()=>eO,displayName:()=>uj,createLocalStore:()=>$,evaluate:()=>oi,defineExtensionConfigSchema:()=>eR,getSyncLifecycle:()=>ic,renderWorkspaceWindowsAndMenu:()=>mb,evaluateAsTypeAsync:()=>om});let s="openmrs:notification-shown",a="openmrs:actionable-notification-shown",l="openmrs:toast-shown",c="openmrs:snack-bar-shown";function u(e){window.dispatchEvent(new CustomEvent(s,{detail:e}))}function d(e){window.dispatchEvent(new CustomEvent(a,{detail:e}))}function m(e){window.dispatchEvent(new CustomEvent(c,{detail:e}))}function f(e){window.dispatchEvent(new CustomEvent(l,{detail:e}))}function p(e){let t=t=>e(t.detail);return window.addEventListener(s,t),()=>window.removeEventListener(s,t)}function g(e){let t=t=>e(t.detail);return window.addEventListener(a,t),()=>window.removeEventListener(a,t)}function h(e){let t=t=>e(t.detail);return window.addEventListener(l,t),()=>window.removeEventListener(l,t)}function w(e){let t=t=>e(t.detail);return window.addEventListener(c,t),()=>window.removeEventListener(c,t)}function _(e,t){let{message:n}=b(e);return"string"==typeof n&&n?n:t}function v(e){let t=b(e);setTimeout(()=>{throw t})}function y(){let e=Error();return t=>{let n=b(t);n.stack+=`
|
|
1
|
+
"use strict";(globalThis.webpackChunk_openmrs_esm_devtools_app=globalThis.webpackChunk_openmrs_esm_devtools_app||[]).push([["575"],{9882(e,t,n){let o,r,i;n.r(t),n.d(t,{GenderUnknownIcon:()=>aj,evaluateAsNumber:()=>oc,getImportMapOverrideMap:()=>no,StockManagementPictogram:()=>d_,ChemistryIcon:()=>as,BabyIcon:()=>s8,DashboardExtension:()=>lj,openmrsComponentDecorator:()=>il,tryRegisterExtension:()=>sk,pictogramIds:()=>uX,ActivityIcon:()=>sQ,compile:()=>of,removeRouteMapOverride:()=>nR,TableBatchActions:()=>sB,getAsyncLifecycle:()=>iu,subscribeOpenmrsEvent:()=>nG,PasswordIcon:()=>aJ,Assessment2Pictogram:()=>u0,CloseIcon:()=>ad,setupRouteMapOverrides:()=>nM,useFeatureFlag:()=>iH,reset:()=>ry,ConceptDictionaryPictogram:()=>u6,LabOrderIcon:()=>aT,VisitMode:()=>nY,useLocations:()=>i7,getLifecycle:()=>ic,formatDatetime:()=>ct,getVisitsForPatient:()=>n8,formatPartialDate:()=>l4,CustomOverflowMenu:()=>sJ,LocationIcon:()=>aM,GroupIcon:()=>aN,createUseStore:()=>rQ,VisitStatus:()=>nZ,getSessionLocation:()=>tF,getCurrentImportMap:()=>ng,usePatient:()=>ss,useRenderableExtensions:()=>sl,getOpenedWindowIndexByWorkspace:()=>rI,setLeftNav:()=>rx,clearHistory:()=>tb,clearConfigErrors:()=>e0,formatTime:()=>ce,isDevEnabled:()=>tY,CohortsPictogram:()=>u5,closeWorkspaceGroup2:()=>dF,getCurrentRouteMap:()=>nE,ConfigurableLink:()=>rz,sessionStore:()=>tA,setSessionLocale:()=>tV,subscribeSnackbarShown:()=>w,getLoggedInUser:()=>tB,GenderMaleIcon:()=>ax,getExtensionSlotConfigFromStore:()=>ei,evaluateAsNumberAsync:()=>ou,getImportMapDefaultMap:()=>nt,unregisterExtensionRendering:()=>oX,implementerToolsConfigStore:()=>e_,Type:()=>G,InPatientPictogram:()=>dr,cleanupObsoleteFeatureFlags:()=>o$,getAttachmentsUrl:()=>nU,showSnackbar:()=>dR,PatientBannerActionsMenu:()=>uH,PatientSearchPictogram:()=>du,DocumentAttachmentIcon:()=>ag,Snackbar:()=>dE,CardiologyPictogram:()=>u2,ImageMedicalIcon:()=>aP,ActionableNotificationComponent:()=>ul,DiagnosisTags:()=>cq,openChildWorkspaceInWindow:()=>dX,iconIds:()=>sZ,PatientsPictogram:()=>dd,interpolateUrl:()=>tf,setupHistory:()=>t_,subscribeToastShown:()=>h,detachAll:()=>rg,convertToLocaleCalendar:()=>cn,DocumentIcon:()=>ap,configInternalStore:()=>Q,ActionMenuButton2:()=>mm,setupDynamicOfflineDataHandler:()=>mM,makeUrl:()=>tE,oneOf:()=>e4,selectPreferredName:()=>uA,MobileCheckIcon:()=>aF,createErrorHandler:()=>y,parseDate:()=>l1,getAttachmentByUuid:()=>nW,LeftNavMenu:()=>c0,getExtensionRegistration:()=>rd,ShoppingCartAddItemIcon:()=>lb,ReferralOrderIcon:()=>a0,ReportIcon:()=>a2,dispatchToastShown:()=>f,getImportMapNextPageMap:()=>nn,registerExtension:()=>rm,setupOfflineSync:()=>m$,DownloadIcon:()=>ah,useConnectivity:()=>mB,provide:()=>eT,ShoppingCartArrowDownIcon:()=>a7,featureFlagsStore:()=>oR,jsep:()=>n3.A,GeriatricsPictogram:()=>dt,SearchIcon:()=>a8,reportError:()=>v,slugify:()=>nm,isOmrsDateToday:()=>lZ,getExtensionStore:()=>oY,BloodBankPictogram:()=>u1,TriagePictogram:()=>db,Workspace2:()=>d3,refetchCurrentUser:()=>tW,CheckmarkOutlineIcon:()=>ai,registerExtensionSlot:()=>rv,AllergiesIcon:()=>lw,ArrowDownIcon:()=>s1,useOpenmrsInfinite:()=>iY,getExtensionConfigFromExtensionSlotStore:()=>el,OpenmrsDatePicker:()=>cV,getExtensionConfigFromStore:()=>ea,getDynamicOfflineDataEntries:()=>mL,getLocaleDisplayName:()=>lB,messageOmrsServiceWorker:()=>mD,navigate:()=>tg,launchWorkspace2:()=>dH,getGroupByWindowName:()=>rP,CustomOverflowMenuItem:()=>sK,isUrl:()=>e3,CaretDownIcon:()=>s9,ArrowLeftIcon:()=>s2,FacilityPictogram:()=>de,ViewOffIcon:()=>lp,updateInternalExtensionStore:()=>oV,dispatchActionableNotificationShown:()=>d,resetRouteMapOverrides:()=>nT,formatDurationBetween:()=>cu,defaultVisitCustomRepresentation:()=>nQ,getBreadcrumbsFor:()=>ts,useOpenmrsPagination:()=>iG,Pagination:()=>uN,CheckmarkFilledIcon:()=>ar,clearCurrentUser:()=>tD,showModal:()=>ur,ChevronUpIcon:()=>au,saveVisit:()=>n5,useAttachments:()=>iE,Pictogram:()=>dN,useExtensionSlot:()=>r8,ChevronDownIcon:()=>aa,OpenmrsDateRangePicker:()=>cG,deleteAttachmentPermanently:()=>nF,getVisitTypes:()=>nX,OverflowMenuHorizontalIcon:()=>az,EventScheduleIcon:()=>av,getSessionStore:()=>tM,ProcedureOrderIcon:()=>aZ,preloadImport:()=>np,registerWorkspaceWindows2:()=>rO,useOnVisible:()=>st,setSessionLocation:()=>tH,userHasAccess:()=>tU,ChartAverageIcon:()=>an,getFeatureFlag:()=>oM,UserAvatarIcon:()=>lu,renderExtension:()=>rB,useFhirInfinite:()=>i2,toVisitTypeObject:()=>nJ,useSession:()=>sc,EmergencyDepartmentPictogram:()=>u7,Notification:()=>us,dispatchSnackbarShown:()=>m,formatDate:()=>l9,workspace2StoreActions:()=>dQ,SwitcherIcon:()=>a4,esmStyleGuideSchema:()=>sW,getImportMapDisabledOverrides:()=>nr,useAssignedExtensionIds:()=>iN,CaretRightIcon:()=>ae,evaluateAsType:()=>od,PageHeader:()=>uj,TranslateIcon:()=>ls,setUserProperties:()=>tG,MovementIcon:()=>aG,renderInlineNotifications:()=>ug,subscribePrecacheStaticDependencies:()=>mU,PaymentsDeskPictogram:()=>dm,usePrimaryIdentifierCode:()=>sa,useLayoutType:()=>i6,getCurrentUser:()=>t$,closeWorkspaceInWindow:()=>dK,XrayPictogram:()=>dx,CaretUpIcon:()=>at,renderActionableNotifications:()=>uw,OpenmrsAppContext:()=>ib,setupModals:()=>uo,getDefaultsFromConfigSchema:()=>function e(t){let n={};for(let o of Object.keys(t))if(mP(t[o])&&t[o].hasOwnProperty("_default"))n[o]=t[o]._default;else{if(o.startsWith("_"))continue;mP(t[o])?n[o]=e(t[o]):n[o]=t[o]}return n},subscribeTo:()=>L,recordConfigDerivationError:()=>eh,useAbortController:()=>iS,Extension:()=>rq,getFhirServerPaginationHandlers:()=>iK,useConnectedExtensions:()=>iT,registerApp:()=>sC,HospitalBedIcon:()=>aE,useExtensionInternalStore:()=>iU,configExtensionStore:()=>et,getSynchronizationItems:()=>mW,getExtensionSlotsConfigStore:()=>eo,registerExtensionRendering:()=>oK,RenderIfValueIsTruthy:()=>ix,registerFeatureFlag:()=>oT,useFhirFetchAll:()=>i1,restBaseUrl:()=>tk,CalendarHeatMapIcon:()=>s3,isImportMapOverrideDisabled:()=>ni,resetConfigSystem:()=>e1,getExtensionInternalStore:()=>oF,registerGlobalStore:()=>$,evaluateAsBoolean:()=>oa,PatientBannerPatientInfo:()=>uB,addRouteMapOverride:()=>nO,getDefaultCalendar:()=>l8,SettingsIcon:()=>a3,DrugOrderIcon:()=>aw,ProgramsIcon:()=>aQ,useAssignedExtensions:()=>r6,CloseFilledIcon:()=>am,canAccessStorage:()=>mE,registerDefaultCalendar:()=>l6,TreeViewAltIcon:()=>ll,OverflowMenuVerticalIcon:()=>aq,clearConfigDerivationError:()=>ew,getConfigStore:()=>en,InformationSquareIcon:()=>aO,EmptyCard:()=>cY,ChevronLeftIcon:()=>al,RadiologyIcon:()=>ly,useCandidateExtensions:()=>iC,renderToasts:()=>dW,isDesktop:()=>i8,integrateBreakpoints:()=>sO,RegistrationPictogram:()=>dg,CardHeader:()=>s$,getExtensionRegistrationFrom:()=>ru,InformationIcon:()=>aI,SystemAdministrationPictogram:()=>dv,TrashCanIcon:()=>la,useShallowStableValue:()=>rJ,PatientDocumentsPictogram:()=>dc,useOpenmrsSWR:()=>sn,Assessment1Pictogram:()=>uQ,finishRegisteringAllApps:()=>sE,importDynamic:()=>nf,useFhirPagination:()=>iJ,useVisitContextStore:()=>sw,ArrowUpIcon:()=>s6,showActionableNotification:()=>u_,useForceUpdate:()=>iV,useVisit:()=>s_,PatientBannerPatientIdentifiers:()=>uL,TransferPictogram:()=>dy,usePagination:()=>so,Breakpoint:()=>sP,PatientBannerToggleContactDetailsButton:()=>mf,CloseOutlineIcon:()=>af,ObstetricsPictogram:()=>dl,parseDateInput:()=>cr,ReportsPictogram:()=>dh,getConfig:()=>eM,attach:()=>rf,getLocale:()=>lF,isUrlWithTemplateParameters:()=>e8,useEmrConfiguration:()=>iW,useLeftNav:()=>i3,ToolsIcon:()=>li,ErrorState:()=>cZ,detach:()=>rp,setCurrentVisit:()=>n2,ConditionsIcon:()=>lv,SaveIcon:()=>a6,useConfig:()=>iR,validator:()=>z,CalendarIcon:()=>s4,getHistory:()=>tv,StickyNoteAddIcon:()=>le,useWorkspace2Store:()=>d0,getPatientName:()=>uC,getVisitStore:()=>n1,getCoreTranslation:()=>tm,registerModuleWithConfigSystem:()=>eI,updateOpenedWorkspaceInWindow:()=>dY,registerModuleLoad:()=>eA,getBreadcrumbs:()=>to,extractVariableNames:()=>oI,translateFrom:()=>td,useStoreWithActions:()=>rZ,EditIcon:()=>a_,getCandidateExtensions:()=>r_,shallowEqual:()=>x,subscribeNotificationShown:()=>p,MaximizeIcon:()=>aW,promptForClosingWorkspaces:()=>dq,WarningIcon:()=>lh,fhirBaseUrl:()=>tN,matchLocale:()=>mC,usePatientPhoto:()=>uz,registerBreadcrumb:()=>tt,EventsIcon:()=>ay,createGlobalStore:()=>R,subscribeToFeatureFlag:()=>oL,useExtensionStore:()=>iF,createAttachment:()=>nB,useLeftNavStore:()=>i4,TableIcon:()=>lo,Icon:()=>lS,InformationFilledIcon:()=>aA,getCurrentPageMap:()=>ne,LaboratoryPictogram:()=>di,temporaryConfigStore:()=>ee,toDateObjectStrict:()=>lQ,defineConfigSchema:()=>eP,filterBreadcrumbs:()=>ti,invalidateImplementerToolsConfig:()=>ep,PatientBannerContactDetails:()=>mv,getAssignedExtensions:()=>rw,promptForClosingWorkspacesInWindow:()=>dJ,PatientPhoto:()=>uK,MaterialOrderIcon:()=>aL,MicroscopeIcon:()=>aB,visitTypesUrl:()=>nK,getOpenedWindowWidth:()=>d5,scheduleRecomputation:()=>o2,PharmacyPictogram:()=>df,AttachmentIcon:()=>l_,MoneyIcon:()=>aH,getAttachments:()=>nD,PageHeaderContent:()=>uk,MedicationIcon:()=>aD,PrinterIcon:()=>aY,PatientListsPictogram:()=>dj,useAppContext:()=>ij,isOpenmrsRoutes:()=>n_,AppointmentsAltPictogram:()=>uZ,GenericOrderTypeIcon:()=>ak,batchExtensionUpdates:()=>o0,useExtensionSlotStore:()=>r2,ViewIcon:()=>lg,formattedName:()=>uI,sessionEndpoint:()=>tC,duration:()=>cl,resetImportMapOverrides:()=>nl,TableOfContentsIcon:()=>ln,CaretLeftIcon:()=>s7,getTranslationOverrides:()=>eL,isVersionSatisfied:()=>mO,EmptyCardIllustration:()=>cX,PenIcon:()=>aX,verifyTotpCode:()=>tz,validators:()=>e9,setupImportMapOverrides:()=>nd,showToast:()=>dD,useDefineAppContext:()=>iy,getGlobalStore:()=>M,useOnClickOutside:()=>se,getWindowByWorkspaceName:()=>rE,ArrowRightIcon:()=>s5,loadLifeCycles:()=>sx,registerBreadcrumbs:()=>tn,MotherIcon:()=>aV,fetchCurrentPatient:()=>nH,Toast:()=>dT,MessageQueueIcon:()=>aU,TwoFactorAuthenticationIcon:()=>lc,Pharmacy2Pictogram:()=>dp,goBackInHistory:()=>ty,GroupAccessIcon:()=>aC,getExtensionRenderingsStore:()=>oH,setImplementerToolsConfigRecomputer:()=>ef,getAsyncExtensionLifecycle:()=>im,setupApiModule:()=>tQ,renderLoadingSpinner:()=>my,showNotification:()=>uh,getModalRegistration:()=>rN,ListCheckedIcon:()=>a$,ResponsiveWrapper:()=>dC,GynaecologyPictogram:()=>dn,ShoppingCartIcon:()=>a9,getRouteMapNextPageMap:()=>nI,MetadataExportPictogram:()=>da,updateVisit:()=>n6,backendDependencies:()=>tZ,MaybePictogram:()=>dk,createParcelMounter:()=>rD,openmrsFetch:()=>tP,useStore:()=>rY,isOpenmrsAppRoutes:()=>nw,ExportedWorkspace:()=>ms,DentistryPictogram:()=>u4,HomePictogram:()=>dS,ServiceQueuesPictogram:()=>dw,createExportedWorkspaceWindow:()=>d8,setFeatureFlag:()=>oW,toLanguageTag:()=>lU,DigitalTrustPictogram:()=>u9,NumericObservation:()=>ux,attachmentUrl:()=>nL,interpolateString:()=>tp,inRange:()=>e6,useExtensionSlotMeta:()=>iB,AppointmentsPictogram:()=>uY,renderSnackbars:()=>dO,getRegisteredWorkspace2Names:()=>d2,logout:()=>tq,toLocationObject:()=>nz,ChartLineIcon:()=>ao,UserHasAccess:()=>su,evaluateAsBooleanAsync:()=>ol,createDashboard:()=>lk,getLocations:()=>nq,useExtensionContext:()=>iD,getExtensionsConfigStore:()=>es,getRouteMapDefaultMap:()=>nP,age:()=>uR,isOmrsDateStrict:()=>lY,registerWorkspaceGroups2:()=>rA,usePaginationInfo:()=>sr,evaluateAsync:()=>os,useOpenmrsFetchAll:()=>iQ,removeImportMapOverride:()=>na,useVisitTypes:()=>sy,ageAsDuration:()=>uO,getExtensionNameFromId:()=>rc,DataEntryPictogram:()=>u3,renderParcel:()=>rW,ResetIcon:()=>a5,RenewIcon:()=>a1,useWorkspace2Context:()=>d1,subscribeActionableNotificationShown:()=>g,ErrorCard:()=>cQ,GenderFemaleIcon:()=>ab,enableImportMapOverride:()=>nc,retry:()=>mR,ComponentContext:()=>rV,ExtensionSlot:()=>r4,unsetLeftNav:()=>rS,addImportMapOverride:()=>ns,MaybeIcon:()=>lx,useCustomOverflowMenu:()=>sq,PedestrianFamilyIcon:()=>aK,CtScanPictogram:()=>u8,dispatchNotificationShown:()=>u,leftNavStore:()=>rb,OpenmrsFetchError:()=>tI,UserFollowIcon:()=>ld,launchWorkspaceGroup2:()=>dB,ChevronRightIcon:()=>ac,UserXrayIcon:()=>lm,GenderOtherIcon:()=>aS,formatDuration:()=>co,toOmrsIsoString:()=>l0,Labs2Pictogram:()=>ds,workspace2Store:()=>rC,setUserLanguage:()=>tL,useBodyScrollLock:()=>iP,SyringeIcon:()=>lt,LocationPicker:()=>c1,useDebounce:()=>i$,TimeIcon:()=>lr,getExtensionSlotConfig:()=>er,AddIcon:()=>s0,getRouteMapOverrideMap:()=>nA,processConfig:()=>eW,InventoryManagementIcon:()=>aR,registerWorkspaces2:()=>rR,UserIcon:()=>lf,formatPatientName:()=>uP,fireOpenmrsEvent:()=>nV,registerModal:()=>rk,registerTranslationNamespace:()=>eO,displayName:()=>uE,createLocalStore:()=>T,evaluate:()=>oi,defineExtensionConfigSchema:()=>eR,getSyncLifecycle:()=>id,renderWorkspaceWindowsAndMenu:()=>mj,evaluateAsTypeAsync:()=>om});let s="openmrs:notification-shown",a="openmrs:actionable-notification-shown",l="openmrs:toast-shown",c="openmrs:snack-bar-shown";function u(e){window.dispatchEvent(new CustomEvent(s,{detail:e}))}function d(e){window.dispatchEvent(new CustomEvent(a,{detail:e}))}function m(e){window.dispatchEvent(new CustomEvent(c,{detail:e}))}function f(e){window.dispatchEvent(new CustomEvent(l,{detail:e}))}function p(e){let t=t=>e(t.detail);return window.addEventListener(s,t),()=>window.removeEventListener(s,t)}function g(e){let t=t=>e(t.detail);return window.addEventListener(a,t),()=>window.removeEventListener(a,t)}function h(e){let t=t=>e(t.detail);return window.addEventListener(l,t),()=>window.removeEventListener(l,t)}function w(e){let t=t=>e(t.detail);return window.addEventListener(c,t),()=>window.removeEventListener(c,t)}function _(e,t){let{message:n}=b(e);return"string"==typeof n&&n?n:t}function v(e){let t=b(e);setTimeout(()=>{throw t})}function y(){let e=Error();return t=>{let n=b(t);n.stack+=`
|
|
2
2
|
Async stacktrace:
|
|
3
|
-
${e.stack}`,v(t)}}function b(e){let t;if(e instanceof Error)return e;if(null===e)return Error("'null' was thrown as an error");if("object"==typeof e){try{t=`Object thrown as error: ${JSON.stringify(e)}`}catch(n){t=`Object thrown as error with the following properties: ${Object.keys(e)}`}return Error(t)}if(void 0===e)return Error("'undefined' was thrown as an error");return Error(e.toString())}function x(e,t){if(e===t||Object.is(e,t))return!0;if(Array.isArray(e)){if(!Array.isArray(t)||e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}if(Array.isArray(t)||"object"!=typeof e||null===e||"object"!=typeof t||null===t)return!1;let n=Object.getOwnPropertyNames(e),o=Object.getOwnPropertyNames(t);return n.length===o.length&&n.every(n=>e[n]===t[n])}window.onerror=function(e,t,n,o,r){return console.error("Unexpected error: ",r??e),f({description:_(r,"Oops! An unexpected error occurred."),kind:"error",title:"Error"}),!1},window.onunhandledrejection=function(e){console.error("Unhandled rejection: ",e.reason),f({description:_(e.reason,"Oops! An unhandled promise rejection occurred."),kind:"error",title:"Error"})};var S,k,j,N=n(1978),E=n(9167);function C(){try{return"u">typeof process&&("true"===process.env.VITEST||void 0!==process.env.JEST_WORKER_ID)||"u">typeof globalThis&&("__vitest_worker__"in globalThis||"__jest__"in globalThis)}catch{return!1}}let P={},I=Symbol.for("openmrs.esm-state.instanceCount"),A=globalThis,O=(A[I]??0)+1;function R(e,t,n="none"){let o=P[e];if(o)return o.active?C()||console.error(`Attempted to override the existing store ${e}. Make sure that stores are only created once.`):o.value.setState(t,!0),o.active=!0,o.value;{let o=W(e,t,n);return P[e]={value:o,active:!0},o}}function $(e){return(0,E.y)()(()=>e)}function T(e,t){let n=P[e];return n?(n.active?C()||console.error(`Attempted to override the existing store ${e}. Make sure that stores are only created once.`):n.value=t,n.active=!0,n.value):(P[e]={value:t,active:!0},t)}function M(e,t,n="none"){let o=P[e];if(!o){let o=W(e,t??{},n);return P[e]={value:o,active:!1},o}return o.value}function L(...e){let[t,n,o]=e,r=void 0===o?n:o,i=void 0===o?e=>e:n,s=i(t.getState());return r(s),t.subscribe(e=>{let t=i(e);x(s,t)||(s=t,r(t))})}function W(e,t,n){return"sessionStorage"===n?(0,E.y)()((0,N.Zr)(()=>t,{name:e,storage:(0,N.KU)(()=>sessionStorage)})):(0,E.y)()(()=>t)}A[I]=O,O>1&&!C()&&console.error(`Detected ${O} copies of @openmrs/esm-framework running on this page. Each copy keeps its own store registry, so stores, configuration and extension state are not shared between them. This usually means a frontend module loaded its own bundled framework instead of the one the app shell provides.`),globalThis.setTimeout?.(()=>{"u">typeof window&&"development"===window.spaEnv&&(window.stores=P)},1e3);var D=n(1156),U=n(3591),B=n(4888),F=n(9352),H=n(602),V=n(8395),G=((S={}).Array="Array",S.Boolean="Boolean",S.ConceptUuid="ConceptUuid",S.Number="Number",S.Object="Object",S.String="String",S.UUID="UUID",S.PersonAttributeTypeUuid="PersonAttributeTypeUuid",S.PatientIdentifierTypeUuid="PatientIdentifierTypeUuid",S);function z(e,t){return n=>{if(!e(n))if("function"==typeof t)return t(n);else return t}}let q=z(e=>Array.isArray(e),"must be an array"),J=z(e=>"boolean"==typeof e,"must be a boolean"),K=z(e=>"number"==typeof e,"must be a number"),X=z(e=>"string"==typeof e,"must be a string"),Y=z(e=>"object"==typeof e&&!Array.isArray(e)&&null!==e,"must be an object (not an array or null)"),Z=z(e=>/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(e)||/^[0-9a-f]{36}$/i.test(e),"must be a valid UUID or a 36-character hexadecimal string"),Q=R("config-internal",{providedConfigs:[],schemas:{},moduleLoaded:{},moduleStarted:{}}),ee=R("temporary-config",{config:function(){try{return JSON.parse(localStorage.getItem("openmrs:temporaryConfig")||"{}")}catch(e){return{}}}()});ee.subscribe(e=>{var t=e.config;try{localStorage.setItem("openmrs:temporaryConfig",JSON.stringify(t))}catch(e){}});let et=R("config-store-of-extension-state",{mountedExtensions:[]});function en(e){return M(`config-module-${e}`,{config:null,loaded:!1,translationOverridesLoaded:!1})}function eo(){return M("config-extension-slots",{slots:{}})}function er(e){return ei(eo().getState(),e)}function ei(e,t){return e.slots[t]??{loaded:!1,config:{}}}function es(){return M("config-extensions",{configs:{}})}function ea(e,t,n){return e.configs[t]?.[n]??{loaded:!1,config:null}}function el(e,t,n){return e.configure?.[n]??null}let ec=(0,E.y)()(()=>({config:{}})),eu=0,ed=!0,em=!1;function ef(e){o=e}function ep(){ed=!0,eu>0&&eg()}function eg(){if(ed&&o&&!em){em=!0,ed=!1;try{o()}catch(e){ed=!0,eh(e),console.error("Failed to derive the implementer tools config",e)}finally{em=!1}}}function eh(e){ec.setState({derivationError:e instanceof Error?e.message:String(e)})}function ew(){ec.getState().derivationError&&ec.setState({derivationError:void 0})}let e_=T("config-implementer-tools",{...ec,getState:()=>(0===eu&&eg(),ec.getState()),setState:(...e)=>(ed=!1,ec.setState(...e)),subscribe(e){eu++,eg();let t=ec.subscribe(e),n=!1;return()=>{!n&&(n=!0,eu--),t()}}});function ev(e,t){if(Array.isArray(t))return t}function ey(e,t){return(0,B.A)({},e,t,ev)}let eb=[],ex=new Set,eS=null,ek=new WeakMap;function ej(){o=()=>{var e,t;let n,o;return e=Q.getState(),t=ee.getState(),n=e_.getState(),o={config:function(e,t){let n=function(e){let t={};for(let[n,o]of Object.entries(e)){let e=eB.get(n);if(e&&e.schema===o)t[n]=e.annotated;else{let e=function e(t){return t.hasOwnProperty("_default")?{...t,_value:t._default,_source:"default"}:eZ(t)?Object.keys(t).reduce((n,o)=>(n[o]=e(t[o]),n),{}):{}}((0,V.A)(o));eB.set(n,{schema:o,annotated:e}),t[n]=e}}return t}(e.schemas),o=[...e.providedConfigs.map(e=>[e.config,e.source]),[t.config,"temporary config"]],r=new Set(Object.keys(n));for(let[e]of o)for(let t of Object.keys(e))r.add(t);let i={};for(let e of r){let t=n[e],r=o.map(([t])=>t[e]),s=o.map(([,e])=>e),a=eU.get(e);if(a&&a.annotatedSchema===t&&a.configSlices.length===r.length&&a.configSlices.every((e,t)=>e===r[t])&&a.sources.every((e,t)=>e===s[t])){i[e]=a.result;continue}let l=t??{};o.forEach(([,e],t)=>{let n=r[t];void 0!==n&&(l=ey(l,function e(t,n){return eZ(t)?Object.keys(t).reduce((o,r)=>(o[r]=e(t[r],n),o),{}):{_value:t,_source:n}}(n,e)))}),eU.set(e,{annotatedSchema:t,configSlices:r,sources:s,result:l}),i[e]=l}return i}(e,t)},void((0,F.A)(n.config,o.config)||e_.setState(o))},eN(),eb.push(Q.subscribe(eN),ee.subscribe(eN),et.subscribe(eN))}function eN(){ew();try{!function(){let e=Q.getState(),t=ee.getState(),n=et.getState();if(eS?.configState===e&&eS.tempConfigState===t)return eC(e,n,t,eS.slotConfigs,!0);!function(e,t){for(let n of Object.keys(e.schemas)){let o,r=en(n),i=e.schemas[n],s=!!e.moduleLoaded[n],a=eE.get(n);if(a&&a.schema===i&&a.moduleLoaded===s&&a.providedConfigs===e.providedConfigs&&a.temporaryConfig===t.config)o=a.state;else{let r=s?function(e,t,n){let o=t.schemas[e],r=eV(e,eF(t,n));ez(o,r,e);let i=eX(o,r);return eq(o,i,e),delete i.extensionSlots,i}(n,e,t):function(e,t,n){let o=eX(e5,eV(e,eF(t,n)));return eq(e5,o,e),delete o.extensionSlots,o}(n,e,t);o={translationOverridesLoaded:!0,loaded:s,config:r},eE.set(n,{schema:i,moduleLoaded:s,providedConfigs:e.providedConfigs,temporaryConfig:t.config,state:o})}let l=r.getState();l.loaded===o.loaded&&l.translationOverridesLoaded===o.translationOverridesLoaded&&(0,F.A)(l.config,o.config)||r.setState(o)}}(e,t);let o=function(e,t){let n=eG(eF(e,t)),o=Object.keys(n).reduce((e,t)=>(n[t]?.extensionSlots&&(e[t]=n[t]?.extensionSlots),e),{});var r=o;for(let[e,t]of Object.entries(r))for(let[n,o]of Object.entries(t))!function(e,t,n){let o=`${t}.extensionSlots.${n}`,r=`Extension slot config '${o}'`,i=Object.keys(e).filter(e=>!["add","remove","order","configure"].includes(e));i.length&&eQ(o,r+`' contains invalid keys '${i.join("', '")}'`),!e.add||Array.isArray(e.add)&&e.add.every(e=>"string"==typeof e)||eQ(o,r+".add' is invalid. Must be an array of strings (extension IDs)"),!e.remove||Array.isArray(e.remove)&&e.remove.every(e=>"string"==typeof e)||eQ(o,r+".remove' is invalid. Must be an array of strings (extension IDs)"),!e.order||Array.isArray(e.order)&&e.order.every(e=>"string"==typeof e)||eQ(o,r+".order' is invalid. Must be an array of strings (extension IDs)"),e.configure&&!eZ(e.configure)&&eQ(o,r+".configure' is invalid. Must be an object with extension IDs for keys")}(o,e,n);let i={},s={};for(let e of Object.values(o))for(let[t,n]of Object.entries(e))i[t]=n,n.configure&&(s[t]??(s[t]=[])).push(n.configure);for(let[e,t]of Object.entries(s)){let n=1===t.length?t[0]:eG(t);i[e].configure!==n&&(i[e]={...i[e],configure:n})}return i}(e,t);(function(e){let t=eo(),n=t.getState().slots,o={},r=!1;for(let[t,i]of Object.entries(e)){let e=n[t];e?.loaded&&(0,F.A)(e.config,i)?o[t]=e:(o[t]={loaded:!0,config:i},r=!0)}(r||Object.keys(n).length!==Object.keys(o).length)&&t.setState({slots:o})})(o),eC(e,n,t,o,!1),eS={configState:e,tempConfigState:t,slotConfigs:o},ep()}()}catch(e){eh(e),console.error("Failed to recompute the configuration",e)}}ej();let eE=new Map;function eC(e,t,n,o,r){let i=es(),s=i.getState().configs,a={},l=!1,c=0;for(let i of t.mountedExtensions){let t,u=s[i.slotName]?.[i.extensionId],d=u&&ek.get(u);if(r&&u?.loaded&&d?.slotModuleName===i.slotModuleName&&d.extensionModuleName===i.extensionModuleName)t=u;else{let r=function(e,t,n,o,r,i,s){let a=function(e){let[t]=e.split("#");return t}(o),l=r.schemas[a],c=!!r.moduleStarted[t],u=JSON.stringify([n,o,e,t]),d=eD.get(u);if(d&&d.extensionSchema===l&&d.extensionModuleSchema===r.schemas[t]&&d.extensionModuleStarted===c&&d.providedConfigs===r.providedConfigs&&d.temporaryConfig===i.config)return d.config;let m=l?a:t,f=eF(r,i),p=s?.configure?.[o]??{},g=eV(e,f),h=g?.extensionSlots?.[n]?.configure?.[o]??{},w=eG([eV(m,f),p,h]),_=l??r.schemas[t];(l||c)&&ez(_,w,m);let v=eX(_,w);return eq(_,v,m),delete v.extensionSlots,eD.set(u,{extensionSchema:l,extensionModuleSchema:r.schemas[t],extensionModuleStarted:c,providedConfigs:r.providedConfigs,temporaryConfig:i.config,config:v}),v}(i.slotModuleName,i.extensionModuleName,i.slotName,i.extensionId,e,n,o[i.slotName]);t=u?.loaded&&(0,F.A)(u.config,r)?u:{config:r,loaded:!0}}ek.set(t,i),t!==u&&(l=!0),a[i.slotName]||(a[i.slotName]={}),a[i.slotName][i.extensionId]=t,c++}for(let[e,t]of Object.entries(a)){let n=s[e];n&&Object.keys(n).length===Object.keys(t).length&&Object.entries(t).every(([e,t])=>n[e]===t)&&(a[e]=n)}l||(l=Object.keys(s).length!==Object.keys(a).length||Object.values(s).reduce((e,t)=>e+Object.keys(t).length,0)!==c),l&&i.setState({configs:a})}function eP(e,t){eH(e,t);let n=ey(t,e5);Q.setState(t=>({...t,schemas:{...t.schemas,[e]:n},moduleLoaded:{...t.moduleLoaded,[e]:!0}}))}function eI(e){Q.setState(t=>({...t,schemas:{...t.schemas,[e]:e5}}))}function eA(e){Q.setState(t=>({...t,moduleLoaded:{...t.moduleLoaded,[e]:!0},moduleStarted:{...t.moduleStarted,[e]:!0}}))}function eO(e){Q.setState(t=>({...t,schemas:{...t.schemas,[e]:e2}}))}function eR(e,t){eH(e,t);let n=ey(t,e5);Q.getState().schemas[e]&&console.error(`Config schema for extension ${e} already exists. If there are multiple extensions with this same name, one will probably crash.`),Q.setState(t=>({...t,schemas:{...t.schemas,[e]:n}}))}function e$(e,t="provided"){Q.setState(n=>({...n,providedConfigs:[...n.providedConfigs,{source:t,config:e}]}))}function eT(e,t,n){return new Promise(o=>{let r,i=!1;function s(e){!i&&t(e)&&(i=!0,o(n(e)),r?.())}s(e.getState()),i||(r=e.subscribe(s))})}function eM(e){return eT(en(e),e=>!!(e.loaded&&e.config),e=>(0,H.A)(e.config,["Display conditions","Translation overrides"]))}function eL(e,t,n){let o=[e in Q.getState().schemas?eT(en(e),e=>!!(e.translationOverridesLoaded&&e.config),e=>e.config["Translation overrides"]??{}):Promise.resolve({})];if(t&&n){let e=ea(es().getState(),t,n),r=e.loaded&&e.config?e.config["Translation overrides"]??{}:{};o.push(Promise.resolve(r))}return Promise.all(o)}function eW(e,t,n){ez(e,t,n);let o=eX(e,t);return eq(e,o,n),o}let eD=new Map,eU=new Map,eB=new Map;function eF(e,t){return[...e.providedConfigs.map(e=>e.config),t.config]}function eH(e,t,n=""){let o="Please verify that you are running the latest version and, if so, alert the maintainer.";for(let r of Object.keys(t).filter(e=>!e.startsWith("_"))){let i=n+(n&&".")+r,s=t[r];if("Display conditions"===i&&console.error(`${e} declares a configuration option called "Display conditions"; the "Display conditions" option is a reserved name. ${o}`),"Translation overrides"===i&&console.error(`${e} declares a configuration option called "Translation overrides"; the "Translation overrides" option is a reserved name. ${o}`),!eZ(s)){console.error(`${e} has bad config schema definition for key '${i}'. ${o}`);continue}s.hasOwnProperty("_default")||eH(e,s,i);let a=s._elements;if(eY(a)&&eH(e,a,i+"._elements"),s._validators)for(let t of s._validators)"function"!=typeof t&&console.error(`${e} has invalid validator for key '${i}' ${o}.
|
|
3
|
+
${e.stack}`,v(t)}}function b(e){let t;if(e instanceof Error)return e;if(null===e)return Error("'null' was thrown as an error");if("object"==typeof e){try{t=`Object thrown as error: ${JSON.stringify(e)}`}catch(n){t=`Object thrown as error with the following properties: ${Object.keys(e)}`}return Error(t)}if(void 0===e)return Error("'undefined' was thrown as an error");return Error(e.toString())}function x(e,t){if(e===t||Object.is(e,t))return!0;if(Array.isArray(e)){if(!Array.isArray(t)||e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}if(Array.isArray(t)||"object"!=typeof e||null===e||"object"!=typeof t||null===t)return!1;let n=Object.getOwnPropertyNames(e),o=Object.getOwnPropertyNames(t);return n.length===o.length&&n.every(n=>e[n]===t[n])}window.onerror=function(e,t,n,o,r){return console.error("Unexpected error: ",r??e),f({description:_(r,"Oops! An unexpected error occurred."),kind:"error",title:"Error"}),!1},window.onunhandledrejection=function(e){console.error("Unhandled rejection: ",e.reason),f({description:_(e.reason,"Oops! An unhandled promise rejection occurred."),kind:"error",title:"Error"})};var S,j,k,N=n(1978),C=n(9167);function E(){try{return"u">typeof process&&("true"===process.env.VITEST||void 0!==process.env.JEST_WORKER_ID)||"u">typeof globalThis&&("__vitest_worker__"in globalThis||"__jest__"in globalThis)}catch{return!1}}let P={},I=Symbol.for("openmrs.esm-state.instanceCount"),A=globalThis,O=(A[I]??0)+1;function R(e,t,n="none"){let o=P[e];if(o)return o.active?E()||console.error(`Attempted to override the existing store ${e}. Make sure that stores are only created once.`):o.value.setState(t,!0),o.active=!0,o.value;{let o=W(e,t,n);return P[e]={value:o,active:!0},o}}function T(e){return(0,C.y)()(()=>e)}function $(e,t){let n=P[e];return n?(n.active?E()||console.error(`Attempted to override the existing store ${e}. Make sure that stores are only created once.`):n.value=t,n.active=!0,n.value):(P[e]={value:t,active:!0},t)}function M(e,t,n="none"){let o=P[e];if(!o){let o=W(e,t??{},n);return P[e]={value:o,active:!1},o}return o.value}function L(...e){let[t,n,o]=e,r=void 0===o?n:o,i=void 0===o?e=>e:n,s=i(t.getState());return r(s),t.subscribe(e=>{let t=i(e);x(s,t)||(s=t,r(t))})}function W(e,t,n){return"sessionStorage"===n?(0,C.y)()((0,N.Zr)(()=>t,{name:e,storage:(0,N.KU)(()=>sessionStorage)})):(0,C.y)()(()=>t)}A[I]=O,O>1&&!E()&&console.error(`Detected ${O} copies of @openmrs/esm-framework running on this page. Each copy keeps its own store registry, so stores, configuration and extension state are not shared between them. This usually means a frontend module loaded its own bundled framework instead of the one the app shell provides.`),globalThis.setTimeout?.(()=>{"u">typeof window&&"development"===window.spaEnv&&(window.stores=P)},1e3);var D=n(1156),U=n(3591),B=n(4888),F=n(9352),H=n(602),V=n(8395),G=((S={}).Array="Array",S.Boolean="Boolean",S.ConceptUuid="ConceptUuid",S.Number="Number",S.Object="Object",S.String="String",S.UUID="UUID",S.PersonAttributeTypeUuid="PersonAttributeTypeUuid",S.PatientIdentifierTypeUuid="PatientIdentifierTypeUuid",S);function z(e,t){return n=>{if(!e(n))if("function"==typeof t)return t(n);else return t}}let q=z(e=>Array.isArray(e),"must be an array"),J=z(e=>"boolean"==typeof e,"must be a boolean"),K=z(e=>"number"==typeof e,"must be a number"),X=z(e=>"string"==typeof e,"must be a string"),Y=z(e=>"object"==typeof e&&!Array.isArray(e)&&null!==e,"must be an object (not an array or null)"),Z=z(e=>/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(e)||/^[0-9a-f]{36}$/i.test(e),"must be a valid UUID or a 36-character hexadecimal string"),Q=R("config-internal",{providedConfigs:[],schemas:{},moduleLoaded:{},moduleStarted:{}}),ee=R("temporary-config",{config:function(){try{return JSON.parse(localStorage.getItem("openmrs:temporaryConfig")||"{}")}catch(e){return{}}}()});ee.subscribe(e=>{var t=e.config;try{localStorage.setItem("openmrs:temporaryConfig",JSON.stringify(t))}catch(e){}});let et=R("config-store-of-extension-state",{mountedExtensions:[]});function en(e){return M(`config-module-${e}`,{config:null,loaded:!1,translationOverridesLoaded:!1})}function eo(){return M("config-extension-slots",{slots:{}})}function er(e){return ei(eo().getState(),e)}function ei(e,t){return e.slots[t]??{loaded:!1,config:{}}}function es(){return M("config-extensions",{configs:{}})}function ea(e,t,n){return e.configs[t]?.[n]??{loaded:!1,config:null}}function el(e,t,n){return e.configure?.[n]??null}let ec=(0,C.y)()(()=>({config:{}})),eu=0,ed=!0,em=!1;function ef(e){o=e}function ep(){ed=!0,eu>0&&eg()}function eg(){if(ed&&o&&!em){em=!0,ed=!1;try{o()}catch(e){ed=!0,eh(e),console.error("Failed to derive the implementer tools config",e)}finally{em=!1}}}function eh(e){ec.setState({derivationError:e instanceof Error?e.message:String(e)})}function ew(){ec.getState().derivationError&&ec.setState({derivationError:void 0})}let e_=$("config-implementer-tools",{...ec,getState:()=>(0===eu&&eg(),ec.getState()),setState:(...e)=>(ed=!1,ec.setState(...e)),subscribe(e){eu++,eg();let t=ec.subscribe(e),n=!1;return()=>{!n&&(n=!0,eu--),t()}}});function ev(e,t){if(Array.isArray(t))return t}function ey(e,t){return(0,B.A)({},e,t,ev)}let eb=[],ex=new Set,eS=null,ej=new WeakMap;function ek(){o=()=>{var e,t;let n,o;return e=Q.getState(),t=ee.getState(),n=e_.getState(),o={config:function(e,t){let n=function(e){let t={};for(let[n,o]of Object.entries(e)){let e=eB.get(n);if(e&&e.schema===o)t[n]=e.annotated;else{let e=function e(t){return t.hasOwnProperty("_default")?{...t,_value:t._default,_source:"default"}:eZ(t)?Object.keys(t).reduce((n,o)=>(n[o]=e(t[o]),n),{}):{}}((0,V.A)(o));eB.set(n,{schema:o,annotated:e}),t[n]=e}}return t}(e.schemas),o=[...e.providedConfigs.map(e=>[e.config,e.source]),[t.config,"temporary config"]],r=new Set(Object.keys(n));for(let[e]of o)for(let t of Object.keys(e))r.add(t);let i={};for(let e of r){let t=n[e],r=o.map(([t])=>t[e]),s=o.map(([,e])=>e),a=eU.get(e);if(a&&a.annotatedSchema===t&&a.configSlices.length===r.length&&a.configSlices.every((e,t)=>e===r[t])&&a.sources.every((e,t)=>e===s[t])){i[e]=a.result;continue}let l=t??{};o.forEach(([,e],t)=>{let n=r[t];void 0!==n&&(l=ey(l,function e(t,n){return eZ(t)?Object.keys(t).reduce((o,r)=>(o[r]=e(t[r],n),o),{}):{_value:t,_source:n}}(n,e)))}),eU.set(e,{annotatedSchema:t,configSlices:r,sources:s,result:l}),i[e]=l}return i}(e,t)},void((0,F.A)(n.config,o.config)||e_.setState(o))},eN(),eb.push(Q.subscribe(eN),ee.subscribe(eN),et.subscribe(eN))}function eN(){ew();try{!function(){let e=Q.getState(),t=ee.getState(),n=et.getState();if(eS?.configState===e&&eS.tempConfigState===t)return eE(e,n,t,eS.slotConfigs,!0);!function(e,t){for(let n of Object.keys(e.schemas)){let o,r=en(n),i=e.schemas[n],s=!!e.moduleLoaded[n],a=eC.get(n);if(a&&a.schema===i&&a.moduleLoaded===s&&a.providedConfigs===e.providedConfigs&&a.temporaryConfig===t.config)o=a.state;else{let r=s?function(e,t,n){let o=t.schemas[e],r=eV(e,eF(t,n));ez(o,r,e);let i=eX(o,r);return eq(o,i,e),delete i.extensionSlots,i}(n,e,t):function(e,t,n){let o=eX(e5,eV(e,eF(t,n)));return eq(e5,o,e),delete o.extensionSlots,o}(n,e,t);o={translationOverridesLoaded:!0,loaded:s,config:r},eC.set(n,{schema:i,moduleLoaded:s,providedConfigs:e.providedConfigs,temporaryConfig:t.config,state:o})}let l=r.getState();l.loaded===o.loaded&&l.translationOverridesLoaded===o.translationOverridesLoaded&&(0,F.A)(l.config,o.config)||r.setState(o)}}(e,t);let o=function(e,t){let n=eG(eF(e,t)),o=Object.keys(n).reduce((e,t)=>(n[t]?.extensionSlots&&(e[t]=n[t]?.extensionSlots),e),{});var r=o;for(let[e,t]of Object.entries(r))for(let[n,o]of Object.entries(t))!function(e,t,n){let o=`${t}.extensionSlots.${n}`,r=`Extension slot config '${o}'`,i=Object.keys(e).filter(e=>!["add","remove","order","configure"].includes(e));i.length&&eQ(o,r+`' contains invalid keys '${i.join("', '")}'`),!e.add||Array.isArray(e.add)&&e.add.every(e=>"string"==typeof e)||eQ(o,r+".add' is invalid. Must be an array of strings (extension IDs)"),!e.remove||Array.isArray(e.remove)&&e.remove.every(e=>"string"==typeof e)||eQ(o,r+".remove' is invalid. Must be an array of strings (extension IDs)"),!e.order||Array.isArray(e.order)&&e.order.every(e=>"string"==typeof e)||eQ(o,r+".order' is invalid. Must be an array of strings (extension IDs)"),e.configure&&!eZ(e.configure)&&eQ(o,r+".configure' is invalid. Must be an object with extension IDs for keys")}(o,e,n);let i={},s={};for(let e of Object.values(o))for(let[t,n]of Object.entries(e))i[t]=n,n.configure&&(s[t]??(s[t]=[])).push(n.configure);for(let[e,t]of Object.entries(s)){let n=1===t.length?t[0]:eG(t);i[e].configure!==n&&(i[e]={...i[e],configure:n})}return i}(e,t);(function(e){let t=eo(),n=t.getState().slots,o={},r=!1;for(let[t,i]of Object.entries(e)){let e=n[t];e?.loaded&&(0,F.A)(e.config,i)?o[t]=e:(o[t]={loaded:!0,config:i},r=!0)}(r||Object.keys(n).length!==Object.keys(o).length)&&t.setState({slots:o})})(o),eE(e,n,t,o,!1),eS={configState:e,tempConfigState:t,slotConfigs:o},ep()}()}catch(e){eh(e),console.error("Failed to recompute the configuration",e)}}ek();let eC=new Map;function eE(e,t,n,o,r){let i=es(),s=i.getState().configs,a={},l=!1,c=0;for(let i of t.mountedExtensions){let t,u=s[i.slotName]?.[i.extensionId],d=u&&ej.get(u);if(r&&u?.loaded&&d?.slotModuleName===i.slotModuleName&&d.extensionModuleName===i.extensionModuleName)t=u;else{let r=function(e,t,n,o,r,i,s){let a=function(e){let[t]=e.split("#");return t}(o),l=r.schemas[a],c=!!r.moduleStarted[t],u=JSON.stringify([n,o,e,t]),d=eD.get(u);if(d&&d.extensionSchema===l&&d.extensionModuleSchema===r.schemas[t]&&d.extensionModuleStarted===c&&d.providedConfigs===r.providedConfigs&&d.temporaryConfig===i.config)return d.config;let m=l?a:t,f=eF(r,i),p=s?.configure?.[o]??{},g=eV(e,f),h=g?.extensionSlots?.[n]?.configure?.[o]??{},w=eG([eV(m,f),p,h]),_=l??r.schemas[t];(l||c)&&ez(_,w,m);let v=eX(_,w);return eq(_,v,m),delete v.extensionSlots,eD.set(u,{extensionSchema:l,extensionModuleSchema:r.schemas[t],extensionModuleStarted:c,providedConfigs:r.providedConfigs,temporaryConfig:i.config,config:v}),v}(i.slotModuleName,i.extensionModuleName,i.slotName,i.extensionId,e,n,o[i.slotName]);t=u?.loaded&&(0,F.A)(u.config,r)?u:{config:r,loaded:!0}}ej.set(t,i),t!==u&&(l=!0),a[i.slotName]||(a[i.slotName]={}),a[i.slotName][i.extensionId]=t,c++}for(let[e,t]of Object.entries(a)){let n=s[e];n&&Object.keys(n).length===Object.keys(t).length&&Object.entries(t).every(([e,t])=>n[e]===t)&&(a[e]=n)}l||(l=Object.keys(s).length!==Object.keys(a).length||Object.values(s).reduce((e,t)=>e+Object.keys(t).length,0)!==c),l&&i.setState({configs:a})}function eP(e,t){eH(e,t);let n=ey(t,e5);Q.setState(t=>({...t,schemas:{...t.schemas,[e]:n},moduleLoaded:{...t.moduleLoaded,[e]:!0}}))}function eI(e){Q.setState(t=>({...t,schemas:{...t.schemas,[e]:e5}}))}function eA(e){Q.setState(t=>({...t,moduleLoaded:{...t.moduleLoaded,[e]:!0},moduleStarted:{...t.moduleStarted,[e]:!0}}))}function eO(e){Q.setState(t=>({...t,schemas:{...t.schemas,[e]:e2}}))}function eR(e,t){eH(e,t);let n=ey(t,e5);Q.getState().schemas[e]&&console.error(`Config schema for extension ${e} already exists. If there are multiple extensions with this same name, one will probably crash.`),Q.setState(t=>({...t,schemas:{...t.schemas,[e]:n}}))}function eT(e,t="provided"){Q.setState(n=>({...n,providedConfigs:[...n.providedConfigs,{source:t,config:e}]}))}function e$(e,t,n){return new Promise(o=>{let r,i=!1;function s(e){!i&&t(e)&&(i=!0,o(n(e)),r?.())}s(e.getState()),i||(r=e.subscribe(s))})}function eM(e){return e$(en(e),e=>!!(e.loaded&&e.config),e=>(0,H.A)(e.config,["Display conditions","Translation overrides"]))}function eL(e,t,n){let o=[e in Q.getState().schemas?e$(en(e),e=>!!(e.translationOverridesLoaded&&e.config),e=>e.config["Translation overrides"]??{}):Promise.resolve({})];if(t&&n){let e=ea(es().getState(),t,n),r=e.loaded&&e.config?e.config["Translation overrides"]??{}:{};o.push(Promise.resolve(r))}return Promise.all(o)}function eW(e,t,n){ez(e,t,n);let o=eX(e,t);return eq(e,o,n),o}let eD=new Map,eU=new Map,eB=new Map;function eF(e,t){return[...e.providedConfigs.map(e=>e.config),t.config]}function eH(e,t,n=""){let o="Please verify that you are running the latest version and, if so, alert the maintainer.";for(let r of Object.keys(t).filter(e=>!e.startsWith("_"))){let i=n+(n&&".")+r,s=t[r];if("Display conditions"===i&&console.error(`${e} declares a configuration option called "Display conditions"; the "Display conditions" option is a reserved name. ${o}`),"Translation overrides"===i&&console.error(`${e} declares a configuration option called "Translation overrides"; the "Translation overrides" option is a reserved name. ${o}`),!eZ(s)){console.error(`${e} has bad config schema definition for key '${i}'. ${o}`);continue}s.hasOwnProperty("_default")||eH(e,s,i);let a=s._elements;if(eY(a)&&eH(e,a,i+"._elements"),s._validators)for(let t of s._validators)"function"!=typeof t&&console.error(`${e} has invalid validator for key '${i}' ${o}.
|
|
4
4
|
|
|
5
5
|
If you're the maintainer: validators must be functions that return either undefined or an error string. Received ${t}.`);let l=s._type;l&&!Object.values(G).includes(l)&&console.error(`${e} has invalid type for key '${i}' ${o}.
|
|
6
6
|
|
|
@@ -9,20 +9,20 @@ If you're the maintainer: the allowed types are ${Object.values(G).join(", ")}.
|
|
|
9
9
|
If you're the maintainer: all config elements must have a default. Received ${JSON.stringify(s)}`),a&&l&&![G.Array,G.Object].includes(l)&&console.error(`${e} has bad config schema definition for key '${i}'. ${o}.
|
|
10
10
|
|
|
11
11
|
If you're the maintainer: the 'elements' key only works with '_type' equal to 'Array' or 'Object'. Received ${JSON.stringify(l)}`)}}function eV(e,t){return eG(t.map(({[e]:t})=>t).filter(e=>!!e))}function eG(e){return e.reduce((e,t)=>(0,B.A)(e,t,ev),{})}function ez(e,t,n=""){for(let o of Object.keys(t)){let r=t[o],i=n+"."+o,s=e[o];if(!e.hasOwnProperty(o)){("extensionSlots"!==o||""===n)&&eQ(i,`Unknown config key '${i}' provided. Ignoring.`);continue}(function e(t,n,o){eJ(o,t._type,n),eZ(n)?t._type===G.Object?function(t,n,o){if(t._elements)for(let r of Object.keys(n)){let i=n[r];e(t._elements,i,`${o}.${r}`)}}(t,n,o):t.hasOwnProperty("_default")||t.hasOwnProperty("_type")||ez(t,n,o):t._type===G.Array&&function(t,n,o){if(eJ(o,G.Array,n)){if(eY(t._elements))for(let r=0;r<n.length;r++)e(t._elements,n[r],`${o}[${r}]`);for(let e=0;e<n.length;e++)eJ(`${o}[${e}]`,t._elements?._type,n[e])}}(t,n,o)})(s,r,i)}}function eq(e,t,n=""){if(e){if(t!==e._default&&eK(n,e._validators,t),eZ(t))for(let o of Object.keys(t)){let r=t[o],i=n+"."+o,s=e[o];e._type===G.Object&&e._elements?eq(e._elements,r,i):eq(s,r,i)}else if(Array.isArray(t)&&e._elements)for(let o=0;o<t.length;o++)eq(e._elements,t[o],`${n}[${o}]`)}}function eJ(e,t,n){return!t||eK(e,[{Array:q,Boolean:J,ConceptUuid:Z,Number:K,Object:Y,String:X,UUID:Z,PersonAttributeTypeUuid:Z,PatientIdentifierTypeUuid:Z}[t]],n)}function eK(e,t,n){let o=!0;if(t)try{for(let r of t){let t=r(n);if("string"==typeof t){let r="object"==typeof n?`Invalid configuration for ${e}: ${t}`:`Invalid configuration value ${n} for ${e}: ${t}`;eQ(e,r),o=!1}}}catch(t){console.error(`Skipping invalid validator at "${e}". Encountered error
|
|
12
|
-
${t}`)}return o}let eX=(e,t)=>{let n=structuredClone(t);if(!e)return n;for(let t of Object.keys(e)){let o=n[t],r=e[t];if(r&&(r.hasOwnProperty("_type")||r.hasOwnProperty("_default"))){n.hasOwnProperty(t)||(n[t]=r._default);let e=r._elements;if(o&&eY(e)){if(r._type===G.Array&&Array.isArray(o)){let r=o.map(t=>eX(e,t));n[t]=r}else if(r._type===G.Object)for(let t of Object.keys(o))o[t]=eX(e,o[t])}}else if(eZ(r)){let e=o??{};eZ(e)&&(n[t]=eX(r,e))}}return n};function eY(e){return!!e&&Object.keys(e).filter(e=>!["_default","_validators"].includes(e)).length>0}function eZ(e){return"object"==typeof e&&!Array.isArray(e)&&null!==e}function eQ(e,t){let n=`${e}:::${t}`;ex.has(n)||(console.error(t),ex.add(n))}function e0(e){e?ex.forEach(t=>{t.startsWith(e)&&ex.delete(t)}):ex.clear()}function e1(){eb.forEach(e=>e()),eb.length=0,eE.clear(),eD.clear(),eB.clear(),eU.clear(),eS=null,ek=new WeakMap,ej()}let e2={"Translation overrides":{_description:"Per-language overrides for frontend translations should be keyed by language code and each language dictionary contains the translation key and the display value",_type:G.Object,_default:{},_validators:[z(e=>Object.keys(e).every(e=>/^[a-z]{2,3}(-[A-Z]{2,3})?$/.test(e)),e=>{let t=Object.keys(e).filter(e=>!/^[a-z]{2,3}(-[A-Z]{2,3})?$/.test(e));return`The 'Translation overrides' object should have language codes for keys. Language codes must be in the form of a two-to-three letter language code optionally followed by a hyphen and a two-to-three letter country code. The following keys do not conform: ${t.join(", ")}.`})]}},e5={"Display conditions":{privileges:{_description:"The privilege(s) the user must have to use this extension",_type:G.Array,_default:[]},expression:{_description:"The expression that determines whether the extension is displayed",_type:G.String,_default:void 0}},...e2},e6=(e,t)=>z(n=>e<=n&&n<=t,`must be between ${e} and ${t}`),e8=e=>{let t=e.concat(["openmrsBase","openmrsSpaBase"]);return z(e=>{if(!e||"string"!=typeof e)return!1;let n=/\${(.*?)}/g,o=n.exec(e);for(;o;){if(!t.includes(o[1]))return!1;o=n.exec(e)}return!0},"Should be a URL or path. The allowed template parameters are "+t.map(e=>"${"+e+"}").join(", "))},e3=e8([]),e4=e=>z(t=>e.includes(t),`Must be one of the following: '${e.join("', '")}'.`),e7={inRange:e6,isUrl:e3,isUrlWithTemplateParameters:e8,oneOf:e4};var e9=n(4913);let te=R("breadcrumbs",[]);function tt(e){return tn([e])}function tn(e){let t=[...to(),...e.map(e=>({matcher:e.matcher instanceof RegExp?e.matcher:"string"==typeof e.matcher?(0,e9.pathToRegexp)(e.matcher).regexp:(0,e9.pathToRegexp)(e.path).regexp,settings:e}))];te.setState(t,!0)}function to(){return te.getState()}function tr(e,t){if(t)return function(e,t){let[n]=e.filter(e=>e.matcher.test(t));return n}(e,t)||function(e,t){let n=t.split("/");for(;n.length>1;){n.pop();let t=tr(e,n.join("/"));if(t)return t}}(e,t)}function ti(e,t){if(e.length>0){let n=tr(e,t);if(n){let t=[n],o=tr(e,n.settings.parent);for(;void 0!==o;)t.push(o),o=tr(e,o.settings.parent);return t.reverse()}}return[]}function ts(e){return ti(to(),e)}var ta=n(2267);let tl={address1:"Address line 1",address2:"Address line 2",address3:"Address line 3",address4:"Address line 4",address5:"Address line 5",address6:"Address line 6",city:"City",cityVillage:"City",country:"Country",countyDistrict:"District",district:"District",postalCode:"Postal code",state:"State",stateProvince:"State",closeAllOpenedWorkspaces:"Discard changes in {{count}} workspaces",closingAllWorkspacesPromptBody:"There may be unsaved changes in the following workspaces. Do you want to discard changes in the following workspaces? {{workspaceNames}}",closingAllWorkspacesPromptTitle:"You have unsaved changes",discard:"Discard",hide:"Hide",maximize:"Maximize",minimize:"Minimize",openAnyway:"Open anyway",unsavedChangesInOpenedWorkspace:"You may have unsaved changes in the opened workspace. Do you want to discard these changes?",unsavedChangesInWorkspace:'There may be unsaved changes in "{{workspaceName}}". Please save them before opening another workspace.',unsavedChangesTitleText:"Unsaved changes",workspaceHeader:"Workspace header",discardUnsavedChangesPromptBodyMultiple:"{{count}} workspaces have unsaved changes. Closing them will discard the changes:",discardUnsavedChangesPromptBodySingle:"<strong>{{workspaceTitle}}</strong> has unsaved changes. Closing it will discard them.",discardUnsavedChangesPromptTitle:"Discard unsaved changes?",keepEditing:"Keep editing",abnormalValue:"Abnormal value",actions:"Actions",actionableNotification:"Actionable notification",address:"Address",age:"Age",applicationError:"Application Error",batchActionItemSelected:"{{totalSelected}} item selected",batchActionsItemsSelected:"{{totalSelected}} items selected",cancel:"Cancel",change:"Change",Clinic:"Clinic",clearDevOverrides:"Clear dev overrides",close:"Close",closesActionableNotification:"Close actionable notification",closeSnackbar:"Close snackbar",confirm:"Confirm",contactAdministratorIfIssuePersists:"Contact your system administrator if the problem persists.",contactDetails:"Contact details",copied:"Copied!",copyToClipboard:"Copy to clipboard",delete:"Delete",discardChanges:"Discard changes",edit:"Edit",emptyStateText:"There are no {{displayText}} to display",error:"Error",errorCopy:"Sorry, there was a problem displaying this information. You can try to reload this page, or contact the site administrator and quote the error code above.",errorLoadingLoginLocations:"Unable to load login locations. Please try again or contact support if the problem persists.",female:"Female",leftNavigation:"Left navigation",loading:"Loading",localVersion:"Local Build",male:"Male",navigateNonHttp:"Could not navigate to the requested page as it is not a safe URL",noResultsToDisplay:"No results to display",notAvailable:"Not available",other:"Other",paginationItemsCount:"{{pageItemsCount}} / {{totalItems}} items",paginationOfPages:"of {{count}} pages",patientAvatarAlt:"Avatar for {{patientName}}",patientIdentifierSticker:"Patient identifier sticker",patientLists:"Patient lists",patientPhotoAlt:"Profile photo of {{patientName}}",patientPhotoPlaceholder:"Photo placeholder for {{patientName}}",prereleaseVersion:"Prerelease",print:"Print",printError:"Print error",printErrorExplainer:"An error occurred in {{errorLocation}}",printIdentifierSticker:"Print identifier sticker",printing:"Printing",provisional:"Provisional",recordNewEntry:"Record {{displayText}}",relationships:"Relationships",reload:"Reload",resetOverrides:"Reset overrides",save:"Save",scriptLoadingFailed:"Error: Script failed to load",scriptLoadingError:"Failed to load overridden script from {{url}}. Please check that the bundled script is available at the expected URL. Click the button below to reset all import map overrides.",searchForLocation:"Search for a location",seeAll:"See all",seeMoreLists:"See {{count}} more lists",selectAll:"Select all",serverStartingUp:"The server is starting",serverStartingUpExplainer:"This can take a few minutes. OpenMRS will open automatically when the server is ready.",serverStartingUpSlowExplainer:"This is taking longer than usual. First startup after an upgrade can take 10 minutes or more. You can leave this page open.",sex:"Sex",showLess:"Show less",showMore:"Show more",snackbarNotification:"Snackbar notification",somethingWentWrongTryReloading:"Something went wrong. Please try reloading.",toggleDevTools:"Toggle dev tools",unknown:"Unknown",viewSetupProgress:"View setup progress",waitingForServer:"Waiting for the server",yearAbbreviation:"yr",yearsAbbreviation:"yrs"};var tc=n(2279);let tu=tc.Ay.default||tc.Ay;function td(e,t,n,o){return tu.t(t,{ns:e,defaultValue:n,...o})}function tm(e,t,n){return tl[e]?td("core",e,t??tl[e],n):(console.error(`O3 Core Translations does not provide key '${e}'. The key itself is being rendered as text.`),e)}function tf(e,t){let n=window.getOpenmrsSpaBase().replace(/\/$/,""),o=tp(e,{openmrsBase:window.openmrsBase,openmrsSpaBase:n,...t});return e.startsWith("//")?o:o.replace(/^\/\//,"/")}function tp(e,t){return Object.keys(t).reduce((e,n)=>e.split("${"+n+"}").join(t[n]),e)}function tg({to:e,templateParams:t}){let n=window.getOpenmrsSpaBase().replace(/\/$/,""),o=tf(e,t).replace(window.location.origin,""),r=new URL(o,window.location.origin);if("http:"!=r.protocol&&"https:"!=r.protocol)throw console.error(`Received request to navigate to non-http URL: ${r.toString()}`),Error(tm("navigateNonHttp"));o.startsWith(n)?(0,ta.EH)(o):window.location.assign(o)}tu.on("initialized",function(){window.i18next.loadNamespaces(["core"])});let th="openmrs:history";function tw(e){let t=JSON.parse(sessionStorage.getItem(th)??"[]")||[];t.push(e),t.length>50&&(t=t.slice(-50)),sessionStorage.setItem(th,JSON.stringify(t))}function t_(){0===JSON.parse(sessionStorage.getItem(th)??"[]").length&&document.referrer&&tw(document.referrer),window.addEventListener("single-spa:routing-event",e=>{let t=tv();e.detail.originalEvent?.singleSpaTrigger=="replaceState"?(t[t.length-1]=window.location.href,sessionStorage.setItem(th,JSON.stringify(t))):!e.detail.originalEvent?.singleSpa&&t.includes(window.location.href)?ty({toUrl:window.location.href}):t[t.length-1]!==window.location.href&&tw(window.location.href)})}function tv(){return JSON.parse(sessionStorage.getItem(th)??"[]")}function ty({toUrl:e}){let t=tv(),n=t.lastIndexOf(e);if(-1!=n){let e=t.slice(0,n+1);tg({to:t[n]}),sessionStorage.setItem(th,JSON.stringify(e))}else throw Error(`URL ${e} not found in history; cannot go back to it.`)}function tb(){sessionStorage.removeItem(th)}let tx="${openmrsSpaBase}/login",tS={redirectAuthFailure:{enabled:{_type:G.Boolean,_default:!0,_description:"Whether to redirect logged-out users to `redirectAuthFailure.url`"},url:{_type:G.String,_default:tx,_validators:[e7.isUrl],_description:"The url to which users will be redirected when they are logged out. If set to blank, the `location` header from the response will be used."},errors:{_type:G.Array,_default:[401],_elements:{_type:G.Number,_validators:[e7.inRange(100,600)]},_description:"The HTTP error codes for which users will be redirected"},resolvePromise:{_type:G.Boolean,_default:!1,_description:"Changes how requests that fail authentication are handled. Try messing with this if redirects to the login page aren't working correctly."}},followRedirects:{_type:G.Boolean,_default:!0,_description:"Whether openmrsFetch should support redirects returned from the backend"}};function tk(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}let tj="/ws/rest/v1",tN="/ws/fhir2/R4",tE=`${tj}/session`;function tC(e){return e&&e.startsWith("http")?e:("/"!==e[0]&&(e="/"+e),window.openmrsBase+e)}function tP(e,t={}){if("string"!=typeof e)throw Error("The first argument to @openmrs/api's openmrsFetch function must be a url string");if("object"!=typeof t)throw Error("The second argument to @openmrs/api's openmrsFetch function must be a plain object.");if(!window.openmrsBase)throw Error("@openmrs/api is running in a browser that doesn't have window.openmrsBase, which is provided by openmrs-module-spa's HTML file.");let n=tC(e);t.headers||(t.headers={}),(0,U.A)(t.body)&&(t.body=JSON.stringify(t.body)),void 0===t.headers.Accept&&(t.headers.Accept="application/json"),null===t.headers.Accept&&delete t.headers.Accept;let o=!1;try{let e=new URL(n,window.location.href),t=new URL(tC(tj),window.location.href),r=e.pathname.replace(/\/{2,}/g,"/"),i=t.pathname.replace(/\/{2,}/g,"/");o=e.origin===t.origin&&(r===i||r.startsWith(`${i}/`))}catch{}if(o){let e=!1;for(let[n,o]of Object.entries(t.headers))"disable-www-authenticate"===n.toLowerCase()&&(void 0===o?delete t.headers[n]:e=!0);e||(t.headers["Disable-WWW-Authenticate"]="true")}if(e.startsWith(tN)){let e=new URL(n,window.location.toString());e.searchParams.has("_summary")||(e.searchParams.set("_summary","data"),n=e.toString())}let r=Error();return window.fetch(n,t).then(async e=>{let{redirectAuthFailure:o,followRedirects:i}=await eM("@openmrs/esm-api");if(e.ok){let t=e.headers.get("location");return(i&&t&&(n===tC(tE)||204===e.status)&&tg({to:t}),204===e.status)?(e.data=null,e):e.clone().text().then(t=>{try{t&&(e.data=JSON.parse(t))}catch(e){}return e})}return(n===tC(tE)&&403===e.status||o.enabled&&o.errors.includes(e.status))&&(tb(),tg({to:o.url||e.headers.get("location")||tx}),!0!==t.rejectAuthFailure)?o.resolvePromise?Promise.resolve():new Promise(()=>{}):e.clone().text().then(t=>{let o=t;try{o=JSON.parse(t)}catch(e){}throw new tI(n,e,o,r)},()=>{throw new tI(n,e,null,r)})})}class tI extends Error{constructor(e,t,n,o){super(),tk(this,"response",void 0),tk(this,"responseBody",void 0),this.message=`Server responded with ${t.status} (${t.statusText}) for url ${e}. Check err.responseBody or network tab in dev tools for more info`,o.message=this.message,this.responseBody=n,this.response=t,this.stack=`Stacktrace for outgoing request:
|
|
12
|
+
${t}`)}return o}let eX=(e,t)=>{let n=structuredClone(t);if(!e)return n;for(let t of Object.keys(e)){let o=n[t],r=e[t];if(r&&(r.hasOwnProperty("_type")||r.hasOwnProperty("_default"))){n.hasOwnProperty(t)||(n[t]=r._default);let e=r._elements;if(o&&eY(e)){if(r._type===G.Array&&Array.isArray(o)){let r=o.map(t=>eX(e,t));n[t]=r}else if(r._type===G.Object)for(let t of Object.keys(o))o[t]=eX(e,o[t])}}else if(eZ(r)){let e=o??{};eZ(e)&&(n[t]=eX(r,e))}}return n};function eY(e){return!!e&&Object.keys(e).filter(e=>!["_default","_validators"].includes(e)).length>0}function eZ(e){return"object"==typeof e&&!Array.isArray(e)&&null!==e}function eQ(e,t){let n=`${e}:::${t}`;ex.has(n)||(console.error(t),ex.add(n))}function e0(e){e?ex.forEach(t=>{t.startsWith(e)&&ex.delete(t)}):ex.clear()}function e1(){eb.forEach(e=>e()),eb.length=0,eC.clear(),eD.clear(),eB.clear(),eU.clear(),eS=null,ej=new WeakMap,ek()}let e2={"Translation overrides":{_description:"Per-language overrides for frontend translations should be keyed by language code and each language dictionary contains the translation key and the display value",_type:G.Object,_default:{},_validators:[z(e=>Object.keys(e).every(e=>/^[a-z]{2,3}(-[A-Z]{2,3})?$/.test(e)),e=>{let t=Object.keys(e).filter(e=>!/^[a-z]{2,3}(-[A-Z]{2,3})?$/.test(e));return`The 'Translation overrides' object should have language codes for keys. Language codes must be in the form of a two-to-three letter language code optionally followed by a hyphen and a two-to-three letter country code. The following keys do not conform: ${t.join(", ")}.`})]}},e5={"Display conditions":{privileges:{_description:"The privilege(s) the user must have to use this extension",_type:G.Array,_default:[]},expression:{_description:"The expression that determines whether the extension is displayed",_type:G.String,_default:void 0}},...e2},e6=(e,t)=>z(n=>e<=n&&n<=t,`must be between ${e} and ${t}`),e8=e=>{let t=e.concat(["openmrsBase","openmrsSpaBase"]);return z(e=>{if(!e||"string"!=typeof e)return!1;let n=/\${(.*?)}/g,o=n.exec(e);for(;o;){if(!t.includes(o[1]))return!1;o=n.exec(e)}return!0},"Should be a URL or path. The allowed template parameters are "+t.map(e=>"${"+e+"}").join(", "))},e3=e8([]),e4=e=>z(t=>e.includes(t),`Must be one of the following: '${e.join("', '")}'.`),e9={inRange:e6,isUrl:e3,isUrlWithTemplateParameters:e8,oneOf:e4};var e7=n(4913);let te=R("breadcrumbs",[]);function tt(e){return tn([e])}function tn(e){let t=[...to(),...e.map(e=>({matcher:e.matcher instanceof RegExp?e.matcher:"string"==typeof e.matcher?(0,e7.pathToRegexp)(e.matcher).regexp:(0,e7.pathToRegexp)(e.path).regexp,settings:e}))];te.setState(t,!0)}function to(){return te.getState()}function tr(e,t){if(t)return function(e,t){let[n]=e.filter(e=>e.matcher.test(t));return n}(e,t)||function(e,t){let n=t.split("/");for(;n.length>1;){n.pop();let t=tr(e,n.join("/"));if(t)return t}}(e,t)}function ti(e,t){if(e.length>0){let n=tr(e,t);if(n){let t=[n],o=tr(e,n.settings.parent);for(;void 0!==o;)t.push(o),o=tr(e,o.settings.parent);return t.reverse()}}return[]}function ts(e){return ti(to(),e)}var ta=n(2267);let tl={address1:"Address line 1",address2:"Address line 2",address3:"Address line 3",address4:"Address line 4",address5:"Address line 5",address6:"Address line 6",city:"City",cityVillage:"City",country:"Country",countyDistrict:"District",district:"District",postalCode:"Postal code",state:"State",stateProvince:"State",closeAllOpenedWorkspaces:"Discard changes in {{count}} workspaces",closingAllWorkspacesPromptBody:"There may be unsaved changes in the following workspaces. Do you want to discard changes in the following workspaces? {{workspaceNames}}",closingAllWorkspacesPromptTitle:"You have unsaved changes",discard:"Discard",hide:"Hide",maximize:"Maximize",minimize:"Minimize",openAnyway:"Open anyway",unsavedChangesInOpenedWorkspace:"You may have unsaved changes in the opened workspace. Do you want to discard these changes?",unsavedChangesInWorkspace:'There may be unsaved changes in "{{workspaceName}}". Please save them before opening another workspace.',unsavedChangesTitleText:"Unsaved changes",workspaceHeader:"Workspace header",discardUnsavedChangesPromptBodyMultiple:"{{count}} workspaces have unsaved changes. Closing them will discard the changes:",discardUnsavedChangesPromptBodySingle:"<strong>{{workspaceTitle}}</strong> has unsaved changes. Closing it will discard them.",discardUnsavedChangesPromptTitle:"Discard unsaved changes?",keepEditing:"Keep editing",abnormalValue:"Abnormal value",actions:"Actions",actionableNotification:"Actionable notification",address:"Address",age:"Age",applicationError:"Application Error",batchActionItemSelected:"{{totalSelected}} item selected",batchActionsItemsSelected:"{{totalSelected}} items selected",cancel:"Cancel",change:"Change",Clinic:"Clinic",clearDevOverrides:"Clear dev overrides",close:"Close",closesActionableNotification:"Close actionable notification",closeSnackbar:"Close snackbar",confirm:"Confirm",contactAdministratorIfIssuePersists:"Contact your system administrator if the problem persists.",contactDetails:"Contact details",copied:"Copied!",copyToClipboard:"Copy to clipboard",delete:"Delete",discardChanges:"Discard changes",edit:"Edit",emptyStateText:"There are no {{displayText}} to display",error:"Error",errorCopy:"Sorry, there was a problem displaying this information. You can try to reload this page, or contact the site administrator and quote the error code above.",errorLoadingLoginLocations:"Unable to load login locations. Please try again or contact support if the problem persists.",female:"Female",leftNavigation:"Left navigation",loading:"Loading",localVersion:"Local Build",male:"Male",navigateNonHttp:"Could not navigate to the requested page as it is not a safe URL",noResultsToDisplay:"No results to display",notAvailable:"Not available",other:"Other",paginationItemsCount:"{{pageItemsCount}} / {{totalItems}} items",paginationOfPages:"of {{count}} pages",patientAvatarAlt:"Avatar for {{patientName}}",patientIdentifierSticker:"Patient identifier sticker",patientLists:"Patient lists",patientPhotoAlt:"Profile photo of {{patientName}}",patientPhotoPlaceholder:"Photo placeholder for {{patientName}}",prereleaseVersion:"Prerelease",print:"Print",printError:"Print error",printErrorExplainer:"An error occurred in {{errorLocation}}",printIdentifierSticker:"Print identifier sticker",printing:"Printing",provisional:"Provisional",recordNewEntry:"Record {{displayText}}",relationships:"Relationships",reload:"Reload",resetOverrides:"Reset overrides",save:"Save",scriptLoadingFailed:"Error: Script failed to load",scriptLoadingError:"Failed to load overridden script from {{url}}. Please check that the bundled script is available at the expected URL. Click the button below to reset all import map overrides.",searchForLocation:"Search for a location",seeAll:"See all",seeMoreLists:"See {{count}} more lists",selectAll:"Select all",serverStartingUp:"The server is starting",serverStartingUpExplainer:"This can take a few minutes. OpenMRS will open automatically when the server is ready.",serverStartingUpSlowExplainer:"This is taking longer than usual. First startup after an upgrade can take 10 minutes or more. You can leave this page open.",sex:"Sex",showLess:"Show less",showMore:"Show more",snackbarNotification:"Snackbar notification",somethingWentWrongTryReloading:"Something went wrong. Please try reloading.",toggleDevTools:"Toggle dev tools",unknown:"Unknown",viewSetupProgress:"View setup progress",waitingForServer:"Waiting for the server",yearAbbreviation:"yr",yearsAbbreviation:"yrs"};var tc=n(2279);let tu=tc.Ay.default||tc.Ay;function td(e,t,n,o){return tu.t(t,{ns:e,defaultValue:n,...o})}function tm(e,t,n){return tl[e]?td("core",e,t??tl[e],n):(console.error(`O3 Core Translations does not provide key '${e}'. The key itself is being rendered as text.`),e)}function tf(e,t){let n=window.getOpenmrsSpaBase().replace(/\/$/,""),o=tp(e,{openmrsBase:window.openmrsBase,openmrsSpaBase:n,...t});return e.startsWith("//")?o:o.replace(/^\/\//,"/")}function tp(e,t){return Object.keys(t).reduce((e,n)=>e.split("${"+n+"}").join(t[n]),e)}function tg({to:e,templateParams:t}){let n=window.getOpenmrsSpaBase().replace(/\/$/,""),o=tf(e,t).replace(window.location.origin,""),r=new URL(o,window.location.origin);if("http:"!=r.protocol&&"https:"!=r.protocol)throw console.error(`Received request to navigate to non-http URL: ${r.toString()}`),Error(tm("navigateNonHttp"));o.startsWith(n)?(0,ta.EH)(o):window.location.assign(o)}tu.on("initialized",function(){window.i18next.loadNamespaces(["core"])});let th="openmrs:history";function tw(e){let t=JSON.parse(sessionStorage.getItem(th)??"[]")||[];t.push(e),t.length>50&&(t=t.slice(-50)),sessionStorage.setItem(th,JSON.stringify(t))}function t_(){0===JSON.parse(sessionStorage.getItem(th)??"[]").length&&document.referrer&&tw(document.referrer),window.addEventListener("single-spa:routing-event",e=>{let t=tv();e.detail.originalEvent?.singleSpaTrigger=="replaceState"?(t[t.length-1]=window.location.href,sessionStorage.setItem(th,JSON.stringify(t))):!e.detail.originalEvent?.singleSpa&&t.includes(window.location.href)?ty({toUrl:window.location.href}):t[t.length-1]!==window.location.href&&tw(window.location.href)})}function tv(){return JSON.parse(sessionStorage.getItem(th)??"[]")}function ty({toUrl:e}){let t=tv(),n=t.lastIndexOf(e);if(-1!=n){let e=t.slice(0,n+1);tg({to:t[n]}),sessionStorage.setItem(th,JSON.stringify(e))}else throw Error(`URL ${e} not found in history; cannot go back to it.`)}function tb(){sessionStorage.removeItem(th)}let tx="${openmrsSpaBase}/login",tS={redirectAuthFailure:{enabled:{_type:G.Boolean,_default:!0,_description:"Whether to redirect logged-out users to `redirectAuthFailure.url`"},url:{_type:G.String,_default:tx,_validators:[e9.isUrl],_description:"The url to which users will be redirected when they are logged out. If set to blank, the `location` header from the response will be used."},errors:{_type:G.Array,_default:[401],_elements:{_type:G.Number,_validators:[e9.inRange(100,600)]},_description:"The HTTP error codes for which users will be redirected"},resolvePromise:{_type:G.Boolean,_default:!1,_description:"Changes how requests that fail authentication are handled. Try messing with this if redirects to the login page aren't working correctly."}},followRedirects:{_type:G.Boolean,_default:!0,_description:"Whether openmrsFetch should support redirects returned from the backend"}};function tj(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}let tk="/ws/rest/v1",tN="/ws/fhir2/R4",tC=`${tk}/session`;function tE(e){return e&&e.startsWith("http")?e:("/"!==e[0]&&(e="/"+e),window.openmrsBase+e)}function tP(e,t={}){if("string"!=typeof e)throw Error("The first argument to @openmrs/api's openmrsFetch function must be a url string");if("object"!=typeof t)throw Error("The second argument to @openmrs/api's openmrsFetch function must be a plain object.");if(!window.openmrsBase)throw Error("@openmrs/api is running in a browser that doesn't have window.openmrsBase, which is provided by openmrs-module-spa's HTML file.");let n=tE(e);t.headers||(t.headers={}),(0,U.A)(t.body)&&(t.body=JSON.stringify(t.body)),void 0===t.headers.Accept&&(t.headers.Accept="application/json"),null===t.headers.Accept&&delete t.headers.Accept;let o=!1;try{let e=new URL(n,window.location.href),t=new URL(tE(tk),window.location.href),r=e.pathname.replace(/\/{2,}/g,"/"),i=t.pathname.replace(/\/{2,}/g,"/");o=e.origin===t.origin&&(r===i||r.startsWith(`${i}/`))}catch{}if(o){let e=!1;for(let[n,o]of Object.entries(t.headers))"disable-www-authenticate"===n.toLowerCase()&&(void 0===o?delete t.headers[n]:e=!0);e||(t.headers["Disable-WWW-Authenticate"]="true")}if(e.startsWith(tN)){let e=new URL(n,window.location.toString());e.searchParams.has("_summary")||(e.searchParams.set("_summary","data"),n=e.toString())}let r=Error();return window.fetch(n,t).then(async e=>{let{redirectAuthFailure:o,followRedirects:i}=await eM("@openmrs/esm-api");if(e.ok){let t=e.headers.get("location");return(i&&t&&(n===tE(tC)||204===e.status)&&tg({to:t}),204===e.status)?(e.data=null,e):e.clone().text().then(t=>{try{t&&(e.data=JSON.parse(t))}catch(e){}return e})}return(n===tE(tC)&&403===e.status||o.enabled&&o.errors.includes(e.status))&&(tb(),tg({to:o.url||e.headers.get("location")||tx}),!0!==t.rejectAuthFailure)?o.resolvePromise?Promise.resolve():new Promise(()=>{}):e.clone().text().then(t=>{let o=t;try{o=JSON.parse(t)}catch(e){}throw new tI(n,e,o,r)},()=>{throw new tI(n,e,null,r)})})}class tI extends Error{constructor(e,t,n,o){super(),tj(this,"response",void 0),tj(this,"responseBody",void 0),this.message=`Server responded with ${t.status} (${t.statusText}) for url ${e}. Check err.responseBody or network tab in dev tools for more info`,o.message=this.message,this.responseBody=n,this.response=t,this.stack=`Stacktrace for outgoing request:
|
|
13
13
|
${o.stack}
|
|
14
14
|
Stacktrace for incoming response:
|
|
15
|
-
${this.stack}`}}let tA=R("session",{loaded:!1,session:null}),tO=0,tR=null;function t$(){return tR||(tA.getState().loaded&&tO>=Date.now()-6e4?null:tW())}function tT(e){let t=e?.includeAuthStatus??!0,n=e=>t?e:e.user,o=t$();return o?new Promise(e=>{let t=()=>{let t=tA.getState();t.loaded&&(r(),e(n(t.session)))},r=tA.subscribe(t);o.then(t,t)}):Promise.resolve(n(tA.getState().session))}function tM(){return t$(),tA}function tL(e){let t=e.locale??e.user?.userProperties?.defaultLocale;t&&t.includes("_")&&(t=t.replaceAll("_","-")),function(e){if(void 0===e||"string"!=typeof e)return!1;try{new Intl.Locale(e)}catch(e){return!1}return!0}(t)&&t!==document.documentElement.getAttribute("lang")&&document.documentElement.setAttribute("lang",t)}function tW(e,t){tO=Date.now(),r??(r=tO);let n={};e&&t&&(n.Authorization=`Basic ${window.btoa(`${e}:${t}`)}`);let o=tJ(tP(tE,{headers:n,rejectAuthFailure:!0})),i=()=>{tR===o&&(tR=null)};return o.then(i,i),tR=o,o}function tD(){tA.setState({loaded:!0,session:{authenticated:!1,sessionId:""}},!0)}function tU(e,t){var n,o;if(void 0===t)return!e;if(!e)return!0;return n=e,o=t,("string"==typeof n?!(0,D.A)(o.privileges.find(e=>n===e.display)):Array.isArray(n)?n.every(e=>!(0,D.A)(o.privileges.find(t=>e===t.display))):((0,D.A)(n)||console.error(`Could not understand privileges "${n}"`),!0))||!(0,D.A)(t.roles.find(e=>"System Developer"===e.display))}function tB(){let e,t;return new Promise(n=>{let o=o=>{o.loaded&&o.session.user&&(e=o.session.user,n(o.session.user),t&&t())};o(tA.getState()),e||(t=tA.subscribe(o))})}async function tF(){return(await tT()).sessionLocation}async function tH(e,t){return tJ(tP(tE,{method:"POST",body:{sessionLocation:e},headers:{"Content-Type":"application/json"},rejectAuthFailure:!0,signal:t?.signal}))}async function tV(e,t){return await tP(tE,{method:"POST",body:{locale:e},headers:{"Content-Type":"application/json"},signal:t?.signal}),tW()}async function tG(e,t,n){return n||(n=new AbortController),await tP(`${tj}/user/${e}`,{method:"POST",body:{userProperties:t},headers:{"Content-Type":"application/json"},signal:n.signal}),tW()}async function tz(e,t=!1){let n=await tP(t?`${tE}?rememberMe=true`:tE,{headers:{"X-Totp-Code":e}});return n.data?.authenticated?(await tW()).session:n.data}async function tq(){try{await tP(tE,{method:"DELETE",rejectAuthFailure:!0})}catch(e){if(!tK(e))throw e}tD(),await tW().catch(()=>{})}function tJ(e){return new Promise((t,n)=>{e.then(e=>{if("object"==typeof e?.data){let n={loaded:!0,session:e.data};tA.setState(n,!0),t(n)}else!function(e){if(!e?.redirected||!e.url)return!1;try{return new URL(e.url,window.location.href).pathname.replace(/\/+$/,"").endsWith("/initialsetup")}catch{return!1}}(e)?n(tX(Error("The session endpoint did not respond with a session"))):n(tX(Error("The server is still starting up"),!0))}).catch(e=>{var o,i;if(tK(e)){"object"==typeof(o=e.responseBody)&&null!==o&&!1===o.authenticated?tA.setState({loaded:!0,session:e.responseBody},!0):tD(),t(tA.getState());return}(i=e)instanceof tI&&502===i.response.status&&!tA.getState().loaded&&void 0!==r&&Date.now()-r<18e4?n(tX(e,!0)):(v(`Failed to fetch new session information: ${e}`),n(tX(e)))})})}function tK(e){return e instanceof tI&&(401===e.response.status||403===e.response.status)}function tX(e,t=!1){return tA.getState().loaded||tA.setState({loaded:!1,session:null,error:e instanceof Error?e:Error(String(e)),initializing:t},!0),tA.getState()}function tY(){return"development"===window.spaEnv||"true"===localStorage.getItem("openmrs:devtools")}tA.subscribe(e=>{e.loaded&&e.session&&tL(e.session)});let tZ={"webservices.rest":"2.24.0",fhir2:"1.0.0-SNAPSHOT"};function tQ(){eP("@openmrs/esm-api",tS),tW()}let t0="import-map-override:",t1="import-map-overrides-disabled",t2="import-map-overrides:change",t5=!1,t6=null,t8=null;async function t3(){return t8??(t8=t4().then(({map:e,complete:t})=>(t||(t8=null),e))),t8}async function t4(){let e=document.querySelectorAll('script[type="systemjs-importmap"]'),t=[],n=!0;for(let o=0;o<e.length;o++){let r=e[o];try{if(r.src){let e=await fetch(r.src);if(!e.ok)throw Error(`Request for ${r.src} returned ${e.status} ${e.statusText}`);t.push(await e.json())}else r.textContent&&t.push(JSON.parse(r.textContent))}catch(e){n=!1,console.warn(`[import-maps] Failed to parse import map from script tag at index ${o}`,e)}}return{map:t7(t),complete:n}}function t7(e){let t={imports:{}};for(let n of e)n?.imports&&Object.assign(t.imports,n.imports);return t}function t9(){let e={};try{let t=nr();for(let n=0;n<localStorage.length;n++){let o=localStorage.key(n);if(o?.startsWith(t0)){let n=o.slice(t0.length);if(!t.includes(n)){let t=localStorage.getItem(o);t&&(e[n]=t)}}}}catch(e){console.warn("[import-maps] Failed to read import-map overrides from localStorage",e)}return{imports:e}}async function ne(){let e=await t3();return t5?t7([e,t6??t9()]):e}async function nt(){return t3()}async function nn(){return t5?t7([await t3(),t9()]):t3()}function no(e){if(!t5)return{imports:{}};if(e){let e={};for(let t=0;t<localStorage.length;t++){let n=localStorage.key(t);if(n?.startsWith(t0)){let t=localStorage.getItem(n);t&&(e[n.slice(t0.length)]=t)}}return{imports:e}}return t9()}function nr(){if(!t5)return[];try{let e=localStorage.getItem(t1);if(e){let t=JSON.parse(e);if(Array.isArray(t))return t}}catch{}return[]}function ni(e){return!!t5&&nr().includes(e)}function ns(e,t){if(!t5)return void console.warn("[Security] Import map overrides are disabled in production mode.");try{localStorage.setItem(t0+e,t),window.dispatchEvent(new CustomEvent(t2))}catch(e){console.warn("[import-maps] Failed to write import-map override to localStorage",e)}}function na(e){if(!t5)return void console.warn("[Security] Import map overrides are disabled in production mode.");try{localStorage.removeItem(t0+e);let t=nr().filter(t=>t!==e);t.length>0?localStorage.setItem(t1,JSON.stringify(t)):localStorage.removeItem(t1),window.dispatchEvent(new CustomEvent(t2))}catch(e){console.warn("[import-maps] Failed to update import-map overrides in localStorage",e)}}function nl(){if(!t5)return void console.warn("[Security] Import map overrides are disabled in production mode.");try{let e=[];for(let t=0;t<localStorage.length;t++){let n=localStorage.key(t);n?.startsWith(t0)&&e.push(n)}e.forEach(e=>localStorage.removeItem(e)),localStorage.removeItem(t1),window.dispatchEvent(new CustomEvent(t2))}catch(e){console.warn("[import-maps] Failed to clear import-map overrides from localStorage",e)}}function nc(e){if(!t5)return void console.warn("[Security] Import map overrides are disabled in production mode.");try{let t=nr().filter(t=>t!==e);t.length>0?localStorage.setItem(t1,JSON.stringify(t)):localStorage.removeItem(t1),window.dispatchEvent(new CustomEvent(t2))}catch(e){console.warn("[import-maps] Failed to update import-map overrides in localStorage",e)}}let nu=!1;function nd(){!nu&&(nu=!0,(t5="development"===window.spaEnv)&&(t6=t9()))}function nm(e){return e.replace(/[\/\-@]/g,"_")}async function nf(e,t="./start",o){var r;let i,s=!o?.maxLoadingTime||o.maxLoadingTime<=0?6e5:o.maxLoadingTime;await Promise.race([np(e,o?.importMap),new Promise((t,n)=>{i=setTimeout(()=>{var t;n(Error(`Could not resolve requested script, ${e}, within ${(t=s)<1e3?`${t} milliseconds`:t<6e4?`${Math.floor(t/1e3)} seconds`:t<36e5?`${Math.floor(t/6e4)} minutes`:t<864e5?`${Math.floor(t/36e5)} hours`:`${Math.floor(t/864e5)} days`}.`))},s)})]),i&&clearTimeout(i);let a=nm(e),l=window[a];if(!("object"==typeof(r=l)&&null!==r&&"init"in r&&"function"==typeof r.init&&"get"in r&&"function"==typeof r.get)){let e=`The global variable ${a} does not refer to a federated module`;throw console.error(e),Error(e)}l.init(n.S.default);let c=(await l.get(t))();if("object"!=typeof c||null===c){let t=`Container for ${e} did not return an ESM module as expected`;throw console.error(t),Error(t)}return c}async function np(e,t){if("string"!=typeof e||0===e.trim().length){let e="Attempted to call importDynamic() without supplying a package to load";throw console.error(e),Error(e)}let n=nm(e);if(!window[n]){let n=t??await ng();if(!n.imports.hasOwnProperty(e)){let t=`Could not find the package ${e} defined in the current importmap`;throw console.error(t),Error(t)}let o=n.imports[e];o.startsWith("./")&&(o=window.spaBase+o.substring(1));let r=e in no().imports;try{return await function(e){var t;let n=(t=window)[nh]??(t[nh]=new Map),o=n.get(e);if(o)return o;if(document.head.querySelector(`script[src="${e}"]`))return console.warn(`Script at ${e} already loaded. Not loading it again.`),Promise.resolve();let r=document.createElement("script");r.src=e,r.type="text/javascript",r.async=!0;let i=new Promise((t,o)=>{let i=setTimeout(()=>{console.error(`The script at ${e} did not load within 5 seconds. This may indicate an issue with the imports in the script's entry-point file or with the script's bundler configuration.`)},5e3);function s(){clearTimeout(i),r.removeEventListener("load",a),r.removeEventListener("error",l)}function a(){s(),t()}function l(t){s(),n.delete(e),r.remove();let i=`Failed to load script from ${e}`;console.error(i,t),o(t.message??i)}r.addEventListener("load",a),r.addEventListener("error",l),document.head.appendChild(r)});return n.set(e,i),i}(o)}catch(e){return r&&f({kind:"error",title:tm("scriptLoadingFailed","Error: Script failed to load"),description:tm("scriptLoadingError","Failed to load overridden script from {{- url}}. Please check that the bundled script is available at the expected URL. Click the button below to reset all import map overrides.",{url:o}),actionButtonLabel:tm("resetOverrides","Reset overrides"),onActionButtonClick(){nl(),window.location.reload()}}),Promise.reject(e)}}return Promise.resolve()}async function ng(){return ne()}let nh=Symbol.for("__openmrs_script_loading");function nw(e){return!!e&&"object"==typeof e&&!(Object.hasOwn(e,"pages")&&(!e.pages||!Array.isArray(e.pages))||Object.hasOwn(e,"extensions")&&(!e.extensions||!Array.isArray(e.extensions))||Object.hasOwn(e,"modals")&&(!e.modals||!Array.isArray(e.modals))||Object.hasOwn(e,"workspaces2")&&(!e.workspaces2||!Array.isArray(e.workspaces2))||Object.hasOwn(e,"workspaceWindows2")&&(!e.workspaceWindows2||!Array.isArray(e.workspaceWindows2))||Object.hasOwn(e,"workspaceGroups2")&&(!e.workspaceGroups2||!Array.isArray(e.workspaceGroups2)))}function n_(e){return!!e&&"object"==typeof e&&"routes"in e&&!!e.routes&&"object"==typeof e.routes&&Object.entries(e.routes).every(([e,t])=>"string"==typeof e&&nw(t))}let nv="openmrs-routes:",ny="openmrs-routes:change",nb=!1,nx=null,nS=null;async function nk(){return nS??(nS=nj().then(({map:e,complete:t})=>(t||(nS=null),e))),nS}async function nj(){let e=document.querySelectorAll("script[type='openmrs-routes']"),t=[],n=!0;for(let o=0;o<e.length;o++){let r=e[o];try{let e;if(r.src){let t=await fetch(r.src);if(!t.ok)throw Error(`Request for ${r.src} returned ${t.status} ${t.statusText}`);e=await t.json()}else r.textContent&&(e=JSON.parse(r.textContent));e&&n_(e)&&t.push(e)}catch(e){n=!1,console.warn(`[route-maps] Failed to parse routes from script tag at index ${o}`,e)}}return{map:nN(t),complete:n}}function nN(e){let t={routes:{}};for(let n of e)n&&"object"==typeof n&&!Array.isArray(n)&&(Object.assign(t.routes,n.routes),void 0===t.version&&void 0!==n.version&&(t.version=n.version));return t}async function nE(){let e={version:void 0,routes:{}};try{let t=[];for(let e=0;e<localStorage.length;e++){let n=localStorage.key(e);if(n?.startsWith(nv)){let e=localStorage.getItem(n);e&&t.push({moduleName:n.slice(nv.length),raw:e})}}for(let n of(await Promise.allSettled(t.map(async({moduleName:e,raw:t})=>{let n=JSON.parse(t);if(nw(n))return{moduleName:e,routes:n};if("string"==typeof n&&n.startsWith("http")){let t=await fetch(n),o=await t.json();if(nw(o))return{moduleName:e,routes:o};throw Error(`${n} did not resolve to a valid OpenmrsAppRoutes object`)}throw Error(`Override for ${e} is neither a valid routes object nor a URL`)}))))"fulfilled"===n.status?e.routes[n.value.moduleName]=n.value.routes:console.warn("[route-maps] Failed to load route override",n.reason)}catch(e){console.warn("[route-maps] Failed to read route overrides from localStorage",e)}return e}async function nC(){let e=await nk();return nb?nN([e,nx??await nE()]):e}async function nP(){return nk()}async function nI(){return nb?nN([await nk(),await nE()]):nk()}function nA(){if(!nb)return{};let e={};try{for(let t=0;t<localStorage.length;t++){let n=localStorage.key(t);if(n?.startsWith(nv)){let t=localStorage.getItem(n);t&&(e[n.slice(nv.length)]=t)}}}catch(e){console.warn("[route-maps] Failed to read route overrides from localStorage",e)}return e}function nO(e,t){if(!nb)return void console.warn("[Security] Route overrides are disabled outside development mode.");try{if("string"==typeof t)if(t.startsWith("http"))localStorage.setItem(nv+e,JSON.stringify(t));else{let n=JSON.parse(t);if(!nw(n))return void console.error(`The supplied routes for ${e} is not a valid OpenmrsAppRoutes object`,t);localStorage.setItem(nv+e,JSON.stringify(n))}else if(t instanceof URL)localStorage.setItem(nv+e,JSON.stringify(t.toString()));else{if(!nw(t))return void console.error(`Override for ${e} is not in a valid format. Expected either a Javascript Object, a JSON string of a Javascript object, or a URL`,t);localStorage.setItem(nv+e,JSON.stringify(t))}window.dispatchEvent(new CustomEvent(ny))}catch(e){console.warn("[route-maps] Failed to write route override to localStorage",e)}}function nR(e){if(!nb)return void console.warn("[Security] Route overrides are disabled outside development mode.");try{localStorage.removeItem(nv+e),window.dispatchEvent(new CustomEvent(ny))}catch(e){console.warn("[route-maps] Failed to remove route override from localStorage",e)}}function n$(){if(!nb)return void console.warn("[Security] Route overrides are disabled outside development mode.");try{let e=[];for(let t=0;t<localStorage.length;t++){let n=localStorage.key(t);n?.startsWith(nv)&&e.push(n)}e.forEach(e=>localStorage.removeItem(e)),window.dispatchEvent(new CustomEvent(ny))}catch(e){console.warn("[route-maps] Failed to clear route overrides from localStorage",e)}}let nT=null;function nM(){return nT||(nT=(nb="development"===window.spaEnv)?nE().then(e=>{nx=e}):Promise.resolve())}let nL=`${tj}/attachment`;function nW(e,t){return tP(`${nL}/${e}`,{signal:t.signal})}function nD(e,t,n,o){return tP(nU(e,t,o),{signal:n.signal})}function nU(e,t,n){return n?`${nL}?patient=${e}&encounter=${n}`:`${nL}?patient=${e}&includeEncounterless=${t}`}async function nB(e,t,n){let o=new FormData;return o.append("fileCaption",t.fileDescription),o.append("patient",e),n&&o.append("encounter",n),t.file?o.append("file",t.file,t.fileName):(o.append("file",new File([""],t.fileName),t.fileName),o.append("base64Content",t.base64Content)),tP(`${nL}`,{method:"POST",body:o})}function nF(e,t){return tP(`${nL}/${e}`,{method:"DELETE",signal:t.signal})}async function nH(e,t){return e?(await tP(`${tN}/Patient/${e}`,t)).data:null}function nV(e,t){let n=new CustomEvent(`openmrs:${e}`,{detail:t??void 0,cancelable:!0,bubbles:!0});return window.dispatchEvent(n)}function nG(e,t){let n=e=>{t("detail"in e&&null!==e.detail?e.detail:void 0)};return window.addEventListener(`openmrs:${e}`,n),()=>{window.removeEventListener(`openmrs:${e}`,n)}}function nz(e){return{uuid:e.uuid,display:e.display}}function nq(e=null,t=null){let n=new URLSearchParams;e&&n.set("tag",e),t&&n.set("q",t);let o=n.toString();return tP(`${tj}/location${o?"?"+o:""}`).then(e=>e.data.results.map(nz))}function nJ(e){return{uuid:e.uuid,display:e.display,name:e.name}}let nK=`${tj}/visittype`;function nX(e=nK){return tP(e).then(e=>e.data.results.map(nJ))}var nY=((k={}).NEWVISIT="startVisit",k.EDITVISIT="editVisit",k.LOADING="loadingVisit",k),nZ=((j={}).NOTSTARTED="notStarted",j.ONGOING="ongoing",j);let nQ="custom:(uuid,display,voided,indication,startDatetime,stopDatetime,encounters:(uuid,display,encounterDatetime,form:(uuid,name),location:ref,encounterType:ref,encounterProviders:(uuid,display,provider:(uuid,display))),patient:(uuid,display),visitType:(uuid,name,display),attributes:(uuid,display,attributeType:(name,datatypeClassname,uuid),value),location:(uuid,name,display))",n0=function(){try{return JSON.parse(sessionStorage.getItem("openmrs:visitStoreState")||"null")}catch(e){return null}}()||{patientUuid:null,manuallySetVisitUuid:null};function n1(){return M("visit",n0)}function n2(e,t){n1().setState({patientUuid:e,manuallySetVisitUuid:t})}function n5(e,t){return tP(`${tj}/visit`,{signal:t.signal,method:"POST",headers:{"Content-type":"application/json"},body:e})}function n6(e,t,n){return tP(`${tj}/visit/${e}`,{signal:n.signal,method:"POST",headers:{"Content-type":"application/json"},body:t})}function n8(e,t,n){return tP(`${tj}/visit?patient=${e}&v=${n??nQ}`,{signal:t.signal,method:"GET",headers:{"Content-type":"application/json"}})}n1().subscribe(e=>{var t;t=e,sessionStorage.setItem("openmrs:visitStoreState",JSON.stringify(t))});var n3=n(9225),n4=n(6881),n7=n(6828),n9=n(1956),oe=n(3635),ot=n(7839),on=n(2298);let oo={Array,Boolean,Symbol,Infinity,NaN,Math,Number,BigInt,String,RegExp,JSON,isFinite,isNaN,parseFloat,parseInt,decodeURI,encodeURI,encodeURIComponent,Object:{__proto__:void 0,assign:Object.assign.bind(null),fromEntries:Object.fromEntries.bind(null),hasOwn:Object.hasOwn.bind(null),keys:Object.keys.bind(null),is:Object.is.bind(null),values:Object.values.bind(null)}},or={...oo,Promise};function oi(e,t={}){return od(e,t,op)}async function os(e,t={}){return om(e,t,op)}function oa(e,t={}){return od(e,t,og)}function ol(e,t={}){return om(e,t,og)}function oc(e,t={}){return od(e,t,oh)}function ou(e,t={}){return om(e,t,oh)}function od(e,t={},n){if("string"!=typeof e&&("object"!=typeof e||!e||!("type"in e)))throw`Unknown expression type ${e}. Expressions must either be a string or pre-compiled string.`;if("string"==typeof e&&0===e.trim().length)throw{type:"Empty expression",message:"Expression cannot be an empty string"};null==t&&(t={});let o=ob(t,oo),r=ow("string"==typeof e?(0,n3.A)(e):e,o);if(n(r))return r;throw{type:"Invalid result",message:"string"==typeof e?`The expression ${e} did not produce a valid result`:"The expression did not produce a valid result"}}async function om(e,t={},n){if("string"!=typeof e&&("object"!=typeof e||!e||!("type"in e)))return Promise.reject(`Unknown expression type ${e}. Expressions must either be a string or pre-compiled string.`);if("string"==typeof e&&0===e.trim().length)throw{type:"Empty expression",message:"Expression cannot be an empty string"};null==t&&(t={});let o=ob(t,or);return Promise.resolve(ow("string"==typeof e?(0,n3.A)(e):e,o)).then(t=>{if(n(t))return t;throw{type:"Invalid result",message:"string"==typeof e?`The expression ${e} did not produce a valid result`:"The expression did not produce a valid result"}})}function of(e){return(0,n3.A)(e)}function op(e){return"string"==typeof e||"number"==typeof e||"boolean"==typeof e||null==e||e instanceof Date}function og(e){return"boolean"==typeof e}function oh(e){return"number"==typeof e}function ow(e,t){switch(e.type){case"UnaryExpression":var n,o,r,i,s,a,l,c,u,d,m,f,p,g=e,h=t;let w=ow(g.argument,h);switch(g.operator){case"+":return+w;case"-":return-w;case"~":return~w;case"!":return!w;default:throw`Expression evaluator does not support operator '${g.operator}''`}case"BinaryExpression":var _=e,v=t;switch(_.operator){case"&&":return ow(_.left,v)&&ow(_.right,v);case"||":return ow(_.left,v)||ow(_.right,v);case"??":return ow(_.left,v)??ow(_.right,v)}let y=ow(_.left,v),b=ow(_.right,v);switch(_.operator){case"+":return y+b;case"-":return y-b;case"*":return y*b;case"/":return y/b;case"%":return y%b;case"**":return y**b;case"==":return y==b;case"===":return y===b;case"!=":return y!=b;case"!==":return y!==b;case">":return y>b;case">=":return y>=b;case"<":return y<b;case"<=":return y<=b;case"in":return y in b;default:throw`Expression evaluator does not support operator '${_.operator}' operator`}case"ConditionalExpression":return n=e,o=t,ow(n.test,o)?ow(n.consequent,o):ow(n.alternate,o);case"CallExpression":return ok(ov(e,t));case"ArrowFunctionExpression":let x;return r=e,i=t,x=r.params?.map(e=>{if("Identifier"===e.type)return e.name;throw`Cannot handle parameter of type ${e.type}`})??[],(function(...e){if(e.length<x.length)throw`Required argument(s) ${x.slice(e.length,-1).join(", ")} were not provided`;let t=Object.fromEntries(x.reduce((t,n,o)=>{let r=e[o];return function e(t){if("string"==typeof t||"number"==typeof t||"boolean"==typeof t||"function"==typeof t||null===t||t instanceof RegExp)return!0;if("object"==typeof t){for(let n of Object.keys(t))if(!e(t[n]))return!1;return!0}if(Array.isArray(t)){for(let n of t)if(!e(n))break}return!1}(r)&&t.push([n,r]),t},[]));return ow(r.body,i.addVariables(t))}).bind(null);case"MemberExpression":return ok(oy(e,t));case"ArrayExpression":return s=e,a=t,s.elements?.map(oj(a));case"SequenceExpression":let S;return l=e,c=t,(S=l.expressions.map(oj(c)))[S.length-1];case"NewExpression":var k=e,j=t;if(k.callee&&"Identifier"===k.callee.type){let e=k.arguments?.map(oj(j));switch(k.callee.name){case"Date":return new Date(...e);case"RegExp":return new RegExp(...e);default:throw`Cannot instantiate object of type ${k.callee.name}`}}if(k.callee)throw"new must be called with either Date or RegExp";throw'Could not handle "new" without a specified class';case"Literal":return e.value;case"Identifier":return u=e,d=t,(oN(u.name),d.variables&&Object.hasOwn(d.variables,u.name))?d.variables[u.name]:Object.hasOwn(d.globals,u.name)?d.globals[u.name]:void 0;case"TemplateLiteral":let N,E;return m=e,f=t,N=m.expressions?.map(oj(f))??[],(E=m.quasis?.map(oj(f))??[]).filter(e=>!e.tail).map(e=>e.value).join("")+N.join("")+E.filter(e=>e.tail).map(e=>e.value).join("");case"TemplateElement":return{value:(p=e).cooked,tail:p.tail};default:throw`Expression evaluator does not support expression of type '${e.type}'`}}function o_(e,t){switch(e.type){case"Literal":return e.value;case"Identifier":return e.name;case"MemberExpression":return o_(e.property,t);default:throw`VisitExpressionName does not support expression of type '${e.type}'`}}function ov(e,t){let n=oS(e.callee,t);if(n===ox||e.optional&&null==n)return ox;let o=e.arguments?.map(oj(t));if(n){if("function"!=typeof n)throw`${oP(e.callee)} is not a function`}else throw`No function named ${oP(e.callee)} is defined in this context`;return n(...o)}function oy(e,t){let n=oS(e.object,t);if(n===ox||e.optional&&null==n)return ox;if(null===n)throw TypeError(`TypeError: cannot read properties of null (reading '${oC(e.property,t)}')`);if(void 0===n)switch(e.object.type){case"Identifier":{let n=o_(e.object,t);throw ReferenceError(`ReferenceError: ${n} is not defined`)}case"MemberExpression":throw TypeError(`TypeError: cannot read properties of undefined (reading '${oC(e.property,t)}')`);default:throw`VisitMemberExpression does not support operator '${e.object.type}' type`}if("object"!=typeof n&&"function"!=typeof n&&"string"!=typeof n&&"number"!=typeof n)throw`VisitMemberExpression does not support member access on type ${typeof n}`;let o=e.computed?function(e){if(void 0===e)throw{type:"Illegal property access",message:"No property was supplied to the property access"};if("string"!=typeof e&&"number"!=typeof e)throw{type:"Illegal property access",message:`Cannot use a value of type ${null===e?"null":typeof e} as a property name`};return e}(ow(e.property,t)):function(e){if("Identifier"!==e.type)throw`VisitMemberExpression does not support a property of type '${e.type}'`;return e.name}(e.property);oN(o),function(e,t){if(oE.has(String(t)))return;let n=Object(e);for(;null!==n;){if(Object.hasOwn(n,t)){if(n===Object.prototype||n===Function.prototype)throw{type:"Illegal property access",message:`Cannot access the ${t} property of objects`};return}n=Object.getPrototypeOf(n)}}(n,o);let r=n[o];return"function"==typeof r?r.bind(n):r}function ob(e,t){let n={variables:{...e},globals:{...t},addVariables(e){return this.variables={...this.variables,...e},this}};return n.addVariables.bind(n),n}n3.A.plugins.register(n4.A),n3.A.plugins.register(n7.A),n3.A.plugins.register(n9.A),n3.A.plugins.register(oe.A),n3.A.plugins.register(ot.A),n3.A.plugins.register(on.A),n3.A.addBinaryOp("in",7),n3.A.addBinaryOp("??",1);let ox=Symbol("optional chain short-circuited");function oS(e,t){switch(e.type){case"MemberExpression":return oy(e,t);case"CallExpression":return ov(e,t);default:return ow(e,t)}}function ok(e){return e===ox?void 0:e}function oj(e){return function(t){return null===t?null:ow(t,e)}}function oN(e){if("__proto__"===e||"prototype"===e||"constructor"===e)throw{type:"Illegal property access",message:`Cannot access the ${e} property of objects`}}let oE=new Set(["toString","valueOf","hasOwnProperty"]);function oC(e,t){try{return o_(e,t)}catch{return"<computed>"}}function oP(e){return e?"MemberExpression"===e.type?e.property?.name:e.name:null}function oI(e){if("string"!=typeof e&&("object"!=typeof e||!e||!("type"in e)))throw`Unknown expression type ${e}. Expressions must either be a string or pre-compiled string.`;let t={globals:{...or},boundNames:new Set,variables:new Set};return oA("string"==typeof e?(0,n3.A)(e):e,t),[...t.variables]}function oA(e,t){switch(e.type){case"UnaryExpression":return n=e,o=t,void oA(n.argument,o);case"BinaryExpression":return r=e,i=t,void(oA(r.left,i),oA(r.right,i));case"ConditionalExpression":return s=e,a=t,void(oA(s.consequent,a),oA(s.test,a),oA(s.alternate,a));case"CallExpression":return l=e,c=t,void(oA(l.callee,c),l.arguments?.map(oO(c)));case"ArrowFunctionExpression":var n,o,r,i,s,a,l,c,u,d,m,f,p,g,h,w,_,v,y,b,x=e,S=t;let k=new Set(S.boundNames);for(let e of x.params??[])e?.type==="Identifier"&&k.add(e.name);oA(x.body,{...S,boundNames:k});return;case"MemberExpression":return u=e,d=t,void(oA(u.object,d),u.computed&&oA(u.property,d));case"ArrayExpression":return m=e,f=t,void m.elements?.map(oO(f));case"SequenceExpression":return p=e,g=t,void p.expressions?.map(oO(g));case"NewExpression":return h=e,w=t,void h.arguments?.map(oO(w));case"Literal":case"TemplateElement":return;case"Identifier":return _=e,v=t,void(_.name in v.globals||v.boundNames.has(_.name)||v.variables.add(_.name));case"TemplateLiteral":return y=e,b=t,void(y.expressions?.map(oO(b)),y.quasis?.map(oO(b)));default:throw`Expression evaluator does not support expression of type '${e.type}'`}}function oO(e){return function(t){return null===t?null:oA(t,e)}}let oR=M("feature-flags",{flags:function(){let e={};for(let t of Object.keys(localStorage))if(t.startsWith("openmrs:feature-flag:")){let n=t.replace("openmrs:feature-flag:",""),o=JSON.parse(localStorage.getItem(`openmrs:feature-flag-meta:${n}`)||"{}");e[n]={enabled:"true"===localStorage.getItem(t),...o}}return e}()});function o$(e,t,n){oR.setState(o=>({flags:{...o.flags,[e]:{enabled:o.flags[e]?.enabled??!1,label:t,description:n}}}))}function oT(){let e=oR.getState().flags;Object.keys(localStorage).filter(e=>e.startsWith("openmrs:feature-flag:")).forEach(t=>{let n=t.replace("openmrs:feature-flag:","");e[n]||(localStorage.removeItem(t),localStorage.removeItem(`openmrs:feature-flag-meta:${n}`))})}function oM(e){return oR.getState().flags[e].enabled}function oL(e,t){oR.subscribe(n=>{t(n.flags[e].enabled)})}function oW(e,t){oR.setState(n=>({flags:{...n.flags,[e]:{...n.flags[e],enabled:t}}}))}oR.subscribe(e=>{for(let[t,n]of Object.entries(e.flags))localStorage.setItem(`openmrs:feature-flag:${t}`,n.enabled.toString()),localStorage.setItem(`openmrs:feature-flag-meta:${t}`,JSON.stringify({label:n.label,description:n.description}))});var oD=n(1216);let oU=R("extensionsInternal",{slots:{},extensions:{}}),oB=R("extensionRenderings",{renderings:new Map}),oF=()=>M("extensionsInternal",{slots:{},extensions:{}}),oH=()=>M("extensionRenderings",{renderings:new Map});function oV(e){let t=oU.getState(),n=e(t);n!==t&&oU.setState(n)}let oG=null,oz=null;function oq(){let e=oB.getState();return oG&&e===oz||(oG=new Map(e.renderings),oz=e,function(e){for(let t of(o5.clear(),e.values()))o8(t,1);o6=!0}(oG)),oG}function oJ(e){oz={renderings:e},oB.setState(oz,!0)}function oK(e){let t=oq();t.has(e.renderingId)||(t.set(e.renderingId,e),o8(e,1),oJ(t))}function oX(e){let t=oq(),n=t.get(e);n&&(t.delete(e),o8(n,-1),oJ(t))}let oY=()=>M("extensions",{slots:{}}),oZ=0,oQ=new Set;function o0(e){oZ++;try{return e()}finally{if(0==--oZ&&oQ.size>0){let e=Array.from(oQ);for(let t of(oQ.clear(),e))o1(t)}}}function o1(e){try{e()}catch(t){console.error(`The extension system's '${e.name}' recomputation failed`,t)}}function o2(e){oZ>0?oQ.add(e):o1(e)}let o5=new Map,o6=!1;function o8(e,t){let n=JSON.stringify([e.slotName,e.extensionId,e.slotModuleName,e.extensionModuleName]),o=o5.get(n);if(!o){if(t<0)return;o5.set(n,{count:1,record:{slotModuleName:e.slotModuleName,extensionModuleName:e.extensionModuleName,slotName:e.slotName,extensionId:e.extensionId}}),o6=!0;return}o.count+=t,o.count<1&&(o5.delete(n),o6=!0)}function o3(){var e,t;if(oq(),!o6)return;o6=!1;let n=Array.from(o5.values(),({record:e})=>e);n.sort(o4),e=et.getState().mountedExtensions,t=n,e.length===t.length&&e.every((e,n)=>0===o4(e,t[n]))||et.setState({mountedExtensions:n})}function o4(e,t){return o7(e.slotName,t.slotName)||o7(e.extensionId,t.extensionId)||o7(e.slotModuleName,t.slotModuleName)||o7(e.extensionModuleName,t.extensionModuleName)}function o7(e,t){return e===t?0:e<t?-1:1}o3(),oB.subscribe(()=>o2(o3));let o9=oF(),re=oY(),rt=eo(),rn=es(),ro=new Set,rr=!1;function ri(e){if(null===e)ro=null;else if(null!==ro)for(let t of e)ro.add(t);o2(rs)}function rs(){if(!rr){rr=!0;try{for(let e=1;;e++){let t=ro;if(null!==t&&0===t.size)return;ro=new Set;try{!function(e,t,n,o,r,i=null){let s=re.getState().slots,a={},l=!1,c=Object.entries(o.flags).filter(([,{enabled:e}])=>e).map(([e])=>e);for(let[o,u]of Object.entries(e.slots)){let d=s[o];if(d&&i&&!i.has(o)){a[o]=d;continue}let{config:m}=ei(t,u.name),f=function(e,t,n,o,r,i){let s=function(e,t){let n=e.add||[],o=e.remove||[],r=e.order||[],{extensions:i}=o9.getState(),s=new Set(o),a=[...t,...n].filter(e=>!s.has(e)),l=rh(r),c=rh(t),u=new Map(a.map(e=>[e,function(e,t,n,o){let r=t.get(e);if(void 0!==r)return r;{if(void 0!==n)return 1e3+n;let t=o.get(e);return void 0!==t?2e3+t:3e3}}(e,l,i[rc(e)]?.order,c)]));return a.sort((e,t)=>u.get(e)-u.get(t))}(n,t.slots[e].attachedIds),a=[];for(let l of s){let{config:s}=ea(o,e,l),c=el(n,e,l),u=c?(0,oD.A)({},s,c):s,d=rc(l),m=t.extensions[d];if(m){let e=u?.["Display conditions"]?.privileges??m.privileges??[];if(e&&("string"==typeof e||Array.isArray(e)&&e.length>0)&&(!i?.user||!tU(e,i.user))||m.featureFlag&&!r.includes(m.featureFlag))continue;a.push({id:l,name:d,moduleName:m.moduleName,config:u,featureFlag:m.featureFlag,meta:m.meta,displayConditionExpression:u?.["Display conditions"]?.expression||m.displayExpression})}}return a}(o,e,m,n,c,r.session);d&&d.moduleName===u.moduleName&&(0,F.A)(d.candidateExtensions,f)?a[o]=d:(a[o]={moduleName:u.moduleName,candidateExtensions:f},l=!0)}(l||Object.keys(s).length!==Object.keys(a).length)&&re.setState({slots:a})}(o9.getState(),rt.getState(),rn.getState(),oR.getState(),tA.getState(),t)}catch(e){throw ro=null===t||null===ro?null:new Set([...t,...ro]),e}if(e>=20)return void console.error("The extension system stopped recomputing after 20 passes because something keeps invalidating slots in response to the extension store being written. Some slots are left stale until the next write.")}}finally{rr=!1}}}function ra(e,t){let n=new Set;for(let o of Object.keys(e))e[o]!==t[o]&&n.add(o);for(let o of Object.keys(t))o in e||n.add(o);return n}function rl(e,t){return{moduleName:t,name:e,attachedIds:[]}}function rc(e){let[t]=e.split("#");return t}function ru(e,t){let n=rc(t);return e.extensions[n]}function rd(e){return ru(o9.getState(),e)}o9.subscribe((e,t)=>{ri(e.extensions!==t.extensions?null:ra(e.slots,t.slots))}),rt.subscribe((e,t)=>{ri(ra(e.slots,t.slots))}),rn.subscribe((e,t)=>{ri(ra(e.configs,t.configs))}),oR.subscribe(()=>ri(null)),tA.subscribe(()=>ri(null)),ri(null);let rm=e=>oV(t=>({...t,extensions:{...t.extensions,[e.name]:{...e}}}));function rf(e,t){oV(n=>{let o=n.slots[e];return o?{...n,slots:{...n.slots,[e]:{...o,attachedIds:[...o.attachedIds,t]}}}:{...n,slots:{...n.slots,[e]:{...rl(e),attachedIds:[t]}}}})}function rp(e,t){oV(n=>{let o=n.slots[e];return o&&o.attachedIds.includes(t)?{...n,slots:{...n.slots,[e]:{...o,attachedIds:o.attachedIds.filter(e=>e!==t)}}}:n})}function rg(e){oV(t=>{let n=t.slots[e];return n?{...t,slots:{...t.slots,[e]:{...n,attachedIds:[]}}}:t})}function rh(e){let t=new Map;return e.forEach((e,n)=>{t.has(e)||t.set(e,n)}),t}function rw(e,t){return function(e,t,n=null,o){let r;return e.filter(e=>{let i=e.displayConditionExpression;if("string"!=typeof i||0===i.trim().length)return!0;r??(r=t&&"object"==typeof t?{session:n,...t}:{session:n});try{return!!oa(i,r)}catch(t){return console.error(`Error while evaluating expression '${i}' for ${e.id}`+(o?` in ${o}`:""),t),!1}})}(r_(e),t,tA.getState().session,e)}function r_(e){return re.getState().slots[e]?.candidateExtensions??[]}let rv=(e,t)=>o9.setState(n=>{let o=n.slots[t]?.moduleName;if(o&&o!=e)return console.warn(`An extension slot with the name '${t}' already exists. Refusing to register the same slot name twice (in "registerExtensionSlot"). The existing one is from module ${o}.`),n;if(o&&o==e)return n;if(n.slots[t])return{...n,slots:{...n.slots,[t]:{...n.slots[t],moduleName:e}}};let r=rl(t,e);return{...n,slots:{...n.slots,[t]:{...r}}}}),ry=()=>{ro=null,oV(()=>({slots:{},extensions:{}})),oH().setState({renderings:new Map}),re.setState({slots:{}})},rb=R("left-nav",{slotName:null,basePath:window.spaBase,mode:"normal"});function rx({name:e,basePath:t,mode:n,componentContext:o,state:r}){rb.setState({slotName:e,basePath:t,mode:n??"normal",componentContext:o,state:r})}function rS(e){rb.getState().slotName===e&&rb.setState(rb.getInitialState(),!0)}let rk=R("modalRegistry",{modals:{}});function rj(e){rk.setState(t=>(t.modals[e.name]=e,t))}function rN(e){let t=rk.getState().modals[e];if(!t){let n=rd(e);n&&(t={name:e,load:n.load,moduleName:n.moduleName},console.warn(`Modal ${e} was registered as an extension. This is deprecated and will be removed in the future. Please register it in the "modals" section of routes.json instead of the "extensions" section.`),rj(t))}return t}let rE=R("workspace2",{registeredGroupsByName:{},registeredWindowsByName:{},registeredWorkspacesByName:{},openedGroup:null,openedWindows:[],isMostRecentlyOpenedWindowHidden:!1});function rC(e){let{registeredWorkspacesByName:t,registeredWindowsByName:n}=rE.getState(),o=t[e];if(o){let t=n[o.window];if(t)return t;throw Error(`No workspace window found with name: ${o.window} for workspace: ${e}`)}throw Error(`No workspace found with name: ${e}`)}function rP(e){let{registeredGroupsByName:t,registeredWindowsByName:n}=rE.getState(),o=n[e];if(o){let n=t[o.group];if(n)return n;throw Error(`No workspace group found with name: ${o.group} for window: ${e}`)}throw Error(`No workspace window found with name: ${e}`)}function rI(e){let{openedWindows:t}=rE.getState();return t.findIndex(t=>t.openedWorkspaces.find(t=>t.workspaceName===e))}function rA(e,t){if(0==t.length)return;let{registeredGroupsByName:n}=rE.getState(),o={...n};for(let n of t){if(o[n.name])throw Error(`Cannot register workspace group ${n.name} more than once`);o[n.name]={...n,moduleName:e}}rE.setState({registeredGroupsByName:o})}function rO(e,t){if(0==t.length)return;let{registeredWindowsByName:n}=rE.getState(),o={...n};for(let n of t){if(o[n.name])throw Error(`Cannot register workspace window ${n.name} more than once`);let t={...n,moduleName:e};o[n.name]=t}rE.setState({registeredWindowsByName:o})}function rR(e,t){if(0==t.length)return;let{registeredWorkspacesByName:n}=rE.getState(),o={...n};for(let n of t){if(o[n.name])throw Error(`Cannot register workspace ${n.name} more than once`);let t={...n,moduleName:e};o[n.name]=t}rE.setState({registeredWorkspacesByName:o})}let r$=0,rT=null,rM={bootstrap:15e3,mount:15e3,unmount:15e3};function rL(e,t){if(e.timeouts)return e;let n=e.name??"parcel",o=Object.fromEntries(Object.keys(rM).filter(t=>e[t]).map(o=>{var r,i;let s,a;return[o,(r=e[o],i=rM[o],s=Array.isArray(r)?r:[r],a=e=>s.reduce((t,r,i)=>t.then(()=>{let t=r(e);return"function"==typeof t?.then&&"function"==typeof t?.catch?t:Promise.reject(Error(`Lifecycle function ${o} at array index ${i} for parcel ${n} did not return a promise`))}),Promise.resolve(void 0)),e=>{let r,s=new Promise((e,t)=>{r=setTimeout(()=>t(Error(`Lifecycle function ${o} for parcel ${n} did not settle within ${i}ms`)),i)});return Promise.race([a(e),s]).finally(()=>clearTimeout(r)).then(e=>(t(o,!1),e),e=>{throw t(o,!0),e})})]}));return{...e,...o}}async function rW(e,t){var n,o;let r,i,s,a,l,c=await (rT??(rT=new Promise((e,t)=>{(0,ta.xL)({name:"openmrs-extension-host",bootstrap:()=>Promise.resolve(),mount:t=>(e(t.mountParcel),Promise.resolve()),unmount:()=>Promise.resolve()},{domElement:document.createElement("div")}).mountPromise.catch(t)}).catch(e=>(console.error("The host parcel used to mount extensions could not be mounted. Falling back to mounting extensions as root parcels, which leaks their DOM elements.",e),ta.xL))),rT),u={...t},d=(r=u,i=!1,{retarget:e=>r={...e},release:s=()=>(function(e){for(let t of Object.keys(e))delete e[t]})(r),onSettled(e,t){switch(e){case"bootstrap":t&&s();return;case"mount":i||(i=t);return;case"unmount":(t||i)&&s();return}}});return o=c((n=d.onSettled,"function"==typeof e?()=>e().then(e=>rL(e,n)):rL(e,n)),u),a=e=>t=>e.call(o,d.retarget(t)).catch(e=>{throw"SKIP_BECAUSE_BROKEN"===o.getStatus()&&d.release(),e}),l=o.update&&a(o.update),Object.defineProperty(o,"update",{configurable:!0,enumerable:!0,get:()=>l,set:e=>{l=e&&a(e)}})}function rD(){return rU}function rU(e,t){let n,o=rW(e,t).then(e=>n=e);return{mount:()=>o.then(e=>e.mount()),unmount:()=>o.then(e=>e.unmount()),update:e=>o.then(t=>t.update?.(e)),getStatus:()=>n?.getStatus()??"LOADING_SOURCE_CODE",get loadPromise(){return o.then(e=>e.loadPromise)},get bootstrapPromise(){return o.then(e=>e.bootstrapPromise)},get mountPromise(){return o.then(e=>e.mountPromise)},get unmountPromise(){return o.then(e=>e.unmountPromise)}}}async function rB(e,t,n,o,r=e=>e,i={}){let s=rc(o),a=rd(o),l=null;if(e){let c;if(!a)throw Error(`Couldn't find extension '${s}' to attach to '${t}'`);let{meta:u,moduleName:d,load:m}=a,f=r$++,p=`${t}/${o}-${f}`;e.dataset.extensionRenderingId=p;let g=e=>{try{oX(p)}catch(t){console.error(e,t)}};try{oK({renderingId:p,extensionName:s,extensionModuleName:d,extensionId:o,slotName:t,slotModuleName:n})}catch(e){throw g(`Recomputing configuration after registering '${o}' failed also failed`),e}try{c=await m()}catch(e){throw g(`Recomputing configuration after '${o}' failed to load also failed`),e}try{l=await rW(r({...c,name:`${t}/${s}-${f}`}),{...i,_meta:u,_extensionContext:{extensionId:o,extensionSlotName:t,extensionSlotModuleName:n,extensionModuleName:d,extensionMeta:u},domElement:e})}catch(e){throw g(`Recomputing configuration after '${o}' failed to mount also failed`),e}l.mountPromise.then(void 0,e=>{console.error(`Extension '${o}' in slot '${t}' failed to mount`,e),g(`Recomputing configuration after '${o}' failed to mount also failed`)}),l.unmountPromise.then(()=>g(`Recomputing configuration after unmounting '${o}' failed`),e=>{console.error(`Extension '${o}' in slot '${t}' failed to unmount`,e),g(`Recomputing configuration after '${o}' failed to unmount also failed`)})}else console.warn(`Tried to render ${o} into ${t} but no DOM element was available.`);return l}var rF=n(6925),rH=n.n(rF);let rV=(0,rF.createContext)({moduleName:"",featureName:""});function rG({to:e,templateParams:t,onBeforeNavigate:n,children:o,...r}){return(0,rF.useEffect)(()=>{r.href&&console.warn(`ConfigurableLink does not support the href prop. Use the 'to' prop instead. The provided href value is '${r.href}'`),r.onClick&&console.warn(`ConfigurableLink does not support the onClick prop. Use the 'onBeforeNavigate' prop instead. The 'to' prop of the offending link is ${e}`)},[]),rH().createElement("a",{onClick:o=>{0===o.button&&!o.ctrlKey&&!o.shiftKey&&!o.altKey&&!o.metaKey&&(o.preventDefault(),n?.(o),tg({to:e,templateParams:t})),0===o.button&&(o.ctrlKey||o.metaKey)&&n?.(o),0===o.button&&o.shiftKey&&n?.(o),1===o.button&&n?.(o)},href:tf(e,t),...r},o)}let rz=({state:e,children:t,...n})=>{let{extension:o}=(0,rF.useContext)(rV),r=(0,rF.useRef)(null),i=(0,rF.useRef)(Promise.resolve()),s=(0,rF.useRef)(!1),a=(0,rF.useRef)(!1),l=(0,rF.useRef)(e),c=(0,rF.useCallback)(e=>{if(!e)return;let t=()=>{"MOUNTED"===e.getStatus()&&e.unmount()};switch(e.getStatus()){case"MOUNTED":e.unmount();break;case"UPDATING":i.current?.then(t,t);break;default:e.mountPromise.then(t,()=>{})}},[]),u=(0,rF.useCallback)((e,t)=>{e.update&&"UNMOUNTING"!==e.getStatus()&&(i.current=Promise.all([e.mountPromise,i.current]).then(()=>{if(r.current?.getStatus()==="MOUNTED"&&r.current.update)return r.current.update({...t})}).catch(e=>{let t=r.current?.getStatus();"UNMOUNTING"!==t&&"NOT_MOUNTED"!==t&&"UNLOADING"!==t&&console.error(`The extension '${o?.extensionId}' failed to update`,e)}))},[]),d=(0,rF.useCallback)(t=>{t&&!r.current&&!a.current&&o?.extensionSlotName&&o.extensionSlotModuleName&&(a.current=!0,rB(t,o.extensionSlotName,o.extensionSlotModuleName,o.extensionId,void 0,e).then(t=>{(a.current=!1,r.current=t,s.current)?c(t):t&&l.current!==e&&u(t,l.current)},()=>{a.current=!1}))},[]);return(0,rF.useEffect)(()=>(s.current=!1,()=>{s.current=!0,c(r.current)}),[]),(0,rF.useEffect)(()=>{l.current=e,r.current&&u(r.current,e)},[e]),o?rH().createElement("div",{ref:d,"data-extension-id":o?.extensionId,style:{position:"relative"},...n}):null};function rq(e){let t=(0,rF.useRef)(e);return x(t.current,e)||(t.current=e),t.current}function rJ(e,t){"function"==typeof t&&(t=t(e));let n={};for(let[o,r]of Object.entries(t)){let t=function(...t){e.setState(e=>r(e,...t))};n[o]=t}return n}let rK=e=>e;function rX(e,t=rK,n){let o=(0,rF.useCallback)(t=>e.subscribe(t),[e]),r=(0,rF.useCallback)(()=>t(e.getState()),[e,t]),i=(0,rF.useSyncExternalStore)(o,r,r),s=(0,rF.useMemo)(()=>n?rJ(e,n):null,[e,n]);return(0,rF.useMemo)(()=>s?{...i,...s}:i,[i,s])}function rY(e,t){return rX(e,rK,t)}function rZ(e){return function(t){let n=(0,rF.useCallback)(t=>e.subscribe(t),[]),o=(0,rF.useCallback)(()=>e.getState(),[]),r=(0,rF.useSyncExternalStore)(n,o,o),i=(0,rF.useMemo)(()=>t?rJ(e,t):null,[t]);return(0,rF.useMemo)(()=>i?{...r,...i}:r,[r,i])}}let rQ=[];Object.freeze(rQ);let r0={candidateExtensions:rQ};Object.freeze(r0);let r1=e=>{let t=(0,rF.useCallback)(t=>t.slots?.[e]??r0,[e]);return rX(oY(),t)},r2=e=>e.session;function r5(e,t){let{candidateExtensions:n}=r1(e),o=rX(tA,r2),r=rq(t);return(0,rF.useMemo)(()=>rw(e,r),[e,r,o,n])}function r6(e,t){let{moduleName:n}=(0,rF.useContext)(rV);if(!n)throw Error("ComponentContext has not been provided. This should come from @openmrs/esm-react-utils.");return(0,rF.useEffect)(()=>{rv(n,e)},[n,e]),{extensions:r5(e,t),extensionSlotName:e,extensionSlotModuleName:n}}function r8(e){return e}function r3({name:e,extensionSlotName:t,select:n=r8,children:o,state:r,style:i,...s}){if(o&&r)throw Error("Both children and state have been provided. If children are provided, the state must be passed as a prop to the `Extension` component.");let a=e??t,l=(0,rF.useRef)(null),{extensions:c,extensionSlotModuleName:u}=r6(a,r),d=(0,rF.useMemo)(()=>n(c),[n,c]),m=(0,rF.useMemo)(()=>{if("function"==typeof o&&!rH().isValidElement(o))return d.map(e=>o(e,r))},[o,d]);return rH().createElement("div",{ref:l,"data-extension-slot-name":a,"data-extension-slot-module-name":u,style:{...i,position:"relative"},...s},a&&d?.map((e,t)=>rH().createElement(rV.Provider,{key:e.id,value:{moduleName:u,featureName:"",extension:{extensionId:e.id,extensionSlotName:a,extensionSlotModuleName:u,extensionMeta:e.meta}}},m?.[t]??("function"!=typeof o?o:null)??rH().createElement(rz,{state:r}))))}var r4=n(3776),r7=n(9568),r9=n(9737),ie=n(2324),it=n(242);let io={strictMode:!0,throwErrorsToConsole:!0,disableTranslations:!1},ir=new Map;(0,it.y)(ir);let ii={errorRetryCount:3,fetcher:tP,focusThrottleInterval:18e5,revalidateIfStale:!0,revalidateOnFocus:!1,revalidateOnReconnect:!1,refreshInterval:0,shouldRetryOnError:e=>{if(e instanceof tI){let t=e.response.status;return!!(t>=500)||401===t||403===t||429===t}return!0},provider:()=>ir};function is(e){if("object"!=typeof e||"string"!=typeof e.featureName||"string"!=typeof e.moduleName)throw Error("Invalid options");let t=Object.assign({},io,e),n={...ii,...t.swrConfig};return function(e){var o,r,i,s,a;return i=r=class extends(o=rH().Component){componentDidCatch(e,n){n&&n.componentStack&&(e.extra=Object.assign(e.extra||{},{componentStack:n.componentStack})),t.throwErrorsToConsole&&setTimeout(()=>{throw e}),this.setState({caughtError:e,caughtErrorInfo:n})}render(){if(this.state.caughtError)return rH().createElement("div",null,"An error has occurred. Please try reloading the page.");{let o=rH().createElement(rF.Suspense,{fallback:null},rH().createElement(ie.S,{value:n},rH().createElement(rV.Provider,{value:this.state.config},t.disableTranslations?rH().createElement(e,this.props):rH().createElement(r9.I18nextProvider,{i18n:window.i18next,defaultNS:this.state.config.extension?`${this.state.config.moduleName}___${this.state.config.extension.extensionSlotName}___${this.state.config.extension.extensionId}`:this.state.config.moduleName},rH().createElement(e,this.props)))));return t.strictMode&&rH().StrictMode?rH().createElement(rH().StrictMode,null,o):o}}constructor(e){super(e),this.state={caughtError:null,caughtErrorInfo:null,config:{moduleName:t.moduleName,featureName:t.featureName,extension:e._extensionContext}}}},s="displayName",a=`OpenmrsReactComponent(${t.featureName})`,s in i?Object.defineProperty(i,s,{value:a,enumerable:!0,configurable:!0,writable:!0}):i[s]=a,r}}function ia(e,t){return(0,r7.A)({React:rH(),ReactDOMClient:r4,rootComponent:is(t)(e)})}function il(e,t){return()=>e().then(({default:e})=>ia(e,t))}function ic(e,t){return()=>Promise.resolve(ia(e,t))}let iu=il,id=(0,E.y)()(()=>({}));T("openmrs-app-context",id);let im={};function ip(e,t=e=>e){let n=id.getState();return e in n?Object.freeze(Object.assign({},t?t(n[e]):n[e])):null}function ig(e,t){id.setState(n=>(e in n||(n[e]={}),n[e]=t(n[e]),Object.assign({},n)))}function ih(e){return null===e?null:Object.freeze(Object.assign({},e))}let iw=new Map;function i_(e,t){let n=(0,rF.useRef)(t??{}),o=(0,rF.useRef)(t=>ig(e,t)),r=(0,rF.useRef)(Symbol());return(0,rF.useEffect)(()=>{let n=t??{},o=r.current;return null===ip(e)?!function(e,t=im){id.setState(n=>{if(e in n)throw Error(`Attempted to re-register namespace ${e} in the app context. Each namespace must be unregistered before the name can be registered again.`);return Object.assign({},n,{[e]:t===im?{}:t})})}(e,n):(console.warn(`Namespace ${e} is already registered in the app context. This is likely a race condition during navigation, but may indicate two components are trying to own the same namespace. Updating the existing context.`),ig(e,()=>n)),iw.set(e,o),()=>{iw.get(e)===o&&(id.setState(t=>(e in t&&delete t[e],t)),iw.delete(e))}},[e]),(0,rF.useEffect)(()=>{let o=t??{};x(n.current,o)||(ig(e,()=>o),n.current=o)},[t]),o.current}function iv({namespace:e,value:t}){return i_(e,t),null}let iy=({children:e,value:t,fallback:n})=>t?rH().createElement(rH().Fragment,null,e):n?rH().createElement(rH().Fragment,null,n):null;function ib(){let e=(0,rF.useRef)();return(!e.current||e.current.signal.aborted)&&(e.current=new AbortController),(0,rF.useEffect)(()=>{let t=e.current;return()=>t?.abort()},[]),e.current}function ix(e,t=e=>e??{}){let[n,o]=(0,rF.useState)(()=>{if(iS(e))return;let n=ip(e);if(null!==n)return t?t(n):n});return(0,rF.useEffect)(()=>{if(iS(e))throw Error(`The namespace supplied to useAppContext must be a non-empty string, but was "${e}".`)},[e]),(0,rF.useEffect)(()=>{var n;let r;return(n=e=>{if(null==e)return void o(void 0);let n=t?t(e):e;o(e=>x(e,n)?e:n)})(ih(r=ip(e))),id.subscribe(t=>{let o=e in t?t[e]:null;o!==r&&(r=o,n(ih(o)))})},[e,t]),n}function iS(e){return"string"!=typeof e||0===e.trim().length}function ik(e){let t=r5(e);return(0,rF.useMemo)(()=>t.map(e=>e.id),[t])}function ij(e){return r1(e).candidateExtensions}function iN(e,t,n){let{data:o,error:r,mutate:i,isLoading:s,isValidating:a}=(0,ie.u)(e?nU(e,t,n):null,tP);return(0,rF.useMemo)(()=>({isLoading:s,data:o?.data.results??[],error:r,mutate:i,isValidating:a}),[o,r,s,a,i])}function iE(e){(0,rF.useEffect)(()=>{if(e){let e=window.getComputedStyle(document.body).overflow;return document.body.style.overflow="hidden",()=>{document.body.style.overflow=e}}},[e])}let iC={},iP=`No ComponentContext has been provided. This should come from "openmrsComponentDecorator".
|
|
16
|
-
Usually this is already applied when using "getAsyncLifecycle" or "getSyncLifecycle".`;function iI(e,t,n){let o=iC[e];if(o)return o;let r=new Promise(e=>{let o=n(t.getState());if(o)return void e(o);let r=t.subscribe(t=>{let o=n(t);o&&(r(),e(o))})});return iC[e]=r,r.then(()=>{iC[e]===r&&delete iC[e]}),r}function iA(e){let{moduleName:t,extension:n}=(0,rF.useContext)(rV),o=e?.externalModuleName??t;if(!o&&!n)throw Error(iP);let r=function(e){let t=(0,rF.useMemo)(()=>en(e),[e]),n=function(e){let[t,n]=(0,rF.useState)(()=>{let t=e.getState();return t.loaded&&t.config?t.config:null});return(0,rF.useEffect)(()=>e?.subscribe(e=>{e.loaded&&e.config&&n(e.config)}),[e]),t}(t);if(!n)throw iI(e,t,e=>e.loaded?e.config:null);return n}(o),i=function(e){let t=(0,rF.useMemo)(es,[]),n=function(e,t){let[n,o]=(0,rF.useState)(t?()=>{let n=ea(e.getState(),t.extensionSlotName,t.extensionId);if(n.loaded&&n.config)return n.config}:null);return(0,rF.useEffect)(()=>{if(t)return e.subscribe(e=>{let r=ea(e,t.extensionSlotName,t.extensionId);r.loaded&&r.config&&!(0,F.A)(r.config,n)&&o(r.config)})},[e,t,n]),n}(t,e);if(!n&&e)throw iI(`${e.extensionSlotName}-${e.extensionId}`,t,t=>{let n=ea(t,e.extensionSlotName,e.extensionId);return n.loaded?n.config:null});return n||{}}(n);return(0,rF.useMemo)(()=>e?.externalModuleName&&o===e.externalModuleName?{...r}:{...r,...i},[o,e?.externalModuleName,r,i])}let iO=r5;function iR(e,t=300){let[n,o]=(0,rF.useState)(e);return(0,rF.useEffect)(()=>{let n=setTimeout(()=>{o(e)},t);return()=>{clearTimeout(n)}},[e,t]),n}var i$=n(6269);let iT=`custom:${[["admissionDecisionConcept","ref"],["admissionEncounterType","ref"],["admissionForm","ref"],["atFacilityVisitType","ref"],["bedAssignmentEncounterType","ref"],["cancelADTRequestEncounterType","ref"],["checkInClerkEncounterRole","ref"],["checkInEncounterType","ref"],["clinicianEncounterRole","ref"],["conceptSourcesForDiagnosisSearch","ref"],["consultEncounterType","ref"],["consultFreeTextCommentsConcept","ref"],["denyAdmissionConcept","ref"],["diagnosisMetadata","ref"],["diagnosisSets","ref"],["dischargeForm","ref"],["dispositionDescriptor","ref"],["dispositions","ref"],["emrApiConceptSource","ref"],["exitFromInpatientEncounterType","ref"],["extraPatientIdentifierTypes","ref"],["fullPrivilegeLevel","ref"],["highPrivilegeLevel","ref"],["identifierTypesToSearch","ref"],["inpatientNoteEncounterType","ref"],["lastViewedPatientSizeLimit","ref"],["metadataSourceName","ref"],["motherChildRelationshipType","ref"],["narrowerThanConceptMapType","ref"],["nonDiagnosisConceptSets","ref"],["orderingProviderEncounterRole","ref"],["patientDiedConcept","ref"],["personImageDirectory","ref"],["primaryIdentifierType","ref"],["sameAsConceptMapType","ref"],["suppressedDiagnosisConcepts","ref"],["supportsAdmissionLocationTag","(uuid,display,name,links)"],["supportsLoginLocationTag","(uuid,display,name,links)"],["supportsTransferLocationTag","(uuid,display,name,links)"],["supportsVisitsLocationTag","(uuid,display,name,links)"],["telephoneAttributeType","ref"],["testPatientPersonAttributeType","ref"],["transferForm","ref"],["transferRequestEncounterType","ref"],["transferWithinHospitalEncounterType","ref"],["unknownCauseOfDeathConcept","ref"],["unknownLocation","ref"],["unknownPatientPersonAttributeType","ref"],["unknownProvider","ref"],["visitAssignmentHandlerAdjustEncounterTimeOfDayIfNecessary","ref"],["visitExpireHours","ref"],["visitNoteEncounterType","ref"]].map(([e,t])=>`${e}:${t}`).join(",")}`;function iM(){let e=`${tj}/emrapi/configuration?v=${iT}`,t=(0,i$.A)(e,tP);return(0,rF.useMemo)(()=>({emrConfiguration:t.data?.data,isLoadingEmrConfiguration:t.isLoading,mutateEmrConfiguration:t.mutate,errorFetchingEmrConfiguration:t.error}),[t])}function iL(){return(0,rF.useContext)(rV).extension}let iW=rZ(oF());function iD(e){let t=r5(e);return(0,rF.useMemo)(()=>Object.fromEntries(t.map(e=>[e.name,e.meta])),[t])}let iU=rZ(oY());function iB(e){let{flags:t}=rX(oR);return t[e]?.enabled??!1}function iF(){let[,e]=(0,rF.useState)(0);return(0,rF.useCallback)(()=>{e(e=>e+1)},[])}function iH(e,t,n={}){return iG(e,t,iV,n)}let iV={getPaginatedUrl:(e,t,n)=>{if(!e)return null;{let o=new URL(tC(e.toString()),window.location.toString());return o.searchParams.set("limit",""+t),o.searchParams.set("startIndex",""+n),o.searchParams.set("totalCount","true"),o.toString()}},getNextUrl:e=>{let t=e?.links?.find(e=>"next"==e.rel)?.uri;if(!t)return null;{let e=new URL(t);return e.host=window.location.host,e.protocol=window.location.protocol,e.toString()}},getTotalCount:e=>e?.totalCount??NaN,getCurrentPageSize:e=>e?.results?.length??NaN,getData:e=>e?.results};function iG(e,t,n,o={}){let{getPaginatedUrl:r,getTotalCount:i,getCurrentPageSize:s,getData:a}=n,{immutable:l,swrConfig:c}=o,u=o.fetcher??tP,[d,m]=(0,rF.useState)(1),f=(0,rF.useRef)(NaN),p=(0,rF.useRef)(NaN),g=(0,rF.useRef)(d),h=(0,rF.useRef)(!1),w=(0,rF.useRef)(!1),_=e?.toString()??"",[v,y]=(0,rF.useState)(_);_!==v&&(y(_),m(1),g.current=1,f.current=NaN,p.current=NaN,h.current=!1,w.current=!1);let b=(d-1)*t,x=(0,rF.useMemo)(()=>r(e,t,b),[e,t,b]),{data:S,...k}=(l?i$.A:ie.u)(x,u,c);S?.data&&(f.current=i(S?.data),p.current=s(S?.data),h.current=!0);let j=Math.ceil(f.current/t),N=(0,rF.useCallback)(e=>{if(!Number.isInteger(e)||e<1)return void console.warn(`useServerPagination: ignoring goTo(${e}); page must be a positive integer.`);let n=Math.ceil(f.current/t);!h.current||Number.isNaN(n)||e<=n?(g.current=e,m(e)):console.warn("Invalid attempt to go to out of bounds page: "+e)},[t]);(0,rF.useEffect)(()=>{if(!h.current)return;if(Number.isNaN(f.current)){w.current||(w.current=!0,console.warn(`useServerPagination: ${_} returned no total count, so out-of-range pages cannot be detected.`));return}let e=Math.max(1,Math.ceil(f.current/t));d>e&&(console.warn(`Invalid attempt to go to out of bounds page: ${d}; returning to page ${e}.`),g.current=e,m(e))},[d,t,_,S]);let E=(0,rF.useCallback)(()=>{N(g.current+1)},[N]),C=(0,rF.useCallback)(()=>{N(g.current-1)},[N]);return{data:a(S?.data),totalPages:j,totalCount:f.current,currentPage:d,currentPageSize:p.current,paginated:j>1,showNextButton:d<j,showPreviousButton:d>1,goTo:N,goToNext:E,goToPrevious:C,...k}}function iz(e,t,n={}){return iG(e,t,iq(),n)}function iq(){return{getPaginatedUrl:(e,t,n)=>{if(!e)return null;{let o=new URL(tC(e.toString()),window.location.toString());return o.searchParams.set("_count",""+t),o.searchParams.set("_getpagesoffset",""+n),o.toString()}},getNextUrl:e=>{let t=e?.link?.find(e=>"next"==e.relation)?.url;if(!t)return null;{let e=new URL(t);return e.host=window.location.host,e.protocol=window.location.protocol,e.toString()}},getTotalCount:e=>e?.total??NaN,getCurrentPageSize:e=>e?.entry?.length??NaN,getData:e=>e?.entry?.map(e=>e.resource)}}var iJ=n(3709);function iK(e,t={}){return iX(e,iV,t)}function iX(e,t,n={}){let{swrInfiniteConfig:o,immutable:r}=n,{getNextUrl:i,getTotalCount:s,getData:a}=t,l=n.fetcher??tP,c=(0,rF.useCallback)((n,o)=>0==n?e?.toString()??null:t.getNextUrl(o.data),[e]),{data:u,size:d,setSize:m,...f}=(0,iJ.Ay)(c,l,{...o,...r?{revalidateIfStale:!1,revalidateOnFocus:!1,revalidateOnReconnect:!1}:{}}),p=i(u?.[u.length-1].data),g=s(u?.[0]?.data);return{data:u?.flatMap(e=>a(e.data)),totalCount:g,hasMore:null!=p,loadMore:()=>{m((u?.length??0)+1)},nextUri:p,...f}}function iY(e,t={}){return iZ(e,iV,t)}function iZ(e,t,n={}){let o=iX(e,t,n),{hasMore:r,error:i,data:s,loadMore:a,isLoading:l,nextUri:c}=o;return((0,rF.useEffect)(()=>{r&&!i&&a()},[r,c]),n.partialData)?o:{...o,data:r||i?void 0:s,isLoading:l||r}}function iQ(e,t={}){return iZ(e,iq(),t)}function i0(e,t={}){return iX(e,iq(),t)}function i1(){let e="tablet";return document.body.classList.forEach(t=>{switch(t){case"omrs-breakpoint-lt-tablet":e="phone";break;case"omrs-breakpoint-gt-small-desktop":e="large-desktop";break;case"omrs-breakpoint-gt-tablet":e="small-desktop"}}),e}function i2(){let[e,t]=(0,rF.useState)(i1);return(0,rF.useEffect)(()=>{let e=()=>{t(i1())};return window.addEventListener("resize",e),()=>window.removeEventListener("resize",e)},[]),e}let i5=e=>"small-desktop"===e||"large-desktop"===e;function i6(e){let t=(0,rF.useContext)(rV);(0,rF.useEffect)(()=>(t&&t.moduleName&&(e.componentContext=t),rx(e),()=>{rS(e.name)}),[t,e])}function i8(){return rX(rb)}let i3=[];function i4(e=null,t=null){let n=new URLSearchParams;e&&n.set("tag",e),t&&n.set("q",t);let o=n.toString(),{data:r}=iY(`${tj}/location${o?"?"+o:""}`,{immutable:!0});return r??i3}function i7(e,t=!0){let n=(0,rF.useRef)(null);return(0,rF.useEffect)(()=>{let o=o=>{t&&n.current&&o.target&&o.target instanceof Node&&(n.current.contains(o.target)||e(o))};return window.addEventListener("mousedown",o),window.addEventListener("touchstart",o),()=>{window.removeEventListener("mousedown",o),window.removeEventListener("touchstart",o)}},[e,t]),n}function i9(e){let t=(0,rF.useRef)();return(0,rF.useEffect)(()=>{let n=new IntersectionObserver(t=>{for(let n of t)if(n.isIntersecting)return void e()},{threshold:1});return t.current&&n.observe(t.current),()=>{t.current&&n.unobserve(t.current)}},[t.current,e]),t}function se(e,t={}){let{abortController:n,fetchInit:o,url:r,swrConfig:i}=t,s=ib(),a=(0,rF.useMemo)(()=>o?.signal??n?.signal??s.signal,[n?.signal,o?.signal,s.signal]),l=(0,rF.useCallback)(e=>tP(function(e,t){if(t)return"function"==typeof t?t(e):t;if("string"==typeof e)return e;throw Error(`When using useOpenmrsSWR with a key that is not a string, you must provide a url() function that converts the key to a valid url. The key for this hook is ${e}.`)}(e,r),{...o,signal:a}),[a,o,r]);return(0,ie.u)(e,l,i)}function st(e=[],t=10){let[n,o]=(0,rF.useState)(1),r=(0,rF.useMemo)(()=>"number"==typeof t&&t>0?Math.max(1,Math.ceil(e.length/t)):1,[e.length,t]);n>r&&o(r);let i=Math.min(Math.max(1,n),r),s=(0,rF.useMemo)(()=>{let n=(i-1)*t,o=(i+0)*t;return e.slice(n,o)},[e,i,t]),a=(0,rF.useCallback)(e=>{!Number.isInteger(e)||e<1?console.warn(`usePagination: ignoring goTo(${e}); page must be a positive integer.`):o(e)},[]),l=(0,rF.useCallback)(()=>{o(e=>e+1)},[]),c=(0,rF.useCallback)(()=>{o(e=>Math.max(1,e-1))},[]);return(0,rF.useMemo)(()=>({results:s,totalPages:r,currentPage:i,paginated:e.length>t,showNextButton:i<r,showPreviousButton:i>1,goTo:a,goToNext:l,goToPrevious:c}),[s,r,e.length,t,i,a,l,c])}function sn(e,t,n,o){return{pageSizes:(0,rF.useMemo)(()=>{let n=Math.ceil(t/e);return isNaN(n)&&(n=0),[...Array(n).keys()].map(t=>(t+1)*e)},[e,t]),pageItemsCount:(0,rF.useMemo)(()=>e>t?t:e*n>t?e*(n-1)+o:e*n,[e,t,n,o])}}function so(){let e=/\/patient\/([a-zA-Z0-9\-]+)\/?/.exec(location.pathname);return e&&e[1]}function sr(e){let[t,n]=(0,rF.useState)(e??so()),{data:o,error:r,isValidating:i}=(0,ie.u)(t?["patient",t]:null,()=>nH(t,{}));return(0,rF.useEffect)(()=>{let e=()=>{let e=so();e!==t&&n(e)};return window.addEventListener("single-spa:routing-event",e),()=>window.removeEventListener("single-spa:routing-event",e)},[t]),(0,rF.useMemo)(()=>({isLoading:i&&!r&&!o,patient:o,patientUuid:t,error:r}),[i,r,o,t])}function si(){let e=`${tj}/metadatamapping/termmapping?v=custom:(metadataUuid)&code=emr.primaryIdentifierType`,{data:t,error:n,isLoading:o}=(0,ie.u)(e,tP);return(0,rF.useMemo)(()=>({primaryIdentifierCode:t?.data?.results[0]?.metadataUuid,isLoading:o,error:n}),[t,n,o])}function ss(e){let{extensions:t,extensionSlotModuleName:n}=r6(e);return e?t.map(t=>({state:o})=>rH().createElement(rV.Provider,{value:{moduleName:n,featureName:"",extension:{extensionId:t.id,extensionSlotName:e,extensionSlotModuleName:n,extensionMeta:t.meta}}},rH().createElement(rz,{state:o}))):[]}function sa(){let e=(0,rF.useRef)(),[t,n]=(0,rF.useState)(null),o=null;if(!t){if(i){let e=tM().getState();e.loaded&&(o=e.session)}else i=new Promise(t=>{let n=({loaded:n,session:r})=>{n&&(t(r),o=r,e.current&&(e.current(),e.current=void 0))};n(tM().getState()),o||(e.current=tM().subscribe(n))});if(o)n(o);else throw i}(0,rF.useEffect)(()=>(e.current||(e.current=tM().subscribe(({loaded:e,session:t})=>{e&&(o=t,n(t))})),()=>{e.current&&(e.current(),e.current=void 0)}),[]);let r=t||o;if(!r)if(i)throw console.warn("useSession is in an unexpected state. Attempting to recover."),i;else throw Error("useSession is in an invalid state.");return r}let sl=({privilege:e,fallback:t,children:n})=>{let[o,r]=(0,rF.useState)(null);return((0,rF.useEffect)(()=>{let e=tM(),t=e.subscribe(({loaded:e,session:t})=>{r(e?t?.user??null:null)}),{loaded:n,session:o}=e.getState();return n&&r(o?.user??null),t},[]),o&&tU(e,o))?rH().createElement(rH().Fragment,null,n):t?rH().createElement(rH().Fragment,null,t):null};var sc=n(4343),su=n.n(sc),sd=n(3355);let sm=new Map;function sf(){for(let e of Array.from(sm.values()))e()}let sp={setVisitContext:(e,t)=>null==t?{manuallySetVisitUuid:null}:{manuallySetVisitUuid:t.uuid,patientUuid:t.patient?.uuid}};function sg(e){let t=(0,rF.useId)();return(0,rF.useEffect)(()=>{if(e)return sm.set(t,e),()=>{sm.delete(t)}},[t,e]),{...rY(n1(),sp),mutateVisit:sf}}function sh(e,t=nQ){let n=(0,rF.useRef)(void 0),{patientUuid:o,manuallySetVisitUuid:r,setVisitContext:i}=sg((0,rF.useCallback)(()=>n.current?.(),[])),s=e&&o==e?r:null,a=`?patient=${e}&v=${t}&includeInactive=false`,l=`/${s}?v=${t}`,{data:c,error:u,mutate:d,isValidating:m}=(0,ie.u)(e?`${tj}/visit${a}`:null,tP),{data:f,error:p,mutate:g,isValidating:h}=(0,ie.u)(e&&s?`${tj}/visit${l}`:null,tP),w=(0,rF.useMemo)(()=>c?.data.results.find(e=>null===e.stopDatetime)??null,[c]),_=(0,rF.useMemo)(()=>s&&f?f.data:null,[f,s]),v=(0,rF.useRef)(null);(0,rF.useEffect)(()=>{!m&&w&&o===e&&null===r&&i(w),h||(v.current&&_&&v.current.uuid===_.uuid&&!v.current.stopDatetime&&_.stopDatetime&&i(null),v.current=_)},[_,r,w,m,h,o]);let y=(0,rF.useCallback)(()=>{d(),g()},[d,g]);(0,rF.useEffect)(()=>{n.current=y},[y]);let b=!!(!c||s&&!f),x=!!(s?p:u);return{error:u||p,mutate:y,isValidating:m||h,activeVisit:w,currentVisit:_,currentVisitIsRetrospective:!!s,isLoading:b&&!x}}sc.extend(sd);let sw=[];function s_(){let{data:e}=(0,i$.A)(nK,nX);return e??sw}let sv=new Map;async function sy(e,t){let n=t.indexOf("#"),o=n>=0,r=o?t.substring(0,n):e,i=o?t.substring(n+1):t,s=await nf(r);return s&&Object.hasOwn(s,i)&&"function"==typeof s[i]?sx(r,s).then(()=>s[i]()):(s?s&&Object.hasOwn(s,i)?console.warn(`The export ${t}, defined in ${e}'s routes.json, is not a function`):console.warn(`${r} does not define a component called "${i}", referenced in ${e}'s routes.json. This cannot be loaded.`):console.warn(`Unknown app ${r} for ${t} defined in ${e}'s routes.json`),sb)}let sb={bootstrap:()=>Promise.resolve(),mount:()=>Promise.resolve(),unmount:()=>Promise.resolve()};async function sx(e,t){if(e in sv)await sv[e];else{let n=t??await nf(e);await (sv[e]=new Promise((t,o)=>{if(Object.hasOwn(n,"startupApp")){let r=n.startupApp;if("function"==typeof r)return Promise.resolve(r()).then(()=>{eA(e),t(null)}).catch(o)}eA(e),t(null)}))}}function sS(e,t){let n=t.name;if(!n)return void console.error(`An extension definition in ${e} is missing an name and thus cannot be
|
|
15
|
+
${this.stack}`}}let tA=R("session",{loaded:!1,session:null}),tO=0,tR=null;function tT(){return tR||(tA.getState().loaded&&tO>=Date.now()-6e4?null:tW())}function t$(e){let t=e?.includeAuthStatus??!0,n=e=>t?e:e.user,o=tT();return o?new Promise(e=>{let t=()=>{let t=tA.getState();t.loaded&&(r(),e(n(t.session)))},r=tA.subscribe(t);o.then(t,t)}):Promise.resolve(n(tA.getState().session))}function tM(){return tT(),tA}function tL(e){let t=e.locale??e.user?.userProperties?.defaultLocale;t&&t.includes("_")&&(t=t.replaceAll("_","-")),function(e){if(void 0===e||"string"!=typeof e)return!1;try{new Intl.Locale(e)}catch(e){return!1}return!0}(t)&&t!==document.documentElement.getAttribute("lang")&&document.documentElement.setAttribute("lang",t)}function tW(e,t){tO=Date.now(),r??(r=tO);let n={};e&&t&&(n.Authorization=`Basic ${window.btoa(`${e}:${t}`)}`);let o=tJ(tP(tC,{headers:n,rejectAuthFailure:!0})),i=()=>{tR===o&&(tR=null)};return o.then(i,i),tR=o,o}function tD(){tA.setState({loaded:!0,session:{authenticated:!1,sessionId:""}},!0)}function tU(e,t){var n,o;if(void 0===t)return!e;if(!e)return!0;return n=e,o=t,("string"==typeof n?!(0,D.A)(o.privileges.find(e=>n===e.display)):Array.isArray(n)?n.every(e=>!(0,D.A)(o.privileges.find(t=>e===t.display))):((0,D.A)(n)||console.error(`Could not understand privileges "${n}"`),!0))||!(0,D.A)(t.roles.find(e=>"System Developer"===e.display))}function tB(){let e,t;return new Promise(n=>{let o=o=>{o.loaded&&o.session.user&&(e=o.session.user,n(o.session.user),t&&t())};o(tA.getState()),e||(t=tA.subscribe(o))})}async function tF(){return(await t$()).sessionLocation}async function tH(e,t){return tJ(tP(tC,{method:"POST",body:{sessionLocation:e},headers:{"Content-Type":"application/json"},rejectAuthFailure:!0,signal:t?.signal}))}async function tV(e,t){return await tP(tC,{method:"POST",body:{locale:e},headers:{"Content-Type":"application/json"},signal:t?.signal}),tW()}async function tG(e,t,n){return n||(n=new AbortController),await tP(`${tk}/user/${e}`,{method:"POST",body:{userProperties:t},headers:{"Content-Type":"application/json"},signal:n.signal}),tW()}async function tz(e,t=!1){let n=await tP(t?`${tC}?rememberMe=true`:tC,{headers:{"X-Totp-Code":e}});return n.data?.authenticated?(await tW()).session:n.data}async function tq(){try{await tP(tC,{method:"DELETE",rejectAuthFailure:!0})}catch(e){if(!tK(e))throw e}tD(),await tW().catch(()=>{})}function tJ(e){return new Promise((t,n)=>{e.then(e=>{if("object"==typeof e?.data){let n={loaded:!0,session:e.data};tA.setState(n,!0),t(n)}else!function(e){if(!e?.redirected||!e.url)return!1;try{return new URL(e.url,window.location.href).pathname.replace(/\/+$/,"").endsWith("/initialsetup")}catch{return!1}}(e)?n(tX(Error("The session endpoint did not respond with a session"))):n(tX(Error("The server is still starting up"),!0))}).catch(e=>{var o,i;if(tK(e)){"object"==typeof(o=e.responseBody)&&null!==o&&!1===o.authenticated?tA.setState({loaded:!0,session:e.responseBody},!0):tD(),t(tA.getState());return}(i=e)instanceof tI&&502===i.response.status&&!tA.getState().loaded&&void 0!==r&&Date.now()-r<18e4?n(tX(e,!0)):(v(`Failed to fetch new session information: ${e}`),n(tX(e)))})})}function tK(e){return e instanceof tI&&(401===e.response.status||403===e.response.status)}function tX(e,t=!1){return tA.getState().loaded||tA.setState({loaded:!1,session:null,error:e instanceof Error?e:Error(String(e)),initializing:t},!0),tA.getState()}function tY(){return"development"===window.spaEnv||"true"===localStorage.getItem("openmrs:devtools")}tA.subscribe(e=>{e.loaded&&e.session&&tL(e.session)});let tZ={"webservices.rest":"2.24.0",fhir2:"1.0.0-SNAPSHOT"};function tQ(){eP("@openmrs/esm-api",tS),tW()}let t0="import-map-override:",t1="import-map-overrides-disabled",t2="import-map-overrides:change",t5=!1,t6=null,t8=null;async function t3(){return t8??(t8=t4().then(({map:e,complete:t})=>(t||(t8=null),e))),t8}async function t4(){let e=document.querySelectorAll('script[type="systemjs-importmap"]'),t=[],n=!0;for(let o=0;o<e.length;o++){let r=e[o];try{if(r.src){let e=await fetch(r.src);if(!e.ok)throw Error(`Request for ${r.src} returned ${e.status} ${e.statusText}`);t.push(await e.json())}else r.textContent&&t.push(JSON.parse(r.textContent))}catch(e){n=!1,console.warn(`[import-maps] Failed to parse import map from script tag at index ${o}`,e)}}return{map:t9(t),complete:n}}function t9(e){let t={imports:{}};for(let n of e)n?.imports&&Object.assign(t.imports,n.imports);return t}function t7(){let e={};try{let t=nr();for(let n=0;n<localStorage.length;n++){let o=localStorage.key(n);if(o?.startsWith(t0)){let n=o.slice(t0.length);if(!t.includes(n)){let t=localStorage.getItem(o);t&&(e[n]=t)}}}}catch(e){console.warn("[import-maps] Failed to read import-map overrides from localStorage",e)}return{imports:e}}async function ne(){let e=await t3();return t5?t9([e,t6??t7()]):e}async function nt(){return t3()}async function nn(){return t5?t9([await t3(),t7()]):t3()}function no(e){if(!t5)return{imports:{}};if(e){let e={};for(let t=0;t<localStorage.length;t++){let n=localStorage.key(t);if(n?.startsWith(t0)){let t=localStorage.getItem(n);t&&(e[n.slice(t0.length)]=t)}}return{imports:e}}return t7()}function nr(){if(!t5)return[];try{let e=localStorage.getItem(t1);if(e){let t=JSON.parse(e);if(Array.isArray(t))return t}}catch{}return[]}function ni(e){return!!t5&&nr().includes(e)}function ns(e,t){if(!t5)return void console.warn("[Security] Import map overrides are disabled in production mode.");try{localStorage.setItem(t0+e,t),window.dispatchEvent(new CustomEvent(t2))}catch(e){console.warn("[import-maps] Failed to write import-map override to localStorage",e)}}function na(e){if(!t5)return void console.warn("[Security] Import map overrides are disabled in production mode.");try{localStorage.removeItem(t0+e);let t=nr().filter(t=>t!==e);t.length>0?localStorage.setItem(t1,JSON.stringify(t)):localStorage.removeItem(t1),window.dispatchEvent(new CustomEvent(t2))}catch(e){console.warn("[import-maps] Failed to update import-map overrides in localStorage",e)}}function nl(){if(!t5)return void console.warn("[Security] Import map overrides are disabled in production mode.");try{let e=[];for(let t=0;t<localStorage.length;t++){let n=localStorage.key(t);n?.startsWith(t0)&&e.push(n)}e.forEach(e=>localStorage.removeItem(e)),localStorage.removeItem(t1),window.dispatchEvent(new CustomEvent(t2))}catch(e){console.warn("[import-maps] Failed to clear import-map overrides from localStorage",e)}}function nc(e){if(!t5)return void console.warn("[Security] Import map overrides are disabled in production mode.");try{let t=nr().filter(t=>t!==e);t.length>0?localStorage.setItem(t1,JSON.stringify(t)):localStorage.removeItem(t1),window.dispatchEvent(new CustomEvent(t2))}catch(e){console.warn("[import-maps] Failed to update import-map overrides in localStorage",e)}}let nu=!1;function nd(){!nu&&(nu=!0,(t5="development"===window.spaEnv)&&(t6=t7()))}function nm(e){return e.replace(/[\/\-@]/g,"_")}async function nf(e,t="./start",o){var r;let i,s=!o?.maxLoadingTime||o.maxLoadingTime<=0?6e5:o.maxLoadingTime;await Promise.race([np(e,o?.importMap),new Promise((t,n)=>{i=setTimeout(()=>{var t;n(Error(`Could not resolve requested script, ${e}, within ${(t=s)<1e3?`${t} milliseconds`:t<6e4?`${Math.floor(t/1e3)} seconds`:t<36e5?`${Math.floor(t/6e4)} minutes`:t<864e5?`${Math.floor(t/36e5)} hours`:`${Math.floor(t/864e5)} days`}.`))},s)})]),i&&clearTimeout(i);let a=nm(e),l=window[a];if(!("object"==typeof(r=l)&&null!==r&&"init"in r&&"function"==typeof r.init&&"get"in r&&"function"==typeof r.get)){let e=`The global variable ${a} does not refer to a federated module`;throw console.error(e),Error(e)}l.init(n.S.default);let c=(await l.get(t))();if("object"!=typeof c||null===c){let t=`Container for ${e} did not return an ESM module as expected`;throw console.error(t),Error(t)}return c}async function np(e,t){if("string"!=typeof e||0===e.trim().length){let e="Attempted to call importDynamic() without supplying a package to load";throw console.error(e),Error(e)}let n=nm(e);if(!window[n]){let n=t??await ng();if(!n.imports.hasOwnProperty(e)){let t=`Could not find the package ${e} defined in the current importmap`;throw console.error(t),Error(t)}let o=n.imports[e];o.startsWith("./")&&(o=window.spaBase+o.substring(1));let r=e in no().imports;try{return await function(e){var t;let n=(t=window)[nh]??(t[nh]=new Map),o=n.get(e);if(o)return o;if(document.head.querySelector(`script[src="${e}"]`))return console.warn(`Script at ${e} already loaded. Not loading it again.`),Promise.resolve();let r=document.createElement("script");r.src=e,r.type="text/javascript",r.async=!0;let i=new Promise((t,o)=>{let i=setTimeout(()=>{console.error(`The script at ${e} did not load within 5 seconds. This may indicate an issue with the imports in the script's entry-point file or with the script's bundler configuration.`)},5e3);function s(){clearTimeout(i),r.removeEventListener("load",a),r.removeEventListener("error",l)}function a(){s(),t()}function l(t){s(),n.delete(e),r.remove();let i=`Failed to load script from ${e}`;console.error(i,t),o(t.message??i)}r.addEventListener("load",a),r.addEventListener("error",l),document.head.appendChild(r)});return n.set(e,i),i}(o)}catch(e){return r&&f({kind:"error",title:tm("scriptLoadingFailed","Error: Script failed to load"),description:tm("scriptLoadingError","Failed to load overridden script from {{- url}}. Please check that the bundled script is available at the expected URL. Click the button below to reset all import map overrides.",{url:o}),actionButtonLabel:tm("resetOverrides","Reset overrides"),onActionButtonClick(){nl(),window.location.reload()}}),Promise.reject(e)}}return Promise.resolve()}async function ng(){return ne()}let nh=Symbol.for("__openmrs_script_loading");function nw(e){return!!e&&"object"==typeof e&&!(Object.hasOwn(e,"pages")&&(!e.pages||!Array.isArray(e.pages))||Object.hasOwn(e,"extensions")&&(!e.extensions||!Array.isArray(e.extensions))||Object.hasOwn(e,"modals")&&(!e.modals||!Array.isArray(e.modals))||Object.hasOwn(e,"workspaces2")&&(!e.workspaces2||!Array.isArray(e.workspaces2))||Object.hasOwn(e,"workspaceWindows2")&&(!e.workspaceWindows2||!Array.isArray(e.workspaceWindows2))||Object.hasOwn(e,"workspaceGroups2")&&(!e.workspaceGroups2||!Array.isArray(e.workspaceGroups2)))}function n_(e){return!!e&&"object"==typeof e&&"routes"in e&&!!e.routes&&"object"==typeof e.routes&&Object.entries(e.routes).every(([e,t])=>"string"==typeof e&&nw(t))}let nv="openmrs-routes:",ny="openmrs-routes:change",nb=!1,nx=null,nS=null;async function nj(){return nS??(nS=nk().then(({map:e,complete:t})=>(t||(nS=null),e))),nS}async function nk(){let e=document.querySelectorAll("script[type='openmrs-routes']"),t=[],n=!0;for(let o=0;o<e.length;o++){let r=e[o];try{let e;if(r.src){let t=await fetch(r.src);if(!t.ok)throw Error(`Request for ${r.src} returned ${t.status} ${t.statusText}`);e=await t.json()}else r.textContent&&(e=JSON.parse(r.textContent));e&&n_(e)&&t.push(e)}catch(e){n=!1,console.warn(`[route-maps] Failed to parse routes from script tag at index ${o}`,e)}}return{map:nN(t),complete:n}}function nN(e){let t={routes:{}};for(let n of e)n&&"object"==typeof n&&!Array.isArray(n)&&(Object.assign(t.routes,n.routes),void 0===t.version&&void 0!==n.version&&(t.version=n.version));return t}async function nC(){let e={version:void 0,routes:{}};try{let t=[];for(let e=0;e<localStorage.length;e++){let n=localStorage.key(e);if(n?.startsWith(nv)){let e=localStorage.getItem(n);e&&t.push({moduleName:n.slice(nv.length),raw:e})}}for(let n of(await Promise.allSettled(t.map(async({moduleName:e,raw:t})=>{let n=JSON.parse(t);if(nw(n))return{moduleName:e,routes:n};if("string"==typeof n&&n.startsWith("http")){let t=await fetch(n),o=await t.json();if(nw(o))return{moduleName:e,routes:o};throw Error(`${n} did not resolve to a valid OpenmrsAppRoutes object`)}throw Error(`Override for ${e} is neither a valid routes object nor a URL`)}))))"fulfilled"===n.status?e.routes[n.value.moduleName]=n.value.routes:console.warn("[route-maps] Failed to load route override",n.reason)}catch(e){console.warn("[route-maps] Failed to read route overrides from localStorage",e)}return e}async function nE(){let e=await nj();return nb?nN([e,nx??await nC()]):e}async function nP(){return nj()}async function nI(){return nb?nN([await nj(),await nC()]):nj()}function nA(){if(!nb)return{};let e={};try{for(let t=0;t<localStorage.length;t++){let n=localStorage.key(t);if(n?.startsWith(nv)){let t=localStorage.getItem(n);t&&(e[n.slice(nv.length)]=t)}}}catch(e){console.warn("[route-maps] Failed to read route overrides from localStorage",e)}return e}function nO(e,t){if(!nb)return void console.warn("[Security] Route overrides are disabled outside development mode.");try{if("string"==typeof t)if(t.startsWith("http"))localStorage.setItem(nv+e,JSON.stringify(t));else{let n=JSON.parse(t);if(!nw(n))return void console.error(`The supplied routes for ${e} is not a valid OpenmrsAppRoutes object`,t);localStorage.setItem(nv+e,JSON.stringify(n))}else if(t instanceof URL)localStorage.setItem(nv+e,JSON.stringify(t.toString()));else{if(!nw(t))return void console.error(`Override for ${e} is not in a valid format. Expected either a Javascript Object, a JSON string of a Javascript object, or a URL`,t);localStorage.setItem(nv+e,JSON.stringify(t))}window.dispatchEvent(new CustomEvent(ny))}catch(e){console.warn("[route-maps] Failed to write route override to localStorage",e)}}function nR(e){if(!nb)return void console.warn("[Security] Route overrides are disabled outside development mode.");try{localStorage.removeItem(nv+e),window.dispatchEvent(new CustomEvent(ny))}catch(e){console.warn("[route-maps] Failed to remove route override from localStorage",e)}}function nT(){if(!nb)return void console.warn("[Security] Route overrides are disabled outside development mode.");try{let e=[];for(let t=0;t<localStorage.length;t++){let n=localStorage.key(t);n?.startsWith(nv)&&e.push(n)}e.forEach(e=>localStorage.removeItem(e)),window.dispatchEvent(new CustomEvent(ny))}catch(e){console.warn("[route-maps] Failed to clear route overrides from localStorage",e)}}let n$=null;function nM(){return n$||(n$=(nb="development"===window.spaEnv)?nC().then(e=>{nx=e}):Promise.resolve())}let nL=`${tk}/attachment`;function nW(e,t){return tP(`${nL}/${e}`,{signal:t.signal})}function nD(e,t,n,o){return tP(nU(e,t,o),{signal:n.signal})}function nU(e,t,n){return n?`${nL}?patient=${e}&encounter=${n}`:`${nL}?patient=${e}&includeEncounterless=${t}`}async function nB(e,t,n){let o=new FormData;return o.append("fileCaption",t.fileDescription),o.append("patient",e),n&&o.append("encounter",n),t.file?o.append("file",t.file,t.fileName):(o.append("file",new File([""],t.fileName),t.fileName),o.append("base64Content",t.base64Content)),tP(`${nL}`,{method:"POST",body:o})}function nF(e,t){return tP(`${nL}/${e}`,{method:"DELETE",signal:t.signal})}async function nH(e,t){return e?(await tP(`${tN}/Patient/${e}`,t)).data:null}function nV(e,t){let n=new CustomEvent(`openmrs:${e}`,{detail:t??void 0,cancelable:!0,bubbles:!0});return window.dispatchEvent(n)}function nG(e,t){let n=e=>{t("detail"in e&&null!==e.detail?e.detail:void 0)};return window.addEventListener(`openmrs:${e}`,n),()=>{window.removeEventListener(`openmrs:${e}`,n)}}function nz(e){return{uuid:e.uuid,display:e.display}}function nq(e=null,t=null){let n=new URLSearchParams;e&&n.set("tag",e),t&&n.set("q",t);let o=n.toString();return tP(`${tk}/location${o?"?"+o:""}`).then(e=>e.data.results.map(nz))}function nJ(e){return{uuid:e.uuid,display:e.display,name:e.name}}let nK=`${tk}/visittype`;function nX(e=nK){return tP(e).then(e=>e.data.results.map(nJ))}var nY=((j={}).NEWVISIT="startVisit",j.EDITVISIT="editVisit",j.LOADING="loadingVisit",j),nZ=((k={}).NOTSTARTED="notStarted",k.ONGOING="ongoing",k);let nQ="custom:(uuid,display,voided,indication,startDatetime,stopDatetime,encounters:(uuid,display,encounterDatetime,form:(uuid,name),location:ref,encounterType:ref,encounterProviders:(uuid,display,provider:(uuid,display))),patient:(uuid,display),visitType:(uuid,name,display),attributes:(uuid,display,attributeType:(name,datatypeClassname,uuid),value),location:(uuid,name,display))",n0=function(){try{return JSON.parse(sessionStorage.getItem("openmrs:visitStoreState")||"null")}catch(e){return null}}()||{patientUuid:null,manuallySetVisitUuid:null};function n1(){return M("visit",n0)}function n2(e,t){n1().setState({patientUuid:e,manuallySetVisitUuid:t})}function n5(e,t){return tP(`${tk}/visit`,{signal:t.signal,method:"POST",headers:{"Content-type":"application/json"},body:e})}function n6(e,t,n){return tP(`${tk}/visit/${e}`,{signal:n.signal,method:"POST",headers:{"Content-type":"application/json"},body:t})}function n8(e,t,n){return tP(`${tk}/visit?patient=${e}&v=${n??nQ}`,{signal:t.signal,method:"GET",headers:{"Content-type":"application/json"}})}n1().subscribe(e=>{var t;t=e,sessionStorage.setItem("openmrs:visitStoreState",JSON.stringify(t))});var n3=n(9225),n4=n(6881),n9=n(6828),n7=n(1956),oe=n(3635),ot=n(7839),on=n(2298);let oo={Array,Boolean,Symbol,Infinity,NaN,Math,Number,BigInt,String,RegExp,JSON,isFinite,isNaN,parseFloat,parseInt,decodeURI,encodeURI,encodeURIComponent,Object:{__proto__:void 0,assign:Object.assign.bind(null),fromEntries:Object.fromEntries.bind(null),hasOwn:Object.hasOwn.bind(null),keys:Object.keys.bind(null),is:Object.is.bind(null),values:Object.values.bind(null)}},or={...oo,Promise};function oi(e,t={}){return od(e,t,op)}async function os(e,t={}){return om(e,t,op)}function oa(e,t={}){return od(e,t,og)}function ol(e,t={}){return om(e,t,og)}function oc(e,t={}){return od(e,t,oh)}function ou(e,t={}){return om(e,t,oh)}function od(e,t={},n){if("string"!=typeof e&&("object"!=typeof e||!e||!("type"in e)))throw`Unknown expression type ${e}. Expressions must either be a string or pre-compiled string.`;if("string"==typeof e&&0===e.trim().length)throw{type:"Empty expression",message:"Expression cannot be an empty string"};null==t&&(t={});let o=ob(t,oo),r=ow("string"==typeof e?(0,n3.A)(e):e,o);if(n(r))return r;throw{type:"Invalid result",message:"string"==typeof e?`The expression ${e} did not produce a valid result`:"The expression did not produce a valid result"}}async function om(e,t={},n){if("string"!=typeof e&&("object"!=typeof e||!e||!("type"in e)))return Promise.reject(`Unknown expression type ${e}. Expressions must either be a string or pre-compiled string.`);if("string"==typeof e&&0===e.trim().length)throw{type:"Empty expression",message:"Expression cannot be an empty string"};null==t&&(t={});let o=ob(t,or);return Promise.resolve(ow("string"==typeof e?(0,n3.A)(e):e,o)).then(t=>{if(n(t))return t;throw{type:"Invalid result",message:"string"==typeof e?`The expression ${e} did not produce a valid result`:"The expression did not produce a valid result"}})}function of(e){return(0,n3.A)(e)}function op(e){return"string"==typeof e||"number"==typeof e||"boolean"==typeof e||null==e||e instanceof Date}function og(e){return"boolean"==typeof e}function oh(e){return"number"==typeof e}function ow(e,t){switch(e.type){case"UnaryExpression":var n,o,r,i,s,a,l,c,u,d,m,f,p,g=e,h=t;let w=ow(g.argument,h);switch(g.operator){case"+":return+w;case"-":return-w;case"~":return~w;case"!":return!w;default:throw`Expression evaluator does not support operator '${g.operator}''`}case"BinaryExpression":var _=e,v=t;switch(_.operator){case"&&":return ow(_.left,v)&&ow(_.right,v);case"||":return ow(_.left,v)||ow(_.right,v);case"??":return ow(_.left,v)??ow(_.right,v)}let y=ow(_.left,v),b=ow(_.right,v);switch(_.operator){case"+":return y+b;case"-":return y-b;case"*":return y*b;case"/":return y/b;case"%":return y%b;case"**":return y**b;case"==":return y==b;case"===":return y===b;case"!=":return y!=b;case"!==":return y!==b;case">":return y>b;case">=":return y>=b;case"<":return y<b;case"<=":return y<=b;case"in":return y in b;default:throw`Expression evaluator does not support operator '${_.operator}' operator`}case"ConditionalExpression":return n=e,o=t,ow(n.test,o)?ow(n.consequent,o):ow(n.alternate,o);case"CallExpression":return oj(ov(e,t));case"ArrowFunctionExpression":let x;return r=e,i=t,x=r.params?.map(e=>{if("Identifier"===e.type)return e.name;throw`Cannot handle parameter of type ${e.type}`})??[],(function(...e){if(e.length<x.length)throw`Required argument(s) ${x.slice(e.length,-1).join(", ")} were not provided`;let t=Object.fromEntries(x.reduce((t,n,o)=>{let r=e[o];return function e(t){if("string"==typeof t||"number"==typeof t||"boolean"==typeof t||"function"==typeof t||null===t||t instanceof RegExp)return!0;if("object"==typeof t){for(let n of Object.keys(t))if(!e(t[n]))return!1;return!0}if(Array.isArray(t)){for(let n of t)if(!e(n))break}return!1}(r)&&t.push([n,r]),t},[]));return ow(r.body,i.addVariables(t))}).bind(null);case"MemberExpression":return oj(oy(e,t));case"ArrayExpression":return s=e,a=t,s.elements?.map(ok(a));case"SequenceExpression":let S;return l=e,c=t,(S=l.expressions.map(ok(c)))[S.length-1];case"NewExpression":var j=e,k=t;if(j.callee&&"Identifier"===j.callee.type){let e=j.arguments?.map(ok(k));switch(j.callee.name){case"Date":return new Date(...e);case"RegExp":return new RegExp(...e);default:throw`Cannot instantiate object of type ${j.callee.name}`}}if(j.callee)throw"new must be called with either Date or RegExp";throw'Could not handle "new" without a specified class';case"Literal":return e.value;case"Identifier":return u=e,d=t,(oN(u.name),d.variables&&Object.hasOwn(d.variables,u.name))?d.variables[u.name]:Object.hasOwn(d.globals,u.name)?d.globals[u.name]:void 0;case"TemplateLiteral":let N,C;return m=e,f=t,N=m.expressions?.map(ok(f))??[],(C=m.quasis?.map(ok(f))??[]).filter(e=>!e.tail).map(e=>e.value).join("")+N.join("")+C.filter(e=>e.tail).map(e=>e.value).join("");case"TemplateElement":return{value:(p=e).cooked,tail:p.tail};default:throw`Expression evaluator does not support expression of type '${e.type}'`}}function o_(e,t){switch(e.type){case"Literal":return e.value;case"Identifier":return e.name;case"MemberExpression":return o_(e.property,t);default:throw`VisitExpressionName does not support expression of type '${e.type}'`}}function ov(e,t){let n=oS(e.callee,t);if(n===ox||e.optional&&null==n)return ox;let o=e.arguments?.map(ok(t));if(n){if("function"!=typeof n)throw`${oP(e.callee)} is not a function`}else throw`No function named ${oP(e.callee)} is defined in this context`;return n(...o)}function oy(e,t){let n=oS(e.object,t);if(n===ox||e.optional&&null==n)return ox;if(null===n)throw TypeError(`TypeError: cannot read properties of null (reading '${oE(e.property,t)}')`);if(void 0===n)switch(e.object.type){case"Identifier":{let n=o_(e.object,t);throw ReferenceError(`ReferenceError: ${n} is not defined`)}case"MemberExpression":throw TypeError(`TypeError: cannot read properties of undefined (reading '${oE(e.property,t)}')`);default:throw`VisitMemberExpression does not support operator '${e.object.type}' type`}if("object"!=typeof n&&"function"!=typeof n&&"string"!=typeof n&&"number"!=typeof n)throw`VisitMemberExpression does not support member access on type ${typeof n}`;let o=e.computed?function(e){if(void 0===e)throw{type:"Illegal property access",message:"No property was supplied to the property access"};if("string"!=typeof e&&"number"!=typeof e)throw{type:"Illegal property access",message:`Cannot use a value of type ${null===e?"null":typeof e} as a property name`};return e}(ow(e.property,t)):function(e){if("Identifier"!==e.type)throw`VisitMemberExpression does not support a property of type '${e.type}'`;return e.name}(e.property);oN(o),function(e,t){if(oC.has(String(t)))return;let n=Object(e);for(;null!==n;){if(Object.hasOwn(n,t)){if(n===Object.prototype||n===Function.prototype)throw{type:"Illegal property access",message:`Cannot access the ${t} property of objects`};return}n=Object.getPrototypeOf(n)}}(n,o);let r=n[o];return"function"==typeof r?r.bind(n):r}function ob(e,t){let n={variables:{...e},globals:{...t},addVariables(e){return this.variables={...this.variables,...e},this}};return n.addVariables.bind(n),n}n3.A.plugins.register(n4.A),n3.A.plugins.register(n9.A),n3.A.plugins.register(n7.A),n3.A.plugins.register(oe.A),n3.A.plugins.register(ot.A),n3.A.plugins.register(on.A),n3.A.addBinaryOp("in",7),n3.A.addBinaryOp("??",1);let ox=Symbol("optional chain short-circuited");function oS(e,t){switch(e.type){case"MemberExpression":return oy(e,t);case"CallExpression":return ov(e,t);default:return ow(e,t)}}function oj(e){return e===ox?void 0:e}function ok(e){return function(t){return null===t?null:ow(t,e)}}function oN(e){if("__proto__"===e||"prototype"===e||"constructor"===e)throw{type:"Illegal property access",message:`Cannot access the ${e} property of objects`}}let oC=new Set(["toString","valueOf","hasOwnProperty"]);function oE(e,t){try{return o_(e,t)}catch{return"<computed>"}}function oP(e){return e?"MemberExpression"===e.type?e.property?.name:e.name:null}function oI(e){if("string"!=typeof e&&("object"!=typeof e||!e||!("type"in e)))throw`Unknown expression type ${e}. Expressions must either be a string or pre-compiled string.`;let t={globals:{...or},boundNames:new Set,variables:new Set};return oA("string"==typeof e?(0,n3.A)(e):e,t),[...t.variables]}function oA(e,t){switch(e.type){case"UnaryExpression":return n=e,o=t,void oA(n.argument,o);case"BinaryExpression":return r=e,i=t,void(oA(r.left,i),oA(r.right,i));case"ConditionalExpression":return s=e,a=t,void(oA(s.consequent,a),oA(s.test,a),oA(s.alternate,a));case"CallExpression":return l=e,c=t,void(oA(l.callee,c),l.arguments?.map(oO(c)));case"ArrowFunctionExpression":var n,o,r,i,s,a,l,c,u,d,m,f,p,g,h,w,_,v,y,b,x=e,S=t;let j=new Set(S.boundNames);for(let e of x.params??[])e?.type==="Identifier"&&j.add(e.name);oA(x.body,{...S,boundNames:j});return;case"MemberExpression":return u=e,d=t,void(oA(u.object,d),u.computed&&oA(u.property,d));case"ArrayExpression":return m=e,f=t,void m.elements?.map(oO(f));case"SequenceExpression":return p=e,g=t,void p.expressions?.map(oO(g));case"NewExpression":return h=e,w=t,void h.arguments?.map(oO(w));case"Literal":case"TemplateElement":return;case"Identifier":return _=e,v=t,void(_.name in v.globals||v.boundNames.has(_.name)||v.variables.add(_.name));case"TemplateLiteral":return y=e,b=t,void(y.expressions?.map(oO(b)),y.quasis?.map(oO(b)));default:throw`Expression evaluator does not support expression of type '${e.type}'`}}function oO(e){return function(t){return null===t?null:oA(t,e)}}let oR=M("feature-flags",{flags:function(){let e={};for(let t of Object.keys(localStorage))if(t.startsWith("openmrs:feature-flag:")){let n=t.replace("openmrs:feature-flag:",""),o=JSON.parse(localStorage.getItem(`openmrs:feature-flag-meta:${n}`)||"{}");e[n]={enabled:"true"===localStorage.getItem(t),...o}}return e}()});function oT(e,t,n){oR.setState(o=>({flags:{...o.flags,[e]:{enabled:o.flags[e]?.enabled??!1,label:t,description:n}}}))}function o$(){let e=oR.getState().flags;Object.keys(localStorage).filter(e=>e.startsWith("openmrs:feature-flag:")).forEach(t=>{let n=t.replace("openmrs:feature-flag:","");e[n]||(localStorage.removeItem(t),localStorage.removeItem(`openmrs:feature-flag-meta:${n}`))})}function oM(e){return oR.getState().flags[e].enabled}function oL(e,t){oR.subscribe(n=>{t(n.flags[e].enabled)})}function oW(e,t){oR.setState(n=>({flags:{...n.flags,[e]:{...n.flags[e],enabled:t}}}))}oR.subscribe(e=>{for(let[t,n]of Object.entries(e.flags))localStorage.setItem(`openmrs:feature-flag:${t}`,n.enabled.toString()),localStorage.setItem(`openmrs:feature-flag-meta:${t}`,JSON.stringify({label:n.label,description:n.description}))});var oD=n(1216);let oU=R("extensionsInternal",{slots:{},extensions:{}}),oB=R("extensionRenderings",{renderings:new Map}),oF=()=>M("extensionsInternal",{slots:{},extensions:{}}),oH=()=>M("extensionRenderings",{renderings:new Map});function oV(e){let t=oU.getState(),n=e(t);n!==t&&oU.setState(n)}let oG=null,oz=null;function oq(){let e=oB.getState();return oG&&e===oz||(oG=new Map(e.renderings),oz=e,function(e){for(let t of(o5.clear(),e.values()))o8(t,1);o6=!0}(oG)),oG}function oJ(e){oz={renderings:e},oB.setState(oz,!0)}function oK(e){let t=oq();t.has(e.renderingId)||(t.set(e.renderingId,e),o8(e,1),oJ(t))}function oX(e){let t=oq(),n=t.get(e);n&&(t.delete(e),o8(n,-1),oJ(t))}let oY=()=>M("extensions",{slots:{}}),oZ=0,oQ=new Set;function o0(e){oZ++;try{return e()}finally{if(0==--oZ&&oQ.size>0){let e=Array.from(oQ);for(let t of(oQ.clear(),e))o1(t)}}}function o1(e){try{e()}catch(t){console.error(`The extension system's '${e.name}' recomputation failed`,t)}}function o2(e){oZ>0?oQ.add(e):o1(e)}let o5=new Map,o6=!1;function o8(e,t){let n=JSON.stringify([e.slotName,e.extensionId,e.slotModuleName,e.extensionModuleName]),o=o5.get(n);if(!o){if(t<0)return;o5.set(n,{count:1,record:{slotModuleName:e.slotModuleName,extensionModuleName:e.extensionModuleName,slotName:e.slotName,extensionId:e.extensionId}}),o6=!0;return}o.count+=t,o.count<1&&(o5.delete(n),o6=!0)}function o3(){var e,t;if(oq(),!o6)return;o6=!1;let n=Array.from(o5.values(),({record:e})=>e);n.sort(o4),e=et.getState().mountedExtensions,t=n,e.length===t.length&&e.every((e,n)=>0===o4(e,t[n]))||et.setState({mountedExtensions:n})}function o4(e,t){return o9(e.slotName,t.slotName)||o9(e.extensionId,t.extensionId)||o9(e.slotModuleName,t.slotModuleName)||o9(e.extensionModuleName,t.extensionModuleName)}function o9(e,t){return e===t?0:e<t?-1:1}o3(),oB.subscribe(()=>o2(o3));let o7=oF(),re=oY(),rt=eo(),rn=es(),ro=new Set,rr=!1;function ri(e){if(null===e)ro=null;else if(null!==ro)for(let t of e)ro.add(t);o2(rs)}function rs(){if(!rr){rr=!0;try{for(let e=1;;e++){let t=ro;if(null!==t&&0===t.size)return;ro=new Set;try{!function(e,t,n,o,r,i=null){let s=re.getState().slots,a={},l=!1,c=Object.entries(o.flags).filter(([,{enabled:e}])=>e).map(([e])=>e);for(let[o,u]of Object.entries(e.slots)){let d=s[o];if(d&&i&&!i.has(o)){a[o]=d;continue}let{config:m}=ei(t,u.name),f=function(e,t,n,o,r,i){let s=function(e,t){let n=e.add||[],o=e.remove||[],r=e.order||[],{extensions:i}=o7.getState(),s=new Set(o),a=[...t,...n].filter(e=>!s.has(e)),l=rh(r),c=rh(t),u=new Map(a.map(e=>[e,function(e,t,n,o){let r=t.get(e);if(void 0!==r)return r;{if(void 0!==n)return 1e3+n;let t=o.get(e);return void 0!==t?2e3+t:3e3}}(e,l,i[rc(e)]?.order,c)]));return a.sort((e,t)=>u.get(e)-u.get(t))}(n,t.slots[e].attachedIds),a=[];for(let l of s){let{config:s}=ea(o,e,l),c=el(n,e,l),u=c?(0,oD.A)({},s,c):s,d=rc(l),m=t.extensions[d];if(m){let e=u?.["Display conditions"]?.privileges??m.privileges??[];if(e&&("string"==typeof e||Array.isArray(e)&&e.length>0)&&(!i?.user||!tU(e,i.user))||m.featureFlag&&!r.includes(m.featureFlag))continue;a.push({id:l,name:d,moduleName:m.moduleName,config:u,featureFlag:m.featureFlag,meta:m.meta,displayConditionExpression:u?.["Display conditions"]?.expression||m.displayExpression})}}return a}(o,e,m,n,c,r.session);d&&d.moduleName===u.moduleName&&(0,F.A)(d.candidateExtensions,f)?a[o]=d:(a[o]={moduleName:u.moduleName,candidateExtensions:f},l=!0)}(l||Object.keys(s).length!==Object.keys(a).length)&&re.setState({slots:a})}(o7.getState(),rt.getState(),rn.getState(),oR.getState(),tA.getState(),t)}catch(e){throw ro=null===t||null===ro?null:new Set([...t,...ro]),e}if(e>=20)return void console.error("The extension system stopped recomputing after 20 passes because something keeps invalidating slots in response to the extension store being written. Some slots are left stale until the next write.")}}finally{rr=!1}}}function ra(e,t){let n=new Set;for(let o of Object.keys(e))e[o]!==t[o]&&n.add(o);for(let o of Object.keys(t))o in e||n.add(o);return n}function rl(e,t){return{moduleName:t,name:e,attachedIds:[]}}function rc(e){let[t]=e.split("#");return t}function ru(e,t){let n=rc(t);return e.extensions[n]}function rd(e){return ru(o7.getState(),e)}o7.subscribe((e,t)=>{ri(e.extensions!==t.extensions?null:ra(e.slots,t.slots))}),rt.subscribe((e,t)=>{ri(ra(e.slots,t.slots))}),rn.subscribe((e,t)=>{ri(ra(e.configs,t.configs))}),oR.subscribe(()=>ri(null)),tA.subscribe(()=>ri(null)),ri(null);let rm=e=>oV(t=>({...t,extensions:{...t.extensions,[e.name]:{...e}}}));function rf(e,t){oV(n=>{let o=n.slots[e];return o?{...n,slots:{...n.slots,[e]:{...o,attachedIds:[...o.attachedIds,t]}}}:{...n,slots:{...n.slots,[e]:{...rl(e),attachedIds:[t]}}}})}function rp(e,t){oV(n=>{let o=n.slots[e];return o&&o.attachedIds.includes(t)?{...n,slots:{...n.slots,[e]:{...o,attachedIds:o.attachedIds.filter(e=>e!==t)}}}:n})}function rg(e){oV(t=>{let n=t.slots[e];return n?{...t,slots:{...t.slots,[e]:{...n,attachedIds:[]}}}:t})}function rh(e){let t=new Map;return e.forEach((e,n)=>{t.has(e)||t.set(e,n)}),t}function rw(e,t){return function(e,t,n=null,o){let r;return e.filter(e=>{let i=e.displayConditionExpression;if("string"!=typeof i||0===i.trim().length)return!0;r??(r=t&&"object"==typeof t?{session:n,...t}:{session:n});try{return!!oa(i,r)}catch(t){return console.error(`Error while evaluating expression '${i}' for ${e.id}`+(o?` in ${o}`:""),t),!1}})}(r_(e),t,tA.getState().session,e)}function r_(e){return re.getState().slots[e]?.candidateExtensions??[]}let rv=(e,t)=>o7.setState(n=>{let o=n.slots[t]?.moduleName;if(o&&o!=e)return console.warn(`An extension slot with the name '${t}' already exists. Refusing to register the same slot name twice (in "registerExtensionSlot"). The existing one is from module ${o}.`),n;if(o&&o==e)return n;if(n.slots[t])return{...n,slots:{...n.slots,[t]:{...n.slots[t],moduleName:e}}};let r=rl(t,e);return{...n,slots:{...n.slots,[t]:{...r}}}}),ry=()=>{ro=null,oV(()=>({slots:{},extensions:{}})),oH().setState({renderings:new Map}),re.setState({slots:{}})},rb=R("left-nav",{slotName:null,basePath:window.spaBase,mode:"normal"});function rx({name:e,basePath:t,mode:n,componentContext:o,state:r}){rb.setState({slotName:e,basePath:t,mode:n??"normal",componentContext:o,state:r})}function rS(e){rb.getState().slotName===e&&rb.setState(rb.getInitialState(),!0)}let rj=R("modalRegistry",{modals:{}});function rk(e){rj.setState(t=>(t.modals[e.name]=e,t))}function rN(e){let t=rj.getState().modals[e];if(!t){let n=rd(e);n&&(t={name:e,load:n.load,moduleName:n.moduleName},console.warn(`Modal ${e} was registered as an extension. This is deprecated and will be removed in the future. Please register it in the "modals" section of routes.json instead of the "extensions" section.`),rk(t))}return t}let rC=R("workspace2",{registeredGroupsByName:{},registeredWindowsByName:{},registeredWorkspacesByName:{},openedGroup:null,openedWindows:[],isMostRecentlyOpenedWindowHidden:!1});function rE(e){let{registeredWorkspacesByName:t,registeredWindowsByName:n}=rC.getState(),o=t[e];if(o){let t=n[o.window];if(t)return t;throw Error(`No workspace window found with name: ${o.window} for workspace: ${e}`)}throw Error(`No workspace found with name: ${e}`)}function rP(e){let{registeredGroupsByName:t,registeredWindowsByName:n}=rC.getState(),o=n[e];if(o){let n=t[o.group];if(n)return n;throw Error(`No workspace group found with name: ${o.group} for window: ${e}`)}throw Error(`No workspace window found with name: ${e}`)}function rI(e){let{openedWindows:t}=rC.getState();return t.findIndex(t=>t.openedWorkspaces.find(t=>t.workspaceName===e))}function rA(e,t){if(0==t.length)return;let{registeredGroupsByName:n}=rC.getState(),o={...n};for(let n of t){if(o[n.name])throw Error(`Cannot register workspace group ${n.name} more than once`);o[n.name]={...n,moduleName:e}}rC.setState({registeredGroupsByName:o})}function rO(e,t){if(0==t.length)return;let{registeredWindowsByName:n}=rC.getState(),o={...n};for(let n of t){if(o[n.name])throw Error(`Cannot register workspace window ${n.name} more than once`);let t={...n,moduleName:e};o[n.name]=t}rC.setState({registeredWindowsByName:o})}function rR(e,t){if(0==t.length)return;let{registeredWorkspacesByName:n}=rC.getState(),o={...n};for(let n of t){if(o[n.name])throw Error(`Cannot register workspace ${n.name} more than once`);let t={...n,moduleName:e};o[n.name]=t}rC.setState({registeredWorkspacesByName:o})}let rT=0,r$=null,rM={bootstrap:15e3,mount:15e3,unmount:15e3};function rL(e,t){if(e.timeouts)return e;let n=e.name??"parcel",o=Object.fromEntries(Object.keys(rM).filter(t=>e[t]).map(o=>{var r,i;let s,a;return[o,(r=e[o],i=rM[o],s=Array.isArray(r)?r:[r],a=e=>s.reduce((t,r,i)=>t.then(()=>{let t=r(e);return"function"==typeof t?.then&&"function"==typeof t?.catch?t:Promise.reject(Error(`Lifecycle function ${o} at array index ${i} for parcel ${n} did not return a promise`))}),Promise.resolve(void 0)),e=>{let r,s=new Promise((e,t)=>{r=setTimeout(()=>t(Error(`Lifecycle function ${o} for parcel ${n} did not settle within ${i}ms`)),i)});return Promise.race([a(e),s]).finally(()=>clearTimeout(r)).then(e=>(t(o,!1),e),e=>{throw t(o,!0),e})})]}));return{...e,...o}}async function rW(e,t){var n,o;let r,i,s,a,l,c=await (r$??(r$=new Promise((e,t)=>{(0,ta.xL)({name:"openmrs-extension-host",bootstrap:()=>Promise.resolve(),mount:t=>(e(t.mountParcel),Promise.resolve()),unmount:()=>Promise.resolve()},{domElement:document.createElement("div")}).mountPromise.catch(t)}).catch(e=>(console.error("The host parcel used to mount extensions could not be mounted. Falling back to mounting extensions as root parcels, which leaks their DOM elements.",e),ta.xL))),r$),u={...t},d=(r=u,i=!1,{retarget:e=>r={...e},release:s=()=>(function(e){for(let t of Object.keys(e))delete e[t]})(r),onSettled(e,t){switch(e){case"bootstrap":t&&s();return;case"mount":i||(i=t);return;case"unmount":(t||i)&&s();return}}});return o=c((n=d.onSettled,"function"==typeof e?()=>e().then(e=>rL(e,n)):rL(e,n)),u),a=e=>t=>e.call(o,d.retarget(t)).catch(e=>{throw"SKIP_BECAUSE_BROKEN"===o.getStatus()&&d.release(),e}),l=o.update&&a(o.update),Object.defineProperty(o,"update",{configurable:!0,enumerable:!0,get:()=>l,set:e=>{l=e&&a(e)}})}function rD(){return rU}function rU(e,t){let n,o=rW(e,t).then(e=>n=e);return{mount:()=>o.then(e=>e.mount()),unmount:()=>o.then(e=>e.unmount()),update:e=>o.then(t=>t.update?.(e)),getStatus:()=>n?.getStatus()??"LOADING_SOURCE_CODE",get loadPromise(){return o.then(e=>e.loadPromise)},get bootstrapPromise(){return o.then(e=>e.bootstrapPromise)},get mountPromise(){return o.then(e=>e.mountPromise)},get unmountPromise(){return o.then(e=>e.unmountPromise)}}}async function rB(e,t,n,o,r=e=>e,i={}){let s=rc(o),a=rd(o),l=null;if(e){let c;if(!a)throw Error(`Couldn't find extension '${s}' to attach to '${t}'`);let{meta:u,moduleName:d,load:m}=a,f=rT++,p=`${t}/${o}-${f}`;e.dataset.extensionRenderingId=p;let g=e=>{try{oX(p)}catch(t){console.error(e,t)}};try{oK({renderingId:p,extensionName:s,extensionModuleName:d,extensionId:o,slotName:t,slotModuleName:n})}catch(e){throw g(`Recomputing configuration after registering '${o}' failed also failed`),e}try{c=await m()}catch(e){throw g(`Recomputing configuration after '${o}' failed to load also failed`),e}try{l=await rW(r({...c,name:`${t}/${s}-${f}`}),{...i,_meta:u,_extensionContext:{extensionId:o,extensionSlotName:t,extensionSlotModuleName:n,extensionModuleName:d,extensionMeta:u},domElement:e})}catch(e){throw g(`Recomputing configuration after '${o}' failed to mount also failed`),e}l.mountPromise.then(void 0,e=>{console.error(`Extension '${o}' in slot '${t}' failed to mount`,e),g(`Recomputing configuration after '${o}' failed to mount also failed`)}),l.unmountPromise.then(()=>g(`Recomputing configuration after unmounting '${o}' failed`),e=>{console.error(`Extension '${o}' in slot '${t}' failed to unmount`,e),g(`Recomputing configuration after '${o}' failed to unmount also failed`)})}else console.warn(`Tried to render ${o} into ${t} but no DOM element was available.`);return l}var rF=n(6925),rH=n.n(rF);let rV=(0,rF.createContext)({moduleName:"",featureName:""});var rG=n(5140);function rz({to:e,templateParams:t,onBeforeNavigate:n,children:o,...r}){return(0,rF.useEffect)(()=>{r.href&&console.warn(`ConfigurableLink does not support the href prop. Use the 'to' prop instead. The provided href value is '${r.href}'`),r.onClick&&console.warn(`ConfigurableLink does not support the onClick prop. Use the 'onBeforeNavigate' prop instead. The 'to' prop of the offending link is ${e}`)},[]),(0,rG.jsx)("a",{onClick:o=>{0===o.button&&!o.ctrlKey&&!o.shiftKey&&!o.altKey&&!o.metaKey&&(o.preventDefault(),n?.(o),tg({to:e,templateParams:t})),0===o.button&&(o.ctrlKey||o.metaKey)&&n?.(o),0===o.button&&o.shiftKey&&n?.(o),1===o.button&&n?.(o)},href:tf(e,t),...r,children:o})}let rq=({state:e,children:t,...n})=>{let{extension:o}=(0,rF.useContext)(rV),r=(0,rF.useRef)(null),i=(0,rF.useRef)(Promise.resolve()),s=(0,rF.useRef)(!1),a=(0,rF.useRef)(!1),l=(0,rF.useRef)(e),c=(0,rF.useCallback)(e=>{if(!e)return;let t=()=>{"MOUNTED"===e.getStatus()&&e.unmount()};switch(e.getStatus()){case"MOUNTED":e.unmount();break;case"UPDATING":i.current?.then(t,t);break;default:e.mountPromise.then(t,()=>{})}},[]),u=(0,rF.useCallback)((e,t)=>{e.update&&"UNMOUNTING"!==e.getStatus()&&(i.current=Promise.all([e.mountPromise,i.current]).then(()=>{if(r.current?.getStatus()==="MOUNTED"&&r.current.update)return r.current.update({...t})}).catch(e=>{let t=r.current?.getStatus();"UNMOUNTING"!==t&&"NOT_MOUNTED"!==t&&"UNLOADING"!==t&&console.error(`The extension '${o?.extensionId}' failed to update`,e)}))},[]),d=(0,rF.useCallback)(t=>{t&&!r.current&&!a.current&&o?.extensionSlotName&&o.extensionSlotModuleName&&(a.current=!0,rB(t,o.extensionSlotName,o.extensionSlotModuleName,o.extensionId,void 0,e).then(t=>{(a.current=!1,r.current=t,s.current)?c(t):t&&l.current!==e&&u(t,l.current)},()=>{a.current=!1}))},[]);return(0,rF.useEffect)(()=>(s.current=!1,()=>{s.current=!0,c(r.current)}),[]),(0,rF.useEffect)(()=>{l.current=e,r.current&&u(r.current,e)},[e]),o?(0,rG.jsx)("div",{ref:d,"data-extension-id":o?.extensionId,style:{position:"relative"},...n}):null};function rJ(e){let t=(0,rF.useRef)(e);return x(t.current,e)||(t.current=e),t.current}function rK(e,t){"function"==typeof t&&(t=t(e));let n={};for(let[o,r]of Object.entries(t)){let t=function(...t){e.setState(e=>r(e,...t))};n[o]=t}return n}let rX=e=>e;function rY(e,t=rX,n){let o=(0,rF.useCallback)(t=>e.subscribe(t),[e]),r=(0,rF.useCallback)(()=>t(e.getState()),[e,t]),i=(0,rF.useSyncExternalStore)(o,r,r),s=(0,rF.useMemo)(()=>n?rK(e,n):null,[e,n]);return(0,rF.useMemo)(()=>s?{...i,...s}:i,[i,s])}function rZ(e,t){return rY(e,rX,t)}function rQ(e){return function(t){let n=(0,rF.useCallback)(t=>e.subscribe(t),[]),o=(0,rF.useCallback)(()=>e.getState(),[]),r=(0,rF.useSyncExternalStore)(n,o,o),i=(0,rF.useMemo)(()=>t?rK(e,t):null,[t]);return(0,rF.useMemo)(()=>i?{...r,...i}:r,[r,i])}}let r0=[];Object.freeze(r0);let r1={candidateExtensions:r0};Object.freeze(r1);let r2=e=>{let t=(0,rF.useCallback)(t=>t.slots?.[e]??r1,[e]);return rY(oY(),t)},r5=e=>e.session;function r6(e,t){let{candidateExtensions:n}=r2(e),o=rY(tA,r5),r=rJ(t);return(0,rF.useMemo)(()=>rw(e,r),[e,r,o,n])}function r8(e,t){let{moduleName:n}=(0,rF.useContext)(rV);if(!n)throw Error("ComponentContext has not been provided. This should come from @openmrs/esm-react-utils.");return(0,rF.useEffect)(()=>{rv(n,e)},[n,e]),{extensions:r6(e,t),extensionSlotName:e,extensionSlotModuleName:n}}function r3(e){return e}function r4({name:e,extensionSlotName:t,select:n=r3,children:o,state:r,style:i,...s}){if(o&&r)throw Error("Both children and state have been provided. If children are provided, the state must be passed as a prop to the `Extension` component.");let a=e??t,l=(0,rF.useRef)(null),{extensions:c,extensionSlotModuleName:u}=r8(a,r),d=(0,rF.useMemo)(()=>n(c),[n,c]),m=(0,rF.useMemo)(()=>{if("function"==typeof o&&!rH().isValidElement(o))return d.map(e=>o(e,r))},[o,d]);return(0,rG.jsx)("div",{ref:l,"data-extension-slot-name":a,"data-extension-slot-module-name":u,style:{...i,position:"relative"},...s,children:a&&d?.map((e,t)=>(0,rG.jsx)(rV.Provider,{value:{moduleName:u,featureName:"",extension:{extensionId:e.id,extensionSlotName:a,extensionSlotModuleName:u,extensionMeta:e.meta}},children:m?.[t]??("function"!=typeof o?o:null)??(0,rG.jsx)(rq,{state:r})},e.id))})}var r9=n(2852),r7=n.n(r9),ie=n(9568),it=n(9737),io=n(2324),ir=n(242);let ii={strictMode:!0,throwErrorsToConsole:!0,disableTranslations:!1},is=new Map;(0,ir.y)(is);let ia={errorRetryCount:3,fetcher:tP,focusThrottleInterval:18e5,revalidateIfStale:!0,revalidateOnFocus:!1,revalidateOnReconnect:!1,refreshInterval:0,shouldRetryOnError:e=>{if(e instanceof tI){let t=e.response.status;return!!(t>=500)||401===t||403===t||429===t}return!0},provider:()=>is};function il(e){if("object"!=typeof e||"string"!=typeof e.featureName||"string"!=typeof e.moduleName)throw Error("Invalid options");let t=Object.assign({},ii,e),n={...ia,...t.swrConfig};return function(e){var o,r,i,s,a;return i=r=class extends(o=rH().Component){componentDidCatch(e,n){n&&n.componentStack&&(e.extra=Object.assign(e.extra||{},{componentStack:n.componentStack})),t.throwErrorsToConsole&&setTimeout(()=>{throw e}),this.setState({caughtError:e,caughtErrorInfo:n})}render(){if(this.state.caughtError)return(0,rG.jsx)("div",{children:"An error has occurred. Please try reloading the page."});{let o=(0,rG.jsx)(rF.Suspense,{fallback:null,children:(0,rG.jsx)(io.S,{value:n,children:(0,rG.jsx)(rV.Provider,{value:this.state.config,children:t.disableTranslations?(0,rG.jsx)(e,{...this.props}):(0,rG.jsx)(it.I18nextProvider,{i18n:window.i18next,defaultNS:this.state.config.extension?`${this.state.config.moduleName}___${this.state.config.extension.extensionSlotName}___${this.state.config.extension.extensionId}`:this.state.config.moduleName,children:(0,rG.jsx)(e,{...this.props})})})})});return t.strictMode&&rH().StrictMode?(0,rG.jsx)(rH().StrictMode,{children:o}):o}}constructor(e){super(e),this.state={caughtError:null,caughtErrorInfo:null,config:{moduleName:t.moduleName,featureName:t.featureName,extension:e._extensionContext}}}},s="displayName",a=`OpenmrsReactComponent(${t.featureName})`,s in i?Object.defineProperty(i,s,{value:a,enumerable:!0,configurable:!0,writable:!0}):i[s]=a,r}}function ic(e,t){return(0,ie.A)({React:rH(),ReactDOMClient:r7(),rootComponent:il(t)(e)})}function iu(e,t){return()=>e().then(({default:e})=>ic(e,t))}function id(e,t){return()=>Promise.resolve(ic(e,t))}let im=iu,ip=(0,C.y)()(()=>({}));$("openmrs-app-context",ip);let ig={};function ih(e,t=e=>e){let n=ip.getState();return e in n?Object.freeze(Object.assign({},t?t(n[e]):n[e])):null}function iw(e,t){ip.setState(n=>(e in n||(n[e]={}),n[e]=t(n[e]),Object.assign({},n)))}function i_(e){return null===e?null:Object.freeze(Object.assign({},e))}let iv=new Map;function iy(e,t){let n=(0,rF.useRef)(t??{}),o=(0,rF.useRef)(t=>iw(e,t)),r=(0,rF.useRef)(Symbol());return(0,rF.useEffect)(()=>{let n=t??{},o=r.current;return null===ih(e)?!function(e,t=ig){ip.setState(n=>{if(e in n)throw Error(`Attempted to re-register namespace ${e} in the app context. Each namespace must be unregistered before the name can be registered again.`);return Object.assign({},n,{[e]:t===ig?{}:t})})}(e,n):(console.warn(`Namespace ${e} is already registered in the app context. This is likely a race condition during navigation, but may indicate two components are trying to own the same namespace. Updating the existing context.`),iw(e,()=>n)),iv.set(e,o),()=>{iv.get(e)===o&&(ip.setState(t=>(e in t&&delete t[e],t)),iv.delete(e))}},[e]),(0,rF.useEffect)(()=>{let o=t??{};x(n.current,o)||(iw(e,()=>o),n.current=o)},[t]),o.current}function ib({namespace:e,value:t}){return iy(e,t),null}let ix=({children:e,value:t,fallback:n})=>t?(0,rG.jsx)(rG.Fragment,{children:e}):n?(0,rG.jsx)(rG.Fragment,{children:n}):null;function iS(){let e=(0,rF.useRef)();return(!e.current||e.current.signal.aborted)&&(e.current=new AbortController),(0,rF.useEffect)(()=>{let t=e.current;return()=>t?.abort()},[]),e.current}function ij(e,t=e=>e??{}){let[n,o]=(0,rF.useState)(()=>{if(ik(e))return;let n=ih(e);if(null!==n)return t?t(n):n});return(0,rF.useEffect)(()=>{if(ik(e))throw Error(`The namespace supplied to useAppContext must be a non-empty string, but was "${e}".`)},[e]),(0,rF.useEffect)(()=>{var n;let r;return(n=e=>{if(null==e)return void o(void 0);let n=t?t(e):e;o(e=>x(e,n)?e:n)})(i_(r=ih(e))),ip.subscribe(t=>{let o=e in t?t[e]:null;o!==r&&(r=o,n(i_(o)))})},[e,t]),n}function ik(e){return"string"!=typeof e||0===e.trim().length}function iN(e){let t=r6(e);return(0,rF.useMemo)(()=>t.map(e=>e.id),[t])}function iC(e){return r2(e).candidateExtensions}function iE(e,t,n){let{data:o,error:r,mutate:i,isLoading:s,isValidating:a}=(0,io.u)(e?nU(e,t,n):null,tP);return(0,rF.useMemo)(()=>({isLoading:s,data:o?.data.results??[],error:r,mutate:i,isValidating:a}),[o,r,s,a,i])}function iP(e){(0,rF.useEffect)(()=>{if(e){let e=window.getComputedStyle(document.body).overflow;return document.body.style.overflow="hidden",()=>{document.body.style.overflow=e}}},[e])}let iI={},iA=`No ComponentContext has been provided. This should come from "openmrsComponentDecorator".
|
|
16
|
+
Usually this is already applied when using "getAsyncLifecycle" or "getSyncLifecycle".`;function iO(e,t,n){let o=iI[e];if(o)return o;let r=new Promise(e=>{let o=n(t.getState());if(o)return void e(o);let r=t.subscribe(t=>{let o=n(t);o&&(r(),e(o))})});return iI[e]=r,r.then(()=>{iI[e]===r&&delete iI[e]}),r}function iR(e){let{moduleName:t,extension:n}=(0,rF.useContext)(rV),o=e?.externalModuleName??t;if(!o&&!n)throw Error(iA);let r=function(e){let t=(0,rF.useMemo)(()=>en(e),[e]),n=function(e){let[t,n]=(0,rF.useState)(()=>{let t=e.getState();return t.loaded&&t.config?t.config:null});return(0,rF.useEffect)(()=>e?.subscribe(e=>{e.loaded&&e.config&&n(e.config)}),[e]),t}(t);if(!n)throw iO(e,t,e=>e.loaded?e.config:null);return n}(o),i=function(e){let t=(0,rF.useMemo)(es,[]),n=function(e,t){let[n,o]=(0,rF.useState)(t?()=>{let n=ea(e.getState(),t.extensionSlotName,t.extensionId);if(n.loaded&&n.config)return n.config}:null);return(0,rF.useEffect)(()=>{if(t)return e.subscribe(e=>{let r=ea(e,t.extensionSlotName,t.extensionId);r.loaded&&r.config&&!(0,F.A)(r.config,n)&&o(r.config)})},[e,t,n]),n}(t,e);if(!n&&e)throw iO(`${e.extensionSlotName}-${e.extensionId}`,t,t=>{let n=ea(t,e.extensionSlotName,e.extensionId);return n.loaded?n.config:null});return n||{}}(n);return(0,rF.useMemo)(()=>e?.externalModuleName&&o===e.externalModuleName?{...r}:{...r,...i},[o,e?.externalModuleName,r,i])}let iT=r6;function i$(e,t=300){let[n,o]=(0,rF.useState)(e);return(0,rF.useEffect)(()=>{let n=setTimeout(()=>{o(e)},t);return()=>{clearTimeout(n)}},[e,t]),n}var iM=n(6269);let iL=`custom:${[["admissionDecisionConcept","ref"],["admissionEncounterType","ref"],["admissionForm","ref"],["atFacilityVisitType","ref"],["bedAssignmentEncounterType","ref"],["cancelADTRequestEncounterType","ref"],["checkInClerkEncounterRole","ref"],["checkInEncounterType","ref"],["clinicianEncounterRole","ref"],["conceptSourcesForDiagnosisSearch","ref"],["consultEncounterType","ref"],["consultFreeTextCommentsConcept","ref"],["denyAdmissionConcept","ref"],["diagnosisMetadata","ref"],["diagnosisSets","ref"],["dischargeForm","ref"],["dispositionDescriptor","ref"],["dispositions","ref"],["emrApiConceptSource","ref"],["exitFromInpatientEncounterType","ref"],["extraPatientIdentifierTypes","ref"],["fullPrivilegeLevel","ref"],["highPrivilegeLevel","ref"],["identifierTypesToSearch","ref"],["inpatientNoteEncounterType","ref"],["lastViewedPatientSizeLimit","ref"],["metadataSourceName","ref"],["motherChildRelationshipType","ref"],["narrowerThanConceptMapType","ref"],["nonDiagnosisConceptSets","ref"],["orderingProviderEncounterRole","ref"],["patientDiedConcept","ref"],["personImageDirectory","ref"],["primaryIdentifierType","ref"],["sameAsConceptMapType","ref"],["suppressedDiagnosisConcepts","ref"],["supportsAdmissionLocationTag","(uuid,display,name,links)"],["supportsLoginLocationTag","(uuid,display,name,links)"],["supportsTransferLocationTag","(uuid,display,name,links)"],["supportsVisitsLocationTag","(uuid,display,name,links)"],["telephoneAttributeType","ref"],["testPatientPersonAttributeType","ref"],["transferForm","ref"],["transferRequestEncounterType","ref"],["transferWithinHospitalEncounterType","ref"],["unknownCauseOfDeathConcept","ref"],["unknownLocation","ref"],["unknownPatientPersonAttributeType","ref"],["unknownProvider","ref"],["visitAssignmentHandlerAdjustEncounterTimeOfDayIfNecessary","ref"],["visitExpireHours","ref"],["visitNoteEncounterType","ref"]].map(([e,t])=>`${e}:${t}`).join(",")}`;function iW(){let e=`${tk}/emrapi/configuration?v=${iL}`,t=(0,iM.A)(e,tP);return(0,rF.useMemo)(()=>({emrConfiguration:t.data?.data,isLoadingEmrConfiguration:t.isLoading,mutateEmrConfiguration:t.mutate,errorFetchingEmrConfiguration:t.error}),[t])}function iD(){return(0,rF.useContext)(rV).extension}let iU=rQ(oF());function iB(e){let t=r6(e);return(0,rF.useMemo)(()=>Object.fromEntries(t.map(e=>[e.name,e.meta])),[t])}let iF=rQ(oY());function iH(e){let{flags:t}=rY(oR);return t[e]?.enabled??!1}function iV(){let[,e]=(0,rF.useState)(0);return(0,rF.useCallback)(()=>{e(e=>e+1)},[])}function iG(e,t,n={}){return iq(e,t,iz,n)}let iz={getPaginatedUrl:(e,t,n)=>{if(!e)return null;{let o=new URL(tE(e.toString()),window.location.toString());return o.searchParams.set("limit",""+t),o.searchParams.set("startIndex",""+n),o.searchParams.set("totalCount","true"),o.toString()}},getNextUrl:e=>{let t=e?.links?.find(e=>"next"==e.rel)?.uri;if(!t)return null;{let e=new URL(t);return e.host=window.location.host,e.protocol=window.location.protocol,e.toString()}},getTotalCount:e=>e?.totalCount??NaN,getCurrentPageSize:e=>e?.results?.length??NaN,getData:e=>e?.results};function iq(e,t,n,o={}){let{getPaginatedUrl:r,getTotalCount:i,getCurrentPageSize:s,getData:a}=n,{immutable:l,swrConfig:c}=o,u=o.fetcher??tP,[d,m]=(0,rF.useState)(1),f=(0,rF.useRef)(NaN),p=(0,rF.useRef)(NaN),g=(0,rF.useRef)(d),h=(0,rF.useRef)(!1),w=(0,rF.useRef)(!1),_=e?.toString()??"",[v,y]=(0,rF.useState)(_);_!==v&&(y(_),m(1),g.current=1,f.current=NaN,p.current=NaN,h.current=!1,w.current=!1);let b=(d-1)*t,x=(0,rF.useMemo)(()=>r(e,t,b),[e,t,b]),{data:S,...j}=(l?iM.A:io.u)(x,u,c);S?.data&&(f.current=i(S?.data),p.current=s(S?.data),h.current=!0);let k=Math.ceil(f.current/t),N=(0,rF.useCallback)(e=>{if(!Number.isInteger(e)||e<1)return void console.warn(`useServerPagination: ignoring goTo(${e}); page must be a positive integer.`);let n=Math.ceil(f.current/t);!h.current||Number.isNaN(n)||e<=n?(g.current=e,m(e)):console.warn("Invalid attempt to go to out of bounds page: "+e)},[t]);(0,rF.useEffect)(()=>{if(!h.current)return;if(Number.isNaN(f.current)){w.current||(w.current=!0,console.warn(`useServerPagination: ${_} returned no total count, so out-of-range pages cannot be detected.`));return}let e=Math.max(1,Math.ceil(f.current/t));d>e&&(console.warn(`Invalid attempt to go to out of bounds page: ${d}; returning to page ${e}.`),g.current=e,m(e))},[d,t,_,S]);let C=(0,rF.useCallback)(()=>{N(g.current+1)},[N]),E=(0,rF.useCallback)(()=>{N(g.current-1)},[N]);return{data:a(S?.data),totalPages:k,totalCount:f.current,currentPage:d,currentPageSize:p.current,paginated:k>1,showNextButton:d<k,showPreviousButton:d>1,goTo:N,goToNext:C,goToPrevious:E,...j}}function iJ(e,t,n={}){return iq(e,t,iK(),n)}function iK(){return{getPaginatedUrl:(e,t,n)=>{if(!e)return null;{let o=new URL(tE(e.toString()),window.location.toString());return o.searchParams.set("_count",""+t),o.searchParams.set("_getpagesoffset",""+n),o.toString()}},getNextUrl:e=>{let t=e?.link?.find(e=>"next"==e.relation)?.url;if(!t)return null;{let e=new URL(t);return e.host=window.location.host,e.protocol=window.location.protocol,e.toString()}},getTotalCount:e=>e?.total??NaN,getCurrentPageSize:e=>e?.entry?.length??NaN,getData:e=>e?.entry?.map(e=>e.resource)}}var iX=n(3709);function iY(e,t={}){return iZ(e,iz,t)}function iZ(e,t,n={}){let{swrInfiniteConfig:o,immutable:r}=n,{getNextUrl:i,getTotalCount:s,getData:a}=t,l=n.fetcher??tP,c=(0,rF.useCallback)((n,o)=>0==n?e?.toString()??null:t.getNextUrl(o.data),[e]),{data:u,size:d,setSize:m,...f}=(0,iX.Ay)(c,l,{...o,...r?{revalidateIfStale:!1,revalidateOnFocus:!1,revalidateOnReconnect:!1}:{}}),p=i(u?.[u.length-1].data),g=s(u?.[0]?.data);return{data:u?.flatMap(e=>a(e.data)),totalCount:g,hasMore:null!=p,loadMore:()=>{m((u?.length??0)+1)},nextUri:p,...f}}function iQ(e,t={}){return i0(e,iz,t)}function i0(e,t,n={}){let o=iZ(e,t,n),{hasMore:r,error:i,data:s,loadMore:a,isLoading:l,nextUri:c}=o;return((0,rF.useEffect)(()=>{r&&!i&&a()},[r,c]),n.partialData)?o:{...o,data:r||i?void 0:s,isLoading:l||r}}function i1(e,t={}){return i0(e,iK(),t)}function i2(e,t={}){return iZ(e,iK(),t)}function i5(){let e="tablet";return document.body.classList.forEach(t=>{switch(t){case"omrs-breakpoint-lt-tablet":e="phone";break;case"omrs-breakpoint-gt-small-desktop":e="large-desktop";break;case"omrs-breakpoint-gt-tablet":e="small-desktop"}}),e}function i6(){let[e,t]=(0,rF.useState)(i5);return(0,rF.useEffect)(()=>{let e=()=>{t(i5())};return window.addEventListener("resize",e),()=>window.removeEventListener("resize",e)},[]),e}let i8=e=>"small-desktop"===e||"large-desktop"===e;function i3(e){let t=(0,rF.useContext)(rV);(0,rF.useEffect)(()=>(t&&t.moduleName&&(e.componentContext=t),rx(e),()=>{rS(e.name)}),[t,e])}function i4(){return rY(rb)}let i9=[];function i7(e=null,t=null){let n=new URLSearchParams;e&&n.set("tag",e),t&&n.set("q",t);let o=n.toString(),{data:r}=iQ(`${tk}/location${o?"?"+o:""}`,{immutable:!0});return r??i9}function se(e,t=!0){let n=(0,rF.useRef)(null);return(0,rF.useEffect)(()=>{let o=o=>{t&&n.current&&o.target&&o.target instanceof Node&&(n.current.contains(o.target)||e(o))};return window.addEventListener("mousedown",o),window.addEventListener("touchstart",o),()=>{window.removeEventListener("mousedown",o),window.removeEventListener("touchstart",o)}},[e,t]),n}function st(e){let t=(0,rF.useRef)();return(0,rF.useEffect)(()=>{let n=new IntersectionObserver(t=>{for(let n of t)if(n.isIntersecting)return void e()},{threshold:1});return t.current&&n.observe(t.current),()=>{t.current&&n.unobserve(t.current)}},[t.current,e]),t}function sn(e,t={}){let{abortController:n,fetchInit:o,url:r,swrConfig:i}=t,s=iS(),a=(0,rF.useMemo)(()=>o?.signal??n?.signal??s.signal,[n?.signal,o?.signal,s.signal]),l=(0,rF.useCallback)(e=>tP(function(e,t){if(t)return"function"==typeof t?t(e):t;if("string"==typeof e)return e;throw Error(`When using useOpenmrsSWR with a key that is not a string, you must provide a url() function that converts the key to a valid url. The key for this hook is ${e}.`)}(e,r),{...o,signal:a}),[a,o,r]);return(0,io.u)(e,l,i)}function so(e=[],t=10){let[n,o]=(0,rF.useState)(1),r=(0,rF.useMemo)(()=>"number"==typeof t&&t>0?Math.max(1,Math.ceil(e.length/t)):1,[e.length,t]);n>r&&o(r);let i=Math.min(Math.max(1,n),r),s=(0,rF.useMemo)(()=>{let n=(i-1)*t,o=(i+0)*t;return e.slice(n,o)},[e,i,t]),a=(0,rF.useCallback)(e=>{!Number.isInteger(e)||e<1?console.warn(`usePagination: ignoring goTo(${e}); page must be a positive integer.`):o(e)},[]),l=(0,rF.useCallback)(()=>{o(e=>e+1)},[]),c=(0,rF.useCallback)(()=>{o(e=>Math.max(1,e-1))},[]);return(0,rF.useMemo)(()=>({results:s,totalPages:r,currentPage:i,paginated:e.length>t,showNextButton:i<r,showPreviousButton:i>1,goTo:a,goToNext:l,goToPrevious:c}),[s,r,e.length,t,i,a,l,c])}function sr(e,t,n,o){return{pageSizes:(0,rF.useMemo)(()=>{let n=Math.ceil(t/e);return isNaN(n)&&(n=0),[...Array(n).keys()].map(t=>(t+1)*e)},[e,t]),pageItemsCount:(0,rF.useMemo)(()=>e>t?t:e*n>t?e*(n-1)+o:e*n,[e,t,n,o])}}function si(){let e=/\/patient\/([a-zA-Z0-9\-]+)\/?/.exec(location.pathname);return e&&e[1]}function ss(e){let[t,n]=(0,rF.useState)(e??si()),{data:o,error:r,isValidating:i}=(0,io.u)(t?["patient",t]:null,()=>nH(t,{}));return(0,rF.useEffect)(()=>{let e=()=>{let e=si();e!==t&&n(e)};return window.addEventListener("single-spa:routing-event",e),()=>window.removeEventListener("single-spa:routing-event",e)},[t]),(0,rF.useMemo)(()=>({isLoading:i&&!r&&!o,patient:o,patientUuid:t,error:r}),[i,r,o,t])}function sa(){let e=`${tk}/metadatamapping/termmapping?v=custom:(metadataUuid)&code=emr.primaryIdentifierType`,{data:t,error:n,isLoading:o}=(0,io.u)(e,tP);return(0,rF.useMemo)(()=>({primaryIdentifierCode:t?.data?.results[0]?.metadataUuid,isLoading:o,error:n}),[t,n,o])}function sl(e){let{extensions:t,extensionSlotModuleName:n}=r8(e);return e?t.map(t=>({state:o})=>(0,rG.jsx)(rV.Provider,{value:{moduleName:n,featureName:"",extension:{extensionId:t.id,extensionSlotName:e,extensionSlotModuleName:n,extensionMeta:t.meta}},children:(0,rG.jsx)(rq,{state:o})})):[]}function sc(){let e=(0,rF.useRef)(),[t,n]=(0,rF.useState)(null),o=null;if(!t){if(i){let e=tM().getState();e.loaded&&(o=e.session)}else i=new Promise(t=>{let n=({loaded:n,session:r})=>{n&&(t(r),o=r,e.current&&(e.current(),e.current=void 0))};n(tM().getState()),o||(e.current=tM().subscribe(n))});if(o)n(o);else throw i}(0,rF.useEffect)(()=>(e.current||(e.current=tM().subscribe(({loaded:e,session:t})=>{e&&(o=t,n(t))})),()=>{e.current&&(e.current(),e.current=void 0)}),[]);let r=t||o;if(!r)if(i)throw console.warn("useSession is in an unexpected state. Attempting to recover."),i;else throw Error("useSession is in an invalid state.");return r}let su=({privilege:e,fallback:t,children:n})=>{let[o,r]=(0,rF.useState)(null);return((0,rF.useEffect)(()=>{let e=tM(),t=e.subscribe(({loaded:e,session:t})=>{r(e?t?.user??null:null)}),{loaded:n,session:o}=e.getState();return n&&r(o?.user??null),t},[]),o&&tU(e,o))?(0,rG.jsx)(rG.Fragment,{children:n}):t?(0,rG.jsx)(rG.Fragment,{children:t}):null};var sd=n(4343),sm=n.n(sd),sf=n(3355);let sp=new Map;function sg(){for(let e of Array.from(sp.values()))e()}let sh={setVisitContext:(e,t)=>null==t?{manuallySetVisitUuid:null}:{manuallySetVisitUuid:t.uuid,patientUuid:t.patient?.uuid}};function sw(e){let t=(0,rF.useId)();return(0,rF.useEffect)(()=>{if(e)return sp.set(t,e),()=>{sp.delete(t)}},[t,e]),{...rZ(n1(),sh),mutateVisit:sg}}function s_(e,t=nQ){let n=(0,rF.useRef)(void 0),{patientUuid:o,manuallySetVisitUuid:r,setVisitContext:i}=sw((0,rF.useCallback)(()=>n.current?.(),[])),s=e&&o==e?r:null,a=`?patient=${e}&v=${t}&includeInactive=false`,l=`/${s}?v=${t}`,{data:c,error:u,mutate:d,isValidating:m}=(0,io.u)(e?`${tk}/visit${a}`:null,tP),{data:f,error:p,mutate:g,isValidating:h}=(0,io.u)(e&&s?`${tk}/visit${l}`:null,tP),w=(0,rF.useMemo)(()=>c?.data.results.find(e=>null===e.stopDatetime)??null,[c]),_=(0,rF.useMemo)(()=>s&&f?f.data:null,[f,s]),v=(0,rF.useRef)(null);(0,rF.useEffect)(()=>{!m&&w&&o===e&&null===r&&i(w),h||(v.current&&_&&v.current.uuid===_.uuid&&!v.current.stopDatetime&&_.stopDatetime&&i(null),v.current=_)},[_,r,w,m,h,o]);let y=(0,rF.useCallback)(()=>{d(),g()},[d,g]);(0,rF.useEffect)(()=>{n.current=y},[y]);let b=!!(!c||s&&!f),x=!!(s?p:u);return{error:u||p,mutate:y,isValidating:m||h,activeVisit:w,currentVisit:_,currentVisitIsRetrospective:!!s,isLoading:b&&!x}}sd.extend(sf);let sv=[];function sy(){let{data:e}=(0,iM.A)(nK,nX);return e??sv}let sb=new Map;async function sx(e,t){let n=t.indexOf("#"),o=n>=0,r=o?t.substring(0,n):e,i=o?t.substring(n+1):t,s=await nf(r);return s&&Object.hasOwn(s,i)&&"function"==typeof s[i]?sj(r,s).then(()=>s[i]()):(s?s&&Object.hasOwn(s,i)?console.warn(`The export ${t}, defined in ${e}'s routes.json, is not a function`):console.warn(`${r} does not define a component called "${i}", referenced in ${e}'s routes.json. This cannot be loaded.`):console.warn(`Unknown app ${r} for ${t} defined in ${e}'s routes.json`),sS)}let sS={bootstrap:()=>Promise.resolve(),mount:()=>Promise.resolve(),unmount:()=>Promise.resolve()};async function sj(e,t){if(e in sb)await sb[e];else{let n=t??await nf(e);await (sb[e]=new Promise((t,o)=>{if(Object.hasOwn(n,"startupApp")){let r=n.startupApp;if("function"==typeof r)return Promise.resolve(r()).then(()=>{eA(e),t(null)}).catch(o)}eA(e),t(null)}))}}function sk(e,t){let n=t.name;if(!n)return void console.error(`An extension definition in ${e} is missing an name and thus cannot be
|
|
17
17
|
registered. To fix this, ensure that you define the "name" field inside the
|
|
18
18
|
extension definition.`,t);t.slots&&t.slot&&console.warn(`The extension ${n} from ${e} declares both a 'slots' property and
|
|
19
19
|
a 'slot' property. Only the 'slots' property will be honored.`);let o=t.slots?t.slots:t.slot?[t.slot]:[];if(!t.component)return void console.error(`The extension ${n} from ${e} is missing a 'component' entry and thus cannot be registered.
|
|
20
|
-
To fix this, ensure that you define a 'component' field inside the extension definition.`,t);for(let r of(rm({name:n,load:()=>
|
|
20
|
+
To fix this, ensure that you define a 'component' field inside the extension definition.`,t);for(let r of(rm({name:n,load:()=>sx(e,t.component),meta:t.meta||{},order:t.order,moduleName:e,privileges:t.privileges,featureFlag:t.featureFlag,displayExpression:t.displayExpression}),o))rf(r,n)}let sN=[];function sC(e,t){o0(()=>(function(e,t){if(e&&t&&"object"==typeof t){eI(e);let n=t.extensions??[],o=t.modals??[],r=t.featureFlags??[],i=t.workspaceGroups2??[],s=t.workspaceWindows2??[],a=t.workspaces2??[];t.pages?.forEach(t=>{t&&"object"==typeof t&&Object.hasOwn(t,"component")&&(Object.hasOwn(t,"route")||Object.hasOwn(t,"routeRegex")||Object.hasOwn(t,"routes"))?sN.push({...t,appName:e}):console.warn(`A page for ${e} could not be registered as it does not appear to have the required properties`,t)}),n.forEach(t=>{t&&"object"==typeof t&&Object.hasOwn(t,"name")&&Object.hasOwn(t,"component")?sk(e,t):console.warn(`An extension for ${e} could not be registered as it does not appear to have the required properties`,t)}),o.forEach(t=>{if(t&&"object"==typeof t&&Object.hasOwn(t,"name")&&Object.hasOwn(t,"component")){let n;(n=t.name)?t.component?rk({name:n,moduleName:e,load:()=>sx(e,t.component)}):console.error(`The modal ${n} from ${e} is missing a 'component' entry and thus cannot be registered.
|
|
21
21
|
To fix this, ensure that you define a 'component' field inside the modal definition.`,t):console.error(`A modal definition in ${e} is missing an name and thus cannot be
|
|
22
22
|
registered. To fix this, ensure that you define the "name" field inside the
|
|
23
|
-
modal definition.`,t)}else console.warn(`A modal for ${e} could not be registered as it does not appear to have the required properties`,t)}),(Object.hasOwn(t,"workspaces")||Object.hasOwn(t,"workspaceGroups"))&&console.warn(`${e} defines workspaces or workspaceGroups in its routes.json, which are no longer supported and won't be registered. Use workspaces2, workspaceWindows2 and workspaceGroups2 instead.`),rA(e,i);for(let t of(rO(e,s),s))t.icon&&
|
|
23
|
+
modal definition.`,t)}else console.warn(`A modal for ${e} could not be registered as it does not appear to have the required properties`,t)}),(Object.hasOwn(t,"workspaces")||Object.hasOwn(t,"workspaceGroups"))&&console.warn(`${e} defines workspaces or workspaceGroups in its routes.json, which are no longer supported and won't be registered. Use workspaces2, workspaceWindows2 and workspaceGroups2 instead.`),rA(e,i);for(let t of(rO(e,s),s))t.icon&&sk(e,{name:t.name,component:t.icon,slot:t.group,order:t.order});rR(e,a),r.forEach(t=>{if(t&&"object"==typeof t&&Object.hasOwn(t,"flagName"))t.flagName?t.label?t.description?oT(t.flagName,t.label,t.description):console.error(`A feature flag definition in ${e} is missing a description and thus cannot be registered.
|
|
24
24
|
To fix this, ensure that you define the "description" field inside the feature flag definition.`,t):console.error(`A feature flag definition in ${e} is missing a description and thus cannot be registered.
|
|
25
25
|
To fix this, ensure that you define the "label" field inside the feature flag definition.`,t):console.error(`A feature flag definition in ${e} is missing a name and thus cannot be registered.
|
|
26
|
-
To fix this, ensure that you define the "name" field inside the feature flag definition.`,t);else console.warn(`A feature flag for ${e} could not be registered as it does not appear to have the required properties`,t)})}})(e,t))}function
|
|
26
|
+
To fix this, ensure that you define the "name" field inside the feature flag definition.`,t);else console.warn(`A feature flag for ${e} could not be registered as it does not appear to have the required properties`,t)})}})(e,t))}function sE(){sN.sort((e,t)=>e.appName.localeCompare(t.appName,"en"));let e=new Map;for(let t of sN){e.has(t.appName)?e.set(t.appName,e.get(t.appName)+1):e.set(t.appName,0);let n=e.get(t.appName),o=`${t.appName}-page-${n}`,r=t.containerDomId??"omrs-apps-container",i=document.getElementById(r),s=`single-spa-application:${o}`;if(i){let e=document.createElement("div");e.id=s,i?.appendChild(e)}else throw Error(`${t.appName} ${t.component} cannot be mounted to "${r}"; DOM element does not exist.`);!function(e,t){let n=void 0!==t.route?t.route:void 0!==t.routeRegex&&new RegExp(t.routeRegex);if(!1===n)return console.warn(`A registered page definition is missing a route and thus cannot be registered.
|
|
27
27
|
To fix this, ensure that you define the "route" (or alternatively the "routeRegex") field inside the extension definition.`,e);if(!t.component)return console.warn(`A registered page definition is missing a component and thus cannot be registered.
|
|
28
|
-
To fix this, ensure that you define the "component" field inside the page definition.`,e);let o=function(e,{featureFlag:t}){return t?n=>!!oM(t)&&e(n):e}(function e(t){if(Array.isArray(t)){let n=t.map(e);return e=>n.some(t=>t(e))}return"string"==typeof t?(0,ta.fz)(window.getOpenmrsSpaBase()+t):t instanceof RegExp?e=>t.test(e.pathname.replace(window.getOpenmrsSpaBase(),"")):()=>t}(n),t);(0,ta.AG)(e,()=>sy(t.appName,t.component),o)}(o,t)}}let sE={PHONE_MIN:0,PHONE_MAX:600,TABLET_MIN:601,TABLET_MAX:1023,SMALL_DESKTOP_MIN:1024,SMALL_DESKTOP_MAX:1439,LARGE_DESKTOP_MIN:1440,LARGE_DESKTOP_MAX:Number.MAX_SAFE_INTEGER};function sC(){document.body.classList.toggle("omrs-breakpoint-lt-tablet",window.innerWidth<sE.TABLET_MIN),document.body.classList.toggle("omrs-breakpoint-gt-phone",window.innerWidth>sE.PHONE_MAX),document.body.classList.toggle("omrs-breakpoint-gt-tablet",window.innerWidth>sE.TABLET_MAX),document.body.classList.toggle("omrs-breakpoint-lt-desktop",window.innerWidth<sE.SMALL_DESKTOP_MIN),document.body.classList.toggle("omrs-breakpoint-lt-small-desktop",window.innerWidth<sE.SMALL_DESKTOP_MIN),document.body.classList.toggle("omrs-breakpoint-lt-large-desktop",window.innerWidth<sE.LARGE_DESKTOP_MIN),document.body.classList.toggle("omrs-breakpoint-gt-small-desktop",window.innerWidth>sE.SMALL_DESKTOP_MAX)}let sP=!1;function sI(){sP||(window.addEventListener("resize",sC),sC(),sP=!0)}var sA=n(6870),sO=n(5530),sR=n.n(sO);function s$({title:e,children:t}){let n="tablet"===i2();return(0,sA.jsxs)("div",{className:sR()({"-esm-devtools__card-header-module__tabletHeader___Vkmd-":n,"-esm-devtools__card-header-module__desktopHeader___ocWGq":!n}),children:[(0,sA.jsx)("h4",{children:e}),t]})}let sT=["red","magenta","purple","blue","teal","cyan","gray","green","warm-gray","cool-gray","high-contrast","outline"],sM={primaryColor:{_type:G.String,_description:"The color for displaying primary diagnoses tags",_default:"blue",_validators:[e7.oneOf(sT)]},secondaryColor:{_type:G.String,_description:"The color for displaying secondary diagnoses tags",_default:"gray",_validators:[e7.oneOf(sT)]}},sL={"Brand color #1":{_default:"#005d5d",_type:G.String},"Brand color #2":{_default:"#004144",_type:G.String},"Brand color #3":{_default:"#007d79",_type:G.String},excludePatientIdentifierCodeTypes:{uuids:{_type:G.Array,_description:"List of UUIDs of patient identifier types to exclude from rendering in the patient banner",_default:[],_elements:{_type:G.UUID}}},implementationName:{_type:G.String,_description:"A name of the place (or authority) where all possible locations a user can choose are located.",_default:"Clinic"},logo:{src:{_type:G.String,_default:"",_description:"The path or URL to the logo shown on the login page and while the server is starting up. If set to an empty string, the default OpenMRS logo is used.",_validators:[e7.isUrl]},alt:{_type:G.String,_default:"Logo",_description:"The alternative text for the logo image, displayed when the image cannot be loaded or on hover."}},patientPhotoConceptUuid:{_type:G.ConceptUuid,_default:"736e8771-e501-4615-bfa7-570c03f4bef5",_description:"Used to look up the patient photo, which is stored as an attachment obs. Set to `null` in order to disable the feature and use only generated avatars. To remove the avatars entirely, use extension configuration's `remove` feature."},preferredCalendar:{_type:G.Object,_description:"Keys should be locale codes, and values should be the preferred calendar for that locale. For example, {'am': 'ethiopic'}.",_default:{am:"ethiopic"},_elements:{_validators:[e7.oneOf(["buddhist","chinese","coptic","dangi","ethioaa","ethiopic","gregory","hebrew","indian","islamic","islamic-umalqura","islamic-tbla","islamic-civil","islamic-rgsa","iso8601","japanese","persian","roc","islamicc"])]}},preferredDateLocale:{_type:G.Object,_description:"Allows setting the locale used for date formatting for any browser locale. Does not affect time formatting. Keys should be locale codes, and values should be the preferred locale for formatting dates. For example, {'en': 'en-US', 'fr-CA': 'en-CA'}.",_default:{en:"en-GB"},_elements:{_type:G.String}},diagnosisTags:sM};var sW=n(8326);let sD={"carbon.table.batch.cancel":"cancel","carbon.table.batch.items.selected":"batchActionsItemsSelected","carbon.table.batch.item.selected":"batchActionItemSelected","carbon.table.batch.selectAll":"selectAll"},sU=e=>(0,sA.jsx)(sW.TableBatchActions,{translateWithId:(e,t)=>{let n=sD[e];return n?tm(n,e,t):e},...e}),sB="-esm-devtools__custom-overflow-menu-module__container___8PykS",sF="-esm-devtools__custom-overflow-menu-module__menu___qsOLn",sH="-esm-devtools__custom-overflow-menu-module__show___BserJ",sV="-esm-devtools__custom-overflow-menu-module__overflowMenuButton___n86Gz",sG=(0,rF.createContext)(null);function sz(){let e=(0,rF.useContext)(sG);if(!e)throw Error("useCustomOverflowMenu must be used within a CustomOverflowMenu");return e}function sq({menuTitle:e,children:t}){let[n,o]=rH().useState(!1),r=i7(()=>o(!1),n),i="tablet"===i2(),s=(0,rF.useCallback)(()=>o(e=>!e),[]),a=(0,rF.useRef)(null),l=(0,rF.useRef)(null),c=(0,rF.useId)(),u=`custom-overflow-menu-trigger-${c}`,d=`custom-overflow-menu-${c}`,m=(0,rF.useCallback)(()=>{o(!1),a.current?.focus()},[]),f=(0,rF.useMemo)(()=>({closeMenu:m}),[m]),p=(0,rF.useCallback)(e=>{"Escape"===e.key&&n&&(e.stopPropagation(),m())},[m,n]),g=rF.Children.toArray(t);(0,rF.useEffect)(()=>{if(n&&l.current){let e=l.current.querySelector('[role="menuitem"]:not([disabled])');e?.focus()}},[n]);let h=(0,rF.useCallback)(({currentIndex:e,direction:t})=>{let n=l.current?.querySelectorAll('[role="menuitem"]:not([disabled])');if(!n?.length)return;let o=document.activeElement?.closest?.('[role="menuitem"]')??document.activeElement,r=Array.from(n).indexOf(o);if(-1===r)return void n[t>0?0:n.length-1]?.focus();let i=r+t,s=i<0?n.length-1:i>=n.length?0:i;n[s]?.focus()},[]),w=g.map((e,t)=>(0,rF.isValidElement)(e)?(0,rF.cloneElement)(e,{closeMenu:m,handleOverflowMenuItemFocus:h,index:t}):e);return(0,sA.jsxs)("div",{"data-overflow-menu":!0,className:sR()("cds--overflow-menu",sB),ref:r,children:[(0,sA.jsx)("button",{className:sR()("cds--btn","cds--btn--ghost","cds--overflow-menu__trigger",{"cds--overflow-menu--open":n},sV),"aria-controls":d,"aria-expanded":n,"aria-haspopup":"true",id:u,onClick:s,onKeyDown:p,ref:a,children:e}),(0,sA.jsxs)("div",{className:sR()("cds--overflow-menu-options","cds--overflow-menu--flip",sF,{[sH]:n}),"aria-labelledby":u,"data-floating-menu-direction":"bottom",id:d,onKeyDown:p,ref:l,role:"menu",tabIndex:-1,children:[(0,sA.jsx)("ul",{className:sR()("cds--overflow-menu-options__content",{"cds--overflow-menu-options--lg":i}),children:(0,sA.jsx)(sG.Provider,{value:f,children:w})}),(0,sA.jsx)("span",{})]})]})}function sJ(e){let t=(0,rF.useContext)(sG);return(0,sA.jsx)(sW.OverflowMenuItem,{...e,closeMenu:t?.closeMenu})}var sK=n(2277),sX=n(4194);let sY=["omrs-icon-activity","omrs-icon-add","omrs-icon-arrow-down","omrs-icon-arrow-left","omrs-icon-arrow-right","omrs-icon-arrow-up","omrs-icon-baby","omrs-icon-calendar-heat-map","omrs-icon-calendar","omrs-icon-caret-down","omrs-icon-caret-left","omrs-icon-caret-right","omrs-icon-caret-up","omrs-icon-chart-average","omrs-icon-chart-line","omrs-icon-checkmark-filled","omrs-icon-checkmark-outline","omrs-icon-chemistry","omrs-icon-chevron-down","omrs-icon-chevron-left","omrs-icon-chevron-right","omrs-icon-chevron-up","omrs-icon-close","omrs-icon-close-filled","omrs-icon-close-outline","omrs-icon-document","omrs-icon-document-attachment","omrs-icon-download","omrs-icon-drug-order","omrs-icon-edit","omrs-icon-event-schedule","omrs-icon-events","omrs-icon-gender-female","omrs-icon-gender-male","omrs-icon-gender-other","omrs-icon-gender-unknown","omrs-icon-generic-order-type","omrs-icon-group","omrs-icon-group-access","omrs-icon-hospital-bed","omrs-icon-image-medical","omrs-icon-information","omrs-icon-information-filled","omrs-icon-information-square","omrs-icon-inventory-management","omrs-icon-lab-order","omrs-icon-list-checked","omrs-icon-location","omrs-icon-material-order","omrs-icon-maximize","omrs-icon-medication","omrs-icon-message-queue","omrs-icon-microscope","omrs-icon-mobile-check","omrs-icon-money","omrs-icon-mother","omrs-icon-movement","omrs-icon-overflow-menu--horizontal","omrs-icon-overflow-menu--vertical","omrs-icon-password","omrs-icon-pedestrian-family","omrs-icon-pen","omrs-icon-printer","omrs-icon-procedure-order","omrs-icon-programs","omrs-icon-renew","omrs-icon-referral-order","omrs-icon-report","omrs-icon-reset","omrs-icon-save","omrs-icon-search","omrs-icon-settings","omrs-icon-shopping-cart","omrs-icon-shopping-cart--arrow-down","omrs-icon-sticky-note-add","omrs-icon-switcher","omrs-icon-syringe","omrs-icon-table-of-contents","omrs-icon-table","omrs-icon-time","omrs-icon-tools","omrs-icon-translate","omrs-icon-trash-can","omrs-icon-tree-view--alt","omrs-icon-two-factor-authentication","omrs-icon-user-avatar","omrs-icon-user-follow","omrs-icon-user-xray","omrs-icon-user","omrs-icon-view-off","omrs-icon-view","omrs-icon-warning"],sZ=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,sA.jsx)(lx,{ref:t,icon:"omrs-icon-activity",iconProps:e})})),sQ=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,sA.jsx)(lx,{ref:t,icon:"omrs-icon-add",iconProps:e})})),s0=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,sA.jsx)(lx,{ref:t,icon:"omrs-icon-arrow-down",iconProps:e})})),s1=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,sA.jsx)(lx,{ref:t,icon:"omrs-icon-arrow-left",iconProps:e})})),s2=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,sA.jsx)(lx,{ref:t,icon:"omrs-icon-arrow-right",iconProps:e})})),s5=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,sA.jsx)(lx,{ref:t,icon:"omrs-icon-arrow-up",iconProps:e})})),s6=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,sA.jsx)(lx,{ref:t,icon:"omrs-icon-baby",iconProps:e})})),s8=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,sA.jsx)(lx,{ref:t,icon:"omrs-icon-calendar-heat-map",iconProps:e})})),s3=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,sA.jsx)(lx,{ref:t,icon:"omrs-icon-calendar",iconProps:e})})),s4=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,sA.jsx)(lx,{ref:t,icon:"omrs-icon-caret-down",iconProps:e})})),s7=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,sA.jsx)(lx,{ref:t,icon:"omrs-icon-caret-left",iconProps:e})})),s9=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,sA.jsx)(lx,{ref:t,icon:"omrs-icon-caret-right",iconProps:e})})),ae=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,sA.jsx)(lx,{ref:t,icon:"omrs-icon-caret-up",iconProps:e})})),at=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,sA.jsx)(lx,{ref:t,icon:"omrs-icon-chart-average",iconProps:e})})),an=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,sA.jsx)(lx,{ref:t,icon:"omrs-icon-chart-line",iconProps:e})})),ao=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,sA.jsx)(lx,{ref:t,icon:"omrs-icon-checkmark-filled",iconProps:e})})),ar=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,sA.jsx)(lx,{ref:t,icon:"omrs-icon-checkmark-outline",iconProps:e})})),ai=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,sA.jsx)(lx,{ref:t,icon:"omrs-icon-chemistry",iconProps:e})})),as=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,sA.jsx)(lx,{ref:t,icon:"omrs-icon-chevron-down",iconProps:e})})),aa=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,sA.jsx)(lx,{ref:t,icon:"omrs-icon-chevron-left",iconProps:e})})),al=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,sA.jsx)(lx,{ref:t,icon:"omrs-icon-chevron-right",iconProps:e})})),ac=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,sA.jsx)(lx,{ref:t,icon:"omrs-icon-chevron-up",iconProps:e})})),au=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,sA.jsx)(lx,{ref:t,icon:"omrs-icon-close",iconProps:e})})),ad=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,sA.jsx)(lx,{ref:t,icon:"omrs-icon-close-filled",iconProps:e})})),am=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,sA.jsx)(lx,{ref:t,icon:"omrs-icon-close-outline",iconProps:e})})),af=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,sA.jsx)(lx,{ref:t,icon:"omrs-icon-document",iconProps:e})})),ap=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,sA.jsx)(lx,{ref:t,icon:"omrs-icon-document-attachment",iconProps:e})})),ag=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,sA.jsx)(lx,{ref:t,icon:"omrs-icon-download",iconProps:e})})),ah=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,sA.jsx)(lx,{ref:t,icon:"omrs-icon-drug-order",iconProps:e})})),aw=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,sA.jsx)(lx,{ref:t,icon:"omrs-icon-edit",iconProps:e})})),a_=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,sA.jsx)(lx,{ref:t,icon:"omrs-icon-event-schedule",iconProps:e})})),av=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,sA.jsx)(lx,{ref:t,icon:"omrs-icon-events",iconProps:e})})),ay=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,sA.jsx)(lx,{ref:t,icon:"omrs-icon-gender-female",iconProps:e})})),ab=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,sA.jsx)(lx,{ref:t,icon:"omrs-icon-gender-male",iconProps:e})})),ax=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,sA.jsx)(lx,{ref:t,icon:"omrs-icon-gender-other",iconProps:e})})),aS=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,sA.jsx)(lx,{ref:t,icon:"omrs-icon-gender-unknown",iconProps:e})})),ak=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,sA.jsx)(lx,{ref:t,icon:"omrs-icon-generic-order-type",iconProps:e})})),aj=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,sA.jsx)(lx,{ref:t,icon:"omrs-icon-group",iconProps:e})})),aN=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,sA.jsx)(lx,{ref:t,icon:"omrs-icon-group-access",iconProps:e})})),aE=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,sA.jsx)(lx,{ref:t,icon:"omrs-icon-hospital-bed",iconProps:e})})),aC=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,sA.jsx)(lx,{ref:t,icon:"omrs-icon-image-medical",iconProps:e})})),aP=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,sA.jsx)(lx,{ref:t,icon:"omrs-icon-information",iconProps:e})})),aI=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,sA.jsx)(lx,{ref:t,icon:"omrs-icon-information-filled",iconProps:e})})),aA=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,sA.jsx)(lx,{ref:t,icon:"omrs-icon-information-square",iconProps:e})})),aO=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,sA.jsx)(lx,{ref:t,icon:"omrs-icon-inventory-management",iconProps:e})})),aR=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,sA.jsx)(lx,{ref:t,icon:"omrs-icon-lab-order",iconProps:e})})),a$=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,sA.jsx)(lx,{ref:t,icon:"omrs-icon-list-checked",iconProps:e})})),aT=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,sA.jsx)(lx,{ref:t,icon:"omrs-icon-location",iconProps:e})})),aM=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,sA.jsx)(lx,{ref:t,icon:"omrs-icon-material-order",iconProps:e})})),aL=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,sA.jsx)(lx,{ref:t,icon:"omrs-icon-maximize",iconProps:e})})),aW=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,sA.jsx)(lx,{ref:t,icon:"omrs-icon-medication",iconProps:e})})),aD=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,sA.jsx)(lx,{ref:t,icon:"omrs-icon-message-queue",iconProps:e})})),aU=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,sA.jsx)(lx,{ref:t,icon:"omrs-icon-microscope",iconProps:e})})),aB=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,sA.jsx)(lx,{ref:t,icon:"omrs-icon-mobile-check",iconProps:e})})),aF=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,sA.jsx)(lx,{ref:t,icon:"omrs-icon-money",iconProps:e})})),aH=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,sA.jsx)(lx,{ref:t,icon:"omrs-icon-mother",iconProps:e})})),aV=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,sA.jsx)(lx,{ref:t,icon:"omrs-icon-movement",iconProps:e})})),aG=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,sA.jsx)(lx,{ref:t,icon:"omrs-icon-overflow-menu--horizontal",iconProps:e})})),az=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,sA.jsx)(lx,{ref:t,icon:"omrs-icon-overflow-menu--horizontal",iconProps:e})})),aq=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,sA.jsx)(lx,{ref:t,icon:"omrs-icon-password",iconProps:e})})),aJ=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,sA.jsx)(lx,{ref:t,icon:"omrs-icon-pedestrian-family",iconProps:e})})),aK=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,sA.jsx)(lx,{ref:t,icon:"omrs-icon-pen",iconProps:e})})),aX=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,sA.jsx)(lx,{ref:t,icon:"omrs-icon-printer",iconProps:e})})),aY=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,sA.jsx)(lx,{ref:t,icon:"omrs-icon-procedure-order",iconProps:e})})),aZ=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,sA.jsx)(lx,{ref:t,icon:"omrs-icon-programs",iconProps:e})})),aQ=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,sA.jsx)(lx,{ref:t,icon:"omrs-icon-referral-order",iconProps:e})})),a0=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,sA.jsx)(lx,{ref:t,icon:"omrs-icon-renew",iconProps:e})})),a1=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,sA.jsx)(lx,{ref:t,icon:"omrs-icon-report",iconProps:e})})),a2=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,sA.jsx)(lx,{ref:t,icon:"omrs-icon-reset",iconProps:e})})),a5=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,sA.jsx)(lx,{ref:t,icon:"omrs-icon-save",iconProps:e})})),a6=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,sA.jsx)(lx,{ref:t,icon:"omrs-icon-search",iconProps:e})})),a8=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,sA.jsx)(lx,{ref:t,icon:"omrs-icon-settings",iconProps:e})})),a3=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,sA.jsx)(lx,{ref:t,icon:"omrs-icon-switcher",iconProps:e})})),a4=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,sA.jsx)(lx,{ref:t,icon:"omrs-icon-shopping-cart",iconProps:e})})),a7=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,sA.jsx)(lx,{ref:t,icon:"omrs-icon-shopping-cart--arrow-down",iconProps:e})})),a9=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,sA.jsx)(lx,{ref:t,icon:"omrs-icon-sticky-note-add",iconProps:e})})),le=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,sA.jsx)(lx,{ref:t,icon:"omrs-icon-syringe",iconProps:e})})),lt=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,sA.jsx)(lx,{ref:t,icon:"omrs-icon-table-of-contents",iconProps:e})})),ln=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,sA.jsx)(lx,{ref:t,icon:"omrs-icon-table",iconProps:e})})),lo=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,sA.jsx)(lx,{ref:t,icon:"omrs-icon-time",iconProps:e})})),lr=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,sA.jsx)(lx,{ref:t,icon:"omrs-icon-tools",iconProps:e})})),li=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,sA.jsx)(lx,{ref:t,icon:"omrs-icon-translate",iconProps:e})})),ls=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,sA.jsx)(lx,{ref:t,icon:"omrs-icon-trash-can",iconProps:e})})),la=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,sA.jsx)(lx,{ref:t,icon:"omrs-icon-tree-view--alt",iconProps:e})})),ll=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,sA.jsx)(lx,{ref:t,icon:"omrs-icon-two-factor-authentication",iconProps:e})})),lc=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,sA.jsx)(lx,{ref:t,icon:"omrs-icon-user-avatar",iconProps:e})})),lu=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,sA.jsx)(lx,{ref:t,icon:"omrs-icon-user-follow",iconProps:e})})),ld=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,sA.jsx)(lx,{ref:t,icon:"omrs-icon-user-xray",iconProps:e})})),lm=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,sA.jsx)(lx,{ref:t,icon:"omrs-icon-user",iconProps:e})})),lf=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,sA.jsx)(lx,{ref:t,icon:"omrs-icon-view-off",iconProps:e})})),lp=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,sA.jsx)(lx,{ref:t,icon:"omrs-icon-view",iconProps:e})})),lg=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,sA.jsx)(lx,{ref:t,icon:"omrs-icon-warning",iconProps:e})})),lh=lg,lw=ap,l_=a$,lv=aC,ly=a7,lb=(0,rF.memo)((0,rF.forwardRef)(function({icon:e,fallback:t,...n},o){let r=(0,rF.useRef)(e?document.getElementById(e):void 0);return(0,rF.useEffect)(()=>{let t=document.getElementById("omrs-svgs-container"),n=new MutationObserver(t=>{for(let n of t)"childList"===n.type&&(r.current=e?document.getElementById(e):void 0)});return t&&n.observe(t,{childList:!0}),()=>n.disconnect()},[e]),(0,sA.jsx)(iy,{value:r.current,fallback:t,children:(0,sA.jsx)(lx,{ref:o,icon:e,iconProps:n})})})),lx=(0,rF.memo)((0,rF.forwardRef)(function({icon:e,iconProps:t},n){let{className:o,fill:r,size:i}=Object.assign({},{fill:"currentColor",size:20},t);(i<=0||i>72)&&(console.error(`Invalid size '${i}' specified for ${e}. Defaulting to 20.`),i=20);let s=(0,rF.useRef)(null);return(0,rF.useImperativeHandle)(n,()=>s.current),(0,rF.useEffect)(()=>{s.current&&"currentColor"!==r&&s.current.style.setProperty("--omrs-icon-fill",r)},[]),(0,sA.jsx)("svg",{ref:s,className:sR()("omrs-icon","-esm-devtools__icons-module__icon___BfFhd",o),height:i,width:i,viewBox:"0 0 16 16",children:(0,sA.jsx)("use",{href:`#${e}`})})})),lS=({path:e,title:t,basePath:n,icon:o})=>{let{t:r}=(0,r9.useTranslation)(),i=(0,sK.zy)(),s=(0,rF.useMemo)(()=>{if(!e)return!1;let t=e.startsWith("/")?e.slice(1):e;if(t.startsWith("http"))return t===window.location.href;let n=t.split("/").map(e=>decodeURIComponent(e)),o=(i.pathname??"").split("/").slice(1).map(e=>decodeURIComponent(e));return o.some((e,t)=>n.every((e,n)=>o[t+n]===e))},[i.pathname,e]);return(0,sA.jsx)("div",{children:(0,sA.jsx)(rG,{className:sR()("cds--side-nav__link",{"active-left-nav-link":s}),to:`${n}/${encodeURIComponent(e)}`,children:(0,sA.jsxs)("span",{className:"-esm-devtools__dashboard-module__menu___ds1tf",children:[(0,sA.jsx)(lb,{icon:o,className:"-esm-devtools__dashboard-module__icon___4Zrrh",size:16}),(0,sA.jsx)("span",{children:r(t)})]})})},e)};function lk(e){return function({basePath:t}){return(0,sA.jsx)(sX.Kd,{children:(0,sA.jsx)(lS,{basePath:t,...e})})}}var lj=n(7715),lN=n(7532),lE=n(3692),lC=n(7615),lP=n(700),lI=n(6816),lA=n(1168);function lO(e){return rH().createElement(lA.C,e)}var lR=n(3010),l$=n(6513),lT=n(6190);function lM(e,t,n=!1){if(null==e)return n?e:void 0;if("string"==typeof e&&!e)return n?null:void 0;if(e instanceof lR.ng||e instanceof lR._l||e instanceof lR.Ip)return t?(0,l$.yP)(e,t):e;{let n=su()(e).toDate(),o=new lR.ng(n.getFullYear(),n.getMonth()+1,n.getDate());return t?(0,l$.yP)(o,t):o}}function lL(e){if(e)return e.toDate((0,lT.Xj)())}var lW=n(9002);function lD(e){if("string"==typeof e&&0!==e.trim().length)try{return new Intl.Locale(e.replace(/[_@]/g,"-")).toString()}catch{return}}function lU(e){let t=e??"",n=lD(t);if(!n)return t;try{return new Intl.DisplayNames([n],{type:"language"}).of(n)??t}catch{return t}}function lB(){let e=window.i18next.language,t=lD(e)??e;return"ht"===t&&(t="fr-HT"),t}var lF=n(7883),lH=n(424),lV=n(1492),lG=n(8271);function lz(e,t){var n=function(e,t){if(!t.has(e))throw TypeError("attempted to get private field on non-instance");return t.get(e)}(e,t);return n.get?n.get.call(e):n.value}sc.extend(sd),sc.extend(lV),sc.extend(lH);let lq="YYYY-MM-DDTHH:mm:ss.SSSZZ";function lJ(e){return null!=e&&28===e.trim().length&&"T"===(e=e.trim())[10]&&":"===e[13]&&":"===e[16]&&"."===e[19]&&("+"===e[23]||"-"===e[23])&&sc(e,lq).isValid()}function lK(e){return sc(e).isToday()}function lX(e){return lJ(e)?sc(e,lq).toDate():null}function lY(e,t=!1){let n=sc(e);return t&&(n=n.utc()),n.format(lq)}function lZ(e){return sc(e).toDate()}var lQ=new WeakMap;let l0=new class{register(e,t){lz(this,lQ).set(e,t)}getCalendar(e){if(!e)return;if(e.calendar)return e.calendar;if(e.region){let t=`${e.language}-${e.region}`;if(lz(this,lQ).has(t))return lz(this,lQ).get(t)}if(e.language&&lz(this,lQ).has(e.language))return lz(this,lQ).get(e.language);let t=new Intl.DateTimeFormat(e.toString()).resolvedOptions().calendar;return lz(this,lQ).set(`${e.language}${e.region?`-${e.region}`:""}`,t),t}constructor(){!function(e,t,n){if(t.has(e))throw TypeError("Cannot initialize the same private elements twice on an object");t.set(e,n)}(this,lQ,{writable:!0,value:new Map})}};function l1(e,t){l0.register(e,t)}function l2(e){let t=e??lB();return l0.getCalendar(t instanceof Intl.Locale?t:new Intl.Locale(t))}let l5={mode:"standard",time:"for today",day:!0,month:!0,year:!0,noToday:!1};function l6(e,t={}){let n=lB(),o=(0,lF.CD)(e,n);if(o.invalid)return console.warn(`Could not parse invalid date '${e}'`),null;!(0,lG.A)(o.day)&&(0,lG.A)(o.month)&&(o=Object.assign({},(0,H.A)(o,"day"),{month:o.day})),o.month&&(o.month-=1),o.day&&(o=Object.assign({},(0,H.A)(o,"day"),{date:o.day}));let r=sc().set(o).toDate();return(0,lG.A)(o.year)&&(t.year=!1),(0,lG.A)(o.month)&&(t.month=!1),(0,lG.A)(o.date)&&(t.day=!1),l8(r,t)}function l8(e,t){let n,o=t?.locale??lB(),r=new Intl.Locale(o),{calendar:i,mode:s,time:a,day:l,month:c,year:u,noToday:d,numberingSystem:m}={...l5,...{noToday:"am"===r.language},...t},f={calendar:i??l2(r),year:u?"numeric":void 0,month:c?"short":void 0,day:l?"2-digit":void 0,numberingSystem:m},p=sc(e).isToday();if(p&&!d)n=(n=new Intl.RelativeTimeFormat(o,{numeric:"auto"}).format(0,"day"))[0].toLocaleUpperCase(o)+n.slice(1);else{"en"===r.language&&(o="en-GB");let t=new Intl.DateTimeFormat(o,f).formatToParts(e);("en"===r.language||"am"===r.language)&&"standard"==s&&u&&l&&(t=t.map(l3("-"))),"wide"==s&&(t=t.map(l3(" — "))),"ethiopic"===f.calendar&&(t=t.filter((e,t,n)=>"era"!==e.type&&("literal"!==e.type||!(t<n.length-1)||"era"!==n[t+1].type))),n=t.map(e=>e.value).join("")}return(!0===a||p&&"for today"===a)&&(n+=`, ${l4(e)}`),n}let l3=e=>(t,n,o)=>"literal"!==t.type||" "!==t.value||n<o.length-1&&"era"===o[n+1].type?t:{type:"literal",value:e};function l4(e){return e.toLocaleTimeString(lB(),{hour:"2-digit",minute:"2-digit"})}function l7(e,t){return l8(e,{...t,time:!0})}function l9(e,t){let n=l2("string"==typeof t?new Intl.Locale(t):t);return n?(0,l$.yP)(e,(0,lW.d)(n)):e}function ce(e,t){return new Intl.DurationFormat(lB(),t).format(e)}function ct(e,t){if(null==e)return null;if("string"==typeof e){let n=lB(),o=(0,lF.CD)(e,n);return o.invalid?(console.warn(`Could not interpret '${e}' as a date`),null):(o.day&&!o.month&&(o={...(0,H.A)(o,"day"),...{month:o.day}}),o.month&&(o.month-=1),o.day&&(o={...(0,H.A)(o,"day"),...{date:o.day}}),sc(t).set(o))}return sc(e)}let cn=["years","months","days","hours","minutes","seconds"],co={second:"seconds",minute:"minutes",hour:"hours",day:"days",month:"months",year:"years"},cr={seconds:45,minutes:45,hours:22,days:26,months:11,years:1/0};function ci(e,t=sc(),n){let o,r=sc(t),i=ct(e,r);if(null==i)return null;if("string"==typeof n){let e=co[n]??n;return{[e]:r.diff(i,e)}}let{thresholds:s,largestUnit:a,smallestUnit:l}=n??{};if(void 0!==a||void 0!==l){let e,t=l?co[l]??l:void 0;return e="auto"===a||void 0===a?function(e,t,n){let o=cn.indexOf(n);for(let r=0;r<cn.length;r++){let i=cn[r];if(t.diff(e,i)>0)return r<=o?i:n}return n}(i,r,t??"seconds"):co[a]??a,function(e,t,n,o){let r=cn.indexOf(n),i=cn.indexOf(o),s=cn.slice(r,i+1),a={},l=e;for(let e of s){let n=t.diff(l,e);a[e]=n,l=l.add(n,e)}return a}(i,r,e,t??e)}let c=(o=function(e){let t={...cr};if(e)for(let[n,o]of Object.entries(e))void 0!==o&&(t[co[n]??n]=o);return t}(s),r.diff(i,"seconds")<o.seconds?"seconds":r.diff(i,"minutes")<o.minutes?"minutes":r.diff(i,"hours")<o.hours?"hours":r.diff(i,"days")<o.days?"days":r.diff(i,"months")<o.months?"months":"years");return{[c]:r.diff(i,c)}}let cs={style:"short",localeMatcher:"lookup"};function ca(e,t=sc(),n){let o=ci(e,t,n);return null==o?null:ce(o,"object"==typeof n&&n.formatOptions?{...cs,...n.formatOptions}:cs)}let cl=(0,rF.createContext)(null);function cc(){let e=iA({externalModuleName:"@openmrs/esm-styleguide"}).preferredDateLocale,t=(0,rF.useMemo)(()=>{let t=lB();return e[t]&&(t=e[t]),t},[window.i18next.language]),n=(0,rF.useMemo)(()=>{let e=l2(t);return void 0!==e?(0,lW.d)(e):void 0},[t]),o=(0,rF.useMemo)(()=>new Intl.Locale(t,{calendar:n?.identifier}),[t,n]),r=(0,rF.useMemo)(()=>n?(0,l$.yP)((0,lT.Ec)((0,lT.Xj)()),n):(0,lT.Ec)((0,lT.Xj)()),[n]);return{calendar:n,intlLocale:o,today_:r}}let cu=new lR.ng(1793,1,1);var cd=n(5830),cm=n(5354),cf=n(4745),cp=n(1202);function cg(e,t){return Number.parseInt(l8(e,{calendar:t.calendar,locale:t.baseName,day:!1,month:!1,noToday:!0,numberingSystem:"latn"}))}let ch=(0,rF.forwardRef)(function(e,t){let{className:n}=e,o=(0,rF.useContext)(cd.f2),r=(0,rF.useContext)(cd._I),i=o??r,s=(0,rF.useContext)(cl),a=(0,lT.Xj)(),l=l8(i.visibleRange.start.toDate(a),{calendar:s.calendar,locale:s.baseName,day:!1,year:!1,noToday:!0}),c=cg(i.visibleRange.start.toDate(a),s),u=i.maxValue?cg(i.maxValue.toDate(a),s):void 0,d=i.minValue?cg(i.minValue.toDate(a),s):void 0,m=(0,rF.useCallback)(e=>{i.setFocusedDate(i.focusedDate.cycle("year",e-i.focusedDate.year))},[]);return i&&(0,sA.jsxs)("span",{ref:t,className:n,children:[(0,sA.jsx)("span",{children:l}),(0,sA.jsxs)(cf.oz,{formatOptions:{useGrouping:!1},maxValue:u,minValue:d,onChange:m,value:c,children:[(0,sA.jsx)(cp.p,{}),(0,sA.jsxs)(lC.Y,{children:[(0,sA.jsx)(lP.$,{slot:"increment",children:(0,sA.jsx)(ae,{size:8})}),(0,sA.jsx)(lP.$,{slot:"decrement",children:(0,sA.jsx)(s4,{size:8})})]})]})]})});var cw=n(9588);let c_="-esm-devtools__datepicker-module__inputGroup___+4zks",cv="-esm-devtools__datepicker-module__inputSegment___wiExn",cy="-esm-devtools__datepicker-module__dateInputWrapper___uiyAC",cb="-esm-devtools__datepicker-module__invalidText___SxtTL",cx="-esm-devtools__datepicker-module__flatButton___UU1Qp",cS="-esm-devtools__datepicker-module__flatButtonMd___fhR-1",ck="-esm-devtools__datepicker-module__flatButtonSm___5INZ7",cj="-esm-devtools__datepicker-module__flatButtonLg___RFMrl";function cN({children:e}){let t=(0,rF.useContext)(lN.Pg),n=(0,rF.useContext)(lN.a8),o=t??n,r=i7(()=>o?.close());return(0,sA.jsx)(cw.lG,{className:"-esm-devtools__datepicker-module__dialog___qllIf",ref:r,children:e})}let cE=(0,rF.forwardRef)(function({variant:e,today_:t,minDate:n,maxDate:o},r){let i="range"===e,s=i?cd._e:cd.Vv;return(0,sA.jsx)(cm.A,{ref:r,className:"-esm-devtools__datepicker-module__popover___16UMX",placement:"bottom start",offset:1,isNonModal:!0,children:(0,sA.jsx)(cN,{children:(0,sA.jsxs)(s,{...i?{minValue:n,maxValue:o,className:"cds--date-picker__calendar"}:{},children:[(0,sA.jsxs)("header",{className:"-esm-devtools__datepicker-module__header___WAVlD",children:[(0,sA.jsx)(lP.$,{className:sR()(cx,cS),slot:"previous",children:(0,sA.jsx)(aa,{size:16})}),(0,sA.jsx)(ch,{className:"-esm-devtools__datepicker-module__monthYear___A3aKF"}),(0,sA.jsx)(lP.$,{className:sR()(cx,cS),slot:"next",children:(0,sA.jsx)(al,{size:16})})]}),(0,sA.jsx)(cd.r8,{className:"-esm-devtools__datepicker-module__calendarGrid___6qRB2",children:e=>(0,sA.jsx)(cd.Zr,{className:sR()("cds--date-picker__day",{"-esm-devtools__datepicker-module__today___TZl6M":0===t.compare(e)}),date:e},e.toString())})]})})})});var cC=n(8017),cP=n(9774),cI=n(7956);let cA=(0,rF.forwardRef)(function(e,t){let n=(0,rF.useContext)(lN.Pg),[o,r]=(0,lj.JT)({slot:e.slot},t,cP.cQ),{locale:i}=(0,lA.Y)(),s=(0,cI.F)({...o,locale:i,createCalendar:lW.d}),a=(0,rF.useRef)(null),{fieldProps:l,inputProps:c}=(0,cC.cJ)({...o,inputRef:a},s,r),u=(0,rF.useCallback)(()=>{s.isDisabled||n.toggle()},[]);return(0,sA.jsxs)(lj.Kq,{values:[[cP.$,s],[cp.E,{...c,ref:a}],[lC.t,{...l,ref:r,isInvalid:s.isInvalid}]],children:[(0,sA.jsx)(lC.Y,{...e,id:e.id,ref:t,slot:e.slot||void 0,className:e.className,isDisabled:s.isDisabled,isInvalid:s.isInvalid,onClick:u,children:s.segments.map((t,n)=>(0,rF.cloneElement)(e.children(t),{key:n}))}),(0,sA.jsx)(cp.p,{})]})}),cO=(0,rF.forwardRef)(function(e,t){let n=(0,rF.useContext)(lN.Pg),o=(0,rF.useContext)(lN.a8);return(n??o).isInvalid?(0,sA.jsx)(lg,{ref:t,size:16,...e}):(0,sA.jsx)(s3,{ref:t,size:16,...e})});var cR=n(64),c$=n(5503),cT=n(1697),cM=n(7866),cL=n(8035),cW=n(2231);let cD=(0,rF.forwardRef)(function({segment:e,...t},n){let o=(0,rF.useContext)(cP.$),r=(0,cR.U)(n),{segmentProps:i}=(0,c$.V)(e,o,r),{focusProps:s,isFocused:a,isFocusVisible:l}=(0,cT.o)(),{hoverProps:c,isHovered:u}=(0,cM.M)({...t,isDisabled:o.isDisabled||"literal"===e.type}),d=function(e){let{className:t,style:n,children:o,defaultClassName:r,defaultChildren:i,defaultStyle:s,values:a}=e;return(0,rF.useMemo)(()=>{let e,l,c;return e="function"==typeof t?t({...a,defaultClassName:r}):t,l="function"==typeof n?n({...a,defaultStyle:s||{}}):n,c="function"==typeof o?o({...a,defaultChildren:i}):null==o?i:o,{className:e??r,style:l||s?{...s,...l}:void 0,children:c??i,"data-rac":""}},[t,n,o,r,i,s,a])}({...t,values:{...e,isReadOnly:!e.isEditable,isInvalid:o.isInvalid,isDisabled:o.isDisabled,isHovered:u,isFocused:a,isFocusVisible:l},defaultChildren:e.text}),m=(0,rF.useCallback)(e=>{e.stopPropagation()},[]);return(0,sA.jsx)("span",{...(0,cL.v)((0,cW.$)(t),i,s,c),...d,ref:r,style:i.style,"data-placeholder":e.isPlaceholder||void 0,"data-invalid":o.isInvalid||void 0,"data-readonly":!e.isEditable||void 0,"data-disabled":o.isDisabled||void 0,"data-type":e.type,"data-hovered":u||void 0,"data-focused":a||void 0,"data-focus-visible":l||void 0,onClick:m})}),cU={short:!1,size:"md"},cB=(0,rF.forwardRef)(function(e,t){let{className:n,defaultValue:o,isDisabled:r,invalid:i,invalidText:s,isInvalid:a,label:l,labelText:c,light:u,maxDate:d,minDate:m,onChange:f,onChangeRaw:p,short:g,size:h,value:w,..._}={...cU,...e},{calendar:v,intlLocale:y,today_:b}=cc(),x=(0,rF.useId)(),S=!!(c??l),k=(0,rF.useMemo)(()=>lM(o,v),[o,v]),j=(0,rF.useMemo)(()=>lM(w,v,!0),[w,v]),N=(0,rF.useMemo)(()=>lM(d,v),[d,v]),E=(0,rF.useMemo)(()=>lM(m??cu,v),[m,v]),C=(0,rF.useMemo)(()=>i||a,[i,a]),P=(0,rF.useMemo)(()=>(p&&f&&console.error("An OpenmrsDatePicker component was created with both onChange and onChangeRaw handlers defined. Only onChangeRaw will be used."),p??(e=>f?.(lL(e)))),[p,f]);return(0,sA.jsx)(lO,{locale:y.toString(),children:(0,sA.jsx)("div",{className:sR()("cds--form-item",n),children:(0,sA.jsx)(lj.Kq,{values:[[cl,y]],children:(0,sA.jsxs)(lN.lr,{className:sR()("cds--date-picker","cds--date-picker--single",{"cds--date-picker--short":g,"cds--date-picker--light":u}),defaultValue:k,isDisabled:r,isInvalid:C,maxValue:N,minValue:E,value:j,shouldForceLeadingZeros:"en"===y.language||void 0,..._,onChange:P,children:[(0,sA.jsxs)("div",{className:"cds--date-picker-container",children:[S&&(0,sA.jsx)(lE.J,{className:sR()("cds--label",{"cds--label--disabled":r}),htmlFor:x,children:c??l}),(0,sA.jsxs)(lC.Y,{className:c_,children:[(0,sA.jsx)(cA,{id:S?x:void 0,ref:t,className:sR()("cds--date-picker-input__wrapper","-esm-devtools__datepicker-module__inputWrapper___kykar",{"-esm-devtools__datepicker-module__inputWrapperSm___KJtg-":"sm"===h,"-esm-devtools__datepicker-module__inputWrapperMd___ablE9":"md"===h||!h||0===h.length,"-esm-devtools__datepicker-module__inputWrapperLg___5dkQp":"lg"===h}),children:e=>"era"!==e.type?(0,sA.jsx)(cD,{className:cv,segment:e}):(0,sA.jsx)(rH().Fragment,{})}),(0,sA.jsx)(lP.$,{className:sR()(cx,{[ck]:"sm"===h,[cS]:"md"===h||!h||0===h.length,[cj]:"lg"===h}),children:(0,sA.jsx)(cO,{})})]}),(0,sA.jsx)(lI.b,{className:cb,children:s})]}),(0,sA.jsx)(cE,{variant:"single",today_:b})]})})})})}),cF=(0,rF.forwardRef)(function({className:e,defaultValue:t,invalid:n,invalidText:o,isDisabled:r,isInvalid:i,label:s,labelText:a,light:l,maxDate:c,minDate:u,onChange:d,onChangeRaw:m,size:f="md",value:p,...g},h){let{calendar:w,intlLocale:_,today_:v}=cc(),y=(0,rF.useId)(),b=!!(a??s),x=(0,rF.useMemo)(()=>{if(p)return{start:lM(p[0],w,!1),end:lM(p[1],w,!1)}},[p,w]),S=(0,rF.useMemo)(()=>{if(t)return{start:lM(t[0],w,!1),end:lM(t[1],w,!1)}},[t,w]),k=(0,rF.useMemo)(()=>lM(u??cu,w,!0),[u,w]),j=(0,rF.useMemo)(()=>lM(c,w,!0),[c,w]),N=(0,rF.useMemo)(()=>n||i,[n,i]),E=(0,rF.useMemo)(()=>(m&&d&&console.error("An OpenmrsDateRangePicker component was created with both onChange and onChangeRaw handlers defined. Only onChangeRaw will be used."),m??(e=>d?.([lL(e.start),lL(e.end)]))),[m,d]);return(0,sA.jsx)(lO,{locale:_.toString(),children:(0,sA.jsx)("div",{className:sR()("cds--form-item",e),children:(0,sA.jsx)(lj.Kq,{values:[[cl,_]],children:(0,sA.jsx)(lN.Ur,{id:b?y:void 0,className:sR()("cds--date-picker",{"cds--date-picker--light":l,"cds--date-picker--disabled":r}),isInvalid:N,shouldForceLeadingZeros:"en"===_.language||void 0,maxValue:j,minValue:k,value:x,defaultValue:S,ref:h,isDisabled:r,...g,onChange:E,children:(0,sA.jsxs)("div",{className:"cds--date-picker-container",children:[b&&(0,sA.jsx)(lE.J,{className:sR()("cds--label",{"cds--label--disabled":r}),htmlFor:y,children:a??s}),(0,sA.jsxs)(lC.Y,{className:c_,children:[(0,sA.jsxs)("div",{className:sR()("-esm-devtools__datepicker-module__inputsWrapper___YlkGh",{"-esm-devtools__datepicker-module__inputsWrapperSm___fAKhS":"sm"===f,"-esm-devtools__datepicker-module__inputsWrapperMd___XVgGP":"md"===f||!f||0===f.length,"-esm-devtools__datepicker-module__inputsWrapperLg___UgHJ1":"lg"===f}),children:[(0,sA.jsx)(cP.J3,{className:sR()("cds--date-picker-input__wrapper","-esm-devtools__datepicker-module__startInput___qgbQm",cy),slot:"start",children:e=>(0,sA.jsx)(cD,{className:cv,segment:e})}),(0,sA.jsx)("div",{className:"-esm-devtools__datepicker-module__separator___79vXZ",children:(0,sA.jsx)("span",{"aria-hidden":"true","data-readonly":!0,children:"–"})}),(0,sA.jsx)(cP.J3,{className:sR()("cds--date-picker-input__wrapper","-esm-devtools__datepicker-module__endInput___huv7x",cy),slot:"end",children:e=>(0,sA.jsx)(cD,{className:cv,segment:e})})]}),(0,sA.jsx)(lP.$,{className:sR()(cx,{[ck]:"sm"===f,[cS]:"md"===f||!f||0===f.length,[cj]:"lg"===f}),children:(0,sA.jsx)(cO,{})})]}),(0,sA.jsx)(lI.b,{className:cb,children:o}),(0,sA.jsx)(cE,{variant:"range",today_:v,minDate:k,maxDate:j})]})})})})})});var cH=n(9606);let cV=({diagnoses:e,showCertainty:t=!1})=>{let{diagnosisTags:n}=iA({externalModuleName:"@openmrs/esm-styleguide"});return(0,sA.jsx)("div",{className:"-esm-devtools__diagnosis-tags-module__container___8kut8",children:e.map(e=>{let o=t&&"PROVISIONAL"===e.certainty,r=1===e.rank?n?.primaryColor??"blue":n?.secondaryColor??"gray";return(0,sA.jsx)(cG,{color:r,isProvisional:o,name:e.display},e.uuid)})})};function cG({color:e,isProvisional:t,name:n}){let[o,r]=(0,rF.useState)(!1),[i,s]=(0,rF.useState)(!1),[a,l]=(0,rF.useState)(!1),c=a||i,u=(0,rF.useRef)(null);(0,rF.useLayoutEffect)(()=>{let e=u.current;if(!e)return;let t=()=>{let t=e.scrollWidth>e.clientWidth;l(t),t||r(!1)};t();let n=new ResizeObserver(t);return n.observe(e),()=>n.disconnect()},[n,t,c]);let d=sR()("cds--tag","cds--tag--md","cds--layout--size-md",`cds--tag--${e}`,"-esm-devtools__diagnosis-tags-module__diagnosisTag___PFhpl"),m=(0,sA.jsxs)(sA.Fragment,{children:[t&&(0,sA.jsxs)(sA.Fragment,{children:[(0,sA.jsx)("span",{"aria-hidden":"true",className:"-esm-devtools__diagnosis-tags-module__provisionalMark___8o6l4",children:"?"}),(0,sA.jsxs)("span",{className:"cds--visually-hidden",children:[tm("provisional","Provisional")," "]})]}),(0,sA.jsx)("span",{ref:u,className:"cds--tag__label",children:n})]});return c?(0,sA.jsxs)(cH.k$,{delay:0,closeDelay:150,isOpen:o,onOpenChange:r,children:[(0,sA.jsx)(lP.$,{className:d,"data-testid":"diagnosis-tag",onFocusChange:s,onPress:()=>r(!0),children:m}),(0,sA.jsx)(cH.m_,{className:"-esm-devtools__diagnosis-tags-module__tagTooltip___asRTH",placement:"bottom",offset:4,containerPadding:8,children:n})]}):(0,sA.jsx)("span",{className:d,"data-testid":"diagnosis-tag",children:m})}let cz={action:"-esm-devtools__empty-card-module__action___Y0dul",content:"-esm-devtools__empty-card-module__content___fo0nB",desktopHeading:"-esm-devtools__empty-card-module__desktopHeading___0Cg1N",tabletHeading:"-esm-devtools__empty-card-module__tabletHeading___BogTF",tile:"-esm-devtools__empty-card-module__tile___QB8Ld"},cq=({width:e="64",height:t="64"})=>(0,sA.jsx)("svg",{width:e,height:t,viewBox:"0 0 64 64",children:(0,sA.jsx)("use",{href:"#omrs-empty-data-illustration"})}),cJ=e=>{let t="tablet"===i2(),n=e.launchForm;return(0,sA.jsx)(sW.Layer,{className:cz.layer,children:(0,sA.jsxs)(sW.Tile,{className:cz.tile,children:[(0,sA.jsx)("div",{className:t?cz.tabletHeading:cz.desktopHeading,children:(0,sA.jsx)("h4",{children:e.headerTitle})}),(0,sA.jsx)(cq,{}),(0,sA.jsx)("p",{className:cz.content,children:tm("emptyStateText","There are no {{displayText}} to display",{displayText:e.displayText})}),(0,sA.jsx)("p",{className:cz.action,children:n&&(0,sA.jsx)(sW.Button,{onClick:()=>n(),kind:"ghost",size:t?"lg":"sm",children:tm("recordNewEntry","Record {{ displayText }}",{displayText:e.displayText})})})]})})},cK=({error:e,headerTitle:t})=>{let n="tablet"===i2();return(0,sA.jsx)(sW.Layer,{children:(0,sA.jsxs)(sW.Tile,{className:"-esm-devtools__error-state-module__tile___dd418",children:[(0,sA.jsx)("div",{className:n?"-esm-devtools__error-state-module__tabletHeading___g5rjg":"-esm-devtools__error-state-module__desktopHeading___Nd9u2",children:(0,sA.jsx)("h4",{children:t})}),(0,sA.jsxs)("p",{className:"-esm-devtools__error-state-module__errorMessage___z2RiN",children:[tm("error","Error")," ",`${e?.response?.status}: `,e?.response?.statusText]}),(0,sA.jsx)("p",{className:"-esm-devtools__error-state-module__errorCopy___dq+e2",children:tm("errorCopy")})]})})},cX=cK,cY=rH().forwardRef((e,t)=>{let{slotName:n,basePath:o,componentContext:r,state:i}=i8(),s=window.location??{pathname:""},a=r5(n??"");return e.isChildOfHeader&&n&&a.length>0?(0,sA.jsxs)(sW.SideNav,{"aria-label":tm("leftNavigation","Left navigation"),className:"-esm-devtools__left-nav-module__leftNav___jzTJK",expanded:!0,isFixedNav:!0,ref:t,...e,children:[(0,sA.jsx)(r3,{name:"global-nav-menu-slot"}),n?(0,sA.jsx)(iy,{value:r,fallback:(0,sA.jsx)(r3,{name:n,state:{basePath:o,currentPath:s,...i}}),children:(0,sA.jsx)(rV.Provider,{value:r,children:(0,sA.jsx)(r3,{name:n,state:{basePath:o,currentPath:s,...i}})})}):null]}):null}),cZ=({selectedLocationUuid:e,defaultLocationUuid:t,locationTag:n,locationsPerRequest:o=50,onChange:r})=>{let[i,s]=(0,rF.useState)(""),a=(0,rF.useId)(),{location:l}=function(e){let t=e?`/ws/fhir2/R4/Location?_id=${e}`:null,{data:n,error:o,isLoading:r}=(0,i$.A)(t,tP,{shouldRetryOnError:e=>!!e?.response?.status&&e.response.status>=500});return(0,rF.useMemo)(()=>({location:n?.data?.entry?n.data.entry[0]:null,error:t?o:null,isLoading:!!t&&r}),[n,r,o,t])}(t),{locations:c,isLoading:u,hasMore:d,loadingNewData:m,error:f,setPage:p}=function(e,t=0,n=""){let o=iR(n),{data:r,isLoading:i,isValidating:s,setSize:a,error:l}=(0,iJ.Ay)(function(n,r){if(r){let e=r.data?.link?.find(e=>"next"===e.relation);if(!e)return null;let t=new URL(e.url);return t.origin===window.location.origin?e.url:new URL(`${t.pathname}${t.search?`?${t.search}`:""}`,window.location.origin).toString()}let i=`${tN}/Location?`,s=new URLSearchParams;return s.append("_summary","data"),t&&s.append("_count",""+t),n&&s.append("_getpagesoffset",""+n*t),e&&s.append("_tag",e),"string"==typeof o&&""!==o&&s.append("name:contains",o),i+s.toString()},tP);return(0,rF.useMemo)(()=>({locations:r?.length?r?.flatMap(e=>e?.data?.entry??[]):[],isLoading:i,totalResults:r?.[0]?.data?.total,hasMore:!!r?.length&&r?.[r.length-1]?.data?.link?.some(e=>"next"===e.relation),loadingNewData:s,error:l||null,setPage:a}),[i,r,s,a,l])}(n,o,i),g=(0,rF.useMemo)(()=>l&&!i&&t?[l,...c.filter(({resource:e})=>e.id!==t)]:c??[],[l,c,t,i]),h=(0,rF.useCallback)(e=>{r(),s(e.trim())},[r]),w=i9((0,rF.useCallback)(()=>{!m&&d&&p(e=>e+1)},[m,d,p])),_=d?Math.max(0,Math.floor(g.length-o/2)):-1;return(0,sA.jsxs)(sA.Fragment,{children:[(0,sA.jsx)(sW.Search,{"aria-describedby":f?`${a}-error`:void 0,labelText:tm("searchForLocation"),id:a,placeholder:tm("searchForLocation"),onChange:e=>h(e.target.value),size:"lg"}),f&&(0,sA.jsx)("div",{className:"-esm-devtools__location-picker-module__errorNotification___vWBFD",id:`${a}-error`,children:(0,sA.jsx)(sW.InlineNotification,{kind:"error",subtitle:tm("errorLoadingLoginLocations","Unable to load login locations. Please try again or contact support if the problem persists."),title:tm("error","Error")})}),(0,sA.jsx)("div",{className:"-esm-devtools__location-picker-module__searchResults___Gbet+",children:u?(0,sA.jsx)("div",{className:"-esm-devtools__location-picker-module__loadingContainer___QO-zj",children:Array.from({length:5}).map((e,t)=>(0,sA.jsx)(sW.RadioButtonSkeleton,{className:"-esm-devtools__location-picker-module__radioButtonSkeleton___otoCy",role:"progressbar"},t))}):(0,sA.jsxs)(sA.Fragment,{children:[(0,sA.jsx)("div",{className:"-esm-devtools__location-picker-module__locationResultsContainer___6Pasf",children:g.length>0?(0,sA.jsx)(sW.RadioButtonGroup,{name:"loginLocations",onChange:e=>{r(e?.toString())},orientation:"vertical",valueSelected:e,children:g.map((e,t)=>(0,sA.jsx)(sW.RadioButton,{className:"-esm-devtools__location-picker-module__locationRadioButton___rTDPj",id:e.resource.id,labelText:(0,sA.jsx)("span",{ref:t===_?w:null,children:e.resource.name}),name:e.resource.name,value:e.resource.id},e.resource.id))}):(0,sA.jsx)("div",{className:"-esm-devtools__location-picker-module__emptyState___w4-Ca",children:(0,sA.jsx)("p",{className:"-esm-devtools__location-picker-module__locationNotFound___Of2MJ",children:tm("noResultsToDisplay")})})}),m&&(0,sA.jsx)("div",{className:"-esm-devtools__location-picker-module__loadingIcon___NAwSB",children:(0,sA.jsx)(sW.InlineLoading,{description:tm("loading")})})]})})]})},cQ=R("modalState",{modalContainer:null,modalStack:[]}),c0=0;async function c1(e,t,n={}){let o=rN(t),r=null;if(e){if(!o)throw Error(`No modal named '${t}' has been registered.`);let{load:i}=o,s=await i(),a=c0++;r=await rW({...s,name:`${t}-${a}`},{...n,domElement:e})}else v(`Failed to launch modal. Please notify your administrator. Modal name: ${t}`);return r}function c2(e){return"TO_BE_DELETED"===e.state||"DELETED"===e.state}function c5(e,t){t?.unmount&&(t.unmountPromise?.catch(()=>{}),t.unmount().catch(t=>{console.error(`The modal '${e}' failed to unmount`,t)}))}function c6(e){return e.find(e=>!c2(e))}function c8(e,t){e.container&&(e.container.style.visibility=t?"unset":"hidden")}let c3=window.getComputedStyle(document.body).overflow;function c4({modalStack:e,modalContainer:t}){if(t)if(e.length){t.style.visibility||(addEventListener("keydown",c9),document.body.style.overflow="hidden",t.style.visibility="unset");let n=c6(e);e.forEach(e=>{switch(e.state){case"NEW":{let n=function({size:e}){let t=document.createElement("div");return t.className=`cds--modal-container cds--modal-container--${e}`,t.setAttribute("role","dialog"),t.setAttribute("tabindex","-1"),t.setAttribute("aria-modal","true"),t}({size:e.props?.size??"md"});e.container=n,e.state="MOUNTING",c1(n,e.modalName,e.props).then(o=>{c2(e)?c5(e.modalName,o):o?(e.parcel=o,t.prepend(n),c8(e,c6(cQ.getState().modalStack)===e),o.mountPromise.then(()=>{c2(e)||(e.state="MOUNTED")},t=>{v(t),e.parcel=null,c7(e)})):c7(e)},t=>{v(t),c7(e)});break}case"MOUNTING":case"MOUNTED":c8(e,e===n);break;case"TO_BE_DELETED":e.state="DELETED",e.onClose(),c5(e.modalName,e.parcel),e.container?.remove(),setTimeout(()=>{let t=cQ.getState();cQ.setState({...t,modalStack:t.modalStack.filter(t=>t!==e)})},0)}})}else t.style.removeProperty("visibility"),document.body.style.overflow=c3,removeEventListener("keydown",c9)}function c7(e){if(c2(e))return;e.state="TO_BE_DELETED";let t=cQ.getState();cQ.setState({...t,modalStack:[...t.modalStack]})}function c9(e){"Escape"===e.key&&function(){let[e]=cQ.getState().modalStack;e&&c7(e)}()}function ue(e){cQ.subscribe(c4),cQ.setState({...cQ.getState(),modalContainer:e})}function ut(e,t={},n=()=>{}){let o=()=>{let e=cQ.getState().modalStack.find(e=>e.onClose===n);e&&c7(e)};if(rN(e)){var r;let i,s;r={state:"NEW",onClose:n,modalName:e,props:{close:o,...t}},s=[r,...(i=cQ.getState()).modalStack],cQ.setState({...i,modalStack:s})}else v(`Failed to launch modal. Please notify your administrator. Modal name: "${e}"`);return o}var un=n(9685);let uo=({notification:e})=>{let{description:t,action:n,kind:o,critical:r,title:i,onAction:s}=e;return(0,sA.jsx)(sW.ActionableNotification,{actionButtonLabel:n,kind:o||"info",lowContrast:r,subtitle:t,title:i||"",inline:!0,onActionButtonClick:s})},ur=({subject:e})=>{let[t,n]=(0,rF.useState)([]);return(0,rF.useEffect)(()=>{let t=e.subscribe(e=>n(t=>[...t.filter(t=>t.description!==e.description||t.action!==e.action||t.kind!==e.kind||t.title!==e.title),e]));return()=>t.unsubscribe()},[e]),(0,sA.jsx)(sA.Fragment,{children:t.map(e=>(0,sA.jsx)(uo,{notification:e},e.id))})},ui=({notification:e})=>{let{actionButtonLabel:t,onActionButtonClick:n=()=>{},subtitle:o,kind:r,title:i,critical:s,progressActionLabel:a,id:l,...c}=e,[u,d]=(0,rF.useState)(t);return(0,sA.jsx)(sW.ActionableNotification,{kind:r||"info",actionButtonLabel:u,ariaLabel:tm("closesActionableNotification","Closes actionable notification"),onActionButtonClick:()=>{n(),a&&d(a)},statusIconDescription:tm("actionableNotification","Actionable notification"),subtitle:o,title:i,lowContrast:s,inline:!0,...c})},us=({subject:e})=>{let[t,n]=(0,rF.useState)([]);return(0,rF.useEffect)(()=>{let t=e.subscribe(e=>n(t=>[...t.filter(t=>t.subtitle!==e.subtitle||t.actionButtonLabel!==e.actionButtonLabel||t.onActionButtonClick!==e.onActionButtonClick||t.kind!==e.kind||t.title!==e.title),e]));return()=>t.unsubscribe()},[e]),(0,sA.jsx)(sA.Fragment,{children:t.map(e=>(0,sA.jsx)(ui,{notification:e},e.id))})};class ua{subscribe(e){return this.listeners.add(e),{unsubscribe:()=>{this.listeners.delete(e)}}}next(e){for(let t of[...this.listeners])t(e)}constructor(){!function(e,t,n){t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n}(this,"listeners",new Set)}}let ul=new ua,uc=0,uu=new ua,ud=0;function um(e){e&&(0,r4.createRoot)(e).render((0,sA.jsx)(ur,{subject:ul}))}function uf(e){var t;e&&("string"==typeof(t=e.description)?t.trim().length>0:"object"==typeof t&&(t instanceof Error||!(0,un.A)(t)))?(e.description instanceof Error&&(e.description=e.description.toLocaleString()),setTimeout(()=>{ul.next({...e,id:uc++})},0)):console.error("showNotification must be called with an object having a 'description' property that is a non-empty string or object")}function up(e){e&&(0,r4.createRoot)(e).render((0,sA.jsx)(us,{subject:uu}))}function ug(e){var t;e&&("string"==typeof(t=e.actionButtonLabel)?t.trim().length>0:"object"==typeof t&&!(0,un.A)(t))?setTimeout(()=>{uu.next({...e,id:ud++})},0):console.error("showActionableNotification must be called with an actionButtonLabel that is a non-empty string")}let uh=["NORMAL","HIGH","CRITICALLY_HIGH","OFF_SCALE_HIGH","LOW","CRITICALLY_LOW","OFF_SCALE_LOW"],uw=["critically_low","critically_high","high","low","normal","off_scale_low","off_scale_high"],u_={container:"-esm-devtools__numeric-observation-module__container___NfxbH",card:"-esm-devtools__numeric-observation-module__card___9oQAh","abnormal-value":"-esm-devtools__numeric-observation-module__abnormal-value___drvEi","critical-value":"-esm-devtools__numeric-observation-module__critical-value___JAIHt",cell:"-esm-devtools__numeric-observation-module__cell___lTunW","critically-high":"-esm-devtools__numeric-observation-module__critically-high___aDUjc","critically-low":"-esm-devtools__numeric-observation-module__critically-low___5srAK",high:"-esm-devtools__numeric-observation-module__high___7KiyK",low:"-esm-devtools__numeric-observation-module__low___Zs2ct","label-container":"-esm-devtools__numeric-observation-module__label-container___lGnGH","value-container":"-esm-devtools__numeric-observation-module__value-container___hHPXt",label:"-esm-devtools__numeric-observation-module__label___WFuxk",value:"-esm-devtools__numeric-observation-module__value___6fHUr",units:"-esm-devtools__numeric-observation-module__units___EdVuw","pad-right":"-esm-devtools__numeric-observation-module__pad-right___6T9Cd","off-scale-low":"-esm-devtools__numeric-observation-module__off-scale-low___Sc1CV","off-scale-high":"-esm-devtools__numeric-observation-module__off-scale-high___cWpU2",arrow:"-esm-devtools__numeric-observation-module__arrow___SLGUh"},uv=({value:e,unit:t,label:n,interpretation:o,referenceRange:r,conceptUuid:i,variant:s="card",patientUuid:a})=>{let l=(0,rF.useId)(),{referenceRange:c,isLoading:u}=function(e,t){let n=null;e&&(n=t?`${tj}/conceptreferencerange/?patient=${t}&concept=${e}&v=full`:`${tj}/conceptreferencerange/?concept=${e}&v=full`);let{data:o,error:r,isLoading:i}=(0,i$.A)(n,tP),s=o?.data?.results?.[0];return{referenceRange:s?{hiNormal:s.hiNormal??null,hiAbsolute:s.hiAbsolute??null,hiCritical:s.hiCritical??null,lowNormal:s.lowNormal??null,lowAbsolute:s.lowAbsolute??null,lowCritical:s.lowCritical??null}:void 0,error:r,isLoading:i}}(r||o?void 0:i,a),d=r??c,m=(0,rF.useMemo)(()=>{if(o)return o?"--"===o?"normal":uh.includes(o)?o.toLowerCase():uw.includes(o)?o:"normal":void 0;if(d&&!u){if(!d||null==e||""===e)return"normal";let t="string"==typeof e?Number.parseFloat(e):e;return Number.isNaN(t)?"normal":null!==d.hiAbsolute&&void 0!==d.hiAbsolute&&t>d.hiAbsolute?"off_scale_high":null!==d.hiCritical&&void 0!==d.hiCritical&&t>=d.hiCritical?"critically_high":null!==d.hiNormal&&void 0!==d.hiNormal&&t>d.hiNormal?"high":null!==d.lowAbsolute&&void 0!==d.lowAbsolute&&t<d.lowAbsolute?"off_scale_low":null!==d.lowCritical&&void 0!==d.lowCritical&&t<=d.lowCritical?"critically_low":null!==d.lowNormal&&void 0!==d.lowNormal&&t<d.lowNormal?"low":"normal"}return"normal"},[o,d,e,u])??"normal",f="critically_low"===m||"critically_high"===m||"off_scale_low"===m||"off_scale_high"===m,p="normal"!==m,g=n?`omrs-numeric-obs-label-${n.replaceAll(/\s+/g,"-").toLowerCase()}-${l}`:void 0,h=`omrs-numeric-obs-value-${l}`,w=`omrs-numeric-obs-unit-${l}`,_=null!=e&&""!==e,v=_?e:tm("notAvailable","Not available"),y=sR()({[u_["critically-low"]]:"critically_low"===m||"off_scale_low"===m,[u_["critically-high"]]:"critically_high"===m||"off_scale_high"===m,[u_.low]:"low"===m,[u_.high]:"high"===m,[u_["off-scale-low"]]:"off_scale_low"===m,[u_["off-scale-high"]]:"off_scale_high"===m}),b=sR()({[u_.container]:!0,[u_.card]:!0,[u_["critical-value"]]:f,[u_["abnormal-value"]]:p&&!f}),x=sR()({[u_.cell]:!0,[y]:!0});return"cell"===s?(0,sA.jsxs)("div",{className:x,children:[v,_&&t?` ${t}`:""]}):(0,sA.jsxs)("section",{className:b,"data-testid":"numeric-observation-card",children:[n&&(0,sA.jsxs)("div",{className:u_["label-container"],children:[(0,sA.jsx)("span",{id:g,className:u_.label,children:n}),p&&(0,sA.jsx)("span",{className:u_[m.replace("_","-")],title:tm("abnormalValue","Abnormal value")})]}),(0,sA.jsxs)("div",{className:u_["value-container"],children:[(0,sA.jsx)("span",{id:h,"aria-labelledby":g&&w?`${g} ${w}`:g||w||void 0,className:u_.value,children:v}),_&&t&&(0,sA.jsx)("span",{id:w,className:u_.units,children:t})]})]})},uy="-esm-devtools__page-header-module__pageHeader___YOpQL",ub=e=>{if("children"in e){let{children:t,className:n,...o}=e;return(0,sA.jsx)("div",{className:sR()(uy,n),...o,children:t})}{let{title:t,illustration:n,className:o,...r}=e;return(0,sA.jsx)("div",{className:sR()(uy,o),...r,children:(0,sA.jsx)(ux,{title:t,illustration:n})})}},ux=({title:e,illustration:t,className:n})=>{let[o,r]=(0,rF.useState)(null);return(0,rF.useEffect)(()=>{eM("@openmrs/esm-styleguide").then(e=>{r(e)})},[]),(0,sA.jsxs)("div",{className:sR()("-esm-devtools__page-header-module__pageHeaderContent___PjsJm",n),children:[t,(0,sA.jsxs)("div",{className:"-esm-devtools__page-header-module__pageLabels___pPcKj",children:[o?.implementationName&&(0,sA.jsx)("p",{children:tm(o.implementationName)}),(0,sA.jsx)("h1",{className:"-esm-devtools__page-header-module__pageName___3d4IC",children:e})]})]})},uS=({totalItems:e,pageSize:t,onPageNumberChange:n,pageNumber:o,dashboardLinkUrl:r,currentItems:i,dashboardLinkLabel:s})=>{let{pageSizes:a,pageItemsCount:l}=sn(t,e,o,i),c="tablet"===i2(),u=tm("paginationItemsCount","{{pageItemsCount}} / {{totalItems}} items",{totalItems:e,pageItemsCount:l});return(0,sA.jsx)(sA.Fragment,{children:e>0&&(0,sA.jsxs)("div",{className:sR()({"-esm-devtools__pagination-module__tablet___lQ3ak":c,"-esm-devtools__pagination-module__desktop___HfUTY":!c}),children:[(0,sA.jsxs)("div",{children:[u,r&&(0,sA.jsx)(rG,{to:r,className:"-esm-devtools__pagination-module__configurableLink___NM9v7",children:s??tm("seeAll","See all")})]}),(0,sA.jsx)(sW.Pagination,{className:"-esm-devtools__pagination-module__pagination___WzkBs",page:o,pageSize:t,pageSizes:a,totalItems:e,onChange:n,pageRangeText:(e,t)=>tm("paginationOfPages","of {{count}} pages",{count:t}),size:c?"lg":"sm"})]})})};function uk(e){return uN(uC(e,"usual","official"))}function uj(e){return uk(e)}function uN(e){var t;let n;return e?e.text??(n=(t=e).given??[],(t.family?n.concat(t.family):n).join(" ")):""}function uE(e){return uN(e)}function uC(e,...t){for(let n of(0==t.length&&(t=["usual"]),t)){let t=e.name?.find(e=>{var t,o;return t=e,o=n,t.use?t.use===o:"usual"===o});if(t)return t}}function uP(e,t=sc()){let n=sc(t),o=ct(e,n);if(null==o)return null;let r=n.diff(o,"hours"),i=n.diff(o,"days"),s=n.diff(o,"weeks"),a=n.diff(o,"months"),l=n.diff(o,"years"),c={};if(r<2)c.minutes=n.diff(o,"minutes");else if(i<2)c.hours=r;else if(s<4)c.days=i;else if(l<1){let e=n.subtract(s,"weeks").diff(o,"days");c.weeks=s,c.days=e}else if(l<2){let e=n.subtract(a,"months").diff(o,"days");c.months=a,c.days=e}else if(l<18){let e=n.subtract(l,"year").diff(o,"months");c.years=l,c.months=e}else c.years=l;return c}function uI(e,t=sc()){let n=uP(e,t);if(null==n)return null;let o={style:"short",localeMatcher:"lookup"};return"minutes"in n&&0===n.minutes&&(o.minutesDisplay="always"),ce(n,o)}let uA={container:"-esm-devtools__patient-banner-patient-info-module__container___Gjd-4",activePatientContainer:"-esm-devtools__patient-banner-patient-info-module__activePatientContainer___QLcpg",patientBanner:"-esm-devtools__patient-banner-patient-info-module__patientBanner___7nrgC",patientName:"-esm-devtools__patient-banner-patient-info-module__patientName___-bF9a",patientAvatar:"-esm-devtools__patient-banner-patient-info-module__patientAvatar___AkN3H",patientAvatarButton:"-esm-devtools__patient-banner-patient-info-module__patientAvatarButton___KDxA6",patientInfo:"-esm-devtools__patient-banner-patient-info-module__patientInfo___+WtDB",demographics:"-esm-devtools__patient-banner-patient-info-module__demographics___Vtf3v",row:"-esm-devtools__patient-banner-patient-info-module__row___NIOYI",flexRow:"-esm-devtools__patient-banner-patient-info-module__flexRow___VxdGB",tagsSlot:"-esm-devtools__patient-banner-patient-info-module__tagsSlot___lU6+4",identifiers:"-esm-devtools__patient-banner-patient-info-module__identifiers___tehd8",identifier:"-esm-devtools__patient-banner-patient-info-module__identifier___bSJIF",primaryIdentifier:"-esm-devtools__patient-banner-patient-info-module__primaryIdentifier___yOV1B",secondaryIdentifier:"-esm-devtools__patient-banner-patient-info-module__secondaryIdentifier___WvJbh",value:"-esm-devtools__patient-banner-patient-info-module__value___sBM-q",tag:"-esm-devtools__patient-banner-patient-info-module__tag___BEvEV",gender:"-esm-devtools__patient-banner-patient-info-module__gender___4XkLq",separator:"-esm-devtools__patient-banner-patient-info-module__separator___iYBA3",tooltipPadding:"-esm-devtools__patient-banner-patient-info-module__tooltipPadding___EWVCK",tooltipSmallText:"-esm-devtools__patient-banner-patient-info-module__tooltipSmallText___yDmRU",actionsButtonText:"-esm-devtools__patient-banner-patient-info-module__actionsButtonText___mn139"};function uO({showIdentifierLabel:e,type:t,value:n}){return(0,sA.jsx)("span",{className:uA.primaryIdentifier,children:(0,sA.jsxs)(sW.Tag,{className:uA.tag,type:"gray",children:[e&&t?.text&&(0,sA.jsxs)("span",{className:uA.label,children:[t.text,": "]}),(0,sA.jsx)("span",{className:uA.value,children:n})]})})}function uR({showIdentifierLabel:e,type:t,value:n}){return(0,sA.jsxs)(sW.FormLabel,{className:uA.secondaryIdentifier,id:`patient-banner-identifier-${n}`,children:[e&&(0,sA.jsxs)("span",{className:uA.label,children:[t?.text,": "]}),(0,sA.jsx)("span",{className:uA.value,children:n})]})}function u$({identifiers:e,showIdentifierLabel:t}){let{excludePatientIdentifierCodeTypes:n}=iA(),{primaryIdentifierCode:o}=si(),r=e?.filter(e=>{let t=e.type?.coding?.[0]?.code;return t&&!n?.uuids.includes(t)})??[];return(0,sA.jsx)(sA.Fragment,{children:r?.length?r.map(({value:e,type:n},i)=>(0,sA.jsxs)(rH().Fragment,{children:[(0,sA.jsx)("span",{className:uA.identifier,children:n?.coding?.[0]?.code===o?(0,sA.jsx)(uO,{showIdentifierLabel:t,type:n,value:e}):(0,sA.jsx)(uR,{showIdentifierLabel:t,type:n,value:e})}),i<r.length-1&&(0,sA.jsx)("span",{className:uA.separator,children:"\xb7"})]},e)):""})}let uT={Female:ay,Male:ab,Other:ax,Unknown:aS},uM=({gender:e})=>{let t=uT[e];return t?(0,sA.jsx)(t,{fill:"#525252"}):null},uL={male:"Male",female:"Female",other:"Other",unknown:"Unknown"};function uW({patient:e,renderedFrom:t}){var n;let o,r,i=uk(e),s=e?.gender&&(r=uL[o=(n=e.gender).toLowerCase()]??"Unknown",{displayText:tm(o,n),iconKey:r}),a=(0,rF.useMemo)(()=>({patientUuid:e.id,patient:e,renderedFrom:t}),[e.id,e,t]);return(0,sA.jsxs)("div",{className:uA.patientInfo,children:[(0,sA.jsx)("div",{className:sR()(uA.row,uA.patientNameRow),children:(0,sA.jsxs)("div",{className:uA.flexRow,children:[(0,sA.jsx)("span",{className:uA.patientName,children:i}),s&&(0,sA.jsxs)("div",{className:uA.gender,children:[(0,sA.jsx)(uM,{gender:s.iconKey}),(0,sA.jsx)("span",{children:s.displayText})]}),(0,sA.jsx)(r3,{className:uA.tagsSlot,name:"patient-banner-tags-slot",state:a})]})}),(0,sA.jsxs)("div",{className:uA.demographics,children:[e.birthDate&&(0,sA.jsxs)(sA.Fragment,{children:[(0,sA.jsx)("span",{children:uI(e.birthDate)}),(0,sA.jsx)("span",{className:uA.separator,children:"\xb7"}),(0,sA.jsx)("span",{children:l6(e.birthDate,{time:!1})}),(0,sA.jsx)("span",{className:uA.separator,children:"\xb7"})]}),(0,sA.jsx)(u$,{identifiers:e.identifier,showIdentifierLabel:!0}),(0,sA.jsx)(r3,{className:uA.extensionSlot,name:"patient-banner-bottom-slot",state:a})]})]})}var uD=n(7683);function uU({patient:e,patientUuid:t,actionsSlotName:n,additionalActionsSlotState:o}){let[r,i]=(0,rF.useState)(!1),{extensions:s}=r6(n),a="tablet"===i2(),l=i7(()=>i(!1),r),c=(0,rF.useRef)(null),u=(0,rF.useRef)(null),d=(0,rF.useId)(),m=`patient-actions-menu-trigger-${d}`,f=`patient-actions-menu-${d}`,p=(0,rF.useCallback)(()=>i(e=>!e),[]),g=(0,rF.useCallback)(()=>{i(!1),c.current?.focus()},[]),h=(0,rF.useCallback)(e=>{if("Escape"===e.key&&r){e.stopPropagation(),g();return}if(("ArrowDown"===e.key||"ArrowUp"===e.key)&&r){e.preventDefault();let t=u.current?.querySelectorAll('[role="menuitem"]:not([disabled])');if(!t?.length)return;let n=document.activeElement?.closest?.('[role="menuitem"]')??document.activeElement,o=Array.from(t).indexOf(n);if(-1===o)return void t["ArrowDown"===e.key?0:t.length-1]?.focus();let r=o+("ArrowDown"===e.key?1:-1),i=r<0?t.length-1:r>=t.length?0:r;t[i]?.focus()}},[g,r]);(0,rF.useEffect)(()=>{if(r&&u.current){let e=u.current.querySelector('[role="menuitem"]:not([disabled])');e?.focus()}},[r]);let w=(0,rF.useMemo)(()=>({patientUuid:t,patient:e,closeMenu:g,...o}),[t,e,g,o]);return 0===s.length?null:(0,sA.jsx)("div",{className:"-esm-devtools__patient-banner-actions-menu-module__overflowMenuContainer___lXHHD",children:(0,sA.jsxs)("div",{"data-overflow-menu":!0,className:sR()("cds--overflow-menu",sB),ref:l,children:[(0,sA.jsxs)("button",{className:sR()("cds--btn","cds--btn--ghost","cds--overflow-menu__trigger",{"cds--overflow-menu--open":r},sV),"aria-controls":f,"aria-expanded":r,"aria-haspopup":"true",id:m,onClick:p,onKeyDown:h,ref:c,children:[(0,sA.jsx)("span",{className:"-esm-devtools__patient-banner-actions-menu-module__actionsButtonText___SdOyM",children:tm("actions","Actions")})," ",(0,sA.jsx)(uD.CH,{size:16,style:{marginLeft:"0.5rem",fill:"#78A9FF"}})]}),(0,sA.jsxs)("div",{className:sR()("cds--overflow-menu-options","cds--overflow-menu--flip",sF,{[sH]:r}),"aria-labelledby":m,"data-floating-menu-direction":"bottom",id:f,onKeyDown:h,ref:u,role:"menu",tabIndex:-1,children:[(0,sA.jsx)("ul",{className:sR()("cds--overflow-menu-options__content",{"cds--overflow-menu-options--lg":a}),children:(0,sA.jsx)(r3,{name:n,state:w},n)}),(0,sA.jsx)("span",{})]})]})})}var uB=n(397),uF=n.n(uB);function uH(e){let{patientPhotoConceptUuid:t}=iA({externalModuleName:"@openmrs/esm-styleguide"}),n=t?`${tj}/obs?patient=${e}&concept=${t}&v=full`:null,{data:o,error:r,isLoading:i}=(0,ie.u)(e?n:null,tP),s=o?.data?.results[0];return{data:s?{dateTime:s?.obsDatetime,imageSrc:s?.value?.links?.uri}:null,error:r,isLoading:i}}let uV=({width:e=56,height:t=56,"aria-label":n})=>{let{t:o}=(0,r9.useTranslation)();return(0,sA.jsxs)("svg",{"aria-label":n??o("patientPhotoPlaceholder","Patient photo placeholder"),width:e,height:t,fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[(0,sA.jsx)("path",{fill:"#ffffff",d:"M0 0h56v56H0z"}),(0,sA.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"m36.75 20.134-.884-.884L19.25 35.866l.884.884 1.25-1.25H34.25a1.252 1.252 0 0 0 1.25-1.25V21.384l1.25-1.25Zm-2.5 14.116H22.634l4.87-4.87 1.487 1.486a1.25 1.25 0 0 0 1.768 0l.991-.991 2.5 2.498v1.877Zm0-3.645-1.616-1.616a1.25 1.25 0 0 0-1.768 0l-.991.991-1.486-1.486 5.861-5.86v7.971Zm-12.5 1.145v-1.875l3.125-3.123.858.859.885-.885-.86-.86a1.25 1.25 0 0 0-1.767 0l-2.241 2.242V21.75h10V20.5h-10c-.69 0-1.25.56-1.25 1.25v10h1.25Z",fill:"#8D8D8D"})]})},uG="-esm-devtools__patient-photo-module__avatar___t5TmZ";function uz({patientUuid:e,patientName:t,alt:n}){let{data:o,isLoading:r}=uH(e),[i,s]=(0,rF.useState)(null),[a,l]=(0,rF.useState)(!1),c=(0,rF.useMemo)(()=>uF().generate(e),[e]);(0,rF.useEffect)(()=>{if(o?.imageSrc){let e=new URL(o.imageSrc,window.location.origin).pathname;l(!0);let t=!1,n=new Image;return n.onload=()=>{t||(s(e),l(!1))},n.onerror=()=>{t||(s(null),l(!1))},n.src=e,()=>{t=!0}}s(null),l(!1)},[o?.imageSrc]);let u=(0,rF.useMemo)(()=>n||(i?tm("patientPhotoAlt","Profile photo of {{patientName}}",{patientName:t}):tm("patientAvatarAlt","Avatar for {{patientName}}",{patientName:t})),[n,i,t]);return r||a?(0,sA.jsx)(sW.SkeletonIcon,{className:"-esm-devtools__patient-photo-module__skeleton___ueN8Q","data-testid":"skeleton-icon"}):o?.imageSrc&&!i?(0,sA.jsx)(uV,{"aria-label":tm("patientPhotoPlaceholder","Photo placeholder for {{patientName}}",{patientName:t})}):i?(0,sA.jsx)("div",{"aria-label":u,children:(0,sA.jsx)("img",{className:uG,src:i,alt:u,title:t})}):(0,sA.jsx)("div",{"aria-label":u,children:(0,sA.jsx)("div",{className:uG,title:t,style:{backgroundImage:c.toDataUrl(),backgroundRepeat:"no-repeat",backgroundSize:"cover"},children:(0,sA.jsx)("span",{className:"-esm-devtools__patient-photo-module__initials___-k9Hv",children:function(e,t=3){return e.split(/\s+/).filter(Boolean).slice(0,t).map(e=>e[0]).join("")}(t)})})})}let uq=["omrs-pict-appointments","omrs-pict-assessment-1","omrs-pict-assessment-2","omrs-pict-blood-bank","omrs-pict-cardiology","omrs-pict-cohorts","omrs-pict-concept-dictionary","omrs-pict-ct-scan","omrs-pict-data-entry","omrs-pict-dentistry","omrs-pict-digital-trust","omrs-pict-emergency-department","omrs-pict-facility","omrs-pict-geriatrics","omrs-pict-gynaecology","omrs-pict-in-patient","omrs-pict-laboratory","omrs-pict-labs-2","omrs-pict-metadata-export","omrs-pict-obstetrics","omrs-pict-patient-documents","omrs-pict-patient-search","omrs-pict-patients","omrs-pict-payments-desk","omrs-pict-pharmacy","omrs-pict-pharmacy-2","omrs-pict-registration","omrs-pict-reports","omrs-pict-service-queues","omrs-pict-stock-management","omrs-pict-system-administration","omrs-pict-transfer","omrs-pict-triage","omrs-pict-x-ray"],uJ=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,sA.jsx)(dS,{ref:t,pictogram:"omrs-pict-appointments",pictogramProps:e})})),uK=uJ,uX=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,sA.jsx)(dS,{ref:t,pictogram:"omrs-pict-assessment-1",pictogramProps:e})})),uY=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,sA.jsx)(dS,{ref:t,pictogram:"omrs-pict-assessment-2",pictogramProps:e})})),uZ=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,sA.jsx)(dS,{ref:t,pictogram:"omrs-pict-blood-bank",pictogramProps:e})})),uQ=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,sA.jsx)(dS,{ref:t,pictogram:"omrs-pict-cardiology",pictogramProps:e})})),u0=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,sA.jsx)(dS,{ref:t,pictogram:"omrs-pict-cohorts",pictogramProps:e})})),u1=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,sA.jsx)(dS,{ref:t,pictogram:"omrs-pict-concept-dictionary",pictogramProps:e})})),u2=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,sA.jsx)(dS,{ref:t,pictogram:"omrs-pict-ct-scan",pictogramProps:e})})),u5=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,sA.jsx)(dS,{ref:t,pictogram:"omrs-pict-data-entry",pictogramProps:e})})),u6=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,sA.jsx)(dS,{ref:t,pictogram:"omrs-pict-dentistry",pictogramProps:e})})),u8=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,sA.jsx)(dS,{ref:t,pictogram:"omrs-pict-digital-trust",pictogramProps:e})})),u3=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,sA.jsx)(dS,{ref:t,pictogram:"omrs-pict-emergency-department",pictogramProps:e})})),u4=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,sA.jsx)(dS,{ref:t,pictogram:"omrs-pict-facility",pictogramProps:e})})),u7=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,sA.jsx)(dS,{ref:t,pictogram:"omrs-pict-geriatrics",pictogramProps:e})})),u9=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,sA.jsx)(dS,{ref:t,pictogram:"omrs-pict-gynaecology",pictogramProps:e})})),de=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,sA.jsx)(dS,{ref:t,pictogram:"omrs-pict-in-patient",pictogramProps:e})})),dt=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,sA.jsx)(dS,{ref:t,pictogram:"omrs-pict-laboratory",pictogramProps:e})})),dn=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,sA.jsx)(dS,{ref:t,pictogram:"omrs-pict-labs-2",pictogramProps:e})})),dr=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,sA.jsx)(dS,{ref:t,pictogram:"omrs-pict-metadata-export",pictogramProps:e})})),di=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,sA.jsx)(dS,{ref:t,pictogram:"omrs-pict-obstetrics",pictogramProps:e})})),ds=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,sA.jsx)(dS,{ref:t,pictogram:"omrs-pict-patient-documents",pictogramProps:e})})),da=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,sA.jsx)(dS,{ref:t,pictogram:"omrs-pict-patient-search",pictogramProps:e})})),dl=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,sA.jsx)(dS,{ref:t,pictogram:"omrs-pict-patients",pictogramProps:e})})),dc=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,sA.jsx)(dS,{ref:t,pictogram:"omrs-pict-payments-desk",pictogramProps:e})})),du=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,sA.jsx)(dS,{ref:t,pictogram:"omrs-pict-pharmacy",pictogramProps:e})})),dd=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,sA.jsx)(dS,{ref:t,pictogram:"omrs-pict-pharmacy-2",pictogramProps:e})})),dm=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,sA.jsx)(dS,{ref:t,pictogram:"omrs-pict-registration",pictogramProps:e})})),df=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,sA.jsx)(dS,{ref:t,pictogram:"omrs-pict-reports",pictogramProps:e})})),dp=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,sA.jsx)(dS,{ref:t,pictogram:"omrs-pict-service-queues",pictogramProps:e})})),dg=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,sA.jsx)(dS,{ref:t,pictogram:"omrs-pict-stock-management",pictogramProps:e})})),dh=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,sA.jsx)(dS,{ref:t,pictogram:"omrs-pict-system-administration",pictogramProps:e})})),dw=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,sA.jsx)(dS,{ref:t,pictogram:"omrs-pict-transfer",pictogramProps:e})})),d_=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,sA.jsx)(dS,{ref:t,pictogram:"omrs-pict-triage",pictogramProps:e})})),dv=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,sA.jsx)(dS,{ref:t,pictogram:"omrs-pict-x-ray",pictogramProps:e})})),dy=u4,db=dl,dx=(0,rF.memo)((0,rF.forwardRef)(function({pictogram:e,fallback:t,...n},o){let r=(0,rF.useRef)(document.getElementById(e));return(0,rF.useEffect)(()=>{let t=document.getElementById("omrs-svgs-container"),n=new MutationObserver(t=>{for(let n of t)"childList"===n.type&&(r.current=document.getElementById(e))});return t&&n.observe(t,{childList:!0}),()=>n.disconnect()},[e]),(0,sA.jsx)(iy,{value:r.current,fallback:t,children:(0,sA.jsx)(dS,{ref:o,pictogram:e,pictogramProps:n})})})),dS=(0,rF.memo)((0,rF.forwardRef)(function({pictogram:e,pictogramProps:t},n){let{className:o,size:r}=Object.assign({},{size:92},t);return(r<=26||r>144)&&(console.error(`Invalid size '${r}' specified for ${e}. Defaulting to 92.`),r=92),(0,sA.jsx)("svg",{ref:n,className:sR()("-esm-devtools__pictograms-module__pictogram___wXX7t",o),height:r,width:r,children:(0,sA.jsx)("use",{href:`#${e}`})})})),dk=({children:e})=>"tablet"===i2()?(0,sA.jsx)(sW.Layer,{children:e}):(0,sA.jsx)(sA.Fragment,{children:e}),dj=({snackbar:e,closeSnackbar:t})=>{let{actionButtonLabel:n="",kind:o="success",onActionButtonClick:r=()=>{},isLowContrast:i="error"!==o,progressActionLabel:s,subtitle:a="",timeoutInMs:l=5e3,autoClose:c="error"!==o,title:u,id:d,...m}=e,[f,p]=(0,rF.useState)(n),[g,h]=(0,rF.useState)(!0),[w,_]=(0,rF.useState)(!1),v=(0,rF.useCallback)(()=>{setTimeout(t,250)},[t]),y=(0,rF.useCallback)(()=>{_(!0),v()},[v]);return(0,rF.useEffect)(()=>{if(c){let e=setTimeout(y,l);return()=>clearTimeout(e)}},[l,c,y]),(0,rF.useEffect)(()=>{h(!1),window.setTimeout(()=>{h(!0)},0)},[]),(0,sA.jsx)(sW.ActionableNotification,{actionButtonLabel:f,"aria-label":tm("closeSnackbar","Close snackbar"),className:sR()("-esm-devtools__snackbar-module__slideIn___-oZIt",{"-esm-devtools__snackbar-module__animated___M2YBU":g,"-esm-devtools__snackbar-module__slideOut___yEmGT":w}),kind:o,lowContrast:i,onActionButtonClick:()=>{r(),y(),s&&p(s)},onClose:v,statusIconDescription:tm("snackbarNotification","Snackbar notification"),subtitle:a,title:u,...m})},dN=({subject:e})=>{let[t,n]=(0,rF.useState)([]),o=(0,rF.useCallback)(e=>{n(t=>t.filter(t=>t!==e))},[]);return(0,rF.useEffect)(()=>{let t=e.subscribe(e=>n(t=>[...t.filter(t=>t.subtitle!==e.subtitle||t.actionButtonLabel!==e.actionButtonLabel||t.onActionButtonClick!==e.onActionButtonClick||t.kind!==e.kind||t.title!==e.title),e]));return()=>t.unsubscribe()},[e]),(0,sA.jsx)(sA.Fragment,{children:t.map(e=>(0,sA.jsx)(dj,{snackbar:e,closeSnackbar:()=>o(e)},e.id))})},dE=new ua,dC=0;function dP(e){e&&(0,r4.createRoot)(e).render((0,sA.jsx)(dN,{subject:dE}))}function dI(e){var t;e&&"string"==typeof(t=e.title)&&t.trim().length>0?setTimeout(()=>{dE.next({...e,id:dC++})},0):console.error("showSnackbar must be called with an object having a 'title' property that is a non-empty string")}let dA=({toast:e,closeToast:t})=>{let{description:n,kind:o,critical:r,title:i,actionButtonLabel:s,onActionButtonClick:a=()=>{}}=e,l=(0,rF.useCallback)(()=>{a(),t()},[t,a]);return(0,sA.jsx)("div",{children:(0,sA.jsx)(sW.ActionableNotification,{actionButtonLabel:s,kind:o||"info",lowContrast:r,subtitle:n,title:i||"",onActionButtonClick:l,onClose:t})})},dO=({subject:e})=>{let[t,n]=(0,rF.useState)([]),o=(0,rF.useCallback)(e=>{n(t=>t.filter(t=>t!==e))},[]);return(0,rF.useEffect)(()=>{let t=e.subscribe(e=>n(t=>[...t.filter(t=>t.description!==e.description||t.kind!==e.kind||t.title!==e.title||t.actionButtonLabel!==e.actionButtonLabel||t.onActionButtonClick!==e.onActionButtonClick),e]));return()=>t.unsubscribe()},[e]),(0,sA.jsx)(sA.Fragment,{children:t.map(e=>(0,sA.jsx)(dA,{toast:e,closeToast:()=>o(e)},e.id))})},dR=new ua,d$=0;function dT(e){e&&(0,r4.createRoot)(e).render((0,sA.jsx)(dO,{subject:dR}))}function dM(e){var t;e&&("string"==typeof(t=e.description)?t.trim().length>0:"object"==typeof t&&!(0,un.A)(t))?setTimeout(()=>{dR.next({...e,id:d$++})},0):console.error("showToast must be called with an object having a 'description' property that is a non-empty string or object")}var dL=n(4656);async function dW(e,t){let{openedGroup:n}=rE.getState();if(n){if(n.groupName===e&&dB(n.props,t))return!0;else if(!await dV({reason:"CLOSE_WORKSPACE_GROUP",explicit:!1}))return!1}return rE.setState(n=>({...n,openedGroup:{groupName:e,props:t},openedWindows:[]})),!0}async function dD(e){let{openedGroup:t,openedWindows:n}=rE.getState();if(t){if(n.length>0&&!(e||await dV({reason:"CLOSE_WORKSPACE_GROUP",explicit:!0})))return!1;rE.setState(e=>({...e,openedGroup:null,openedWindows:[]}))}return!0}async function dU(e,t=null,n=null,o=null){let r=rE.getState();if(!r.registeredWorkspacesByName[e])throw Error(`Unable to launch workspace ${e}. Workspace is not registered`);let i=rC(e);if(!i)throw Error(`Unable to launch workspace ${e}. Workspace is not registered to a workspace window`);let{openedGroup:s}=r,{name:a}=i,l=rP(a);if(!l)throw Error(`Unable to launch workspace ${e}. Workspace window ${i.name} is not registered to a workspace group`);let c=rI(e);if(s&&(s.groupName!==l.name||!dB(s.props,o)))return!!await dV({reason:"CLOSE_WORKSPACE_GROUP",explicit:!0})&&(rE.setState({...r,openedGroup:{groupName:l.name,props:o},openedWindows:[{windowName:a,openedWorkspaces:[d1(e,t)],props:n,maximized:!1}],isMostRecentlyOpenedWindowHidden:!1}),!0);if(c>=0){let o=r.openedWindows[c],i=r.openedGroup?.props??{},s=r.isMostRecentlyOpenedWindowHidden,{openedWorkspaces:u}=o;if(dB(o.props,n)){let d=u.find(t=>t.workspaceName===e);return d&&dB(d.props,t)?((s||c!==r.openedWindows.length-1)&&rE.setState(dX.restoreWindow(r,a)),!0):!!await dV({reason:"CLOSE_WORKSPACE",explicit:!1,windowName:a,workspaceName:e})&&(rE.setState({...r,openedGroup:{groupName:l.name,props:r?.openedGroup?.props??i},openedWindows:[...r.openedWindows.filter((e,t)=>t!==c),{windowName:a,openedWorkspaces:[d1(e,t)],props:o?.props??n,maximized:!1}],isMostRecentlyOpenedWindowHidden:!1}),!0)}return!!await dV({reason:"CLOSE_WINDOW",explicit:!1,windowName:a})&&(rE.setState({...r,openedGroup:{groupName:l.name,props:i??r?.openedGroup?.props},openedWindows:[...r.openedWindows.filter((e,t)=>t!==c),{windowName:a,openedWorkspaces:[d1(e,t)],props:n,maximized:!1}],isMostRecentlyOpenedWindowHidden:!1}),!0)}return"closable"!=l.persistence?(rE.setState({...r,openedGroup:{groupName:l.name,props:o??r?.openedGroup?.props??null},openedWindows:[...r.openedWindows,{windowName:a,openedWorkspaces:[d1(e,t)],props:n,maximized:!1}],isMostRecentlyOpenedWindowHidden:!1}),!0):!!await dV({reason:"CLOSE_OTHER_WINDOWS",explicit:!1,windowNameToSpare:i.name})&&(rE.setState({...r,openedGroup:{groupName:l.name,props:o??r?.openedGroup?.props??null},openedWindows:[{windowName:a,openedWorkspaces:[d1(e,t)],props:n,maximized:!1}],isMostRecentlyOpenedWindowHidden:!1}),!0)}function dB(e,t){return null==e||null==t||x(e,t)}function dF(e,t){let n=[];for(let o=e.openedWorkspaces.length-1;o>=0;o--){let r=e.openedWorkspaces[o];if(r.hasUnsavedChanges&&n.push(r),t&&r.workspaceName===t)break}return n}function dH(e){return 0===e.length?Promise.resolve(!0):new Promise(t=>{let n=ut("workspace2-close-prompt",{size:"sm",onConfirm:()=>{n(),t(!0)},onCancel:()=>{n(),t(!1)},affectedWorkspaceTitles:e.map(e=>e.title??"")})})}function dV(e){let{openedWindows:t}=rE.getState(),n=[];switch(e.reason){case"CLOSE_WORKSPACE_GROUP":n=t.flatMap(e=>dF(e));break;case"CLOSE_WINDOW":{let o=t.find(t=>t.windowName===e.windowName);if(!o)throw Error(`Window ${e.windowName} not found in opened windows.`);n=dF(o);break}case"CLOSE_WORKSPACE":{let o=t.find(t=>t.windowName===e.windowName);if(!o)throw Error(`Window ${e.windowName} not found in opened windows.`);n=dF(o,e.workspaceName);break}case"CLOSE_OTHER_WINDOWS":n=t.filter(t=>t.windowName!==e.windowNameToSpare).flatMap(e=>dF(e))}return dH(n)}function dG(e,t){return dH(dF(e,t))}function dz(e,t){let n=e.openedWorkspaces.findIndex(e=>e.workspaceName===t);return n<0?e:0===n?null:{...e,openedWorkspaces:e.openedWorkspaces.slice(0,n)}}function dq(e,t,n,o){let{registeredWorkspacesByName:r}=rE.getState(),i=r[n];if(!i)throw Error(`No workspace named "${n}" registered`);let s=r[t];if(!s)throw Error(`No workspace named "${t}" registered`);if(s.window!==i.window)throw Error(`Child workspace ${n} does not belong to the same workspace window as parent workspace ${t}`);if(i.window!==e.windowName)throw Error(`Cannot open child workspace ${n} as window ${i.window} is not opened`);let{openedWorkspaces:a}=e,l=a.findIndex(e=>e.workspaceName===t);if(-1===l)throw Error(`Cannot open child workspace ${n} from parent workspace ${t} as the parent is not opened within the workspace window`);let c=a.slice(0,l+1);return{...e,openedWorkspaces:[...c,d1(n,o)]}}function dJ(e,t,n){let o=e.openedWorkspaces.findIndex(e=>e.uuid===t);if(o<0)return e;let r=e.openedWorkspaces[o];if(Object.keys(n).every(e=>r[e]===n[e]))return e;let i=[...e.openedWorkspaces];return i[o]={...r,...n},{...e,openedWorkspaces:i}}function dK(e,t,n){let o=e.openedWindows.findIndex(e=>e.openedWorkspaces.some(e=>e.uuid===t));if(o<0)return e;let r=e.openedWindows[o],i=dJ(r,t,n);if(i===r)return e;let s=[...e.openedWindows];return s[o]=i,{...e,openedWindows:s}}let dX={setWindowMaximized(e,t,n){let o=e.openedWindows.findIndex(e=>e.windowName===t),r=[...e.openedWindows],i={...r[o],maximized:n};return r[o]=i,{...e,openedWindows:r}},hideWindow:e=>({...e,isMostRecentlyOpenedWindowHidden:!0}),restoreWindow(e,t){let n=e.openedWindows.findIndex(e=>e.windowName===t),o=e.openedWindows[n],r=[...e.openedWindows.filter((e,t)=>t!==n),o];return{...e,openedWindows:r,isMostRecentlyOpenedWindowHidden:!1}},closeWorkspace(e,t){let n=e.openedWindows.findIndex(e=>e.openedWorkspaces.some(e=>e.workspaceName===t));if(n<0)return e;let o=dz(e.openedWindows[n],t),r=[...e.openedWindows],i=e.isMostRecentlyOpenedWindowHidden;if(null===o){let t=n===e.openedWindows.length-1;r.splice(n,1),t&&r.length>0&&(i=!1)}else r[n]=o;return{...e,openedWindows:r,isMostRecentlyOpenedWindowHidden:i}},openChildWorkspace(e,t,n,o){let r=e.registeredWorkspacesByName[n];if(!r)throw Error(`No workspace named "${n}" registered`);let i=e.openedWindows.findIndex(e=>e.windowName===r.window);if(-1==i)throw Error(`Cannot open child workspace ${n} as window ${r.window} is not opened`);let s=[...e.openedWindows];return s[i]=dq(e.openedWindows[i],t,n,o),{...e,openedWindows:s}},setHasUnsavedChanges:(e,t,n)=>dK(e,t,{hasUnsavedChanges:n}),setWorkspaceTitle:(e,t,n)=>dK(e,t,{title:n})};function dY(){return rY(rE,dX)}let dZ=()=>(0,rF.useContext)(r7.i),dQ=()=>Object.keys(rE.getState().registeredWorkspacesByName);function d0(e,t,n){let o=e.openedWorkspaces[e.openedWorkspaces.length-1];return(o?t[o.workspaceName]?.width:void 0)??n[e.windowName]?.width??"narrow"}function d1(e,t){return{workspaceName:e,props:t??{},hasUnsavedChanges:!1,uuid:(0,dL.A)()}}function d2(e,t,n){let o=rE.getState().registeredWorkspacesByName[e];return o?{windowName:o.window,openedWorkspaces:[d1(e,t)],props:n??null,maximized:!1}:null}let d5=({title:e,children:t,hasUnsavedChanges:n=!1})=>{let{setHasUnsavedChanges:o,setWorkspaceTitle:r}=dZ();return(0,rF.useEffect)(()=>{o(n??!1)},[n,o]),(0,rF.useEffect)(()=>{r(e)},[e,r]),(0,sA.jsx)(sA.Fragment,{children:t})};var d6=n(1820),d8=n(3173),d3=n(185);let d4={workspaceOuterContainer:"-esm-devtools__workspace2-module__workspaceOuterContainer___bPVpy",narrowWorkspace:"-esm-devtools__workspace2-module__narrowWorkspace___kSYS7",widerWorkspace:"-esm-devtools__workspace2-module__widerWorkspace___nW2HB",extraWideWorkspace:"-esm-devtools__workspace2-module__extraWideWorkspace___em5yA",workspaceMiddleContainer:"-esm-devtools__workspace2-module__workspaceMiddleContainer___Bx1i6",maximized:"-esm-devtools__workspace2-module__maximized___Kfygr",hidden:"-esm-devtools__workspace2-module__hidden___RPimX",workspaceInnerContainer:"-esm-devtools__workspace2-module__workspaceInnerContainer___5zxpt",workspaceSpacer:"-esm-devtools__workspace2-module__workspaceSpacer___E+982",loader:"-esm-devtools__workspace2-module__loader___vmBQn",hiddenExtraWorkspace:"-esm-devtools__workspace2-module__hiddenExtraWorkspace___qkbMG",header:"-esm-devtools__workspace2-module__header___IZ-2+",headerButtons:"-esm-devtools__workspace2-module__headerButtons___81a2N",workspaceContent:"-esm-devtools__workspace2-module__workspaceContent___eetPy",overlayHeaderSpacer:"-esm-devtools__workspace2-module__overlayHeaderSpacer___ruc6r",isActionMenuOpened:"-esm-devtools__workspace2-module__isActionMenuOpened___XgCkc",showActionMenu:"-esm-devtools__workspace2-module__showActionMenu___sHRt1",marginWorkspaceContent:"-esm-devtools__workspace2-module__marginWorkspaceContent___TN+S+",workspaceContainerWithActionMenu:"-esm-devtools__workspace2-module__workspaceContainerWithActionMenu___xLg8e",workspaceFixedContainer:"-esm-devtools__workspace2-module__workspaceFixedContainer___W9cgZ",workspaceContainerWithoutActionMenu:"-esm-devtools__workspace2-module__workspaceContainerWithoutActionMenu___fRrxd"},d7=e=>e.registeredWorkspacesByName,d9=({lifeCycle:e,openedWorkspace:t,openedWindow:n,groupProps:o,actions:r,renderChrome:i,isRootWorkspace:s,isLeafWorkspace:a,showActionMenu:l})=>{let c=(0,rF.useMemo)(()=>t&&{closeWorkspace:async(e={})=>{let{closeWindow:o=!1,discardUnsavedChanges:i=!1}=e;return o?!!(i||await r.promptForClosingWorkspaces())&&(r.closeWorkspace(n.openedWorkspaces[0].workspaceName),!0):!!(i||await r.promptForClosingWorkspaces(t.workspaceName))&&(r.closeWorkspace(t.workspaceName),!0)},launchChildWorkspace:async(e,o)=>{let i=t.workspaceName,{openedWorkspaces:s}=n,a=s.findIndex(e=>e.workspaceName===i);-1===a||a!==s.length-1&&s.slice(a+1).some(e=>e.hasUnsavedChanges)&&!await r.promptForClosingWorkspaces(s[a+1].workspaceName)||r.openChildWorkspace(i,e,o||{})},setWorkspaceTitle:e=>r.setWorkspaceTitle(t.uuid,e),setHasUnsavedChanges:e=>r.setHasUnsavedChanges(t.uuid,e),workspaceName:t.workspaceName,workspaceProps:t.props,windowProps:n.props,groupProps:o,workspaceMeta:rE.getState().registeredWorkspacesByName[t.workspaceName]?.meta??{},isRootWorkspace:s,isLeafWorkspace:a,windowName:n.windowName,showActionMenu:l},[t,n,o,r,s,a,l]),u=!i&&!a,d=(0,rF.useMemo)(()=>e?(0,sA.jsx)(d6.A,{config:e,mountParcel:rU,wrapWith:"div",wrapClassName:sR()(d4.workspaceContent,{[d4.hiddenExtraWorkspace]:u}),...c},t.workspaceName):null===e?(0,sA.jsx)("div",{className:sR()(d4.workspaceContent,{[d4.hiddenExtraWorkspace]:u}),children:(0,sA.jsx)(sW.InlineNotification,{kind:"error",title:tm("error"),subtitle:tm("somethingWentWrongTryReloading"),hideCloseButton:!0})}):null,[e,t.workspaceName,c,u]);return i?(0,sA.jsx)("div",{children:(0,sA.jsx)(me,{openedWorkspace:t,openedWindow:n,isRootWorkspace:s,showActionMenu:l,closeWindow:()=>c.closeWorkspace({closeWindow:!0}),children:d})}):d??(0,sA.jsx)(sW.InlineLoading,{className:sR()(d4.loader,{[d4.hiddenExtraWorkspace]:u}),description:`${tm("loading")}`})},me=({openedWorkspace:e,openedWindow:t,isRootWorkspace:n,showActionMenu:o,closeWindow:r,children:i})=>{let s=i2(),{openedGroup:a,openedWindows:l,registeredWindowsByName:c,registeredWorkspacesByName:u,registeredGroupsByName:d,isMostRecentlyOpenedWindowHidden:m,setWindowMaximized:f,hideWindow:p}=dY(),g=t.windowName,{maximized:h}=t,w=e.title??"",_=c[g],v=d0(t,u,c),y=_?.icon,b=_?.canMaximize,x=!!a&&d[a.groupName]?.persistence==="closable",S=!!y&&!x,k=l.findIndex(e=>e.windowName===g)<l.length-1||m,j=Object.values(c).some(e=>e.group===a?.groupName&&void 0!==e.icon);return(0,sA.jsxs)("div",{className:sR()(d4.workspaceOuterContainer,{[d4.narrowWorkspace]:"narrow"===v,[d4.widerWorkspace]:"wider"===v,[d4.extraWideWorkspace]:"extra-wide"===v,[d4.isActionMenuOpened]:j}),children:[(0,sA.jsx)("div",{className:sR()(d4.workspaceSpacer,{[d4.hidden]:k})}),(0,sA.jsx)("div",{className:sR()(d4.workspaceMiddleContainer,{[d4.maximized]:h,[d4.hidden]:k,[d4.isRootWorkspace]:n,[d4.showActionMenu]:o}),children:(0,sA.jsx)("div",{className:sR()(d4.workspaceInnerContainer,{[d4.maximized]:h,[d4.hidden]:k,[d4.isRootWorkspace]:n}),children:i?(0,sA.jsxs)(sA.Fragment,{children:[(0,sA.jsxs)(sW.Header,{"aria-label":tm("workspaceHeader"),className:d4.header,children:[(0,sA.jsx)(sW.HeaderName,{prefix:"",children:w}),(0,sA.jsx)("div",{className:d4.overlayHeaderSpacer}),(0,sA.jsx)(sW.HeaderGlobalBar,{className:d4.headerButtons,children:i5(s)?(0,sA.jsxs)(sA.Fragment,{children:[(b||h)&&(0,sA.jsx)(sW.HeaderGlobalAction,{"aria-label":h?tm("minimize"):tm("maximize"),onClick:()=>f(g,!h),children:h?(0,sA.jsx)(d8.Xj,{}):(0,sA.jsx)(d8.hz,{})}),S&&(0,sA.jsx)(sW.HeaderGlobalAction,{"aria-label":tm("hide"),onClick:()=>p(),children:(0,sA.jsx)(s2,{})}),!x&&(0,sA.jsx)(sW.HeaderGlobalAction,{"aria-label":tm("close"),onClick:r,children:(0,sA.jsx)(au,{})})]}):(0,sA.jsxs)(sA.Fragment,{children:[S&&(0,sA.jsx)(sW.HeaderGlobalAction,{"aria-label":tm("hide"),onClick:()=>p(),children:(0,sA.jsx)(d3.d3,{})}),(0,sA.jsx)(sW.HeaderGlobalAction,{"aria-label":tm("close"),onClick:()=>{x?dD():r()},children:(0,sA.jsx)(au,{})})]})})]}),i]}):(0,sA.jsx)(sW.InlineLoading,{className:d4.loader,description:`${tm("loading")} ...`})})})]})},mt=({openedWindow:e,groupProps:t,actions:n,renderChrome:o,showActionMenu:r})=>{let{openedWorkspaces:i}=e,[s,a]=(0,rF.useState)({}),l=rX(rE,d7),c=(0,rF.useRef)(new Set);return(0,rF.useEffect)(()=>{let e=!1;return Promise.all(i.map(async t=>{let n=l[t.workspaceName];if(!n)return null;let{moduleName:o,component:r}=n;try{return[t.uuid,await sy(o,r)]}catch(n){return e||c.current.has(t.uuid)||(c.current.add(t.uuid),v(n)),[t.uuid,null]}})).then(t=>{e||a(Object.fromEntries(t.filter(e=>null!=e)))},v),()=>{e=!0}},[i,l]),(0,sA.jsx)(sA.Fragment,{children:i.map((a,l)=>(0,sA.jsx)(d9,{openedWorkspace:a,openedWindow:e,groupProps:t,actions:n,renderChrome:o,lifeCycle:s[a.uuid],isRootWorkspace:0===l,isLeafWorkspace:l===i.length-1,showActionMenu:r},a.uuid))})},mn=e=>e.registeredWorkspacesByName,mo=({name:e,workspaceProps:t,windowProps:n,groupProps:o,onWindowChanged:r})=>{let i=rX(rE,mn),s=rX(rE,t=>{let n=t.registeredWorkspacesByName[e]?.window;return n?t.registeredWindowsByName[n]:void 0}),a={name:e,workspaceProps:t,windowProps:n,groupProps:o},l=(0,rF.useRef)(),c=(0,rF.useRef)(null);if(!l.current){let r=d2(e,t,n);l.current=$({openedWindow:r,groupProps:o??null}),r&&(c.current=a)}let u=l.current;(0,rF.useEffect)(()=>{let r=c.current;if(r&&r.name===e&&x(r.workspaceProps,t)&&x(r.windowProps,n)&&x(r.groupProps,o))return;let i=d2(e,t,n);u.setState({openedWindow:i,groupProps:o??null},!0),c.current=i?a:null},[e,t,n,o,i,u]);let d=(0,rF.useMemo)(()=>(function(e){function t(t){e.setState(e=>{if(!e.openedWindow)return e;let n=t(e.openedWindow);return n===e.openedWindow?e:{...e,openedWindow:n}})}return{closeWorkspace(e){t(t=>dz(t,e))},openChildWorkspace(e,n,o){t(t=>dq(t,e,n,o))},setWorkspaceTitle(e,n){t(t=>dJ(t,e,{title:n}))},setHasUnsavedChanges(e,n){t(t=>dJ(t,e,{hasUnsavedChanges:n}))},promptForClosingWorkspaces(t){let{openedWindow:n}=e.getState();return n?dG(n,t):Promise.resolve(!0)}}})(u),[u]),{openedWindow:m,groupProps:f}=rX(u),p=m?.openedWorkspaces[m.openedWorkspaces.length-1],g=p?.workspaceName??null,h=p?.title??"",w=m?.openedWorkspaces.some(e=>e.hasUnsavedChanges)??!1,_=s?.width??"narrow",v=(0,rF.useRef)(r);return(0,rF.useEffect)(()=>{v.current=r}),(0,rF.useEffect)(()=>{v.current?.({workspaceName:g,windowWidth:_,title:h,hasUnsavedChanges:w})},[g,_,h,w]),(0,sA.jsx)("div",{className:"-esm-devtools__exported-workspace-module__exportedWorkspace___7PE0H",children:m?(0,sA.jsx)(mt,{openedWindow:m,groupProps:f,actions:d,renderChrome:!1,showActionMenu:!1}):null})},mr="-esm-devtools__action-menu-button2-module__container___jc6--",mi="-esm-devtools__action-menu-button2-module__elementContainer___whLL8",ms="-esm-devtools__action-menu-button2-module__active___fbyFm",ma="-esm-devtools__action-menu-button2-module__focused___+aVpz";function ml({getIcon:e,hasUnsavedChanges:t,tagContent:n}){return(0,sA.jsxs)(sA.Fragment,{children:[e({size:16}),t?(0,sA.jsx)("span",{className:"-esm-devtools__action-menu-button2-module__interruptedTag___sRkvS",children:"!"}):(0,sA.jsx)("span",{className:"-esm-devtools__action-menu-button2-module__countTag___XMH0D",children:n})]})}let mc=({icon:e,label:t,tagContent:n,workspaceToLaunch:o,onBeforeWorkspaceLaunch:r,hidden:i,disabled:s})=>{let a=i2(),{openedWindows:l,restoreWindow:c,hideWindow:u,isMostRecentlyOpenedWindowHidden:d}=dY(),{extension:m}=(0,rF.useContext)(rV),f=l.findIndex(e=>e.windowName===m?.extensionId),p=l[f],g=null!=p,h=g&&(f<l.length-1||d),w=g&&!h,_=p?.openedWorkspaces.some(e=>e.hasUnsavedChanges)??!1,v=async()=>{if(g)h?c(p.windowName):u();else if(await (r?.()??!0)){let{workspaceName:e,workspaceProps:t,windowProps:n}=o;dU(e,t,n)}};return i?.(l)?null:"tablet"===a||"phone"===a?(0,sA.jsxs)(sW.Button,{className:sR()(mr,{[ms]:g&&!w,[ma]:w}),iconDescription:t,kind:"ghost",onClick:v,role:"button",tabIndex:0,size:"md",disabled:s?.(l),children:[(0,sA.jsx)("span",{className:mi,children:(0,sA.jsx)(ml,{hasUnsavedChanges:_,getIcon:e,tagContent:n})}),(0,sA.jsx)("span",{children:t})]}):(0,sA.jsx)(sW.IconButton,{align:"left","aria-label":t,className:sR()(mr,{[ms]:g&&!w,[ma]:w}),enterDelayMs:300,kind:"ghost",label:t,onClick:v,size:"md",disabled:s?.(l),children:(0,sA.jsx)("div",{className:mi,children:(0,sA.jsx)(ml,{hasUnsavedChanges:_,getIcon:e,tagContent:n})})})};function mu({showContactDetails:e,toggleContactDetails:t,className:n}){return(0,sA.jsx)(sW.Button,{className:n,iconDescription:"Toggle contact details",kind:"ghost",onClick:t,renderIcon:e?ac:as,children:e?tm("showLess","Show less"):tm("showMore","Show more")})}let md={contactDetails:"-esm-devtools__patient-banner-contact-details-module__contactDetails___R7vfY",deceased:"-esm-devtools__patient-banner-contact-details-module__deceased___nTt+l",heading:"-esm-devtools__patient-banner-contact-details-module__heading___x7UoT",row:"-esm-devtools__patient-banner-contact-details-module__row___qFgIi",col:"-esm-devtools__patient-banner-contact-details-module__col___JXUlg",relationship:"-esm-devtools__patient-banner-contact-details-module__relationship___T3LO-"},mm=({patientUuid:e})=>{let{cohorts:t=[],isLoading:n}=function(e){let t=e?`${tj}/cohortm/cohortmember?patient=${e}&v=custom:(uuid,patient:ref,cohort:(uuid,name,startDate,endDate))`:null,{data:n,isLoading:o}=(0,ie.u)(t,tP),r=n?.data?.results.map(e=>({uuid:e.cohort.uuid,name:e.cohort.name,startDate:e.cohort.startDate,endDate:e.cohort.endDate}));return(0,rF.useMemo)(()=>({cohorts:r,isLoading:o}),[o,r])}(e);return(0,sA.jsxs)(sA.Fragment,{children:[(0,sA.jsxs)("p",{className:md.heading,children:[tm("patientLists","Patient Lists")," (",t?.length??0,")"]}),n?(0,sA.jsx)(sW.InlineLoading,{description:`${tm("loading","Loading")} ...`,role:"progressbar"}):(0,sA.jsxs)("ul",{children:[(()=>{if(t?.length>0){let e=t.sort((e,t)=>lZ(e?.startDate).getTime()-lZ(t?.startDate).getTime()).slice(0,3);return e?.map(e=>(0,sA.jsx)("li",{children:(0,sA.jsx)(rG,{to:`${window.spaBase}/home/patient-lists/${e.uuid}`,children:e.name},e.uuid)},e.uuid))}return(0,sA.jsx)("li",{children:"--"})})(),t.length>3&&(0,sA.jsx)("li",{className:md.link,children:(0,sA.jsx)(rG,{to:`${window.spaBase}/home/patient-lists`,children:tm("seeMoreLists","See {{count}} more lists",{count:t?.length-3})})})]})]})},mf=({patientId:e})=>{let{patient:t,isLoading:n}=sr(e),o=t?.address?.find(e=>"home"===e.use),r=e=>e.split("#")[1];return n?(0,sA.jsx)(sW.InlineLoading,{description:`${tm("loading","Loading")} ...`,role:"progressbar"}):(0,sA.jsxs)(sA.Fragment,{children:[(0,sA.jsx)("p",{className:md.heading,children:tm("address","Address")}),(0,sA.jsx)("ul",{children:o?Object.entries(o).filter(([e])=>"id"!==e&&"use"!==e).map(([e,t])=>"extension"===e?o.extension?.[0]?.extension?.map((t,n)=>(0,sA.jsxs)("li",{children:[tm(r(t.url),r(t.url)),": ",t.valueString]},`address-${e}-${n}`)):(0,sA.jsxs)("li",{children:[tm(e,e),": ",t]},`address-${e}`)):(0,sA.jsx)("li",{children:"--"})})]})},mp=({patientUuid:e})=>{let{isLoading:t,contactAttributes:n}=(e=>{let{contactAttributeTypes:t=[]}=iA({externalModuleName:"@openmrs/esm-patient-banner-app"}),{attributes:n,error:o,isLoading:r}=(e=>{let{data:t,error:n,isLoading:o}=(0,i$.A)(`${tj}/patient/${e}?v=custom:(uuid,display,identifiers:(identifier,uuid,preferred,location:(uuid,name),identifierType:(uuid,name,format,formatDescription,validator)),person:(uuid,display,gender,birthdate,dead,age,deathDate,birthdateEstimated,causeOfDeath,preferredName:(uuid,preferred,givenName,middleName,familyName),attributes,preferredAddress:(uuid,preferred,address1,address2,cityVillage,longitude,stateProvince,latitude,country,postalCode,countyDistrict,address3,address4,address5,address6,address7)))`,tP);return{isLoading:o,attributes:t?.data.person.attributes??[],error:n}})(e);return{contactAttributes:(0,rF.useMemo)(()=>n.filter(({attributeType:e})=>t?.some(t=>e.uuid===t)),[n,t]),isLoading:r,error:o}})(e),o=(0,rF.useMemo)(()=>n?[...n?.map(e=>[e.attributeType.display?tm(e.attributeType.display,e.attributeType.display):"",e.value])]:[],[n]);return(0,sA.jsxs)(sA.Fragment,{children:[(0,sA.jsx)("p",{className:md.heading,children:tm("contactDetails","Contact Details")}),t?(0,sA.jsx)(sW.InlineLoading,{description:`${tm("loading","Loading")} ...`,role:"progressbar"}):(0,sA.jsx)("ul",{children:o.length?o.map(([e,t],n)=>(0,sA.jsxs)("li",{children:[e,": ",t]},`${e}-${t}-${n}`)):(0,sA.jsx)("li",{children:"--"})})]})},mg=({patientId:e})=>{let{data:t,isLoading:n}=function(e){let t=`${tj}/relationship?v=custom:(display,uuid,personA:(age,display,birthdate,uuid),personB:(age,display,birthdate,uuid),relationshipType:(uuid,display,description,aIsToB,bIsToA))&person=${e}`,{data:n,error:o,isLoading:r,isValidating:i}=(0,ie.u)(e?t:null,tP),s=n?.data?.results?.length?function(e,t){let n=[];for(let o of t)e===o.personA.uuid?n.push({uuid:`${o.uuid}`,display:o.personB.display,relativeAge:o.personB.age,relativeUuid:o.personB.uuid,relationshipType:o.relationshipType.bIsToA}):n.push({uuid:`${o.uuid}`,display:o.personA.display,relativeAge:o.personA.age,relativeUuid:o.personA.uuid,relationshipType:o.relationshipType.aIsToB});return n}(e,n.data.results):null;return{data:n?s:null,error:o,isLoading:r,isValidating:i}}(e);return(0,sA.jsxs)(sA.Fragment,{children:[(0,sA.jsx)("p",{className:md.heading,children:tm("relationships","Relationships")}),n?(0,sA.jsx)(sW.InlineLoading,{description:`${tm("loading","Loading")} ...`,role:"progressbar"}):(0,sA.jsx)("ul",{children:t&&t.length>0?(0,sA.jsx)(sA.Fragment,{children:t.map(e=>(0,sA.jsxs)("li",{className:md.relationship,children:[(0,sA.jsx)("div",{children:(0,sA.jsx)(rG,{to:`${window.spaBase}/patient/${e.relativeUuid}/chart`,children:e.display})}),(0,sA.jsx)("div",{children:e.relationshipType}),(0,sA.jsx)("div",{children:`${e.relativeAge?e.relativeAge:"--"} ${e.relativeAge?1===e.relativeAge?tm("yearAbbreviation","yr"):tm("yearsAbbreviation","yrs"):""}`})]},e.uuid))}):(0,sA.jsx)("li",{children:"--"})})]})};function mh({patientId:e,deceased:t}){return(0,sA.jsxs)("div",{className:sR()(md.contactDetails,{[md.deceased]:t}),children:[(0,sA.jsxs)("div",{className:md.row,children:[(0,sA.jsx)("div",{className:md.col,children:(0,sA.jsx)(mf,{patientId:e})}),(0,sA.jsx)("div",{className:md.col,children:(0,sA.jsx)(mp,{patientUuid:e})})]}),(0,sA.jsxs)("div",{className:md.row,children:[(0,sA.jsx)("div",{className:md.col,children:(0,sA.jsx)(mg,{patientId:e})}),(0,sA.jsx)("div",{className:md.col,children:(0,sA.jsx)(mm,{patientUuid:e})})]})]})}function mw(e){let t=document.querySelector("template#loading-spinner");if(t){let n=t.content.cloneNode(!0),o=Array.prototype.map.call(n.childNodes,e=>e);return e.appendChild(n),()=>o.forEach(e=>e.remove())}return()=>{}}let m_="-esm-devtools__action-menu2-module__container___6Gke0";function mv({workspaceGroup:e,groupProps:t}){let n=i2(),{persistence:o}=e;return(0,sA.jsx)("aside",{className:"-esm-devtools__action-menu2-module__sideRail___T2lMV",children:(0,sA.jsxs)("div",{className:m_,children:["closable"==o&&i5(n)&&(0,sA.jsx)(sW.IconButton,{align:"left",onClick:()=>dD(),label:tm("close"),kind:"ghost",children:(0,sA.jsx)(au,{})}),(0,sA.jsx)(rV.Provider,{value:{moduleName:e.moduleName,featureName:e.name},children:(0,sA.jsx)(r3,{className:m_,name:e.name,state:{groupProps:t}})})]})})}function my(e){let t=new URL(e,window.location.origin).pathname,n=new URL(window.getOpenmrsSpaBase?.()??"/",window.location.origin).pathname,o=n.endsWith("/")?n.slice(0,-1):n,r=null;return o?o===t?r="/":t.startsWith(`${o}/`)&&(r=t.slice(o.length)):r=t,{full:t,spaRelative:r}}function mb(e){e&&(0,r4.createRoot)(e).render((0,sA.jsx)(mx,{}))}function mx(){let{openedGroup:e,openedWindows:t,registeredGroupsByName:n,registeredWindowsByName:o}=dY();if((0,rF.useEffect)(()=>nG("before-page-changed",t=>{let{newPage:o,cancelNavigation:r,oldUrl:i,newUrl:s}=t;if(!e)return;if(o)return void r(dD().then(e=>!e));let a=n[e.groupName],l=a?.scopePattern;l&&function(e,t,n){try{let o=new RegExp(e),r=my(t),i=my(n);if(null===r.spaRelative||null===i.spaRelative)return!0;let s=o.exec(r.spaRelative),a=o.exec(i.spaRelative);if(s&&a||(s=o.exec(r.full),a=o.exec(i.full)),!s||!a)return!0;if(s.length>1)return!s.slice(1).every((e,t)=>e===a[t+1]);return!1}catch{return!0}}(l,i,s)&&r(dD().then(e=>!e))}),[e,n]),!e)return null;let r=n[e.groupName],i=t.some(e=>e.maximized),{name:s}=r,a=Object.values(o).filter(e=>e.group===s&&void 0!==e.icon).sort((e,t)=>(e.order??Number.MAX_VALUE)-(t.order??Number.MAX_VALUE)).length>0;return(0,sA.jsxs)("div",{className:sR()("-esm-devtools__workspace-windows-and-menu-module__workspaceWindowsAndMenuContainer___2u2mc",{"-esm-devtools__workspace-windows-and-menu-module__overlay___7RHYZ":r.overlay,"-esm-devtools__workspace-windows-and-menu-module__hasMaximizedWindow___gvJRd":i}),children:[(0,sA.jsx)("div",{className:"-esm-devtools__workspace-windows-and-menu-module__workspaceWindowsContainer___40ITO",children:t.map(t=>(0,sA.jsx)(mS,{openedWindow:t,groupProps:e.props,showActionMenu:a},t.windowName))}),a&&(0,sA.jsx)(mv,{workspaceGroup:r,groupProps:e.props})]})}function mS({openedWindow:e,groupProps:t,showActionMenu:n}){let{windowName:o}=e,r=(0,rF.useMemo)(()=>({closeWorkspace(e){rE.setState(t=>dX.closeWorkspace(t,e))},openChildWorkspace(e,t,n){rE.setState(o=>dX.openChildWorkspace(o,e,t,n))},setWorkspaceTitle(e,t){rE.setState(n=>dX.setWorkspaceTitle(n,e,t))},setHasUnsavedChanges(e,t){rE.setState(n=>dX.setHasUnsavedChanges(n,e,t))},promptForClosingWorkspaces(e){let t=rE.getState().openedWindows.find(e=>e.windowName===o);return t?dG(t,e):Promise.resolve(!0)}}),[o]);return(0,sA.jsx)(mt,{openedWindow:e,groupProps:t,actions:r,renderChrome:!0,showActionMenu:n})}function mk(e,t,n){if(null==e)return n;let o=lD(e);if(!o)return console.warn(`matchLocale: invalid requested locale tag: ${JSON.stringify(e)}`),n;let r=[];for(let e of t){let t=lD(e);if(!t){console.warn(`matchLocale: skipping invalid available locale tag: ${JSON.stringify(e)}`);continue}r.push({canonical:t,original:e})}let i=o;for(;i;){let e=r.find(e=>e.canonical===i);if(e)return e.original;let t=i+"-",n=r.find(e=>e.canonical.startsWith(t));if(n)return n.original;if("ht"===i){i="fr-HT";continue}let o=i.lastIndexOf("-");if(-1===o)break;let s=(i=i.slice(0,o)).lastIndexOf("-");-1!==s&&i.length-s==2&&(i=i.slice(0,s))}return n}function mj(e=window.localStorage){try{return e.getItem("test"),!0}catch{return!1}}function mN(e){return!!e&&e.constructor===Object}var mE=n(3376);function mC(e){let[t,n,o]=e.split(".");return`${t}.${n}.${o}`}function mP(e,t){return mE(function(e){let t=e.indexOf("-");if(t>=0){let n=mC(e.slice(0,t)),o=e.slice(t+1);return`${n}-${o}`}return mC(e)}(t),e,{includePrerelease:!0})}async function mI(e,t={}){let n,{shouldRetry:o,getDelay:r,onError:i}=t;o=o??(e=>e<=5),r=r??(e=>(function(e,t=!1){return 1e3*Math.pow(2,t?e+1:e)})(e));let s=0;do try{return await mA(r(s)),await e()}catch(e){i?.(e,s),n=e}while(o(s++));throw n}async function mA(e){if(!(e<=0))return new Promise(t=>setTimeout(t,e))}function mO(e,t,n,o){}function mR(e){}function m$(e){return Promise.resolve([])}function mT(e){return Promise.resolve([])}function mM(e){return Promise.resolve({success:!1,result:void 0,error:"No service worker has been registered. Offline-related features have been removed from the framework."})}function mL(e){return()=>{}}function mW(){return!0}}}]);
|
|
28
|
+
To fix this, ensure that you define the "component" field inside the page definition.`,e);let o=function(e,{featureFlag:t}){return t?n=>!!oM(t)&&e(n):e}(function e(t){if(Array.isArray(t)){let n=t.map(e);return e=>n.some(t=>t(e))}return"string"==typeof t?(0,ta.fz)(window.getOpenmrsSpaBase()+t):t instanceof RegExp?e=>t.test(e.pathname.replace(window.getOpenmrsSpaBase(),"")):()=>t}(n),t);(0,ta.AG)(e,()=>sx(t.appName,t.component),o)}(o,t)}}let sP={PHONE_MIN:0,PHONE_MAX:600,TABLET_MIN:601,TABLET_MAX:1023,SMALL_DESKTOP_MIN:1024,SMALL_DESKTOP_MAX:1439,LARGE_DESKTOP_MIN:1440,LARGE_DESKTOP_MAX:Number.MAX_SAFE_INTEGER};function sI(){document.body.classList.toggle("omrs-breakpoint-lt-tablet",window.innerWidth<sP.TABLET_MIN),document.body.classList.toggle("omrs-breakpoint-gt-phone",window.innerWidth>sP.PHONE_MAX),document.body.classList.toggle("omrs-breakpoint-gt-tablet",window.innerWidth>sP.TABLET_MAX),document.body.classList.toggle("omrs-breakpoint-lt-desktop",window.innerWidth<sP.SMALL_DESKTOP_MIN),document.body.classList.toggle("omrs-breakpoint-lt-small-desktop",window.innerWidth<sP.SMALL_DESKTOP_MIN),document.body.classList.toggle("omrs-breakpoint-lt-large-desktop",window.innerWidth<sP.LARGE_DESKTOP_MIN),document.body.classList.toggle("omrs-breakpoint-gt-small-desktop",window.innerWidth>sP.SMALL_DESKTOP_MAX)}let sA=!1;function sO(){sA||(window.addEventListener("resize",sI),sI(),sA=!0)}var sR=n(5530),sT=n.n(sR);function s$({title:e,children:t}){let n="tablet"===i6();return(0,rG.jsxs)("div",{className:sT()({"-esm-devtools__card-header-module__tabletHeader___Vkmd-":n,"-esm-devtools__card-header-module__desktopHeader___ocWGq":!n}),children:[(0,rG.jsx)("h4",{children:e}),t]})}let sM=["red","magenta","purple","blue","teal","cyan","gray","green","warm-gray","cool-gray","high-contrast","outline"],sL={primaryColor:{_type:G.String,_description:"The color for displaying primary diagnoses tags",_default:"blue",_validators:[e9.oneOf(sM)]},secondaryColor:{_type:G.String,_description:"The color for displaying secondary diagnoses tags",_default:"gray",_validators:[e9.oneOf(sM)]}},sW={"Brand color #1":{_default:"#005d5d",_type:G.String},"Brand color #2":{_default:"#004144",_type:G.String},"Brand color #3":{_default:"#007d79",_type:G.String},excludePatientIdentifierCodeTypes:{uuids:{_type:G.Array,_description:"List of UUIDs of patient identifier types to exclude from rendering in the patient banner",_default:[],_elements:{_type:G.UUID}}},implementationName:{_type:G.String,_description:"A name of the place (or authority) where all possible locations a user can choose are located.",_default:"Clinic"},logo:{src:{_type:G.String,_default:"",_description:"The path or URL to the logo shown on the login page and while the server is starting up. If set to an empty string, the default OpenMRS logo is used.",_validators:[e9.isUrl]},alt:{_type:G.String,_default:"Logo",_description:"The alternative text for the logo image, displayed when the image cannot be loaded or on hover."}},patientPhotoConceptUuid:{_type:G.ConceptUuid,_default:"736e8771-e501-4615-bfa7-570c03f4bef5",_description:"Used to look up the patient photo, which is stored as an attachment obs. Set to `null` in order to disable the feature and use only generated avatars. To remove the avatars entirely, use extension configuration's `remove` feature."},preferredCalendar:{_type:G.Object,_description:"Keys should be locale codes, and values should be the preferred calendar for that locale. For example, {'am': 'ethiopic'}.",_default:{am:"ethiopic"},_elements:{_validators:[e9.oneOf(["buddhist","chinese","coptic","dangi","ethioaa","ethiopic","gregory","hebrew","indian","islamic","islamic-umalqura","islamic-tbla","islamic-civil","islamic-rgsa","iso8601","japanese","persian","roc","islamicc"])]}},preferredDateLocale:{_type:G.Object,_description:"Allows setting the locale used for date formatting for any browser locale. Does not affect time formatting. Keys should be locale codes, and values should be the preferred locale for formatting dates. For example, {'en': 'en-US', 'fr-CA': 'en-CA'}.",_default:{en:"en-GB"},_elements:{_type:G.String}},diagnosisTags:sL};var sD=n(8326);let sU={"carbon.table.batch.cancel":"cancel","carbon.table.batch.items.selected":"batchActionsItemsSelected","carbon.table.batch.item.selected":"batchActionItemSelected","carbon.table.batch.selectAll":"selectAll"},sB=e=>(0,rG.jsx)(sD.TableBatchActions,{translateWithId:(e,t)=>{let n=sU[e];return n?tm(n,e,t):e},...e}),sF="-esm-devtools__custom-overflow-menu-module__container___8PykS",sH="-esm-devtools__custom-overflow-menu-module__menu___qsOLn",sV="-esm-devtools__custom-overflow-menu-module__show___BserJ",sG="-esm-devtools__custom-overflow-menu-module__overflowMenuButton___n86Gz",sz=(0,rF.createContext)(null);function sq(){let e=(0,rF.useContext)(sz);if(!e)throw Error("useCustomOverflowMenu must be used within a CustomOverflowMenu");return e}function sJ({menuTitle:e,children:t}){let[n,o]=rH().useState(!1),r=se(()=>o(!1),n),i="tablet"===i6(),s=(0,rF.useCallback)(()=>o(e=>!e),[]),a=(0,rF.useRef)(null),l=(0,rF.useRef)(null),c=(0,rF.useId)(),u=`custom-overflow-menu-trigger-${c}`,d=`custom-overflow-menu-${c}`,m=(0,rF.useCallback)(()=>{o(!1),a.current?.focus()},[]),f=(0,rF.useMemo)(()=>({closeMenu:m}),[m]),p=(0,rF.useCallback)(e=>{"Escape"===e.key&&n&&(e.stopPropagation(),m())},[m,n]),g=rF.Children.toArray(t);(0,rF.useEffect)(()=>{if(n&&l.current){let e=l.current.querySelector('[role="menuitem"]:not([disabled])');e?.focus()}},[n]);let h=(0,rF.useCallback)(({currentIndex:e,direction:t})=>{let n=l.current?.querySelectorAll('[role="menuitem"]:not([disabled])');if(!n?.length)return;let o=document.activeElement?.closest?.('[role="menuitem"]')??document.activeElement,r=Array.from(n).indexOf(o);if(-1===r)return void n[t>0?0:n.length-1]?.focus();let i=r+t,s=i<0?n.length-1:i>=n.length?0:i;n[s]?.focus()},[]),w=g.map((e,t)=>(0,rF.isValidElement)(e)?(0,rF.cloneElement)(e,{closeMenu:m,handleOverflowMenuItemFocus:h,index:t}):e);return(0,rG.jsxs)("div",{"data-overflow-menu":!0,className:sT()("cds--overflow-menu",sF),ref:r,children:[(0,rG.jsx)("button",{className:sT()("cds--btn","cds--btn--ghost","cds--overflow-menu__trigger",{"cds--overflow-menu--open":n},sG),"aria-controls":d,"aria-expanded":n,"aria-haspopup":"true",id:u,onClick:s,onKeyDown:p,ref:a,children:e}),(0,rG.jsxs)("div",{className:sT()("cds--overflow-menu-options","cds--overflow-menu--flip",sH,{[sV]:n}),"aria-labelledby":u,"data-floating-menu-direction":"bottom",id:d,onKeyDown:p,ref:l,role:"menu",tabIndex:-1,children:[(0,rG.jsx)("ul",{className:sT()("cds--overflow-menu-options__content",{"cds--overflow-menu-options--lg":i}),children:(0,rG.jsx)(sz.Provider,{value:f,children:w})}),(0,rG.jsx)("span",{})]})]})}function sK(e){let t=(0,rF.useContext)(sz);return(0,rG.jsx)(sD.OverflowMenuItem,{...e,closeMenu:t?.closeMenu})}var sX=n(2277),sY=n(4194);let sZ=["omrs-icon-activity","omrs-icon-add","omrs-icon-arrow-down","omrs-icon-arrow-left","omrs-icon-arrow-right","omrs-icon-arrow-up","omrs-icon-baby","omrs-icon-calendar-heat-map","omrs-icon-calendar","omrs-icon-caret-down","omrs-icon-caret-left","omrs-icon-caret-right","omrs-icon-caret-up","omrs-icon-chart-average","omrs-icon-chart-line","omrs-icon-checkmark-filled","omrs-icon-checkmark-outline","omrs-icon-chemistry","omrs-icon-chevron-down","omrs-icon-chevron-left","omrs-icon-chevron-right","omrs-icon-chevron-up","omrs-icon-close","omrs-icon-close-filled","omrs-icon-close-outline","omrs-icon-document","omrs-icon-document-attachment","omrs-icon-download","omrs-icon-drug-order","omrs-icon-edit","omrs-icon-event-schedule","omrs-icon-events","omrs-icon-gender-female","omrs-icon-gender-male","omrs-icon-gender-other","omrs-icon-gender-unknown","omrs-icon-generic-order-type","omrs-icon-group","omrs-icon-group-access","omrs-icon-hospital-bed","omrs-icon-image-medical","omrs-icon-information","omrs-icon-information-filled","omrs-icon-information-square","omrs-icon-inventory-management","omrs-icon-lab-order","omrs-icon-list-checked","omrs-icon-location","omrs-icon-material-order","omrs-icon-maximize","omrs-icon-medication","omrs-icon-message-queue","omrs-icon-microscope","omrs-icon-mobile-check","omrs-icon-money","omrs-icon-mother","omrs-icon-movement","omrs-icon-overflow-menu--horizontal","omrs-icon-overflow-menu--vertical","omrs-icon-password","omrs-icon-pedestrian-family","omrs-icon-pen","omrs-icon-printer","omrs-icon-procedure-order","omrs-icon-programs","omrs-icon-renew","omrs-icon-referral-order","omrs-icon-report","omrs-icon-reset","omrs-icon-save","omrs-icon-search","omrs-icon-settings","omrs-icon-shopping-cart","omrs-icon-shopping-cart--arrow-down","omrs-icon-sticky-note-add","omrs-icon-switcher","omrs-icon-syringe","omrs-icon-table-of-contents","omrs-icon-table","omrs-icon-time","omrs-icon-tools","omrs-icon-translate","omrs-icon-trash-can","omrs-icon-tree-view--alt","omrs-icon-two-factor-authentication","omrs-icon-user-avatar","omrs-icon-user-follow","omrs-icon-user-xray","omrs-icon-user","omrs-icon-view-off","omrs-icon-view","omrs-icon-warning"],sQ=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,rG.jsx)(lS,{ref:t,icon:"omrs-icon-activity",iconProps:e})})),s0=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,rG.jsx)(lS,{ref:t,icon:"omrs-icon-add",iconProps:e})})),s1=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,rG.jsx)(lS,{ref:t,icon:"omrs-icon-arrow-down",iconProps:e})})),s2=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,rG.jsx)(lS,{ref:t,icon:"omrs-icon-arrow-left",iconProps:e})})),s5=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,rG.jsx)(lS,{ref:t,icon:"omrs-icon-arrow-right",iconProps:e})})),s6=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,rG.jsx)(lS,{ref:t,icon:"omrs-icon-arrow-up",iconProps:e})})),s8=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,rG.jsx)(lS,{ref:t,icon:"omrs-icon-baby",iconProps:e})})),s3=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,rG.jsx)(lS,{ref:t,icon:"omrs-icon-calendar-heat-map",iconProps:e})})),s4=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,rG.jsx)(lS,{ref:t,icon:"omrs-icon-calendar",iconProps:e})})),s9=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,rG.jsx)(lS,{ref:t,icon:"omrs-icon-caret-down",iconProps:e})})),s7=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,rG.jsx)(lS,{ref:t,icon:"omrs-icon-caret-left",iconProps:e})})),ae=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,rG.jsx)(lS,{ref:t,icon:"omrs-icon-caret-right",iconProps:e})})),at=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,rG.jsx)(lS,{ref:t,icon:"omrs-icon-caret-up",iconProps:e})})),an=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,rG.jsx)(lS,{ref:t,icon:"omrs-icon-chart-average",iconProps:e})})),ao=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,rG.jsx)(lS,{ref:t,icon:"omrs-icon-chart-line",iconProps:e})})),ar=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,rG.jsx)(lS,{ref:t,icon:"omrs-icon-checkmark-filled",iconProps:e})})),ai=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,rG.jsx)(lS,{ref:t,icon:"omrs-icon-checkmark-outline",iconProps:e})})),as=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,rG.jsx)(lS,{ref:t,icon:"omrs-icon-chemistry",iconProps:e})})),aa=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,rG.jsx)(lS,{ref:t,icon:"omrs-icon-chevron-down",iconProps:e})})),al=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,rG.jsx)(lS,{ref:t,icon:"omrs-icon-chevron-left",iconProps:e})})),ac=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,rG.jsx)(lS,{ref:t,icon:"omrs-icon-chevron-right",iconProps:e})})),au=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,rG.jsx)(lS,{ref:t,icon:"omrs-icon-chevron-up",iconProps:e})})),ad=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,rG.jsx)(lS,{ref:t,icon:"omrs-icon-close",iconProps:e})})),am=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,rG.jsx)(lS,{ref:t,icon:"omrs-icon-close-filled",iconProps:e})})),af=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,rG.jsx)(lS,{ref:t,icon:"omrs-icon-close-outline",iconProps:e})})),ap=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,rG.jsx)(lS,{ref:t,icon:"omrs-icon-document",iconProps:e})})),ag=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,rG.jsx)(lS,{ref:t,icon:"omrs-icon-document-attachment",iconProps:e})})),ah=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,rG.jsx)(lS,{ref:t,icon:"omrs-icon-download",iconProps:e})})),aw=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,rG.jsx)(lS,{ref:t,icon:"omrs-icon-drug-order",iconProps:e})})),a_=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,rG.jsx)(lS,{ref:t,icon:"omrs-icon-edit",iconProps:e})})),av=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,rG.jsx)(lS,{ref:t,icon:"omrs-icon-event-schedule",iconProps:e})})),ay=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,rG.jsx)(lS,{ref:t,icon:"omrs-icon-events",iconProps:e})})),ab=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,rG.jsx)(lS,{ref:t,icon:"omrs-icon-gender-female",iconProps:e})})),ax=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,rG.jsx)(lS,{ref:t,icon:"omrs-icon-gender-male",iconProps:e})})),aS=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,rG.jsx)(lS,{ref:t,icon:"omrs-icon-gender-other",iconProps:e})})),aj=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,rG.jsx)(lS,{ref:t,icon:"omrs-icon-gender-unknown",iconProps:e})})),ak=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,rG.jsx)(lS,{ref:t,icon:"omrs-icon-generic-order-type",iconProps:e})})),aN=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,rG.jsx)(lS,{ref:t,icon:"omrs-icon-group",iconProps:e})})),aC=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,rG.jsx)(lS,{ref:t,icon:"omrs-icon-group-access",iconProps:e})})),aE=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,rG.jsx)(lS,{ref:t,icon:"omrs-icon-hospital-bed",iconProps:e})})),aP=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,rG.jsx)(lS,{ref:t,icon:"omrs-icon-image-medical",iconProps:e})})),aI=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,rG.jsx)(lS,{ref:t,icon:"omrs-icon-information",iconProps:e})})),aA=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,rG.jsx)(lS,{ref:t,icon:"omrs-icon-information-filled",iconProps:e})})),aO=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,rG.jsx)(lS,{ref:t,icon:"omrs-icon-information-square",iconProps:e})})),aR=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,rG.jsx)(lS,{ref:t,icon:"omrs-icon-inventory-management",iconProps:e})})),aT=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,rG.jsx)(lS,{ref:t,icon:"omrs-icon-lab-order",iconProps:e})})),a$=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,rG.jsx)(lS,{ref:t,icon:"omrs-icon-list-checked",iconProps:e})})),aM=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,rG.jsx)(lS,{ref:t,icon:"omrs-icon-location",iconProps:e})})),aL=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,rG.jsx)(lS,{ref:t,icon:"omrs-icon-material-order",iconProps:e})})),aW=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,rG.jsx)(lS,{ref:t,icon:"omrs-icon-maximize",iconProps:e})})),aD=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,rG.jsx)(lS,{ref:t,icon:"omrs-icon-medication",iconProps:e})})),aU=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,rG.jsx)(lS,{ref:t,icon:"omrs-icon-message-queue",iconProps:e})})),aB=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,rG.jsx)(lS,{ref:t,icon:"omrs-icon-microscope",iconProps:e})})),aF=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,rG.jsx)(lS,{ref:t,icon:"omrs-icon-mobile-check",iconProps:e})})),aH=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,rG.jsx)(lS,{ref:t,icon:"omrs-icon-money",iconProps:e})})),aV=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,rG.jsx)(lS,{ref:t,icon:"omrs-icon-mother",iconProps:e})})),aG=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,rG.jsx)(lS,{ref:t,icon:"omrs-icon-movement",iconProps:e})})),az=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,rG.jsx)(lS,{ref:t,icon:"omrs-icon-overflow-menu--horizontal",iconProps:e})})),aq=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,rG.jsx)(lS,{ref:t,icon:"omrs-icon-overflow-menu--horizontal",iconProps:e})})),aJ=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,rG.jsx)(lS,{ref:t,icon:"omrs-icon-password",iconProps:e})})),aK=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,rG.jsx)(lS,{ref:t,icon:"omrs-icon-pedestrian-family",iconProps:e})})),aX=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,rG.jsx)(lS,{ref:t,icon:"omrs-icon-pen",iconProps:e})})),aY=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,rG.jsx)(lS,{ref:t,icon:"omrs-icon-printer",iconProps:e})})),aZ=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,rG.jsx)(lS,{ref:t,icon:"omrs-icon-procedure-order",iconProps:e})})),aQ=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,rG.jsx)(lS,{ref:t,icon:"omrs-icon-programs",iconProps:e})})),a0=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,rG.jsx)(lS,{ref:t,icon:"omrs-icon-referral-order",iconProps:e})})),a1=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,rG.jsx)(lS,{ref:t,icon:"omrs-icon-renew",iconProps:e})})),a2=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,rG.jsx)(lS,{ref:t,icon:"omrs-icon-report",iconProps:e})})),a5=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,rG.jsx)(lS,{ref:t,icon:"omrs-icon-reset",iconProps:e})})),a6=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,rG.jsx)(lS,{ref:t,icon:"omrs-icon-save",iconProps:e})})),a8=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,rG.jsx)(lS,{ref:t,icon:"omrs-icon-search",iconProps:e})})),a3=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,rG.jsx)(lS,{ref:t,icon:"omrs-icon-settings",iconProps:e})})),a4=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,rG.jsx)(lS,{ref:t,icon:"omrs-icon-switcher",iconProps:e})})),a9=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,rG.jsx)(lS,{ref:t,icon:"omrs-icon-shopping-cart",iconProps:e})})),a7=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,rG.jsx)(lS,{ref:t,icon:"omrs-icon-shopping-cart--arrow-down",iconProps:e})})),le=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,rG.jsx)(lS,{ref:t,icon:"omrs-icon-sticky-note-add",iconProps:e})})),lt=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,rG.jsx)(lS,{ref:t,icon:"omrs-icon-syringe",iconProps:e})})),ln=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,rG.jsx)(lS,{ref:t,icon:"omrs-icon-table-of-contents",iconProps:e})})),lo=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,rG.jsx)(lS,{ref:t,icon:"omrs-icon-table",iconProps:e})})),lr=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,rG.jsx)(lS,{ref:t,icon:"omrs-icon-time",iconProps:e})})),li=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,rG.jsx)(lS,{ref:t,icon:"omrs-icon-tools",iconProps:e})})),ls=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,rG.jsx)(lS,{ref:t,icon:"omrs-icon-translate",iconProps:e})})),la=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,rG.jsx)(lS,{ref:t,icon:"omrs-icon-trash-can",iconProps:e})})),ll=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,rG.jsx)(lS,{ref:t,icon:"omrs-icon-tree-view--alt",iconProps:e})})),lc=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,rG.jsx)(lS,{ref:t,icon:"omrs-icon-two-factor-authentication",iconProps:e})})),lu=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,rG.jsx)(lS,{ref:t,icon:"omrs-icon-user-avatar",iconProps:e})})),ld=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,rG.jsx)(lS,{ref:t,icon:"omrs-icon-user-follow",iconProps:e})})),lm=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,rG.jsx)(lS,{ref:t,icon:"omrs-icon-user-xray",iconProps:e})})),lf=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,rG.jsx)(lS,{ref:t,icon:"omrs-icon-user",iconProps:e})})),lp=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,rG.jsx)(lS,{ref:t,icon:"omrs-icon-view-off",iconProps:e})})),lg=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,rG.jsx)(lS,{ref:t,icon:"omrs-icon-view",iconProps:e})})),lh=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,rG.jsx)(lS,{ref:t,icon:"omrs-icon-warning",iconProps:e})})),lw=lh,l_=ag,lv=a$,ly=aP,lb=a7,lx=(0,rF.memo)((0,rF.forwardRef)(function({icon:e,fallback:t,...n},o){let r=(0,rF.useRef)(e?document.getElementById(e):void 0);return(0,rF.useEffect)(()=>{let t=document.getElementById("omrs-svgs-container"),n=new MutationObserver(t=>{for(let n of t)"childList"===n.type&&(r.current=e?document.getElementById(e):void 0)});return t&&n.observe(t,{childList:!0}),()=>n.disconnect()},[e]),(0,rG.jsx)(ix,{value:r.current,fallback:t,children:(0,rG.jsx)(lS,{ref:o,icon:e,iconProps:n})})})),lS=(0,rF.memo)((0,rF.forwardRef)(function({icon:e,iconProps:t},n){let{className:o,fill:r,size:i}=Object.assign({},{fill:"currentColor",size:20},t);(i<=0||i>72)&&(console.error(`Invalid size '${i}' specified for ${e}. Defaulting to 20.`),i=20);let s=(0,rF.useRef)(null);return(0,rF.useImperativeHandle)(n,()=>s.current),(0,rF.useEffect)(()=>{s.current&&"currentColor"!==r&&s.current.style.setProperty("--omrs-icon-fill",r)},[]),(0,rG.jsx)("svg",{ref:s,className:sT()("omrs-icon","-esm-devtools__icons-module__icon___BfFhd",o),height:i,width:i,viewBox:"0 0 16 16",children:(0,rG.jsx)("use",{href:`#${e}`})})})),lj=({path:e,title:t,basePath:n,icon:o})=>{let{t:r}=(0,it.useTranslation)(),i=(0,sX.zy)(),s=(0,rF.useMemo)(()=>{if(!e)return!1;let t=e.startsWith("/")?e.slice(1):e;if(t.startsWith("http"))return t===window.location.href;let n=t.split("/").map(e=>decodeURIComponent(e)),o=(i.pathname??"").split("/").slice(1).map(e=>decodeURIComponent(e));return o.some((e,t)=>n.every((e,n)=>o[t+n]===e))},[i.pathname,e]);return(0,rG.jsx)("div",{children:(0,rG.jsx)(rz,{className:sT()("cds--side-nav__link",{"active-left-nav-link":s}),to:`${n}/${encodeURIComponent(e)}`,children:(0,rG.jsxs)("span",{className:"-esm-devtools__dashboard-module__menu___ds1tf",children:[(0,rG.jsx)(lx,{icon:o,className:"-esm-devtools__dashboard-module__icon___4Zrrh",size:16}),(0,rG.jsx)("span",{children:r(t)})]})})},e)};function lk(e){return function({basePath:t}){return(0,rG.jsx)(sY.Kd,{children:(0,rG.jsx)(lj,{basePath:t,...e})})}}var lN=n(7715),lC=n(7532),lE=n(3692),lP=n(7615),lI=n(700),lA=n(6816),lO=n(1168);function lR(e){return rH().createElement(lO.C,e)}var lT=n(3010),l$=n(6513),lM=n(6190);function lL(e,t,n=!1){if(null==e)return n?e:void 0;if("string"==typeof e&&!e)return n?null:void 0;if(e instanceof lT.ng||e instanceof lT._l||e instanceof lT.Ip)return t?(0,l$.yP)(e,t):e;{let n=sm()(e).toDate(),o=new lT.ng(n.getFullYear(),n.getMonth()+1,n.getDate());return t?(0,l$.yP)(o,t):o}}function lW(e){if(e)return e.toDate((0,lM.Xj)())}var lD=n(9002);function lU(e){if("string"==typeof e&&0!==e.trim().length)try{return new Intl.Locale(e.replace(/[_@]/g,"-")).toString()}catch{return}}function lB(e){let t=e??"",n=lU(t);if(!n)return t;try{return new Intl.DisplayNames([n],{type:"language"}).of(n)??t}catch{return t}}function lF(){let e=window.i18next.language,t=lU(e)??e;return"ht"===t&&(t="fr-HT"),t}var lH=n(7883),lV=n(424),lG=n(1492),lz=n(8271);function lq(e,t){var n=function(e,t){if(!t.has(e))throw TypeError("attempted to get private field on non-instance");return t.get(e)}(e,t);return n.get?n.get.call(e):n.value}sd.extend(sf),sd.extend(lG),sd.extend(lV);let lJ="YYYY-MM-DDTHH:mm:ss.SSSZZ",lK=/^(\d{4})(?:-(\d{2})(?:-(\d{2}))?)?$/;function lX(e,t){let n=lK.exec(e);if(!n)return(0,lH.CD)(e,t);let o=Number(n[1]),r=void 0===n[2]?void 0:Number(n[2]),i=void 0===n[3]?void 0:Number(n[3]),s=new Date(0);return(s.setUTCFullYear(o,(r??1)-1,i??1),s.getUTCFullYear()!==o||s.getUTCMonth()!==(r??1)-1||s.getUTCDate()!==(i??1))?{invalid:`Invalid ISO calendar date '${e}'`}:{year:o,...void 0!==r&&{month:r},...void 0!==i&&{day:i}}}function lY(e){return null!=e&&28===e.trim().length&&"T"===(e=e.trim())[10]&&":"===e[13]&&":"===e[16]&&"."===e[19]&&("+"===e[23]||"-"===e[23])&&sd(e,lJ).isValid()}function lZ(e){return sd(e).isToday()}function lQ(e){return lY(e)?sd(e,lJ).toDate():null}function l0(e,t=!1){let n=sd(e);return t&&(n=n.utc()),n.format(lJ)}function l1(e){return sd(e).toDate()}var l2=new WeakMap;let l5=new class{register(e,t){lq(this,l2).set(e,t)}getCalendar(e){if(!e)return;if(e.calendar)return e.calendar;if(e.region){let t=`${e.language}-${e.region}`;if(lq(this,l2).has(t))return lq(this,l2).get(t)}if(e.language&&lq(this,l2).has(e.language))return lq(this,l2).get(e.language);let t=new Intl.DateTimeFormat(e.toString()).resolvedOptions().calendar;return lq(this,l2).set(`${e.language}${e.region?`-${e.region}`:""}`,t),t}constructor(){!function(e,t,n){if(t.has(e))throw TypeError("Cannot initialize the same private elements twice on an object");t.set(e,n)}(this,l2,{writable:!0,value:new Map})}};function l6(e,t){l5.register(e,t)}function l8(e){let t=e??lF();return l5.getCalendar(t instanceof Intl.Locale?t:new Intl.Locale(t))}let l3={mode:"standard",time:"for today",day:!0,month:!0,year:!0,noToday:!1};function l4(e,t={}){let n=lX(e,lF());if(n.invalid)return console.warn(`Could not parse invalid date '${e}'`),null;!(0,lz.A)(n.day)&&(0,lz.A)(n.month)&&(n=Object.assign({},(0,H.A)(n,"day"),{month:n.day})),n.month&&(n.month-=1),n.day&&(n=Object.assign({},(0,H.A)(n,"day"),{date:n.day}));let o=sd().set(n).toDate();return(0,lz.A)(n.year)&&(t.year=!1),(0,lz.A)(n.month)&&(t.month=!1),(0,lz.A)(n.date)&&(t.day=!1),l9(o,t)}function l9(e,t){let n,o=t?.locale??lF(),r=new Intl.Locale(o),{calendar:i,mode:s,time:a,day:l,month:c,year:u,noToday:d,numberingSystem:m}={...l3,...{noToday:"am"===r.language},...t},f={calendar:i??l8(r),year:u?"numeric":void 0,month:c?"short":void 0,day:l?"2-digit":void 0,numberingSystem:m},p=sd(e).isToday();if(p&&!d)n=(n=new Intl.RelativeTimeFormat(o,{numeric:"auto"}).format(0,"day"))[0].toLocaleUpperCase(o)+n.slice(1);else{"en"===r.language&&(o="en-GB");let t=new Intl.DateTimeFormat(o,f).formatToParts(e);("en"===r.language||"am"===r.language)&&"standard"==s&&u&&l&&(t=t.map(l7("-"))),"wide"==s&&(t=t.map(l7(" — "))),"ethiopic"===f.calendar&&(t=t.filter((e,t,n)=>"era"!==e.type&&("literal"!==e.type||!(t<n.length-1)||"era"!==n[t+1].type))),n=t.map(e=>e.value).join("")}return(!0===a||p&&"for today"===a)&&(n+=`, ${ce(e)}`),n}let l7=e=>(t,n,o)=>"literal"!==t.type||" "!==t.value||n<o.length-1&&"era"===o[n+1].type?t:{type:"literal",value:e};function ce(e){return e.toLocaleTimeString(lF(),{hour:"2-digit",minute:"2-digit"})}function ct(e,t){return l9(e,{...t,time:!0})}function cn(e,t){let n=l8("string"==typeof t?new Intl.Locale(t):t);return n?(0,l$.yP)(e,(0,lD.d)(n)):e}function co(e,t){return new Intl.DurationFormat(lF(),t).format(e)}function cr(e,t){if(null==e)return null;if("string"==typeof e){let n=lX(e,lF());return n.invalid?(console.warn(`Could not interpret '${e}' as a date`),null):(n.day&&!n.month&&(n={...(0,H.A)(n,"day"),...{month:n.day}}),n.month&&(n.month-=1),n.day&&(n={...(0,H.A)(n,"day"),...{date:n.day}}),sd(t).set(n))}return sd(e)}let ci=["years","months","days","hours","minutes","seconds"],cs={second:"seconds",minute:"minutes",hour:"hours",day:"days",month:"months",year:"years"},ca={seconds:45,minutes:45,hours:22,days:26,months:11,years:1/0};function cl(e,t=sd(),n){let o,r=sd(t),i=cr(e,r);if(null==i)return null;if("string"==typeof n){let e=cs[n]??n;return{[e]:r.diff(i,e)}}let{thresholds:s,largestUnit:a,smallestUnit:l}=n??{};if(void 0!==a||void 0!==l){let e,t=l?cs[l]??l:void 0;return e="auto"===a||void 0===a?function(e,t,n){let o=ci.indexOf(n);for(let r=0;r<ci.length;r++){let i=ci[r];if(t.diff(e,i)>0)return r<=o?i:n}return n}(i,r,t??"seconds"):cs[a]??a,function(e,t,n,o){let r=ci.indexOf(n),i=ci.indexOf(o),s=ci.slice(r,i+1),a={},l=e;for(let e of s){let n=t.diff(l,e);a[e]=n,l=l.add(n,e)}return a}(i,r,e,t??e)}let c=(o=function(e){let t={...ca};if(e)for(let[n,o]of Object.entries(e))void 0!==o&&(t[cs[n]??n]=o);return t}(s),r.diff(i,"seconds")<o.seconds?"seconds":r.diff(i,"minutes")<o.minutes?"minutes":r.diff(i,"hours")<o.hours?"hours":r.diff(i,"days")<o.days?"days":r.diff(i,"months")<o.months?"months":"years");return{[c]:r.diff(i,c)}}let cc={style:"short",localeMatcher:"lookup"};function cu(e,t=sd(),n){let o=cl(e,t,n);return null==o?null:co(o,"object"==typeof n&&n.formatOptions?{...cc,...n.formatOptions}:cc)}let cd=(0,rF.createContext)(null);function cm(){let e=iR({externalModuleName:"@openmrs/esm-styleguide"}).preferredDateLocale,t=(0,rF.useMemo)(()=>{let t=lF();return e[t]&&(t=e[t]),t},[window.i18next.language]),n=(0,rF.useMemo)(()=>{let e=l8(t);return void 0!==e?(0,lD.d)(e):void 0},[t]),o=(0,rF.useMemo)(()=>new Intl.Locale(t,{calendar:n?.identifier}),[t,n]),r=(0,rF.useMemo)(()=>n?(0,l$.yP)((0,lM.Ec)((0,lM.Xj)()),n):(0,lM.Ec)((0,lM.Xj)()),[n]);return{calendar:n,intlLocale:o,today_:r}}let cf=new lT.ng(1793,1,1);var cp=n(5830),cg=n(5354),ch=n(4745),cw=n(1202);function c_(e,t){return Number.parseInt(l9(e,{calendar:t.calendar,locale:t.baseName,day:!1,month:!1,noToday:!0,numberingSystem:"latn"}))}let cv=(0,rF.forwardRef)(function(e,t){let{className:n}=e,o=(0,rF.useContext)(cp.f2),r=(0,rF.useContext)(cp._I),i=o??r,s=(0,rF.useContext)(cd),a=(0,lM.Xj)(),l=l9(i.visibleRange.start.toDate(a),{calendar:s.calendar,locale:s.baseName,day:!1,year:!1,noToday:!0}),c=c_(i.visibleRange.start.toDate(a),s),u=i.maxValue?c_(i.maxValue.toDate(a),s):void 0,d=i.minValue?c_(i.minValue.toDate(a),s):void 0,m=(0,rF.useCallback)(e=>{i.setFocusedDate(i.focusedDate.cycle("year",e-i.focusedDate.year))},[]);return i&&(0,rG.jsxs)("span",{ref:t,className:n,children:[(0,rG.jsx)("span",{children:l}),(0,rG.jsxs)(ch.oz,{formatOptions:{useGrouping:!1},maxValue:u,minValue:d,onChange:m,value:c,children:[(0,rG.jsx)(cw.p,{}),(0,rG.jsxs)(lP.Y,{children:[(0,rG.jsx)(lI.$,{slot:"increment",children:(0,rG.jsx)(at,{size:8})}),(0,rG.jsx)(lI.$,{slot:"decrement",children:(0,rG.jsx)(s9,{size:8})})]})]})]})});var cy=n(9588);let cb="-esm-devtools__datepicker-module__inputGroup___+4zks",cx="-esm-devtools__datepicker-module__inputSegment___wiExn",cS="-esm-devtools__datepicker-module__dateInputWrapper___uiyAC",cj="-esm-devtools__datepicker-module__invalidText___SxtTL",ck="-esm-devtools__datepicker-module__flatButton___UU1Qp",cN="-esm-devtools__datepicker-module__flatButtonMd___fhR-1",cC="-esm-devtools__datepicker-module__flatButtonSm___5INZ7",cE="-esm-devtools__datepicker-module__flatButtonLg___RFMrl";function cP({children:e}){let t=(0,rF.useContext)(lC.Pg),n=(0,rF.useContext)(lC.a8),o=t??n,r=se(()=>o?.close());return(0,rG.jsx)(cy.lG,{className:"-esm-devtools__datepicker-module__dialog___qllIf",ref:r,children:e})}let cI=(0,rF.forwardRef)(function({variant:e,today_:t,minDate:n,maxDate:o},r){let i="range"===e,s=i?cp._e:cp.Vv;return(0,rG.jsx)(cg.A,{ref:r,className:"-esm-devtools__datepicker-module__popover___16UMX",placement:"bottom start",offset:1,isNonModal:!0,children:(0,rG.jsx)(cP,{children:(0,rG.jsxs)(s,{...i?{minValue:n,maxValue:o,className:"cds--date-picker__calendar"}:{},children:[(0,rG.jsxs)("header",{className:"-esm-devtools__datepicker-module__header___WAVlD",children:[(0,rG.jsx)(lI.$,{className:sT()(ck,cN),slot:"previous",children:(0,rG.jsx)(al,{size:16})}),(0,rG.jsx)(cv,{className:"-esm-devtools__datepicker-module__monthYear___A3aKF"}),(0,rG.jsx)(lI.$,{className:sT()(ck,cN),slot:"next",children:(0,rG.jsx)(ac,{size:16})})]}),(0,rG.jsx)(cp.r8,{className:"-esm-devtools__datepicker-module__calendarGrid___6qRB2",children:e=>(0,rG.jsx)(cp.Zr,{className:sT()("cds--date-picker__day",{"-esm-devtools__datepicker-module__today___TZl6M":0===t.compare(e)}),date:e},e.toString())})]})})})});var cA=n(8017),cO=n(9774),cR=n(7956);let cT=(0,rF.forwardRef)(function(e,t){let n=(0,rF.useContext)(lC.Pg),[o,r]=(0,lN.JT)({slot:e.slot},t,cO.cQ),{locale:i}=(0,lO.Y)(),s=(0,cR.F)({...o,locale:i,createCalendar:lD.d}),a=(0,rF.useRef)(null),{fieldProps:l,inputProps:c}=(0,cA.cJ)({...o,inputRef:a},s,r),u=(0,rF.useCallback)(()=>{s.isDisabled||n.toggle()},[]);return(0,rG.jsxs)(lN.Kq,{values:[[cO.$,s],[cw.E,{...c,ref:a}],[lP.t,{...l,ref:r,isInvalid:s.isInvalid}]],children:[(0,rG.jsx)(lP.Y,{...e,id:e.id,ref:t,slot:e.slot||void 0,className:e.className,isDisabled:s.isDisabled,isInvalid:s.isInvalid,onClick:u,children:s.segments.map((t,n)=>(0,rF.cloneElement)(e.children(t),{key:n}))}),(0,rG.jsx)(cw.p,{})]})}),c$=(0,rF.forwardRef)(function(e,t){let n=(0,rF.useContext)(lC.Pg),o=(0,rF.useContext)(lC.a8);return(n??o).isInvalid?(0,rG.jsx)(lh,{ref:t,size:16,...e}):(0,rG.jsx)(s4,{ref:t,size:16,...e})});var cM=n(64),cL=n(5503),cW=n(1697),cD=n(7866),cU=n(8035),cB=n(2231);let cF=(0,rF.forwardRef)(function({segment:e,...t},n){let o=(0,rF.useContext)(cO.$),r=(0,cM.U)(n),{segmentProps:i}=(0,cL.V)(e,o,r),{focusProps:s,isFocused:a,isFocusVisible:l}=(0,cW.o)(),{hoverProps:c,isHovered:u}=(0,cD.M)({...t,isDisabled:o.isDisabled||"literal"===e.type}),d=function(e){let{className:t,style:n,children:o,defaultClassName:r,defaultChildren:i,defaultStyle:s,values:a}=e;return(0,rF.useMemo)(()=>{let e,l,c;return e="function"==typeof t?t({...a,defaultClassName:r}):t,l="function"==typeof n?n({...a,defaultStyle:s||{}}):n,c="function"==typeof o?o({...a,defaultChildren:i}):null==o?i:o,{className:e??r,style:l||s?{...s,...l}:void 0,children:c??i,"data-rac":""}},[t,n,o,r,i,s,a])}({...t,values:{...e,isReadOnly:!e.isEditable,isInvalid:o.isInvalid,isDisabled:o.isDisabled,isHovered:u,isFocused:a,isFocusVisible:l},defaultChildren:e.text}),m=(0,rF.useCallback)(e=>{e.stopPropagation()},[]);return(0,rG.jsx)("span",{...(0,cU.v)((0,cB.$)(t),i,s,c),...d,ref:r,style:i.style,"data-placeholder":e.isPlaceholder||void 0,"data-invalid":o.isInvalid||void 0,"data-readonly":!e.isEditable||void 0,"data-disabled":o.isDisabled||void 0,"data-type":e.type,"data-hovered":u||void 0,"data-focused":a||void 0,"data-focus-visible":l||void 0,onClick:m})}),cH={short:!1,size:"md"},cV=(0,rF.forwardRef)(function(e,t){let{className:n,defaultValue:o,isDisabled:r,invalid:i,invalidText:s,isInvalid:a,label:l,labelText:c,light:u,maxDate:d,minDate:m,onChange:f,onChangeRaw:p,short:g,size:h,value:w,..._}={...cH,...e},{calendar:v,intlLocale:y,today_:b}=cm(),x=(0,rF.useId)(),S=!!(c??l),j=(0,rF.useMemo)(()=>lL(o,v),[o,v]),k=(0,rF.useMemo)(()=>lL(w,v,!0),[w,v]),N=(0,rF.useMemo)(()=>lL(d,v),[d,v]),C=(0,rF.useMemo)(()=>lL(m??cf,v),[m,v]),E=(0,rF.useMemo)(()=>i||a,[i,a]),P=(0,rF.useMemo)(()=>(p&&f&&console.error("An OpenmrsDatePicker component was created with both onChange and onChangeRaw handlers defined. Only onChangeRaw will be used."),p??(e=>f?.(lW(e)))),[p,f]);return(0,rG.jsx)(lR,{locale:y.toString(),children:(0,rG.jsx)("div",{className:sT()("cds--form-item",n),children:(0,rG.jsx)(lN.Kq,{values:[[cd,y]],children:(0,rG.jsxs)(lC.lr,{className:sT()("cds--date-picker","cds--date-picker--single",{"cds--date-picker--short":g,"cds--date-picker--light":u}),defaultValue:j,isDisabled:r,isInvalid:E,maxValue:N,minValue:C,value:k,shouldForceLeadingZeros:"en"===y.language||void 0,..._,onChange:P,children:[(0,rG.jsxs)("div",{className:"cds--date-picker-container",children:[S&&(0,rG.jsx)(lE.J,{className:sT()("cds--label",{"cds--label--disabled":r}),htmlFor:x,children:c??l}),(0,rG.jsxs)(lP.Y,{className:cb,children:[(0,rG.jsx)(cT,{id:S?x:void 0,ref:t,className:sT()("cds--date-picker-input__wrapper","-esm-devtools__datepicker-module__inputWrapper___kykar",{"-esm-devtools__datepicker-module__inputWrapperSm___KJtg-":"sm"===h,"-esm-devtools__datepicker-module__inputWrapperMd___ablE9":"md"===h||!h||0===h.length,"-esm-devtools__datepicker-module__inputWrapperLg___5dkQp":"lg"===h}),children:e=>"era"!==e.type?(0,rG.jsx)(cF,{className:cx,segment:e}):(0,rG.jsx)(rH().Fragment,{})}),(0,rG.jsx)(lI.$,{className:sT()(ck,{[cC]:"sm"===h,[cN]:"md"===h||!h||0===h.length,[cE]:"lg"===h}),children:(0,rG.jsx)(c$,{})})]}),(0,rG.jsx)(lA.b,{className:cj,children:s})]}),(0,rG.jsx)(cI,{variant:"single",today_:b})]})})})})}),cG=(0,rF.forwardRef)(function({className:e,defaultValue:t,invalid:n,invalidText:o,isDisabled:r,isInvalid:i,label:s,labelText:a,light:l,maxDate:c,minDate:u,onChange:d,onChangeRaw:m,size:f="md",value:p,...g},h){let{calendar:w,intlLocale:_,today_:v}=cm(),y=(0,rF.useId)(),b=!!(a??s),x=(0,rF.useMemo)(()=>{if(p)return{start:lL(p[0],w,!1),end:lL(p[1],w,!1)}},[p,w]),S=(0,rF.useMemo)(()=>{if(t)return{start:lL(t[0],w,!1),end:lL(t[1],w,!1)}},[t,w]),j=(0,rF.useMemo)(()=>lL(u??cf,w,!0),[u,w]),k=(0,rF.useMemo)(()=>lL(c,w,!0),[c,w]),N=(0,rF.useMemo)(()=>n||i,[n,i]),C=(0,rF.useMemo)(()=>(m&&d&&console.error("An OpenmrsDateRangePicker component was created with both onChange and onChangeRaw handlers defined. Only onChangeRaw will be used."),m??(e=>d?.([lW(e.start),lW(e.end)]))),[m,d]);return(0,rG.jsx)(lR,{locale:_.toString(),children:(0,rG.jsx)("div",{className:sT()("cds--form-item",e),children:(0,rG.jsx)(lN.Kq,{values:[[cd,_]],children:(0,rG.jsx)(lC.Ur,{id:b?y:void 0,className:sT()("cds--date-picker",{"cds--date-picker--light":l,"cds--date-picker--disabled":r}),isInvalid:N,shouldForceLeadingZeros:"en"===_.language||void 0,maxValue:k,minValue:j,value:x,defaultValue:S,ref:h,isDisabled:r,...g,onChange:C,children:(0,rG.jsxs)("div",{className:"cds--date-picker-container",children:[b&&(0,rG.jsx)(lE.J,{className:sT()("cds--label",{"cds--label--disabled":r}),htmlFor:y,children:a??s}),(0,rG.jsxs)(lP.Y,{className:cb,children:[(0,rG.jsxs)("div",{className:sT()("-esm-devtools__datepicker-module__inputsWrapper___YlkGh",{"-esm-devtools__datepicker-module__inputsWrapperSm___fAKhS":"sm"===f,"-esm-devtools__datepicker-module__inputsWrapperMd___XVgGP":"md"===f||!f||0===f.length,"-esm-devtools__datepicker-module__inputsWrapperLg___UgHJ1":"lg"===f}),children:[(0,rG.jsx)(cO.J3,{className:sT()("cds--date-picker-input__wrapper","-esm-devtools__datepicker-module__startInput___qgbQm",cS),slot:"start",children:e=>(0,rG.jsx)(cF,{className:cx,segment:e})}),(0,rG.jsx)("div",{className:"-esm-devtools__datepicker-module__separator___79vXZ",children:(0,rG.jsx)("span",{"aria-hidden":"true","data-readonly":!0,children:"–"})}),(0,rG.jsx)(cO.J3,{className:sT()("cds--date-picker-input__wrapper","-esm-devtools__datepicker-module__endInput___huv7x",cS),slot:"end",children:e=>(0,rG.jsx)(cF,{className:cx,segment:e})})]}),(0,rG.jsx)(lI.$,{className:sT()(ck,{[cC]:"sm"===f,[cN]:"md"===f||!f||0===f.length,[cE]:"lg"===f}),children:(0,rG.jsx)(c$,{})})]}),(0,rG.jsx)(lA.b,{className:cj,children:o}),(0,rG.jsx)(cI,{variant:"range",today_:v,minDate:j,maxDate:k})]})})})})})});var cz=n(9606);let cq=({diagnoses:e,showCertainty:t=!1})=>{let{diagnosisTags:n}=iR({externalModuleName:"@openmrs/esm-styleguide"});return(0,rG.jsx)("div",{className:"-esm-devtools__diagnosis-tags-module__container___8kut8",children:e.map(e=>{let o=t&&"PROVISIONAL"===e.certainty,r=1===e.rank?n?.primaryColor??"blue":n?.secondaryColor??"gray";return(0,rG.jsx)(cJ,{color:r,isProvisional:o,name:e.display},e.uuid)})})};function cJ({color:e,isProvisional:t,name:n}){let[o,r]=(0,rF.useState)(!1),[i,s]=(0,rF.useState)(!1),[a,l]=(0,rF.useState)(!1),c=a||i,u=(0,rF.useRef)(null);(0,rF.useLayoutEffect)(()=>{let e=u.current;if(!e)return;let t=()=>{let t=e.scrollWidth>e.clientWidth;l(t),t||r(!1)};t();let n=new ResizeObserver(t);return n.observe(e),()=>n.disconnect()},[n,t,c]);let d=sT()("cds--tag","cds--tag--md","cds--layout--size-md",`cds--tag--${e}`,"-esm-devtools__diagnosis-tags-module__diagnosisTag___PFhpl"),m=(0,rG.jsxs)(rG.Fragment,{children:[t&&(0,rG.jsxs)(rG.Fragment,{children:[(0,rG.jsx)("span",{"aria-hidden":"true",className:"-esm-devtools__diagnosis-tags-module__provisionalMark___8o6l4",children:"?"}),(0,rG.jsxs)("span",{className:"cds--visually-hidden",children:[tm("provisional","Provisional")," "]})]}),(0,rG.jsx)("span",{ref:u,className:"cds--tag__label",children:n})]});return c?(0,rG.jsxs)(cz.k$,{delay:0,closeDelay:150,isOpen:o,onOpenChange:r,children:[(0,rG.jsx)(lI.$,{className:d,"data-testid":"diagnosis-tag",onFocusChange:s,onPress:()=>r(!0),children:m}),(0,rG.jsx)(cz.m_,{className:"-esm-devtools__diagnosis-tags-module__tagTooltip___asRTH",placement:"bottom",offset:4,containerPadding:8,children:n})]}):(0,rG.jsx)("span",{className:d,"data-testid":"diagnosis-tag",children:m})}let cK={action:"-esm-devtools__empty-card-module__action___Y0dul",content:"-esm-devtools__empty-card-module__content___fo0nB",desktopHeading:"-esm-devtools__empty-card-module__desktopHeading___0Cg1N",tabletHeading:"-esm-devtools__empty-card-module__tabletHeading___BogTF",tile:"-esm-devtools__empty-card-module__tile___QB8Ld"},cX=({width:e="64",height:t="64"})=>(0,rG.jsx)("svg",{width:e,height:t,viewBox:"0 0 64 64",children:(0,rG.jsx)("use",{href:"#omrs-empty-data-illustration"})}),cY=e=>{let t="tablet"===i6(),n=e.launchForm;return(0,rG.jsx)(sD.Layer,{className:cK.layer,children:(0,rG.jsxs)(sD.Tile,{className:cK.tile,children:[(0,rG.jsx)("div",{className:t?cK.tabletHeading:cK.desktopHeading,children:(0,rG.jsx)("h4",{children:e.headerTitle})}),(0,rG.jsx)(cX,{}),(0,rG.jsx)("p",{className:cK.content,children:tm("emptyStateText","There are no {{displayText}} to display",{displayText:e.displayText})}),(0,rG.jsx)("p",{className:cK.action,children:n&&(0,rG.jsx)(sD.Button,{onClick:()=>n(),kind:"ghost",size:t?"lg":"sm",children:tm("recordNewEntry","Record {{ displayText }}",{displayText:e.displayText})})})]})})},cZ=({error:e,headerTitle:t})=>{let n="tablet"===i6();return(0,rG.jsx)(sD.Layer,{children:(0,rG.jsxs)(sD.Tile,{className:"-esm-devtools__error-state-module__tile___dd418",children:[(0,rG.jsx)("div",{className:n?"-esm-devtools__error-state-module__tabletHeading___g5rjg":"-esm-devtools__error-state-module__desktopHeading___Nd9u2",children:(0,rG.jsx)("h4",{children:t})}),(0,rG.jsxs)("p",{className:"-esm-devtools__error-state-module__errorMessage___z2RiN",children:[tm("error","Error")," ",`${e?.response?.status}: `,e?.response?.statusText]}),(0,rG.jsx)("p",{className:"-esm-devtools__error-state-module__errorCopy___dq+e2",children:tm("errorCopy")})]})})},cQ=cZ,c0=rH().forwardRef((e,t)=>{let{slotName:n,basePath:o,componentContext:r,state:i}=i4(),s=window.location??{pathname:""},a=r6(n??"");return e.isChildOfHeader&&n&&a.length>0?(0,rG.jsxs)(sD.SideNav,{"aria-label":tm("leftNavigation","Left navigation"),className:"-esm-devtools__left-nav-module__leftNav___jzTJK",expanded:!0,isFixedNav:!0,ref:t,...e,children:[(0,rG.jsx)(r4,{name:"global-nav-menu-slot"}),n?(0,rG.jsx)(ix,{value:r,fallback:(0,rG.jsx)(r4,{name:n,state:{basePath:o,currentPath:s,...i}}),children:(0,rG.jsx)(rV.Provider,{value:r,children:(0,rG.jsx)(r4,{name:n,state:{basePath:o,currentPath:s,...i}})})}):null]}):null}),c1=({selectedLocationUuid:e,defaultLocationUuid:t,locationTag:n,locationsPerRequest:o=50,onChange:r})=>{let[i,s]=(0,rF.useState)(""),a=(0,rF.useId)(),{location:l}=function(e){let t=e?`/ws/fhir2/R4/Location?_id=${e}`:null,{data:n,error:o,isLoading:r}=(0,iM.A)(t,tP,{shouldRetryOnError:e=>!!e?.response?.status&&e.response.status>=500});return(0,rF.useMemo)(()=>({location:n?.data?.entry?n.data.entry[0]:null,error:t?o:null,isLoading:!!t&&r}),[n,r,o,t])}(t),{locations:c,isLoading:u,hasMore:d,loadingNewData:m,error:f,setPage:p}=function(e,t=0,n=""){let o=i$(n),{data:r,isLoading:i,isValidating:s,setSize:a,error:l}=(0,iX.Ay)(function(n,r){if(r){let e=r.data?.link?.find(e=>"next"===e.relation);if(!e)return null;let t=new URL(e.url);return t.origin===window.location.origin?e.url:new URL(`${t.pathname}${t.search?`?${t.search}`:""}`,window.location.origin).toString()}let i=`${tN}/Location?`,s=new URLSearchParams;return s.append("_summary","data"),t&&s.append("_count",""+t),n&&s.append("_getpagesoffset",""+n*t),e&&s.append("_tag",e),"string"==typeof o&&""!==o&&s.append("name:contains",o),i+s.toString()},tP);return(0,rF.useMemo)(()=>({locations:r?.length?r?.flatMap(e=>e?.data?.entry??[]):[],isLoading:i,totalResults:r?.[0]?.data?.total,hasMore:!!r?.length&&r?.[r.length-1]?.data?.link?.some(e=>"next"===e.relation),loadingNewData:s,error:l||null,setPage:a}),[i,r,s,a,l])}(n,o,i),g=(0,rF.useMemo)(()=>l&&!i&&t?[l,...c.filter(({resource:e})=>e.id!==t)]:c??[],[l,c,t,i]),h=(0,rF.useCallback)(e=>{r(),s(e.trim())},[r]),w=st((0,rF.useCallback)(()=>{!m&&d&&p(e=>e+1)},[m,d,p])),_=d?Math.max(0,Math.floor(g.length-o/2)):-1;return(0,rG.jsxs)(rG.Fragment,{children:[(0,rG.jsx)(sD.Search,{"aria-describedby":f?`${a}-error`:void 0,labelText:tm("searchForLocation"),id:a,placeholder:tm("searchForLocation"),onChange:e=>h(e.target.value),size:"lg"}),f&&(0,rG.jsx)("div",{className:"-esm-devtools__location-picker-module__errorNotification___vWBFD",id:`${a}-error`,children:(0,rG.jsx)(sD.InlineNotification,{kind:"error",subtitle:tm("errorLoadingLoginLocations","Unable to load login locations. Please try again or contact support if the problem persists."),title:tm("error","Error")})}),(0,rG.jsx)("div",{className:"-esm-devtools__location-picker-module__searchResults___Gbet+",children:u?(0,rG.jsx)("div",{className:"-esm-devtools__location-picker-module__loadingContainer___QO-zj",children:Array.from({length:5}).map((e,t)=>(0,rG.jsx)(sD.RadioButtonSkeleton,{className:"-esm-devtools__location-picker-module__radioButtonSkeleton___otoCy",role:"progressbar"},t))}):(0,rG.jsxs)(rG.Fragment,{children:[(0,rG.jsx)("div",{className:"-esm-devtools__location-picker-module__locationResultsContainer___6Pasf",children:g.length>0?(0,rG.jsx)(sD.RadioButtonGroup,{name:"loginLocations",onChange:e=>{r(e?.toString())},orientation:"vertical",valueSelected:e,children:g.map((e,t)=>(0,rG.jsx)(sD.RadioButton,{className:"-esm-devtools__location-picker-module__locationRadioButton___rTDPj",id:e.resource.id,labelText:(0,rG.jsx)("span",{ref:t===_?w:null,children:e.resource.name}),name:e.resource.name,value:e.resource.id},e.resource.id))}):(0,rG.jsx)("div",{className:"-esm-devtools__location-picker-module__emptyState___w4-Ca",children:(0,rG.jsx)("p",{className:"-esm-devtools__location-picker-module__locationNotFound___Of2MJ",children:tm("noResultsToDisplay")})})}),m&&(0,rG.jsx)("div",{className:"-esm-devtools__location-picker-module__loadingIcon___NAwSB",children:(0,rG.jsx)(sD.InlineLoading,{description:tm("loading")})})]})})]})},c2=R("modalState",{modalContainer:null,modalStack:[]}),c5=0;async function c6(e,t,n={}){let o=rN(t),r=null;if(e){if(!o)throw Error(`No modal named '${t}' has been registered.`);let{load:i}=o,s=await i(),a=c5++;r=await rW({...s,name:`${t}-${a}`},{...n,domElement:e})}else v(`Failed to launch modal. Please notify your administrator. Modal name: ${t}`);return r}function c8(e){return"TO_BE_DELETED"===e.state||"DELETED"===e.state}function c3(e,t){t?.unmount&&(t.unmountPromise?.catch(()=>{}),t.unmount().catch(t=>{console.error(`The modal '${e}' failed to unmount`,t)}))}function c4(e){return e.find(e=>!c8(e))}function c9(e,t){e.container&&(e.container.style.visibility=t?"unset":"hidden")}let c7=window.getComputedStyle(document.body).overflow;function ue({modalStack:e,modalContainer:t}){if(t)if(e.length){t.style.visibility||(addEventListener("keydown",un),document.body.style.overflow="hidden",t.style.visibility="unset");let n=c4(e);e.forEach(e=>{switch(e.state){case"NEW":{let n=function({size:e}){let t=document.createElement("div");return t.className=`cds--modal-container cds--modal-container--${e}`,t.setAttribute("role","dialog"),t.setAttribute("tabindex","-1"),t.setAttribute("aria-modal","true"),t}({size:e.props?.size??"md"});e.container=n,e.state="MOUNTING",c6(n,e.modalName,e.props).then(o=>{c8(e)?c3(e.modalName,o):o?(e.parcel=o,t.prepend(n),c9(e,c4(c2.getState().modalStack)===e),o.mountPromise.then(()=>{c8(e)||(e.state="MOUNTED")},t=>{v(t),e.parcel=null,ut(e)})):ut(e)},t=>{v(t),ut(e)});break}case"MOUNTING":case"MOUNTED":c9(e,e===n);break;case"TO_BE_DELETED":e.state="DELETED",e.onClose(),c3(e.modalName,e.parcel),e.container?.remove(),setTimeout(()=>{let t=c2.getState();c2.setState({...t,modalStack:t.modalStack.filter(t=>t!==e)})},0)}})}else t.style.removeProperty("visibility"),document.body.style.overflow=c7,removeEventListener("keydown",un)}function ut(e){if(c8(e))return;e.state="TO_BE_DELETED";let t=c2.getState();c2.setState({...t,modalStack:[...t.modalStack]})}function un(e){"Escape"===e.key&&function(){let[e]=c2.getState().modalStack;e&&ut(e)}()}function uo(e){c2.subscribe(ue),c2.setState({...c2.getState(),modalContainer:e})}function ur(e,t={},n=()=>{}){let o=()=>{let e=c2.getState().modalStack.find(e=>e.onClose===n);e&&ut(e)};if(rN(e)){var r;let i,s;r={state:"NEW",onClose:n,modalName:e,props:{close:o,...t}},s=[r,...(i=c2.getState()).modalStack],c2.setState({...i,modalStack:s})}else v(`Failed to launch modal. Please notify your administrator. Modal name: "${e}"`);return o}var ui=n(9685);let us=({notification:e})=>{let{description:t,action:n,kind:o,critical:r,title:i,onAction:s}=e;return(0,rG.jsx)(sD.ActionableNotification,{actionButtonLabel:n,kind:o||"info",lowContrast:r,subtitle:t,title:i||"",inline:!0,onActionButtonClick:s})},ua=({subject:e})=>{let[t,n]=(0,rF.useState)([]);return(0,rF.useEffect)(()=>{let t=e.subscribe(e=>n(t=>[...t.filter(t=>t.description!==e.description||t.action!==e.action||t.kind!==e.kind||t.title!==e.title),e]));return()=>t.unsubscribe()},[e]),(0,rG.jsx)(rG.Fragment,{children:t.map(e=>(0,rG.jsx)(us,{notification:e},e.id))})},ul=({notification:e})=>{let{actionButtonLabel:t,onActionButtonClick:n=()=>{},subtitle:o,kind:r,title:i,critical:s,progressActionLabel:a,id:l,...c}=e,[u,d]=(0,rF.useState)(t);return(0,rG.jsx)(sD.ActionableNotification,{kind:r||"info",actionButtonLabel:u,ariaLabel:tm("closesActionableNotification","Closes actionable notification"),onActionButtonClick:()=>{n(),a&&d(a)},statusIconDescription:tm("actionableNotification","Actionable notification"),subtitle:o,title:i,lowContrast:s,inline:!0,...c})},uc=({subject:e})=>{let[t,n]=(0,rF.useState)([]);return(0,rF.useEffect)(()=>{let t=e.subscribe(e=>n(t=>[...t.filter(t=>t.subtitle!==e.subtitle||t.actionButtonLabel!==e.actionButtonLabel||t.onActionButtonClick!==e.onActionButtonClick||t.kind!==e.kind||t.title!==e.title),e]));return()=>t.unsubscribe()},[e]),(0,rG.jsx)(rG.Fragment,{children:t.map(e=>(0,rG.jsx)(ul,{notification:e},e.id))})};class uu{subscribe(e){return this.listeners.add(e),{unsubscribe:()=>{this.listeners.delete(e)}}}next(e){for(let t of[...this.listeners])t(e)}constructor(){!function(e,t,n){t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n}(this,"listeners",new Set)}}let ud=new uu,um=0,uf=new uu,up=0;function ug(e){e&&(0,r9.createRoot)(e).render((0,rG.jsx)(ua,{subject:ud}))}function uh(e){var t;e&&("string"==typeof(t=e.description)?t.trim().length>0:"object"==typeof t&&(t instanceof Error||!(0,ui.A)(t)))?(e.description instanceof Error&&(e.description=e.description.toLocaleString()),setTimeout(()=>{ud.next({...e,id:um++})},0)):console.error("showNotification must be called with an object having a 'description' property that is a non-empty string or object")}function uw(e){e&&(0,r9.createRoot)(e).render((0,rG.jsx)(uc,{subject:uf}))}function u_(e){var t;e&&("string"==typeof(t=e.actionButtonLabel)?t.trim().length>0:"object"==typeof t&&!(0,ui.A)(t))?setTimeout(()=>{uf.next({...e,id:up++})},0):console.error("showActionableNotification must be called with an actionButtonLabel that is a non-empty string")}let uv=["NORMAL","HIGH","CRITICALLY_HIGH","OFF_SCALE_HIGH","LOW","CRITICALLY_LOW","OFF_SCALE_LOW"],uy=["critically_low","critically_high","high","low","normal","off_scale_low","off_scale_high"],ub={container:"-esm-devtools__numeric-observation-module__container___NfxbH",card:"-esm-devtools__numeric-observation-module__card___9oQAh","abnormal-value":"-esm-devtools__numeric-observation-module__abnormal-value___drvEi","critical-value":"-esm-devtools__numeric-observation-module__critical-value___JAIHt",cell:"-esm-devtools__numeric-observation-module__cell___lTunW","critically-high":"-esm-devtools__numeric-observation-module__critically-high___aDUjc","critically-low":"-esm-devtools__numeric-observation-module__critically-low___5srAK",high:"-esm-devtools__numeric-observation-module__high___7KiyK",low:"-esm-devtools__numeric-observation-module__low___Zs2ct","label-container":"-esm-devtools__numeric-observation-module__label-container___lGnGH","value-container":"-esm-devtools__numeric-observation-module__value-container___hHPXt",label:"-esm-devtools__numeric-observation-module__label___WFuxk",value:"-esm-devtools__numeric-observation-module__value___6fHUr",units:"-esm-devtools__numeric-observation-module__units___EdVuw","pad-right":"-esm-devtools__numeric-observation-module__pad-right___6T9Cd","off-scale-low":"-esm-devtools__numeric-observation-module__off-scale-low___Sc1CV","off-scale-high":"-esm-devtools__numeric-observation-module__off-scale-high___cWpU2",arrow:"-esm-devtools__numeric-observation-module__arrow___SLGUh"},ux=({value:e,unit:t,label:n,interpretation:o,referenceRange:r,conceptUuid:i,variant:s="card",patientUuid:a})=>{let l=(0,rF.useId)(),{referenceRange:c,isLoading:u}=function(e,t){let n=null;e&&(n=t?`${tk}/conceptreferencerange/?patient=${t}&concept=${e}&v=full`:`${tk}/conceptreferencerange/?concept=${e}&v=full`);let{data:o,error:r,isLoading:i}=(0,iM.A)(n,tP),s=o?.data?.results?.[0];return{referenceRange:s?{hiNormal:s.hiNormal??null,hiAbsolute:s.hiAbsolute??null,hiCritical:s.hiCritical??null,lowNormal:s.lowNormal??null,lowAbsolute:s.lowAbsolute??null,lowCritical:s.lowCritical??null}:void 0,error:r,isLoading:i}}(r||o?void 0:i,a),d=r??c,m=(0,rF.useMemo)(()=>{if(o)return o?"--"===o?"normal":uv.includes(o)?o.toLowerCase():uy.includes(o)?o:"normal":void 0;if(d&&!u){if(!d||null==e||""===e)return"normal";let t="string"==typeof e?Number.parseFloat(e):e;return Number.isNaN(t)?"normal":null!==d.hiAbsolute&&void 0!==d.hiAbsolute&&t>d.hiAbsolute?"off_scale_high":null!==d.hiCritical&&void 0!==d.hiCritical&&t>=d.hiCritical?"critically_high":null!==d.hiNormal&&void 0!==d.hiNormal&&t>d.hiNormal?"high":null!==d.lowAbsolute&&void 0!==d.lowAbsolute&&t<d.lowAbsolute?"off_scale_low":null!==d.lowCritical&&void 0!==d.lowCritical&&t<=d.lowCritical?"critically_low":null!==d.lowNormal&&void 0!==d.lowNormal&&t<d.lowNormal?"low":"normal"}return"normal"},[o,d,e,u])??"normal",f="critically_low"===m||"critically_high"===m||"off_scale_low"===m||"off_scale_high"===m,p="normal"!==m,g=n?`omrs-numeric-obs-label-${n.replaceAll(/\s+/g,"-").toLowerCase()}-${l}`:void 0,h=`omrs-numeric-obs-value-${l}`,w=`omrs-numeric-obs-unit-${l}`,_=null!=e&&""!==e,v=_?e:tm("notAvailable","Not available"),y=sT()({[ub["critically-low"]]:"critically_low"===m||"off_scale_low"===m,[ub["critically-high"]]:"critically_high"===m||"off_scale_high"===m,[ub.low]:"low"===m,[ub.high]:"high"===m,[ub["off-scale-low"]]:"off_scale_low"===m,[ub["off-scale-high"]]:"off_scale_high"===m}),b=sT()({[ub.container]:!0,[ub.card]:!0,[ub["critical-value"]]:f,[ub["abnormal-value"]]:p&&!f}),x=sT()({[ub.cell]:!0,[y]:!0});return"cell"===s?(0,rG.jsxs)("div",{className:x,children:[v,_&&t?` ${t}`:""]}):(0,rG.jsxs)("section",{className:b,"data-testid":"numeric-observation-card",children:[n&&(0,rG.jsxs)("div",{className:ub["label-container"],children:[(0,rG.jsx)("span",{id:g,className:ub.label,children:n}),p&&(0,rG.jsx)("span",{className:ub[m.replace("_","-")],title:tm("abnormalValue","Abnormal value")})]}),(0,rG.jsxs)("div",{className:ub["value-container"],children:[(0,rG.jsx)("span",{id:h,"aria-labelledby":g&&w?`${g} ${w}`:g||w||void 0,className:ub.value,children:v}),_&&t&&(0,rG.jsx)("span",{id:w,className:ub.units,children:t})]})]})},uS="-esm-devtools__page-header-module__pageHeader___YOpQL",uj=e=>{if("children"in e){let{children:t,className:n,...o}=e;return(0,rG.jsx)("div",{className:sT()(uS,n),...o,children:t})}{let{title:t,illustration:n,className:o,...r}=e;return(0,rG.jsx)("div",{className:sT()(uS,o),...r,children:(0,rG.jsx)(uk,{title:t,illustration:n})})}},uk=({title:e,illustration:t,className:n})=>{let[o,r]=(0,rF.useState)(null);return(0,rF.useEffect)(()=>{eM("@openmrs/esm-styleguide").then(e=>{r(e)})},[]),(0,rG.jsxs)("div",{className:sT()("-esm-devtools__page-header-module__pageHeaderContent___PjsJm",n),children:[t,(0,rG.jsxs)("div",{className:"-esm-devtools__page-header-module__pageLabels___pPcKj",children:[o?.implementationName&&(0,rG.jsx)("p",{children:tm(o.implementationName)}),(0,rG.jsx)("h1",{className:"-esm-devtools__page-header-module__pageName___3d4IC",children:e})]})]})},uN=({totalItems:e,pageSize:t,onPageNumberChange:n,pageNumber:o,dashboardLinkUrl:r,currentItems:i,dashboardLinkLabel:s})=>{let{pageSizes:a,pageItemsCount:l}=sr(t,e,o,i),c="tablet"===i6(),u=tm("paginationItemsCount","{{pageItemsCount}} / {{totalItems}} items",{totalItems:e,pageItemsCount:l});return(0,rG.jsx)(rG.Fragment,{children:e>0&&(0,rG.jsxs)("div",{className:sT()({"-esm-devtools__pagination-module__tablet___lQ3ak":c,"-esm-devtools__pagination-module__desktop___HfUTY":!c}),children:[(0,rG.jsxs)("div",{children:[u,r&&(0,rG.jsx)(rz,{to:r,className:"-esm-devtools__pagination-module__configurableLink___NM9v7",children:s??tm("seeAll","See all")})]}),(0,rG.jsx)(sD.Pagination,{className:"-esm-devtools__pagination-module__pagination___WzkBs",page:o,pageSize:t,pageSizes:a,totalItems:e,onChange:n,pageRangeText:(e,t)=>tm("paginationOfPages","of {{count}} pages",{count:t}),size:c?"lg":"sm"})]})})};function uC(e){return uP(uA(e,"usual","official"))}function uE(e){return uC(e)}function uP(e){var t;let n;return e?e.text??(n=(t=e).given??[],(t.family?n.concat(t.family):n).join(" ")):""}function uI(e){return uP(e)}function uA(e,...t){for(let n of(0==t.length&&(t=["usual"]),t)){let t=e.name?.find(e=>{var t,o;return t=e,o=n,t.use?t.use===o:"usual"===o});if(t)return t}}function uO(e,t=sd()){let n=sd(t),o=cr(e,n);if(null==o)return null;let r=n.diff(o,"hours"),i=n.diff(o,"days"),s=n.diff(o,"weeks"),a=n.diff(o,"months"),l=n.diff(o,"years"),c={};if(r<2)c.minutes=n.diff(o,"minutes");else if(i<2)c.hours=r;else if(s<4)c.days=i;else if(l<1){let e=n.subtract(s,"weeks").diff(o,"days");c.weeks=s,c.days=e}else if(l<2){let e=n.subtract(a,"months").diff(o,"days");c.months=a,c.days=e}else if(l<18){let e=n.subtract(l,"year").diff(o,"months");c.years=l,c.months=e}else c.years=l;return c}function uR(e,t=sd()){let n=uO(e,t);if(null==n)return null;let o={style:"short",localeMatcher:"lookup"};return"minutes"in n&&0===n.minutes&&(o.minutesDisplay="always"),co(n,o)}let uT={container:"-esm-devtools__patient-banner-patient-info-module__container___Gjd-4",activePatientContainer:"-esm-devtools__patient-banner-patient-info-module__activePatientContainer___QLcpg",patientBanner:"-esm-devtools__patient-banner-patient-info-module__patientBanner___7nrgC",patientName:"-esm-devtools__patient-banner-patient-info-module__patientName___-bF9a",patientAvatar:"-esm-devtools__patient-banner-patient-info-module__patientAvatar___AkN3H",patientAvatarButton:"-esm-devtools__patient-banner-patient-info-module__patientAvatarButton___KDxA6",patientInfo:"-esm-devtools__patient-banner-patient-info-module__patientInfo___+WtDB",demographics:"-esm-devtools__patient-banner-patient-info-module__demographics___Vtf3v",row:"-esm-devtools__patient-banner-patient-info-module__row___NIOYI",flexRow:"-esm-devtools__patient-banner-patient-info-module__flexRow___VxdGB",tagsSlot:"-esm-devtools__patient-banner-patient-info-module__tagsSlot___lU6+4",identifiers:"-esm-devtools__patient-banner-patient-info-module__identifiers___tehd8",identifier:"-esm-devtools__patient-banner-patient-info-module__identifier___bSJIF",primaryIdentifier:"-esm-devtools__patient-banner-patient-info-module__primaryIdentifier___yOV1B",secondaryIdentifier:"-esm-devtools__patient-banner-patient-info-module__secondaryIdentifier___WvJbh",value:"-esm-devtools__patient-banner-patient-info-module__value___sBM-q",tag:"-esm-devtools__patient-banner-patient-info-module__tag___BEvEV",gender:"-esm-devtools__patient-banner-patient-info-module__gender___4XkLq",separator:"-esm-devtools__patient-banner-patient-info-module__separator___iYBA3",tooltipPadding:"-esm-devtools__patient-banner-patient-info-module__tooltipPadding___EWVCK",tooltipSmallText:"-esm-devtools__patient-banner-patient-info-module__tooltipSmallText___yDmRU",actionsButtonText:"-esm-devtools__patient-banner-patient-info-module__actionsButtonText___mn139"};function u$({showIdentifierLabel:e,type:t,value:n}){return(0,rG.jsx)("span",{className:uT.primaryIdentifier,children:(0,rG.jsxs)(sD.Tag,{className:uT.tag,type:"gray",children:[e&&t?.text&&(0,rG.jsxs)("span",{className:uT.label,children:[t.text,": "]}),(0,rG.jsx)("span",{className:uT.value,children:n})]})})}function uM({showIdentifierLabel:e,type:t,value:n}){return(0,rG.jsxs)(sD.FormLabel,{className:uT.secondaryIdentifier,id:`patient-banner-identifier-${n}`,children:[e&&(0,rG.jsxs)("span",{className:uT.label,children:[t?.text,": "]}),(0,rG.jsx)("span",{className:uT.value,children:n})]})}function uL({identifiers:e,showIdentifierLabel:t}){let{excludePatientIdentifierCodeTypes:n}=iR(),{primaryIdentifierCode:o}=sa(),r=e?.filter(e=>{let t=e.type?.coding?.[0]?.code;return t&&!n?.uuids.includes(t)})??[];return(0,rG.jsx)(rG.Fragment,{children:r?.length?r.map(({value:e,type:n},i)=>(0,rG.jsxs)(rH().Fragment,{children:[(0,rG.jsx)("span",{className:uT.identifier,children:n?.coding?.[0]?.code===o?(0,rG.jsx)(u$,{showIdentifierLabel:t,type:n,value:e}):(0,rG.jsx)(uM,{showIdentifierLabel:t,type:n,value:e})}),i<r.length-1&&(0,rG.jsx)("span",{className:uT.separator,children:"\xb7"})]},e)):""})}let uW={Female:ab,Male:ax,Other:aS,Unknown:aj},uD=({gender:e})=>{let t=uW[e];return t?(0,rG.jsx)(t,{fill:"#525252"}):null},uU={male:"Male",female:"Female",other:"Other",unknown:"Unknown"};function uB({patient:e,renderedFrom:t}){var n;let o,r,i=uC(e),s=e?.gender&&(r=uU[o=(n=e.gender).toLowerCase()]??"Unknown",{displayText:tm(o,n),iconKey:r}),a=(0,rF.useMemo)(()=>({patientUuid:e.id,patient:e,renderedFrom:t}),[e.id,e,t]);return(0,rG.jsxs)("div",{className:uT.patientInfo,children:[(0,rG.jsx)("div",{className:sT()(uT.row,uT.patientNameRow),children:(0,rG.jsxs)("div",{className:uT.flexRow,children:[(0,rG.jsx)("span",{className:uT.patientName,children:i}),s&&(0,rG.jsxs)("div",{className:uT.gender,children:[(0,rG.jsx)(uD,{gender:s.iconKey}),(0,rG.jsx)("span",{children:s.displayText})]}),(0,rG.jsx)(r4,{className:uT.tagsSlot,name:"patient-banner-tags-slot",state:a})]})}),(0,rG.jsxs)("div",{className:uT.demographics,children:[e.birthDate&&(0,rG.jsxs)(rG.Fragment,{children:[(0,rG.jsx)("span",{children:uR(e.birthDate)}),(0,rG.jsx)("span",{className:uT.separator,children:"\xb7"}),(0,rG.jsx)("span",{children:l4(e.birthDate,{time:!1})}),(0,rG.jsx)("span",{className:uT.separator,children:"\xb7"})]}),(0,rG.jsx)(uL,{identifiers:e.identifier,showIdentifierLabel:!0}),(0,rG.jsx)(r4,{className:uT.extensionSlot,name:"patient-banner-bottom-slot",state:a})]})]})}var uF=n(7683);function uH({patient:e,patientUuid:t,actionsSlotName:n,additionalActionsSlotState:o}){let[r,i]=(0,rF.useState)(!1),{extensions:s}=r8(n),a="tablet"===i6(),l=se(()=>i(!1),r),c=(0,rF.useRef)(null),u=(0,rF.useRef)(null),d=(0,rF.useId)(),m=`patient-actions-menu-trigger-${d}`,f=`patient-actions-menu-${d}`,p=(0,rF.useCallback)(()=>i(e=>!e),[]),g=(0,rF.useCallback)(()=>{i(!1),c.current?.focus()},[]),h=(0,rF.useCallback)(e=>{if("Escape"===e.key&&r){e.stopPropagation(),g();return}if(("ArrowDown"===e.key||"ArrowUp"===e.key)&&r){e.preventDefault();let t=u.current?.querySelectorAll('[role="menuitem"]:not([disabled])');if(!t?.length)return;let n=document.activeElement?.closest?.('[role="menuitem"]')??document.activeElement,o=Array.from(t).indexOf(n);if(-1===o)return void t["ArrowDown"===e.key?0:t.length-1]?.focus();let r=o+("ArrowDown"===e.key?1:-1),i=r<0?t.length-1:r>=t.length?0:r;t[i]?.focus()}},[g,r]);(0,rF.useEffect)(()=>{if(r&&u.current){let e=u.current.querySelector('[role="menuitem"]:not([disabled])');e?.focus()}},[r]);let w=(0,rF.useMemo)(()=>({patientUuid:t,patient:e,closeMenu:g,...o}),[t,e,g,o]);return 0===s.length?null:(0,rG.jsx)("div",{className:"-esm-devtools__patient-banner-actions-menu-module__overflowMenuContainer___lXHHD",children:(0,rG.jsxs)("div",{"data-overflow-menu":!0,className:sT()("cds--overflow-menu",sF),ref:l,children:[(0,rG.jsxs)("button",{className:sT()("cds--btn","cds--btn--ghost","cds--overflow-menu__trigger",{"cds--overflow-menu--open":r},sG),"aria-controls":f,"aria-expanded":r,"aria-haspopup":"true",id:m,onClick:p,onKeyDown:h,ref:c,children:[(0,rG.jsx)("span",{className:"-esm-devtools__patient-banner-actions-menu-module__actionsButtonText___SdOyM",children:tm("actions","Actions")})," ",(0,rG.jsx)(uF.CH,{size:16,style:{marginLeft:"0.5rem",fill:"#78A9FF"}})]}),(0,rG.jsxs)("div",{className:sT()("cds--overflow-menu-options","cds--overflow-menu--flip",sH,{[sV]:r}),"aria-labelledby":m,"data-floating-menu-direction":"bottom",id:f,onKeyDown:h,ref:u,role:"menu",tabIndex:-1,children:[(0,rG.jsx)("ul",{className:sT()("cds--overflow-menu-options__content",{"cds--overflow-menu-options--lg":a}),children:(0,rG.jsx)(r4,{name:n,state:w},n)}),(0,rG.jsx)("span",{})]})]})})}var uV=n(397),uG=n.n(uV);function uz(e){let{patientPhotoConceptUuid:t}=iR({externalModuleName:"@openmrs/esm-styleguide"}),n=t?`${tk}/obs?patient=${e}&concept=${t}&v=full`:null,{data:o,error:r,isLoading:i}=(0,io.u)(e?n:null,tP),s=o?.data?.results[0];return{data:s?{dateTime:s?.obsDatetime,imageSrc:s?.value?.links?.uri}:null,error:r,isLoading:i}}let uq=({width:e=56,height:t=56,"aria-label":n})=>{let{t:o}=(0,it.useTranslation)();return(0,rG.jsxs)("svg",{"aria-label":n??o("patientPhotoPlaceholder","Patient photo placeholder"),width:e,height:t,fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[(0,rG.jsx)("path",{fill:"#ffffff",d:"M0 0h56v56H0z"}),(0,rG.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"m36.75 20.134-.884-.884L19.25 35.866l.884.884 1.25-1.25H34.25a1.252 1.252 0 0 0 1.25-1.25V21.384l1.25-1.25Zm-2.5 14.116H22.634l4.87-4.87 1.487 1.486a1.25 1.25 0 0 0 1.768 0l.991-.991 2.5 2.498v1.877Zm0-3.645-1.616-1.616a1.25 1.25 0 0 0-1.768 0l-.991.991-1.486-1.486 5.861-5.86v7.971Zm-12.5 1.145v-1.875l3.125-3.123.858.859.885-.885-.86-.86a1.25 1.25 0 0 0-1.767 0l-2.241 2.242V21.75h10V20.5h-10c-.69 0-1.25.56-1.25 1.25v10h1.25Z",fill:"#8D8D8D"})]})},uJ="-esm-devtools__patient-photo-module__avatar___t5TmZ";function uK({patientUuid:e,patientName:t,alt:n}){let{data:o,isLoading:r}=uz(e),[i,s]=(0,rF.useState)(null),[a,l]=(0,rF.useState)(!1),c=(0,rF.useMemo)(()=>uG().generate(e),[e]);(0,rF.useEffect)(()=>{if(o?.imageSrc){let e=new URL(o.imageSrc,window.location.origin).pathname;l(!0);let t=!1,n=new Image;return n.onload=()=>{t||(s(e),l(!1))},n.onerror=()=>{t||(s(null),l(!1))},n.src=e,()=>{t=!0}}s(null),l(!1)},[o?.imageSrc]);let u=(0,rF.useMemo)(()=>n||(i?tm("patientPhotoAlt","Profile photo of {{patientName}}",{patientName:t}):tm("patientAvatarAlt","Avatar for {{patientName}}",{patientName:t})),[n,i,t]);return r||a?(0,rG.jsx)(sD.SkeletonIcon,{className:"-esm-devtools__patient-photo-module__skeleton___ueN8Q","data-testid":"skeleton-icon"}):o?.imageSrc&&!i?(0,rG.jsx)(uq,{"aria-label":tm("patientPhotoPlaceholder","Photo placeholder for {{patientName}}",{patientName:t})}):i?(0,rG.jsx)("div",{"aria-label":u,children:(0,rG.jsx)("img",{className:uJ,src:i,alt:u,title:t})}):(0,rG.jsx)("div",{"aria-label":u,children:(0,rG.jsx)("div",{className:uJ,title:t,style:{backgroundImage:c.toDataUrl(),backgroundRepeat:"no-repeat",backgroundSize:"cover"},children:(0,rG.jsx)("span",{className:"-esm-devtools__patient-photo-module__initials___-k9Hv",children:function(e,t=3){return e.split(/\s+/).filter(Boolean).slice(0,t).map(e=>e[0]).join("")}(t)})})})}let uX=["omrs-pict-appointments","omrs-pict-assessment-1","omrs-pict-assessment-2","omrs-pict-blood-bank","omrs-pict-cardiology","omrs-pict-cohorts","omrs-pict-concept-dictionary","omrs-pict-ct-scan","omrs-pict-data-entry","omrs-pict-dentistry","omrs-pict-digital-trust","omrs-pict-emergency-department","omrs-pict-facility","omrs-pict-geriatrics","omrs-pict-gynaecology","omrs-pict-in-patient","omrs-pict-laboratory","omrs-pict-labs-2","omrs-pict-metadata-export","omrs-pict-obstetrics","omrs-pict-patient-documents","omrs-pict-patient-search","omrs-pict-patients","omrs-pict-payments-desk","omrs-pict-pharmacy","omrs-pict-pharmacy-2","omrs-pict-registration","omrs-pict-reports","omrs-pict-service-queues","omrs-pict-stock-management","omrs-pict-system-administration","omrs-pict-transfer","omrs-pict-triage","omrs-pict-x-ray"],uY=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,rG.jsx)(dN,{ref:t,pictogram:"omrs-pict-appointments",pictogramProps:e})})),uZ=uY,uQ=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,rG.jsx)(dN,{ref:t,pictogram:"omrs-pict-assessment-1",pictogramProps:e})})),u0=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,rG.jsx)(dN,{ref:t,pictogram:"omrs-pict-assessment-2",pictogramProps:e})})),u1=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,rG.jsx)(dN,{ref:t,pictogram:"omrs-pict-blood-bank",pictogramProps:e})})),u2=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,rG.jsx)(dN,{ref:t,pictogram:"omrs-pict-cardiology",pictogramProps:e})})),u5=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,rG.jsx)(dN,{ref:t,pictogram:"omrs-pict-cohorts",pictogramProps:e})})),u6=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,rG.jsx)(dN,{ref:t,pictogram:"omrs-pict-concept-dictionary",pictogramProps:e})})),u8=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,rG.jsx)(dN,{ref:t,pictogram:"omrs-pict-ct-scan",pictogramProps:e})})),u3=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,rG.jsx)(dN,{ref:t,pictogram:"omrs-pict-data-entry",pictogramProps:e})})),u4=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,rG.jsx)(dN,{ref:t,pictogram:"omrs-pict-dentistry",pictogramProps:e})})),u9=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,rG.jsx)(dN,{ref:t,pictogram:"omrs-pict-digital-trust",pictogramProps:e})})),u7=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,rG.jsx)(dN,{ref:t,pictogram:"omrs-pict-emergency-department",pictogramProps:e})})),de=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,rG.jsx)(dN,{ref:t,pictogram:"omrs-pict-facility",pictogramProps:e})})),dt=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,rG.jsx)(dN,{ref:t,pictogram:"omrs-pict-geriatrics",pictogramProps:e})})),dn=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,rG.jsx)(dN,{ref:t,pictogram:"omrs-pict-gynaecology",pictogramProps:e})})),dr=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,rG.jsx)(dN,{ref:t,pictogram:"omrs-pict-in-patient",pictogramProps:e})})),di=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,rG.jsx)(dN,{ref:t,pictogram:"omrs-pict-laboratory",pictogramProps:e})})),ds=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,rG.jsx)(dN,{ref:t,pictogram:"omrs-pict-labs-2",pictogramProps:e})})),da=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,rG.jsx)(dN,{ref:t,pictogram:"omrs-pict-metadata-export",pictogramProps:e})})),dl=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,rG.jsx)(dN,{ref:t,pictogram:"omrs-pict-obstetrics",pictogramProps:e})})),dc=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,rG.jsx)(dN,{ref:t,pictogram:"omrs-pict-patient-documents",pictogramProps:e})})),du=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,rG.jsx)(dN,{ref:t,pictogram:"omrs-pict-patient-search",pictogramProps:e})})),dd=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,rG.jsx)(dN,{ref:t,pictogram:"omrs-pict-patients",pictogramProps:e})})),dm=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,rG.jsx)(dN,{ref:t,pictogram:"omrs-pict-payments-desk",pictogramProps:e})})),df=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,rG.jsx)(dN,{ref:t,pictogram:"omrs-pict-pharmacy",pictogramProps:e})})),dp=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,rG.jsx)(dN,{ref:t,pictogram:"omrs-pict-pharmacy-2",pictogramProps:e})})),dg=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,rG.jsx)(dN,{ref:t,pictogram:"omrs-pict-registration",pictogramProps:e})})),dh=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,rG.jsx)(dN,{ref:t,pictogram:"omrs-pict-reports",pictogramProps:e})})),dw=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,rG.jsx)(dN,{ref:t,pictogram:"omrs-pict-service-queues",pictogramProps:e})})),d_=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,rG.jsx)(dN,{ref:t,pictogram:"omrs-pict-stock-management",pictogramProps:e})})),dv=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,rG.jsx)(dN,{ref:t,pictogram:"omrs-pict-system-administration",pictogramProps:e})})),dy=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,rG.jsx)(dN,{ref:t,pictogram:"omrs-pict-transfer",pictogramProps:e})})),db=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,rG.jsx)(dN,{ref:t,pictogram:"omrs-pict-triage",pictogramProps:e})})),dx=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,rG.jsx)(dN,{ref:t,pictogram:"omrs-pict-x-ray",pictogramProps:e})})),dS=de,dj=dd,dk=(0,rF.memo)((0,rF.forwardRef)(function({pictogram:e,fallback:t,...n},o){let r=(0,rF.useRef)(document.getElementById(e));return(0,rF.useEffect)(()=>{let t=document.getElementById("omrs-svgs-container"),n=new MutationObserver(t=>{for(let n of t)"childList"===n.type&&(r.current=document.getElementById(e))});return t&&n.observe(t,{childList:!0}),()=>n.disconnect()},[e]),(0,rG.jsx)(ix,{value:r.current,fallback:t,children:(0,rG.jsx)(dN,{ref:o,pictogram:e,pictogramProps:n})})})),dN=(0,rF.memo)((0,rF.forwardRef)(function({pictogram:e,pictogramProps:t},n){let{className:o,size:r}=Object.assign({},{size:92},t);return(r<=26||r>144)&&(console.error(`Invalid size '${r}' specified for ${e}. Defaulting to 92.`),r=92),(0,rG.jsx)("svg",{ref:n,className:sT()("-esm-devtools__pictograms-module__pictogram___wXX7t",o),height:r,width:r,children:(0,rG.jsx)("use",{href:`#${e}`})})})),dC=({children:e})=>"tablet"===i6()?(0,rG.jsx)(sD.Layer,{children:e}):(0,rG.jsx)(rG.Fragment,{children:e}),dE=({snackbar:e,closeSnackbar:t})=>{let{actionButtonLabel:n="",kind:o="success",onActionButtonClick:r=()=>{},isLowContrast:i="error"!==o,progressActionLabel:s,subtitle:a="",timeoutInMs:l=5e3,autoClose:c="error"!==o,title:u,id:d,...m}=e,[f,p]=(0,rF.useState)(n),[g,h]=(0,rF.useState)(!0),[w,_]=(0,rF.useState)(!1),v=(0,rF.useCallback)(()=>{setTimeout(t,250)},[t]),y=(0,rF.useCallback)(()=>{_(!0),v()},[v]);return(0,rF.useEffect)(()=>{if(c){let e=setTimeout(y,l);return()=>clearTimeout(e)}},[l,c,y]),(0,rF.useEffect)(()=>{h(!1),window.setTimeout(()=>{h(!0)},0)},[]),(0,rG.jsx)(sD.ActionableNotification,{actionButtonLabel:f,"aria-label":tm("closeSnackbar","Close snackbar"),className:sT()("-esm-devtools__snackbar-module__slideIn___-oZIt",{"-esm-devtools__snackbar-module__animated___M2YBU":g,"-esm-devtools__snackbar-module__slideOut___yEmGT":w}),kind:o,lowContrast:i,onActionButtonClick:()=>{r(),y(),s&&p(s)},onClose:v,statusIconDescription:tm("snackbarNotification","Snackbar notification"),subtitle:a,title:u,...m})},dP=({subject:e})=>{let[t,n]=(0,rF.useState)([]),o=(0,rF.useCallback)(e=>{n(t=>t.filter(t=>t!==e))},[]);return(0,rF.useEffect)(()=>{let t=e.subscribe(e=>n(t=>[...t.filter(t=>t.subtitle!==e.subtitle||t.actionButtonLabel!==e.actionButtonLabel||t.onActionButtonClick!==e.onActionButtonClick||t.kind!==e.kind||t.title!==e.title),e]));return()=>t.unsubscribe()},[e]),(0,rG.jsx)(rG.Fragment,{children:t.map(e=>(0,rG.jsx)(dE,{snackbar:e,closeSnackbar:()=>o(e)},e.id))})},dI=new uu,dA=0;function dO(e){e&&(0,r9.createRoot)(e).render((0,rG.jsx)(dP,{subject:dI}))}function dR(e){var t;e&&"string"==typeof(t=e.title)&&t.trim().length>0?setTimeout(()=>{dI.next({...e,id:dA++})},0):console.error("showSnackbar must be called with an object having a 'title' property that is a non-empty string")}let dT=({toast:e,closeToast:t})=>{let{description:n,kind:o,critical:r,title:i,actionButtonLabel:s,onActionButtonClick:a=()=>{}}=e,l=(0,rF.useCallback)(()=>{a(),t()},[t,a]);return(0,rG.jsx)("div",{children:(0,rG.jsx)(sD.ActionableNotification,{actionButtonLabel:s,kind:o||"info",lowContrast:r,subtitle:n,title:i||"",onActionButtonClick:l,onClose:t})})},d$=({subject:e})=>{let[t,n]=(0,rF.useState)([]),o=(0,rF.useCallback)(e=>{n(t=>t.filter(t=>t!==e))},[]);return(0,rF.useEffect)(()=>{let t=e.subscribe(e=>n(t=>[...t.filter(t=>t.description!==e.description||t.kind!==e.kind||t.title!==e.title||t.actionButtonLabel!==e.actionButtonLabel||t.onActionButtonClick!==e.onActionButtonClick),e]));return()=>t.unsubscribe()},[e]),(0,rG.jsx)(rG.Fragment,{children:t.map(e=>(0,rG.jsx)(dT,{toast:e,closeToast:()=>o(e)},e.id))})},dM=new uu,dL=0;function dW(e){e&&(0,r9.createRoot)(e).render((0,rG.jsx)(d$,{subject:dM}))}function dD(e){var t;e&&("string"==typeof(t=e.description)?t.trim().length>0:"object"==typeof t&&!(0,ui.A)(t))?setTimeout(()=>{dM.next({...e,id:dL++})},0):console.error("showToast must be called with an object having a 'description' property that is a non-empty string or object")}var dU=n(4656);async function dB(e,t){let{openedGroup:n}=rC.getState();if(n){if(n.groupName===e&&dV(n.props,t))return!0;else if(!await dq({reason:"CLOSE_WORKSPACE_GROUP",explicit:!1}))return!1}return rC.setState(n=>({...n,openedGroup:{groupName:e,props:t},openedWindows:[]})),!0}async function dF(e){let{openedGroup:t,openedWindows:n}=rC.getState();if(t){if(n.length>0&&!(e||await dq({reason:"CLOSE_WORKSPACE_GROUP",explicit:!0})))return!1;rC.setState(e=>({...e,openedGroup:null,openedWindows:[]}))}return!0}async function dH(e,t=null,n=null,o=null){let r=rC.getState();if(!r.registeredWorkspacesByName[e])throw Error(`Unable to launch workspace ${e}. Workspace is not registered`);let i=rE(e);if(!i)throw Error(`Unable to launch workspace ${e}. Workspace is not registered to a workspace window`);let{openedGroup:s}=r,{name:a}=i,l=rP(a);if(!l)throw Error(`Unable to launch workspace ${e}. Workspace window ${i.name} is not registered to a workspace group`);let c=rI(e);if(s&&(s.groupName!==l.name||!dV(s.props,o)))return!!await dq({reason:"CLOSE_WORKSPACE_GROUP",explicit:!0})&&(rC.setState({...r,openedGroup:{groupName:l.name,props:o},openedWindows:[{windowName:a,openedWorkspaces:[d6(e,t)],props:n,maximized:!1}],isMostRecentlyOpenedWindowHidden:!1}),!0);if(c>=0){let o=r.openedWindows[c],i=r.openedGroup?.props??{},s=r.isMostRecentlyOpenedWindowHidden,{openedWorkspaces:u}=o;if(dV(o.props,n)){let d=u.find(t=>t.workspaceName===e);return d&&dV(d.props,t)?((s||c!==r.openedWindows.length-1)&&rC.setState(dQ.restoreWindow(r,a)),!0):!!await dq({reason:"CLOSE_WORKSPACE",explicit:!1,windowName:a,workspaceName:e})&&(rC.setState({...r,openedGroup:{groupName:l.name,props:r?.openedGroup?.props??i},openedWindows:[...r.openedWindows.filter((e,t)=>t!==c),{windowName:a,openedWorkspaces:[d6(e,t)],props:o?.props??n,maximized:!1}],isMostRecentlyOpenedWindowHidden:!1}),!0)}return!!await dq({reason:"CLOSE_WINDOW",explicit:!1,windowName:a})&&(rC.setState({...r,openedGroup:{groupName:l.name,props:i??r?.openedGroup?.props},openedWindows:[...r.openedWindows.filter((e,t)=>t!==c),{windowName:a,openedWorkspaces:[d6(e,t)],props:n,maximized:!1}],isMostRecentlyOpenedWindowHidden:!1}),!0)}return"closable"!=l.persistence?(rC.setState({...r,openedGroup:{groupName:l.name,props:o??r?.openedGroup?.props??null},openedWindows:[...r.openedWindows,{windowName:a,openedWorkspaces:[d6(e,t)],props:n,maximized:!1}],isMostRecentlyOpenedWindowHidden:!1}),!0):!!await dq({reason:"CLOSE_OTHER_WINDOWS",explicit:!1,windowNameToSpare:i.name})&&(rC.setState({...r,openedGroup:{groupName:l.name,props:o??r?.openedGroup?.props??null},openedWindows:[{windowName:a,openedWorkspaces:[d6(e,t)],props:n,maximized:!1}],isMostRecentlyOpenedWindowHidden:!1}),!0)}function dV(e,t){return null==e||null==t||x(e,t)}function dG(e,t){let n=[];for(let o=e.openedWorkspaces.length-1;o>=0;o--){let r=e.openedWorkspaces[o];if(r.hasUnsavedChanges&&n.push(r),t&&r.workspaceName===t)break}return n}function dz(e){return 0===e.length?Promise.resolve(!0):new Promise(t=>{let n=ur("workspace2-close-prompt",{size:"sm",onConfirm:()=>{n(),t(!0)},onCancel:()=>{n(),t(!1)},affectedWorkspaceTitles:e.map(e=>e.title??"")})})}function dq(e){let{openedWindows:t}=rC.getState(),n=[];switch(e.reason){case"CLOSE_WORKSPACE_GROUP":n=t.flatMap(e=>dG(e));break;case"CLOSE_WINDOW":{let o=t.find(t=>t.windowName===e.windowName);if(!o)throw Error(`Window ${e.windowName} not found in opened windows.`);n=dG(o);break}case"CLOSE_WORKSPACE":{let o=t.find(t=>t.windowName===e.windowName);if(!o)throw Error(`Window ${e.windowName} not found in opened windows.`);n=dG(o,e.workspaceName);break}case"CLOSE_OTHER_WINDOWS":n=t.filter(t=>t.windowName!==e.windowNameToSpare).flatMap(e=>dG(e))}return dz(n)}function dJ(e,t){return dz(dG(e,t))}function dK(e,t){let n=e.openedWorkspaces.findIndex(e=>e.workspaceName===t);return n<0?e:0===n?null:{...e,openedWorkspaces:e.openedWorkspaces.slice(0,n)}}function dX(e,t,n,o){let{registeredWorkspacesByName:r}=rC.getState(),i=r[n];if(!i)throw Error(`No workspace named "${n}" registered`);let s=r[t];if(!s)throw Error(`No workspace named "${t}" registered`);if(s.window!==i.window)throw Error(`Child workspace ${n} does not belong to the same workspace window as parent workspace ${t}`);if(i.window!==e.windowName)throw Error(`Cannot open child workspace ${n} as window ${i.window} is not opened`);let{openedWorkspaces:a}=e,l=a.findIndex(e=>e.workspaceName===t);if(-1===l)throw Error(`Cannot open child workspace ${n} from parent workspace ${t} as the parent is not opened within the workspace window`);let c=a.slice(0,l+1);return{...e,openedWorkspaces:[...c,d6(n,o)]}}function dY(e,t,n){let o=e.openedWorkspaces.findIndex(e=>e.uuid===t);if(o<0)return e;let r=e.openedWorkspaces[o];if(Object.keys(n).every(e=>r[e]===n[e]))return e;let i=[...e.openedWorkspaces];return i[o]={...r,...n},{...e,openedWorkspaces:i}}function dZ(e,t,n){let o=e.openedWindows.findIndex(e=>e.openedWorkspaces.some(e=>e.uuid===t));if(o<0)return e;let r=e.openedWindows[o],i=dY(r,t,n);if(i===r)return e;let s=[...e.openedWindows];return s[o]=i,{...e,openedWindows:s}}let dQ={setWindowMaximized(e,t,n){let o=e.openedWindows.findIndex(e=>e.windowName===t),r=[...e.openedWindows],i={...r[o],maximized:n};return r[o]=i,{...e,openedWindows:r}},hideWindow:e=>({...e,isMostRecentlyOpenedWindowHidden:!0}),restoreWindow(e,t){let n=e.openedWindows.findIndex(e=>e.windowName===t),o=e.openedWindows[n],r=[...e.openedWindows.filter((e,t)=>t!==n),o];return{...e,openedWindows:r,isMostRecentlyOpenedWindowHidden:!1}},closeWorkspace(e,t){let n=e.openedWindows.findIndex(e=>e.openedWorkspaces.some(e=>e.workspaceName===t));if(n<0)return e;let o=dK(e.openedWindows[n],t),r=[...e.openedWindows],i=e.isMostRecentlyOpenedWindowHidden;if(null===o){let t=n===e.openedWindows.length-1;r.splice(n,1),t&&r.length>0&&(i=!1)}else r[n]=o;return{...e,openedWindows:r,isMostRecentlyOpenedWindowHidden:i}},openChildWorkspace(e,t,n,o){let r=e.registeredWorkspacesByName[n];if(!r)throw Error(`No workspace named "${n}" registered`);let i=e.openedWindows.findIndex(e=>e.windowName===r.window);if(-1==i)throw Error(`Cannot open child workspace ${n} as window ${r.window} is not opened`);let s=[...e.openedWindows];return s[i]=dX(e.openedWindows[i],t,n,o),{...e,openedWindows:s}},setHasUnsavedChanges:(e,t,n)=>dZ(e,t,{hasUnsavedChanges:n}),setWorkspaceTitle:(e,t,n)=>dZ(e,t,{title:n})};function d0(){return rZ(rC,dQ)}let d1=()=>(0,rF.useContext)(ie.i),d2=()=>Object.keys(rC.getState().registeredWorkspacesByName);function d5(e,t,n){let o=e.openedWorkspaces[e.openedWorkspaces.length-1];return(o?t[o.workspaceName]?.width:void 0)??n[e.windowName]?.width??"narrow"}function d6(e,t){return{workspaceName:e,props:t??{},hasUnsavedChanges:!1,uuid:(0,dU.A)()}}function d8(e,t,n){let o=rC.getState().registeredWorkspacesByName[e];return o?{windowName:o.window,openedWorkspaces:[d6(e,t)],props:n??null,maximized:!1}:null}let d3=({title:e,children:t,hasUnsavedChanges:n=!1})=>{let{setHasUnsavedChanges:o,setWorkspaceTitle:r}=d1();return(0,rF.useEffect)(()=>{o(n??!1)},[n,o]),(0,rF.useEffect)(()=>{r(e)},[e,r]),(0,rG.jsx)(rG.Fragment,{children:t})};var d4=n(1820),d9=n(3173),d7=n(185);let me={workspaceOuterContainer:"-esm-devtools__workspace2-module__workspaceOuterContainer___bPVpy",narrowWorkspace:"-esm-devtools__workspace2-module__narrowWorkspace___kSYS7",widerWorkspace:"-esm-devtools__workspace2-module__widerWorkspace___nW2HB",extraWideWorkspace:"-esm-devtools__workspace2-module__extraWideWorkspace___em5yA",workspaceMiddleContainer:"-esm-devtools__workspace2-module__workspaceMiddleContainer___Bx1i6",maximized:"-esm-devtools__workspace2-module__maximized___Kfygr",hidden:"-esm-devtools__workspace2-module__hidden___RPimX",workspaceInnerContainer:"-esm-devtools__workspace2-module__workspaceInnerContainer___5zxpt",workspaceSpacer:"-esm-devtools__workspace2-module__workspaceSpacer___E+982",loader:"-esm-devtools__workspace2-module__loader___vmBQn",hiddenExtraWorkspace:"-esm-devtools__workspace2-module__hiddenExtraWorkspace___qkbMG",header:"-esm-devtools__workspace2-module__header___IZ-2+",headerButtons:"-esm-devtools__workspace2-module__headerButtons___81a2N",workspaceContent:"-esm-devtools__workspace2-module__workspaceContent___eetPy",overlayHeaderSpacer:"-esm-devtools__workspace2-module__overlayHeaderSpacer___ruc6r",isActionMenuOpened:"-esm-devtools__workspace2-module__isActionMenuOpened___XgCkc",showActionMenu:"-esm-devtools__workspace2-module__showActionMenu___sHRt1",marginWorkspaceContent:"-esm-devtools__workspace2-module__marginWorkspaceContent___TN+S+",workspaceContainerWithActionMenu:"-esm-devtools__workspace2-module__workspaceContainerWithActionMenu___xLg8e",workspaceFixedContainer:"-esm-devtools__workspace2-module__workspaceFixedContainer___W9cgZ",workspaceContainerWithoutActionMenu:"-esm-devtools__workspace2-module__workspaceContainerWithoutActionMenu___fRrxd"},mt=e=>e.registeredWorkspacesByName,mn=({lifeCycle:e,openedWorkspace:t,openedWindow:n,groupProps:o,actions:r,renderChrome:i,isRootWorkspace:s,isLeafWorkspace:a,showActionMenu:l})=>{let c=(0,rF.useMemo)(()=>t&&{closeWorkspace:async(e={})=>{let{closeWindow:o=!1,discardUnsavedChanges:i=!1}=e;return o?!!(i||await r.promptForClosingWorkspaces())&&(r.closeWorkspace(n.openedWorkspaces[0].workspaceName),!0):!!(i||await r.promptForClosingWorkspaces(t.workspaceName))&&(r.closeWorkspace(t.workspaceName),!0)},launchChildWorkspace:async(e,o)=>{let i=t.workspaceName,{openedWorkspaces:s}=n,a=s.findIndex(e=>e.workspaceName===i);-1===a||a!==s.length-1&&s.slice(a+1).some(e=>e.hasUnsavedChanges)&&!await r.promptForClosingWorkspaces(s[a+1].workspaceName)||r.openChildWorkspace(i,e,o||{})},setWorkspaceTitle:e=>r.setWorkspaceTitle(t.uuid,e),setHasUnsavedChanges:e=>r.setHasUnsavedChanges(t.uuid,e),workspaceName:t.workspaceName,workspaceProps:t.props,windowProps:n.props,groupProps:o,workspaceMeta:rC.getState().registeredWorkspacesByName[t.workspaceName]?.meta??{},isRootWorkspace:s,isLeafWorkspace:a,windowName:n.windowName,showActionMenu:l},[t,n,o,r,s,a,l]),u=!i&&!a,d=(0,rF.useMemo)(()=>e?(0,rG.jsx)(d4.A,{config:e,mountParcel:rU,wrapWith:"div",wrapClassName:sT()(me.workspaceContent,{[me.hiddenExtraWorkspace]:u}),...c},t.workspaceName):null===e?(0,rG.jsx)("div",{className:sT()(me.workspaceContent,{[me.hiddenExtraWorkspace]:u}),children:(0,rG.jsx)(sD.InlineNotification,{kind:"error",title:tm("error"),subtitle:tm("somethingWentWrongTryReloading"),hideCloseButton:!0})}):null,[e,t.workspaceName,c,u]);return i?(0,rG.jsx)("div",{children:(0,rG.jsx)(mo,{openedWorkspace:t,openedWindow:n,isRootWorkspace:s,showActionMenu:l,closeWindow:()=>c.closeWorkspace({closeWindow:!0}),children:d})}):d??(0,rG.jsx)(sD.InlineLoading,{className:sT()(me.loader,{[me.hiddenExtraWorkspace]:u}),description:`${tm("loading")}`})},mo=({openedWorkspace:e,openedWindow:t,isRootWorkspace:n,showActionMenu:o,closeWindow:r,children:i})=>{let s=i6(),{openedGroup:a,openedWindows:l,registeredWindowsByName:c,registeredWorkspacesByName:u,registeredGroupsByName:d,isMostRecentlyOpenedWindowHidden:m,setWindowMaximized:f,hideWindow:p}=d0(),g=t.windowName,{maximized:h}=t,w=e.title??"",_=c[g],v=d5(t,u,c),y=_?.icon,b=_?.canMaximize,x=!!a&&d[a.groupName]?.persistence==="closable",S=!!y&&!x,j=l.findIndex(e=>e.windowName===g)<l.length-1||m,k=Object.values(c).some(e=>e.group===a?.groupName&&void 0!==e.icon);return(0,rG.jsxs)("div",{className:sT()(me.workspaceOuterContainer,{[me.narrowWorkspace]:"narrow"===v,[me.widerWorkspace]:"wider"===v,[me.extraWideWorkspace]:"extra-wide"===v,[me.isActionMenuOpened]:k}),children:[(0,rG.jsx)("div",{className:sT()(me.workspaceSpacer,{[me.hidden]:j})}),(0,rG.jsx)("div",{className:sT()(me.workspaceMiddleContainer,{[me.maximized]:h,[me.hidden]:j,[me.isRootWorkspace]:n,[me.showActionMenu]:o}),children:(0,rG.jsx)("div",{className:sT()(me.workspaceInnerContainer,{[me.maximized]:h,[me.hidden]:j,[me.isRootWorkspace]:n}),children:i?(0,rG.jsxs)(rG.Fragment,{children:[(0,rG.jsxs)(sD.Header,{"aria-label":tm("workspaceHeader"),className:me.header,children:[(0,rG.jsx)(sD.HeaderName,{prefix:"",children:w}),(0,rG.jsx)("div",{className:me.overlayHeaderSpacer}),(0,rG.jsx)(sD.HeaderGlobalBar,{className:me.headerButtons,children:i8(s)?(0,rG.jsxs)(rG.Fragment,{children:[(b||h)&&(0,rG.jsx)(sD.HeaderGlobalAction,{"aria-label":h?tm("minimize"):tm("maximize"),onClick:()=>f(g,!h),children:h?(0,rG.jsx)(d9.Xj,{}):(0,rG.jsx)(d9.hz,{})}),S&&(0,rG.jsx)(sD.HeaderGlobalAction,{"aria-label":tm("hide"),onClick:()=>p(),children:(0,rG.jsx)(s5,{})}),!x&&(0,rG.jsx)(sD.HeaderGlobalAction,{"aria-label":tm("close"),onClick:r,children:(0,rG.jsx)(ad,{})})]}):(0,rG.jsxs)(rG.Fragment,{children:[S&&(0,rG.jsx)(sD.HeaderGlobalAction,{"aria-label":tm("hide"),onClick:()=>p(),children:(0,rG.jsx)(d7.d3,{})}),(0,rG.jsx)(sD.HeaderGlobalAction,{"aria-label":tm("close"),onClick:()=>{x?dF():r()},children:(0,rG.jsx)(ad,{})})]})})]}),i]}):(0,rG.jsx)(sD.InlineLoading,{className:me.loader,description:`${tm("loading")} ...`})})})]})},mr=({openedWindow:e,groupProps:t,actions:n,renderChrome:o,showActionMenu:r})=>{let{openedWorkspaces:i}=e,[s,a]=(0,rF.useState)({}),l=rY(rC,mt),c=(0,rF.useRef)(new Set);return(0,rF.useEffect)(()=>{let e=!1;return Promise.all(i.map(async t=>{let n=l[t.workspaceName];if(!n)return null;let{moduleName:o,component:r}=n;try{return[t.uuid,await sx(o,r)]}catch(n){return e||c.current.has(t.uuid)||(c.current.add(t.uuid),v(n)),[t.uuid,null]}})).then(t=>{e||a(Object.fromEntries(t.filter(e=>null!=e)))},v),()=>{e=!0}},[i,l]),(0,rG.jsx)(rG.Fragment,{children:i.map((a,l)=>(0,rG.jsx)(mn,{openedWorkspace:a,openedWindow:e,groupProps:t,actions:n,renderChrome:o,lifeCycle:s[a.uuid],isRootWorkspace:0===l,isLeafWorkspace:l===i.length-1,showActionMenu:r},a.uuid))})},mi=e=>e.registeredWorkspacesByName,ms=({name:e,workspaceProps:t,windowProps:n,groupProps:o,onWindowChanged:r})=>{let i=rY(rC,mi),s=rY(rC,t=>{let n=t.registeredWorkspacesByName[e]?.window;return n?t.registeredWindowsByName[n]:void 0}),a={name:e,workspaceProps:t,windowProps:n,groupProps:o},l=(0,rF.useRef)(),c=(0,rF.useRef)(null);if(!l.current){let r=d8(e,t,n);l.current=T({openedWindow:r,groupProps:o??null}),r&&(c.current=a)}let u=l.current;(0,rF.useEffect)(()=>{let r=c.current;if(r&&r.name===e&&x(r.workspaceProps,t)&&x(r.windowProps,n)&&x(r.groupProps,o))return;let i=d8(e,t,n);u.setState({openedWindow:i,groupProps:o??null},!0),c.current=i?a:null},[e,t,n,o,i,u]);let d=(0,rF.useMemo)(()=>(function(e){function t(t){e.setState(e=>{if(!e.openedWindow)return e;let n=t(e.openedWindow);return n===e.openedWindow?e:{...e,openedWindow:n}})}return{closeWorkspace(e){t(t=>dK(t,e))},openChildWorkspace(e,n,o){t(t=>dX(t,e,n,o))},setWorkspaceTitle(e,n){t(t=>dY(t,e,{title:n}))},setHasUnsavedChanges(e,n){t(t=>dY(t,e,{hasUnsavedChanges:n}))},promptForClosingWorkspaces(t){let{openedWindow:n}=e.getState();return n?dJ(n,t):Promise.resolve(!0)}}})(u),[u]),{openedWindow:m,groupProps:f}=rY(u),p=m?.openedWorkspaces[m.openedWorkspaces.length-1],g=p?.workspaceName??null,h=p?.title??"",w=m?.openedWorkspaces.some(e=>e.hasUnsavedChanges)??!1,_=s?.width??"narrow",v=(0,rF.useRef)(r);return(0,rF.useEffect)(()=>{v.current=r}),(0,rF.useEffect)(()=>{v.current?.({workspaceName:g,windowWidth:_,title:h,hasUnsavedChanges:w})},[g,_,h,w]),(0,rG.jsx)("div",{className:"-esm-devtools__exported-workspace-module__exportedWorkspace___7PE0H",children:m?(0,rG.jsx)(mr,{openedWindow:m,groupProps:f,actions:d,renderChrome:!1,showActionMenu:!1}):null})},ma="-esm-devtools__action-menu-button2-module__container___jc6--",ml="-esm-devtools__action-menu-button2-module__elementContainer___whLL8",mc="-esm-devtools__action-menu-button2-module__active___fbyFm",mu="-esm-devtools__action-menu-button2-module__focused___+aVpz";function md({getIcon:e,hasUnsavedChanges:t,tagContent:n}){return(0,rG.jsxs)(rG.Fragment,{children:[e({size:16}),t?(0,rG.jsx)("span",{className:"-esm-devtools__action-menu-button2-module__interruptedTag___sRkvS",children:"!"}):(0,rG.jsx)("span",{className:"-esm-devtools__action-menu-button2-module__countTag___XMH0D",children:n})]})}let mm=({icon:e,label:t,tagContent:n,workspaceToLaunch:o,onBeforeWorkspaceLaunch:r,hidden:i,disabled:s})=>{let a=i6(),{openedWindows:l,restoreWindow:c,hideWindow:u,isMostRecentlyOpenedWindowHidden:d}=d0(),{extension:m}=(0,rF.useContext)(rV),f=l.findIndex(e=>e.windowName===m?.extensionId),p=l[f],g=null!=p,h=g&&(f<l.length-1||d),w=g&&!h,_=p?.openedWorkspaces.some(e=>e.hasUnsavedChanges)??!1,v=async()=>{if(g)h?c(p.windowName):u();else if(await (r?.()??!0)){let{workspaceName:e,workspaceProps:t,windowProps:n}=o;dH(e,t,n)}};return i?.(l)?null:"tablet"===a||"phone"===a?(0,rG.jsxs)(sD.Button,{className:sT()(ma,{[mc]:g&&!w,[mu]:w}),iconDescription:t,kind:"ghost",onClick:v,role:"button",tabIndex:0,size:"md",disabled:s?.(l),children:[(0,rG.jsx)("span",{className:ml,children:(0,rG.jsx)(md,{hasUnsavedChanges:_,getIcon:e,tagContent:n})}),(0,rG.jsx)("span",{children:t})]}):(0,rG.jsx)(sD.IconButton,{align:"left","aria-label":t,className:sT()(ma,{[mc]:g&&!w,[mu]:w}),enterDelayMs:300,kind:"ghost",label:t,onClick:v,size:"md",disabled:s?.(l),children:(0,rG.jsx)("div",{className:ml,children:(0,rG.jsx)(md,{hasUnsavedChanges:_,getIcon:e,tagContent:n})})})};function mf({showContactDetails:e,toggleContactDetails:t,className:n}){return(0,rG.jsx)(sD.Button,{className:n,iconDescription:"Toggle contact details",kind:"ghost",onClick:t,renderIcon:e?au:aa,children:e?tm("showLess","Show less"):tm("showMore","Show more")})}let mp={contactDetails:"-esm-devtools__patient-banner-contact-details-module__contactDetails___R7vfY",deceased:"-esm-devtools__patient-banner-contact-details-module__deceased___nTt+l",heading:"-esm-devtools__patient-banner-contact-details-module__heading___x7UoT",row:"-esm-devtools__patient-banner-contact-details-module__row___qFgIi",col:"-esm-devtools__patient-banner-contact-details-module__col___JXUlg",relationship:"-esm-devtools__patient-banner-contact-details-module__relationship___T3LO-"},mg=({patientUuid:e})=>{let{cohorts:t=[],isLoading:n}=function(e){let t=e?`${tk}/cohortm/cohortmember?patient=${e}&v=custom:(uuid,patient:ref,cohort:(uuid,name,startDate,endDate))`:null,{data:n,isLoading:o}=(0,io.u)(t,tP),r=n?.data?.results.map(e=>({uuid:e.cohort.uuid,name:e.cohort.name,startDate:e.cohort.startDate,endDate:e.cohort.endDate}));return(0,rF.useMemo)(()=>({cohorts:r,isLoading:o}),[o,r])}(e);return(0,rG.jsxs)(rG.Fragment,{children:[(0,rG.jsxs)("p",{className:mp.heading,children:[tm("patientLists","Patient Lists")," (",t?.length??0,")"]}),n?(0,rG.jsx)(sD.InlineLoading,{description:`${tm("loading","Loading")} ...`,role:"progressbar"}):(0,rG.jsxs)("ul",{children:[(()=>{if(t?.length>0){let e=t.sort((e,t)=>l1(e?.startDate).getTime()-l1(t?.startDate).getTime()).slice(0,3);return e?.map(e=>(0,rG.jsx)("li",{children:(0,rG.jsx)(rz,{to:`${window.spaBase}/home/patient-lists/${e.uuid}`,children:e.name},e.uuid)},e.uuid))}return(0,rG.jsx)("li",{children:"--"})})(),t.length>3&&(0,rG.jsx)("li",{className:mp.link,children:(0,rG.jsx)(rz,{to:`${window.spaBase}/home/patient-lists`,children:tm("seeMoreLists","See {{count}} more lists",{count:t?.length-3})})})]})]})},mh=({patientId:e})=>{let{patient:t,isLoading:n}=ss(e),o=t?.address?.find(e=>"home"===e.use),r=e=>e.split("#")[1];return n?(0,rG.jsx)(sD.InlineLoading,{description:`${tm("loading","Loading")} ...`,role:"progressbar"}):(0,rG.jsxs)(rG.Fragment,{children:[(0,rG.jsx)("p",{className:mp.heading,children:tm("address","Address")}),(0,rG.jsx)("ul",{children:o?Object.entries(o).filter(([e])=>"id"!==e&&"use"!==e).map(([e,t])=>"extension"===e?o.extension?.[0]?.extension?.map((t,n)=>(0,rG.jsxs)("li",{children:[tm(r(t.url),r(t.url)),": ",t.valueString]},`address-${e}-${n}`)):(0,rG.jsxs)("li",{children:[tm(e,e),": ",t]},`address-${e}`)):(0,rG.jsx)("li",{children:"--"})})]})},mw=({patientUuid:e})=>{let{isLoading:t,contactAttributes:n}=(e=>{let{contactAttributeTypes:t=[]}=iR({externalModuleName:"@openmrs/esm-patient-banner-app"}),{attributes:n,error:o,isLoading:r}=(e=>{let{data:t,error:n,isLoading:o}=(0,iM.A)(`${tk}/patient/${e}?v=custom:(uuid,display,identifiers:(identifier,uuid,preferred,location:(uuid,name),identifierType:(uuid,name,format,formatDescription,validator)),person:(uuid,display,gender,birthdate,dead,age,deathDate,birthdateEstimated,causeOfDeath,preferredName:(uuid,preferred,givenName,middleName,familyName),attributes,preferredAddress:(uuid,preferred,address1,address2,cityVillage,longitude,stateProvince,latitude,country,postalCode,countyDistrict,address3,address4,address5,address6,address7)))`,tP);return{isLoading:o,attributes:t?.data.person.attributes??[],error:n}})(e);return{contactAttributes:(0,rF.useMemo)(()=>n.filter(({attributeType:e})=>t?.some(t=>e.uuid===t)),[n,t]),isLoading:r,error:o}})(e),o=(0,rF.useMemo)(()=>n?[...n?.map(e=>[e.attributeType.display?tm(e.attributeType.display,e.attributeType.display):"",e.value])]:[],[n]);return(0,rG.jsxs)(rG.Fragment,{children:[(0,rG.jsx)("p",{className:mp.heading,children:tm("contactDetails","Contact Details")}),t?(0,rG.jsx)(sD.InlineLoading,{description:`${tm("loading","Loading")} ...`,role:"progressbar"}):(0,rG.jsx)("ul",{children:o.length?o.map(([e,t],n)=>(0,rG.jsxs)("li",{children:[e,": ",t]},`${e}-${t}-${n}`)):(0,rG.jsx)("li",{children:"--"})})]})},m_=({patientId:e})=>{let{data:t,isLoading:n}=function(e){let t=`${tk}/relationship?v=custom:(display,uuid,personA:(age,display,birthdate,uuid),personB:(age,display,birthdate,uuid),relationshipType:(uuid,display,description,aIsToB,bIsToA))&person=${e}`,{data:n,error:o,isLoading:r,isValidating:i}=(0,io.u)(e?t:null,tP),s=n?.data?.results?.length?function(e,t){let n=[];for(let o of t)e===o.personA.uuid?n.push({uuid:`${o.uuid}`,display:o.personB.display,relativeAge:o.personB.age,relativeUuid:o.personB.uuid,relationshipType:o.relationshipType.bIsToA}):n.push({uuid:`${o.uuid}`,display:o.personA.display,relativeAge:o.personA.age,relativeUuid:o.personA.uuid,relationshipType:o.relationshipType.aIsToB});return n}(e,n.data.results):null;return{data:n?s:null,error:o,isLoading:r,isValidating:i}}(e);return(0,rG.jsxs)(rG.Fragment,{children:[(0,rG.jsx)("p",{className:mp.heading,children:tm("relationships","Relationships")}),n?(0,rG.jsx)(sD.InlineLoading,{description:`${tm("loading","Loading")} ...`,role:"progressbar"}):(0,rG.jsx)("ul",{children:t&&t.length>0?(0,rG.jsx)(rG.Fragment,{children:t.map(e=>(0,rG.jsxs)("li",{className:mp.relationship,children:[(0,rG.jsx)("div",{children:(0,rG.jsx)(rz,{to:`${window.spaBase}/patient/${e.relativeUuid}/chart`,children:e.display})}),(0,rG.jsx)("div",{children:e.relationshipType}),(0,rG.jsx)("div",{children:`${e.relativeAge?e.relativeAge:"--"} ${e.relativeAge?1===e.relativeAge?tm("yearAbbreviation","yr"):tm("yearsAbbreviation","yrs"):""}`})]},e.uuid))}):(0,rG.jsx)("li",{children:"--"})})]})};function mv({patientId:e,deceased:t}){return(0,rG.jsxs)("div",{className:sT()(mp.contactDetails,{[mp.deceased]:t}),children:[(0,rG.jsxs)("div",{className:mp.row,children:[(0,rG.jsx)("div",{className:mp.col,children:(0,rG.jsx)(mh,{patientId:e})}),(0,rG.jsx)("div",{className:mp.col,children:(0,rG.jsx)(mw,{patientUuid:e})})]}),(0,rG.jsxs)("div",{className:mp.row,children:[(0,rG.jsx)("div",{className:mp.col,children:(0,rG.jsx)(m_,{patientId:e})}),(0,rG.jsx)("div",{className:mp.col,children:(0,rG.jsx)(mg,{patientUuid:e})})]})]})}function my(e){let t=document.querySelector("template#loading-spinner");if(t){let n=t.content.cloneNode(!0),o=Array.prototype.map.call(n.childNodes,e=>e);return e.appendChild(n),()=>o.forEach(e=>e.remove())}return()=>{}}let mb="-esm-devtools__action-menu2-module__container___6Gke0";function mx({workspaceGroup:e,groupProps:t}){let n=i6(),{persistence:o}=e;return(0,rG.jsx)("aside",{className:"-esm-devtools__action-menu2-module__sideRail___T2lMV",children:(0,rG.jsxs)("div",{className:mb,children:["closable"==o&&i8(n)&&(0,rG.jsx)(sD.IconButton,{align:"left",onClick:()=>dF(),label:tm("close"),kind:"ghost",children:(0,rG.jsx)(ad,{})}),(0,rG.jsx)(rV.Provider,{value:{moduleName:e.moduleName,featureName:e.name},children:(0,rG.jsx)(r4,{className:mb,name:e.name,state:{groupProps:t}})})]})})}function mS(e){let t=new URL(e,window.location.origin).pathname,n=new URL(window.getOpenmrsSpaBase?.()??"/",window.location.origin).pathname,o=n.endsWith("/")?n.slice(0,-1):n,r=null;return o?o===t?r="/":t.startsWith(`${o}/`)&&(r=t.slice(o.length)):r=t,{full:t,spaRelative:r}}function mj(e){e&&(0,r9.createRoot)(e).render((0,rG.jsx)(mk,{}))}function mk(){let{openedGroup:e,openedWindows:t,registeredGroupsByName:n,registeredWindowsByName:o}=d0();if((0,rF.useEffect)(()=>nG("before-page-changed",t=>{let{newPage:o,cancelNavigation:r,oldUrl:i,newUrl:s}=t;if(!e)return;if(o)return void r(dF().then(e=>!e));let a=n[e.groupName],l=a?.scopePattern;l&&function(e,t,n){try{let o=new RegExp(e),r=mS(t),i=mS(n);if(null===r.spaRelative||null===i.spaRelative)return!0;let s=o.exec(r.spaRelative),a=o.exec(i.spaRelative);if(s&&a||(s=o.exec(r.full),a=o.exec(i.full)),!s||!a)return!0;if(s.length>1)return!s.slice(1).every((e,t)=>e===a[t+1]);return!1}catch{return!0}}(l,i,s)&&r(dF().then(e=>!e))}),[e,n]),!e)return null;let r=n[e.groupName],i=t.some(e=>e.maximized),{name:s}=r,a=Object.values(o).filter(e=>e.group===s&&void 0!==e.icon).sort((e,t)=>(e.order??Number.MAX_VALUE)-(t.order??Number.MAX_VALUE)).length>0;return(0,rG.jsxs)("div",{className:sT()("-esm-devtools__workspace-windows-and-menu-module__workspaceWindowsAndMenuContainer___2u2mc",{"-esm-devtools__workspace-windows-and-menu-module__overlay___7RHYZ":r.overlay,"-esm-devtools__workspace-windows-and-menu-module__hasMaximizedWindow___gvJRd":i}),children:[(0,rG.jsx)("div",{className:"-esm-devtools__workspace-windows-and-menu-module__workspaceWindowsContainer___40ITO",children:t.map(t=>(0,rG.jsx)(mN,{openedWindow:t,groupProps:e.props,showActionMenu:a},t.windowName))}),a&&(0,rG.jsx)(mx,{workspaceGroup:r,groupProps:e.props})]})}function mN({openedWindow:e,groupProps:t,showActionMenu:n}){let{windowName:o}=e,r=(0,rF.useMemo)(()=>({closeWorkspace(e){rC.setState(t=>dQ.closeWorkspace(t,e))},openChildWorkspace(e,t,n){rC.setState(o=>dQ.openChildWorkspace(o,e,t,n))},setWorkspaceTitle(e,t){rC.setState(n=>dQ.setWorkspaceTitle(n,e,t))},setHasUnsavedChanges(e,t){rC.setState(n=>dQ.setHasUnsavedChanges(n,e,t))},promptForClosingWorkspaces(e){let t=rC.getState().openedWindows.find(e=>e.windowName===o);return t?dJ(t,e):Promise.resolve(!0)}}),[o]);return(0,rG.jsx)(mr,{openedWindow:e,groupProps:t,actions:r,renderChrome:!0,showActionMenu:n})}function mC(e,t,n){if(null==e)return n;let o=lU(e);if(!o)return console.warn(`matchLocale: invalid requested locale tag: ${JSON.stringify(e)}`),n;let r=[];for(let e of t){let t=lU(e);if(!t){console.warn(`matchLocale: skipping invalid available locale tag: ${JSON.stringify(e)}`);continue}r.push({canonical:t,original:e})}let i=o;for(;i;){let e=r.find(e=>e.canonical===i);if(e)return e.original;let t=i+"-",n=r.find(e=>e.canonical.startsWith(t));if(n)return n.original;if("ht"===i){i="fr-HT";continue}let o=i.lastIndexOf("-");if(-1===o)break;let s=(i=i.slice(0,o)).lastIndexOf("-");-1!==s&&i.length-s==2&&(i=i.slice(0,s))}return n}function mE(e=window.localStorage){try{return e.getItem("test"),!0}catch{return!1}}function mP(e){return!!e&&e.constructor===Object}var mI=n(3376);function mA(e){let[t,n,o]=e.split(".");return`${t}.${n}.${o}`}function mO(e,t){return mI(function(e){let t=e.indexOf("-");if(t>=0){let n=mA(e.slice(0,t)),o=e.slice(t+1);return`${n}-${o}`}return mA(e)}(t),e,{includePrerelease:!0})}async function mR(e,t={}){let n,{shouldRetry:o,getDelay:r,onError:i}=t;o=o??(e=>e<=5),r=r??(e=>(function(e,t=!1){return 1e3*Math.pow(2,t?e+1:e)})(e));let s=0;do try{return await mT(r(s)),await e()}catch(e){i?.(e,s),n=e}while(o(s++));throw n}async function mT(e){if(!(e<=0))return new Promise(t=>setTimeout(t,e))}function m$(e,t,n,o){}function mM(e){}function mL(e){return Promise.resolve([])}function mW(e){return Promise.resolve([])}function mD(e){return Promise.resolve({success:!1,result:void 0,error:"No service worker has been registered. Offline-related features have been removed from the framework."})}function mU(e){return()=>{}}function mB(){return!0}}}]);
|