@openmrs/esm-fast-data-entry-app 1.5.1-pre.804 → 1.5.1-pre.806

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/1100.js CHANGED
@@ -40,4 +40,4 @@ To fix this, ensure that you define the "component" field inside the page defini
40
40
  * {
41
41
  overscroll-behavior: contain;
42
42
  }
43
- }`.trim(),document.head.prepend(a),o=HTMLElement.prototype.focus,HTMLElement.prototype.focus=function(e){let t=((e=document)=>e.activeElement)(),n=null!=t&&$z(t);o.call(this,{...e,preventScroll:!0}),e&&e.preventScroll||$I(this,n)},i=hX($B(document,"touchstart",t=>{let a=mS(t);e=bI(a)?a:bN(a,!0),n=!1;let r=a.ownerDocument.defaultView.getSelection();r&&!r.isCollapsed&&r.containsNode(a,!0)&&(n=!0),t.composedPath().some(e=>e instanceof HTMLInputElement&&"range"===e.type)&&(n=!0),"selectionStart"in a&&"selectionEnd"in a&&a.selectionStart<a.selectionEnd&&a.ownerDocument.activeElement===a&&(n=!0)},{passive:!1,capture:!0}),$B(document,"touchmove",t=>{if(2!==t.touches.length&&!n){if(!e||e===document.documentElement||e===document.body)return void t.preventDefault();e.scrollHeight===e.clientHeight&&e.scrollWidth===e.clientWidth&&t.preventDefault()}},{passive:!1,capture:!0}),$B(document,"blur",e=>{let t=mS(e),n=e.relatedTarget;if(n&&$z(n))n.focus({preventScroll:!0}),$I(n,$z(t));else if(!n){let e=t.parentElement?.closest("[tabindex]");e?.focus({preventScroll:!0})}},!0)),()=>{t(),i(),a.remove(),HTMLElement.prototype.focus=o}):hX((s=window.innerWidth-document.documentElement.clientWidth)>0&&("scrollbarGutter"in document.documentElement.style?$T(document.documentElement,"scrollbarGutter","stable"):$T(document.documentElement,"paddingRight",`${s}px`)),$T(document.documentElement,"overflow","hidden"))),()=>{0==--$P&&c()}}},[t])}({isDisabled:o||!t.isOpen}),(0,uq.useEffect)(()=>{if(t.isOpen&&a.current)if(o){var e,n,i=r?.current??a.current;let t=$i[$i.length-1];return t&&!t.visibleNodes.has(i)?(t.visibleNodes.add(i),()=>{t.visibleNodes.delete(i)}):void 0}else{let t,o,i,s,l,c,u,p,d,f,h;return e=[r?.current??a.current],o=(n={shouldUseInert:!0})instanceof(t=mC(e?.[0])).Element?{root:n}:n,i=o?.root??document.body,s=o?.shouldUseInert&&$r,l=new Set(e),c=new Set,u=(e,n)=>{s&&e instanceof t.HTMLElement?e.inert=n:n?e.setAttribute("aria-hidden","true"):(e.removeAttribute("aria-hidden"),e instanceof t.HTMLElement&&(e.inert=!1))},p=e=>{for(let t of e.querySelectorAll("[data-live-announcer], [data-react-aria-top-layer]"))l.add(t);let t=e=>{if(c.has(e)||l.has(e)||e.parentElement&&c.has(e.parentElement)&&"row"!==e.parentElement.getAttribute("role"))return NodeFilter.FILTER_REJECT;for(let t of l)if(mE(e,t))return NodeFilter.FILTER_SKIP;return NodeFilter.FILTER_ACCEPT},n=_X(mx(e),e,NodeFilter.SHOW_ELEMENT,{acceptNode:t}),a=t(e);if(a===NodeFilter.FILTER_ACCEPT&&d(e),a!==NodeFilter.FILTER_REJECT){let e=n.nextNode();for(;null!=e;)d(e),e=n.nextNode()}},d=e=>{let n=$o.get(e)??0;(s&&e instanceof t.HTMLElement?e.inert:"true"===e.getAttribute("aria-hidden"))&&0===n||(0===n&&u(e,!0),c.add(e),$o.set(e,n+1))},$i.length&&$i[$i.length-1].disconnect(),p(i),(f=new MutationObserver(e=>{for(let n of e)if("childList"===n.type&&n.target.isConnected&&![...l,...c].some(e=>mE(e,n.target)))for(let e of n.addedNodes){var t;(e instanceof HTMLElement||e instanceof SVGElement)&&("true"===(t=e).dataset.liveAnnouncer||void 0!==t.dataset.reactAriaTopLayer)?l.add(e):e instanceof Element&&p(e)}})).observe(i,{childList:!0,subtree:!0}),h={visibleNodes:l,hiddenNodes:c,observe(){f.observe(i,{childList:!0,subtree:!0})},disconnect(){f.disconnect()}},$i.push(h),()=>{for(let e of(f.disconnect(),c)){let t=$o.get(e);null!=t&&(1===t?(u(e,!1),$o.delete(e)):$o.set(e,t-1))}h===$i[$i.length-1]?($i.pop(),$i.length&&$i[$i.length-1].observe()):$i.splice($i.indexOf(h),1)}}},[o,t.isOpen,a,r]),{popoverProps:mr(p,f),arrowProps:h,underlayProps:d,placement:m,triggerAnchorPoint:g}}({...a,offset:null!=(r=a.offset)?r:8,arrowSize:s,groupRef:d?p:u},e),y=a.popoverRef,b=function(e,t=!0){let[n,a]=(0,uq.useState)(!0),r=n&&t;return hQ(()=>{if(r&&e.current&&"getAnimations"in e.current)for(let t of e.current.getAnimations())t instanceof CSSTransition&&t.cancel()},[e,r]),$F(e,r,(0,uq.useCallback)(()=>a(!1),[])),r}(y,!!g)||a.isEntering||!1,v=ms({...a,defaultClassName:"react-aria-Popover",values:{trigger:a.trigger||null,placement:g,isEntering:b,isExiting:t}}),$=!a.isNonModal||"SubmenuTrigger"===a.trigger,[A,w]=(0,uq.useState)(!1);hQ(()=>{y.current&&w($&&!y.current.querySelector("[role=dialog]"))},[y,$]),(0,uq.useEffect)(()=>{var e;let t,n;A&&y.current&&!y.current.contains(document.activeElement)&&(n=((e=document)=>e.activeElement)(t=mx(e=y.current)),"virtual"===$L?gu(()=>{((e=document)=>e.activeElement)(t)===n&&e.isConnected&&mw(e)}):mw(e))},[A,y]);let k={...f.style,...v.style},x=uH().createElement("div",{...mr(mA(a),f),...v,role:A?"dialog":void 0,tabIndex:A?-1:void 0,"aria-label":a["aria-label"],"aria-labelledby":a["aria-labelledby"],ref:y,slot:a.slot||void 0,style:k,dir:a.dir,"data-trigger":a.trigger,"data-placement":g,"data-entering":b||void 0,"data-exiting":t||void 0},!a.isNonModal&&uH().createElement($R,{onDismiss:e.close}),uH().createElement($a.Provider,{value:{...m,placement:g,ref:i}},v.children),uH().createElement($R,{onDismiss:e.close}));return d?uH().createElement(v3,{...a,shouldContainFocus:A,isExiting:t,portalContainer:null!=(o=null!=n?n:null==p?void 0:p.current)?o:void 0},x):uH().createElement(v3,{...a,shouldContainFocus:A,isExiting:t,portalContainer:n},!a.isNonModal&&e.isOpen&&uH().createElement("div",{"data-testid":"underlay",...h,style:{position:"fixed",inset:0}}),uH().createElement("div",{ref:u,style:{display:"contents"}},uH().createElement($2.Provider,{value:u},x)))}function $5(e){return e?.start!=null&&null!=e.end}let $6=(0,uq.createContext)(null),$8=(0,uq.createContext)(null),$7=(0,uq.createContext)(null),$9=(0,uq.createContext)(null),Ae=(0,uq.forwardRef)(function(e,t){var n,a;[e,t]=mc(e,t,$6);let{validationBehavior:r}=ml($e)||{},o=null!=(a=null!=(n=e.validationBehavior)?n:r)?a:"native",i=function(e){let t=$0(e),[n,a]=_M(e.value,e.defaultValue||null,e.onChange),[r]=(0,uq.useState)(n),o=n||e.placeholderValue||null,[i,s]=vj(o,e.granularity),l=null!=n?n.toDate(s??"UTC"):null,c="hour"===i||"minute"===i||"second"===i,u=e.shouldCloseOnSelect??!0,[p,d]=(0,uq.useState)(null),[f,h]=(0,uq.useState)(null);if(n&&(p=n,"hour"in n&&(f=n)),o&&!(i in o))throw Error("Invalid granularity "+i+" for value "+o.toString());let m=n?.calendar.identifier==="gregory"&&"BC"===n.era,g=(0,uq.useMemo)(()=>({granularity:i,timeZone:s,hideTimeZone:e.hideTimeZone,hourCycle:e.hourCycle,shouldForceLeadingZeros:e.shouldForceLeadingZeros,showEra:m}),[i,e.hourCycle,e.shouldForceLeadingZeros,s,e.hideTimeZone,m]),{minValue:y,maxValue:b,isDateUnavailable:v}=e,$=(0,uq.useMemo)(()=>vO(n,y,b,v,g),[n,y,b,v,g]),A=vx({...e,value:n,builtinValidation:$}),w=A.displayValidation.isInvalid,k=e.validationState||(w?"invalid":null),x=(e,t)=>{a("timeZone"in t?t.set(ba(e)):br(e,t)),d(null),h(null),A.commitValidation()};return{...A,value:n,defaultValue:e.defaultValue??r,setValue:a,dateValue:p,timeValue:f,setDateValue:n=>{let r="function"==typeof u?u():u;c?f||r?x(n,f||vI(e.defaultValue||e.placeholderValue)):d(n):(a(n),A.commitValidation()),r&&t.setOpen(!1)},setTimeValue:e=>{p&&e?x(p,e):h(e)},granularity:i,hasTime:c,...t,setOpen(a){!a&&!n&&p&&c&&x(p,f||vI(e.defaultValue||e.placeholderValue)),t.setOpen(a)},validationState:k,isInvalid:w,formatValue:(e,t)=>l?new yd(e,vB(t,g)).format(l):"",getDateFormatter:(e,t)=>new yd(e,vB({},{...g,...t}))}}({...e,validationBehavior:o}),s=(0,uq.useRef)(null),[l,c]=mu(!e["aria-label"]&&!e["aria-labelledby"]),{groupProps:u,labelProps:p,fieldProps:d,buttonProps:f,dialogProps:h,calendarProps:m,descriptionProps:g,errorMessageProps:y,...b}=function(e,t,n){var a;let r=mt(),o=mt(),i=mt(),s=yE((a=vc)&&a.__esModule?a.default:a,"@react-aria/datepicker"),{isInvalid:l,validationErrors:c,validationDetails:u}=t.displayValidation,{labelProps:p,fieldProps:d,descriptionProps:f,errorMessageProps:h}=vd({...e,labelElementType:"span",isInvalid:l,errorMessage:e.errorMessage||c}),m=vu(t,n),g=d["aria-labelledby"]||d.id,{locale:y}=yo(),b=t.formatValue(y,{month:"long"}),v=bG(b?s.format("selectedDateDescription",{date:b}):""),$=[v["aria-describedby"],d["aria-describedby"]].filter(Boolean).join(" ")||void 0,A=mA(e),w=(0,uq.useMemo)(()=>vr(n),[n]),k=(0,uq.useRef)(!1),{focusWithinProps:x}=gL({...e,isDisabled:t.isOpen,onBlurWithin:t=>{mE(document.getElementById(o),t.relatedTarget)||(k.current=!1,e.onBlur?.(t),e.onFocusChange?.(!1))},onFocusWithin:t=>{k.current||(k.current=!0,e.onFocus?.(t),e.onFocusChange?.(!0))}});return{groupProps:mr(A,m,d,v,x,{role:"group","aria-disabled":e.isDisabled||null,"aria-labelledby":g,"aria-describedby":$,onKeyDown(n){!t.isOpen&&e.onKeyDown&&e.onKeyDown(n)},onKeyUp(n){!t.isOpen&&e.onKeyUp&&e.onKeyUp(n)}}),labelProps:{...p,onClick:()=>{w.focusFirst()}},fieldProps:{...d,id:i,[vg]:"presentation","aria-describedby":$,value:t.value,defaultValue:t.defaultValue,onChange:t.setValue,placeholderValue:e.placeholderValue,hideTimeZone:e.hideTimeZone,hourCycle:e.hourCycle,shouldForceLeadingZeros:e.shouldForceLeadingZeros,granularity:e.granularity,isDisabled:e.isDisabled,isReadOnly:e.isReadOnly,isRequired:e.isRequired,validationBehavior:e.validationBehavior,[vk]:t,autoFocus:e.autoFocus,name:e.name,form:e.form},descriptionProps:f,errorMessageProps:h,buttonProps:{...v,id:r,"aria-haspopup":"dialog","aria-label":s.format("calendar"),"aria-labelledby":`${r} ${g}`,"aria-describedby":$,"aria-expanded":t.isOpen,isDisabled:e.isDisabled||e.isReadOnly,onPress:()=>t.setOpen(!0)},dialogProps:{id:o,"aria-labelledby":`${r} ${g}`},calendarProps:{autoFocus:!0,value:t.dateValue,onChange:t.setDateValue,minValue:e.minValue,maxValue:e.maxValue,isDisabled:e.isDisabled,isReadOnly:e.isReadOnly,isDateUnavailable:e.isDateUnavailable,defaultFocusedValue:t.dateValue?void 0:e.placeholderValue,isInvalid:t.isInvalid,errorMessage:"function"==typeof e.errorMessage?e.errorMessage(t.displayValidation):e.errorMessage||t.displayValidation.validationErrors.join(" "),firstDayOfWeek:e.firstDayOfWeek,pageBehavior:e.pageBehavior},isInvalid:l,validationErrors:c,validationDetails:u}}({...mp(e),label:c,validationBehavior:o},i,s),[v,$]=(0,uq.useState)(null),A=(0,uq.useCallback)(()=>{s.current&&$(s.current.offsetWidth+"px")},[]);$C({ref:s,onResize:A});let{focusProps:w,isFocused:k,isFocusVisible:x}=gW({within:!0}),C=ms({...e,values:{state:i,isFocusWithin:k,isFocusVisible:x,isDisabled:e.isDisabled||!1,isInvalid:i.isInvalid,isOpen:i.isOpen},defaultClassName:"react-aria-DatePicker"}),E=mA(e);return delete E.id,uH().createElement(mi,{values:[[$7,i],[_K,{...u,ref:s,isInvalid:i.isInvalid}],[vK,d],[gZ,{...f,isPressed:i.isOpen}],[$t,{...p,ref:l,elementType:"span"}],[_I,m],[v5,i],[$1,{trigger:"DatePicker",triggerRef:s,placement:"bottom start",style:{"--trigger-width":v}}],[v4,h],[g0,{slots:{description:g,errorMessage:y}}],[v8,b]]},uH().createElement("div",{...w,...E,...C,ref:t,slot:e.slot||void 0,"data-focus-within":k||void 0,"data-invalid":i.isInvalid||void 0,"data-focus-visible":x||void 0,"data-disabled":e.isDisabled||void 0,"data-open":i.isOpen||void 0}))}),At=(0,uq.forwardRef)(function(e,t){var n,a;[e,t]=mc(e,t,$8);let{validationBehavior:r}=ml($e)||{},o=null!=(a=null!=(n=e.validationBehavior)?n:r)?a:"native",i=function(e){let t=$0(e),[n,a]=_M(e.value,e.defaultValue||null,e.onChange),[r]=(0,uq.useState)(n),[o,i]=(0,uq.useState)(()=>n||{start:null,end:null});null==n&&o.start&&o.end&&i(o={start:null,end:null});let s=n||o,l=e=>{i(s=e||{start:null,end:null}),$5(s)?a(s):a(null)},[c,u]=vj(s?.start||s?.end||e.placeholderValue||null,e.granularity),p="hour"===c||"minute"===c||"second"===c,d=e.shouldCloseOnSelect??!0,[f,h]=(0,uq.useState)(null),[m,g]=(0,uq.useState)(null);s&&$5(s)&&(f=s,"hour"in s.start&&(m=s));let y=(e,t)=>{l({start:"timeZone"in t.start?t.start.set(ba(e.start)):br(e.start,t.start),end:"timeZone"in t.end?t.end.set(ba(e.end)):br(e.end,t.end)}),h(null),g(null),E.commitValidation()},b=n=>{let a="function"==typeof d?d():d;p?$5(n)&&(a||m?.start&&m?.end)?y(n,{start:m?.start||vI(e.placeholderValue),end:m?.end||vI(e.placeholderValue)}):h(n):$5(n)?(l(n),E.commitValidation()):h(n),a&&t.setOpen(!1)},v=e=>{$5(f)&&$5(e)?y(f,e):g(e)},$=s?.start?.calendar.identifier==="gregory"&&"BC"===s.start.era||s?.end?.calendar.identifier==="gregory"&&"BC"===s.end.era,A=(0,uq.useMemo)(()=>({granularity:c,timeZone:u,hideTimeZone:e.hideTimeZone,hourCycle:e.hourCycle,shouldForceLeadingZeros:e.shouldForceLeadingZeros,showEra:$}),[c,e.hourCycle,e.shouldForceLeadingZeros,u,e.hideTimeZone,$]),{minValue:w,maxValue:k,isDateUnavailable:x}=e,C=(0,uq.useMemo)(()=>{var e;let t;return e=s,t=vD(vO(e?.start??null,w,k,x,A),vO(e?.end??null,w,k,x,A)),e?.end!=null&&null!=e.start&&0>e.end.compare(e.start)&&(t=vD(t,{isInvalid:!0,validationErrors:[(y$.getGlobalDictionaryForPackage("@react-stately/datepicker")||vM).getStringForLocale("rangeReversed",vz())],validationDetails:{...vv,rangeUnderflow:!0,rangeOverflow:!0,valid:!1}})),t},[s,w,k,x,A]),E=vx({...e,value:n,name:(0,uq.useMemo)(()=>[e.startName,e.endName].filter(e=>null!=e),[e.startName,e.endName]),builtinValidation:C}),S=E.displayValidation.isInvalid,D=e.validationState||(S?"invalid":null);return{...E,value:s,defaultValue:e.defaultValue??r,setValue:l,dateRange:f,timeRange:m,granularity:c,hasTime:p,setDate(e,t){"start"===e?b({start:t,end:f?.end??null}):b({start:f?.start??null,end:t})},setTime(e,t){"start"===e?v({start:t,end:m?.end??null}):v({start:m?.start??null,end:t})},setDateTime(e,t){"start"===e?l({start:t,end:s?.end??null}):l({start:s?.start??null,end:t})},setDateRange:b,setTimeRange:v,...t,setOpen(n){!n&&!(s?.start&&s?.end)&&$5(f)&&p&&y(f,{start:m?.start||vI(e.placeholderValue),end:m?.end||vI(e.placeholderValue)}),t.setOpen(n)},validationState:D,isInvalid:S,formatValue(t,n){let a;if(!s||!s.start||!s.end)return null;let r="timeZone"in s.start?s.start.timeZone:void 0,o=e.granularity||(s.start&&"minute"in s.start?"minute":"day"),i="timeZone"in s.end?s.end.timeZone:void 0,l=e.granularity||(s.end&&"minute"in s.end?"minute":"day"),c=vB(n,{granularity:o,timeZone:r,hideTimeZone:e.hideTimeZone,hourCycle:e.hourCycle,showEra:"gregory"===s.start.calendar.identifier&&"BC"===s.start.era||"gregory"===s.end.calendar.identifier&&"BC"===s.end.era}),u=s.start.toDate(r||"UTC"),p=s.end.toDate(i||"UTC"),d=new yd(t,c);if(r===i&&o===l&&0!==s.start.compare(s.end)){try{let e=d.formatRangeToParts(u,p),t=-1;for(let n=0;n<e.length;n++){let a=e[n];if("shared"===a.source&&"literal"===a.type)t=n;else if("endRange"===a.source)break}let n="",a="";for(let r=0;r<e.length;r++)r<t?n+=e[r].value:r>t&&(a+=e[r].value);return{start:n,end:a}}catch{}a=d}else a=new yd(t,vB(n,{granularity:l,timeZone:i,hideTimeZone:e.hideTimeZone,hourCycle:e.hourCycle}));return{start:d.format(u),end:a.format(p)}},getDateFormatter:(e,t)=>new yd(e,vB({},{...A,...t}))}}({...e,validationBehavior:o}),s=(0,uq.useRef)(null),[l,c]=mu(!e["aria-label"]&&!e["aria-labelledby"]),{groupProps:u,labelProps:p,startFieldProps:d,endFieldProps:f,buttonProps:h,dialogProps:m,calendarProps:g,descriptionProps:y,errorMessageProps:b,...v}=function(e,t,n){var a;let r=yE((a=vc)&&a.__esModule?a.default:a,"@react-aria/datepicker"),{isInvalid:o,validationErrors:i,validationDetails:s}=t.displayValidation,{labelProps:l,fieldProps:c,descriptionProps:u,errorMessageProps:p}=vd({...e,labelElementType:"span",isInvalid:o,errorMessage:e.errorMessage||i}),d=c["aria-labelledby"]||c.id,{locale:f}=yo(),h=t.formatValue(f,{month:"long"}),m=bG(h?r.format("selectedRangeDescription",{startDate:h.start,endDate:h.end}):""),g={"aria-label":r.format("startDate"),"aria-labelledby":d},y={"aria-label":r.format("endDate"),"aria-labelledby":d},b=mt(),v=mt(),$=vu(t,n),A=[m["aria-describedby"],c["aria-describedby"]].filter(Boolean).join(" ")||void 0,w=(0,uq.useMemo)(()=>vr(n,{accept:e=>e.id!==b}),[n,b]),k={[vy]:w,[vg]:"presentation","aria-describedby":A,placeholderValue:e.placeholderValue,hideTimeZone:e.hideTimeZone,hourCycle:e.hourCycle,granularity:e.granularity,shouldForceLeadingZeros:e.shouldForceLeadingZeros,isDisabled:e.isDisabled,isReadOnly:e.isReadOnly,isRequired:e.isRequired,validationBehavior:e.validationBehavior},x=mA(e),C=(0,uq.useRef)(!1),{focusWithinProps:E}=gL({...e,isDisabled:t.isOpen,onBlurWithin:t=>{mE(document.getElementById(v),t.relatedTarget)||(C.current=!1,e.onBlur?.(t),e.onFocusChange?.(!1))},onFocusWithin:t=>{C.current||(C.current=!0,e.onFocus?.(t),e.onFocusChange?.(!0))}}),S=(0,uq.useRef)(vA),D=(0,uq.useRef)(vA);return{groupProps:mr(x,$,c,m,E,{role:"group","aria-disabled":e.isDisabled||null,"aria-describedby":A,onKeyDown(n){!t.isOpen&&e.onKeyDown&&e.onKeyDown(n)},onKeyUp(n){!t.isOpen&&e.onKeyUp&&e.onKeyUp(n)}}),labelProps:{...l,onClick:()=>{w.focusFirst()}},buttonProps:{...m,id:b,"aria-haspopup":"dialog","aria-label":r.format("calendar"),"aria-labelledby":`${b} ${d}`,"aria-describedby":A,"aria-expanded":t.isOpen,isDisabled:e.isDisabled||e.isReadOnly,onPress:()=>t.setOpen(!0)},dialogProps:{id:v,"aria-labelledby":`${b} ${d}`},startFieldProps:{...g,...k,value:t.value?.start??null,defaultValue:t.defaultValue?.start,onChange:e=>t.setDateTime("start",e),autoFocus:e.autoFocus,name:e.startName,form:e.form,[vk]:{realtimeValidation:t.realtimeValidation,displayValidation:t.displayValidation,updateValidation(e){S.current=e,t.updateValidation(vD(e,D.current))},resetValidation:t.resetValidation,commitValidation:t.commitValidation}},endFieldProps:{...y,...k,value:t.value?.end??null,defaultValue:t.defaultValue?.end,onChange:e=>t.setDateTime("end",e),name:e.endName,form:e.form,[vk]:{realtimeValidation:t.realtimeValidation,displayValidation:t.displayValidation,updateValidation(e){D.current=e,t.updateValidation(vD(S.current,e))},resetValidation:t.resetValidation,commitValidation:t.commitValidation}},descriptionProps:u,errorMessageProps:p,calendarProps:{autoFocus:!0,value:t.dateRange?.start&&t.dateRange.end?t.dateRange:null,onChange:t.setDateRange,minValue:e.minValue,maxValue:e.maxValue,isDisabled:e.isDisabled,isReadOnly:e.isReadOnly,isDateUnavailable:e.isDateUnavailable,allowsNonContiguousRanges:e.allowsNonContiguousRanges,defaultFocusedValue:t.dateRange?void 0:e.placeholderValue,isInvalid:t.isInvalid,errorMessage:"function"==typeof e.errorMessage?e.errorMessage(t.displayValidation):e.errorMessage||t.displayValidation.validationErrors.join(" "),firstDayOfWeek:e.firstDayOfWeek,pageBehavior:e.pageBehavior},isInvalid:o,validationErrors:i,validationDetails:s}}({...mp(e),label:c,validationBehavior:o},i,s),[$,A]=(0,uq.useState)(null),w=(0,uq.useCallback)(()=>{s.current&&A(s.current.offsetWidth+"px")},[]);$C({ref:s,onResize:w});let{focusProps:k,isFocused:x,isFocusVisible:C}=gW({within:!0}),E=ms({...e,values:{state:i,isFocusWithin:x,isFocusVisible:C,isDisabled:e.isDisabled||!1,isInvalid:i.isInvalid,isOpen:i.isOpen},defaultClassName:"react-aria-DateRangePicker"}),S=mA(e);return delete S.id,uH().createElement(mi,{values:[[$9,i],[_K,{...u,ref:s,isInvalid:i.isInvalid}],[gZ,{...h,isPressed:i.isOpen}],[$t,{...p,ref:l,elementType:"span"}],[_N,g],[v5,i],[$1,{trigger:"DateRangePicker",triggerRef:s,placement:"bottom start",style:{"--trigger-width":$}}],[v4,m],[vK,{slots:{start:d,end:f}}],[g0,{slots:{description:y,errorMessage:b}}],[v8,v]]},uH().createElement("div",{...k,...S,...E,ref:t,slot:e.slot||void 0,"data-focus-within":x||void 0,"data-invalid":i.isInvalid||void 0,"data-focus-visible":C||void 0,"data-disabled":e.isDisabled||void 0,"data-open":i.isOpen||void 0}))});function An(e){return uH().createElement(yr,e)}function Aa(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 y1||e instanceof y3||e instanceof y4)return t?bo(e,t):e;{let n=dv()(e).toDate(),a=new y1(n.getFullYear(),n.getMonth()+1,n.getDate());return t?bo(a,t):a}}function Ar(e){if(e)return e.toDate(by())}function Ao(){let e=window.i18next.language;return"ht"===(e=e.replaceAll("_","-"))&&(e="fr-HT"),e}if("u">typeof navigator){let e=navigator;Q=Array.isArray(e.languages)?e.languages[0]:e.language}else if("u">typeof process){let e=process.env;Q=e.LC_ALL||e.LC_MESSAGES||e.LANG||e.LANGUAGE}var Ai=function(e){e=(e=e.replace(/_/g,"-")).replace(/[.:][\w-]*$/,"");try{return new Intl.Locale(e).baseName}catch(e){return"en-US"}}(Q||"en-US"),As=class extends Date{invalid=null;isValid(){return!Number.isNaN(this.valueOf())}},Al={};for(let e=1;e<100;e++)Al[(e<=9?"0":"")+e]=e+(e>51?1900:2e3);var Ac={arab:1632,arabext:1776,bali:6992,beng:2534,deva:2406,fullwide:65296,gujr:2790,khmr:6112,knda:3302,laoo:3792,limb:6470,mlym:3430,mong:6160,mymr:4160,orya:2918,tamldec:3046,telu:3174,thai:3664,tibt:3872},Au="[1234567890一二三四五六七八九〇\\d]",Ap={0:0,1:1,2:2,3:3,4:4,5:5,6:6,7:7,8:8,9:9,"0":0,"1":1,"2":2,"3":3,"4":4,"5":5,"6":6,"7":7,"8":8,"9":9,〇:0,一:1,二:2,三:3,四:4,五:5,六:6,七:7,八:8,九:9},Ad={},Af={"Eastern Daylight Time":-240,"Eastern Standard Time":-300,"Central Daylight Time":-300,"Central Standard Time":-360,"Mountain Daylight Time":-360,"Mountain Standard Time":-420,"Pacific Daylight Time":-420,"Pacific Standard Time":-480,"Coordinated Universal Time":0,ACDT:630,ACST:570,ACT:480,ADT:-180,AEDT:660,AEST:600,AFT:270,AKDT:-480,AKST:-540,AMST:-180,AMT:-240,ART:-180,AST:180,AWDT:540,AWST:480,AZOST:-60,AZT:240,BDT:360,BIOT:360,BIT:-720,BOT:-240,BRST:-120,BRT:-180,BTT:360,CAT:120,CCT:390,CDT:-300,CEDT:120,CEST:120,CET:60,CHADT:825,CHAST:765,CHOT:480,ChST:600,CHUT:600,CIST:-480,CIT:480,CKT:-600,CLST:-180,CLT:-240,COST:-240,COT:-300,CST:-360,CT:480,CVT:-60,CXT:420,DAVT:420,DDUT:600,DFT:60,EASST:-300,EAST:-360,EAT:180,ECT:-300,EDT:-240,EEDT:180,EEST:180,EET:120,EGST:0,EGT:-60,EIT:540,EST:-300,FET:180,FJT:720,FKST:-180,FKT:-240,FNT:-120,GALT:-360,GAMT:-540,GET:240,GFT:-180,GILT:720,GIT:-540,GMT:0,GST:-120,GYT:-240,HADT:-540,HAEC:120,HAST:-600,HKT:480,HMT:300,HOVT:420,HST:-600,IBST:0,ICT:420,IDT:180,IOT:180,IRDT:270,IRKT:480,IRST:210,IST:120,JST:540,KGT:360,KOST:660,KRAT:420,KST:540,LHST:630,LINT:840,MAGT:720,MART:-510,MAWT:300,MDT:-360,MET:60,MEST:120,MHT:720,MIST:660,MIT:-510,MMT:390,MSK:180,MST:-420,MUT:240,MVT:300,MYT:480,NCT:660,NDT:-90,NFT:660,NPT:345,NST:-150,NT:-150,NUT:-660,NZDT:780,NZST:720,OMST:360,ORAT:300,PDT:-420,PET:-300,PETT:720,PGT:600,PHOT:780,PKT:300,PMDT:-120,PMST:-180,PONT:660,PST:-480,PYST:-180,PYT:-240,RET:240,ROTT:-180,SAKT:660,SAMT:240,SAST:120,SBT:660,SCT:240,SGT:480,SLST:330,SRET:660,SRT:-180,SST:480,SYOT:180,TAHT:-600,THA:420,TFT:300,TJT:300,TKT:780,TLT:540,TMT:300,TOT:780,TVT:720,UCT:0,ULAT:480,USZ1:120,UTC:0,UYST:-120,UYT:-180,UZT:300,VET:-240,VLAT:600,VOLT:240,VOST:360,VUT:660,WAKT:720,WAST:120,WAT:60,WEDT:60,WEST:60,WET:0,WIT:420,WST:480,YAKT:540,YEKT:300},Ah={zone:Af,year:Al,meridiem:{am:0,pm:12,"a.m.":0,"p.m.":12},month:{january:1,jan:1,february:2,feb:2,march:3,mar:3,april:4,apr:4,may:5,june:6,jun:6,july:7,jul:7,august:8,aug:8,september:9,sep:9,october:10,oct:10,november:11,nov:11,december:12,dec:12},dayname:{sunday:0,sun:0,monday:1,mon:1,tuesday:2,tue:2,wednesday:3,wed:3,thursday:4,thu:4,friday:5,fri:5,saturday:6,sat:6},digit:{}},Am={MONTHNAME:"january|february|march|april|may|june|july|august|september|october|november|december|jan\\.?|feb\\.?|mar\\.?|apr\\.?|may\\.?|jun\\.?|jul\\.?|aug\\.?|sep\\.?|oct\\.?|nov\\.?|dec\\.?",DAYNAME:"sunday|monday|tuesday|wednesday|thursday|friday|saturday|sun\\.?|mon\\.?|tue\\.?|wed\\.?|thu\\.?|fri\\.?|sat\\.?",ZONE:"\\(?(?:"+Object.keys(Af).join("|")+")\\)?",MERIDIEM:"am|pm|a.m.|p.m.",ORDINAL:"st|nd|rd|th|\\.",YEAR:"\\d{4}|\\d{2}",YEAR2:"\\d{2}",YEAR4:"\\d{4}",YEAR6:"-\\d{6}|\\+?\\d{5,6}",MONTH:"1[0-2]|0?[1-9]",MONTH2:"1[0-2]|0[1-9]",DAY:"3[01]|[12]\\d|0?[1-9]",DAY2:"3[01]|[12]\\d|0[1-9]",OFFSET:"(?:GMT)?[\xb1−+-](?:[01]\\d[0-5]\\d|[01]\\d:[0-5]\\d|[01]?\\d)",H24:"[01]\\d|2[0-3]",H12:"0?[1-9]|1[012]",MIN:"[0-5]\\d",SEC:"[0-5]\\d|60",MS:"\\d{9}|\\d{6}|\\d{1,3}",GAP:"[\\s/.,-]{1,}"},Ag={...Am,YEAR:"*{4}|*{2}",YEAR4:"*{4}",YEAR6:"-*{6}|\\+?*{5,6}",MONTH:"*{1,2}",MONTH2:"*{2}",DAY:"*{1,2}",DAY2:"*{2}",OFFSET:"(?:GMT)?[\xb1−+-](?:*{4}|*{2}:*{2}|*{1,2})",H24:"*{2}",H12:"*{1,2}",MIN:"*{2}",SEC:"*{2}",MS:"*{9}|*{6}|*{3}"},Ay={},Ab=class e{locale;lookups;vars;numberingSystem;baseName;dateOptions;static factory(t=Ai){return Ay[t.toLowerCase()]||(Ay[t.toLowerCase()]=new e(t)),Ay[t.toLowerCase()]}constructor(e=Ai){this.locale=e,this.lookups={...Ah},this.vars={...Am};const t=new Intl.NumberFormat(this.locale);this.numberingSystem=t.resolvedOptions().numberingSystem,this.dateOptions=new Intl.DateTimeFormat(this.locale).resolvedOptions(),this.baseName=new Intl.Locale(this.locale).baseName,this.build()}toInt(e){if("number"==typeof e)return e;if("string"!=typeof e)return;if("latn"===this.numberingSystem&&!this.baseName.startsWith("zh")){let t=parseInt(e,10);if(!isNaN(t))return t}let t="";for(let n=0;n<e.length;n++)t+=String(this.lookups.digit[e[n]]);return parseInt(t,10)}millisecondToInt(e){if("number"==typeof e)return e;if("string"!=typeof e)return;let t=e.slice(0,3);return 1===t.length?100*this.toInt(t):2===t.length?10*this.toInt(t):this.toInt(t)}monthNameToInt(e){if("string"!=typeof e)return;let t=e.toLocaleLowerCase(this.locale).replace(/\.$/,"");return this.lookups.month[t]||12}h12ToInt(e,t){if("string"!=typeof e)return;let n=this.lookups.meridiem[t?.toLowerCase()]||0,a=this.toInt(e);return a<12&&12===n&&(a+=12),12===a&&0===n&&(a=0),a}zoneToOffset(e){if("string"==typeof e)return e=e.replace(/[^a-z\s]/gi,""),this.lookups.zone[e]}offsetToMinutes(e){if("string"!=typeof e)return;let t=e.match(/^(?:GMT)?([±−+-])(..?):?(..)?$/);if(t){let[,e,n,a]=t;return("-"===e||"−"===e?-1:1)*(60*this.toInt(n)+this.toInt(a||0))}return 0}build(){"latn"===this.dateOptions.numberingSystem?this.lookups.digit=Ap:this.buildNumbers(),!/^en/i.test(this.locale)&&(this.buildMonthNames(),this.buildDaynames(),/zh/i.test(this.locale)||this.buildMeridiems())}buildNumbers(){let{group:e,lookup:t}=function(e){if(Ad[e])return Ad[e];if("fullwide"===e||"hanidec"===e)return{group:Au,lookup:{...Ap}};let t=Ac[e];if(!t)return{group:"\\d",lookup:{...Ap}};let n=String.fromCharCode(t),a=String.fromCharCode(t+9),r={};for(let e=0;e<10;e++)r[String.fromCharCode(t+e)]=e;return Ad[e]={group:`[${n}-${a}]`,lookup:r},Ad[e]}(this.numberingSystem);for(let n in this.lookups.digit=t,Ag)Ag.hasOwnProperty(n)&&(this.vars[n]=Ag[n].replace(/\*/g,e))}buildMonthNames(){let e={},t={};if(/^fi/i.test(this.locale))"tammi|helmi|maalis|huhti|touko|kes\xe4|hein\xe4|elo|syys|loka|marras|joulu".split("|").forEach((n,a)=>{["","k","kuu","kuuta"].forEach((r,o)=>{e[n+r+(o<2?"\\.?":"")]=!0,t[n+r]=a+1})});else{let n=[],a=e=>"month"===e.type;for(let e=0;e<12;e++)n.push(new Date(2017,e,1));for(let r of["full","long","medium"]){let o=Intl.DateTimeFormat(this.locale,{dateStyle:r});for(let i=0;i<12;i++){let s=o.formatToParts(n[i]).find(a).value.toLocaleLowerCase(this.locale);/^\d+$/.test(s)||(/^ko/i.test(this.locale)&&(s+="월"),"medium"===r?(s=s.replace(/\.$/,""),e[`${s}\\.?`]=!0):e[s]=!0,t[s]=i+1)}}let r=Intl.DateTimeFormat(this.locale,{month:"short"});for(let o=0;o<12;o++){let i=r.formatToParts(n[o]).find(a).value.toLocaleLowerCase(this.locale);i=i.replace(/\.$/,""),e[`${i}\\.?`]=!0,t[i]=o+1}}this.vars.MONTHNAME=Object.keys(e).join("|"),this.lookups.month=t}buildDaynames(){let e=[],t=e=>"weekday"===e.type;for(let t=0;t<7;t++)e.push(new Date(2017,0,t+1));let n=[],a={};for(let r of["long","short"]){let o=Intl.DateTimeFormat(this.locale,{weekday:r});for(let i=0;i<7;i++){let s=o.formatToParts(e[i]).find(t).value.toLocaleLowerCase(this.locale);"short"===r?(s=s.replace(/\.$/,""),n.push(`${s}\\.?`)):n.push(s),a[s]=i}}this.vars.DAYNAME=n.join("|"),this.lookups.dayname=a}buildMeridiems(){let e=[new Date(2017,0,1),new Date(2017,0,1,23,0,0)],t=e=>"dayPeriod"===e.type,n=[],a={},r=Intl.DateTimeFormat(this.locale,{timeStyle:"long"});for(let o=0;o<2;o++){let i=r.formatToParts(e[o]).find(t);if(!i)return;let s=i.value.toLocaleLowerCase(this.locale);n.push(s),a[s]=12*o}this.vars.MERIDIEM=n.join("|"),this.lookups.meridiem=a}compile(e){return RegExp(e.replace(/_([A-Z0-9]+)_/g,(e,t)=>{if(!this.vars[t])throw Error(`Template string contains invalid variable _${t}_`);return this.vars[t]}),"i")}},A_=["ee-TG","en-AS","en-CA","en-FM","en-GH","en-GU","en-KE","en-KY","en-MH","en-MP","en-US","en-VI","en-WS","jp-JP","sm-AS","sm-SM"],Av={y:"year",M:"month",d:"day",w:"week",h:"hour",m:"minute",s:"second",ms:"millisecond"},A$=()=>new Date;function AA(e){return function(t){let n={};for(let a=0,r=e.length;a<r;a++){let r=e[a];r&&(n[r]=t[a])}return n}}var Aw=class{doneChecker;fallback;patterns;formatter;constructor({doneChecker:e,fallback:t,patterns:n,formatter:a}){this.doneChecker=e,this.fallback=t,this.patterns=n,this.formatter=a}attempt(e){if("string"!=typeof e)return this.fallback(e);let t=e.trim(),n={},a=!1;for(let e of this.patterns){let r=t.match(e.regex);if(!r)continue;a=!0;let o=e.handler(r);if(o){for(let[e,t]of Object.entries(o))e in n||void 0===t||(n[e]=t);if(t=(t=t.slice(0,r.index)+t.slice(r.index+r[0].length+1)).trim(),this.doneChecker(n,t))break}}return a?this.formatter(n):this.fallback(e)}},Ak=["year","month","day","hour","minute","second","millisecond","offset"],Ax={};function AC(e,t){return""===t||/^\s+$/.test(t)||"year"in e&&("month"in e||"monthname"in e)&&"day"in e&&"hour"in e&&"minute"in e&&"second"in e&&"millisecond"in e&&("zone"in e||"offset"in e)}var AE=[[/([^\d.]+)(\d{1,2})\.(\d{2})\.(\d{2})(\D|$)/,"$1$2:$3:$4$5"],[/([^\d.]+)(\d{1,2})\.(\d{2})(\D|$)/,"$1$2:$3$4"]],AS={ar:[[/ /g," "]],bn:[[/,/g,""]],zh:[[/早上\s*([\d:]+)/,"$1am"],[/凌晨\s*([\d:]+)/,"$1am"],[/上午\s*([\d:]+)/,"$1am"],[/下午\s*([\d:]+)/,"$1pm"],[/晚上\s*([\d:]+)/,"$1pm"]],he:[[/ב/gi,""]],de:[[/ um /g," "]],pt:[[/\sde /gi," "]],es:[[/\sde /gi," "]],da:[[/\sden /gi," "],...AE],ru:[[/ г\./g,""]],th:[[/\s*นาฬิกา\s*/i,":"],[/\s*นาที\s*/i,":"],[/\s*วินาที\s*/i," "]],ko:[[/\s*시\s*/,":"],[/\s*분\s*/,":"],[/\s*초\s*/,""],[/(오전|오후)\s*([\d:]+)/,"$2$1"],[/(\d{4})\. (\d{1,2})\. (\d{1,2})\./,"$1-$2-$3"]],fi:AE,id:AE,fr:[[/(\d{2}) h /,"$1:"],[/(\d{2}) min /,"$1:"],[/(\d{2}) s /,"$1"]]};function AD(e,t=Ai){let n=function(e){if(!Ax[e]){var t,n;let a,r,o=Ab.factory(e);Ax[e]=new Aw({doneChecker:AC,fallback:(t=e,function(e){let n=String(e).slice(0,50);return""===n&&(n="(empty string)"),{invalid:`Unable to parse "${n}" with locale "${t}"`}}),patterns:(a=[{name:"timestampWithOffset",regex:o.compile("^(_YEAR4_)-(_MONTH_)-(_DAY_)[T ](_H24_):(_MIN_):(_SEC_)(?:.(_MS_))? ?(_OFFSET_|Z)?$"),handler:AA(["","year","month","day","hour","minute","second","millisecond","offset"])},{name:"timestampWithZone",regex:o.compile("^(_YEAR4_)-(_MONTH_)-(_DAY_)[T ](_H24_):(_MIN_):(_SEC_)(?:.(_MS_))?\\s*(_ZONE_)$"),handler:AA(["","year","month","day","hour","minute","second","millisecond","zone"])},{name:"timestampWithOffsetAndZone",regex:o.compile("^(_YEAR4_)-(_MONTH_)-(_DAY_)[T ](_H24_):(_MIN_):(_SEC_)(?:.(_MS_))? (_OFFSET_|Z)\\s*(_ZONE_)$"),handler:AA(["","year","month","day","hour","minute","second","millisecond","offset"])},{name:"chinese",regex:o.compile(`^(${Au}{2,4})\\s*\u5E74\\s*(${Au}{1,2})\\s*\u6708\\s*(${Au}{1,2})\\s*\u65E5$`),handler:AA(["","year","month","day"])},{name:"korean",regex:o.compile("^(_YEAR_)년\\s*(_MONTH_)월\\s*(_DAY_)일$"),handler:AA(["","year","month","day"])},{name:"twitter",regex:/^(?:sun|mon|tue|wed|thu|fri|sat) (jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec) (\d{2}) (\d{2}):(\d{2}):(\d{2}) ([+-]\d{4}) (\d{4})$/i,handler:AA(["","monthname","day","hour","minute","second","offset","year"])},{name:"today",regex:/^(now|today|tomorrow|yesterday)$/i,handler:function(e){let t=A$(),n=e[0].toLowerCase(),a={now:0,today:0,tomorrow:864e5,yesterday:-864e5}[n];0!==a&&t.setTime(t.getTime()+a);let r={year:t.getFullYear(),month:t.getMonth()+1,day:t.getDate()};return"now"===n?{...r,hour:t.getHours(),minute:t.getMinutes(),second:t.getSeconds(),millisecond:t.getMilliseconds()}:r}},{name:"ago",regex:/^(\+|-|in|) ?([\d.]+) ?(years?|months?|weeks?|days?|hours?|minutes?|seconds?|milliseconds?|ms|s|m|h|w|d|M|y)( ago)?$/i,handler:function([,e,t,n,a]){t=parseFloat(t),"week"===(n=n.length<=2?Av[n]:(n=n.replace(/s$/,"")).toLowerCase())&&(n="day",t*=7),("-"===e||a)&&(t*=-1);let r=A$();return"millisecond"===n?r.setUTCMilliseconds(r.getUTCMilliseconds()+t):"second"===n?r.setUTCSeconds(r.getUTCSeconds()+t):"minute"===n?r.setUTCMinutes(r.getUTCMinutes()+t):"hour"===n?r.setUTCHours(r.getUTCHours()+t):"day"===n?r.setUTCDate(r.getUTCDate()+t):"month"===n?r.setUTCMonth(r.getUTCMonth()+t):"year"===n&&r.setUTCFullYear(r.getUTCFullYear()+t),{year:r.getUTCFullYear(),month:r.getUTCMonth()+1,day:r.getUTCDate(),hour:r.getUTCHours(),minute:r.getUTCMinutes(),second:r.getUTCSeconds(),millisecond:r.getUTCMilliseconds()}}},{name:"atSeconds",regex:/^@(\d+)$/,handler:function(e){let t=new Date(1e3*parseInt(e[1],10));return{year:t.getUTCFullYear(),month:t.getUTCMonth()+1,day:t.getUTCDate(),hour:t.getUTCHours(),minute:t.getUTCMinutes(),second:t.getUTCSeconds()}}},{name:"microsoftJson",regex:/^\/Date\((\d+)([+-]\d{4})?\)\/$/,handler:function(e){let t=new Date(parseInt(e[1],10));return{year:t.getUTCFullYear(),month:t.getUTCMonth()+1,day:t.getUTCDate(),hour:t.getUTCHours(),minute:t.getUTCMinutes(),second:t.getUTCSeconds(),millisecond:t.getUTCMilliseconds(),offset:e[2]}}},{name:"full24",regex:o.compile("(?:^|[\\sT])(_H24_):(_MIN_):(_SEC_)(?:\\.(_MS_))?(Z)?$"),handler:AA(["","hour","minute","second","millisecond","zone"])},{name:"zone24",regex:o.compile("(_H24_):(_MIN_):(_SEC_)(?:\\.(_MS_))?[\\s\\[(]*(_ZONE_)?[\\s\\])]*$"),handler:AA(["","hour","minute","second","millisecond","zone"])},{name:"hms12WithOffset",regex:o.compile("(_H12_):(_MIN_):(_SEC_)\\s*(_MERIDIEM_)\\s*(_OFFSET_)"),handler:AA(["","hour","minute","second","meridiem","offset"])},{name:"hms12",regex:o.compile("(_H12_):(_MIN_):(_SEC_)\\s*(_MERIDIEM_)"),handler:AA(["","hour","minute","second","meridiem"])},{name:"hms24",regex:o.compile("(_H24_):(_MIN_):(_SEC_)(?:\\.(_MS_))?"),handler:AA(["","hour","minute","second","millisecond"])},{name:"hm12",regex:o.compile("(_H12_):(_MIN_)\\s*(_MERIDIEM_)"),handler:AA(["","hour","minute","meridiem"])},{name:"hm24",regex:o.compile("(_H24_):(_MIN_)"),handler:AA(["","hour","minute"])},{name:"h12",regex:o.compile("(_H12_)\\s*(_MERIDIEM_)"),handler:AA(["","hour","meridiem"])},{name:"8digit",regex:/^((?:19|20)\d{2})(\d{2})(\d{2})$/,handler:AA(["","year","month","day"])},{name:"yearMonthnameDay",regex:o.compile("(_YEAR4_)[\\s.-]+(_MONTHNAME_)[\\s,.-]+(_DAY_)(_ORDINAL_)?"),handler:AA(["","year","monthname","day"])},{name:"dayMonthnameYear",regex:o.compile("(_DAY_)(_ORDINAL_)?[\\s.-]*(_MONTHNAME_)[\\s,.-]+(_YEAR_)"),handler:AA(["","day","","monthname","year"])},{name:"monthnameDayYear",regex:o.compile("(_MONTHNAME_)[\\s.-]*(_DAY_)(_ORDINAL_)?[\\s,.-]+(_YEAR_)"),handler:AA(["","monthname","day","","year"])},{name:"dayMonthname",regex:o.compile("\\b(_DAY_)(_ORDINAL_)?[\\s.-]*(_MONTHNAME_)\\b"),handler:AA(["","day","","monthname"])},{name:"monthnameDay",regex:o.compile("\\b(_MONTHNAME_)[\\s.-]*(_DAY_)(_ORDINAL_)?\\b"),handler:AA(["","monthname","day"])},{name:"hmsNoMeridiem",regex:o.compile("\\b(_H12_|_H24_):(_MIN_):(_SEC_)\\b"),handler:AA(["","hour","minute","second"])},{name:"hmNoMeridiem",regex:o.compile("\\b(_H12_|_H24_):(_MIN_)\\b"),handler:AA(["","hour","minute"])},{name:"ymd",regex:o.compile("(_YEAR4_)([.-])(_MONTH_)\\2+(_DAY_)"),handler:AA(["","year","","month","day"])},{name:"mdy",regex:o.compile("(_MONTH_)([/-])(_DAY_)\\2(_YEAR_)"),handler:AA(["","month","","day","year"])},{name:"dmy",regex:o.compile("(_DAY_)(?:_ORDINAL_)?[./\\s-]+(_MONTH_)[./\\s-]+(_YEAR_)"),handler:AA(["","day","month","year"])},{name:"yearLoose",regex:o.compile("_YEAR4_"),handler:AA(["year"])},{name:"dayMonthnameLoose",regex:o.compile("(_DAY_)[\\s.]*(_MONTHNAME_)"),handler:AA(["","day","monthname"])},{name:"monthnameDayLoose",regex:o.compile("(_MONTHNAME_)[\\s.]*(_DAY_)"),handler:AA(["","monthname","day"])},{name:"monthname",regex:o.compile("_MONTHNAME_"),handler:AA(["monthname"])},{name:"year4",regex:o.compile("_YEAR4_"),handler:AA(["year"])},{name:"md",regex:o.compile("(_MONTH_)[/-](_DAY_)"),handler:AA(["","month","day"])},{name:"dm",regex:o.compile("(_DAY_)(?:_ORDINAL_)?[./\\s-]+(_MONTH_)"),handler:AA(["","day","month"])},{name:"day",regex:o.compile("_DAY_"),handler:AA(["day"])},{name:"year2",regex:o.compile("_YEAR2_"),handler:AA(["year"])},{name:"onlyZone",regex:o.compile("_ZONE_"),handler:AA(["zone"])},{name:"onlyOffset",regex:o.compile("_OFFSET_"),handler:AA(["offset"])}],r=o.baseName.slice(0,5),A_.includes(r)?a:a.filter(e=>!["mdy","md"].includes(e.name))),formatter:(n=o,function(e){let t={};for(let[a,r]of Object.entries(e))if("monthname"===a){if(r){let e=n.monthNameToInt(r);void 0!==e&&(t.month=e)}}else if("hour"===a&&e.meridiem){let a=n.h12ToInt(r,e.meridiem);void 0!==a&&(t.hour=a)}else if("zone"===a){if(r){let e=n.zoneToOffset(r);void 0!==e&&(t.offset=e)}}else if("offset"===a){let e=n.offsetToMinutes(r);void 0!==e&&(t.offset=e)}else if("millisecond"===a){let e=n.millisecondToInt(r);"number"==typeof e&&(t.millisecond=e)}else if(Ak.includes(a)){let e=n.toInt(r);"number"==typeof e&&(t[a]=e)}return t.year<100&&(t.year=Al[t.year]),t.year&&"buddhist"===n.dateOptions.calendar&&(t.year-=543),t})})}return Ax[e]}(t),a=function(e,t){let n=AS[t.slice(0,2).toLowerCase()];if(!n)return e;for(let[t,a]of n)e=e.replace(t,a);return e}(e,t);return n.attempt(a)}function AM(e){e.month&&e.day&&void 0===e.year&&(e.year=new Date().getFullYear()),60===e.second&&(e.second=59);let t=new As(e.year,e.month-1,e.day,e.hour||0,e.minute||0,e.second||0,e.millisecond||0);return"number"==typeof e.offset?new As(t.valueOf()-60*e.offset*1e3):t}function Az(e,t=Ai){let n=AD(e,t),a=n.invalid?new As(NaN):AM(n);return a.isValid()||(a.invalid=`Unable to parse date "${e}"`),a}function AO(e,t=Ai){return e instanceof Date?new As(e.valueOf()):"number"==typeof e?new As(e):Az(e,t)}Date.fromString=As.fromString=Az,Date.fromAny=As.fromAny=AO,"u">typeof window&&(window.anyDateParser={fromString:Az,fromAny:AO,fromObject:AM,attempt:AD});var AP=n(5238),AT=n(1445);function AB(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}d_.extend(d$),d_.extend(AT),d_.extend(AP);let AI="YYYY-MM-DDTHH:mm:ss.SSSZZ";function AN(e){return null!=e&&28===e.trim().length&&"T"===(e=e.trim())[10]&&":"===e[13]&&":"===e[16]&&"."===e[19]&&("+"===e[23]||"-"===e[23])&&d_(e,AI).isValid()}function Aj(e){return d_(e).isToday()}function AR(e){return AN(e)?d_(e,AI).toDate():null}function AF(e,t=!1){let n=d_(e);return t&&(n=n.utc()),n.format(AI)}function AL(e){return d_(e).toDate()}var AW=new WeakMap;let AG=new class{register(e,t){AB(this,AW).set(e,t)}getCalendar(e){if(!e)return;if(e.calendar)return e.calendar;if(e.region){let t=`${e.language}-${e.region}`;if(AB(this,AW).has(t))return AB(this,AW).get(t)}if(e.language&&AB(this,AW).has(e.language))return AB(this,AW).get(e.language);let t=new Intl.DateTimeFormat(e.toString()).resolvedOptions().calendar;return AB(this,AW).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,AW,{writable:!0,value:new Map})}};function AV(e,t){AG.register(e,t)}function AU(e){let t=e??Ao();return AG.getCalendar(t instanceof Intl.Locale?t:new Intl.Locale(t))}let Aq={mode:"standard",time:"for today",day:!0,month:!0,year:!0,noToday:!1};function AH(e,t={}){let n=AD(e,Ao());if(n.invalid)return console.warn(`Could not parse invalid date '${e}'`),null;!(0,ee.isNil)(n.day)&&(0,ee.isNil)(n.month)&&(n=Object.assign({},(0,ee.omit)(n,"day"),{month:n.day})),n.month&&(n.month-=1),n.day&&(n=Object.assign({},(0,ee.omit)(n,"day"),{date:n.day}));let a=d_().set(n).toDate();return(0,ee.isNil)(n.year)&&(t.year=!1),(0,ee.isNil)(n.month)&&(t.month=!1),(0,ee.isNil)(n.date)&&(t.day=!1),AK(a,t)}function AK(e,t){let n,a=t?.locale??Ao(),r=new Intl.Locale(a),{calendar:o,mode:i,time:s,day:l,month:c,year:u,noToday:p,numberingSystem:d}={...Aq,...{noToday:"am"===r.language},...t},f={calendar:o??AU(r),year:u?"numeric":void 0,month:c?"short":void 0,day:l?"2-digit":void 0,numberingSystem:d},h=d_(e).isToday();if(h&&!p)n=(n=new Intl.RelativeTimeFormat(a,{numeric:"auto"}).format(0,"day"))[0].toLocaleUpperCase(a)+n.slice(1);else{"en"===r.language&&(a="en-GB");let t=new Intl.DateTimeFormat(a,f).formatToParts(e);("en"===r.language||"am"===r.language)&&"standard"==i&&u&&l&&(t=t.map(AY("-"))),"wide"==i&&(t=t.map(AY(" — "))),"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||h&&"for today"===s)&&(n+=`, ${AJ(e)}`),n}let AY=e=>(t,n,a)=>"literal"!==t.type||" "!==t.value||n<a.length-1&&"era"===a[n+1].type?t:{type:"literal",value:e};function AJ(e){return e.toLocaleTimeString(Ao(),{hour:"2-digit",minute:"2-digit"})}function AZ(e,t){return AK(e,{...t,time:!0})}function AX(e,t){let n=AU("string"==typeof t?new Intl.Locale(t):t);return n?bo(e,_$(n)):e}function AQ(e,t){return new Intl.DurationFormat(Ao(),t).format(e)}function A0(e,t){if(null==e)return null;if("string"==typeof e){let n=AD(e,Ao());return n.invalid?(console.warn(`Could not interpret '${e}' as a date`),null):(n.day&&!n.month&&(n={...(0,ee.omit)(n,"day"),...{month:n.day}}),n.month&&(n.month-=1),n.day&&(n={...(0,ee.omit)(n,"day"),...{date:n.day}}),d_(t).set(n))}return d_(e)}let A1=["years","months","days","hours","minutes","seconds"],A2={second:"seconds",minute:"minutes",hour:"hours",day:"days",month:"months",year:"years"},A3={seconds:45,minutes:45,hours:22,days:26,months:11,years:1/0};function A4(e,t=d_(),n){let a,r=d_(t),o=A0(e,r);if(null==o)return null;if("string"==typeof n){let e=A2[n]??n;return{[e]:r.diff(o,e)}}let{thresholds:i,largestUnit:s,smallestUnit:l}=n??{};if(void 0!==s||void 0!==l){let e,t=l?A2[l]??l:void 0;return e="auto"===s||void 0===s?function(e,t,n){let a=A1.indexOf(n);for(let r=0;r<A1.length;r++){let o=A1[r];if(t.diff(e,o)>0)return r<=a?o:n}return n}(o,r,t??"seconds"):A2[s]??s,function(e,t,n,a){let r=A1.indexOf(n),o=A1.indexOf(a),i=A1.slice(r,o+1),s={},l=e;for(let e of i){let n=t.diff(l,e);s[e]=n,l=l.add(n,e)}return s}(o,r,e,t??e)}let c=(a=function(e){let t={...A3};if(e)for(let[n,a]of Object.entries(e))void 0!==a&&(t[A2[n]??n]=a);return t}(i),r.diff(o,"seconds")<a.seconds?"seconds":r.diff(o,"minutes")<a.minutes?"minutes":r.diff(o,"hours")<a.hours?"hours":r.diff(o,"days")<a.days?"days":r.diff(o,"months")<a.months?"months":"years");return{[c]:r.diff(o,c)}}let A5={style:"short",localeMatcher:"lookup"};function A6(e,t=d_(),n){let a=A4(e,t,n);return null==a?null:AQ(a,"object"==typeof n&&n.formatOptions?{...A5,...n.formatOptions}:A5)}let A8=(0,uq.createContext)(null);function A7(){let e=pR({externalModuleName:"@openmrs/esm-styleguide"}).preferredDateLocale,t=(0,uq.useMemo)(()=>{let t=Ao();return e[t]&&(t=e[t]),t},[window.i18next.language]),n=(0,uq.useMemo)(()=>{let e=AU(t);return void 0!==e?_$(e):void 0},[t]),a=(0,uq.useMemo)(()=>new Intl.Locale(t,{calendar:n?.identifier}),[t,n]),r=(0,uq.useMemo)(()=>n?bo(bf(by()),n):bf(by()),[n]);return{calendar:n,intlLocale:a,today_:r}}let A9=new y1(1793,1,1);var we={};function wt(){return"u">typeof window&&window.InputEvent&&"function"==typeof InputEvent.prototype.getTargetRanges}function wn(e={}){let{locale:t}=yo();return(0,uq.useMemo)(()=>new(0,vG.K)(t,e),[t,e])}we={"ar-AE":{decrease:e=>`\u{62E}\u{641}\u{636} ${e.fieldLabel}`,increase:e=>`\u{632}\u{64A}\u{627}\u{62F}\u{629} ${e.fieldLabel}`,numberField:"حقل رقمي"},"bg-BG":{decrease:e=>`\u{41D}\u{430}\u{43C}\u{430}\u{43B}\u{44F}\u{432}\u{430}\u{43D}\u{435} ${e.fieldLabel}`,increase:e=>`\u{423}\u{441}\u{438}\u{43B}\u{432}\u{430}\u{43D}\u{435} ${e.fieldLabel}`,numberField:"Номер на полето"},"cs-CZ":{decrease:e=>`Sn\xed\u{17E}it ${e.fieldLabel}`,increase:e=>`Zv\xfd\u{161}it ${e.fieldLabel}`,numberField:"Č\xedseln\xe9 pole"},"da-DK":{decrease:e=>`Reducer ${e.fieldLabel}`,increase:e=>`\xd8g ${e.fieldLabel}`,numberField:"Talfelt"},"de-DE":{decrease:e=>`${e.fieldLabel} verringern`,increase:e=>`${e.fieldLabel} erh\xf6hen`,numberField:"Nummernfeld"},"el-GR":{decrease:e=>`\u{39C}\u{3B5}\u{3AF}\u{3C9}\u{3C3}\u{3B7} ${e.fieldLabel}`,increase:e=>`\u{391}\u{3CD}\u{3BE}\u{3B7}\u{3C3}\u{3B7} ${e.fieldLabel}`,numberField:"Πεδίο αριθμού"},"en-US":{decrease:e=>`Decrease ${e.fieldLabel}`,increase:e=>`Increase ${e.fieldLabel}`,numberField:"Number field"},"es-ES":{decrease:e=>`Reducir ${e.fieldLabel}`,increase:e=>`Aumentar ${e.fieldLabel}`,numberField:"Campo de n\xfamero"},"et-EE":{decrease:e=>`V\xe4henda ${e.fieldLabel}`,increase:e=>`Suurenda ${e.fieldLabel}`,numberField:"Numbri v\xe4li"},"fi-FI":{decrease:e=>`V\xe4henn\xe4 ${e.fieldLabel}`,increase:e=>`Lis\xe4\xe4 ${e.fieldLabel}`,numberField:"Numerokentt\xe4"},"fr-FR":{decrease:e=>`Diminuer ${e.fieldLabel}`,increase:e=>`Augmenter ${e.fieldLabel}`,numberField:"Champ de nombre"},"he-IL":{decrease:e=>`\u{5D4}\u{5E7}\u{5D8}\u{5DF} ${e.fieldLabel}`,increase:e=>`\u{5D4}\u{5D2}\u{5D3}\u{5DC} ${e.fieldLabel}`,numberField:"שדה מספר"},"hr-HR":{decrease:e=>`Smanji ${e.fieldLabel}`,increase:e=>`Pove\u{107}aj ${e.fieldLabel}`,numberField:"Polje broja"},"hu-HU":{decrease:e=>`${e.fieldLabel} cs\xf6kkent\xe9se`,increase:e=>`${e.fieldLabel} n\xf6vel\xe9se`,numberField:"Sz\xe1mmező"},"it-IT":{decrease:e=>`Riduci ${e.fieldLabel}`,increase:e=>`Aumenta ${e.fieldLabel}`,numberField:"Campo numero"},"ja-JP":{decrease:e=>`${e.fieldLabel}\u{3092}\u{7E2E}\u{5C0F}`,increase:e=>`${e.fieldLabel}\u{3092}\u{62E1}\u{5927}`,numberField:"数値フィールド"},"ko-KR":{decrease:e=>`${e.fieldLabel} \u{AC10}\u{C18C}`,increase:e=>`${e.fieldLabel} \u{C99D}\u{AC00}`,numberField:"번호 필드"},"lt-LT":{decrease:e=>`Suma\u{17E}inti ${e.fieldLabel}`,increase:e=>`Padidinti ${e.fieldLabel}`,numberField:"Numerio laukas"},"lv-LV":{decrease:e=>`Samazin\u{101}\u{161}ana ${e.fieldLabel}`,increase:e=>`Palielin\u{101}\u{161}ana ${e.fieldLabel}`,numberField:"Skaitļu lauks"},"nb-NO":{decrease:e=>`Reduser ${e.fieldLabel}`,increase:e=>`\xd8k ${e.fieldLabel}`,numberField:"Tallfelt"},"nl-NL":{decrease:e=>`${e.fieldLabel} verlagen`,increase:e=>`${e.fieldLabel} verhogen`,numberField:"Getalveld"},"pl-PL":{decrease:e=>`Zmniejsz ${e.fieldLabel}`,increase:e=>`Zwi\u{119}ksz ${e.fieldLabel}`,numberField:"Pole numeru"},"pt-BR":{decrease:e=>`Diminuir ${e.fieldLabel}`,increase:e=>`Aumentar ${e.fieldLabel}`,numberField:"Campo de n\xfamero"},"pt-PT":{decrease:e=>`Diminuir ${e.fieldLabel}`,increase:e=>`Aumentar ${e.fieldLabel}`,numberField:"Campo num\xe9rico"},"ro-RO":{decrease:e=>`Sc\u{103}dere ${e.fieldLabel}`,increase:e=>`Cre\u{219}tere ${e.fieldLabel}`,numberField:"C\xe2mp numeric"},"ru-RU":{decrease:e=>`\u{423}\u{43C}\u{435}\u{43D}\u{44C}\u{448}\u{435}\u{43D}\u{438}\u{435} ${e.fieldLabel}`,increase:e=>`\u{423}\u{432}\u{435}\u{43B}\u{438}\u{447}\u{435}\u{43D}\u{438}\u{435} ${e.fieldLabel}`,numberField:"Числовое поле"},"sk-SK":{decrease:e=>`Zn\xed\u{17E}i\u{165} ${e.fieldLabel}`,increase:e=>`Zv\xfd\u{161}i\u{165} ${e.fieldLabel}`,numberField:"Č\xedseln\xe9 pole"},"sl-SI":{decrease:e=>`Upadati ${e.fieldLabel}`,increase:e=>`Pove\u{10D}ajte ${e.fieldLabel}`,numberField:"Številčno polje"},"sr-SP":{decrease:e=>`Smanji ${e.fieldLabel}`,increase:e=>`Pove\u{107}aj ${e.fieldLabel}`,numberField:"Polje broja"},"sv-SE":{decrease:e=>`Minska ${e.fieldLabel}`,increase:e=>`\xd6ka ${e.fieldLabel}`,numberField:"Nummerf\xe4lt"},"tr-TR":{decrease:e=>`${e.fieldLabel} azalt`,increase:e=>`${e.fieldLabel} artt\u{131}r`,numberField:"Sayı alanı"},"uk-UA":{decrease:e=>`\u{417}\u{43C}\u{435}\u{43D}\u{448}\u{438}\u{442}\u{438} ${e.fieldLabel}`,increase:e=>`\u{417}\u{431}\u{456}\u{43B}\u{44C}\u{448}\u{438}\u{442}\u{438} ${e.fieldLabel}`,numberField:"Поле номера"},"zh-CN":{decrease:e=>`\u{964D}\u{4F4E} ${e.fieldLabel}`,increase:e=>`\u{63D0}\u{9AD8} ${e.fieldLabel}`,numberField:"数字字段"},"zh-TW":{decrease:e=>`\u{7E2E}\u{5C0F} ${e.fieldLabel}`,increase:e=>`\u{653E}\u{5927} ${e.fieldLabel}`,numberField:"數字欄位"}};var wa={};wa={"ar-AE":{Empty:"فارغ"},"bg-BG":{Empty:"Изпразни"},"cs-CZ":{Empty:"Pr\xe1zdn\xe9"},"da-DK":{Empty:"Tom"},"de-DE":{Empty:"Leer"},"el-GR":{Empty:"Άδειο"},"en-US":{Empty:"Empty"},"es-ES":{Empty:"Vac\xedo"},"et-EE":{Empty:"T\xfchjenda"},"fi-FI":{Empty:"Tyhj\xe4"},"fr-FR":{Empty:"Vide"},"he-IL":{Empty:"ריק"},"hr-HR":{Empty:"Prazno"},"hu-HU":{Empty:"\xdcres"},"it-IT":{Empty:"Vuoto"},"ja-JP":{Empty:"空"},"ko-KR":{Empty:"비어 있음"},"lt-LT":{Empty:"Tuščias"},"lv-LV":{Empty:"Tukšs"},"nb-NO":{Empty:"Tom"},"nl-NL":{Empty:"Leeg"},"pl-PL":{Empty:"Pusty"},"pt-BR":{Empty:"Vazio"},"pt-PT":{Empty:"Vazio"},"ro-RO":{Empty:"Gol"},"ru-RU":{Empty:"Не заполнено"},"sk-SK":{Empty:"Pr\xe1zdne"},"sl-SI":{Empty:"Prazen"},"sr-SP":{Empty:"Prazno"},"sv-SE":{Empty:"Tomt"},"tr-TR":{Empty:"Boş"},"uk-UA":{Empty:"Пусто"},"zh-CN":{Empty:"空"},"zh-TW":{Empty:"空白"}};let wr=()=>{};function wo(e){var t;let n=(0,uq.useRef)(void 0),{value:a,textValue:r,minValue:o,maxValue:i,isDisabled:s,isReadOnly:l,isRequired:c,onIncrement:u,onIncrementPage:p,onDecrement:d,onDecrementPage:f,onDecrementToMin:h,onIncrementToMax:m}=e,g=yE((t=wa)&&t.__esModule?t.default:t,"@react-aria/spinbutton"),y=(0,uq.useRef)(!1),b=(0,uq.useCallback)(()=>{clearTimeout(n.current),y.current=!1},[]),v=gC(()=>{b()});(0,uq.useEffect)(()=>()=>v(),[]);let $=(0,uq.useRef)(!1),A=()=>{$.current=!0},w=()=>{$.current=!1},k=""===r?g.format("Empty"):(r||`${a}`).replace("-","−");(0,uq.useEffect)(()=>{$.current&&(yi&&yi.clear("assertive"),ys(k,"assertive"))},[k]);let x=(0,uq.useCallback)(()=>{b()},[b]),C=gC(u??wr),E=gC(d??wr),S=gC(()=>{(void 0===i||isNaN(i)||void 0===a||isNaN(a)||a<i)&&(C(),D(60))}),D=gC(e=>{v(),y.current=!0,n.current=window.setTimeout(S,e)}),M=gC(()=>{(void 0===o||isNaN(o)||void 0===a||isNaN(a)||a>o)&&(E(),z(60))}),z=gC(e=>{v(),y.current=!0,n.current=window.setTimeout(M,e)}),O=e=>{e.preventDefault()},{addGlobalListener:P,removeAllGlobalListeners:T}=gE(),B=(0,uq.useRef)(!1),[I,N]=(0,uq.useState)(null);(0,uq.useEffect)(()=>{"touch"===I?D(600):I&&D(400)},[I]);let[j,R]=(0,uq.useState)(null);return(0,uq.useEffect)(()=>{"touch"===j?z(600):j&&z(400)},[j]),{spinButtonProps:{role:"spinbutton","aria-valuenow":void 0===a||isNaN(a)?void 0:a,"aria-valuetext":k,"aria-valuemin":o,"aria-valuemax":i,"aria-disabled":s||void 0,"aria-readonly":l||void 0,"aria-required":c||void 0,onKeyDown:e=>{if(!e.ctrlKey&&!e.metaKey&&!e.shiftKey&&!e.altKey&&!l&&!e.nativeEvent.isComposing)switch(e.key){case"PageUp":if(p){e.preventDefault(),p?.();break}case"ArrowUp":case"Up":u&&(e.preventDefault(),u?.());break;case"PageDown":if(f){e.preventDefault(),f?.();break}case"ArrowDown":case"Down":d&&(e.preventDefault(),d?.());break;case"Home":h&&(e.preventDefault(),h?.());break;case"End":m&&(e.preventDefault(),m?.())}},onFocus:A,onBlur:w},incrementButtonProps:{onPressStart:e=>{b(),"touch"!==e.pointerType?(u?.(),N("mouse")):(P(window,"pointercancel",x,{capture:!0}),B.current=!1,N("touch")),P(window,"contextmenu",O)},onPressUp:e=>{b(),"touch"===e.pointerType&&(B.current=!0),T(),N(null)},onPressEnd:e=>{b(),"touch"===e.pointerType&&!y.current&&B.current&&u?.(),B.current=!1,N(null)},onFocus:A,onBlur:w},decrementButtonProps:{onPressStart:e=>{b(),"touch"!==e.pointerType?(d?.(),R("mouse")):(P(window,"pointercancel",x,{capture:!0}),B.current=!1,R("touch"))},onPressUp:e=>{b(),"touch"===e.pointerType&&(B.current=!0),T(),R(null)},onPressEnd:e=>{b(),"touch"===e.pointerType&&!y.current&&B.current&&d?.(),B.current=!1,R(null)},onFocus:A,onBlur:w}}}let wi=null;var ws=n(6284);function wl(e,t,n){let a="+"===e?t+n:t-n;if(t%1!=0||n%1!=0){let r=t.toString().split("."),o=n.toString().split("."),i=Math.pow(10,Math.max(r[1]&&r[1].length||0,o[1]&&o[1].length||0));t=Math.round(t*i),n=Math.round(n*i),a=("+"===e?t+n:t-n)/i}return a}let wc=(0,uq.createContext)(null),wu=(0,uq.createContext)(null),wp=(0,uq.forwardRef)(function(e,t){var n,a;[e,t]=mc(e,t,wc);let{validationBehavior:r}=ml($e)||{},o=null!=(a=null!=(n=e.validationBehavior)?n:r)?a:"native",{locale:i}=yo(),s=function(e){let{minValue:t,maxValue:n,step:a,formatOptions:r,value:o,defaultValue:i=NaN,onChange:s,locale:l,isDisabled:c,isReadOnly:u,commitBehavior:p="snap"}=e;null===o&&(o=NaN);let d=(0,uq.useCallback)(e=>void 0===a||isNaN(a)?$s(e,t,n):$c(e,t,n,a),[a,t,n]);void 0===o||isNaN(o)||"snap"!==p||(o=d(o)),isNaN(i)||"snap"!==p||(i=d(i));let[f,h]=_M(o,isNaN(i)?NaN:i,s),[m]=(0,uq.useState)(f),[g,y]=(0,uq.useState)(()=>isNaN(f)?"":new(0,vG.K)(l,r).format(f)),b=(0,uq.useMemo)(()=>new(0,ws.d)(l,r),[l,r]),v=(0,uq.useMemo)(()=>b.getNumberingSystem(g),[b,g]),$=(0,uq.useMemo)(()=>new(0,vG.K)(l,{...r,numberingSystem:v}),[l,r,v]),A=(0,uq.useMemo)(()=>$.resolvedOptions(),[$]),w=(0,uq.useCallback)(e=>isNaN(e)||null===e?"":$.format(e),[$]),k=vx({...e,value:f}),x=void 0===a||isNaN(a)?1:a;"percent"===A.style&&(void 0===a||isNaN(a))&&(x=.01);let[C,E]=(0,uq.useState)(f),[S,D]=(0,uq.useState)(l),[M,z]=(0,uq.useState)(r);Object.is(f,C)&&l===S&&r===M||(y(w(f)),E(f),D(l),z(r));let O=(0,uq.useMemo)(()=>b.parse(g),[b,g]),P=(e,a=0)=>{if(isNaN(O))return $c(isNaN(a)?0:a,t,n,x);{let a=$c(O,t,n,x);return"+"===e&&a>O||"-"===e&&a<O?a:$c(wl(e,O,x),t,n,x)}},T=(0,uq.useMemo)(()=>!c&&!u&&(isNaN(O)||void 0===n||isNaN(n)||$c(O,t,n,x)>O||wl("+",O,x)<=n),[c,u,t,n,x,O]),B=(0,uq.useMemo)(()=>!c&&!u&&(isNaN(O)||void 0===t||isNaN(t)||$c(O,t,n,x)<O||wl("-",O,x)>=t),[c,u,t,n,x,O]);return{...k,validate:e=>b.isValidPartialNumber(e,t,n),increment:()=>{let e=P("+",t);e===f&&y(w(e)),h(e),k.commitValidation()},incrementToMax:()=>{null!=n&&(h($c(n,t,n,x)),k.commitValidation())},decrement:()=>{let e=P("-",n);e===f&&y(w(e)),h(e),k.commitValidation()},decrementToMin:()=>{null!=t&&(h(t),k.commitValidation())},canIncrement:T,canDecrement:B,minValue:t,maxValue:n,numberValue:O,defaultNumberValue:isNaN(i)?m:i,setNumberValue:h,setInputValue:y,inputValue:g,commit:e=>{let t=void 0===e?g:e,n=O;if(void 0!==e&&(n=b.parse(t)),!t.length){h(NaN),y(void 0===o?"":w(f));return}if(isNaN(n))return void y(w(f));let a="snap"===p?d(n):n,r=(a=b.parse(w(a)))!==f;h(a),y(w(void 0===o?a:f)),r&&k.commitValidation()}}}({...e,locale:i,validationBehavior:o}),l=(0,uq.useRef)(null),[c,u]=mu(!e["aria-label"]&&!e["aria-labelledby"]),{labelProps:p,groupProps:d,inputProps:f,incrementButtonProps:h,decrementButtonProps:m,descriptionProps:g,errorMessageProps:y,...b}=function(e,t,n){var a,r,o,i,s,l,c,u,p;let d,{id:f,decrementAriaLabel:h,incrementAriaLabel:m,isDisabled:g,isReadOnly:y,isRequired:b,minValue:v,maxValue:$,autoFocus:A,label:w,formatOptions:k,onBlur:x=()=>{},onFocus:C,onFocusChange:E,onKeyDown:S,onKeyUp:D,description:M,errorMessage:z,isWheelDisabled:O,...P}=e,{increment:T,incrementToMax:B,decrement:I,decrementToMin:N,numberValue:j,inputValue:R,commit:F,commitValidation:L}=t,W=yE((a=we)&&a.__esModule?a.default:a,"@react-aria/numberfield"),G=(0,uq.useCallback)(()=>{let e=n.current?.value??"";(0,gS.flushSync)(()=>{F()}),n.current?.value!==e&&ys(n.current?.value??"","assertive")},[F,n]),V=mt(f),{focusProps:U}=gd({onBlur(){G()}}),q=wn(k),H=(0,uq.useMemo)(()=>q.resolvedOptions(),[q]),K=wn({...k,currencySign:void 0}),Y=(0,uq.useMemo)(()=>isNaN(j)?"":K.format(j),[K,j]),{spinButtonProps:J,incrementButtonProps:Z,decrementButtonProps:X}=wo({isDisabled:g,isReadOnly:y,isRequired:b,maxValue:$,minValue:v,onIncrement:T,onIncrementToMax:B,onDecrement:I,onDecrementToMin:N,value:j,textValue:Y}),[Q,ee]=(0,uq.useState)(!1),{focusWithinProps:et}=gL({isDisabled:g,onFocusWithinChange:ee});!function(e,t){let{onScroll:n,isDisabled:a}=e,r=(0,uq.useCallback)(e=>{!e.ctrlKey&&(e.preventDefault(),e.stopPropagation(),n&&n({deltaX:e.deltaX,deltaY:e.deltaY}))},[n]);bB(t,"wheel",a?void 0:r)}({onScroll:(0,uq.useCallback)(e=>{!(Math.abs(e.deltaY)<=Math.abs(e.deltaX))&&(e.deltaY>0?T():e.deltaY<0&&I())},[I,T]),isDisabled:O||g||y||!Q},n);let en=(H.maximumFractionDigits??0)>0,ea=void 0===t.minValue||isNaN(t.minValue)||t.minValue<0,er="numeric";mq()?ea?er="text":en&&(er="decimal"):mZ()&&(ea?er="numeric":en&&(er="decimal"));let eo=mA(e),ei=(0,uq.useCallback)(e=>{e.nativeEvent.isComposing||("Enter"===e.key?((0,gS.flushSync)(()=>{F()}),L()):e.continuePropagation())},[F,L]),{isInvalid:es,validationErrors:el,validationDetails:ec}=t.displayValidation,{labelProps:eu,inputProps:ep,descriptionProps:ed,errorMessageProps:ef}=function(e,t,n){let a=gC(e=>{let a=n.current;if(!a)return;let r=null;switch(e.inputType){case"historyUndo":case"historyRedo":case"insertLineBreak":return;case"deleteContent":case"deleteByCut":case"deleteByDrag":r=a.value.slice(0,a.selectionStart)+a.value.slice(a.selectionEnd);break;case"deleteContentForward":r=a.selectionEnd===a.selectionStart?a.value.slice(0,a.selectionStart)+a.value.slice(a.selectionEnd+1):a.value.slice(0,a.selectionStart)+a.value.slice(a.selectionEnd);break;case"deleteContentBackward":r=a.selectionEnd===a.selectionStart?a.value.slice(0,a.selectionStart-1)+a.value.slice(a.selectionStart):a.value.slice(0,a.selectionStart)+a.value.slice(a.selectionEnd);break;case"deleteSoftLineBackward":case"deleteHardLineBackward":r=a.value.slice(a.selectionStart);break;default:null!=e.data&&(r=a.value.slice(0,a.selectionStart)+e.data+a.value.slice(a.selectionEnd))}null!=r&&t.validate(r)||e.preventDefault()});(0,uq.useEffect)(()=>{if(!wt()||!n.current)return;let e=n.current;return e.addEventListener("beforeinput",a,!1),()=>{e.removeEventListener("beforeinput",a,!1)}},[n]);let r=wt()?null:e=>{let n=mS(e).value.slice(0,mS(e).selectionStart)+e.data+mS(e).value.slice(mS(e).selectionEnd);t.validate(n)||e.preventDefault()},{labelProps:o,inputProps:i,descriptionProps:s,errorMessageProps:l,...c}=function(e,t){let{inputElementType:n="input",isDisabled:a=!1,isRequired:r=!1,isReadOnly:o=!1,type:i="text",validationBehavior:s="aria"}=e,[l,c]=_M(e.value,e.defaultValue||"",e.onChange),{focusableProps:u}=gg(e,t),p=vx({...e,value:l}),{isInvalid:d,validationErrors:f,validationDetails:h}=p.displayValidation,{labelProps:m,fieldProps:g,descriptionProps:y,errorMessageProps:b}=vd({...e,isInvalid:d,errorMessage:e.errorMessage||f}),v=mA(e,{labelable:!0}),$={type:i,pattern:e.pattern},[A]=(0,uq.useState)(l);return vf(t,e.defaultValue??A,c),vh(e,p,t),{labelProps:m,inputProps:mr(v,"input"===n?$:void 0,{disabled:a,readOnly:o,required:r&&"native"===s,"aria-required":r&&"aria"===s||void 0,"aria-invalid":d||void 0,"aria-errormessage":e["aria-errormessage"],"aria-activedescendant":e["aria-activedescendant"],"aria-autocomplete":e["aria-autocomplete"],"aria-haspopup":e["aria-haspopup"],"aria-controls":e["aria-controls"],value:l,onChange:e=>c(mS(e).value),autoComplete:e.autoComplete,autoCapitalize:e.autoCapitalize,maxLength:e.maxLength,minLength:e.minLength,name:e.name,form:e.form,placeholder:e.placeholder,inputMode:e.inputMode,autoCorrect:e.autoCorrect,spellCheck:e.spellCheck,[parseInt(uH().version,10)>=17?"enterKeyHint":"enterkeyhint"]:e.enterKeyHint,onCopy:e.onCopy,onCut:e.onCut,onPaste:e.onPaste,onCompositionEnd:e.onCompositionEnd,onCompositionStart:e.onCompositionStart,onCompositionUpdate:e.onCompositionUpdate,onSelect:e.onSelect,onBeforeInput:e.onBeforeInput,onInput:e.onInput,...u,...g}),descriptionProps:y,errorMessageProps:b,isInvalid:d,validationErrors:f,validationDetails:h}}(e,n),u=(0,uq.useRef)(null);return{inputProps:mr(i,{onBeforeInput:r,onCompositionStart(){let{value:e,selectionStart:t,selectionEnd:a}=n.current;u.current={value:e,selectionStart:t,selectionEnd:a}},onCompositionEnd(){if(n.current&&!t.validate(n.current.value)){let{value:e,selectionStart:a,selectionEnd:r}=u.current;n.current.value=e,n.current.setSelectionRange(a,r),t.setInputValue(e)}}}),labelProps:o,descriptionProps:s,errorMessageProps:l,...c}}({...P,...eo,name:void 0,form:void 0,label:w,autoFocus:A,isDisabled:g,isReadOnly:y,isRequired:b,validate:void 0,[vk]:t,value:R,defaultValue:"!",autoComplete:"off","aria-label":e["aria-label"]||void 0,"aria-labelledby":e["aria-labelledby"]||void 0,id:V,type:"text",inputMode:er,onChange:e=>{t.validate(e)&&t.setInputValue(e)},onBlur:x,onFocus:C,onFocusChange:E,onKeyDown:(0,uq.useMemo)(()=>hX(ei,S),[ei,S]),onKeyUp:D,onPaste:t=>{e.onPaste?.(t);let n=mS(t);n&&(n.selectionEnd??-1)-(n.selectionStart??0)===n.value.length&&(t.preventDefault(),F(t.clipboardData?.getData?.("text/plain")?.trim()??""))},description:M,errorMessage:z},t,n);vf(n,t.defaultNumberValue,t.setNumberValue),r=t,o=e.validationBehavior,i=e.commitBehavior,s=n,l=t.minValue,c=t.maxValue,u=e.step,p=t.numberValue,hQ(()=>{let e=s.current;if("validate"!==i||r.realtimeValidation.isInvalid||!e||e.disabled||(!wi&&"u">typeof document&&((wi=document.createElement("input")).type="number"),!wi))return;wi.min=null==l||isNaN(l)?"":String(l),wi.max=null==c||isNaN(c)?"":String(c),wi.step=null==u||isNaN(u)?"":String(u),wi.value=null==p||isNaN(p)?"":String(p);let t=e.validity.valid&&wi.validity.valid,n=e.validationMessage||wi.validationMessage,a={isInvalid:!t,validationErrors:n?[n]:[],validationDetails:{badInput:e.validity.badInput,customError:e.validity.customError,patternMismatch:e.validity.patternMismatch,rangeOverflow:wi.validity.rangeOverflow,rangeUnderflow:wi.validity.rangeUnderflow,stepMismatch:wi.validity.stepMismatch,tooLong:e.validity.tooLong,tooShort:e.validity.tooShort,typeMismatch:e.validity.typeMismatch,valueMissing:e.validity.valueMissing,valid:t}};r.updateValidation(a),"native"!==o||wi.validity.valid||e.setCustomValidity(wi.validationMessage)});let eh=mr(J,U,ep,{role:null,"aria-roledescription":mK()?null:W.format("numberField"),"aria-valuemax":null,"aria-valuemin":null,"aria-valuenow":null,"aria-valuetext":null,autoCorrect:"off",spellCheck:"false"});"native"===e.validationBehavior&&(eh["aria-required"]=void 0);let em=e=>{((e=document)=>e.activeElement)()!==n.current&&("mouse"===e.pointerType?n.current?.focus():e.target.focus())},eg=e["aria-label"]||("string"==typeof e.label?e.label:"");eg||(d=null!=e.label?eu.id:e["aria-labelledby"]);let ey=mt(),eb=mt(),e_=mr(Z,{"aria-label":m||W.format("increase",{fieldLabel:eg}).trim(),id:d&&!m?ey:null,"aria-labelledby":d&&!m?`${ey} ${d}`:null,"aria-controls":V,excludeFromTabOrder:!0,preventFocusOnPress:!0,allowFocusWhenDisabled:!0,isDisabled:!t.canIncrement,onPressStart:em}),ev=mr(X,{"aria-label":h||W.format("decrease",{fieldLabel:eg}).trim(),id:d&&!h?eb:null,"aria-labelledby":d&&!h?`${eb} ${d}`:null,"aria-controls":V,excludeFromTabOrder:!0,preventFocusOnPress:!0,allowFocusWhenDisabled:!0,isDisabled:!t.canDecrement,onPressStart:em});return{groupProps:{...et,role:"group","aria-disabled":g,"aria-invalid":es?"true":void 0},labelProps:eu,inputProps:eh,incrementButtonProps:e_,decrementButtonProps:ev,errorMessageProps:ef,descriptionProps:ed,isInvalid:es,validationErrors:el,validationDetails:ec}}({...mp(e),label:u,validationBehavior:o},s,l),v=ms({...e,values:{state:s,isDisabled:e.isDisabled||!1,isInvalid:b.isInvalid||!1,isRequired:e.isRequired||!1},defaultClassName:"react-aria-NumberField"}),$=mA(e);return delete $.id,uH().createElement(mi,{values:[[wu,s],[_K,d],[_J,{...f,ref:l}],[$t,{...p,ref:c}],[gZ,{slots:{increment:h,decrement:m}}],[g0,{slots:{description:g,errorMessage:y}}],[v8,b]]},uH().createElement("div",{...$,...v,ref:t,slot:e.slot||void 0,"data-disabled":e.isDisabled||void 0,"data-required":e.isRequired||void 0,"data-invalid":b.isInvalid||void 0}),e.name&&uH().createElement("input",{type:"hidden",name:e.name,value:isNaN(s.numberValue)?"":s.numberValue}))});function wd(e,t){return Number.parseInt(AK(e,{calendar:t.calendar,locale:t.baseName,day:!1,month:!1,noToday:!0,numberingSystem:"latn"}))}let wf=(0,uq.forwardRef)(function(e,t){let{className:n}=e,a=(0,uq.useContext)(_j),r=(0,uq.useContext)(_R),o=a??r,i=(0,uq.useContext)(A8),s=by(),l=AK(o.visibleRange.start.toDate(s),{calendar:i.calendar,locale:i.baseName,day:!1,year:!1,noToday:!0}),c=wd(o.visibleRange.start.toDate(s),i),u=o.maxValue?wd(o.maxValue.toDate(s),i):void 0,p=o.minValue?wd(o.minValue.toDate(s),i):void 0,d=(0,uq.useCallback)(e=>{o.setFocusedDate(o.focusedDate.cycle("year",e-o.focusedDate.year))},[]);return o&&(0,dj.jsxs)("span",{ref:t,className:n,children:[(0,dj.jsx)("span",{children:l}),(0,dj.jsxs)(wp,{formatOptions:{useGrouping:!1},maxValue:u,minValue:p,onChange:d,value:c,children:[(0,dj.jsx)(_Z,{}),(0,dj.jsxs)(_Y,{children:[(0,dj.jsx)(gX,{slot:"increment",children:(0,dj.jsx)(fw,{size:8})}),(0,dj.jsx)(gX,{slot:"decrement",children:(0,dj.jsx)(fv,{size:8})})]})]})]})});var wh=n(4782),wm={};wm.styleTagTransform=dX(),wm.setAttributes=dK(),wm.insert=dq().bind(null,"head"),wm.domAPI=dV(),wm.insertStyleElement=dJ(),dW()(wh.A,wm);let wg=wh.A&&wh.A.locals?wh.A.locals:void 0;function wy({children:e}){let t=(0,uq.useContext)($7),n=(0,uq.useContext)($9),a=t??n,r=dl(()=>a?.close());return(0,dj.jsx)(v6,{className:wg.dialog,ref:r,children:e})}let wb=(0,uq.forwardRef)(function({variant:e,today_:t,minDate:n,maxDate:a},r){let o="range"===e;return(0,dj.jsx)($3,{ref:r,className:wg.popover,placement:"bottom start",offset:1,isNonModal:!0,children:(0,dj.jsx)(wy,{children:(0,dj.jsxs)(o?_L:_F,{...o?{minValue:n,maxValue:a,className:"cds--date-picker__calendar"}:{},children:[(0,dj.jsxs)("header",{className:wg.header,children:[(0,dj.jsx)(gX,{className:dF()(wg.flatButton,wg.flatButtonMd),slot:"previous",children:(0,dj.jsx)(fM,{size:16})}),(0,dj.jsx)(wf,{className:wg.monthYear}),(0,dj.jsx)(gX,{className:dF()(wg.flatButton,wg.flatButtonMd),slot:"next",children:(0,dj.jsx)(fz,{size:16})})]}),(0,dj.jsx)(_G,{className:wg.calendarGrid,children:e=>(0,dj.jsx)(_H,{className:dF()("cds--date-picker__day",{[wg.today]:0===t.compare(e)}),date:e},e.toString())})]})})})}),w_=(0,uq.forwardRef)(function(e,t){let n=(0,uq.useContext)($7),[a,r]=mc({slot:e.slot},t,vK),{locale:o}=yo(),i=vH({...a,locale:o,createCalendar:_$}),s=(0,uq.useRef)(null),{fieldProps:l,inputProps:c}=vb({...a,inputRef:s},i,r),u=(0,uq.useCallback)(()=>{i.isDisabled||n.toggle()},[]);return(0,dj.jsxs)(mi,{values:[[vY,i],[_J,{...c,ref:s}],[_K,{...l,ref:r,isInvalid:i.isInvalid}]],children:[(0,dj.jsx)(_Y,{...e,id:e.id,ref:t,slot:e.slot||void 0,className:e.className,isDisabled:i.isDisabled,isInvalid:i.isInvalid,onClick:u,children:i.segments.map((t,n)=>(0,uq.cloneElement)(e.children(t),{key:n}))}),(0,dj.jsx)(_Z,{})]})}),wv=(0,uq.forwardRef)(function(e,t){let n=(0,uq.useContext)($7),a=(0,uq.useContext)($9);return(n??a).isInvalid?(0,dj.jsx)(hI,{ref:t,size:16,...e}):(0,dj.jsx)(f_,{ref:t,size:16,...e})});class w${constructor(e,t){this.locale=e,this.dictionary=t}of(e){return this.dictionary.getStringForLocale(e,this.locale)}}let wA=new Map,ww=(0,uq.forwardRef)(function({segment:e,...t},n){let a=(0,uq.useContext)(vY),r=hY(n),{segmentProps:o}=function(e,t,n){let a,r,o,i,s=(0,uq.useRef)(""),{locale:l,direction:c}=yo(),u=function(){var e;let{locale:t}=yo(),n=yC((e=vc)&&e.__esModule?e.default:e,"@react-aria/datepicker");return(0,uq.useMemo)(()=>{try{return new Intl.DisplayNames(t,{type:"dateTimeField"})}catch{return new w$(t,n)}},[t,n])}(),{ariaLabel:p,ariaLabelledBy:d,ariaDescribedBy:f,focusManager:h}=vm.get(t),m=e.isPlaceholder?"":e.text,g=(0,uq.useMemo)(()=>t.dateFormatter.resolvedOptions(),[t.dateFormatter]),y=yy({month:"long",timeZone:g.timeZone}),b=yy({hour:"numeric",hour12:g.hour12,timeZone:g.timeZone});if("month"!==e.type||e.isPlaceholder)"hour"!==e.type||e.isPlaceholder||(m=b.format(t.dateValue));else{let e=y.format(t.dateValue);m=e!==m?`${m} \u{2013} ${e}`:e}let{spinButtonProps:v}=wo({value:e.value??void 0,textValue:m,minValue:e.minValue,maxValue:e.maxValue,isDisabled:t.isDisabled,isReadOnly:t.isReadOnly||!e.isEditable,isRequired:t.isRequired,onIncrement:()=>{s.current="",t.increment(e.type)},onDecrement:()=>{s.current="",t.decrement(e.type)},onIncrementPage:()=>{s.current="",t.incrementPage(e.type)},onDecrementPage:()=>{s.current="",t.decrementPage(e.type)},onIncrementToMax:()=>{s.current="",t.incrementToMax(e.type)},onDecrementToMin:()=>{s.current="",t.decrementToMin(e.type)}}),$=(0,uq.useMemo)(()=>new(0,ws.d)(l,{maximumFractionDigits:0}),[l]),A=()=>{if(e.text===e.placeholder&&h.focusPrevious(),!$.isValidPartialNumber(e.text)||t.isReadOnly||e.isPlaceholder)("dayPeriod"===e.type||"era"===e.type)&&t.clearSegment(e.type);else{let n=e.text.slice(0,-1),a=$.parse(n);0===(n=0===a?"":n).length||0===a?t.clearSegment(e.type):t.setSegment(e.type,a),s.current=n}},{startsWith:w}=(a=function(e){let{locale:t}=yo(),n=t+(e?Object.entries(e).sort((e,t)=>e[0]<t[0]?-1:1).join():"");if(wA.has(n))return wA.get(n);let a=new Intl.Collator(t,e);return wA.set(n,a),a}({usage:"search",sensitivity:"base"}),r=(0,uq.useCallback)((e,t)=>0===t.length||(e=e.normalize("NFC"),t=t.normalize("NFC"),0===a.compare(e.slice(0,t.length),t)),[a]),o=(0,uq.useCallback)((e,t)=>0===t.length||(e=e.normalize("NFC"),t=t.normalize("NFC"),0===a.compare(e.slice(-t.length),t)),[a]),i=(0,uq.useCallback)((e,t)=>{if(0===t.length)return!0;e=e.normalize("NFC");let n=0,r=(t=t.normalize("NFC")).length;for(;n+r<=e.length;n++){let o=e.slice(n,n+r);if(0===a.compare(t,o))return!0}return!1},[a]),(0,uq.useMemo)(()=>({startsWith:r,endsWith:o,contains:i}),[r,o,i])),k=yy({hour:"numeric",hour12:!0}),x=(0,uq.useMemo)(()=>{let e=new Date;return e.setHours(0),k.formatToParts(e).find(e=>"dayPeriod"===e.type).value},[k]),C=(0,uq.useMemo)(()=>{let e=new Date;return e.setHours(12),k.formatToParts(e).find(e=>"dayPeriod"===e.type).value},[k]),E=yy({year:"numeric",era:"narrow",timeZone:"UTC"}),S=(0,uq.useMemo)(()=>{if("era"!==e.type)return[];let n=bo(new y1(1,1,1),t.calendar),a=t.calendar.getEras().map(e=>{let t=n.set({year:1,month:1,day:1,era:e}).toDate("UTC");return{era:e,formatted:E.formatToParts(t).find(e=>"era"===e.type).value}}),r=function(e){e.sort();let t=e[0],n=e[e.length-1];for(let e=0;e<t.length;e++)if(t[e]!==n[e])return e;return 0}(a.map(e=>e.formatted));if(r)for(let e of a)e.formatted=e.formatted.slice(r);return a},[E,t.calendar,e.type]),D=n=>{if(t.isDisabled||t.isReadOnly)return;let a=s.current+n;switch(e.type){case"dayPeriod":if(w(x,n))t.setSegment("dayPeriod",0);else if(w(C,n))t.setSegment("dayPeriod",1);else break;h.focusNext();break;case"era":{let e=S.find(e=>w(e.formatted,n));e&&(t.setSegment("era",e.era),h.focusNext());break}case"day":case"hour":case"minute":case"second":case"month":case"year":{if(!$.isValidPartialNumber(a))return;let r=$.parse(a),o=r;if(void 0!==e.maxValue&&r>e.maxValue&&(o=$.parse(n)),isNaN(r))return;t.setSegment(e.type,o),void 0!==e.maxValue&&(Number(r+"0")>e.maxValue||a.length>=String(e.maxValue).length)?(s.current="",h.focusNext()):s.current=a}}};bB((0,uq.useRef)("u">typeof document?document:null),"selectionchange",()=>{let e=window.getSelection();e?.anchorNode&&mE(n.current,e?.anchorNode)&&e.collapse(n.current)});let M=(0,uq.useRef)("");bB(n,"beforeinput",a=>{if(n.current)switch(a.preventDefault(),a.inputType){case"deleteContentBackward":case"deleteContentForward":$.isValidPartialNumber(e.text)&&!t.isReadOnly&&A();break;case"insertCompositionText":M.current=n.current.textContent,n.current.textContent=n.current.textContent;break;default:null!=a.data&&D(a.data)}}),bB(n,"input",e=>{let{inputType:t,data:a}=e;"insertCompositionText"===t&&(n.current&&(n.current.textContent=M.current),null!=a&&(w(x,a)||w(C,a))&&D(a))}),hQ(()=>{let e=n.current;return()=>{((e=document)=>e.activeElement)()===e&&(h.focusPrevious()||h.focusNext())}},[n,h]);let z=mK()||"timeZoneName"===e.type?{role:"textbox","aria-valuemax":null,"aria-valuemin":null,"aria-valuetext":null,"aria-valuenow":null}:{};e===(0,uq.useMemo)(()=>t.segments.find(e=>e.isEditable),[t.segments])||t.isInvalid||(f=void 0);let O=mt(),P=!t.isDisabled&&!t.isReadOnly&&e.isEditable,T="literal"===e.type?"":u.of(e.type),B=bM({"aria-label":`${T}${p?`, ${p}`:""}${d?", ":""}`,"aria-labelledby":d});if("literal"===e.type)return{segmentProps:{"aria-hidden":!0}};let I={caretColor:"transparent"};if("rtl"===c){I.unicodeBidi="embed";let t=g[e.type];("numeric"===t||"2-digit"===t)&&(I.direction="ltr")}return{segmentProps:mr(v,B,{id:O,...z,"aria-invalid":t.isInvalid?"true":void 0,"aria-describedby":f,"aria-readonly":t.isReadOnly||!e.isEditable?"true":void 0,"data-placeholder":e.isPlaceholder||void 0,contentEditable:P,suppressContentEditableWarning:P,spellCheck:P?"false":void 0,autoCorrect:P?"off":void 0,[parseInt(uH().version,10)>=17?"enterKeyHint":"enterkeyhint"]:P?"next":void 0,inputMode:t.isDisabled||"dayPeriod"===e.type||"era"===e.type||!P?void 0:"numeric",tabIndex:t.isDisabled?void 0:0,onKeyDown:e=>{if("a"===e.key&&(mU()?e.metaKey:e.ctrlKey)&&e.preventDefault(),!e.ctrlKey&&!e.metaKey&&!e.shiftKey&&!e.altKey)switch(e.key){case"Backspace":case"Delete":e.preventDefault(),e.stopPropagation(),A()}},onFocus:()=>{s.current="",n.current&&bF(n.current,{containingElement:bN(n.current)});let e=window.getSelection();e?.collapse(n.current)},style:I,onPointerDown(e){e.stopPropagation()},onMouseDown(e){e.stopPropagation()}})}}(e,a,r),{focusProps:i,isFocused:s,isFocusVisible:l}=gW(),{hoverProps:c,isHovered:u}=gH({...t,isDisabled:a.isDisabled||"literal"===e.type}),p=function(e){let{className:t,style:n,children:a,defaultClassName:r,defaultChildren:o,defaultStyle:i,values:s}=e;return(0,uq.useMemo)(()=>{let e,l,c;return e="function"==typeof t?t({...s,defaultClassName:r}):t,l="function"==typeof n?n({...s,defaultStyle:i||{}}):n,c="function"==typeof a?a({...s,defaultChildren:o}):null==a?o:a,{className:e??r,style:l||i?{...i,...l}:void 0,children:c??o,"data-rac":""}},[t,n,a,r,o,i,s])}({...t,values:{...e,isReadOnly:!e.isEditable,isInvalid:a.isInvalid,isDisabled:a.isDisabled,isHovered:u,isFocused:s,isFocusVisible:l},defaultChildren:e.text}),d=(0,uq.useCallback)(e=>{e.stopPropagation()},[]);return(0,dj.jsx)("span",{...mr(mA(t),o,i,c),...p,ref:r,style:o.style,"data-placeholder":e.isPlaceholder||void 0,"data-invalid":a.isInvalid||void 0,"data-readonly":!e.isEditable||void 0,"data-disabled":a.isDisabled||void 0,"data-type":e.type,"data-hovered":u||void 0,"data-focused":s||void 0,"data-focus-visible":l||void 0,onClick:d})}),wk={short:!1,size:"md"},wx=(0,uq.forwardRef)(function(e,t){let{className:n,defaultValue:a,isDisabled:r,invalid:o,invalidText:i,isInvalid:s,label:l,labelText:c,light:u,maxDate:p,minDate:d,onChange:f,onChangeRaw:h,short:m,size:g,value:y,...b}={...wk,...e},{calendar:v,intlLocale:$,today_:A}=A7(),w=(0,uq.useId)(),k=!!(c??l),x=(0,uq.useMemo)(()=>Aa(a,v),[a,v]),C=(0,uq.useMemo)(()=>Aa(y,v,!0),[y,v]),E=(0,uq.useMemo)(()=>Aa(p,v),[p,v]),S=(0,uq.useMemo)(()=>Aa(d??A9,v),[d,v]),D=(0,uq.useMemo)(()=>o||s,[o,s]),M=(0,uq.useMemo)(()=>(h&&f&&console.error("An OpenmrsDatePicker component was created with both onChange and onChangeRaw handlers defined. Only onChangeRaw will be used."),h??(e=>f?.(Ar(e)))),[h,f]);return(0,dj.jsx)(An,{locale:$.toString(),children:(0,dj.jsx)("div",{className:dF()("cds--form-item",n),children:(0,dj.jsx)(mi,{values:[[A8,$]],children:(0,dj.jsxs)(Ae,{className:dF()("cds--date-picker","cds--date-picker--single",{"cds--date-picker--short":m,"cds--date-picker--light":u}),defaultValue:x,isDisabled:r,isInvalid:D,maxValue:E,minValue:S,value:C,shouldForceLeadingZeros:"en"===$.language||void 0,...b,onChange:M,children:[(0,dj.jsxs)("div",{className:"cds--date-picker-container",children:[k&&(0,dj.jsx)($n,{className:dF()("cds--label",{"cds--label--disabled":r}),htmlFor:w,children:c??l}),(0,dj.jsxs)(_Y,{className:wg.inputGroup,children:[(0,dj.jsx)(w_,{id:k?w:void 0,ref:t,className:dF()("cds--date-picker-input__wrapper",wg.inputWrapper,{[wg.inputWrapperSm]:"sm"===g,[wg.inputWrapperMd]:"md"===g||!g||0===g.length,[wg.inputWrapperLg]:"lg"===g}),children:e=>"era"!==e.type?(0,dj.jsx)(ww,{className:wg.inputSegment,segment:e}):(0,dj.jsx)(uH().Fragment,{})}),(0,dj.jsx)(gX,{className:dF()(wg.flatButton,{[wg.flatButtonSm]:"sm"===g,[wg.flatButtonMd]:"md"===g||!g||0===g.length,[wg.flatButtonLg]:"lg"===g}),children:(0,dj.jsx)(wv,{})})]}),(0,dj.jsx)(v7,{className:wg.invalidText,children:i})]}),(0,dj.jsx)(wb,{variant:"single",today_:A})]})})})})}),wC=(0,uq.forwardRef)(function({className:e,defaultValue:t,invalid:n,invalidText:a,isDisabled:r,isInvalid:o,label:i,labelText:s,light:l,maxDate:c,minDate:u,onChange:p,onChangeRaw:d,size:f="md",value:h,...m},g){let{calendar:y,intlLocale:b,today_:v}=A7(),$=(0,uq.useId)(),A=!!(s??i),w=(0,uq.useMemo)(()=>{if(h)return{start:Aa(h[0],y,!1),end:Aa(h[1],y,!1)}},[h,y]),k=(0,uq.useMemo)(()=>{if(t)return{start:Aa(t[0],y,!1),end:Aa(t[1],y,!1)}},[t,y]),x=(0,uq.useMemo)(()=>Aa(u??A9,y,!0),[u,y]),C=(0,uq.useMemo)(()=>Aa(c,y,!0),[c,y]),E=(0,uq.useMemo)(()=>n||o,[n,o]),S=(0,uq.useMemo)(()=>(d&&p&&console.error("An OpenmrsDateRangePicker component was created with both onChange and onChangeRaw handlers defined. Only onChangeRaw will be used."),d??(e=>p?.([Ar(e.start),Ar(e.end)]))),[d,p]);return(0,dj.jsx)(An,{locale:b.toString(),children:(0,dj.jsx)("div",{className:dF()("cds--form-item",e),children:(0,dj.jsx)(mi,{values:[[A8,b]],children:(0,dj.jsx)(At,{id:A?$:void 0,className:dF()("cds--date-picker",{"cds--date-picker--light":l,"cds--date-picker--disabled":r}),isInvalid:E,shouldForceLeadingZeros:"en"===b.language||void 0,maxValue:C,minValue:x,value:w,defaultValue:k,ref:g,isDisabled:r,...m,onChange:S,children:(0,dj.jsxs)("div",{className:"cds--date-picker-container",children:[A&&(0,dj.jsx)($n,{className:dF()("cds--label",{"cds--label--disabled":r}),htmlFor:$,children:s??i}),(0,dj.jsxs)(_Y,{className:wg.inputGroup,children:[(0,dj.jsxs)("div",{className:dF()(wg.inputsWrapper,{[wg.inputsWrapperSm]:"sm"===f,[wg.inputsWrapperMd]:"md"===f||!f||0===f.length,[wg.inputsWrapperLg]:"lg"===f}),children:[(0,dj.jsx)(vZ,{className:dF()("cds--date-picker-input__wrapper",wg.startInput,wg.dateInputWrapper),slot:"start",children:e=>(0,dj.jsx)(ww,{className:wg.inputSegment,segment:e})}),(0,dj.jsx)("div",{className:wg.separator,children:(0,dj.jsx)("span",{"aria-hidden":"true","data-readonly":!0,children:"–"})}),(0,dj.jsx)(vZ,{className:dF()("cds--date-picker-input__wrapper",wg.endInput,wg.dateInputWrapper),slot:"end",children:e=>(0,dj.jsx)(ww,{className:wg.inputSegment,segment:e})})]}),(0,dj.jsx)(gX,{className:dF()(wg.flatButton,{[wg.flatButtonSm]:"sm"===f,[wg.flatButtonMd]:"md"===f||!f||0===f.length,[wg.flatButtonLg]:"lg"===f}),children:(0,dj.jsx)(wv,{})})]}),(0,dj.jsx)(v7,{className:wg.invalidText,children:a}),(0,dj.jsx)(wb,{variant:"range",today_:v,minDate:x,maxDate:C})]})})})})})});var wE=n(9124),wS={};wS.styleTagTransform=dX(),wS.setAttributes=dK(),wS.insert=dq().bind(null,"head"),wS.domAPI=dV(),wS.insertStyleElement=dJ(),dW()(wE.A,wS);let wD=wE.A&&wE.A.locals?wE.A.locals:void 0,wM=({diagnoses:e})=>{let{diagnosisTags:t}=pR({externalModuleName:"@openmrs/esm-styleguide"});return(0,dj.jsx)("div",{className:wD.container,children:e.map(e=>{let{rank:n,uuid:a,display:r}=e,o=t[1===n?"primaryColor":"secondaryColor"];return(0,dj.jsx)(d6.Tag,{type:o,children:r},a)})})};var wz=n(7770),wO={};wO.styleTagTransform=dX(),wO.setAttributes=dK(),wO.insert=dq().bind(null,"head"),wO.domAPI=dV(),wO.insertStyleElement=dJ(),dW()(wz.A,wO);let wP=wz.A&&wz.A.locals?wz.A.locals:void 0,wT=({width:e="64",height:t="64"})=>(0,dj.jsx)("svg",{width:e,height:t,viewBox:"0 0 64 64",children:(0,dj.jsx)("use",{href:"#omrs-empty-data-illustration"})}),wB=e=>{let t="tablet"===dn(),n=e.launchForm;return(0,dj.jsx)(d6.Layer,{className:wP.layer,children:(0,dj.jsxs)(d6.Tile,{className:wP.tile,children:[(0,dj.jsx)("div",{className:t?wP.tabletHeading:wP.desktopHeading,children:(0,dj.jsx)("h4",{children:e.headerTitle})}),(0,dj.jsx)(wT,{}),(0,dj.jsx)("p",{className:wP.content,children:rp("emptyStateText","There are no {{displayText}} to display",{displayText:e.displayText})}),(0,dj.jsx)("p",{className:wP.action,children:n&&(0,dj.jsx)(d6.Button,{onClick:()=>n(),kind:"ghost",size:t?"lg":"sm",children:rp("recordNewEntry","Record {{ displayText }}",{displayText:e.displayText})})})]})})};var wI=n(6099),wN={};wN.styleTagTransform=dX(),wN.setAttributes=dK(),wN.insert=dq().bind(null,"head"),wN.domAPI=dV(),wN.insertStyleElement=dJ(),dW()(wI.A,wN);let wj=wI.A&&wI.A.locals?wI.A.locals:void 0,wR=({error:e,headerTitle:t})=>{let n="tablet"===dn();return(0,dj.jsx)(d6.Layer,{children:(0,dj.jsxs)(d6.Tile,{className:wj.tile,children:[(0,dj.jsx)("div",{className:n?wj.tabletHeading:wj.desktopHeading,children:(0,dj.jsx)("h4",{children:t})}),(0,dj.jsxs)("p",{className:wj.errorMessage,children:[rp("error","Error")," ",`${e?.response?.status}: `,e?.response?.statusText]}),(0,dj.jsx)("p",{className:wj.errorCopy,children:rp("errorCopy")})]})})},wF=wR;var wL=n(5764),wW={};wW.styleTagTransform=dX(),wW.setAttributes=dK(),wW.insert=dq().bind(null,"head"),wW.domAPI=dV(),wW.insertStyleElement=dJ(),dW()(wL.A,wW);let wG=wL.A&&wL.A.locals?wL.A.locals:void 0,wV=uH().forwardRef((e,t)=>{let{slotName:n,basePath:a,componentContext:r,state:o}=di(),i=window.location??{pathname:""},s=u3(n??"");return e.isChildOfHeader&&n&&s.length>0?(0,dj.jsxs)(d6.SideNav,{"aria-label":rp("leftNavigation","Left navigation"),className:wG.leftNav,expanded:!0,isFixedNav:!0,ref:t,...e,children:[(0,dj.jsx)(u6,{name:"global-nav-menu-slot"}),n?(0,dj.jsx)(pM,{value:r,fallback:(0,dj.jsx)(u6,{name:n,state:{basePath:a,currentPath:i,...o}}),children:(0,dj.jsx)(uK.Provider,{value:r,children:(0,dj.jsx)(u6,{name:n,state:{basePath:a,currentPath:i,...o}})})}):null]}):null});var wU=n(8500),wq={};wq.styleTagTransform=dX(),wq.setAttributes=dK(),wq.insert=dq().bind(null,"head"),wq.domAPI=dV(),wq.insertStyleElement=dJ(),dW()(wU.A,wq);let wH=wU.A&&wU.A.locals?wU.A.locals:void 0,wK=({selectedLocationUuid:e,defaultLocationUuid:t,locationTag:n,locationsPerRequest:a=50,onChange:r})=>{let[o,i]=(0,uq.useState)(""),s=(0,uq.useId)(),{location:l}=function(e){let t=e?`/ws/fhir2/R4/Location?_id=${e}`:null,{data:n,error:a,isLoading:r}=pV()(t,n4,{shouldRetryOnError:e=>!!e?.response?.status&&e.response.status>=500});return(0,uq.useMemo)(()=>({location:n?.data?.entry?n.data.entry[0]:null,error:t?a:null,isLoading:!!t&&r}),[n,r,a,t])}(t),{locations:c,isLoading:u,hasMore:p,loadingNewData:d,error:f,setPage:h}=function(e,t=0,n=""){let a=pW(n),{data:r,isLoading:o,isValidating:i,setSize:s,error:l}=p4()(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 o=`${n1}/Location?`,i=new URLSearchParams;return i.append("_summary","data"),t&&i.append("_count",""+t),n&&i.append("_getpagesoffset",""+n*t),e&&i.append("_tag",e),"string"==typeof a&&""!==a&&i.append("name:contains",a),o+i.toString()},n4);return(0,uq.useMemo)(()=>({locations:r?.length?r?.flatMap(e=>e?.data?.entry??[]):[],isLoading:o,totalResults:r?.[0]?.data?.total,hasMore:!!r?.length&&r?.[r.length-1]?.data?.link?.some(e=>"next"===e.relation),loadingNewData:i,error:l||null,setPage:s}),[o,r,i,s,l])}(n,a,o),m=(0,uq.useMemo)(()=>l&&!o&&t?[l,...c.filter(({resource:e})=>e.id!==t)]:c??[],[l,c,t,o]),g=(0,uq.useCallback)(e=>{r(),i(e.trim())},[r]),y=dc((0,uq.useCallback)(()=>{!d&&p&&h(e=>e+1)},[d,p,h])),b=p?Math.max(0,Math.floor(m.length-a/2)):-1;return(0,dj.jsxs)(dj.Fragment,{children:[(0,dj.jsx)(d6.Search,{"aria-describedby":f?`${s}-error`:void 0,labelText:rp("searchForLocation"),id:s,placeholder:rp("searchForLocation"),onChange:e=>g(e.target.value),size:"lg"}),f&&(0,dj.jsx)("div",{className:wH.errorNotification,id:`${s}-error`,children:(0,dj.jsx)(d6.InlineNotification,{kind:"error",subtitle:rp("errorLoadingLoginLocations","Unable to load login locations. Please try again or contact support if the problem persists."),title:rp("error","Error")})}),(0,dj.jsx)("div",{className:wH.searchResults,children:u?(0,dj.jsx)("div",{className:wH.loadingContainer,children:Array.from({length:5}).map((e,t)=>(0,dj.jsx)(d6.RadioButtonSkeleton,{className:wH.radioButtonSkeleton,role:"progressbar"},t))}):(0,dj.jsxs)(dj.Fragment,{children:[(0,dj.jsx)("div",{className:wH.locationResultsContainer,children:m.length>0?(0,dj.jsx)(d6.RadioButtonGroup,{name:"loginLocations",onChange:e=>{r(e?.toString())},orientation:"vertical",valueSelected:e,children:m.map((e,t)=>(0,dj.jsx)(d6.RadioButton,{className:wH.locationRadioButton,id:e.resource.id,labelText:(0,dj.jsx)("span",{ref:t===b?y:null,children:e.resource.name}),name:e.resource.name,value:e.resource.id},e.resource.id))}):(0,dj.jsx)("div",{className:wH.emptyState,children:(0,dj.jsx)("p",{className:wH.locationNotFound,children:rp("noResultsToDisplay")})})}),d&&(0,dj.jsx)("div",{className:wH.loadingIcon,children:(0,dj.jsx)(d6.InlineLoading,{description:rp("loading")})})]})})]})},wY=V("modalState",{modalContainer:null,modalStack:[]}),wJ=0;async function wZ(e,t,n={}){let a=uD(t),r=null;if(e){if(!a)throw Error(`No modal named '${t}' has been registered.`);let{load:o}=a,i=await o(),s=wJ++;r=t2({...i,name:`${t}-${s}`},{...n,domElement:e})}else T(`Failed to launch modal. Please notify your administrator. Modal name: ${t}`);return r}let wX=window.getComputedStyle(document.body).overflow;function wQ({modalStack:e,modalContainer:t}){t&&(e.length?(t.style.visibility||(addEventListener("keydown",w1),document.body.style.overflow="hidden",t.style.visibility="unset"),e.forEach((n,a)=>{switch(n.state){case"NEW":{let e=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:n.props?.size??"md"});n.container=e,wZ(e,n.modalName,n.props).then(a=>{n.parcel=a,n.state="MOUNTED",t.prepend(e),e.style.visibility="unset"});break}case"MOUNTED":n.container&&(n.container.style.visibility=a?"hidden":"unset");break;case"TO_BE_DELETED":n.onClose(),n.parcel?.unmount?.(),n.container?.remove(),setTimeout(()=>{wY.setState({modalContainer:t,modalStack:e.filter(e=>e!==n)})},0)}})):(t.style.removeProperty("visibility"),document.body.style.overflow=wX,removeEventListener("keydown",w1)))}function w0(e){let t=wY.getState(),n=t.modalStack.map(t=>t===e?{...t,state:"TO_BE_DELETED"}:t);wY.setState({...t,modalStack:n})}function w1(e){"Escape"===e.key&&function(){let[e]=wY.getState().modalStack;e&&w0(e)}()}function w2(e){wY.subscribe(wQ),wY.setState({...wY.getState(),modalContainer:e})}function w3(e,t={},n=()=>{}){let a=()=>{let e=wY.getState().modalStack.find(e=>e.onClose===n);e&&w0(e)};if(uD(e)){var r;let o,i;r={state:"NEW",onClose:n,modalName:e,props:{close:a,...t}},i=[r,...(o=wY.getState()).modalStack],wY.setState({...o,modalStack:i})}else T(`Failed to launch modal. Please notify your administrator. Modal name: "${e}"`);return a}let w4=({notification:e})=>{let{description:t,action:n,kind:a,critical:r,title:o,onAction:i}=e;return(0,dj.jsx)(d6.ActionableNotification,{actionButtonLabel:n,kind:a||"info",lowContrast:r,subtitle:t,title:o||"",inline:!0,onActionButtonClick:i})},w5=({subject:e})=>{let[t,n]=(0,uq.useState)([]);return(0,uq.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,dj.jsx)(dj.Fragment,{children:t.map(e=>(0,dj.jsx)(w4,{notification:e},e.id))})},w6=({notification:e})=>{let{actionButtonLabel:t,onActionButtonClick:n=()=>{},subtitle:a,kind:r,title:o,critical:i,progressActionLabel:s,id:l,...c}=e,[u,p]=(0,uq.useState)(t);return(0,dj.jsx)(d6.ActionableNotification,{kind:r||"info",actionButtonLabel:u,ariaLabel:rp("closesActionableNotification","Closes actionable notification"),onActionButtonClick:()=>{n(),s&&p(s)},statusIconDescription:rp("actionableNotification","Actionable notification"),subtitle:a,title:o,lowContrast:i,inline:!0,...c})},w8=({subject:e})=>{let[t,n]=(0,uq.useState)([]);return(0,uq.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,dj.jsx)(dj.Fragment,{children:t.map(e=>(0,dj.jsx)(w6,{notification:e},e.id))})};var w7=n(6401);let w9=new ch,ke=0,kt=new ch,kn=0;function ka(e){e&&(0,u8.createRoot)(e).render((0,dj.jsx)(w5,{subject:w9}))}function kr(e){var t;e&&("string"==typeof(t=e.description)?t.trim().length>0:"object"==typeof t&&(t instanceof Error||!(0,w7.A)(t)))?(e.description instanceof Error&&(e.description=e.description.toLocaleString()),setTimeout(()=>{w9.next({...e,id:ke++})},0)):console.error("showNotification must be called with an object having a 'description' property that is a non-empty string or object")}function ko(e){e&&(0,u8.createRoot)(e).render((0,dj.jsx)(w8,{subject:kt}))}function ki(e){var t;e&&("string"==typeof(t=e.actionButtonLabel)?t.trim().length>0:"object"==typeof t&&!(0,w7.A)(t))?setTimeout(()=>{kt.next({...e,id:kn++})},0):console.error("showActionableNotification must be called with an actionButtonLabel that is a non-empty string")}let ks=["NORMAL","HIGH","CRITICALLY_HIGH","OFF_SCALE_HIGH","LOW","CRITICALLY_LOW","OFF_SCALE_LOW"],kl=["critically_low","critically_high","high","low","normal","off_scale_low","off_scale_high"];var kc=n(4112),ku={};ku.styleTagTransform=dX(),ku.setAttributes=dK(),ku.insert=dq().bind(null,"head"),ku.domAPI=dV(),ku.insertStyleElement=dJ(),dW()(kc.A,ku);let kp=kc.A&&kc.A.locals?kc.A.locals:void 0,kd=({value:e,unit:t,label:n,interpretation:a,referenceRange:r,conceptUuid:o,variant:i="card",patientUuid:s})=>{let l=(0,uq.useId)(),{referenceRange:c,isLoading:u}=function(e,t){let n=null;e&&(n=t?`${n0}/conceptreferencerange/?patient=${t}&concept=${e}&v=full`:`${n0}/conceptreferencerange/?concept=${e}&v=full`);let{data:a,error:r,isLoading:o}=pV()(n,n4),i=a?.data?.results?.[0];return{referenceRange:i?{hiNormal:i.hiNormal??null,hiAbsolute:i.hiAbsolute??null,hiCritical:i.hiCritical??null,lowNormal:i.lowNormal??null,lowAbsolute:i.lowAbsolute??null,lowCritical:i.lowCritical??null}:void 0,error:r,isLoading:o}}(r||a?void 0:o,s),p=r??c,d=(0,uq.useMemo)(()=>{if(a)return a?"--"===a?"normal":ks.includes(a)?a.toLowerCase():kl.includes(a)?a:"normal":void 0;if(p&&!u){if(!p||null==e||""===e)return"normal";let t="string"==typeof e?Number.parseFloat(e):e;return Number.isNaN(t)?"normal":null!==p.hiAbsolute&&void 0!==p.hiAbsolute&&t>p.hiAbsolute?"off_scale_high":null!==p.hiCritical&&void 0!==p.hiCritical&&t>=p.hiCritical?"critically_high":null!==p.hiNormal&&void 0!==p.hiNormal&&t>p.hiNormal?"high":null!==p.lowAbsolute&&void 0!==p.lowAbsolute&&t<p.lowAbsolute?"off_scale_low":null!==p.lowCritical&&void 0!==p.lowCritical&&t<=p.lowCritical?"critically_low":null!==p.lowNormal&&void 0!==p.lowNormal&&t<p.lowNormal?"low":"normal"}return"normal"},[a,p,e,u])??"normal",f="critically_low"===d||"critically_high"===d||"off_scale_low"===d||"off_scale_high"===d,h="normal"!==d,m=n?`omrs-numeric-obs-label-${n.replaceAll(/\s+/g,"-").toLowerCase()}-${l}`:void 0,g=`omrs-numeric-obs-value-${l}`,y=`omrs-numeric-obs-unit-${l}`,b=null!=e&&""!==e,v=b?e:rp("notAvailable","Not available"),$=dF()({[kp["critically-low"]]:"critically_low"===d||"off_scale_low"===d,[kp["critically-high"]]:"critically_high"===d||"off_scale_high"===d,[kp.low]:"low"===d,[kp.high]:"high"===d,[kp["off-scale-low"]]:"off_scale_low"===d,[kp["off-scale-high"]]:"off_scale_high"===d}),A=dF()({[kp.container]:!0,[kp.card]:!0,[kp["critical-value"]]:f,[kp["abnormal-value"]]:h&&!f}),w=dF()({[kp.cell]:!0,[$]:!0});return"cell"===i?(0,dj.jsxs)("div",{className:w,children:[v,b&&t?` ${t}`:""]}):(0,dj.jsxs)("section",{className:A,"data-testid":"numeric-observation-card",children:[n&&(0,dj.jsxs)("div",{className:kp["label-container"],children:[(0,dj.jsx)("span",{id:m,className:kp.label,children:n}),h&&(0,dj.jsx)("span",{className:kp[d.replace("_","-")],title:rp("abnormalValue","Abnormal value")})]}),(0,dj.jsxs)("div",{className:kp["value-container"],children:[(0,dj.jsx)("span",{id:g,"aria-labelledby":m&&y?`${m} ${y}`:m||y||void 0,className:kp.value,children:v}),b&&t&&(0,dj.jsx)("span",{id:y,className:kp.units,children:t})]})]})};var kf=n(292),kh={};kh.styleTagTransform=dX(),kh.setAttributes=dK(),kh.insert=dq().bind(null,"head"),kh.domAPI=dV(),kh.insertStyleElement=dJ(),dW()(kf.A,kh);let km=kf.A&&kf.A.locals?kf.A.locals:void 0,kg=e=>{if("children"in e){let{children:t,className:n,...a}=e;return(0,dj.jsx)("div",{className:dF()(km.pageHeader,n),...a,children:t})}{let{title:t,illustration:n,className:a,...r}=e;return(0,dj.jsx)("div",{className:dF()(km.pageHeader,a),...r,children:(0,dj.jsx)(ky,{title:t,illustration:n})})}},ky=({title:e,illustration:t,className:n})=>{let[a,r]=(0,uq.useState)(null);return(0,uq.useEffect)(()=>{eK("@openmrs/esm-styleguide").then(e=>{r(e)})},[]),(0,dj.jsxs)("div",{className:dF()(km.pageHeaderContent,n),children:[t,(0,dj.jsxs)("div",{className:km.pageLabels,children:[a?.implementationName&&(0,dj.jsx)("p",{children:rp(a.implementationName)}),(0,dj.jsx)("p",{className:km.pageName,children:e})]})]})};var kb=n(2886),k_={};k_.styleTagTransform=dX(),k_.setAttributes=dK(),k_.insert=dq().bind(null,"head"),k_.domAPI=dV(),k_.insertStyleElement=dJ(),dW()(kb.A,k_);let kv=kb.A&&kb.A.locals?kb.A.locals:void 0,k$=({totalItems:e,pageSize:t,onPageNumberChange:n,pageNumber:a,dashboardLinkUrl:r,currentItems:o,dashboardLinkLabel:i})=>{let{pageSizes:s,pageItemsCount:l}=dd(t,e,a,o),c="tablet"===dn(),u=rp("paginationItemsCount","{{pageItemsCount}} / {{totalItems}} items",{totalItems:e,pageItemsCount:l});return(0,dj.jsx)(dj.Fragment,{children:e>0&&(0,dj.jsxs)("div",{className:dF()({[kv.tablet]:c,[kv.desktop]:!c}),children:[(0,dj.jsxs)("div",{children:[u,r&&(0,dj.jsx)(uY,{to:r,className:kv.configurableLink,children:i??rp("seeAll","See all")})]}),(0,dj.jsx)(d6.Pagination,{className:kv.pagination,page:a,pageSize:t,pageSizes:s,totalItems:e,onChange:n,pageRangeText:(e,t)=>rp("paginationOfPages","of {{count}} pages",{count:t}),size:c?"lg":"sm"})]})})};function kA(e){return kk(kC(e,"usual","official"))}function kw(e){return kA(e)}function kk(e){var t;let n;return e?e.text??(n=(t=e).given??[],(t.family?n.concat(t.family):n).join(" ")):""}function kx(e){return kk(e)}function kC(e,...t){for(let n of(0==t.length&&(t=["usual"]),t)){let t=e.name?.find(e=>{var t,a;return t=e,a=n,t.use?t.use===a:"usual"===a});if(t)return t}}function kE(e,t=d_()){let n=d_(t),a=A0(e,n);if(null==a)return null;let r=n.diff(a,"hours"),o=n.diff(a,"days"),i=n.diff(a,"weeks"),s=n.diff(a,"months"),l=n.diff(a,"years"),c={};if(r<2)c.minutes=n.diff(a,"minutes");else if(o<2)c.hours=r;else if(i<4)c.days=o;else if(l<1){let e=n.subtract(i,"weeks").diff(a,"days");c.weeks=i,c.days=e}else if(l<2){let e=n.subtract(s,"months").diff(a,"days");c.months=s,c.days=e}else if(l<18){let e=n.subtract(l,"year").diff(a,"months");c.years=l,c.months=e}else c.years=l;return c}function kS(e,t=d_()){let n=kE(e,t);if(null==n)return null;let a={style:"short",localeMatcher:"lookup"};return"minutes"in n&&0===n.minutes&&(a.minutesDisplay="always"),AQ(n,a)}var kD=n(6010),kM={};kM.styleTagTransform=dX(),kM.setAttributes=dK(),kM.insert=dq().bind(null,"head"),kM.domAPI=dV(),kM.insertStyleElement=dJ(),dW()(kD.A,kM);let kz=kD.A&&kD.A.locals?kD.A.locals:void 0;function kO({showIdentifierLabel:e,type:t,value:n}){return(0,dj.jsx)("span",{className:kz.primaryIdentifier,children:(0,dj.jsxs)(d6.Tag,{className:kz.tag,type:"gray",children:[e&&t?.text&&(0,dj.jsxs)("span",{className:kz.label,children:[t.text,": "]}),(0,dj.jsx)("span",{className:kz.value,children:n})]})})}function kP({showIdentifierLabel:e,type:t,value:n}){return(0,dj.jsxs)(d6.FormLabel,{className:kz.secondaryIdentifier,id:`patient-banner-identifier-${n}`,children:[e&&(0,dj.jsxs)("span",{className:kz.label,children:[t?.text,": "]}),(0,dj.jsx)("span",{className:kz.value,children:n})]})}function kT({identifiers:e,showIdentifierLabel:t}){let{excludePatientIdentifierCodeTypes:n}=pR(),{primaryIdentifierCode:a}=dm(),r=e?.filter(e=>{let t=e.type?.coding?.[0]?.code;return t&&!n?.uuids.includes(t)})??[];return(0,dj.jsx)(dj.Fragment,{children:r?.length?r.map(({value:e,type:n},o)=>(0,dj.jsxs)(uH().Fragment,{children:[(0,dj.jsx)("span",{className:kz.identifier,children:n?.coding?.[0]?.code===a?(0,dj.jsx)(kO,{showIdentifierLabel:t,type:n,value:e}):(0,dj.jsx)(kP,{showIdentifierLabel:t,type:n,value:e})}),o<r.length-1&&(0,dj.jsx)("span",{className:kz.separator,children:"\xb7"})]},e)):""})}let kB={Female:fG,Male:fV,Other:fU,Unknown:fq},kI=({gender:e})=>{let t=kB[e];return t?(0,dj.jsx)(t,{fill:"#525252"}):null},kN={male:"Male",female:"Female",other:"Other",unknown:"Unknown"};function kj({patient:e,renderedFrom:t}){var n;let a,r,o=kA(e),i=e?.gender&&(r=kN[a=(n=e.gender).toLowerCase()]??"Unknown",{displayText:rp(a,n),iconKey:r}),s=(0,uq.useMemo)(()=>({patientUuid:e.id,patient:e,renderedFrom:t}),[e.id,e,t]);return(0,dj.jsxs)("div",{className:kz.patientInfo,children:[(0,dj.jsx)("div",{className:dF()(kz.row,kz.patientNameRow),children:(0,dj.jsxs)("div",{className:kz.flexRow,children:[(0,dj.jsx)("span",{className:kz.patientName,children:o}),i&&(0,dj.jsxs)("div",{className:kz.gender,children:[(0,dj.jsx)(kI,{gender:i.iconKey}),(0,dj.jsx)("span",{children:i.displayText})]}),(0,dj.jsx)(u6,{className:kz.tagsSlot,name:"patient-banner-tags-slot",state:s})]})}),(0,dj.jsxs)("div",{className:kz.demographics,children:[e.birthDate&&(0,dj.jsxs)(dj.Fragment,{children:[(0,dj.jsx)("span",{children:kS(e.birthDate)}),(0,dj.jsx)("span",{className:kz.separator,children:"\xb7"}),(0,dj.jsx)("span",{children:AH(e.birthDate,{time:!1})}),(0,dj.jsx)("span",{className:kz.separator,children:"\xb7"})]}),(0,dj.jsx)(kT,{identifiers:e.identifier,showIdentifierLabel:!0}),(0,dj.jsx)(u6,{className:kz.extensionSlot,name:"patient-banner-bottom-slot",state:s})]})]})}var kR=n(1673),kF=n(9102),kL={};kL.styleTagTransform=dX(),kL.setAttributes=dK(),kL.insert=dq().bind(null,"head"),kL.domAPI=dV(),kL.insertStyleElement=dJ(),dW()(kF.A,kL);let kW=kF.A&&kF.A.locals?kF.A.locals:void 0;function kG({patient:e,patientUuid:t,actionsSlotName:n,additionalActionsSlotState:a}){let[r,o]=(0,uq.useState)(!1),{extensions:i}=u4(n),s="tablet"===dn(),l=dl(()=>o(!1),r),c=(0,uq.useRef)(null),u=(0,uq.useRef)(null),p=(0,uq.useId)(),d=`patient-actions-menu-trigger-${p}`,f=`patient-actions-menu-${p}`,h=(0,uq.useCallback)(()=>o(e=>!e),[]),m=(0,uq.useCallback)(()=>{o(!1),c.current?.focus()},[]),g=(0,uq.useCallback)(e=>{if("Escape"===e.key&&r){e.stopPropagation(),m();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,a=Array.from(t).indexOf(n);if(-1===a)return void t["ArrowDown"===e.key?0:t.length-1]?.focus();let r=a+("ArrowDown"===e.key?1:-1),o=r<0?t.length-1:r>=t.length?0:r;t[o]?.focus()}},[m,r]);(0,uq.useEffect)(()=>{if(r&&u.current){let e=u.current.querySelector('[role="menuitem"]:not([disabled])');e?.focus()}},[r]);let y=(0,uq.useMemo)(()=>({patientUuid:t,patient:e,closeMenu:m,...a}),[t,e,m,a]);return 0===i.length?null:(0,dj.jsx)("div",{className:kW.overflowMenuContainer,children:(0,dj.jsxs)("div",{"data-overflow-menu":!0,className:dF()("cds--overflow-menu",ft.container),ref:l,children:[(0,dj.jsxs)("button",{className:dF()("cds--btn","cds--btn--ghost","cds--overflow-menu__trigger",{"cds--overflow-menu--open":r},ft.overflowMenuButton),"aria-controls":f,"aria-expanded":r,"aria-haspopup":"true",id:d,onClick:h,onKeyDown:g,ref:c,children:[(0,dj.jsx)("span",{className:kW.actionsButtonText,children:rp("actions","Actions")})," ",(0,dj.jsx)(kR.CH,{size:16,style:{marginLeft:"0.5rem",fill:"#78A9FF"}})]}),(0,dj.jsxs)("div",{className:dF()("cds--overflow-menu-options","cds--overflow-menu--flip",ft.menu,{[ft.show]:r}),"aria-labelledby":d,"data-floating-menu-direction":"bottom",id:f,onKeyDown:g,ref:u,role:"menu",tabIndex:-1,children:[(0,dj.jsx)("ul",{className:dF()("cds--overflow-menu-options__content",{"cds--overflow-menu-options--lg":s}),children:(0,dj.jsx)(u6,{name:n,state:y},n)}),(0,dj.jsx)("span",{})]})]})})}var kV=n(6767),kU=n.n(kV);function kq(e){let{patientPhotoConceptUuid:t}=pR({externalModuleName:"@openmrs/esm-styleguide"}),n=t?`${n0}/obs?patient=${e}&concept=${t}&v=full`:null,{data:a,error:r,isLoading:o}=(0,pd.Ay)(e?n:null,n4),i=a?.data?.results[0];return{data:i?{dateTime:i?.obsDatetime,imageSrc:i?.value?.links?.uri}:null,error:r,isLoading:o}}let kH=({width:e=56,height:t=56,"aria-label":n})=>{let{t:a}=(0,pp.useTranslation)();return(0,dj.jsxs)("svg",{"aria-label":n??a("patientPhotoPlaceholder","Patient photo placeholder"),width:e,height:t,fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[(0,dj.jsx)("path",{fill:"#ffffff",d:"M0 0h56v56H0z"}),(0,dj.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"})]})};var kK=n(7268),kY={};kY.styleTagTransform=dX(),kY.setAttributes=dK(),kY.insert=dq().bind(null,"head"),kY.domAPI=dV(),kY.insertStyleElement=dJ(),dW()(kK.A,kY);let kJ=kK.A&&kK.A.locals?kK.A.locals:void 0;function kZ({patientUuid:e,patientName:t,alt:n}){let{data:a,isLoading:r}=kq(e),[o,i]=(0,uq.useState)(null),[s,l]=(0,uq.useState)(!1),c=(0,uq.useMemo)(()=>kU().generate(e),[e]);(0,uq.useEffect)(()=>{if(a?.imageSrc){let e=new URL(a.imageSrc,window.location.origin).pathname;l(!0);let t=!1,n=new Image;return n.onload=()=>{t||(i(e),l(!1))},n.onerror=()=>{t||(i(null),l(!1))},n.src=e,()=>{t=!0}}i(null),l(!1)},[a?.imageSrc]);let u=(0,uq.useMemo)(()=>n||(o?rp("patientPhotoAlt","Profile photo of {{patientName}}",{patientName:t}):rp("patientAvatarAlt","Avatar for {{patientName}}",{patientName:t})),[n,o,t]);return r||s?(0,dj.jsx)(d6.SkeletonIcon,{className:kJ.skeleton,"data-testid":"skeleton-icon"}):a?.imageSrc&&!o?(0,dj.jsx)(kH,{"aria-label":rp("patientPhotoPlaceholder","Photo placeholder for {{patientName}}",{patientName:t})}):o?(0,dj.jsx)("div",{"aria-label":u,children:(0,dj.jsx)("img",{className:kJ.avatar,src:o,alt:u,title:t})}):(0,dj.jsx)("div",{"aria-label":u,children:(0,dj.jsx)("div",{className:kJ.avatar,title:t,style:{backgroundImage:c.toDataUrl(),backgroundRepeat:"no-repeat",backgroundSize:"cover"},children:(0,dj.jsx)("span",{className:kJ.initials,children:function(e,t=3){return e.split(/\s+/).filter(Boolean).slice(0,t).map(e=>e[0]).join("")}(t)})})})}var kX=n(1636),kQ={};kQ.styleTagTransform=dX(),kQ.setAttributes=dK(),kQ.insert=dq().bind(null,"head"),kQ.domAPI=dV(),kQ.insertStyleElement=dJ(),dW()(kX.A,kQ);let k0=kX.A&&kX.A.locals?kX.A.locals:void 0,k1=["omrs-pict-appointments","omrs-pict-assessment-1","omrs-pict-assessment-2","omrs-pict-blood-bank","omrs-pict-cardiology","omrs-pict-ct-scan","omrs-pict-dentistry","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-obstetrics","omrs-pict-patient-search","omrs-pict-patients","omrs-pict-payments-desk","omrs-pict-pharmacy","omrs-pict-pharmacy-2","omrs-pict-registration","omrs-pict-service-queues","omrs-pict-stock-management","omrs-pict-transfer","omrs-pict-triage","omrs-pict-x-ray"],k2=(0,uq.memo)((0,uq.forwardRef)(function(e,t){return(0,dj.jsx)(xA,{ref:t,pictogram:"omrs-pict-appointments",pictogramProps:e})})),k3=k2,k4=(0,uq.memo)((0,uq.forwardRef)(function(e,t){return(0,dj.jsx)(xA,{ref:t,pictogram:"omrs-pict-assessment-1",pictogramProps:e})})),k5=(0,uq.memo)((0,uq.forwardRef)(function(e,t){return(0,dj.jsx)(xA,{ref:t,pictogram:"omrs-pict-assessment-2",pictogramProps:e})})),k6=(0,uq.memo)((0,uq.forwardRef)(function(e,t){return(0,dj.jsx)(xA,{ref:t,pictogram:"omrs-pict-blood-bank",pictogramProps:e})})),k8=(0,uq.memo)((0,uq.forwardRef)(function(e,t){return(0,dj.jsx)(xA,{ref:t,pictogram:"omrs-pict-cardiology",pictogramProps:e})})),k7=(0,uq.memo)((0,uq.forwardRef)(function(e,t){return(0,dj.jsx)(xA,{ref:t,pictogram:"omrs-pict-ct-scan",pictogramProps:e})})),k9=(0,uq.memo)((0,uq.forwardRef)(function(e,t){return(0,dj.jsx)(xA,{ref:t,pictogram:"omrs-pict-dentistry",pictogramProps:e})})),xe=(0,uq.memo)((0,uq.forwardRef)(function(e,t){return(0,dj.jsx)(xA,{ref:t,pictogram:"omrs-pict-emergency-department",pictogramProps:e})})),xt=(0,uq.memo)((0,uq.forwardRef)(function(e,t){return(0,dj.jsx)(xA,{ref:t,pictogram:"omrs-pict-facility",pictogramProps:e})})),xn=(0,uq.memo)((0,uq.forwardRef)(function(e,t){return(0,dj.jsx)(xA,{ref:t,pictogram:"omrs-pict-geriatrics",pictogramProps:e})})),xa=(0,uq.memo)((0,uq.forwardRef)(function(e,t){return(0,dj.jsx)(xA,{ref:t,pictogram:"omrs-pict-gynaecology",pictogramProps:e})})),xr=(0,uq.memo)((0,uq.forwardRef)(function(e,t){return(0,dj.jsx)(xA,{ref:t,pictogram:"omrs-pict-in-patient",pictogramProps:e})})),xo=(0,uq.memo)((0,uq.forwardRef)(function(e,t){return(0,dj.jsx)(xA,{ref:t,pictogram:"omrs-pict-laboratory",pictogramProps:e})})),xi=(0,uq.memo)((0,uq.forwardRef)(function(e,t){return(0,dj.jsx)(xA,{ref:t,pictogram:"omrs-pict-labs-2",pictogramProps:e})})),xs=(0,uq.memo)((0,uq.forwardRef)(function(e,t){return(0,dj.jsx)(xA,{ref:t,pictogram:"omrs-pict-obstetrics",pictogramProps:e})})),xl=(0,uq.memo)((0,uq.forwardRef)(function(e,t){return(0,dj.jsx)(xA,{ref:t,pictogram:"omrs-pict-patient-search",pictogramProps:e})})),xc=(0,uq.memo)((0,uq.forwardRef)(function(e,t){return(0,dj.jsx)(xA,{ref:t,pictogram:"omrs-pict-patients",pictogramProps:e})})),xu=(0,uq.memo)((0,uq.forwardRef)(function(e,t){return(0,dj.jsx)(xA,{ref:t,pictogram:"omrs-pict-payments-desk",pictogramProps:e})})),xp=(0,uq.memo)((0,uq.forwardRef)(function(e,t){return(0,dj.jsx)(xA,{ref:t,pictogram:"omrs-pict-pharmacy",pictogramProps:e})})),xd=(0,uq.memo)((0,uq.forwardRef)(function(e,t){return(0,dj.jsx)(xA,{ref:t,pictogram:"omrs-pict-pharmacy-2",pictogramProps:e})})),xf=(0,uq.memo)((0,uq.forwardRef)(function(e,t){return(0,dj.jsx)(xA,{ref:t,pictogram:"omrs-pict-registration",pictogramProps:e})})),xh=(0,uq.memo)((0,uq.forwardRef)(function(e,t){return(0,dj.jsx)(xA,{ref:t,pictogram:"omrs-pict-service-queues",pictogramProps:e})})),xm=(0,uq.memo)((0,uq.forwardRef)(function(e,t){return(0,dj.jsx)(xA,{ref:t,pictogram:"omrs-pict-stock-management",pictogramProps:e})})),xg=(0,uq.memo)((0,uq.forwardRef)(function(e,t){return(0,dj.jsx)(xA,{ref:t,pictogram:"omrs-pict-transfer",pictogramProps:e})})),xy=(0,uq.memo)((0,uq.forwardRef)(function(e,t){return(0,dj.jsx)(xA,{ref:t,pictogram:"omrs-pict-triage",pictogramProps:e})})),xb=(0,uq.memo)((0,uq.forwardRef)(function(e,t){return(0,dj.jsx)(xA,{ref:t,pictogram:"omrs-pict-x-ray",pictogramProps:e})})),x_=xt,xv=xc,x$=(0,uq.memo)((0,uq.forwardRef)(function({pictogram:e,fallback:t,...n},a){let r=(0,uq.useRef)(document.getElementById(e));return(0,uq.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,dj.jsx)(pM,{value:r.current,fallback:t,children:(0,dj.jsx)(xA,{ref:a,pictogram:e,pictogramProps:n})})})),xA=(0,uq.memo)((0,uq.forwardRef)(function({pictogram:e,pictogramProps:t},n){let{className:a,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,dj.jsx)("svg",{ref:n,className:dF()(k0.pictogram,a),height:r,width:r,children:(0,dj.jsx)("use",{href:`#${e}`})})})),xw=({children:e})=>"tablet"===dn()?(0,dj.jsx)(d6.Layer,{children:e}):(0,dj.jsx)(dj.Fragment,{children:e});var xk=n(5925),xx={};xx.styleTagTransform=dX(),xx.setAttributes=dK(),xx.insert=dq().bind(null,"head"),xx.domAPI=dV(),xx.insertStyleElement=dJ(),dW()(xk.A,xx);let xC=xk.A&&xk.A.locals?xk.A.locals:void 0,xE=({snackbar:e,closeSnackbar:t})=>{let{actionButtonLabel:n="",kind:a="success",onActionButtonClick:r=()=>{},isLowContrast:o="error"!==a,progressActionLabel:i,subtitle:s="",timeoutInMs:l=5e3,autoClose:c="error"!==a,title:u,id:p,...d}=e,[f,h]=(0,uq.useState)(n),[m,g]=(0,uq.useState)(!0),[y,b]=(0,uq.useState)(!1),v=(0,uq.useCallback)(()=>{setTimeout(t,250)},[t]),$=(0,uq.useCallback)(()=>{b(!0),v()},[v]);return(0,uq.useEffect)(()=>{if(c){let e=setTimeout($,l);return()=>clearTimeout(e)}},[l,c,$]),(0,uq.useEffect)(()=>{g(!1),window.setTimeout(()=>{g(!0)},0)},[]),(0,dj.jsx)(d6.ActionableNotification,{actionButtonLabel:f,"aria-label":rp("closeSnackbar","Close snackbar"),className:dF()(xC.slideIn,{[xC.animated]:m,[xC.slideOut]:y}),kind:a,lowContrast:o,onActionButtonClick:()=>{r(),$(),i&&h(i)},onClose:v,statusIconDescription:rp("snackbarNotification","Snackbar notification"),subtitle:s,title:u,...d})},xS=({subject:e})=>{let[t,n]=(0,uq.useState)([]),a=(0,uq.useCallback)(e=>{n(t=>t.filter(t=>t!==e))},[]);return(0,uq.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,dj.jsx)(dj.Fragment,{children:t.map(e=>(0,dj.jsx)(xE,{snackbar:e,closeSnackbar:()=>a(e)},e.id))})},xD=new ch,xM=0;function xz(e){e&&(0,u8.createRoot)(e).render((0,dj.jsx)(xS,{subject:xD}))}function xO(e){var t;e&&"string"==typeof(t=e.title)&&t.trim().length>0?setTimeout(()=>{xD.next({...e,id:xM++})},0):console.error("showSnackbar must be called with an object having a 'title' property that is a non-empty string")}let xP=({toast:e,closeToast:t})=>{let{description:n,kind:a,critical:r,title:o,actionButtonLabel:i,onActionButtonClick:s=()=>{}}=e,l=(0,uq.useCallback)(()=>{s(),t()},[t,s]);return(0,dj.jsx)("div",{children:(0,dj.jsx)(d6.ActionableNotification,{actionButtonLabel:i,kind:a||"info",lowContrast:r,subtitle:n,title:o||"",onActionButtonClick:l,onClose:t})})},xT=({subject:e})=>{let[t,n]=(0,uq.useState)([]),a=(0,uq.useCallback)(e=>{n(t=>t.filter(t=>t!==e))},[]);return(0,uq.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,dj.jsx)(dj.Fragment,{children:t.map(e=>(0,dj.jsx)(xP,{toast:e,closeToast:()=>a(e)},e.id))})},xB=new ch,xI=0;function xN(e){e&&(0,u8.createRoot)(e).render((0,dj.jsx)(xT,{subject:xB}))}function xj(e){var t;e&&("string"==typeof(t=e.description)?t.trim().length>0:"object"==typeof t&&!(0,w7.A)(t))?setTimeout(()=>{xB.next({...e,id:xI++})},0):console.error("showToast must be called with an object having a 'description' property that is a non-empty string or object")}function xR(e,t=!1){if(t)return!0;let n=xV[e];return!n||!n()}function xF(e,t){let n=xX.getState()?.workspaceGroup,a=n?.name;a&&e===a&&x2(()=>{let a=x8(e);a&&(a.setState({},!0),a.subscribe(()=>{})()),"function"==typeof n?.cleanup&&n.cleanup(),xX.setState(e=>({...e,workspaceGroup:void 0})),"function"==typeof t&&t()},a?e=>e.currentWorkspaceGroup===a:()=>!0)}function xL(e,t){let{name:n,additionalProps:a}=t;uB(n);let r=()=>{xY(e.name,{ignoreChanges:!0,onWorkspaceClose:()=>xW(n,a),closeWorkspaceGroup:!1})};xR(e.name)?r():x4("closing-workspace-launching-new-workspace",r,e.title??e.name)}function xW(e,t){let n=uB(e),a=xX.getState().workspaceGroup;if(a&&!a.members?.includes(e))return void xF(a.name,()=>{xW(e,t)});let r=xX.getState().workspaceGroup?.name,o={...n,title:x5(n,t),closeWorkspace:(t={})=>xY(e,t),closeWorkspaceWithSavedChanges:t=>xY(e,{ignoreChanges:!0,...t}),promptBeforeClosing:t=>{var n,a;return n=e,a=t,void(xV[n]=a)},setTitle:(t,n)=>{o.title=t,o.titleNode=n,xX.setState(t=>{let n=t.openWorkspaces.map(t=>t.name===e?o:t);return{...t,openWorkspaces:n}})},currentWorkspaceGroup:r,additionalProps:t??{}};function i(e,t){xX.setState(n=>{let a=[e,...t??n.openWorkspaces],r=x1(e);return{...n,openWorkspaces:a,workspaceWindowState:r}})}r&&x8(r,t);let s=xX.getState().openWorkspaces,l=s.findIndex(t=>t.name===e),c=s.find(e=>e.type==o.type);if(0===s.length)i(o);else if(s[0].canHide||0===l)if(l>=0){let t=s[l];i({...t,additionalProps:o.additionalProps,...t.title===x5(t,t.additionalProps)&&{title:x5(o,o.additionalProps)}},s.filter(t=>t.name!=e))}else c?(i(c,xX.getState().openWorkspaces.filter(e=>e.type!=o.type)),xL(c,{name:e,additionalProps:t})):i(o);else xL(s[0],{name:e,additionalProps:t})}function xG({targetUrl:e,contextKey:t,workspaceName:n,additionalProps:a}){xJ(t),xW(n,a),nV({to:e})}let xV={};function xU(e,t){xV[e]=t}function xq(e){return xV[e]}function xH(){let e=xX.getState();xX.setState({...e,prompt:null})}let xK={ignoreChanges:!1,onWorkspaceClose:()=>{},closeWorkspaceGroup:!0};function xY(e,t={}){t={...xK,...t};let n=()=>{let n=xX.getState();n.openWorkspaces.find(t=>t.name===e);let a=n.openWorkspaces.filter(t=>t.name!=e),r=xX.getState().workspaceGroup?.name;r&&t.closeWorkspaceGroup&&xF(r),xV[e]=()=>!1,xX.setState(e=>({...e,prompt:null,openWorkspaces:a,workspaceWindowState:x1(a?.[0])})),t?.onWorkspaceClose?.()};return xR(e,t?.ignoreChanges)?(n(),!0):(x4("closing-workspace",n,uB(e).title??e),!1)}function xJ(e){xX.getState().context!=e&&xX.setState({context:e,openWorkspaces:[],prompt:null})}let xZ={context:"",openWorkspaces:[],prompt:null,workspaceWindowState:"normal",workspaceGroup:void 0},xX=V("workspace",xZ);function xQ(){return xX}function x0(e){let t=xX.getState();xX.setState({...t,workspaceWindowState:e})}function x1(e){return e?.preferredWindowSize??"normal"}function x2(e=()=>{},t=()=>!0){let n=xX.getState().openWorkspaces.filter(t).every(({name:e})=>xR(e)),a=()=>{x6(),e?.()};n?a():x4("closing-all-workspaces",a)}function x3(){let{workspaceWindowState:e,openWorkspaces:t,prompt:n,workspaceGroup:a}=uQ(xX);return(0,uq.useMemo)(()=>({active:t.length>0,prompt:n,workspaceWindowState:e,workspaces:t,workspaceGroup:a}),[t,e,n,a])}function x4(e,t=()=>{},n=""){let a;switch(e){case"closing-workspace":a={title:rp("unsavedChangesTitleText","Unsaved changes"),body:rp("unsavedChangesInOpenedWorkspace","You may have unsaved changes in the opened workspace. Do you want to discard these changes?"),onConfirm:()=>{t?.()},confirmText:rp("discard","Discard")};break;case"closing-all-workspaces":{let e=xX.getState().openWorkspaces.filter(({name:e})=>!xR(e)).map(({title:e},t)=>`${t+1}. ${e}`);a={title:rp("closingAllWorkspacesPromptTitle","You have unsaved changes"),body:rp("closingAllWorkspacesPromptBody","There may be unsaved changes in the following workspaces. Do you want to discard changes in the following workspaces? {{workspaceNames}}",{workspaceNames:e.join(",")}),onConfirm:()=>{t?.()},confirmText:rp("closeAllOpenedWorkspaces","Discard changes in {{count}} workspaces",{count:e.length})};break}case"closing-workspace-launching-new-workspace":a={title:rp("unsavedChangesTitleText","Unsaved changes"),body:rp("unsavedChangesInWorkspace",'There may be unsaved changes in "{{workspaceName}}". Please save them before opening another workspace.',{workspaceName:n}),onConfirm:()=>{xX.setState(e=>({...e,prompt:null})),t?.()},confirmText:rp("openAnyway","Open anyway")};break;default:console.error(`Workspace system trying to open unknown prompt type "${e}" in function "showWorkspacePrompts"`),t?.();return}xX.setState(e=>({...e,prompt:a}))}function x5(e,t){return t?.workspaceTitle??e.title}function x6(){xX.setState(xZ)}function x8(e,t={}){if(!e||"default"===e)return;let n=q(e,{});return t&&n.setState(e=>({...e,...t})),n}var x7=n(1341),x9={};x9.styleTagTransform=dX(),x9.setAttributes=dK(),x9.insert=dq().bind(null,"head"),x9.domAPI=dV(),x9.insertStyleElement=dJ(),dW()(x7.A,x9);let Ce=x7.A&&x7.A.locals?x7.A.locals:void 0;function Ct({getIcon:e,formOpenInTheBackground:t,tagContent:n}){return(0,dj.jsxs)(dj.Fragment,{children:[e({size:16}),t?(0,dj.jsx)("span",{className:Ce.interruptedTag,children:"!"}):(0,dj.jsx)("span",{className:Ce.countTag,children:n})]})}let Cn=({getIcon:e,label:t,iconDescription:n,handler:a,type:r,tagContent:o})=>{let i=dn(),{workspaces:s,workspaceWindowState:l}=x3(),c=s?.findIndex(({type:e})=>e===r)??-1,u="hidden"!==l&&0===c,p=c>0||0===c&&"hidden"===l;return"tablet"===i||"phone"===i?(0,dj.jsxs)(d6.Button,{className:dF()(Ce.container,{[Ce.active]:u}),iconDescription:n,kind:"ghost",onClick:a,role:"button",tabIndex:0,size:"md",children:[(0,dj.jsx)("span",{className:Ce.elementContainer,children:(0,dj.jsx)(Ct,{formOpenInTheBackground:p,getIcon:e,tagContent:o})}),(0,dj.jsx)("span",{children:t})]}):(0,dj.jsx)(d6.IconButton,{align:"left","aria-label":n,className:dF()(Ce.container,{[Ce.active]:u}),enterDelayMs:300,kind:"ghost",label:t,onClick:a,size:"md",children:(0,dj.jsx)("div",{className:Ce.elementContainer,children:(0,dj.jsx)(Ct,{formOpenInTheBackground:p,getIcon:e,tagContent:o})})})};var Ca=n(4535),Cr=n(771),Co=n(7781),Ci={};Ci.styleTagTransform=dX(),Ci.setAttributes=dK(),Ci.insert=dq().bind(null,"head"),Ci.domAPI=dV(),Ci.insertStyleElement=dJ(),dW()(Co.A,Ci);let Cs=Co.A&&Co.A.locals?Co.A.locals:void 0;function Cl({contextKey:e}){let{prompt:t}=x3();return(0,uq.useEffect)(()=>{RegExp(`/${(0,ee.escapeRegExp)(e)}(/|$)`).test(window.location.pathname)||console.warn(`WorkspaceContainer has provided an invalid context key: "${e}". The context key must be part of the URL path, with no initial or trailing slash.`)},[]),(0,uq.useEffect)(()=>(xJ(e),()=>{xJ(null)}),[e]),(0,uq.useEffect)(()=>{let t=t=>{let{detail:{cancelNavigation:n,newUrl:a}}=t,r=RegExp(`/${(0,ee.escapeRegExp)(e)}(/|$)`),o=new URL(a),i=r.test(o.pathname),s=xX.getState().openWorkspaces.every(({name:e})=>xR(e));i||(s?x6():(n?.(),x2(()=>{nV({to:a})})))};return window.addEventListener("single-spa:before-routing-event",t),()=>{window.removeEventListener("single-spa:before-routing-event",t)}},[]),null!=t?(0,dj.jsxs)(d6.ComposedModal,{open:!0,onClose:xH,children:[(0,dj.jsx)(d6.ModalHeader,{title:t.title}),(0,dj.jsx)(d6.ModalBody,{children:(0,dj.jsx)("p",{className:Cs.messageBody,children:t.body})}),(0,dj.jsxs)(d6.ModalFooter,{children:[(0,dj.jsx)(d6.Button,{kind:"secondary",onClick:xH,children:t.cancelText??rp("cancel")}),(0,dj.jsx)(d6.Button,{kind:"danger",onClick:t.onConfirm,children:t.confirmText??rp("confirm")})]})]}):null}function Cc(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,a)}return n}function Cu(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Cc(Object(n),!0).forEach(function(t){Cd(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Cc(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function Cp(e,t){for(var n=0;n<t.length;n++){var a=t[n];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}function Cd(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Cf(e){return(Cf=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function Ch(e,t){return(Ch=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function Cm(e){if(void 0===e)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return e}var Cg=function(e){var t=uq.Component;if("function"!=typeof t&&null!==t)throw TypeError("Super expression must either be null or a function");i.prototype=Object.create(t&&t.prototype,{constructor:{value:i,writable:!0,configurable:!0}}),t&&Ch(i,t);var n,a,r,o=(n=function(){if("u"<typeof Reflect||!Reflect.construct||Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(e){return!1}}(),function(){var e,t=Cf(i);e=n?Reflect.construct(t,arguments,Cf(this).constructor):t.apply(this,arguments);if(e&&("object"==typeof e||"function"==typeof e))return e;if(void 0!==e)throw TypeError("Derived constructors may only return object or undefined");return Cm(this)});function i(e){var t;if(function(e,t){if(!(e instanceof t))throw TypeError("Cannot call a class as a function")}(this,i),Cd(Cm(t=o.call(this,e)),"handleRef",function(e){t.el=e}),Cd(Cm(t),"addThingToDo",function(e,n){t.state.hasError&&"unmount"!==e||(t.nextThingToDo=(t.nextThingToDo||Promise.resolve()).then(function(){if(!t.unmounted||"unmount"===e)return n.apply(void 0,arguments)}).catch(function(n){throw t.nextThingToDo=Promise.resolve(),t.setState({hasError:!0}),n&&n.message&&(n.message="During '".concat(e,"', parcel threw an error: ").concat(n.message)),t.props.handleError?t.props.handleError(n):setTimeout(function(){throw n}),n}))}),Cd(Cm(t),"getParcelProps",function(){var e=Cu(Cu({},t.props),{},{domElement:t.el});return delete e.mountParcel,delete e.config,delete e.wrapWith,delete e.wrapStyle,delete e.appendTo,delete e.handleError,delete e.parcelDidMount,e}),t.state={hasError:!1},!e.config)throw Error("single-spa-react's Parcel component requires the 'config' prop to either be a parcel config or a loading function that returns a promise. See https://github.com/single-spa/single-spa-react");return t}return a=[{key:"componentDidMount",value:function(){var e=this;this.unmounted=!1,this.addThingToDo("mount",function(){var t,n=e.props.mountParcel||e.mountParcel;if(!n)throw Error("\n <Parcel /> was not passed a mountParcel prop, nor is it rendered where mountParcel is within the React context.\n If you are using <Parcel /> within a module that is not a single-spa application, you will need to import mountRootParcel from single-spa and pass it into <Parcel /> as a mountParcel prop \n ");return e.el?t=e.el:(e.createdDomElement=t=document.createElement(e.props.wrapWith),Object.keys(e.props.wrapStyle).forEach(function(n){t.style[n]=e.props.wrapStyle[n]}),e.props.appendTo.appendChild(t)),e.parcel=n(e.props.config,Cu({domElement:t},e.getParcelProps())),e.parcel.mountPromise.then(e.props.parcelDidMount),e.parcel.mountPromise})}},{key:"componentDidUpdate",value:function(){var e=this;this.addThingToDo("update",function(){if(e.parcel&&e.parcel.update)return e.parcel.update(e.getParcelProps())})}},{key:"componentWillUnmount",value:function(){var e=this;this.addThingToDo("unmount",function(){if(e.parcel&&"MOUNTED"===e.parcel.getStatus())return e.parcel.unmount()}),this.createdDomElement&&this.createdDomElement.parentNode.removeChild(this.createdDomElement),this.unmounted=!0}},{key:"render",value:function(){var e=this;if(this.props.appendTo)return pa&&pa.Consumer?uq.createElement(pa.Consumer,null,function(t){return e.mountParcel=t?t.mountParcel:null,null}):null;var t=pa&&pa.Consumer?uq.createElement(pa.Consumer,null,function(t){return e.mountParcel=t?t.mountParcel:null,null}):void 0;return uq.createElement(this.props.wrapWith,{ref:this.handleRef,style:this.props.wrapStyle,className:this.props.wrapClassName},t)}}],Cp(i.prototype,a),r&&Cp(i,r),i}();Cd(Cg,"defaultProps",{wrapWith:"div",wrapStyle:{},parcelDidMount:function(){}});var Cy=n(7515),Cb={};Cb.styleTagTransform=dX(),Cb.setAttributes=dK(),Cb.insert=dq().bind(null,"head"),Cb.domAPI=dV(),Cb.insertStyleElement=dJ(),dW()(Cy.A,Cb);let C_=Cy.A&&Cy.A.locals?Cy.A.locals:void 0;function Cv({workspace:e,additionalPropsFromPage:t}){let[n,a]=(0,uq.useState)(),r=function(e){let[t,n]=(0,uq.useState)({}),[a,r]=(0,uq.useState)(e);return(0,uq.useEffect)(()=>{a!==e&&r(e)},[e]),(0,uq.useEffect)(()=>{let e,t=x8(a);return t&&(n(t.getState()),e=t.subscribe(n)),()=>{t&&e?.()}},[a]),t}(e.currentWorkspaceGroup);(0,uq.useEffect)(()=>{let t=!0;return e.load().then(e=>{t&&a(e)}),()=>{t=!1}},[e]);let o=(0,uq.useMemo)(()=>e&&{closeWorkspace:e.closeWorkspace,closeWorkspaceWithSavedChanges:e.closeWorkspaceWithSavedChanges,promptBeforeClosing:e.promptBeforeClosing,setTitle:e.setTitle,...t,...r,...e.additionalProps},[e,t,r]);return n?(0,dj.jsx)(Cg,{config:n,mountParcel:t2,...o},e.name):(0,dj.jsx)(d6.InlineLoading,{className:C_.loader,description:`${rp("loading","Loading")} ...`})}var C$=n(4646),CA={};CA.styleTagTransform=dX(),CA.setAttributes=dK(),CA.insert=dq().bind(null,"head"),CA.domAPI=dV(),CA.insertStyleElement=dJ(),dW()(C$.A,CA);let Cw=C$.A&&C$.A.locals?C$.A.locals:void 0;function Ck({isWithinWorkspace:e,name:t,actionMenuProps:n={}}){let[a,r]=(0,uq.useState)(!1),o=(0,uq.useRef)(window.innerHeight),{featureName:i}=(0,uq.useContext)(uK),s=dn();(0,uq.useEffect)(()=>{let e=()=>{r(!da(s)&&o.current>window.innerHeight),o.current!=window.innerHeight&&(o.current=window.innerHeight)};return window.addEventListener("resize",e),()=>window.removeEventListener("resize",e)},[o]);let l=`action-menu-${t&&"default"!=t?t:i}-items-slot`;return(0,dj.jsx)("aside",{className:dF()(Cw.sideRail,{[Cw.withinWorkspace]:e,[Cw.sideRailHidden]:a,[Cw.sideRailVisible]:!a}),children:(0,dj.jsx)("div",{className:Cw.container,children:(0,dj.jsx)(u6,{className:Cw.chartExtensions,name:l,state:n})})})}function Cx({contextKey:e,overlay:t,showSiderailAndBottomNav:n,additionalWorkspaceProps:a,actionMenuProps:r}){let o=dn(),{workspaces:i,workspaceWindowState:s,workspaceGroup:l}=x3(),c=l?.name,u=i[0],p="hidden"===s||null==u,d=u?.width??(t?"wider":"narrow"),f=(0,uq.useMemo)(()=>n||c&&!p,[c,p,n]);return pI(!p&&!da(o)),(0,dj.jsxs)(dj.Fragment,{children:[(0,dj.jsxs)("div",{className:n?C_.workspaceContainerWithActionMenu:C_.workspaceContainerWithoutActionMenu,children:[(0,dj.jsx)("aside",{className:dF()(t?C_.workspaceOverlayOuterContainer:C_.workspaceWindowSpacer,{[C_.hiddenRelative]:p,[C_.narrowWorkspace]:"narrow"===d,[C_.widerWorkspace]:"wider"===d,[C_.extraWideWorkspace]:"extra-wide"===d}),children:(0,dj.jsx)("div",{className:dF()(C_.workspaceFixedContainer,{[C_.maximizedWindow]:"maximized"===s,[C_.hiddenFixed]:p}),children:i.map((e,t)=>(0,dj.jsx)("div",{className:dF()(C_.workspaceInnerContainer,{[C_.hiddenExtraWorkspace]:0!==t}),children:(0,dj.jsx)(uq.Suspense,{fallback:null,children:(0,dj.jsx)(pp.I18nextProvider,{i18n:window.i18next,defaultNS:e.moduleName,children:(0,dj.jsx)(CC,{workspaceInstance:e,additionalWorkspaceProps:a})})})},`workspace-container-${e?e.name:`empty-${t}`}`))})}),(0,dj.jsx)(Cl,{contextKey:e})]}),f&&(0,dj.jsx)(Ck,{name:c,isWithinWorkspace:!n,actionMenuProps:r})]})}function CC({workspaceInstance:e,additionalWorkspaceProps:t}){let{t:n}=(0,pp.useTranslation)(),a=dn(),{workspaceWindowState:r,workspaceGroup:o}=x3(),i=o?.name,s="maximized"===r;(0,uq.useEffect)(()=>{let t=n(e.title);t!==e.title&&e.setTitle(t)},[e.title,n,e.setTitle]);let{featureName:l}=(0,uq.useContext)(uK),c=(0,uq.useCallback)(()=>{x0(s?"normal":"maximized")},[s]),{canHide:u=!1,canMaximize:p=!1,currentWorkspaceGroup:d="",closeWorkspace:f}=(0,uq.useMemo)(()=>e??{},[e]),h=(0,uq.useMemo)(()=>({...t,...e?.additionalProps}),[t,e]);return e&&(0,dj.jsxs)(dj.Fragment,{children:[(0,dj.jsxs)(d6.Header,{"aria-label":rp("workspaceHeader","Workspace Header"),className:C_.header,children:[!da(a)&&!u&&(0,dj.jsx)(d6.HeaderMenuButton,{"aria-label":rp("close","Close"),renderMenuIcon:(0,dj.jsx)(fh,{}),onClick:()=>f()}),(0,dj.jsx)(d6.HeaderName,{prefix:"",children:e.titleNode??n(e.title)}),(0,dj.jsx)("div",{className:C_.overlayHeaderSpacer}),(0,dj.jsxs)(d6.HeaderGlobalBar,{className:C_.headerButtons,children:[(0,dj.jsx)(u6,{name:`workspace-header-group-${e.currentWorkspaceGroup}-slot`,state:h}),(0,dj.jsx)(u6,{name:`workspace-header-type-${e.type}-slot`,state:h}),(0,dj.jsx)(u6,{name:`workspace-header-${l}-slot`,state:h}),da(a)&&(0,dj.jsxs)(dj.Fragment,{children:[(p||s)&&(0,dj.jsx)(d6.HeaderGlobalAction,{"aria-label":s?rp("minimize","Minimize"):rp("maximize","Maximize"),onClick:c,children:s?(0,dj.jsx)(Ca.Xj,{}):(0,dj.jsx)(Ca.hz,{})}),u&&!i?(0,dj.jsx)(d6.HeaderGlobalAction,{"aria-label":rp("hide","Hide"),onClick:()=>x0("hidden"),children:(0,dj.jsx)(fm,{})}):(0,dj.jsx)(d6.HeaderGlobalAction,{"aria-label":rp("close","Close"),onClick:()=>f?.(),children:(0,dj.jsx)(fP,{})})]}),"tablet"===a&&u&&(0,dj.jsx)(d6.HeaderGlobalAction,{"aria-label":rp("close","Close"),onClick:()=>f?.(),children:(0,dj.jsx)(Cr.d3,{})})]})]}),(0,dj.jsx)("div",{className:dF()(C_.workspaceContent,{[C_.marginWorkspaceContent]:!!d}),children:(0,dj.jsx)(Cv,{workspace:e,additionalPropsFromPage:t},e.name)})]})}async function CE(e,t){let{openedGroup:n}=uN.getState();if(n){if(n.groupName===e&&CM(n.props,t))return!0;else if(!await Cz({reason:"CLOSE_WORKSPACE_GROUP",explicit:!1}))return!1}return uN.setState(n=>({...n,openedGroup:{groupName:e,props:t},openedWindows:[]})),!0}async function CS(e){let{openedGroup:t,openedWindows:n}=uN.getState();if(t){if(n.length>0&&!(e||await Cz({reason:"CLOSE_WORKSPACE_GROUP",explicit:!0})))return!1;uN.setState(e=>({...e,openedGroup:null,openedWindows:[]}))}return!0}async function CD(e,t=null,n=null,a=null){let r=uN.getState();if(!r.registeredWorkspacesByName[e])throw Error(`Unable to launch workspace ${e}. Workspace is not registered`);let o=uj(e);if(!o)throw Error(`Unable to launch workspace ${e}. Workspace is not registered to a workspace window`);let{openedGroup:i}=r,{name:s}=o,l=uR(s);if(!l)throw Error(`Unable to launch workspace ${e}. Workspace window ${o.name} is not registered to a workspace group`);let c=uF(e);if(i&&(i.groupName!==l.name||!CM(i.props,a)))return!!await Cz({reason:"CLOSE_WORKSPACE_GROUP",explicit:!0})&&(uN.setState({...r,openedGroup:{groupName:l.name,props:a},openedWindows:[{windowName:s,openedWorkspaces:[CI(e,t)],props:n,maximized:!1}],isMostRecentlyOpenedWindowHidden:!1}),!0);if(c>=0){let a=r.openedWindows[c],o=r.openedGroup?.props??{},i=r.isMostRecentlyOpenedWindowHidden,{openedWorkspaces:u}=a;if(CM(a.props,n)){let p=u.find(t=>t.workspaceName===e);return p&&CM(p.props,t)?((i||c!==r.openedWindows.length-1)&&uN.setState(CO.restoreWindow(r,s)),!0):!!await Cz({reason:"CLOSE_WORKSPACE",explicit:!1,windowName:s,workspaceName:e})&&(uN.setState({...r,openedGroup:{groupName:l.name,props:r?.openedGroup?.props??o},openedWindows:[...r.openedWindows.filter((e,t)=>t!==c),{windowName:s,openedWorkspaces:[CI(e,t)],props:a?.props??n,maximized:!1}],isMostRecentlyOpenedWindowHidden:!1}),!0)}return!!await Cz({reason:"CLOSE_WINDOW",explicit:!1,windowName:s})&&(uN.setState({...r,openedGroup:{groupName:l.name,props:o??r?.openedGroup?.props},openedWindows:[...r.openedWindows.filter((e,t)=>t!==c),{windowName:s,openedWorkspaces:[CI(e,t)],props:n,maximized:!1}],isMostRecentlyOpenedWindowHidden:!1}),!0)}return"closable"!=l.persistence?(uN.setState({...r,openedGroup:{groupName:l.name,props:a??r?.openedGroup?.props??null},openedWindows:[...r.openedWindows,{windowName:s,openedWorkspaces:[CI(e,t)],props:n,maximized:!1}],isMostRecentlyOpenedWindowHidden:!1}),!0):!!await Cz({reason:"CLOSE_OTHER_WINDOWS",explicit:!1,windowNameToSpare:o.name})&&(uN.setState({...r,openedGroup:{groupName:l.name,props:a??r?.openedGroup?.props??null},openedWindows:[{windowName:s,openedWorkspaces:[CI(e,t)],props:n,maximized:!1}],isMostRecentlyOpenedWindowHidden:!1}),!0)}function CM(e,t){return null==e||null==t||N(e,t)}function Cz(e){function t(e,t){let n=[];for(let a=e.openedWorkspaces.length-1;a>=0;a--){let r=e.openedWorkspaces[a];if(r.hasUnsavedChanges&&n.push(r),t&&r.workspaceName===t)break}return n}let{openedWindows:n,workspaceTitleByWorkspaceName:a}=uN.getState(),r=[];switch(e.reason){case"CLOSE_WORKSPACE_GROUP":r=n.flatMap(e=>t(e));break;case"CLOSE_WINDOW":{let a=n.find(t=>t.windowName===e.windowName);if(!a)throw Error(`Window ${e.windowName} not found in opened windows.`);r=t(a);break}case"CLOSE_WORKSPACE":{let a=n.find(t=>t.windowName===e.windowName);if(!a)throw Error(`Window ${e.windowName} not found in opened windows.`);r=t(a,e.workspaceName);break}case"CLOSE_OTHER_WINDOWS":r=n.filter(t=>t.windowName!==e.windowNameToSpare).flatMap(e=>t(e))}return 0===r.length?Promise.resolve(!0):new Promise(e=>{let t=w3("workspace2-close-prompt",{onConfirm:()=>{t(),e(!0)},onCancel:()=>{t(),e(!1)},affectedWorkspaceTitles:r.map(e=>a[e.workspaceName])})})}let CO={setWindowMaximized(e,t,n){let a=e.openedWindows.findIndex(e=>e.windowName===t),r=[...e.openedWindows],o={...r[a],maximized:n};return r[a]=o,{...e,openedWindows:r}},hideWindow:e=>({...e,isMostRecentlyOpenedWindowHidden:!0}),restoreWindow(e,t){let n=e.openedWindows.findIndex(e=>e.windowName===t),a=e.openedWindows[n],r=[...e.openedWindows.filter((e,t)=>t!==n),a];return{...e,openedWindows:r,isMostRecentlyOpenedWindowHidden:!1}},closeWorkspace(e,t){let n=uF(t);if(n<0)return e;let a={...e.openedWindows[n]},r=a.openedWorkspaces.findIndex(e=>e.workspaceName===t),o=[...e.openedWindows];a.openedWorkspaces=a.openedWorkspaces.slice(0,r);let i=e.isMostRecentlyOpenedWindowHidden;if(0===a.openedWorkspaces.length){let t=n===e.openedWindows.length-1;o.splice(n,1),t&&o.length>0&&(i=!1)}else o[n]=a;return{...e,openedWindows:o,isMostRecentlyOpenedWindowHidden:i}},openChildWorkspace(e,t,n,a){let r=e.registeredWorkspacesByName[n];if(!r)throw Error(`No workspace named "${n}" registered`);let o=e.registeredWorkspacesByName[t];if(!o)throw Error(`No workspace named "${t}" registered`);if(o.window!==r.window)throw Error(`Child workspace ${n} does not belong to the same workspace window as parent workspace ${t}`);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{openedWorkspaces:s}=e.openedWindows[i],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{openedWindows:e.openedWindows.map((e,t)=>t==i?{...e,openedWorkspaces:[...c,CI(n,a)]}:e)}},setHasUnsavedChanges(e,t,n){let a=uF(t);if(a<0)return e;let r={...e.openedWindows[a]},o=r.openedWorkspaces.findIndex(e=>e.workspaceName===t);if(o<0)return e;r.openedWorkspaces[o]={...r.openedWorkspaces[o],hasUnsavedChanges:n};let i=[...e.openedWindows];return i[a]=r,{...e,openedWindows:i}},setWorkspaceTitle(e,t,n){let a={...e.workspaceTitleByWorkspaceName};return null===n?delete a[t]:a[t]=n,{...e,workspaceTitleByWorkspaceName:a}}};function CP(){return u0(uN,CO)}let CT=()=>(0,uq.useContext)(pa),CB=()=>Object.keys(uN.getState().registeredWorkspacesByName);function CI(e,t){return{workspaceName:e,props:t??{},hasUnsavedChanges:!1,uuid:(0,lU.A)()}}var CN=n(1179),Cj={};Cj.styleTagTransform=dX(),Cj.setAttributes=dK(),Cj.insert=dq().bind(null,"head"),Cj.domAPI=dV(),Cj.insertStyleElement=dJ(),dW()(CN.A,Cj);let CR=CN.A&&CN.A.locals?CN.A.locals:void 0,CF=({title:e,children:t,hasUnsavedChanges:n=!1})=>{let a=dn(),{setWindowMaximized:r,hideWindow:o,setHasUnsavedChanges:i,openedWindows:s,openedGroup:l,registeredGroupsByName:c,registeredWindowsByName:u,registeredWorkspacesByName:p,workspaceTitleByWorkspaceName:d,setWorkspaceTitle:f,isMostRecentlyOpenedWindowHidden:h}=CP(),{workspaceName:m,isRootWorkspace:g,closeWorkspace:y,showActionMenu:b}=CT(),v=uF(m),$=s[v],A=$?.openedWorkspaces.find(e=>e.workspaceName===m);if((0,uq.useEffect)(()=>{A?.hasUnsavedChanges!=n&&i(m,n??!1)},[A?.hasUnsavedChanges,n,m,i]),(0,uq.useEffect)(()=>{d[m]!==e&&f(m,e)},[d,m,e,f]),v<0||null==l||null==A)return null;let w=c[l.groupName];if(!w)throw Error(`Cannot find registered workspace group ${l.groupName}`);let k=p[m].window,x=u[k];if(!x)throw Error(`Cannot find registered workspace window ${k}`);let{icon:C,canMaximize:E}=x,S="closable"===w.persistence,D=!!C&&!S,{maximized:M}=$,z=x?.width??"narrow",O=Object.values(u).some(e=>e.group===l.groupName&&void 0!==e.icon),P=v<s.length-1||h;return(0,dj.jsxs)("div",{className:dF()(CR.workspaceOuterContainer,{[CR.narrowWorkspace]:"narrow"===z,[CR.widerWorkspace]:"wider"===z,[CR.extraWideWorkspace]:"extra-wide"===z,[CR.isActionMenuOpened]:O}),children:[(0,dj.jsx)("div",{className:dF()(CR.workspaceSpacer,{[CR.hidden]:P})}),(0,dj.jsx)("div",{className:dF()(CR.workspaceMiddleContainer,{[CR.maximized]:M,[CR.hidden]:P,[CR.isRootWorkspace]:g,[CR.showActionMenu]:b}),children:(0,dj.jsxs)("div",{className:dF()(CR.workspaceInnerContainer,{[CR.maximized]:M,[CR.hidden]:P,[CR.isRootWorkspace]:g}),children:[(0,dj.jsxs)(d6.Header,{"aria-label":rp("workspaceHeader"),className:CR.header,children:[(0,dj.jsx)(d6.HeaderName,{prefix:"",children:e}),(0,dj.jsx)("div",{className:CR.overlayHeaderSpacer}),(0,dj.jsx)(d6.HeaderGlobalBar,{className:CR.headerButtons,children:da(a)?(0,dj.jsxs)(dj.Fragment,{children:[(E||M)&&(0,dj.jsx)(d6.HeaderGlobalAction,{"aria-label":M?rp("minimize"):rp("maximize"),onClick:()=>r(k,!M),children:M?(0,dj.jsx)(Ca.Xj,{}):(0,dj.jsx)(Ca.hz,{})}),D&&(0,dj.jsx)(d6.HeaderGlobalAction,{"aria-label":rp("hide"),onClick:()=>o(),children:(0,dj.jsx)(fm,{})}),!S&&(0,dj.jsx)(d6.HeaderGlobalAction,{"aria-label":rp("close"),onClick:()=>y({closeWindow:!0}),children:(0,dj.jsx)(fP,{})})]}):(0,dj.jsxs)(dj.Fragment,{children:[D&&(0,dj.jsx)(d6.HeaderGlobalAction,{"aria-label":rp("hide"),onClick:()=>o(),children:(0,dj.jsx)(Cr.d3,{})}),(0,dj.jsx)(d6.HeaderGlobalAction,{"aria-label":rp("close"),onClick:()=>{S?CS():y({closeWindow:!0})},children:(0,dj.jsx)(fP,{})})]})})]}),(0,dj.jsx)("div",{className:dF()(CR.workspaceContent),children:t})]})})]})};var CL=n(7810),CW={};CW.styleTagTransform=dX(),CW.setAttributes=dK(),CW.insert=dq().bind(null,"head"),CW.domAPI=dV(),CW.insertStyleElement=dJ(),dW()(CL.A,CW);let CG=CL.A&&CL.A.locals?CL.A.locals:void 0;function CV({getIcon:e,hasUnsavedChanges:t,tagContent:n}){return(0,dj.jsxs)(dj.Fragment,{children:[e({size:16}),t?(0,dj.jsx)("span",{className:CG.interruptedTag,children:"!"}):(0,dj.jsx)("span",{className:CG.countTag,children:n})]})}let CU=({icon:e,label:t,tagContent:n,workspaceToLaunch:a,onBeforeWorkspaceLaunch:r})=>{let o=dn(),{openedWindows:i,restoreWindow:s,hideWindow:l,isMostRecentlyOpenedWindowHidden:c}=CP(),{extension:u}=(0,uq.useContext)(uK),p=i.findIndex(e=>e.windowName===u?.extensionId),d=i[p],f=null!=d,h=f&&(p<i.length-1||c),m=f&&!h,g=d?.openedWorkspaces.some(e=>e.hasUnsavedChanges)??!1,y=async()=>{if(f)h?s(d.windowName):l();else if(await (r?.()??!0)){let{workspaceName:e,workspaceProps:t,windowProps:n}=a;CD(e,t,n)}};return"tablet"===o||"phone"===o?(0,dj.jsxs)(d6.Button,{className:dF()(CG.container,{[CG.active]:f&&!m,[CG.focused]:m}),iconDescription:t,kind:"ghost",onClick:y,role:"button",tabIndex:0,size:"md",children:[(0,dj.jsx)("span",{className:CG.elementContainer,children:(0,dj.jsx)(CV,{hasUnsavedChanges:g,getIcon:e,tagContent:n})}),(0,dj.jsx)("span",{children:t})]}):(0,dj.jsx)(d6.IconButton,{align:"left","aria-label":t,className:dF()(CG.container,{[CG.active]:f&&!m,[CG.focused]:m}),enterDelayMs:300,kind:"ghost",label:t,onClick:y,size:"md",children:(0,dj.jsx)("div",{className:CG.elementContainer,children:(0,dj.jsx)(CV,{hasUnsavedChanges:g,getIcon:e,tagContent:n})})})};function Cq({showContactDetails:e,toggleContactDetails:t,className:n}){return(0,dj.jsx)(d6.Button,{className:n,iconDescription:"Toggle contact details",kind:"ghost",onClick:t,renderIcon:e?fO:fD,children:e?rp("showLess","Show less"):rp("showMore","Show more")})}var CH=n(5804),CK={};CK.styleTagTransform=dX(),CK.setAttributes=dK(),CK.insert=dq().bind(null,"head"),CK.domAPI=dV(),CK.insertStyleElement=dJ(),dW()(CH.A,CK);let CY=CH.A&&CH.A.locals?CH.A.locals:void 0,CJ=({patientUuid:e})=>{let{cohorts:t=[],isLoading:n}=function(e){let t=e?`${n0}/cohortm/cohortmember?patient=${e}&v=custom:(uuid,patient:ref,cohort:(uuid,name,startDate,endDate))`:null,{data:n,isLoading:a}=(0,pd.Ay)(t,n4),r=n?.data?.results.map(e=>({uuid:e.cohort.uuid,name:e.cohort.name,startDate:e.cohort.startDate,endDate:e.cohort.endDate}));return(0,uq.useMemo)(()=>({cohorts:r,isLoading:a}),[a,r])}(e);return(0,dj.jsxs)(dj.Fragment,{children:[(0,dj.jsxs)("p",{className:CY.heading,children:[rp("patientLists","Patient Lists")," (",t?.length??0,")"]}),n?(0,dj.jsx)(d6.InlineLoading,{description:`${rp("loading","Loading")} ...`,role:"progressbar"}):(0,dj.jsxs)("ul",{children:[(()=>{if(t?.length>0){let e=t.sort((e,t)=>AL(e?.startDate).getTime()-AL(t?.startDate).getTime()).slice(0,3);return e?.map(e=>(0,dj.jsx)("li",{children:(0,dj.jsx)(uY,{to:`${window.spaBase}/home/patient-lists/${e.uuid}`,children:e.name},e.uuid)},e.uuid))}return(0,dj.jsx)("li",{children:"--"})})(),t.length>3&&(0,dj.jsx)("li",{className:CY.link,children:(0,dj.jsx)(uY,{to:`${window.spaBase}/home/patient-lists`,children:rp("seeMoreLists","See {{count}} more lists",{count:t?.length-3})})})]})]})},CZ=({patientId:e})=>{let{patient:t,isLoading:n}=dh(e),a=t?.address?.find(e=>"home"===e.use),r=e=>e.split("#")[1];return n?(0,dj.jsx)(d6.InlineLoading,{description:`${rp("loading","Loading")} ...`,role:"progressbar"}):(0,dj.jsxs)(dj.Fragment,{children:[(0,dj.jsx)("p",{className:CY.heading,children:rp("address","Address")}),(0,dj.jsx)("ul",{children:a?Object.entries(a).filter(([e])=>"id"!==e&&"use"!==e).map(([e,t])=>"extension"===e?a.extension?.[0]?.extension?.map((t,n)=>(0,dj.jsxs)("li",{children:[rp(r(t.url),r(t.url)),": ",t.valueString]},`address-${e}-${n}`)):(0,dj.jsxs)("li",{children:[rp(e,e),": ",t]},`address-${e}`)):(0,dj.jsx)("li",{children:"--"})})]})},CX=({patientUuid:e})=>{let{isLoading:t,contactAttributes:n}=(e=>{let{contactAttributeTypes:t=[]}=pR({externalModuleName:"@openmrs/esm-patient-banner-app"}),{attributes:n,error:a,isLoading:r}=(e=>{let{data:t,error:n,isLoading:a}=pV()(`${n0}/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)))`,n4);return{isLoading:a,attributes:t?.data.person.attributes??[],error:n}})(e);return{contactAttributes:(0,uq.useMemo)(()=>n.filter(({attributeType:e})=>t?.some(t=>e.uuid===t)),[n,t]),isLoading:r,error:a}})(e),a=(0,uq.useMemo)(()=>n?[...n?.map(e=>[e.attributeType.display?rp(e.attributeType.display,e.attributeType.display):"",e.value])]:[],[n]);return(0,dj.jsxs)(dj.Fragment,{children:[(0,dj.jsx)("p",{className:CY.heading,children:rp("contactDetails","Contact Details")}),t?(0,dj.jsx)(d6.InlineLoading,{description:`${rp("loading","Loading")} ...`,role:"progressbar"}):(0,dj.jsx)("ul",{children:a.length?a.map(([e,t],n)=>(0,dj.jsxs)("li",{children:[e,": ",t]},`${e}-${t}-${n}`)):(0,dj.jsx)("li",{children:"--"})})]})},CQ=({patientId:e})=>{let{data:t,isLoading:n}=function(e){let t=`${n0}/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:a,isLoading:r,isValidating:o}=(0,pd.Ay)(e?t:null,n4),i=n?.data?.results?.length?function(e,t){let n=[];for(let a of t)e===a.personA.uuid?n.push({uuid:`${a.uuid}`,display:a.personB.display,relativeAge:a.personB.age,relativeUuid:a.personB.uuid,relationshipType:a.relationshipType.bIsToA}):n.push({uuid:`${a.uuid}`,display:a.personA.display,relativeAge:a.personA.age,relativeUuid:a.personA.uuid,relationshipType:a.relationshipType.aIsToB});return n}(e,n.data.results):null;return{data:n?i:null,error:a,isLoading:r,isValidating:o}}(e);return(0,dj.jsxs)(dj.Fragment,{children:[(0,dj.jsx)("p",{className:CY.heading,children:rp("relationships","Relationships")}),n?(0,dj.jsx)(d6.InlineLoading,{description:`${rp("loading","Loading")} ...`,role:"progressbar"}):(0,dj.jsx)("ul",{children:t&&t.length>0?(0,dj.jsx)(dj.Fragment,{children:t.map(e=>(0,dj.jsxs)("li",{className:CY.relationship,children:[(0,dj.jsx)("div",{children:(0,dj.jsx)(uY,{to:`${window.spaBase}/patient/${e.relativeUuid}/chart`,children:e.display})}),(0,dj.jsx)("div",{children:e.relationshipType}),(0,dj.jsx)("div",{children:`${e.relativeAge?e.relativeAge:"--"} ${e.relativeAge?1===e.relativeAge?rp("yearAbbreviation","yr"):rp("yearsAbbreviation","yrs"):""}`})]},e.uuid))}):(0,dj.jsx)("li",{children:"--"})})]})};function C0({patientId:e,deceased:t}){return(0,dj.jsxs)("div",{className:dF()(CY.contactDetails,{[CY.deceased]:t}),children:[(0,dj.jsxs)("div",{className:CY.row,children:[(0,dj.jsx)("div",{className:CY.col,children:(0,dj.jsx)(CZ,{patientId:e})}),(0,dj.jsx)("div",{className:CY.col,children:(0,dj.jsx)(CX,{patientUuid:e})})]}),(0,dj.jsxs)("div",{className:CY.row,children:[(0,dj.jsx)("div",{className:CY.col,children:(0,dj.jsx)(CQ,{patientId:e})}),(0,dj.jsx)("div",{className:CY.col,children:(0,dj.jsx)(CJ,{patientUuid:e})})]})]})}function C1(e){let t=document.querySelector("template#loading-spinner");if(t){let n=t.content.cloneNode(!0),a=Array.prototype.map.call(n.childNodes,e=>e);return e.appendChild(n),()=>a.forEach(e=>e.remove())}return()=>{}}var C2=n(4039),C3={};C3.styleTagTransform=dX(),C3.setAttributes=dK(),C3.insert=dq().bind(null,"head"),C3.domAPI=dV(),C3.insertStyleElement=dJ(),dW()(C2.A,C3);let C4=C2.A&&C2.A.locals?C2.A.locals:void 0;function C5({workspaceGroup:e,groupProps:t}){let n=dn(),{persistence:a}=e;return(0,dj.jsx)("aside",{className:C4.sideRail,children:(0,dj.jsxs)("div",{className:C4.container,children:["closable"==a&&da(n)&&(0,dj.jsx)(d6.IconButton,{align:"left",onClick:()=>CS(),label:rp("close"),kind:"ghost",children:(0,dj.jsx)(fP,{})}),(0,dj.jsx)(uK.Provider,{value:{moduleName:e.moduleName,featureName:e.name},children:(0,dj.jsx)(u6,{className:C4.container,name:e.name,state:{groupProps:t}})})]})})}let C6=({lifeCycle:e,openedWorkspace:t,openedWindow:n,isRootWorkspace:a,isLeafWorkspace:r,showActionMenu:o})=>{let{openedGroup:i,closeWorkspace:s,openChildWorkspace:l}=CP(),c=(0,uq.useMemo)(()=>t&&{closeWorkspace:async(e={})=>{let{closeWindow:a=!1,discardUnsavedChanges:r=!1}=e;return a?!!(r||await Cz({reason:"CLOSE_WINDOW",explicit:!0,windowName:n.windowName}))&&(s(n.openedWorkspaces[0].workspaceName),!0):!!(r||await Cz({reason:"CLOSE_WORKSPACE",explicit:!0,windowName:n.windowName,workspaceName:t.workspaceName}))&&(s(t.workspaceName),!0)},launchChildWorkspace:async(e,a)=>{let r=t.workspaceName,{openedWorkspaces:o}=n,i=o.findIndex(e=>e.workspaceName===r);-1===i||i!==o.length-1&&o.slice(i+1).some(e=>e.hasUnsavedChanges)&&!await Cz({reason:"CLOSE_WORKSPACE",explicit:!0,windowName:n.windowName,workspaceName:o[i+1].workspaceName})||l(r,e,a||{})},workspaceName:t.workspaceName,workspaceProps:t.props,windowProps:n.props,groupProps:i&&i.props?i.props:null,isRootWorkspace:a,isLeafWorkspace:r,windowName:n.windowName,showActionMenu:o},[t,s,i,n]);if(!e){let{registeredWorkspacesByName:e}=uN.getState(),n=e[t.workspaceName],r=n&&n.window?n.window:void 0,{registeredWindowsByName:s}=uN.getState(),l=r?s[r]:void 0,c=l&&l.width?l.width:"narrow",u=Object.values(s).some(e=>e.group===i?.groupName&&void 0!==e.icon);return(0,dj.jsxs)("div",{className:dF()(CR.workspaceOuterContainer,{[CR.narrowWorkspace]:"narrow"===c,[CR.widerWorkspace]:"wider"===c,[CR.extraWideWorkspace]:"extra-wide"===c,[CR.isActionMenuOpened]:u}),children:[(0,dj.jsx)("div",{className:CR.workspaceSpacer}),(0,dj.jsx)("div",{className:dF()(CR.workspaceMiddleContainer,{[CR.isRootWorkspace]:a,[CR.showActionMenu]:o}),children:(0,dj.jsx)("div",{className:dF()(CR.workspaceInnerContainer,{[CR.isRootWorkspace]:a}),children:(0,dj.jsx)(d6.InlineLoading,{className:CR.loader,description:`${rp("loading")} ...`})})})]})}return(0,dj.jsx)(Cg,{config:e,mountParcel:t2,...c},t.workspaceName)},C8=({openedWindow:e,showActionMenu:t})=>{let{openedWorkspaces:n}=e,[a,r]=(0,uq.useState)(),{registeredWorkspacesByName:o}=uN.getState();return(0,uq.useEffect)(()=>{Promise.all(n.map(e=>{let{moduleName:t,component:n}=o[e.workspaceName];return dE(t,n)})).then(r)},[n]),(0,dj.jsx)(dj.Fragment,{children:n.map((r,o)=>(0,dj.jsx)(C6,{openedWorkspace:r,openedWindow:e,lifeCycle:a&&a[o]?a[o]:void 0,isRootWorkspace:0===o,isLeafWorkspace:o===n.length-1,showActionMenu:t},r.uuid))})};var C7=n(297),C9={};C9.styleTagTransform=dX(),C9.setAttributes=dK(),C9.insert=dq().bind(null,"head"),C9.domAPI=dV(),C9.insertStyleElement=dJ(),dW()(C7.A,C9);let Ee=C7.A&&C7.A.locals?C7.A.locals:void 0;function Et(e){e&&(0,u8.createRoot)(e).render((0,dj.jsx)(En,{}))}function En(){let{openedGroup:e,openedWindows:t,registeredGroupsByName:n,registeredWindowsByName:a}=CP();if((0,uq.useEffect)(()=>co("before-page-changed",t=>{let{newPage:a,cancelNavigation:r,oldUrl:o,newUrl:i}=t;if(!e)return;if(a)return void r(CS().then(e=>!e));let s=n[e.groupName],l=s?.scopePattern;l&&function(e,t,n){try{let a=new URL(t,window.location.origin).pathname,r=new URL(n,window.location.origin).pathname,o=new RegExp(e),i=a.match(o),s=r.match(o);if(!i||!s)return!0;if(i.length>1)return!i.slice(1).every((e,t)=>e===s[t+1]);return!1}catch{return!0}}(l,o,i)&&r(CS().then(e=>!e))}),[e,n]),!e)return null;let r=n[e.groupName],o=t.some(e=>e.maximized),{name:i}=r,s=Object.values(a).filter(e=>e.group===i&&void 0!==e.icon).sort((e,t)=>(e.order??Number.MAX_VALUE)-(t.order??Number.MAX_VALUE)).length>0;return(0,dj.jsxs)("div",{className:dF()(Ee.workspaceWindowsAndMenuContainer,{[Ee.overlay]:r.overlay,[Ee.hasMaximizedWindow]:o}),children:[(0,dj.jsx)("div",{className:Ee.workspaceWindowsContainer,children:t.map(e=>(0,dj.jsx)(C8,{openedWindow:e,showActionMenu:s},e.windowName))}),s&&(0,dj.jsx)(C5,{workspaceGroup:r,groupProps:e.props})]})}function Ea(e){if("string"!=typeof e||0===e.trim().length)return;let t=e.replaceAll("_","-");try{return new Intl.Locale(t).toString()}catch{return}}function Er(e,t,n){if(null==e)return n;let a=Ea(e);if(!a)return console.warn(`matchLocale: invalid requested locale tag: ${JSON.stringify(e)}`),n;let r=[];for(let e of t){let t=Ea(e);if(!t){console.warn(`matchLocale: skipping invalid available locale tag: ${JSON.stringify(e)}`);continue}r.push({canonical:t,original:e})}let o=a;for(;o;){let e=r.find(e=>e.canonical===o);if(e)return e.original;let t=o+"-",n=r.find(e=>e.canonical.startsWith(t));if(n)return n.original;if("ht"===o){o="fr-HT";continue}let a=o.lastIndexOf("-");if(-1===a)break;let i=(o=o.slice(0,a)).lastIndexOf("-");-1!==i&&o.length-i==2&&(o=o.slice(0,i))}return n}function Eo(e=window.localStorage){try{return e.getItem("test"),!0}catch{return!1}}function Ei(e){return!!e&&e.constructor===Object}var Es=n(9589);function El(e){let[t,n,a]=e.split(".");return`${t}.${n}.${a}`}function Ec(e,t){let n=function(e){let t=e.indexOf("-");if(t>=0){let n=El(e.slice(0,t)),a=e.slice(t+1);return`${n}-${a}`}return El(e)}(t);return Es.satisfies(n,e,{includePrerelease:!0})}async function Eu(e,t={}){let n,{shouldRetry:a,getDelay:r,onError:o}=t;a=a??(e=>e<=5),r=r??(e=>(function(e,t=!1){return 1e3*Math.pow(2,t?e+1:e)})(e));let i=0;do try{return await Ep(r(i)),await e()}catch(e){o?.(e,i),n=e}while(a(i++));throw n}async function Ep(e){if(!(e<=0))return new Promise(t=>setTimeout(t,e))}}}]);
43
+ }`.trim(),document.head.prepend(a),o=HTMLElement.prototype.focus,HTMLElement.prototype.focus=function(e){let t=((e=document)=>e.activeElement)(),n=null!=t&&$z(t);o.call(this,{...e,preventScroll:!0}),e&&e.preventScroll||$I(this,n)},i=hX($B(document,"touchstart",t=>{let a=mS(t);e=bI(a)?a:bN(a,!0),n=!1;let r=a.ownerDocument.defaultView.getSelection();r&&!r.isCollapsed&&r.containsNode(a,!0)&&(n=!0),t.composedPath().some(e=>e instanceof HTMLInputElement&&"range"===e.type)&&(n=!0),"selectionStart"in a&&"selectionEnd"in a&&a.selectionStart<a.selectionEnd&&a.ownerDocument.activeElement===a&&(n=!0)},{passive:!1,capture:!0}),$B(document,"touchmove",t=>{if(2!==t.touches.length&&!n){if(!e||e===document.documentElement||e===document.body)return void t.preventDefault();e.scrollHeight===e.clientHeight&&e.scrollWidth===e.clientWidth&&t.preventDefault()}},{passive:!1,capture:!0}),$B(document,"blur",e=>{let t=mS(e),n=e.relatedTarget;if(n&&$z(n))n.focus({preventScroll:!0}),$I(n,$z(t));else if(!n){let e=t.parentElement?.closest("[tabindex]");e?.focus({preventScroll:!0})}},!0)),()=>{t(),i(),a.remove(),HTMLElement.prototype.focus=o}):hX((s=window.innerWidth-document.documentElement.clientWidth)>0&&("scrollbarGutter"in document.documentElement.style?$T(document.documentElement,"scrollbarGutter","stable"):$T(document.documentElement,"paddingRight",`${s}px`)),$T(document.documentElement,"overflow","hidden"))),()=>{0==--$P&&c()}}},[t])}({isDisabled:o||!t.isOpen}),(0,uq.useEffect)(()=>{if(t.isOpen&&a.current)if(o){var e,n,i=r?.current??a.current;let t=$i[$i.length-1];return t&&!t.visibleNodes.has(i)?(t.visibleNodes.add(i),()=>{t.visibleNodes.delete(i)}):void 0}else{let t,o,i,s,l,c,u,p,d,f,h;return e=[r?.current??a.current],o=(n={shouldUseInert:!0})instanceof(t=mC(e?.[0])).Element?{root:n}:n,i=o?.root??document.body,s=o?.shouldUseInert&&$r,l=new Set(e),c=new Set,u=(e,n)=>{s&&e instanceof t.HTMLElement?e.inert=n:n?e.setAttribute("aria-hidden","true"):(e.removeAttribute("aria-hidden"),e instanceof t.HTMLElement&&(e.inert=!1))},p=e=>{for(let t of e.querySelectorAll("[data-live-announcer], [data-react-aria-top-layer]"))l.add(t);let t=e=>{if(c.has(e)||l.has(e)||e.parentElement&&c.has(e.parentElement)&&"row"!==e.parentElement.getAttribute("role"))return NodeFilter.FILTER_REJECT;for(let t of l)if(mE(e,t))return NodeFilter.FILTER_SKIP;return NodeFilter.FILTER_ACCEPT},n=_X(mx(e),e,NodeFilter.SHOW_ELEMENT,{acceptNode:t}),a=t(e);if(a===NodeFilter.FILTER_ACCEPT&&d(e),a!==NodeFilter.FILTER_REJECT){let e=n.nextNode();for(;null!=e;)d(e),e=n.nextNode()}},d=e=>{let n=$o.get(e)??0;(s&&e instanceof t.HTMLElement?e.inert:"true"===e.getAttribute("aria-hidden"))&&0===n||(0===n&&u(e,!0),c.add(e),$o.set(e,n+1))},$i.length&&$i[$i.length-1].disconnect(),p(i),(f=new MutationObserver(e=>{for(let n of e)if("childList"===n.type&&n.target.isConnected&&![...l,...c].some(e=>mE(e,n.target)))for(let e of n.addedNodes){var t;(e instanceof HTMLElement||e instanceof SVGElement)&&("true"===(t=e).dataset.liveAnnouncer||void 0!==t.dataset.reactAriaTopLayer)?l.add(e):e instanceof Element&&p(e)}})).observe(i,{childList:!0,subtree:!0}),h={visibleNodes:l,hiddenNodes:c,observe(){f.observe(i,{childList:!0,subtree:!0})},disconnect(){f.disconnect()}},$i.push(h),()=>{for(let e of(f.disconnect(),c)){let t=$o.get(e);null!=t&&(1===t?(u(e,!1),$o.delete(e)):$o.set(e,t-1))}h===$i[$i.length-1]?($i.pop(),$i.length&&$i[$i.length-1].observe()):$i.splice($i.indexOf(h),1)}}},[o,t.isOpen,a,r]),{popoverProps:mr(p,f),arrowProps:h,underlayProps:d,placement:m,triggerAnchorPoint:g}}({...a,offset:null!=(r=a.offset)?r:8,arrowSize:s,groupRef:d?p:u},e),y=a.popoverRef,b=function(e,t=!0){let[n,a]=(0,uq.useState)(!0),r=n&&t;return hQ(()=>{if(r&&e.current&&"getAnimations"in e.current)for(let t of e.current.getAnimations())t instanceof CSSTransition&&t.cancel()},[e,r]),$F(e,r,(0,uq.useCallback)(()=>a(!1),[])),r}(y,!!g)||a.isEntering||!1,v=ms({...a,defaultClassName:"react-aria-Popover",values:{trigger:a.trigger||null,placement:g,isEntering:b,isExiting:t}}),$=!a.isNonModal||"SubmenuTrigger"===a.trigger,[A,w]=(0,uq.useState)(!1);hQ(()=>{y.current&&w($&&!y.current.querySelector("[role=dialog]"))},[y,$]),(0,uq.useEffect)(()=>{var e;let t,n;A&&y.current&&!y.current.contains(document.activeElement)&&(n=((e=document)=>e.activeElement)(t=mx(e=y.current)),"virtual"===$L?gu(()=>{((e=document)=>e.activeElement)(t)===n&&e.isConnected&&mw(e)}):mw(e))},[A,y]);let k={...f.style,...v.style},x=uH().createElement("div",{...mr(mA(a),f),...v,role:A?"dialog":void 0,tabIndex:A?-1:void 0,"aria-label":a["aria-label"],"aria-labelledby":a["aria-labelledby"],ref:y,slot:a.slot||void 0,style:k,dir:a.dir,"data-trigger":a.trigger,"data-placement":g,"data-entering":b||void 0,"data-exiting":t||void 0},!a.isNonModal&&uH().createElement($R,{onDismiss:e.close}),uH().createElement($a.Provider,{value:{...m,placement:g,ref:i}},v.children),uH().createElement($R,{onDismiss:e.close}));return d?uH().createElement(v3,{...a,shouldContainFocus:A,isExiting:t,portalContainer:null!=(o=null!=n?n:null==p?void 0:p.current)?o:void 0},x):uH().createElement(v3,{...a,shouldContainFocus:A,isExiting:t,portalContainer:n},!a.isNonModal&&e.isOpen&&uH().createElement("div",{"data-testid":"underlay",...h,style:{position:"fixed",inset:0}}),uH().createElement("div",{ref:u,style:{display:"contents"}},uH().createElement($2.Provider,{value:u},x)))}function $5(e){return e?.start!=null&&null!=e.end}let $6=(0,uq.createContext)(null),$8=(0,uq.createContext)(null),$7=(0,uq.createContext)(null),$9=(0,uq.createContext)(null),Ae=(0,uq.forwardRef)(function(e,t){var n,a;[e,t]=mc(e,t,$6);let{validationBehavior:r}=ml($e)||{},o=null!=(a=null!=(n=e.validationBehavior)?n:r)?a:"native",i=function(e){let t=$0(e),[n,a]=_M(e.value,e.defaultValue||null,e.onChange),[r]=(0,uq.useState)(n),o=n||e.placeholderValue||null,[i,s]=vj(o,e.granularity),l=null!=n?n.toDate(s??"UTC"):null,c="hour"===i||"minute"===i||"second"===i,u=e.shouldCloseOnSelect??!0,[p,d]=(0,uq.useState)(null),[f,h]=(0,uq.useState)(null);if(n&&(p=n,"hour"in n&&(f=n)),o&&!(i in o))throw Error("Invalid granularity "+i+" for value "+o.toString());let m=n?.calendar.identifier==="gregory"&&"BC"===n.era,g=(0,uq.useMemo)(()=>({granularity:i,timeZone:s,hideTimeZone:e.hideTimeZone,hourCycle:e.hourCycle,shouldForceLeadingZeros:e.shouldForceLeadingZeros,showEra:m}),[i,e.hourCycle,e.shouldForceLeadingZeros,s,e.hideTimeZone,m]),{minValue:y,maxValue:b,isDateUnavailable:v}=e,$=(0,uq.useMemo)(()=>vO(n,y,b,v,g),[n,y,b,v,g]),A=vx({...e,value:n,builtinValidation:$}),w=A.displayValidation.isInvalid,k=e.validationState||(w?"invalid":null),x=(e,t)=>{a("timeZone"in t?t.set(ba(e)):br(e,t)),d(null),h(null),A.commitValidation()};return{...A,value:n,defaultValue:e.defaultValue??r,setValue:a,dateValue:p,timeValue:f,setDateValue:n=>{let r="function"==typeof u?u():u;c?f||r?x(n,f||vI(e.defaultValue||e.placeholderValue)):d(n):(a(n),A.commitValidation()),r&&t.setOpen(!1)},setTimeValue:e=>{p&&e?x(p,e):h(e)},granularity:i,hasTime:c,...t,setOpen(a){!a&&!n&&p&&c&&x(p,f||vI(e.defaultValue||e.placeholderValue)),t.setOpen(a)},validationState:k,isInvalid:w,formatValue:(e,t)=>l?new yd(e,vB(t,g)).format(l):"",getDateFormatter:(e,t)=>new yd(e,vB({},{...g,...t}))}}({...e,validationBehavior:o}),s=(0,uq.useRef)(null),[l,c]=mu(!e["aria-label"]&&!e["aria-labelledby"]),{groupProps:u,labelProps:p,fieldProps:d,buttonProps:f,dialogProps:h,calendarProps:m,descriptionProps:g,errorMessageProps:y,...b}=function(e,t,n){var a;let r=mt(),o=mt(),i=mt(),s=yE((a=vc)&&a.__esModule?a.default:a,"@react-aria/datepicker"),{isInvalid:l,validationErrors:c,validationDetails:u}=t.displayValidation,{labelProps:p,fieldProps:d,descriptionProps:f,errorMessageProps:h}=vd({...e,labelElementType:"span",isInvalid:l,errorMessage:e.errorMessage||c}),m=vu(t,n),g=d["aria-labelledby"]||d.id,{locale:y}=yo(),b=t.formatValue(y,{month:"long"}),v=bG(b?s.format("selectedDateDescription",{date:b}):""),$=[v["aria-describedby"],d["aria-describedby"]].filter(Boolean).join(" ")||void 0,A=mA(e),w=(0,uq.useMemo)(()=>vr(n),[n]),k=(0,uq.useRef)(!1),{focusWithinProps:x}=gL({...e,isDisabled:t.isOpen,onBlurWithin:t=>{mE(document.getElementById(o),t.relatedTarget)||(k.current=!1,e.onBlur?.(t),e.onFocusChange?.(!1))},onFocusWithin:t=>{k.current||(k.current=!0,e.onFocus?.(t),e.onFocusChange?.(!0))}});return{groupProps:mr(A,m,d,v,x,{role:"group","aria-disabled":e.isDisabled||null,"aria-labelledby":g,"aria-describedby":$,onKeyDown(n){!t.isOpen&&e.onKeyDown&&e.onKeyDown(n)},onKeyUp(n){!t.isOpen&&e.onKeyUp&&e.onKeyUp(n)}}),labelProps:{...p,onClick:()=>{w.focusFirst()}},fieldProps:{...d,id:i,[vg]:"presentation","aria-describedby":$,value:t.value,defaultValue:t.defaultValue,onChange:t.setValue,placeholderValue:e.placeholderValue,hideTimeZone:e.hideTimeZone,hourCycle:e.hourCycle,shouldForceLeadingZeros:e.shouldForceLeadingZeros,granularity:e.granularity,isDisabled:e.isDisabled,isReadOnly:e.isReadOnly,isRequired:e.isRequired,validationBehavior:e.validationBehavior,[vk]:t,autoFocus:e.autoFocus,name:e.name,form:e.form},descriptionProps:f,errorMessageProps:h,buttonProps:{...v,id:r,"aria-haspopup":"dialog","aria-label":s.format("calendar"),"aria-labelledby":`${r} ${g}`,"aria-describedby":$,"aria-expanded":t.isOpen,isDisabled:e.isDisabled||e.isReadOnly,onPress:()=>t.setOpen(!0)},dialogProps:{id:o,"aria-labelledby":`${r} ${g}`},calendarProps:{autoFocus:!0,value:t.dateValue,onChange:t.setDateValue,minValue:e.minValue,maxValue:e.maxValue,isDisabled:e.isDisabled,isReadOnly:e.isReadOnly,isDateUnavailable:e.isDateUnavailable,defaultFocusedValue:t.dateValue?void 0:e.placeholderValue,isInvalid:t.isInvalid,errorMessage:"function"==typeof e.errorMessage?e.errorMessage(t.displayValidation):e.errorMessage||t.displayValidation.validationErrors.join(" "),firstDayOfWeek:e.firstDayOfWeek,pageBehavior:e.pageBehavior},isInvalid:l,validationErrors:c,validationDetails:u}}({...mp(e),label:c,validationBehavior:o},i,s),[v,$]=(0,uq.useState)(null),A=(0,uq.useCallback)(()=>{s.current&&$(s.current.offsetWidth+"px")},[]);$C({ref:s,onResize:A});let{focusProps:w,isFocused:k,isFocusVisible:x}=gW({within:!0}),C=ms({...e,values:{state:i,isFocusWithin:k,isFocusVisible:x,isDisabled:e.isDisabled||!1,isInvalid:i.isInvalid,isOpen:i.isOpen},defaultClassName:"react-aria-DatePicker"}),E=mA(e);return delete E.id,uH().createElement(mi,{values:[[$7,i],[_K,{...u,ref:s,isInvalid:i.isInvalid}],[vK,d],[gZ,{...f,isPressed:i.isOpen}],[$t,{...p,ref:l,elementType:"span"}],[_I,m],[v5,i],[$1,{trigger:"DatePicker",triggerRef:s,placement:"bottom start",style:{"--trigger-width":v}}],[v4,h],[g0,{slots:{description:g,errorMessage:y}}],[v8,b]]},uH().createElement("div",{...w,...E,...C,ref:t,slot:e.slot||void 0,"data-focus-within":k||void 0,"data-invalid":i.isInvalid||void 0,"data-focus-visible":x||void 0,"data-disabled":e.isDisabled||void 0,"data-open":i.isOpen||void 0}))}),At=(0,uq.forwardRef)(function(e,t){var n,a;[e,t]=mc(e,t,$8);let{validationBehavior:r}=ml($e)||{},o=null!=(a=null!=(n=e.validationBehavior)?n:r)?a:"native",i=function(e){let t=$0(e),[n,a]=_M(e.value,e.defaultValue||null,e.onChange),[r]=(0,uq.useState)(n),[o,i]=(0,uq.useState)(()=>n||{start:null,end:null});null==n&&o.start&&o.end&&i(o={start:null,end:null});let s=n||o,l=e=>{i(s=e||{start:null,end:null}),$5(s)?a(s):a(null)},[c,u]=vj(s?.start||s?.end||e.placeholderValue||null,e.granularity),p="hour"===c||"minute"===c||"second"===c,d=e.shouldCloseOnSelect??!0,[f,h]=(0,uq.useState)(null),[m,g]=(0,uq.useState)(null);s&&$5(s)&&(f=s,"hour"in s.start&&(m=s));let y=(e,t)=>{l({start:"timeZone"in t.start?t.start.set(ba(e.start)):br(e.start,t.start),end:"timeZone"in t.end?t.end.set(ba(e.end)):br(e.end,t.end)}),h(null),g(null),E.commitValidation()},b=n=>{let a="function"==typeof d?d():d;p?$5(n)&&(a||m?.start&&m?.end)?y(n,{start:m?.start||vI(e.placeholderValue),end:m?.end||vI(e.placeholderValue)}):h(n):$5(n)?(l(n),E.commitValidation()):h(n),a&&t.setOpen(!1)},v=e=>{$5(f)&&$5(e)?y(f,e):g(e)},$=s?.start?.calendar.identifier==="gregory"&&"BC"===s.start.era||s?.end?.calendar.identifier==="gregory"&&"BC"===s.end.era,A=(0,uq.useMemo)(()=>({granularity:c,timeZone:u,hideTimeZone:e.hideTimeZone,hourCycle:e.hourCycle,shouldForceLeadingZeros:e.shouldForceLeadingZeros,showEra:$}),[c,e.hourCycle,e.shouldForceLeadingZeros,u,e.hideTimeZone,$]),{minValue:w,maxValue:k,isDateUnavailable:x}=e,C=(0,uq.useMemo)(()=>{var e;let t;return e=s,t=vD(vO(e?.start??null,w,k,x,A),vO(e?.end??null,w,k,x,A)),e?.end!=null&&null!=e.start&&0>e.end.compare(e.start)&&(t=vD(t,{isInvalid:!0,validationErrors:[(y$.getGlobalDictionaryForPackage("@react-stately/datepicker")||vM).getStringForLocale("rangeReversed",vz())],validationDetails:{...vv,rangeUnderflow:!0,rangeOverflow:!0,valid:!1}})),t},[s,w,k,x,A]),E=vx({...e,value:n,name:(0,uq.useMemo)(()=>[e.startName,e.endName].filter(e=>null!=e),[e.startName,e.endName]),builtinValidation:C}),S=E.displayValidation.isInvalid,D=e.validationState||(S?"invalid":null);return{...E,value:s,defaultValue:e.defaultValue??r,setValue:l,dateRange:f,timeRange:m,granularity:c,hasTime:p,setDate(e,t){"start"===e?b({start:t,end:f?.end??null}):b({start:f?.start??null,end:t})},setTime(e,t){"start"===e?v({start:t,end:m?.end??null}):v({start:m?.start??null,end:t})},setDateTime(e,t){"start"===e?l({start:t,end:s?.end??null}):l({start:s?.start??null,end:t})},setDateRange:b,setTimeRange:v,...t,setOpen(n){!n&&!(s?.start&&s?.end)&&$5(f)&&p&&y(f,{start:m?.start||vI(e.placeholderValue),end:m?.end||vI(e.placeholderValue)}),t.setOpen(n)},validationState:D,isInvalid:S,formatValue(t,n){let a;if(!s||!s.start||!s.end)return null;let r="timeZone"in s.start?s.start.timeZone:void 0,o=e.granularity||(s.start&&"minute"in s.start?"minute":"day"),i="timeZone"in s.end?s.end.timeZone:void 0,l=e.granularity||(s.end&&"minute"in s.end?"minute":"day"),c=vB(n,{granularity:o,timeZone:r,hideTimeZone:e.hideTimeZone,hourCycle:e.hourCycle,showEra:"gregory"===s.start.calendar.identifier&&"BC"===s.start.era||"gregory"===s.end.calendar.identifier&&"BC"===s.end.era}),u=s.start.toDate(r||"UTC"),p=s.end.toDate(i||"UTC"),d=new yd(t,c);if(r===i&&o===l&&0!==s.start.compare(s.end)){try{let e=d.formatRangeToParts(u,p),t=-1;for(let n=0;n<e.length;n++){let a=e[n];if("shared"===a.source&&"literal"===a.type)t=n;else if("endRange"===a.source)break}let n="",a="";for(let r=0;r<e.length;r++)r<t?n+=e[r].value:r>t&&(a+=e[r].value);return{start:n,end:a}}catch{}a=d}else a=new yd(t,vB(n,{granularity:l,timeZone:i,hideTimeZone:e.hideTimeZone,hourCycle:e.hourCycle}));return{start:d.format(u),end:a.format(p)}},getDateFormatter:(e,t)=>new yd(e,vB({},{...A,...t}))}}({...e,validationBehavior:o}),s=(0,uq.useRef)(null),[l,c]=mu(!e["aria-label"]&&!e["aria-labelledby"]),{groupProps:u,labelProps:p,startFieldProps:d,endFieldProps:f,buttonProps:h,dialogProps:m,calendarProps:g,descriptionProps:y,errorMessageProps:b,...v}=function(e,t,n){var a;let r=yE((a=vc)&&a.__esModule?a.default:a,"@react-aria/datepicker"),{isInvalid:o,validationErrors:i,validationDetails:s}=t.displayValidation,{labelProps:l,fieldProps:c,descriptionProps:u,errorMessageProps:p}=vd({...e,labelElementType:"span",isInvalid:o,errorMessage:e.errorMessage||i}),d=c["aria-labelledby"]||c.id,{locale:f}=yo(),h=t.formatValue(f,{month:"long"}),m=bG(h?r.format("selectedRangeDescription",{startDate:h.start,endDate:h.end}):""),g={"aria-label":r.format("startDate"),"aria-labelledby":d},y={"aria-label":r.format("endDate"),"aria-labelledby":d},b=mt(),v=mt(),$=vu(t,n),A=[m["aria-describedby"],c["aria-describedby"]].filter(Boolean).join(" ")||void 0,w=(0,uq.useMemo)(()=>vr(n,{accept:e=>e.id!==b}),[n,b]),k={[vy]:w,[vg]:"presentation","aria-describedby":A,placeholderValue:e.placeholderValue,hideTimeZone:e.hideTimeZone,hourCycle:e.hourCycle,granularity:e.granularity,shouldForceLeadingZeros:e.shouldForceLeadingZeros,isDisabled:e.isDisabled,isReadOnly:e.isReadOnly,isRequired:e.isRequired,validationBehavior:e.validationBehavior},x=mA(e),C=(0,uq.useRef)(!1),{focusWithinProps:E}=gL({...e,isDisabled:t.isOpen,onBlurWithin:t=>{mE(document.getElementById(v),t.relatedTarget)||(C.current=!1,e.onBlur?.(t),e.onFocusChange?.(!1))},onFocusWithin:t=>{C.current||(C.current=!0,e.onFocus?.(t),e.onFocusChange?.(!0))}}),S=(0,uq.useRef)(vA),D=(0,uq.useRef)(vA);return{groupProps:mr(x,$,c,m,E,{role:"group","aria-disabled":e.isDisabled||null,"aria-describedby":A,onKeyDown(n){!t.isOpen&&e.onKeyDown&&e.onKeyDown(n)},onKeyUp(n){!t.isOpen&&e.onKeyUp&&e.onKeyUp(n)}}),labelProps:{...l,onClick:()=>{w.focusFirst()}},buttonProps:{...m,id:b,"aria-haspopup":"dialog","aria-label":r.format("calendar"),"aria-labelledby":`${b} ${d}`,"aria-describedby":A,"aria-expanded":t.isOpen,isDisabled:e.isDisabled||e.isReadOnly,onPress:()=>t.setOpen(!0)},dialogProps:{id:v,"aria-labelledby":`${b} ${d}`},startFieldProps:{...g,...k,value:t.value?.start??null,defaultValue:t.defaultValue?.start,onChange:e=>t.setDateTime("start",e),autoFocus:e.autoFocus,name:e.startName,form:e.form,[vk]:{realtimeValidation:t.realtimeValidation,displayValidation:t.displayValidation,updateValidation(e){S.current=e,t.updateValidation(vD(e,D.current))},resetValidation:t.resetValidation,commitValidation:t.commitValidation}},endFieldProps:{...y,...k,value:t.value?.end??null,defaultValue:t.defaultValue?.end,onChange:e=>t.setDateTime("end",e),name:e.endName,form:e.form,[vk]:{realtimeValidation:t.realtimeValidation,displayValidation:t.displayValidation,updateValidation(e){D.current=e,t.updateValidation(vD(S.current,e))},resetValidation:t.resetValidation,commitValidation:t.commitValidation}},descriptionProps:u,errorMessageProps:p,calendarProps:{autoFocus:!0,value:t.dateRange?.start&&t.dateRange.end?t.dateRange:null,onChange:t.setDateRange,minValue:e.minValue,maxValue:e.maxValue,isDisabled:e.isDisabled,isReadOnly:e.isReadOnly,isDateUnavailable:e.isDateUnavailable,allowsNonContiguousRanges:e.allowsNonContiguousRanges,defaultFocusedValue:t.dateRange?void 0:e.placeholderValue,isInvalid:t.isInvalid,errorMessage:"function"==typeof e.errorMessage?e.errorMessage(t.displayValidation):e.errorMessage||t.displayValidation.validationErrors.join(" "),firstDayOfWeek:e.firstDayOfWeek,pageBehavior:e.pageBehavior},isInvalid:o,validationErrors:i,validationDetails:s}}({...mp(e),label:c,validationBehavior:o},i,s),[$,A]=(0,uq.useState)(null),w=(0,uq.useCallback)(()=>{s.current&&A(s.current.offsetWidth+"px")},[]);$C({ref:s,onResize:w});let{focusProps:k,isFocused:x,isFocusVisible:C}=gW({within:!0}),E=ms({...e,values:{state:i,isFocusWithin:x,isFocusVisible:C,isDisabled:e.isDisabled||!1,isInvalid:i.isInvalid,isOpen:i.isOpen},defaultClassName:"react-aria-DateRangePicker"}),S=mA(e);return delete S.id,uH().createElement(mi,{values:[[$9,i],[_K,{...u,ref:s,isInvalid:i.isInvalid}],[gZ,{...h,isPressed:i.isOpen}],[$t,{...p,ref:l,elementType:"span"}],[_N,g],[v5,i],[$1,{trigger:"DateRangePicker",triggerRef:s,placement:"bottom start",style:{"--trigger-width":$}}],[v4,m],[vK,{slots:{start:d,end:f}}],[g0,{slots:{description:y,errorMessage:b}}],[v8,v]]},uH().createElement("div",{...k,...S,...E,ref:t,slot:e.slot||void 0,"data-focus-within":x||void 0,"data-invalid":i.isInvalid||void 0,"data-focus-visible":C||void 0,"data-disabled":e.isDisabled||void 0,"data-open":i.isOpen||void 0}))});function An(e){return uH().createElement(yr,e)}function Aa(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 y1||e instanceof y3||e instanceof y4)return t?bo(e,t):e;{let n=dv()(e).toDate(),a=new y1(n.getFullYear(),n.getMonth()+1,n.getDate());return t?bo(a,t):a}}function Ar(e){if(e)return e.toDate(by())}function Ao(){let e=window.i18next.language;return"ht"===(e=e.replaceAll("_","-"))&&(e="fr-HT"),e}if("u">typeof navigator){let e=navigator;Q=Array.isArray(e.languages)?e.languages[0]:e.language}else if("u">typeof process){let e=process.env;Q=e.LC_ALL||e.LC_MESSAGES||e.LANG||e.LANGUAGE}var Ai=function(e){e=(e=e.replace(/_/g,"-")).replace(/[.:][\w-]*$/,"");try{return new Intl.Locale(e).baseName}catch(e){return"en-US"}}(Q||"en-US"),As=class extends Date{invalid=null;isValid(){return!Number.isNaN(this.valueOf())}},Al={};for(let e=1;e<100;e++)Al[(e<=9?"0":"")+e]=e+(e>51?1900:2e3);var Ac={arab:1632,arabext:1776,bali:6992,beng:2534,deva:2406,fullwide:65296,gujr:2790,khmr:6112,knda:3302,laoo:3792,limb:6470,mlym:3430,mong:6160,mymr:4160,orya:2918,tamldec:3046,telu:3174,thai:3664,tibt:3872},Au="[1234567890一二三四五六七八九〇\\d]",Ap={0:0,1:1,2:2,3:3,4:4,5:5,6:6,7:7,8:8,9:9,"0":0,"1":1,"2":2,"3":3,"4":4,"5":5,"6":6,"7":7,"8":8,"9":9,〇:0,一:1,二:2,三:3,四:4,五:5,六:6,七:7,八:8,九:9},Ad={},Af={"Eastern Daylight Time":-240,"Eastern Standard Time":-300,"Central Daylight Time":-300,"Central Standard Time":-360,"Mountain Daylight Time":-360,"Mountain Standard Time":-420,"Pacific Daylight Time":-420,"Pacific Standard Time":-480,"Coordinated Universal Time":0,ACDT:630,ACST:570,ACT:480,ADT:-180,AEDT:660,AEST:600,AFT:270,AKDT:-480,AKST:-540,AMST:-180,AMT:-240,ART:-180,AST:180,AWDT:540,AWST:480,AZOST:-60,AZT:240,BDT:360,BIOT:360,BIT:-720,BOT:-240,BRST:-120,BRT:-180,BTT:360,CAT:120,CCT:390,CDT:-300,CEDT:120,CEST:120,CET:60,CHADT:825,CHAST:765,CHOT:480,ChST:600,CHUT:600,CIST:-480,CIT:480,CKT:-600,CLST:-180,CLT:-240,COST:-240,COT:-300,CST:-360,CT:480,CVT:-60,CXT:420,DAVT:420,DDUT:600,DFT:60,EASST:-300,EAST:-360,EAT:180,ECT:-300,EDT:-240,EEDT:180,EEST:180,EET:120,EGST:0,EGT:-60,EIT:540,EST:-300,FET:180,FJT:720,FKST:-180,FKT:-240,FNT:-120,GALT:-360,GAMT:-540,GET:240,GFT:-180,GILT:720,GIT:-540,GMT:0,GST:-120,GYT:-240,HADT:-540,HAEC:120,HAST:-600,HKT:480,HMT:300,HOVT:420,HST:-600,IBST:0,ICT:420,IDT:180,IOT:180,IRDT:270,IRKT:480,IRST:210,IST:120,JST:540,KGT:360,KOST:660,KRAT:420,KST:540,LHST:630,LINT:840,MAGT:720,MART:-510,MAWT:300,MDT:-360,MET:60,MEST:120,MHT:720,MIST:660,MIT:-510,MMT:390,MSK:180,MST:-420,MUT:240,MVT:300,MYT:480,NCT:660,NDT:-90,NFT:660,NPT:345,NST:-150,NT:-150,NUT:-660,NZDT:780,NZST:720,OMST:360,ORAT:300,PDT:-420,PET:-300,PETT:720,PGT:600,PHOT:780,PKT:300,PMDT:-120,PMST:-180,PONT:660,PST:-480,PYST:-180,PYT:-240,RET:240,ROTT:-180,SAKT:660,SAMT:240,SAST:120,SBT:660,SCT:240,SGT:480,SLST:330,SRET:660,SRT:-180,SST:480,SYOT:180,TAHT:-600,THA:420,TFT:300,TJT:300,TKT:780,TLT:540,TMT:300,TOT:780,TVT:720,UCT:0,ULAT:480,USZ1:120,UTC:0,UYST:-120,UYT:-180,UZT:300,VET:-240,VLAT:600,VOLT:240,VOST:360,VUT:660,WAKT:720,WAST:120,WAT:60,WEDT:60,WEST:60,WET:0,WIT:420,WST:480,YAKT:540,YEKT:300},Ah={zone:Af,year:Al,meridiem:{am:0,pm:12,"a.m.":0,"p.m.":12},month:{january:1,jan:1,february:2,feb:2,march:3,mar:3,april:4,apr:4,may:5,june:6,jun:6,july:7,jul:7,august:8,aug:8,september:9,sep:9,october:10,oct:10,november:11,nov:11,december:12,dec:12},dayname:{sunday:0,sun:0,monday:1,mon:1,tuesday:2,tue:2,wednesday:3,wed:3,thursday:4,thu:4,friday:5,fri:5,saturday:6,sat:6},digit:{}},Am={MONTHNAME:"january|february|march|april|may|june|july|august|september|october|november|december|jan\\.?|feb\\.?|mar\\.?|apr\\.?|may\\.?|jun\\.?|jul\\.?|aug\\.?|sep\\.?|oct\\.?|nov\\.?|dec\\.?",DAYNAME:"sunday|monday|tuesday|wednesday|thursday|friday|saturday|sun\\.?|mon\\.?|tue\\.?|wed\\.?|thu\\.?|fri\\.?|sat\\.?",ZONE:"\\(?(?:"+Object.keys(Af).join("|")+")\\)?",MERIDIEM:"am|pm|a.m.|p.m.",ORDINAL:"st|nd|rd|th|\\.",YEAR:"\\d{4}|\\d{2}",YEAR2:"\\d{2}",YEAR4:"\\d{4}",YEAR6:"-\\d{6}|\\+?\\d{5,6}",MONTH:"1[0-2]|0?[1-9]",MONTH2:"1[0-2]|0[1-9]",DAY:"3[01]|[12]\\d|0?[1-9]",DAY2:"3[01]|[12]\\d|0[1-9]",OFFSET:"(?:GMT)?[\xb1−+-](?:[01]\\d[0-5]\\d|[01]\\d:[0-5]\\d|[01]?\\d)",H24:"[01]\\d|2[0-3]",H12:"0?[1-9]|1[012]",MIN:"[0-5]\\d",SEC:"[0-5]\\d|60",MS:"\\d{9}|\\d{6}|\\d{1,3}",GAP:"[\\s/.,-]{1,}"},Ag={...Am,YEAR:"*{4}|*{2}",YEAR4:"*{4}",YEAR6:"-*{6}|\\+?*{5,6}",MONTH:"*{1,2}",MONTH2:"*{2}",DAY:"*{1,2}",DAY2:"*{2}",OFFSET:"(?:GMT)?[\xb1−+-](?:*{4}|*{2}:*{2}|*{1,2})",H24:"*{2}",H12:"*{1,2}",MIN:"*{2}",SEC:"*{2}",MS:"*{9}|*{6}|*{3}"},Ay={},Ab=class e{locale;lookups;vars;numberingSystem;baseName;dateOptions;static factory(t=Ai){return Ay[t.toLowerCase()]||(Ay[t.toLowerCase()]=new e(t)),Ay[t.toLowerCase()]}constructor(e=Ai){this.locale=e,this.lookups={...Ah},this.vars={...Am};const t=new Intl.NumberFormat(this.locale);this.numberingSystem=t.resolvedOptions().numberingSystem,this.dateOptions=new Intl.DateTimeFormat(this.locale).resolvedOptions(),this.baseName=new Intl.Locale(this.locale).baseName,this.build()}toInt(e){if("number"==typeof e)return e;if("string"!=typeof e)return;if("latn"===this.numberingSystem&&!this.baseName.startsWith("zh")){let t=parseInt(e,10);if(!isNaN(t))return t}let t="";for(let n=0;n<e.length;n++)t+=String(this.lookups.digit[e[n]]);return parseInt(t,10)}millisecondToInt(e){if("number"==typeof e)return e;if("string"!=typeof e)return;let t=e.slice(0,3);return 1===t.length?100*this.toInt(t):2===t.length?10*this.toInt(t):this.toInt(t)}monthNameToInt(e){if("string"!=typeof e)return;let t=e.toLocaleLowerCase(this.locale).replace(/\.$/,"");return this.lookups.month[t]||12}h12ToInt(e,t){if("string"!=typeof e)return;let n=this.lookups.meridiem[t?.toLowerCase()]||0,a=this.toInt(e);return a<12&&12===n&&(a+=12),12===a&&0===n&&(a=0),a}zoneToOffset(e){if("string"==typeof e)return e=e.replace(/[^a-z\s]/gi,""),this.lookups.zone[e]}offsetToMinutes(e){if("string"!=typeof e)return;let t=e.match(/^(?:GMT)?([±−+-])(..?):?(..)?$/);if(t){let[,e,n,a]=t;return("-"===e||"−"===e?-1:1)*(60*this.toInt(n)+this.toInt(a||0))}return 0}build(){"latn"===this.dateOptions.numberingSystem?this.lookups.digit=Ap:this.buildNumbers(),!/^en/i.test(this.locale)&&(this.buildMonthNames(),this.buildDaynames(),/zh/i.test(this.locale)||this.buildMeridiems())}buildNumbers(){let{group:e,lookup:t}=function(e){if(Ad[e])return Ad[e];if("fullwide"===e||"hanidec"===e)return{group:Au,lookup:{...Ap}};let t=Ac[e];if(!t)return{group:"\\d",lookup:{...Ap}};let n=String.fromCharCode(t),a=String.fromCharCode(t+9),r={};for(let e=0;e<10;e++)r[String.fromCharCode(t+e)]=e;return Ad[e]={group:`[${n}-${a}]`,lookup:r},Ad[e]}(this.numberingSystem);for(let n in this.lookups.digit=t,Ag)Ag.hasOwnProperty(n)&&(this.vars[n]=Ag[n].replace(/\*/g,e))}buildMonthNames(){let e={},t={};if(/^fi/i.test(this.locale))"tammi|helmi|maalis|huhti|touko|kes\xe4|hein\xe4|elo|syys|loka|marras|joulu".split("|").forEach((n,a)=>{["","k","kuu","kuuta"].forEach((r,o)=>{e[n+r+(o<2?"\\.?":"")]=!0,t[n+r]=a+1})});else{let n=[],a=e=>"month"===e.type;for(let e=0;e<12;e++)n.push(new Date(2017,e,1));for(let r of["full","long","medium"]){let o=Intl.DateTimeFormat(this.locale,{dateStyle:r});for(let i=0;i<12;i++){let s=o.formatToParts(n[i]).find(a).value.toLocaleLowerCase(this.locale);/^\d+$/.test(s)||(/^ko/i.test(this.locale)&&(s+="월"),"medium"===r?(s=s.replace(/\.$/,""),e[`${s}\\.?`]=!0):e[s]=!0,t[s]=i+1)}}let r=Intl.DateTimeFormat(this.locale,{month:"short"});for(let o=0;o<12;o++){let i=r.formatToParts(n[o]).find(a).value.toLocaleLowerCase(this.locale);i=i.replace(/\.$/,""),e[`${i}\\.?`]=!0,t[i]=o+1}}this.vars.MONTHNAME=Object.keys(e).join("|"),this.lookups.month=t}buildDaynames(){let e=[],t=e=>"weekday"===e.type;for(let t=0;t<7;t++)e.push(new Date(2017,0,t+1));let n=[],a={};for(let r of["long","short"]){let o=Intl.DateTimeFormat(this.locale,{weekday:r});for(let i=0;i<7;i++){let s=o.formatToParts(e[i]).find(t).value.toLocaleLowerCase(this.locale);"short"===r?(s=s.replace(/\.$/,""),n.push(`${s}\\.?`)):n.push(s),a[s]=i}}this.vars.DAYNAME=n.join("|"),this.lookups.dayname=a}buildMeridiems(){let e=[new Date(2017,0,1),new Date(2017,0,1,23,0,0)],t=e=>"dayPeriod"===e.type,n=[],a={},r=Intl.DateTimeFormat(this.locale,{timeStyle:"long"});for(let o=0;o<2;o++){let i=r.formatToParts(e[o]).find(t);if(!i)return;let s=i.value.toLocaleLowerCase(this.locale);n.push(s),a[s]=12*o}this.vars.MERIDIEM=n.join("|"),this.lookups.meridiem=a}compile(e){return RegExp(e.replace(/_([A-Z0-9]+)_/g,(e,t)=>{if(!this.vars[t])throw Error(`Template string contains invalid variable _${t}_`);return this.vars[t]}),"i")}},A_=["ee-TG","en-AS","en-CA","en-FM","en-GH","en-GU","en-KE","en-KY","en-MH","en-MP","en-US","en-VI","en-WS","jp-JP","sm-AS","sm-SM"],Av={y:"year",M:"month",d:"day",w:"week",h:"hour",m:"minute",s:"second",ms:"millisecond"},A$=()=>new Date;function AA(e){return function(t){let n={};for(let a=0,r=e.length;a<r;a++){let r=e[a];r&&(n[r]=t[a])}return n}}var Aw=class{doneChecker;fallback;patterns;formatter;constructor({doneChecker:e,fallback:t,patterns:n,formatter:a}){this.doneChecker=e,this.fallback=t,this.patterns=n,this.formatter=a}attempt(e){if("string"!=typeof e)return this.fallback(e);let t=e.trim(),n={},a=!1;for(let e of this.patterns){let r=t.match(e.regex);if(!r)continue;a=!0;let o=e.handler(r);if(o){for(let[e,t]of Object.entries(o))e in n||void 0===t||(n[e]=t);if(t=(t=t.slice(0,r.index)+t.slice(r.index+r[0].length+1)).trim(),this.doneChecker(n,t))break}}return a?this.formatter(n):this.fallback(e)}},Ak=["year","month","day","hour","minute","second","millisecond","offset"],Ax={};function AC(e,t){return""===t||/^\s+$/.test(t)||"year"in e&&("month"in e||"monthname"in e)&&"day"in e&&"hour"in e&&"minute"in e&&"second"in e&&"millisecond"in e&&("zone"in e||"offset"in e)}var AE=[[/([^\d.]+)(\d{1,2})\.(\d{2})\.(\d{2})(\D|$)/,"$1$2:$3:$4$5"],[/([^\d.]+)(\d{1,2})\.(\d{2})(\D|$)/,"$1$2:$3$4"]],AS={ar:[[/ /g," "]],bn:[[/,/g,""]],zh:[[/早上\s*([\d:]+)/,"$1am"],[/凌晨\s*([\d:]+)/,"$1am"],[/上午\s*([\d:]+)/,"$1am"],[/下午\s*([\d:]+)/,"$1pm"],[/晚上\s*([\d:]+)/,"$1pm"]],he:[[/ב/gi,""]],de:[[/ um /g," "]],pt:[[/\sde /gi," "]],es:[[/\sde /gi," "]],da:[[/\sden /gi," "],...AE],ru:[[/ г\./g,""]],th:[[/\s*นาฬิกา\s*/i,":"],[/\s*นาที\s*/i,":"],[/\s*วินาที\s*/i," "]],ko:[[/\s*시\s*/,":"],[/\s*분\s*/,":"],[/\s*초\s*/,""],[/(오전|오후)\s*([\d:]+)/,"$2$1"],[/(\d{4})\. (\d{1,2})\. (\d{1,2})\./,"$1-$2-$3"]],fi:AE,id:AE,fr:[[/(\d{2}) h /,"$1:"],[/(\d{2}) min /,"$1:"],[/(\d{2}) s /,"$1"]]};function AD(e,t=Ai){let n=function(e){if(!Ax[e]){var t,n;let a,r,o=Ab.factory(e);Ax[e]=new Aw({doneChecker:AC,fallback:(t=e,function(e){let n=String(e).slice(0,50);return""===n&&(n="(empty string)"),{invalid:`Unable to parse "${n}" with locale "${t}"`}}),patterns:(a=[{name:"timestampWithOffset",regex:o.compile("^(_YEAR4_)-(_MONTH_)-(_DAY_)[T ](_H24_):(_MIN_):(_SEC_)(?:.(_MS_))? ?(_OFFSET_|Z)?$"),handler:AA(["","year","month","day","hour","minute","second","millisecond","offset"])},{name:"timestampWithZone",regex:o.compile("^(_YEAR4_)-(_MONTH_)-(_DAY_)[T ](_H24_):(_MIN_):(_SEC_)(?:.(_MS_))?\\s*(_ZONE_)$"),handler:AA(["","year","month","day","hour","minute","second","millisecond","zone"])},{name:"timestampWithOffsetAndZone",regex:o.compile("^(_YEAR4_)-(_MONTH_)-(_DAY_)[T ](_H24_):(_MIN_):(_SEC_)(?:.(_MS_))? (_OFFSET_|Z)\\s*(_ZONE_)$"),handler:AA(["","year","month","day","hour","minute","second","millisecond","offset"])},{name:"chinese",regex:o.compile(`^(${Au}{2,4})\\s*\u5E74\\s*(${Au}{1,2})\\s*\u6708\\s*(${Au}{1,2})\\s*\u65E5$`),handler:AA(["","year","month","day"])},{name:"korean",regex:o.compile("^(_YEAR_)년\\s*(_MONTH_)월\\s*(_DAY_)일$"),handler:AA(["","year","month","day"])},{name:"twitter",regex:/^(?:sun|mon|tue|wed|thu|fri|sat) (jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec) (\d{2}) (\d{2}):(\d{2}):(\d{2}) ([+-]\d{4}) (\d{4})$/i,handler:AA(["","monthname","day","hour","minute","second","offset","year"])},{name:"today",regex:/^(now|today|tomorrow|yesterday)$/i,handler:function(e){let t=A$(),n=e[0].toLowerCase(),a={now:0,today:0,tomorrow:864e5,yesterday:-864e5}[n];0!==a&&t.setTime(t.getTime()+a);let r={year:t.getFullYear(),month:t.getMonth()+1,day:t.getDate()};return"now"===n?{...r,hour:t.getHours(),minute:t.getMinutes(),second:t.getSeconds(),millisecond:t.getMilliseconds()}:r}},{name:"ago",regex:/^(\+|-|in|) ?([\d.]+) ?(years?|months?|weeks?|days?|hours?|minutes?|seconds?|milliseconds?|ms|s|m|h|w|d|M|y)( ago)?$/i,handler:function([,e,t,n,a]){t=parseFloat(t),"week"===(n=n.length<=2?Av[n]:(n=n.replace(/s$/,"")).toLowerCase())&&(n="day",t*=7),("-"===e||a)&&(t*=-1);let r=A$();return"millisecond"===n?r.setUTCMilliseconds(r.getUTCMilliseconds()+t):"second"===n?r.setUTCSeconds(r.getUTCSeconds()+t):"minute"===n?r.setUTCMinutes(r.getUTCMinutes()+t):"hour"===n?r.setUTCHours(r.getUTCHours()+t):"day"===n?r.setUTCDate(r.getUTCDate()+t):"month"===n?r.setUTCMonth(r.getUTCMonth()+t):"year"===n&&r.setUTCFullYear(r.getUTCFullYear()+t),{year:r.getUTCFullYear(),month:r.getUTCMonth()+1,day:r.getUTCDate(),hour:r.getUTCHours(),minute:r.getUTCMinutes(),second:r.getUTCSeconds(),millisecond:r.getUTCMilliseconds()}}},{name:"atSeconds",regex:/^@(\d+)$/,handler:function(e){let t=new Date(1e3*parseInt(e[1],10));return{year:t.getUTCFullYear(),month:t.getUTCMonth()+1,day:t.getUTCDate(),hour:t.getUTCHours(),minute:t.getUTCMinutes(),second:t.getUTCSeconds()}}},{name:"microsoftJson",regex:/^\/Date\((\d+)([+-]\d{4})?\)\/$/,handler:function(e){let t=new Date(parseInt(e[1],10));return{year:t.getUTCFullYear(),month:t.getUTCMonth()+1,day:t.getUTCDate(),hour:t.getUTCHours(),minute:t.getUTCMinutes(),second:t.getUTCSeconds(),millisecond:t.getUTCMilliseconds(),offset:e[2]}}},{name:"full24",regex:o.compile("(?:^|[\\sT])(_H24_):(_MIN_):(_SEC_)(?:\\.(_MS_))?(Z)?$"),handler:AA(["","hour","minute","second","millisecond","zone"])},{name:"zone24",regex:o.compile("(_H24_):(_MIN_):(_SEC_)(?:\\.(_MS_))?[\\s\\[(]*(_ZONE_)?[\\s\\])]*$"),handler:AA(["","hour","minute","second","millisecond","zone"])},{name:"hms12WithOffset",regex:o.compile("(_H12_):(_MIN_):(_SEC_)\\s*(_MERIDIEM_)\\s*(_OFFSET_)"),handler:AA(["","hour","minute","second","meridiem","offset"])},{name:"hms12",regex:o.compile("(_H12_):(_MIN_):(_SEC_)\\s*(_MERIDIEM_)"),handler:AA(["","hour","minute","second","meridiem"])},{name:"hms24",regex:o.compile("(_H24_):(_MIN_):(_SEC_)(?:\\.(_MS_))?"),handler:AA(["","hour","minute","second","millisecond"])},{name:"hm12",regex:o.compile("(_H12_):(_MIN_)\\s*(_MERIDIEM_)"),handler:AA(["","hour","minute","meridiem"])},{name:"hm24",regex:o.compile("(_H24_):(_MIN_)"),handler:AA(["","hour","minute"])},{name:"h12",regex:o.compile("(_H12_)\\s*(_MERIDIEM_)"),handler:AA(["","hour","meridiem"])},{name:"8digit",regex:/^((?:19|20)\d{2})(\d{2})(\d{2})$/,handler:AA(["","year","month","day"])},{name:"yearMonthnameDay",regex:o.compile("(_YEAR4_)[\\s.-]+(_MONTHNAME_)[\\s,.-]+(_DAY_)(_ORDINAL_)?"),handler:AA(["","year","monthname","day"])},{name:"dayMonthnameYear",regex:o.compile("(_DAY_)(_ORDINAL_)?[\\s.-]*(_MONTHNAME_)[\\s,.-]+(_YEAR_)"),handler:AA(["","day","","monthname","year"])},{name:"monthnameDayYear",regex:o.compile("(_MONTHNAME_)[\\s.-]*(_DAY_)(_ORDINAL_)?[\\s,.-]+(_YEAR_)"),handler:AA(["","monthname","day","","year"])},{name:"dayMonthname",regex:o.compile("\\b(_DAY_)(_ORDINAL_)?[\\s.-]*(_MONTHNAME_)\\b"),handler:AA(["","day","","monthname"])},{name:"monthnameDay",regex:o.compile("\\b(_MONTHNAME_)[\\s.-]*(_DAY_)(_ORDINAL_)?\\b"),handler:AA(["","monthname","day"])},{name:"hmsNoMeridiem",regex:o.compile("\\b(_H12_|_H24_):(_MIN_):(_SEC_)\\b"),handler:AA(["","hour","minute","second"])},{name:"hmNoMeridiem",regex:o.compile("\\b(_H12_|_H24_):(_MIN_)\\b"),handler:AA(["","hour","minute"])},{name:"ymd",regex:o.compile("(_YEAR4_)([.-])(_MONTH_)\\2+(_DAY_)"),handler:AA(["","year","","month","day"])},{name:"mdy",regex:o.compile("(_MONTH_)([/-])(_DAY_)\\2(_YEAR_)"),handler:AA(["","month","","day","year"])},{name:"dmy",regex:o.compile("(_DAY_)(?:_ORDINAL_)?[./\\s-]+(_MONTH_)[./\\s-]+(_YEAR_)"),handler:AA(["","day","month","year"])},{name:"yearLoose",regex:o.compile("_YEAR4_"),handler:AA(["year"])},{name:"dayMonthnameLoose",regex:o.compile("(_DAY_)[\\s.]*(_MONTHNAME_)"),handler:AA(["","day","monthname"])},{name:"monthnameDayLoose",regex:o.compile("(_MONTHNAME_)[\\s.]*(_DAY_)"),handler:AA(["","monthname","day"])},{name:"monthname",regex:o.compile("_MONTHNAME_"),handler:AA(["monthname"])},{name:"year4",regex:o.compile("_YEAR4_"),handler:AA(["year"])},{name:"md",regex:o.compile("(_MONTH_)[/-](_DAY_)"),handler:AA(["","month","day"])},{name:"dm",regex:o.compile("(_DAY_)(?:_ORDINAL_)?[./\\s-]+(_MONTH_)"),handler:AA(["","day","month"])},{name:"day",regex:o.compile("_DAY_"),handler:AA(["day"])},{name:"year2",regex:o.compile("_YEAR2_"),handler:AA(["year"])},{name:"onlyZone",regex:o.compile("_ZONE_"),handler:AA(["zone"])},{name:"onlyOffset",regex:o.compile("_OFFSET_"),handler:AA(["offset"])}],r=o.baseName.slice(0,5),A_.includes(r)?a:a.filter(e=>!["mdy","md"].includes(e.name))),formatter:(n=o,function(e){let t={};for(let[a,r]of Object.entries(e))if("monthname"===a){if(r){let e=n.monthNameToInt(r);void 0!==e&&(t.month=e)}}else if("hour"===a&&e.meridiem){let a=n.h12ToInt(r,e.meridiem);void 0!==a&&(t.hour=a)}else if("zone"===a){if(r){let e=n.zoneToOffset(r);void 0!==e&&(t.offset=e)}}else if("offset"===a){let e=n.offsetToMinutes(r);void 0!==e&&(t.offset=e)}else if("millisecond"===a){let e=n.millisecondToInt(r);"number"==typeof e&&(t.millisecond=e)}else if(Ak.includes(a)){let e=n.toInt(r);"number"==typeof e&&(t[a]=e)}return t.year<100&&(t.year=Al[t.year]),t.year&&"buddhist"===n.dateOptions.calendar&&(t.year-=543),t})})}return Ax[e]}(t),a=function(e,t){let n=AS[t.slice(0,2).toLowerCase()];if(!n)return e;for(let[t,a]of n)e=e.replace(t,a);return e}(e,t);return n.attempt(a)}function AM(e){e.month&&e.day&&void 0===e.year&&(e.year=new Date().getFullYear()),60===e.second&&(e.second=59);let t=new As(e.year,e.month-1,e.day,e.hour||0,e.minute||0,e.second||0,e.millisecond||0);return"number"==typeof e.offset?new As(t.valueOf()-60*e.offset*1e3):t}function Az(e,t=Ai){let n=AD(e,t),a=n.invalid?new As(NaN):AM(n);return a.isValid()||(a.invalid=`Unable to parse date "${e}"`),a}function AO(e,t=Ai){return e instanceof Date?new As(e.valueOf()):"number"==typeof e?new As(e):Az(e,t)}Date.fromString=As.fromString=Az,Date.fromAny=As.fromAny=AO,"u">typeof window&&(window.anyDateParser={fromString:Az,fromAny:AO,fromObject:AM,attempt:AD});var AP=n(5238),AT=n(1445);function AB(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}d_.extend(d$),d_.extend(AT),d_.extend(AP);let AI="YYYY-MM-DDTHH:mm:ss.SSSZZ";function AN(e){return null!=e&&28===e.trim().length&&"T"===(e=e.trim())[10]&&":"===e[13]&&":"===e[16]&&"."===e[19]&&("+"===e[23]||"-"===e[23])&&d_(e,AI).isValid()}function Aj(e){return d_(e).isToday()}function AR(e){return AN(e)?d_(e,AI).toDate():null}function AF(e,t=!1){let n=d_(e);return t&&(n=n.utc()),n.format(AI)}function AL(e){return d_(e).toDate()}var AW=new WeakMap;let AG=new class{register(e,t){AB(this,AW).set(e,t)}getCalendar(e){if(!e)return;if(e.calendar)return e.calendar;if(e.region){let t=`${e.language}-${e.region}`;if(AB(this,AW).has(t))return AB(this,AW).get(t)}if(e.language&&AB(this,AW).has(e.language))return AB(this,AW).get(e.language);let t=new Intl.DateTimeFormat(e.toString()).resolvedOptions().calendar;return AB(this,AW).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,AW,{writable:!0,value:new Map})}};function AV(e,t){AG.register(e,t)}function AU(e){let t=e??Ao();return AG.getCalendar(t instanceof Intl.Locale?t:new Intl.Locale(t))}let Aq={mode:"standard",time:"for today",day:!0,month:!0,year:!0,noToday:!1};function AH(e,t={}){let n=AD(e,Ao());if(n.invalid)return console.warn(`Could not parse invalid date '${e}'`),null;!(0,ee.isNil)(n.day)&&(0,ee.isNil)(n.month)&&(n=Object.assign({},(0,ee.omit)(n,"day"),{month:n.day})),n.month&&(n.month-=1),n.day&&(n=Object.assign({},(0,ee.omit)(n,"day"),{date:n.day}));let a=d_().set(n).toDate();return(0,ee.isNil)(n.year)&&(t.year=!1),(0,ee.isNil)(n.month)&&(t.month=!1),(0,ee.isNil)(n.date)&&(t.day=!1),AK(a,t)}function AK(e,t){let n,a=t?.locale??Ao(),r=new Intl.Locale(a),{calendar:o,mode:i,time:s,day:l,month:c,year:u,noToday:p,numberingSystem:d}={...Aq,...{noToday:"am"===r.language},...t},f={calendar:o??AU(r),year:u?"numeric":void 0,month:c?"short":void 0,day:l?"2-digit":void 0,numberingSystem:d},h=d_(e).isToday();if(h&&!p)n=(n=new Intl.RelativeTimeFormat(a,{numeric:"auto"}).format(0,"day"))[0].toLocaleUpperCase(a)+n.slice(1);else{"en"===r.language&&(a="en-GB");let t=new Intl.DateTimeFormat(a,f).formatToParts(e);("en"===r.language||"am"===r.language)&&"standard"==i&&u&&l&&(t=t.map(AY("-"))),"wide"==i&&(t=t.map(AY(" — "))),"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||h&&"for today"===s)&&(n+=`, ${AJ(e)}`),n}let AY=e=>(t,n,a)=>"literal"!==t.type||" "!==t.value||n<a.length-1&&"era"===a[n+1].type?t:{type:"literal",value:e};function AJ(e){return e.toLocaleTimeString(Ao(),{hour:"2-digit",minute:"2-digit"})}function AZ(e,t){return AK(e,{...t,time:!0})}function AX(e,t){let n=AU("string"==typeof t?new Intl.Locale(t):t);return n?bo(e,_$(n)):e}function AQ(e,t){return new Intl.DurationFormat(Ao(),t).format(e)}function A0(e,t){if(null==e)return null;if("string"==typeof e){let n=AD(e,Ao());return n.invalid?(console.warn(`Could not interpret '${e}' as a date`),null):(n.day&&!n.month&&(n={...(0,ee.omit)(n,"day"),...{month:n.day}}),n.month&&(n.month-=1),n.day&&(n={...(0,ee.omit)(n,"day"),...{date:n.day}}),d_(t).set(n))}return d_(e)}let A1=["years","months","days","hours","minutes","seconds"],A2={second:"seconds",minute:"minutes",hour:"hours",day:"days",month:"months",year:"years"},A3={seconds:45,minutes:45,hours:22,days:26,months:11,years:1/0};function A4(e,t=d_(),n){let a,r=d_(t),o=A0(e,r);if(null==o)return null;if("string"==typeof n){let e=A2[n]??n;return{[e]:r.diff(o,e)}}let{thresholds:i,largestUnit:s,smallestUnit:l}=n??{};if(void 0!==s||void 0!==l){let e,t=l?A2[l]??l:void 0;return e="auto"===s||void 0===s?function(e,t,n){let a=A1.indexOf(n);for(let r=0;r<A1.length;r++){let o=A1[r];if(t.diff(e,o)>0)return r<=a?o:n}return n}(o,r,t??"seconds"):A2[s]??s,function(e,t,n,a){let r=A1.indexOf(n),o=A1.indexOf(a),i=A1.slice(r,o+1),s={},l=e;for(let e of i){let n=t.diff(l,e);s[e]=n,l=l.add(n,e)}return s}(o,r,e,t??e)}let c=(a=function(e){let t={...A3};if(e)for(let[n,a]of Object.entries(e))void 0!==a&&(t[A2[n]??n]=a);return t}(i),r.diff(o,"seconds")<a.seconds?"seconds":r.diff(o,"minutes")<a.minutes?"minutes":r.diff(o,"hours")<a.hours?"hours":r.diff(o,"days")<a.days?"days":r.diff(o,"months")<a.months?"months":"years");return{[c]:r.diff(o,c)}}let A5={style:"short",localeMatcher:"lookup"};function A6(e,t=d_(),n){let a=A4(e,t,n);return null==a?null:AQ(a,"object"==typeof n&&n.formatOptions?{...A5,...n.formatOptions}:A5)}let A8=(0,uq.createContext)(null);function A7(){let e=pR({externalModuleName:"@openmrs/esm-styleguide"}).preferredDateLocale,t=(0,uq.useMemo)(()=>{let t=Ao();return e[t]&&(t=e[t]),t},[window.i18next.language]),n=(0,uq.useMemo)(()=>{let e=AU(t);return void 0!==e?_$(e):void 0},[t]),a=(0,uq.useMemo)(()=>new Intl.Locale(t,{calendar:n?.identifier}),[t,n]),r=(0,uq.useMemo)(()=>n?bo(bf(by()),n):bf(by()),[n]);return{calendar:n,intlLocale:a,today_:r}}let A9=new y1(1793,1,1);var we={};function wt(){return"u">typeof window&&window.InputEvent&&"function"==typeof InputEvent.prototype.getTargetRanges}function wn(e={}){let{locale:t}=yo();return(0,uq.useMemo)(()=>new(0,vG.K)(t,e),[t,e])}we={"ar-AE":{decrease:e=>`\u{62E}\u{641}\u{636} ${e.fieldLabel}`,increase:e=>`\u{632}\u{64A}\u{627}\u{62F}\u{629} ${e.fieldLabel}`,numberField:"حقل رقمي"},"bg-BG":{decrease:e=>`\u{41D}\u{430}\u{43C}\u{430}\u{43B}\u{44F}\u{432}\u{430}\u{43D}\u{435} ${e.fieldLabel}`,increase:e=>`\u{423}\u{441}\u{438}\u{43B}\u{432}\u{430}\u{43D}\u{435} ${e.fieldLabel}`,numberField:"Номер на полето"},"cs-CZ":{decrease:e=>`Sn\xed\u{17E}it ${e.fieldLabel}`,increase:e=>`Zv\xfd\u{161}it ${e.fieldLabel}`,numberField:"Č\xedseln\xe9 pole"},"da-DK":{decrease:e=>`Reducer ${e.fieldLabel}`,increase:e=>`\xd8g ${e.fieldLabel}`,numberField:"Talfelt"},"de-DE":{decrease:e=>`${e.fieldLabel} verringern`,increase:e=>`${e.fieldLabel} erh\xf6hen`,numberField:"Nummernfeld"},"el-GR":{decrease:e=>`\u{39C}\u{3B5}\u{3AF}\u{3C9}\u{3C3}\u{3B7} ${e.fieldLabel}`,increase:e=>`\u{391}\u{3CD}\u{3BE}\u{3B7}\u{3C3}\u{3B7} ${e.fieldLabel}`,numberField:"Πεδίο αριθμού"},"en-US":{decrease:e=>`Decrease ${e.fieldLabel}`,increase:e=>`Increase ${e.fieldLabel}`,numberField:"Number field"},"es-ES":{decrease:e=>`Reducir ${e.fieldLabel}`,increase:e=>`Aumentar ${e.fieldLabel}`,numberField:"Campo de n\xfamero"},"et-EE":{decrease:e=>`V\xe4henda ${e.fieldLabel}`,increase:e=>`Suurenda ${e.fieldLabel}`,numberField:"Numbri v\xe4li"},"fi-FI":{decrease:e=>`V\xe4henn\xe4 ${e.fieldLabel}`,increase:e=>`Lis\xe4\xe4 ${e.fieldLabel}`,numberField:"Numerokentt\xe4"},"fr-FR":{decrease:e=>`Diminuer ${e.fieldLabel}`,increase:e=>`Augmenter ${e.fieldLabel}`,numberField:"Champ de nombre"},"he-IL":{decrease:e=>`\u{5D4}\u{5E7}\u{5D8}\u{5DF} ${e.fieldLabel}`,increase:e=>`\u{5D4}\u{5D2}\u{5D3}\u{5DC} ${e.fieldLabel}`,numberField:"שדה מספר"},"hr-HR":{decrease:e=>`Smanji ${e.fieldLabel}`,increase:e=>`Pove\u{107}aj ${e.fieldLabel}`,numberField:"Polje broja"},"hu-HU":{decrease:e=>`${e.fieldLabel} cs\xf6kkent\xe9se`,increase:e=>`${e.fieldLabel} n\xf6vel\xe9se`,numberField:"Sz\xe1mmező"},"it-IT":{decrease:e=>`Riduci ${e.fieldLabel}`,increase:e=>`Aumenta ${e.fieldLabel}`,numberField:"Campo numero"},"ja-JP":{decrease:e=>`${e.fieldLabel}\u{3092}\u{7E2E}\u{5C0F}`,increase:e=>`${e.fieldLabel}\u{3092}\u{62E1}\u{5927}`,numberField:"数値フィールド"},"ko-KR":{decrease:e=>`${e.fieldLabel} \u{AC10}\u{C18C}`,increase:e=>`${e.fieldLabel} \u{C99D}\u{AC00}`,numberField:"번호 필드"},"lt-LT":{decrease:e=>`Suma\u{17E}inti ${e.fieldLabel}`,increase:e=>`Padidinti ${e.fieldLabel}`,numberField:"Numerio laukas"},"lv-LV":{decrease:e=>`Samazin\u{101}\u{161}ana ${e.fieldLabel}`,increase:e=>`Palielin\u{101}\u{161}ana ${e.fieldLabel}`,numberField:"Skaitļu lauks"},"nb-NO":{decrease:e=>`Reduser ${e.fieldLabel}`,increase:e=>`\xd8k ${e.fieldLabel}`,numberField:"Tallfelt"},"nl-NL":{decrease:e=>`${e.fieldLabel} verlagen`,increase:e=>`${e.fieldLabel} verhogen`,numberField:"Getalveld"},"pl-PL":{decrease:e=>`Zmniejsz ${e.fieldLabel}`,increase:e=>`Zwi\u{119}ksz ${e.fieldLabel}`,numberField:"Pole numeru"},"pt-BR":{decrease:e=>`Diminuir ${e.fieldLabel}`,increase:e=>`Aumentar ${e.fieldLabel}`,numberField:"Campo de n\xfamero"},"pt-PT":{decrease:e=>`Diminuir ${e.fieldLabel}`,increase:e=>`Aumentar ${e.fieldLabel}`,numberField:"Campo num\xe9rico"},"ro-RO":{decrease:e=>`Sc\u{103}dere ${e.fieldLabel}`,increase:e=>`Cre\u{219}tere ${e.fieldLabel}`,numberField:"C\xe2mp numeric"},"ru-RU":{decrease:e=>`\u{423}\u{43C}\u{435}\u{43D}\u{44C}\u{448}\u{435}\u{43D}\u{438}\u{435} ${e.fieldLabel}`,increase:e=>`\u{423}\u{432}\u{435}\u{43B}\u{438}\u{447}\u{435}\u{43D}\u{438}\u{435} ${e.fieldLabel}`,numberField:"Числовое поле"},"sk-SK":{decrease:e=>`Zn\xed\u{17E}i\u{165} ${e.fieldLabel}`,increase:e=>`Zv\xfd\u{161}i\u{165} ${e.fieldLabel}`,numberField:"Č\xedseln\xe9 pole"},"sl-SI":{decrease:e=>`Upadati ${e.fieldLabel}`,increase:e=>`Pove\u{10D}ajte ${e.fieldLabel}`,numberField:"Številčno polje"},"sr-SP":{decrease:e=>`Smanji ${e.fieldLabel}`,increase:e=>`Pove\u{107}aj ${e.fieldLabel}`,numberField:"Polje broja"},"sv-SE":{decrease:e=>`Minska ${e.fieldLabel}`,increase:e=>`\xd6ka ${e.fieldLabel}`,numberField:"Nummerf\xe4lt"},"tr-TR":{decrease:e=>`${e.fieldLabel} azalt`,increase:e=>`${e.fieldLabel} artt\u{131}r`,numberField:"Sayı alanı"},"uk-UA":{decrease:e=>`\u{417}\u{43C}\u{435}\u{43D}\u{448}\u{438}\u{442}\u{438} ${e.fieldLabel}`,increase:e=>`\u{417}\u{431}\u{456}\u{43B}\u{44C}\u{448}\u{438}\u{442}\u{438} ${e.fieldLabel}`,numberField:"Поле номера"},"zh-CN":{decrease:e=>`\u{964D}\u{4F4E} ${e.fieldLabel}`,increase:e=>`\u{63D0}\u{9AD8} ${e.fieldLabel}`,numberField:"数字字段"},"zh-TW":{decrease:e=>`\u{7E2E}\u{5C0F} ${e.fieldLabel}`,increase:e=>`\u{653E}\u{5927} ${e.fieldLabel}`,numberField:"數字欄位"}};var wa={};wa={"ar-AE":{Empty:"فارغ"},"bg-BG":{Empty:"Изпразни"},"cs-CZ":{Empty:"Pr\xe1zdn\xe9"},"da-DK":{Empty:"Tom"},"de-DE":{Empty:"Leer"},"el-GR":{Empty:"Άδειο"},"en-US":{Empty:"Empty"},"es-ES":{Empty:"Vac\xedo"},"et-EE":{Empty:"T\xfchjenda"},"fi-FI":{Empty:"Tyhj\xe4"},"fr-FR":{Empty:"Vide"},"he-IL":{Empty:"ריק"},"hr-HR":{Empty:"Prazno"},"hu-HU":{Empty:"\xdcres"},"it-IT":{Empty:"Vuoto"},"ja-JP":{Empty:"空"},"ko-KR":{Empty:"비어 있음"},"lt-LT":{Empty:"Tuščias"},"lv-LV":{Empty:"Tukšs"},"nb-NO":{Empty:"Tom"},"nl-NL":{Empty:"Leeg"},"pl-PL":{Empty:"Pusty"},"pt-BR":{Empty:"Vazio"},"pt-PT":{Empty:"Vazio"},"ro-RO":{Empty:"Gol"},"ru-RU":{Empty:"Не заполнено"},"sk-SK":{Empty:"Pr\xe1zdne"},"sl-SI":{Empty:"Prazen"},"sr-SP":{Empty:"Prazno"},"sv-SE":{Empty:"Tomt"},"tr-TR":{Empty:"Boş"},"uk-UA":{Empty:"Пусто"},"zh-CN":{Empty:"空"},"zh-TW":{Empty:"空白"}};let wr=()=>{};function wo(e){var t;let n=(0,uq.useRef)(void 0),{value:a,textValue:r,minValue:o,maxValue:i,isDisabled:s,isReadOnly:l,isRequired:c,onIncrement:u,onIncrementPage:p,onDecrement:d,onDecrementPage:f,onDecrementToMin:h,onIncrementToMax:m}=e,g=yE((t=wa)&&t.__esModule?t.default:t,"@react-aria/spinbutton"),y=(0,uq.useRef)(!1),b=(0,uq.useCallback)(()=>{clearTimeout(n.current),y.current=!1},[]),v=gC(()=>{b()});(0,uq.useEffect)(()=>()=>v(),[]);let $=(0,uq.useRef)(!1),A=()=>{$.current=!0},w=()=>{$.current=!1},k=""===r?g.format("Empty"):(r||`${a}`).replace("-","−");(0,uq.useEffect)(()=>{$.current&&(yi&&yi.clear("assertive"),ys(k,"assertive"))},[k]);let x=(0,uq.useCallback)(()=>{b()},[b]),C=gC(u??wr),E=gC(d??wr),S=gC(()=>{(void 0===i||isNaN(i)||void 0===a||isNaN(a)||a<i)&&(C(),D(60))}),D=gC(e=>{v(),y.current=!0,n.current=window.setTimeout(S,e)}),M=gC(()=>{(void 0===o||isNaN(o)||void 0===a||isNaN(a)||a>o)&&(E(),z(60))}),z=gC(e=>{v(),y.current=!0,n.current=window.setTimeout(M,e)}),O=e=>{e.preventDefault()},{addGlobalListener:P,removeAllGlobalListeners:T}=gE(),B=(0,uq.useRef)(!1),[I,N]=(0,uq.useState)(null);(0,uq.useEffect)(()=>{"touch"===I?D(600):I&&D(400)},[I]);let[j,R]=(0,uq.useState)(null);return(0,uq.useEffect)(()=>{"touch"===j?z(600):j&&z(400)},[j]),{spinButtonProps:{role:"spinbutton","aria-valuenow":void 0===a||isNaN(a)?void 0:a,"aria-valuetext":k,"aria-valuemin":o,"aria-valuemax":i,"aria-disabled":s||void 0,"aria-readonly":l||void 0,"aria-required":c||void 0,onKeyDown:e=>{if(!e.ctrlKey&&!e.metaKey&&!e.shiftKey&&!e.altKey&&!l&&!e.nativeEvent.isComposing)switch(e.key){case"PageUp":if(p){e.preventDefault(),p?.();break}case"ArrowUp":case"Up":u&&(e.preventDefault(),u?.());break;case"PageDown":if(f){e.preventDefault(),f?.();break}case"ArrowDown":case"Down":d&&(e.preventDefault(),d?.());break;case"Home":h&&(e.preventDefault(),h?.());break;case"End":m&&(e.preventDefault(),m?.())}},onFocus:A,onBlur:w},incrementButtonProps:{onPressStart:e=>{b(),"touch"!==e.pointerType?(u?.(),N("mouse")):(P(window,"pointercancel",x,{capture:!0}),B.current=!1,N("touch")),P(window,"contextmenu",O)},onPressUp:e=>{b(),"touch"===e.pointerType&&(B.current=!0),T(),N(null)},onPressEnd:e=>{b(),"touch"===e.pointerType&&!y.current&&B.current&&u?.(),B.current=!1,N(null)},onFocus:A,onBlur:w},decrementButtonProps:{onPressStart:e=>{b(),"touch"!==e.pointerType?(d?.(),R("mouse")):(P(window,"pointercancel",x,{capture:!0}),B.current=!1,R("touch"))},onPressUp:e=>{b(),"touch"===e.pointerType&&(B.current=!0),T(),R(null)},onPressEnd:e=>{b(),"touch"===e.pointerType&&!y.current&&B.current&&d?.(),B.current=!1,R(null)},onFocus:A,onBlur:w}}}let wi=null;var ws=n(6284);function wl(e,t,n){let a="+"===e?t+n:t-n;if(t%1!=0||n%1!=0){let r=t.toString().split("."),o=n.toString().split("."),i=Math.pow(10,Math.max(r[1]&&r[1].length||0,o[1]&&o[1].length||0));t=Math.round(t*i),n=Math.round(n*i),a=("+"===e?t+n:t-n)/i}return a}let wc=(0,uq.createContext)(null),wu=(0,uq.createContext)(null),wp=(0,uq.forwardRef)(function(e,t){var n,a;[e,t]=mc(e,t,wc);let{validationBehavior:r}=ml($e)||{},o=null!=(a=null!=(n=e.validationBehavior)?n:r)?a:"native",{locale:i}=yo(),s=function(e){let{minValue:t,maxValue:n,step:a,formatOptions:r,value:o,defaultValue:i=NaN,onChange:s,locale:l,isDisabled:c,isReadOnly:u,commitBehavior:p="snap"}=e;null===o&&(o=NaN);let d=(0,uq.useCallback)(e=>void 0===a||isNaN(a)?$s(e,t,n):$c(e,t,n,a),[a,t,n]);void 0===o||isNaN(o)||"snap"!==p||(o=d(o)),isNaN(i)||"snap"!==p||(i=d(i));let[f,h]=_M(o,isNaN(i)?NaN:i,s),[m]=(0,uq.useState)(f),[g,y]=(0,uq.useState)(()=>isNaN(f)?"":new(0,vG.K)(l,r).format(f)),b=(0,uq.useMemo)(()=>new(0,ws.d)(l,r),[l,r]),v=(0,uq.useMemo)(()=>b.getNumberingSystem(g),[b,g]),$=(0,uq.useMemo)(()=>new(0,vG.K)(l,{...r,numberingSystem:v}),[l,r,v]),A=(0,uq.useMemo)(()=>$.resolvedOptions(),[$]),w=(0,uq.useCallback)(e=>isNaN(e)||null===e?"":$.format(e),[$]),k=vx({...e,value:f}),x=void 0===a||isNaN(a)?1:a;"percent"===A.style&&(void 0===a||isNaN(a))&&(x=.01);let[C,E]=(0,uq.useState)(f),[S,D]=(0,uq.useState)(l),[M,z]=(0,uq.useState)(r);Object.is(f,C)&&l===S&&r===M||(y(w(f)),E(f),D(l),z(r));let O=(0,uq.useMemo)(()=>b.parse(g),[b,g]),P=(e,a=0)=>{if(isNaN(O))return $c(isNaN(a)?0:a,t,n,x);{let a=$c(O,t,n,x);return"+"===e&&a>O||"-"===e&&a<O?a:$c(wl(e,O,x),t,n,x)}},T=(0,uq.useMemo)(()=>!c&&!u&&(isNaN(O)||void 0===n||isNaN(n)||$c(O,t,n,x)>O||wl("+",O,x)<=n),[c,u,t,n,x,O]),B=(0,uq.useMemo)(()=>!c&&!u&&(isNaN(O)||void 0===t||isNaN(t)||$c(O,t,n,x)<O||wl("-",O,x)>=t),[c,u,t,n,x,O]);return{...k,validate:e=>b.isValidPartialNumber(e,t,n),increment:()=>{let e=P("+",t);e===f&&y(w(e)),h(e),k.commitValidation()},incrementToMax:()=>{null!=n&&(h($c(n,t,n,x)),k.commitValidation())},decrement:()=>{let e=P("-",n);e===f&&y(w(e)),h(e),k.commitValidation()},decrementToMin:()=>{null!=t&&(h(t),k.commitValidation())},canIncrement:T,canDecrement:B,minValue:t,maxValue:n,numberValue:O,defaultNumberValue:isNaN(i)?m:i,setNumberValue:h,setInputValue:y,inputValue:g,commit:e=>{let t=void 0===e?g:e,n=O;if(void 0!==e&&(n=b.parse(t)),!t.length){h(NaN),y(void 0===o?"":w(f));return}if(isNaN(n))return void y(w(f));let a="snap"===p?d(n):n,r=(a=b.parse(w(a)))!==f;h(a),y(w(void 0===o?a:f)),r&&k.commitValidation()}}}({...e,locale:i,validationBehavior:o}),l=(0,uq.useRef)(null),[c,u]=mu(!e["aria-label"]&&!e["aria-labelledby"]),{labelProps:p,groupProps:d,inputProps:f,incrementButtonProps:h,decrementButtonProps:m,descriptionProps:g,errorMessageProps:y,...b}=function(e,t,n){var a,r,o,i,s,l,c,u,p;let d,{id:f,decrementAriaLabel:h,incrementAriaLabel:m,isDisabled:g,isReadOnly:y,isRequired:b,minValue:v,maxValue:$,autoFocus:A,label:w,formatOptions:k,onBlur:x=()=>{},onFocus:C,onFocusChange:E,onKeyDown:S,onKeyUp:D,description:M,errorMessage:z,isWheelDisabled:O,...P}=e,{increment:T,incrementToMax:B,decrement:I,decrementToMin:N,numberValue:j,inputValue:R,commit:F,commitValidation:L}=t,W=yE((a=we)&&a.__esModule?a.default:a,"@react-aria/numberfield"),G=(0,uq.useCallback)(()=>{let e=n.current?.value??"";(0,gS.flushSync)(()=>{F()}),n.current?.value!==e&&ys(n.current?.value??"","assertive")},[F,n]),V=mt(f),{focusProps:U}=gd({onBlur(){G()}}),q=wn(k),H=(0,uq.useMemo)(()=>q.resolvedOptions(),[q]),K=wn({...k,currencySign:void 0}),Y=(0,uq.useMemo)(()=>isNaN(j)?"":K.format(j),[K,j]),{spinButtonProps:J,incrementButtonProps:Z,decrementButtonProps:X}=wo({isDisabled:g,isReadOnly:y,isRequired:b,maxValue:$,minValue:v,onIncrement:T,onIncrementToMax:B,onDecrement:I,onDecrementToMin:N,value:j,textValue:Y}),[Q,ee]=(0,uq.useState)(!1),{focusWithinProps:et}=gL({isDisabled:g,onFocusWithinChange:ee});!function(e,t){let{onScroll:n,isDisabled:a}=e,r=(0,uq.useCallback)(e=>{!e.ctrlKey&&(e.preventDefault(),e.stopPropagation(),n&&n({deltaX:e.deltaX,deltaY:e.deltaY}))},[n]);bB(t,"wheel",a?void 0:r)}({onScroll:(0,uq.useCallback)(e=>{!(Math.abs(e.deltaY)<=Math.abs(e.deltaX))&&(e.deltaY>0?T():e.deltaY<0&&I())},[I,T]),isDisabled:O||g||y||!Q},n);let en=(H.maximumFractionDigits??0)>0,ea=void 0===t.minValue||isNaN(t.minValue)||t.minValue<0,er="numeric";mq()?ea?er="text":en&&(er="decimal"):mZ()&&(ea?er="numeric":en&&(er="decimal"));let eo=mA(e),ei=(0,uq.useCallback)(e=>{e.nativeEvent.isComposing||("Enter"===e.key?((0,gS.flushSync)(()=>{F()}),L()):e.continuePropagation())},[F,L]),{isInvalid:es,validationErrors:el,validationDetails:ec}=t.displayValidation,{labelProps:eu,inputProps:ep,descriptionProps:ed,errorMessageProps:ef}=function(e,t,n){let a=gC(e=>{let a=n.current;if(!a)return;let r=null;switch(e.inputType){case"historyUndo":case"historyRedo":case"insertLineBreak":return;case"deleteContent":case"deleteByCut":case"deleteByDrag":r=a.value.slice(0,a.selectionStart)+a.value.slice(a.selectionEnd);break;case"deleteContentForward":r=a.selectionEnd===a.selectionStart?a.value.slice(0,a.selectionStart)+a.value.slice(a.selectionEnd+1):a.value.slice(0,a.selectionStart)+a.value.slice(a.selectionEnd);break;case"deleteContentBackward":r=a.selectionEnd===a.selectionStart?a.value.slice(0,a.selectionStart-1)+a.value.slice(a.selectionStart):a.value.slice(0,a.selectionStart)+a.value.slice(a.selectionEnd);break;case"deleteSoftLineBackward":case"deleteHardLineBackward":r=a.value.slice(a.selectionStart);break;default:null!=e.data&&(r=a.value.slice(0,a.selectionStart)+e.data+a.value.slice(a.selectionEnd))}null!=r&&t.validate(r)||e.preventDefault()});(0,uq.useEffect)(()=>{if(!wt()||!n.current)return;let e=n.current;return e.addEventListener("beforeinput",a,!1),()=>{e.removeEventListener("beforeinput",a,!1)}},[n]);let r=wt()?null:e=>{let n=mS(e).value.slice(0,mS(e).selectionStart)+e.data+mS(e).value.slice(mS(e).selectionEnd);t.validate(n)||e.preventDefault()},{labelProps:o,inputProps:i,descriptionProps:s,errorMessageProps:l,...c}=function(e,t){let{inputElementType:n="input",isDisabled:a=!1,isRequired:r=!1,isReadOnly:o=!1,type:i="text",validationBehavior:s="aria"}=e,[l,c]=_M(e.value,e.defaultValue||"",e.onChange),{focusableProps:u}=gg(e,t),p=vx({...e,value:l}),{isInvalid:d,validationErrors:f,validationDetails:h}=p.displayValidation,{labelProps:m,fieldProps:g,descriptionProps:y,errorMessageProps:b}=vd({...e,isInvalid:d,errorMessage:e.errorMessage||f}),v=mA(e,{labelable:!0}),$={type:i,pattern:e.pattern},[A]=(0,uq.useState)(l);return vf(t,e.defaultValue??A,c),vh(e,p,t),{labelProps:m,inputProps:mr(v,"input"===n?$:void 0,{disabled:a,readOnly:o,required:r&&"native"===s,"aria-required":r&&"aria"===s||void 0,"aria-invalid":d||void 0,"aria-errormessage":e["aria-errormessage"],"aria-activedescendant":e["aria-activedescendant"],"aria-autocomplete":e["aria-autocomplete"],"aria-haspopup":e["aria-haspopup"],"aria-controls":e["aria-controls"],value:l,onChange:e=>c(mS(e).value),autoComplete:e.autoComplete,autoCapitalize:e.autoCapitalize,maxLength:e.maxLength,minLength:e.minLength,name:e.name,form:e.form,placeholder:e.placeholder,inputMode:e.inputMode,autoCorrect:e.autoCorrect,spellCheck:e.spellCheck,[parseInt(uH().version,10)>=17?"enterKeyHint":"enterkeyhint"]:e.enterKeyHint,onCopy:e.onCopy,onCut:e.onCut,onPaste:e.onPaste,onCompositionEnd:e.onCompositionEnd,onCompositionStart:e.onCompositionStart,onCompositionUpdate:e.onCompositionUpdate,onSelect:e.onSelect,onBeforeInput:e.onBeforeInput,onInput:e.onInput,...u,...g}),descriptionProps:y,errorMessageProps:b,isInvalid:d,validationErrors:f,validationDetails:h}}(e,n),u=(0,uq.useRef)(null);return{inputProps:mr(i,{onBeforeInput:r,onCompositionStart(){let{value:e,selectionStart:t,selectionEnd:a}=n.current;u.current={value:e,selectionStart:t,selectionEnd:a}},onCompositionEnd(){if(n.current&&!t.validate(n.current.value)){let{value:e,selectionStart:a,selectionEnd:r}=u.current;n.current.value=e,n.current.setSelectionRange(a,r),t.setInputValue(e)}}}),labelProps:o,descriptionProps:s,errorMessageProps:l,...c}}({...P,...eo,name:void 0,form:void 0,label:w,autoFocus:A,isDisabled:g,isReadOnly:y,isRequired:b,validate:void 0,[vk]:t,value:R,defaultValue:"!",autoComplete:"off","aria-label":e["aria-label"]||void 0,"aria-labelledby":e["aria-labelledby"]||void 0,id:V,type:"text",inputMode:er,onChange:e=>{t.validate(e)&&t.setInputValue(e)},onBlur:x,onFocus:C,onFocusChange:E,onKeyDown:(0,uq.useMemo)(()=>hX(ei,S),[ei,S]),onKeyUp:D,onPaste:t=>{e.onPaste?.(t);let n=mS(t);n&&(n.selectionEnd??-1)-(n.selectionStart??0)===n.value.length&&(t.preventDefault(),F(t.clipboardData?.getData?.("text/plain")?.trim()??""))},description:M,errorMessage:z},t,n);vf(n,t.defaultNumberValue,t.setNumberValue),r=t,o=e.validationBehavior,i=e.commitBehavior,s=n,l=t.minValue,c=t.maxValue,u=e.step,p=t.numberValue,hQ(()=>{let e=s.current;if("validate"!==i||r.realtimeValidation.isInvalid||!e||e.disabled||(!wi&&"u">typeof document&&((wi=document.createElement("input")).type="number"),!wi))return;wi.min=null==l||isNaN(l)?"":String(l),wi.max=null==c||isNaN(c)?"":String(c),wi.step=null==u||isNaN(u)?"":String(u),wi.value=null==p||isNaN(p)?"":String(p);let t=e.validity.valid&&wi.validity.valid,n=e.validationMessage||wi.validationMessage,a={isInvalid:!t,validationErrors:n?[n]:[],validationDetails:{badInput:e.validity.badInput,customError:e.validity.customError,patternMismatch:e.validity.patternMismatch,rangeOverflow:wi.validity.rangeOverflow,rangeUnderflow:wi.validity.rangeUnderflow,stepMismatch:wi.validity.stepMismatch,tooLong:e.validity.tooLong,tooShort:e.validity.tooShort,typeMismatch:e.validity.typeMismatch,valueMissing:e.validity.valueMissing,valid:t}};r.updateValidation(a),"native"!==o||wi.validity.valid||e.setCustomValidity(wi.validationMessage)});let eh=mr(J,U,ep,{role:null,"aria-roledescription":mK()?null:W.format("numberField"),"aria-valuemax":null,"aria-valuemin":null,"aria-valuenow":null,"aria-valuetext":null,autoCorrect:"off",spellCheck:"false"});"native"===e.validationBehavior&&(eh["aria-required"]=void 0);let em=e=>{((e=document)=>e.activeElement)()!==n.current&&("mouse"===e.pointerType?n.current?.focus():e.target.focus())},eg=e["aria-label"]||("string"==typeof e.label?e.label:"");eg||(d=null!=e.label?eu.id:e["aria-labelledby"]);let ey=mt(),eb=mt(),e_=mr(Z,{"aria-label":m||W.format("increase",{fieldLabel:eg}).trim(),id:d&&!m?ey:null,"aria-labelledby":d&&!m?`${ey} ${d}`:null,"aria-controls":V,excludeFromTabOrder:!0,preventFocusOnPress:!0,allowFocusWhenDisabled:!0,isDisabled:!t.canIncrement,onPressStart:em}),ev=mr(X,{"aria-label":h||W.format("decrease",{fieldLabel:eg}).trim(),id:d&&!h?eb:null,"aria-labelledby":d&&!h?`${eb} ${d}`:null,"aria-controls":V,excludeFromTabOrder:!0,preventFocusOnPress:!0,allowFocusWhenDisabled:!0,isDisabled:!t.canDecrement,onPressStart:em});return{groupProps:{...et,role:"group","aria-disabled":g,"aria-invalid":es?"true":void 0},labelProps:eu,inputProps:eh,incrementButtonProps:e_,decrementButtonProps:ev,errorMessageProps:ef,descriptionProps:ed,isInvalid:es,validationErrors:el,validationDetails:ec}}({...mp(e),label:u,validationBehavior:o},s,l),v=ms({...e,values:{state:s,isDisabled:e.isDisabled||!1,isInvalid:b.isInvalid||!1,isRequired:e.isRequired||!1},defaultClassName:"react-aria-NumberField"}),$=mA(e);return delete $.id,uH().createElement(mi,{values:[[wu,s],[_K,d],[_J,{...f,ref:l}],[$t,{...p,ref:c}],[gZ,{slots:{increment:h,decrement:m}}],[g0,{slots:{description:g,errorMessage:y}}],[v8,b]]},uH().createElement("div",{...$,...v,ref:t,slot:e.slot||void 0,"data-disabled":e.isDisabled||void 0,"data-required":e.isRequired||void 0,"data-invalid":b.isInvalid||void 0}),e.name&&uH().createElement("input",{type:"hidden",name:e.name,value:isNaN(s.numberValue)?"":s.numberValue}))});function wd(e,t){return Number.parseInt(AK(e,{calendar:t.calendar,locale:t.baseName,day:!1,month:!1,noToday:!0,numberingSystem:"latn"}))}let wf=(0,uq.forwardRef)(function(e,t){let{className:n}=e,a=(0,uq.useContext)(_j),r=(0,uq.useContext)(_R),o=a??r,i=(0,uq.useContext)(A8),s=by(),l=AK(o.visibleRange.start.toDate(s),{calendar:i.calendar,locale:i.baseName,day:!1,year:!1,noToday:!0}),c=wd(o.visibleRange.start.toDate(s),i),u=o.maxValue?wd(o.maxValue.toDate(s),i):void 0,p=o.minValue?wd(o.minValue.toDate(s),i):void 0,d=(0,uq.useCallback)(e=>{o.setFocusedDate(o.focusedDate.cycle("year",e-o.focusedDate.year))},[]);return o&&(0,dj.jsxs)("span",{ref:t,className:n,children:[(0,dj.jsx)("span",{children:l}),(0,dj.jsxs)(wp,{formatOptions:{useGrouping:!1},maxValue:u,minValue:p,onChange:d,value:c,children:[(0,dj.jsx)(_Z,{}),(0,dj.jsxs)(_Y,{children:[(0,dj.jsx)(gX,{slot:"increment",children:(0,dj.jsx)(fw,{size:8})}),(0,dj.jsx)(gX,{slot:"decrement",children:(0,dj.jsx)(fv,{size:8})})]})]})]})});var wh=n(4782),wm={};wm.styleTagTransform=dX(),wm.setAttributes=dK(),wm.insert=dq().bind(null,"head"),wm.domAPI=dV(),wm.insertStyleElement=dJ(),dW()(wh.A,wm);let wg=wh.A&&wh.A.locals?wh.A.locals:void 0;function wy({children:e}){let t=(0,uq.useContext)($7),n=(0,uq.useContext)($9),a=t??n,r=dl(()=>a?.close());return(0,dj.jsx)(v6,{className:wg.dialog,ref:r,children:e})}let wb=(0,uq.forwardRef)(function({variant:e,today_:t,minDate:n,maxDate:a},r){let o="range"===e;return(0,dj.jsx)($3,{ref:r,className:wg.popover,placement:"bottom start",offset:1,isNonModal:!0,children:(0,dj.jsx)(wy,{children:(0,dj.jsxs)(o?_L:_F,{...o?{minValue:n,maxValue:a,className:"cds--date-picker__calendar"}:{},children:[(0,dj.jsxs)("header",{className:wg.header,children:[(0,dj.jsx)(gX,{className:dF()(wg.flatButton,wg.flatButtonMd),slot:"previous",children:(0,dj.jsx)(fM,{size:16})}),(0,dj.jsx)(wf,{className:wg.monthYear}),(0,dj.jsx)(gX,{className:dF()(wg.flatButton,wg.flatButtonMd),slot:"next",children:(0,dj.jsx)(fz,{size:16})})]}),(0,dj.jsx)(_G,{className:wg.calendarGrid,children:e=>(0,dj.jsx)(_H,{className:dF()("cds--date-picker__day",{[wg.today]:0===t.compare(e)}),date:e},e.toString())})]})})})}),w_=(0,uq.forwardRef)(function(e,t){let n=(0,uq.useContext)($7),[a,r]=mc({slot:e.slot},t,vK),{locale:o}=yo(),i=vH({...a,locale:o,createCalendar:_$}),s=(0,uq.useRef)(null),{fieldProps:l,inputProps:c}=vb({...a,inputRef:s},i,r),u=(0,uq.useCallback)(()=>{i.isDisabled||n.toggle()},[]);return(0,dj.jsxs)(mi,{values:[[vY,i],[_J,{...c,ref:s}],[_K,{...l,ref:r,isInvalid:i.isInvalid}]],children:[(0,dj.jsx)(_Y,{...e,id:e.id,ref:t,slot:e.slot||void 0,className:e.className,isDisabled:i.isDisabled,isInvalid:i.isInvalid,onClick:u,children:i.segments.map((t,n)=>(0,uq.cloneElement)(e.children(t),{key:n}))}),(0,dj.jsx)(_Z,{})]})}),wv=(0,uq.forwardRef)(function(e,t){let n=(0,uq.useContext)($7),a=(0,uq.useContext)($9);return(n??a).isInvalid?(0,dj.jsx)(hI,{ref:t,size:16,...e}):(0,dj.jsx)(f_,{ref:t,size:16,...e})});class w${constructor(e,t){this.locale=e,this.dictionary=t}of(e){return this.dictionary.getStringForLocale(e,this.locale)}}let wA=new Map,ww=(0,uq.forwardRef)(function({segment:e,...t},n){let a=(0,uq.useContext)(vY),r=hY(n),{segmentProps:o}=function(e,t,n){let a,r,o,i,s=(0,uq.useRef)(""),{locale:l,direction:c}=yo(),u=function(){var e;let{locale:t}=yo(),n=yC((e=vc)&&e.__esModule?e.default:e,"@react-aria/datepicker");return(0,uq.useMemo)(()=>{try{return new Intl.DisplayNames(t,{type:"dateTimeField"})}catch{return new w$(t,n)}},[t,n])}(),{ariaLabel:p,ariaLabelledBy:d,ariaDescribedBy:f,focusManager:h}=vm.get(t),m=e.isPlaceholder?"":e.text,g=(0,uq.useMemo)(()=>t.dateFormatter.resolvedOptions(),[t.dateFormatter]),y=yy({month:"long",timeZone:g.timeZone}),b=yy({hour:"numeric",hour12:g.hour12,timeZone:g.timeZone});if("month"!==e.type||e.isPlaceholder)"hour"!==e.type||e.isPlaceholder||(m=b.format(t.dateValue));else{let e=y.format(t.dateValue);m=e!==m?`${m} \u{2013} ${e}`:e}let{spinButtonProps:v}=wo({value:e.value??void 0,textValue:m,minValue:e.minValue,maxValue:e.maxValue,isDisabled:t.isDisabled,isReadOnly:t.isReadOnly||!e.isEditable,isRequired:t.isRequired,onIncrement:()=>{s.current="",t.increment(e.type)},onDecrement:()=>{s.current="",t.decrement(e.type)},onIncrementPage:()=>{s.current="",t.incrementPage(e.type)},onDecrementPage:()=>{s.current="",t.decrementPage(e.type)},onIncrementToMax:()=>{s.current="",t.incrementToMax(e.type)},onDecrementToMin:()=>{s.current="",t.decrementToMin(e.type)}}),$=(0,uq.useMemo)(()=>new(0,ws.d)(l,{maximumFractionDigits:0}),[l]),A=()=>{if(e.text===e.placeholder&&h.focusPrevious(),!$.isValidPartialNumber(e.text)||t.isReadOnly||e.isPlaceholder)("dayPeriod"===e.type||"era"===e.type)&&t.clearSegment(e.type);else{let n=e.text.slice(0,-1),a=$.parse(n);0===(n=0===a?"":n).length||0===a?t.clearSegment(e.type):t.setSegment(e.type,a),s.current=n}},{startsWith:w}=(a=function(e){let{locale:t}=yo(),n=t+(e?Object.entries(e).sort((e,t)=>e[0]<t[0]?-1:1).join():"");if(wA.has(n))return wA.get(n);let a=new Intl.Collator(t,e);return wA.set(n,a),a}({usage:"search",sensitivity:"base"}),r=(0,uq.useCallback)((e,t)=>0===t.length||(e=e.normalize("NFC"),t=t.normalize("NFC"),0===a.compare(e.slice(0,t.length),t)),[a]),o=(0,uq.useCallback)((e,t)=>0===t.length||(e=e.normalize("NFC"),t=t.normalize("NFC"),0===a.compare(e.slice(-t.length),t)),[a]),i=(0,uq.useCallback)((e,t)=>{if(0===t.length)return!0;e=e.normalize("NFC");let n=0,r=(t=t.normalize("NFC")).length;for(;n+r<=e.length;n++){let o=e.slice(n,n+r);if(0===a.compare(t,o))return!0}return!1},[a]),(0,uq.useMemo)(()=>({startsWith:r,endsWith:o,contains:i}),[r,o,i])),k=yy({hour:"numeric",hour12:!0}),x=(0,uq.useMemo)(()=>{let e=new Date;return e.setHours(0),k.formatToParts(e).find(e=>"dayPeriod"===e.type).value},[k]),C=(0,uq.useMemo)(()=>{let e=new Date;return e.setHours(12),k.formatToParts(e).find(e=>"dayPeriod"===e.type).value},[k]),E=yy({year:"numeric",era:"narrow",timeZone:"UTC"}),S=(0,uq.useMemo)(()=>{if("era"!==e.type)return[];let n=bo(new y1(1,1,1),t.calendar),a=t.calendar.getEras().map(e=>{let t=n.set({year:1,month:1,day:1,era:e}).toDate("UTC");return{era:e,formatted:E.formatToParts(t).find(e=>"era"===e.type).value}}),r=function(e){e.sort();let t=e[0],n=e[e.length-1];for(let e=0;e<t.length;e++)if(t[e]!==n[e])return e;return 0}(a.map(e=>e.formatted));if(r)for(let e of a)e.formatted=e.formatted.slice(r);return a},[E,t.calendar,e.type]),D=n=>{if(t.isDisabled||t.isReadOnly)return;let a=s.current+n;switch(e.type){case"dayPeriod":if(w(x,n))t.setSegment("dayPeriod",0);else if(w(C,n))t.setSegment("dayPeriod",1);else break;h.focusNext();break;case"era":{let e=S.find(e=>w(e.formatted,n));e&&(t.setSegment("era",e.era),h.focusNext());break}case"day":case"hour":case"minute":case"second":case"month":case"year":{if(!$.isValidPartialNumber(a))return;let r=$.parse(a),o=r;if(void 0!==e.maxValue&&r>e.maxValue&&(o=$.parse(n)),isNaN(r))return;t.setSegment(e.type,o),void 0!==e.maxValue&&(Number(r+"0")>e.maxValue||a.length>=String(e.maxValue).length)?(s.current="",h.focusNext()):s.current=a}}};bB((0,uq.useRef)("u">typeof document?document:null),"selectionchange",()=>{let e=window.getSelection();e?.anchorNode&&mE(n.current,e?.anchorNode)&&e.collapse(n.current)});let M=(0,uq.useRef)("");bB(n,"beforeinput",a=>{if(n.current)switch(a.preventDefault(),a.inputType){case"deleteContentBackward":case"deleteContentForward":$.isValidPartialNumber(e.text)&&!t.isReadOnly&&A();break;case"insertCompositionText":M.current=n.current.textContent,n.current.textContent=n.current.textContent;break;default:null!=a.data&&D(a.data)}}),bB(n,"input",e=>{let{inputType:t,data:a}=e;"insertCompositionText"===t&&(n.current&&(n.current.textContent=M.current),null!=a&&(w(x,a)||w(C,a))&&D(a))}),hQ(()=>{let e=n.current;return()=>{((e=document)=>e.activeElement)()===e&&(h.focusPrevious()||h.focusNext())}},[n,h]);let z=mK()||"timeZoneName"===e.type?{role:"textbox","aria-valuemax":null,"aria-valuemin":null,"aria-valuetext":null,"aria-valuenow":null}:{};e===(0,uq.useMemo)(()=>t.segments.find(e=>e.isEditable),[t.segments])||t.isInvalid||(f=void 0);let O=mt(),P=!t.isDisabled&&!t.isReadOnly&&e.isEditable,T="literal"===e.type?"":u.of(e.type),B=bM({"aria-label":`${T}${p?`, ${p}`:""}${d?", ":""}`,"aria-labelledby":d});if("literal"===e.type)return{segmentProps:{"aria-hidden":!0}};let I={caretColor:"transparent"};if("rtl"===c){I.unicodeBidi="embed";let t=g[e.type];("numeric"===t||"2-digit"===t)&&(I.direction="ltr")}return{segmentProps:mr(v,B,{id:O,...z,"aria-invalid":t.isInvalid?"true":void 0,"aria-describedby":f,"aria-readonly":t.isReadOnly||!e.isEditable?"true":void 0,"data-placeholder":e.isPlaceholder||void 0,contentEditable:P,suppressContentEditableWarning:P,spellCheck:P?"false":void 0,autoCorrect:P?"off":void 0,[parseInt(uH().version,10)>=17?"enterKeyHint":"enterkeyhint"]:P?"next":void 0,inputMode:t.isDisabled||"dayPeriod"===e.type||"era"===e.type||!P?void 0:"numeric",tabIndex:t.isDisabled?void 0:0,onKeyDown:e=>{if("a"===e.key&&(mU()?e.metaKey:e.ctrlKey)&&e.preventDefault(),!e.ctrlKey&&!e.metaKey&&!e.shiftKey&&!e.altKey)switch(e.key){case"Backspace":case"Delete":e.preventDefault(),e.stopPropagation(),A()}},onFocus:()=>{s.current="",n.current&&bF(n.current,{containingElement:bN(n.current)});let e=window.getSelection();e?.collapse(n.current)},style:I,onPointerDown(e){e.stopPropagation()},onMouseDown(e){e.stopPropagation()}})}}(e,a,r),{focusProps:i,isFocused:s,isFocusVisible:l}=gW(),{hoverProps:c,isHovered:u}=gH({...t,isDisabled:a.isDisabled||"literal"===e.type}),p=function(e){let{className:t,style:n,children:a,defaultClassName:r,defaultChildren:o,defaultStyle:i,values:s}=e;return(0,uq.useMemo)(()=>{let e,l,c;return e="function"==typeof t?t({...s,defaultClassName:r}):t,l="function"==typeof n?n({...s,defaultStyle:i||{}}):n,c="function"==typeof a?a({...s,defaultChildren:o}):null==a?o:a,{className:e??r,style:l||i?{...i,...l}:void 0,children:c??o,"data-rac":""}},[t,n,a,r,o,i,s])}({...t,values:{...e,isReadOnly:!e.isEditable,isInvalid:a.isInvalid,isDisabled:a.isDisabled,isHovered:u,isFocused:s,isFocusVisible:l},defaultChildren:e.text}),d=(0,uq.useCallback)(e=>{e.stopPropagation()},[]);return(0,dj.jsx)("span",{...mr(mA(t),o,i,c),...p,ref:r,style:o.style,"data-placeholder":e.isPlaceholder||void 0,"data-invalid":a.isInvalid||void 0,"data-readonly":!e.isEditable||void 0,"data-disabled":a.isDisabled||void 0,"data-type":e.type,"data-hovered":u||void 0,"data-focused":s||void 0,"data-focus-visible":l||void 0,onClick:d})}),wk={short:!1,size:"md"},wx=(0,uq.forwardRef)(function(e,t){let{className:n,defaultValue:a,isDisabled:r,invalid:o,invalidText:i,isInvalid:s,label:l,labelText:c,light:u,maxDate:p,minDate:d,onChange:f,onChangeRaw:h,short:m,size:g,value:y,...b}={...wk,...e},{calendar:v,intlLocale:$,today_:A}=A7(),w=(0,uq.useId)(),k=!!(c??l),x=(0,uq.useMemo)(()=>Aa(a,v),[a,v]),C=(0,uq.useMemo)(()=>Aa(y,v,!0),[y,v]),E=(0,uq.useMemo)(()=>Aa(p,v),[p,v]),S=(0,uq.useMemo)(()=>Aa(d??A9,v),[d,v]),D=(0,uq.useMemo)(()=>o||s,[o,s]),M=(0,uq.useMemo)(()=>(h&&f&&console.error("An OpenmrsDatePicker component was created with both onChange and onChangeRaw handlers defined. Only onChangeRaw will be used."),h??(e=>f?.(Ar(e)))),[h,f]);return(0,dj.jsx)(An,{locale:$.toString(),children:(0,dj.jsx)("div",{className:dF()("cds--form-item",n),children:(0,dj.jsx)(mi,{values:[[A8,$]],children:(0,dj.jsxs)(Ae,{className:dF()("cds--date-picker","cds--date-picker--single",{"cds--date-picker--short":m,"cds--date-picker--light":u}),defaultValue:x,isDisabled:r,isInvalid:D,maxValue:E,minValue:S,value:C,shouldForceLeadingZeros:"en"===$.language||void 0,...b,onChange:M,children:[(0,dj.jsxs)("div",{className:"cds--date-picker-container",children:[k&&(0,dj.jsx)($n,{className:dF()("cds--label",{"cds--label--disabled":r}),htmlFor:w,children:c??l}),(0,dj.jsxs)(_Y,{className:wg.inputGroup,children:[(0,dj.jsx)(w_,{id:k?w:void 0,ref:t,className:dF()("cds--date-picker-input__wrapper",wg.inputWrapper,{[wg.inputWrapperSm]:"sm"===g,[wg.inputWrapperMd]:"md"===g||!g||0===g.length,[wg.inputWrapperLg]:"lg"===g}),children:e=>"era"!==e.type?(0,dj.jsx)(ww,{className:wg.inputSegment,segment:e}):(0,dj.jsx)(uH().Fragment,{})}),(0,dj.jsx)(gX,{className:dF()(wg.flatButton,{[wg.flatButtonSm]:"sm"===g,[wg.flatButtonMd]:"md"===g||!g||0===g.length,[wg.flatButtonLg]:"lg"===g}),children:(0,dj.jsx)(wv,{})})]}),(0,dj.jsx)(v7,{className:wg.invalidText,children:i})]}),(0,dj.jsx)(wb,{variant:"single",today_:A})]})})})})}),wC=(0,uq.forwardRef)(function({className:e,defaultValue:t,invalid:n,invalidText:a,isDisabled:r,isInvalid:o,label:i,labelText:s,light:l,maxDate:c,minDate:u,onChange:p,onChangeRaw:d,size:f="md",value:h,...m},g){let{calendar:y,intlLocale:b,today_:v}=A7(),$=(0,uq.useId)(),A=!!(s??i),w=(0,uq.useMemo)(()=>{if(h)return{start:Aa(h[0],y,!1),end:Aa(h[1],y,!1)}},[h,y]),k=(0,uq.useMemo)(()=>{if(t)return{start:Aa(t[0],y,!1),end:Aa(t[1],y,!1)}},[t,y]),x=(0,uq.useMemo)(()=>Aa(u??A9,y,!0),[u,y]),C=(0,uq.useMemo)(()=>Aa(c,y,!0),[c,y]),E=(0,uq.useMemo)(()=>n||o,[n,o]),S=(0,uq.useMemo)(()=>(d&&p&&console.error("An OpenmrsDateRangePicker component was created with both onChange and onChangeRaw handlers defined. Only onChangeRaw will be used."),d??(e=>p?.([Ar(e.start),Ar(e.end)]))),[d,p]);return(0,dj.jsx)(An,{locale:b.toString(),children:(0,dj.jsx)("div",{className:dF()("cds--form-item",e),children:(0,dj.jsx)(mi,{values:[[A8,b]],children:(0,dj.jsx)(At,{id:A?$:void 0,className:dF()("cds--date-picker",{"cds--date-picker--light":l,"cds--date-picker--disabled":r}),isInvalid:E,shouldForceLeadingZeros:"en"===b.language||void 0,maxValue:C,minValue:x,value:w,defaultValue:k,ref:g,isDisabled:r,...m,onChange:S,children:(0,dj.jsxs)("div",{className:"cds--date-picker-container",children:[A&&(0,dj.jsx)($n,{className:dF()("cds--label",{"cds--label--disabled":r}),htmlFor:$,children:s??i}),(0,dj.jsxs)(_Y,{className:wg.inputGroup,children:[(0,dj.jsxs)("div",{className:dF()(wg.inputsWrapper,{[wg.inputsWrapperSm]:"sm"===f,[wg.inputsWrapperMd]:"md"===f||!f||0===f.length,[wg.inputsWrapperLg]:"lg"===f}),children:[(0,dj.jsx)(vZ,{className:dF()("cds--date-picker-input__wrapper",wg.startInput,wg.dateInputWrapper),slot:"start",children:e=>(0,dj.jsx)(ww,{className:wg.inputSegment,segment:e})}),(0,dj.jsx)("div",{className:wg.separator,children:(0,dj.jsx)("span",{"aria-hidden":"true","data-readonly":!0,children:"–"})}),(0,dj.jsx)(vZ,{className:dF()("cds--date-picker-input__wrapper",wg.endInput,wg.dateInputWrapper),slot:"end",children:e=>(0,dj.jsx)(ww,{className:wg.inputSegment,segment:e})})]}),(0,dj.jsx)(gX,{className:dF()(wg.flatButton,{[wg.flatButtonSm]:"sm"===f,[wg.flatButtonMd]:"md"===f||!f||0===f.length,[wg.flatButtonLg]:"lg"===f}),children:(0,dj.jsx)(wv,{})})]}),(0,dj.jsx)(v7,{className:wg.invalidText,children:a}),(0,dj.jsx)(wb,{variant:"range",today_:v,minDate:x,maxDate:C})]})})})})})});var wE=n(9124),wS={};wS.styleTagTransform=dX(),wS.setAttributes=dK(),wS.insert=dq().bind(null,"head"),wS.domAPI=dV(),wS.insertStyleElement=dJ(),dW()(wE.A,wS);let wD=wE.A&&wE.A.locals?wE.A.locals:void 0,wM=({diagnoses:e})=>{let{diagnosisTags:t}=pR({externalModuleName:"@openmrs/esm-styleguide"});return(0,dj.jsx)("div",{className:wD.container,children:e.map(e=>{let{rank:n,uuid:a,display:r}=e,o=t[1===n?"primaryColor":"secondaryColor"];return(0,dj.jsx)(d6.Tag,{type:o,children:r},a)})})};var wz=n(7770),wO={};wO.styleTagTransform=dX(),wO.setAttributes=dK(),wO.insert=dq().bind(null,"head"),wO.domAPI=dV(),wO.insertStyleElement=dJ(),dW()(wz.A,wO);let wP=wz.A&&wz.A.locals?wz.A.locals:void 0,wT=({width:e="64",height:t="64"})=>(0,dj.jsx)("svg",{width:e,height:t,viewBox:"0 0 64 64",children:(0,dj.jsx)("use",{href:"#omrs-empty-data-illustration"})}),wB=e=>{let t="tablet"===dn(),n=e.launchForm;return(0,dj.jsx)(d6.Layer,{className:wP.layer,children:(0,dj.jsxs)(d6.Tile,{className:wP.tile,children:[(0,dj.jsx)("div",{className:t?wP.tabletHeading:wP.desktopHeading,children:(0,dj.jsx)("h4",{children:e.headerTitle})}),(0,dj.jsx)(wT,{}),(0,dj.jsx)("p",{className:wP.content,children:rp("emptyStateText","There are no {{displayText}} to display",{displayText:e.displayText})}),(0,dj.jsx)("p",{className:wP.action,children:n&&(0,dj.jsx)(d6.Button,{onClick:()=>n(),kind:"ghost",size:t?"lg":"sm",children:rp("recordNewEntry","Record {{ displayText }}",{displayText:e.displayText})})})]})})};var wI=n(6099),wN={};wN.styleTagTransform=dX(),wN.setAttributes=dK(),wN.insert=dq().bind(null,"head"),wN.domAPI=dV(),wN.insertStyleElement=dJ(),dW()(wI.A,wN);let wj=wI.A&&wI.A.locals?wI.A.locals:void 0,wR=({error:e,headerTitle:t})=>{let n="tablet"===dn();return(0,dj.jsx)(d6.Layer,{children:(0,dj.jsxs)(d6.Tile,{className:wj.tile,children:[(0,dj.jsx)("div",{className:n?wj.tabletHeading:wj.desktopHeading,children:(0,dj.jsx)("h4",{children:t})}),(0,dj.jsxs)("p",{className:wj.errorMessage,children:[rp("error","Error")," ",`${e?.response?.status}: `,e?.response?.statusText]}),(0,dj.jsx)("p",{className:wj.errorCopy,children:rp("errorCopy")})]})})},wF=wR;var wL=n(5764),wW={};wW.styleTagTransform=dX(),wW.setAttributes=dK(),wW.insert=dq().bind(null,"head"),wW.domAPI=dV(),wW.insertStyleElement=dJ(),dW()(wL.A,wW);let wG=wL.A&&wL.A.locals?wL.A.locals:void 0,wV=uH().forwardRef((e,t)=>{let{slotName:n,basePath:a,componentContext:r,state:o}=di(),i=window.location??{pathname:""},s=u3(n??"");return e.isChildOfHeader&&n&&s.length>0?(0,dj.jsxs)(d6.SideNav,{"aria-label":rp("leftNavigation","Left navigation"),className:wG.leftNav,expanded:!0,isFixedNav:!0,ref:t,...e,children:[(0,dj.jsx)(u6,{name:"global-nav-menu-slot"}),n?(0,dj.jsx)(pM,{value:r,fallback:(0,dj.jsx)(u6,{name:n,state:{basePath:a,currentPath:i,...o}}),children:(0,dj.jsx)(uK.Provider,{value:r,children:(0,dj.jsx)(u6,{name:n,state:{basePath:a,currentPath:i,...o}})})}):null]}):null});var wU=n(8500),wq={};wq.styleTagTransform=dX(),wq.setAttributes=dK(),wq.insert=dq().bind(null,"head"),wq.domAPI=dV(),wq.insertStyleElement=dJ(),dW()(wU.A,wq);let wH=wU.A&&wU.A.locals?wU.A.locals:void 0,wK=({selectedLocationUuid:e,defaultLocationUuid:t,locationTag:n,locationsPerRequest:a=50,onChange:r})=>{let[o,i]=(0,uq.useState)(""),s=(0,uq.useId)(),{location:l}=function(e){let t=e?`/ws/fhir2/R4/Location?_id=${e}`:null,{data:n,error:a,isLoading:r}=pV()(t,n4,{shouldRetryOnError:e=>!!e?.response?.status&&e.response.status>=500});return(0,uq.useMemo)(()=>({location:n?.data?.entry?n.data.entry[0]:null,error:t?a:null,isLoading:!!t&&r}),[n,r,a,t])}(t),{locations:c,isLoading:u,hasMore:p,loadingNewData:d,error:f,setPage:h}=function(e,t=0,n=""){let a=pW(n),{data:r,isLoading:o,isValidating:i,setSize:s,error:l}=p4()(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 o=`${n1}/Location?`,i=new URLSearchParams;return i.append("_summary","data"),t&&i.append("_count",""+t),n&&i.append("_getpagesoffset",""+n*t),e&&i.append("_tag",e),"string"==typeof a&&""!==a&&i.append("name:contains",a),o+i.toString()},n4);return(0,uq.useMemo)(()=>({locations:r?.length?r?.flatMap(e=>e?.data?.entry??[]):[],isLoading:o,totalResults:r?.[0]?.data?.total,hasMore:!!r?.length&&r?.[r.length-1]?.data?.link?.some(e=>"next"===e.relation),loadingNewData:i,error:l||null,setPage:s}),[o,r,i,s,l])}(n,a,o),m=(0,uq.useMemo)(()=>l&&!o&&t?[l,...c.filter(({resource:e})=>e.id!==t)]:c??[],[l,c,t,o]),g=(0,uq.useCallback)(e=>{r(),i(e.trim())},[r]),y=dc((0,uq.useCallback)(()=>{!d&&p&&h(e=>e+1)},[d,p,h])),b=p?Math.max(0,Math.floor(m.length-a/2)):-1;return(0,dj.jsxs)(dj.Fragment,{children:[(0,dj.jsx)(d6.Search,{"aria-describedby":f?`${s}-error`:void 0,labelText:rp("searchForLocation"),id:s,placeholder:rp("searchForLocation"),onChange:e=>g(e.target.value),size:"lg"}),f&&(0,dj.jsx)("div",{className:wH.errorNotification,id:`${s}-error`,children:(0,dj.jsx)(d6.InlineNotification,{kind:"error",subtitle:rp("errorLoadingLoginLocations","Unable to load login locations. Please try again or contact support if the problem persists."),title:rp("error","Error")})}),(0,dj.jsx)("div",{className:wH.searchResults,children:u?(0,dj.jsx)("div",{className:wH.loadingContainer,children:Array.from({length:5}).map((e,t)=>(0,dj.jsx)(d6.RadioButtonSkeleton,{className:wH.radioButtonSkeleton,role:"progressbar"},t))}):(0,dj.jsxs)(dj.Fragment,{children:[(0,dj.jsx)("div",{className:wH.locationResultsContainer,children:m.length>0?(0,dj.jsx)(d6.RadioButtonGroup,{name:"loginLocations",onChange:e=>{r(e?.toString())},orientation:"vertical",valueSelected:e,children:m.map((e,t)=>(0,dj.jsx)(d6.RadioButton,{className:wH.locationRadioButton,id:e.resource.id,labelText:(0,dj.jsx)("span",{ref:t===b?y:null,children:e.resource.name}),name:e.resource.name,value:e.resource.id},e.resource.id))}):(0,dj.jsx)("div",{className:wH.emptyState,children:(0,dj.jsx)("p",{className:wH.locationNotFound,children:rp("noResultsToDisplay")})})}),d&&(0,dj.jsx)("div",{className:wH.loadingIcon,children:(0,dj.jsx)(d6.InlineLoading,{description:rp("loading")})})]})})]})},wY=V("modalState",{modalContainer:null,modalStack:[]}),wJ=0;async function wZ(e,t,n={}){let a=uD(t),r=null;if(e){if(!a)throw Error(`No modal named '${t}' has been registered.`);let{load:o}=a,i=await o(),s=wJ++;r=t2({...i,name:`${t}-${s}`},{...n,domElement:e})}else T(`Failed to launch modal. Please notify your administrator. Modal name: ${t}`);return r}let wX=window.getComputedStyle(document.body).overflow;function wQ({modalStack:e,modalContainer:t}){t&&(e.length?(t.style.visibility||(addEventListener("keydown",w1),document.body.style.overflow="hidden",t.style.visibility="unset"),e.forEach((n,a)=>{switch(n.state){case"NEW":{let e=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:n.props?.size??"md"});n.container=e,wZ(e,n.modalName,n.props).then(a=>{n.parcel=a,n.state="MOUNTED",t.prepend(e),e.style.visibility="unset"});break}case"MOUNTED":n.container&&(n.container.style.visibility=a?"hidden":"unset");break;case"TO_BE_DELETED":n.onClose(),n.parcel?.unmount?.(),n.container?.remove(),setTimeout(()=>{wY.setState({modalContainer:t,modalStack:e.filter(e=>e!==n)})},0)}})):(t.style.removeProperty("visibility"),document.body.style.overflow=wX,removeEventListener("keydown",w1)))}function w0(e){let t=wY.getState(),n=t.modalStack.map(t=>t===e?{...t,state:"TO_BE_DELETED"}:t);wY.setState({...t,modalStack:n})}function w1(e){"Escape"===e.key&&function(){let[e]=wY.getState().modalStack;e&&w0(e)}()}function w2(e){wY.subscribe(wQ),wY.setState({...wY.getState(),modalContainer:e})}function w3(e,t={},n=()=>{}){let a=()=>{let e=wY.getState().modalStack.find(e=>e.onClose===n);e&&w0(e)};if(uD(e)){var r;let o,i;r={state:"NEW",onClose:n,modalName:e,props:{close:a,...t}},i=[r,...(o=wY.getState()).modalStack],wY.setState({...o,modalStack:i})}else T(`Failed to launch modal. Please notify your administrator. Modal name: "${e}"`);return a}let w4=({notification:e})=>{let{description:t,action:n,kind:a,critical:r,title:o,onAction:i}=e;return(0,dj.jsx)(d6.ActionableNotification,{actionButtonLabel:n,kind:a||"info",lowContrast:r,subtitle:t,title:o||"",inline:!0,onActionButtonClick:i})},w5=({subject:e})=>{let[t,n]=(0,uq.useState)([]);return(0,uq.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,dj.jsx)(dj.Fragment,{children:t.map(e=>(0,dj.jsx)(w4,{notification:e},e.id))})},w6=({notification:e})=>{let{actionButtonLabel:t,onActionButtonClick:n=()=>{},subtitle:a,kind:r,title:o,critical:i,progressActionLabel:s,id:l,...c}=e,[u,p]=(0,uq.useState)(t);return(0,dj.jsx)(d6.ActionableNotification,{kind:r||"info",actionButtonLabel:u,ariaLabel:rp("closesActionableNotification","Closes actionable notification"),onActionButtonClick:()=>{n(),s&&p(s)},statusIconDescription:rp("actionableNotification","Actionable notification"),subtitle:a,title:o,lowContrast:i,inline:!0,...c})},w8=({subject:e})=>{let[t,n]=(0,uq.useState)([]);return(0,uq.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,dj.jsx)(dj.Fragment,{children:t.map(e=>(0,dj.jsx)(w6,{notification:e},e.id))})};var w7=n(6401);let w9=new ch,ke=0,kt=new ch,kn=0;function ka(e){e&&(0,u8.createRoot)(e).render((0,dj.jsx)(w5,{subject:w9}))}function kr(e){var t;e&&("string"==typeof(t=e.description)?t.trim().length>0:"object"==typeof t&&(t instanceof Error||!(0,w7.A)(t)))?(e.description instanceof Error&&(e.description=e.description.toLocaleString()),setTimeout(()=>{w9.next({...e,id:ke++})},0)):console.error("showNotification must be called with an object having a 'description' property that is a non-empty string or object")}function ko(e){e&&(0,u8.createRoot)(e).render((0,dj.jsx)(w8,{subject:kt}))}function ki(e){var t;e&&("string"==typeof(t=e.actionButtonLabel)?t.trim().length>0:"object"==typeof t&&!(0,w7.A)(t))?setTimeout(()=>{kt.next({...e,id:kn++})},0):console.error("showActionableNotification must be called with an actionButtonLabel that is a non-empty string")}let ks=["NORMAL","HIGH","CRITICALLY_HIGH","OFF_SCALE_HIGH","LOW","CRITICALLY_LOW","OFF_SCALE_LOW"],kl=["critically_low","critically_high","high","low","normal","off_scale_low","off_scale_high"];var kc=n(4112),ku={};ku.styleTagTransform=dX(),ku.setAttributes=dK(),ku.insert=dq().bind(null,"head"),ku.domAPI=dV(),ku.insertStyleElement=dJ(),dW()(kc.A,ku);let kp=kc.A&&kc.A.locals?kc.A.locals:void 0,kd=({value:e,unit:t,label:n,interpretation:a,referenceRange:r,conceptUuid:o,variant:i="card",patientUuid:s})=>{let l=(0,uq.useId)(),{referenceRange:c,isLoading:u}=function(e,t){let n=null;e&&(n=t?`${n0}/conceptreferencerange/?patient=${t}&concept=${e}&v=full`:`${n0}/conceptreferencerange/?concept=${e}&v=full`);let{data:a,error:r,isLoading:o}=pV()(n,n4),i=a?.data?.results?.[0];return{referenceRange:i?{hiNormal:i.hiNormal??null,hiAbsolute:i.hiAbsolute??null,hiCritical:i.hiCritical??null,lowNormal:i.lowNormal??null,lowAbsolute:i.lowAbsolute??null,lowCritical:i.lowCritical??null}:void 0,error:r,isLoading:o}}(r||a?void 0:o,s),p=r??c,d=(0,uq.useMemo)(()=>{if(a)return a?"--"===a?"normal":ks.includes(a)?a.toLowerCase():kl.includes(a)?a:"normal":void 0;if(p&&!u){if(!p||null==e||""===e)return"normal";let t="string"==typeof e?Number.parseFloat(e):e;return Number.isNaN(t)?"normal":null!==p.hiAbsolute&&void 0!==p.hiAbsolute&&t>p.hiAbsolute?"off_scale_high":null!==p.hiCritical&&void 0!==p.hiCritical&&t>=p.hiCritical?"critically_high":null!==p.hiNormal&&void 0!==p.hiNormal&&t>p.hiNormal?"high":null!==p.lowAbsolute&&void 0!==p.lowAbsolute&&t<p.lowAbsolute?"off_scale_low":null!==p.lowCritical&&void 0!==p.lowCritical&&t<=p.lowCritical?"critically_low":null!==p.lowNormal&&void 0!==p.lowNormal&&t<p.lowNormal?"low":"normal"}return"normal"},[a,p,e,u])??"normal",f="critically_low"===d||"critically_high"===d||"off_scale_low"===d||"off_scale_high"===d,h="normal"!==d,m=n?`omrs-numeric-obs-label-${n.replaceAll(/\s+/g,"-").toLowerCase()}-${l}`:void 0,g=`omrs-numeric-obs-value-${l}`,y=`omrs-numeric-obs-unit-${l}`,b=null!=e&&""!==e,v=b?e:rp("notAvailable","Not available"),$=dF()({[kp["critically-low"]]:"critically_low"===d||"off_scale_low"===d,[kp["critically-high"]]:"critically_high"===d||"off_scale_high"===d,[kp.low]:"low"===d,[kp.high]:"high"===d,[kp["off-scale-low"]]:"off_scale_low"===d,[kp["off-scale-high"]]:"off_scale_high"===d}),A=dF()({[kp.container]:!0,[kp.card]:!0,[kp["critical-value"]]:f,[kp["abnormal-value"]]:h&&!f}),w=dF()({[kp.cell]:!0,[$]:!0});return"cell"===i?(0,dj.jsxs)("div",{className:w,children:[v,b&&t?` ${t}`:""]}):(0,dj.jsxs)("section",{className:A,"data-testid":"numeric-observation-card",children:[n&&(0,dj.jsxs)("div",{className:kp["label-container"],children:[(0,dj.jsx)("span",{id:m,className:kp.label,children:n}),h&&(0,dj.jsx)("span",{className:kp[d.replace("_","-")],title:rp("abnormalValue","Abnormal value")})]}),(0,dj.jsxs)("div",{className:kp["value-container"],children:[(0,dj.jsx)("span",{id:g,"aria-labelledby":m&&y?`${m} ${y}`:m||y||void 0,className:kp.value,children:v}),b&&t&&(0,dj.jsx)("span",{id:y,className:kp.units,children:t})]})]})};var kf=n(292),kh={};kh.styleTagTransform=dX(),kh.setAttributes=dK(),kh.insert=dq().bind(null,"head"),kh.domAPI=dV(),kh.insertStyleElement=dJ(),dW()(kf.A,kh);let km=kf.A&&kf.A.locals?kf.A.locals:void 0,kg=e=>{if("children"in e){let{children:t,className:n,...a}=e;return(0,dj.jsx)("div",{className:dF()(km.pageHeader,n),...a,children:t})}{let{title:t,illustration:n,className:a,...r}=e;return(0,dj.jsx)("div",{className:dF()(km.pageHeader,a),...r,children:(0,dj.jsx)(ky,{title:t,illustration:n})})}},ky=({title:e,illustration:t,className:n})=>{let[a,r]=(0,uq.useState)(null);return(0,uq.useEffect)(()=>{eK("@openmrs/esm-styleguide").then(e=>{r(e)})},[]),(0,dj.jsxs)("div",{className:dF()(km.pageHeaderContent,n),children:[t,(0,dj.jsxs)("div",{className:km.pageLabels,children:[a?.implementationName&&(0,dj.jsx)("p",{children:rp(a.implementationName)}),(0,dj.jsx)("p",{className:km.pageName,children:e})]})]})};var kb=n(2886),k_={};k_.styleTagTransform=dX(),k_.setAttributes=dK(),k_.insert=dq().bind(null,"head"),k_.domAPI=dV(),k_.insertStyleElement=dJ(),dW()(kb.A,k_);let kv=kb.A&&kb.A.locals?kb.A.locals:void 0,k$=({totalItems:e,pageSize:t,onPageNumberChange:n,pageNumber:a,dashboardLinkUrl:r,currentItems:o,dashboardLinkLabel:i})=>{let{pageSizes:s,pageItemsCount:l}=dd(t,e,a,o),c="tablet"===dn(),u=rp("paginationItemsCount","{{pageItemsCount}} / {{totalItems}} items",{totalItems:e,pageItemsCount:l});return(0,dj.jsx)(dj.Fragment,{children:e>0&&(0,dj.jsxs)("div",{className:dF()({[kv.tablet]:c,[kv.desktop]:!c}),children:[(0,dj.jsxs)("div",{children:[u,r&&(0,dj.jsx)(uY,{to:r,className:kv.configurableLink,children:i??rp("seeAll","See all")})]}),(0,dj.jsx)(d6.Pagination,{className:kv.pagination,page:a,pageSize:t,pageSizes:s,totalItems:e,onChange:n,pageRangeText:(e,t)=>rp("paginationOfPages","of {{count}} pages",{count:t}),size:c?"lg":"sm"})]})})};function kA(e){return kk(kC(e,"usual","official"))}function kw(e){return kA(e)}function kk(e){var t;let n;return e?e.text??(n=(t=e).given??[],(t.family?n.concat(t.family):n).join(" ")):""}function kx(e){return kk(e)}function kC(e,...t){for(let n of(0==t.length&&(t=["usual"]),t)){let t=e.name?.find(e=>{var t,a;return t=e,a=n,t.use?t.use===a:"usual"===a});if(t)return t}}function kE(e,t=d_()){let n=d_(t),a=A0(e,n);if(null==a)return null;let r=n.diff(a,"hours"),o=n.diff(a,"days"),i=n.diff(a,"weeks"),s=n.diff(a,"months"),l=n.diff(a,"years"),c={};if(r<2)c.minutes=n.diff(a,"minutes");else if(o<2)c.hours=r;else if(i<4)c.days=o;else if(l<1){let e=n.subtract(i,"weeks").diff(a,"days");c.weeks=i,c.days=e}else if(l<2){let e=n.subtract(s,"months").diff(a,"days");c.months=s,c.days=e}else if(l<18){let e=n.subtract(l,"year").diff(a,"months");c.years=l,c.months=e}else c.years=l;return c}function kS(e,t=d_()){let n=kE(e,t);if(null==n)return null;let a={style:"short",localeMatcher:"lookup"};return"minutes"in n&&0===n.minutes&&(a.minutesDisplay="always"),AQ(n,a)}var kD=n(6010),kM={};kM.styleTagTransform=dX(),kM.setAttributes=dK(),kM.insert=dq().bind(null,"head"),kM.domAPI=dV(),kM.insertStyleElement=dJ(),dW()(kD.A,kM);let kz=kD.A&&kD.A.locals?kD.A.locals:void 0;function kO({showIdentifierLabel:e,type:t,value:n}){return(0,dj.jsx)("span",{className:kz.primaryIdentifier,children:(0,dj.jsxs)(d6.Tag,{className:kz.tag,type:"gray",children:[e&&t?.text&&(0,dj.jsxs)("span",{className:kz.label,children:[t.text,": "]}),(0,dj.jsx)("span",{className:kz.value,children:n})]})})}function kP({showIdentifierLabel:e,type:t,value:n}){return(0,dj.jsxs)(d6.FormLabel,{className:kz.secondaryIdentifier,id:`patient-banner-identifier-${n}`,children:[e&&(0,dj.jsxs)("span",{className:kz.label,children:[t?.text,": "]}),(0,dj.jsx)("span",{className:kz.value,children:n})]})}function kT({identifiers:e,showIdentifierLabel:t}){let{excludePatientIdentifierCodeTypes:n}=pR(),{primaryIdentifierCode:a}=dm(),r=e?.filter(e=>{let t=e.type?.coding?.[0]?.code;return t&&!n?.uuids.includes(t)})??[];return(0,dj.jsx)(dj.Fragment,{children:r?.length?r.map(({value:e,type:n},o)=>(0,dj.jsxs)(uH().Fragment,{children:[(0,dj.jsx)("span",{className:kz.identifier,children:n?.coding?.[0]?.code===a?(0,dj.jsx)(kO,{showIdentifierLabel:t,type:n,value:e}):(0,dj.jsx)(kP,{showIdentifierLabel:t,type:n,value:e})}),o<r.length-1&&(0,dj.jsx)("span",{className:kz.separator,children:"\xb7"})]},e)):""})}let kB={Female:fG,Male:fV,Other:fU,Unknown:fq},kI=({gender:e})=>{let t=kB[e];return t?(0,dj.jsx)(t,{fill:"#525252"}):null},kN={male:"Male",female:"Female",other:"Other",unknown:"Unknown"};function kj({patient:e,renderedFrom:t}){var n;let a,r,o=kA(e),i=e?.gender&&(r=kN[a=(n=e.gender).toLowerCase()]??"Unknown",{displayText:rp(a,n),iconKey:r}),s=(0,uq.useMemo)(()=>({patientUuid:e.id,patient:e,renderedFrom:t}),[e.id,e,t]);return(0,dj.jsxs)("div",{className:kz.patientInfo,children:[(0,dj.jsx)("div",{className:dF()(kz.row,kz.patientNameRow),children:(0,dj.jsxs)("div",{className:kz.flexRow,children:[(0,dj.jsx)("span",{className:kz.patientName,children:o}),i&&(0,dj.jsxs)("div",{className:kz.gender,children:[(0,dj.jsx)(kI,{gender:i.iconKey}),(0,dj.jsx)("span",{children:i.displayText})]}),(0,dj.jsx)(u6,{className:kz.tagsSlot,name:"patient-banner-tags-slot",state:s})]})}),(0,dj.jsxs)("div",{className:kz.demographics,children:[e.birthDate&&(0,dj.jsxs)(dj.Fragment,{children:[(0,dj.jsx)("span",{children:kS(e.birthDate)}),(0,dj.jsx)("span",{className:kz.separator,children:"\xb7"}),(0,dj.jsx)("span",{children:AH(e.birthDate,{time:!1})}),(0,dj.jsx)("span",{className:kz.separator,children:"\xb7"})]}),(0,dj.jsx)(kT,{identifiers:e.identifier,showIdentifierLabel:!0}),(0,dj.jsx)(u6,{className:kz.extensionSlot,name:"patient-banner-bottom-slot",state:s})]})]})}var kR=n(1673),kF=n(9102),kL={};kL.styleTagTransform=dX(),kL.setAttributes=dK(),kL.insert=dq().bind(null,"head"),kL.domAPI=dV(),kL.insertStyleElement=dJ(),dW()(kF.A,kL);let kW=kF.A&&kF.A.locals?kF.A.locals:void 0;function kG({patient:e,patientUuid:t,actionsSlotName:n,additionalActionsSlotState:a}){let[r,o]=(0,uq.useState)(!1),{extensions:i}=u4(n),s="tablet"===dn(),l=dl(()=>o(!1),r),c=(0,uq.useRef)(null),u=(0,uq.useRef)(null),p=(0,uq.useId)(),d=`patient-actions-menu-trigger-${p}`,f=`patient-actions-menu-${p}`,h=(0,uq.useCallback)(()=>o(e=>!e),[]),m=(0,uq.useCallback)(()=>{o(!1),c.current?.focus()},[]),g=(0,uq.useCallback)(e=>{if("Escape"===e.key&&r){e.stopPropagation(),m();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,a=Array.from(t).indexOf(n);if(-1===a)return void t["ArrowDown"===e.key?0:t.length-1]?.focus();let r=a+("ArrowDown"===e.key?1:-1),o=r<0?t.length-1:r>=t.length?0:r;t[o]?.focus()}},[m,r]);(0,uq.useEffect)(()=>{if(r&&u.current){let e=u.current.querySelector('[role="menuitem"]:not([disabled])');e?.focus()}},[r]);let y=(0,uq.useMemo)(()=>({patientUuid:t,patient:e,closeMenu:m,...a}),[t,e,m,a]);return 0===i.length?null:(0,dj.jsx)("div",{className:kW.overflowMenuContainer,children:(0,dj.jsxs)("div",{"data-overflow-menu":!0,className:dF()("cds--overflow-menu",ft.container),ref:l,children:[(0,dj.jsxs)("button",{className:dF()("cds--btn","cds--btn--ghost","cds--overflow-menu__trigger",{"cds--overflow-menu--open":r},ft.overflowMenuButton),"aria-controls":f,"aria-expanded":r,"aria-haspopup":"true",id:d,onClick:h,onKeyDown:g,ref:c,children:[(0,dj.jsx)("span",{className:kW.actionsButtonText,children:rp("actions","Actions")})," ",(0,dj.jsx)(kR.CH,{size:16,style:{marginLeft:"0.5rem",fill:"#78A9FF"}})]}),(0,dj.jsxs)("div",{className:dF()("cds--overflow-menu-options","cds--overflow-menu--flip",ft.menu,{[ft.show]:r}),"aria-labelledby":d,"data-floating-menu-direction":"bottom",id:f,onKeyDown:g,ref:u,role:"menu",tabIndex:-1,children:[(0,dj.jsx)("ul",{className:dF()("cds--overflow-menu-options__content",{"cds--overflow-menu-options--lg":s}),children:(0,dj.jsx)(u6,{name:n,state:y},n)}),(0,dj.jsx)("span",{})]})]})})}var kV=n(6767),kU=n.n(kV);function kq(e){let{patientPhotoConceptUuid:t}=pR({externalModuleName:"@openmrs/esm-styleguide"}),n=t?`${n0}/obs?patient=${e}&concept=${t}&v=full`:null,{data:a,error:r,isLoading:o}=(0,pd.Ay)(e?n:null,n4),i=a?.data?.results[0];return{data:i?{dateTime:i?.obsDatetime,imageSrc:i?.value?.links?.uri}:null,error:r,isLoading:o}}let kH=({width:e=56,height:t=56,"aria-label":n})=>{let{t:a}=(0,pp.useTranslation)();return(0,dj.jsxs)("svg",{"aria-label":n??a("patientPhotoPlaceholder","Patient photo placeholder"),width:e,height:t,fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[(0,dj.jsx)("path",{fill:"#ffffff",d:"M0 0h56v56H0z"}),(0,dj.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"})]})};var kK=n(7268),kY={};kY.styleTagTransform=dX(),kY.setAttributes=dK(),kY.insert=dq().bind(null,"head"),kY.domAPI=dV(),kY.insertStyleElement=dJ(),dW()(kK.A,kY);let kJ=kK.A&&kK.A.locals?kK.A.locals:void 0;function kZ({patientUuid:e,patientName:t,alt:n}){let{data:a,isLoading:r}=kq(e),[o,i]=(0,uq.useState)(null),[s,l]=(0,uq.useState)(!1),c=(0,uq.useMemo)(()=>kU().generate(e),[e]);(0,uq.useEffect)(()=>{if(a?.imageSrc){let e=new URL(a.imageSrc,window.location.origin).pathname;l(!0);let t=!1,n=new Image;return n.onload=()=>{t||(i(e),l(!1))},n.onerror=()=>{t||(i(null),l(!1))},n.src=e,()=>{t=!0}}i(null),l(!1)},[a?.imageSrc]);let u=(0,uq.useMemo)(()=>n||(o?rp("patientPhotoAlt","Profile photo of {{patientName}}",{patientName:t}):rp("patientAvatarAlt","Avatar for {{patientName}}",{patientName:t})),[n,o,t]);return r||s?(0,dj.jsx)(d6.SkeletonIcon,{className:kJ.skeleton,"data-testid":"skeleton-icon"}):a?.imageSrc&&!o?(0,dj.jsx)(kH,{"aria-label":rp("patientPhotoPlaceholder","Photo placeholder for {{patientName}}",{patientName:t})}):o?(0,dj.jsx)("div",{"aria-label":u,children:(0,dj.jsx)("img",{className:kJ.avatar,src:o,alt:u,title:t})}):(0,dj.jsx)("div",{"aria-label":u,children:(0,dj.jsx)("div",{className:kJ.avatar,title:t,style:{backgroundImage:c.toDataUrl(),backgroundRepeat:"no-repeat",backgroundSize:"cover"},children:(0,dj.jsx)("span",{className:kJ.initials,children:function(e,t=3){return e.split(/\s+/).filter(Boolean).slice(0,t).map(e=>e[0]).join("")}(t)})})})}var kX=n(1636),kQ={};kQ.styleTagTransform=dX(),kQ.setAttributes=dK(),kQ.insert=dq().bind(null,"head"),kQ.domAPI=dV(),kQ.insertStyleElement=dJ(),dW()(kX.A,kQ);let k0=kX.A&&kX.A.locals?kX.A.locals:void 0,k1=["omrs-pict-appointments","omrs-pict-assessment-1","omrs-pict-assessment-2","omrs-pict-blood-bank","omrs-pict-cardiology","omrs-pict-ct-scan","omrs-pict-dentistry","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-obstetrics","omrs-pict-patient-search","omrs-pict-patients","omrs-pict-payments-desk","omrs-pict-pharmacy","omrs-pict-pharmacy-2","omrs-pict-registration","omrs-pict-service-queues","omrs-pict-stock-management","omrs-pict-transfer","omrs-pict-triage","omrs-pict-x-ray"],k2=(0,uq.memo)((0,uq.forwardRef)(function(e,t){return(0,dj.jsx)(xA,{ref:t,pictogram:"omrs-pict-appointments",pictogramProps:e})})),k3=k2,k4=(0,uq.memo)((0,uq.forwardRef)(function(e,t){return(0,dj.jsx)(xA,{ref:t,pictogram:"omrs-pict-assessment-1",pictogramProps:e})})),k5=(0,uq.memo)((0,uq.forwardRef)(function(e,t){return(0,dj.jsx)(xA,{ref:t,pictogram:"omrs-pict-assessment-2",pictogramProps:e})})),k6=(0,uq.memo)((0,uq.forwardRef)(function(e,t){return(0,dj.jsx)(xA,{ref:t,pictogram:"omrs-pict-blood-bank",pictogramProps:e})})),k8=(0,uq.memo)((0,uq.forwardRef)(function(e,t){return(0,dj.jsx)(xA,{ref:t,pictogram:"omrs-pict-cardiology",pictogramProps:e})})),k7=(0,uq.memo)((0,uq.forwardRef)(function(e,t){return(0,dj.jsx)(xA,{ref:t,pictogram:"omrs-pict-ct-scan",pictogramProps:e})})),k9=(0,uq.memo)((0,uq.forwardRef)(function(e,t){return(0,dj.jsx)(xA,{ref:t,pictogram:"omrs-pict-dentistry",pictogramProps:e})})),xe=(0,uq.memo)((0,uq.forwardRef)(function(e,t){return(0,dj.jsx)(xA,{ref:t,pictogram:"omrs-pict-emergency-department",pictogramProps:e})})),xt=(0,uq.memo)((0,uq.forwardRef)(function(e,t){return(0,dj.jsx)(xA,{ref:t,pictogram:"omrs-pict-facility",pictogramProps:e})})),xn=(0,uq.memo)((0,uq.forwardRef)(function(e,t){return(0,dj.jsx)(xA,{ref:t,pictogram:"omrs-pict-geriatrics",pictogramProps:e})})),xa=(0,uq.memo)((0,uq.forwardRef)(function(e,t){return(0,dj.jsx)(xA,{ref:t,pictogram:"omrs-pict-gynaecology",pictogramProps:e})})),xr=(0,uq.memo)((0,uq.forwardRef)(function(e,t){return(0,dj.jsx)(xA,{ref:t,pictogram:"omrs-pict-in-patient",pictogramProps:e})})),xo=(0,uq.memo)((0,uq.forwardRef)(function(e,t){return(0,dj.jsx)(xA,{ref:t,pictogram:"omrs-pict-laboratory",pictogramProps:e})})),xi=(0,uq.memo)((0,uq.forwardRef)(function(e,t){return(0,dj.jsx)(xA,{ref:t,pictogram:"omrs-pict-labs-2",pictogramProps:e})})),xs=(0,uq.memo)((0,uq.forwardRef)(function(e,t){return(0,dj.jsx)(xA,{ref:t,pictogram:"omrs-pict-obstetrics",pictogramProps:e})})),xl=(0,uq.memo)((0,uq.forwardRef)(function(e,t){return(0,dj.jsx)(xA,{ref:t,pictogram:"omrs-pict-patient-search",pictogramProps:e})})),xc=(0,uq.memo)((0,uq.forwardRef)(function(e,t){return(0,dj.jsx)(xA,{ref:t,pictogram:"omrs-pict-patients",pictogramProps:e})})),xu=(0,uq.memo)((0,uq.forwardRef)(function(e,t){return(0,dj.jsx)(xA,{ref:t,pictogram:"omrs-pict-payments-desk",pictogramProps:e})})),xp=(0,uq.memo)((0,uq.forwardRef)(function(e,t){return(0,dj.jsx)(xA,{ref:t,pictogram:"omrs-pict-pharmacy",pictogramProps:e})})),xd=(0,uq.memo)((0,uq.forwardRef)(function(e,t){return(0,dj.jsx)(xA,{ref:t,pictogram:"omrs-pict-pharmacy-2",pictogramProps:e})})),xf=(0,uq.memo)((0,uq.forwardRef)(function(e,t){return(0,dj.jsx)(xA,{ref:t,pictogram:"omrs-pict-registration",pictogramProps:e})})),xh=(0,uq.memo)((0,uq.forwardRef)(function(e,t){return(0,dj.jsx)(xA,{ref:t,pictogram:"omrs-pict-service-queues",pictogramProps:e})})),xm=(0,uq.memo)((0,uq.forwardRef)(function(e,t){return(0,dj.jsx)(xA,{ref:t,pictogram:"omrs-pict-stock-management",pictogramProps:e})})),xg=(0,uq.memo)((0,uq.forwardRef)(function(e,t){return(0,dj.jsx)(xA,{ref:t,pictogram:"omrs-pict-transfer",pictogramProps:e})})),xy=(0,uq.memo)((0,uq.forwardRef)(function(e,t){return(0,dj.jsx)(xA,{ref:t,pictogram:"omrs-pict-triage",pictogramProps:e})})),xb=(0,uq.memo)((0,uq.forwardRef)(function(e,t){return(0,dj.jsx)(xA,{ref:t,pictogram:"omrs-pict-x-ray",pictogramProps:e})})),x_=xt,xv=xc,x$=(0,uq.memo)((0,uq.forwardRef)(function({pictogram:e,fallback:t,...n},a){let r=(0,uq.useRef)(document.getElementById(e));return(0,uq.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,dj.jsx)(pM,{value:r.current,fallback:t,children:(0,dj.jsx)(xA,{ref:a,pictogram:e,pictogramProps:n})})})),xA=(0,uq.memo)((0,uq.forwardRef)(function({pictogram:e,pictogramProps:t},n){let{className:a,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,dj.jsx)("svg",{ref:n,className:dF()(k0.pictogram,a),height:r,width:r,children:(0,dj.jsx)("use",{href:`#${e}`})})})),xw=({children:e})=>"tablet"===dn()?(0,dj.jsx)(d6.Layer,{children:e}):(0,dj.jsx)(dj.Fragment,{children:e});var xk=n(5925),xx={};xx.styleTagTransform=dX(),xx.setAttributes=dK(),xx.insert=dq().bind(null,"head"),xx.domAPI=dV(),xx.insertStyleElement=dJ(),dW()(xk.A,xx);let xC=xk.A&&xk.A.locals?xk.A.locals:void 0,xE=({snackbar:e,closeSnackbar:t})=>{let{actionButtonLabel:n="",kind:a="success",onActionButtonClick:r=()=>{},isLowContrast:o="error"!==a,progressActionLabel:i,subtitle:s="",timeoutInMs:l=5e3,autoClose:c="error"!==a,title:u,id:p,...d}=e,[f,h]=(0,uq.useState)(n),[m,g]=(0,uq.useState)(!0),[y,b]=(0,uq.useState)(!1),v=(0,uq.useCallback)(()=>{setTimeout(t,250)},[t]),$=(0,uq.useCallback)(()=>{b(!0),v()},[v]);return(0,uq.useEffect)(()=>{if(c){let e=setTimeout($,l);return()=>clearTimeout(e)}},[l,c,$]),(0,uq.useEffect)(()=>{g(!1),window.setTimeout(()=>{g(!0)},0)},[]),(0,dj.jsx)(d6.ActionableNotification,{actionButtonLabel:f,"aria-label":rp("closeSnackbar","Close snackbar"),className:dF()(xC.slideIn,{[xC.animated]:m,[xC.slideOut]:y}),kind:a,lowContrast:o,onActionButtonClick:()=>{r(),$(),i&&h(i)},onClose:v,statusIconDescription:rp("snackbarNotification","Snackbar notification"),subtitle:s,title:u,...d})},xS=({subject:e})=>{let[t,n]=(0,uq.useState)([]),a=(0,uq.useCallback)(e=>{n(t=>t.filter(t=>t!==e))},[]);return(0,uq.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,dj.jsx)(dj.Fragment,{children:t.map(e=>(0,dj.jsx)(xE,{snackbar:e,closeSnackbar:()=>a(e)},e.id))})},xD=new ch,xM=0;function xz(e){e&&(0,u8.createRoot)(e).render((0,dj.jsx)(xS,{subject:xD}))}function xO(e){var t;e&&"string"==typeof(t=e.title)&&t.trim().length>0?setTimeout(()=>{xD.next({...e,id:xM++})},0):console.error("showSnackbar must be called with an object having a 'title' property that is a non-empty string")}let xP=({toast:e,closeToast:t})=>{let{description:n,kind:a,critical:r,title:o,actionButtonLabel:i,onActionButtonClick:s=()=>{}}=e,l=(0,uq.useCallback)(()=>{s(),t()},[t,s]);return(0,dj.jsx)("div",{children:(0,dj.jsx)(d6.ActionableNotification,{actionButtonLabel:i,kind:a||"info",lowContrast:r,subtitle:n,title:o||"",onActionButtonClick:l,onClose:t})})},xT=({subject:e})=>{let[t,n]=(0,uq.useState)([]),a=(0,uq.useCallback)(e=>{n(t=>t.filter(t=>t!==e))},[]);return(0,uq.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,dj.jsx)(dj.Fragment,{children:t.map(e=>(0,dj.jsx)(xP,{toast:e,closeToast:()=>a(e)},e.id))})},xB=new ch,xI=0;function xN(e){e&&(0,u8.createRoot)(e).render((0,dj.jsx)(xT,{subject:xB}))}function xj(e){var t;e&&("string"==typeof(t=e.description)?t.trim().length>0:"object"==typeof t&&!(0,w7.A)(t))?setTimeout(()=>{xB.next({...e,id:xI++})},0):console.error("showToast must be called with an object having a 'description' property that is a non-empty string or object")}function xR(e,t=!1){if(t)return!0;let n=xV[e];return!n||!n()}function xF(e,t){let n=xX.getState()?.workspaceGroup,a=n?.name;a&&e===a&&x2(()=>{let a=x8(e);a&&(a.setState({},!0),a.subscribe(()=>{})()),"function"==typeof n?.cleanup&&n.cleanup(),xX.setState(e=>({...e,workspaceGroup:void 0})),"function"==typeof t&&t()},a?e=>e.currentWorkspaceGroup===a:()=>!0)}function xL(e,t){let{name:n,additionalProps:a}=t;uB(n);let r=()=>{xY(e.name,{ignoreChanges:!0,onWorkspaceClose:()=>xW(n,a),closeWorkspaceGroup:!1})};xR(e.name)?r():x4("closing-workspace-launching-new-workspace",r,e.title??e.name)}function xW(e,t){let n=uB(e),a=xX.getState().workspaceGroup;if(a&&!a.members?.includes(e))return void xF(a.name,()=>{xW(e,t)});let r=xX.getState().workspaceGroup?.name,o={...n,title:x5(n,t),closeWorkspace:(t={})=>xY(e,t),closeWorkspaceWithSavedChanges:t=>xY(e,{ignoreChanges:!0,...t}),promptBeforeClosing:t=>{var n,a;return n=e,a=t,void(xV[n]=a)},setTitle:(t,n)=>{o.title=t,o.titleNode=n,xX.setState(t=>{let n=t.openWorkspaces.map(t=>t.name===e?o:t);return{...t,openWorkspaces:n}})},currentWorkspaceGroup:r,additionalProps:t??{}};function i(e,t){xX.setState(n=>{let a=[e,...t??n.openWorkspaces],r=x1(e);return{...n,openWorkspaces:a,workspaceWindowState:r}})}r&&x8(r,t);let s=xX.getState().openWorkspaces,l=s.findIndex(t=>t.name===e),c=s.find(e=>e.type==o.type);if(0===s.length)i(o);else if(s[0].canHide||0===l)if(l>=0){let t=s[l];i({...t,additionalProps:o.additionalProps,...t.title===x5(t,t.additionalProps)&&{title:x5(o,o.additionalProps)}},s.filter(t=>t.name!=e))}else c?(i(c,xX.getState().openWorkspaces.filter(e=>e.type!=o.type)),xL(c,{name:e,additionalProps:t})):i(o);else xL(s[0],{name:e,additionalProps:t})}function xG({targetUrl:e,contextKey:t,workspaceName:n,additionalProps:a}){xJ(t),xW(n,a),nV({to:e})}let xV={};function xU(e,t){xV[e]=t}function xq(e){return xV[e]}function xH(){let e=xX.getState();xX.setState({...e,prompt:null})}let xK={ignoreChanges:!1,onWorkspaceClose:()=>{},closeWorkspaceGroup:!0};function xY(e,t={}){t={...xK,...t};let n=()=>{let n=xX.getState();n.openWorkspaces.find(t=>t.name===e);let a=n.openWorkspaces.filter(t=>t.name!=e),r=xX.getState().workspaceGroup?.name;r&&t.closeWorkspaceGroup&&xF(r),xV[e]=()=>!1,xX.setState(e=>({...e,prompt:null,openWorkspaces:a,workspaceWindowState:x1(a?.[0])})),t?.onWorkspaceClose?.()};return xR(e,t?.ignoreChanges)?(n(),!0):(x4("closing-workspace",n,uB(e).title??e),!1)}function xJ(e){xX.getState().context!=e&&xX.setState({context:e,openWorkspaces:[],prompt:null})}let xZ={context:"",openWorkspaces:[],prompt:null,workspaceWindowState:"normal",workspaceGroup:void 0},xX=V("workspace",xZ);function xQ(){return xX}function x0(e){let t=xX.getState();xX.setState({...t,workspaceWindowState:e})}function x1(e){return e?.preferredWindowSize??"normal"}function x2(e=()=>{},t=()=>!0){let n=xX.getState().openWorkspaces.filter(t).every(({name:e})=>xR(e)),a=()=>{x6(),e?.()};n?a():x4("closing-all-workspaces",a)}function x3(){let{workspaceWindowState:e,openWorkspaces:t,prompt:n,workspaceGroup:a}=uQ(xX);return(0,uq.useMemo)(()=>({active:t.length>0,prompt:n,workspaceWindowState:e,workspaces:t,workspaceGroup:a}),[t,e,n,a])}function x4(e,t=()=>{},n=""){let a;switch(e){case"closing-workspace":a={title:rp("unsavedChangesTitleText","Unsaved changes"),body:rp("unsavedChangesInOpenedWorkspace","You may have unsaved changes in the opened workspace. Do you want to discard these changes?"),onConfirm:()=>{t?.()},confirmText:rp("discard","Discard")};break;case"closing-all-workspaces":{let e=xX.getState().openWorkspaces.filter(({name:e})=>!xR(e)).map(({title:e},t)=>`${t+1}. ${e}`);a={title:rp("closingAllWorkspacesPromptTitle","You have unsaved changes"),body:rp("closingAllWorkspacesPromptBody","There may be unsaved changes in the following workspaces. Do you want to discard changes in the following workspaces? {{workspaceNames}}",{workspaceNames:e.join(",")}),onConfirm:()=>{t?.()},confirmText:rp("closeAllOpenedWorkspaces","Discard changes in {{count}} workspaces",{count:e.length})};break}case"closing-workspace-launching-new-workspace":a={title:rp("unsavedChangesTitleText","Unsaved changes"),body:rp("unsavedChangesInWorkspace",'There may be unsaved changes in "{{workspaceName}}". Please save them before opening another workspace.',{workspaceName:n}),onConfirm:()=>{xX.setState(e=>({...e,prompt:null})),t?.()},confirmText:rp("openAnyway","Open anyway")};break;default:console.error(`Workspace system trying to open unknown prompt type "${e}" in function "showWorkspacePrompts"`),t?.();return}xX.setState(e=>({...e,prompt:a}))}function x5(e,t){return t?.workspaceTitle??e.title}function x6(){xX.setState(xZ)}function x8(e,t={}){if(!e||"default"===e)return;let n=q(e,{});return t&&n.setState(e=>({...e,...t})),n}var x7=n(1341),x9={};x9.styleTagTransform=dX(),x9.setAttributes=dK(),x9.insert=dq().bind(null,"head"),x9.domAPI=dV(),x9.insertStyleElement=dJ(),dW()(x7.A,x9);let Ce=x7.A&&x7.A.locals?x7.A.locals:void 0;function Ct({getIcon:e,formOpenInTheBackground:t,tagContent:n}){return(0,dj.jsxs)(dj.Fragment,{children:[e({size:16}),t?(0,dj.jsx)("span",{className:Ce.interruptedTag,children:"!"}):(0,dj.jsx)("span",{className:Ce.countTag,children:n})]})}let Cn=({getIcon:e,label:t,iconDescription:n,handler:a,type:r,tagContent:o})=>{let i=dn(),{workspaces:s,workspaceWindowState:l}=x3(),c=s?.findIndex(({type:e})=>e===r)??-1,u="hidden"!==l&&0===c,p=c>0||0===c&&"hidden"===l;return"tablet"===i||"phone"===i?(0,dj.jsxs)(d6.Button,{className:dF()(Ce.container,{[Ce.active]:u}),iconDescription:n,kind:"ghost",onClick:a,role:"button",tabIndex:0,size:"md",children:[(0,dj.jsx)("span",{className:Ce.elementContainer,children:(0,dj.jsx)(Ct,{formOpenInTheBackground:p,getIcon:e,tagContent:o})}),(0,dj.jsx)("span",{children:t})]}):(0,dj.jsx)(d6.IconButton,{align:"left","aria-label":n,className:dF()(Ce.container,{[Ce.active]:u}),enterDelayMs:300,kind:"ghost",label:t,onClick:a,size:"md",children:(0,dj.jsx)("div",{className:Ce.elementContainer,children:(0,dj.jsx)(Ct,{formOpenInTheBackground:p,getIcon:e,tagContent:o})})})};var Ca=n(4535),Cr=n(771),Co=n(7781),Ci={};Ci.styleTagTransform=dX(),Ci.setAttributes=dK(),Ci.insert=dq().bind(null,"head"),Ci.domAPI=dV(),Ci.insertStyleElement=dJ(),dW()(Co.A,Ci);let Cs=Co.A&&Co.A.locals?Co.A.locals:void 0;function Cl({contextKey:e}){let{prompt:t}=x3();return(0,uq.useEffect)(()=>{RegExp(`/${(0,ee.escapeRegExp)(e)}(/|$)`).test(window.location.pathname)||console.warn(`WorkspaceContainer has provided an invalid context key: "${e}". The context key must be part of the URL path, with no initial or trailing slash.`)},[]),(0,uq.useEffect)(()=>(xJ(e),()=>{xJ(null)}),[e]),(0,uq.useEffect)(()=>{let t=t=>{let{detail:{cancelNavigation:n,newUrl:a}}=t,r=RegExp(`/${(0,ee.escapeRegExp)(e)}(/|$)`),o=new URL(a),i=r.test(o.pathname),s=xX.getState().openWorkspaces.every(({name:e})=>xR(e));i||(s?x6():(n?.(),x2(()=>{nV({to:a})})))};return window.addEventListener("single-spa:before-routing-event",t),()=>{window.removeEventListener("single-spa:before-routing-event",t)}},[]),null!=t?(0,dj.jsxs)(d6.ComposedModal,{open:!0,onClose:xH,children:[(0,dj.jsx)(d6.ModalHeader,{title:t.title}),(0,dj.jsx)(d6.ModalBody,{children:(0,dj.jsx)("p",{className:Cs.messageBody,children:t.body})}),(0,dj.jsxs)(d6.ModalFooter,{children:[(0,dj.jsx)(d6.Button,{kind:"secondary",onClick:xH,children:t.cancelText??rp("cancel")}),(0,dj.jsx)(d6.Button,{kind:"danger",onClick:t.onConfirm,children:t.confirmText??rp("confirm")})]})]}):null}function Cc(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,a)}return n}function Cu(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Cc(Object(n),!0).forEach(function(t){Cd(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Cc(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function Cp(e,t){for(var n=0;n<t.length;n++){var a=t[n];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}function Cd(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Cf(e){return(Cf=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function Ch(e,t){return(Ch=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function Cm(e){if(void 0===e)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return e}var Cg=function(e){var t=uq.Component;if("function"!=typeof t&&null!==t)throw TypeError("Super expression must either be null or a function");i.prototype=Object.create(t&&t.prototype,{constructor:{value:i,writable:!0,configurable:!0}}),t&&Ch(i,t);var n,a,r,o=(n=function(){if("u"<typeof Reflect||!Reflect.construct||Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(e){return!1}}(),function(){var e,t=Cf(i);e=n?Reflect.construct(t,arguments,Cf(this).constructor):t.apply(this,arguments);if(e&&("object"==typeof e||"function"==typeof e))return e;if(void 0!==e)throw TypeError("Derived constructors may only return object or undefined");return Cm(this)});function i(e){var t;if(function(e,t){if(!(e instanceof t))throw TypeError("Cannot call a class as a function")}(this,i),Cd(Cm(t=o.call(this,e)),"handleRef",function(e){t.el=e}),Cd(Cm(t),"addThingToDo",function(e,n){t.state.hasError&&"unmount"!==e||(t.nextThingToDo=(t.nextThingToDo||Promise.resolve()).then(function(){if(!t.unmounted||"unmount"===e)return n.apply(void 0,arguments)}).catch(function(n){throw t.nextThingToDo=Promise.resolve(),t.setState({hasError:!0}),n&&n.message&&(n.message="During '".concat(e,"', parcel threw an error: ").concat(n.message)),t.props.handleError?t.props.handleError(n):setTimeout(function(){throw n}),n}))}),Cd(Cm(t),"getParcelProps",function(){var e=Cu(Cu({},t.props),{},{domElement:t.el});return delete e.mountParcel,delete e.config,delete e.wrapWith,delete e.wrapStyle,delete e.appendTo,delete e.handleError,delete e.parcelDidMount,e}),t.state={hasError:!1},!e.config)throw Error("single-spa-react's Parcel component requires the 'config' prop to either be a parcel config or a loading function that returns a promise. See https://github.com/single-spa/single-spa-react");return t}return a=[{key:"componentDidMount",value:function(){var e=this;this.unmounted=!1,this.addThingToDo("mount",function(){var t,n=e.props.mountParcel||e.mountParcel;if(!n)throw Error("\n <Parcel /> was not passed a mountParcel prop, nor is it rendered where mountParcel is within the React context.\n If you are using <Parcel /> within a module that is not a single-spa application, you will need to import mountRootParcel from single-spa and pass it into <Parcel /> as a mountParcel prop \n ");return e.el?t=e.el:(e.createdDomElement=t=document.createElement(e.props.wrapWith),Object.keys(e.props.wrapStyle).forEach(function(n){t.style[n]=e.props.wrapStyle[n]}),e.props.appendTo.appendChild(t)),e.parcel=n(e.props.config,Cu({domElement:t},e.getParcelProps())),e.parcel.mountPromise.then(e.props.parcelDidMount),e.parcel.mountPromise})}},{key:"componentDidUpdate",value:function(){var e=this;this.addThingToDo("update",function(){if(e.parcel&&e.parcel.update)return e.parcel.update(e.getParcelProps())})}},{key:"componentWillUnmount",value:function(){var e=this;this.addThingToDo("unmount",function(){if(e.parcel&&"MOUNTED"===e.parcel.getStatus())return e.parcel.unmount()}),this.createdDomElement&&this.createdDomElement.parentNode.removeChild(this.createdDomElement),this.unmounted=!0}},{key:"render",value:function(){var e=this;if(this.props.appendTo)return pa&&pa.Consumer?uq.createElement(pa.Consumer,null,function(t){return e.mountParcel=t?t.mountParcel:null,null}):null;var t=pa&&pa.Consumer?uq.createElement(pa.Consumer,null,function(t){return e.mountParcel=t?t.mountParcel:null,null}):void 0;return uq.createElement(this.props.wrapWith,{ref:this.handleRef,style:this.props.wrapStyle,className:this.props.wrapClassName},t)}}],Cp(i.prototype,a),r&&Cp(i,r),i}();Cd(Cg,"defaultProps",{wrapWith:"div",wrapStyle:{},parcelDidMount:function(){}});var Cy=n(7515),Cb={};Cb.styleTagTransform=dX(),Cb.setAttributes=dK(),Cb.insert=dq().bind(null,"head"),Cb.domAPI=dV(),Cb.insertStyleElement=dJ(),dW()(Cy.A,Cb);let C_=Cy.A&&Cy.A.locals?Cy.A.locals:void 0;function Cv({workspace:e,additionalPropsFromPage:t}){let[n,a]=(0,uq.useState)(),r=function(e){let[t,n]=(0,uq.useState)({}),[a,r]=(0,uq.useState)(e);return(0,uq.useEffect)(()=>{a!==e&&r(e)},[e]),(0,uq.useEffect)(()=>{let e,t=x8(a);return t&&(n(t.getState()),e=t.subscribe(n)),()=>{t&&e?.()}},[a]),t}(e.currentWorkspaceGroup);(0,uq.useEffect)(()=>{let t=!0;return e.load().then(e=>{t&&a(e)}),()=>{t=!1}},[e]);let o=(0,uq.useMemo)(()=>e&&{closeWorkspace:e.closeWorkspace,closeWorkspaceWithSavedChanges:e.closeWorkspaceWithSavedChanges,promptBeforeClosing:e.promptBeforeClosing,setTitle:e.setTitle,...t,...r,...e.additionalProps},[e,t,r]);return n?(0,dj.jsx)(Cg,{config:n,mountParcel:t2,...o},e.name):(0,dj.jsx)(d6.InlineLoading,{className:C_.loader,description:`${rp("loading","Loading")} ...`})}var C$=n(4646),CA={};CA.styleTagTransform=dX(),CA.setAttributes=dK(),CA.insert=dq().bind(null,"head"),CA.domAPI=dV(),CA.insertStyleElement=dJ(),dW()(C$.A,CA);let Cw=C$.A&&C$.A.locals?C$.A.locals:void 0;function Ck({isWithinWorkspace:e,name:t,actionMenuProps:n={}}){let[a,r]=(0,uq.useState)(!1),o=(0,uq.useRef)(window.innerHeight),{featureName:i}=(0,uq.useContext)(uK),s=dn();(0,uq.useEffect)(()=>{let e=()=>{r(!da(s)&&o.current>window.innerHeight),o.current!=window.innerHeight&&(o.current=window.innerHeight)};return window.addEventListener("resize",e),()=>window.removeEventListener("resize",e)},[o]);let l=`action-menu-${t&&"default"!=t?t:i}-items-slot`;return(0,dj.jsx)("aside",{className:dF()(Cw.sideRail,{[Cw.withinWorkspace]:e,[Cw.sideRailHidden]:a,[Cw.sideRailVisible]:!a}),children:(0,dj.jsx)("div",{className:Cw.container,children:(0,dj.jsx)(u6,{className:Cw.chartExtensions,name:l,state:n})})})}function Cx({contextKey:e,overlay:t,showSiderailAndBottomNav:n,additionalWorkspaceProps:a,actionMenuProps:r}){let o=dn(),{workspaces:i,workspaceWindowState:s,workspaceGroup:l}=x3(),c=l?.name,u=i[0],p="hidden"===s||null==u,d=u?.width??(t?"wider":"narrow"),f=(0,uq.useMemo)(()=>n||c&&!p,[c,p,n]);return pI(!p&&!da(o)),(0,dj.jsxs)(dj.Fragment,{children:[(0,dj.jsxs)("div",{className:n?C_.workspaceContainerWithActionMenu:C_.workspaceContainerWithoutActionMenu,children:[(0,dj.jsx)("aside",{className:dF()(t?C_.workspaceOverlayOuterContainer:C_.workspaceWindowSpacer,{[C_.hiddenRelative]:p,[C_.narrowWorkspace]:"narrow"===d,[C_.widerWorkspace]:"wider"===d,[C_.extraWideWorkspace]:"extra-wide"===d}),children:(0,dj.jsx)("div",{className:dF()(C_.workspaceFixedContainer,{[C_.maximizedWindow]:"maximized"===s,[C_.hiddenFixed]:p}),children:i.map((e,t)=>(0,dj.jsx)("div",{className:dF()(C_.workspaceInnerContainer,{[C_.hiddenExtraWorkspace]:0!==t}),children:(0,dj.jsx)(uq.Suspense,{fallback:null,children:(0,dj.jsx)(pp.I18nextProvider,{i18n:window.i18next,defaultNS:e.moduleName,children:(0,dj.jsx)(CC,{workspaceInstance:e,additionalWorkspaceProps:a})})})},`workspace-container-${e?e.name:`empty-${t}`}`))})}),(0,dj.jsx)(Cl,{contextKey:e})]}),f&&(0,dj.jsx)(Ck,{name:c,isWithinWorkspace:!n,actionMenuProps:r})]})}function CC({workspaceInstance:e,additionalWorkspaceProps:t}){let{t:n}=(0,pp.useTranslation)(),a=dn(),{workspaceWindowState:r,workspaceGroup:o}=x3(),i=o?.name,s="maximized"===r;(0,uq.useEffect)(()=>{let t=n(e.title);t!==e.title&&e.setTitle(t)},[e.title,n,e.setTitle]);let{featureName:l}=(0,uq.useContext)(uK),c=(0,uq.useCallback)(()=>{x0(s?"normal":"maximized")},[s]),{canHide:u=!1,canMaximize:p=!1,currentWorkspaceGroup:d="",closeWorkspace:f}=(0,uq.useMemo)(()=>e??{},[e]),h=(0,uq.useMemo)(()=>({...t,...e?.additionalProps}),[t,e]);return e&&(0,dj.jsxs)(dj.Fragment,{children:[(0,dj.jsxs)(d6.Header,{"aria-label":rp("workspaceHeader","Workspace Header"),className:C_.header,children:[!da(a)&&!u&&(0,dj.jsx)(d6.HeaderMenuButton,{"aria-label":rp("close","Close"),renderMenuIcon:(0,dj.jsx)(fh,{}),onClick:()=>f()}),(0,dj.jsx)(d6.HeaderName,{prefix:"",children:e.titleNode??n(e.title)}),(0,dj.jsx)("div",{className:C_.overlayHeaderSpacer}),(0,dj.jsxs)(d6.HeaderGlobalBar,{className:C_.headerButtons,children:[(0,dj.jsx)(u6,{name:`workspace-header-group-${e.currentWorkspaceGroup}-slot`,state:h}),(0,dj.jsx)(u6,{name:`workspace-header-type-${e.type}-slot`,state:h}),(0,dj.jsx)(u6,{name:`workspace-header-${l}-slot`,state:h}),da(a)&&(0,dj.jsxs)(dj.Fragment,{children:[(p||s)&&(0,dj.jsx)(d6.HeaderGlobalAction,{"aria-label":s?rp("minimize","Minimize"):rp("maximize","Maximize"),onClick:c,children:s?(0,dj.jsx)(Ca.Xj,{}):(0,dj.jsx)(Ca.hz,{})}),u&&!i?(0,dj.jsx)(d6.HeaderGlobalAction,{"aria-label":rp("hide","Hide"),onClick:()=>x0("hidden"),children:(0,dj.jsx)(fm,{})}):(0,dj.jsx)(d6.HeaderGlobalAction,{"aria-label":rp("close","Close"),onClick:()=>f?.(),children:(0,dj.jsx)(fP,{})})]}),"tablet"===a&&u&&(0,dj.jsx)(d6.HeaderGlobalAction,{"aria-label":rp("close","Close"),onClick:()=>f?.(),children:(0,dj.jsx)(Cr.d3,{})})]})]}),(0,dj.jsx)("div",{className:dF()(C_.workspaceContent,{[C_.marginWorkspaceContent]:!!d}),children:(0,dj.jsx)(Cv,{workspace:e,additionalPropsFromPage:t},e.name)})]})}async function CE(e,t){let{openedGroup:n}=uN.getState();if(n){if(n.groupName===e&&CM(n.props,t))return!0;else if(!await Cz({reason:"CLOSE_WORKSPACE_GROUP",explicit:!1}))return!1}return uN.setState(n=>({...n,openedGroup:{groupName:e,props:t},openedWindows:[]})),!0}async function CS(e){let{openedGroup:t,openedWindows:n}=uN.getState();if(t){if(n.length>0&&!(e||await Cz({reason:"CLOSE_WORKSPACE_GROUP",explicit:!0})))return!1;uN.setState(e=>({...e,openedGroup:null,openedWindows:[]}))}return!0}async function CD(e,t=null,n=null,a=null){let r=uN.getState();if(!r.registeredWorkspacesByName[e])throw Error(`Unable to launch workspace ${e}. Workspace is not registered`);let o=uj(e);if(!o)throw Error(`Unable to launch workspace ${e}. Workspace is not registered to a workspace window`);let{openedGroup:i}=r,{name:s}=o,l=uR(s);if(!l)throw Error(`Unable to launch workspace ${e}. Workspace window ${o.name} is not registered to a workspace group`);let c=uF(e);if(i&&(i.groupName!==l.name||!CM(i.props,a)))return!!await Cz({reason:"CLOSE_WORKSPACE_GROUP",explicit:!0})&&(uN.setState({...r,openedGroup:{groupName:l.name,props:a},openedWindows:[{windowName:s,openedWorkspaces:[CI(e,t)],props:n,maximized:!1}],isMostRecentlyOpenedWindowHidden:!1}),!0);if(c>=0){let a=r.openedWindows[c],o=r.openedGroup?.props??{},i=r.isMostRecentlyOpenedWindowHidden,{openedWorkspaces:u}=a;if(CM(a.props,n)){let p=u.find(t=>t.workspaceName===e);return p&&CM(p.props,t)?((i||c!==r.openedWindows.length-1)&&uN.setState(CO.restoreWindow(r,s)),!0):!!await Cz({reason:"CLOSE_WORKSPACE",explicit:!1,windowName:s,workspaceName:e})&&(uN.setState({...r,openedGroup:{groupName:l.name,props:r?.openedGroup?.props??o},openedWindows:[...r.openedWindows.filter((e,t)=>t!==c),{windowName:s,openedWorkspaces:[CI(e,t)],props:a?.props??n,maximized:!1}],isMostRecentlyOpenedWindowHidden:!1}),!0)}return!!await Cz({reason:"CLOSE_WINDOW",explicit:!1,windowName:s})&&(uN.setState({...r,openedGroup:{groupName:l.name,props:o??r?.openedGroup?.props},openedWindows:[...r.openedWindows.filter((e,t)=>t!==c),{windowName:s,openedWorkspaces:[CI(e,t)],props:n,maximized:!1}],isMostRecentlyOpenedWindowHidden:!1}),!0)}return"closable"!=l.persistence?(uN.setState({...r,openedGroup:{groupName:l.name,props:a??r?.openedGroup?.props??null},openedWindows:[...r.openedWindows,{windowName:s,openedWorkspaces:[CI(e,t)],props:n,maximized:!1}],isMostRecentlyOpenedWindowHidden:!1}),!0):!!await Cz({reason:"CLOSE_OTHER_WINDOWS",explicit:!1,windowNameToSpare:o.name})&&(uN.setState({...r,openedGroup:{groupName:l.name,props:a??r?.openedGroup?.props??null},openedWindows:[{windowName:s,openedWorkspaces:[CI(e,t)],props:n,maximized:!1}],isMostRecentlyOpenedWindowHidden:!1}),!0)}function CM(e,t){return null==e||null==t||N(e,t)}function Cz(e){function t(e,t){let n=[];for(let a=e.openedWorkspaces.length-1;a>=0;a--){let r=e.openedWorkspaces[a];if(r.hasUnsavedChanges&&n.push(r),t&&r.workspaceName===t)break}return n}let{openedWindows:n,workspaceTitleByWorkspaceName:a}=uN.getState(),r=[];switch(e.reason){case"CLOSE_WORKSPACE_GROUP":r=n.flatMap(e=>t(e));break;case"CLOSE_WINDOW":{let a=n.find(t=>t.windowName===e.windowName);if(!a)throw Error(`Window ${e.windowName} not found in opened windows.`);r=t(a);break}case"CLOSE_WORKSPACE":{let a=n.find(t=>t.windowName===e.windowName);if(!a)throw Error(`Window ${e.windowName} not found in opened windows.`);r=t(a,e.workspaceName);break}case"CLOSE_OTHER_WINDOWS":r=n.filter(t=>t.windowName!==e.windowNameToSpare).flatMap(e=>t(e))}return 0===r.length?Promise.resolve(!0):new Promise(e=>{let t=w3("workspace2-close-prompt",{onConfirm:()=>{t(),e(!0)},onCancel:()=>{t(),e(!1)},affectedWorkspaceTitles:r.map(e=>a[e.workspaceName])})})}let CO={setWindowMaximized(e,t,n){let a=e.openedWindows.findIndex(e=>e.windowName===t),r=[...e.openedWindows],o={...r[a],maximized:n};return r[a]=o,{...e,openedWindows:r}},hideWindow:e=>({...e,isMostRecentlyOpenedWindowHidden:!0}),restoreWindow(e,t){let n=e.openedWindows.findIndex(e=>e.windowName===t),a=e.openedWindows[n],r=[...e.openedWindows.filter((e,t)=>t!==n),a];return{...e,openedWindows:r,isMostRecentlyOpenedWindowHidden:!1}},closeWorkspace(e,t){let n=uF(t);if(n<0)return e;let a={...e.openedWindows[n]},r=a.openedWorkspaces.findIndex(e=>e.workspaceName===t),o=[...e.openedWindows];a.openedWorkspaces=a.openedWorkspaces.slice(0,r);let i=e.isMostRecentlyOpenedWindowHidden;if(0===a.openedWorkspaces.length){let t=n===e.openedWindows.length-1;o.splice(n,1),t&&o.length>0&&(i=!1)}else o[n]=a;return{...e,openedWindows:o,isMostRecentlyOpenedWindowHidden:i}},openChildWorkspace(e,t,n,a){let r=e.registeredWorkspacesByName[n];if(!r)throw Error(`No workspace named "${n}" registered`);let o=e.registeredWorkspacesByName[t];if(!o)throw Error(`No workspace named "${t}" registered`);if(o.window!==r.window)throw Error(`Child workspace ${n} does not belong to the same workspace window as parent workspace ${t}`);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{openedWorkspaces:s}=e.openedWindows[i],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{openedWindows:e.openedWindows.map((e,t)=>t==i?{...e,openedWorkspaces:[...c,CI(n,a)]}:e)}},setHasUnsavedChanges(e,t,n){let a=uF(t);if(a<0)return e;let r={...e.openedWindows[a]},o=r.openedWorkspaces.findIndex(e=>e.workspaceName===t);if(o<0)return e;r.openedWorkspaces[o]={...r.openedWorkspaces[o],hasUnsavedChanges:n};let i=[...e.openedWindows];return i[a]=r,{...e,openedWindows:i}},setWorkspaceTitle(e,t,n){let a={...e.workspaceTitleByWorkspaceName};return null===n?delete a[t]:a[t]=n,{...e,workspaceTitleByWorkspaceName:a}}};function CP(){return u0(uN,CO)}let CT=()=>(0,uq.useContext)(pa),CB=()=>Object.keys(uN.getState().registeredWorkspacesByName);function CI(e,t){return{workspaceName:e,props:t??{},hasUnsavedChanges:!1,uuid:(0,lU.A)()}}var CN=n(1179),Cj={};Cj.styleTagTransform=dX(),Cj.setAttributes=dK(),Cj.insert=dq().bind(null,"head"),Cj.domAPI=dV(),Cj.insertStyleElement=dJ(),dW()(CN.A,Cj);let CR=CN.A&&CN.A.locals?CN.A.locals:void 0,CF=({title:e,children:t,hasUnsavedChanges:n=!1})=>{let a=dn(),{setWindowMaximized:r,hideWindow:o,setHasUnsavedChanges:i,openedWindows:s,openedGroup:l,registeredGroupsByName:c,registeredWindowsByName:u,registeredWorkspacesByName:p,workspaceTitleByWorkspaceName:d,setWorkspaceTitle:f,isMostRecentlyOpenedWindowHidden:h}=CP(),{workspaceName:m,isRootWorkspace:g,closeWorkspace:y,showActionMenu:b}=CT(),v=uF(m),$=s[v],A=$?.openedWorkspaces.find(e=>e.workspaceName===m);if((0,uq.useEffect)(()=>{A?.hasUnsavedChanges!=n&&i(m,n??!1)},[A?.hasUnsavedChanges,n,m,i]),(0,uq.useEffect)(()=>{d[m]!==e&&f(m,e)},[d,m,e,f]),v<0||null==l||null==A)return null;let w=c[l.groupName];if(!w)throw Error(`Cannot find registered workspace group ${l.groupName}`);let k=p[m].window,x=u[k];if(!x)throw Error(`Cannot find registered workspace window ${k}`);let{icon:C,canMaximize:E}=x,S="closable"===w.persistence,D=!!C&&!S,{maximized:M}=$,z=x?.width??"narrow",O=Object.values(u).some(e=>e.group===l.groupName&&void 0!==e.icon),P=v<s.length-1||h;return(0,dj.jsxs)("div",{className:dF()(CR.workspaceOuterContainer,{[CR.narrowWorkspace]:"narrow"===z,[CR.widerWorkspace]:"wider"===z,[CR.extraWideWorkspace]:"extra-wide"===z,[CR.isActionMenuOpened]:O}),children:[(0,dj.jsx)("div",{className:dF()(CR.workspaceSpacer,{[CR.hidden]:P})}),(0,dj.jsx)("div",{className:dF()(CR.workspaceMiddleContainer,{[CR.maximized]:M,[CR.hidden]:P,[CR.isRootWorkspace]:g,[CR.showActionMenu]:b}),children:(0,dj.jsxs)("div",{className:dF()(CR.workspaceInnerContainer,{[CR.maximized]:M,[CR.hidden]:P,[CR.isRootWorkspace]:g}),children:[(0,dj.jsxs)(d6.Header,{"aria-label":rp("workspaceHeader"),className:CR.header,children:[(0,dj.jsx)(d6.HeaderName,{prefix:"",children:e}),(0,dj.jsx)("div",{className:CR.overlayHeaderSpacer}),(0,dj.jsx)(d6.HeaderGlobalBar,{className:CR.headerButtons,children:da(a)?(0,dj.jsxs)(dj.Fragment,{children:[(E||M)&&(0,dj.jsx)(d6.HeaderGlobalAction,{"aria-label":M?rp("minimize"):rp("maximize"),onClick:()=>r(k,!M),children:M?(0,dj.jsx)(Ca.Xj,{}):(0,dj.jsx)(Ca.hz,{})}),D&&(0,dj.jsx)(d6.HeaderGlobalAction,{"aria-label":rp("hide"),onClick:()=>o(),children:(0,dj.jsx)(fm,{})}),!S&&(0,dj.jsx)(d6.HeaderGlobalAction,{"aria-label":rp("close"),onClick:()=>y({closeWindow:!0}),children:(0,dj.jsx)(fP,{})})]}):(0,dj.jsxs)(dj.Fragment,{children:[D&&(0,dj.jsx)(d6.HeaderGlobalAction,{"aria-label":rp("hide"),onClick:()=>o(),children:(0,dj.jsx)(Cr.d3,{})}),(0,dj.jsx)(d6.HeaderGlobalAction,{"aria-label":rp("close"),onClick:()=>{S?CS():y({closeWindow:!0})},children:(0,dj.jsx)(fP,{})})]})})]}),(0,dj.jsx)("div",{className:dF()(CR.workspaceContent),children:t})]})})]})};var CL=n(7810),CW={};CW.styleTagTransform=dX(),CW.setAttributes=dK(),CW.insert=dq().bind(null,"head"),CW.domAPI=dV(),CW.insertStyleElement=dJ(),dW()(CL.A,CW);let CG=CL.A&&CL.A.locals?CL.A.locals:void 0;function CV({getIcon:e,hasUnsavedChanges:t,tagContent:n}){return(0,dj.jsxs)(dj.Fragment,{children:[e({size:16}),t?(0,dj.jsx)("span",{className:CG.interruptedTag,children:"!"}):(0,dj.jsx)("span",{className:CG.countTag,children:n})]})}let CU=({icon:e,label:t,tagContent:n,workspaceToLaunch:a,onBeforeWorkspaceLaunch:r})=>{let o=dn(),{openedWindows:i,restoreWindow:s,hideWindow:l,isMostRecentlyOpenedWindowHidden:c}=CP(),{extension:u}=(0,uq.useContext)(uK),p=i.findIndex(e=>e.windowName===u?.extensionId),d=i[p],f=null!=d,h=f&&(p<i.length-1||c),m=f&&!h,g=d?.openedWorkspaces.some(e=>e.hasUnsavedChanges)??!1,y=async()=>{if(f)h?s(d.windowName):l();else if(await (r?.()??!0)){let{workspaceName:e,workspaceProps:t,windowProps:n}=a;CD(e,t,n)}};return"tablet"===o||"phone"===o?(0,dj.jsxs)(d6.Button,{className:dF()(CG.container,{[CG.active]:f&&!m,[CG.focused]:m}),iconDescription:t,kind:"ghost",onClick:y,role:"button",tabIndex:0,size:"md",children:[(0,dj.jsx)("span",{className:CG.elementContainer,children:(0,dj.jsx)(CV,{hasUnsavedChanges:g,getIcon:e,tagContent:n})}),(0,dj.jsx)("span",{children:t})]}):(0,dj.jsx)(d6.IconButton,{align:"left","aria-label":t,className:dF()(CG.container,{[CG.active]:f&&!m,[CG.focused]:m}),enterDelayMs:300,kind:"ghost",label:t,onClick:y,size:"md",children:(0,dj.jsx)("div",{className:CG.elementContainer,children:(0,dj.jsx)(CV,{hasUnsavedChanges:g,getIcon:e,tagContent:n})})})};function Cq({showContactDetails:e,toggleContactDetails:t,className:n}){return(0,dj.jsx)(d6.Button,{className:n,iconDescription:"Toggle contact details",kind:"ghost",onClick:t,renderIcon:e?fO:fD,children:e?rp("showLess","Show less"):rp("showMore","Show more")})}var CH=n(5804),CK={};CK.styleTagTransform=dX(),CK.setAttributes=dK(),CK.insert=dq().bind(null,"head"),CK.domAPI=dV(),CK.insertStyleElement=dJ(),dW()(CH.A,CK);let CY=CH.A&&CH.A.locals?CH.A.locals:void 0,CJ=({patientUuid:e})=>{let{cohorts:t=[],isLoading:n}=function(e){let t=e?`${n0}/cohortm/cohortmember?patient=${e}&v=custom:(uuid,patient:ref,cohort:(uuid,name,startDate,endDate))`:null,{data:n,isLoading:a}=(0,pd.Ay)(t,n4),r=n?.data?.results.map(e=>({uuid:e.cohort.uuid,name:e.cohort.name,startDate:e.cohort.startDate,endDate:e.cohort.endDate}));return(0,uq.useMemo)(()=>({cohorts:r,isLoading:a}),[a,r])}(e);return(0,dj.jsxs)(dj.Fragment,{children:[(0,dj.jsxs)("p",{className:CY.heading,children:[rp("patientLists","Patient Lists")," (",t?.length??0,")"]}),n?(0,dj.jsx)(d6.InlineLoading,{description:`${rp("loading","Loading")} ...`,role:"progressbar"}):(0,dj.jsxs)("ul",{children:[(()=>{if(t?.length>0){let e=t.sort((e,t)=>AL(e?.startDate).getTime()-AL(t?.startDate).getTime()).slice(0,3);return e?.map(e=>(0,dj.jsx)("li",{children:(0,dj.jsx)(uY,{to:`${window.spaBase}/home/patient-lists/${e.uuid}`,children:e.name},e.uuid)},e.uuid))}return(0,dj.jsx)("li",{children:"--"})})(),t.length>3&&(0,dj.jsx)("li",{className:CY.link,children:(0,dj.jsx)(uY,{to:`${window.spaBase}/home/patient-lists`,children:rp("seeMoreLists","See {{count}} more lists",{count:t?.length-3})})})]})]})},CZ=({patientId:e})=>{let{patient:t,isLoading:n}=dh(e),a=t?.address?.find(e=>"home"===e.use),r=e=>e.split("#")[1];return n?(0,dj.jsx)(d6.InlineLoading,{description:`${rp("loading","Loading")} ...`,role:"progressbar"}):(0,dj.jsxs)(dj.Fragment,{children:[(0,dj.jsx)("p",{className:CY.heading,children:rp("address","Address")}),(0,dj.jsx)("ul",{children:a?Object.entries(a).filter(([e])=>"id"!==e&&"use"!==e).map(([e,t])=>"extension"===e?a.extension?.[0]?.extension?.map((t,n)=>(0,dj.jsxs)("li",{children:[rp(r(t.url),r(t.url)),": ",t.valueString]},`address-${e}-${n}`)):(0,dj.jsxs)("li",{children:[rp(e,e),": ",t]},`address-${e}`)):(0,dj.jsx)("li",{children:"--"})})]})},CX=({patientUuid:e})=>{let{isLoading:t,contactAttributes:n}=(e=>{let{contactAttributeTypes:t=[]}=pR({externalModuleName:"@openmrs/esm-patient-banner-app"}),{attributes:n,error:a,isLoading:r}=(e=>{let{data:t,error:n,isLoading:a}=pV()(`${n0}/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)))`,n4);return{isLoading:a,attributes:t?.data.person.attributes??[],error:n}})(e);return{contactAttributes:(0,uq.useMemo)(()=>n.filter(({attributeType:e})=>t?.some(t=>e.uuid===t)),[n,t]),isLoading:r,error:a}})(e),a=(0,uq.useMemo)(()=>n?[...n?.map(e=>[e.attributeType.display?rp(e.attributeType.display,e.attributeType.display):"",e.value])]:[],[n]);return(0,dj.jsxs)(dj.Fragment,{children:[(0,dj.jsx)("p",{className:CY.heading,children:rp("contactDetails","Contact Details")}),t?(0,dj.jsx)(d6.InlineLoading,{description:`${rp("loading","Loading")} ...`,role:"progressbar"}):(0,dj.jsx)("ul",{children:a.length?a.map(([e,t],n)=>(0,dj.jsxs)("li",{children:[e,": ",t]},`${e}-${t}-${n}`)):(0,dj.jsx)("li",{children:"--"})})]})},CQ=({patientId:e})=>{let{data:t,isLoading:n}=function(e){let t=`${n0}/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:a,isLoading:r,isValidating:o}=(0,pd.Ay)(e?t:null,n4),i=n?.data?.results?.length?function(e,t){let n=[];for(let a of t)e===a.personA.uuid?n.push({uuid:`${a.uuid}`,display:a.personB.display,relativeAge:a.personB.age,relativeUuid:a.personB.uuid,relationshipType:a.relationshipType.bIsToA}):n.push({uuid:`${a.uuid}`,display:a.personA.display,relativeAge:a.personA.age,relativeUuid:a.personA.uuid,relationshipType:a.relationshipType.aIsToB});return n}(e,n.data.results):null;return{data:n?i:null,error:a,isLoading:r,isValidating:o}}(e);return(0,dj.jsxs)(dj.Fragment,{children:[(0,dj.jsx)("p",{className:CY.heading,children:rp("relationships","Relationships")}),n?(0,dj.jsx)(d6.InlineLoading,{description:`${rp("loading","Loading")} ...`,role:"progressbar"}):(0,dj.jsx)("ul",{children:t&&t.length>0?(0,dj.jsx)(dj.Fragment,{children:t.map(e=>(0,dj.jsxs)("li",{className:CY.relationship,children:[(0,dj.jsx)("div",{children:(0,dj.jsx)(uY,{to:`${window.spaBase}/patient/${e.relativeUuid}/chart`,children:e.display})}),(0,dj.jsx)("div",{children:e.relationshipType}),(0,dj.jsx)("div",{children:`${e.relativeAge?e.relativeAge:"--"} ${e.relativeAge?1===e.relativeAge?rp("yearAbbreviation","yr"):rp("yearsAbbreviation","yrs"):""}`})]},e.uuid))}):(0,dj.jsx)("li",{children:"--"})})]})};function C0({patientId:e,deceased:t}){return(0,dj.jsxs)("div",{className:dF()(CY.contactDetails,{[CY.deceased]:t}),children:[(0,dj.jsxs)("div",{className:CY.row,children:[(0,dj.jsx)("div",{className:CY.col,children:(0,dj.jsx)(CZ,{patientId:e})}),(0,dj.jsx)("div",{className:CY.col,children:(0,dj.jsx)(CX,{patientUuid:e})})]}),(0,dj.jsxs)("div",{className:CY.row,children:[(0,dj.jsx)("div",{className:CY.col,children:(0,dj.jsx)(CQ,{patientId:e})}),(0,dj.jsx)("div",{className:CY.col,children:(0,dj.jsx)(CJ,{patientUuid:e})})]})]})}function C1(e){let t=document.querySelector("template#loading-spinner");if(t){let n=t.content.cloneNode(!0),a=Array.prototype.map.call(n.childNodes,e=>e);return e.appendChild(n),()=>a.forEach(e=>e.remove())}return()=>{}}var C2=n(4039),C3={};C3.styleTagTransform=dX(),C3.setAttributes=dK(),C3.insert=dq().bind(null,"head"),C3.domAPI=dV(),C3.insertStyleElement=dJ(),dW()(C2.A,C3);let C4=C2.A&&C2.A.locals?C2.A.locals:void 0;function C5({workspaceGroup:e,groupProps:t}){let n=dn(),{persistence:a}=e;return(0,dj.jsx)("aside",{className:C4.sideRail,children:(0,dj.jsxs)("div",{className:C4.container,children:["closable"==a&&da(n)&&(0,dj.jsx)(d6.IconButton,{align:"left",onClick:()=>CS(),label:rp("close"),kind:"ghost",children:(0,dj.jsx)(fP,{})}),(0,dj.jsx)(uK.Provider,{value:{moduleName:e.moduleName,featureName:e.name},children:(0,dj.jsx)(u6,{className:C4.container,name:e.name,state:{groupProps:t}})})]})})}let C6=({lifeCycle:e,openedWorkspace:t,openedWindow:n,isRootWorkspace:a,isLeafWorkspace:r,showActionMenu:o})=>{let{openedGroup:i,closeWorkspace:s,openChildWorkspace:l}=CP(),c=(0,uq.useMemo)(()=>t&&{closeWorkspace:async(e={})=>{let{closeWindow:a=!1,discardUnsavedChanges:r=!1}=e;return a?!!(r||await Cz({reason:"CLOSE_WINDOW",explicit:!0,windowName:n.windowName}))&&(s(n.openedWorkspaces[0].workspaceName),!0):!!(r||await Cz({reason:"CLOSE_WORKSPACE",explicit:!0,windowName:n.windowName,workspaceName:t.workspaceName}))&&(s(t.workspaceName),!0)},launchChildWorkspace:async(e,a)=>{let r=t.workspaceName,{openedWorkspaces:o}=n,i=o.findIndex(e=>e.workspaceName===r);-1===i||i!==o.length-1&&o.slice(i+1).some(e=>e.hasUnsavedChanges)&&!await Cz({reason:"CLOSE_WORKSPACE",explicit:!0,windowName:n.windowName,workspaceName:o[i+1].workspaceName})||l(r,e,a||{})},workspaceName:t.workspaceName,workspaceProps:t.props,windowProps:n.props,groupProps:i&&i.props?i.props:null,isRootWorkspace:a,isLeafWorkspace:r,windowName:n.windowName,showActionMenu:o},[t,s,i,n]);if(!e){let{registeredWorkspacesByName:e}=uN.getState(),n=e[t.workspaceName],r=n&&n.window?n.window:void 0,{registeredWindowsByName:s}=uN.getState(),l=r?s[r]:void 0,c=l&&l.width?l.width:"narrow",u=Object.values(s).some(e=>e.group===i?.groupName&&void 0!==e.icon);return(0,dj.jsxs)("div",{className:dF()(CR.workspaceOuterContainer,{[CR.narrowWorkspace]:"narrow"===c,[CR.widerWorkspace]:"wider"===c,[CR.extraWideWorkspace]:"extra-wide"===c,[CR.isActionMenuOpened]:u}),children:[(0,dj.jsx)("div",{className:CR.workspaceSpacer}),(0,dj.jsx)("div",{className:dF()(CR.workspaceMiddleContainer,{[CR.isRootWorkspace]:a,[CR.showActionMenu]:o}),children:(0,dj.jsx)("div",{className:dF()(CR.workspaceInnerContainer,{[CR.isRootWorkspace]:a}),children:(0,dj.jsx)(d6.InlineLoading,{className:CR.loader,description:`${rp("loading")} ...`})})})]})}return(0,dj.jsx)(Cg,{config:e,mountParcel:t2,...c},t.workspaceName)},C8=({openedWindow:e,showActionMenu:t})=>{let{openedWorkspaces:n}=e,[a,r]=(0,uq.useState)({}),{registeredWorkspacesByName:o}=uN.getState();return(0,uq.useEffect)(()=>{let e=!1;return Promise.all(n.map(async e=>{let{moduleName:t,component:n}=o[e.workspaceName];return[e.uuid,await dE(t,n)]})).then(t=>{e||r(Object.fromEntries(t))}),()=>{e=!0}},[n]),(0,dj.jsx)(dj.Fragment,{children:n.map((r,o)=>(0,dj.jsx)(C6,{openedWorkspace:r,openedWindow:e,lifeCycle:a[r.uuid],isRootWorkspace:0===o,isLeafWorkspace:o===n.length-1,showActionMenu:t},r.uuid))})};var C7=n(297),C9={};C9.styleTagTransform=dX(),C9.setAttributes=dK(),C9.insert=dq().bind(null,"head"),C9.domAPI=dV(),C9.insertStyleElement=dJ(),dW()(C7.A,C9);let Ee=C7.A&&C7.A.locals?C7.A.locals:void 0;function Et(e){e&&(0,u8.createRoot)(e).render((0,dj.jsx)(En,{}))}function En(){let{openedGroup:e,openedWindows:t,registeredGroupsByName:n,registeredWindowsByName:a}=CP();if((0,uq.useEffect)(()=>co("before-page-changed",t=>{let{newPage:a,cancelNavigation:r,oldUrl:o,newUrl:i}=t;if(!e)return;if(a)return void r(CS().then(e=>!e));let s=n[e.groupName],l=s?.scopePattern;l&&function(e,t,n){try{let a=new URL(t,window.location.origin).pathname,r=new URL(n,window.location.origin).pathname,o=new RegExp(e),i=a.match(o),s=r.match(o);if(!i||!s)return!0;if(i.length>1)return!i.slice(1).every((e,t)=>e===s[t+1]);return!1}catch{return!0}}(l,o,i)&&r(CS().then(e=>!e))}),[e,n]),!e)return null;let r=n[e.groupName],o=t.some(e=>e.maximized),{name:i}=r,s=Object.values(a).filter(e=>e.group===i&&void 0!==e.icon).sort((e,t)=>(e.order??Number.MAX_VALUE)-(t.order??Number.MAX_VALUE)).length>0;return(0,dj.jsxs)("div",{className:dF()(Ee.workspaceWindowsAndMenuContainer,{[Ee.overlay]:r.overlay,[Ee.hasMaximizedWindow]:o}),children:[(0,dj.jsx)("div",{className:Ee.workspaceWindowsContainer,children:t.map(e=>(0,dj.jsx)(C8,{openedWindow:e,showActionMenu:s},e.windowName))}),s&&(0,dj.jsx)(C5,{workspaceGroup:r,groupProps:e.props})]})}function Ea(e){if("string"!=typeof e||0===e.trim().length)return;let t=e.replaceAll("_","-");try{return new Intl.Locale(t).toString()}catch{return}}function Er(e,t,n){if(null==e)return n;let a=Ea(e);if(!a)return console.warn(`matchLocale: invalid requested locale tag: ${JSON.stringify(e)}`),n;let r=[];for(let e of t){let t=Ea(e);if(!t){console.warn(`matchLocale: skipping invalid available locale tag: ${JSON.stringify(e)}`);continue}r.push({canonical:t,original:e})}let o=a;for(;o;){let e=r.find(e=>e.canonical===o);if(e)return e.original;let t=o+"-",n=r.find(e=>e.canonical.startsWith(t));if(n)return n.original;if("ht"===o){o="fr-HT";continue}let a=o.lastIndexOf("-");if(-1===a)break;let i=(o=o.slice(0,a)).lastIndexOf("-");-1!==i&&o.length-i==2&&(o=o.slice(0,i))}return n}function Eo(e=window.localStorage){try{return e.getItem("test"),!0}catch{return!1}}function Ei(e){return!!e&&e.constructor===Object}var Es=n(9589);function El(e){let[t,n,a]=e.split(".");return`${t}.${n}.${a}`}function Ec(e,t){let n=function(e){let t=e.indexOf("-");if(t>=0){let n=El(e.slice(0,t)),a=e.slice(t+1);return`${n}-${a}`}return El(e)}(t);return Es.satisfies(n,e,{includePrerelease:!0})}async function Eu(e,t={}){let n,{shouldRetry:a,getDelay:r,onError:o}=t;a=a??(e=>e<=5),r=r??(e=>(function(e,t=!1){return 1e3*Math.pow(2,t?e+1:e)})(e));let i=0;do try{return await Ep(r(i)),await e()}catch(e){o?.(e,i),n=e}while(a(i++));throw n}async function Ep(e){if(!(e<=0))return new Promise(t=>setTimeout(t,e))}}}]);