@openmrs/esm-login-app 11.0.1-pre.5908 → 11.0.1-pre.5932

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.
@@ -4,4 +4,4 @@
4
4
  │ 5562.js (431.190 KiB)
5
5
  
6
6
 
7
- Rspack compiled with 1 warning in 30.29 s
7
+ Rspack compiled with 1 warning in 28.74 s
package/dist/7575.js CHANGED
@@ -25,4 +25,4 @@ To fix this, ensure that you define the "description" field inside the feature f
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
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 aO(){aP.sort((e,t)=>e.appName.localeCompare(t.appName,"en"));let e=new Map;for(let t of aP){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),a=`single-spa-application:${o}`;if(i){let e=document.createElement("div");e.id=a,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,ts.fz)(window.getOpenmrsSpaBase()+t):t instanceof RegExp?e=>t.test(e.pathname.replace(window.getOpenmrsSpaBase(),"")):()=>t}(n),t);(0,ts.AG)(e,()=>ak(t.appName,t.component),o)}(o,t)}}let aA={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 aR(){document.body.classList.toggle("omrs-breakpoint-lt-tablet",window.innerWidth<aA.TABLET_MIN),document.body.classList.toggle("omrs-breakpoint-gt-phone",window.innerWidth>aA.PHONE_MAX),document.body.classList.toggle("omrs-breakpoint-gt-tablet",window.innerWidth>aA.TABLET_MAX),document.body.classList.toggle("omrs-breakpoint-lt-desktop",window.innerWidth<aA.SMALL_DESKTOP_MIN),document.body.classList.toggle("omrs-breakpoint-lt-small-desktop",window.innerWidth<aA.SMALL_DESKTOP_MIN),document.body.classList.toggle("omrs-breakpoint-lt-large-desktop",window.innerWidth<aA.LARGE_DESKTOP_MIN),document.body.classList.toggle("omrs-breakpoint-gt-small-desktop",window.innerWidth>aA.SMALL_DESKTOP_MAX)}let aT=!1;function a$(){aT||(window.addEventListener("resize",aR),aR(),aT=!0)}var aM=n(5530),aL=n.n(aM);function aW({title:e,children:t}){let n="tablet"===i4();return(0,rG.jsxs)("div",{className:aL()({"-esm-login__card-header-module__tabletHeader___Vkmd-":n,"-esm-login__card-header-module__desktopHeader___ocWGq":!n}),children:[(0,rG.jsx)("h4",{children:e}),t]})}let aD=["red","magenta","purple","blue","teal","cyan","gray","green","warm-gray","cool-gray","high-contrast","outline"],aU={primaryColor:{_type:G.String,_description:"The color for displaying primary diagnoses tags",_default:"blue",_validators:[e7.oneOf(aD)]},secondaryColor:{_type:G.String,_description:"The color for displaying secondary diagnoses tags",_default:"gray",_validators:[e7.oneOf(aD)]}},aB={"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:aU};var aF=n(8326);let aH={"carbon.table.batch.cancel":"cancel","carbon.table.batch.items.selected":"batchActionsItemsSelected","carbon.table.batch.item.selected":"batchActionItemSelected","carbon.table.batch.selectAll":"selectAll"},aV=e=>(0,rG.jsx)(aF.TableBatchActions,{translateWithId:(e,t)=>{let n=aH[e];return n?tm(n,e,t):e},...e}),aG="-esm-login__custom-overflow-menu-module__container___8PykS",az="-esm-login__custom-overflow-menu-module__menu___qsOLn",aq="-esm-login__custom-overflow-menu-module__show___BserJ",aJ="-esm-login__custom-overflow-menu-module__overflowMenuButton___n86Gz",aK=(0,rF.createContext)(null);function aX(){let e=(0,rF.useContext)(aK);if(!e)throw Error("useCustomOverflowMenu must be used within a CustomOverflowMenu");return e}function aY({menuTitle:e,children:t}){let[n,o]=rH().useState(!1),r=ao(()=>o(!1),n),i="tablet"===i4(),a=(0,rF.useCallback)(()=>o(e=>!e),[]),s=(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),s.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,a=i<0?n.length-1:i>=n.length?0:i;n[a]?.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:aL()("cds--overflow-menu",aG),ref:r,children:[(0,rG.jsx)("button",{className:aL()("cds--btn","cds--btn--ghost","cds--overflow-menu__trigger",{"cds--overflow-menu--open":n},aJ),"aria-controls":d,"aria-expanded":n,"aria-haspopup":"true",id:u,onClick:a,onKeyDown:p,ref:s,children:e}),(0,rG.jsxs)("div",{className:aL()("cds--overflow-menu-options","cds--overflow-menu--flip",az,{[aq]: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:aL()("cds--overflow-menu-options__content",{"cds--overflow-menu-options--lg":i}),children:(0,rG.jsx)(aK.Provider,{value:f,children:w})}),(0,rG.jsx)("span",{})]})]})}function aZ(e){let t=(0,rF.useContext)(aK);return(0,rG.jsx)(aF.OverflowMenuItem,{...e,closeMenu:t?.closeMenu})}var aQ=n(7665);let a0=["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"],a1=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,rG.jsx)(lk,{ref:t,icon:"omrs-icon-activity",iconProps:e})})),a2=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,rG.jsx)(lk,{ref:t,icon:"omrs-icon-add",iconProps:e})})),a5=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,rG.jsx)(lk,{ref:t,icon:"omrs-icon-arrow-down",iconProps:e})})),a6=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,rG.jsx)(lk,{ref:t,icon:"omrs-icon-arrow-left",iconProps:e})})),a8=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,rG.jsx)(lk,{ref:t,icon:"omrs-icon-arrow-right",iconProps:e})})),a3=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,rG.jsx)(lk,{ref:t,icon:"omrs-icon-arrow-up",iconProps:e})})),a4=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,rG.jsx)(lk,{ref:t,icon:"omrs-icon-baby",iconProps:e})})),a7=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,rG.jsx)(lk,{ref:t,icon:"omrs-icon-calendar-heat-map",iconProps:e})})),a9=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,rG.jsx)(lk,{ref:t,icon:"omrs-icon-calendar",iconProps:e})})),se=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,rG.jsx)(lk,{ref:t,icon:"omrs-icon-caret-down",iconProps:e})})),st=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,rG.jsx)(lk,{ref:t,icon:"omrs-icon-caret-left",iconProps:e})})),sn=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,rG.jsx)(lk,{ref:t,icon:"omrs-icon-caret-right",iconProps:e})})),so=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,rG.jsx)(lk,{ref:t,icon:"omrs-icon-caret-up",iconProps:e})})),sr=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,rG.jsx)(lk,{ref:t,icon:"omrs-icon-chart-average",iconProps:e})})),si=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,rG.jsx)(lk,{ref:t,icon:"omrs-icon-chart-line",iconProps:e})})),sa=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,rG.jsx)(lk,{ref:t,icon:"omrs-icon-checkmark-filled",iconProps:e})})),ss=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,rG.jsx)(lk,{ref:t,icon:"omrs-icon-checkmark-outline",iconProps:e})})),sl=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,rG.jsx)(lk,{ref:t,icon:"omrs-icon-chemistry",iconProps:e})})),sc=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,rG.jsx)(lk,{ref:t,icon:"omrs-icon-chevron-down",iconProps:e})})),su=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,rG.jsx)(lk,{ref:t,icon:"omrs-icon-chevron-left",iconProps:e})})),sd=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,rG.jsx)(lk,{ref:t,icon:"omrs-icon-chevron-right",iconProps:e})})),sm=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,rG.jsx)(lk,{ref:t,icon:"omrs-icon-chevron-up",iconProps:e})})),sf=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,rG.jsx)(lk,{ref:t,icon:"omrs-icon-close",iconProps:e})})),sp=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,rG.jsx)(lk,{ref:t,icon:"omrs-icon-close-filled",iconProps:e})})),sg=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,rG.jsx)(lk,{ref:t,icon:"omrs-icon-close-outline",iconProps:e})})),sh=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,rG.jsx)(lk,{ref:t,icon:"omrs-icon-document",iconProps:e})})),sw=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,rG.jsx)(lk,{ref:t,icon:"omrs-icon-document-attachment",iconProps:e})})),s_=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,rG.jsx)(lk,{ref:t,icon:"omrs-icon-download",iconProps:e})})),sy=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,rG.jsx)(lk,{ref:t,icon:"omrs-icon-drug-order",iconProps:e})})),sv=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,rG.jsx)(lk,{ref:t,icon:"omrs-icon-edit",iconProps:e})})),sb=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,rG.jsx)(lk,{ref:t,icon:"omrs-icon-event-schedule",iconProps:e})})),sx=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,rG.jsx)(lk,{ref:t,icon:"omrs-icon-events",iconProps:e})})),sS=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,rG.jsx)(lk,{ref:t,icon:"omrs-icon-gender-female",iconProps:e})})),sj=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,rG.jsx)(lk,{ref:t,icon:"omrs-icon-gender-male",iconProps:e})})),sk=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,rG.jsx)(lk,{ref:t,icon:"omrs-icon-gender-other",iconProps:e})})),sN=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,rG.jsx)(lk,{ref:t,icon:"omrs-icon-gender-unknown",iconProps:e})})),sC=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,rG.jsx)(lk,{ref:t,icon:"omrs-icon-generic-order-type",iconProps:e})})),sE=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,rG.jsx)(lk,{ref:t,icon:"omrs-icon-group",iconProps:e})})),sP=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,rG.jsx)(lk,{ref:t,icon:"omrs-icon-group-access",iconProps:e})})),sI=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,rG.jsx)(lk,{ref:t,icon:"omrs-icon-hospital-bed",iconProps:e})})),sO=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,rG.jsx)(lk,{ref:t,icon:"omrs-icon-image-medical",iconProps:e})})),sA=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,rG.jsx)(lk,{ref:t,icon:"omrs-icon-information",iconProps:e})})),sR=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,rG.jsx)(lk,{ref:t,icon:"omrs-icon-information-filled",iconProps:e})})),sT=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,rG.jsx)(lk,{ref:t,icon:"omrs-icon-information-square",iconProps:e})})),s$=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,rG.jsx)(lk,{ref:t,icon:"omrs-icon-inventory-management",iconProps:e})})),sM=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,rG.jsx)(lk,{ref:t,icon:"omrs-icon-lab-order",iconProps:e})})),sL=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,rG.jsx)(lk,{ref:t,icon:"omrs-icon-list-checked",iconProps:e})})),sW=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,rG.jsx)(lk,{ref:t,icon:"omrs-icon-location",iconProps:e})})),sD=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,rG.jsx)(lk,{ref:t,icon:"omrs-icon-material-order",iconProps:e})})),sU=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,rG.jsx)(lk,{ref:t,icon:"omrs-icon-maximize",iconProps:e})})),sB=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,rG.jsx)(lk,{ref:t,icon:"omrs-icon-medication",iconProps:e})})),sF=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,rG.jsx)(lk,{ref:t,icon:"omrs-icon-message-queue",iconProps:e})})),sH=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,rG.jsx)(lk,{ref:t,icon:"omrs-icon-microscope",iconProps:e})})),sV=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,rG.jsx)(lk,{ref:t,icon:"omrs-icon-mobile-check",iconProps:e})})),sG=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,rG.jsx)(lk,{ref:t,icon:"omrs-icon-money",iconProps:e})})),sz=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,rG.jsx)(lk,{ref:t,icon:"omrs-icon-mother",iconProps:e})})),sq=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,rG.jsx)(lk,{ref:t,icon:"omrs-icon-movement",iconProps:e})})),sJ=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,rG.jsx)(lk,{ref:t,icon:"omrs-icon-overflow-menu--horizontal",iconProps:e})})),sK=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,rG.jsx)(lk,{ref:t,icon:"omrs-icon-overflow-menu--horizontal",iconProps:e})})),sX=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,rG.jsx)(lk,{ref:t,icon:"omrs-icon-password",iconProps:e})})),sY=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,rG.jsx)(lk,{ref:t,icon:"omrs-icon-pedestrian-family",iconProps:e})})),sZ=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,rG.jsx)(lk,{ref:t,icon:"omrs-icon-pen",iconProps:e})})),sQ=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,rG.jsx)(lk,{ref:t,icon:"omrs-icon-printer",iconProps:e})})),s0=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,rG.jsx)(lk,{ref:t,icon:"omrs-icon-procedure-order",iconProps:e})})),s1=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,rG.jsx)(lk,{ref:t,icon:"omrs-icon-programs",iconProps:e})})),s2=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,rG.jsx)(lk,{ref:t,icon:"omrs-icon-referral-order",iconProps:e})})),s5=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,rG.jsx)(lk,{ref:t,icon:"omrs-icon-renew",iconProps:e})})),s6=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,rG.jsx)(lk,{ref:t,icon:"omrs-icon-report",iconProps:e})})),s8=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,rG.jsx)(lk,{ref:t,icon:"omrs-icon-reset",iconProps:e})})),s3=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,rG.jsx)(lk,{ref:t,icon:"omrs-icon-save",iconProps:e})})),s4=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,rG.jsx)(lk,{ref:t,icon:"omrs-icon-search",iconProps:e})})),s7=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,rG.jsx)(lk,{ref:t,icon:"omrs-icon-settings",iconProps:e})})),s9=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,rG.jsx)(lk,{ref:t,icon:"omrs-icon-switcher",iconProps:e})})),le=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,rG.jsx)(lk,{ref:t,icon:"omrs-icon-shopping-cart",iconProps:e})})),lt=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,rG.jsx)(lk,{ref:t,icon:"omrs-icon-shopping-cart--arrow-down",iconProps:e})})),ln=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,rG.jsx)(lk,{ref:t,icon:"omrs-icon-sticky-note-add",iconProps:e})})),lo=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,rG.jsx)(lk,{ref:t,icon:"omrs-icon-syringe",iconProps:e})})),lr=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,rG.jsx)(lk,{ref:t,icon:"omrs-icon-table-of-contents",iconProps:e})})),li=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,rG.jsx)(lk,{ref:t,icon:"omrs-icon-table",iconProps:e})})),la=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,rG.jsx)(lk,{ref:t,icon:"omrs-icon-time",iconProps:e})})),ls=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,rG.jsx)(lk,{ref:t,icon:"omrs-icon-tools",iconProps:e})})),ll=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,rG.jsx)(lk,{ref:t,icon:"omrs-icon-translate",iconProps:e})})),lc=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,rG.jsx)(lk,{ref:t,icon:"omrs-icon-trash-can",iconProps:e})})),lu=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,rG.jsx)(lk,{ref:t,icon:"omrs-icon-tree-view--alt",iconProps:e})})),ld=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,rG.jsx)(lk,{ref:t,icon:"omrs-icon-two-factor-authentication",iconProps:e})})),lm=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,rG.jsx)(lk,{ref:t,icon:"omrs-icon-user-avatar",iconProps:e})})),lf=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,rG.jsx)(lk,{ref:t,icon:"omrs-icon-user-follow",iconProps:e})})),lp=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,rG.jsx)(lk,{ref:t,icon:"omrs-icon-user-xray",iconProps:e})})),lg=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,rG.jsx)(lk,{ref:t,icon:"omrs-icon-user",iconProps:e})})),lh=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,rG.jsx)(lk,{ref:t,icon:"omrs-icon-view-off",iconProps:e})})),lw=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,rG.jsx)(lk,{ref:t,icon:"omrs-icon-view",iconProps:e})})),l_=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,rG.jsx)(lk,{ref:t,icon:"omrs-icon-warning",iconProps:e})})),ly=l_,lv=sw,lb=sL,lx=sO,lS=lt,lj=(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)(iS,{value:r.current,fallback:t,children:(0,rG.jsx)(lk,{ref:o,icon:e,iconProps:n})})})),lk=(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 a=(0,rF.useRef)(null);return(0,rF.useImperativeHandle)(n,()=>a.current),(0,rF.useEffect)(()=>{a.current&&"currentColor"!==r&&a.current.style.setProperty("--omrs-icon-fill",r)},[]),(0,rG.jsx)("svg",{ref:a,className:aL()("omrs-icon","-esm-login__icons-module__icon___BfFhd",o),height:i,width:i,viewBox:"0 0 16 16",children:(0,rG.jsx)("use",{href:`#${e}`})})})),lN=({path:e,title:t,basePath:n,icon:o})=>{let{t:r}=(0,it.useTranslation)(),i=(0,aQ.useLocation)(),a=(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:aL()("cds--side-nav__link",{"active-left-nav-link":a}),to:`${n}/${encodeURIComponent(e)}`,children:(0,rG.jsxs)("span",{className:"-esm-login__dashboard-module__menu___ds1tf",children:[(0,rG.jsx)(lj,{icon:o,className:"-esm-login__dashboard-module__icon___4Zrrh",size:16}),(0,rG.jsx)("span",{children:r(t)})]})})},e)};function lC(e){return function({basePath:t}){return(0,rG.jsx)(aQ.BrowserRouter,{children:(0,rG.jsx)(lN,{basePath:t,...e})})}}var lE=n(7715),lP=n(7532),lI=n(3692),lO=n(7615),lA=n(700),lR=n(6816),lT=n(1168);function l$(e){return rH().createElement(lT.C,e)}var lM=n(3010),lL=n(6513),lW=n(6190);function lD(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 lM.ng||e instanceof lM._l||e instanceof lM.Ip)return t?(0,lL.yP)(e,t):e;{let n=ag()(e).toDate(),o=new lM.ng(n.getFullYear(),n.getMonth()+1,n.getDate());return t?(0,lL.yP)(o,t):o}}function lU(e){if(e)return e.toDate((0,lW.Xj)())}var lB=n(9002);function lF(e){if("string"==typeof e&&0!==e.trim().length)try{return new Intl.Locale(e.replace(/[_@]/g,"-")).toString()}catch{return}}function lH(e){let t=e??"",n=lF(t);if(!n)return t;try{return new Intl.DisplayNames([n],{type:"language"}).of(n)??t}catch{return t}}function lV(){let e=window.i18next.language,t=lF(e)??e;return"ht"===t&&(t="fr-HT"),t}var lG=n(7883),lz=n(424),lq=n(1492),lJ=n(8271);function lK(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}ap.extend(ah),ap.extend(lq),ap.extend(lz);let lX="YYYY-MM-DDTHH:mm:ss.SSSZZ",lY=/^(\d{4})(?:-(\d{2})(?:-(\d{2}))?)?$/;function lZ(e,t){let n=lY.exec(e);if(!n)return(0,lG.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]),a=new Date(0);return(a.setUTCFullYear(o,(r??1)-1,i??1),a.getUTCFullYear()!==o||a.getUTCMonth()!==(r??1)-1||a.getUTCDate()!==(i??1))?{invalid:`Invalid ISO calendar date '${e}'`}:{year:o,...void 0!==r&&{month:r},...void 0!==i&&{day:i}}}function lQ(e){return null!=e&&28===e.trim().length&&"T"===(e=e.trim())[10]&&":"===e[13]&&":"===e[16]&&"."===e[19]&&("+"===e[23]||"-"===e[23])&&ap(e,lX).isValid()}function l0(e){return ap(e).isToday()}function l1(e){return lQ(e)?ap(e,lX).toDate():null}function l2(e,t=!1){let n=ap(e);return t&&(n=n.utc()),n.format(lX)}function l5(e){return ap(e).toDate()}var l6=new WeakMap;let l8=new class{register(e,t){lK(this,l6).set(e,t)}getCalendar(e){if(!e)return;if(e.calendar)return e.calendar;if(e.region){let t=`${e.language}-${e.region}`;if(lK(this,l6).has(t))return lK(this,l6).get(t)}if(e.language&&lK(this,l6).has(e.language))return lK(this,l6).get(e.language);let t=new Intl.DateTimeFormat(e.toString()).resolvedOptions().calendar;return lK(this,l6).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,l6,{writable:!0,value:new Map})}};function l3(e,t){l8.register(e,t)}function l4(e){let t=e??lV();return l8.getCalendar(t instanceof Intl.Locale?t:new Intl.Locale(t))}let l7={mode:"standard",time:"for today",day:!0,month:!0,year:!0,noToday:!1};function l9(e,t={}){let n=lZ(e,lV());if(n.invalid)return console.warn(`Could not parse invalid date '${e}'`),null;!(0,lJ.A)(n.day)&&(0,lJ.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=ap().set(n).toDate();return(0,lJ.A)(n.year)&&(t.year=!1),(0,lJ.A)(n.month)&&(t.month=!1),(0,lJ.A)(n.date)&&(t.day=!1),ce(o,t)}function ce(e,t){let n,o=t?.locale??lV(),r=new Intl.Locale(o),{calendar:i,mode:a,time:s,day:l,month:c,year:u,noToday:d,numberingSystem:m}={...l7,...{noToday:"am"===r.language},...t},f={calendar:i??l4(r),year:u?"numeric":void 0,month:c?"short":void 0,day:l?"2-digit":void 0,numberingSystem:m},p=ap(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"==a&&u&&l&&(t=t.map(ct("-"))),"wide"==a&&(t=t.map(ct(" — "))),"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===s||p&&"for today"===s)&&(n+=`, ${cn(e)}`),n}let ct=e=>(t,n,o)=>"literal"!==t.type||" "!==t.value||n<o.length-1&&"era"===o[n+1].type?t:{type:"literal",value:e};function cn(e){return e.toLocaleTimeString(lV(),{hour:"2-digit",minute:"2-digit"})}function co(e,t){return ce(e,{...t,time:!0})}function cr(e,t){let n=l4("string"==typeof t?new Intl.Locale(t):t);return n?(0,lL.yP)(e,(0,lB.d)(n)):e}function ci(e,t){return new Intl.DurationFormat(lV(),t).format(e)}function ca(e,t){if(null==e)return null;if("string"==typeof e){let n=lZ(e,lV());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}}),ap(t).set(n))}return ap(e)}let cs=["years","months","days","hours","minutes","seconds"],cl={second:"seconds",minute:"minutes",hour:"hours",day:"days",month:"months",year:"years"},cc={seconds:45,minutes:45,hours:22,days:26,months:11,years:1/0};function cu(e,t=ap(),n){let o,r=ap(t),i=ca(e,r);if(null==i)return null;if("string"==typeof n){let e=cl[n]??n;return{[e]:r.diff(i,e)}}let{thresholds:a,largestUnit:s,smallestUnit:l}=n??{};if(void 0!==s||void 0!==l){let e,t=l?cl[l]??l:void 0;return e="auto"===s||void 0===s?function(e,t,n){let o=cs.indexOf(n);for(let r=0;r<cs.length;r++){let i=cs[r];if(t.diff(e,i)>0)return r<=o?i:n}return n}(i,r,t??"seconds"):cl[s]??s,function(e,t,n,o){let r=cs.indexOf(n),i=cs.indexOf(o),a=cs.slice(r,i+1),s={},l=e;for(let e of a){let n=t.diff(l,e);s[e]=n,l=l.add(n,e)}return s}(i,r,e,t??e)}let c=(o=function(e){let t={...cc};if(e)for(let[n,o]of Object.entries(e))void 0!==o&&(t[cl[n]??n]=o);return t}(a),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 cd={style:"short",localeMatcher:"lookup"};function cm(e,t=ap(),n){let o=cu(e,t,n);return null==o?null:ci(o,"object"==typeof n&&n.formatOptions?{...cd,...n.formatOptions}:cd)}let cf=(0,rF.createContext)(null);function cp(){let e=iT({externalModuleName:"@openmrs/esm-styleguide"}).preferredDateLocale,t=(0,rF.useMemo)(()=>{let t=lV();return e[t]&&(t=e[t]),t},[window.i18next.language]),n=(0,rF.useMemo)(()=>{let e=l4(t);return void 0!==e?(0,lB.d)(e):void 0},[t]),o=(0,rF.useMemo)(()=>new Intl.Locale(t,{calendar:n?.identifier}),[t,n]),r=(0,rF.useMemo)(()=>n?(0,lL.yP)((0,lW.Ec)((0,lW.Xj)()),n):(0,lW.Ec)((0,lW.Xj)()),[n]);return{calendar:n,intlLocale:o,today_:r}}let cg=new lM.ng(1793,1,1);var ch=n(5830),cw=n(5354),c_=n(4745),cy=n(1202);function cv(e,t){return Number.parseInt(ce(e,{calendar:t.calendar,locale:t.baseName,day:!1,month:!1,noToday:!0,numberingSystem:"latn"}))}let cb=(0,rF.forwardRef)(function(e,t){let{className:n}=e,o=(0,rF.useContext)(ch.f2),r=(0,rF.useContext)(ch._I),i=o??r,a=(0,rF.useContext)(cf),s=(0,lW.Xj)(),l=ce(i.visibleRange.start.toDate(s),{calendar:a.calendar,locale:a.baseName,day:!1,year:!1,noToday:!0}),c=cv(i.visibleRange.start.toDate(s),a),u=i.maxValue?cv(i.maxValue.toDate(s),a):void 0,d=i.minValue?cv(i.minValue.toDate(s),a):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)(c_.oz,{formatOptions:{useGrouping:!1},maxValue:u,minValue:d,onChange:m,value:c,children:[(0,rG.jsx)(cy.p,{}),(0,rG.jsxs)(lO.Y,{children:[(0,rG.jsx)(lA.$,{slot:"increment",children:(0,rG.jsx)(so,{size:8})}),(0,rG.jsx)(lA.$,{slot:"decrement",children:(0,rG.jsx)(se,{size:8})})]})]})]})});var cx=n(9588);let cS="-esm-login__datepicker-module__inputGroup___+4zks",cj="-esm-login__datepicker-module__inputSegment___wiExn",ck="-esm-login__datepicker-module__dateInputWrapper___uiyAC",cN="-esm-login__datepicker-module__invalidText___SxtTL",cC="-esm-login__datepicker-module__flatButton___UU1Qp",cE="-esm-login__datepicker-module__flatButtonMd___fhR-1",cP="-esm-login__datepicker-module__flatButtonSm___5INZ7",cI="-esm-login__datepicker-module__flatButtonLg___RFMrl";function cO({children:e}){let t=(0,rF.useContext)(lP.Pg),n=(0,rF.useContext)(lP.a8),o=t??n,r=ao(()=>o?.close());return(0,rG.jsx)(cx.lG,{className:"-esm-login__datepicker-module__dialog___qllIf",ref:r,children:e})}let cA=(0,rF.forwardRef)(function({variant:e,today_:t,minDate:n,maxDate:o},r){let i="range"===e,a=i?ch._e:ch.Vv;return(0,rG.jsx)(cw.A,{ref:r,className:"-esm-login__datepicker-module__popover___16UMX",placement:"bottom start",offset:1,isNonModal:!0,children:(0,rG.jsx)(cO,{children:(0,rG.jsxs)(a,{...i?{minValue:n,maxValue:o,className:"cds--date-picker__calendar"}:{},children:[(0,rG.jsxs)("header",{className:"-esm-login__datepicker-module__header___WAVlD",children:[(0,rG.jsx)(lA.$,{className:aL()(cC,cE),slot:"previous",children:(0,rG.jsx)(su,{size:16})}),(0,rG.jsx)(cb,{className:"-esm-login__datepicker-module__monthYear___A3aKF"}),(0,rG.jsx)(lA.$,{className:aL()(cC,cE),slot:"next",children:(0,rG.jsx)(sd,{size:16})})]}),(0,rG.jsx)(ch.r8,{className:"-esm-login__datepicker-module__calendarGrid___6qRB2",children:e=>(0,rG.jsx)(ch.Zr,{className:aL()("cds--date-picker__day",{"-esm-login__datepicker-module__today___TZl6M":0===t.compare(e)}),date:e},e.toString())})]})})})});var cR=n(8017),cT=n(9774),c$=n(7956);let cM=(0,rF.forwardRef)(function(e,t){let n=(0,rF.useContext)(lP.Pg),[o,r]=(0,lE.JT)({slot:e.slot},t,cT.cQ),{locale:i}=(0,lT.Y)(),a=(0,c$.F)({...o,locale:i,createCalendar:lB.d}),s=(0,rF.useRef)(null),{fieldProps:l,inputProps:c}=(0,cR.cJ)({...o,inputRef:s},a,r),u=(0,rF.useCallback)(()=>{a.isDisabled||n.toggle()},[]);return(0,rG.jsxs)(lE.Kq,{values:[[cT.$,a],[cy.E,{...c,ref:s}],[lO.t,{...l,ref:r,isInvalid:a.isInvalid}]],children:[(0,rG.jsx)(lO.Y,{...e,id:e.id,ref:t,slot:e.slot||void 0,className:e.className,isDisabled:a.isDisabled,isInvalid:a.isInvalid,onClick:u,children:a.segments.map((t,n)=>(0,rF.cloneElement)(e.children(t),{key:n}))}),(0,rG.jsx)(cy.p,{})]})}),cL=(0,rF.forwardRef)(function(e,t){let n=(0,rF.useContext)(lP.Pg),o=(0,rF.useContext)(lP.a8);return(n??o).isInvalid?(0,rG.jsx)(l_,{ref:t,size:16,...e}):(0,rG.jsx)(a9,{ref:t,size:16,...e})});var cW=n(64),cD=n(5503),cU=n(1697),cB=n(7866),cF=n(8035),cH=n(2231);let cV=(0,rF.forwardRef)(function({segment:e,...t},n){let o=(0,rF.useContext)(cT.$),r=(0,cW.U)(n),{segmentProps:i}=(0,cD.V)(e,o,r),{focusProps:a,isFocused:s,isFocusVisible:l}=(0,cU.o)(),{hoverProps:c,isHovered:u}=(0,cB.M)({...t,isDisabled:o.isDisabled||"literal"===e.type}),d=function(e){let{className:t,style:n,children:o,defaultClassName:r,defaultChildren:i,defaultStyle:a,values:s}=e;return(0,rF.useMemo)(()=>{let e,l,c;return e="function"==typeof t?t({...s,defaultClassName:r}):t,l="function"==typeof n?n({...s,defaultStyle:a||{}}):n,c="function"==typeof o?o({...s,defaultChildren:i}):null==o?i:o,{className:e??r,style:l||a?{...a,...l}:void 0,children:c??i,"data-rac":""}},[t,n,o,r,i,a,s])}({...t,values:{...e,isReadOnly:!e.isEditable,isInvalid:o.isInvalid,isDisabled:o.isDisabled,isHovered:u,isFocused:s,isFocusVisible:l},defaultChildren:e.text}),m=(0,rF.useCallback)(e=>{e.stopPropagation()},[]);return(0,rG.jsx)("span",{...(0,cF.v)((0,cH.$)(t),i,a,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":s||void 0,"data-focus-visible":l||void 0,onClick:m})}),cG={short:!1,size:"md"},cz=(0,rF.forwardRef)(function(e,t){let{className:n,defaultValue:o,isDisabled:r,invalid:i,invalidText:a,isInvalid:s,label:l,labelText:c,light:u,maxDate:d,minDate:m,onChange:f,onChangeRaw:p,short:g,size:h,value:w,..._}={...cG,...e},{calendar:y,intlLocale:v,today_:b}=cp(),x=(0,rF.useId)(),S=!!(c??l),j=(0,rF.useMemo)(()=>lD(o,y),[o,y]),k=(0,rF.useMemo)(()=>lD(w,y,!0),[w,y]),N=(0,rF.useMemo)(()=>lD(d,y),[d,y]),C=(0,rF.useMemo)(()=>lD(m??cg,y),[m,y]),E=(0,rF.useMemo)(()=>i||s,[i,s]),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?.(lU(e)))),[p,f]);return(0,rG.jsx)(l$,{locale:v.toString(),children:(0,rG.jsx)("div",{className:aL()("cds--form-item",n),children:(0,rG.jsx)(lE.Kq,{values:[[cf,v]],children:(0,rG.jsxs)(lP.lr,{className:aL()("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"===v.language||void 0,..._,onChange:P,children:[(0,rG.jsxs)("div",{className:"cds--date-picker-container",children:[S&&(0,rG.jsx)(lI.J,{className:aL()("cds--label",{"cds--label--disabled":r}),htmlFor:x,children:c??l}),(0,rG.jsxs)(lO.Y,{className:cS,children:[(0,rG.jsx)(cM,{id:S?x:void 0,ref:t,className:aL()("cds--date-picker-input__wrapper","-esm-login__datepicker-module__inputWrapper___kykar",{"-esm-login__datepicker-module__inputWrapperSm___KJtg-":"sm"===h,"-esm-login__datepicker-module__inputWrapperMd___ablE9":"md"===h||!h||0===h.length,"-esm-login__datepicker-module__inputWrapperLg___5dkQp":"lg"===h}),children:e=>"era"!==e.type?(0,rG.jsx)(cV,{className:cj,segment:e}):(0,rG.jsx)(rH().Fragment,{})}),(0,rG.jsx)(lA.$,{className:aL()(cC,{[cP]:"sm"===h,[cE]:"md"===h||!h||0===h.length,[cI]:"lg"===h}),children:(0,rG.jsx)(cL,{})})]}),(0,rG.jsx)(lR.b,{className:cN,children:a})]}),(0,rG.jsx)(cA,{variant:"single",today_:b})]})})})})}),cq=(0,rF.forwardRef)(function({className:e,defaultValue:t,invalid:n,invalidText:o,isDisabled:r,isInvalid:i,label:a,labelText:s,light:l,maxDate:c,minDate:u,onChange:d,onChangeRaw:m,size:f="md",value:p,...g},h){let{calendar:w,intlLocale:_,today_:y}=cp(),v=(0,rF.useId)(),b=!!(s??a),x=(0,rF.useMemo)(()=>{if(p)return{start:lD(p[0],w,!1),end:lD(p[1],w,!1)}},[p,w]),S=(0,rF.useMemo)(()=>{if(t)return{start:lD(t[0],w,!1),end:lD(t[1],w,!1)}},[t,w]),j=(0,rF.useMemo)(()=>lD(u??cg,w,!0),[u,w]),k=(0,rF.useMemo)(()=>lD(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?.([lU(e.start),lU(e.end)]))),[m,d]);return(0,rG.jsx)(l$,{locale:_.toString(),children:(0,rG.jsx)("div",{className:aL()("cds--form-item",e),children:(0,rG.jsx)(lE.Kq,{values:[[cf,_]],children:(0,rG.jsx)(lP.Ur,{id:b?v:void 0,className:aL()("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)(lI.J,{className:aL()("cds--label",{"cds--label--disabled":r}),htmlFor:v,children:s??a}),(0,rG.jsxs)(lO.Y,{className:cS,children:[(0,rG.jsxs)("div",{className:aL()("-esm-login__datepicker-module__inputsWrapper___YlkGh",{"-esm-login__datepicker-module__inputsWrapperSm___fAKhS":"sm"===f,"-esm-login__datepicker-module__inputsWrapperMd___XVgGP":"md"===f||!f||0===f.length,"-esm-login__datepicker-module__inputsWrapperLg___UgHJ1":"lg"===f}),children:[(0,rG.jsx)(cT.J3,{className:aL()("cds--date-picker-input__wrapper","-esm-login__datepicker-module__startInput___qgbQm",ck),slot:"start",children:e=>(0,rG.jsx)(cV,{className:cj,segment:e})}),(0,rG.jsx)("div",{className:"-esm-login__datepicker-module__separator___79vXZ",children:(0,rG.jsx)("span",{"aria-hidden":"true","data-readonly":!0,children:"–"})}),(0,rG.jsx)(cT.J3,{className:aL()("cds--date-picker-input__wrapper","-esm-login__datepicker-module__endInput___huv7x",ck),slot:"end",children:e=>(0,rG.jsx)(cV,{className:cj,segment:e})})]}),(0,rG.jsx)(lA.$,{className:aL()(cC,{[cP]:"sm"===f,[cE]:"md"===f||!f||0===f.length,[cI]:"lg"===f}),children:(0,rG.jsx)(cL,{})})]}),(0,rG.jsx)(lR.b,{className:cN,children:o}),(0,rG.jsx)(cA,{variant:"range",today_:y,minDate:j,maxDate:k})]})})})})})});var cJ=n(9606);let cK=({diagnoses:e,showCertainty:t=!1})=>{let{diagnosisTags:n}=iT({externalModuleName:"@openmrs/esm-styleguide"});return(0,rG.jsx)("div",{className:"-esm-login__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)(cX,{color:r,isProvisional:o,name:e.display},e.uuid)})})};function cX({color:e,isProvisional:t,name:n}){let[o,r]=(0,rF.useState)(!1),[i,a]=(0,rF.useState)(!1),[s,l]=(0,rF.useState)(!1),c=s||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=aL()("cds--tag","cds--tag--md","cds--layout--size-md",`cds--tag--${e}`,"-esm-login__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-login__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)(cJ.k$,{delay:0,closeDelay:150,isOpen:o,onOpenChange:r,children:[(0,rG.jsx)(lA.$,{className:d,"data-testid":"diagnosis-tag",onFocusChange:a,onPress:()=>r(!0),children:m}),(0,rG.jsx)(cJ.m_,{className:"-esm-login__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 cY={action:"-esm-login__empty-card-module__action___Y0dul",content:"-esm-login__empty-card-module__content___fo0nB",desktopHeading:"-esm-login__empty-card-module__desktopHeading___0Cg1N",tabletHeading:"-esm-login__empty-card-module__tabletHeading___BogTF",tile:"-esm-login__empty-card-module__tile___QB8Ld"},cZ=({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"})}),cQ=e=>{let t="tablet"===i4(),n=e.launchForm;return(0,rG.jsx)(aF.Layer,{className:cY.layer,children:(0,rG.jsxs)(aF.Tile,{className:cY.tile,children:[(0,rG.jsx)("div",{className:t?cY.tabletHeading:cY.desktopHeading,children:(0,rG.jsx)("h4",{children:e.headerTitle})}),(0,rG.jsx)(cZ,{}),(0,rG.jsx)("p",{className:cY.content,children:tm("emptyStateText","There are no {{displayText}} to display",{displayText:e.displayText})}),(0,rG.jsx)("p",{className:cY.action,children:n&&(0,rG.jsx)(aF.Button,{onClick:()=>n(),kind:"ghost",size:t?"lg":"sm",children:tm("recordNewEntry","Record {{ displayText }}",{displayText:e.displayText})})})]})})},c0=({error:e,headerTitle:t})=>{let n="tablet"===i4();return(0,rG.jsx)(aF.Layer,{children:(0,rG.jsxs)(aF.Tile,{className:"-esm-login__error-state-module__tile___dd418",children:[(0,rG.jsx)("div",{className:n?"-esm-login__error-state-module__tabletHeading___g5rjg":"-esm-login__error-state-module__desktopHeading___Nd9u2",children:(0,rG.jsx)("h4",{children:t})}),(0,rG.jsxs)("p",{className:"-esm-login__error-state-module__errorMessage___z2RiN",children:[tm("error","Error")," ",`${e?.response?.status}: `,e?.response?.statusText]}),(0,rG.jsx)("p",{className:"-esm-login__error-state-module__errorCopy___dq+e2",children:tm("errorCopy")})]})})},c1=c0,c2=rH().forwardRef((e,t)=>{let{slotName:n,basePath:o,componentContext:r,state:i}=ae(),a=window.location??{pathname:""},s=r6(n??"");return e.isChildOfHeader&&n&&s.length>0?(0,rG.jsxs)(aF.SideNav,{"aria-label":tm("leftNavigation","Left navigation"),className:"-esm-login__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)(iS,{value:r,fallback:(0,rG.jsx)(r4,{name:n,state:{basePath:o,currentPath:a,...i}}),children:(0,rG.jsx)(rV.Provider,{value:r,children:(0,rG.jsx)(r4,{name:n,state:{basePath:o,currentPath:a,...i}})})}):null]}):null}),c5=({selectedLocationUuid:e,defaultLocationUuid:t,locationTag:n,locationsPerRequest:o=50,onChange:r})=>{let[i,a]=(0,rF.useState)(""),s=(0,rF.useId)(),{location:l}=function(e){let t=e?`/ws/fhir2/R4/Location?_id=${e}`:null,{data:n,error:o,isLoading:r}=iW()(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=iM(n),{data:r,isLoading:i,isValidating:a,setSize:s,error:l}=iQ()(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?`,a=new URLSearchParams;return a.append("_summary","data"),t&&a.append("_count",""+t),n&&a.append("_getpagesoffset",""+n*t),e&&a.append("_tag",e),"string"==typeof o&&""!==o&&a.append("name:contains",o),i+a.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:a,error:l||null,setPage:s}),[i,r,a,s,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(),a(e.trim())},[r]),w=ar((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)(aF.Search,{"aria-describedby":f?`${s}-error`:void 0,labelText:tm("searchForLocation"),id:s,placeholder:tm("searchForLocation"),onChange:e=>h(e.target.value),size:"lg"}),f&&(0,rG.jsx)("div",{className:"-esm-login__location-picker-module__errorNotification___vWBFD",id:`${s}-error`,children:(0,rG.jsx)(aF.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-login__location-picker-module__searchResults___Gbet+",children:u?(0,rG.jsx)("div",{className:"-esm-login__location-picker-module__loadingContainer___QO-zj",children:Array.from({length:5}).map((e,t)=>(0,rG.jsx)(aF.RadioButtonSkeleton,{className:"-esm-login__location-picker-module__radioButtonSkeleton___otoCy",role:"progressbar"},t))}):(0,rG.jsxs)(rG.Fragment,{children:[(0,rG.jsx)("div",{className:"-esm-login__location-picker-module__locationResultsContainer___6Pasf",children:g.length>0?(0,rG.jsx)(aF.RadioButtonGroup,{name:"loginLocations",onChange:e=>{r(e?.toString())},orientation:"vertical",valueSelected:e,children:g.map((e,t)=>(0,rG.jsx)(aF.RadioButton,{className:"-esm-login__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-login__location-picker-module__emptyState___w4-Ca",children:(0,rG.jsx)("p",{className:"-esm-login__location-picker-module__locationNotFound___Of2MJ",children:tm("noResultsToDisplay")})})}),m&&(0,rG.jsx)("div",{className:"-esm-login__location-picker-module__loadingIcon___NAwSB",children:(0,rG.jsx)(aF.InlineLoading,{description:tm("loading")})})]})})]})},c6=R("modalState",{modalContainer:null,modalStack:[]}),c8=0;async function c3(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,a=await i(),s=c8++;r=await rW({...a,name:`${t}-${s}`},{...n,domElement:e})}else y(`Failed to launch modal. Please notify your administrator. Modal name: ${t}`);return r}function c4(e){return"TO_BE_DELETED"===e.state||"DELETED"===e.state}function c7(e,t){t?.unmount&&(t.unmountPromise?.catch(()=>{}),t.unmount().catch(t=>{console.error(`The modal '${e}' failed to unmount`,t)}))}function c9(e){return e.find(e=>!c4(e))}function ue(e,t){e.container&&(e.container.style.visibility=t?"unset":"hidden")}let ut=window.getComputedStyle(document.body).overflow;function un({modalStack:e,modalContainer:t}){if(t)if(e.length){t.style.visibility||(addEventListener("keydown",ur),document.body.style.overflow="hidden",t.style.visibility="unset");let n=c9(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",c3(n,e.modalName,e.props).then(o=>{c4(e)?c7(e.modalName,o):o?(e.parcel=o,t.prepend(n),ue(e,c9(c6.getState().modalStack)===e),o.mountPromise.then(()=>{c4(e)||(e.state="MOUNTED")},t=>{y(t),e.parcel=null,uo(e)})):uo(e)},t=>{y(t),uo(e)});break}case"MOUNTING":case"MOUNTED":ue(e,e===n);break;case"TO_BE_DELETED":e.state="DELETED",e.onClose(),c7(e.modalName,e.parcel),e.container?.remove(),setTimeout(()=>{let t=c6.getState();c6.setState({...t,modalStack:t.modalStack.filter(t=>t!==e)})},0)}})}else t.style.removeProperty("visibility"),document.body.style.overflow=ut,removeEventListener("keydown",ur)}function uo(e){if(c4(e))return;e.state="TO_BE_DELETED";let t=c6.getState();c6.setState({...t,modalStack:[...t.modalStack]})}function ur(e){"Escape"===e.key&&function(){let[e]=c6.getState().modalStack;e&&uo(e)}()}function ui(e){c6.subscribe(un),c6.setState({...c6.getState(),modalContainer:e})}function ua(e,t={},n=()=>{}){let o=()=>{let e=c6.getState().modalStack.find(e=>e.onClose===n);e&&uo(e)};if(rN(e)){var r;let i,a;r={state:"NEW",onClose:n,modalName:e,props:{close:o,...t}},a=[r,...(i=c6.getState()).modalStack],c6.setState({...i,modalStack:a})}else y(`Failed to launch modal. Please notify your administrator. Modal name: "${e}"`);return o}var us=n(9685);let ul=({notification:e})=>{let{description:t,action:n,kind:o,critical:r,title:i,onAction:a}=e;return(0,rG.jsx)(aF.ActionableNotification,{actionButtonLabel:n,kind:o||"info",lowContrast:r,subtitle:t,title:i||"",inline:!0,onActionButtonClick:a})},uc=({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)(ul,{notification:e},e.id))})},uu=({notification:e})=>{let{actionButtonLabel:t,onActionButtonClick:n=()=>{},subtitle:o,kind:r,title:i,critical:a,progressActionLabel:s,id:l,...c}=e,[u,d]=(0,rF.useState)(t);return(0,rG.jsx)(aF.ActionableNotification,{kind:r||"info",actionButtonLabel:u,ariaLabel:tm("closesActionableNotification","Closes actionable notification"),onActionButtonClick:()=>{n(),s&&d(s)},statusIconDescription:tm("actionableNotification","Actionable notification"),subtitle:o,title:i,lowContrast:a,inline:!0,...c})},ud=({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)(uu,{notification:e},e.id))})};class um{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 uf=new um,up=0,ug=new um,uh=0;function uw(e){e&&(0,r7.createRoot)(e).render((0,rG.jsx)(uc,{subject:uf}))}function u_(e){var t;e&&("string"==typeof(t=e.description)?t.trim().length>0:"object"==typeof t&&(t instanceof Error||!(0,us.A)(t)))?(e.description instanceof Error&&(e.description=e.description.toLocaleString()),setTimeout(()=>{uf.next({...e,id:up++})},0)):console.error("showNotification must be called with an object having a 'description' property that is a non-empty string or object")}function uy(e){e&&(0,r7.createRoot)(e).render((0,rG.jsx)(ud,{subject:ug}))}function uv(e){var t;e&&("string"==typeof(t=e.actionButtonLabel)?t.trim().length>0:"object"==typeof t&&!(0,us.A)(t))?setTimeout(()=>{ug.next({...e,id:uh++})},0):console.error("showActionableNotification must be called with an actionButtonLabel that is a non-empty string")}let ub=["NORMAL","HIGH","CRITICALLY_HIGH","OFF_SCALE_HIGH","LOW","CRITICALLY_LOW","OFF_SCALE_LOW"],ux=["critically_low","critically_high","high","low","normal","off_scale_low","off_scale_high"],uS={container:"-esm-login__numeric-observation-module__container___NfxbH",card:"-esm-login__numeric-observation-module__card___9oQAh","abnormal-value":"-esm-login__numeric-observation-module__abnormal-value___drvEi","critical-value":"-esm-login__numeric-observation-module__critical-value___JAIHt",cell:"-esm-login__numeric-observation-module__cell___lTunW","critically-high":"-esm-login__numeric-observation-module__critically-high___aDUjc","critically-low":"-esm-login__numeric-observation-module__critically-low___5srAK",high:"-esm-login__numeric-observation-module__high___7KiyK",low:"-esm-login__numeric-observation-module__low___Zs2ct","label-container":"-esm-login__numeric-observation-module__label-container___lGnGH","value-container":"-esm-login__numeric-observation-module__value-container___hHPXt",label:"-esm-login__numeric-observation-module__label___WFuxk",value:"-esm-login__numeric-observation-module__value___6fHUr",units:"-esm-login__numeric-observation-module__units___EdVuw","pad-right":"-esm-login__numeric-observation-module__pad-right___6T9Cd","off-scale-low":"-esm-login__numeric-observation-module__off-scale-low___Sc1CV","off-scale-high":"-esm-login__numeric-observation-module__off-scale-high___cWpU2",arrow:"-esm-login__numeric-observation-module__arrow___SLGUh"},uj=({value:e,unit:t,label:n,interpretation:o,referenceRange:r,conceptUuid:i,variant:a="card",patientUuid:s})=>{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}=iW()(n,tP),a=o?.data?.results?.[0];return{referenceRange:a?{hiNormal:a.hiNormal??null,hiAbsolute:a.hiAbsolute??null,hiCritical:a.hiCritical??null,lowNormal:a.lowNormal??null,lowAbsolute:a.lowAbsolute??null,lowCritical:a.lowCritical??null}:void 0,error:r,isLoading:i}}(r||o?void 0:i,s),d=r??c,m=(0,rF.useMemo)(()=>{if(o)return o?"--"===o?"normal":ub.includes(o)?o.toLowerCase():ux.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,y=_?e:tm("notAvailable","Not available"),v=aL()({[uS["critically-low"]]:"critically_low"===m||"off_scale_low"===m,[uS["critically-high"]]:"critically_high"===m||"off_scale_high"===m,[uS.low]:"low"===m,[uS.high]:"high"===m,[uS["off-scale-low"]]:"off_scale_low"===m,[uS["off-scale-high"]]:"off_scale_high"===m}),b=aL()({[uS.container]:!0,[uS.card]:!0,[uS["critical-value"]]:f,[uS["abnormal-value"]]:p&&!f}),x=aL()({[uS.cell]:!0,[v]:!0});return"cell"===a?(0,rG.jsxs)("div",{className:x,children:[y,_&&t?` ${t}`:""]}):(0,rG.jsxs)("section",{className:b,"data-testid":"numeric-observation-card",children:[n&&(0,rG.jsxs)("div",{className:uS["label-container"],children:[(0,rG.jsx)("span",{id:g,className:uS.label,children:n}),p&&(0,rG.jsx)("span",{className:uS[m.replace("_","-")],title:tm("abnormalValue","Abnormal value")})]}),(0,rG.jsxs)("div",{className:uS["value-container"],children:[(0,rG.jsx)("span",{id:h,"aria-labelledby":g&&w?`${g} ${w}`:g||w||void 0,className:uS.value,children:y}),_&&t&&(0,rG.jsx)("span",{id:w,className:uS.units,children:t})]})]})},uk="-esm-login__page-header-module__pageHeader___YOpQL",uN=e=>{if("children"in e){let{children:t,className:n,...o}=e;return(0,rG.jsx)("div",{className:aL()(uk,n),...o,children:t})}{let{title:t,illustration:n,className:o,...r}=e;return(0,rG.jsx)("div",{className:aL()(uk,o),...r,children:(0,rG.jsx)(uC,{title:t,illustration:n})})}},uC=({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:aL()("-esm-login__page-header-module__pageHeaderContent___PjsJm",n),children:[t,(0,rG.jsxs)("div",{className:"-esm-login__page-header-module__pageLabels___pPcKj",children:[o?.implementationName&&(0,rG.jsx)("p",{children:tm(o.implementationName)}),(0,rG.jsx)("h1",{className:"-esm-login__page-header-module__pageName___3d4IC",children:e})]})]})},uE=({totalItems:e,pageSize:t,onPageNumberChange:n,pageNumber:o,dashboardLinkUrl:r,currentItems:i,dashboardLinkLabel:a})=>{let{pageSizes:s,pageItemsCount:l}=as(t,e,o,i),c="tablet"===i4(),u=tm("paginationItemsCount","{{pageItemsCount}} / {{totalItems}} items",{totalItems:e,pageItemsCount:l});return(0,rG.jsx)(rG.Fragment,{children:e>0&&(0,rG.jsxs)("div",{className:aL()({"-esm-login__pagination-module__tablet___lQ3ak":c,"-esm-login__pagination-module__desktop___HfUTY":!c}),children:[(0,rG.jsxs)("div",{children:[u,r&&(0,rG.jsx)(rz,{to:r,className:"-esm-login__pagination-module__configurableLink___NM9v7",children:a??tm("seeAll","See all")})]}),(0,rG.jsx)(aF.Pagination,{className:"-esm-login__pagination-module__pagination___WzkBs",page:o,pageSize:t,pageSizes:s,totalItems:e,onChange:n,pageRangeText:(e,t)=>tm("paginationOfPages","of {{count}} pages",{count:t}),size:c?"lg":"sm"})]})})};function uP(e){return uO(uR(e,"usual","official"))}function uI(e){return uP(e)}function uO(e){var t;let n;return e?e.text??(n=(t=e).given??[],(t.family?n.concat(t.family):n).join(" ")):""}function uA(e){return uO(e)}function uR(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 uT(e,t=ap()){let n=ap(t),o=ca(e,n);if(null==o)return null;let r=n.diff(o,"hours"),i=n.diff(o,"days"),a=n.diff(o,"weeks"),s=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(a<4)c.days=i;else if(l<1){let e=n.subtract(a,"weeks").diff(o,"days");c.weeks=a,c.days=e}else if(l<2){let e=n.subtract(s,"months").diff(o,"days");c.months=s,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 u$(e,t=ap()){let n=uT(e,t);if(null==n)return null;let o={style:"short",localeMatcher:"lookup"};return"minutes"in n&&0===n.minutes&&(o.minutesDisplay="always"),ci(n,o)}let uM={container:"-esm-login__patient-banner-patient-info-module__container___Gjd-4",activePatientContainer:"-esm-login__patient-banner-patient-info-module__activePatientContainer___QLcpg",patientBanner:"-esm-login__patient-banner-patient-info-module__patientBanner___7nrgC",patientName:"-esm-login__patient-banner-patient-info-module__patientName___-bF9a",patientAvatar:"-esm-login__patient-banner-patient-info-module__patientAvatar___AkN3H",patientAvatarButton:"-esm-login__patient-banner-patient-info-module__patientAvatarButton___KDxA6",patientInfo:"-esm-login__patient-banner-patient-info-module__patientInfo___+WtDB",demographics:"-esm-login__patient-banner-patient-info-module__demographics___Vtf3v",row:"-esm-login__patient-banner-patient-info-module__row___NIOYI",flexRow:"-esm-login__patient-banner-patient-info-module__flexRow___VxdGB",tagsSlot:"-esm-login__patient-banner-patient-info-module__tagsSlot___lU6+4",identifiers:"-esm-login__patient-banner-patient-info-module__identifiers___tehd8",identifier:"-esm-login__patient-banner-patient-info-module__identifier___bSJIF",primaryIdentifier:"-esm-login__patient-banner-patient-info-module__primaryIdentifier___yOV1B",secondaryIdentifier:"-esm-login__patient-banner-patient-info-module__secondaryIdentifier___WvJbh",value:"-esm-login__patient-banner-patient-info-module__value___sBM-q",tag:"-esm-login__patient-banner-patient-info-module__tag___BEvEV",gender:"-esm-login__patient-banner-patient-info-module__gender___4XkLq",separator:"-esm-login__patient-banner-patient-info-module__separator___iYBA3",tooltipPadding:"-esm-login__patient-banner-patient-info-module__tooltipPadding___EWVCK",tooltipSmallText:"-esm-login__patient-banner-patient-info-module__tooltipSmallText___yDmRU",actionsButtonText:"-esm-login__patient-banner-patient-info-module__actionsButtonText___mn139"};function uL({showIdentifierLabel:e,type:t,value:n}){return(0,rG.jsx)("span",{className:uM.primaryIdentifier,children:(0,rG.jsxs)(aF.Tag,{className:uM.tag,type:"gray",children:[e&&t?.text&&(0,rG.jsxs)("span",{className:uM.label,children:[t.text,": "]}),(0,rG.jsx)("span",{className:uM.value,children:n})]})})}function uW({showIdentifierLabel:e,type:t,value:n}){return(0,rG.jsxs)(aF.FormLabel,{className:uM.secondaryIdentifier,id:`patient-banner-identifier-${n}`,children:[e&&(0,rG.jsxs)("span",{className:uM.label,children:[t?.text,": "]}),(0,rG.jsx)("span",{className:uM.value,children:n})]})}function uD({identifiers:e,showIdentifierLabel:t}){let{excludePatientIdentifierCodeTypes:n}=iT(),{primaryIdentifierCode:o}=au(),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:uM.identifier,children:n?.coding?.[0]?.code===o?(0,rG.jsx)(uL,{showIdentifierLabel:t,type:n,value:e}):(0,rG.jsx)(uW,{showIdentifierLabel:t,type:n,value:e})}),i<r.length-1&&(0,rG.jsx)("span",{className:uM.separator,children:"\xb7"})]},e)):""})}let uU={Female:sS,Male:sj,Other:sk,Unknown:sN},uB=({gender:e})=>{let t=uU[e];return t?(0,rG.jsx)(t,{fill:"#525252"}):null},uF={male:"Male",female:"Female",other:"Other",unknown:"Unknown"};function uH({patient:e,renderedFrom:t}){var n;let o,r,i=uP(e),a=e?.gender&&(r=uF[o=(n=e.gender).toLowerCase()]??"Unknown",{displayText:tm(o,n),iconKey:r}),s=(0,rF.useMemo)(()=>({patientUuid:e.id,patient:e,renderedFrom:t}),[e.id,e,t]);return(0,rG.jsxs)("div",{className:uM.patientInfo,children:[(0,rG.jsx)("div",{className:aL()(uM.row,uM.patientNameRow),children:(0,rG.jsxs)("div",{className:uM.flexRow,children:[(0,rG.jsx)("span",{className:uM.patientName,children:i}),a&&(0,rG.jsxs)("div",{className:uM.gender,children:[(0,rG.jsx)(uB,{gender:a.iconKey}),(0,rG.jsx)("span",{children:a.displayText})]}),(0,rG.jsx)(r4,{className:uM.tagsSlot,name:"patient-banner-tags-slot",state:s})]})}),(0,rG.jsxs)("div",{className:uM.demographics,children:[e.birthDate&&(0,rG.jsxs)(rG.Fragment,{children:[(0,rG.jsx)("span",{children:u$(e.birthDate)}),(0,rG.jsx)("span",{className:uM.separator,children:"\xb7"}),(0,rG.jsx)("span",{children:l9(e.birthDate,{time:!1})}),(0,rG.jsx)("span",{className:uM.separator,children:"\xb7"})]}),(0,rG.jsx)(uD,{identifiers:e.identifier,showIdentifierLabel:!0}),(0,rG.jsx)(r4,{className:uM.extensionSlot,name:"patient-banner-bottom-slot",state:s})]})]})}var uV=n(7683);function uG({patient:e,patientUuid:t,actionsSlotName:n,additionalActionsSlotState:o}){let[r,i]=(0,rF.useState)(!1),{extensions:a}=r8(n),s="tablet"===i4(),l=ao(()=>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===a.length?null:(0,rG.jsx)("div",{className:"-esm-login__patient-banner-actions-menu-module__overflowMenuContainer___lXHHD",children:(0,rG.jsxs)("div",{"data-overflow-menu":!0,className:aL()("cds--overflow-menu",aG),ref:l,children:[(0,rG.jsxs)("button",{className:aL()("cds--btn","cds--btn--ghost","cds--overflow-menu__trigger",{"cds--overflow-menu--open":r},aJ),"aria-controls":f,"aria-expanded":r,"aria-haspopup":"true",id:m,onClick:p,onKeyDown:h,ref:c,children:[(0,rG.jsx)("span",{className:"-esm-login__patient-banner-actions-menu-module__actionsButtonText___SdOyM",children:tm("actions","Actions")})," ",(0,rG.jsx)(uV.CH,{size:16,style:{marginLeft:"0.5rem",fill:"#78A9FF"}})]}),(0,rG.jsxs)("div",{className:aL()("cds--overflow-menu-options","cds--overflow-menu--flip",az,{[aq]: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:aL()("cds--overflow-menu-options__content",{"cds--overflow-menu-options--lg":s}),children:(0,rG.jsx)(r4,{name:n,state:w},n)}),(0,rG.jsx)("span",{})]})]})})}var uz=n(397),uq=n.n(uz);function uJ(e){let{patientPhotoConceptUuid:t}=iT({externalModuleName:"@openmrs/esm-styleguide"}),n=t?`${tk}/obs?patient=${e}&concept=${t}&v=full`:null,{data:o,error:r,isLoading:i}=ir()(e?n:null,tP),a=o?.data?.results[0];return{data:a?{dateTime:a?.obsDatetime,imageSrc:a?.value?.links?.uri}:null,error:r,isLoading:i}}let uK=({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"})]})},uX="-esm-login__patient-photo-module__avatar___t5TmZ";function uY({patientUuid:e,patientName:t,alt:n}){let{data:o,isLoading:r}=uJ(e),[i,a]=(0,rF.useState)(null),[s,l]=(0,rF.useState)(!1),c=(0,rF.useMemo)(()=>uq().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||(a(e),l(!1))},n.onerror=()=>{t||(a(null),l(!1))},n.src=e,()=>{t=!0}}a(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||s?(0,rG.jsx)(aF.SkeletonIcon,{className:"-esm-login__patient-photo-module__skeleton___ueN8Q","data-testid":"skeleton-icon"}):o?.imageSrc&&!i?(0,rG.jsx)(uK,{"aria-label":tm("patientPhotoPlaceholder","Photo placeholder for {{patientName}}",{patientName:t})}):i?(0,rG.jsx)("div",{"aria-label":u,children:(0,rG.jsx)("img",{className:uX,src:i,alt:u,title:t})}):(0,rG.jsx)("div",{"aria-label":u,children:(0,rG.jsx)("div",{className:uX,title:t,style:{backgroundImage:c.toDataUrl(),backgroundRepeat:"no-repeat",backgroundSize:"cover"},children:(0,rG.jsx)("span",{className:"-esm-login__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 uZ=["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"],uQ=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,rG.jsx)(dE,{ref:t,pictogram:"omrs-pict-appointments",pictogramProps:e})})),u0=uQ,u1=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,rG.jsx)(dE,{ref:t,pictogram:"omrs-pict-assessment-1",pictogramProps:e})})),u2=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,rG.jsx)(dE,{ref:t,pictogram:"omrs-pict-assessment-2",pictogramProps:e})})),u5=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,rG.jsx)(dE,{ref:t,pictogram:"omrs-pict-blood-bank",pictogramProps:e})})),u6=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,rG.jsx)(dE,{ref:t,pictogram:"omrs-pict-cardiology",pictogramProps:e})})),u8=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,rG.jsx)(dE,{ref:t,pictogram:"omrs-pict-cohorts",pictogramProps:e})})),u3=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,rG.jsx)(dE,{ref:t,pictogram:"omrs-pict-concept-dictionary",pictogramProps:e})})),u4=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,rG.jsx)(dE,{ref:t,pictogram:"omrs-pict-ct-scan",pictogramProps:e})})),u7=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,rG.jsx)(dE,{ref:t,pictogram:"omrs-pict-data-entry",pictogramProps:e})})),u9=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,rG.jsx)(dE,{ref:t,pictogram:"omrs-pict-dentistry",pictogramProps:e})})),de=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,rG.jsx)(dE,{ref:t,pictogram:"omrs-pict-digital-trust",pictogramProps:e})})),dt=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,rG.jsx)(dE,{ref:t,pictogram:"omrs-pict-emergency-department",pictogramProps:e})})),dn=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,rG.jsx)(dE,{ref:t,pictogram:"omrs-pict-facility",pictogramProps:e})})),dr=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,rG.jsx)(dE,{ref:t,pictogram:"omrs-pict-geriatrics",pictogramProps:e})})),di=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,rG.jsx)(dE,{ref:t,pictogram:"omrs-pict-gynaecology",pictogramProps:e})})),da=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,rG.jsx)(dE,{ref:t,pictogram:"omrs-pict-in-patient",pictogramProps:e})})),ds=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,rG.jsx)(dE,{ref:t,pictogram:"omrs-pict-laboratory",pictogramProps:e})})),dl=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,rG.jsx)(dE,{ref:t,pictogram:"omrs-pict-labs-2",pictogramProps:e})})),dc=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,rG.jsx)(dE,{ref:t,pictogram:"omrs-pict-metadata-export",pictogramProps:e})})),du=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,rG.jsx)(dE,{ref:t,pictogram:"omrs-pict-obstetrics",pictogramProps:e})})),dd=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,rG.jsx)(dE,{ref:t,pictogram:"omrs-pict-patient-documents",pictogramProps:e})})),dm=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,rG.jsx)(dE,{ref:t,pictogram:"omrs-pict-patient-search",pictogramProps:e})})),df=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,rG.jsx)(dE,{ref:t,pictogram:"omrs-pict-patients",pictogramProps:e})})),dp=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,rG.jsx)(dE,{ref:t,pictogram:"omrs-pict-payments-desk",pictogramProps:e})})),dg=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,rG.jsx)(dE,{ref:t,pictogram:"omrs-pict-pharmacy",pictogramProps:e})})),dh=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,rG.jsx)(dE,{ref:t,pictogram:"omrs-pict-pharmacy-2",pictogramProps:e})})),dw=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,rG.jsx)(dE,{ref:t,pictogram:"omrs-pict-registration",pictogramProps:e})})),d_=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,rG.jsx)(dE,{ref:t,pictogram:"omrs-pict-reports",pictogramProps:e})})),dy=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,rG.jsx)(dE,{ref:t,pictogram:"omrs-pict-service-queues",pictogramProps:e})})),dv=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,rG.jsx)(dE,{ref:t,pictogram:"omrs-pict-stock-management",pictogramProps:e})})),db=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,rG.jsx)(dE,{ref:t,pictogram:"omrs-pict-system-administration",pictogramProps:e})})),dx=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,rG.jsx)(dE,{ref:t,pictogram:"omrs-pict-transfer",pictogramProps:e})})),dS=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,rG.jsx)(dE,{ref:t,pictogram:"omrs-pict-triage",pictogramProps:e})})),dj=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,rG.jsx)(dE,{ref:t,pictogram:"omrs-pict-x-ray",pictogramProps:e})})),dk=dn,dN=df,dC=(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)(iS,{value:r.current,fallback:t,children:(0,rG.jsx)(dE,{ref:o,pictogram:e,pictogramProps:n})})})),dE=(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:aL()("-esm-login__pictograms-module__pictogram___wXX7t",o),height:r,width:r,children:(0,rG.jsx)("use",{href:`#${e}`})})})),dP=({children:e})=>"tablet"===i4()?(0,rG.jsx)(aF.Layer,{children:e}):(0,rG.jsx)(rG.Fragment,{children:e}),dI=({snackbar:e,closeSnackbar:t})=>{let{actionButtonLabel:n="",kind:o="success",onActionButtonClick:r=()=>{},isLowContrast:i="error"!==o,progressActionLabel:a,subtitle:s="",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),y=(0,rF.useCallback)(()=>{setTimeout(t,250)},[t]),v=(0,rF.useCallback)(()=>{_(!0),y()},[y]);return(0,rF.useEffect)(()=>{if(c){let e=setTimeout(v,l);return()=>clearTimeout(e)}},[l,c,v]),(0,rF.useEffect)(()=>{h(!1),window.setTimeout(()=>{h(!0)},0)},[]),(0,rG.jsx)(aF.ActionableNotification,{actionButtonLabel:f,"aria-label":tm("closeSnackbar","Close snackbar"),className:aL()("-esm-login__snackbar-module__slideIn___-oZIt",{"-esm-login__snackbar-module__animated___M2YBU":g,"-esm-login__snackbar-module__slideOut___yEmGT":w}),kind:o,lowContrast:i,onActionButtonClick:()=>{r(),v(),a&&p(a)},onClose:y,statusIconDescription:tm("snackbarNotification","Snackbar notification"),subtitle:s,title:u,...m})},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.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)(dI,{snackbar:e,closeSnackbar:()=>o(e)},e.id))})},dA=new um,dR=0;function dT(e){e&&(0,r7.createRoot)(e).render((0,rG.jsx)(dO,{subject:dA}))}function d$(e){var t;e&&"string"==typeof(t=e.title)&&t.trim().length>0?setTimeout(()=>{dA.next({...e,id:dR++})},0):console.error("showSnackbar must be called with an object having a 'title' property that is a non-empty string")}let dM=({toast:e,closeToast:t})=>{let{description:n,kind:o,critical:r,title:i,actionButtonLabel:a,onActionButtonClick:s=()=>{}}=e,l=(0,rF.useCallback)(()=>{s(),t()},[t,s]);return(0,rG.jsx)("div",{children:(0,rG.jsx)(aF.ActionableNotification,{actionButtonLabel:a,kind:o||"info",lowContrast:r,subtitle:n,title:i||"",onActionButtonClick:l,onClose:t})})},dL=({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)(dM,{toast:e,closeToast:()=>o(e)},e.id))})},dW=new um,dD=0;function dU(e){e&&(0,r7.createRoot)(e).render((0,rG.jsx)(dL,{subject:dW}))}function dB(e){var t;e&&("string"==typeof(t=e.description)?t.trim().length>0:"object"==typeof t&&!(0,us.A)(t))?setTimeout(()=>{dW.next({...e,id:dD++})},0):console.error("showToast must be called with an object having a 'description' property that is a non-empty string or object")}var dF=n(4656);async function dH(e,t){let{openedGroup:n}=rC.getState();if(n){if(n.groupName===e&&dz(n.props,t))return!0;else if(!await dK({reason:"CLOSE_WORKSPACE_GROUP",explicit:!1}))return!1}return rC.setState(n=>({...n,openedGroup:{groupName:e,props:t},openedWindows:[]})),!0}async function dV(e){let{openedGroup:t,openedWindows:n}=rC.getState();if(t){if(n.length>0&&!(e||await dK({reason:"CLOSE_WORKSPACE_GROUP",explicit:!0})))return!1;rC.setState(e=>({...e,openedGroup:null,openedWindows:[]}))}return!0}async function dG(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:a}=r,{name:s}=i,l=rP(s);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(a&&(a.groupName!==l.name||!dz(a.props,o)))return!!await dK({reason:"CLOSE_WORKSPACE_GROUP",explicit:!0})&&(rC.setState({...r,openedGroup:{groupName:l.name,props:o},openedWindows:[{windowName:s,openedWorkspaces:[d3(e,t)],props:n,maximized:!1}],isMostRecentlyOpenedWindowHidden:!1}),!0);if(c>=0){let o=r.openedWindows[c],i=r.openedGroup?.props??{},a=r.isMostRecentlyOpenedWindowHidden,{openedWorkspaces:u}=o;if(dz(o.props,n)){let d=u.find(t=>t.workspaceName===e);return d&&dz(d.props,t)?((a||c!==r.openedWindows.length-1)&&rC.setState(d1.restoreWindow(r,s)),!0):!!await dK({reason:"CLOSE_WORKSPACE",explicit:!1,windowName:s,workspaceName:e})&&(rC.setState({...r,openedGroup:{groupName:l.name,props:r?.openedGroup?.props??i},openedWindows:[...r.openedWindows.filter((e,t)=>t!==c),{windowName:s,openedWorkspaces:[d3(e,t)],props:o?.props??n,maximized:!1}],isMostRecentlyOpenedWindowHidden:!1}),!0)}return!!await dK({reason:"CLOSE_WINDOW",explicit:!1,windowName:s})&&(rC.setState({...r,openedGroup:{groupName:l.name,props:i??r?.openedGroup?.props},openedWindows:[...r.openedWindows.filter((e,t)=>t!==c),{windowName:s,openedWorkspaces:[d3(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:s,openedWorkspaces:[d3(e,t)],props:n,maximized:!1}],isMostRecentlyOpenedWindowHidden:!1}),!0):!!await dK({reason:"CLOSE_OTHER_WINDOWS",explicit:!1,windowNameToSpare:i.name})&&(rC.setState({...r,openedGroup:{groupName:l.name,props:o??r?.openedGroup?.props??null},openedWindows:[{windowName:s,openedWorkspaces:[d3(e,t)],props:n,maximized:!1}],isMostRecentlyOpenedWindowHidden:!1}),!0)}function dz(e,t){return null==e||null==t||x(e,t)}function dq(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 dJ(e){return 0===e.length?Promise.resolve(!0):new Promise(t=>{let n=ua("workspace2-close-prompt",{size:"sm",onConfirm:()=>{n(),t(!0)},onCancel:()=>{n(),t(!1)},affectedWorkspaceTitles:e.map(e=>e.title??"")})})}function dK(e){let{openedWindows:t}=rC.getState(),n=[];switch(e.reason){case"CLOSE_WORKSPACE_GROUP":n=t.flatMap(e=>dq(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=dq(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=dq(o,e.workspaceName);break}case"CLOSE_OTHER_WINDOWS":n=t.filter(t=>t.windowName!==e.windowNameToSpare).flatMap(e=>dq(e))}return dJ(n)}function dX(e,t){return dJ(dq(e,t))}function dY(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 dZ(e,t,n,o){let{registeredWorkspacesByName:r}=rC.getState(),i=r[n];if(!i)throw Error(`No workspace named "${n}" registered`);let a=r[t];if(!a)throw Error(`No workspace named "${t}" registered`);if(a.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:s}=e,l=s.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=s.slice(0,l+1);return{...e,openedWorkspaces:[...c,d3(n,o)]}}function dQ(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 d0(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=dQ(r,t,n);if(i===r)return e;let a=[...e.openedWindows];return a[o]=i,{...e,openedWindows:a}}let d1={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=dY(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 a=[...e.openedWindows];return a[i]=dZ(e.openedWindows[i],t,n,o),{...e,openedWindows:a}},setHasUnsavedChanges:(e,t,n)=>d0(e,t,{hasUnsavedChanges:n}),setWorkspaceTitle:(e,t,n)=>d0(e,t,{title:n})};function d2(){return rZ(rC,d1)}let d5=()=>(0,rF.useContext)(ie.i),d6=()=>Object.keys(rC.getState().registeredWorkspacesByName);function d8(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 d3(e,t){return{workspaceName:e,props:t??{},hasUnsavedChanges:!1,uuid:(0,dF.A)()}}function d4(e,t,n){let o=rC.getState().registeredWorkspacesByName[e];return o?{windowName:o.window,openedWorkspaces:[d3(e,t)],props:n??null,maximized:!1}:null}let d7=({title:e,children:t,hasUnsavedChanges:n=!1})=>{let{setHasUnsavedChanges:o,setWorkspaceTitle:r}=d5();return(0,rF.useEffect)(()=>{o(n??!1)},[n,o]),(0,rF.useEffect)(()=>{r(e)},[e,r]),(0,rG.jsx)(rG.Fragment,{children:t})};var d9=n(1820),me=n(3173),mt=n(185);let mn={workspaceOuterContainer:"-esm-login__workspace2-module__workspaceOuterContainer___bPVpy",narrowWorkspace:"-esm-login__workspace2-module__narrowWorkspace___kSYS7",widerWorkspace:"-esm-login__workspace2-module__widerWorkspace___nW2HB",extraWideWorkspace:"-esm-login__workspace2-module__extraWideWorkspace___em5yA",workspaceMiddleContainer:"-esm-login__workspace2-module__workspaceMiddleContainer___Bx1i6",maximized:"-esm-login__workspace2-module__maximized___Kfygr",hidden:"-esm-login__workspace2-module__hidden___RPimX",workspaceInnerContainer:"-esm-login__workspace2-module__workspaceInnerContainer___5zxpt",workspaceSpacer:"-esm-login__workspace2-module__workspaceSpacer___E+982",loader:"-esm-login__workspace2-module__loader___vmBQn",hiddenExtraWorkspace:"-esm-login__workspace2-module__hiddenExtraWorkspace___qkbMG",header:"-esm-login__workspace2-module__header___IZ-2+",headerButtons:"-esm-login__workspace2-module__headerButtons___81a2N",workspaceContent:"-esm-login__workspace2-module__workspaceContent___eetPy",overlayHeaderSpacer:"-esm-login__workspace2-module__overlayHeaderSpacer___ruc6r",isActionMenuOpened:"-esm-login__workspace2-module__isActionMenuOpened___XgCkc",showActionMenu:"-esm-login__workspace2-module__showActionMenu___sHRt1",marginWorkspaceContent:"-esm-login__workspace2-module__marginWorkspaceContent___TN+S+",workspaceContainerWithActionMenu:"-esm-login__workspace2-module__workspaceContainerWithActionMenu___xLg8e",workspaceFixedContainer:"-esm-login__workspace2-module__workspaceFixedContainer___W9cgZ",workspaceContainerWithoutActionMenu:"-esm-login__workspace2-module__workspaceContainerWithoutActionMenu___fRrxd"},mo=e=>e.registeredWorkspacesByName,mr=({lifeCycle:e,openedWorkspace:t,openedWindow:n,groupProps:o,actions:r,renderChrome:i,isRootWorkspace:a,isLeafWorkspace:s,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:a}=n,s=a.findIndex(e=>e.workspaceName===i);-1===s||s!==a.length-1&&a.slice(s+1).some(e=>e.hasUnsavedChanges)&&!await r.promptForClosingWorkspaces(a[s+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:a,isLeafWorkspace:s,windowName:n.windowName,showActionMenu:l},[t,n,o,r,a,s,l]),u=!i&&!s,d=(0,rF.useMemo)(()=>e?(0,rG.jsx)(d9.A,{config:e,mountParcel:rU,wrapWith:"div",wrapClassName:aL()(mn.workspaceContent,{[mn.hiddenExtraWorkspace]:u}),...c},t.workspaceName):null===e?(0,rG.jsx)("div",{className:aL()(mn.workspaceContent,{[mn.hiddenExtraWorkspace]:u}),children:(0,rG.jsx)(aF.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)(mi,{openedWorkspace:t,openedWindow:n,isRootWorkspace:a,showActionMenu:l,closeWindow:()=>c.closeWorkspace({closeWindow:!0}),children:d})}):d??(0,rG.jsx)(aF.InlineLoading,{className:aL()(mn.loader,{[mn.hiddenExtraWorkspace]:u}),description:`${tm("loading")}`})},mi=({openedWorkspace:e,openedWindow:t,isRootWorkspace:n,showActionMenu:o,closeWindow:r,children:i})=>{let a=i4(),{openedGroup:s,openedWindows:l,registeredWindowsByName:c,registeredWorkspacesByName:u,registeredGroupsByName:d,isMostRecentlyOpenedWindowHidden:m,setWindowMaximized:f,hideWindow:p}=d2(),g=t.windowName,{maximized:h}=t,w=e.title??"",_=c[g],y=d8(t,u,c),v=_?.icon,b=_?.canMaximize,x=!!s&&d[s.groupName]?.persistence==="closable",S=!!v&&!x,j=l.findIndex(e=>e.windowName===g)<l.length-1||m,k=Object.values(c).some(e=>e.group===s?.groupName&&void 0!==e.icon);return(0,rG.jsxs)("div",{className:aL()(mn.workspaceOuterContainer,{[mn.narrowWorkspace]:"narrow"===y,[mn.widerWorkspace]:"wider"===y,[mn.extraWideWorkspace]:"extra-wide"===y,[mn.isActionMenuOpened]:k}),children:[(0,rG.jsx)("div",{className:aL()(mn.workspaceSpacer,{[mn.hidden]:j})}),(0,rG.jsx)("div",{className:aL()(mn.workspaceMiddleContainer,{[mn.maximized]:h,[mn.hidden]:j,[mn.isRootWorkspace]:n,[mn.showActionMenu]:o}),children:(0,rG.jsx)("div",{className:aL()(mn.workspaceInnerContainer,{[mn.maximized]:h,[mn.hidden]:j,[mn.isRootWorkspace]:n}),children:i?(0,rG.jsxs)(rG.Fragment,{children:[(0,rG.jsxs)(aF.Header,{"aria-label":tm("workspaceHeader"),className:mn.header,children:[(0,rG.jsx)(aF.HeaderName,{prefix:"",children:w}),(0,rG.jsx)("div",{className:mn.overlayHeaderSpacer}),(0,rG.jsx)(aF.HeaderGlobalBar,{className:mn.headerButtons,children:i7(a)?(0,rG.jsxs)(rG.Fragment,{children:[(b||h)&&(0,rG.jsx)(aF.HeaderGlobalAction,{"aria-label":h?tm("minimize"):tm("maximize"),onClick:()=>f(g,!h),children:h?(0,rG.jsx)(me.Xj,{}):(0,rG.jsx)(me.hz,{})}),S&&(0,rG.jsx)(aF.HeaderGlobalAction,{"aria-label":tm("hide"),onClick:()=>p(),children:(0,rG.jsx)(a8,{})}),!x&&(0,rG.jsx)(aF.HeaderGlobalAction,{"aria-label":tm("close"),onClick:r,children:(0,rG.jsx)(sf,{})})]}):(0,rG.jsxs)(rG.Fragment,{children:[S&&(0,rG.jsx)(aF.HeaderGlobalAction,{"aria-label":tm("hide"),onClick:()=>p(),children:(0,rG.jsx)(mt.d3,{})}),(0,rG.jsx)(aF.HeaderGlobalAction,{"aria-label":tm("close"),onClick:()=>{x?dV():r()},children:(0,rG.jsx)(sf,{})})]})})]}),i]}):(0,rG.jsx)(aF.InlineLoading,{className:mn.loader,description:`${tm("loading")} ...`})})})]})},ma=({openedWindow:e,groupProps:t,actions:n,renderChrome:o,showActionMenu:r})=>{let{openedWorkspaces:i}=e,[a,s]=(0,rF.useState)({}),l=rY(rC,mo),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 ak(o,r)]}catch(n){return e||c.current.has(t.uuid)||(c.current.add(t.uuid),y(n)),[t.uuid,null]}})).then(t=>{e||s(Object.fromEntries(t.filter(e=>null!=e)))},y),()=>{e=!0}},[i,l]),(0,rG.jsx)(rG.Fragment,{children:i.map((s,l)=>(0,rG.jsx)(mr,{openedWorkspace:s,openedWindow:e,groupProps:t,actions:n,renderChrome:o,lifeCycle:a[s.uuid],isRootWorkspace:0===l,isLeafWorkspace:l===i.length-1,showActionMenu:r},s.uuid))})},ms=e=>e.registeredWorkspacesByName,ml=({name:e,workspaceProps:t,windowProps:n,groupProps:o,onWindowChanged:r})=>{let i=rY(rC,ms),a=rY(rC,t=>{let n=t.registeredWorkspacesByName[e]?.window;return n?t.registeredWindowsByName[n]:void 0}),s={name:e,workspaceProps:t,windowProps:n,groupProps:o},l=(0,rF.useRef)(),c=(0,rF.useRef)(null);if(!l.current){let r=d4(e,t,n);l.current=T({openedWindow:r,groupProps:o??null}),r&&(c.current=s)}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=d4(e,t,n);u.setState({openedWindow:i,groupProps:o??null},!0),c.current=i?s: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=>dY(t,e))},openChildWorkspace(e,n,o){t(t=>dZ(t,e,n,o))},setWorkspaceTitle(e,n){t(t=>dQ(t,e,{title:n}))},setHasUnsavedChanges(e,n){t(t=>dQ(t,e,{hasUnsavedChanges:n}))},promptForClosingWorkspaces(t){let{openedWindow:n}=e.getState();return n?dX(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,_=a?.width??"narrow",y=(0,rF.useRef)(r);return(0,rF.useEffect)(()=>{y.current=r}),(0,rF.useEffect)(()=>{y.current?.({workspaceName:g,windowWidth:_,title:h,hasUnsavedChanges:w})},[g,_,h,w]),(0,rG.jsx)("div",{className:"-esm-login__exported-workspace-module__exportedWorkspace___7PE0H",children:m?(0,rG.jsx)(ma,{openedWindow:m,groupProps:f,actions:d,renderChrome:!1,showActionMenu:!1}):null})},mc="-esm-login__action-menu-button2-module__container___jc6--",mu="-esm-login__action-menu-button2-module__elementContainer___whLL8",md="-esm-login__action-menu-button2-module__active___fbyFm",mm="-esm-login__action-menu-button2-module__focused___+aVpz";function mf({getIcon:e,hasUnsavedChanges:t,tagContent:n}){return(0,rG.jsxs)(rG.Fragment,{children:[e({size:16}),t?(0,rG.jsx)("span",{className:"-esm-login__action-menu-button2-module__interruptedTag___sRkvS",children:"!"}):(0,rG.jsx)("span",{className:"-esm-login__action-menu-button2-module__countTag___XMH0D",children:n})]})}let mp=({icon:e,label:t,tagContent:n,workspaceToLaunch:o,onBeforeWorkspaceLaunch:r,hidden:i,disabled:a})=>{let s=i4(),{openedWindows:l,restoreWindow:c,hideWindow:u,isMostRecentlyOpenedWindowHidden:d}=d2(),{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,y=async()=>{if(g)h?c(p.windowName):u();else if(await (r?.()??!0)){let{workspaceName:e,workspaceProps:t,windowProps:n}=o;dG(e,t,n)}};return i?.(l)?null:"tablet"===s||"phone"===s?(0,rG.jsxs)(aF.Button,{className:aL()(mc,{[md]:g&&!w,[mm]:w}),iconDescription:t,kind:"ghost",onClick:y,role:"button",tabIndex:0,size:"md",disabled:a?.(l),children:[(0,rG.jsx)("span",{className:mu,children:(0,rG.jsx)(mf,{hasUnsavedChanges:_,getIcon:e,tagContent:n})}),(0,rG.jsx)("span",{children:t})]}):(0,rG.jsx)(aF.IconButton,{align:"left","aria-label":t,className:aL()(mc,{[md]:g&&!w,[mm]:w}),enterDelayMs:300,kind:"ghost",label:t,onClick:y,size:"md",disabled:a?.(l),children:(0,rG.jsx)("div",{className:mu,children:(0,rG.jsx)(mf,{hasUnsavedChanges:_,getIcon:e,tagContent:n})})})};function mg({showContactDetails:e,toggleContactDetails:t,className:n}){return(0,rG.jsx)(aF.Button,{className:n,iconDescription:"Toggle contact details",kind:"ghost",onClick:t,renderIcon:e?sm:sc,children:e?tm("showLess","Show less"):tm("showMore","Show more")})}let mh={contactDetails:"-esm-login__patient-banner-contact-details-module__contactDetails___R7vfY",deceased:"-esm-login__patient-banner-contact-details-module__deceased___nTt+l",heading:"-esm-login__patient-banner-contact-details-module__heading___x7UoT",row:"-esm-login__patient-banner-contact-details-module__row___qFgIi",col:"-esm-login__patient-banner-contact-details-module__col___JXUlg",relationship:"-esm-login__patient-banner-contact-details-module__relationship___T3LO-"},mw=({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}=ir()(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:mh.heading,children:[tm("patientLists","Patient Lists")," (",t?.length??0,")"]}),n?(0,rG.jsx)(aF.InlineLoading,{description:`${tm("loading","Loading")} ...`,role:"progressbar"}):(0,rG.jsxs)("ul",{children:[(()=>{if(t?.length>0){let e=t.sort((e,t)=>l5(e?.startDate).getTime()-l5(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:mh.link,children:(0,rG.jsx)(rz,{to:`${window.spaBase}/home/patient-lists`,children:tm("seeMoreLists","See {{count}} more lists",{count:t?.length-3})})})]})]})},m_=({patientId:e})=>{let{patient:t,isLoading:n}=ac(e),o=t?.address?.find(e=>"home"===e.use),r=e=>e.split("#")[1];return n?(0,rG.jsx)(aF.InlineLoading,{description:`${tm("loading","Loading")} ...`,role:"progressbar"}):(0,rG.jsxs)(rG.Fragment,{children:[(0,rG.jsx)("p",{className:mh.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:"--"})})]})},my=({patientUuid:e})=>{let{isLoading:t,contactAttributes:n}=(e=>{let{contactAttributeTypes:t=[]}=iT({externalModuleName:"@openmrs/esm-patient-banner-app"}),{attributes:n,error:o,isLoading:r}=(e=>{let{data:t,error:n,isLoading:o}=iW()(`${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:mh.heading,children:tm("contactDetails","Contact Details")}),t?(0,rG.jsx)(aF.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:"--"})})]})},mv=({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}=ir()(e?t:null,tP),a=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?a:null,error:o,isLoading:r,isValidating:i}}(e);return(0,rG.jsxs)(rG.Fragment,{children:[(0,rG.jsx)("p",{className:mh.heading,children:tm("relationships","Relationships")}),n?(0,rG.jsx)(aF.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:mh.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 mb({patientId:e,deceased:t}){return(0,rG.jsxs)("div",{className:aL()(mh.contactDetails,{[mh.deceased]:t}),children:[(0,rG.jsxs)("div",{className:mh.row,children:[(0,rG.jsx)("div",{className:mh.col,children:(0,rG.jsx)(m_,{patientId:e})}),(0,rG.jsx)("div",{className:mh.col,children:(0,rG.jsx)(my,{patientUuid:e})})]}),(0,rG.jsxs)("div",{className:mh.row,children:[(0,rG.jsx)("div",{className:mh.col,children:(0,rG.jsx)(mv,{patientId:e})}),(0,rG.jsx)("div",{className:mh.col,children:(0,rG.jsx)(mw,{patientUuid:e})})]})]})}function mx(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 mS="-esm-login__action-menu2-module__container___6Gke0";function mj({workspaceGroup:e,groupProps:t}){let n=i4(),{persistence:o}=e;return(0,rG.jsx)("aside",{className:"-esm-login__action-menu2-module__sideRail___T2lMV",children:(0,rG.jsxs)("div",{className:mS,children:["closable"==o&&i7(n)&&(0,rG.jsx)(aF.IconButton,{align:"left",onClick:()=>dV(),label:tm("close"),kind:"ghost",children:(0,rG.jsx)(sf,{})}),(0,rG.jsx)(rV.Provider,{value:{moduleName:e.moduleName,featureName:e.name},children:(0,rG.jsx)(r4,{className:mS,name:e.name,state:{groupProps:t}})})]})})}function mk(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 mN(e){e&&(0,r7.createRoot)(e).render((0,rG.jsx)(mC,{}))}function mC(){let{openedGroup:e,openedWindows:t,registeredGroupsByName:n,registeredWindowsByName:o}=d2();if((0,rF.useEffect)(()=>nG("before-page-changed",t=>{let{newPage:o,cancelNavigation:r,oldUrl:i,newUrl:a}=t;if(!e)return;if(o)return void r(dV().then(e=>!e));let s=n[e.groupName],l=s?.scopePattern;l&&function(e,t,n){try{let o=new RegExp(e),r=mk(t),i=mk(n);if(null===r.spaRelative||null===i.spaRelative)return!0;let a=o.exec(r.spaRelative),s=o.exec(i.spaRelative);if(a&&s||(a=o.exec(r.full),s=o.exec(i.full)),!a||!s)return!0;if(a.length>1)return!a.slice(1).every((e,t)=>e===s[t+1]);return!1}catch{return!0}}(l,i,a)&&r(dV().then(e=>!e))}),[e,n]),!e)return null;let r=n[e.groupName],i=t.some(e=>e.maximized),{name:a}=r,s=Object.values(o).filter(e=>e.group===a&&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:aL()("-esm-login__workspace-windows-and-menu-module__workspaceWindowsAndMenuContainer___2u2mc",{"-esm-login__workspace-windows-and-menu-module__overlay___7RHYZ":r.overlay,"-esm-login__workspace-windows-and-menu-module__hasMaximizedWindow___gvJRd":i}),children:[(0,rG.jsx)("div",{className:"-esm-login__workspace-windows-and-menu-module__workspaceWindowsContainer___40ITO",children:t.map(t=>(0,rG.jsx)(mE,{openedWindow:t,groupProps:e.props,showActionMenu:s},t.windowName))}),s&&(0,rG.jsx)(mj,{workspaceGroup:r,groupProps:e.props})]})}function mE({openedWindow:e,groupProps:t,showActionMenu:n}){let{windowName:o}=e,r=(0,rF.useMemo)(()=>({closeWorkspace(e){rC.setState(t=>d1.closeWorkspace(t,e))},openChildWorkspace(e,t,n){rC.setState(o=>d1.openChildWorkspace(o,e,t,n))},setWorkspaceTitle(e,t){rC.setState(n=>d1.setWorkspaceTitle(n,e,t))},setHasUnsavedChanges(e,t){rC.setState(n=>d1.setHasUnsavedChanges(n,e,t))},promptForClosingWorkspaces(e){let t=rC.getState().openedWindows.find(e=>e.windowName===o);return t?dX(t,e):Promise.resolve(!0)}}),[o]);return(0,rG.jsx)(ma,{openedWindow:e,groupProps:t,actions:r,renderChrome:!0,showActionMenu:n})}function mP(e,t,n){if(null==e)return n;let o=lF(e);if(!o)return console.warn(`matchLocale: invalid requested locale tag: ${JSON.stringify(e)}`),n;let r=[];for(let e of t){let t=lF(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 a=(i=i.slice(0,o)).lastIndexOf("-");-1!==a&&i.length-a==2&&(i=i.slice(0,a))}return n}function mI(e=window.localStorage){try{return e.getItem("test"),!0}catch{return!1}}function mO(e){return!!e&&e.constructor===Object}var mA=n(3376);function mR(e){let[t,n,o]=e.split(".");return`${t}.${n}.${o}`}function mT(e,t){return mA(function(e){let t=e.indexOf("-");if(t>=0){let n=mR(e.slice(0,t)),o=e.slice(t+1);return`${n}-${o}`}return mR(e)}(t),e,{includePrerelease:!0})}async function m$(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 a=0;do try{return await mM(r(a)),await e()}catch(e){i?.(e,a),n=e}while(o(a++));throw n}async function mM(e){if(!(e<=0))return new Promise(t=>setTimeout(t,e))}function mL(e,t,n,o){}function mW(e){}function mD(e){return Promise.resolve([])}function mU(e){return Promise.resolve([])}function mB(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 mF(e){return()=>{}}function mH(){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,ts.fz)(window.getOpenmrsSpaBase()+t):t instanceof RegExp?e=>t.test(e.pathname.replace(window.getOpenmrsSpaBase(),"")):()=>t}(n),t);(0,ts.AG)(e,()=>ak(t.appName,t.component),o)}(o,t)}}let aA={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 aR(){document.body.classList.toggle("omrs-breakpoint-lt-tablet",window.innerWidth<aA.TABLET_MIN),document.body.classList.toggle("omrs-breakpoint-gt-phone",window.innerWidth>aA.PHONE_MAX),document.body.classList.toggle("omrs-breakpoint-gt-tablet",window.innerWidth>aA.TABLET_MAX),document.body.classList.toggle("omrs-breakpoint-lt-desktop",window.innerWidth<aA.SMALL_DESKTOP_MIN),document.body.classList.toggle("omrs-breakpoint-lt-small-desktop",window.innerWidth<aA.SMALL_DESKTOP_MIN),document.body.classList.toggle("omrs-breakpoint-lt-large-desktop",window.innerWidth<aA.LARGE_DESKTOP_MIN),document.body.classList.toggle("omrs-breakpoint-gt-small-desktop",window.innerWidth>aA.SMALL_DESKTOP_MAX)}let aT=!1;function a$(){aT||(window.addEventListener("resize",aR),aR(),aT=!0)}var aM=n(5530),aL=n.n(aM);function aW({title:e,children:t}){let n="tablet"===i4();return(0,rG.jsxs)("div",{className:aL()({"-esm-login__card-header-module__tabletHeader___Vkmd-":n,"-esm-login__card-header-module__desktopHeader___ocWGq":!n}),children:[(0,rG.jsx)("h4",{children:e}),t]})}let aD=["red","magenta","purple","blue","teal","cyan","gray","green","warm-gray","cool-gray","high-contrast","outline"],aU={primaryColor:{_type:G.String,_description:"The color for displaying primary diagnoses tags",_default:"blue",_validators:[e7.oneOf(aD)]},secondaryColor:{_type:G.String,_description:"The color for displaying secondary diagnoses tags",_default:"gray",_validators:[e7.oneOf(aD)]}},aB={"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:aU};var aF=n(8326);let aH={"carbon.table.batch.cancel":"cancel","carbon.table.batch.items.selected":"batchActionsItemsSelected","carbon.table.batch.item.selected":"batchActionItemSelected","carbon.table.batch.selectAll":"selectAll"},aV=e=>(0,rG.jsx)(aF.TableBatchActions,{translateWithId:(e,t)=>{let n=aH[e];return n?tm(n,e,t):e},...e}),aG="-esm-login__custom-overflow-menu-module__container___8PykS",az="-esm-login__custom-overflow-menu-module__menu___qsOLn",aq="-esm-login__custom-overflow-menu-module__show___BserJ",aJ="-esm-login__custom-overflow-menu-module__overflowMenuButton___n86Gz",aK=(0,rF.createContext)(null);function aX(){let e=(0,rF.useContext)(aK);if(!e)throw Error("useCustomOverflowMenu must be used within a CustomOverflowMenu");return e}function aY({menuTitle:e,children:t}){let[n,o]=rH().useState(!1),r=ao(()=>o(!1),n),i="tablet"===i4(),a=(0,rF.useCallback)(()=>o(e=>!e),[]),s=(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),s.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,a=i<0?n.length-1:i>=n.length?0:i;n[a]?.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:aL()("cds--overflow-menu",aG),ref:r,children:[(0,rG.jsx)("button",{className:aL()("cds--btn","cds--btn--ghost","cds--overflow-menu__trigger",{"cds--overflow-menu--open":n},aJ),"aria-controls":d,"aria-expanded":n,"aria-haspopup":"true",id:u,onClick:a,onKeyDown:p,ref:s,children:e}),(0,rG.jsxs)("div",{className:aL()("cds--overflow-menu-options","cds--overflow-menu--flip",az,{[aq]: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:aL()("cds--overflow-menu-options__content",{"cds--overflow-menu-options--lg":i}),children:(0,rG.jsx)(aK.Provider,{value:f,children:w})}),(0,rG.jsx)("span",{})]})]})}function aZ(e){let t=(0,rF.useContext)(aK);return(0,rG.jsx)(aF.OverflowMenuItem,{...e,closeMenu:t?.closeMenu})}var aQ=n(7665);let a0=["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"],a1=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,rG.jsx)(lk,{ref:t,icon:"omrs-icon-activity",iconProps:e})})),a2=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,rG.jsx)(lk,{ref:t,icon:"omrs-icon-add",iconProps:e})})),a5=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,rG.jsx)(lk,{ref:t,icon:"omrs-icon-arrow-down",iconProps:e})})),a6=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,rG.jsx)(lk,{ref:t,icon:"omrs-icon-arrow-left",iconProps:e})})),a8=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,rG.jsx)(lk,{ref:t,icon:"omrs-icon-arrow-right",iconProps:e})})),a3=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,rG.jsx)(lk,{ref:t,icon:"omrs-icon-arrow-up",iconProps:e})})),a4=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,rG.jsx)(lk,{ref:t,icon:"omrs-icon-baby",iconProps:e})})),a7=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,rG.jsx)(lk,{ref:t,icon:"omrs-icon-calendar-heat-map",iconProps:e})})),a9=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,rG.jsx)(lk,{ref:t,icon:"omrs-icon-calendar",iconProps:e})})),se=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,rG.jsx)(lk,{ref:t,icon:"omrs-icon-caret-down",iconProps:e})})),st=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,rG.jsx)(lk,{ref:t,icon:"omrs-icon-caret-left",iconProps:e})})),sn=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,rG.jsx)(lk,{ref:t,icon:"omrs-icon-caret-right",iconProps:e})})),so=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,rG.jsx)(lk,{ref:t,icon:"omrs-icon-caret-up",iconProps:e})})),sr=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,rG.jsx)(lk,{ref:t,icon:"omrs-icon-chart-average",iconProps:e})})),si=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,rG.jsx)(lk,{ref:t,icon:"omrs-icon-chart-line",iconProps:e})})),sa=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,rG.jsx)(lk,{ref:t,icon:"omrs-icon-checkmark-filled",iconProps:e})})),ss=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,rG.jsx)(lk,{ref:t,icon:"omrs-icon-checkmark-outline",iconProps:e})})),sl=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,rG.jsx)(lk,{ref:t,icon:"omrs-icon-chemistry",iconProps:e})})),sc=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,rG.jsx)(lk,{ref:t,icon:"omrs-icon-chevron-down",iconProps:e})})),su=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,rG.jsx)(lk,{ref:t,icon:"omrs-icon-chevron-left",iconProps:e})})),sd=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,rG.jsx)(lk,{ref:t,icon:"omrs-icon-chevron-right",iconProps:e})})),sm=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,rG.jsx)(lk,{ref:t,icon:"omrs-icon-chevron-up",iconProps:e})})),sf=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,rG.jsx)(lk,{ref:t,icon:"omrs-icon-close",iconProps:e})})),sp=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,rG.jsx)(lk,{ref:t,icon:"omrs-icon-close-filled",iconProps:e})})),sg=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,rG.jsx)(lk,{ref:t,icon:"omrs-icon-close-outline",iconProps:e})})),sh=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,rG.jsx)(lk,{ref:t,icon:"omrs-icon-document",iconProps:e})})),sw=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,rG.jsx)(lk,{ref:t,icon:"omrs-icon-document-attachment",iconProps:e})})),s_=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,rG.jsx)(lk,{ref:t,icon:"omrs-icon-download",iconProps:e})})),sy=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,rG.jsx)(lk,{ref:t,icon:"omrs-icon-drug-order",iconProps:e})})),sv=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,rG.jsx)(lk,{ref:t,icon:"omrs-icon-edit",iconProps:e})})),sb=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,rG.jsx)(lk,{ref:t,icon:"omrs-icon-event-schedule",iconProps:e})})),sx=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,rG.jsx)(lk,{ref:t,icon:"omrs-icon-events",iconProps:e})})),sS=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,rG.jsx)(lk,{ref:t,icon:"omrs-icon-gender-female",iconProps:e})})),sj=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,rG.jsx)(lk,{ref:t,icon:"omrs-icon-gender-male",iconProps:e})})),sk=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,rG.jsx)(lk,{ref:t,icon:"omrs-icon-gender-other",iconProps:e})})),sN=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,rG.jsx)(lk,{ref:t,icon:"omrs-icon-gender-unknown",iconProps:e})})),sC=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,rG.jsx)(lk,{ref:t,icon:"omrs-icon-generic-order-type",iconProps:e})})),sE=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,rG.jsx)(lk,{ref:t,icon:"omrs-icon-group",iconProps:e})})),sP=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,rG.jsx)(lk,{ref:t,icon:"omrs-icon-group-access",iconProps:e})})),sI=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,rG.jsx)(lk,{ref:t,icon:"omrs-icon-hospital-bed",iconProps:e})})),sO=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,rG.jsx)(lk,{ref:t,icon:"omrs-icon-image-medical",iconProps:e})})),sA=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,rG.jsx)(lk,{ref:t,icon:"omrs-icon-information",iconProps:e})})),sR=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,rG.jsx)(lk,{ref:t,icon:"omrs-icon-information-filled",iconProps:e})})),sT=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,rG.jsx)(lk,{ref:t,icon:"omrs-icon-information-square",iconProps:e})})),s$=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,rG.jsx)(lk,{ref:t,icon:"omrs-icon-inventory-management",iconProps:e})})),sM=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,rG.jsx)(lk,{ref:t,icon:"omrs-icon-lab-order",iconProps:e})})),sL=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,rG.jsx)(lk,{ref:t,icon:"omrs-icon-list-checked",iconProps:e})})),sW=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,rG.jsx)(lk,{ref:t,icon:"omrs-icon-location",iconProps:e})})),sD=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,rG.jsx)(lk,{ref:t,icon:"omrs-icon-material-order",iconProps:e})})),sU=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,rG.jsx)(lk,{ref:t,icon:"omrs-icon-maximize",iconProps:e})})),sB=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,rG.jsx)(lk,{ref:t,icon:"omrs-icon-medication",iconProps:e})})),sF=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,rG.jsx)(lk,{ref:t,icon:"omrs-icon-message-queue",iconProps:e})})),sH=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,rG.jsx)(lk,{ref:t,icon:"omrs-icon-microscope",iconProps:e})})),sV=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,rG.jsx)(lk,{ref:t,icon:"omrs-icon-mobile-check",iconProps:e})})),sG=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,rG.jsx)(lk,{ref:t,icon:"omrs-icon-money",iconProps:e})})),sz=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,rG.jsx)(lk,{ref:t,icon:"omrs-icon-mother",iconProps:e})})),sq=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,rG.jsx)(lk,{ref:t,icon:"omrs-icon-movement",iconProps:e})})),sJ=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,rG.jsx)(lk,{ref:t,icon:"omrs-icon-overflow-menu--horizontal",iconProps:e})})),sK=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,rG.jsx)(lk,{ref:t,icon:"omrs-icon-overflow-menu--horizontal",iconProps:e})})),sX=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,rG.jsx)(lk,{ref:t,icon:"omrs-icon-password",iconProps:e})})),sY=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,rG.jsx)(lk,{ref:t,icon:"omrs-icon-pedestrian-family",iconProps:e})})),sZ=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,rG.jsx)(lk,{ref:t,icon:"omrs-icon-pen",iconProps:e})})),sQ=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,rG.jsx)(lk,{ref:t,icon:"omrs-icon-printer",iconProps:e})})),s0=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,rG.jsx)(lk,{ref:t,icon:"omrs-icon-procedure-order",iconProps:e})})),s1=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,rG.jsx)(lk,{ref:t,icon:"omrs-icon-programs",iconProps:e})})),s2=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,rG.jsx)(lk,{ref:t,icon:"omrs-icon-referral-order",iconProps:e})})),s5=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,rG.jsx)(lk,{ref:t,icon:"omrs-icon-renew",iconProps:e})})),s6=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,rG.jsx)(lk,{ref:t,icon:"omrs-icon-report",iconProps:e})})),s8=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,rG.jsx)(lk,{ref:t,icon:"omrs-icon-reset",iconProps:e})})),s3=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,rG.jsx)(lk,{ref:t,icon:"omrs-icon-save",iconProps:e})})),s4=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,rG.jsx)(lk,{ref:t,icon:"omrs-icon-search",iconProps:e})})),s7=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,rG.jsx)(lk,{ref:t,icon:"omrs-icon-settings",iconProps:e})})),s9=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,rG.jsx)(lk,{ref:t,icon:"omrs-icon-switcher",iconProps:e})})),le=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,rG.jsx)(lk,{ref:t,icon:"omrs-icon-shopping-cart",iconProps:e})})),lt=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,rG.jsx)(lk,{ref:t,icon:"omrs-icon-shopping-cart--arrow-down",iconProps:e})})),ln=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,rG.jsx)(lk,{ref:t,icon:"omrs-icon-sticky-note-add",iconProps:e})})),lo=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,rG.jsx)(lk,{ref:t,icon:"omrs-icon-syringe",iconProps:e})})),lr=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,rG.jsx)(lk,{ref:t,icon:"omrs-icon-table-of-contents",iconProps:e})})),li=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,rG.jsx)(lk,{ref:t,icon:"omrs-icon-table",iconProps:e})})),la=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,rG.jsx)(lk,{ref:t,icon:"omrs-icon-time",iconProps:e})})),ls=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,rG.jsx)(lk,{ref:t,icon:"omrs-icon-tools",iconProps:e})})),ll=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,rG.jsx)(lk,{ref:t,icon:"omrs-icon-translate",iconProps:e})})),lc=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,rG.jsx)(lk,{ref:t,icon:"omrs-icon-trash-can",iconProps:e})})),lu=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,rG.jsx)(lk,{ref:t,icon:"omrs-icon-tree-view--alt",iconProps:e})})),ld=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,rG.jsx)(lk,{ref:t,icon:"omrs-icon-two-factor-authentication",iconProps:e})})),lm=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,rG.jsx)(lk,{ref:t,icon:"omrs-icon-user-avatar",iconProps:e})})),lf=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,rG.jsx)(lk,{ref:t,icon:"omrs-icon-user-follow",iconProps:e})})),lp=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,rG.jsx)(lk,{ref:t,icon:"omrs-icon-user-xray",iconProps:e})})),lg=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,rG.jsx)(lk,{ref:t,icon:"omrs-icon-user",iconProps:e})})),lh=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,rG.jsx)(lk,{ref:t,icon:"omrs-icon-view-off",iconProps:e})})),lw=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,rG.jsx)(lk,{ref:t,icon:"omrs-icon-view",iconProps:e})})),l_=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,rG.jsx)(lk,{ref:t,icon:"omrs-icon-warning",iconProps:e})})),ly=l_,lv=sw,lb=sL,lx=sO,lS=lt,lj=(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)(iS,{value:r.current,fallback:t,children:(0,rG.jsx)(lk,{ref:o,icon:e,iconProps:n})})})),lk=(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 a=(0,rF.useRef)(null);return(0,rF.useImperativeHandle)(n,()=>a.current),(0,rF.useEffect)(()=>{a.current&&"currentColor"!==r&&a.current.style.setProperty("--omrs-icon-fill",r)},[]),(0,rG.jsx)("svg",{ref:a,className:aL()("omrs-icon","-esm-login__icons-module__icon___BfFhd",o),height:i,width:i,viewBox:"0 0 16 16",children:(0,rG.jsx)("use",{href:`#${e}`})})})),lN=({path:e,title:t,basePath:n,icon:o})=>{let{t:r}=(0,it.useTranslation)(),i=(0,aQ.useLocation)(),a=(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:aL()("cds--side-nav__link",{"active-left-nav-link":a}),to:`${n}/${encodeURIComponent(e)}`,children:(0,rG.jsxs)("span",{className:"-esm-login__dashboard-module__menu___ds1tf",children:[(0,rG.jsx)(lj,{icon:o,className:"-esm-login__dashboard-module__icon___4Zrrh",size:16}),(0,rG.jsx)("span",{children:r(t)})]})})},e)};function lC(e){return function({basePath:t}){return(0,rG.jsx)(aQ.BrowserRouter,{children:(0,rG.jsx)(lN,{basePath:t,...e})})}}var lE=n(7715),lP=n(7532),lI=n(3692),lO=n(7615),lA=n(700),lR=n(6816),lT=n(1168);function l$(e){return rH().createElement(lT.C,e)}var lM=n(3010),lL=n(6513),lW=n(6190);function lD(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 lM.ng||e instanceof lM._l||e instanceof lM.Ip)return t?(0,lL.yP)(e,t):e;{let n=ag()(e).toDate(),o=new lM.ng(n.getFullYear(),n.getMonth()+1,n.getDate());return t?(0,lL.yP)(o,t):o}}function lU(e){if(e)return e.toDate((0,lW.Xj)())}var lB=n(9002);function lF(e){if("string"==typeof e&&0!==e.trim().length)try{return new Intl.Locale(e.replace(/[_@]/g,"-")).toString()}catch{return}}function lH(e){let t=e??"",n=lF(t);if(!n)return t;try{return new Intl.DisplayNames([n],{type:"language"}).of(n)??t}catch{return t}}function lV(){let e=window.i18next.language,t=lF(e)??e;return"ht"===t&&(t="fr-HT"),t}var lG=n(7883),lz=n(424),lq=n(1492),lJ=n(8271);function lK(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}ap.extend(ah),ap.extend(lq),ap.extend(lz);let lX="YYYY-MM-DDTHH:mm:ss.SSSZZ",lY=/^(\d{4})(?:-(\d{2})(?:-(\d{2}))?)?$/;function lZ(e,t){let n=lY.exec(e);if(!n)return(0,lG.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]),a=new Date(0);return(a.setUTCFullYear(o,(r??1)-1,i??1),a.getUTCFullYear()!==o||a.getUTCMonth()!==(r??1)-1||a.getUTCDate()!==(i??1))?{invalid:`Invalid ISO calendar date '${e}'`}:{year:o,...void 0!==r&&{month:r},...void 0!==i&&{day:i}}}function lQ(e){return null!=e&&28===e.trim().length&&"T"===(e=e.trim())[10]&&":"===e[13]&&":"===e[16]&&"."===e[19]&&("+"===e[23]||"-"===e[23])&&ap(e,lX).isValid()}function l0(e){return ap(e).isToday()}function l1(e){return lQ(e)?ap(e,lX).toDate():null}function l2(e,t=!1){let n=ap(e);return t&&(n=n.utc()),n.format(lX)}function l5(e){return ap(e).toDate()}var l6=new WeakMap;let l8=new class{register(e,t){lK(this,l6).set(e,t)}getCalendar(e){if(!e)return;if(e.calendar)return e.calendar;if(e.region){let t=`${e.language}-${e.region}`;if(lK(this,l6).has(t))return lK(this,l6).get(t)}if(e.language&&lK(this,l6).has(e.language))return lK(this,l6).get(e.language);let t=new Intl.DateTimeFormat(e.toString()).resolvedOptions().calendar;return lK(this,l6).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,l6,{writable:!0,value:new Map})}};function l3(e,t){l8.register(e,t)}function l4(e){let t=e??lV();return l8.getCalendar(t instanceof Intl.Locale?t:new Intl.Locale(t))}let l7={mode:"standard",time:"for today",day:!0,month:!0,year:!0,noToday:!1};function l9(e,t={}){let n=lZ(e,lV());if(n.invalid)return console.warn(`Could not parse invalid date '${e}'`),null;!(0,lJ.A)(n.day)&&(0,lJ.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=ap().set(n).toDate();return(0,lJ.A)(n.year)&&(t.year=!1),(0,lJ.A)(n.month)&&(t.month=!1),(0,lJ.A)(n.date)&&(t.day=!1),ce(o,t)}function ce(e,t){let n,o=t?.locale??lV(),r=new Intl.Locale(o),{calendar:i,mode:a,time:s,day:l,month:c,year:u,noToday:d,numberingSystem:m}={...l7,...{noToday:"am"===r.language},...t},f={calendar:i??l4(r),year:u?"numeric":void 0,month:c?"short":void 0,day:l?"2-digit":void 0,numberingSystem:m},p=ap(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"==a&&u&&l&&(t=t.map(ct("-"))),"wide"==a&&(t=t.map(ct(" — "))),"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===s||p&&"for today"===s)&&(n+=`, ${cn(e)}`),n}let ct=e=>(t,n,o)=>"literal"!==t.type||" "!==t.value||n<o.length-1&&"era"===o[n+1].type?t:{type:"literal",value:e};function cn(e){return e.toLocaleTimeString(lV(),{hour:"2-digit",minute:"2-digit"})}function co(e,t){return ce(e,{...t,time:!0})}function cr(e,t){let n=l4("string"==typeof t?new Intl.Locale(t):t);return n?(0,lL.yP)(e,(0,lB.d)(n)):e}function ci(e,t){return new Intl.DurationFormat(lV(),t).format(e)}function ca(e,t){if(null==e)return null;if("string"==typeof e){let n=lZ(e,lV());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}}),ap(t).set(n))}return ap(e)}let cs=["years","months","days","hours","minutes","seconds"],cl={second:"seconds",minute:"minutes",hour:"hours",day:"days",month:"months",year:"years"},cc={seconds:45,minutes:45,hours:22,days:26,months:11,years:1/0};function cu(e,t=ap(),n){let o,r=ap(t),i=ca(e,r);if(null==i)return null;if("string"==typeof n){let e=cl[n]??n;return{[e]:r.diff(i,e)}}let{thresholds:a,largestUnit:s,smallestUnit:l}=n??{};if(void 0!==s||void 0!==l){let e,t=l?cl[l]??l:void 0;return e="auto"===s||void 0===s?function(e,t,n){let o=cs.indexOf(n);for(let r=0;r<cs.length;r++){let i=cs[r];if(t.diff(e,i)>0)return r<=o?i:n}return n}(i,r,t??"seconds"):cl[s]??s,function(e,t,n,o){let r=cs.indexOf(n),i=cs.indexOf(o),a=cs.slice(r,i+1),s={},l=e;for(let e of a){let n=t.diff(l,e);s[e]=n,l=l.add(n,e)}return s}(i,r,e,t??e)}let c=(o=function(e){let t={...cc};if(e)for(let[n,o]of Object.entries(e))void 0!==o&&(t[cl[n]??n]=o);return t}(a),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 cd={style:"short",localeMatcher:"lookup"};function cm(e,t=ap(),n){let o=cu(e,t,n);return null==o?null:ci(o,"object"==typeof n&&n.formatOptions?{...cd,...n.formatOptions}:cd)}let cf=(0,rF.createContext)(null);function cp(){let e=iT({externalModuleName:"@openmrs/esm-styleguide"}).preferredDateLocale,t=(0,rF.useMemo)(()=>{let t=lV();return e[t]&&(t=e[t]),t},[window.i18next.language]),n=(0,rF.useMemo)(()=>{let e=l4(t);return void 0!==e?(0,lB.d)(e):void 0},[t]),o=(0,rF.useMemo)(()=>new Intl.Locale(t,{calendar:n?.identifier}),[t,n]),r=(0,rF.useMemo)(()=>n?(0,lL.yP)((0,lW.Ec)((0,lW.Xj)()),n):(0,lW.Ec)((0,lW.Xj)()),[n]);return{calendar:n,intlLocale:o,today_:r}}let cg=new lM.ng(1793,1,1);var ch=n(5830),cw=n(5354),c_=n(4745),cy=n(1202);function cv(e,t){return Number.parseInt(ce(e,{calendar:t.calendar,locale:t.baseName,day:!1,month:!1,noToday:!0,numberingSystem:"latn"}))}let cb=(0,rF.forwardRef)(function(e,t){let{className:n}=e,o=(0,rF.useContext)(ch.f2),r=(0,rF.useContext)(ch._I),i=o??r,a=(0,rF.useContext)(cf),s=(0,lW.Xj)(),l=ce(i.visibleRange.start.toDate(s),{calendar:a.calendar,locale:a.baseName,day:!1,year:!1,noToday:!0}),c=cv(i.visibleRange.start.toDate(s),a),u=i.maxValue?cv(i.maxValue.toDate(s),a):void 0,d=i.minValue?cv(i.minValue.toDate(s),a):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)(c_.oz,{formatOptions:{useGrouping:!1},maxValue:u,minValue:d,onChange:m,value:c,children:[(0,rG.jsx)(cy.p,{}),(0,rG.jsxs)(lO.Y,{children:[(0,rG.jsx)(lA.$,{slot:"increment",children:(0,rG.jsx)(so,{size:8})}),(0,rG.jsx)(lA.$,{slot:"decrement",children:(0,rG.jsx)(se,{size:8})})]})]})]})});var cx=n(9588);let cS="-esm-login__datepicker-module__inputGroup___+4zks",cj="-esm-login__datepicker-module__inputSegment___wiExn",ck="-esm-login__datepicker-module__dateInputWrapper___uiyAC",cN="-esm-login__datepicker-module__invalidText___SxtTL",cC="-esm-login__datepicker-module__flatButton___UU1Qp",cE="-esm-login__datepicker-module__flatButtonMd___fhR-1",cP="-esm-login__datepicker-module__flatButtonSm___5INZ7",cI="-esm-login__datepicker-module__flatButtonLg___RFMrl";function cO({children:e}){let t=(0,rF.useContext)(lP.Pg),n=(0,rF.useContext)(lP.a8),o=t??n,r=ao(()=>o?.close());return(0,rG.jsx)(cx.lG,{className:"-esm-login__datepicker-module__dialog___qllIf",ref:r,children:e})}let cA=(0,rF.forwardRef)(function({variant:e,today_:t,minDate:n,maxDate:o},r){let i="range"===e,a=i?ch._e:ch.Vv;return(0,rG.jsx)(cw.A,{ref:r,className:"-esm-login__datepicker-module__popover___16UMX",placement:"bottom start",offset:1,isNonModal:!0,children:(0,rG.jsx)(cO,{children:(0,rG.jsxs)(a,{...i?{minValue:n,maxValue:o,className:"cds--date-picker__calendar"}:{},children:[(0,rG.jsxs)("header",{className:"-esm-login__datepicker-module__header___WAVlD",children:[(0,rG.jsx)(lA.$,{className:aL()(cC,cE),slot:"previous",children:(0,rG.jsx)(su,{size:16})}),(0,rG.jsx)(cb,{className:"-esm-login__datepicker-module__monthYear___A3aKF"}),(0,rG.jsx)(lA.$,{className:aL()(cC,cE),slot:"next",children:(0,rG.jsx)(sd,{size:16})})]}),(0,rG.jsx)(ch.r8,{className:"-esm-login__datepicker-module__calendarGrid___6qRB2",children:e=>(0,rG.jsx)(ch.Zr,{className:aL()("cds--date-picker__day",{"-esm-login__datepicker-module__today___TZl6M":0===t.compare(e)}),date:e},e.toString())})]})})})});var cR=n(8017),cT=n(9774),c$=n(7956);let cM=(0,rF.forwardRef)(function(e,t){let n=(0,rF.useContext)(lP.Pg),[o,r]=(0,lE.JT)({slot:e.slot},t,cT.cQ),{locale:i}=(0,lT.Y)(),a=(0,c$.F)({...o,locale:i,createCalendar:lB.d}),s=(0,rF.useRef)(null),{fieldProps:l,inputProps:c}=(0,cR.cJ)({...o,inputRef:s},a,r),u=(0,rF.useCallback)(()=>{a.isDisabled||n.toggle()},[]);return(0,rG.jsxs)(lE.Kq,{values:[[cT.$,a],[cy.E,{...c,ref:s}],[lO.t,{...l,ref:r,isInvalid:a.isInvalid}]],children:[(0,rG.jsx)(lO.Y,{...e,id:e.id,ref:t,slot:e.slot||void 0,className:e.className,isDisabled:a.isDisabled,isInvalid:a.isInvalid,onClick:u,children:a.segments.map((t,n)=>(0,rF.cloneElement)(e.children(t),{key:n}))}),(0,rG.jsx)(cy.p,{})]})}),cL=(0,rF.forwardRef)(function(e,t){let n=(0,rF.useContext)(lP.Pg),o=(0,rF.useContext)(lP.a8);return(n??o).isInvalid?(0,rG.jsx)(l_,{ref:t,size:16,...e}):(0,rG.jsx)(a9,{ref:t,size:16,...e})});var cW=n(64),cD=n(5503),cU=n(1697),cB=n(7866),cF=n(8035),cH=n(2231);let cV=(0,rF.forwardRef)(function({segment:e,...t},n){let o=(0,rF.useContext)(cT.$),r=(0,cW.U)(n),{segmentProps:i}=(0,cD.V)(e,o,r),{focusProps:a,isFocused:s,isFocusVisible:l}=(0,cU.o)(),{hoverProps:c,isHovered:u}=(0,cB.M)({...t,isDisabled:o.isDisabled||"literal"===e.type}),d=function(e){let{className:t,style:n,children:o,defaultClassName:r,defaultChildren:i,defaultStyle:a,values:s}=e;return(0,rF.useMemo)(()=>{let e,l,c;return e="function"==typeof t?t({...s,defaultClassName:r}):t,l="function"==typeof n?n({...s,defaultStyle:a||{}}):n,c="function"==typeof o?o({...s,defaultChildren:i}):null==o?i:o,{className:e??r,style:l||a?{...a,...l}:void 0,children:c??i,"data-rac":""}},[t,n,o,r,i,a,s])}({...t,values:{...e,isReadOnly:!e.isEditable,isInvalid:o.isInvalid,isDisabled:o.isDisabled,isHovered:u,isFocused:s,isFocusVisible:l},defaultChildren:e.text}),m=(0,rF.useCallback)(e=>{e.stopPropagation()},[]);return(0,rG.jsx)("span",{...(0,cF.v)((0,cH.$)(t),i,a,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":s||void 0,"data-focus-visible":l||void 0,onClick:m})}),cG={short:!1,size:"md"},cz=(0,rF.forwardRef)(function(e,t){let{className:n,defaultValue:o,isDisabled:r,invalid:i,invalidText:a,isInvalid:s,label:l,labelText:c,light:u,maxDate:d,minDate:m,onChange:f,onChangeRaw:p,short:g,size:h,value:w,..._}={...cG,...e},{calendar:y,intlLocale:v,today_:b}=cp(),x=(0,rF.useId)(),S=!!(c??l),j=(0,rF.useMemo)(()=>lD(o,y),[o,y]),k=(0,rF.useMemo)(()=>lD(w,y,!0),[w,y]),N=(0,rF.useMemo)(()=>lD(d,y),[d,y]),C=(0,rF.useMemo)(()=>lD(m??cg,y),[m,y]),E=(0,rF.useMemo)(()=>i||s,[i,s]),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?.(lU(e)))),[p,f]);return(0,rG.jsx)(l$,{locale:v.toString(),children:(0,rG.jsx)("div",{className:aL()("cds--form-item",n),children:(0,rG.jsx)(lE.Kq,{values:[[cf,v]],children:(0,rG.jsxs)(lP.lr,{className:aL()("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"===v.language||void 0,..._,onChange:P,children:[(0,rG.jsxs)("div",{className:"cds--date-picker-container",children:[S&&(0,rG.jsx)(lI.J,{className:aL()("cds--label",{"cds--label--disabled":r}),htmlFor:x,children:c??l}),(0,rG.jsxs)(lO.Y,{className:cS,children:[(0,rG.jsx)(cM,{id:S?x:void 0,ref:t,className:aL()("cds--date-picker-input__wrapper","-esm-login__datepicker-module__inputWrapper___kykar",{"-esm-login__datepicker-module__inputWrapperSm___KJtg-":"sm"===h,"-esm-login__datepicker-module__inputWrapperMd___ablE9":"md"===h||!h||0===h.length,"-esm-login__datepicker-module__inputWrapperLg___5dkQp":"lg"===h}),children:e=>"era"!==e.type?(0,rG.jsx)(cV,{className:cj,segment:e}):(0,rG.jsx)(rH().Fragment,{})}),(0,rG.jsx)(lA.$,{className:aL()(cC,{[cP]:"sm"===h,[cE]:"md"===h||!h||0===h.length,[cI]:"lg"===h}),children:(0,rG.jsx)(cL,{})})]}),(0,rG.jsx)(lR.b,{className:cN,children:a})]}),(0,rG.jsx)(cA,{variant:"single",today_:b})]})})})})}),cq=(0,rF.forwardRef)(function({className:e,defaultValue:t,invalid:n,invalidText:o,isDisabled:r,isInvalid:i,label:a,labelText:s,light:l,maxDate:c,minDate:u,onChange:d,onChangeRaw:m,size:f="md",value:p,...g},h){let{calendar:w,intlLocale:_,today_:y}=cp(),v=(0,rF.useId)(),b=!!(s??a),x=(0,rF.useMemo)(()=>{if(p)return{start:lD(p[0],w,!1),end:lD(p[1],w,!1)}},[p,w]),S=(0,rF.useMemo)(()=>{if(t)return{start:lD(t[0],w,!1),end:lD(t[1],w,!1)}},[t,w]),j=(0,rF.useMemo)(()=>lD(u??cg,w,!0),[u,w]),k=(0,rF.useMemo)(()=>lD(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?.([lU(e.start),lU(e.end)]))),[m,d]);return(0,rG.jsx)(l$,{locale:_.toString(),children:(0,rG.jsx)("div",{className:aL()("cds--form-item",e),children:(0,rG.jsx)(lE.Kq,{values:[[cf,_]],children:(0,rG.jsx)(lP.Ur,{id:b?v:void 0,className:aL()("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)(lI.J,{className:aL()("cds--label",{"cds--label--disabled":r}),htmlFor:v,children:s??a}),(0,rG.jsxs)(lO.Y,{className:cS,children:[(0,rG.jsxs)("div",{className:aL()("-esm-login__datepicker-module__inputsWrapper___YlkGh",{"-esm-login__datepicker-module__inputsWrapperSm___fAKhS":"sm"===f,"-esm-login__datepicker-module__inputsWrapperMd___XVgGP":"md"===f||!f||0===f.length,"-esm-login__datepicker-module__inputsWrapperLg___UgHJ1":"lg"===f}),children:[(0,rG.jsx)(cT.J3,{className:aL()("cds--date-picker-input__wrapper","-esm-login__datepicker-module__startInput___qgbQm",ck),slot:"start",children:e=>(0,rG.jsx)(cV,{className:cj,segment:e})}),(0,rG.jsx)("div",{className:"-esm-login__datepicker-module__separator___79vXZ",children:(0,rG.jsx)("span",{"aria-hidden":"true","data-readonly":!0,children:"–"})}),(0,rG.jsx)(cT.J3,{className:aL()("cds--date-picker-input__wrapper","-esm-login__datepicker-module__endInput___huv7x",ck),slot:"end",children:e=>(0,rG.jsx)(cV,{className:cj,segment:e})})]}),(0,rG.jsx)(lA.$,{className:aL()(cC,{[cP]:"sm"===f,[cE]:"md"===f||!f||0===f.length,[cI]:"lg"===f}),children:(0,rG.jsx)(cL,{})})]}),(0,rG.jsx)(lR.b,{className:cN,children:o}),(0,rG.jsx)(cA,{variant:"range",today_:y,minDate:j,maxDate:k})]})})})})})});var cJ=n(9606);let cK=({diagnoses:e,showCertainty:t=!1})=>{let{diagnosisTags:n}=iT({externalModuleName:"@openmrs/esm-styleguide"});return(0,rG.jsx)("div",{className:"-esm-login__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)(cX,{color:r,isProvisional:o,name:e.display},e.uuid)})})};function cX({color:e,isProvisional:t,name:n}){let[o,r]=(0,rF.useState)(!1),[i,a]=(0,rF.useState)(!1),[s,l]=(0,rF.useState)(!1),c=s||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=aL()("cds--tag","cds--tag--md","cds--layout--size-md",`cds--tag--${e}`,"-esm-login__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-login__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)(cJ.k$,{delay:0,closeDelay:150,isOpen:o,onOpenChange:r,children:[(0,rG.jsx)(lA.$,{className:d,"data-testid":"diagnosis-tag",onFocusChange:a,onPress:()=>r(!0),children:m}),(0,rG.jsx)(cJ.m_,{className:"-esm-login__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 cY={action:"-esm-login__empty-card-module__action___Y0dul",content:"-esm-login__empty-card-module__content___fo0nB",desktopHeading:"-esm-login__empty-card-module__desktopHeading___0Cg1N",tabletHeading:"-esm-login__empty-card-module__tabletHeading___BogTF",tile:"-esm-login__empty-card-module__tile___QB8Ld"},cZ=({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"})}),cQ=e=>{let t="tablet"===i4(),n=e.launchForm;return(0,rG.jsx)(aF.Layer,{className:cY.layer,children:(0,rG.jsxs)(aF.Tile,{className:cY.tile,children:[(0,rG.jsx)("div",{className:t?cY.tabletHeading:cY.desktopHeading,children:(0,rG.jsx)("h4",{children:e.headerTitle})}),(0,rG.jsx)(cZ,{}),(0,rG.jsx)("p",{className:cY.content,children:tm("emptyStateText","There are no {{displayText}} to display",{displayText:e.displayText})}),(0,rG.jsx)("p",{className:cY.action,children:n&&(0,rG.jsx)(aF.Button,{onClick:()=>n(),kind:"ghost",size:t?"lg":"sm",children:tm("recordNewEntry","Record {{ displayText }}",{displayText:e.displayText})})})]})})},c0=({error:e,headerTitle:t})=>{let n="tablet"===i4();return(0,rG.jsx)(aF.Layer,{children:(0,rG.jsxs)(aF.Tile,{className:"-esm-login__error-state-module__tile___dd418",children:[(0,rG.jsx)("div",{className:n?"-esm-login__error-state-module__tabletHeading___g5rjg":"-esm-login__error-state-module__desktopHeading___Nd9u2",children:(0,rG.jsx)("h4",{children:t})}),(0,rG.jsxs)("p",{className:"-esm-login__error-state-module__errorMessage___z2RiN",children:[tm("error","Error")," ",`${e?.response?.status}: `,e?.response?.statusText]}),(0,rG.jsx)("p",{className:"-esm-login__error-state-module__errorCopy___dq+e2",children:tm("errorCopy")})]})})},c1=c0,c2=rH().forwardRef((e,t)=>{let{slotName:n,basePath:o,componentContext:r,state:i}=ae(),a=window.location??{pathname:""},s=r6(n??"");return e.isChildOfHeader&&n&&s.length>0?(0,rG.jsxs)(aF.SideNav,{"aria-label":tm("leftNavigation","Left navigation"),className:"-esm-login__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)(iS,{value:r,fallback:(0,rG.jsx)(r4,{name:n,state:{basePath:o,currentPath:a,...i}}),children:(0,rG.jsx)(rV.Provider,{value:r,children:(0,rG.jsx)(r4,{name:n,state:{basePath:o,currentPath:a,...i}})})}):null]}):null}),c5=({selectedLocationUuid:e,defaultLocationUuid:t,locationTag:n,locationsPerRequest:o=50,onChange:r})=>{let[i,a]=(0,rF.useState)(""),s=(0,rF.useId)(),{location:l}=function(e){let t=e?`/ws/fhir2/R4/Location?_id=${e}`:null,{data:n,error:o,isLoading:r}=iW()(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=iM(n),{data:r,isLoading:i,isValidating:a,setSize:s,error:l}=iQ()(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?`,a=new URLSearchParams;return a.append("_summary","data"),t&&a.append("_count",""+t),n&&a.append("_getpagesoffset",""+n*t),e&&a.append("_tag",e),"string"==typeof o&&""!==o&&a.append("name:contains",o),i+a.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:a,error:l||null,setPage:s}),[i,r,a,s,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(),a(e.trim())},[r]),w=ar((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)(aF.Search,{"aria-describedby":f?`${s}-error`:void 0,labelText:tm("searchForLocation"),id:s,placeholder:tm("searchForLocation"),onChange:e=>h(e.target.value),size:"lg"}),f&&(0,rG.jsx)("div",{className:"-esm-login__location-picker-module__errorNotification___vWBFD",id:`${s}-error`,children:(0,rG.jsx)(aF.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-login__location-picker-module__searchResults___Gbet+",children:u?(0,rG.jsx)("div",{className:"-esm-login__location-picker-module__loadingContainer___QO-zj",children:Array.from({length:5}).map((e,t)=>(0,rG.jsx)(aF.RadioButtonSkeleton,{className:"-esm-login__location-picker-module__radioButtonSkeleton___otoCy",role:"progressbar"},t))}):(0,rG.jsxs)(rG.Fragment,{children:[(0,rG.jsx)("div",{className:"-esm-login__location-picker-module__locationResultsContainer___6Pasf",children:g.length>0?(0,rG.jsx)(aF.RadioButtonGroup,{name:"loginLocations",onChange:e=>{r(e?.toString())},orientation:"vertical",valueSelected:e,children:g.map((e,t)=>(0,rG.jsx)(aF.RadioButton,{className:"-esm-login__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-login__location-picker-module__emptyState___w4-Ca",children:(0,rG.jsx)("p",{className:"-esm-login__location-picker-module__locationNotFound___Of2MJ",children:tm("noResultsToDisplay")})})}),m&&(0,rG.jsx)("div",{className:"-esm-login__location-picker-module__loadingIcon___NAwSB",children:(0,rG.jsx)(aF.InlineLoading,{description:tm("loading")})})]})})]})},c6=R("modalState",{modalContainer:null,modalStack:[]}),c8=0;async function c3(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,a=await i(),s=c8++;r=await rW({...a,name:`${t}-${s}`},{...n,domElement:e})}else y(`Failed to launch modal. Please notify your administrator. Modal name: ${t}`);return r}function c4(e){return"TO_BE_DELETED"===e.state||"DELETED"===e.state}function c7(e,t){t?.unmount&&(t.unmountPromise?.catch(()=>{}),t.unmount().catch(t=>{console.error(`The modal '${e}' failed to unmount`,t)}))}function c9(e){return e.find(e=>!c4(e))}function ue(e,t){e.container&&(e.container.style.visibility=t?"unset":"hidden")}let ut=window.getComputedStyle(document.body).overflow;function un({modalStack:e,modalContainer:t}){if(t)if(e.length){t.style.visibility||(addEventListener("keydown",ur),document.body.style.overflow="hidden",t.style.visibility="unset");let n=c9(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",c3(n,e.modalName,e.props).then(o=>{c4(e)?c7(e.modalName,o):o?(e.parcel=o,t.prepend(n),ue(e,c9(c6.getState().modalStack)===e),o.mountPromise.then(()=>{c4(e)||(e.state="MOUNTED")},t=>{y(t),e.parcel=null,uo(e)})):uo(e)},t=>{y(t),uo(e)});break}case"MOUNTING":case"MOUNTED":ue(e,e===n);break;case"TO_BE_DELETED":e.state="DELETED",e.onClose(),c7(e.modalName,e.parcel),e.container?.remove(),setTimeout(()=>{let t=c6.getState();c6.setState({...t,modalStack:t.modalStack.filter(t=>t!==e)})},0)}})}else t.style.removeProperty("visibility"),document.body.style.overflow=ut,removeEventListener("keydown",ur)}function uo(e){if(c4(e))return;e.state="TO_BE_DELETED";let t=c6.getState();c6.setState({...t,modalStack:[...t.modalStack]})}function ur(e){"Escape"===e.key&&function(){let[e]=c6.getState().modalStack;e&&uo(e)}()}function ui(e){c6.subscribe(un),c6.setState({...c6.getState(),modalContainer:e})}function ua(e,t={},n=()=>{}){let o=()=>{let e=c6.getState().modalStack.find(e=>e.onClose===n);e&&uo(e)};if(rN(e)){var r;let i,a;r={state:"NEW",onClose:n,modalName:e,props:{close:o,...t}},a=[r,...(i=c6.getState()).modalStack],c6.setState({...i,modalStack:a})}else y(`Failed to launch modal. Please notify your administrator. Modal name: "${e}"`);return o}var us=n(9685);let ul=({notification:e})=>{let{description:t,action:n,kind:o,critical:r,title:i,onAction:a}=e;return(0,rG.jsx)(aF.ActionableNotification,{actionButtonLabel:n,kind:o||"info",lowContrast:r,subtitle:t,title:i||"",inline:!0,onActionButtonClick:a})},uc=({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)(ul,{notification:e},e.id))})},uu=({notification:e})=>{let{actionButtonLabel:t,onActionButtonClick:n=()=>{},subtitle:o,kind:r,title:i,critical:a,progressActionLabel:s,id:l,...c}=e,[u,d]=(0,rF.useState)(t);return(0,rG.jsx)(aF.ActionableNotification,{kind:r||"info",actionButtonLabel:u,ariaLabel:tm("closesActionableNotification","Closes actionable notification"),onActionButtonClick:()=>{n(),s&&d(s)},statusIconDescription:tm("actionableNotification","Actionable notification"),subtitle:o,title:i,lowContrast:a,inline:!0,...c})},ud=({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)(uu,{notification:e},e.id))})};class um{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 uf=new um,up=0,ug=new um,uh=0;function uw(e){e&&(0,r7.createRoot)(e).render((0,rG.jsx)(uc,{subject:uf}))}function u_(e){var t;e&&("string"==typeof(t=e.description)?t.trim().length>0:"object"==typeof t&&(t instanceof Error||!(0,us.A)(t)))?(e.description instanceof Error&&(e.description=e.description.toLocaleString()),setTimeout(()=>{uf.next({...e,id:up++})},0)):console.error("showNotification must be called with an object having a 'description' property that is a non-empty string or object")}function uy(e){e&&(0,r7.createRoot)(e).render((0,rG.jsx)(ud,{subject:ug}))}function uv(e){var t;e&&("string"==typeof(t=e.actionButtonLabel)?t.trim().length>0:"object"==typeof t&&!(0,us.A)(t))?setTimeout(()=>{ug.next({...e,id:uh++})},0):console.error("showActionableNotification must be called with an actionButtonLabel that is a non-empty string")}let ub=["NORMAL","HIGH","CRITICALLY_HIGH","OFF_SCALE_HIGH","LOW","CRITICALLY_LOW","OFF_SCALE_LOW"],ux=["critically_low","critically_high","high","low","normal","off_scale_low","off_scale_high"],uS={container:"-esm-login__numeric-observation-module__container___NfxbH",card:"-esm-login__numeric-observation-module__card___9oQAh","abnormal-value":"-esm-login__numeric-observation-module__abnormal-value___drvEi","critical-value":"-esm-login__numeric-observation-module__critical-value___JAIHt",cell:"-esm-login__numeric-observation-module__cell___lTunW","critically-high":"-esm-login__numeric-observation-module__critically-high___aDUjc","critically-low":"-esm-login__numeric-observation-module__critically-low___5srAK",high:"-esm-login__numeric-observation-module__high___7KiyK",low:"-esm-login__numeric-observation-module__low___Zs2ct","label-container":"-esm-login__numeric-observation-module__label-container___lGnGH","value-container":"-esm-login__numeric-observation-module__value-container___hHPXt",label:"-esm-login__numeric-observation-module__label___WFuxk",value:"-esm-login__numeric-observation-module__value___6fHUr",units:"-esm-login__numeric-observation-module__units___EdVuw","pad-right":"-esm-login__numeric-observation-module__pad-right___6T9Cd","off-scale-low":"-esm-login__numeric-observation-module__off-scale-low___Sc1CV","off-scale-high":"-esm-login__numeric-observation-module__off-scale-high___cWpU2",arrow:"-esm-login__numeric-observation-module__arrow___SLGUh"},uj=({value:e,unit:t,label:n,interpretation:o,referenceRange:r,conceptUuid:i,variant:a="card",patientUuid:s})=>{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}=iW()(n,tP),a=o?.data?.results?.[0];return{referenceRange:a?{hiNormal:a.hiNormal??null,hiAbsolute:a.hiAbsolute??null,hiCritical:a.hiCritical??null,lowNormal:a.lowNormal??null,lowAbsolute:a.lowAbsolute??null,lowCritical:a.lowCritical??null}:void 0,error:r,isLoading:i}}(r||o?void 0:i,s),d=r??c,m=(0,rF.useMemo)(()=>{if(o)return o?"--"===o?"normal":ub.includes(o)?o.toLowerCase():ux.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,y=_?e:tm("notAvailable","Not available"),v=aL()({[uS["critically-low"]]:"critically_low"===m||"off_scale_low"===m,[uS["critically-high"]]:"critically_high"===m||"off_scale_high"===m,[uS.low]:"low"===m,[uS.high]:"high"===m,[uS["off-scale-low"]]:"off_scale_low"===m,[uS["off-scale-high"]]:"off_scale_high"===m}),b=aL()({[uS.container]:!0,[uS.card]:!0,[uS["critical-value"]]:f,[uS["abnormal-value"]]:p&&!f}),x=aL()({[uS.cell]:!0,[v]:!0});return"cell"===a?(0,rG.jsxs)("div",{className:x,children:[y,_&&t?` ${t}`:""]}):(0,rG.jsxs)("section",{className:b,"data-testid":"numeric-observation-card",children:[n&&(0,rG.jsxs)("div",{className:uS["label-container"],children:[(0,rG.jsx)("span",{id:g,className:uS.label,children:n}),p&&(0,rG.jsx)("span",{className:uS[m.replace("_","-")],title:tm("abnormalValue","Abnormal value")})]}),(0,rG.jsxs)("div",{className:uS["value-container"],children:[(0,rG.jsx)("span",{id:h,"aria-labelledby":g&&w?`${g} ${w}`:g||w||void 0,className:uS.value,children:y}),_&&t&&(0,rG.jsx)("span",{id:w,className:uS.units,children:t})]})]})},uk="-esm-login__page-header-module__pageHeader___YOpQL",uN=e=>{if("children"in e){let{children:t,className:n,...o}=e;return(0,rG.jsx)("div",{className:aL()(uk,n),...o,children:t})}{let{title:t,illustration:n,className:o,...r}=e;return(0,rG.jsx)("div",{className:aL()(uk,o),...r,children:(0,rG.jsx)(uC,{title:t,illustration:n})})}},uC=({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:aL()("-esm-login__page-header-module__pageHeaderContent___PjsJm",n),children:[t,(0,rG.jsxs)("div",{className:"-esm-login__page-header-module__pageLabels___pPcKj",children:[o?.implementationName&&(0,rG.jsx)("p",{children:tm(o.implementationName)}),(0,rG.jsx)("h1",{className:"-esm-login__page-header-module__pageName___3d4IC",children:e})]})]})},uE=({totalItems:e,pageSize:t,onPageNumberChange:n,pageNumber:o,dashboardLinkUrl:r,currentItems:i,dashboardLinkLabel:a})=>{let{pageSizes:s,pageItemsCount:l}=as(t,e,o,i),c="tablet"===i4(),u=tm("paginationItemsCount","{{pageItemsCount}} / {{totalItems}} items",{totalItems:e,pageItemsCount:l});return(0,rG.jsx)(rG.Fragment,{children:e>0&&(0,rG.jsxs)("div",{className:aL()({"-esm-login__pagination-module__tablet___lQ3ak":c,"-esm-login__pagination-module__desktop___HfUTY":!c}),children:[(0,rG.jsxs)("div",{children:[u,r&&(0,rG.jsx)(rz,{to:r,className:"-esm-login__pagination-module__configurableLink___NM9v7",children:a??tm("seeAll","See all")})]}),(0,rG.jsx)(aF.Pagination,{className:"-esm-login__pagination-module__pagination___WzkBs",page:o,pageSize:t,pageSizes:s,totalItems:e,onChange:n,pageRangeText:(e,t)=>tm("paginationOfPages","of {{count}} pages",{count:t}),size:c?"lg":"sm"})]})})};function uP(e){return uO(uR(e,"usual","official"))}function uI(e){return uP(e)}function uO(e){var t;let n;return e?e.text??(n=(t=e).given??[],(t.family?n.concat(t.family):n).join(" ")):""}function uA(e){return uO(e)}function uR(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 uT(e,t=ap()){let n=ap(t),o=ca(e,n);if(null==o)return null;let r=n.diff(o,"hours"),i=n.diff(o,"days"),a=n.diff(o,"weeks"),s=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(a<4)c.days=i;else if(l<1){let e=n.subtract(a,"weeks").diff(o,"days");c.weeks=a,c.days=e}else if(l<2){let e=n.subtract(s,"months").diff(o,"days");c.months=s,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 u$(e,t=ap()){let n=uT(e,t);if(null==n)return null;let o={style:"short",localeMatcher:"lookup"};return"minutes"in n&&0===n.minutes&&(o.minutesDisplay="always"),ci(n,o)}let uM={container:"-esm-login__patient-banner-patient-info-module__container___Gjd-4",activePatientContainer:"-esm-login__patient-banner-patient-info-module__activePatientContainer___QLcpg",patientBanner:"-esm-login__patient-banner-patient-info-module__patientBanner___7nrgC",patientName:"-esm-login__patient-banner-patient-info-module__patientName___-bF9a",patientAvatar:"-esm-login__patient-banner-patient-info-module__patientAvatar___AkN3H",patientAvatarButton:"-esm-login__patient-banner-patient-info-module__patientAvatarButton___KDxA6",patientInfo:"-esm-login__patient-banner-patient-info-module__patientInfo___+WtDB",demographics:"-esm-login__patient-banner-patient-info-module__demographics___Vtf3v",row:"-esm-login__patient-banner-patient-info-module__row___NIOYI",flexRow:"-esm-login__patient-banner-patient-info-module__flexRow___VxdGB",tagsSlot:"-esm-login__patient-banner-patient-info-module__tagsSlot___lU6+4",identifiers:"-esm-login__patient-banner-patient-info-module__identifiers___tehd8",identifier:"-esm-login__patient-banner-patient-info-module__identifier___bSJIF",primaryIdentifier:"-esm-login__patient-banner-patient-info-module__primaryIdentifier___yOV1B",secondaryIdentifier:"-esm-login__patient-banner-patient-info-module__secondaryIdentifier___WvJbh",value:"-esm-login__patient-banner-patient-info-module__value___sBM-q",tag:"-esm-login__patient-banner-patient-info-module__tag___BEvEV",gender:"-esm-login__patient-banner-patient-info-module__gender___4XkLq",separator:"-esm-login__patient-banner-patient-info-module__separator___iYBA3",tooltipPadding:"-esm-login__patient-banner-patient-info-module__tooltipPadding___EWVCK",tooltipSmallText:"-esm-login__patient-banner-patient-info-module__tooltipSmallText___yDmRU",actionsButtonText:"-esm-login__patient-banner-patient-info-module__actionsButtonText___mn139"};function uL({showIdentifierLabel:e,type:t,value:n}){return(0,rG.jsx)("span",{className:uM.primaryIdentifier,children:(0,rG.jsxs)(aF.Tag,{className:uM.tag,type:"gray",children:[e&&t?.text&&(0,rG.jsxs)("span",{className:uM.label,children:[t.text,": "]}),(0,rG.jsx)("span",{className:uM.value,children:n})]})})}function uW({showIdentifierLabel:e,type:t,value:n}){return(0,rG.jsxs)(aF.FormLabel,{className:uM.secondaryIdentifier,id:`patient-banner-identifier-${n}`,children:[e&&(0,rG.jsxs)("span",{className:uM.label,children:[t?.text,": "]}),(0,rG.jsx)("span",{className:uM.value,children:n})]})}function uD({identifiers:e,showIdentifierLabel:t}){let{excludePatientIdentifierCodeTypes:n}=iT(),{primaryIdentifierCode:o}=au(),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:uM.identifier,children:n?.coding?.[0]?.code===o?(0,rG.jsx)(uL,{showIdentifierLabel:t,type:n,value:e}):(0,rG.jsx)(uW,{showIdentifierLabel:t,type:n,value:e})}),i<r.length-1&&(0,rG.jsx)("span",{className:uM.separator,children:"\xb7"})]},e)):""})}let uU={Female:sS,Male:sj,Other:sk,Unknown:sN},uB=({gender:e})=>{let t=uU[e];return t?(0,rG.jsx)(t,{fill:"#525252"}):null},uF={male:"Male",female:"Female",other:"Other",unknown:"Unknown"};function uH({patient:e,renderedFrom:t}){var n;let o,r,i=uP(e),a=e?.gender&&(r=uF[o=(n=e.gender).toLowerCase()]??"Unknown",{displayText:tm(o,n),iconKey:r}),s=(0,rF.useMemo)(()=>({patientUuid:e.id,patient:e,renderedFrom:t}),[e.id,e,t]);return(0,rG.jsxs)("div",{className:uM.patientInfo,children:[(0,rG.jsx)("div",{className:aL()(uM.row,uM.patientNameRow),children:(0,rG.jsxs)("div",{className:uM.flexRow,children:[(0,rG.jsx)("span",{className:uM.patientName,children:i}),a&&(0,rG.jsxs)("div",{className:uM.gender,children:[(0,rG.jsx)(uB,{gender:a.iconKey}),(0,rG.jsx)("span",{children:a.displayText})]}),(0,rG.jsx)(r4,{className:uM.tagsSlot,name:"patient-banner-tags-slot",state:s})]})}),(0,rG.jsxs)("div",{className:uM.demographics,children:[e.birthDate&&(0,rG.jsxs)(rG.Fragment,{children:[(0,rG.jsx)("span",{children:u$(e.birthDate)}),(0,rG.jsx)("span",{className:uM.separator,children:"\xb7"}),(0,rG.jsx)("span",{children:l9(e.birthDate,{time:!1,noToday:!0})}),(0,rG.jsx)("span",{className:uM.separator,children:"\xb7"})]}),(0,rG.jsx)(uD,{identifiers:e.identifier,showIdentifierLabel:!0}),(0,rG.jsx)(r4,{className:uM.extensionSlot,name:"patient-banner-bottom-slot",state:s})]})]})}var uV=n(7683);function uG({patient:e,patientUuid:t,actionsSlotName:n,additionalActionsSlotState:o}){let[r,i]=(0,rF.useState)(!1),{extensions:a}=r8(n),s="tablet"===i4(),l=ao(()=>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===a.length?null:(0,rG.jsx)("div",{className:"-esm-login__patient-banner-actions-menu-module__overflowMenuContainer___lXHHD",children:(0,rG.jsxs)("div",{"data-overflow-menu":!0,className:aL()("cds--overflow-menu",aG),ref:l,children:[(0,rG.jsxs)("button",{className:aL()("cds--btn","cds--btn--ghost","cds--overflow-menu__trigger",{"cds--overflow-menu--open":r},aJ),"aria-controls":f,"aria-expanded":r,"aria-haspopup":"true",id:m,onClick:p,onKeyDown:h,ref:c,children:[(0,rG.jsx)("span",{className:"-esm-login__patient-banner-actions-menu-module__actionsButtonText___SdOyM",children:tm("actions","Actions")})," ",(0,rG.jsx)(uV.CH,{size:16,style:{marginLeft:"0.5rem",fill:"#78A9FF"}})]}),(0,rG.jsxs)("div",{className:aL()("cds--overflow-menu-options","cds--overflow-menu--flip",az,{[aq]: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:aL()("cds--overflow-menu-options__content",{"cds--overflow-menu-options--lg":s}),children:(0,rG.jsx)(r4,{name:n,state:w},n)}),(0,rG.jsx)("span",{})]})]})})}var uz=n(397),uq=n.n(uz);function uJ(e){let{patientPhotoConceptUuid:t}=iT({externalModuleName:"@openmrs/esm-styleguide"}),n=t?`${tk}/obs?patient=${e}&concept=${t}&v=full`:null,{data:o,error:r,isLoading:i}=ir()(e?n:null,tP),a=o?.data?.results[0];return{data:a?{dateTime:a?.obsDatetime,imageSrc:a?.value?.links?.uri}:null,error:r,isLoading:i}}let uK=({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"})]})},uX="-esm-login__patient-photo-module__avatar___t5TmZ";function uY({patientUuid:e,patientName:t,alt:n}){let{data:o,isLoading:r}=uJ(e),[i,a]=(0,rF.useState)(null),[s,l]=(0,rF.useState)(!1),c=(0,rF.useMemo)(()=>uq().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||(a(e),l(!1))},n.onerror=()=>{t||(a(null),l(!1))},n.src=e,()=>{t=!0}}a(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||s?(0,rG.jsx)(aF.SkeletonIcon,{className:"-esm-login__patient-photo-module__skeleton___ueN8Q","data-testid":"skeleton-icon"}):o?.imageSrc&&!i?(0,rG.jsx)(uK,{"aria-label":tm("patientPhotoPlaceholder","Photo placeholder for {{patientName}}",{patientName:t})}):i?(0,rG.jsx)("div",{"aria-label":u,children:(0,rG.jsx)("img",{className:uX,src:i,alt:u,title:t})}):(0,rG.jsx)("div",{"aria-label":u,children:(0,rG.jsx)("div",{className:uX,title:t,style:{backgroundImage:c.toDataUrl(),backgroundRepeat:"no-repeat",backgroundSize:"cover"},children:(0,rG.jsx)("span",{className:"-esm-login__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 uZ=["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"],uQ=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,rG.jsx)(dE,{ref:t,pictogram:"omrs-pict-appointments",pictogramProps:e})})),u0=uQ,u1=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,rG.jsx)(dE,{ref:t,pictogram:"omrs-pict-assessment-1",pictogramProps:e})})),u2=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,rG.jsx)(dE,{ref:t,pictogram:"omrs-pict-assessment-2",pictogramProps:e})})),u5=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,rG.jsx)(dE,{ref:t,pictogram:"omrs-pict-blood-bank",pictogramProps:e})})),u6=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,rG.jsx)(dE,{ref:t,pictogram:"omrs-pict-cardiology",pictogramProps:e})})),u8=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,rG.jsx)(dE,{ref:t,pictogram:"omrs-pict-cohorts",pictogramProps:e})})),u3=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,rG.jsx)(dE,{ref:t,pictogram:"omrs-pict-concept-dictionary",pictogramProps:e})})),u4=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,rG.jsx)(dE,{ref:t,pictogram:"omrs-pict-ct-scan",pictogramProps:e})})),u7=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,rG.jsx)(dE,{ref:t,pictogram:"omrs-pict-data-entry",pictogramProps:e})})),u9=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,rG.jsx)(dE,{ref:t,pictogram:"omrs-pict-dentistry",pictogramProps:e})})),de=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,rG.jsx)(dE,{ref:t,pictogram:"omrs-pict-digital-trust",pictogramProps:e})})),dt=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,rG.jsx)(dE,{ref:t,pictogram:"omrs-pict-emergency-department",pictogramProps:e})})),dn=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,rG.jsx)(dE,{ref:t,pictogram:"omrs-pict-facility",pictogramProps:e})})),dr=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,rG.jsx)(dE,{ref:t,pictogram:"omrs-pict-geriatrics",pictogramProps:e})})),di=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,rG.jsx)(dE,{ref:t,pictogram:"omrs-pict-gynaecology",pictogramProps:e})})),da=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,rG.jsx)(dE,{ref:t,pictogram:"omrs-pict-in-patient",pictogramProps:e})})),ds=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,rG.jsx)(dE,{ref:t,pictogram:"omrs-pict-laboratory",pictogramProps:e})})),dl=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,rG.jsx)(dE,{ref:t,pictogram:"omrs-pict-labs-2",pictogramProps:e})})),dc=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,rG.jsx)(dE,{ref:t,pictogram:"omrs-pict-metadata-export",pictogramProps:e})})),du=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,rG.jsx)(dE,{ref:t,pictogram:"omrs-pict-obstetrics",pictogramProps:e})})),dd=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,rG.jsx)(dE,{ref:t,pictogram:"omrs-pict-patient-documents",pictogramProps:e})})),dm=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,rG.jsx)(dE,{ref:t,pictogram:"omrs-pict-patient-search",pictogramProps:e})})),df=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,rG.jsx)(dE,{ref:t,pictogram:"omrs-pict-patients",pictogramProps:e})})),dp=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,rG.jsx)(dE,{ref:t,pictogram:"omrs-pict-payments-desk",pictogramProps:e})})),dg=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,rG.jsx)(dE,{ref:t,pictogram:"omrs-pict-pharmacy",pictogramProps:e})})),dh=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,rG.jsx)(dE,{ref:t,pictogram:"omrs-pict-pharmacy-2",pictogramProps:e})})),dw=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,rG.jsx)(dE,{ref:t,pictogram:"omrs-pict-registration",pictogramProps:e})})),d_=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,rG.jsx)(dE,{ref:t,pictogram:"omrs-pict-reports",pictogramProps:e})})),dy=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,rG.jsx)(dE,{ref:t,pictogram:"omrs-pict-service-queues",pictogramProps:e})})),dv=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,rG.jsx)(dE,{ref:t,pictogram:"omrs-pict-stock-management",pictogramProps:e})})),db=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,rG.jsx)(dE,{ref:t,pictogram:"omrs-pict-system-administration",pictogramProps:e})})),dx=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,rG.jsx)(dE,{ref:t,pictogram:"omrs-pict-transfer",pictogramProps:e})})),dS=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,rG.jsx)(dE,{ref:t,pictogram:"omrs-pict-triage",pictogramProps:e})})),dj=(0,rF.memo)((0,rF.forwardRef)(function(e,t){return(0,rG.jsx)(dE,{ref:t,pictogram:"omrs-pict-x-ray",pictogramProps:e})})),dk=dn,dN=df,dC=(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)(iS,{value:r.current,fallback:t,children:(0,rG.jsx)(dE,{ref:o,pictogram:e,pictogramProps:n})})})),dE=(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:aL()("-esm-login__pictograms-module__pictogram___wXX7t",o),height:r,width:r,children:(0,rG.jsx)("use",{href:`#${e}`})})})),dP=({children:e})=>"tablet"===i4()?(0,rG.jsx)(aF.Layer,{children:e}):(0,rG.jsx)(rG.Fragment,{children:e}),dI=({snackbar:e,closeSnackbar:t})=>{let{actionButtonLabel:n="",kind:o="success",onActionButtonClick:r=()=>{},isLowContrast:i="error"!==o,progressActionLabel:a,subtitle:s="",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),y=(0,rF.useCallback)(()=>{setTimeout(t,250)},[t]),v=(0,rF.useCallback)(()=>{_(!0),y()},[y]);return(0,rF.useEffect)(()=>{if(c){let e=setTimeout(v,l);return()=>clearTimeout(e)}},[l,c,v]),(0,rF.useEffect)(()=>{h(!1),window.setTimeout(()=>{h(!0)},0)},[]),(0,rG.jsx)(aF.ActionableNotification,{actionButtonLabel:f,"aria-label":tm("closeSnackbar","Close snackbar"),className:aL()("-esm-login__snackbar-module__slideIn___-oZIt",{"-esm-login__snackbar-module__animated___M2YBU":g,"-esm-login__snackbar-module__slideOut___yEmGT":w}),kind:o,lowContrast:i,onActionButtonClick:()=>{r(),v(),a&&p(a)},onClose:y,statusIconDescription:tm("snackbarNotification","Snackbar notification"),subtitle:s,title:u,...m})},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.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)(dI,{snackbar:e,closeSnackbar:()=>o(e)},e.id))})},dA=new um,dR=0;function dT(e){e&&(0,r7.createRoot)(e).render((0,rG.jsx)(dO,{subject:dA}))}function d$(e){var t;e&&"string"==typeof(t=e.title)&&t.trim().length>0?setTimeout(()=>{dA.next({...e,id:dR++})},0):console.error("showSnackbar must be called with an object having a 'title' property that is a non-empty string")}let dM=({toast:e,closeToast:t})=>{let{description:n,kind:o,critical:r,title:i,actionButtonLabel:a,onActionButtonClick:s=()=>{}}=e,l=(0,rF.useCallback)(()=>{s(),t()},[t,s]);return(0,rG.jsx)("div",{children:(0,rG.jsx)(aF.ActionableNotification,{actionButtonLabel:a,kind:o||"info",lowContrast:r,subtitle:n,title:i||"",onActionButtonClick:l,onClose:t})})},dL=({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)(dM,{toast:e,closeToast:()=>o(e)},e.id))})},dW=new um,dD=0;function dU(e){e&&(0,r7.createRoot)(e).render((0,rG.jsx)(dL,{subject:dW}))}function dB(e){var t;e&&("string"==typeof(t=e.description)?t.trim().length>0:"object"==typeof t&&!(0,us.A)(t))?setTimeout(()=>{dW.next({...e,id:dD++})},0):console.error("showToast must be called with an object having a 'description' property that is a non-empty string or object")}var dF=n(4656);async function dH(e,t){let{openedGroup:n}=rC.getState();if(n){if(n.groupName===e&&dz(n.props,t))return!0;else if(!await dK({reason:"CLOSE_WORKSPACE_GROUP",explicit:!1}))return!1}return rC.setState(n=>({...n,openedGroup:{groupName:e,props:t},openedWindows:[]})),!0}async function dV(e){let{openedGroup:t,openedWindows:n}=rC.getState();if(t){if(n.length>0&&!(e||await dK({reason:"CLOSE_WORKSPACE_GROUP",explicit:!0})))return!1;rC.setState(e=>({...e,openedGroup:null,openedWindows:[]}))}return!0}async function dG(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:a}=r,{name:s}=i,l=rP(s);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(a&&(a.groupName!==l.name||!dz(a.props,o)))return!!await dK({reason:"CLOSE_WORKSPACE_GROUP",explicit:!0})&&(rC.setState({...r,openedGroup:{groupName:l.name,props:o},openedWindows:[{windowName:s,openedWorkspaces:[d3(e,t)],props:n,maximized:!1}],isMostRecentlyOpenedWindowHidden:!1}),!0);if(c>=0){let o=r.openedWindows[c],i=r.openedGroup?.props??{},a=r.isMostRecentlyOpenedWindowHidden,{openedWorkspaces:u}=o;if(dz(o.props,n)){let d=u.find(t=>t.workspaceName===e);return d&&dz(d.props,t)?((a||c!==r.openedWindows.length-1)&&rC.setState(d1.restoreWindow(r,s)),!0):!!await dK({reason:"CLOSE_WORKSPACE",explicit:!1,windowName:s,workspaceName:e})&&(rC.setState({...r,openedGroup:{groupName:l.name,props:r?.openedGroup?.props??i},openedWindows:[...r.openedWindows.filter((e,t)=>t!==c),{windowName:s,openedWorkspaces:[d3(e,t)],props:o?.props??n,maximized:!1}],isMostRecentlyOpenedWindowHidden:!1}),!0)}return!!await dK({reason:"CLOSE_WINDOW",explicit:!1,windowName:s})&&(rC.setState({...r,openedGroup:{groupName:l.name,props:i??r?.openedGroup?.props},openedWindows:[...r.openedWindows.filter((e,t)=>t!==c),{windowName:s,openedWorkspaces:[d3(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:s,openedWorkspaces:[d3(e,t)],props:n,maximized:!1}],isMostRecentlyOpenedWindowHidden:!1}),!0):!!await dK({reason:"CLOSE_OTHER_WINDOWS",explicit:!1,windowNameToSpare:i.name})&&(rC.setState({...r,openedGroup:{groupName:l.name,props:o??r?.openedGroup?.props??null},openedWindows:[{windowName:s,openedWorkspaces:[d3(e,t)],props:n,maximized:!1}],isMostRecentlyOpenedWindowHidden:!1}),!0)}function dz(e,t){return null==e||null==t||x(e,t)}function dq(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 dJ(e){return 0===e.length?Promise.resolve(!0):new Promise(t=>{let n=ua("workspace2-close-prompt",{size:"sm",onConfirm:()=>{n(),t(!0)},onCancel:()=>{n(),t(!1)},affectedWorkspaceTitles:e.map(e=>e.title??"")})})}function dK(e){let{openedWindows:t}=rC.getState(),n=[];switch(e.reason){case"CLOSE_WORKSPACE_GROUP":n=t.flatMap(e=>dq(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=dq(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=dq(o,e.workspaceName);break}case"CLOSE_OTHER_WINDOWS":n=t.filter(t=>t.windowName!==e.windowNameToSpare).flatMap(e=>dq(e))}return dJ(n)}function dX(e,t){return dJ(dq(e,t))}function dY(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 dZ(e,t,n,o){let{registeredWorkspacesByName:r}=rC.getState(),i=r[n];if(!i)throw Error(`No workspace named "${n}" registered`);let a=r[t];if(!a)throw Error(`No workspace named "${t}" registered`);if(a.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:s}=e,l=s.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=s.slice(0,l+1);return{...e,openedWorkspaces:[...c,d3(n,o)]}}function dQ(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 d0(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=dQ(r,t,n);if(i===r)return e;let a=[...e.openedWindows];return a[o]=i,{...e,openedWindows:a}}let d1={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=dY(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 a=[...e.openedWindows];return a[i]=dZ(e.openedWindows[i],t,n,o),{...e,openedWindows:a}},setHasUnsavedChanges:(e,t,n)=>d0(e,t,{hasUnsavedChanges:n}),setWorkspaceTitle:(e,t,n)=>d0(e,t,{title:n})};function d2(){return rZ(rC,d1)}let d5=()=>(0,rF.useContext)(ie.i),d6=()=>Object.keys(rC.getState().registeredWorkspacesByName);function d8(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 d3(e,t){return{workspaceName:e,props:t??{},hasUnsavedChanges:!1,uuid:(0,dF.A)()}}function d4(e,t,n){let o=rC.getState().registeredWorkspacesByName[e];return o?{windowName:o.window,openedWorkspaces:[d3(e,t)],props:n??null,maximized:!1}:null}let d7=({title:e,children:t,hasUnsavedChanges:n=!1})=>{let{setHasUnsavedChanges:o,setWorkspaceTitle:r}=d5();return(0,rF.useEffect)(()=>{o(n??!1)},[n,o]),(0,rF.useEffect)(()=>{r(e)},[e,r]),(0,rG.jsx)(rG.Fragment,{children:t})};var d9=n(1820),me=n(3173),mt=n(185);let mn={workspaceOuterContainer:"-esm-login__workspace2-module__workspaceOuterContainer___bPVpy",narrowWorkspace:"-esm-login__workspace2-module__narrowWorkspace___kSYS7",widerWorkspace:"-esm-login__workspace2-module__widerWorkspace___nW2HB",extraWideWorkspace:"-esm-login__workspace2-module__extraWideWorkspace___em5yA",workspaceMiddleContainer:"-esm-login__workspace2-module__workspaceMiddleContainer___Bx1i6",maximized:"-esm-login__workspace2-module__maximized___Kfygr",hidden:"-esm-login__workspace2-module__hidden___RPimX",workspaceInnerContainer:"-esm-login__workspace2-module__workspaceInnerContainer___5zxpt",workspaceSpacer:"-esm-login__workspace2-module__workspaceSpacer___E+982",loader:"-esm-login__workspace2-module__loader___vmBQn",hiddenExtraWorkspace:"-esm-login__workspace2-module__hiddenExtraWorkspace___qkbMG",header:"-esm-login__workspace2-module__header___IZ-2+",headerButtons:"-esm-login__workspace2-module__headerButtons___81a2N",workspaceContent:"-esm-login__workspace2-module__workspaceContent___eetPy",overlayHeaderSpacer:"-esm-login__workspace2-module__overlayHeaderSpacer___ruc6r",isActionMenuOpened:"-esm-login__workspace2-module__isActionMenuOpened___XgCkc",showActionMenu:"-esm-login__workspace2-module__showActionMenu___sHRt1",marginWorkspaceContent:"-esm-login__workspace2-module__marginWorkspaceContent___TN+S+",workspaceContainerWithActionMenu:"-esm-login__workspace2-module__workspaceContainerWithActionMenu___xLg8e",workspaceFixedContainer:"-esm-login__workspace2-module__workspaceFixedContainer___W9cgZ",workspaceContainerWithoutActionMenu:"-esm-login__workspace2-module__workspaceContainerWithoutActionMenu___fRrxd"},mo=e=>e.registeredWorkspacesByName,mr=({lifeCycle:e,openedWorkspace:t,openedWindow:n,groupProps:o,actions:r,renderChrome:i,isRootWorkspace:a,isLeafWorkspace:s,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:a}=n,s=a.findIndex(e=>e.workspaceName===i);-1===s||s!==a.length-1&&a.slice(s+1).some(e=>e.hasUnsavedChanges)&&!await r.promptForClosingWorkspaces(a[s+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:a,isLeafWorkspace:s,windowName:n.windowName,showActionMenu:l},[t,n,o,r,a,s,l]),u=!i&&!s,d=(0,rF.useMemo)(()=>e?(0,rG.jsx)(d9.A,{config:e,mountParcel:rU,wrapWith:"div",wrapClassName:aL()(mn.workspaceContent,{[mn.hiddenExtraWorkspace]:u}),...c},t.workspaceName):null===e?(0,rG.jsx)("div",{className:aL()(mn.workspaceContent,{[mn.hiddenExtraWorkspace]:u}),children:(0,rG.jsx)(aF.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)(mi,{openedWorkspace:t,openedWindow:n,isRootWorkspace:a,showActionMenu:l,closeWindow:()=>c.closeWorkspace({closeWindow:!0}),children:d})}):d??(0,rG.jsx)(aF.InlineLoading,{className:aL()(mn.loader,{[mn.hiddenExtraWorkspace]:u}),description:`${tm("loading")}`})},mi=({openedWorkspace:e,openedWindow:t,isRootWorkspace:n,showActionMenu:o,closeWindow:r,children:i})=>{let a=i4(),{openedGroup:s,openedWindows:l,registeredWindowsByName:c,registeredWorkspacesByName:u,registeredGroupsByName:d,isMostRecentlyOpenedWindowHidden:m,setWindowMaximized:f,hideWindow:p}=d2(),g=t.windowName,{maximized:h}=t,w=e.title??"",_=c[g],y=d8(t,u,c),v=_?.icon,b=_?.canMaximize,x=!!s&&d[s.groupName]?.persistence==="closable",S=!!v&&!x,j=l.findIndex(e=>e.windowName===g)<l.length-1||m,k=Object.values(c).some(e=>e.group===s?.groupName&&void 0!==e.icon);return(0,rG.jsxs)("div",{className:aL()(mn.workspaceOuterContainer,{[mn.narrowWorkspace]:"narrow"===y,[mn.widerWorkspace]:"wider"===y,[mn.extraWideWorkspace]:"extra-wide"===y,[mn.isActionMenuOpened]:k}),children:[(0,rG.jsx)("div",{className:aL()(mn.workspaceSpacer,{[mn.hidden]:j})}),(0,rG.jsx)("div",{className:aL()(mn.workspaceMiddleContainer,{[mn.maximized]:h,[mn.hidden]:j,[mn.isRootWorkspace]:n,[mn.showActionMenu]:o}),children:(0,rG.jsx)("div",{className:aL()(mn.workspaceInnerContainer,{[mn.maximized]:h,[mn.hidden]:j,[mn.isRootWorkspace]:n}),children:i?(0,rG.jsxs)(rG.Fragment,{children:[(0,rG.jsxs)(aF.Header,{"aria-label":tm("workspaceHeader"),className:mn.header,children:[(0,rG.jsx)(aF.HeaderName,{prefix:"",children:w}),(0,rG.jsx)("div",{className:mn.overlayHeaderSpacer}),(0,rG.jsx)(aF.HeaderGlobalBar,{className:mn.headerButtons,children:i7(a)?(0,rG.jsxs)(rG.Fragment,{children:[(b||h)&&(0,rG.jsx)(aF.HeaderGlobalAction,{"aria-label":h?tm("minimize"):tm("maximize"),onClick:()=>f(g,!h),children:h?(0,rG.jsx)(me.Xj,{}):(0,rG.jsx)(me.hz,{})}),S&&(0,rG.jsx)(aF.HeaderGlobalAction,{"aria-label":tm("hide"),onClick:()=>p(),children:(0,rG.jsx)(a8,{})}),!x&&(0,rG.jsx)(aF.HeaderGlobalAction,{"aria-label":tm("close"),onClick:r,children:(0,rG.jsx)(sf,{})})]}):(0,rG.jsxs)(rG.Fragment,{children:[S&&(0,rG.jsx)(aF.HeaderGlobalAction,{"aria-label":tm("hide"),onClick:()=>p(),children:(0,rG.jsx)(mt.d3,{})}),(0,rG.jsx)(aF.HeaderGlobalAction,{"aria-label":tm("close"),onClick:()=>{x?dV():r()},children:(0,rG.jsx)(sf,{})})]})})]}),i]}):(0,rG.jsx)(aF.InlineLoading,{className:mn.loader,description:`${tm("loading")} ...`})})})]})},ma=({openedWindow:e,groupProps:t,actions:n,renderChrome:o,showActionMenu:r})=>{let{openedWorkspaces:i}=e,[a,s]=(0,rF.useState)({}),l=rY(rC,mo),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 ak(o,r)]}catch(n){return e||c.current.has(t.uuid)||(c.current.add(t.uuid),y(n)),[t.uuid,null]}})).then(t=>{e||s(Object.fromEntries(t.filter(e=>null!=e)))},y),()=>{e=!0}},[i,l]),(0,rG.jsx)(rG.Fragment,{children:i.map((s,l)=>(0,rG.jsx)(mr,{openedWorkspace:s,openedWindow:e,groupProps:t,actions:n,renderChrome:o,lifeCycle:a[s.uuid],isRootWorkspace:0===l,isLeafWorkspace:l===i.length-1,showActionMenu:r},s.uuid))})},ms=e=>e.registeredWorkspacesByName,ml=({name:e,workspaceProps:t,windowProps:n,groupProps:o,onWindowChanged:r})=>{let i=rY(rC,ms),a=rY(rC,t=>{let n=t.registeredWorkspacesByName[e]?.window;return n?t.registeredWindowsByName[n]:void 0}),s={name:e,workspaceProps:t,windowProps:n,groupProps:o},l=(0,rF.useRef)(),c=(0,rF.useRef)(null);if(!l.current){let r=d4(e,t,n);l.current=T({openedWindow:r,groupProps:o??null}),r&&(c.current=s)}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=d4(e,t,n);u.setState({openedWindow:i,groupProps:o??null},!0),c.current=i?s: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=>dY(t,e))},openChildWorkspace(e,n,o){t(t=>dZ(t,e,n,o))},setWorkspaceTitle(e,n){t(t=>dQ(t,e,{title:n}))},setHasUnsavedChanges(e,n){t(t=>dQ(t,e,{hasUnsavedChanges:n}))},promptForClosingWorkspaces(t){let{openedWindow:n}=e.getState();return n?dX(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,_=a?.width??"narrow",y=(0,rF.useRef)(r);return(0,rF.useEffect)(()=>{y.current=r}),(0,rF.useEffect)(()=>{y.current?.({workspaceName:g,windowWidth:_,title:h,hasUnsavedChanges:w})},[g,_,h,w]),(0,rG.jsx)("div",{className:"-esm-login__exported-workspace-module__exportedWorkspace___7PE0H",children:m?(0,rG.jsx)(ma,{openedWindow:m,groupProps:f,actions:d,renderChrome:!1,showActionMenu:!1}):null})},mc="-esm-login__action-menu-button2-module__container___jc6--",mu="-esm-login__action-menu-button2-module__elementContainer___whLL8",md="-esm-login__action-menu-button2-module__active___fbyFm",mm="-esm-login__action-menu-button2-module__focused___+aVpz";function mf({getIcon:e,hasUnsavedChanges:t,tagContent:n}){return(0,rG.jsxs)(rG.Fragment,{children:[e({size:16}),t?(0,rG.jsx)("span",{className:"-esm-login__action-menu-button2-module__interruptedTag___sRkvS",children:"!"}):(0,rG.jsx)("span",{className:"-esm-login__action-menu-button2-module__countTag___XMH0D",children:n})]})}let mp=({icon:e,label:t,tagContent:n,workspaceToLaunch:o,onBeforeWorkspaceLaunch:r,hidden:i,disabled:a})=>{let s=i4(),{openedWindows:l,restoreWindow:c,hideWindow:u,isMostRecentlyOpenedWindowHidden:d}=d2(),{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,y=async()=>{if(g)h?c(p.windowName):u();else if(await (r?.()??!0)){let{workspaceName:e,workspaceProps:t,windowProps:n}=o;dG(e,t,n)}};return i?.(l)?null:"tablet"===s||"phone"===s?(0,rG.jsxs)(aF.Button,{className:aL()(mc,{[md]:g&&!w,[mm]:w}),iconDescription:t,kind:"ghost",onClick:y,role:"button",tabIndex:0,size:"md",disabled:a?.(l),children:[(0,rG.jsx)("span",{className:mu,children:(0,rG.jsx)(mf,{hasUnsavedChanges:_,getIcon:e,tagContent:n})}),(0,rG.jsx)("span",{children:t})]}):(0,rG.jsx)(aF.IconButton,{align:"left","aria-label":t,className:aL()(mc,{[md]:g&&!w,[mm]:w}),enterDelayMs:300,kind:"ghost",label:t,onClick:y,size:"md",disabled:a?.(l),children:(0,rG.jsx)("div",{className:mu,children:(0,rG.jsx)(mf,{hasUnsavedChanges:_,getIcon:e,tagContent:n})})})};function mg({showContactDetails:e,toggleContactDetails:t,className:n}){return(0,rG.jsx)(aF.Button,{className:n,iconDescription:"Toggle contact details",kind:"ghost",onClick:t,renderIcon:e?sm:sc,children:e?tm("showLess","Show less"):tm("showMore","Show more")})}let mh={contactDetails:"-esm-login__patient-banner-contact-details-module__contactDetails___R7vfY",deceased:"-esm-login__patient-banner-contact-details-module__deceased___nTt+l",heading:"-esm-login__patient-banner-contact-details-module__heading___x7UoT",row:"-esm-login__patient-banner-contact-details-module__row___qFgIi",col:"-esm-login__patient-banner-contact-details-module__col___JXUlg",relationship:"-esm-login__patient-banner-contact-details-module__relationship___T3LO-"},mw=({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}=ir()(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:mh.heading,children:[tm("patientLists","Patient Lists")," (",t?.length??0,")"]}),n?(0,rG.jsx)(aF.InlineLoading,{description:`${tm("loading","Loading")} ...`,role:"progressbar"}):(0,rG.jsxs)("ul",{children:[(()=>{if(t?.length>0){let e=t.sort((e,t)=>l5(e?.startDate).getTime()-l5(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:mh.link,children:(0,rG.jsx)(rz,{to:`${window.spaBase}/home/patient-lists`,children:tm("seeMoreLists","See {{count}} more lists",{count:t?.length-3})})})]})]})},m_=({patientId:e})=>{let{patient:t,isLoading:n}=ac(e),o=t?.address?.find(e=>"home"===e.use),r=e=>e.split("#")[1];return n?(0,rG.jsx)(aF.InlineLoading,{description:`${tm("loading","Loading")} ...`,role:"progressbar"}):(0,rG.jsxs)(rG.Fragment,{children:[(0,rG.jsx)("p",{className:mh.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:"--"})})]})},my=({patientUuid:e})=>{let{isLoading:t,contactAttributes:n}=(e=>{let{contactAttributeTypes:t=[]}=iT({externalModuleName:"@openmrs/esm-patient-banner-app"}),{attributes:n,error:o,isLoading:r}=(e=>{let{data:t,error:n,isLoading:o}=iW()(`${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:mh.heading,children:tm("contactDetails","Contact Details")}),t?(0,rG.jsx)(aF.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:"--"})})]})},mv=({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}=ir()(e?t:null,tP),a=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?a:null,error:o,isLoading:r,isValidating:i}}(e);return(0,rG.jsxs)(rG.Fragment,{children:[(0,rG.jsx)("p",{className:mh.heading,children:tm("relationships","Relationships")}),n?(0,rG.jsx)(aF.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:mh.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 mb({patientId:e,deceased:t}){return(0,rG.jsxs)("div",{className:aL()(mh.contactDetails,{[mh.deceased]:t}),children:[(0,rG.jsxs)("div",{className:mh.row,children:[(0,rG.jsx)("div",{className:mh.col,children:(0,rG.jsx)(m_,{patientId:e})}),(0,rG.jsx)("div",{className:mh.col,children:(0,rG.jsx)(my,{patientUuid:e})})]}),(0,rG.jsxs)("div",{className:mh.row,children:[(0,rG.jsx)("div",{className:mh.col,children:(0,rG.jsx)(mv,{patientId:e})}),(0,rG.jsx)("div",{className:mh.col,children:(0,rG.jsx)(mw,{patientUuid:e})})]})]})}function mx(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 mS="-esm-login__action-menu2-module__container___6Gke0";function mj({workspaceGroup:e,groupProps:t}){let n=i4(),{persistence:o}=e;return(0,rG.jsx)("aside",{className:"-esm-login__action-menu2-module__sideRail___T2lMV",children:(0,rG.jsxs)("div",{className:mS,children:["closable"==o&&i7(n)&&(0,rG.jsx)(aF.IconButton,{align:"left",onClick:()=>dV(),label:tm("close"),kind:"ghost",children:(0,rG.jsx)(sf,{})}),(0,rG.jsx)(rV.Provider,{value:{moduleName:e.moduleName,featureName:e.name},children:(0,rG.jsx)(r4,{className:mS,name:e.name,state:{groupProps:t}})})]})})}function mk(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 mN(e){e&&(0,r7.createRoot)(e).render((0,rG.jsx)(mC,{}))}function mC(){let{openedGroup:e,openedWindows:t,registeredGroupsByName:n,registeredWindowsByName:o}=d2();if((0,rF.useEffect)(()=>nG("before-page-changed",t=>{let{newPage:o,cancelNavigation:r,oldUrl:i,newUrl:a}=t;if(!e)return;if(o)return void r(dV().then(e=>!e));let s=n[e.groupName],l=s?.scopePattern;l&&function(e,t,n){try{let o=new RegExp(e),r=mk(t),i=mk(n);if(null===r.spaRelative||null===i.spaRelative)return!0;let a=o.exec(r.spaRelative),s=o.exec(i.spaRelative);if(a&&s||(a=o.exec(r.full),s=o.exec(i.full)),!a||!s)return!0;if(a.length>1)return!a.slice(1).every((e,t)=>e===s[t+1]);return!1}catch{return!0}}(l,i,a)&&r(dV().then(e=>!e))}),[e,n]),!e)return null;let r=n[e.groupName],i=t.some(e=>e.maximized),{name:a}=r,s=Object.values(o).filter(e=>e.group===a&&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:aL()("-esm-login__workspace-windows-and-menu-module__workspaceWindowsAndMenuContainer___2u2mc",{"-esm-login__workspace-windows-and-menu-module__overlay___7RHYZ":r.overlay,"-esm-login__workspace-windows-and-menu-module__hasMaximizedWindow___gvJRd":i}),children:[(0,rG.jsx)("div",{className:"-esm-login__workspace-windows-and-menu-module__workspaceWindowsContainer___40ITO",children:t.map(t=>(0,rG.jsx)(mE,{openedWindow:t,groupProps:e.props,showActionMenu:s},t.windowName))}),s&&(0,rG.jsx)(mj,{workspaceGroup:r,groupProps:e.props})]})}function mE({openedWindow:e,groupProps:t,showActionMenu:n}){let{windowName:o}=e,r=(0,rF.useMemo)(()=>({closeWorkspace(e){rC.setState(t=>d1.closeWorkspace(t,e))},openChildWorkspace(e,t,n){rC.setState(o=>d1.openChildWorkspace(o,e,t,n))},setWorkspaceTitle(e,t){rC.setState(n=>d1.setWorkspaceTitle(n,e,t))},setHasUnsavedChanges(e,t){rC.setState(n=>d1.setHasUnsavedChanges(n,e,t))},promptForClosingWorkspaces(e){let t=rC.getState().openedWindows.find(e=>e.windowName===o);return t?dX(t,e):Promise.resolve(!0)}}),[o]);return(0,rG.jsx)(ma,{openedWindow:e,groupProps:t,actions:r,renderChrome:!0,showActionMenu:n})}function mP(e,t,n){if(null==e)return n;let o=lF(e);if(!o)return console.warn(`matchLocale: invalid requested locale tag: ${JSON.stringify(e)}`),n;let r=[];for(let e of t){let t=lF(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 a=(i=i.slice(0,o)).lastIndexOf("-");-1!==a&&i.length-a==2&&(i=i.slice(0,a))}return n}function mI(e=window.localStorage){try{return e.getItem("test"),!0}catch{return!1}}function mO(e){return!!e&&e.constructor===Object}var mA=n(3376);function mR(e){let[t,n,o]=e.split(".");return`${t}.${n}.${o}`}function mT(e,t){return mA(function(e){let t=e.indexOf("-");if(t>=0){let n=mR(e.slice(0,t)),o=e.slice(t+1);return`${n}-${o}`}return mR(e)}(t),e,{includePrerelease:!0})}async function m$(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 a=0;do try{return await mM(r(a)),await e()}catch(e){i?.(e,a),n=e}while(o(a++));throw n}async function mM(e){if(!(e<=0))return new Promise(t=>setTimeout(t,e))}function mL(e,t,n,o){}function mW(e){}function mD(e){return Promise.resolve([])}function mU(e){return Promise.resolve([])}function mB(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 mF(e){return()=>{}}function mH(){return!0}}}]);