@openmrs/esm-report-builder 0.1.1-pre.205 → 0.1.1-pre.209

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/5584.js CHANGED
@@ -12,8 +12,8 @@ If you're the maintainer: the 'elements' key only works with '_type' equal to 'A
12
12
  ${t}`)}return n}let ai=(e,t)=>{let r=structuredClone(t);if(!e)return r;for(let t of Object.keys(e)){let n=r[t],a=e[t];if(a&&(a.hasOwnProperty("_type")||a.hasOwnProperty("_default"))){r.hasOwnProperty(t)||(r[t]=a._default);let e=a._elements;if(n&&as(e)){if(a._type===nd.Array&&Array.isArray(n)){let a=n.map(t=>ai(e,t));r[t]=a}else if(a._type===nd.Object)for(let t of Object.keys(n))n[t]=ai(e,n[t])}}else if(al(a)){let e=n??{};al(e)&&(r[t]=ai(a,e))}}return r};function as(e){return!!e&&Object.keys(e).filter(e=>!["_default","_validators"].includes(e)).length>0}function al(e){return"object"==typeof e&&!Array.isArray(e)&&null!==e}function au(e,t){let r=`${e}:::${t}`;nU.has(r)||(console.error(t),nU.add(r))}function ac(e){e?nU.forEach(t=>{t.startsWith(e)&&nU.delete(t)}):nU.clear()}function ad(){nV.forEach(e=>e()),nV.length=0,nG.clear(),n6.clear(),n9.clear(),n5.clear(),nW=null,nH=new WeakMap,nz()}let am={"Translation overrides":{_description:"Per-language overrides for frontend translations should be keyed by language code and each language dictionary contains the translation key and the display value",_type:nd.Object,_default:{},_validators:[nm(e=>Object.keys(e).every(e=>/^[a-z]{2,3}(-[A-Z]{2,3})?$/.test(e)),e=>{let t=Object.keys(e).filter(e=>!/^[a-z]{2,3}(-[A-Z]{2,3})?$/.test(e));return`The 'Translation overrides' object should have language codes for keys. Language codes must be in the form of a two-to-three letter language code optionally followed by a hyphen and a two-to-three letter country code. The following keys do not conform: ${t.join(", ")}.`})]}},ap={"Display conditions":{privileges:{_description:"The privilege(s) the user must have to use this extension",_type:nd.Array,_default:[]},expression:{_description:"The expression that determines whether the extension is displayed",_type:nd.String,_default:void 0}},...am},af=(e,t)=>nm(r=>e<=r&&r<=t,`must be between ${e} and ${t}`),ah=e=>{let t=e.concat(["openmrsBase","openmrsSpaBase"]);return nm(e=>{if(!e||"string"!=typeof e)return!1;let r=/\${(.*?)}/g,n=r.exec(e);for(;n;){if(!t.includes(n[1]))return!1;n=r.exec(e)}return!0},"Should be a URL or path. The allowed template parameters are "+t.map(e=>"${"+e+"}").join(", "))},ag=ah([]),ay=e=>nm(t=>e.includes(t),`Must be one of the following: '${e.join("', '")}'.`),av={inRange:af,isUrl:ag,isUrlWithTemplateParameters:ah,oneOf:ay};var ab=r(8067);let aw=B("breadcrumbs",[]);function aE(e){return aD([e])}function aD(e){let t=[...ax(),...e.map(e=>({matcher:e.matcher instanceof RegExp?e.matcher:"string"==typeof e.matcher?(0,ab.pathToRegexp)(e.matcher).regexp:(0,ab.pathToRegexp)(e.path).regexp,settings:e}))];aw.setState(t,!0)}function ax(){return aw.getState()}function a_(e,t){if(t)return function(e,t){let[r]=e.filter(e=>e.matcher.test(t));return r}(e,t)||function(e,t){let r=t.split("/");for(;r.length>1;){r.pop();let t=a_(e,r.join("/"));if(t)return t}}(e,t)}function aS(e,t){if(e.length>0){let r=a_(e,t);if(r){let t=[r],n=a_(e,r.settings.parent);for(;void 0!==n;)t.push(n),n=a_(e,n.settings.parent);return t.reverse()}}return[]}function aC(e){return aS(ax(),e)}var ak=r(366);let aP={address1:"Address line 1",address2:"Address line 2",address3:"Address line 3",address4:"Address line 4",address5:"Address line 5",address6:"Address line 6",city:"City",cityVillage:"City",country:"Country",countyDistrict:"District",district:"District",postalCode:"Postal code",state:"State",stateProvince:"State",closeAllOpenedWorkspaces:"Discard changes in {{count}} workspaces",closingAllWorkspacesPromptBody:"There may be unsaved changes in the following workspaces. Do you want to discard changes in the following workspaces? {{workspaceNames}}",closingAllWorkspacesPromptTitle:"You have unsaved changes",discard:"Discard",hide:"Hide",maximize:"Maximize",minimize:"Minimize",openAnyway:"Open anyway",unsavedChangesInOpenedWorkspace:"You may have unsaved changes in the opened workspace. Do you want to discard these changes?",unsavedChangesInWorkspace:'There may be unsaved changes in "{{workspaceName}}". Please save them before opening another workspace.',unsavedChangesTitleText:"Unsaved changes",workspaceHeader:"Workspace header",discardUnsavedChangesPromptBodyMultiple:"{{count}} workspaces have unsaved changes. Closing them will discard the changes:",discardUnsavedChangesPromptBodySingle:"<strong>{{workspaceTitle}}</strong> has unsaved changes. Closing it will discard them.",discardUnsavedChangesPromptTitle:"Discard unsaved changes?",keepEditing:"Keep editing",abnormalValue:"Abnormal value",actions:"Actions",actionableNotification:"Actionable notification",address:"Address",age:"Age",applicationError:"Application Error",batchActionItemSelected:"{{totalSelected}} item selected",batchActionsItemsSelected:"{{totalSelected}} items selected",cancel:"Cancel",change:"Change",Clinic:"Clinic",clearDevOverrides:"Clear dev overrides",close:"Close",closesActionableNotification:"Close actionable notification",closeSnackbar:"Close snackbar",confirm:"Confirm",contactAdministratorIfIssuePersists:"Contact your system administrator if the problem persists.",contactDetails:"Contact details",copied:"Copied!",copyToClipboard:"Copy to clipboard",delete:"Delete",discardChanges:"Discard changes",edit:"Edit",emptyStateText:"There are no {{displayText}} to display",error:"Error",errorCopy:"Sorry, there was a problem displaying this information. You can try to reload this page, or contact the site administrator and quote the error code above.",errorLoadingLoginLocations:"Unable to load login locations. Please try again or contact support if the problem persists.",female:"Female",leftNavigation:"Left navigation",loading:"Loading",localVersion:"Local Build",male:"Male",navigateNonHttp:"Could not navigate to the requested page as it is not a safe URL",noResultsToDisplay:"No results to display",notAvailable:"Not available",other:"Other",paginationItemsCount:"{{pageItemsCount}} / {{totalItems}} items",paginationOfPages:"of {{count}} pages",patientAvatarAlt:"Avatar for {{patientName}}",patientIdentifierSticker:"Patient identifier sticker",patientLists:"Patient lists",patientPhotoAlt:"Profile photo of {{patientName}}",patientPhotoPlaceholder:"Photo placeholder for {{patientName}}",prereleaseVersion:"Prerelease",print:"Print",printError:"Print error",printErrorExplainer:"An error occurred in {{errorLocation}}",printIdentifierSticker:"Print identifier sticker",printing:"Printing",provisional:"Provisional",recordNewEntry:"Record {{displayText}}",relationships:"Relationships",reload:"Reload",resetOverrides:"Reset overrides",save:"Save",scriptLoadingFailed:"Error: Script failed to load",scriptLoadingError:"Failed to load overridden script from {{url}}. Please check that the bundled script is available at the expected URL. Click the button below to reset all import map overrides.",searchForLocation:"Search for a location",seeAll:"See all",seeMoreLists:"See {{count}} more lists",selectAll:"Select all",serverStartingUp:"The server is starting",serverStartingUpExplainer:"This can take a few minutes. OpenMRS will open automatically when the server is ready.",serverStartingUpSlowExplainer:"This is taking longer than usual. First startup after an upgrade can take 10 minutes or more. You can leave this page open.",sex:"Sex",showLess:"Show less",showMore:"Show more",snackbarNotification:"Snackbar notification",somethingWentWrongTryReloading:"Something went wrong. Please try reloading.",toggleDevTools:"Toggle dev tools",unknown:"Unknown",viewSetupProgress:"View setup progress",waitingForServer:"Waiting for the server",yearAbbreviation:"yr",yearsAbbreviation:"yrs"};var aR=r(2635);let aT=aR.Ay.default||aR.Ay;function a$(e,t,r,n){return aT.t(t,{ns:e,defaultValue:r,...n})}function aO(e,t,r){return aP[e]?a$("core",e,t??aP[e],r):(console.error(`O3 Core Translations does not provide key '${e}'. The key itself is being rendered as text.`),e)}function aN(e,t){let r=window.getOpenmrsSpaBase().replace(/\/$/,""),n=aM(e,{openmrsBase:window.openmrsBase,openmrsSpaBase:r,...t});return e.startsWith("//")?n:n.replace(/^\/\//,"/")}function aM(e,t){return Object.keys(t).reduce((e,r)=>e.split("${"+r+"}").join(t[r]),e)}function aI({to:e,templateParams:t}){let r=window.getOpenmrsSpaBase().replace(/\/$/,""),n=aN(e,t).replace(window.location.origin,""),a=new URL(n,window.location.origin);if("http:"!=a.protocol&&"https:"!=a.protocol)throw console.error(`Received request to navigate to non-http URL: ${a.toString()}`),Error(aO("navigateNonHttp"));n.startsWith(r)?(0,ak.navigateToUrl)(n):window.location.assign(n)}aT.on("initialized",function(){window.i18next.loadNamespaces(["core"])});let aj="openmrs:history";function aA(e){let t=JSON.parse(sessionStorage.getItem(aj)??"[]")||[];t.push(e),t.length>50&&(t=t.slice(-50)),sessionStorage.setItem(aj,JSON.stringify(t))}function aL(){0===JSON.parse(sessionStorage.getItem(aj)??"[]").length&&document.referrer&&aA(document.referrer),window.addEventListener("single-spa:routing-event",e=>{let t=aF();e.detail.originalEvent?.singleSpaTrigger=="replaceState"?(t[t.length-1]=window.location.href,sessionStorage.setItem(aj,JSON.stringify(t))):!e.detail.originalEvent?.singleSpa&&t.includes(window.location.href)?aB({toUrl:window.location.href}):t[t.length-1]!==window.location.href&&aA(window.location.href)})}function aF(){return JSON.parse(sessionStorage.getItem(aj)??"[]")}function aB({toUrl:e}){let t=aF(),r=t.lastIndexOf(e);if(-1!=r){let e=t.slice(0,r+1);aI({to:t[r]}),sessionStorage.setItem(aj,JSON.stringify(e))}else throw Error(`URL ${e} not found in history; cannot go back to it.`)}function aV(){sessionStorage.removeItem(aj)}let aU="${openmrsSpaBase}/login",aW={redirectAuthFailure:{enabled:{_type:nd.Boolean,_default:!0,_description:"Whether to redirect logged-out users to `redirectAuthFailure.url`"},url:{_type:nd.String,_default:aU,_validators:[av.isUrl],_description:"The url to which users will be redirected when they are logged out. If set to blank, the `location` header from the response will be used."},errors:{_type:nd.Array,_default:[401],_elements:{_type:nd.Number,_validators:[av.inRange(100,600)]},_description:"The HTTP error codes for which users will be redirected"},resolvePromise:{_type:nd.Boolean,_default:!1,_description:"Changes how requests that fail authentication are handled. Try messing with this if redirects to the login page aren't working correctly."}},followRedirects:{_type:nd.Boolean,_default:!0,_description:"Whether openmrsFetch should support redirects returned from the backend"}};function aH(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}let az="/ws/rest/v1",aK="/ws/fhir2/R4",aG=`${az}/session`;function aZ(e){return e&&e.startsWith("http")?e:("/"!==e[0]&&(e="/"+e),window.openmrsBase+e)}function aY(e,t={}){if("string"!=typeof e)throw Error("The first argument to @openmrs/api's openmrsFetch function must be a url string");if("object"!=typeof t)throw Error("The second argument to @openmrs/api's openmrsFetch function must be a plain object.");if(!window.openmrsBase)throw Error("@openmrs/api is running in a browser that doesn't have window.openmrsBase, which is provided by openmrs-module-spa's HTML file.");let r=aZ(e);t.headers||(t.headers={}),e_(t.body)&&(t.body=JSON.stringify(t.body)),void 0===t.headers.Accept&&(t.headers.Accept="application/json"),null===t.headers.Accept&&delete t.headers.Accept;let n=!1;try{let e=new URL(r,window.location.href),t=new URL(aZ(az),window.location.href),a=e.pathname.replace(/\/{2,}/g,"/"),o=t.pathname.replace(/\/{2,}/g,"/");n=e.origin===t.origin&&(a===o||a.startsWith(`${o}/`))}catch{}if(n){let e=!1;for(let[r,n]of Object.entries(t.headers))"disable-www-authenticate"===r.toLowerCase()&&(void 0===n?delete t.headers[r]:e=!0);e||(t.headers["Disable-WWW-Authenticate"]="true")}if(e.startsWith(aK)){let e=new URL(r,window.location.toString());e.searchParams.has("_summary")||(e.searchParams.set("_summary","data"),r=e.toString())}let a=Error();return window.fetch(r,t).then(async e=>{let{redirectAuthFailure:n,followRedirects:o}=await n4("@openmrs/esm-api");if(e.ok){let t=e.headers.get("location");return(o&&t&&(r===aZ(aG)||204===e.status)&&aI({to:t}),204===e.status)?(e.data=null,e):e.clone().text().then(t=>{try{t&&(e.data=JSON.parse(t))}catch(e){}return e})}return(r===aZ(aG)&&403===e.status||n.enabled&&n.errors.includes(e.status))&&(aV(),aI({to:n.url||e.headers.get("location")||aU}),!0!==t.rejectAuthFailure)?n.resolvePromise?Promise.resolve():new Promise(()=>{}):e.clone().text().then(t=>{let n=t;try{n=JSON.parse(t)}catch(e){}throw new aq(r,e,n,a)},()=>{throw new aq(r,e,null,a)})})}class aq extends Error{constructor(e,t,r,n){super(),aH(this,"response",void 0),aH(this,"responseBody",void 0),this.message=`Server responded with ${t.status} (${t.statusText}) for url ${e}. Check err.responseBody or network tab in dev tools for more info`,n.message=this.message,this.responseBody=r,this.response=t,this.stack=`Stacktrace for outgoing request:
13
13
  ${n.stack}
14
14
  Stacktrace for incoming response:
15
- ${this.stack}`}}let aJ=B("session",{loaded:!1,session:null}),aX=0,aQ=null;function a0(){return aQ||(aJ.getState().loaded&&aX>=Date.now()-6e4?null:a3())}function a1(e){let t=e?.includeAuthStatus??!0,r=e=>t?e:e.user,n=a0();return n?new Promise(e=>{let t=()=>{let t=aJ.getState();t.loaded&&(a(),e(r(t.session)))},a=aJ.subscribe(t);n.then(t,t)}):Promise.resolve(r(aJ.getState().session))}function a4(){return a0(),aJ}function a2(e){let t=e.locale??e.user?.userProperties?.defaultLocale;t&&t.includes("_")&&(t=t.replaceAll("_","-")),function(e){if(void 0===e||"string"!=typeof e)return!1;try{new Intl.Locale(e)}catch(e){return!1}return!0}(t)&&t!==document.documentElement.getAttribute("lang")&&document.documentElement.setAttribute("lang",t)}function a3(e,t){aX=Date.now(),a??(a=aX);let r={};e&&t&&(r.Authorization=`Basic ${window.btoa(`${e}:${t}`)}`);let n=oa(aY(aG,{headers:r,rejectAuthFailure:!0})),o=()=>{aQ===n&&(aQ=null)};return n.then(o,o),aQ=n,n}function a6(){aJ.setState({loaded:!0,session:{authenticated:!1,sessionId:""}},!0)}function a5(e,t){var r,n;if(void 0===t)return!e;if(!e)return!0;return r=e,n=t,("string"==typeof r?!K(n.privileges.find(e=>r===e.display)):Array.isArray(r)?r.every(e=>!K(n.privileges.find(t=>e===t.display))):(K(r)||console.error(`Could not understand privileges "${r}"`),!0))||!K(t.roles.find(e=>"System Developer"===e.display))}function a9(){let e,t;return new Promise(r=>{let n=n=>{n.loaded&&n.session.user&&(e=n.session.user,r(n.session.user),t&&t())};n(aJ.getState()),e||(t=aJ.subscribe(n))})}async function a8(){return(await a1()).sessionLocation}async function a7(e,t){return oa(aY(aG,{method:"POST",body:{sessionLocation:e},headers:{"Content-Type":"application/json"},rejectAuthFailure:!0,signal:t?.signal}))}async function oe(e,t){return await aY(aG,{method:"POST",body:{locale:e},headers:{"Content-Type":"application/json"},signal:t?.signal}),a3()}async function ot(e,t,r){return r||(r=new AbortController),await aY(`${az}/user/${e}`,{method:"POST",body:{userProperties:t},headers:{"Content-Type":"application/json"},signal:r.signal}),a3()}async function or(e,t=!1){let r=await aY(t?`${aG}?rememberMe=true`:aG,{headers:{"X-Totp-Code":e}});return r.data?.authenticated?(await a3()).session:r.data}async function on(){try{await aY(aG,{method:"DELETE",rejectAuthFailure:!0})}catch(e){if(!oo(e))throw e}a6(),await a3().catch(()=>{})}function oa(e){return new Promise((t,r)=>{e.then(e=>{if("object"==typeof e?.data){let r={loaded:!0,session:e.data};aJ.setState(r,!0),t(r)}else!function(e){if(!e?.redirected||!e.url)return!1;try{return new URL(e.url,window.location.href).pathname.replace(/\/+$/,"").endsWith("/initialsetup")}catch{return!1}}(e)?r(oi(Error("The session endpoint did not respond with a session"))):r(oi(Error("The server is still starting up"),!0))}).catch(e=>{var n,o;if(oo(e)){"object"==typeof(n=e.responseBody)&&null!==n&&!1===n.authenticated?aJ.setState({loaded:!0,session:e.responseBody},!0):a6(),t(aJ.getState());return}(o=e)instanceof aq&&502===o.response.status&&!aJ.getState().loaded&&void 0!==a&&Date.now()-a<18e4?r(oi(e,!0)):(k(`Failed to fetch new session information: ${e}`),r(oi(e)))})})}function oo(e){return e instanceof aq&&(401===e.response.status||403===e.response.status)}function oi(e,t=!1){return aJ.getState().loaded||aJ.setState({loaded:!1,session:null,error:e instanceof Error?e:Error(String(e)),initializing:t},!0),aJ.getState()}function os(){return"development"===window.spaEnv||"true"===localStorage.getItem("openmrs:devtools")}aJ.subscribe(e=>{e.loaded&&e.session&&a2(e.session)});let ol={"webservices.rest":"2.24.0",fhir2:"1.0.0-SNAPSHOT"};function ou(){nY("@openmrs/esm-api",aW),a3()}let oc="import-map-override:",od="import-map-overrides-disabled",om="import-map-overrides:change",op=!1,of=null,oh=null;async function og(){return oh??(oh=oy().then(({map:e,complete:t})=>(t||(oh=null),e))),oh}async function oy(){let e=document.querySelectorAll('script[type="systemjs-importmap"]'),t=[],r=!0;for(let n=0;n<e.length;n++){let a=e[n];try{if(a.src){let e=await fetch(a.src);if(!e.ok)throw Error(`Request for ${a.src} returned ${e.status} ${e.statusText}`);t.push(await e.json())}else a.textContent&&t.push(JSON.parse(a.textContent))}catch(e){r=!1,console.warn(`[import-maps] Failed to parse import map from script tag at index ${n}`,e)}}return{map:ov(t),complete:r}}function ov(e){let t={imports:{}};for(let r of e)r?.imports&&Object.assign(t.imports,r.imports);return t}function ob(){let e={};try{let t=o_();for(let r=0;r<localStorage.length;r++){let n=localStorage.key(r);if(n?.startsWith(oc)){let r=n.slice(oc.length);if(!t.includes(r)){let t=localStorage.getItem(n);t&&(e[r]=t)}}}}catch(e){console.warn("[import-maps] Failed to read import-map overrides from localStorage",e)}return{imports:e}}async function ow(){let e=await og();return op?ov([e,of??ob()]):e}async function oE(){return og()}async function oD(){return op?ov([await og(),ob()]):og()}function ox(e){if(!op)return{imports:{}};if(e){let e={};for(let t=0;t<localStorage.length;t++){let r=localStorage.key(t);if(r?.startsWith(oc)){let t=localStorage.getItem(r);t&&(e[r.slice(oc.length)]=t)}}return{imports:e}}return ob()}function o_(){if(!op)return[];try{let e=localStorage.getItem(od);if(e){let t=JSON.parse(e);if(Array.isArray(t))return t}}catch{}return[]}function oS(e){return!!op&&o_().includes(e)}function oC(e,t){if(!op)return void console.warn("[Security] Import map overrides are disabled in production mode.");try{localStorage.setItem(oc+e,t),window.dispatchEvent(new CustomEvent(om))}catch(e){console.warn("[import-maps] Failed to write import-map override to localStorage",e)}}function ok(e){if(!op)return void console.warn("[Security] Import map overrides are disabled in production mode.");try{localStorage.removeItem(oc+e);let t=o_().filter(t=>t!==e);t.length>0?localStorage.setItem(od,JSON.stringify(t)):localStorage.removeItem(od),window.dispatchEvent(new CustomEvent(om))}catch(e){console.warn("[import-maps] Failed to update import-map overrides in localStorage",e)}}function oP(){if(!op)return void console.warn("[Security] Import map overrides are disabled in production mode.");try{let e=[];for(let t=0;t<localStorage.length;t++){let r=localStorage.key(t);r?.startsWith(oc)&&e.push(r)}e.forEach(e=>localStorage.removeItem(e)),localStorage.removeItem(od),window.dispatchEvent(new CustomEvent(om))}catch(e){console.warn("[import-maps] Failed to clear import-map overrides from localStorage",e)}}function oR(e){if(!op)return void console.warn("[Security] Import map overrides are disabled in production mode.");try{let t=o_().filter(t=>t!==e);t.length>0?localStorage.setItem(od,JSON.stringify(t)):localStorage.removeItem(od),window.dispatchEvent(new CustomEvent(om))}catch(e){console.warn("[import-maps] Failed to update import-map overrides in localStorage",e)}}let oT=!1;function o$(){!oT&&(oT=!0,(op="development"===window.spaEnv)&&(of=ob()))}function oO(e){return e.replace(/[\/\-@]/g,"_")}async function oN(e,t="./start",n){var a;let o,i=!n?.maxLoadingTime||n.maxLoadingTime<=0?6e5:n.maxLoadingTime;await Promise.race([oM(e,n?.importMap),new Promise((t,r)=>{o=setTimeout(()=>{var t;r(Error(`Could not resolve requested script, ${e}, within ${(t=i)<1e3?`${t} milliseconds`:t<6e4?`${Math.floor(t/1e3)} seconds`:t<36e5?`${Math.floor(t/6e4)} minutes`:t<864e5?`${Math.floor(t/36e5)} hours`:`${Math.floor(t/864e5)} days`}.`))},i)})]),o&&clearTimeout(o);let s=oO(e),l=window[s];if(!("object"==typeof(a=l)&&null!==a&&"init"in a&&"function"==typeof a.init&&"get"in a&&"function"==typeof a.get)){let e=`The global variable ${s} does not refer to a federated module`;throw console.error(e),Error(e)}l.init(r.S.default);let u=(await l.get(t))();if("object"!=typeof u||null===u){let t=`Container for ${e} did not return an ESM module as expected`;throw console.error(t),Error(t)}return u}async function oM(e,t){if("string"!=typeof e||0===e.trim().length){let e="Attempted to call importDynamic() without supplying a package to load";throw console.error(e),Error(e)}let r=oO(e);if(!window[r]){let r=t??await oI();if(!r.imports.hasOwnProperty(e)){let t=`Could not find the package ${e} defined in the current importmap`;throw console.error(t),Error(t)}let n=r.imports[e];n.startsWith("./")&&(n=window.spaBase+n.substring(1));let a=e in ox().imports;try{return await function(e){var t;let r=(t=window)[oj]??(t[oj]=new Map),n=r.get(e);if(n)return n;if(document.head.querySelector(`script[src="${e}"]`))return console.warn(`Script at ${e} already loaded. Not loading it again.`),Promise.resolve();let a=document.createElement("script");a.src=e,a.type="text/javascript",a.async=!0;let o=new Promise((t,n)=>{let o=setTimeout(()=>{console.error(`The script at ${e} did not load within 5 seconds. This may indicate an issue with the imports in the script's entry-point file or with the script's bundler configuration.`)},5e3);function i(){clearTimeout(o),a.removeEventListener("load",s),a.removeEventListener("error",l)}function s(){i(),t()}function l(t){i(),r.delete(e),a.remove();let o=`Failed to load script from ${e}`;console.error(o,t),n(t.message??o)}a.addEventListener("load",s),a.addEventListener("error",l),document.head.appendChild(a)});return r.set(e,o),o}(n)}catch(e){return a&&E({kind:"error",title:aO("scriptLoadingFailed","Error: Script failed to load"),description:aO("scriptLoadingError","Failed to load overridden script from {{- url}}. Please check that the bundled script is available at the expected URL. Click the button below to reset all import map overrides.",{url:n}),actionButtonLabel:aO("resetOverrides","Reset overrides"),onActionButtonClick(){oP(),window.location.reload()}}),Promise.reject(e)}}return Promise.resolve()}async function oI(){return ow()}let oj=Symbol.for("__openmrs_script_loading");function oA(e){return!!e&&"object"==typeof e&&!(Object.hasOwn(e,"pages")&&(!e.pages||!Array.isArray(e.pages))||Object.hasOwn(e,"extensions")&&(!e.extensions||!Array.isArray(e.extensions))||Object.hasOwn(e,"modals")&&(!e.modals||!Array.isArray(e.modals))||Object.hasOwn(e,"workspaces2")&&(!e.workspaces2||!Array.isArray(e.workspaces2))||Object.hasOwn(e,"workspaceWindows2")&&(!e.workspaceWindows2||!Array.isArray(e.workspaceWindows2))||Object.hasOwn(e,"workspaceGroups2")&&(!e.workspaceGroups2||!Array.isArray(e.workspaceGroups2)))}function oL(e){return!!e&&"object"==typeof e&&"routes"in e&&!!e.routes&&"object"==typeof e.routes&&Object.entries(e.routes).every(([e,t])=>"string"==typeof e&&oA(t))}let oF="openmrs-routes:",oB="openmrs-routes:change",oV=!1,oU=null,oW=null;async function oH(){return oW??(oW=oz().then(({map:e,complete:t})=>(t||(oW=null),e))),oW}async function oz(){let e=document.querySelectorAll("script[type='openmrs-routes']"),t=[],r=!0;for(let n=0;n<e.length;n++){let a=e[n];try{let e;if(a.src){let t=await fetch(a.src);if(!t.ok)throw Error(`Request for ${a.src} returned ${t.status} ${t.statusText}`);e=await t.json()}else a.textContent&&(e=JSON.parse(a.textContent));e&&oL(e)&&t.push(e)}catch(e){r=!1,console.warn(`[route-maps] Failed to parse routes from script tag at index ${n}`,e)}}return{map:oK(t),complete:r}}function oK(e){let t={routes:{}};for(let r of e)r&&"object"==typeof r&&!Array.isArray(r)&&(Object.assign(t.routes,r.routes),void 0===t.version&&void 0!==r.version&&(t.version=r.version));return t}async function oG(){let e={version:void 0,routes:{}};try{let t=[];for(let e=0;e<localStorage.length;e++){let r=localStorage.key(e);if(r?.startsWith(oF)){let e=localStorage.getItem(r);e&&t.push({moduleName:r.slice(oF.length),raw:e})}}for(let r of(await Promise.allSettled(t.map(async({moduleName:e,raw:t})=>{let r=JSON.parse(t);if(oA(r))return{moduleName:e,routes:r};if("string"==typeof r&&r.startsWith("http")){let t=await fetch(r),n=await t.json();if(oA(n))return{moduleName:e,routes:n};throw Error(`${r} did not resolve to a valid OpenmrsAppRoutes object`)}throw Error(`Override for ${e} is neither a valid routes object nor a URL`)}))))"fulfilled"===r.status?e.routes[r.value.moduleName]=r.value.routes:console.warn("[route-maps] Failed to load route override",r.reason)}catch(e){console.warn("[route-maps] Failed to read route overrides from localStorage",e)}return e}async function oZ(){let e=await oH();return oV?oK([e,oU??await oG()]):e}async function oY(){return oH()}async function oq(){return oV?oK([await oH(),await oG()]):oH()}function oJ(){if(!oV)return{};let e={};try{for(let t=0;t<localStorage.length;t++){let r=localStorage.key(t);if(r?.startsWith(oF)){let t=localStorage.getItem(r);t&&(e[r.slice(oF.length)]=t)}}}catch(e){console.warn("[route-maps] Failed to read route overrides from localStorage",e)}return e}function oX(e,t){if(!oV)return void console.warn("[Security] Route overrides are disabled outside development mode.");try{if("string"==typeof t)if(t.startsWith("http"))localStorage.setItem(oF+e,JSON.stringify(t));else{let r=JSON.parse(t);if(!oA(r))return void console.error(`The supplied routes for ${e} is not a valid OpenmrsAppRoutes object`,t);localStorage.setItem(oF+e,JSON.stringify(r))}else if(t instanceof URL)localStorage.setItem(oF+e,JSON.stringify(t.toString()));else{if(!oA(t))return void console.error(`Override for ${e} is not in a valid format. Expected either a Javascript Object, a JSON string of a Javascript object, or a URL`,t);localStorage.setItem(oF+e,JSON.stringify(t))}window.dispatchEvent(new CustomEvent(oB))}catch(e){console.warn("[route-maps] Failed to write route override to localStorage",e)}}function oQ(e){if(!oV)return void console.warn("[Security] Route overrides are disabled outside development mode.");try{localStorage.removeItem(oF+e),window.dispatchEvent(new CustomEvent(oB))}catch(e){console.warn("[route-maps] Failed to remove route override from localStorage",e)}}function o0(){if(!oV)return void console.warn("[Security] Route overrides are disabled outside development mode.");try{let e=[];for(let t=0;t<localStorage.length;t++){let r=localStorage.key(t);r?.startsWith(oF)&&e.push(r)}e.forEach(e=>localStorage.removeItem(e)),window.dispatchEvent(new CustomEvent(oB))}catch(e){console.warn("[route-maps] Failed to clear route overrides from localStorage",e)}}let o1=null;function o4(){return o1||(o1=(oV="development"===window.spaEnv)?oG().then(e=>{oU=e}):Promise.resolve())}let o2=`${az}/attachment`;function o3(e,t){return aY(`${o2}/${e}`,{signal:t.signal})}function o6(e,t,r,n){return aY(o5(e,t,n),{signal:r.signal})}function o5(e,t,r){return r?`${o2}?patient=${e}&encounter=${r}`:`${o2}?patient=${e}&includeEncounterless=${t}`}async function o9(e,t,r){let n=new FormData;return n.append("fileCaption",t.fileDescription),n.append("patient",e),r&&n.append("encounter",r),t.file?n.append("file",t.file,t.fileName):(n.append("file",new File([""],t.fileName),t.fileName),n.append("base64Content",t.base64Content)),aY(`${o2}`,{method:"POST",body:n})}function o8(e,t){return aY(`${o2}/${e}`,{method:"DELETE",signal:t.signal})}async function o7(e,t){return e?(await aY(`${aK}/Patient/${e}`,t)).data:null}function ie(e,t){let r=new CustomEvent(`openmrs:${e}`,{detail:t??void 0,cancelable:!0,bubbles:!0});return window.dispatchEvent(r)}function it(e,t){let r=e=>{t("detail"in e&&null!==e.detail?e.detail:void 0)};return window.addEventListener(`openmrs:${e}`,r),()=>{window.removeEventListener(`openmrs:${e}`,r)}}function ir(e){return{uuid:e.uuid,display:e.display}}function ia(e=null,t=null){let r=new URLSearchParams;e&&r.set("tag",e),t&&r.set("q",t);let n=r.toString();return aY(`${az}/location${n?"?"+n:""}`).then(e=>e.data.results.map(ir))}function io(e){return{uuid:e.uuid,display:e.display,name:e.name}}let ii=`${az}/visittype`;function is(e=ii){return aY(e).then(e=>e.data.results.map(io))}var il=((et={}).NEWVISIT="startVisit",et.EDITVISIT="editVisit",et.LOADING="loadingVisit",et),iu=((er={}).NOTSTARTED="notStarted",er.ONGOING="ongoing",er);let ic="custom:(uuid,display,voided,indication,startDatetime,stopDatetime,encounters:(uuid,display,encounterDatetime,form:(uuid,name),location:ref,encounterType:ref,encounterProviders:(uuid,display,provider:(uuid,display))),patient:(uuid,display),visitType:(uuid,name,display),attributes:(uuid,display,attributeType:(name,datatypeClassname,uuid),value),location:(uuid,name,display))",id=function(){try{return JSON.parse(sessionStorage.getItem("openmrs:visitStoreState")||"null")}catch(e){return null}}()||{patientUuid:null,manuallySetVisitUuid:null};function im(){return W("visit",id)}function ip(e,t){im().setState({patientUuid:e,manuallySetVisitUuid:t})}function ih(e,t){return aY(`${az}/visit`,{signal:t.signal,method:"POST",headers:{"Content-type":"application/json"},body:e})}function ig(e,t,r){return aY(`${az}/visit/${e}`,{signal:r.signal,method:"POST",headers:{"Content-type":"application/json"},body:t})}function iy(e,t,r){return aY(`${az}/visit?patient=${e}&v=${r??ic}`,{signal:t.signal,method:"GET",headers:{"Content-type":"application/json"}})}im().subscribe(e=>{var t;t=e,sessionStorage.setItem("openmrs:visitStoreState",JSON.stringify(t))});class iv{static get version(){return"1.4.0"}static toString(){return"JavaScript Expression Parser (JSEP) v"+iv.version}static addUnaryOp(e){return iv.max_unop_len=Math.max(e.length,iv.max_unop_len),iv.unary_ops[e]=1,iv}static addBinaryOp(e,t,r){return iv.max_binop_len=Math.max(e.length,iv.max_binop_len),iv.binary_ops[e]=t,r?iv.right_associative.add(e):iv.right_associative.delete(e),iv}static addIdentifierChar(e){return iv.additional_identifier_chars.add(e),iv}static addLiteral(e,t){return iv.literals[e]=t,iv}static removeUnaryOp(e){return delete iv.unary_ops[e],e.length===iv.max_unop_len&&(iv.max_unop_len=iv.getMaxKeyLen(iv.unary_ops)),iv}static removeAllUnaryOps(){return iv.unary_ops={},iv.max_unop_len=0,iv}static removeIdentifierChar(e){return iv.additional_identifier_chars.delete(e),iv}static removeBinaryOp(e){return delete iv.binary_ops[e],e.length===iv.max_binop_len&&(iv.max_binop_len=iv.getMaxKeyLen(iv.binary_ops)),iv.right_associative.delete(e),iv}static removeAllBinaryOps(){return iv.binary_ops={},iv.max_binop_len=0,iv}static removeLiteral(e){return delete iv.literals[e],iv}static removeAllLiterals(){return iv.literals={},iv}get char(){return this.expr.charAt(this.index)}get code(){return this.expr.charCodeAt(this.index)}constructor(e){this.expr=e,this.index=0}static parse(e){return new iv(e).parse()}static getMaxKeyLen(e){return Math.max(0,...Object.keys(e).map(e=>e.length))}static isDecimalDigit(e){return e>=48&&e<=57}static binaryPrecedence(e){return iv.binary_ops[e]||0}static isIdentifierStart(e){return e>=65&&e<=90||e>=97&&e<=122||e>=128&&!iv.binary_ops[String.fromCharCode(e)]||iv.additional_identifier_chars.has(String.fromCharCode(e))}static isIdentifierPart(e){return iv.isIdentifierStart(e)||iv.isDecimalDigit(e)}throwError(e){let t=Error(e+" at character "+this.index);throw t.index=this.index,t.description=e,t}runHook(e,t){if(iv.hooks[e]){let r={context:this,node:t};return iv.hooks.run(e,r),r.node}return t}searchHook(e){if(iv.hooks[e]){let t={context:this};return iv.hooks[e].find(function(e){return e.call(t.context,t),t.node}),t.node}}gobbleSpaces(){let e=this.code;for(;e===iv.SPACE_CODE||e===iv.TAB_CODE||e===iv.LF_CODE||e===iv.CR_CODE;)e=this.expr.charCodeAt(++this.index);this.runHook("gobble-spaces")}parse(){this.runHook("before-all");let e=this.gobbleExpressions(),t=1===e.length?e[0]:{type:iv.COMPOUND,body:e};return this.runHook("after-all",t)}gobbleExpressions(e){let t=[],r,n;for(;this.index<this.expr.length;)if((r=this.code)===iv.SEMCOL_CODE||r===iv.COMMA_CODE)this.index++;else if(n=this.gobbleExpression())t.push(n);else if(this.index<this.expr.length){if(r===e)break;this.throwError('Unexpected "'+this.char+'"')}return t}gobbleExpression(){let e=this.searchHook("gobble-expression")||this.gobbleBinaryExpression();return this.gobbleSpaces(),this.runHook("after-expression",e)}gobbleBinaryOp(){this.gobbleSpaces();let e=this.expr.substr(this.index,iv.max_binop_len),t=e.length;for(;t>0;){if(iv.binary_ops.hasOwnProperty(e)&&(!iv.isIdentifierStart(this.code)||this.index+e.length<this.expr.length&&!iv.isIdentifierPart(this.expr.charCodeAt(this.index+e.length))))return this.index+=t,e;e=e.substr(0,--t)}return!1}gobbleBinaryExpression(){let e,t,r,n,a,o,i,s,l;if(!(o=this.gobbleToken())||!(t=this.gobbleBinaryOp()))return o;for(a={value:t,prec:iv.binaryPrecedence(t),right_a:iv.right_associative.has(t)},(i=this.gobbleToken())||this.throwError("Expected expression after "+t),n=[o,a,i];t=this.gobbleBinaryOp();){if(0===(r=iv.binaryPrecedence(t))){this.index-=t.length;break}a={value:t,prec:r,right_a:iv.right_associative.has(t)},l=t;let s=e=>a.right_a&&e.right_a?r>e.prec:r<=e.prec;for(;n.length>2&&s(n[n.length-2]);)i=n.pop(),t=n.pop().value,o=n.pop(),e={type:iv.BINARY_EXP,operator:t,left:o,right:i},n.push(e);(e=this.gobbleToken())||this.throwError("Expected expression after "+l),n.push(a,e)}for(s=n.length-1,e=n[s];s>1;)e={type:iv.BINARY_EXP,operator:n[s-1].value,left:n[s-2],right:e},s-=2;return e}gobbleToken(){let e,t,r,n;if(this.gobbleSpaces(),n=this.searchHook("gobble-token"))return this.runHook("after-token",n);if(e=this.code,iv.isDecimalDigit(e)||e===iv.PERIOD_CODE)return this.gobbleNumericLiteral();if(e===iv.SQUOTE_CODE||e===iv.DQUOTE_CODE)n=this.gobbleStringLiteral();else if(e===iv.OBRACK_CODE)n=this.gobbleArray();else{for(r=(t=this.expr.substr(this.index,iv.max_unop_len)).length;r>0;){if(iv.unary_ops.hasOwnProperty(t)&&(!iv.isIdentifierStart(this.code)||this.index+t.length<this.expr.length&&!iv.isIdentifierPart(this.expr.charCodeAt(this.index+t.length)))){this.index+=r;let e=this.gobbleToken();return e||this.throwError("missing unaryOp argument"),this.runHook("after-token",{type:iv.UNARY_EXP,operator:t,argument:e,prefix:!0})}t=t.substr(0,--r)}iv.isIdentifierStart(e)?(n=this.gobbleIdentifier(),iv.literals.hasOwnProperty(n.name)?n={type:iv.LITERAL,value:iv.literals[n.name],raw:n.name}:n.name===iv.this_str&&(n={type:iv.THIS_EXP})):e===iv.OPAREN_CODE&&(n=this.gobbleGroup())}return n?(n=this.gobbleTokenProperty(n),this.runHook("after-token",n)):this.runHook("after-token",!1)}gobbleTokenProperty(e){this.gobbleSpaces();let t=this.code;for(;t===iv.PERIOD_CODE||t===iv.OBRACK_CODE||t===iv.OPAREN_CODE||t===iv.QUMARK_CODE;){let r;if(t===iv.QUMARK_CODE){if(this.expr.charCodeAt(this.index+1)!==iv.PERIOD_CODE)break;r=!0,this.index+=2,this.gobbleSpaces(),t=this.code}this.index++,t===iv.OBRACK_CODE?((e={type:iv.MEMBER_EXP,computed:!0,object:e,property:this.gobbleExpression()}).property||this.throwError('Unexpected "'+this.char+'"'),this.gobbleSpaces(),(t=this.code)!==iv.CBRACK_CODE&&this.throwError("Unclosed ["),this.index++):t===iv.OPAREN_CODE?e={type:iv.CALL_EXP,arguments:this.gobbleArguments(iv.CPAREN_CODE),callee:e}:(t===iv.PERIOD_CODE||r)&&(r&&this.index--,this.gobbleSpaces(),e={type:iv.MEMBER_EXP,computed:!1,object:e,property:this.gobbleIdentifier()}),r&&(e.optional=!0),this.gobbleSpaces(),t=this.code}return e}gobbleNumericLiteral(){let e="",t,r;for(;iv.isDecimalDigit(this.code);)e+=this.expr.charAt(this.index++);if(this.code===iv.PERIOD_CODE)for(e+=this.expr.charAt(this.index++);iv.isDecimalDigit(this.code);)e+=this.expr.charAt(this.index++);if("e"===(t=this.char)||"E"===t){for(e+=this.expr.charAt(this.index++),("+"===(t=this.char)||"-"===t)&&(e+=this.expr.charAt(this.index++));iv.isDecimalDigit(this.code);)e+=this.expr.charAt(this.index++);iv.isDecimalDigit(this.expr.charCodeAt(this.index-1))||this.throwError("Expected exponent ("+e+this.char+")")}return r=this.code,iv.isIdentifierStart(r)?this.throwError("Variable names cannot start with a number ("+e+this.char+")"):(r===iv.PERIOD_CODE||1===e.length&&e.charCodeAt(0)===iv.PERIOD_CODE)&&this.throwError("Unexpected period"),{type:iv.LITERAL,value:parseFloat(e),raw:e}}gobbleStringLiteral(){let e="",t=this.index,r=this.expr.charAt(this.index++),n=!1;for(;this.index<this.expr.length;){let t=this.expr.charAt(this.index++);if(t===r){n=!0;break}if("\\"===t)switch(t=this.expr.charAt(this.index++)){case"n":e+="\n";break;case"r":e+="\r";break;case"t":e+=" ";break;case"b":e+="\b";break;case"f":e+="\f";break;case"v":e+="\v";break;default:e+=t}else e+=t}return n||this.throwError('Unclosed quote after "'+e+'"'),{type:iv.LITERAL,value:e,raw:this.expr.substring(t,this.index)}}gobbleIdentifier(){let e=this.code,t=this.index;for(iv.isIdentifierStart(e)?this.index++:this.throwError("Unexpected "+this.char);this.index<this.expr.length;)if(e=this.code,iv.isIdentifierPart(e))this.index++;else break;return{type:iv.IDENTIFIER,name:this.expr.slice(t,this.index)}}gobbleArguments(e){let t=[],r=!1,n=0;for(;this.index<this.expr.length;){this.gobbleSpaces();let a=this.code;if(a===e){r=!0,this.index++,e===iv.CPAREN_CODE&&n&&n>=t.length&&this.throwError("Unexpected token "+String.fromCharCode(e));break}if(a===iv.COMMA_CODE){if(this.index++,++n!==t.length){if(e===iv.CPAREN_CODE)this.throwError("Unexpected token ,");else if(e===iv.CBRACK_CODE)for(let e=t.length;e<n;e++)t.push(null)}}else if(t.length!==n&&0!==n)this.throwError("Expected comma");else{let e=this.gobbleExpression();e&&e.type!==iv.COMPOUND||this.throwError("Expected comma"),t.push(e)}}return r||this.throwError("Expected "+String.fromCharCode(e)),t}gobbleGroup(){this.index++;let e=this.gobbleExpressions(iv.CPAREN_CODE);if(this.code===iv.CPAREN_CODE)return(this.index++,1===e.length)?e[0]:!!e.length&&{type:iv.SEQUENCE_EXP,expressions:e};this.throwError("Unclosed (")}gobbleArray(){return this.index++,{type:iv.ARRAY_EXP,elements:this.gobbleArguments(iv.CBRACK_CODE)}}}Object.assign(iv,{hooks:new class{add(e,t,r){if("string"!=typeof arguments[0])for(let e in arguments[0])this.add(e,arguments[0][e],arguments[1]);else(Array.isArray(e)?e:[e]).forEach(function(e){this[e]=this[e]||[],t&&this[e][r?"unshift":"push"](t)},this)}run(e,t){this[e]=this[e]||[],this[e].forEach(function(e){e.call(t&&t.context?t.context:t,t)})}},plugins:new class{constructor(e){this.jsep=e,this.registered={}}register(...e){e.forEach(e=>{if("object"!=typeof e||!e.name||!e.init)throw Error("Invalid JSEP plugin format");this.registered[e.name]||(e.init(this.jsep),this.registered[e.name]=e)})}}(iv),COMPOUND:"Compound",SEQUENCE_EXP:"SequenceExpression",IDENTIFIER:"Identifier",MEMBER_EXP:"MemberExpression",LITERAL:"Literal",THIS_EXP:"ThisExpression",CALL_EXP:"CallExpression",UNARY_EXP:"UnaryExpression",BINARY_EXP:"BinaryExpression",ARRAY_EXP:"ArrayExpression",TAB_CODE:9,LF_CODE:10,CR_CODE:13,SPACE_CODE:32,PERIOD_CODE:46,COMMA_CODE:44,SQUOTE_CODE:39,DQUOTE_CODE:34,OPAREN_CODE:40,CPAREN_CODE:41,OBRACK_CODE:91,CBRACK_CODE:93,QUMARK_CODE:63,SEMCOL_CODE:59,COLON_CODE:58,unary_ops:{"-":1,"!":1,"~":1,"+":1},binary_ops:{"||":1,"??":1,"&&":2,"|":3,"^":4,"&":5,"==":6,"!=":6,"===":6,"!==":6,"<":7,">":7,"<=":7,">=":7,"<<":8,">>":8,">>>":8,"+":9,"-":9,"*":10,"/":10,"%":10,"**":11},right_associative:new Set(["**"]),additional_identifier_chars:new Set(["$","_"]),literals:{true:!0,false:!1,null:null},this_str:"this"}),iv.max_unop_len=iv.getMaxKeyLen(iv.unary_ops),iv.max_binop_len=iv.getMaxKeyLen(iv.binary_ops);let ib=e=>new iv(e).parse(),iw=Object.getOwnPropertyNames(class{});Object.getOwnPropertyNames(iv).filter(e=>!iw.includes(e)&&void 0===ib[e]).forEach(e=>{ib[e]=iv[e]}),ib.Jsep=iv,ib.plugins.register({name:"ternary",init(e){e.hooks.add("after-expression",function(t){if(t.node&&this.code===e.QUMARK_CODE){this.index++;let r=t.node,n=this.gobbleExpression();if(n||this.throwError("Expected expression"),this.gobbleSpaces(),this.code===e.COLON_CODE){this.index++;let a=this.gobbleExpression();if(a||this.throwError("Expected expression"),t.node={type:"ConditionalExpression",test:r,consequent:n,alternate:a},r.operator&&e.binary_ops[r.operator]<=.9){let n=r;for(;n.right.operator&&e.binary_ops[n.right.operator]<=.9;)n=n.right;t.node.test=n.right,n.right=t.node,t.node=r}}else this.throwError("Expected :")}})}});let iE="ArrowFunctionExpression",iD={Array,Boolean,Symbol,Infinity,NaN,Math,Number,BigInt,String,RegExp,JSON,isFinite,isNaN,parseFloat,parseInt,decodeURI,encodeURI,encodeURIComponent,Object:{__proto__:void 0,assign:Object.assign.bind(null),fromEntries:Object.fromEntries.bind(null),hasOwn:Object.hasOwn.bind(null),keys:Object.keys.bind(null),is:Object.is.bind(null),values:Object.values.bind(null)}},ix={...iD,Promise};function i_(e,t={}){return iT(e,t,iN)}async function iS(e,t={}){return i$(e,t,iN)}function iC(e,t={}){return iT(e,t,iM)}function ik(e,t={}){return i$(e,t,iM)}function iP(e,t={}){return iT(e,t,iI)}function iR(e,t={}){return i$(e,t,iI)}function iT(e,t={},r){if("string"!=typeof e&&("object"!=typeof e||!e||!("type"in e)))throw`Unknown expression type ${e}. Expressions must either be a string or pre-compiled string.`;if("string"==typeof e&&0===e.trim().length)throw{type:"Empty expression",message:"Expression cannot be an empty string"};null==t&&(t={});let n=iB(t,iD),a=ij("string"==typeof e?ib(e):e,n);if(r(a))return a;throw{type:"Invalid result",message:"string"==typeof e?`The expression ${e} did not produce a valid result`:"The expression did not produce a valid result"}}async function i$(e,t={},r){if("string"!=typeof e&&("object"!=typeof e||!e||!("type"in e)))return Promise.reject(`Unknown expression type ${e}. Expressions must either be a string or pre-compiled string.`);if("string"==typeof e&&0===e.trim().length)throw{type:"Empty expression",message:"Expression cannot be an empty string"};null==t&&(t={});let n=iB(t,ix);return Promise.resolve(ij("string"==typeof e?ib(e):e,n)).then(t=>{if(r(t))return t;throw{type:"Invalid result",message:"string"==typeof e?`The expression ${e} did not produce a valid result`:"The expression did not produce a valid result"}})}function iO(e){return ib(e)}function iN(e){return"string"==typeof e||"number"==typeof e||"boolean"==typeof e||null==e||e instanceof Date}function iM(e){return"boolean"==typeof e}function iI(e){return"number"==typeof e}function ij(e,t){switch(e.type){case"UnaryExpression":var r,n,a,o,i,s,l,u,c,d,m,p,f,h=e,g=t;let y=ij(h.argument,g);switch(h.operator){case"+":return+y;case"-":return-y;case"~":return~y;case"!":return!y;default:throw`Expression evaluator does not support operator '${h.operator}''`}case"BinaryExpression":var v=e,b=t;switch(v.operator){case"&&":return ij(v.left,b)&&ij(v.right,b);case"||":return ij(v.left,b)||ij(v.right,b);case"??":return ij(v.left,b)??ij(v.right,b)}let w=ij(v.left,b),E=ij(v.right,b);switch(v.operator){case"+":return w+E;case"-":return w-E;case"*":return w*E;case"/":return w/E;case"%":return w%E;case"**":return w**E;case"==":return w==E;case"===":return w===E;case"!=":return w!=E;case"!==":return w!==E;case">":return w>E;case">=":return w>=E;case"<":return w<E;case"<=":return w<=E;case"in":return w in E;default:throw`Expression evaluator does not support operator '${v.operator}' operator`}case"ConditionalExpression":return r=e,n=t,ij(r.test,n)?ij(r.consequent,n):ij(r.alternate,n);case"CallExpression":return iW(iL(e,t));case"ArrowFunctionExpression":let D;return a=e,o=t,D=a.params?.map(e=>{if("Identifier"===e.type)return e.name;throw`Cannot handle parameter of type ${e.type}`})??[],(function(...e){if(e.length<D.length)throw`Required argument(s) ${D.slice(e.length,-1).join(", ")} were not provided`;let t=Object.fromEntries(D.reduce((t,r,n)=>{let a=e[n];return function e(t){if("string"==typeof t||"number"==typeof t||"boolean"==typeof t||"function"==typeof t||null===t||t instanceof RegExp)return!0;if("object"==typeof t){for(let r of Object.keys(t))if(!e(t[r]))return!1;return!0}if(Array.isArray(t)){for(let r of t)if(!e(r))break}return!1}(a)&&t.push([r,a]),t},[]));return ij(a.body,o.addVariables(t))}).bind(null);case"MemberExpression":return iW(iF(e,t));case"ArrayExpression":return i=e,s=t,i.elements?.map(iH(s));case"SequenceExpression":let x;return l=e,u=t,(x=l.expressions.map(iH(u)))[x.length-1];case"NewExpression":var _=e,S=t;if(_.callee&&"Identifier"===_.callee.type){let e=_.arguments?.map(iH(S));switch(_.callee.name){case"Date":return new Date(...e);case"RegExp":return new RegExp(...e);default:throw`Cannot instantiate object of type ${_.callee.name}`}}if(_.callee)throw"new must be called with either Date or RegExp";throw'Could not handle "new" without a specified class';case"Literal":return e.value;case"Identifier":return c=e,d=t,(iz(c.name),d.variables&&Object.hasOwn(d.variables,c.name))?d.variables[c.name]:Object.hasOwn(d.globals,c.name)?d.globals[c.name]:void 0;case"TemplateLiteral":let C,k;return m=e,p=t,C=m.expressions?.map(iH(p))??[],(k=m.quasis?.map(iH(p))??[]).filter(e=>!e.tail).map(e=>e.value).join("")+C.join("")+k.filter(e=>e.tail).map(e=>e.value).join("");case"TemplateElement":return{value:(f=e).cooked,tail:f.tail};default:throw`Expression evaluator does not support expression of type '${e.type}'`}}function iA(e,t){switch(e.type){case"Literal":return e.value;case"Identifier":return e.name;case"MemberExpression":return iA(e.property,t);default:throw`VisitExpressionName does not support expression of type '${e.type}'`}}function iL(e,t){let r=iU(e.callee,t);if(r===iV||e.optional&&null==r)return iV;let n=e.arguments?.map(iH(t));if(r){if("function"!=typeof r)throw`${iZ(e.callee)} is not a function`}else throw`No function named ${iZ(e.callee)} is defined in this context`;return r(...n)}function iF(e,t){let r=iU(e.object,t);if(r===iV||e.optional&&null==r)return iV;if(null===r)throw TypeError(`TypeError: cannot read properties of null (reading '${iG(e.property,t)}')`);if(void 0===r)switch(e.object.type){case"Identifier":{let r=iA(e.object,t);throw ReferenceError(`ReferenceError: ${r} is not defined`)}case"MemberExpression":throw TypeError(`TypeError: cannot read properties of undefined (reading '${iG(e.property,t)}')`);default:throw`VisitMemberExpression does not support operator '${e.object.type}' type`}if("object"!=typeof r&&"function"!=typeof r&&"string"!=typeof r&&"number"!=typeof r)throw`VisitMemberExpression does not support member access on type ${typeof r}`;let n=e.computed?function(e){if(void 0===e)throw{type:"Illegal property access",message:"No property was supplied to the property access"};if("string"!=typeof e&&"number"!=typeof e)throw{type:"Illegal property access",message:`Cannot use a value of type ${null===e?"null":typeof e} as a property name`};return e}(ij(e.property,t)):function(e){if("Identifier"!==e.type)throw`VisitMemberExpression does not support a property of type '${e.type}'`;return e.name}(e.property);iz(n),function(e,t){if(iK.has(String(t)))return;let r=Object(e);for(;null!==r;){if(Object.hasOwn(r,t)){if(r===Object.prototype||r===Function.prototype)throw{type:"Illegal property access",message:`Cannot access the ${t} property of objects`};return}r=Object.getPrototypeOf(r)}}(r,n);let a=r[n];return"function"==typeof a?a.bind(r):a}function iB(e,t){let r={variables:{...e},globals:{...t},addVariables(e){return this.variables={...this.variables,...e},this}};return r.addVariables.bind(r),r}ib.plugins.register({name:"arrow",init(e){e.addBinaryOp("=>",.1,!0),e.hooks.add("gobble-expression",function(t){if(this.gobbleSpaces(),this.code===e.OPAREN_CODE){let r=this.index;if(this.index++,this.gobbleSpaces(),this.code===e.CPAREN_CODE){this.index++;let e=this.gobbleBinaryOp();if("=>"===e){let r=this.gobbleBinaryExpression();r||this.throwError("Expected expression after "+e),t.node={type:iE,params:null,body:r};return}}this.index=r}}),e.hooks.add("after-expression",function(t){!function t(r){r&&(Object.values(r).forEach(e=>{e&&"object"==typeof e&&t(e)}),"=>"===r.operator&&(r.type=iE,r.params=r.left?[r.left]:null,r.body=r.right,r.params&&r.params[0].type===e.SEQUENCE_EXP&&(r.params=r.params[0].expressions),delete r.left,delete r.right,delete r.operator))}(t.node)})}}),ib.plugins.register({name:"new",init(e){e.addUnaryOp("new"),e.hooks.add("after-token",function(t){let r=t.node;if(r&&"new"===r.operator){r.argument&&[e.CALL_EXP,e.MEMBER_EXP].includes(r.argument.type)||this.throwError("Expected new function()"),t.node=r.argument;let n=t.node;for(;n.type===e.MEMBER_EXP||n.type===e.CALL_EXP&&n.callee.type===e.MEMBER_EXP;)n=n.type===e.MEMBER_EXP?n.object:n.callee.object;n.type="NewExpression"}})}}),ib.plugins.register({name:"numbers",init(e){function t(e){return"x"===e||"X"===e?(this.index+=2,[[48,57],[65,70],[97,102]]):"b"===e||"B"===e?(this.index+=2,[[48,49]]):"o"===e||"O"===e||e>="0"&&e<="7"?(this.index+=e<="7"?1:2,[[48,55]]):null}function r(t){let r=this.index,n="",a=()=>{for(;e.isDecimalDigit(this.code)||95===this.code;)95===this.code?this.index++:n+=this.expr.charAt(this.index++)};a(),this.code===e.PERIOD_CODE&&(n+=this.expr.charAt(this.index++),a());let o=this.char;("e"===o||"E"===o)&&(n+=this.expr.charAt(this.index++),("+"===(o=this.char)||"-"===o)&&(n+=this.expr.charAt(this.index++)),a(),e.isDecimalDigit(this.expr.charCodeAt(this.index-1))||this.throwError("Expected exponent ("+n+this.char+")"));let i=this.code;if(e.isIdentifierStart(i))this.throwError("Variable names cannot start with a number ("+n+this.char+")");else if(i===e.PERIOD_CODE){n.length>1&&this.throwError(`Unexpected period ${JSON.stringify({chCode:i,number:n},null,2)}`),this.index=r;return}t.node={type:e.LITERAL,value:parseFloat(n),raw:this.expr.substring(r,this.index)}}e.hooks.add("gobble-token",function(n){if(48===this.code){var a,o,i;let s=this.index,l=this.expr.charAt(this.index+1),u=t.call(this,l);if(!u)return;let c="";for(;a=this.code,o=u,95===a||o.some(([e,t])=>a>=e&&a<=t);)95===this.code?this.index++:c+=this.expr.charAt(this.index++);if(e.isIdentifierPart(this.code)){if(e.isDecimalDigit(this.code)&&e.isDecimalDigit(l.charCodeAt(0))){this.index=s+1,r.call(this,n);return}this.throwError("unexpected char within number")}n.node={type:e.LITERAL,value:parseInt(c,"x"===(i=l)||"X"===i?16:"b"===i||"B"===i?2:8),raw:this.expr.substring(s,this.index)}}else(e.isDecimalDigit(this.code)||this.code===e.PERIOD_CODE)&&r.call(this,n)})}}),ib.plugins.register({name:"regex",init(e){e.hooks.add("gobble-token",function(t){if(47===this.code){let r=++this.index,n=!1;for(;this.index<this.expr.length;){if(47===this.code&&!n){let n,a=this.expr.slice(r,this.index),o="";for(;++this.index<this.expr.length;){let e=this.code;if(e>=97&&e<=122||e>=65&&e<=90||e>=48&&e<=57)o+=this.char;else break}try{n=new RegExp(a,o)}catch(e){this.throwError(e.message)}return t.node={type:e.LITERAL,value:n,raw:this.expr.slice(r-1,this.index)},t.node=this.gobbleTokenProperty(t.node),t.node}this.code===e.OBRACK_CODE?n=!0:n&&this.code===e.CBRACK_CODE&&(n=!1),this.index+=92===this.code?2:1}this.throwError("Unclosed Regex")}})}}),ib.plugins.register({name:"ternary",init(e){e.hooks.add("after-expression",function(t){if(t.node&&this.code===e.QUMARK_CODE){this.index++;let r=t.node,n=this.gobbleExpression();if(n||this.throwError("Expected expression"),this.gobbleSpaces(),this.code===e.COLON_CODE){this.index++;let a=this.gobbleExpression();if(a||this.throwError("Expected expression"),t.node={type:"ConditionalExpression",test:r,consequent:n,alternate:a},r.operator&&e.binary_ops[r.operator]<=.9){let n=r;for(;n.right.operator&&e.binary_ops[n.right.operator]<=.9;)n=n.right;t.node.test=n.right,n.right=t.node,t.node=r}}else this.throwError("Expected :")}})}}),ib.plugins.register({name:"jsepTemplateLiteral",init(e){function t(e,r=!0){if(96===this.code){let t={type:"TemplateLiteral",quasis:[],expressions:[]},n="",a="",o=!1,i=this.expr.length,s=()=>t.quasis.push({type:"TemplateElement",value:{raw:a,cooked:n},tail:o});for(;this.index<i;){let i=this.expr.charAt(++this.index);if("`"===i)return this.index+=1,o=!0,s(),e.node=t,r&&(e.node=this.gobbleTokenProperty(e.node)),e.node;if("$"===i&&"{"===this.expr.charAt(this.index+1))this.index+=2,s(),a="",n="",t.expressions.push(...this.gobbleExpressions(125)),125!==this.code&&this.throwError("unclosed ${");else if("\\"===i)switch(a+=i,i=this.expr.charAt(++this.index),a+=i,i){case"n":n+="\n";break;case"r":n+="\r";break;case"t":n+=" ";break;case"b":n+="\b";break;case"f":n+="\f";break;case"v":n+="\v";break;default:n+=i}else n+=i,a+=i}this.throwError("Unclosed `")}}e.hooks.add("gobble-token",t),e.hooks.add("after-token",function(r){if((r.node.type===e.IDENTIFIER||r.node.type===e.MEMBER_EXP)&&96===this.code)return r.node={type:"TaggedTemplateExpression",tag:r.node,quasi:t.bind(this)(r,!1)},r.node=this.gobbleTokenProperty(r.node),r.node})}}),ib.addBinaryOp("in",7),ib.addBinaryOp("??",1);let iV=Symbol("optional chain short-circuited");function iU(e,t){switch(e.type){case"MemberExpression":return iF(e,t);case"CallExpression":return iL(e,t);default:return ij(e,t)}}function iW(e){return e===iV?void 0:e}function iH(e){return function(t){return null===t?null:ij(t,e)}}function iz(e){if("__proto__"===e||"prototype"===e||"constructor"===e)throw{type:"Illegal property access",message:`Cannot access the ${e} property of objects`}}let iK=new Set(["toString","valueOf","hasOwnProperty"]);function iG(e,t){try{return iA(e,t)}catch{return"<computed>"}}function iZ(e){return e?"MemberExpression"===e.type?e.property?.name:e.name:null}function iY(e){if("string"!=typeof e&&("object"!=typeof e||!e||!("type"in e)))throw`Unknown expression type ${e}. Expressions must either be a string or pre-compiled string.`;let t={globals:{...ix},boundNames:new Set,variables:new Set};return iq("string"==typeof e?ib(e):e,t),[...t.variables]}function iq(e,t){switch(e.type){case"UnaryExpression":return r=e,n=t,void iq(r.argument,n);case"BinaryExpression":return a=e,o=t,void(iq(a.left,o),iq(a.right,o));case"ConditionalExpression":return i=e,s=t,void(iq(i.consequent,s),iq(i.test,s),iq(i.alternate,s));case"CallExpression":return l=e,u=t,void(iq(l.callee,u),l.arguments?.map(iJ(u)));case"ArrowFunctionExpression":var r,n,a,o,i,s,l,u,c,d,m,p,f,h,g,y,v,b,w,E,D=e,x=t;let _=new Set(x.boundNames);for(let e of D.params??[])e?.type==="Identifier"&&_.add(e.name);iq(D.body,{...x,boundNames:_});return;case"MemberExpression":return c=e,d=t,void(iq(c.object,d),c.computed&&iq(c.property,d));case"ArrayExpression":return m=e,p=t,void m.elements?.map(iJ(p));case"SequenceExpression":return f=e,h=t,void f.expressions?.map(iJ(h));case"NewExpression":return g=e,y=t,void g.arguments?.map(iJ(y));case"Literal":case"TemplateElement":return;case"Identifier":return v=e,b=t,void(v.name in b.globals||b.boundNames.has(v.name)||b.variables.add(v.name));case"TemplateLiteral":return w=e,E=t,void(w.expressions?.map(iJ(E)),w.quasis?.map(iJ(E)));default:throw`Expression evaluator does not support expression of type '${e.type}'`}}function iJ(e){return function(t){return null===t?null:iq(t,e)}}let iX=W("feature-flags",{flags:function(){let e={};for(let t of Object.keys(localStorage))if(t.startsWith("openmrs:feature-flag:")){let r=t.replace("openmrs:feature-flag:",""),n=JSON.parse(localStorage.getItem(`openmrs:feature-flag-meta:${r}`)||"{}");e[r]={enabled:"true"===localStorage.getItem(t),...n}}return e}()});function iQ(e,t,r){iX.setState(n=>({flags:{...n.flags,[e]:{enabled:n.flags[e]?.enabled??!1,label:t,description:r}}}))}function i0(){let e=iX.getState().flags;Object.keys(localStorage).filter(e=>e.startsWith("openmrs:feature-flag:")).forEach(t=>{let r=t.replace("openmrs:feature-flag:","");e[r]||(localStorage.removeItem(t),localStorage.removeItem(`openmrs:feature-flag-meta:${r}`))})}function i1(e){return iX.getState().flags[e].enabled}function i4(e,t){iX.subscribe(r=>{t(r.flags[e].enabled)})}function i2(e,t){iX.setState(r=>({flags:{...r.flags,[e]:{...r.flags[e],enabled:t}}}))}iX.subscribe(e=>{for(let[t,r]of Object.entries(e.flags))localStorage.setItem(`openmrs:feature-flag:${t}`,r.enabled.toString()),localStorage.setItem(`openmrs:feature-flag-meta:${t}`,JSON.stringify({label:r.label,description:r.description}))});var i3=tG(function(e,t,r){tF(e,t,r)});let i6=B("extensionsInternal",{slots:{},extensions:{}}),i5=B("extensionRenderings",{renderings:new Map}),i9=()=>W("extensionsInternal",{slots:{},extensions:{}}),i8=()=>W("extensionRenderings",{renderings:new Map});function i7(e){let t=i6.getState(),r=e(t);r!==t&&i6.setState(r)}let se=null,st=null;function sr(){let e=i5.getState();return se&&e===st||(se=new Map(e.renderings),st=e,function(e){for(let t of(sm.clear(),e.values()))sf(t,1);sp=!0}(se)),se}function sn(e){st={renderings:e},i5.setState(st,!0)}function sa(e){let t=sr();t.has(e.renderingId)||(t.set(e.renderingId,e),sf(e,1),sn(t))}function so(e){let t=sr(),r=t.get(e);r&&(t.delete(e),sf(r,-1),sn(t))}let si=()=>W("extensions",{slots:{}}),ss=0,sl=new Set;function su(e){ss++;try{return e()}finally{if(0==--ss&&sl.size>0){let e=Array.from(sl);for(let t of(sl.clear(),e))sc(t)}}}function sc(e){try{e()}catch(t){console.error(`The extension system's '${e.name}' recomputation failed`,t)}}function sd(e){ss>0?sl.add(e):sc(e)}let sm=new Map,sp=!1;function sf(e,t){let r=JSON.stringify([e.slotName,e.extensionId,e.slotModuleName,e.extensionModuleName]),n=sm.get(r);if(!n){if(t<0)return;sm.set(r,{count:1,record:{slotModuleName:e.slotModuleName,extensionModuleName:e.extensionModuleName,slotName:e.slotName,extensionId:e.extensionId}}),sp=!0;return}n.count+=t,n.count<1&&(sm.delete(r),sp=!0)}function sh(){var e,t;if(sr(),!sp)return;sp=!1;let r=Array.from(sm.values(),({record:e})=>e);r.sort(sg),e=nE.getState().mountedExtensions,t=r,e.length===t.length&&e.every((e,r)=>0===sg(e,t[r]))||nE.setState({mountedExtensions:r})}function sg(e,t){return sy(e.slotName,t.slotName)||sy(e.extensionId,t.extensionId)||sy(e.slotModuleName,t.slotModuleName)||sy(e.extensionModuleName,t.extensionModuleName)}function sy(e,t){return e===t?0:e<t?-1:1}sh(),i5.subscribe(()=>sd(sh));let sv=i9(),sb=si(),sw=nx(),sE=nC(),sD=new Set,sx=!1;function s_(e){if(null===e)sD=null;else if(null!==sD)for(let t of e)sD.add(t);sd(sS)}function sS(){if(!sx){sx=!0;try{for(let e=1;;e++){let t=sD;if(null!==t&&0===t.size)return;sD=new Set;try{!function(e,t,r,n,a,o=null){let i=sb.getState().slots,s={},l=!1,u=Object.entries(n.flags).filter(([,{enabled:e}])=>e).map(([e])=>e);for(let[n,c]of Object.entries(e.slots)){let d=i[n];if(d&&o&&!o.has(n)){s[n]=d;continue}let{config:m}=nS(t,c.name),p=function(e,t,r,n,a,o){let i=function(e,t){let r=e.add||[],n=e.remove||[],a=e.order||[],{extensions:o}=sv.getState(),i=new Set(n),s=[...t,...r].filter(e=>!i.has(e)),l=sI(a),u=sI(t),c=new Map(s.map(e=>[e,function(e,t,r,n){let a=t.get(e);if(void 0!==a)return a;{if(void 0!==r)return 1e3+r;let t=n.get(e);return void 0!==t?2e3+t:3e3}}(e,l,o[sP(e)]?.order,u)]));return s.sort((e,t)=>c.get(e)-c.get(t))}(r,t.slots[e].attachedIds),s=[];for(let l of i){let{config:i}=nk(n,e,l),u=nP(r,e,l),c=u?i3({},i,u):i,d=sP(l),m=t.extensions[d];if(m){let e=c?.["Display conditions"]?.privileges??m.privileges??[];if(e&&("string"==typeof e||Array.isArray(e)&&e.length>0)&&(!o?.user||!a5(e,o.user))||m.featureFlag&&!a.includes(m.featureFlag))continue;s.push({id:l,name:d,moduleName:m.moduleName,config:c,featureFlag:m.featureFlag,meta:m.meta,displayConditionExpression:c?.["Display conditions"]?.expression||m.displayExpression})}}return s}(n,e,m,r,u,a.session);d&&d.moduleName===c.moduleName&&rP(d.candidateExtensions,p)?s[n]=d:(s[n]={moduleName:c.moduleName,candidateExtensions:p},l=!0)}(l||Object.keys(i).length!==Object.keys(s).length)&&sb.setState({slots:s})}(sv.getState(),sw.getState(),sE.getState(),iX.getState(),aJ.getState(),t)}catch(e){throw sD=null===t||null===sD?null:new Set([...t,...sD]),e}if(e>=20)return void console.error("The extension system stopped recomputing after 20 passes because something keeps invalidating slots in response to the extension store being written. Some slots are left stale until the next write.")}}finally{sx=!1}}}function sC(e,t){let r=new Set;for(let n of Object.keys(e))e[n]!==t[n]&&r.add(n);for(let n of Object.keys(t))n in e||r.add(n);return r}function sk(e,t){return{moduleName:t,name:e,attachedIds:[]}}function sP(e){let[t]=e.split("#");return t}function sR(e,t){let r=sP(t);return e.extensions[r]}function sT(e){return sR(sv.getState(),e)}sv.subscribe((e,t)=>{s_(e.extensions!==t.extensions?null:sC(e.slots,t.slots))}),sw.subscribe((e,t)=>{s_(sC(e.slots,t.slots))}),sE.subscribe((e,t)=>{s_(sC(e.configs,t.configs))}),iX.subscribe(()=>s_(null)),aJ.subscribe(()=>s_(null)),s_(null);let s$=e=>i7(t=>({...t,extensions:{...t.extensions,[e.name]:{...e}}}));function sO(e,t){i7(r=>{let n=r.slots[e];return n?{...r,slots:{...r.slots,[e]:{...n,attachedIds:[...n.attachedIds,t]}}}:{...r,slots:{...r.slots,[e]:{...sk(e),attachedIds:[t]}}}})}function sN(e,t){i7(r=>{let n=r.slots[e];return n&&n.attachedIds.includes(t)?{...r,slots:{...r.slots,[e]:{...n,attachedIds:n.attachedIds.filter(e=>e!==t)}}}:r})}function sM(e){i7(t=>{let r=t.slots[e];return r?{...t,slots:{...t.slots,[e]:{...r,attachedIds:[]}}}:t})}function sI(e){let t=new Map;return e.forEach((e,r)=>{t.has(e)||t.set(e,r)}),t}function sj(e,t){return function(e,t,r=null,n){let a;return e.filter(e=>{let o=e.displayConditionExpression;if("string"!=typeof o||0===o.trim().length)return!0;a??(a=t&&"object"==typeof t?{session:r,...t}:{session:r});try{return!!iC(o,a)}catch(t){return console.error(`Error while evaluating expression '${o}' for ${e.id}`+(n?` in ${n}`:""),t),!1}})}(sA(e),t,aJ.getState().session,e)}function sA(e){return sb.getState().slots[e]?.candidateExtensions??[]}let sL=(e,t)=>sv.setState(r=>{let n=r.slots[t]?.moduleName;if(n&&n!=e)return console.warn(`An extension slot with the name '${t}' already exists. Refusing to register the same slot name twice (in "registerExtensionSlot"). The existing one is from module ${n}.`),r;if(n&&n==e)return r;if(r.slots[t])return{...r,slots:{...r.slots,[t]:{...r.slots[t],moduleName:e}}};let a=sk(t,e);return{...r,slots:{...r.slots,[t]:{...a}}}}),sF=()=>{sD=null,i7(()=>({slots:{},extensions:{}})),i8().setState({renderings:new Map}),sb.setState({slots:{}})},sB=B("left-nav",{slotName:null,basePath:window.spaBase,mode:"normal"});function sV({name:e,basePath:t,mode:r,componentContext:n,state:a}){sB.setState({slotName:e,basePath:t,mode:r??"normal",componentContext:n,state:a})}function sU(e){sB.getState().slotName===e&&sB.setState(sB.getInitialState(),!0)}let sW=B("modalRegistry",{modals:{}});function sH(e){sW.setState(t=>(t.modals[e.name]=e,t))}function sz(e){let t=sW.getState().modals[e];if(!t){let r=sT(e);r&&(t={name:e,load:r.load,moduleName:r.moduleName},console.warn(`Modal ${e} was registered as an extension. This is deprecated and will be removed in the future. Please register it in the "modals" section of routes.json instead of the "extensions" section.`),sH(t))}return t}let sK=B("workspace2",{registeredGroupsByName:{},registeredWindowsByName:{},registeredWorkspacesByName:{},openedGroup:null,openedWindows:[],isMostRecentlyOpenedWindowHidden:!1});function sG(e){let{registeredWorkspacesByName:t,registeredWindowsByName:r}=sK.getState(),n=t[e];if(n){let t=r[n.window];if(t)return t;throw Error(`No workspace window found with name: ${n.window} for workspace: ${e}`)}throw Error(`No workspace found with name: ${e}`)}function sZ(e){let{registeredGroupsByName:t,registeredWindowsByName:r}=sK.getState(),n=r[e];if(n){let r=t[n.group];if(r)return r;throw Error(`No workspace group found with name: ${n.group} for window: ${e}`)}throw Error(`No workspace window found with name: ${e}`)}function sY(e){let{openedWindows:t}=sK.getState();return t.findIndex(t=>t.openedWorkspaces.find(t=>t.workspaceName===e))}function sq(e,t){if(0==t.length)return;let{registeredGroupsByName:r}=sK.getState(),n={...r};for(let r of t){if(n[r.name])throw Error(`Cannot register workspace group ${r.name} more than once`);n[r.name]={...r,moduleName:e}}sK.setState({registeredGroupsByName:n})}function sJ(e,t){if(0==t.length)return;let{registeredWindowsByName:r}=sK.getState(),n={...r};for(let r of t){if(n[r.name])throw Error(`Cannot register workspace window ${r.name} more than once`);let t={...r,moduleName:e};n[r.name]=t}sK.setState({registeredWindowsByName:n})}function sX(e,t){if(0==t.length)return;let{registeredWorkspacesByName:r}=sK.getState(),n={...r};for(let r of t){if(n[r.name])throw Error(`Cannot register workspace ${r.name} more than once`);let t={...r,moduleName:e};n[r.name]=t}sK.setState({registeredWorkspacesByName:n})}let sQ=0,s0=null,s1={bootstrap:15e3,mount:15e3,unmount:15e3};function s4(e,t){if(e.timeouts)return e;let r=e.name??"parcel",n=Object.fromEntries(Object.keys(s1).filter(t=>e[t]).map(n=>{var a,o;let i,s;return[n,(a=e[n],o=s1[n],i=Array.isArray(a)?a:[a],s=e=>i.reduce((t,a,o)=>t.then(()=>{let t=a(e);return"function"==typeof t?.then&&"function"==typeof t?.catch?t:Promise.reject(Error(`Lifecycle function ${n} at array index ${o} for parcel ${r} did not return a promise`))}),Promise.resolve(void 0)),e=>{let a,i=new Promise((e,t)=>{a=setTimeout(()=>t(Error(`Lifecycle function ${n} for parcel ${r} did not settle within ${o}ms`)),o)});return Promise.race([s(e),i]).finally(()=>clearTimeout(a)).then(e=>(t(n,!1),e),e=>{throw t(n,!0),e})})]}));return{...e,...n}}async function s2(e,t){var r,n;let a,o,i,s,l,u=await (s0??(s0=new Promise((e,t)=>{(0,ak.mountRootParcel)({name:"openmrs-extension-host",bootstrap:()=>Promise.resolve(),mount:t=>(e(t.mountParcel),Promise.resolve()),unmount:()=>Promise.resolve()},{domElement:document.createElement("div")}).mountPromise.catch(t)}).catch(e=>(console.error("The host parcel used to mount extensions could not be mounted. Falling back to mounting extensions as root parcels, which leaks their DOM elements.",e),ak.mountRootParcel))),s0),c={...t},d=(a=c,o=!1,{retarget:e=>a={...e},release:i=()=>(function(e){for(let t of Object.keys(e))delete e[t]})(a),onSettled(e,t){switch(e){case"bootstrap":t&&i();return;case"mount":o||(o=t);return;case"unmount":(t||o)&&i();return}}});return n=u((r=d.onSettled,"function"==typeof e?()=>e().then(e=>s4(e,r)):s4(e,r)),c),s=e=>t=>e.call(n,d.retarget(t)).catch(e=>{throw"SKIP_BECAUSE_BROKEN"===n.getStatus()&&d.release(),e}),l=n.update&&s(n.update),Object.defineProperty(n,"update",{configurable:!0,enumerable:!0,get:()=>l,set:e=>{l=e&&s(e)}})}function s3(){return s6}function s6(e,t){let r,n=s2(e,t).then(e=>r=e);return{mount:()=>n.then(e=>e.mount()),unmount:()=>n.then(e=>e.unmount()),update:e=>n.then(t=>t.update?.(e)),getStatus:()=>r?.getStatus()??"LOADING_SOURCE_CODE",get loadPromise(){return n.then(e=>e.loadPromise)},get bootstrapPromise(){return n.then(e=>e.bootstrapPromise)},get mountPromise(){return n.then(e=>e.mountPromise)},get unmountPromise(){return n.then(e=>e.unmountPromise)}}}async function s5(e,t,r,n,a=e=>e,o={}){let i=sP(n),s=sT(n),l=null;if(e){let u;if(!s)throw Error(`Couldn't find extension '${i}' to attach to '${t}'`);let{meta:c,moduleName:d,load:m}=s,p=sQ++,f=`${t}/${n}-${p}`;e.dataset.extensionRenderingId=f;let h=e=>{try{so(f)}catch(t){console.error(e,t)}};try{sa({renderingId:f,extensionName:i,extensionModuleName:d,extensionId:n,slotName:t,slotModuleName:r})}catch(e){throw h(`Recomputing configuration after registering '${n}' failed also failed`),e}try{u=await m()}catch(e){throw h(`Recomputing configuration after '${n}' failed to load also failed`),e}try{l=await s2(a({...u,name:`${t}/${i}-${p}`}),{...o,_meta:c,_extensionContext:{extensionId:n,extensionSlotName:t,extensionSlotModuleName:r,extensionModuleName:d,extensionMeta:c},domElement:e})}catch(e){throw h(`Recomputing configuration after '${n}' failed to mount also failed`),e}l.mountPromise.then(void 0,e=>{console.error(`Extension '${n}' in slot '${t}' failed to mount`,e),h(`Recomputing configuration after '${n}' failed to mount also failed`)}),l.unmountPromise.then(()=>h(`Recomputing configuration after unmounting '${n}' failed`),e=>{console.error(`Extension '${n}' in slot '${t}' failed to unmount`,e),h(`Recomputing configuration after '${n}' failed to unmount also failed`)})}else console.warn(`Tried to render ${n} into ${t} but no DOM element was available.`);return l}var s9=r(4587),s8=r.n(s9);let s7=(0,s9.createContext)({moduleName:"",featureName:""});var le=r(9978);function lt({to:e,templateParams:t,onBeforeNavigate:r,children:n,...a}){return(0,s9.useEffect)(()=>{a.href&&console.warn(`ConfigurableLink does not support the href prop. Use the 'to' prop instead. The provided href value is '${a.href}'`),a.onClick&&console.warn(`ConfigurableLink does not support the onClick prop. Use the 'onBeforeNavigate' prop instead. The 'to' prop of the offending link is ${e}`)},[]),(0,le.jsx)("a",{onClick:n=>{0===n.button&&!n.ctrlKey&&!n.shiftKey&&!n.altKey&&!n.metaKey&&(n.preventDefault(),r?.(n),aI({to:e,templateParams:t})),0===n.button&&(n.ctrlKey||n.metaKey)&&r?.(n),0===n.button&&n.shiftKey&&r?.(n),1===n.button&&r?.(n)},href:aN(e,t),...a,children:n})}let lr=({state:e,children:t,...r})=>{let{extension:n}=(0,s9.useContext)(s7),a=(0,s9.useRef)(null),o=(0,s9.useRef)(Promise.resolve()),i=(0,s9.useRef)(!1),s=(0,s9.useRef)(!1),l=(0,s9.useRef)(e),u=(0,s9.useCallback)(e=>{if(!e)return;let t=()=>{"MOUNTED"===e.getStatus()&&e.unmount()};switch(e.getStatus()){case"MOUNTED":e.unmount();break;case"UPDATING":o.current?.then(t,t);break;default:e.mountPromise.then(t,()=>{})}},[]),c=(0,s9.useCallback)((e,t)=>{e.update&&"UNMOUNTING"!==e.getStatus()&&(o.current=Promise.all([e.mountPromise,o.current]).then(()=>{if(a.current?.getStatus()==="MOUNTED"&&a.current.update)return a.current.update({...t})}).catch(e=>{let t=a.current?.getStatus();"UNMOUNTING"!==t&&"NOT_MOUNTED"!==t&&"UNLOADING"!==t&&console.error(`The extension '${n?.extensionId}' failed to update`,e)}))},[]),d=(0,s9.useCallback)(t=>{t&&!a.current&&!s.current&&n?.extensionSlotName&&n.extensionSlotModuleName&&(s.current=!0,s5(t,n.extensionSlotName,n.extensionSlotModuleName,n.extensionId,void 0,e).then(t=>{(s.current=!1,a.current=t,i.current)?u(t):t&&l.current!==e&&c(t,l.current)},()=>{s.current=!1}))},[]);return(0,s9.useEffect)(()=>(i.current=!1,()=>{i.current=!0,u(a.current)}),[]),(0,s9.useEffect)(()=>{l.current=e,a.current&&c(a.current,e)},[e]),n?(0,le.jsx)("div",{ref:d,"data-extension-id":n?.extensionId,style:{position:"relative"},...r}):null};function ln(e){let t=(0,s9.useRef)(e);return T(t.current,e)||(t.current=e),t.current}function la(e,t){"function"==typeof t&&(t=t(e));let r={};for(let[n,a]of Object.entries(t)){let t=function(...t){e.setState(e=>a(e,...t))};r[n]=t}return r}let lo=e=>e;function li(e,t=lo,r){let n=(0,s9.useCallback)(t=>e.subscribe(t),[e]),a=(0,s9.useCallback)(()=>t(e.getState()),[e,t]),o=(0,s9.useSyncExternalStore)(n,a,a),i=(0,s9.useMemo)(()=>r?la(e,r):null,[e,r]);return(0,s9.useMemo)(()=>i?{...o,...i}:o,[o,i])}function ls(e,t){return li(e,lo,t)}function ll(e){return function(t){let r=(0,s9.useCallback)(t=>e.subscribe(t),[]),n=(0,s9.useCallback)(()=>e.getState(),[]),a=(0,s9.useSyncExternalStore)(r,n,n),o=(0,s9.useMemo)(()=>t?la(e,t):null,[t]);return(0,s9.useMemo)(()=>o?{...a,...o}:a,[a,o])}}let lu=[];Object.freeze(lu);let lc={candidateExtensions:lu};Object.freeze(lc);let ld=e=>{let t=(0,s9.useCallback)(t=>t.slots?.[e]??lc,[e]);return li(si(),t)},lm=e=>e.session;function lp(e,t){let{candidateExtensions:r}=ld(e),n=li(aJ,lm),a=ln(t);return(0,s9.useMemo)(()=>sj(e,a),[e,a,n,r])}function lf(e,t){let{moduleName:r}=(0,s9.useContext)(s7);if(!r)throw Error("ComponentContext has not been provided. This should come from @openmrs/esm-react-utils.");return(0,s9.useEffect)(()=>{sL(r,e)},[r,e]),{extensions:lp(e,t),extensionSlotName:e,extensionSlotModuleName:r}}function lh(e){return e}function lg({name:e,extensionSlotName:t,select:r=lh,children:n,state:a,style:o,...i}){if(n&&a)throw Error("Both children and state have been provided. If children are provided, the state must be passed as a prop to the `Extension` component.");let s=e??t,l=(0,s9.useRef)(null),{extensions:u,extensionSlotModuleName:c}=lf(s,a),d=(0,s9.useMemo)(()=>r(u),[r,u]),m=(0,s9.useMemo)(()=>{if("function"==typeof n&&!s8().isValidElement(n))return d.map(e=>n(e,a))},[n,d]);return(0,le.jsx)("div",{ref:l,"data-extension-slot-name":s,"data-extension-slot-module-name":c,style:{...o,position:"relative"},...i,children:s&&d?.map((e,t)=>(0,le.jsx)(s7.Provider,{value:{moduleName:c,featureName:"",extension:{extensionId:e.id,extensionSlotName:s,extensionSlotModuleName:c,extensionMeta:e.meta}},children:m?.[t]??("function"!=typeof n?n:null)??(0,le.jsx)(lr,{state:a})},e.id))})}var ly=r(6298),lv=r.n(ly);function lb(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function lw(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?lb(Object(r),!0).forEach(function(t){var n,a,o;n=e,a=t,o=r[t],a in n?Object.defineProperty(n,a,{value:o,enumerable:!0,configurable:!0,writable:!0}):n[a]=o}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):lb(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function lE(e){return(lE="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function lD(e){return(lD="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function lx(e,t){var r;if("function"!=typeof(r=t.domElement?function(){return t.domElement}:t.domElementGetter?t.domElementGetter:e.domElementGetter?e.domElementGetter:function(e){var t=e.appName||e.name;if(!t)throw Error("single-spa's dom-element-getter-helpers was not given an application name as a prop, so it can't make a unique dom element container for the react application");var r="single-spa-application:".concat(t);return function(){var e=document.getElementById(r);return e||((e=document.createElement("div")).id=r,document.body.appendChild(e)),e}}(t)))throw Error("single-spa's dom-element-getter-helpers was given an invalid domElementGetter for application or parcel '".concat(t.name,"'. Expected a function, received ").concat(lD(r)));return function(){var e=r(t);if(!(e instanceof HTMLElement))throw Error("single-spa's dom-element-getter-helpers: domElementGetter returned an invalid dom element for application or parcel '".concat(t.name,"'. Expected HTMLElement, received ").concat(lD(e)));return e}}var l_=null;try{l_=require("react").createContext()}catch(e){}var lS={React:null,ReactDOM:null,ReactDOMClient:null,rootComponent:null,loadRootComponent:null,errorBoundary:null,errorBoundaryClass:null,domElementGetter:null,parcelCanUpdate:!0,suppressComponentDidCatchWarning:!1,domElements:{},renderResults:{},updateResolves:{},unmountResolves:{}};function lC(e,t){return e.rootComponent?Promise.resolve():e.loadRootComponent(t).then(function(t){e.rootComponent=t})}function lk(e,t){return new Promise(function(r,n){e.suppressComponentDidCatchWarning||!function(e){if(!(e&&"string"==typeof e.version&&e.version.indexOf(".")>=0))return!1;var t=e.version.slice(0,e.version.indexOf("."));try{return Number(t)>=16}catch(e){return!1}}(e.React)||e.errorBoundary||e.errorBoundaryClass||(e.rootComponent.prototype?e.rootComponent.prototype.componentDidCatch||console.warn("single-spa-react: ".concat(t.name||t.appName||t.childAppName,"'s rootComponent should implement componentDidCatch to avoid accidentally unmounting the entire single-spa application.")):console.warn("single-spa-react: ".concat(t.name||t.appName||t.childAppName,"'s rootComponent does not implement an error boundary. If using a functional component, consider providing an opts.errorBoundary to singleSpaReact(opts).")));var a,o=l$(e,t,function(){r(this)}),i=lx(e,t)(),s=function(e){var t=e.reactDom,r=e.renderType,n=e.elementToRender,a=e.domElement,o=t[r];if("function"!=typeof o)throw Error('renderType "'.concat(r,'" did not return a function.'));switch(r){case"createRoot":case"unstable_createRoot":case"createBlockingRoot":case"unstable_createBlockingRoot":var i=o(a);return i.render(n),i;case"hydrateRoot":return o(a,n);default:return o(n,a),null}}({elementToRender:o,domElement:i,reactDom:lT(e),renderType:"function"==typeof(a=e).renderType?a.renderType():a.renderType});e.domElements[t.name]=i,e.renderResults[t.name]=s})}function lP(e,t){return new Promise(function(r){e.unmountResolves[t.name]=r;var n=e.renderResults[t.name];n&&n.unmount?n.unmount():lT(e).unmountComponentAtNode(e.domElements[t.name]),delete e.domElements[t.name],delete e.renderResults[t.name]})}function lR(e,t){return new Promise(function(r){e.updateResolves[t.name]||(e.updateResolves[t.name]=[]),e.updateResolves[t.name].push(r);var n=l$(e,t,null),a=e.renderResults[t.name];if(a&&a.render)a.render(n);else{var o=lx(e,t)();lT(e).render(n,o)}})}function lT(e){return e.ReactDOMClient||e.ReactDOM}function l$(e,t,r){var n=e.React.createElement(e.rootComponent,t),a=l_?e.React.createElement(l_.Provider,{value:t},n):n;return(e.errorBoundary||t.errorBoundary||e.errorBoundaryClass||t.errorBoundaryClass)&&(e.errorBoundaryClass=e.errorBoundaryClass||t.errorBoundaryClass||function(e,t){function r(t){e.React.Component.apply(this,arguments),this.state={caughtError:null,caughtErrorInfo:null},r.displayName="SingleSpaReactErrorBoundary(".concat(t.name,")")}return r.prototype=Object.create(e.React.Component.prototype),r.prototype.render=function(){return this.state.caughtError?(e.errorBoundary||t.errorBoundary)(this.state.caughtError,this.state.caughtErrorInfo,this.props):this.props.children},r.prototype.componentDidCatch=function(e,t){this.setState({caughtError:e,caughtErrorInfo:t})},r}(e,t),a=e.React.createElement(e.errorBoundaryClass,t,a)),a=e.React.createElement(e.SingleSpaRoot,lw(lw({},t),{},{mountFinished:r,updateFinished:function(){e.updateResolves[t.name]&&(e.updateResolves[t.name].forEach(function(e){return e()}),delete e.updateResolves[t.name])},unmountFinished:function(){e.unmountResolves[t.name]&&(e.unmountResolves[t.name](),delete e.unmountResolves[t.name])}}),a)}var lO=r(587),lN=r(2272),lM=r(8444);let lI={strictMode:!0,throwErrorsToConsole:!0,disableTranslations:!1},lj=new Map;(0,lM.y)(lj);let lA={errorRetryCount:3,fetcher:aY,focusThrottleInterval:18e5,revalidateIfStale:!0,revalidateOnFocus:!1,revalidateOnReconnect:!1,refreshInterval:0,shouldRetryOnError:e=>{if(e instanceof aq){let t=e.response.status;return!!(t>=500)||401===t||403===t||429===t}return!0},provider:()=>lj};function lL(e){if("object"!=typeof e||"string"!=typeof e.featureName||"string"!=typeof e.moduleName)throw Error("Invalid options");let t=Object.assign({},lI,e),r={...lA,...t.swrConfig};return function(e){var n,a,o,i,s;return o=a=class extends(n=s8().Component){componentDidCatch(e,r){r&&r.componentStack&&(e.extra=Object.assign(e.extra||{},{componentStack:r.componentStack})),t.throwErrorsToConsole&&setTimeout(()=>{throw e}),this.setState({caughtError:e,caughtErrorInfo:r})}render(){if(this.state.caughtError)return(0,le.jsx)("div",{children:"An error has occurred. Please try reloading the page."});{let n=(0,le.jsx)(s9.Suspense,{fallback:null,children:(0,le.jsx)(lN.S,{value:r,children:(0,le.jsx)(s7.Provider,{value:this.state.config,children:t.disableTranslations?(0,le.jsx)(e,{...this.props}):(0,le.jsx)(lO.I18nextProvider,{i18n:window.i18next,defaultNS:this.state.config.extension?`${this.state.config.moduleName}___${this.state.config.extension.extensionSlotName}___${this.state.config.extension.extensionId}`:this.state.config.moduleName,children:(0,le.jsx)(e,{...this.props})})})})});return t.strictMode&&s8().StrictMode?(0,le.jsx)(s8().StrictMode,{children:n}):n}}constructor(e){super(e),this.state={caughtError:null,caughtErrorInfo:null,config:{moduleName:t.moduleName,featureName:t.featureName,extension:e._extensionContext}}}},i="displayName",s=`OpenmrsReactComponent(${t.featureName})`,i in o?Object.defineProperty(o,i,{value:s,enumerable:!0,configurable:!0,writable:!0}):o[i]=s,a}}function lF(e,t){return function(e){if("object"!==lE(e))throw Error("single-spa-react requires a configuration object");var t,r=lw(lw({},lS),e);if(!r.React)throw Error("single-spa-react must be passed opts.React");if(!r.ReactDOM&&!r.ReactDOMClient)throw Error("single-spa-react must be passed opts.ReactDOM or opts.ReactDOMClient");if(r.renderType||(null!=(t=r.ReactDOMClient)&&t.createRoot?r.renderType="createRoot":r.renderType="render"),!r.rootComponent&&!r.loadRootComponent)throw Error("single-spa-react must be passed opts.rootComponent or opts.loadRootComponent");if(r.errorBoundary&&"function"!=typeof r.errorBoundary)throw Error("The errorBoundary opt for single-spa-react must either be omitted or be a function that returns React elements");!l_&&r.React.createContext&&(l_=r.React.createContext()),r.SingleSpaRoot=function(e){function t(e){t.displayName="SingleSpaRoot(".concat(e.name,")")}return t.prototype=Object.create(e.React.Component.prototype),t.prototype.componentDidMount=function(){setTimeout(this.props.mountFinished)},t.prototype.componentWillUnmount=function(){setTimeout(this.props.unmountFinished)},t.prototype.render=function(){return setTimeout(this.props.updateFinished),this.props.children},t}(r);var n={bootstrap:lC.bind(null,r),mount:lk.bind(null,r),unmount:lP.bind(null,r)};return r.parcelCanUpdate&&(n.update=lR.bind(null,r)),n}({React:s8(),ReactDOMClient:lv(),rootComponent:lL(t)(e)})}function lB(e,t){return()=>e().then(({default:e})=>lF(e,t))}function lV(e,t){return()=>Promise.resolve(lF(e,t))}let lU=lB,lW=M()(()=>({}));U("openmrs-app-context",lW);let lH={};function lz(e,t=e=>e){let r=lW.getState();return e in r?Object.freeze(Object.assign({},t?t(r[e]):r[e])):null}function lK(e,t){lW.setState(r=>(e in r||(r[e]={}),r[e]=t(r[e]),Object.assign({},r)))}function lG(e){return null===e?null:Object.freeze(Object.assign({},e))}let lZ=new Map;function lY(e,t){let r=(0,s9.useRef)(t??{}),n=(0,s9.useRef)(t=>lK(e,t)),a=(0,s9.useRef)(Symbol());return(0,s9.useEffect)(()=>{let r=t??{},n=a.current;return null===lz(e)?!function(e,t=lH){lW.setState(r=>{if(e in r)throw Error(`Attempted to re-register namespace ${e} in the app context. Each namespace must be unregistered before the name can be registered again.`);return Object.assign({},r,{[e]:t===lH?{}:t})})}(e,r):(console.warn(`Namespace ${e} is already registered in the app context. This is likely a race condition during navigation, but may indicate two components are trying to own the same namespace. Updating the existing context.`),lK(e,()=>r)),lZ.set(e,n),()=>{lZ.get(e)===n&&(lW.setState(t=>(e in t&&delete t[e],t)),lZ.delete(e))}},[e]),(0,s9.useEffect)(()=>{let n=t??{};T(r.current,n)||(lK(e,()=>n),r.current=n)},[t]),n.current}function lq({namespace:e,value:t}){return lY(e,t),null}let lJ=({children:e,value:t,fallback:r})=>t?(0,le.jsx)(le.Fragment,{children:e}):r?(0,le.jsx)(le.Fragment,{children:r}):null;function lX(){let e=(0,s9.useRef)();return(!e.current||e.current.signal.aborted)&&(e.current=new AbortController),(0,s9.useEffect)(()=>{let t=e.current;return()=>t?.abort()},[]),e.current}function lQ(e,t=e=>e??{}){let[r,n]=(0,s9.useState)(()=>{if(l0(e))return;let r=lz(e);if(null!==r)return t?t(r):r});return(0,s9.useEffect)(()=>{if(l0(e))throw Error(`The namespace supplied to useAppContext must be a non-empty string, but was "${e}".`)},[e]),(0,s9.useEffect)(()=>{var r;let a;return(r=e=>{if(null==e)return void n(void 0);let r=t?t(e):e;n(e=>T(e,r)?e:r)})(lG(a=lz(e))),lW.subscribe(t=>{let n=e in t?t[e]:null;n!==a&&(a=n,r(lG(n)))})},[e,t]),r}function l0(e){return"string"!=typeof e||0===e.trim().length}function l1(e){let t=lp(e);return(0,s9.useMemo)(()=>t.map(e=>e.id),[t])}function l4(e){return ld(e).candidateExtensions}function l2(e,t,r){let{data:n,error:a,mutate:o,isLoading:i,isValidating:s}=(0,lN.u)(e?o5(e,t,r):null,aY);return(0,s9.useMemo)(()=>({isLoading:i,data:n?.data.results??[],error:a,mutate:o,isValidating:s}),[n,a,i,s,o])}function l3(e){(0,s9.useEffect)(()=>{if(e){let e=window.getComputedStyle(document.body).overflow;return document.body.style.overflow="hidden",()=>{document.body.style.overflow=e}}},[e])}let l6={},l5=`No ComponentContext has been provided. This should come from "openmrsComponentDecorator".
16
- Usually this is already applied when using "getAsyncLifecycle" or "getSyncLifecycle".`;function l9(e,t,r){let n=l6[e];if(n)return n;let a=new Promise(e=>{let n=r(t.getState());if(n)return void e(n);let a=t.subscribe(t=>{let n=r(t);n&&(a(),e(n))})});return l6[e]=a,a.then(()=>{l6[e]===a&&delete l6[e]}),a}function l8(e){let{moduleName:t,extension:r}=(0,s9.useContext)(s7),n=e?.externalModuleName??t;if(!n&&!r)throw Error(l5);let a=function(e){let t=(0,s9.useMemo)(()=>nD(e),[e]),r=function(e){let[t,r]=(0,s9.useState)(()=>{let t=e.getState();return t.loaded&&t.config?t.config:null});return(0,s9.useEffect)(()=>e?.subscribe(e=>{e.loaded&&e.config&&r(e.config)}),[e]),t}(t);if(!r)throw l9(e,t,e=>e.loaded?e.config:null);return r}(n),o=function(e){let t=(0,s9.useMemo)(nC,[]),r=function(e,t){let[r,n]=(0,s9.useState)(t?()=>{let r=nk(e.getState(),t.extensionSlotName,t.extensionId);if(r.loaded&&r.config)return r.config}:null);return(0,s9.useEffect)(()=>{if(t)return e.subscribe(e=>{let a=nk(e,t.extensionSlotName,t.extensionId);a.loaded&&a.config&&!rP(a.config,r)&&n(a.config)})},[e,t,r]),r}(t,e);if(!r&&e)throw l9(`${e.extensionSlotName}-${e.extensionId}`,t,t=>{let r=nk(t,e.extensionSlotName,e.extensionId);return r.loaded?r.config:null});return r||{}}(r);return(0,s9.useMemo)(()=>e?.externalModuleName&&n===e.externalModuleName?{...a}:{...a,...o},[n,e?.externalModuleName,a,o])}let l7=lp;function ue(e,t=300){let[r,n]=(0,s9.useState)(e);return(0,s9.useEffect)(()=>{let r=setTimeout(()=>{n(e)},t);return()=>{clearTimeout(r)}},[e,t]),r}var ut=r(4993);let ur=(0,ut.Ht)(lN.u,e=>(t,r,n)=>(n.revalidateOnFocus=!1,n.revalidateIfStale=!1,n.revalidateOnReconnect=!1,n.refreshInterval=0,e(t,r,n))),un=`custom:${[["admissionDecisionConcept","ref"],["admissionEncounterType","ref"],["admissionForm","ref"],["atFacilityVisitType","ref"],["bedAssignmentEncounterType","ref"],["cancelADTRequestEncounterType","ref"],["checkInClerkEncounterRole","ref"],["checkInEncounterType","ref"],["clinicianEncounterRole","ref"],["conceptSourcesForDiagnosisSearch","ref"],["consultEncounterType","ref"],["consultFreeTextCommentsConcept","ref"],["denyAdmissionConcept","ref"],["diagnosisMetadata","ref"],["diagnosisSets","ref"],["dischargeForm","ref"],["dispositionDescriptor","ref"],["dispositions","ref"],["emrApiConceptSource","ref"],["exitFromInpatientEncounterType","ref"],["extraPatientIdentifierTypes","ref"],["fullPrivilegeLevel","ref"],["highPrivilegeLevel","ref"],["identifierTypesToSearch","ref"],["inpatientNoteEncounterType","ref"],["lastViewedPatientSizeLimit","ref"],["metadataSourceName","ref"],["motherChildRelationshipType","ref"],["narrowerThanConceptMapType","ref"],["nonDiagnosisConceptSets","ref"],["orderingProviderEncounterRole","ref"],["patientDiedConcept","ref"],["personImageDirectory","ref"],["primaryIdentifierType","ref"],["sameAsConceptMapType","ref"],["suppressedDiagnosisConcepts","ref"],["supportsAdmissionLocationTag","(uuid,display,name,links)"],["supportsLoginLocationTag","(uuid,display,name,links)"],["supportsTransferLocationTag","(uuid,display,name,links)"],["supportsVisitsLocationTag","(uuid,display,name,links)"],["telephoneAttributeType","ref"],["testPatientPersonAttributeType","ref"],["transferForm","ref"],["transferRequestEncounterType","ref"],["transferWithinHospitalEncounterType","ref"],["unknownCauseOfDeathConcept","ref"],["unknownLocation","ref"],["unknownPatientPersonAttributeType","ref"],["unknownProvider","ref"],["visitAssignmentHandlerAdjustEncounterTimeOfDayIfNecessary","ref"],["visitExpireHours","ref"],["visitNoteEncounterType","ref"]].map(([e,t])=>`${e}:${t}`).join(",")}`;function ua(){let e=ur(`${az}/emrapi/configuration?v=${un}`,aY);return(0,s9.useMemo)(()=>({emrConfiguration:e.data?.data,isLoadingEmrConfiguration:e.isLoading,mutateEmrConfiguration:e.mutate,errorFetchingEmrConfiguration:e.error}),[e])}function uo(){return(0,s9.useContext)(s7).extension}let ui=ll(i9());function us(e){let t=lp(e);return(0,s9.useMemo)(()=>Object.fromEntries(t.map(e=>[e.name,e.meta])),[t])}let ul=ll(si());function uu(e){let{flags:t}=li(iX);return t[e]?.enabled??!1}function uc(){let[,e]=(0,s9.useState)(0);return(0,s9.useCallback)(()=>{e(e=>e+1)},[])}function ud(e,t,r={}){return up(e,t,um,r)}let um={getPaginatedUrl:(e,t,r)=>{if(!e)return null;{let n=new URL(aZ(e.toString()),window.location.toString());return n.searchParams.set("limit",""+t),n.searchParams.set("startIndex",""+r),n.searchParams.set("totalCount","true"),n.toString()}},getNextUrl:e=>{let t=e?.links?.find(e=>"next"==e.rel)?.uri;if(!t)return null;{let e=new URL(t);return e.host=window.location.host,e.protocol=window.location.protocol,e.toString()}},getTotalCount:e=>e?.totalCount??NaN,getCurrentPageSize:e=>e?.results?.length??NaN,getData:e=>e?.results};function up(e,t,r,n={}){let{getPaginatedUrl:a,getTotalCount:o,getCurrentPageSize:i,getData:s}=r,{immutable:l,swrConfig:u}=n,c=n.fetcher??aY,[d,m]=(0,s9.useState)(1),p=(0,s9.useRef)(NaN),f=(0,s9.useRef)(NaN),h=(0,s9.useRef)(d),g=(0,s9.useRef)(!1),y=(0,s9.useRef)(!1),v=e?.toString()??"",[b,w]=(0,s9.useState)(v);v!==b&&(w(v),m(1),h.current=1,p.current=NaN,f.current=NaN,g.current=!1,y.current=!1);let E=(d-1)*t,D=(0,s9.useMemo)(()=>a(e,t,E),[e,t,E]),{data:x,..._}=(l?ur:lN.u)(D,c,u);x?.data&&(p.current=o(x?.data),f.current=i(x?.data),g.current=!0);let S=Math.ceil(p.current/t),C=(0,s9.useCallback)(e=>{if(!Number.isInteger(e)||e<1)return void console.warn(`useServerPagination: ignoring goTo(${e}); page must be a positive integer.`);let r=Math.ceil(p.current/t);!g.current||Number.isNaN(r)||e<=r?(h.current=e,m(e)):console.warn("Invalid attempt to go to out of bounds page: "+e)},[t]);(0,s9.useEffect)(()=>{if(!g.current)return;if(Number.isNaN(p.current)){y.current||(y.current=!0,console.warn(`useServerPagination: ${v} returned no total count, so out-of-range pages cannot be detected.`));return}let e=Math.max(1,Math.ceil(p.current/t));d>e&&(console.warn(`Invalid attempt to go to out of bounds page: ${d}; returning to page ${e}.`),h.current=e,m(e))},[d,t,v,x]);let k=(0,s9.useCallback)(()=>{C(h.current+1)},[C]),P=(0,s9.useCallback)(()=>{C(h.current-1)},[C]);return{data:s(x?.data),totalPages:S,totalCount:p.current,currentPage:d,currentPageSize:f.current,paginated:S>1,showNextButton:d<S,showPreviousButton:d>1,goTo:C,goToNext:k,goToPrevious:P,..._}}function uf(e,t,r={}){return up(e,t,uh(),r)}function uh(){return{getPaginatedUrl:(e,t,r)=>{if(!e)return null;{let n=new URL(aZ(e.toString()),window.location.toString());return n.searchParams.set("_count",""+t),n.searchParams.set("_getpagesoffset",""+r),n.toString()}},getNextUrl:e=>{let t=e?.link?.find(e=>"next"==e.relation)?.url;if(!t)return null;{let e=new URL(t);return e.host=window.location.host,e.protocol=window.location.protocol,e.toString()}},getTotalCount:e=>e?.total??NaN,getCurrentPageSize:e=>e?.entry?.length??NaN,getData:e=>e?.entry?.map(e=>e.resource)}}var ug=r(9888);let uy=Promise.resolve(),uv=(0,ut.Ht)(lN.u,e=>(t,r,n)=>{let a,o=(0,s9.useRef)(!1),{cache:i,initialSize:s=1,revalidateAll:l=!1,persistSize:u=!1,revalidateFirstPage:c=!0,revalidateOnMount:d=!1,parallel:m=!1}=n,[,,,p]=lM.a.get(lM.o);try{(a=(0,lM.s)(t?t(0,null):null)[0])&&(a="$inf$"+a)}catch(e){}let[f,h,g]=(0,lM.c)(i,a),y=(0,s9.useCallback)(()=>(0,lM.i)(f()._l)?s:f()._l,[i,a,s]);(0,ug.useSyncExternalStore)((0,s9.useCallback)(e=>a?g(a,()=>{e()}):()=>{},[i,a]),y,y);let v=(0,s9.useCallback)(()=>{let e=f()._l;return(0,lM.i)(e)?s:e},[a,s]),b=(0,s9.useRef)(v());(0,lM.u)(()=>{if(!o.current){o.current=!0;return}a&&h({_l:u?b.current:v()})},[a,i]);let w=d&&!o.current,E=e(a,async e=>{let a=f()._i,o=f()._r,s=lM.a.get(i),u=s[8],d=()=>s[8]!==u;h({_r:lM.U});let g=[],y=v(),[b]=(0,lM.c)(i,e),E=b().data,D=[],x=null;for(let e=0;e<y;++e){let[s,u]=(0,lM.s)(t(e,m?null:x));if(!s)break;let[f,h]=(0,lM.c)(i,s),y=f().data,v=l||a||(0,lM.i)(y)||c&&!e&&!(0,lM.i)(E)||w||E&&!(0,lM.i)(E[e])&&!n.compare(E[e],y);if(r&&("function"==typeof o?o(y,u):v)){let t=async()=>{if(s in p){let e=p[s];delete p[s],y=await e}else y=await r(u);d()||h({data:y,_k:u}),g[e]=y};m?D.push(t):await t()}else g[e]=y;m||(x=y)}return m&&await Promise.all(D.map(e=>e())),d()||h({_i:lM.U}),g},n),D=(0,s9.useCallback)(function(e,t){let r="boolean"==typeof t?{revalidate:t}:t||{},n=!1!==r.revalidate;return a?(n&&((0,lM.i)(e)?h({_i:!0,_r:r.revalidate}):h({_i:!1,_r:r.revalidate})),arguments.length?E.mutate(e,{...r,revalidate:n}):E.mutate()):uy},[a,i]),x=(0,s9.useCallback)(e=>{let r;if(!a)return uy;let[,n]=(0,lM.c)(i,a);if((0,lM.e)(e)?r=e(v()):"number"==typeof e&&(r=e),"number"!=typeof r)return uy;n({_l:r}),b.current=r;let o=[],[s]=(0,lM.c)(i,a),l=null;for(let e=0;e<r;++e){let[r]=(0,lM.s)(t(e,l)),[n]=(0,lM.c)(i,r),a=r?n().data:lM.U;if((0,lM.i)(a))return D(s().data);o.push(a),l=a}return D(o)},[a,i,D,v]);return{size:v(),setSize:x,mutate:D,get data(){return E.data},get error(){return E.error},get isValidating(){return E.isValidating},get isLoading(){return E.isLoading}}});function ub(e,t={}){return uw(e,um,t)}function uw(e,t,r={}){let{swrInfiniteConfig:n,immutable:a}=r,{getNextUrl:o,getTotalCount:i,getData:s}=t,l=r.fetcher??aY,{data:u,size:c,setSize:d,...m}=uv((0,s9.useCallback)((r,n)=>0==r?e?.toString()??null:t.getNextUrl(n.data),[e]),l,{...n,...a?{revalidateIfStale:!1,revalidateOnFocus:!1,revalidateOnReconnect:!1}:{}}),p=o(u?.[u.length-1].data),f=i(u?.[0]?.data);return{data:u?.flatMap(e=>s(e.data)),totalCount:f,hasMore:null!=p,loadMore:()=>{d((u?.length??0)+1)},nextUri:p,...m}}function uE(e,t={}){return uD(e,um,t)}function uD(e,t,r={}){let n=uw(e,t,r),{hasMore:a,error:o,data:i,loadMore:s,isLoading:l,nextUri:u}=n;return((0,s9.useEffect)(()=>{a&&!o&&s()},[a,u]),r.partialData)?n:{...n,data:a||o?void 0:i,isLoading:l||a}}function ux(e,t={}){return uD(e,uh(),t)}function u_(e,t={}){return uw(e,uh(),t)}function uS(){let e="tablet";return document.body.classList.forEach(t=>{switch(t){case"omrs-breakpoint-lt-tablet":e="phone";break;case"omrs-breakpoint-gt-small-desktop":e="large-desktop";break;case"omrs-breakpoint-gt-tablet":e="small-desktop"}}),e}function uC(){let[e,t]=(0,s9.useState)(uS);return(0,s9.useEffect)(()=>{let e=()=>{t(uS())};return window.addEventListener("resize",e),()=>window.removeEventListener("resize",e)},[]),e}let uk=e=>"small-desktop"===e||"large-desktop"===e;function uP(e){let t=(0,s9.useContext)(s7);(0,s9.useEffect)(()=>(t&&t.moduleName&&(e.componentContext=t),sV(e),()=>{sU(e.name)}),[t,e])}function uR(){return li(sB)}let uT=[];function u$(e=null,t=null){let r=new URLSearchParams;e&&r.set("tag",e),t&&r.set("q",t);let n=r.toString(),{data:a}=uE(`${az}/location${n?"?"+n:""}`,{immutable:!0});return a??uT}function uO(e,t=!0){let r=(0,s9.useRef)(null);return(0,s9.useEffect)(()=>{let n=n=>{t&&r.current&&n.target&&n.target instanceof Node&&(r.current.contains(n.target)||e(n))};return window.addEventListener("mousedown",n),window.addEventListener("touchstart",n),()=>{window.removeEventListener("mousedown",n),window.removeEventListener("touchstart",n)}},[e,t]),r}function uN(e){let t=(0,s9.useRef)();return(0,s9.useEffect)(()=>{let r=new IntersectionObserver(t=>{for(let r of t)if(r.isIntersecting)return void e()},{threshold:1});return t.current&&r.observe(t.current),()=>{t.current&&r.unobserve(t.current)}},[t.current,e]),t}function uM(e,t={}){let{abortController:r,fetchInit:n,url:a,swrConfig:o}=t,i=lX(),s=(0,s9.useMemo)(()=>n?.signal??r?.signal??i.signal,[r?.signal,n?.signal,i.signal]),l=(0,s9.useCallback)(e=>aY(function(e,t){if(t)return"function"==typeof t?t(e):t;if("string"==typeof e)return e;throw Error(`When using useOpenmrsSWR with a key that is not a string, you must provide a url() function that converts the key to a valid url. The key for this hook is ${e}.`)}(e,a),{...n,signal:s}),[s,n,a]);return(0,lN.u)(e,l,o)}function uI(e=[],t=10){let[r,n]=(0,s9.useState)(1),a=(0,s9.useMemo)(()=>"number"==typeof t&&t>0?Math.max(1,Math.ceil(e.length/t)):1,[e.length,t]);r>a&&n(a);let o=Math.min(Math.max(1,r),a),i=(0,s9.useMemo)(()=>{let r=(o-1)*t,n=(o+0)*t;return e.slice(r,n)},[e,o,t]),s=(0,s9.useCallback)(e=>{!Number.isInteger(e)||e<1?console.warn(`usePagination: ignoring goTo(${e}); page must be a positive integer.`):n(e)},[]),l=(0,s9.useCallback)(()=>{n(e=>e+1)},[]),u=(0,s9.useCallback)(()=>{n(e=>Math.max(1,e-1))},[]);return(0,s9.useMemo)(()=>({results:i,totalPages:a,currentPage:o,paginated:e.length>t,showNextButton:o<a,showPreviousButton:o>1,goTo:s,goToNext:l,goToPrevious:u}),[i,a,e.length,t,o,s,l,u])}function uj(e,t,r,n){return{pageSizes:(0,s9.useMemo)(()=>{let r=Math.ceil(t/e);return isNaN(r)&&(r=0),[...Array(r).keys()].map(t=>(t+1)*e)},[e,t]),pageItemsCount:(0,s9.useMemo)(()=>e>t?t:e*r>t?e*(r-1)+n:e*r,[e,t,r,n])}}function uA(){let e=/\/patient\/([a-zA-Z0-9\-]+)\/?/.exec(location.pathname);return e&&e[1]}function uL(e){let[t,r]=(0,s9.useState)(e??uA()),{data:n,error:a,isValidating:o}=(0,lN.u)(t?["patient",t]:null,()=>o7(t,{}));return(0,s9.useEffect)(()=>{let e=()=>{let e=uA();e!==t&&r(e)};return window.addEventListener("single-spa:routing-event",e),()=>window.removeEventListener("single-spa:routing-event",e)},[t]),(0,s9.useMemo)(()=>({isLoading:o&&!a&&!n,patient:n,patientUuid:t,error:a}),[o,a,n,t])}function uF(){let e=`${az}/metadatamapping/termmapping?v=custom:(metadataUuid)&code=emr.primaryIdentifierType`,{data:t,error:r,isLoading:n}=(0,lN.u)(e,aY);return(0,s9.useMemo)(()=>({primaryIdentifierCode:t?.data?.results[0]?.metadataUuid,isLoading:n,error:r}),[t,r,n])}function uB(e,t,r,n){let a=e?.slotName===t&&e.slotModuleName===r?e.components:null,o=new Map;for(let e of n)o.set(e,a?.get(e)??function(e,t,r){let n=sP(r),a=e=>e.extensions[n]?.meta,o=({state:n})=>{let o=li(i9(),a),i=(0,s9.useMemo)(()=>({moduleName:t,featureName:"",extension:{extensionId:r,extensionSlotName:e,extensionSlotModuleName:t,extensionMeta:o}}),[o]);return(0,le.jsx)(s7.Provider,{value:i,children:(0,le.jsx)(lr,{state:n})})};return o.displayName=`RenderableExtension(${r})`,o}(t,r,e));return{slotName:t,slotModuleName:r,components:o}}function uV(e){let{extensions:t,extensionSlotModuleName:r}=lf(e),n=(0,s9.useMemo)(()=>new Set(e?t.map(e=>e.id):[]),[e,t]),[a,o]=(0,s9.useState)(()=>uB(null,e,r,n)),i=a;return a.slotName===e&&a.slotModuleName===r&&a.components.size===n.size&&[...n].every(e=>a.components.has(e))||o(i=uB(a,e,r,n)),(0,s9.useMemo)(()=>e?t.flatMap(e=>{let t=i.components.get(e.id);return t?[t]:[]}):[],[e,t,i])}function uU(){let e=(0,s9.useRef)(),[t,r]=(0,s9.useState)(null),n=null;if(!t){if(o){let e=a4().getState();e.loaded&&(n=e.session)}else o=new Promise(t=>{let r=({loaded:r,session:a})=>{r&&(t(a),n=a,e.current&&(e.current(),e.current=void 0))};r(a4().getState()),n||(e.current=a4().subscribe(r))});if(n)r(n);else throw o}(0,s9.useEffect)(()=>(e.current||(e.current=a4().subscribe(({loaded:e,session:t})=>{e&&(n=t,r(t))})),()=>{e.current&&(e.current(),e.current=void 0)}),[]);let a=t||n;if(!a)if(o)throw console.warn("useSession is in an unexpected state. Attempting to recover."),o;else throw Error("useSession is in an invalid state.");return a}let uW=({privilege:e,fallback:t,children:r})=>{let[n,a]=(0,s9.useState)(null);return((0,s9.useEffect)(()=>{let e=a4(),t=e.subscribe(({loaded:e,session:t})=>{a(e?t?.user??null:null)}),{loaded:r,session:n}=e.getState();return r&&a(n?.user??null),t},[]),n&&a5(e,n))?(0,le.jsx)(le.Fragment,{children:r}):t?(0,le.jsx)(le.Fragment,{children:t}):null};var uH=r(4353),uz=r.n(uH),uK=r(7581);let uG=new Map;function uZ(){for(let e of Array.from(uG.values()))e()}let uY={setVisitContext:(e,t)=>null==t?{manuallySetVisitUuid:null}:{manuallySetVisitUuid:t.uuid,patientUuid:t.patient?.uuid}};function uq(e){let t=(0,s9.useId)();return(0,s9.useEffect)(()=>{if(e)return uG.set(t,e),()=>{uG.delete(t)}},[t,e]),{...ls(im(),uY),mutateVisit:uZ}}function uJ(e,t=ic){let r=(0,s9.useRef)(void 0),{patientUuid:n,manuallySetVisitUuid:a,setVisitContext:o}=uq((0,s9.useCallback)(()=>r.current?.(),[])),i=e&&n==e?a:null,s=`?patient=${e}&v=${t}&includeInactive=false`,l=`/${i}?v=${t}`,{data:u,error:c,mutate:d,isValidating:m}=(0,lN.u)(e?`${az}/visit${s}`:null,aY),{data:p,error:f,mutate:h,isValidating:g}=(0,lN.u)(e&&i?`${az}/visit${l}`:null,aY),y=(0,s9.useMemo)(()=>u?.data.results.find(e=>null===e.stopDatetime)??null,[u]),v=(0,s9.useMemo)(()=>i&&p?p.data:null,[p,i]),b=(0,s9.useRef)(null);(0,s9.useEffect)(()=>{!m&&y&&n===e&&null===a&&o(y),g||(b.current&&v&&b.current.uuid===v.uuid&&!b.current.stopDatetime&&v.stopDatetime&&o(null),b.current=v)},[v,a,y,m,g,n]);let w=(0,s9.useCallback)(()=>{d(),h()},[d,h]);(0,s9.useEffect)(()=>{r.current=w},[w]);let E=!!(!u||i&&!p),D=!!(i?f:c);return{error:c||f,mutate:w,isValidating:m||g,activeVisit:y,currentVisit:v,currentVisitIsRetrospective:!!i,isLoading:E&&!D}}uH.extend(uK);let uX=[];function uQ(){let{data:e}=ur(ii,is);return e??uX}let u0=new Map;async function u1(e,t){let r=t.indexOf("#"),n=r>=0,a=n?t.substring(0,r):e,o=n?t.substring(r+1):t,i=await oN(a);return i&&Object.hasOwn(i,o)&&"function"==typeof i[o]?u2(a,i).then(()=>i[o]()):(i?i&&Object.hasOwn(i,o)?console.warn(`The export ${t}, defined in ${e}'s routes.json, is not a function`):console.warn(`${a} does not define a component called "${o}", referenced in ${e}'s routes.json. This cannot be loaded.`):console.warn(`Unknown app ${a} for ${t} defined in ${e}'s routes.json`),u4)}let u4={bootstrap:()=>Promise.resolve(),mount:()=>Promise.resolve(),unmount:()=>Promise.resolve()};async function u2(e,t){if(e in u0)await u0[e];else{let r=t??await oN(e);await (u0[e]=new Promise((t,n)=>{if(Object.hasOwn(r,"startupApp")){let a=r.startupApp;if("function"==typeof a)return Promise.resolve(a()).then(()=>{nJ(e),t(null)}).catch(n)}nJ(e),t(null)}))}}function u3(e,t){let r=t.name;if(!r)return void console.error(`An extension definition in ${e} is missing an name and thus cannot be
15
+ ${this.stack}`}}let aJ=B("session",{loaded:!1,session:null}),aX=0,aQ=null;function a0(){return aQ||(aJ.getState().loaded&&aX>=Date.now()-6e4?null:a3())}function a1(e){let t=e?.includeAuthStatus??!0,r=e=>t?e:e.user,n=a0();return n?new Promise(e=>{let t=()=>{let t=aJ.getState();t.loaded&&(a(),e(r(t.session)))},a=aJ.subscribe(t);n.then(t,t)}):Promise.resolve(r(aJ.getState().session))}function a4(){return a0(),aJ}function a2(e){let t=e.locale??e.user?.userProperties?.defaultLocale;t&&t.includes("_")&&(t=t.replaceAll("_","-")),function(e){if(void 0===e||"string"!=typeof e)return!1;try{new Intl.Locale(e)}catch(e){return!1}return!0}(t)&&t!==document.documentElement.getAttribute("lang")&&document.documentElement.setAttribute("lang",t)}function a3(e,t){aX=Date.now(),a??(a=aX);let r={};e&&t&&(r.Authorization=`Basic ${window.btoa(`${e}:${t}`)}`);let n=oa(aY(aG,{headers:r,rejectAuthFailure:!0})),o=()=>{aQ===n&&(aQ=null)};return n.then(o,o),aQ=n,n}function a6(){aJ.setState({loaded:!0,session:{authenticated:!1,sessionId:""}},!0)}function a5(e,t){var r,n;if(void 0===t)return!e;if(!e)return!0;return r=e,n=t,("string"==typeof r?!K(n.privileges.find(e=>r===e.display)):Array.isArray(r)?r.every(e=>!K(n.privileges.find(t=>e===t.display))):(K(r)||console.error(`Could not understand privileges "${r}"`),!0))||!K(t.roles.find(e=>"System Developer"===e.display))}function a9(){let e,t;return new Promise(r=>{let n=n=>{n.loaded&&n.session.user&&(e=n.session.user,r(n.session.user),t&&t())};n(aJ.getState()),e||(t=aJ.subscribe(n))})}async function a8(){return(await a1()).sessionLocation}async function a7(e,t){return oa(aY(aG,{method:"POST",body:{sessionLocation:e},headers:{"Content-Type":"application/json"},rejectAuthFailure:!0,signal:t?.signal}))}async function oe(e,t){return await aY(aG,{method:"POST",body:{locale:e},headers:{"Content-Type":"application/json"},signal:t?.signal}),a3()}async function ot(e,t,r){return r||(r=new AbortController),await aY(`${az}/user/${e}`,{method:"POST",body:{userProperties:t},headers:{"Content-Type":"application/json"},signal:r.signal}),a3()}async function or(e,t=!1){let r=await aY(t?`${aG}?rememberMe=true`:aG,{headers:{"X-Totp-Code":e}});return r.data?.authenticated?(await a3()).session:r.data}async function on(){try{await aY(aG,{method:"DELETE",rejectAuthFailure:!0})}catch(e){if(!oo(e))throw e}a6(),await a3().catch(()=>{})}function oa(e){return new Promise((t,r)=>{e.then(e=>{if("object"==typeof e?.data){let r={loaded:!0,session:e.data};aJ.setState(r,!0),t(r)}else!function(e){if(!e?.redirected||!e.url)return!1;try{return new URL(e.url,window.location.href).pathname.replace(/\/+$/,"").endsWith("/initialsetup")}catch{return!1}}(e)?r(oi(Error("The session endpoint did not respond with a session"))):r(oi(Error("The server is still starting up"),!0))}).catch(e=>{var n,o;if(oo(e)){"object"==typeof(n=e.responseBody)&&null!==n&&!1===n.authenticated?aJ.setState({loaded:!0,session:e.responseBody},!0):a6(),t(aJ.getState());return}(o=e)instanceof aq&&502===o.response.status&&!aJ.getState().loaded&&void 0!==a&&Date.now()-a<18e4?r(oi(e,!0)):(k(`Failed to fetch new session information: ${e}`),r(oi(e)))})})}function oo(e){return e instanceof aq&&(401===e.response.status||403===e.response.status)}function oi(e,t=!1){return aJ.getState().loaded||aJ.setState({loaded:!1,session:null,error:e instanceof Error?e:Error(String(e)),initializing:t},!0),aJ.getState()}function os(){return"development"===window.spaEnv||"true"===localStorage.getItem("openmrs:devtools")}aJ.subscribe(e=>{e.loaded&&e.session&&a2(e.session)});let ol={"webservices.rest":"2.24.0",fhir2:"1.0.0-SNAPSHOT"};function ou(){nY("@openmrs/esm-api",aW),a3()}let oc="import-map-override:",od="import-map-overrides-disabled",om="import-map-overrides:change",op=!1,of=null,oh=null;async function og(){return oh??(oh=oy().then(({map:e,complete:t})=>(t||(oh=null),e))),oh}async function oy(){let e=document.querySelectorAll('script[type="systemjs-importmap"]'),t=[],r=!0;for(let n=0;n<e.length;n++){let a=e[n];try{if(a.src){let e=await fetch(a.src);if(!e.ok)throw Error(`Request for ${a.src} returned ${e.status} ${e.statusText}`);t.push(await e.json())}else a.textContent&&t.push(JSON.parse(a.textContent))}catch(e){r=!1,console.warn(`[import-maps] Failed to parse import map from script tag at index ${n}`,e)}}return{map:ov(t),complete:r}}function ov(e){let t={imports:{}};for(let r of e)r?.imports&&Object.assign(t.imports,r.imports);return t}function ob(){let e={};try{let t=o_();for(let r=0;r<localStorage.length;r++){let n=localStorage.key(r);if(n?.startsWith(oc)){let r=n.slice(oc.length);if(!t.includes(r)){let t=localStorage.getItem(n);t&&(e[r]=t)}}}}catch(e){console.warn("[import-maps] Failed to read import-map overrides from localStorage",e)}return{imports:e}}async function ow(){let e=await og();return op?ov([e,of??ob()]):e}async function oE(){return og()}async function oD(){return op?ov([await og(),ob()]):og()}function ox(e){if(!op)return{imports:{}};if(e){let e={};for(let t=0;t<localStorage.length;t++){let r=localStorage.key(t);if(r?.startsWith(oc)){let t=localStorage.getItem(r);t&&(e[r.slice(oc.length)]=t)}}return{imports:e}}return ob()}function o_(){if(!op)return[];try{let e=localStorage.getItem(od);if(e){let t=JSON.parse(e);if(Array.isArray(t))return t}}catch{}return[]}function oS(e){return!!op&&o_().includes(e)}function oC(e,t){if(!op)return void console.warn("[Security] Import map overrides are disabled in production mode.");try{localStorage.setItem(oc+e,t),window.dispatchEvent(new CustomEvent(om))}catch(e){console.warn("[import-maps] Failed to write import-map override to localStorage",e)}}function ok(e){if(!op)return void console.warn("[Security] Import map overrides are disabled in production mode.");try{localStorage.removeItem(oc+e);let t=o_().filter(t=>t!==e);t.length>0?localStorage.setItem(od,JSON.stringify(t)):localStorage.removeItem(od),window.dispatchEvent(new CustomEvent(om))}catch(e){console.warn("[import-maps] Failed to update import-map overrides in localStorage",e)}}function oP(){if(!op)return void console.warn("[Security] Import map overrides are disabled in production mode.");try{let e=[];for(let t=0;t<localStorage.length;t++){let r=localStorage.key(t);r?.startsWith(oc)&&e.push(r)}e.forEach(e=>localStorage.removeItem(e)),localStorage.removeItem(od),window.dispatchEvent(new CustomEvent(om))}catch(e){console.warn("[import-maps] Failed to clear import-map overrides from localStorage",e)}}function oR(e){if(!op)return void console.warn("[Security] Import map overrides are disabled in production mode.");try{let t=o_().filter(t=>t!==e);t.length>0?localStorage.setItem(od,JSON.stringify(t)):localStorage.removeItem(od),window.dispatchEvent(new CustomEvent(om))}catch(e){console.warn("[import-maps] Failed to update import-map overrides in localStorage",e)}}let oT=!1;function o$(){!oT&&(oT=!0,(op="development"===window.spaEnv)&&(of=ob()))}function oO(e){return e.replace(/[\/\-@]/g,"_")}async function oN(e,t="./start",n){var a;let o,i=!n?.maxLoadingTime||n.maxLoadingTime<=0?6e5:n.maxLoadingTime;await Promise.race([oM(e,n?.importMap),new Promise((t,r)=>{o=setTimeout(()=>{var t;r(Error(`Could not resolve requested script, ${e}, within ${(t=i)<1e3?`${t} milliseconds`:t<6e4?`${Math.floor(t/1e3)} seconds`:t<36e5?`${Math.floor(t/6e4)} minutes`:t<864e5?`${Math.floor(t/36e5)} hours`:`${Math.floor(t/864e5)} days`}.`))},i)})]),o&&clearTimeout(o);let s=oO(e),l=window[s];if(!("object"==typeof(a=l)&&null!==a&&"init"in a&&"function"==typeof a.init&&"get"in a&&"function"==typeof a.get)){let e=`The global variable ${s} does not refer to a federated module`;throw console.error(e),Error(e)}l.init(r.S.default);let u=(await l.get(t))();if("object"!=typeof u||null===u){let t=`Container for ${e} did not return an ESM module as expected`;throw console.error(t),Error(t)}return u}async function oM(e,t){if("string"!=typeof e||0===e.trim().length){let e="Attempted to call importDynamic() without supplying a package to load";throw console.error(e),Error(e)}let r=oO(e);if(!window[r]){let r=t??await oI();if(!r.imports.hasOwnProperty(e)){let t=`Could not find the package ${e} defined in the current importmap`;throw console.error(t),Error(t)}let n=r.imports[e];n.startsWith("./")&&(n=window.spaBase+n.substring(1));let a=e in ox().imports;try{return await function(e){var t;let r=(t=window)[oj]??(t[oj]=new Map),n=r.get(e);if(n)return n;if(document.head.querySelector(`script[src="${e}"]`))return console.warn(`Script at ${e} already loaded. Not loading it again.`),Promise.resolve();let a=document.createElement("script");a.src=e,a.type="text/javascript",a.async=!0;let o=new Promise((t,n)=>{let o=setTimeout(()=>{console.error(`The script at ${e} did not load within 5 seconds. This may indicate an issue with the imports in the script's entry-point file or with the script's bundler configuration.`)},5e3);function i(){clearTimeout(o),a.removeEventListener("load",s),a.removeEventListener("error",l)}function s(){i(),t()}function l(t){i(),r.delete(e),a.remove();let o=`Failed to load script from ${e}`;console.error(o,t),n(t.message??o)}a.addEventListener("load",s),a.addEventListener("error",l),document.head.appendChild(a)});return r.set(e,o),o}(n)}catch(e){return a&&E({kind:"error",title:aO("scriptLoadingFailed","Error: Script failed to load"),description:aO("scriptLoadingError","Failed to load overridden script from {{- url}}. Please check that the bundled script is available at the expected URL. Click the button below to reset all import map overrides.",{url:n}),actionButtonLabel:aO("resetOverrides","Reset overrides"),onActionButtonClick(){oP(),window.location.reload()}}),Promise.reject(e)}}return Promise.resolve()}async function oI(){return ow()}let oj=Symbol.for("__openmrs_script_loading");function oA(e){return!!e&&"object"==typeof e&&!(Object.hasOwn(e,"pages")&&(!e.pages||!Array.isArray(e.pages))||Object.hasOwn(e,"extensions")&&(!e.extensions||!Array.isArray(e.extensions))||Object.hasOwn(e,"modals")&&(!e.modals||!Array.isArray(e.modals))||Object.hasOwn(e,"workspaces2")&&(!e.workspaces2||!Array.isArray(e.workspaces2))||Object.hasOwn(e,"workspaceWindows2")&&(!e.workspaceWindows2||!Array.isArray(e.workspaceWindows2))||Object.hasOwn(e,"workspaceGroups2")&&(!e.workspaceGroups2||!Array.isArray(e.workspaceGroups2)))}function oL(e){return!!e&&"object"==typeof e&&"routes"in e&&!!e.routes&&"object"==typeof e.routes&&Object.entries(e.routes).every(([e,t])=>"string"==typeof e&&oA(t))}let oF="openmrs-routes:",oB="openmrs-routes:change",oV=!1,oU=null,oW=null;async function oH(){return oW??(oW=oz().then(({map:e,complete:t})=>(t||(oW=null),e))),oW}async function oz(){let e=document.querySelectorAll("script[type='openmrs-routes']"),t=[],r=!0;for(let n=0;n<e.length;n++){let a=e[n];try{let e;if(a.src){let t=await fetch(a.src);if(!t.ok)throw Error(`Request for ${a.src} returned ${t.status} ${t.statusText}`);e=await t.json()}else a.textContent&&(e=JSON.parse(a.textContent));e&&oL(e)&&t.push(e)}catch(e){r=!1,console.warn(`[route-maps] Failed to parse routes from script tag at index ${n}`,e)}}return{map:oK(t),complete:r}}function oK(e){let t={routes:{}};for(let r of e)r&&"object"==typeof r&&!Array.isArray(r)&&(Object.assign(t.routes,r.routes),void 0===t.version&&void 0!==r.version&&(t.version=r.version));return t}async function oG(){let e={version:void 0,routes:{}};try{let t=[];for(let e=0;e<localStorage.length;e++){let r=localStorage.key(e);if(r?.startsWith(oF)){let e=localStorage.getItem(r);e&&t.push({moduleName:r.slice(oF.length),raw:e})}}for(let r of(await Promise.allSettled(t.map(async({moduleName:e,raw:t})=>{let r=JSON.parse(t);if(oA(r))return{moduleName:e,routes:r};if("string"==typeof r&&r.startsWith("http")){let t=await fetch(r),n=await t.json();if(oA(n))return{moduleName:e,routes:n};throw Error(`${r} did not resolve to a valid OpenmrsAppRoutes object`)}throw Error(`Override for ${e} is neither a valid routes object nor a URL`)}))))"fulfilled"===r.status?e.routes[r.value.moduleName]=r.value.routes:console.warn("[route-maps] Failed to load route override",r.reason)}catch(e){console.warn("[route-maps] Failed to read route overrides from localStorage",e)}return e}async function oZ(){let e=await oH();return oV?oK([e,oU??await oG()]):e}async function oY(){return oH()}async function oq(){return oV?oK([await oH(),await oG()]):oH()}function oJ(){if(!oV)return{};let e={};try{for(let t=0;t<localStorage.length;t++){let r=localStorage.key(t);if(r?.startsWith(oF)){let t=localStorage.getItem(r);t&&(e[r.slice(oF.length)]=t)}}}catch(e){console.warn("[route-maps] Failed to read route overrides from localStorage",e)}return e}function oX(e,t){if(!oV)return void console.warn("[Security] Route overrides are disabled outside development mode.");try{if("string"==typeof t)if(t.startsWith("http"))localStorage.setItem(oF+e,JSON.stringify(t));else{let r=JSON.parse(t);if(!oA(r))return void console.error(`The supplied routes for ${e} is not a valid OpenmrsAppRoutes object`,t);localStorage.setItem(oF+e,JSON.stringify(r))}else if(t instanceof URL)localStorage.setItem(oF+e,JSON.stringify(t.toString()));else{if(!oA(t))return void console.error(`Override for ${e} is not in a valid format. Expected either a Javascript Object, a JSON string of a Javascript object, or a URL`,t);localStorage.setItem(oF+e,JSON.stringify(t))}window.dispatchEvent(new CustomEvent(oB))}catch(e){console.warn("[route-maps] Failed to write route override to localStorage",e)}}function oQ(e){if(!oV)return void console.warn("[Security] Route overrides are disabled outside development mode.");try{localStorage.removeItem(oF+e),window.dispatchEvent(new CustomEvent(oB))}catch(e){console.warn("[route-maps] Failed to remove route override from localStorage",e)}}function o0(){if(!oV)return void console.warn("[Security] Route overrides are disabled outside development mode.");try{let e=[];for(let t=0;t<localStorage.length;t++){let r=localStorage.key(t);r?.startsWith(oF)&&e.push(r)}e.forEach(e=>localStorage.removeItem(e)),window.dispatchEvent(new CustomEvent(oB))}catch(e){console.warn("[route-maps] Failed to clear route overrides from localStorage",e)}}let o1=null;function o4(){return o1||(o1=(oV="development"===window.spaEnv)?oG().then(e=>{oU=e}):Promise.resolve())}let o2=`${az}/attachment`;function o3(e,t){return aY(`${o2}/${e}`,{signal:t.signal})}function o6(e,t,r,n){return aY(o5(e,t,n),{signal:r.signal})}function o5(e,t,r){return r?`${o2}?patient=${e}&encounter=${r}`:`${o2}?patient=${e}&includeEncounterless=${t}`}async function o9(e,t,r){let n=new FormData;return n.append("fileCaption",t.fileDescription),n.append("patient",e),r&&n.append("encounter",r),t.file?n.append("file",t.file,t.fileName):(n.append("file",new File([""],t.fileName),t.fileName),n.append("base64Content",t.base64Content)),aY(`${o2}`,{method:"POST",body:n})}function o8(e,t){return aY(`${o2}/${e}`,{method:"DELETE",signal:t.signal})}async function o7(e,t){return e?(await aY(`${aK}/Patient/${e}`,t)).data:null}function ie(e,t){let r=new CustomEvent(`openmrs:${e}`,{detail:t??void 0,cancelable:!0,bubbles:!0});return window.dispatchEvent(r)}function it(e,t){let r=e=>{t("detail"in e&&null!==e.detail?e.detail:void 0)};return window.addEventListener(`openmrs:${e}`,r),()=>{window.removeEventListener(`openmrs:${e}`,r)}}function ir(e){return{uuid:e.uuid,display:e.display}}function ia(e=null,t=null){let r=new URLSearchParams;e&&r.set("tag",e),t&&r.set("q",t);let n=r.toString();return aY(`${az}/location${n?"?"+n:""}`).then(e=>e.data.results.map(ir))}function io(e){return{uuid:e.uuid,display:e.display,name:e.name}}let ii=`${az}/visittype`;function is(e=ii){return aY(e).then(e=>e.data.results.map(io))}var il=((et={}).NEWVISIT="startVisit",et.EDITVISIT="editVisit",et.LOADING="loadingVisit",et),iu=((er={}).NOTSTARTED="notStarted",er.ONGOING="ongoing",er);let ic="custom:(uuid,display,voided,indication,startDatetime,stopDatetime,encounters:(uuid,display,encounterDatetime,form:(uuid,name),location:ref,encounterType:ref,encounterProviders:(uuid,display,provider:(uuid,display))),patient:(uuid,display),visitType:(uuid,name,display),attributes:(uuid,display,attributeType:(name,datatypeClassname,uuid),value),location:(uuid,name,display))",id=function(){try{return JSON.parse(sessionStorage.getItem("openmrs:visitStoreState")||"null")}catch(e){return null}}()||{patientUuid:null,manuallySetVisitUuid:null};function im(){return W("visit",id)}function ip(e,t){im().setState({patientUuid:e,manuallySetVisitUuid:t})}function ih(e,t){return aY(`${az}/visit`,{signal:t.signal,method:"POST",headers:{"Content-type":"application/json"},body:e})}function ig(e,t,r){return aY(`${az}/visit/${e}`,{signal:r.signal,method:"POST",headers:{"Content-type":"application/json"},body:t})}function iy(e,t,r){return aY(`${az}/visit?patient=${e}&v=${r??ic}`,{signal:t.signal,method:"GET",headers:{"Content-type":"application/json"}})}im().subscribe(e=>{var t;t=e,sessionStorage.setItem("openmrs:visitStoreState",JSON.stringify(t))});class iv{static get version(){return"1.4.0"}static toString(){return"JavaScript Expression Parser (JSEP) v"+iv.version}static addUnaryOp(e){return iv.max_unop_len=Math.max(e.length,iv.max_unop_len),iv.unary_ops[e]=1,iv}static addBinaryOp(e,t,r){return iv.max_binop_len=Math.max(e.length,iv.max_binop_len),iv.binary_ops[e]=t,r?iv.right_associative.add(e):iv.right_associative.delete(e),iv}static addIdentifierChar(e){return iv.additional_identifier_chars.add(e),iv}static addLiteral(e,t){return iv.literals[e]=t,iv}static removeUnaryOp(e){return delete iv.unary_ops[e],e.length===iv.max_unop_len&&(iv.max_unop_len=iv.getMaxKeyLen(iv.unary_ops)),iv}static removeAllUnaryOps(){return iv.unary_ops={},iv.max_unop_len=0,iv}static removeIdentifierChar(e){return iv.additional_identifier_chars.delete(e),iv}static removeBinaryOp(e){return delete iv.binary_ops[e],e.length===iv.max_binop_len&&(iv.max_binop_len=iv.getMaxKeyLen(iv.binary_ops)),iv.right_associative.delete(e),iv}static removeAllBinaryOps(){return iv.binary_ops={},iv.max_binop_len=0,iv}static removeLiteral(e){return delete iv.literals[e],iv}static removeAllLiterals(){return iv.literals={},iv}get char(){return this.expr.charAt(this.index)}get code(){return this.expr.charCodeAt(this.index)}constructor(e){this.expr=e,this.index=0}static parse(e){return new iv(e).parse()}static getMaxKeyLen(e){return Math.max(0,...Object.keys(e).map(e=>e.length))}static isDecimalDigit(e){return e>=48&&e<=57}static binaryPrecedence(e){return iv.binary_ops[e]||0}static isIdentifierStart(e){return e>=65&&e<=90||e>=97&&e<=122||e>=128&&!iv.binary_ops[String.fromCharCode(e)]||iv.additional_identifier_chars.has(String.fromCharCode(e))}static isIdentifierPart(e){return iv.isIdentifierStart(e)||iv.isDecimalDigit(e)}throwError(e){let t=Error(e+" at character "+this.index);throw t.index=this.index,t.description=e,t}runHook(e,t){if(iv.hooks[e]){let r={context:this,node:t};return iv.hooks.run(e,r),r.node}return t}searchHook(e){if(iv.hooks[e]){let t={context:this};return iv.hooks[e].find(function(e){return e.call(t.context,t),t.node}),t.node}}gobbleSpaces(){let e=this.code;for(;e===iv.SPACE_CODE||e===iv.TAB_CODE||e===iv.LF_CODE||e===iv.CR_CODE;)e=this.expr.charCodeAt(++this.index);this.runHook("gobble-spaces")}parse(){this.runHook("before-all");let e=this.gobbleExpressions(),t=1===e.length?e[0]:{type:iv.COMPOUND,body:e};return this.runHook("after-all",t)}gobbleExpressions(e){let t=[],r,n;for(;this.index<this.expr.length;)if((r=this.code)===iv.SEMCOL_CODE||r===iv.COMMA_CODE)this.index++;else if(n=this.gobbleExpression())t.push(n);else if(this.index<this.expr.length){if(r===e)break;this.throwError('Unexpected "'+this.char+'"')}return t}gobbleExpression(){let e=this.searchHook("gobble-expression")||this.gobbleBinaryExpression();return this.gobbleSpaces(),this.runHook("after-expression",e)}gobbleBinaryOp(){this.gobbleSpaces();let e=this.expr.substr(this.index,iv.max_binop_len),t=e.length;for(;t>0;){if(iv.binary_ops.hasOwnProperty(e)&&(!iv.isIdentifierStart(this.code)||this.index+e.length<this.expr.length&&!iv.isIdentifierPart(this.expr.charCodeAt(this.index+e.length))))return this.index+=t,e;e=e.substr(0,--t)}return!1}gobbleBinaryExpression(){let e,t,r,n,a,o,i,s,l;if(!(o=this.gobbleToken())||!(t=this.gobbleBinaryOp()))return o;for(a={value:t,prec:iv.binaryPrecedence(t),right_a:iv.right_associative.has(t)},(i=this.gobbleToken())||this.throwError("Expected expression after "+t),n=[o,a,i];t=this.gobbleBinaryOp();){if(0===(r=iv.binaryPrecedence(t))){this.index-=t.length;break}a={value:t,prec:r,right_a:iv.right_associative.has(t)},l=t;let s=e=>a.right_a&&e.right_a?r>e.prec:r<=e.prec;for(;n.length>2&&s(n[n.length-2]);)i=n.pop(),t=n.pop().value,o=n.pop(),e={type:iv.BINARY_EXP,operator:t,left:o,right:i},n.push(e);(e=this.gobbleToken())||this.throwError("Expected expression after "+l),n.push(a,e)}for(s=n.length-1,e=n[s];s>1;)e={type:iv.BINARY_EXP,operator:n[s-1].value,left:n[s-2],right:e},s-=2;return e}gobbleToken(){let e,t,r,n;if(this.gobbleSpaces(),n=this.searchHook("gobble-token"))return this.runHook("after-token",n);if(e=this.code,iv.isDecimalDigit(e)||e===iv.PERIOD_CODE)return this.gobbleNumericLiteral();if(e===iv.SQUOTE_CODE||e===iv.DQUOTE_CODE)n=this.gobbleStringLiteral();else if(e===iv.OBRACK_CODE)n=this.gobbleArray();else{for(r=(t=this.expr.substr(this.index,iv.max_unop_len)).length;r>0;){if(iv.unary_ops.hasOwnProperty(t)&&(!iv.isIdentifierStart(this.code)||this.index+t.length<this.expr.length&&!iv.isIdentifierPart(this.expr.charCodeAt(this.index+t.length)))){this.index+=r;let e=this.gobbleToken();return e||this.throwError("missing unaryOp argument"),this.runHook("after-token",{type:iv.UNARY_EXP,operator:t,argument:e,prefix:!0})}t=t.substr(0,--r)}iv.isIdentifierStart(e)?(n=this.gobbleIdentifier(),iv.literals.hasOwnProperty(n.name)?n={type:iv.LITERAL,value:iv.literals[n.name],raw:n.name}:n.name===iv.this_str&&(n={type:iv.THIS_EXP})):e===iv.OPAREN_CODE&&(n=this.gobbleGroup())}return n?(n=this.gobbleTokenProperty(n),this.runHook("after-token",n)):this.runHook("after-token",!1)}gobbleTokenProperty(e){this.gobbleSpaces();let t=this.code;for(;t===iv.PERIOD_CODE||t===iv.OBRACK_CODE||t===iv.OPAREN_CODE||t===iv.QUMARK_CODE;){let r;if(t===iv.QUMARK_CODE){if(this.expr.charCodeAt(this.index+1)!==iv.PERIOD_CODE)break;r=!0,this.index+=2,this.gobbleSpaces(),t=this.code}this.index++,t===iv.OBRACK_CODE?((e={type:iv.MEMBER_EXP,computed:!0,object:e,property:this.gobbleExpression()}).property||this.throwError('Unexpected "'+this.char+'"'),this.gobbleSpaces(),(t=this.code)!==iv.CBRACK_CODE&&this.throwError("Unclosed ["),this.index++):t===iv.OPAREN_CODE?e={type:iv.CALL_EXP,arguments:this.gobbleArguments(iv.CPAREN_CODE),callee:e}:(t===iv.PERIOD_CODE||r)&&(r&&this.index--,this.gobbleSpaces(),e={type:iv.MEMBER_EXP,computed:!1,object:e,property:this.gobbleIdentifier()}),r&&(e.optional=!0),this.gobbleSpaces(),t=this.code}return e}gobbleNumericLiteral(){let e="",t,r;for(;iv.isDecimalDigit(this.code);)e+=this.expr.charAt(this.index++);if(this.code===iv.PERIOD_CODE)for(e+=this.expr.charAt(this.index++);iv.isDecimalDigit(this.code);)e+=this.expr.charAt(this.index++);if("e"===(t=this.char)||"E"===t){for(e+=this.expr.charAt(this.index++),("+"===(t=this.char)||"-"===t)&&(e+=this.expr.charAt(this.index++));iv.isDecimalDigit(this.code);)e+=this.expr.charAt(this.index++);iv.isDecimalDigit(this.expr.charCodeAt(this.index-1))||this.throwError("Expected exponent ("+e+this.char+")")}return r=this.code,iv.isIdentifierStart(r)?this.throwError("Variable names cannot start with a number ("+e+this.char+")"):(r===iv.PERIOD_CODE||1===e.length&&e.charCodeAt(0)===iv.PERIOD_CODE)&&this.throwError("Unexpected period"),{type:iv.LITERAL,value:parseFloat(e),raw:e}}gobbleStringLiteral(){let e="",t=this.index,r=this.expr.charAt(this.index++),n=!1;for(;this.index<this.expr.length;){let t=this.expr.charAt(this.index++);if(t===r){n=!0;break}if("\\"===t)switch(t=this.expr.charAt(this.index++)){case"n":e+="\n";break;case"r":e+="\r";break;case"t":e+=" ";break;case"b":e+="\b";break;case"f":e+="\f";break;case"v":e+="\v";break;default:e+=t}else e+=t}return n||this.throwError('Unclosed quote after "'+e+'"'),{type:iv.LITERAL,value:e,raw:this.expr.substring(t,this.index)}}gobbleIdentifier(){let e=this.code,t=this.index;for(iv.isIdentifierStart(e)?this.index++:this.throwError("Unexpected "+this.char);this.index<this.expr.length;)if(e=this.code,iv.isIdentifierPart(e))this.index++;else break;return{type:iv.IDENTIFIER,name:this.expr.slice(t,this.index)}}gobbleArguments(e){let t=[],r=!1,n=0;for(;this.index<this.expr.length;){this.gobbleSpaces();let a=this.code;if(a===e){r=!0,this.index++,e===iv.CPAREN_CODE&&n&&n>=t.length&&this.throwError("Unexpected token "+String.fromCharCode(e));break}if(a===iv.COMMA_CODE){if(this.index++,++n!==t.length){if(e===iv.CPAREN_CODE)this.throwError("Unexpected token ,");else if(e===iv.CBRACK_CODE)for(let e=t.length;e<n;e++)t.push(null)}}else if(t.length!==n&&0!==n)this.throwError("Expected comma");else{let e=this.gobbleExpression();e&&e.type!==iv.COMPOUND||this.throwError("Expected comma"),t.push(e)}}return r||this.throwError("Expected "+String.fromCharCode(e)),t}gobbleGroup(){this.index++;let e=this.gobbleExpressions(iv.CPAREN_CODE);if(this.code===iv.CPAREN_CODE)return(this.index++,1===e.length)?e[0]:!!e.length&&{type:iv.SEQUENCE_EXP,expressions:e};this.throwError("Unclosed (")}gobbleArray(){return this.index++,{type:iv.ARRAY_EXP,elements:this.gobbleArguments(iv.CBRACK_CODE)}}}Object.assign(iv,{hooks:new class{add(e,t,r){if("string"!=typeof arguments[0])for(let e in arguments[0])this.add(e,arguments[0][e],arguments[1]);else(Array.isArray(e)?e:[e]).forEach(function(e){this[e]=this[e]||[],t&&this[e][r?"unshift":"push"](t)},this)}run(e,t){this[e]=this[e]||[],this[e].forEach(function(e){e.call(t&&t.context?t.context:t,t)})}},plugins:new class{constructor(e){this.jsep=e,this.registered={}}register(...e){e.forEach(e=>{if("object"!=typeof e||!e.name||!e.init)throw Error("Invalid JSEP plugin format");this.registered[e.name]||(e.init(this.jsep),this.registered[e.name]=e)})}}(iv),COMPOUND:"Compound",SEQUENCE_EXP:"SequenceExpression",IDENTIFIER:"Identifier",MEMBER_EXP:"MemberExpression",LITERAL:"Literal",THIS_EXP:"ThisExpression",CALL_EXP:"CallExpression",UNARY_EXP:"UnaryExpression",BINARY_EXP:"BinaryExpression",ARRAY_EXP:"ArrayExpression",TAB_CODE:9,LF_CODE:10,CR_CODE:13,SPACE_CODE:32,PERIOD_CODE:46,COMMA_CODE:44,SQUOTE_CODE:39,DQUOTE_CODE:34,OPAREN_CODE:40,CPAREN_CODE:41,OBRACK_CODE:91,CBRACK_CODE:93,QUMARK_CODE:63,SEMCOL_CODE:59,COLON_CODE:58,unary_ops:{"-":1,"!":1,"~":1,"+":1},binary_ops:{"||":1,"??":1,"&&":2,"|":3,"^":4,"&":5,"==":6,"!=":6,"===":6,"!==":6,"<":7,">":7,"<=":7,">=":7,"<<":8,">>":8,">>>":8,"+":9,"-":9,"*":10,"/":10,"%":10,"**":11},right_associative:new Set(["**"]),additional_identifier_chars:new Set(["$","_"]),literals:{true:!0,false:!1,null:null},this_str:"this"}),iv.max_unop_len=iv.getMaxKeyLen(iv.unary_ops),iv.max_binop_len=iv.getMaxKeyLen(iv.binary_ops);let ib=e=>new iv(e).parse(),iw=Object.getOwnPropertyNames(class{});Object.getOwnPropertyNames(iv).filter(e=>!iw.includes(e)&&void 0===ib[e]).forEach(e=>{ib[e]=iv[e]}),ib.Jsep=iv,ib.plugins.register({name:"ternary",init(e){e.hooks.add("after-expression",function(t){if(t.node&&this.code===e.QUMARK_CODE){this.index++;let r=t.node,n=this.gobbleExpression();if(n||this.throwError("Expected expression"),this.gobbleSpaces(),this.code===e.COLON_CODE){this.index++;let a=this.gobbleExpression();if(a||this.throwError("Expected expression"),t.node={type:"ConditionalExpression",test:r,consequent:n,alternate:a},r.operator&&e.binary_ops[r.operator]<=.9){let n=r;for(;n.right.operator&&e.binary_ops[n.right.operator]<=.9;)n=n.right;t.node.test=n.right,n.right=t.node,t.node=r}}else this.throwError("Expected :")}})}});let iE="ArrowFunctionExpression",iD={Array,Boolean,Symbol,Infinity,NaN,Math,Number,BigInt,String,RegExp,JSON,isFinite,isNaN,parseFloat,parseInt,decodeURI,encodeURI,encodeURIComponent,Object:{__proto__:void 0,assign:Object.assign.bind(null),fromEntries:Object.fromEntries.bind(null),hasOwn:Object.hasOwn.bind(null),keys:Object.keys.bind(null),is:Object.is.bind(null),values:Object.values.bind(null)}},ix={...iD,Promise};function i_(e,t={}){return iT(e,t,iN)}async function iS(e,t={}){return i$(e,t,iN)}function iC(e,t={}){return iT(e,t,iM)}function ik(e,t={}){return i$(e,t,iM)}function iP(e,t={}){return iT(e,t,iI)}function iR(e,t={}){return i$(e,t,iI)}function iT(e,t={},r){if("string"!=typeof e&&("object"!=typeof e||!e||!("type"in e)))throw`Unknown expression type ${e}. Expressions must either be a string or pre-compiled string.`;if("string"==typeof e&&0===e.trim().length)throw{type:"Empty expression",message:"Expression cannot be an empty string"};null==t&&(t={});let n=iB(t,iD),a=ij("string"==typeof e?ib(e):e,n);if(r(a))return a;throw{type:"Invalid result",message:"string"==typeof e?`The expression ${e} did not produce a valid result`:"The expression did not produce a valid result"}}async function i$(e,t={},r){if("string"!=typeof e&&("object"!=typeof e||!e||!("type"in e)))return Promise.reject(`Unknown expression type ${e}. Expressions must either be a string or pre-compiled string.`);if("string"==typeof e&&0===e.trim().length)throw{type:"Empty expression",message:"Expression cannot be an empty string"};null==t&&(t={});let n=iB(t,ix);return Promise.resolve(ij("string"==typeof e?ib(e):e,n)).then(t=>{if(r(t))return t;throw{type:"Invalid result",message:"string"==typeof e?`The expression ${e} did not produce a valid result`:"The expression did not produce a valid result"}})}function iO(e){return ib(e)}function iN(e){return"string"==typeof e||"number"==typeof e||"boolean"==typeof e||null==e||e instanceof Date}function iM(e){return"boolean"==typeof e}function iI(e){return"number"==typeof e}function ij(e,t){switch(e.type){case"UnaryExpression":var r,n,a,o,i,s,l,u,c,d,m,p,f,h=e,g=t;let y=ij(h.argument,g);switch(h.operator){case"+":return+y;case"-":return-y;case"~":return~y;case"!":return!y;default:throw`Expression evaluator does not support operator '${h.operator}''`}case"BinaryExpression":var v=e,b=t;switch(v.operator){case"&&":return ij(v.left,b)&&ij(v.right,b);case"||":return ij(v.left,b)||ij(v.right,b);case"??":return ij(v.left,b)??ij(v.right,b)}let w=ij(v.left,b),E=ij(v.right,b);switch(v.operator){case"+":return w+E;case"-":return w-E;case"*":return w*E;case"/":return w/E;case"%":return w%E;case"**":return w**E;case"==":return w==E;case"===":return w===E;case"!=":return w!=E;case"!==":return w!==E;case">":return w>E;case">=":return w>=E;case"<":return w<E;case"<=":return w<=E;case"in":return w in E;default:throw`Expression evaluator does not support operator '${v.operator}' operator`}case"ConditionalExpression":return r=e,n=t,ij(r.test,n)?ij(r.consequent,n):ij(r.alternate,n);case"CallExpression":return iW(iL(e,t));case"ArrowFunctionExpression":let D;return a=e,o=t,D=a.params?.map(e=>{if("Identifier"===e.type)return e.name;throw`Cannot handle parameter of type ${e.type}`})??[],(function(...e){if(e.length<D.length)throw`Required argument(s) ${D.slice(e.length,-1).join(", ")} were not provided`;let t=Object.fromEntries(D.reduce((t,r,n)=>{let a=e[n];return function e(t){if("string"==typeof t||"number"==typeof t||"boolean"==typeof t||"function"==typeof t||null===t||t instanceof RegExp)return!0;if("object"==typeof t){for(let r of Object.keys(t))if(!e(t[r]))return!1;return!0}if(Array.isArray(t)){for(let r of t)if(!e(r))break}return!1}(a)&&t.push([r,a]),t},[]));return ij(a.body,o.addVariables(t))}).bind(null);case"MemberExpression":return iW(iF(e,t));case"ArrayExpression":return i=e,s=t,i.elements?.map(iH(s));case"SequenceExpression":let x;return l=e,u=t,(x=l.expressions.map(iH(u)))[x.length-1];case"NewExpression":var _=e,S=t;if(_.callee&&"Identifier"===_.callee.type){let e=_.arguments?.map(iH(S));switch(_.callee.name){case"Date":return new Date(...e);case"RegExp":return new RegExp(...e);default:throw`Cannot instantiate object of type ${_.callee.name}`}}if(_.callee)throw"new must be called with either Date or RegExp";throw'Could not handle "new" without a specified class';case"Literal":return e.value;case"Identifier":return c=e,d=t,(iz(c.name),d.variables&&Object.hasOwn(d.variables,c.name))?d.variables[c.name]:Object.hasOwn(d.globals,c.name)?d.globals[c.name]:void 0;case"TemplateLiteral":let C,k;return m=e,p=t,C=m.expressions?.map(iH(p))??[],(k=m.quasis?.map(iH(p))??[]).filter(e=>!e.tail).map(e=>e.value).join("")+C.join("")+k.filter(e=>e.tail).map(e=>e.value).join("");case"TemplateElement":return{value:(f=e).cooked,tail:f.tail};default:throw`Expression evaluator does not support expression of type '${e.type}'`}}function iA(e,t){switch(e.type){case"Literal":return e.value;case"Identifier":return e.name;case"MemberExpression":return iA(e.property,t);default:throw`VisitExpressionName does not support expression of type '${e.type}'`}}function iL(e,t){let r=iU(e.callee,t);if(r===iV||e.optional&&null==r)return iV;let n=e.arguments?.map(iH(t));if(r){if("function"!=typeof r)throw`${iZ(e.callee)} is not a function`}else throw`No function named ${iZ(e.callee)} is defined in this context`;return r(...n)}function iF(e,t){let r=iU(e.object,t);if(r===iV||e.optional&&null==r)return iV;if(null===r)throw TypeError(`TypeError: cannot read properties of null (reading '${iG(e.property,t)}')`);if(void 0===r)switch(e.object.type){case"Identifier":{let r=iA(e.object,t);throw ReferenceError(`ReferenceError: ${r} is not defined`)}case"MemberExpression":throw TypeError(`TypeError: cannot read properties of undefined (reading '${iG(e.property,t)}')`);default:throw`VisitMemberExpression does not support operator '${e.object.type}' type`}if("object"!=typeof r&&"function"!=typeof r&&"string"!=typeof r&&"number"!=typeof r)throw`VisitMemberExpression does not support member access on type ${typeof r}`;let n=e.computed?function(e){if(void 0===e)throw{type:"Illegal property access",message:"No property was supplied to the property access"};if("string"!=typeof e&&"number"!=typeof e)throw{type:"Illegal property access",message:`Cannot use a value of type ${null===e?"null":typeof e} as a property name`};return e}(ij(e.property,t)):function(e){if("Identifier"!==e.type)throw`VisitMemberExpression does not support a property of type '${e.type}'`;return e.name}(e.property);iz(n),function(e,t){if(iK.has(String(t)))return;let r=Object(e);for(;null!==r;){if(Object.hasOwn(r,t)){if(r===Object.prototype||r===Function.prototype)throw{type:"Illegal property access",message:`Cannot access the ${t} property of objects`};return}r=Object.getPrototypeOf(r)}}(r,n);let a=r[n];return"function"==typeof a?a.bind(r):a}function iB(e,t){let r={variables:{...e},globals:{...t},addVariables(e){return this.variables={...this.variables,...e},this}};return r.addVariables.bind(r),r}ib.plugins.register({name:"arrow",init(e){e.addBinaryOp("=>",.1,!0),e.hooks.add("gobble-expression",function(t){if(this.gobbleSpaces(),this.code===e.OPAREN_CODE){let r=this.index;if(this.index++,this.gobbleSpaces(),this.code===e.CPAREN_CODE){this.index++;let e=this.gobbleBinaryOp();if("=>"===e){let r=this.gobbleBinaryExpression();r||this.throwError("Expected expression after "+e),t.node={type:iE,params:null,body:r};return}}this.index=r}}),e.hooks.add("after-expression",function(t){!function t(r){r&&(Object.values(r).forEach(e=>{e&&"object"==typeof e&&t(e)}),"=>"===r.operator&&(r.type=iE,r.params=r.left?[r.left]:null,r.body=r.right,r.params&&r.params[0].type===e.SEQUENCE_EXP&&(r.params=r.params[0].expressions),delete r.left,delete r.right,delete r.operator))}(t.node)})}}),ib.plugins.register({name:"new",init(e){e.addUnaryOp("new"),e.hooks.add("after-token",function(t){let r=t.node;if(r&&"new"===r.operator){r.argument&&[e.CALL_EXP,e.MEMBER_EXP].includes(r.argument.type)||this.throwError("Expected new function()"),t.node=r.argument;let n=t.node;for(;n.type===e.MEMBER_EXP||n.type===e.CALL_EXP&&n.callee.type===e.MEMBER_EXP;)n=n.type===e.MEMBER_EXP?n.object:n.callee.object;n.type="NewExpression"}})}}),ib.plugins.register({name:"numbers",init(e){function t(e){return"x"===e||"X"===e?(this.index+=2,[[48,57],[65,70],[97,102]]):"b"===e||"B"===e?(this.index+=2,[[48,49]]):"o"===e||"O"===e||e>="0"&&e<="7"?(this.index+=e<="7"?1:2,[[48,55]]):null}function r(t){let r=this.index,n="",a=()=>{for(;e.isDecimalDigit(this.code)||95===this.code;)95===this.code?this.index++:n+=this.expr.charAt(this.index++)};a(),this.code===e.PERIOD_CODE&&(n+=this.expr.charAt(this.index++),a());let o=this.char;("e"===o||"E"===o)&&(n+=this.expr.charAt(this.index++),("+"===(o=this.char)||"-"===o)&&(n+=this.expr.charAt(this.index++)),a(),e.isDecimalDigit(this.expr.charCodeAt(this.index-1))||this.throwError("Expected exponent ("+n+this.char+")"));let i=this.code;if(e.isIdentifierStart(i))this.throwError("Variable names cannot start with a number ("+n+this.char+")");else if(i===e.PERIOD_CODE){n.length>1&&this.throwError(`Unexpected period ${JSON.stringify({chCode:i,number:n},null,2)}`),this.index=r;return}t.node={type:e.LITERAL,value:parseFloat(n),raw:this.expr.substring(r,this.index)}}e.hooks.add("gobble-token",function(n){if(48===this.code){var a,o,i;let s=this.index,l=this.expr.charAt(this.index+1),u=t.call(this,l);if(!u)return;let c="";for(;a=this.code,o=u,95===a||o.some(([e,t])=>a>=e&&a<=t);)95===this.code?this.index++:c+=this.expr.charAt(this.index++);if(e.isIdentifierPart(this.code)){if(e.isDecimalDigit(this.code)&&e.isDecimalDigit(l.charCodeAt(0))){this.index=s+1,r.call(this,n);return}this.throwError("unexpected char within number")}n.node={type:e.LITERAL,value:parseInt(c,"x"===(i=l)||"X"===i?16:"b"===i||"B"===i?2:8),raw:this.expr.substring(s,this.index)}}else(e.isDecimalDigit(this.code)||this.code===e.PERIOD_CODE)&&r.call(this,n)})}}),ib.plugins.register({name:"regex",init(e){e.hooks.add("gobble-token",function(t){if(47===this.code){let r=++this.index,n=!1;for(;this.index<this.expr.length;){if(47===this.code&&!n){let n,a=this.expr.slice(r,this.index),o="";for(;++this.index<this.expr.length;){let e=this.code;if(e>=97&&e<=122||e>=65&&e<=90||e>=48&&e<=57)o+=this.char;else break}try{n=new RegExp(a,o)}catch(e){this.throwError(e.message)}return t.node={type:e.LITERAL,value:n,raw:this.expr.slice(r-1,this.index)},t.node=this.gobbleTokenProperty(t.node),t.node}this.code===e.OBRACK_CODE?n=!0:n&&this.code===e.CBRACK_CODE&&(n=!1),this.index+=92===this.code?2:1}this.throwError("Unclosed Regex")}})}}),ib.plugins.register({name:"ternary",init(e){e.hooks.add("after-expression",function(t){if(t.node&&this.code===e.QUMARK_CODE){this.index++;let r=t.node,n=this.gobbleExpression();if(n||this.throwError("Expected expression"),this.gobbleSpaces(),this.code===e.COLON_CODE){this.index++;let a=this.gobbleExpression();if(a||this.throwError("Expected expression"),t.node={type:"ConditionalExpression",test:r,consequent:n,alternate:a},r.operator&&e.binary_ops[r.operator]<=.9){let n=r;for(;n.right.operator&&e.binary_ops[n.right.operator]<=.9;)n=n.right;t.node.test=n.right,n.right=t.node,t.node=r}}else this.throwError("Expected :")}})}}),ib.plugins.register({name:"jsepTemplateLiteral",init(e){function t(e,r=!0){if(96===this.code){let t={type:"TemplateLiteral",quasis:[],expressions:[]},n="",a="",o=!1,i=this.expr.length,s=()=>t.quasis.push({type:"TemplateElement",value:{raw:a,cooked:n},tail:o});for(;this.index<i;){let i=this.expr.charAt(++this.index);if("`"===i)return this.index+=1,o=!0,s(),e.node=t,r&&(e.node=this.gobbleTokenProperty(e.node)),e.node;if("$"===i&&"{"===this.expr.charAt(this.index+1))this.index+=2,s(),a="",n="",t.expressions.push(...this.gobbleExpressions(125)),125!==this.code&&this.throwError("unclosed ${");else if("\\"===i)switch(a+=i,i=this.expr.charAt(++this.index),a+=i,i){case"n":n+="\n";break;case"r":n+="\r";break;case"t":n+=" ";break;case"b":n+="\b";break;case"f":n+="\f";break;case"v":n+="\v";break;default:n+=i}else n+=i,a+=i}this.throwError("Unclosed `")}}e.hooks.add("gobble-token",t),e.hooks.add("after-token",function(r){if((r.node.type===e.IDENTIFIER||r.node.type===e.MEMBER_EXP)&&96===this.code)return r.node={type:"TaggedTemplateExpression",tag:r.node,quasi:t.bind(this)(r,!1)},r.node=this.gobbleTokenProperty(r.node),r.node})}}),ib.addBinaryOp("in",7),ib.addBinaryOp("??",1);let iV=Symbol("optional chain short-circuited");function iU(e,t){switch(e.type){case"MemberExpression":return iF(e,t);case"CallExpression":return iL(e,t);default:return ij(e,t)}}function iW(e){return e===iV?void 0:e}function iH(e){return function(t){return null===t?null:ij(t,e)}}function iz(e){if("__proto__"===e||"prototype"===e||"constructor"===e)throw{type:"Illegal property access",message:`Cannot access the ${e} property of objects`}}let iK=new Set(["toString","valueOf","hasOwnProperty"]);function iG(e,t){try{return iA(e,t)}catch{return"<computed>"}}function iZ(e){return e?"MemberExpression"===e.type?e.property?.name:e.name:null}function iY(e){if("string"!=typeof e&&("object"!=typeof e||!e||!("type"in e)))throw`Unknown expression type ${e}. Expressions must either be a string or pre-compiled string.`;let t={globals:{...ix},boundNames:new Set,variables:new Set};return iq("string"==typeof e?ib(e):e,t),[...t.variables]}function iq(e,t){switch(e.type){case"UnaryExpression":return r=e,n=t,void iq(r.argument,n);case"BinaryExpression":return a=e,o=t,void(iq(a.left,o),iq(a.right,o));case"ConditionalExpression":return i=e,s=t,void(iq(i.consequent,s),iq(i.test,s),iq(i.alternate,s));case"CallExpression":return l=e,u=t,void(iq(l.callee,u),l.arguments?.map(iJ(u)));case"ArrowFunctionExpression":var r,n,a,o,i,s,l,u,c,d,m,p,f,h,g,y,v,b,w,E,D=e,x=t;let _=new Set(x.boundNames);for(let e of D.params??[])e?.type==="Identifier"&&_.add(e.name);iq(D.body,{...x,boundNames:_});return;case"MemberExpression":return c=e,d=t,void(iq(c.object,d),c.computed&&iq(c.property,d));case"ArrayExpression":return m=e,p=t,void m.elements?.map(iJ(p));case"SequenceExpression":return f=e,h=t,void f.expressions?.map(iJ(h));case"NewExpression":return g=e,y=t,void g.arguments?.map(iJ(y));case"Literal":case"TemplateElement":return;case"Identifier":return v=e,b=t,void(v.name in b.globals||b.boundNames.has(v.name)||b.variables.add(v.name));case"TemplateLiteral":return w=e,E=t,void(w.expressions?.map(iJ(E)),w.quasis?.map(iJ(E)));default:throw`Expression evaluator does not support expression of type '${e.type}'`}}function iJ(e){return function(t){return null===t?null:iq(t,e)}}let iX=W("feature-flags",{flags:function(){let e={};for(let t of Object.keys(localStorage))if(t.startsWith("openmrs:feature-flag:")){let r=t.replace("openmrs:feature-flag:",""),n=JSON.parse(localStorage.getItem(`openmrs:feature-flag-meta:${r}`)||"{}");e[r]={enabled:"true"===localStorage.getItem(t),...n}}return e}()});function iQ(e,t,r){iX.setState(n=>({flags:{...n.flags,[e]:{enabled:n.flags[e]?.enabled??!1,label:t,description:r}}}))}function i0(){let e=iX.getState().flags;Object.keys(localStorage).filter(e=>e.startsWith("openmrs:feature-flag:")).forEach(t=>{let r=t.replace("openmrs:feature-flag:","");e[r]||(localStorage.removeItem(t),localStorage.removeItem(`openmrs:feature-flag-meta:${r}`))})}function i1(e){return iX.getState().flags[e].enabled}function i4(e,t){iX.subscribe(r=>{t(r.flags[e].enabled)})}function i2(e,t){iX.setState(r=>({flags:{...r.flags,[e]:{...r.flags[e],enabled:t}}}))}iX.subscribe(e=>{for(let[t,r]of Object.entries(e.flags))localStorage.setItem(`openmrs:feature-flag:${t}`,r.enabled.toString()),localStorage.setItem(`openmrs:feature-flag-meta:${t}`,JSON.stringify({label:r.label,description:r.description}))});var i3=tG(function(e,t,r){tF(e,t,r)});let i6=B("extensionsInternal",{slots:{},extensions:{}}),i5=B("extensionRenderings",{renderings:new Map}),i9=()=>W("extensionsInternal",{slots:{},extensions:{}}),i8=()=>W("extensionRenderings",{renderings:new Map});function i7(e){let t=i6.getState(),r=e(t);r!==t&&i6.setState(r)}let se=null,st=null;function sr(){let e=i5.getState();return se&&e===st||(se=new Map(e.renderings),st=e,function(e){for(let t of(sm.clear(),e.values()))sf(t,1);sp=!0}(se)),se}function sn(e){st={renderings:e},i5.setState(st,!0)}function sa(e){let t=sr();t.has(e.renderingId)||(t.set(e.renderingId,e),sf(e,1),sn(t))}function so(e){let t=sr(),r=t.get(e);r&&(t.delete(e),sf(r,-1),sn(t))}let si=()=>W("extensions",{slots:{}}),ss=0,sl=new Set;function su(e){ss++;try{return e()}finally{if(0==--ss&&sl.size>0){let e=Array.from(sl);for(let t of(sl.clear(),e))sc(t)}}}function sc(e){try{e()}catch(t){console.error(`The extension system's '${e.name}' recomputation failed`,t)}}function sd(e){ss>0?sl.add(e):sc(e)}let sm=new Map,sp=!1;function sf(e,t){let r=JSON.stringify([e.slotName,e.extensionId,e.slotModuleName,e.extensionModuleName]),n=sm.get(r);if(!n){if(t<0)return;sm.set(r,{count:1,record:{slotModuleName:e.slotModuleName,extensionModuleName:e.extensionModuleName,slotName:e.slotName,extensionId:e.extensionId}}),sp=!0;return}n.count+=t,n.count<1&&(sm.delete(r),sp=!0)}function sh(){var e,t;if(sr(),!sp)return;sp=!1;let r=Array.from(sm.values(),({record:e})=>e);r.sort(sg),e=nE.getState().mountedExtensions,t=r,e.length===t.length&&e.every((e,r)=>0===sg(e,t[r]))||nE.setState({mountedExtensions:r})}function sg(e,t){return sy(e.slotName,t.slotName)||sy(e.extensionId,t.extensionId)||sy(e.slotModuleName,t.slotModuleName)||sy(e.extensionModuleName,t.extensionModuleName)}function sy(e,t){return e===t?0:e<t?-1:1}sh(),i5.subscribe(()=>sd(sh));let sv=i9(),sb=si(),sw=nx(),sE=nC(),sD=new Set,sx=!1;function s_(e){if(null===e)sD=null;else if(null!==sD)for(let t of e)sD.add(t);sd(sS)}function sS(){if(!sx){sx=!0;try{for(let e=1;;e++){let t=sD;if(null!==t&&0===t.size)return;sD=new Set;try{!function(e,t,r,n,a,o=null){let i=sb.getState().slots,s={},l=!1,u=Object.entries(n.flags).filter(([,{enabled:e}])=>e).map(([e])=>e);for(let[n,c]of Object.entries(e.slots)){let d=i[n];if(d&&o&&!o.has(n)){s[n]=d;continue}let{config:m}=nS(t,c.name),p=function(e,t,r,n,a,o){let i=function(e,t){let r=e.add||[],n=e.remove||[],a=e.order||[],{extensions:o}=sv.getState(),i=new Set(n),s=[...t,...r].filter(e=>!i.has(e)),l=sI(a),u=sI(t),c=new Map(s.map(e=>[e,function(e,t,r,n){let a=t.get(e);if(void 0!==a)return a;{if(void 0!==r)return 1e3+r;let t=n.get(e);return void 0!==t?2e3+t:3e3}}(e,l,o[sP(e)]?.order,u)]));return s.sort((e,t)=>c.get(e)-c.get(t))}(r,t.slots[e].attachedIds),s=[];for(let l of i){let{config:i}=nk(n,e,l),u=nP(r,e,l),c=u?i3({},i,u):i,d=sP(l),m=t.extensions[d];if(m){let e=c?.["Display conditions"]?.privileges??m.privileges??[];if(e&&("string"==typeof e||Array.isArray(e)&&e.length>0)&&(!o?.user||!a5(e,o.user))||m.featureFlag&&!a.includes(m.featureFlag))continue;s.push({id:l,name:d,moduleName:m.moduleName,config:c,featureFlag:m.featureFlag,meta:m.meta,displayConditionExpression:c?.["Display conditions"]?.expression||m.displayExpression})}}return s}(n,e,m,r,u,a.session);d&&d.moduleName===c.moduleName&&rP(d.candidateExtensions,p)?s[n]=d:(s[n]={moduleName:c.moduleName,candidateExtensions:p},l=!0)}(l||Object.keys(i).length!==Object.keys(s).length)&&sb.setState({slots:s})}(sv.getState(),sw.getState(),sE.getState(),iX.getState(),aJ.getState(),t)}catch(e){throw sD=null===t||null===sD?null:new Set([...t,...sD]),e}if(e>=20)return void console.error("The extension system stopped recomputing after 20 passes because something keeps invalidating slots in response to the extension store being written. Some slots are left stale until the next write.")}}finally{sx=!1}}}function sC(e,t){let r=new Set;for(let n of Object.keys(e))e[n]!==t[n]&&r.add(n);for(let n of Object.keys(t))n in e||r.add(n);return r}function sk(e,t){return{moduleName:t,name:e,attachedIds:[]}}function sP(e){let[t]=e.split("#");return t}function sR(e,t){let r=sP(t);return e.extensions[r]}function sT(e){return sR(sv.getState(),e)}sv.subscribe((e,t)=>{s_(e.extensions!==t.extensions?null:sC(e.slots,t.slots))}),sw.subscribe((e,t)=>{s_(sC(e.slots,t.slots))}),sE.subscribe((e,t)=>{s_(sC(e.configs,t.configs))}),iX.subscribe(()=>s_(null)),aJ.subscribe(()=>s_(null)),s_(null);let s$=e=>i7(t=>({...t,extensions:{...t.extensions,[e.name]:{...e}}}));function sO(e,t){i7(r=>{let n=r.slots[e];return n?{...r,slots:{...r.slots,[e]:{...n,attachedIds:[...n.attachedIds,t]}}}:{...r,slots:{...r.slots,[e]:{...sk(e),attachedIds:[t]}}}})}function sN(e,t){i7(r=>{let n=r.slots[e];return n&&n.attachedIds.includes(t)?{...r,slots:{...r.slots,[e]:{...n,attachedIds:n.attachedIds.filter(e=>e!==t)}}}:r})}function sM(e){i7(t=>{let r=t.slots[e];return r?{...t,slots:{...t.slots,[e]:{...r,attachedIds:[]}}}:t})}function sI(e){let t=new Map;return e.forEach((e,r)=>{t.has(e)||t.set(e,r)}),t}function sj(e,t){return function(e,t,r=null,n){let a;return e.filter(e=>{let o=e.displayConditionExpression;if("string"!=typeof o||0===o.trim().length)return!0;a??(a=t&&"object"==typeof t?{session:r,...t}:{session:r});try{return!!iC(o,a)}catch(t){return console.error(`Error while evaluating expression '${o}' for ${e.id}`+(n?` in ${n}`:""),t),!1}})}(sA(e),t,aJ.getState().session,e)}function sA(e){return sb.getState().slots[e]?.candidateExtensions??[]}let sL=(e,t)=>sv.setState(r=>{let n=r.slots[t]?.moduleName;if(n&&n!=e)return console.warn(`An extension slot with the name '${t}' already exists. Refusing to register the same slot name twice (in "registerExtensionSlot"). The existing one is from module ${n}.`),r;if(n&&n==e)return r;if(r.slots[t])return{...r,slots:{...r.slots,[t]:{...r.slots[t],moduleName:e}}};let a=sk(t,e);return{...r,slots:{...r.slots,[t]:{...a}}}}),sF=()=>{sD=null,i7(()=>({slots:{},extensions:{}})),i8().setState({renderings:new Map}),sb.setState({slots:{}})},sB=B("left-nav",{slotName:null,basePath:window.spaBase,mode:"normal"});function sV({name:e,basePath:t,mode:r,componentContext:n,state:a}){sB.setState({slotName:e,basePath:t,mode:r??"normal",componentContext:n,state:a})}function sU(e){sB.getState().slotName===e&&sB.setState(sB.getInitialState(),!0)}let sW=B("modalRegistry",{modals:{}});function sH(e){sW.setState(t=>(t.modals[e.name]=e,t))}function sz(e){let t=sW.getState().modals[e];if(!t){let r=sT(e);r&&(t={name:e,load:r.load,moduleName:r.moduleName},console.warn(`Modal ${e} was registered as an extension. This is deprecated and will be removed in the future. Please register it in the "modals" section of routes.json instead of the "extensions" section.`),sH(t))}return t}let sK=B("workspace2",{registeredGroupsByName:{},registeredWindowsByName:{},registeredWorkspacesByName:{},openedGroup:null,openedWindows:[],isMostRecentlyOpenedWindowHidden:!1});function sG(e){let{registeredWorkspacesByName:t,registeredWindowsByName:r}=sK.getState(),n=t[e];if(n){let t=r[n.window];if(t)return t;throw Error(`No workspace window found with name: ${n.window} for workspace: ${e}`)}throw Error(`No workspace found with name: ${e}`)}function sZ(e){let{registeredGroupsByName:t,registeredWindowsByName:r}=sK.getState(),n=r[e];if(n){let r=t[n.group];if(r)return r;throw Error(`No workspace group found with name: ${n.group} for window: ${e}`)}throw Error(`No workspace window found with name: ${e}`)}function sY(e){let{openedWindows:t}=sK.getState();return t.findIndex(t=>t.openedWorkspaces.find(t=>t.workspaceName===e))}function sq(e,t){if(0==t.length)return;let{registeredGroupsByName:r}=sK.getState(),n={...r};for(let r of t){if(n[r.name])throw Error(`Cannot register workspace group ${r.name} more than once`);n[r.name]={...r,moduleName:e}}sK.setState({registeredGroupsByName:n})}function sJ(e,t){if(0==t.length)return;let{registeredWindowsByName:r}=sK.getState(),n={...r};for(let r of t){if(n[r.name])throw Error(`Cannot register workspace window ${r.name} more than once`);let t={...r,moduleName:e};n[r.name]=t}sK.setState({registeredWindowsByName:n})}function sX(e,t){if(0==t.length)return;let{registeredWorkspacesByName:r}=sK.getState(),n={...r};for(let r of t){if(n[r.name])throw Error(`Cannot register workspace ${r.name} more than once`);let t={...r,moduleName:e};n[r.name]=t}sK.setState({registeredWorkspacesByName:n})}let sQ=0,s0=null,s1={bootstrap:15e3,mount:15e3,unmount:15e3};function s4(e,t){if(e.timeouts)return e;let r=e.name??"parcel",n=Object.fromEntries(Object.keys(s1).filter(t=>e[t]).map(n=>{var a,o;let i,s;return[n,(a=e[n],o=s1[n],i=Array.isArray(a)?a:[a],s=e=>i.reduce((t,a,o)=>t.then(()=>{let t=a(e);return"function"==typeof t?.then&&"function"==typeof t?.catch?t:Promise.reject(Error(`Lifecycle function ${n} at array index ${o} for parcel ${r} did not return a promise`))}),Promise.resolve(void 0)),e=>{let a,i=new Promise((e,t)=>{a=setTimeout(()=>t(Error(`Lifecycle function ${n} for parcel ${r} did not settle within ${o}ms`)),o)});return Promise.race([s(e),i]).finally(()=>clearTimeout(a)).then(e=>(t(n,!1),e),e=>{throw t(n,!0),e})})]}));return{...e,...n}}async function s2(e,t){var r,n;let a,o,i,s,l,u=await (s0??(s0=new Promise((e,t)=>{(0,ak.mountRootParcel)({name:"openmrs-extension-host",bootstrap:()=>Promise.resolve(),mount:t=>(e(t.mountParcel),Promise.resolve()),unmount:()=>Promise.resolve()},{domElement:document.createElement("div")}).mountPromise.catch(t)}).catch(e=>(console.error("The host parcel used to mount extensions could not be mounted. Falling back to mounting extensions as root parcels, which leaks their DOM elements.",e),ak.mountRootParcel))),s0),c={...t},d=(a=c,o=!1,{retarget:e=>a={...e},release:i=()=>(function(e){for(let t of Object.keys(e))delete e[t]})(a),onSettled(e,t){switch(e){case"bootstrap":t&&i();return;case"mount":o||(o=t);return;case"unmount":(t||o)&&i();return}}});return n=u((r=d.onSettled,"function"==typeof e?()=>e().then(e=>s4(e,r)):s4(e,r)),c),s=e=>t=>e.call(n,d.retarget(t)).catch(e=>{throw"SKIP_BECAUSE_BROKEN"===n.getStatus()&&d.release(),e}),l=n.update&&s(n.update),Object.defineProperty(n,"update",{configurable:!0,enumerable:!0,get:()=>l,set:e=>{l=e&&s(e)}})}function s3(){return s6}function s6(e,t){let r,n=s2(e,t).then(e=>r=e);return{mount:()=>n.then(e=>e.mount()),unmount:()=>n.then(e=>e.unmount()),update:e=>n.then(t=>t.update?.(e)),getStatus:()=>r?.getStatus()??"LOADING_SOURCE_CODE",get loadPromise(){return n.then(e=>e.loadPromise)},get bootstrapPromise(){return n.then(e=>e.bootstrapPromise)},get mountPromise(){return n.then(e=>e.mountPromise)},get unmountPromise(){return n.then(e=>e.unmountPromise)}}}async function s5(e,t,r,n,a=e=>e,o={}){let i=sP(n),s=sT(n),l=null;if(e){let u;if(!s)throw Error(`Couldn't find extension '${i}' to attach to '${t}'`);let{meta:c,moduleName:d,load:m}=s,p=sQ++,f=`${t}/${n}-${p}`;e.dataset.extensionRenderingId=f;let h=e=>{try{so(f)}catch(t){console.error(e,t)}};try{sa({renderingId:f,extensionName:i,extensionModuleName:d,extensionId:n,slotName:t,slotModuleName:r})}catch(e){throw h(`Recomputing configuration after registering '${n}' failed also failed`),e}try{u=await m()}catch(e){throw h(`Recomputing configuration after '${n}' failed to load also failed`),e}try{l=await s2(a({...u,name:`${t}/${i}-${p}`}),{...o,_meta:c,_extensionContext:{extensionId:n,extensionSlotName:t,extensionSlotModuleName:r,extensionModuleName:d,extensionMeta:c},domElement:e})}catch(e){throw h(`Recomputing configuration after '${n}' failed to mount also failed`),e}l.mountPromise.then(void 0,e=>{console.error(`Extension '${n}' in slot '${t}' failed to mount`,e),h(`Recomputing configuration after '${n}' failed to mount also failed`)}),l.unmountPromise.then(()=>h(`Recomputing configuration after unmounting '${n}' failed`),e=>{console.error(`Extension '${n}' in slot '${t}' failed to unmount`,e),h(`Recomputing configuration after '${n}' failed to unmount also failed`)})}else console.warn(`Tried to render ${n} into ${t} but no DOM element was available.`);return l}var s9=r(4587),s8=r.n(s9);let s7=(0,s9.createContext)({moduleName:"",featureName:""});var le=r(9978);function lt({to:e,templateParams:t,onBeforeNavigate:r,children:n,...a}){return(0,s9.useEffect)(()=>{a.href&&console.warn(`ConfigurableLink does not support the href prop. Use the 'to' prop instead. The provided href value is '${a.href}'`),a.onClick&&console.warn(`ConfigurableLink does not support the onClick prop. Use the 'onBeforeNavigate' prop instead. The 'to' prop of the offending link is ${e}`)},[]),(0,le.jsx)("a",{onClick:n=>{0===n.button&&!n.ctrlKey&&!n.shiftKey&&!n.altKey&&!n.metaKey&&(n.preventDefault(),r?.(n),aI({to:e,templateParams:t})),0===n.button&&(n.ctrlKey||n.metaKey)&&r?.(n),0===n.button&&n.shiftKey&&r?.(n),1===n.button&&r?.(n)},href:aN(e,t),...a,children:n})}let lr=({state:e,children:t,...r})=>{let{extension:n}=(0,s9.useContext)(s7),a=(0,s9.useRef)(null),o=(0,s9.useRef)(Promise.resolve()),i=(0,s9.useRef)(!1),s=(0,s9.useRef)(!1),l=(0,s9.useRef)(e),u=(0,s9.useCallback)(e=>{if(!e)return;let t=()=>{"MOUNTED"===e.getStatus()&&e.unmount()};switch(e.getStatus()){case"MOUNTED":e.unmount();break;case"UPDATING":o.current?.then(t,t);break;default:e.mountPromise.then(t,()=>{})}},[]),c=(0,s9.useCallback)((e,t)=>{e.update&&"UNMOUNTING"!==e.getStatus()&&(o.current=Promise.all([e.mountPromise,o.current]).then(()=>{if(a.current?.getStatus()==="MOUNTED"&&a.current.update)return a.current.update({...t})}).catch(e=>{let t=a.current?.getStatus();"UNMOUNTING"!==t&&"NOT_MOUNTED"!==t&&"UNLOADING"!==t&&console.error(`The extension '${n?.extensionId}' failed to update`,e)}))},[]),d=(0,s9.useCallback)(t=>{t&&!a.current&&!s.current&&n?.extensionSlotName&&n.extensionSlotModuleName&&(s.current=!0,s5(t,n.extensionSlotName,n.extensionSlotModuleName,n.extensionId,void 0,e).then(t=>{(s.current=!1,a.current=t,i.current)?u(t):t&&l.current!==e&&c(t,l.current)},()=>{s.current=!1}))},[]);return(0,s9.useEffect)(()=>(i.current=!1,()=>{i.current=!0,u(a.current)}),[]),(0,s9.useEffect)(()=>{l.current=e,a.current&&c(a.current,e)},[e]),n?(0,le.jsx)("div",{ref:d,"data-extension-id":n?.extensionId,style:{position:"relative"},...r}):null};function ln(e){let t=(0,s9.useRef)(e);return T(t.current,e)||(t.current=e),t.current}function la(e,t){"function"==typeof t&&(t=t(e));let r={};for(let[n,a]of Object.entries(t)){let t=function(...t){e.setState(e=>a(e,...t))};r[n]=t}return r}let lo=e=>e;function li(e,t=lo,r){let n=(0,s9.useCallback)(t=>e.subscribe(t),[e]),a=(0,s9.useCallback)(()=>t(e.getState()),[e,t]),o=(0,s9.useSyncExternalStore)(n,a,a),i=(0,s9.useMemo)(()=>r?la(e,r):null,[e,r]);return(0,s9.useMemo)(()=>i?{...o,...i}:o,[o,i])}function ls(e,t){return li(e,lo,t)}function ll(e){return function(t){let r=(0,s9.useCallback)(t=>e.subscribe(t),[]),n=(0,s9.useCallback)(()=>e.getState(),[]),a=(0,s9.useSyncExternalStore)(r,n,n),o=(0,s9.useMemo)(()=>t?la(e,t):null,[t]);return(0,s9.useMemo)(()=>o?{...a,...o}:a,[a,o])}}let lu=[];Object.freeze(lu);let lc={candidateExtensions:lu};Object.freeze(lc);let ld=e=>{let t=(0,s9.useCallback)(t=>t.slots?.[e]??lc,[e]);return li(si(),t)},lm=e=>e.session;function lp(e,t){let{candidateExtensions:r}=ld(e),n=li(aJ,lm),a=ln(t);return(0,s9.useMemo)(()=>sj(e,a),[e,a,n,r])}function lf(e,t){let{moduleName:r}=(0,s9.useContext)(s7);if(!r)throw Error("ComponentContext has not been provided. This should come from @openmrs/esm-react-utils.");return(0,s9.useEffect)(()=>{sL(r,e)},[r,e]),{extensions:lp(e,t),extensionSlotName:e,extensionSlotModuleName:r}}function lh(e){return e}function lg({name:e,extensionSlotName:t,select:r=lh,children:n,state:a,style:o,...i}){if(n&&a)throw Error("Both children and state have been provided. If children are provided, the state must be passed as a prop to the `Extension` component.");let s=e??t,l=(0,s9.useRef)(null),{extensions:u,extensionSlotModuleName:c}=lf(s,a),d=(0,s9.useMemo)(()=>r(u),[r,u]),m=(0,s9.useMemo)(()=>{if("function"==typeof n&&!s8().isValidElement(n))return d.map(e=>n(e,a))},[n,d]);return(0,le.jsx)("div",{ref:l,"data-extension-slot-name":s,"data-extension-slot-module-name":c,style:{...o,position:"relative"},...i,children:s&&d?.map((e,t)=>(0,le.jsx)(s7.Provider,{value:{moduleName:c,featureName:"",extension:{extensionId:e.id,extensionSlotName:s,extensionSlotModuleName:c,extensionMeta:e.meta}},children:m?.[t]??("function"!=typeof n?n:null)??(0,le.jsx)(lr,{state:a})},e.id))})}var ly=r(6298),lv=r.n(ly);function lb(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function lw(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?lb(Object(r),!0).forEach(function(t){var n,a,o;n=e,a=t,o=r[t],a in n?Object.defineProperty(n,a,{value:o,enumerable:!0,configurable:!0,writable:!0}):n[a]=o}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):lb(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function lE(e){return(lE="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function lD(e){return(lD="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function lx(e,t){var r;if("function"!=typeof(r=t.domElement?function(){return t.domElement}:t.domElementGetter?t.domElementGetter:e.domElementGetter?e.domElementGetter:function(e){var t=e.appName||e.name;if(!t)throw Error("single-spa's dom-element-getter-helpers was not given an application name as a prop, so it can't make a unique dom element container for the react application");var r="single-spa-application:".concat(t);return function(){var e=document.getElementById(r);return e||((e=document.createElement("div")).id=r,document.body.appendChild(e)),e}}(t)))throw Error("single-spa's dom-element-getter-helpers was given an invalid domElementGetter for application or parcel '".concat(t.name,"'. Expected a function, received ").concat(lD(r)));return function(){var e=r(t);if(!(e instanceof HTMLElement))throw Error("single-spa's dom-element-getter-helpers: domElementGetter returned an invalid dom element for application or parcel '".concat(t.name,"'. Expected HTMLElement, received ").concat(lD(e)));return e}}var l_=null;try{l_=require("react").createContext()}catch(e){}var lS={React:null,ReactDOM:null,ReactDOMClient:null,rootComponent:null,loadRootComponent:null,errorBoundary:null,errorBoundaryClass:null,domElementGetter:null,parcelCanUpdate:!0,suppressComponentDidCatchWarning:!1,domElements:{},renderResults:{},updateResolves:{},unmountResolves:{}};function lC(e,t){return e.rootComponent?Promise.resolve():e.loadRootComponent(t).then(function(t){e.rootComponent=t})}function lk(e,t){return new Promise(function(r,n){e.suppressComponentDidCatchWarning||!function(e){if(!(e&&"string"==typeof e.version&&e.version.indexOf(".")>=0))return!1;var t=e.version.slice(0,e.version.indexOf("."));try{return Number(t)>=16}catch(e){return!1}}(e.React)||e.errorBoundary||e.errorBoundaryClass||(e.rootComponent.prototype?e.rootComponent.prototype.componentDidCatch||console.warn("single-spa-react: ".concat(t.name||t.appName||t.childAppName,"'s rootComponent should implement componentDidCatch to avoid accidentally unmounting the entire single-spa application.")):console.warn("single-spa-react: ".concat(t.name||t.appName||t.childAppName,"'s rootComponent does not implement an error boundary. If using a functional component, consider providing an opts.errorBoundary to singleSpaReact(opts).")));var a,o=l$(e,t,function(){r(this)}),i=lx(e,t)(),s=function(e){var t=e.reactDom,r=e.renderType,n=e.elementToRender,a=e.domElement,o=t[r];if("function"!=typeof o)throw Error('renderType "'.concat(r,'" did not return a function.'));switch(r){case"createRoot":case"unstable_createRoot":case"createBlockingRoot":case"unstable_createBlockingRoot":var i=o(a);return i.render(n),i;case"hydrateRoot":return o(a,n);default:return o(n,a),null}}({elementToRender:o,domElement:i,reactDom:lT(e),renderType:"function"==typeof(a=e).renderType?a.renderType():a.renderType});e.domElements[t.name]=i,e.renderResults[t.name]=s})}function lP(e,t){return new Promise(function(r){e.unmountResolves[t.name]=r;var n=e.renderResults[t.name];n&&n.unmount?n.unmount():lT(e).unmountComponentAtNode(e.domElements[t.name]),delete e.domElements[t.name],delete e.renderResults[t.name]})}function lR(e,t){return new Promise(function(r){e.updateResolves[t.name]||(e.updateResolves[t.name]=[]),e.updateResolves[t.name].push(r);var n=l$(e,t,null),a=e.renderResults[t.name];if(a&&a.render)a.render(n);else{var o=lx(e,t)();lT(e).render(n,o)}})}function lT(e){return e.ReactDOMClient||e.ReactDOM}function l$(e,t,r){var n=e.React.createElement(e.rootComponent,t),a=l_?e.React.createElement(l_.Provider,{value:t},n):n;return(e.errorBoundary||t.errorBoundary||e.errorBoundaryClass||t.errorBoundaryClass)&&(e.errorBoundaryClass=e.errorBoundaryClass||t.errorBoundaryClass||function(e,t){function r(t){e.React.Component.apply(this,arguments),this.state={caughtError:null,caughtErrorInfo:null},r.displayName="SingleSpaReactErrorBoundary(".concat(t.name,")")}return r.prototype=Object.create(e.React.Component.prototype),r.prototype.render=function(){return this.state.caughtError?(e.errorBoundary||t.errorBoundary)(this.state.caughtError,this.state.caughtErrorInfo,this.props):this.props.children},r.prototype.componentDidCatch=function(e,t){this.setState({caughtError:e,caughtErrorInfo:t})},r}(e,t),a=e.React.createElement(e.errorBoundaryClass,t,a)),a=e.React.createElement(e.SingleSpaRoot,lw(lw({},t),{},{mountFinished:r,updateFinished:function(){e.updateResolves[t.name]&&(e.updateResolves[t.name].forEach(function(e){return e()}),delete e.updateResolves[t.name])},unmountFinished:function(){e.unmountResolves[t.name]&&(e.unmountResolves[t.name](),delete e.unmountResolves[t.name])}}),a)}var lO=r(587),lN=r(2272),lM=r(8444);let lI={strictMode:!0,throwErrorsToConsole:!0,disableTranslations:!1},lj=new Map;(0,lM.y)(lj);let lA={errorRetryCount:3,fetcher:aY,focusThrottleInterval:18e5,revalidateIfStale:!0,revalidateOnFocus:!1,revalidateOnReconnect:!1,refreshInterval:0,shouldRetryOnError:e=>{if(e instanceof aq){let t=e.response.status;return!!(t>=500)||401===t||403===t||429===t}return!0},provider:()=>lj};function lL(e){if("object"!=typeof e||"string"!=typeof e.featureName||"string"!=typeof e.moduleName)throw Error("Invalid options");let t=Object.assign({},lI,e),r={...lA,...t.swrConfig};return function(e){var n,a,o,i,s;return o=a=class extends(n=s8().Component){componentDidCatch(e,r){r&&r.componentStack&&(e.extra=Object.assign(e.extra||{},{componentStack:r.componentStack})),t.throwErrorsToConsole&&setTimeout(()=>{throw e}),this.setState({caughtError:e,caughtErrorInfo:r})}render(){if(this.state.caughtError)return(0,le.jsx)("div",{children:"An error has occurred. Please try reloading the page."});{let n=(0,le.jsx)(s9.Suspense,{fallback:null,children:(0,le.jsx)(lN.S,{value:r,children:(0,le.jsx)(s7.Provider,{value:this.state.config,children:t.disableTranslations?(0,le.jsx)(e,{...this.props}):(0,le.jsx)(lO.I18nextProvider,{i18n:window.i18next,defaultNS:this.state.config.extension?`${this.state.config.moduleName}___${this.state.config.extension.extensionSlotName}___${this.state.config.extension.extensionId}`:this.state.config.moduleName,children:(0,le.jsx)(e,{...this.props})})})})});return t.strictMode&&s8().StrictMode?(0,le.jsx)(s8().StrictMode,{children:n}):n}}constructor(e){super(e),this.state={caughtError:null,caughtErrorInfo:null,config:{moduleName:t.moduleName,featureName:t.featureName,extension:e._extensionContext}}}},i="displayName",s=`OpenmrsReactComponent(${t.featureName})`,i in o?Object.defineProperty(o,i,{value:s,enumerable:!0,configurable:!0,writable:!0}):o[i]=s,a}}function lF(e,t){return function(e){if("object"!==lE(e))throw Error("single-spa-react requires a configuration object");var t,r=lw(lw({},lS),e);if(!r.React)throw Error("single-spa-react must be passed opts.React");if(!r.ReactDOM&&!r.ReactDOMClient)throw Error("single-spa-react must be passed opts.ReactDOM or opts.ReactDOMClient");if(r.renderType||(null!=(t=r.ReactDOMClient)&&t.createRoot?r.renderType="createRoot":r.renderType="render"),!r.rootComponent&&!r.loadRootComponent)throw Error("single-spa-react must be passed opts.rootComponent or opts.loadRootComponent");if(r.errorBoundary&&"function"!=typeof r.errorBoundary)throw Error("The errorBoundary opt for single-spa-react must either be omitted or be a function that returns React elements");!l_&&r.React.createContext&&(l_=r.React.createContext()),r.SingleSpaRoot=function(e){function t(e){t.displayName="SingleSpaRoot(".concat(e.name,")")}return t.prototype=Object.create(e.React.Component.prototype),t.prototype.componentDidMount=function(){setTimeout(this.props.mountFinished)},t.prototype.componentWillUnmount=function(){setTimeout(this.props.unmountFinished)},t.prototype.render=function(){return setTimeout(this.props.updateFinished),this.props.children},t}(r);var n={bootstrap:lC.bind(null,r),mount:lk.bind(null,r),unmount:lP.bind(null,r)};return r.parcelCanUpdate&&(n.update=lR.bind(null,r)),n}({React:s8(),ReactDOMClient:lv(),rootComponent:lL(t)(e)})}function lB(e,t){return()=>e().then(({default:e})=>lF(e,t))}function lV(e,t){return()=>Promise.resolve(lF(e,t))}let lU=lB,lW=M()(()=>({}));U("openmrs-app-context",lW);let lH={};function lz(e,t=e=>e){let r=lW.getState();return e in r?Object.freeze(Object.assign({},t?t(r[e]):r[e])):null}function lK(e,t){lW.setState(r=>(e in r||(r[e]={}),r[e]=t(r[e]),Object.assign({},r)))}function lG(e){return null===e?null:Object.freeze(Object.assign({},e))}let lZ=new Map;function lY(e,t){let r=(0,s9.useRef)(t??{}),n=(0,s9.useRef)(t=>lK(e,t)),a=(0,s9.useRef)(Symbol());return(0,s9.useEffect)(()=>{let r=t??{},n=a.current;return null===lz(e)?!function(e,t=lH){lW.setState(r=>{if(e in r)throw Error(`Attempted to re-register namespace ${e} in the app context. Each namespace must be unregistered before the name can be registered again.`);return Object.assign({},r,{[e]:t===lH?{}:t})})}(e,r):(console.warn(`Namespace ${e} is already registered in the app context. This is likely a race condition during navigation, but may indicate two components are trying to own the same namespace. Updating the existing context.`),lK(e,()=>r)),lZ.set(e,n),()=>{lZ.get(e)===n&&(lW.setState(t=>(e in t&&delete t[e],t)),lZ.delete(e))}},[e]),(0,s9.useEffect)(()=>{let n=t??{};T(r.current,n)||(lK(e,()=>n),r.current=n)},[t]),n.current}function lq({namespace:e,value:t}){return lY(e,t),null}let lJ=({children:e,value:t,fallback:r})=>t?(0,le.jsx)(le.Fragment,{children:e}):r?(0,le.jsx)(le.Fragment,{children:r}):null;function lX(){let e=(0,s9.useRef)(null);return(!e.current||e.current.signal.aborted)&&(e.current=new AbortController),(0,s9.useEffect)(()=>{let t=e.current;return()=>t?.abort()},[]),e.current}function lQ(e,t=e=>e??{}){let[r,n]=(0,s9.useState)(()=>{if(l0(e))return;let r=lz(e);if(null!==r)return t?t(r):r});return(0,s9.useEffect)(()=>{if(l0(e))throw Error(`The namespace supplied to useAppContext must be a non-empty string, but was "${e}".`)},[e]),(0,s9.useEffect)(()=>{var r;let a;return(r=e=>{if(null==e)return void n(void 0);let r=t?t(e):e;n(e=>T(e,r)?e:r)})(lG(a=lz(e))),lW.subscribe(t=>{let n=e in t?t[e]:null;n!==a&&(a=n,r(lG(n)))})},[e,t]),r}function l0(e){return"string"!=typeof e||0===e.trim().length}function l1(e){let t=lp(e);return(0,s9.useMemo)(()=>t.map(e=>e.id),[t])}function l4(e){return ld(e).candidateExtensions}function l2(e,t,r){let{data:n,error:a,mutate:o,isLoading:i,isValidating:s}=(0,lN.u)(e?o5(e,t,r):null,aY);return(0,s9.useMemo)(()=>({isLoading:i,data:n?.data.results??[],error:a,mutate:o,isValidating:s}),[n,a,i,s,o])}function l3(e){(0,s9.useEffect)(()=>{if(e){let e=window.getComputedStyle(document.body).overflow;return document.body.style.overflow="hidden",()=>{document.body.style.overflow=e}}},[e])}let l6={},l5=`No ComponentContext has been provided. This should come from "openmrsComponentDecorator".
16
+ Usually this is already applied when using "getAsyncLifecycle" or "getSyncLifecycle".`;function l9(e,t,r){let n=l6[e];if(n)return n;let a=new Promise(e=>{let n=r(t.getState());if(n)return void e(n);let a=t.subscribe(t=>{let n=r(t);n&&(a(),e(n))})});return l6[e]=a,a.then(()=>{l6[e]===a&&delete l6[e]}),a}function l8(e){let{moduleName:t,extension:r}=(0,s9.useContext)(s7),n=e?.externalModuleName??t;if(!n&&!r)throw Error(l5);let a=function(e){let t=(0,s9.useMemo)(()=>nD(e),[e]),r=function(e){let[t,r]=(0,s9.useState)(()=>{let t=e.getState();return t.loaded&&t.config?t.config:null});return(0,s9.useEffect)(()=>e?.subscribe(e=>{e.loaded&&e.config&&r(e.config)}),[e]),t}(t);if(!r)throw l9(e,t,e=>e.loaded?e.config:null);return r}(n),o=function(e){let t=(0,s9.useMemo)(nC,[]),r=function(e,t){let[r,n]=(0,s9.useState)(t?()=>{let r=nk(e.getState(),t.extensionSlotName,t.extensionId);if(r.loaded&&r.config)return r.config}:null);return(0,s9.useEffect)(()=>{if(t)return e.subscribe(e=>{let a=nk(e,t.extensionSlotName,t.extensionId);a.loaded&&a.config&&!rP(a.config,r)&&n(a.config)})},[e,t,r]),r}(t,e);if(!r&&e)throw l9(`${e.extensionSlotName}-${e.extensionId}`,t,t=>{let r=nk(t,e.extensionSlotName,e.extensionId);return r.loaded?r.config:null});return r||{}}(r);return(0,s9.useMemo)(()=>e?.externalModuleName&&n===e.externalModuleName?{...a}:{...a,...o},[n,e?.externalModuleName,a,o])}let l7=lp;function ue(e,t=300){let[r,n]=(0,s9.useState)(e);return(0,s9.useEffect)(()=>{let r=setTimeout(()=>{n(e)},t);return()=>{clearTimeout(r)}},[e,t]),r}var ut=r(4993);let ur=(0,ut.Ht)(lN.u,e=>(t,r,n)=>(n.revalidateOnFocus=!1,n.revalidateIfStale=!1,n.revalidateOnReconnect=!1,n.refreshInterval=0,e(t,r,n))),un=`custom:${[["admissionDecisionConcept","ref"],["admissionEncounterType","ref"],["admissionForm","ref"],["atFacilityVisitType","ref"],["bedAssignmentEncounterType","ref"],["cancelADTRequestEncounterType","ref"],["checkInClerkEncounterRole","ref"],["checkInEncounterType","ref"],["clinicianEncounterRole","ref"],["conceptSourcesForDiagnosisSearch","ref"],["consultEncounterType","ref"],["consultFreeTextCommentsConcept","ref"],["denyAdmissionConcept","ref"],["diagnosisMetadata","ref"],["diagnosisSets","ref"],["dischargeForm","ref"],["dispositionDescriptor","ref"],["dispositions","ref"],["emrApiConceptSource","ref"],["exitFromInpatientEncounterType","ref"],["extraPatientIdentifierTypes","ref"],["fullPrivilegeLevel","ref"],["highPrivilegeLevel","ref"],["identifierTypesToSearch","ref"],["inpatientNoteEncounterType","ref"],["lastViewedPatientSizeLimit","ref"],["metadataSourceName","ref"],["motherChildRelationshipType","ref"],["narrowerThanConceptMapType","ref"],["nonDiagnosisConceptSets","ref"],["orderingProviderEncounterRole","ref"],["patientDiedConcept","ref"],["personImageDirectory","ref"],["primaryIdentifierType","ref"],["sameAsConceptMapType","ref"],["suppressedDiagnosisConcepts","ref"],["supportsAdmissionLocationTag","(uuid,display,name,links)"],["supportsLoginLocationTag","(uuid,display,name,links)"],["supportsTransferLocationTag","(uuid,display,name,links)"],["supportsVisitsLocationTag","(uuid,display,name,links)"],["telephoneAttributeType","ref"],["testPatientPersonAttributeType","ref"],["transferForm","ref"],["transferRequestEncounterType","ref"],["transferWithinHospitalEncounterType","ref"],["unknownCauseOfDeathConcept","ref"],["unknownLocation","ref"],["unknownPatientPersonAttributeType","ref"],["unknownProvider","ref"],["visitAssignmentHandlerAdjustEncounterTimeOfDayIfNecessary","ref"],["visitExpireHours","ref"],["visitNoteEncounterType","ref"]].map(([e,t])=>`${e}:${t}`).join(",")}`;function ua(){let e=ur(`${az}/emrapi/configuration?v=${un}`,aY);return(0,s9.useMemo)(()=>({emrConfiguration:e.data?.data,isLoadingEmrConfiguration:e.isLoading,mutateEmrConfiguration:e.mutate,errorFetchingEmrConfiguration:e.error}),[e])}function uo(){return(0,s9.useContext)(s7).extension}let ui=ll(i9());function us(e){let t=lp(e);return(0,s9.useMemo)(()=>Object.fromEntries(t.map(e=>[e.name,e.meta])),[t])}let ul=ll(si());function uu(e){let{flags:t}=li(iX);return t[e]?.enabled??!1}function uc(){let[,e]=(0,s9.useState)(0);return(0,s9.useCallback)(()=>{e(e=>e+1)},[])}function ud(e,t,r={}){return up(e,t,um,r)}let um={getPaginatedUrl:(e,t,r)=>{if(!e)return null;{let n=new URL(aZ(e.toString()),window.location.toString());return n.searchParams.set("limit",""+t),n.searchParams.set("startIndex",""+r),n.searchParams.set("totalCount","true"),n.toString()}},getNextUrl:e=>{let t=e?.links?.find(e=>"next"==e.rel)?.uri;if(!t)return null;{let e=new URL(t);return e.host=window.location.host,e.protocol=window.location.protocol,e.toString()}},getTotalCount:e=>e?.totalCount??NaN,getCurrentPageSize:e=>e?.results?.length??NaN,getData:e=>e?.results};function up(e,t,r,n={}){let{getPaginatedUrl:a,getTotalCount:o,getCurrentPageSize:i,getData:s}=r,{immutable:l,swrConfig:u}=n,c=n.fetcher??aY,[d,m]=(0,s9.useState)(1),p=(0,s9.useRef)(NaN),f=(0,s9.useRef)(NaN),h=(0,s9.useRef)(d),g=(0,s9.useRef)(!1),y=(0,s9.useRef)(!1),v=e?.toString()??"",[b,w]=(0,s9.useState)(v);v!==b&&(w(v),m(1),h.current=1,p.current=NaN,f.current=NaN,g.current=!1,y.current=!1);let E=(d-1)*t,D=(0,s9.useMemo)(()=>a(e,t,E),[e,t,E]),{data:x,..._}=(l?ur:lN.u)(D,c,u);x?.data&&(p.current=o(x?.data),f.current=i(x?.data),g.current=!0);let S=Math.ceil(p.current/t),C=(0,s9.useCallback)(e=>{if(!Number.isInteger(e)||e<1)return void console.warn(`useServerPagination: ignoring goTo(${e}); page must be a positive integer.`);let r=Math.ceil(p.current/t);!g.current||Number.isNaN(r)||e<=r?(h.current=e,m(e)):console.warn("Invalid attempt to go to out of bounds page: "+e)},[t]);(0,s9.useEffect)(()=>{if(!g.current)return;if(Number.isNaN(p.current)){y.current||(y.current=!0,console.warn(`useServerPagination: ${v} returned no total count, so out-of-range pages cannot be detected.`));return}let e=Math.max(1,Math.ceil(p.current/t));d>e&&(console.warn(`Invalid attempt to go to out of bounds page: ${d}; returning to page ${e}.`),h.current=e,m(e))},[d,t,v,x]);let k=(0,s9.useCallback)(()=>{C(h.current+1)},[C]),P=(0,s9.useCallback)(()=>{C(h.current-1)},[C]);return{data:s(x?.data),totalPages:S,totalCount:p.current,currentPage:d,currentPageSize:f.current,paginated:S>1,showNextButton:d<S,showPreviousButton:d>1,goTo:C,goToNext:k,goToPrevious:P,..._}}function uf(e,t,r={}){return up(e,t,uh(),r)}function uh(){return{getPaginatedUrl:(e,t,r)=>{if(!e)return null;{let n=new URL(aZ(e.toString()),window.location.toString());return n.searchParams.set("_count",""+t),n.searchParams.set("_getpagesoffset",""+r),n.toString()}},getNextUrl:e=>{let t=e?.link?.find(e=>"next"==e.relation)?.url;if(!t)return null;{let e=new URL(t);return e.host=window.location.host,e.protocol=window.location.protocol,e.toString()}},getTotalCount:e=>e?.total??NaN,getCurrentPageSize:e=>e?.entry?.length??NaN,getData:e=>e?.entry?.map(e=>e.resource)}}var ug=r(9888);let uy=Promise.resolve(),uv=(0,ut.Ht)(lN.u,e=>(t,r,n)=>{let a,o=(0,s9.useRef)(!1),{cache:i,initialSize:s=1,revalidateAll:l=!1,persistSize:u=!1,revalidateFirstPage:c=!0,revalidateOnMount:d=!1,parallel:m=!1}=n,[,,,p]=lM.a.get(lM.o);try{(a=(0,lM.s)(t?t(0,null):null)[0])&&(a="$inf$"+a)}catch(e){}let[f,h,g]=(0,lM.c)(i,a),y=(0,s9.useCallback)(()=>(0,lM.i)(f()._l)?s:f()._l,[i,a,s]);(0,ug.useSyncExternalStore)((0,s9.useCallback)(e=>a?g(a,()=>{e()}):()=>{},[i,a]),y,y);let v=(0,s9.useCallback)(()=>{let e=f()._l;return(0,lM.i)(e)?s:e},[a,s]),b=(0,s9.useRef)(v());(0,lM.u)(()=>{if(!o.current){o.current=!0;return}a&&h({_l:u?b.current:v()})},[a,i]);let w=d&&!o.current,E=e(a,async e=>{let a=f()._i,o=f()._r,s=lM.a.get(i),u=s[8],d=()=>s[8]!==u;h({_r:lM.U});let g=[],y=v(),[b]=(0,lM.c)(i,e),E=b().data,D=[],x=null;for(let e=0;e<y;++e){let[s,u]=(0,lM.s)(t(e,m?null:x));if(!s)break;let[f,h]=(0,lM.c)(i,s),y=f().data,v=l||a||(0,lM.i)(y)||c&&!e&&!(0,lM.i)(E)||w||E&&!(0,lM.i)(E[e])&&!n.compare(E[e],y);if(r&&("function"==typeof o?o(y,u):v)){let t=async()=>{if(s in p){let e=p[s];delete p[s],y=await e}else y=await r(u);d()||h({data:y,_k:u}),g[e]=y};m?D.push(t):await t()}else g[e]=y;m||(x=y)}return m&&await Promise.all(D.map(e=>e())),d()||h({_i:lM.U}),g},n),D=(0,s9.useCallback)(function(e,t){let r="boolean"==typeof t?{revalidate:t}:t||{},n=!1!==r.revalidate;return a?(n&&((0,lM.i)(e)?h({_i:!0,_r:r.revalidate}):h({_i:!1,_r:r.revalidate})),arguments.length?E.mutate(e,{...r,revalidate:n}):E.mutate()):uy},[a,i]),x=(0,s9.useCallback)(e=>{let r;if(!a)return uy;let[,n]=(0,lM.c)(i,a);if((0,lM.e)(e)?r=e(v()):"number"==typeof e&&(r=e),"number"!=typeof r)return uy;n({_l:r}),b.current=r;let o=[],[s]=(0,lM.c)(i,a),l=null;for(let e=0;e<r;++e){let[r]=(0,lM.s)(t(e,l)),[n]=(0,lM.c)(i,r),a=r?n().data:lM.U;if((0,lM.i)(a))return D(s().data);o.push(a),l=a}return D(o)},[a,i,D,v]);return{size:v(),setSize:x,mutate:D,get data(){return E.data},get error(){return E.error},get isValidating(){return E.isValidating},get isLoading(){return E.isLoading}}});function ub(e,t={}){return uw(e,um,t)}function uw(e,t,r={}){let{swrInfiniteConfig:n,immutable:a}=r,{getNextUrl:o,getTotalCount:i,getData:s}=t,l=r.fetcher??aY,{data:u,size:c,setSize:d,...m}=uv((0,s9.useCallback)((r,n)=>0==r?e?.toString()??null:t.getNextUrl(n.data),[e]),l,{...n,...a?{revalidateIfStale:!1,revalidateOnFocus:!1,revalidateOnReconnect:!1}:{}}),p=o(u?.[u.length-1].data),f=i(u?.[0]?.data);return{data:u?.flatMap(e=>s(e.data)),totalCount:f,hasMore:null!=p,loadMore:()=>{d((u?.length??0)+1)},nextUri:p,...m}}function uE(e,t={}){return uD(e,um,t)}function uD(e,t,r={}){let n=uw(e,t,r),{hasMore:a,error:o,data:i,loadMore:s,isLoading:l,nextUri:u}=n;return((0,s9.useEffect)(()=>{a&&!o&&s()},[a,u]),r.partialData)?n:{...n,data:a||o?void 0:i,isLoading:l||a}}function ux(e,t={}){return uD(e,uh(),t)}function u_(e,t={}){return uw(e,uh(),t)}function uS(){let e="tablet";return document.body.classList.forEach(t=>{switch(t){case"omrs-breakpoint-lt-tablet":e="phone";break;case"omrs-breakpoint-gt-small-desktop":e="large-desktop";break;case"omrs-breakpoint-gt-tablet":e="small-desktop"}}),e}function uC(){let[e,t]=(0,s9.useState)(uS);return(0,s9.useEffect)(()=>{let e=()=>{t(uS())};return window.addEventListener("resize",e),()=>window.removeEventListener("resize",e)},[]),e}let uk=e=>"small-desktop"===e||"large-desktop"===e;function uP(e){let t=(0,s9.useContext)(s7);(0,s9.useEffect)(()=>(t&&t.moduleName&&(e.componentContext=t),sV(e),()=>{sU(e.name)}),[t,e])}function uR(){return li(sB)}let uT=[];function u$(e=null,t=null){let r=new URLSearchParams;e&&r.set("tag",e),t&&r.set("q",t);let n=r.toString(),{data:a}=uE(`${az}/location${n?"?"+n:""}`,{immutable:!0});return a??uT}function uO(e,t=!0){let r=(0,s9.useRef)(null);return(0,s9.useEffect)(()=>{let n=n=>{t&&r.current&&n.target&&n.target instanceof Node&&(r.current.contains(n.target)||e(n))};return window.addEventListener("mousedown",n),window.addEventListener("touchstart",n),()=>{window.removeEventListener("mousedown",n),window.removeEventListener("touchstart",n)}},[e,t]),r}function uN(e){let t=(0,s9.useRef)(null);return(0,s9.useEffect)(()=>{let r=new IntersectionObserver(t=>{for(let r of t)if(r.isIntersecting)return void e()},{threshold:1});return t.current&&r.observe(t.current),()=>{t.current&&r.unobserve(t.current)}},[t.current,e]),t}function uM(e,t={}){let{abortController:r,fetchInit:n,url:a,swrConfig:o}=t,i=lX(),s=(0,s9.useMemo)(()=>n?.signal??r?.signal??i.signal,[r?.signal,n?.signal,i.signal]),l=(0,s9.useCallback)(e=>aY(function(e,t){if(t)return"function"==typeof t?t(e):t;if("string"==typeof e)return e;throw Error(`When using useOpenmrsSWR with a key that is not a string, you must provide a url() function that converts the key to a valid url. The key for this hook is ${e}.`)}(e,a),{...n,signal:s}),[s,n,a]);return(0,lN.u)(e,l,o)}function uI(e=[],t=10){let[r,n]=(0,s9.useState)(1),a=(0,s9.useMemo)(()=>"number"==typeof t&&t>0?Math.max(1,Math.ceil(e.length/t)):1,[e.length,t]);r>a&&n(a);let o=Math.min(Math.max(1,r),a),i=(0,s9.useMemo)(()=>{let r=(o-1)*t,n=(o+0)*t;return e.slice(r,n)},[e,o,t]),s=(0,s9.useCallback)(e=>{!Number.isInteger(e)||e<1?console.warn(`usePagination: ignoring goTo(${e}); page must be a positive integer.`):n(e)},[]),l=(0,s9.useCallback)(()=>{n(e=>e+1)},[]),u=(0,s9.useCallback)(()=>{n(e=>Math.max(1,e-1))},[]);return(0,s9.useMemo)(()=>({results:i,totalPages:a,currentPage:o,paginated:e.length>t,showNextButton:o<a,showPreviousButton:o>1,goTo:s,goToNext:l,goToPrevious:u}),[i,a,e.length,t,o,s,l,u])}function uj(e,t,r,n){return{pageSizes:(0,s9.useMemo)(()=>{let r=Math.ceil(t/e);return isNaN(r)&&(r=0),[...Array(r).keys()].map(t=>(t+1)*e)},[e,t]),pageItemsCount:(0,s9.useMemo)(()=>e>t?t:e*r>t?e*(r-1)+n:e*r,[e,t,r,n])}}function uA(){let e=/\/patient\/([a-zA-Z0-9\-]+)\/?/.exec(location.pathname);return e&&e[1]}function uL(e){let[t,r]=(0,s9.useState)(e??uA()),{data:n,error:a,isValidating:o}=(0,lN.u)(t?["patient",t]:null,()=>o7(t,{}));return(0,s9.useEffect)(()=>{let e=()=>{let e=uA();e!==t&&r(e)};return window.addEventListener("single-spa:routing-event",e),()=>window.removeEventListener("single-spa:routing-event",e)},[t]),(0,s9.useMemo)(()=>({isLoading:o&&!a&&!n,patient:n,patientUuid:t,error:a}),[o,a,n,t])}function uF(){let e=`${az}/metadatamapping/termmapping?v=custom:(metadataUuid)&code=emr.primaryIdentifierType`,{data:t,error:r,isLoading:n}=(0,lN.u)(e,aY);return(0,s9.useMemo)(()=>({primaryIdentifierCode:t?.data?.results[0]?.metadataUuid,isLoading:n,error:r}),[t,r,n])}function uB(e,t,r,n){let a=e?.slotName===t&&e.slotModuleName===r?e.components:null,o=new Map;for(let e of n)o.set(e,a?.get(e)??function(e,t,r){let n=sP(r),a=e=>e.extensions[n]?.meta,o=({state:n})=>{let o=li(i9(),a),i=(0,s9.useMemo)(()=>({moduleName:t,featureName:"",extension:{extensionId:r,extensionSlotName:e,extensionSlotModuleName:t,extensionMeta:o}}),[o]);return(0,le.jsx)(s7.Provider,{value:i,children:(0,le.jsx)(lr,{state:n})})};return o.displayName=`RenderableExtension(${r})`,o}(t,r,e));return{slotName:t,slotModuleName:r,components:o}}function uV(e){let{extensions:t,extensionSlotModuleName:r}=lf(e),n=(0,s9.useMemo)(()=>new Set(e?t.map(e=>e.id):[]),[e,t]),[a,o]=(0,s9.useState)(()=>uB(null,e,r,n)),i=a;return a.slotName===e&&a.slotModuleName===r&&a.components.size===n.size&&[...n].every(e=>a.components.has(e))||o(i=uB(a,e,r,n)),(0,s9.useMemo)(()=>e?t.flatMap(e=>{let t=i.components.get(e.id);return t?[t]:[]}):[],[e,t,i])}function uU(){let e=(0,s9.useRef)(null),[t,r]=(0,s9.useState)(null),n=null;if(!t){if(o){let e=a4().getState();e.loaded&&(n=e.session)}else o=new Promise(t=>{let r=({loaded:r,session:a})=>{r&&(t(a),n=a,e.current&&(e.current(),e.current=null))};r(a4().getState()),n||(e.current=a4().subscribe(r))});if(n)r(n);else throw o}(0,s9.useEffect)(()=>(e.current||(e.current=a4().subscribe(({loaded:e,session:t})=>{e&&(n=t,r(t))})),()=>{e.current&&(e.current(),e.current=null)}),[]);let a=t||n;if(!a)if(o)throw console.warn("useSession is in an unexpected state. Attempting to recover."),o;else throw Error("useSession is in an invalid state.");return a}let uW=({privilege:e,fallback:t,children:r})=>{let[n,a]=(0,s9.useState)(null);return((0,s9.useEffect)(()=>{let e=a4(),t=e.subscribe(({loaded:e,session:t})=>{a(e?t?.user??null:null)}),{loaded:r,session:n}=e.getState();return r&&a(n?.user??null),t},[]),n&&a5(e,n))?(0,le.jsx)(le.Fragment,{children:r}):t?(0,le.jsx)(le.Fragment,{children:t}):null};var uH=r(4353),uz=r.n(uH),uK=r(7581);let uG=new Map;function uZ(){for(let e of Array.from(uG.values()))e()}let uY={setVisitContext:(e,t)=>null==t?{manuallySetVisitUuid:null}:{manuallySetVisitUuid:t.uuid,patientUuid:t.patient?.uuid}};function uq(e){let t=(0,s9.useId)();return(0,s9.useEffect)(()=>{if(e)return uG.set(t,e),()=>{uG.delete(t)}},[t,e]),{...ls(im(),uY),mutateVisit:uZ}}function uJ(e,t=ic){let r=(0,s9.useRef)(void 0),{patientUuid:n,manuallySetVisitUuid:a,setVisitContext:o}=uq((0,s9.useCallback)(()=>r.current?.(),[])),i=e&&n==e?a:null,s=`?patient=${e}&v=${t}&includeInactive=false`,l=`/${i}?v=${t}`,{data:u,error:c,mutate:d,isValidating:m}=(0,lN.u)(e?`${az}/visit${s}`:null,aY),{data:p,error:f,mutate:h,isValidating:g}=(0,lN.u)(e&&i?`${az}/visit${l}`:null,aY),y=(0,s9.useMemo)(()=>u?.data.results.find(e=>null===e.stopDatetime)??null,[u]),v=(0,s9.useMemo)(()=>i&&p?p.data:null,[p,i]),b=(0,s9.useRef)(null);(0,s9.useEffect)(()=>{!m&&y&&n===e&&null===a&&o(y),g||(b.current&&v&&b.current.uuid===v.uuid&&!b.current.stopDatetime&&v.stopDatetime&&o(null),b.current=v)},[v,a,y,m,g,n]);let w=(0,s9.useCallback)(()=>{d(),h()},[d,h]);(0,s9.useEffect)(()=>{r.current=w},[w]);let E=!!(!u||i&&!p),D=!!(i?f:c);return{error:c||f,mutate:w,isValidating:m||g,activeVisit:y,currentVisit:v,currentVisitIsRetrospective:!!i,isLoading:E&&!D}}uH.extend(uK);let uX=[];function uQ(){let{data:e}=ur(ii,is);return e??uX}let u0=new Map;async function u1(e,t){let r=t.indexOf("#"),n=r>=0,a=n?t.substring(0,r):e,o=n?t.substring(r+1):t,i=await oN(a);return i&&Object.hasOwn(i,o)&&"function"==typeof i[o]?u2(a,i).then(()=>i[o]()):(i?i&&Object.hasOwn(i,o)?console.warn(`The export ${t}, defined in ${e}'s routes.json, is not a function`):console.warn(`${a} does not define a component called "${o}", referenced in ${e}'s routes.json. This cannot be loaded.`):console.warn(`Unknown app ${a} for ${t} defined in ${e}'s routes.json`),u4)}let u4={bootstrap:()=>Promise.resolve(),mount:()=>Promise.resolve(),unmount:()=>Promise.resolve()};async function u2(e,t){if(e in u0)await u0[e];else{let r=t??await oN(e);await (u0[e]=new Promise((t,n)=>{if(Object.hasOwn(r,"startupApp")){let a=r.startupApp;if("function"==typeof a)return Promise.resolve(a()).then(()=>{nJ(e),t(null)}).catch(n)}nJ(e),t(null)}))}}function u3(e,t){let r=t.name;if(!r)return void console.error(`An extension definition in ${e} is missing an name and thus cannot be
17
17
  registered. To fix this, ensure that you define the "name" field inside the
18
18
  extension definition.`,t);t.slots&&t.slot&&console.warn(`The extension ${r} from ${e} declares both a 'slots' property and
19
19
  a 'slot' property. Only the 'slots' property will be honored.`);let n=t.slots?t.slots:t.slot?[t.slot]:[];if(!t.component)return void console.error(`The extension ${r} from ${e} is missing a 'component' entry and thus cannot be registered.
@@ -36,4 +36,4 @@ To fix this, ensure that you define the "component" field inside the page defini
36
36
  * {
37
37
  overscroll-behavior: contain;
38
38
  }
39
- }`.trim(),document.head.prepend(n),o=HTMLElement.prototype.focus,Reflect.defineProperty(HTMLElement.prototype,"focus",{configurable:!0,writable:!0,value:function(e){let t=((e=document)=>e.activeElement)(),r=null!=t&&br(t);o.call(this,{...e,preventScroll:!0}),e&&e.preventScroll||bo(this,r)}}),i=d7(mW(document,"touchstart",t=>{let n=mK(t);e=gr(n)?n:gn(n,!0),r=!1;let a=n.ownerDocument.defaultView.getSelection();a&&!a.isCollapsed&&a.containsNode(n,!0)&&(r=!0),t.composedPath().some(e=>e instanceof HTMLInputElement&&"range"===e.type)&&(r=!0),"selectionStart"in n&&"selectionEnd"in n&&n.selectionStart<n.selectionEnd&&n.ownerDocument.activeElement===n&&(r=!0)},{passive:!1,capture:!0}),mW(document,"touchmove",t=>{if(2!==t.touches.length&&!r){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}),mW(document,"blur",e=>{let t=mK(e),r=e.relatedTarget;if(r&&br(r))r.focus({preventScroll:!0}),bo(r,br(t));else if(!r){let e=t.parentElement?.closest("[tabindex]");e?.focus({preventScroll:!0})}},!0)),()=>{t(),i(),n.remove(),Reflect.defineProperty(HTMLElement.prototype,"focus",{configurable:!0,writable:!0,value:o})}):d7((s=window.innerWidth-document.documentElement.clientWidth)>0&&("scrollbarGutter"in document.documentElement.style?mH(document.documentElement,"scrollbar-gutter","stable"):mH(document.documentElement,"padding-right",`${s}px`)),mH(document.documentElement,"overflow","hidden"))),()=>{0==--ba&&u()}}},[t])}({isDisabled:o||!t.isOpen}),(0,s9.useEffect)(()=>{if(t.isOpen&&n.current)if(o){var e,r,i=a?.current??n.current;let t=vB[vB.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,u,c,d,m,p,f;return e=[a?.current??n.current],o=(r={shouldUseInert:!0})instanceof(t=mV(e?.[0])).Element?{root:r}:r,i=o?.root??document.body,s=o?.shouldUseInert&&vL,l=new Set(e),u=new Set,c=(e,r)=>{s&&e instanceof t.HTMLElement?e.inert=r:r?e.setAttribute("aria-hidden","true"):(e.removeAttribute("aria-hidden"),e instanceof t.HTMLElement&&(e.inert=!1))},d=e=>{for(let t of e.querySelectorAll("[data-live-announcer], [data-react-aria-top-layer]"))l.add(t);let t=e=>{if(u.has(e)||l.has(e)||e.parentElement&&u.has(e.parentElement)&&"row"!==e.parentElement.getAttribute("role"))return NodeFilter.FILTER_REJECT;for(let t of l)if(mz(e,t))return NodeFilter.FILTER_SKIP;return NodeFilter.FILTER_ACCEPT},r=yv(mB(e),e,NodeFilter.SHOW_ELEMENT,{acceptNode:t}),n=t(e);if(n===NodeFilter.FILTER_ACCEPT&&m(e),n!==NodeFilter.FILTER_REJECT){let e=r.nextNode();for(;null!=e;)m(e),e=r.nextNode()}},m=e=>{let r=vF.get(e)??0;(s&&e instanceof t.HTMLElement?e.inert:"true"===e.getAttribute("aria-hidden"))&&0===r||(0===r&&c(e,!0),u.add(e),vF.set(e,r+1))},vB.length&&vB[vB.length-1].disconnect(),d(i),(p=new MutationObserver(e=>{for(let r of e)if("childList"===r.type&&r.target.isConnected&&![...l,...u].some(e=>mz(e,r.target)))for(let e of r.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&&d(e)}})).observe(i,{childList:!0,subtree:!0}),f={visibleNodes:l,hiddenNodes:u,observe(){p.observe(i,{childList:!0,subtree:!0})},disconnect(){p.disconnect()}},vB.push(f),()=>{for(let e of(p.disconnect(),u)){let t=vF.get(e);null!=t&&(1===t?(c(e,!1),vF.delete(e)):vF.set(e,t-1))}f===vB[vB.length-1]?(vB.pop(),vB.length&&vB[vB.length-1].observe()):vB.splice(vB.indexOf(f),1)}}},[o,t.isOpen,n,a]);let{focusWithinProps:y}=ft(e);return{popoverProps:mg(d,p,y),arrowProps:f,underlayProps:m,placement:h,triggerAnchorPoint:g}}({...a,offset:null!=(o=a.offset)?o:8,arrowRef:s,groupRef:d?c:l},e),y=a.popoverRef,v=bu(y,!!h)||a.isEntering||!1,b=mb({...a,defaultClassName:"react-aria-Popover",values:{trigger:a.trigger||null,placement:h,isEntering:v,isExiting:t}}),w=!a.isNonModal||"SubmenuTrigger"===a.trigger,[E,D]=(0,s9.useState)(!1);me(()=>{y.current&&D(w&&!y.current.querySelector("[role=dialog]"))},[y,w]),(0,s9.useEffect)(()=>{E&&("SubmenuTrigger"!==a.trigger||"pointer"!==bm)&&y.current&&!mZ(y.current)&&function(e){if(!e.isConnected)return;let t=mB(e);if("virtual"===bm){let r=((e=document)=>e.activeElement)(t);pR(()=>{let n=((e=document)=>e.activeElement)(t);(n===r||n===t.body)&&e.isConnected&&mL(e)})}else mL(e)}(y.current)},[E,y,a.trigger]);let x=(0,s9.useMemo)(()=>{let e=b.children;if(n)for(let t of n)e=s8().createElement(t.Provider,{value:null},e);return e},[b.children,n]),_={...m.style,"--trigger-anchor-point":g?`${g.x}px ${g.y}px`:void 0,...b.style},S=s8().createElement(mC.div,{...mg(mA(a,{global:!0}),m),...b,role:E?"dialog":void 0,tabIndex:E?-1:void 0,"aria-label":a["aria-label"],"aria-labelledby":a["aria-labelledby"],ref:y,slot:a.slot||void 0,style:_,dir:a.dir,"data-trigger":a.trigger,"data-placement":h,"data-entering":v||void 0,"data-exiting":t||void 0},!a.isNonModal&&s8().createElement(bl,{onDismiss:e.close}),s8().createElement(vA.Provider,{value:{...f,placement:h,ref:s}},x),s8().createElement(bl,{onDismiss:e.close}));return d?s8().createElement(v_,{...a,shouldContainFocus:E,isExiting:t,portalContainer:null!=(i=null!=r?r:null==c?void 0:c.current)?i:void 0},S):s8().createElement(v_,{...a,shouldContainFocus:E,isExiting:t,portalContainer:r},!a.isNonModal&&e.isOpen&&s8().createElement("div",{"data-testid":"underlay",...p,style:{position:"fixed",inset:0}}),s8().createElement("div",{ref:l,style:{display:"contents"}},s8().createElement(bk.Provider,{value:l},S)))}function bT(e){return e?.start!=null&&null!=e.end}let b$=(0,s9.createContext)(null),bO=(0,s9.createContext)(null),bN=(0,s9.createContext)(null),bM=(0,s9.createContext)(null),bI=[yf,fc,vI,ff],bj=(0,s9.forwardRef)(function(e,t){var r,n;[e,t]=mE(e,t,b$);let{validationBehavior:a}=mw(v$)||{},o=null!=(n=null!=(r=e.validationBehavior)?r:a)?n:"native",i=function(e){let t=bS(e),[r,n]=g5(e.value,e.defaultValue||null,e.onChange),[a]=(0,s9.useState)(r),o=r||e.placeholderValue||null,[i,s]=va(o,e.granularity),l=null!=r?r.toDate(s??"UTC"):null,u="hour"===i||"minute"===i||"second"===i,c=e.shouldCloseOnSelect??!0,[d,m]=(0,s9.useState)(null),[p,f]=(0,s9.useState)(null);if(r&&(d=r,"hour"in r&&(p=r)),o&&!(i in o))throw Error("Invalid granularity "+i+" for value "+o.toString());let h=r?.calendar.identifier==="gregory"&&"BC"===r.era,g=(0,s9.useMemo)(()=>({granularity:i,timeZone:s,hideTimeZone:e.hideTimeZone,hourCycle:e.hourCycle,shouldForceLeadingZeros:e.shouldForceLeadingZeros,showEra:h}),[i,e.hourCycle,e.shouldForceLeadingZeros,s,e.hideTimeZone,h]),{minValue:y,maxValue:v,isDateUnavailable:b}=e,w=(0,s9.useMemo)(()=>y8(r,y,v,b,g),[r,y,v,b,g]),E=y1({...e,value:r,builtinValidation:w}),D=E.displayValidation.isInvalid,x=e.validationState||(D?"invalid":null),_=(e,t)=>{n("timeZone"in t?t.set(h$(e)):hO(e,t)),m(null),f(null),E.commitValidation()};return{...E,value:r,defaultValue:e.defaultValue??a,setValue:n,dateValue:d,timeValue:p,setDateValue:r=>{let a="function"==typeof c?c():c;u?p||a?_(r,p||vr(e.defaultValue||e.placeholderValue)):m(r):(n(r),E.commitValidation()),a&&t.setOpen(!1)},setTimeValue:e=>{d&&e?_(d,e):f(e)},granularity:i,hasTime:u,...t,setOpen(n){!n&&!r&&d&&u&&_(d,p||vr(e.defaultValue||e.placeholderValue)),t.setOpen(n)},validationState:x,isInvalid:D,formatValue:(e,t)=>l?new fj(e,vt(t,g)).format(l):"",getDateFormatter:(e,t)=>new fj(e,vt({},{...g,...t}))}}({...e,validationBehavior:o}),s=(0,s9.useRef)(null),[l,u]=mD(!e["aria-label"]&&!e["aria-labelledby"]),{groupProps:c,labelProps:d,fieldProps:m,buttonProps:p,dialogProps:f,calendarProps:h,descriptionProps:g,errorMessageProps:y,...v}=function(e,t,r){var n;let a=mp(),o=mp(),i=mp(),s=fJ((n=yF)&&n.__esModule?n.default:n,"@react-aria/datepicker"),{isInvalid:l,validationErrors:u,validationDetails:c}=t.displayValidation,{labelProps:d,fieldProps:m,descriptionProps:p,errorMessageProps:f}=yU({...e,labelElementType:"span",isInvalid:l,errorMessage:e.errorMessage||u}),h=yB(t,r),g=m["aria-labelledby"]||m.id,{locale:y}=fR(),v=t.formatValue(y,{month:"long"}),b=gu(v?s.format("selectedDateDescription",{date:v}):""),w=[b["aria-describedby"],m["aria-describedby"]].filter(Boolean).join(" ")||void 0,E=mA(e),D=(0,s9.useMemo)(()=>yM(r),[r]),x=(0,s9.useRef)(!1),{focusWithinProps:_}=ft({...e,isDisabled:t.isOpen,onBlurWithin:t=>{mz(document.getElementById(o),t.relatedTarget)||(x.current=!1,e.onBlur?.(t),e.onFocusChange?.(!1))},onFocusWithin:t=>{x.current||(x.current=!0,e.onFocus?.(t),e.onFocusChange?.(!0))}});return{groupProps:mg(E,h,m,b,_,{role:"group","aria-disabled":e.isDisabled||null,"aria-labelledby":g,"aria-describedby":w,onKeyDown(r){!t.isOpen&&e.onKeyDown&&e.onKeyDown(r)},onKeyUp(r){!t.isOpen&&e.onKeyUp&&e.onKeyUp(r)}}),labelProps:{...d,onClick:()=>{D.focusFirst()}},fieldProps:{...m,id:i,[yK]:"presentation","aria-describedby":w,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,[y0]:t,autoFocus:e.autoFocus,name:e.name,form:e.form},descriptionProps:p,errorMessageProps:f,buttonProps:{...b,id:a,"aria-haspopup":"dialog","aria-label":s.format("calendar"),"aria-labelledby":`${a} ${g}`,"aria-describedby":w,"aria-expanded":t.isOpen,isDisabled:e.isDisabled||e.isReadOnly,onPress:()=>t.setOpen(!0)},dialogProps:{id:o,"aria-labelledby":`${a} ${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:u,validationDetails:c}}({...mx(e),label:u,validationBehavior:o},i,s),[b,w]=(0,s9.useState)(null),E=(0,s9.useCallback)(()=>{s.current&&w(s.current.offsetWidth+"px")},[]);v5({ref:s,onResize:E});let{focusProps:D,isFocused:x,isFocusVisible:_}=fr({within:!0}),S=mb({...e,values:{state:i,isFocusWithin:x,isFocusVisible:_,isDisabled:e.isDisabled||!1,isInvalid:i.isInvalid,isOpen:i.isOpen,isReadOnly:e.isReadOnly||!1,isRequired:e.isRequired||!1},defaultClassName:"react-aria-DatePicker"}),C=mA(e,{global:!0});return delete C.id,s8().createElement(mv,{values:[[bN,i],[yf,{...c,ref:s,isInvalid:i.isInvalid}],[vf,m],[fc,{...p,isPressed:i.isOpen}],[vI,{...d,ref:l,elementType:"span"}],[yr,h],[vC,i],[bC,{trigger:"DatePicker",triggerRef:s,placement:"bottom start",style:{"--trigger-width":b},clearContexts:bI}],[vS,f],[ff,{slots:{description:g,errorMessage:y}}],[vP,v]]},s8().createElement(mC.div,{...mg(C,S,D),ref:t,slot:e.slot||void 0,"data-focus-within":x||void 0,"data-invalid":i.isInvalid||void 0,"data-focus-visible":_||void 0,"data-disabled":e.isDisabled||void 0,"data-readonly":e.isReadOnly||void 0,"data-required":e.isRequired||void 0,"data-open":i.isOpen||void 0}),s8().createElement(vM,{autoComplete:e.autoComplete,name:e.name,isDisabled:e.isDisabled,state:i}))}),bA=(0,s9.forwardRef)(function(e,t){var r,n;[e,t]=mE(e,t,bO);let{validationBehavior:a}=mw(v$)||{},o=null!=(n=null!=(r=e.validationBehavior)?r:a)?n:"native",i=function(e){let t=bS(e),[r,n]=g5(e.value,e.defaultValue||null,e.onChange),[a]=(0,s9.useState)(r),[o,i]=(0,s9.useState)(()=>r||{start:null,end:null});null==r&&o.start&&o.end&&i(o={start:null,end:null});let s=r||o,l=e=>{i(s=e||{start:null,end:null}),bT(s)?n(s):n(null)},[u,c]=va(s?.start||s?.end||e.placeholderValue||null,e.granularity),d="hour"===u||"minute"===u||"second"===u,m=e.shouldCloseOnSelect??!0,[p,f]=(0,s9.useState)(null),[h,g]=(0,s9.useState)(null);s&&bT(s)&&(p=s,"hour"in s.start&&(h=s));let y=(e,t)=>{l({start:"timeZone"in t.start?t.start.set(h$(e.start)):hO(e.start,t.start),end:"timeZone"in t.end?t.end.set(h$(e.end)):hO(e.end,t.end)}),f(null),g(null),C.commitValidation()},v=r=>{let n="function"==typeof m?m():m;d?bT(r)&&(n||h?.start&&h?.end)?y(r,{start:h?.start||vr(e.placeholderValue),end:h?.end||vr(e.placeholderValue)}):f(r):bT(r)?(l(r),C.commitValidation()):f(r),n&&t.setOpen(!1)},b=e=>{bT(p)&&bT(e)?y(p,e):g(e)},w=s?.start?.calendar.identifier==="gregory"&&"BC"===s.start.era||s?.end?.calendar.identifier==="gregory"&&"BC"===s.end.era,E=(0,s9.useMemo)(()=>({granularity:u,timeZone:c,hideTimeZone:e.hideTimeZone,hourCycle:e.hourCycle,shouldForceLeadingZeros:e.shouldForceLeadingZeros,showEra:w}),[u,e.hourCycle,e.shouldForceLeadingZeros,c,e.hideTimeZone,w]),{minValue:D,maxValue:x,isDateUnavailable:_}=e,S=(0,s9.useMemo)(()=>{var e,t;let r;return e=s,t=_?e=>_(e,null):void 0,r=y6(y8(e?.start??null,D,x,t,E),y8(e?.end??null,D,x,t,E)),e?.end!=null&&null!=e.start&&0>e.end.compare(e.start)&&(r=y6(r,{isInvalid:!0,validationErrors:[(fz.getGlobalDictionaryForPackage("@react-stately/datepicker")||y5).getStringForLocale("rangeReversed",y9())],validationDetails:{...yq,rangeUnderflow:!0,rangeOverflow:!0,valid:!1}})),r},[s,D,x,_,E]),C=y1({...e,value:r,name:(0,s9.useMemo)(()=>[e.startName,e.endName].filter(e=>null!=e),[e.startName,e.endName]),builtinValidation:S}),k=C.displayValidation.isInvalid,P=e.validationState||(k?"invalid":null);return{...C,value:s,defaultValue:e.defaultValue??a,setValue:l,dateRange:p,timeRange:h,granularity:u,hasTime:d,setDate(e,t){"start"===e?v({start:t,end:p?.end??null}):v({start:p?.start??null,end:t})},setTime(e,t){"start"===e?b({start:t,end:h?.end??null}):b({start:h?.start??null,end:t})},setDateTime(e,t){"start"===e?l({start:t,end:s?.end??null}):l({start:s?.start??null,end:t})},setDateRange:v,setTimeRange:b,...t,setOpen(r){!r&&!(s?.start&&s?.end)&&bT(p)&&d&&y(p,{start:h?.start||vr(e.placeholderValue),end:h?.end||vr(e.placeholderValue)}),t.setOpen(r)},validationState:P,isInvalid:k,formatValue(t,r){let n;if(!s||!s.start||!s.end)return null;let a="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"),u=vt(r,{granularity:o,timeZone:a,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}),c=s.start.toDate(a||"UTC"),d=s.end.toDate(i||"UTC"),m=new fj(t,u);if(a===i&&o===l&&0!==s.start.compare(s.end)){try{let e=m.formatRangeToParts(c,d),t=-1;for(let r=0;r<e.length;r++){let n=e[r];if("shared"===n.source&&"literal"===n.type)t=r;else if("endRange"===n.source)break}let r="",n="";for(let a=0;a<e.length;a++)a<t?r+=e[a].value:a>t&&(n+=e[a].value);return{start:r,end:n}}catch{}n=m}else n=new fj(t,vt(r,{granularity:l,timeZone:i,hideTimeZone:e.hideTimeZone,hourCycle:e.hourCycle}));return{start:m.format(c),end:n.format(d)}},getDateFormatter:(e,t)=>new fj(e,vt({},{...E,...t}))}}({...e,validationBehavior:o}),s=(0,s9.useRef)(null),[l,u]=mD(!e["aria-label"]&&!e["aria-labelledby"]),{groupProps:c,labelProps:d,startFieldProps:m,endFieldProps:p,buttonProps:f,dialogProps:h,calendarProps:g,descriptionProps:y,errorMessageProps:v,...b}=function(e,t,r){var n;let a=fJ((n=yF)&&n.__esModule?n.default:n,"@react-aria/datepicker"),{isInvalid:o,validationErrors:i,validationDetails:s}=t.displayValidation,{labelProps:l,fieldProps:u,descriptionProps:c,errorMessageProps:d}=yU({...e,labelElementType:"span",isInvalid:o,errorMessage:e.errorMessage||i}),m=u["aria-labelledby"]||u.id,{locale:p}=fR(),f=t.formatValue(p,{month:"long"}),h=gu(f?a.format("selectedRangeDescription",{startDate:f.start,endDate:f.end}):""),g={"aria-label":a.format("startDate"),"aria-labelledby":m},y={"aria-label":a.format("endDate"),"aria-labelledby":m},v=mp(),b=mp(),w=yB(t,r),E=[h["aria-describedby"],u["aria-describedby"]].filter(Boolean).join(" ")||void 0,D=(0,s9.useMemo)(()=>yM(r,{accept:e=>e.id!==v}),[r,v]),x={[yG]:D,[yK]:"presentation","aria-describedby":E,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},_=mA(e),S=(0,s9.useRef)(!1),{focusWithinProps:C}=ft({...e,isDisabled:t.isOpen,onBlurWithin:t=>{mz(document.getElementById(b),t.relatedTarget)||(S.current=!1,e.onBlur?.(t),e.onFocusChange?.(!1))},onFocusWithin:t=>{S.current||(S.current=!0,e.onFocus?.(t),e.onFocusChange?.(!0))}}),k=(0,s9.useRef)(yX),P=(0,s9.useRef)(yX);return{groupProps:mg(_,w,u,h,C,{role:"group","aria-disabled":e.isDisabled||null,"aria-describedby":E,onKeyDown(r){!t.isOpen&&e.onKeyDown&&e.onKeyDown(r)},onKeyUp(r){!t.isOpen&&e.onKeyUp&&e.onKeyUp(r)}}),labelProps:{...l,onClick:()=>{D.focusFirst()}},buttonProps:{...h,id:v,"aria-haspopup":"dialog","aria-label":a.format("calendar"),"aria-labelledby":`${v} ${m}`,"aria-describedby":E,"aria-expanded":t.isOpen,isDisabled:e.isDisabled||e.isReadOnly,onPress:()=>t.setOpen(!0)},dialogProps:{id:b,"aria-labelledby":`${v} ${m}`},startFieldProps:{...g,...x,value:t.value?.start??null,defaultValue:t.defaultValue?.start,onChange:e=>t.setDateTime("start",e),autoFocus:e.autoFocus,name:e.startName,form:e.form,[y0]:{realtimeValidation:t.realtimeValidation,displayValidation:t.displayValidation,updateValidation(e){k.current=e,t.updateValidation(y6(e,P.current))},resetValidation:t.resetValidation,commitValidation:t.commitValidation}},endFieldProps:{...y,...x,value:t.value?.end??null,defaultValue:t.defaultValue?.end,onChange:e=>t.setDateTime("end",e),name:e.endName,form:e.form,[y0]:{realtimeValidation:t.realtimeValidation,displayValidation:t.displayValidation,updateValidation(e){P.current=e,t.updateValidation(y6(k.current,e))},resetValidation:t.resetValidation,commitValidation:t.commitValidation}},descriptionProps:c,errorMessageProps:d,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}}({...mx(e),label:u,validationBehavior:o},i,s),[w,E]=(0,s9.useState)(null),D=(0,s9.useCallback)(()=>{s.current&&E(s.current.offsetWidth+"px")},[]);v5({ref:s,onResize:D});let{focusProps:x,isFocused:_,isFocusVisible:S}=fr({within:!0}),C=mb({...e,values:{state:i,isFocusWithin:_,isFocusVisible:S,isDisabled:e.isDisabled||!1,isInvalid:i.isInvalid,isOpen:i.isOpen,isReadOnly:e.isReadOnly||!1,isRequired:e.isRequired||!1},defaultClassName:"react-aria-DateRangePicker"}),k=mA(e,{global:!0});return delete k.id,s8().createElement(mv,{values:[[bM,i],[yf,{...c,ref:s,isInvalid:i.isInvalid}],[fc,{...f,isPressed:i.isOpen}],[vI,{...d,ref:l,elementType:"span"}],[yn,g],[vC,i],[bC,{trigger:"DateRangePicker",triggerRef:s,placement:"bottom start",style:{"--trigger-width":w},clearContexts:bI}],[vS,h],[vf,{slots:{start:m,end:p}}],[ff,{slots:{description:y,errorMessage:v}}],[vP,b]]},s8().createElement(mC.div,{...mg(k,C,x),ref:t,slot:e.slot||void 0,"data-focus-within":_||void 0,"data-invalid":i.isInvalid||void 0,"data-focus-visible":S||void 0,"data-disabled":e.isDisabled||void 0,"data-readonly":e.isReadOnly||void 0,"data-required":e.isRequired||void 0,"data-open":i.isOpen||void 0}))});function bL(e){return s8().createElement(fP,e)}function bF(e,t,r=!1){if(null==e)return r?e:void 0;if("string"==typeof e&&!e)return r?null:void 0;if(e instanceof hb||e instanceof hE||e instanceof hD)return t?hN(e,t):e;{let r=uz()(e).toDate(),n=new hb(r.getFullYear(),r.getMonth()+1,r.getDate());return t?hN(n,t):n}}function bB(e){if(e)return e.toDate(hK())}function bV(e){if("string"==typeof e&&0!==e.trim().length)try{return new Intl.Locale(e.replace(/[_@]/g,"-")).toString()}catch{return}}function bU(e){let t=e??"",r=bV(t);if(!r)return t;try{return new Intl.DisplayNames([r],{type:"language"}).of(r)??t}catch{return t}}function bW(){let e=window.i18next.language,t=bV(e)??e;return"ht"===t&&(t="fr-HT"),t}if("u">typeof navigator){let e=navigator;ea=Array.isArray(e.languages)?e.languages[0]:e.language}else if("u">typeof process){let e=process.env;ea=e.LC_ALL||e.LC_MESSAGES||e.LANG||e.LANGUAGE}var bH=function(e){e=(e=e.replace(/_/g,"-")).replace(/[.:][\w-]*$/,"");try{return new Intl.Locale(e).baseName}catch(e){return"en-US"}}(ea||"en-US"),bz=class extends Date{invalid=null;isValid(){return!Number.isNaN(this.valueOf())}},bK={};for(let e=0;e<100;e++)bK[(e<=9?"0":"")+e]=e+(e>51?1900:2e3);var bG={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},bZ="[1234567890一二三四五六七八九〇\\d]",bY={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},bq={},bJ={"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},bX={zone:bJ,year:bK,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:{}},bQ={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(bJ).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,}"},b0={...bQ,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}"},b1={},b4=class e{locale;lookups;vars;numberingSystem;baseName;dateOptions;static factory(t=bH){return b1[t.toLowerCase()]||(b1[t.toLowerCase()]=new e(t)),b1[t.toLowerCase()]}constructor(e=bH){this.locale=e,this.lookups={...bX},this.vars={...bQ};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 r=0;r<e.length;r++)t+=String(this.lookups.digit[e[r]]);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 r=this.lookups.meridiem[t?.toLowerCase()]||0,n=this.toInt(e);return n<12&&12===r&&(n+=12),12===n&&0===r&&(n=0),n}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,r,n]=t;return("-"===e||"−"===e?-1:1)*(60*this.toInt(r)+this.toInt(n||0))}return 0}build(){"latn"===this.dateOptions.numberingSystem?this.lookups.digit=bY: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(bq[e])return bq[e];if("fullwide"===e||"hanidec"===e)return{group:bZ,lookup:{...bY}};let t=bG[e];if(!t)return{group:"\\d",lookup:{...bY}};let r=String.fromCharCode(t),n=String.fromCharCode(t+9),a={};for(let e=0;e<10;e++)a[String.fromCharCode(t+e)]=e;return bq[e]={group:`[${r}-${n}]`,lookup:a},bq[e]}(this.numberingSystem);for(let r in this.lookups.digit=t,b0)b0.hasOwnProperty(r)&&(this.vars[r]=b0[r].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((r,n)=>{["","k","kuu","kuuta"].forEach((a,o)=>{e[r+a+(o<2?"\\.?":"")]=!0,t[r+a]=n+1})});else{let r=[],n=e=>"month"===e.type;for(let e=0;e<12;e++)r.push(new Date(2017,e,1));for(let a of["full","long","medium"]){let o=Intl.DateTimeFormat(this.locale,{dateStyle:a});for(let i=0;i<12;i++){let s=o.formatToParts(r[i]).find(n).value.toLocaleLowerCase(this.locale);/^\d+$/.test(s)||(/^ko/i.test(this.locale)&&(s+="월"),"medium"===a?(s=s.replace(/\.$/,""),e[`${s}\\.?`]=!0):e[s]=!0,t[s]=i+1)}}let a=Intl.DateTimeFormat(this.locale,{month:"short"});for(let o=0;o<12;o++){let i=a.formatToParts(r[o]).find(n).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 r=[],n={};for(let a of["long","short"]){let o=Intl.DateTimeFormat(this.locale,{weekday:a});for(let i=0;i<7;i++){let s=o.formatToParts(e[i]).find(t).value.toLocaleLowerCase(this.locale);"short"===a?(s=s.replace(/\.$/,""),r.push(`${s}\\.?`)):r.push(s),n[s]=i}}this.vars.DAYNAME=r.join("|"),this.lookups.dayname=n}buildMeridiems(){let e=[new Date(2017,0,1),new Date(2017,0,1,23,0,0)],t=e=>"dayPeriod"===e.type,r=[],n={},a=Intl.DateTimeFormat(this.locale,{timeStyle:"long"});for(let o=0;o<2;o++){let i=a.formatToParts(e[o]).find(t);if(!i)return;let s=i.value.toLocaleLowerCase(this.locale);r.push(s),n[s]=12*o}this.vars.MERIDIEM=r.join("|"),this.lookups.meridiem=n}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")}},b2=["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"],b3={y:"year",M:"month",d:"day",w:"week",h:"hour",m:"minute",s:"second",ms:"millisecond"},b6=()=>new Date;function b5(e){return function(t){let r={};for(let n=0,a=e.length;n<a;n++){let a=e[n];a&&(r[a]=t[n])}return r}}var b9=class{doneChecker;fallback;patterns;formatter;constructor({doneChecker:e,fallback:t,patterns:r,formatter:n}){this.doneChecker=e,this.fallback=t,this.patterns=r,this.formatter=n}attempt(e){if("string"!=typeof e)return this.fallback(e);let t=e.trim(),r={},n=!1;for(let e of this.patterns){let a=t.match(e.regex);if(!a)continue;n=!0;let o=e.handler(a);if(o){for(let[e,t]of Object.entries(o))e in r||void 0===t||(r[e]=t);if(t=(t=t.slice(0,a.index)+t.slice(a.index+a[0].length+1)).trim(),this.doneChecker(r,t))break}}return n?this.formatter(r):this.fallback(e)}},b8=["year","month","day","hour","minute","second","millisecond","offset"],b7={};function we(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 wt=[[/([^\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"]],wr={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," "],...wt],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:wt,id:wt,fr:[[/(\d{2}) h /,"$1:"],[/(\d{2}) min /,"$1:"],[/(\d{2}) s /,"$1"]]};function wn(e,t=bH){let r=function(e){if(!b7[e]){var t,r;let n,a,o=b4.factory(e);b7[e]=new b9({doneChecker:we,fallback:(t=e,function(e){let r=String(e).slice(0,50);return""===r&&(r="(empty string)"),{invalid:`Unable to parse "${r}" with locale "${t}"`}}),patterns:(n=[{name:"timestampWithOffset",regex:o.compile("^(_YEAR4_)-(_MONTH_)-(_DAY_)[T ](_H24_):(_MIN_):(_SEC_)(?:.(_MS_))? ?(_OFFSET_|Z)?$"),handler:b5(["","year","month","day","hour","minute","second","millisecond","offset"])},{name:"timestampWithZone",regex:o.compile("^(_YEAR4_)-(_MONTH_)-(_DAY_)[T ](_H24_):(_MIN_):(_SEC_)(?:.(_MS_))?\\s*(_ZONE_)$"),handler:b5(["","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:b5(["","year","month","day","hour","minute","second","millisecond","offset"])},{name:"chinese",regex:o.compile(`^(${bZ}{2,4})\\s*\u5E74\\s*(${bZ}{1,2})\\s*\u6708\\s*(${bZ}{1,2})\\s*\u65E5$`),handler:b5(["","year","month","day"])},{name:"korean",regex:o.compile("^(_YEAR_)년\\s*(_MONTH_)월\\s*(_DAY_)일$"),handler:b5(["","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:b5(["","monthname","day","hour","minute","second","offset","year"])},{name:"today",regex:/^(now|today|tomorrow|yesterday)$/i,handler:function(e){let t=b6(),r=e[0].toLowerCase(),n={now:0,today:0,tomorrow:864e5,yesterday:-864e5}[r];0!==n&&t.setTime(t.getTime()+n);let a={year:t.getFullYear(),month:t.getMonth()+1,day:t.getDate()};return"now"===r?{...a,hour:t.getHours(),minute:t.getMinutes(),second:t.getSeconds(),millisecond:t.getMilliseconds()}:a}},{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,r,n]){t=parseFloat(t),"week"===(r=r.length<=2?b3[r]:(r=r.replace(/s$/,"")).toLowerCase())&&(r="day",t*=7),("-"===e||n)&&(t*=-1);let a=b6();return"millisecond"===r?a.setUTCMilliseconds(a.getUTCMilliseconds()+t):"second"===r?a.setUTCSeconds(a.getUTCSeconds()+t):"minute"===r?a.setUTCMinutes(a.getUTCMinutes()+t):"hour"===r?a.setUTCHours(a.getUTCHours()+t):"day"===r?a.setUTCDate(a.getUTCDate()+t):"month"===r?a.setUTCMonth(a.getUTCMonth()+t):"year"===r&&a.setUTCFullYear(a.getUTCFullYear()+t),{year:a.getUTCFullYear(),month:a.getUTCMonth()+1,day:a.getUTCDate(),hour:a.getUTCHours(),minute:a.getUTCMinutes(),second:a.getUTCSeconds(),millisecond:a.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:b5(["","hour","minute","second","millisecond","zone"])},{name:"zone24",regex:o.compile("(_H24_):(_MIN_):(_SEC_)(?:\\.(_MS_))?[\\s\\[(]*(_ZONE_)?[\\s\\])]*$"),handler:b5(["","hour","minute","second","millisecond","zone"])},{name:"hms12WithOffset",regex:o.compile("(_H12_):(_MIN_):(_SEC_)\\s*(_MERIDIEM_)\\s*(_OFFSET_)"),handler:b5(["","hour","minute","second","meridiem","offset"])},{name:"hms12",regex:o.compile("(_H12_):(_MIN_):(_SEC_)\\s*(_MERIDIEM_)"),handler:b5(["","hour","minute","second","meridiem"])},{name:"hms24",regex:o.compile("(_H24_):(_MIN_):(_SEC_)(?:\\.(_MS_))?"),handler:b5(["","hour","minute","second","millisecond"])},{name:"hm12",regex:o.compile("(_H12_):(_MIN_)\\s*(_MERIDIEM_)"),handler:b5(["","hour","minute","meridiem"])},{name:"hm24",regex:o.compile("(_H24_):(_MIN_)"),handler:b5(["","hour","minute"])},{name:"h12",regex:o.compile("(_H12_)\\s*(_MERIDIEM_)"),handler:b5(["","hour","meridiem"])},{name:"8digit",regex:/^((?:19|20)\d{2})(\d{2})(\d{2})$/,handler:b5(["","year","month","day"])},{name:"yearMonthnameDay",regex:o.compile("(_YEAR4_)[\\s.-]+(_MONTHNAME_)[\\s,.-]+(_DAY_)(_ORDINAL_)?"),handler:b5(["","year","monthname","day"])},{name:"dayMonthnameYear",regex:o.compile("(_DAY_)(_ORDINAL_)?[\\s.-]*(_MONTHNAME_)[\\s,.-]+(_YEAR_)"),handler:b5(["","day","","monthname","year"])},{name:"monthnameDayYear",regex:o.compile("(_MONTHNAME_)[\\s.-]*(_DAY_)(_ORDINAL_)?[\\s,.-]+(_YEAR_)"),handler:b5(["","monthname","day","","year"])},{name:"dayMonthname",regex:o.compile("\\b(_DAY_)(_ORDINAL_)?[\\s.-]*(_MONTHNAME_)\\b"),handler:b5(["","day","","monthname"])},{name:"monthnameDay",regex:o.compile("\\b(_MONTHNAME_)[\\s.-]*(_DAY_)(_ORDINAL_)?\\b"),handler:b5(["","monthname","day"])},{name:"hmsNoMeridiem",regex:o.compile("\\b(_H12_|_H24_):(_MIN_):(_SEC_)\\b"),handler:b5(["","hour","minute","second"])},{name:"hmNoMeridiem",regex:o.compile("\\b(_H12_|_H24_):(_MIN_)\\b"),handler:b5(["","hour","minute"])},{name:"ymd",regex:o.compile("(_YEAR4_)([./-])(_MONTH_)\\2+(_DAY_)"),handler:b5(["","year","","month","day"])},{name:"mdy",regex:o.compile("(_MONTH_)([/-])(_DAY_)\\2(_YEAR_)"),handler:b5(["","month","","day","year"])},{name:"dmy",regex:o.compile("(_DAY_)(?:_ORDINAL_)?[./\\s-]+(_MONTH_)[./\\s-]+(_YEAR_)"),handler:b5(["","day","month","year"])},{name:"yearLoose",regex:o.compile("_YEAR4_"),handler:b5(["year"])},{name:"dayMonthnameLoose",regex:o.compile("(_DAY_)[\\s.]*(_MONTHNAME_)"),handler:b5(["","day","monthname"])},{name:"monthnameDayLoose",regex:o.compile("(_MONTHNAME_)[\\s.]*(_DAY_)"),handler:b5(["","monthname","day"])},{name:"monthname",regex:o.compile("_MONTHNAME_"),handler:b5(["monthname"])},{name:"year4",regex:o.compile("_YEAR4_"),handler:b5(["year"])},{name:"md",regex:o.compile("(_MONTH_)[/-](_DAY_)"),handler:b5(["","month","day"])},{name:"dm",regex:o.compile("(_DAY_)(?:_ORDINAL_)?[./\\s-]+(_MONTH_)"),handler:b5(["","day","month"])},{name:"day",regex:o.compile("_DAY_"),handler:b5(["day"])},{name:"year2",regex:o.compile("_YEAR2_"),handler:b5(["year"])},{name:"onlyZone",regex:o.compile("_ZONE_"),handler:b5(["zone"])},{name:"onlyOffset",regex:o.compile("_OFFSET_"),handler:b5(["offset"])}],a=o.baseName.slice(0,5),b2.includes(a)?n:n.filter(e=>!["mdy","md"].includes(e.name))),formatter:(r=o,function(e){let t={};for(let[n,a]of Object.entries(e))if("monthname"===n){if(a){let e=r.monthNameToInt(a);void 0!==e&&(t.month=e)}}else if("hour"===n&&e.meridiem){let n=r.h12ToInt(a,e.meridiem);void 0!==n&&(t.hour=n)}else if("zone"===n){if(a){let e=r.zoneToOffset(a);void 0!==e&&(t.offset=e)}}else if("offset"===n){let e=r.offsetToMinutes(a);void 0!==e&&(t.offset=e)}else if("millisecond"===n){let e=r.millisecondToInt(a);"number"==typeof e&&(t.millisecond=e)}else if(b8.includes(n)){let e=r.toInt(a);"number"==typeof e&&(t[n]=e)}return t.year<100&&(t.year=bK[e.year]),t.year&&"buddhist"===r.dateOptions.calendar&&(t.year-=543),t})})}return b7[e]}(t),n=function(e,t){let r=wr[t.slice(0,2).toLowerCase()];if(!r)return e;for(let[t,n]of r)e=e.replace(t,n);return e}(e,t);return r.attempt(n)}function wa(e){e.month&&e.day&&void 0===e.year&&(e.year=new Date().getFullYear()),60===e.second&&(e.second=59);let t=new bz(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 bz(t.valueOf()-60*e.offset*1e3):t}function wo(e,t=bH){let r=wn(e,t),n=r.invalid?new bz(NaN):wa(r);return n.isValid()||(n.invalid=`Unable to parse date "${e}"`),n}function wi(e,t=bH){return e instanceof Date?new bz(e.valueOf()):"number"==typeof e?new bz(e):wo(e,t)}Date.fromString=bz.fromString=wo,Date.fromAny=bz.fromAny=wi,"u">typeof window&&(window.anyDateParser={fromString:wo,fromAny:wi,fromObject:wa,attempt:wn});var ws=r(5238),wl=r(3826);let wu=function(e){return null==e};function wc(e,t){var r=function(e,t){if(!t.has(e))throw TypeError("attempted to get private field on non-instance");return t.get(e)}(e,t);return r.get?r.get.call(e):r.value}uH.extend(uK),uH.extend(wl),uH.extend(ws);let wd="YYYY-MM-DDTHH:mm:ss.SSSZZ",wm=/^(\d{4})(?:-(\d{2})(?:-(\d{2}))?)?$/;function wp(e,t){let r=wm.exec(e);if(!r)return wn(e,t);let n=Number(r[1]),a=void 0===r[2]?void 0:Number(r[2]),o=void 0===r[3]?void 0:Number(r[3]),i=new Date(0);return(i.setUTCFullYear(n,(a??1)-1,o??1),i.getUTCFullYear()!==n||i.getUTCMonth()!==(a??1)-1||i.getUTCDate()!==(o??1))?{invalid:`Invalid ISO calendar date '${e}'`}:{year:n,...void 0!==a&&{month:a},...void 0!==o&&{day:o}}}function wf(e){return null!=e&&28===e.trim().length&&"T"===(e=e.trim())[10]&&":"===e[13]&&":"===e[16]&&"."===e[19]&&("+"===e[23]||"-"===e[23])&&uH(e,wd).isValid()}function wh(e){return uH(e).isToday()}function wg(e){return wf(e)?uH(e,wd).toDate():null}function wy(e,t=!1){let r=uH(e);return t&&(r=r.utc()),r.format(wd)}function wv(e){return uH(e).toDate()}var wb=new WeakMap;let ww=new class{register(e,t){wc(this,wb).set(e,t)}getCalendar(e){if(!e)return;if(e.calendar)return e.calendar;if(e.region){let t=`${e.language}-${e.region}`;if(wc(this,wb).has(t))return wc(this,wb).get(t)}if(e.language&&wc(this,wb).has(e.language))return wc(this,wb).get(e.language);let t=new Intl.DateTimeFormat(e.toString()).resolvedOptions().calendar;return wc(this,wb).set(`${e.language}${e.region?`-${e.region}`:""}`,t),t}constructor(){!function(e,t,r){if(t.has(e))throw TypeError("Cannot initialize the same private elements twice on an object");t.set(e,r)}(this,wb,{writable:!0,value:new Map})}};function wE(e,t){ww.register(e,t)}function wD(e){let t=e??bW();return ww.getCalendar(t instanceof Intl.Locale?t:new Intl.Locale(t))}let wx={mode:"standard",time:"for today",day:!0,month:!0,year:!0,noToday:!1};function w_(e,t={}){let r=wp(e,bW());if(r.invalid)return console.warn(`Could not parse invalid date '${e}'`),null;!wu(r.day)&&wu(r.month)&&(r=Object.assign({},nc(r,"day"),{month:r.day})),r.month&&(r.month-=1),r.day&&(r=Object.assign({},nc(r,"day"),{date:r.day}));let n=uH().set(r).toDate();return wu(r.year)&&(t.year=!1),wu(r.month)&&(t.month=!1),wu(r.date)&&(t.day=!1),wS(n,t)}function wS(e,t){let r,n=t?.locale??bW(),a=new Intl.Locale(n),{calendar:o,mode:i,time:s,day:l,month:u,year:c,noToday:d,numberingSystem:m}={...wx,...{noToday:"am"===a.language},...t},p={calendar:o??wD(a),year:c?"numeric":void 0,month:u?"short":void 0,day:l?"2-digit":void 0,numberingSystem:m},f=uH(e).isToday();if(f&&!d)r=(r=new Intl.RelativeTimeFormat(n,{numeric:"auto"}).format(0,"day"))[0].toLocaleUpperCase(n)+r.slice(1);else{"en"===a.language&&(n="en-GB");let t=new Intl.DateTimeFormat(n,p).formatToParts(e);("en"===a.language||"am"===a.language)&&"standard"==i&&c&&l&&(t=t.map(wC("-"))),"wide"==i&&(t=t.map(wC(" — "))),"ethiopic"===p.calendar&&(t=t.filter((e,t,r)=>"era"!==e.type&&("literal"!==e.type||!(t<r.length-1)||"era"!==r[t+1].type))),r=t.map(e=>e.value).join("")}return(!0===s||f&&"for today"===s)&&(r+=`, ${wk(e)}`),r}let wC=e=>(t,r,n)=>"literal"!==t.type||" "!==t.value||r<n.length-1&&"era"===n[r+1].type?t:{type:"literal",value:e};function wk(e){return e.toLocaleTimeString(bW(),{hour:"2-digit",minute:"2-digit"})}function wP(e,t){return wS(e,{...t,time:!0})}function wR(e,t){let r=wD("string"==typeof t?new Intl.Locale(t):t);return r?hN(e,gJ(r)):e}function wT(e,t){return new Intl.DurationFormat(bW(),t).format(e)}function w$(e,t){if(null==e)return null;if("string"==typeof e){let r=wp(e,bW());return r.invalid?(console.warn(`Could not interpret '${e}' as a date`),null):(r.day&&!r.month&&(r={...nc(r,"day"),...{month:r.day}}),r.month&&(r.month-=1),r.day&&(r={...nc(r,"day"),...{date:r.day}}),uH(t).set(r))}return uH(e)}let wO=["years","months","days","hours","minutes","seconds"],wN={second:"seconds",minute:"minutes",hour:"hours",day:"days",month:"months",year:"years"},wM={seconds:45,minutes:45,hours:22,days:26,months:11,years:1/0};function wI(e,t=uH(),r){let n,a=uH(t),o=w$(e,a);if(null==o)return null;if("string"==typeof r){let e=wN[r]??r;return{[e]:a.diff(o,e)}}let{thresholds:i,largestUnit:s,smallestUnit:l}=r??{};if(void 0!==s||void 0!==l){let e,t=l?wN[l]??l:void 0;return e="auto"===s||void 0===s?function(e,t,r){let n=wO.indexOf(r);for(let a=0;a<wO.length;a++){let o=wO[a];if(t.diff(e,o)>0)return a<=n?o:r}return r}(o,a,t??"seconds"):wN[s]??s,function(e,t,r,n){let a=wO.indexOf(r),o=wO.indexOf(n),i=wO.slice(a,o+1),s={},l=e;for(let e of i){let r=t.diff(l,e);s[e]=r,l=l.add(r,e)}return s}(o,a,e,t??e)}let u=(n=function(e){let t={...wM};if(e)for(let[r,n]of Object.entries(e))void 0!==n&&(t[wN[r]??r]=n);return t}(i),a.diff(o,"seconds")<n.seconds?"seconds":a.diff(o,"minutes")<n.minutes?"minutes":a.diff(o,"hours")<n.hours?"hours":a.diff(o,"days")<n.days?"days":a.diff(o,"months")<n.months?"months":"years");return{[u]:a.diff(o,u)}}let wj={style:"short",localeMatcher:"lookup"};function wA(e,t=uH(),r){let n=wI(e,t,r);return null==n?null:wT(n,"object"==typeof r&&r.formatOptions?{...wj,...r.formatOptions}:wj)}let wL=(0,s9.createContext)(null);function wF(){let e=l8({externalModuleName:"@openmrs/esm-styleguide"}).preferredDateLocale,t=(0,s9.useMemo)(()=>{let t=bW();return e[t]&&(t=e[t]),t},[window.i18next.language]),r=(0,s9.useMemo)(()=>{let e=wD(t);return void 0!==e?gJ(e):void 0},[t]),n=(0,s9.useMemo)(()=>new Intl.Locale(t,{calendar:r?.identifier}),[t,r]),a=(0,s9.useMemo)(()=>r?hN(hU(hK()),r):hU(hK()),[r]);return{calendar:r,intlLocale:n,today_:a}}let wB=new hb(1793,1,1);var wV={};function wU(){return"u">typeof window&&window.InputEvent&&"function"==typeof InputEvent.prototype.getTargetRanges}function wW(e={}){let{locale:t}=fR();return(0,s9.useMemo)(()=>new(0,vu.K)(t,e),[t,e])}wV={"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 wH={};wH={"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 wz=()=>{};function wK(e){var t;let r=(0,s9.useRef)(void 0),{value:n,textValue:a,minValue:o,maxValue:i,isDisabled:s,isReadOnly:l,isRequired:u,onIncrement:c,onIncrementPage:d,onDecrement:m,onDecrementPage:p,onDecrementToMin:f,onIncrementToMax:h}=e,g=fJ((t=wH)&&t.__esModule?t.default:t,"@react-aria/spinbutton"),y=(0,s9.useRef)(!1),v=(0,s9.useCallback)(()=>{clearTimeout(r.current),y.current=!1},[]),b=pq(()=>{v()});(0,s9.useEffect)(()=>()=>b(),[]);let{keyboardProps:w}=pL({isDisabled:s||l,shortcuts:{PageUp:()=>d?void d():!!c&&void c(),ArrowUp:()=>!!c&&void c(),PageDown:()=>p?void p():!!m&&void m(),ArrowDown:()=>!!m&&void m(),Home:()=>!!f&&void f(),End:()=>!!h&&void h()},allowRepeats:!0}),E=(0,s9.useRef)(!1),D=()=>{E.current=!0},x=()=>{E.current=!1},_=""===a?g.format("Empty"):(a||`${n}`).replace("-","−");(0,s9.useEffect)(()=>{E.current&&(fT&&fT.clear("assertive"),f$(_,"assertive"))},[_]);let S=(0,s9.useCallback)(()=>{v()},[v]),C=pq(c??wz),k=pq(m??wz),P=pq(()=>{(void 0===i||isNaN(i)||void 0===n||isNaN(n)||n<i)&&(C(),R(60))}),R=pq(e=>{b(),y.current=!0,r.current=window.setTimeout(P,e)}),T=pq(()=>{(void 0===o||isNaN(o)||void 0===n||isNaN(n)||n>o)&&(k(),$(60))}),$=pq(e=>{b(),y.current=!0,r.current=window.setTimeout(T,e)}),O=e=>{e.preventDefault()},{addGlobalListener:N,removeAllGlobalListeners:M}=pJ(),I=(0,s9.useRef)(!1),[j,A]=(0,s9.useState)(null);(0,s9.useEffect)(()=>{"touch"===j?R(600):j?R(400):j||b()},[j]);let[L,F]=(0,s9.useState)(null);return(0,s9.useEffect)(()=>{"touch"===L?$(600):L?$(400):L||b()},[L]),{spinButtonProps:{role:"spinbutton","aria-valuenow":void 0===n||isNaN(n)?void 0:n,"aria-valuetext":_,"aria-valuemin":o,"aria-valuemax":i,"aria-disabled":s||void 0,"aria-readonly":l||void 0,"aria-required":u||void 0,...w,onFocus:D,onBlur:x},incrementButtonProps:{onPressStart:e=>{v(),"touch"!==e.pointerType?(c?.(),A("mouse")):(N(window,"pointercancel",S,{capture:!0}),I.current=!1,A("touch")),N(window,"contextmenu",O)},onPressUp:e=>{v(),"touch"===e.pointerType&&(I.current=!0),M(),A(null)},onPressEnd:e=>{v(),"touch"===e.pointerType&&!y.current&&I.current&&c?.(),I.current=!1,A(null)},onFocus:D,onBlur:x},decrementButtonProps:{onPressStart:e=>{v(),"touch"!==e.pointerType?(m?.(),F("mouse")):(N(window,"pointercancel",S,{capture:!0}),I.current=!1,F("touch"))},onPressUp:e=>{v(),"touch"===e.pointerType&&(I.current=!0),M(),F(null)},onPressEnd:e=>{v(),"touch"===e.pointerType&&!y.current&&I.current&&m?.(),I.current=!1,F(null)},onFocus:D,onBlur:x}}}let wG=null;var wZ=r(6284);function wY(e,t,r){let n="+"===e?t+r:t-r;if(t%1!=0||r%1!=0){let a=t.toString().split("."),o=r.toString().split("."),i=Math.pow(10,Math.max(a[1]&&a[1].length||0,o[1]&&o[1].length||0));t=Math.round(t*i),r=Math.round(r*i),n=("+"===e?t+r:t-r)/i}return n}let wq=(0,s9.createContext)(null),wJ=(0,s9.createContext)(null),wX=(0,s9.forwardRef)(function(e,t){var r,n;[e,t]=mE(e,t,wq);let{validationBehavior:a}=mw(v$)||{},o=null!=(n=null!=(r=e.validationBehavior)?r:a)?n:"native",{locale:i}=fR(),s=function(e){let{minValue:t,maxValue:r,step:n,formatOptions:a,value:o,defaultValue:i=NaN,onChange:s,locale:l,isDisabled:u,isReadOnly:c,commitBehavior:d="snap"}=e;null===o&&(o=NaN);let m=(0,s9.useCallback)(e=>void 0===n||isNaN(n)?vV(e,t,r):vW(e,t,r,n),[n,t,r]);void 0===o||isNaN(o)||"snap"!==d||(o=m(o)),isNaN(i)||"snap"!==d||(i=m(i));let[p,f]=g5(o,isNaN(i)?NaN:i,s),[h]=(0,s9.useState)(p),[g,y]=(0,s9.useState)(()=>isNaN(p)?"":new(0,vu.K)(l,a).format(p)),v=(0,s9.useMemo)(()=>new(0,wZ.d)(l,a),[l,a]),b=(0,s9.useMemo)(()=>v.getNumberingSystem(g),[v,g]),w=(0,s9.useMemo)(()=>new(0,vu.K)(l,{...a,numberingSystem:b}),[l,a,b]),E=(0,s9.useMemo)(()=>w.resolvedOptions(),[w]),D=(0,s9.useCallback)(e=>isNaN(e)||null===e?"":w.format(e),[w]),x=y1({...e,value:p}),_=void 0===n||isNaN(n)?1:n;"percent"===E.style&&(void 0===n||isNaN(n))&&(_=.01);let[S,C]=(0,s9.useState)(p),[k,P]=(0,s9.useState)(l),[R,T]=(0,s9.useState)(a);Object.is(p,S)&&l===k&&function(e,t){if(e===t)return!0;if(!e||!t)return!1;let r=Object.keys(e),n=Object.keys(t);if(r.length!==n.length)return!1;for(let n of r)if(t[n]!==e[n])return!1;return!0}(a,R)||(y(D(p)),C(p),P(l),T(a));let $=(0,s9.useMemo)(()=>v.parse(g),[v,g]),O=(e,n=0)=>{if(isNaN($))return vW(isNaN(n)?0:n,t,r,_);{let n=vW($,t,r,_);return"+"===e&&n>$||"-"===e&&n<$?n:vW(wY(e,$,_),t,r,_)}},N=(0,s9.useMemo)(()=>!u&&!c&&(isNaN($)||void 0===r||isNaN(r)||vW($,t,r,_)>$||wY("+",$,_)<=r),[u,c,t,r,_,$]),M=(0,s9.useMemo)(()=>!u&&!c&&(isNaN($)||void 0===t||isNaN(t)||vW($,t,r,_)<$||wY("-",$,_)>=t),[u,c,t,r,_,$]);return{...x,validate:e=>v.isValidPartialNumber(e,t,r),increment:()=>{let e=O("+",t);e===p&&y(D(e)),f(e),x.commitValidation()},incrementToMax:()=>{null!=r&&(f(vW(r,t,r,_)),x.commitValidation())},decrement:()=>{let e=O("-",r);e===p&&y(D(e)),f(e),x.commitValidation()},decrementToMin:()=>{null!=t&&(f(t),x.commitValidation())},canIncrement:N,canDecrement:M,minValue:t,maxValue:r,numberValue:$,defaultNumberValue:isNaN(i)?h:i,setNumberValue:f,setInputValue:y,inputValue:g,commit:e=>{let t=void 0===e?g:e,r=$;if(void 0!==e&&(r=v.parse(t)),!t.length){f(NaN),y(void 0===o?"":D(p));return}if(isNaN(r))return void y(D(p));let n="snap"===d?m(r):r,a=(n=v.parse(D(n)))!==p;f(n),y(D(void 0===o?n:p)),a&&x.commitValidation()}}}({...e,locale:i,validationBehavior:o}),l=(0,s9.useRef)(null),[u,c]=mD(!e["aria-label"]&&!e["aria-labelledby"]),{labelProps:d,groupProps:m,inputProps:p,incrementButtonProps:f,decrementButtonProps:h,descriptionProps:g,errorMessageProps:y,...v}=function(e,t,r){var n,a,o,i,s,l,u,c,d;let m,{id:p,decrementAriaLabel:f,incrementAriaLabel:h,isDisabled:g,isReadOnly:y,isRequired:v,minValue:b,maxValue:w,autoFocus:E,label:D,formatOptions:x,onBlur:_=()=>{},onFocus:S,onFocusChange:C,onKeyDown:k,onKeyUp:P,description:R,errorMessage:T,isWheelDisabled:$,...O}=e,{increment:N,incrementToMax:M,decrement:I,decrementToMin:j,numberValue:A,inputValue:L,commit:F,commitValidation:B}=t,V=fJ((n=wV)&&n.__esModule?n.default:n,"@react-aria/numberfield"),U=(0,s9.useCallback)(()=>{let e=r.current?.value??"";(0,pX.flushSync)(()=>{F()}),r.current?.value!==e&&f$(r.current?.value??"","assertive")},[F,r]),W=mp(p),{focusProps:H}=p$({onBlur(){U()}}),z=wW(x),K=(0,s9.useMemo)(()=>z.resolvedOptions(),[z]),G=wW({...x,currencySign:void 0}),Z=(0,s9.useMemo)(()=>isNaN(A)?"":G.format(A),[G,A]),{spinButtonProps:Y,incrementButtonProps:q,decrementButtonProps:J}=wK({isDisabled:g,isReadOnly:y,isRequired:v,maxValue:w,minValue:b,onIncrement:N,onIncrementToMax:M,onDecrement:I,onDecrementToMin:j,value:A,textValue:Z}),[X,Q]=(0,s9.useState)(!1),{focusWithinProps:ee}=ft({isDisabled:g,onFocusWithinChange:Q});!function(e,t){let{onScroll:r,isDisabled:n}=e,a=(0,s9.useCallback)(e=>{!e.ctrlKey&&(e.preventDefault(),e.stopPropagation(),r&&r({deltaX:e.deltaX,deltaY:e.deltaY}))},[r]);gt(t,"wheel",n?void 0:a)}({onScroll:(0,s9.useCallback)(e=>{!(Math.abs(e.deltaY)<=Math.abs(e.deltaX))&&(e.deltaY>0?N():e.deltaY<0&&I())},[I,N]),isDisabled:$||g||y||!X},r);let et=(K.maximumFractionDigits??0)>0,er=void 0===t.minValue||isNaN(t.minValue)||t.minValue<0,en="numeric";pt()?er?en="text":et&&(en="decimal"):pi()&&(er?en="numeric":et&&(en="decimal"));let ea=mA(e),{keyboardProps:eo}=pL({isDisabled:g||y,shortcuts:{Enter:()=>((0,pX.flushSync)(()=>{F()}),B(),{shouldPreventDefault:!1})},onKeyDown:k,onKeyUp:P}),{isInvalid:ei,validationErrors:es,validationDetails:el}=t.displayValidation,{labelProps:eu,inputProps:ec,descriptionProps:ed,errorMessageProps:em}=function(e,t,r){let n=pq(e=>{let n=r.current;if(!n)return;let a=null;switch(e.inputType){case"historyUndo":case"historyRedo":case"insertLineBreak":return;case"deleteContent":case"deleteByCut":case"deleteByDrag":a=n.value.slice(0,n.selectionStart)+n.value.slice(n.selectionEnd);break;case"deleteContentForward":a=n.selectionEnd===n.selectionStart?n.value.slice(0,n.selectionStart)+n.value.slice(n.selectionEnd+1):n.value.slice(0,n.selectionStart)+n.value.slice(n.selectionEnd);break;case"deleteContentBackward":a=n.selectionEnd===n.selectionStart?n.value.slice(0,n.selectionStart-1)+n.value.slice(n.selectionStart):n.value.slice(0,n.selectionStart)+n.value.slice(n.selectionEnd);break;case"deleteSoftLineBackward":case"deleteHardLineBackward":a=n.value.slice(n.selectionStart);break;default:null!=e.data&&(a=n.value.slice(0,n.selectionStart)+e.data+n.value.slice(n.selectionEnd))}null!=a&&t.validate(a)||e.preventDefault()});(0,s9.useEffect)(()=>{if(!wU()||!r.current)return;let e=r.current;return e.addEventListener("beforeinput",n,!1),()=>{e.removeEventListener("beforeinput",n,!1)}},[r]);let a=wU()?null:e=>{let r=mK(e).value.slice(0,mK(e).selectionStart)+e.data+mK(e).value.slice(mK(e).selectionEnd);t.validate(r)||e.preventDefault()},{labelProps:o,inputProps:i,descriptionProps:s,errorMessageProps:l,...u}=function(e,t){let{inputElementType:r="input",isDisabled:n=!1,isRequired:a=!1,isReadOnly:o=!1,type:i="text",validationBehavior:s="aria"}=e,[l,u]=g5(e.value,e.defaultValue||"",e.onChange),{focusableProps:c}=pV(e,t),d=y1({...e,value:l}),{isInvalid:m,validationErrors:p,validationDetails:f}=d.displayValidation,{labelProps:h,fieldProps:g,descriptionProps:y,errorMessageProps:v}=yU({...e,isInvalid:m,errorMessage:e.errorMessage||p}),b=mA(e,{labelable:!0}),w={type:i,pattern:e.pattern},[E]=(0,s9.useState)(l);return yW(t,e.defaultValue??E,u),yH(e,d,t),{labelProps:h,inputProps:mg(b,"input"===r?w:void 0,{disabled:n,readOnly:o,required:a&&"native"===s,"aria-required":a&&"aria"===s||void 0,"aria-invalid":m||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=>u(mK(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(s8().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,...c,...g}),descriptionProps:y,errorMessageProps:v,isInvalid:m,validationErrors:p,validationDetails:f}}(e,r),c=(0,s9.useRef)(null);return{inputProps:mg(i,{onBeforeInput:a,onCompositionStart(){let{value:e,selectionStart:t,selectionEnd:n}=r.current;c.current={value:e,selectionStart:t,selectionEnd:n}},onCompositionEnd(){if(r.current&&!t.validate(r.current.value)){let{value:e,selectionStart:n,selectionEnd:a}=c.current;r.current.value=e,r.current.setSelectionRange(n,a),t.setInputValue(e)}}}),labelProps:o,descriptionProps:s,errorMessageProps:l,...u}}({...O,...ea,name:void 0,form:void 0,label:D,autoFocus:E,isDisabled:g,isReadOnly:y,isRequired:v,validate:void 0,[y0]:t,value:L,defaultValue:"!",autoComplete:"off","aria-label":e["aria-label"]||void 0,"aria-labelledby":e["aria-labelledby"]||void 0,id:W,type:"text",inputMode:en,onChange:e=>{t.validate(e)&&t.setInputValue(e)},onBlur:_,onFocus:S,onFocusChange:C,onPaste:t=>{e.onPaste?.(t);let r=mK(t);r&&(r.selectionEnd??-1)-(r.selectionStart??0)===r.value.length&&(t.preventDefault(),F(t.clipboardData?.getData?.("text/plain")?.trim()??""))},description:R,errorMessage:T},t,r),ep=mg(eo,ec);yW(r,t.defaultNumberValue,t.setNumberValue),a=t,o=e.validationBehavior,i=e.commitBehavior,s=r,l=t.minValue,u=t.maxValue,c=e.step,d=t.numberValue,me(()=>{let e=s.current;if("validate"!==i||a.realtimeValidation.isInvalid||!e||e.disabled||(!wG&&"u">typeof document&&((wG=document.createElement("input")).type="number"),!wG))return;wG.min=null==l||isNaN(l)?"":String(l),wG.max=null==u||isNaN(u)?"":String(u),wG.step=null==c||isNaN(c)?"":String(c),wG.value=null==d||isNaN(d)?"":String(d);let t=e.validity.valid&&wG.validity.valid,r=e.validationMessage||wG.validationMessage,n={isInvalid:!t,validationErrors:r?[r]:[],validationDetails:{badInput:e.validity.badInput,customError:e.validity.customError,patternMismatch:e.validity.patternMismatch,rangeOverflow:wG.validity.rangeOverflow,rangeUnderflow:wG.validity.rangeUnderflow,stepMismatch:wG.validity.stepMismatch,tooLong:e.validity.tooLong,tooShort:e.validity.tooShort,typeMismatch:e.validity.typeMismatch,valueMissing:e.validity.valueMissing,valid:t}};a.updateValidation(n),"native"!==o||wG.validity.valid||e.setCustomValidity(wG.validationMessage)});let ef=mg(Y,H,ep,{role:null,"aria-roledescription":pn()?null:V.format("numberField"),"aria-valuemax":null,"aria-valuemin":null,"aria-valuenow":null,"aria-valuetext":null,autoCorrect:"off",spellCheck:"false"});"native"===e.validationBehavior&&(ef["aria-required"]=void 0);let eh=e=>{((e=document)=>e.activeElement)()!==r.current&&("mouse"===e.pointerType?r.current?.focus():e.target.focus())},eg=e["aria-label"]||("string"==typeof e.label?e.label:"");eg||(m=null!=e.label?eu.id:e["aria-labelledby"]);let ey=mp(),ev=mp(),eb=mg(q,{"aria-label":h||V.format("increase",{fieldLabel:eg}).trim(),id:m&&!h?ey:null,"aria-labelledby":m&&!h?`${ey} ${m}`:null,"aria-controls":W,excludeFromTabOrder:!0,preventFocusOnPress:!0,allowFocusWhenDisabled:!0,isDisabled:!t.canIncrement,onPressStart:eh}),ew=mg(J,{"aria-label":f||V.format("decrease",{fieldLabel:eg}).trim(),id:m&&!f?ev:null,"aria-labelledby":m&&!f?`${ev} ${m}`:null,"aria-controls":W,excludeFromTabOrder:!0,preventFocusOnPress:!0,allowFocusWhenDisabled:!0,isDisabled:!t.canDecrement,onPressStart:eh});return{groupProps:{...ee,role:"group","aria-disabled":g,"aria-invalid":ei?"true":void 0},labelProps:eu,inputProps:ef,incrementButtonProps:eb,decrementButtonProps:ew,errorMessageProps:em,descriptionProps:ed,isInvalid:ei,validationErrors:es,validationDetails:el}}({...mx(e),label:c,validationBehavior:o},s,l),b=mb({...e,values:{state:s,isDisabled:e.isDisabled||!1,isInvalid:v.isInvalid||!1,isRequired:e.isRequired||!1},defaultClassName:"react-aria-NumberField"}),w=mA(e,{global:!0});return delete w.id,s8().createElement(mv,{values:[[wJ,s],[yf,m],[yg,{...p,ref:l}],[vI,{...d,ref:u}],[fc,{slots:{increment:f,decrement:h}}],[ff,{slots:{description:g,errorMessage:y}}],[vP,v]]},s8().createElement(mC.div,{...w,...b,ref:t,slot:e.slot||void 0,"data-disabled":e.isDisabled||void 0,"data-required":e.isRequired||void 0,"data-invalid":v.isInvalid||void 0}),e.name&&s8().createElement("input",{type:"hidden",name:e.name,form:e.form,value:isNaN(s.numberValue)?"":s.numberValue,disabled:e.isDisabled||void 0}))});function wQ(e,t){return Number.parseInt(wS(e,{calendar:t.calendar,locale:t.baseName,day:!1,month:!1,noToday:!0,numberingSystem:"latn"}))}let w0=(0,s9.forwardRef)(function(e,t){let{className:r}=e,n=(0,s9.useContext)(ya),a=(0,s9.useContext)(yo),o=n??a,i=(0,s9.useContext)(wL),s=hK(),l=wS(o.visibleRange.start.toDate(s),{calendar:i.calendar,locale:i.baseName,day:!1,year:!1,noToday:!0}),u=wQ(o.visibleRange.start.toDate(s),i),c=o.maxValue?wQ(o.maxValue.toDate(s),i):void 0,d=o.minValue?wQ(o.minValue.toDate(s),i):void 0,m=(0,s9.useCallback)(e=>{o.setFocusedDate(o.focusedDate.cycle("year",e-o.focusedDate.year))},[]);return o&&(0,le.jsxs)("span",{ref:t,className:r,children:[(0,le.jsx)("span",{children:l}),(0,le.jsxs)(wX,{formatOptions:{useGrouping:!1},maxValue:c,minValue:d,onChange:m,value:u,children:[(0,le.jsx)(yy,{}),(0,le.jsxs)(yh,{children:[(0,le.jsx)(fd,{slot:"increment",children:(0,le.jsx)(cM,{size:8})}),(0,le.jsx)(fd,{slot:"decrement",children:(0,le.jsx)(c$,{size:8})})]})]})]})}),w1="-esm-report-builder__datepicker-module__inputGroup___8HE83",w4="-esm-report-builder__datepicker-module__inputSegment___bZPCL",w2="-esm-report-builder__datepicker-module__dateInputWrapper___ZGn+P",w3="-esm-report-builder__datepicker-module__invalidText___mb1DW",w6="-esm-report-builder__datepicker-module__flatButton___DL7RZ",w5="-esm-report-builder__datepicker-module__flatButtonMd___JZlIZ",w9="-esm-report-builder__datepicker-module__flatButtonSm___bOLZt",w8="-esm-report-builder__datepicker-module__flatButtonLg___IQPkt";function w7({children:e}){let t=(0,s9.useContext)(bN),r=(0,s9.useContext)(bM),n=t??r,a=uO(()=>n?.close());return(0,le.jsx)(vk,{className:"-esm-report-builder__datepicker-module__dialog___vu+V8",ref:a,children:e})}let Ee=(0,s9.forwardRef)(function({variant:e,today_:t,minDate:r,maxDate:n},a){let o="range"===e;return(0,le.jsx)(bP,{ref:a,className:"-esm-report-builder__datepicker-module__popover___rJRGV",placement:"bottom start",offset:1,isNonModal:!0,children:(0,le.jsx)(w7,{children:(0,le.jsxs)(o?ys:yi,{...o?{minValue:r,maxValue:n,className:"cds--date-picker__calendar"}:{},children:[(0,le.jsxs)("header",{className:"-esm-report-builder__datepicker-module__header___8V465",children:[(0,le.jsx)(fd,{className:cn()(w6,w5),slot:"previous",children:(0,le.jsx)(cV,{size:16})}),(0,le.jsx)(w0,{className:"-esm-report-builder__datepicker-module__monthYear___kwBXn"}),(0,le.jsx)(fd,{className:cn()(w6,w5),slot:"next",children:(0,le.jsx)(cU,{size:16})})]}),(0,le.jsx)(yu,{className:"-esm-report-builder__datepicker-module__calendarGrid___Po5J8",children:e=>(0,le.jsx)(yp,{className:cn()("cds--date-picker__day",{"-esm-report-builder__datepicker-module__today___EotRU":0===t.compare(e)}),date:e},e.toString())})]})})})}),Et=(0,s9.forwardRef)(function(e,t){let r=(0,s9.useContext)(bN),[n,a]=mE({slot:e.slot},t,vf),{locale:o}=fR(),i=vp({...n,locale:o,createCalendar:gJ}),s=(0,s9.useRef)(null),{fieldProps:l,inputProps:u}=yZ({...n,inputRef:s},i,a),c=(0,s9.useCallback)(()=>{i.isDisabled||r.toggle()},[]);return(0,le.jsxs)(mv,{values:[[vh,i],[yg,{...u,ref:s}],[yf,{...l,ref:a,isInvalid:i.isInvalid}]],children:[(0,le.jsx)(yh,{...e,id:e.id,ref:t,slot:e.slot||void 0,className:e.className,isDisabled:i.isDisabled,isInvalid:i.isInvalid,onClick:c,children:i.segments.map((t,r)=>(0,s9.cloneElement)(e.children(t),{key:r}))}),(0,le.jsx)(yy,{})]})}),Er=(0,s9.forwardRef)(function(e,t){let r=(0,s9.useContext)(bN),n=(0,s9.useContext)(bM);return(r??n).isInvalid?(0,le.jsx)(dq,{ref:t,size:16,...e}):(0,le.jsx)(cT,{ref:t,size:16,...e})});class En{constructor(e,t){this.locale=e,this.dictionary=t}of(e){return this.dictionary.getStringForLocale(e,this.locale)}}let Ea=new Map,Eo=(0,s9.forwardRef)(function({segment:e,...t},r){let n=(0,s9.useContext)(vh),a=d5(r),{segmentProps:o}=function(e,t,r){let n,a,o,i,s=(0,s9.useRef)(""),{locale:l,direction:u}=fR(),c=function(){var e;let{locale:t}=fR(),r=fq((e=yF)&&e.__esModule?e.default:e,"@react-aria/datepicker");return(0,s9.useMemo)(()=>{try{return new Intl.DisplayNames(t,{type:"dateTimeField"})}catch{return new En(t,r)}},[t,r])}(),{ariaLabel:d,ariaLabelledBy:m,ariaDescribedBy:p,focusManager:f}=yz.get(t),h=e.isPlaceholder?"":e.text,g=(0,s9.useMemo)(()=>t.dateFormatter.resolvedOptions(),[t.dateFormatter]),y=fV({month:"long",timeZone:g.timeZone}),v=fV({hour:"numeric",hour12:g.hour12,timeZone:g.timeZone});if("month"!==e.type||e.isPlaceholder)"hour"!==e.type||e.isPlaceholder||(h=v.format(t.dateValue));else{let e=y.format(t.dateValue);h=e!==h?`${h} \u{2013} ${e}`:e}let{spinButtonProps:b}=wK({value:e.value??void 0,textValue:h,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)}}),w=(0,s9.useMemo)(()=>new(0,wZ.d)(l,{maximumFractionDigits:0}),[l]),E=()=>{if(e.text===e.placeholder&&f.focusPrevious(),!w.isValidPartialNumber(e.text)||t.isReadOnly||e.isPlaceholder)("dayPeriod"===e.type||"era"===e.type)&&t.clearSegment(e.type);else{let r=e.text.slice(0,-1),n=w.parse(r);0===(r=0===n?"":r).length||0===n?t.clearSegment(e.type):t.setSegment(e.type,n),s.current=r}},{keyboardProps:D}=pL({shortcuts:{Backspace:()=>{E()},Delete:()=>{E()},"Mod+a":()=>{}},allowRepeats:!0}),{startsWith:x}=(n=function(e){let{locale:t}=fR(),r=t+(e?Object.entries(e).sort((e,t)=>e[0]<t[0]?-1:1).join():"");if(Ea.has(r))return Ea.get(r);let n=new Intl.Collator(t,e);return Ea.set(r,n),n}({usage:"search",sensitivity:"base"}),a=(0,s9.useCallback)((e,t)=>0===t.length||(e=e.normalize("NFC"),t=t.normalize("NFC"),0===n.compare(e.slice(0,t.length),t)),[n]),o=(0,s9.useCallback)((e,t)=>0===t.length||(e=e.normalize("NFC"),t=t.normalize("NFC"),0===n.compare(e.slice(-t.length),t)),[n]),i=(0,s9.useCallback)((e,t)=>{if(0===t.length)return!0;e=e.normalize("NFC");let r=0,a=(t=t.normalize("NFC")).length;for(;r+a<=e.length;r++){let o=e.slice(r,r+a);if(0===n.compare(t,o))return!0}return!1},[n]),(0,s9.useMemo)(()=>({startsWith:a,endsWith:o,contains:i}),[a,o,i])),_=fV({hour:"numeric",hour12:!0}),S=(0,s9.useMemo)(()=>{let e=new Date;return e.setHours(0),_.formatToParts(e).find(e=>"dayPeriod"===e.type).value},[_]),C=(0,s9.useMemo)(()=>{let e=new Date;return e.setHours(12),_.formatToParts(e).find(e=>"dayPeriod"===e.type).value},[_]),k=fV({year:"numeric",era:"narrow",timeZone:"UTC"}),P=(0,s9.useMemo)(()=>{if("era"!==e.type)return[];let r=hN(new hb(1,1,1),t.calendar),n=t.calendar.getEras().map(e=>{let t=r.set({year:1,month:1,day:1,era:e}).toDate("UTC");return{era:e,formatted:k.formatToParts(t).find(e=>"era"===e.type).value}}),a=function(e){e.sort();let t=e[0],r=e[e.length-1];for(let e=0;e<t.length;e++)if(t[e]!==r[e])return e;return 0}(n.map(e=>e.formatted));if(a)for(let e of n)e.formatted=e.formatted.slice(a);return n},[k,t.calendar,e.type]),R=r=>{if(t.isDisabled||t.isReadOnly)return;let n=s.current+r;switch(e.type){case"dayPeriod":if(x(S,r))t.setSegment("dayPeriod",0);else if(x(C,r))t.setSegment("dayPeriod",1);else break;f.focusNext();break;case"era":{let e=P.find(e=>x(e.formatted,r));e&&(t.setSegment("era",e.era),f.focusNext());break}case"day":case"hour":case"minute":case"second":case"month":case"year":{if(!w.isValidPartialNumber(n))return;let a=w.parse(n),o=a;if(void 0!==e.maxValue&&a>e.maxValue&&(o=w.parse(r)),isNaN(a))return;t.setSegment(e.type,o),void 0!==e.maxValue&&(Number(a+"0")>e.maxValue||n.length>=String(e.maxValue).length)?(s.current="",f.focusNext()):s.current=n}}};gt((0,s9.useRef)("u">typeof document?document:null),"selectionchange",()=>{let e=window.getSelection();e?.anchorNode&&mz(r.current,e?.anchorNode)&&((e=document)=>e.activeElement)()===r.current&&e.collapse(r.current)});let T=(0,s9.useRef)("");gt(r,"beforeinput",n=>{if(r.current)switch(n.preventDefault(),n.inputType){case"deleteContentBackward":case"deleteContentForward":w.isValidPartialNumber(e.text)&&!t.isReadOnly&&E();break;case"insertCompositionText":T.current=r.current.textContent,r.current.textContent=r.current.textContent;break;default:null!=n.data&&R(n.data)}}),gt(r,"input",e=>{let{inputType:t,data:n}=e;"insertCompositionText"===t&&(r.current&&(r.current.textContent=T.current),null!=n&&(x(S,n)||x(C,n))&&R(n))}),me(()=>{let e=r.current;return()=>{((e=document)=>e.activeElement)()===e&&(f.focusPrevious()||f.focusNext())}},[r,f]);let $=pn()||"timeZoneName"===e.type?{role:"textbox","aria-valuemax":null,"aria-valuemin":null,"aria-valuetext":null,"aria-valuenow":null}:{};e===(0,s9.useMemo)(()=>t.segments.find(e=>e.isEditable),[t.segments])||t.isInvalid||(p=void 0);let O=mp(),N=!t.isDisabled&&!t.isReadOnly&&e.isEditable,M="literal"===e.type?"":c.of(e.type),I=h6({"aria-label":`${M}${d?`, ${d}`:""}${m?", ":""}`,"aria-labelledby":m});if("literal"===e.type)return{segmentProps:{"aria-hidden":!0}};let j={caretColor:"transparent"};if("rtl"===u){j.unicodeBidi="embed";let t=g[e.type];("numeric"===t||"2-digit"===t)&&(j.direction="ltr")}return{segmentProps:mg(b,I,{id:O,...$,...D,"aria-invalid":t.isInvalid?"true":void 0,"aria-describedby":p,"aria-readonly":t.isReadOnly||!e.isEditable?"true":void 0,"data-placeholder":e.isPlaceholder||void 0,contentEditable:N,suppressContentEditableWarning:N,spellCheck:N?"false":void 0,autoCorrect:N?"off":void 0,[parseInt(s8().version,10)>=17?"enterKeyHint":"enterkeyhint"]:N?"next":void 0,inputMode:t.isDisabled||"dayPeriod"===e.type||"era"===e.type||!N?void 0:"numeric",tabIndex:t.isDisabled?void 0:0,onFocus:()=>{s.current="",r.current&&gi(r.current,{containingElement:gn(r.current)});let e=window.getSelection();e?.collapse(r.current)},style:j,onPointerDown(e){e.stopPropagation()},onMouseDown(e){e.stopPropagation()}})}}(e,n,a),{focusProps:i,isFocused:s,isFocusVisible:l}=fr(),{hoverProps:u,isHovered:c}=fs({...t,isDisabled:n.isDisabled||"literal"===e.type}),d=function(e){let{className:t,style:r,children:n,defaultClassName:a,defaultChildren:o,defaultStyle:i,values:s}=e;return(0,s9.useMemo)(()=>{let e,l,u;return e="function"==typeof t?t({...s,defaultClassName:a}):t,l="function"==typeof r?r({...s,defaultStyle:i||{}}):r,u="function"==typeof n?n({...s,defaultChildren:o}):null==n?o:n,{className:e??a,style:l||i?{...i,...l}:void 0,children:u??o,"data-rac":""}},[t,r,n,a,o,i,s])}({...t,values:{...e,isReadOnly:!e.isEditable,isInvalid:n.isInvalid,isDisabled:n.isDisabled,isHovered:c,isFocused:s,isFocusVisible:l},defaultChildren:e.text}),m=(0,s9.useCallback)(e=>{e.stopPropagation()},[]);return(0,le.jsx)("span",{...mg(mA(t),o,i,u),...d,ref:a,style:o.style,"data-placeholder":e.isPlaceholder||void 0,"data-invalid":n.isInvalid||void 0,"data-readonly":!e.isEditable||void 0,"data-disabled":n.isDisabled||void 0,"data-type":e.type,"data-hovered":c||void 0,"data-focused":s||void 0,"data-focus-visible":l||void 0,onClick:m})}),Ei={short:!1,size:"md"},Es=(0,s9.forwardRef)(function(e,t){let{className:r,defaultValue:n,isDisabled:a,invalid:o,invalidText:i,isInvalid:s,label:l,labelText:u,light:c,maxDate:d,minDate:m,onChange:p,onChangeRaw:f,short:h,size:g,value:y,...v}={...Ei,...e},{calendar:b,intlLocale:w,today_:E}=wF(),D=(0,s9.useId)(),x=!!(u??l),_=(0,s9.useMemo)(()=>bF(n,b),[n,b]),S=(0,s9.useMemo)(()=>bF(y,b,!0),[y,b]),C=(0,s9.useMemo)(()=>bF(d,b),[d,b]),k=(0,s9.useMemo)(()=>bF(m??wB,b),[m,b]),P=(0,s9.useMemo)(()=>o||s,[o,s]),R=(0,s9.useMemo)(()=>(f&&p&&console.error("An OpenmrsDatePicker component was created with both onChange and onChangeRaw handlers defined. Only onChangeRaw will be used."),f??(e=>p?.(bB(e)))),[f,p]);return(0,le.jsx)(bL,{locale:w.toString(),children:(0,le.jsx)("div",{className:cn()("cds--form-item",r),children:(0,le.jsx)(mv,{values:[[wL,w]],children:(0,le.jsxs)(bj,{className:cn()("cds--date-picker","cds--date-picker--single",{"cds--date-picker--short":h,"cds--date-picker--light":c}),defaultValue:_,isDisabled:a,isInvalid:P,maxValue:C,minValue:k,value:S,shouldForceLeadingZeros:"en"===w.language||void 0,...v,onChange:R,children:[(0,le.jsxs)("div",{className:"cds--date-picker-container",children:[x&&(0,le.jsx)(vj,{className:cn()("cds--label",{"cds--label--disabled":a}),htmlFor:D,children:u??l}),(0,le.jsxs)(yh,{className:w1,children:[(0,le.jsx)(Et,{id:x?D:void 0,ref:t,className:cn()("cds--date-picker-input__wrapper","-esm-report-builder__datepicker-module__inputWrapper___y+8gr",{"-esm-report-builder__datepicker-module__inputWrapperSm___tpcoF":"sm"===g,"-esm-report-builder__datepicker-module__inputWrapperMd___1hH89":"md"===g||!g||0===g.length,"-esm-report-builder__datepicker-module__inputWrapperLg___CRsQW":"lg"===g}),children:e=>"era"!==e.type?(0,le.jsx)(Eo,{className:w4,segment:e}):(0,le.jsx)(s8().Fragment,{})}),(0,le.jsx)(fd,{className:cn()(w6,{[w9]:"sm"===g,[w5]:"md"===g||!g||0===g.length,[w8]:"lg"===g}),children:(0,le.jsx)(Er,{})})]}),(0,le.jsx)(vR,{className:w3,children:i})]}),(0,le.jsx)(Ee,{variant:"single",today_:E})]})})})})}),El=(0,s9.forwardRef)(function({className:e,defaultValue:t,invalid:r,invalidText:n,isDisabled:a,isInvalid:o,label:i,labelText:s,light:l,maxDate:u,minDate:c,onChange:d,onChangeRaw:m,size:p="md",value:f,...h},g){let{calendar:y,intlLocale:v,today_:b}=wF(),w=(0,s9.useId)(),E=!!(s??i),D=(0,s9.useMemo)(()=>{if(f)return{start:bF(f[0],y,!1),end:bF(f[1],y,!1)}},[f,y]),x=(0,s9.useMemo)(()=>{if(t)return{start:bF(t[0],y,!1),end:bF(t[1],y,!1)}},[t,y]),_=(0,s9.useMemo)(()=>bF(c??wB,y,!0),[c,y]),S=(0,s9.useMemo)(()=>bF(u,y,!0),[u,y]),C=(0,s9.useMemo)(()=>r||o,[r,o]),k=(0,s9.useMemo)(()=>(m&&d&&console.error("An OpenmrsDateRangePicker component was created with both onChange and onChangeRaw handlers defined. Only onChangeRaw will be used."),m??(e=>d?.([bB(e.start),bB(e.end)]))),[m,d]);return(0,le.jsx)(bL,{locale:v.toString(),children:(0,le.jsx)("div",{className:cn()("cds--form-item",e),children:(0,le.jsx)(mv,{values:[[wL,v]],children:(0,le.jsx)(bA,{id:E?w:void 0,className:cn()("cds--date-picker",{"cds--date-picker--light":l,"cds--date-picker--disabled":a}),isInvalid:C,shouldForceLeadingZeros:"en"===v.language||void 0,maxValue:S,minValue:_,value:D,defaultValue:x,ref:g,isDisabled:a,...h,onChange:k,children:(0,le.jsxs)("div",{className:"cds--date-picker-container",children:[E&&(0,le.jsx)(vj,{className:cn()("cds--label",{"cds--label--disabled":a}),htmlFor:w,children:s??i}),(0,le.jsxs)(yh,{className:w1,children:[(0,le.jsxs)("div",{className:cn()("-esm-report-builder__datepicker-module__inputsWrapper___soXTl",{"-esm-report-builder__datepicker-module__inputsWrapperSm___ES6Mr":"sm"===p,"-esm-report-builder__datepicker-module__inputsWrapperMd___4qQj-":"md"===p||!p||0===p.length,"-esm-report-builder__datepicker-module__inputsWrapperLg___apyRG":"lg"===p}),children:[(0,le.jsx)(vy,{className:cn()("cds--date-picker-input__wrapper","-esm-report-builder__datepicker-module__startInput___Rc6pT",w2),slot:"start",children:e=>(0,le.jsx)(Eo,{className:w4,segment:e})}),(0,le.jsx)("div",{className:"-esm-report-builder__datepicker-module__separator___YpWmV",children:(0,le.jsx)("span",{"aria-hidden":"true","data-readonly":!0,children:"–"})}),(0,le.jsx)(vy,{className:cn()("cds--date-picker-input__wrapper","-esm-report-builder__datepicker-module__endInput___euNmk",w2),slot:"end",children:e=>(0,le.jsx)(Eo,{className:w4,segment:e})})]}),(0,le.jsx)(fd,{className:cn()(w6,{[w9]:"sm"===p,[w5]:"md"===p||!p||0===p.length,[w8]:"lg"===p}),children:(0,le.jsx)(Er,{})})]}),(0,le.jsx)(vR,{className:w3,children:n}),(0,le.jsx)(Ee,{variant:"range",today_:b,minDate:_,maxDate:S})]})})})})})}),Eu=s8().createContext(null);function Ec(e){let{children:t}=e,r=(0,s9.useContext)(Eu),[n,a]=(0,s9.useState)(0),o=(0,s9.useMemo)(()=>({parent:r,modalCount:n,addModal(){a(e=>e+1),r&&r.addModal()},removeModal(){a(e=>e-1),r&&r.removeModal()}}),[r,n]);return s8().createElement(Eu.Provider,{value:o},t)}function Ed(e){let t,{modalProviderProps:r}={modalProviderProps:{"aria-hidden":!!(t=(0,s9.useContext)(Eu))&&t.modalCount>0||void 0}};return s8().createElement("div",{"data-overlay-container":!0,...e,...r})}function Em(e){return s8().createElement(Ec,null,s8().createElement(Ed,e))}function Ep(e){let t=mu(),{portalContainer:r=t?null:document.body,...n}=e,{getContainer:a}=vD();if(!e.portalContainer&&a&&(r=a()),s8().useEffect(()=>{if(r?.closest("[data-overlay-container]"))throw Error("An OverlayContainer must not be inside another container. Please change the portalContainer prop.")},[r]),!r)return null;let o=s8().createElement(Em,n);return pQ().createPortal(o,r)}let Ef=s8().createContext(null),Eh=s8().forwardRef(function(e,t){let{children:r,...n}=e,a=d5(t),o={...n,ref:a};return s8().createElement(Ef.Provider,{value:o},r)}),Eg={},Ey=0,Ev=!1,Eb=null,Ew=null;function EE(e={}){let{delay:t=1500,closeDelay:r=500}=e,{isOpen:n,open:a,close:o}=bS(e),[i,s]=(0,s9.useState)(!1),l=(0,s9.useMemo)(()=>`${++Ey}`,[]),u=(0,s9.useRef)(null),c=(0,s9.useRef)(o),d=()=>{Eg[l]=f},m=()=>{for(let e in Eg)e!==l&&(Eg[e](!0,!0),delete Eg[e])},p=e=>{u.current&&clearTimeout(u.current),u.current=null,m(),d(),s(!!e),Ev=!0,a(),Eb&&(clearTimeout(Eb),Eb=null),Ew&&(clearTimeout(Ew),Ew=null)},f=(e,t)=>{s(!!t),e||r<=0?(u.current&&clearTimeout(u.current),u.current=null,c.current()):u.current||(u.current=setTimeout(()=>{u.current=null,c.current()},r)),Eb&&(clearTimeout(Eb),Eb=null),Ev&&(Ew&&clearTimeout(Ew),Ew=setTimeout(()=>{delete Eg[l],Ew=null,Ev=!1},Math.max(500,r)))};return(0,s9.useEffect)(()=>{c.current=o},[o]),(0,s9.useEffect)(()=>()=>{u.current&&clearTimeout(u.current),Eg[l]&&delete Eg[l]},[l]),{isOpen:n,shouldSkipAnimation:i,open:e=>{e||!(t>0)||u.current?p(Ev):(m(),d(),n||Ev?n||p(!0):(Eb&&clearTimeout(Eb),Eb=setTimeout(()=>{Eb=null,Ev=!0,p(!1)},t)))},close:f}}let ED=(0,s9.createContext)(null),Ex=(0,s9.createContext)(null);function E_(e){let t=EE(e),r=(0,s9.useRef)(null),{triggerProps:n,tooltipProps:a}=function(e,t,r){let{isDisabled:n,trigger:a,shouldCloseOnPress:o=!0}=e,i=mp(),s=(0,s9.useRef)(!1),l=(0,s9.useRef)(!1),u=()=>{(s.current||l.current)&&t.open(l.current)},c=e=>{s.current||l.current||t.close(e)};(0,s9.useEffect)(()=>{let e=e=>{r&&r.current&&"Escape"===e.key&&(e.stopPropagation(),t.close(!0))};if(t.isOpen)return document.addEventListener("keydown",e,!0),()=>{document.removeEventListener("keydown",e,!0)}},[r,t]);let d=()=>{o&&(l.current=!1,s.current=!1,c(!0))},{hoverProps:m}=fs({isDisabled:n,onHoverStart:()=>{"focus"!==a&&("pointer"===pc?s.current=!0:s.current=!1,u())},onHoverEnd:()=>{"focus"!==a&&(l.current=!1,s.current=!1,c())}}),{focusableProps:p}=pV({isDisabled:n,onFocus:()=>{p_()&&(l.current=!0,u())},onBlur:()=>{l.current=!1,s.current=!1,c(!0)}},r);return{triggerProps:{"aria-describedby":t.isOpen?i:void 0,...mg(p,m,{onPointerDown:d,onKeyDown:d}),tabIndex:void 0},tooltipProps:{id:i}}}(e,t,r);return s8().createElement(mv,{values:[[ED,t],[Ex,{...a,triggerRef:r}]]},s8().createElement(Eh,{...n,ref:r},e.children))}let ES=(0,s9.forwardRef)(function({UNSTABLE_portalContainer:e,...t},r){[t,r]=mE(t,r,Ex);let n=(0,s9.useContext)(ED),a=EE(t),o=null==t.isOpen&&null==t.defaultOpen&&n?n:a,i=bc(r,o.isOpen)||t.isExiting||!1;return o.isOpen||i?s8().createElement(Ep,{portalContainer:e},s8().createElement(EC,{...t,tooltipRef:r,isExiting:i})):null});function EC(e){let t=(0,s9.useContext)(ED),r=(0,s9.useRef)(null),{overlayProps:n,arrowProps:a,placement:o,triggerAnchorPoint:i}=v8({placement:e.placement||"top",targetRef:e.triggerRef,overlayRef:e.tooltipRef,arrowRef:r,offset:e.offset,crossOffset:e.crossOffset,isOpen:t.isOpen,arrowBoundaryOffset:e.arrowBoundaryOffset,shouldFlip:e.shouldFlip,containerPadding:e.containerPadding,onClose:()=>t.close(!0)}),s=bu(e.tooltipRef,!!o)||e.isEntering||!1,l=mb({...e,defaultClassName:"react-aria-Tooltip",values:{placement:o,isEntering:s,isExiting:e.isExiting,state:t}}),{tooltipProps:u}=function(e,t){let r=mA(e,{labelable:!0}),{hoverProps:n}=fs({onHoverStart:()=>t?.open(!0),onHoverEnd:()=>t?.close()});return{tooltipProps:mg(r,n,{role:"tooltip"})}}(e=mg(e,n),t),c=mA(e,{global:!0});return s8().createElement(mC.div,{...mg(c,l,u),ref:e.tooltipRef,style:{...n.style,"--trigger-anchor-point":i?`${i.x}px ${i.y}px`:void 0,...l.style},"data-placement":null!=o?o:void 0,"data-entering":s||void 0,"data-exiting":e.isExiting||void 0},s8().createElement(vA.Provider,{value:{...a,placement:o,ref:r}},l.children))}let Ek=({diagnoses:e,showCertainty:t=!1})=>{let{diagnosisTags:r}=l8({externalModuleName:"@openmrs/esm-styleguide"});return(0,le.jsx)("div",{className:"-esm-report-builder__diagnosis-tags-module__container___B0P1c",children:e.map(e=>{let n=t&&"PROVISIONAL"===e.certainty,a=1===e.rank?r?.primaryColor??"blue":r?.secondaryColor??"gray";return(0,le.jsx)(EP,{color:a,isProvisional:n,name:e.display},e.uuid)})})};function EP({color:e,isProvisional:t,name:r}){let[n,a]=(0,s9.useState)(!1),[o,i]=(0,s9.useState)(!1),[s,l]=(0,s9.useState)(!1),u=s||o,c=(0,s9.useRef)(null);(0,s9.useLayoutEffect)(()=>{let e=c.current;if(!e)return;let t=()=>{let t=e.scrollWidth>e.clientWidth;l(t),t||a(!1)};t();let r=new ResizeObserver(t);return r.observe(e),()=>r.disconnect()},[r,t,u]);let d=cn()("cds--tag","cds--tag--md","cds--layout--size-md",`cds--tag--${e}`,"-esm-report-builder__diagnosis-tags-module__diagnosisTag___65CPx"),m=(0,le.jsxs)(le.Fragment,{children:[t&&(0,le.jsxs)(le.Fragment,{children:[(0,le.jsx)("span",{"aria-hidden":"true",className:"-esm-report-builder__diagnosis-tags-module__provisionalMark___XQ8DV",children:"?"}),(0,le.jsxs)("span",{className:"cds--visually-hidden",children:[aO("provisional","Provisional")," "]})]}),(0,le.jsx)("span",{ref:c,className:"cds--tag__label",children:r})]});return u?(0,le.jsxs)(E_,{delay:0,closeDelay:150,isOpen:n,onOpenChange:a,children:[(0,le.jsx)(fd,{className:d,"data-testid":"diagnosis-tag",onFocusChange:i,onPress:()=>a(!0),children:m}),(0,le.jsx)(ES,{className:"-esm-report-builder__diagnosis-tags-module__tagTooltip___XQbm8",placement:"bottom",offset:4,containerPadding:8,children:r})]}):(0,le.jsx)("span",{className:d,"data-testid":"diagnosis-tag",children:m})}let ER={action:"-esm-report-builder__empty-card-module__action___sBzfy",content:"-esm-report-builder__empty-card-module__content___oLLP3",desktopHeading:"-esm-report-builder__empty-card-module__desktopHeading___61tqo",tabletHeading:"-esm-report-builder__empty-card-module__tabletHeading___8GoOd",tile:"-esm-report-builder__empty-card-module__tile___THTb6"},ET=({width:e="64",height:t="64"})=>(0,le.jsx)("svg",{width:e,height:t,viewBox:"0 0 64 64",children:(0,le.jsx)("use",{href:"#omrs-empty-data-illustration"})}),E$=e=>{let t="tablet"===uC(),r=e.launchForm;return(0,le.jsx)(cl.Wdr,{className:ER.layer,children:(0,le.jsxs)(cl.FAs,{className:ER.tile,children:[(0,le.jsx)("div",{className:t?ER.tabletHeading:ER.desktopHeading,children:(0,le.jsx)("h4",{children:e.headerTitle})}),(0,le.jsx)(ET,{}),(0,le.jsx)("p",{className:ER.content,children:aO("emptyStateText","There are no {{displayText}} to display",{displayText:e.displayText})}),(0,le.jsx)("p",{className:ER.action,children:r&&(0,le.jsx)(cl.$nd,{onClick:()=>r(),kind:"ghost",size:t?"lg":"sm",children:aO("recordNewEntry","Record {{ displayText }}",{displayText:e.displayText})})})]})})},EO=({error:e,headerTitle:t})=>{let r="tablet"===uC();return(0,le.jsx)(cl.Wdr,{children:(0,le.jsxs)(cl.FAs,{className:"-esm-report-builder__error-state-module__tile___cCC0p",children:[(0,le.jsx)("div",{className:r?"-esm-report-builder__error-state-module__tabletHeading___bj95p":"-esm-report-builder__error-state-module__desktopHeading___cT4Z6",children:(0,le.jsx)("h4",{children:t})}),(0,le.jsxs)("p",{className:"-esm-report-builder__error-state-module__errorMessage___0VxgF",children:[aO("error","Error")," ",`${e?.response?.status}: `,e?.response?.statusText]}),(0,le.jsx)("p",{className:"-esm-report-builder__error-state-module__errorCopy___eiDlp",children:aO("errorCopy")})]})})},EN=EO,EM=s8().forwardRef((e,t)=>{let{slotName:r,basePath:n,componentContext:a,state:o}=uR(),i=window.location??{pathname:""},s=lp(r??"");return e.isChildOfHeader&&r&&s.length>0?(0,le.jsxs)(cl.f8J,{"aria-label":aO("leftNavigation","Left navigation"),className:"-esm-report-builder__left-nav-module__leftNav___+tHzD",expanded:!0,isFixedNav:!0,ref:t,...e,children:[(0,le.jsx)(lg,{name:"global-nav-menu-slot"}),r?(0,le.jsx)(lJ,{value:a,fallback:(0,le.jsx)(lg,{name:r,state:{basePath:n,currentPath:i,...o}}),children:(0,le.jsx)(s7.Provider,{value:a,children:(0,le.jsx)(lg,{name:r,state:{basePath:n,currentPath:i,...o}})})}):null]}):null}),EI=({selectedLocationUuid:e,defaultLocationUuid:t,locationTag:r,locationsPerRequest:n=50,onChange:a})=>{let[o,i]=(0,s9.useState)(""),s=(0,s9.useId)(),{location:l}=function(e){let t=e?`/ws/fhir2/R4/Location?_id=${e}`:null,{data:r,error:n,isLoading:a}=ur(t,aY,{shouldRetryOnError:e=>!!e?.response?.status&&e.response.status>=500});return(0,s9.useMemo)(()=>({location:r?.data?.entry?r.data.entry[0]:null,error:t?n:null,isLoading:!!t&&a}),[r,a,n,t])}(t),{locations:u,isLoading:c,hasMore:d,loadingNewData:m,error:p,setPage:f}=function(e,t=0,r=""){let n=ue(r),{data:a,isLoading:o,isValidating:i,setSize:s,error:l}=uv(function(r,a){if(a){let e=a.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=`${aK}/Location?`,i=new URLSearchParams;return i.append("_summary","data"),t&&i.append("_count",""+t),r&&i.append("_getpagesoffset",""+r*t),e&&i.append("_tag",e),"string"==typeof n&&""!==n&&i.append("name:contains",n),o+i.toString()},aY);return(0,s9.useMemo)(()=>({locations:a?.length?a?.flatMap(e=>e?.data?.entry??[]):[],isLoading:o,totalResults:a?.[0]?.data?.total,hasMore:!!a?.length&&a?.[a.length-1]?.data?.link?.some(e=>"next"===e.relation),loadingNewData:i,error:l||null,setPage:s}),[o,a,i,s,l])}(r,n,o),h=(0,s9.useMemo)(()=>l&&!o&&t?[l,...u.filter(({resource:e})=>e.id!==t)]:u??[],[l,u,t,o]),g=(0,s9.useCallback)(e=>{a(),i(e.trim())},[a]),y=uN((0,s9.useCallback)(()=>{!m&&d&&f(e=>e+1)},[m,d,f])),v=d?Math.max(0,Math.floor(h.length-n/2)):-1;return(0,le.jsxs)(le.Fragment,{children:[(0,le.jsx)(cl.vji,{"aria-describedby":p?`${s}-error`:void 0,labelText:aO("searchForLocation"),id:s,placeholder:aO("searchForLocation"),onChange:e=>g(e.target.value),size:"lg"}),p&&(0,le.jsx)("div",{className:"-esm-report-builder__location-picker-module__errorNotification___sh9BG",id:`${s}-error`,children:(0,le.jsx)(cl.jeF,{kind:"error",subtitle:aO("errorLoadingLoginLocations","Unable to load login locations. Please try again or contact support if the problem persists."),title:aO("error","Error")})}),(0,le.jsx)("div",{className:"-esm-report-builder__location-picker-module__searchResults___gvBsQ",children:c?(0,le.jsx)("div",{className:"-esm-report-builder__location-picker-module__loadingContainer___PR-AY",children:Array.from({length:5}).map((e,t)=>(0,le.jsx)(cl.Psq,{className:"-esm-report-builder__location-picker-module__radioButtonSkeleton___Y913N",role:"progressbar"},t))}):(0,le.jsxs)(le.Fragment,{children:[(0,le.jsx)("div",{className:"-esm-report-builder__location-picker-module__locationResultsContainer___eH1Nw",children:h.length>0?(0,le.jsx)(cl.zWQ,{name:"loginLocations",onChange:e=>{a(e?.toString())},orientation:"vertical",valueSelected:e,children:h.map((e,t)=>(0,le.jsx)(cl.aaP,{className:"-esm-report-builder__location-picker-module__locationRadioButton___5tzhj",id:e.resource.id,labelText:(0,le.jsx)("span",{ref:t===v?y:null,children:e.resource.name}),name:e.resource.name,value:e.resource.id},e.resource.id))}):(0,le.jsx)("div",{className:"-esm-report-builder__location-picker-module__emptyState___+68uf",children:(0,le.jsx)("p",{className:"-esm-report-builder__location-picker-module__locationNotFound___PBqCF",children:aO("noResultsToDisplay")})})}),m&&(0,le.jsx)("div",{className:"-esm-report-builder__location-picker-module__loadingIcon___fSVp7",children:(0,le.jsx)(cl.OuH,{description:aO("loading")})})]})})]})},Ej=B("modalState",{modalContainer:null,modalStack:[]}),EA=0;async function EL(e,t,r={}){let n=sz(t),a=null;if(e){if(!n)throw Error(`No modal named '${t}' has been registered.`);let{load:o}=n,i=await o(),s=EA++;a=await s2({...i,name:`${t}-${s}`},{...r,domElement:e})}else k(`Failed to launch modal. Please notify your administrator. Modal name: ${t}`);return a}function EF(e){return"TO_BE_DELETED"===e.state||"DELETED"===e.state}function EB(e,t){t?.unmount&&(t.unmountPromise?.catch(()=>{}),t.unmount().catch(t=>{console.error(`The modal '${e}' failed to unmount`,t)}))}function EV(e){return e.find(e=>!EF(e))}function EU(e,t){e.container&&(e.container.style.visibility=t?"unset":"hidden")}let EW=window.getComputedStyle(document.body).overflow;function EH({modalStack:e,modalContainer:t}){if(t)if(e.length){t.style.visibility||(addEventListener("keydown",EK),document.body.style.overflow="hidden",t.style.visibility="unset");let r=EV(e);e.forEach(e=>{switch(e.state){case"NEW":{let r=function({size:e}){let t=document.createElement("div");return t.className=`cds--modal-container cds--modal-container--${e}`,t.setAttribute("role","dialog"),t.setAttribute("tabindex","-1"),t.setAttribute("aria-modal","true"),t}({size:e.props?.size??"md"});e.container=r,e.state="MOUNTING",EL(r,e.modalName,e.props).then(n=>{EF(e)?EB(e.modalName,n):n?(e.parcel=n,t.prepend(r),EU(e,EV(Ej.getState().modalStack)===e),n.mountPromise.then(()=>{EF(e)||(e.state="MOUNTED")},t=>{k(t),e.parcel=null,Ez(e)})):Ez(e)},t=>{k(t),Ez(e)});break}case"MOUNTING":case"MOUNTED":EU(e,e===r);break;case"TO_BE_DELETED":e.state="DELETED",e.onClose(),EB(e.modalName,e.parcel),e.container?.remove(),setTimeout(()=>{let t=Ej.getState();Ej.setState({...t,modalStack:t.modalStack.filter(t=>t!==e)})},0)}})}else t.style.removeProperty("visibility"),document.body.style.overflow=EW,removeEventListener("keydown",EK)}function Ez(e){if(EF(e))return;e.state="TO_BE_DELETED";let t=Ej.getState();Ej.setState({...t,modalStack:[...t.modalStack]})}function EK(e){"Escape"===e.key&&function(){let[e]=Ej.getState().modalStack;e&&Ez(e)}()}function EG(e){Ej.subscribe(EH),Ej.setState({...Ej.getState(),modalContainer:e})}function EZ(e,t={},r=()=>{}){let n=()=>{let e=Ej.getState().modalStack.find(e=>e.onClose===r);e&&Ez(e)};if(sz(e)){var a;let o,i;a={state:"NEW",onClose:r,modalName:e,props:{close:n,...t}},i=[a,...(o=Ej.getState()).modalStack],Ej.setState({...o,modalStack:i})}else k(`Failed to launch modal. Please notify your administrator. Modal name: "${e}"`);return n}var EY=Object.prototype.hasOwnProperty;let Eq=function(e){if(null==e)return!0;if(tm(e)&&(tc(e)||"string"==typeof e||"function"==typeof e.splice||tg(e)||t_(e)||tu(e)))return!e.length;var t=rD(e);if("[object Map]"==t||"[object Set]"==t)return!e.size;if(tn(e))return!rr(e).length;for(var r in e)if(EY.call(e,r))return!1;return!0},EJ=({notification:e})=>{let{description:t,action:r,kind:n,critical:a,title:o,onAction:i}=e;return(0,le.jsx)(cl.kZS,{actionButtonLabel:r,kind:n||"info",lowContrast:a,subtitle:t,title:o||"",inline:!0,onActionButtonClick:i})},EX=({subject:e})=>{let[t,r]=(0,s9.useState)([]);return(0,s9.useEffect)(()=>{let t=e.subscribe(e=>r(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,le.jsx)(le.Fragment,{children:t.map(e=>(0,le.jsx)(EJ,{notification:e},e.id))})},EQ=({notification:e})=>{let{actionButtonLabel:t,onActionButtonClick:r=()=>{},subtitle:n,kind:a,title:o,critical:i,progressActionLabel:s,id:l,...u}=e,[c,d]=(0,s9.useState)(t);return(0,le.jsx)(cl.kZS,{kind:a||"info",actionButtonLabel:c,ariaLabel:aO("closesActionableNotification","Closes actionable notification"),onActionButtonClick:()=>{r(),s&&d(s)},statusIconDescription:aO("actionableNotification","Actionable notification"),subtitle:n,title:o,lowContrast:i,inline:!0,...u})},E0=({subject:e})=>{let[t,r]=(0,s9.useState)([]);return(0,s9.useEffect)(()=>{let t=e.subscribe(e=>r(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,le.jsx)(le.Fragment,{children:t.map(e=>(0,le.jsx)(EQ,{notification:e},e.id))})};class E1{subscribe(e){return this.listeners.add(e),{unsubscribe:()=>{this.listeners.delete(e)}}}next(e){for(let t of[...this.listeners])t(e)}constructor(){!function(e,t,r){t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r}(this,"listeners",new Set)}}let E4=new E1,E2=0,E3=new E1,E6=0;function E5(e){e&&(0,ly.createRoot)(e).render((0,le.jsx)(EX,{subject:E4}))}function E9(e){var t;e&&("string"==typeof(t=e.description)?t.trim().length>0:"object"==typeof t&&(t instanceof Error||!Eq(t)))?(e.description instanceof Error&&(e.description=e.description.toLocaleString()),setTimeout(()=>{E4.next({...e,id:E2++})},0)):console.error("showNotification must be called with an object having a 'description' property that is a non-empty string or object")}function E8(e){e&&(0,ly.createRoot)(e).render((0,le.jsx)(E0,{subject:E3}))}function E7(e){var t;e&&("string"==typeof(t=e.actionButtonLabel)?t.trim().length>0:"object"==typeof t&&!Eq(t))?setTimeout(()=>{E3.next({...e,id:E6++})},0):console.error("showActionableNotification must be called with an actionButtonLabel that is a non-empty string")}let De=["NORMAL","HIGH","CRITICALLY_HIGH","OFF_SCALE_HIGH","LOW","CRITICALLY_LOW","OFF_SCALE_LOW"],Dt=["critically_low","critically_high","high","low","normal","off_scale_low","off_scale_high"],Dr={container:"-esm-report-builder__numeric-observation-module__container___YMIz1",card:"-esm-report-builder__numeric-observation-module__card___ZLBwz","abnormal-value":"-esm-report-builder__numeric-observation-module__abnormal-value___bzIYd","critical-value":"-esm-report-builder__numeric-observation-module__critical-value___S2-yh",cell:"-esm-report-builder__numeric-observation-module__cell___ZiLtj","critically-high":"-esm-report-builder__numeric-observation-module__critically-high___NaPDB","critically-low":"-esm-report-builder__numeric-observation-module__critically-low___S29+P",high:"-esm-report-builder__numeric-observation-module__high___qk85l",low:"-esm-report-builder__numeric-observation-module__low___Rh+hW","label-container":"-esm-report-builder__numeric-observation-module__label-container___OHVTn","value-container":"-esm-report-builder__numeric-observation-module__value-container___-5c7b",label:"-esm-report-builder__numeric-observation-module__label___MVUkz",value:"-esm-report-builder__numeric-observation-module__value___Ne+ED",units:"-esm-report-builder__numeric-observation-module__units___7BIK5","pad-right":"-esm-report-builder__numeric-observation-module__pad-right___8vJsT","off-scale-low":"-esm-report-builder__numeric-observation-module__off-scale-low___3TolK","off-scale-high":"-esm-report-builder__numeric-observation-module__off-scale-high___xMngl",arrow:"-esm-report-builder__numeric-observation-module__arrow___6Jyji"},Dn=({value:e,unit:t,label:r,interpretation:n,referenceRange:a,conceptUuid:o,variant:i="card",patientUuid:s})=>{let l=(0,s9.useId)(),{referenceRange:u,isLoading:c}=function(e,t){let r=null;e&&(r=t?`${az}/conceptreferencerange/?patient=${t}&concept=${e}&v=full`:`${az}/conceptreferencerange/?concept=${e}&v=full`);let{data:n,error:a,isLoading:o}=ur(r,aY),i=n?.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:a,isLoading:o}}(a||n?void 0:o,s),d=a??u,m=(0,s9.useMemo)(()=>{if(n)return n?"--"===n?"normal":De.includes(n)?n.toLowerCase():Dt.includes(n)?n:"normal":void 0;if(d&&!c){if(!d||null==e||""===e)return"normal";let t="string"==typeof e?Number.parseFloat(e):e;return Number.isNaN(t)?"normal":null!==d.hiAbsolute&&void 0!==d.hiAbsolute&&t>d.hiAbsolute?"off_scale_high":null!==d.hiCritical&&void 0!==d.hiCritical&&t>=d.hiCritical?"critically_high":null!==d.hiNormal&&void 0!==d.hiNormal&&t>d.hiNormal?"high":null!==d.lowAbsolute&&void 0!==d.lowAbsolute&&t<d.lowAbsolute?"off_scale_low":null!==d.lowCritical&&void 0!==d.lowCritical&&t<=d.lowCritical?"critically_low":null!==d.lowNormal&&void 0!==d.lowNormal&&t<d.lowNormal?"low":"normal"}return"normal"},[n,d,e,c])??"normal",p="critically_low"===m||"critically_high"===m||"off_scale_low"===m||"off_scale_high"===m,f="normal"!==m,h=r?`omrs-numeric-obs-label-${r.replaceAll(/\s+/g,"-").toLowerCase()}-${l}`:void 0,g=`omrs-numeric-obs-value-${l}`,y=`omrs-numeric-obs-unit-${l}`,v=null!=e&&""!==e,b=v?e:aO("notAvailable","Not available"),w=cn()({[Dr["critically-low"]]:"critically_low"===m||"off_scale_low"===m,[Dr["critically-high"]]:"critically_high"===m||"off_scale_high"===m,[Dr.low]:"low"===m,[Dr.high]:"high"===m,[Dr["off-scale-low"]]:"off_scale_low"===m,[Dr["off-scale-high"]]:"off_scale_high"===m}),E=cn()({[Dr.container]:!0,[Dr.card]:!0,[Dr["critical-value"]]:p,[Dr["abnormal-value"]]:f&&!p}),D=cn()({[Dr.cell]:!0,[w]:!0});return"cell"===i?(0,le.jsxs)("div",{className:D,children:[b,v&&t?` ${t}`:""]}):(0,le.jsxs)("section",{className:E,"data-testid":"numeric-observation-card",children:[r&&(0,le.jsxs)("div",{className:Dr["label-container"],children:[(0,le.jsx)("span",{id:h,className:Dr.label,children:r}),f&&(0,le.jsx)("span",{className:Dr[m.replace("_","-")],title:aO("abnormalValue","Abnormal value")})]}),(0,le.jsxs)("div",{className:Dr["value-container"],children:[(0,le.jsx)("span",{id:g,"aria-labelledby":h&&y?`${h} ${y}`:h||y||void 0,className:Dr.value,children:b}),v&&t&&(0,le.jsx)("span",{id:y,className:Dr.units,children:t})]})]})},Da="-esm-report-builder__page-header-module__pageHeader___sRmJ1",Do=e=>{if("children"in e){let{children:t,className:r,...n}=e;return(0,le.jsx)("div",{className:cn()(Da,r),...n,children:t})}{let{title:t,illustration:r,className:n,...a}=e;return(0,le.jsx)("div",{className:cn()(Da,n),...a,children:(0,le.jsx)(Di,{title:t,illustration:r})})}},Di=({title:e,illustration:t,className:r})=>{let[n,a]=(0,s9.useState)(null);return(0,s9.useEffect)(()=>{n4("@openmrs/esm-styleguide").then(e=>{a(e)})},[]),(0,le.jsxs)("div",{className:cn()("-esm-report-builder__page-header-module__pageHeaderContent___9CRks",r),children:[t,(0,le.jsxs)("div",{className:"-esm-report-builder__page-header-module__pageLabels___mIsS6",children:[n?.implementationName&&(0,le.jsx)("p",{children:aO(n.implementationName)}),(0,le.jsx)("h1",{className:"-esm-report-builder__page-header-module__pageName___kvdCd",children:e})]})]})},Ds=({totalItems:e,pageSize:t,onPageNumberChange:r,pageNumber:n,dashboardLinkUrl:a,currentItems:o,dashboardLinkLabel:i})=>{let{pageSizes:s,pageItemsCount:l}=uj(t,e,n,o),u="tablet"===uC(),c=aO("paginationItemsCount","{{pageItemsCount}} / {{totalItems}} items",{totalItems:e,pageItemsCount:l});return(0,le.jsx)(le.Fragment,{children:e>0&&(0,le.jsxs)("div",{className:cn()({"-esm-report-builder__pagination-module__tablet___-EohH":u,"-esm-report-builder__pagination-module__desktop___lJwLA":!u}),children:[(0,le.jsxs)("div",{children:[c,a&&(0,le.jsx)(lt,{to:a,className:"-esm-report-builder__pagination-module__configurableLink___f-IJ9",children:i??aO("seeAll","See all")})]}),(0,le.jsx)(cl.dKS,{className:"-esm-report-builder__pagination-module__pagination___XBkRY",page:n,pageSize:t,pageSizes:s,totalItems:e,onChange:r,pageRangeText:(e,t)=>aO("paginationOfPages","of {{count}} pages",{count:t}),size:u?"lg":"sm"})]})})};function Dl(e){return Dc(Dm(e,"usual","official"))}function Du(e){return Dl(e)}function Dc(e){var t;let r;return e?e.text??(r=(t=e).given??[],(t.family?r.concat(t.family):r).join(" ")):""}function Dd(e){return Dc(e)}function Dm(e,...t){for(let r of(0==t.length&&(t=["usual"]),t)){let t=e.name?.find(e=>{var t,n;return t=e,n=r,t.use?t.use===n:"usual"===n});if(t)return t}}function Dp(e,t=uH()){let r=uH(t),n=w$(e,r);if(null==n)return null;let a=r.diff(n,"hours"),o=r.diff(n,"days"),i=r.diff(n,"weeks"),s=r.diff(n,"months"),l=r.diff(n,"years"),u={};if(a<2)u.minutes=r.diff(n,"minutes");else if(o<2)u.hours=a;else if(i<4)u.days=o;else if(l<1){let e=r.subtract(i,"weeks").diff(n,"days");u.weeks=i,u.days=e}else if(l<2){let e=r.subtract(s,"months").diff(n,"days");u.months=s,u.days=e}else if(l<18){let e=r.subtract(l,"year").diff(n,"months");u.years=l,u.months=e}else u.years=l;return u}function Df(e,t=uH()){let r=Dp(e,t);if(null==r)return null;let n={style:"short",localeMatcher:"lookup"};return"minutes"in r&&0===r.minutes&&(n.minutesDisplay="always"),wT(r,n)}let Dh={container:"-esm-report-builder__patient-banner-patient-info-module__container___SbFly",activePatientContainer:"-esm-report-builder__patient-banner-patient-info-module__activePatientContainer___dPAI3",patientBanner:"-esm-report-builder__patient-banner-patient-info-module__patientBanner___RKK5o",patientName:"-esm-report-builder__patient-banner-patient-info-module__patientName___N4cBt",patientAvatar:"-esm-report-builder__patient-banner-patient-info-module__patientAvatar___S5B6e",patientAvatarButton:"-esm-report-builder__patient-banner-patient-info-module__patientAvatarButton___b4TpF",patientInfo:"-esm-report-builder__patient-banner-patient-info-module__patientInfo___k4TpF",demographics:"-esm-report-builder__patient-banner-patient-info-module__demographics___kUxEK",row:"-esm-report-builder__patient-banner-patient-info-module__row___aBH+R",flexRow:"-esm-report-builder__patient-banner-patient-info-module__flexRow___iE9YF",tagsSlot:"-esm-report-builder__patient-banner-patient-info-module__tagsSlot___qQx0X",identifiers:"-esm-report-builder__patient-banner-patient-info-module__identifiers___S+i2W",identifier:"-esm-report-builder__patient-banner-patient-info-module__identifier___V3fBY",primaryIdentifier:"-esm-report-builder__patient-banner-patient-info-module__primaryIdentifier___MGool",secondaryIdentifier:"-esm-report-builder__patient-banner-patient-info-module__secondaryIdentifier___ORbJn",value:"-esm-report-builder__patient-banner-patient-info-module__value___rZXrd",tag:"-esm-report-builder__patient-banner-patient-info-module__tag___l5yM7",gender:"-esm-report-builder__patient-banner-patient-info-module__gender___pBoq+",separator:"-esm-report-builder__patient-banner-patient-info-module__separator___kqhkj",tooltipPadding:"-esm-report-builder__patient-banner-patient-info-module__tooltipPadding___aca85",tooltipSmallText:"-esm-report-builder__patient-banner-patient-info-module__tooltipSmallText___KSHWn",actionsButtonText:"-esm-report-builder__patient-banner-patient-info-module__actionsButtonText___dfkx2"};function Dg({showIdentifierLabel:e,type:t,value:r}){return(0,le.jsx)("span",{className:Dh.primaryIdentifier,children:(0,le.jsxs)(cl.vwO,{className:Dh.tag,type:"gray",children:[e&&t?.text&&(0,le.jsxs)("span",{className:Dh.label,children:[t.text,": "]}),(0,le.jsx)("span",{className:Dh.value,children:r})]})})}function Dy({showIdentifierLabel:e,type:t,value:r}){return(0,le.jsxs)(cl.lRv,{className:Dh.secondaryIdentifier,id:`patient-banner-identifier-${r}`,children:[e&&(0,le.jsxs)("span",{className:Dh.label,children:[t?.text,": "]}),(0,le.jsx)("span",{className:Dh.value,children:r})]})}function Dv({identifiers:e,showIdentifierLabel:t}){let{excludePatientIdentifierCodeTypes:r}=l8(),{primaryIdentifierCode:n}=uF(),a=e?.filter(e=>{let t=e.type?.coding?.[0]?.code;return t&&!r?.uuids.includes(t)})??[];return(0,le.jsx)(le.Fragment,{children:a?.length?a.map(({value:e,type:r},o)=>(0,le.jsxs)(s8().Fragment,{children:[(0,le.jsx)("span",{className:Dh.identifier,children:r?.coding?.[0]?.code===n?(0,le.jsx)(Dg,{showIdentifierLabel:t,type:r,value:e}):(0,le.jsx)(Dy,{showIdentifierLabel:t,type:r,value:e})}),o<a.length-1&&(0,le.jsx)("span",{className:Dh.separator,children:"\xb7"})]},e)):""})}let Db={Female:c0,Male:c1,Other:c4,Unknown:c2},Dw=({gender:e})=>{let t=Db[e];return t?(0,le.jsx)(t,{fill:"#525252"}):null},DE={male:"Male",female:"Female",other:"Other",unknown:"Unknown"};function DD({patient:e,renderedFrom:t}){var r;let n,a,o=Dl(e),i=e?.gender&&(a=DE[n=(r=e.gender).toLowerCase()]??"Unknown",{displayText:aO(n,r),iconKey:a}),s=(0,s9.useMemo)(()=>({patientUuid:e.id,patient:e,renderedFrom:t}),[e.id,e,t]);return(0,le.jsxs)("div",{className:Dh.patientInfo,children:[(0,le.jsx)("div",{className:cn()(Dh.row,Dh.patientNameRow),children:(0,le.jsxs)("div",{className:Dh.flexRow,children:[(0,le.jsx)("span",{className:Dh.patientName,children:o}),i&&(0,le.jsxs)("div",{className:Dh.gender,children:[(0,le.jsx)(Dw,{gender:i.iconKey}),(0,le.jsx)("span",{children:i.displayText})]}),(0,le.jsx)(lg,{className:Dh.tagsSlot,name:"patient-banner-tags-slot",state:s})]})}),(0,le.jsxs)("div",{className:Dh.demographics,children:[e.birthDate&&(0,le.jsxs)(le.Fragment,{children:[(0,le.jsx)("span",{children:Df(e.birthDate)}),(0,le.jsx)("span",{className:Dh.separator,children:"\xb7"}),(0,le.jsx)("span",{children:w_(e.birthDate,{time:!1,noToday:!0})}),(0,le.jsx)("span",{className:Dh.separator,children:"\xb7"})]}),(0,le.jsx)(Dv,{identifiers:e.identifier,showIdentifierLabel:!0}),(0,le.jsx)(lg,{className:Dh.extensionSlot,name:"patient-banner-bottom-slot",state:s})]})]})}var Dx=r(1673);function D_({patient:e,patientUuid:t,actionsSlotName:r,additionalActionsSlotState:n}){let[a,o]=(0,s9.useState)(!1),{extensions:i}=lf(r),s="tablet"===uC(),l=uO(()=>o(!1),a),u=(0,s9.useRef)(null),c=(0,s9.useRef)(null),d=(0,s9.useId)(),m=`patient-actions-menu-trigger-${d}`,p=`patient-actions-menu-${d}`,f=(0,s9.useCallback)(()=>o(e=>!e),[]),h=(0,s9.useCallback)(()=>{o(!1),u.current?.focus()},[]),g=(0,s9.useCallback)(e=>{if("Escape"===e.key&&a){e.stopPropagation(),h();return}if(("ArrowDown"===e.key||"ArrowUp"===e.key)&&a){e.preventDefault();let t=c.current?.querySelectorAll('[role="menuitem"]:not([disabled])');if(!t?.length)return;let r=document.activeElement?.closest?.('[role="menuitem"]')??document.activeElement,n=Array.from(t).indexOf(r);if(-1===n)return void t["ArrowDown"===e.key?0:t.length-1]?.focus();let a=n+("ArrowDown"===e.key?1:-1),o=a<0?t.length-1:a>=t.length?0:a;t[o]?.focus()}},[h,a]);(0,s9.useEffect)(()=>{if(a&&c.current){let e=c.current.querySelector('[role="menuitem"]:not([disabled])');e?.focus()}},[a]);let y=(0,s9.useMemo)(()=>({patientUuid:t,patient:e,closeMenu:h,...n}),[t,e,h,n]);return 0===i.length?null:(0,le.jsx)("div",{className:"-esm-report-builder__patient-banner-actions-menu-module__overflowMenuContainer___kcHLp",children:(0,le.jsxs)("div",{"data-overflow-menu":!0,className:cn()("cds--overflow-menu",cd),ref:l,children:[(0,le.jsxs)("button",{className:cn()("cds--btn","cds--btn--ghost","cds--overflow-menu__trigger",{"cds--overflow-menu--open":a},cf),"aria-controls":p,"aria-expanded":a,"aria-haspopup":"true",id:m,onClick:f,onKeyDown:g,ref:u,children:[(0,le.jsx)("span",{className:"-esm-report-builder__patient-banner-actions-menu-module__actionsButtonText___w2rar",children:aO("actions","Actions")})," ",(0,le.jsx)(Dx.CH,{size:16,style:{marginLeft:"0.5rem",fill:"#78A9FF"}})]}),(0,le.jsxs)("div",{className:cn()("cds--overflow-menu-options","cds--overflow-menu--flip",cm,{[cp]:a}),"aria-labelledby":m,"data-floating-menu-direction":"bottom",id:p,onKeyDown:g,ref:c,role:"menu",tabIndex:-1,children:[(0,le.jsx)("ul",{className:cn()("cds--overflow-menu-options__content",{"cds--overflow-menu-options--lg":s}),children:(0,le.jsx)(lg,{name:r,state:y},r)}),(0,le.jsx)("span",{})]})]})})}var DS=r(6767),DC=r.n(DS);function Dk(e){let{patientPhotoConceptUuid:t}=l8({externalModuleName:"@openmrs/esm-styleguide"}),r=t?`${az}/obs?patient=${e}&concept=${t}&v=full`:null,{data:n,error:a,isLoading:o}=(0,lN.u)(e?r:null,aY),i=n?.data?.results[0];return{data:i?{dateTime:i?.obsDatetime,imageSrc:i?.value?.links?.uri}:null,error:a,isLoading:o}}let DP=({width:e=56,height:t=56,"aria-label":r})=>{let{t:n}=(0,lO.useTranslation)();return(0,le.jsxs)("svg",{"aria-label":r??n("patientPhotoPlaceholder","Patient photo placeholder"),width:e,height:t,fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[(0,le.jsx)("path",{fill:"#ffffff",d:"M0 0h56v56H0z"}),(0,le.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"})]})},DR="-esm-report-builder__patient-photo-module__avatar___SjWI2";function DT({patientUuid:e,patientName:t,alt:r}){let{data:n,isLoading:a}=Dk(e),[o,i]=(0,s9.useState)(null),[s,l]=(0,s9.useState)(!1),u=(0,s9.useMemo)(()=>DC().generate(e),[e]);(0,s9.useEffect)(()=>{if(n?.imageSrc){let e=new URL(n.imageSrc,window.location.origin).pathname;l(!0);let t=!1,r=new Image;return r.onload=()=>{t||(i(e),l(!1))},r.onerror=()=>{t||(i(null),l(!1))},r.src=e,()=>{t=!0}}i(null),l(!1)},[n?.imageSrc]);let c=(0,s9.useMemo)(()=>r||(o?aO("patientPhotoAlt","Profile photo of {{patientName}}",{patientName:t}):aO("patientAvatarAlt","Avatar for {{patientName}}",{patientName:t})),[r,o,t]);return a||s?(0,le.jsx)(cl.ryE,{className:"-esm-report-builder__patient-photo-module__skeleton___YkxcQ","data-testid":"skeleton-icon"}):n?.imageSrc&&!o?(0,le.jsx)(DP,{"aria-label":aO("patientPhotoPlaceholder","Photo placeholder for {{patientName}}",{patientName:t})}):o?(0,le.jsx)("div",{"aria-label":c,children:(0,le.jsx)("img",{className:DR,src:o,alt:c,title:t})}):(0,le.jsx)("div",{"aria-label":c,children:(0,le.jsx)("div",{className:DR,title:t,style:{backgroundImage:u.toDataUrl(),backgroundRepeat:"no-repeat",backgroundSize:"cover"},children:(0,le.jsx)("span",{className:"-esm-report-builder__patient-photo-module__initials___GrIHj",children:function(e,t=3){return e.split(/\s+/).filter(Boolean).slice(0,t).map(e=>e[0]).join("")}(t)})})})}let D$=["omrs-pict-appointments","omrs-pict-assessment-1","omrs-pict-assessment-2","omrs-pict-blood-bank","omrs-pict-cardiology","omrs-pict-cohorts","omrs-pict-concept-dictionary","omrs-pict-ct-scan","omrs-pict-data-entry","omrs-pict-dentistry","omrs-pict-digital-trust","omrs-pict-emergency-department","omrs-pict-facility","omrs-pict-geriatrics","omrs-pict-gynaecology","omrs-pict-in-patient","omrs-pict-laboratory","omrs-pict-labs-2","omrs-pict-metadata-export","omrs-pict-obstetrics","omrs-pict-patient-documents","omrs-pict-patient-search","omrs-pict-patients","omrs-pict-payments-desk","omrs-pict-pharmacy","omrs-pict-pharmacy-2","omrs-pict-registration","omrs-pict-reports","omrs-pict-service-queues","omrs-pict-stock-management","omrs-pict-system-administration","omrs-pict-transfer","omrs-pict-triage","omrs-pict-x-ray"],DO=(0,s9.memo)((0,s9.forwardRef)(function(e,t){return(0,le.jsx)(xi,{ref:t,pictogram:"omrs-pict-appointments",pictogramProps:e})})),DN=DO,DM=(0,s9.memo)((0,s9.forwardRef)(function(e,t){return(0,le.jsx)(xi,{ref:t,pictogram:"omrs-pict-assessment-1",pictogramProps:e})})),DI=(0,s9.memo)((0,s9.forwardRef)(function(e,t){return(0,le.jsx)(xi,{ref:t,pictogram:"omrs-pict-assessment-2",pictogramProps:e})})),Dj=(0,s9.memo)((0,s9.forwardRef)(function(e,t){return(0,le.jsx)(xi,{ref:t,pictogram:"omrs-pict-blood-bank",pictogramProps:e})})),DA=(0,s9.memo)((0,s9.forwardRef)(function(e,t){return(0,le.jsx)(xi,{ref:t,pictogram:"omrs-pict-cardiology",pictogramProps:e})})),DL=(0,s9.memo)((0,s9.forwardRef)(function(e,t){return(0,le.jsx)(xi,{ref:t,pictogram:"omrs-pict-cohorts",pictogramProps:e})})),DF=(0,s9.memo)((0,s9.forwardRef)(function(e,t){return(0,le.jsx)(xi,{ref:t,pictogram:"omrs-pict-concept-dictionary",pictogramProps:e})})),DB=(0,s9.memo)((0,s9.forwardRef)(function(e,t){return(0,le.jsx)(xi,{ref:t,pictogram:"omrs-pict-ct-scan",pictogramProps:e})})),DV=(0,s9.memo)((0,s9.forwardRef)(function(e,t){return(0,le.jsx)(xi,{ref:t,pictogram:"omrs-pict-data-entry",pictogramProps:e})})),DU=(0,s9.memo)((0,s9.forwardRef)(function(e,t){return(0,le.jsx)(xi,{ref:t,pictogram:"omrs-pict-dentistry",pictogramProps:e})})),DW=(0,s9.memo)((0,s9.forwardRef)(function(e,t){return(0,le.jsx)(xi,{ref:t,pictogram:"omrs-pict-digital-trust",pictogramProps:e})})),DH=(0,s9.memo)((0,s9.forwardRef)(function(e,t){return(0,le.jsx)(xi,{ref:t,pictogram:"omrs-pict-emergency-department",pictogramProps:e})})),Dz=(0,s9.memo)((0,s9.forwardRef)(function(e,t){return(0,le.jsx)(xi,{ref:t,pictogram:"omrs-pict-facility",pictogramProps:e})})),DK=(0,s9.memo)((0,s9.forwardRef)(function(e,t){return(0,le.jsx)(xi,{ref:t,pictogram:"omrs-pict-geriatrics",pictogramProps:e})})),DG=(0,s9.memo)((0,s9.forwardRef)(function(e,t){return(0,le.jsx)(xi,{ref:t,pictogram:"omrs-pict-gynaecology",pictogramProps:e})})),DZ=(0,s9.memo)((0,s9.forwardRef)(function(e,t){return(0,le.jsx)(xi,{ref:t,pictogram:"omrs-pict-in-patient",pictogramProps:e})})),DY=(0,s9.memo)((0,s9.forwardRef)(function(e,t){return(0,le.jsx)(xi,{ref:t,pictogram:"omrs-pict-laboratory",pictogramProps:e})})),Dq=(0,s9.memo)((0,s9.forwardRef)(function(e,t){return(0,le.jsx)(xi,{ref:t,pictogram:"omrs-pict-labs-2",pictogramProps:e})})),DJ=(0,s9.memo)((0,s9.forwardRef)(function(e,t){return(0,le.jsx)(xi,{ref:t,pictogram:"omrs-pict-metadata-export",pictogramProps:e})})),DX=(0,s9.memo)((0,s9.forwardRef)(function(e,t){return(0,le.jsx)(xi,{ref:t,pictogram:"omrs-pict-obstetrics",pictogramProps:e})})),DQ=(0,s9.memo)((0,s9.forwardRef)(function(e,t){return(0,le.jsx)(xi,{ref:t,pictogram:"omrs-pict-patient-documents",pictogramProps:e})})),D0=(0,s9.memo)((0,s9.forwardRef)(function(e,t){return(0,le.jsx)(xi,{ref:t,pictogram:"omrs-pict-patient-search",pictogramProps:e})})),D1=(0,s9.memo)((0,s9.forwardRef)(function(e,t){return(0,le.jsx)(xi,{ref:t,pictogram:"omrs-pict-patients",pictogramProps:e})})),D4=(0,s9.memo)((0,s9.forwardRef)(function(e,t){return(0,le.jsx)(xi,{ref:t,pictogram:"omrs-pict-payments-desk",pictogramProps:e})})),D2=(0,s9.memo)((0,s9.forwardRef)(function(e,t){return(0,le.jsx)(xi,{ref:t,pictogram:"omrs-pict-pharmacy",pictogramProps:e})})),D3=(0,s9.memo)((0,s9.forwardRef)(function(e,t){return(0,le.jsx)(xi,{ref:t,pictogram:"omrs-pict-pharmacy-2",pictogramProps:e})})),D6=(0,s9.memo)((0,s9.forwardRef)(function(e,t){return(0,le.jsx)(xi,{ref:t,pictogram:"omrs-pict-registration",pictogramProps:e})})),D5=(0,s9.memo)((0,s9.forwardRef)(function(e,t){return(0,le.jsx)(xi,{ref:t,pictogram:"omrs-pict-reports",pictogramProps:e})})),D9=(0,s9.memo)((0,s9.forwardRef)(function(e,t){return(0,le.jsx)(xi,{ref:t,pictogram:"omrs-pict-service-queues",pictogramProps:e})})),D8=(0,s9.memo)((0,s9.forwardRef)(function(e,t){return(0,le.jsx)(xi,{ref:t,pictogram:"omrs-pict-stock-management",pictogramProps:e})})),D7=(0,s9.memo)((0,s9.forwardRef)(function(e,t){return(0,le.jsx)(xi,{ref:t,pictogram:"omrs-pict-system-administration",pictogramProps:e})})),xe=(0,s9.memo)((0,s9.forwardRef)(function(e,t){return(0,le.jsx)(xi,{ref:t,pictogram:"omrs-pict-transfer",pictogramProps:e})})),xt=(0,s9.memo)((0,s9.forwardRef)(function(e,t){return(0,le.jsx)(xi,{ref:t,pictogram:"omrs-pict-triage",pictogramProps:e})})),xr=(0,s9.memo)((0,s9.forwardRef)(function(e,t){return(0,le.jsx)(xi,{ref:t,pictogram:"omrs-pict-x-ray",pictogramProps:e})})),xn=Dz,xa=D1,xo=(0,s9.memo)((0,s9.forwardRef)(function({pictogram:e,fallback:t,...r},n){let a=(0,s9.useRef)(document.getElementById(e));return(0,s9.useEffect)(()=>{let t=document.getElementById("omrs-svgs-container"),r=new MutationObserver(t=>{for(let r of t)"childList"===r.type&&(a.current=document.getElementById(e))});return t&&r.observe(t,{childList:!0}),()=>r.disconnect()},[e]),(0,le.jsx)(lJ,{value:a.current,fallback:t,children:(0,le.jsx)(xi,{ref:n,pictogram:e,pictogramProps:r})})})),xi=(0,s9.memo)((0,s9.forwardRef)(function({pictogram:e,pictogramProps:t},r){let{className:n,size:a}=Object.assign({},{size:92},t);return(a<=26||a>144)&&(console.error(`Invalid size '${a}' specified for ${e}. Defaulting to 92.`),a=92),(0,le.jsx)("svg",{ref:r,className:cn()("-esm-report-builder__pictograms-module__pictogram___ej8c6",n),height:a,width:a,children:(0,le.jsx)("use",{href:`#${e}`})})})),xs=({children:e})=>"tablet"===uC()?(0,le.jsx)(cl.Wdr,{children:e}):(0,le.jsx)(le.Fragment,{children:e}),xl=({snackbar:e,closeSnackbar:t})=>{let{actionButtonLabel:r="",kind:n="success",onActionButtonClick:a=()=>{},isLowContrast:o="error"!==n,progressActionLabel:i,subtitle:s="",timeoutInMs:l=5e3,autoClose:u="error"!==n,title:c,id:d,...m}=e,[p,f]=(0,s9.useState)(r),[h,g]=(0,s9.useState)(!0),[y,v]=(0,s9.useState)(!1),b=(0,s9.useCallback)(()=>{setTimeout(t,250)},[t]),w=(0,s9.useCallback)(()=>{v(!0),b()},[b]);return(0,s9.useEffect)(()=>{if(u){let e=setTimeout(w,l);return()=>clearTimeout(e)}},[l,u,w]),(0,s9.useEffect)(()=>{g(!1),window.setTimeout(()=>{g(!0)},0)},[]),(0,le.jsx)(cl.kZS,{actionButtonLabel:p,"aria-label":aO("closeSnackbar","Close snackbar"),className:cn()("-esm-report-builder__snackbar-module__slideIn___hMvlf",{"-esm-report-builder__snackbar-module__animated___c+ZXw":h,"-esm-report-builder__snackbar-module__slideOut___ymbgm":y}),kind:n,lowContrast:o,onActionButtonClick:()=>{a(),w(),i&&f(i)},onClose:b,statusIconDescription:aO("snackbarNotification","Snackbar notification"),subtitle:s,title:c,...m})},xu=({subject:e})=>{let[t,r]=(0,s9.useState)([]),n=(0,s9.useCallback)(e=>{r(t=>t.filter(t=>t!==e))},[]);return(0,s9.useEffect)(()=>{let t=e.subscribe(e=>r(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,le.jsx)(le.Fragment,{children:t.map(e=>(0,le.jsx)(xl,{snackbar:e,closeSnackbar:()=>n(e)},e.id))})},xc=new E1,xd=0;function xm(e){e&&(0,ly.createRoot)(e).render((0,le.jsx)(xu,{subject:xc}))}function xp(e){var t;e&&"string"==typeof(t=e.title)&&t.trim().length>0?setTimeout(()=>{xc.next({...e,id:xd++})},0):console.error("showSnackbar must be called with an object having a 'title' property that is a non-empty string")}let xf=({toast:e,closeToast:t})=>{let{description:r,kind:n,critical:a,title:o,actionButtonLabel:i,onActionButtonClick:s=()=>{}}=e,l=(0,s9.useCallback)(()=>{s(),t()},[t,s]);return(0,le.jsx)("div",{children:(0,le.jsx)(cl.kZS,{actionButtonLabel:i,kind:n||"info",lowContrast:a,subtitle:r,title:o||"",onActionButtonClick:l,onClose:t})})},xh=({subject:e})=>{let[t,r]=(0,s9.useState)([]),n=(0,s9.useCallback)(e=>{r(t=>t.filter(t=>t!==e))},[]);return(0,s9.useEffect)(()=>{let t=e.subscribe(e=>r(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,le.jsx)(le.Fragment,{children:t.map(e=>(0,le.jsx)(xf,{toast:e,closeToast:()=>n(e)},e.id))})},xg=new E1,xy=0;function xv(e){e&&(0,ly.createRoot)(e).render((0,le.jsx)(xh,{subject:xg}))}function xb(e){var t;e&&("string"==typeof(t=e.description)?t.trim().length>0:"object"==typeof t&&!Eq(t))?setTimeout(()=>{xg.next({...e,id:xy++})},0):console.error("showToast must be called with an object having a 'description' property that is a non-empty string or object")}let xw="u">typeof crypto&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),xE=new Uint8Array(16),xD=[];for(let e=0;e<256;++e)xD.push((e+256).toString(16).slice(1));let xx=function(e,t,r){if(xw&&!t&&!e)return xw();let n=(e=e||{}).random??e.rng?.()??function(){if(!c){if("u"<typeof crypto||!crypto.getRandomValues)throw Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");c=crypto.getRandomValues.bind(crypto)}return c(xE)}();if(n.length<16)throw Error("Random bytes length must be >= 16");if(n[6]=15&n[6]|64,n[8]=63&n[8]|128,t){if((r=r||0)<0||r+16>t.length)throw RangeError(`UUID byte range ${r}:${r+15} is out of buffer bounds`);for(let e=0;e<16;++e)t[r+e]=n[e];return t}return function(e,t=0){return(xD[e[t+0]]+xD[e[t+1]]+xD[e[t+2]]+xD[e[t+3]]+"-"+xD[e[t+4]]+xD[e[t+5]]+"-"+xD[e[t+6]]+xD[e[t+7]]+"-"+xD[e[t+8]]+xD[e[t+9]]+"-"+xD[e[t+10]]+xD[e[t+11]]+xD[e[t+12]]+xD[e[t+13]]+xD[e[t+14]]+xD[e[t+15]]).toLowerCase()}(n)};async function x_(e,t){let{openedGroup:r}=sK.getState();if(r){if(r.groupName===e&&xk(r.props,t))return!0;else if(!await xT({reason:"CLOSE_WORKSPACE_GROUP",explicit:!1}))return!1}return sK.setState(r=>({...r,openedGroup:{groupName:e,props:t},openedWindows:[]})),!0}async function xS(e){let{openedGroup:t,openedWindows:r}=sK.getState();if(t){if(r.length>0&&!(e||await xT({reason:"CLOSE_WORKSPACE_GROUP",explicit:!0})))return!1;sK.setState(e=>({...e,openedGroup:null,openedWindows:[]}))}return!0}async function xC(e,t=null,r=null,n=null){let a=sK.getState();if(!a.registeredWorkspacesByName[e])throw Error(`Unable to launch workspace ${e}. Workspace is not registered`);let o=sG(e);if(!o)throw Error(`Unable to launch workspace ${e}. Workspace is not registered to a workspace window`);let{openedGroup:i}=a,{name:s}=o,l=sZ(s);if(!l)throw Error(`Unable to launch workspace ${e}. Workspace window ${o.name} is not registered to a workspace group`);let u=sY(e);if(i&&(i.groupName!==l.name||!xk(i.props,n)))return!!await xT({reason:"CLOSE_WORKSPACE_GROUP",explicit:!0})&&(sK.setState({...a,openedGroup:{groupName:l.name,props:n},openedWindows:[{windowName:s,openedWorkspaces:[xV(e,t)],props:r,maximized:!1}],isMostRecentlyOpenedWindowHidden:!1}),!0);if(u>=0){let n=a.openedWindows[u],o=a.openedGroup?.props??{},i=a.isMostRecentlyOpenedWindowHidden,{openedWorkspaces:c}=n;if(xk(n.props,r)){let d=c.find(t=>t.workspaceName===e);return d&&xk(d.props,t)?((i||u!==a.openedWindows.length-1)&&sK.setState(xj.restoreWindow(a,s)),!0):!!await xT({reason:"CLOSE_WORKSPACE",explicit:!1,windowName:s,workspaceName:e})&&(sK.setState({...a,openedGroup:{groupName:l.name,props:a?.openedGroup?.props??o},openedWindows:[...a.openedWindows.filter((e,t)=>t!==u),{windowName:s,openedWorkspaces:[xV(e,t)],props:n?.props??r,maximized:!1}],isMostRecentlyOpenedWindowHidden:!1}),!0)}return!!await xT({reason:"CLOSE_WINDOW",explicit:!1,windowName:s})&&(sK.setState({...a,openedGroup:{groupName:l.name,props:o??a?.openedGroup?.props},openedWindows:[...a.openedWindows.filter((e,t)=>t!==u),{windowName:s,openedWorkspaces:[xV(e,t)],props:r,maximized:!1}],isMostRecentlyOpenedWindowHidden:!1}),!0)}return"closable"!=l.persistence?(sK.setState({...a,openedGroup:{groupName:l.name,props:n??a?.openedGroup?.props??null},openedWindows:[...a.openedWindows,{windowName:s,openedWorkspaces:[xV(e,t)],props:r,maximized:!1}],isMostRecentlyOpenedWindowHidden:!1}),!0):!!await xT({reason:"CLOSE_OTHER_WINDOWS",explicit:!1,windowNameToSpare:o.name})&&(sK.setState({...a,openedGroup:{groupName:l.name,props:n??a?.openedGroup?.props??null},openedWindows:[{windowName:s,openedWorkspaces:[xV(e,t)],props:r,maximized:!1}],isMostRecentlyOpenedWindowHidden:!1}),!0)}function xk(e,t){return null==e||null==t||T(e,t)}function xP(e,t){let r=[];for(let n=e.openedWorkspaces.length-1;n>=0;n--){let a=e.openedWorkspaces[n];if(a.hasUnsavedChanges&&r.push(a),t&&a.workspaceName===t)break}return r}function xR(e){return 0===e.length?Promise.resolve(!0):new Promise(t=>{let r=EZ("workspace2-close-prompt",{size:"sm",onConfirm:()=>{r(),t(!0)},onCancel:()=>{r(),t(!1)},affectedWorkspaceTitles:e.map(e=>e.title??"")})})}function xT(e){let{openedWindows:t}=sK.getState(),r=[];switch(e.reason){case"CLOSE_WORKSPACE_GROUP":r=t.flatMap(e=>xP(e));break;case"CLOSE_WINDOW":{let n=t.find(t=>t.windowName===e.windowName);if(!n)throw Error(`Window ${e.windowName} not found in opened windows.`);r=xP(n);break}case"CLOSE_WORKSPACE":{let n=t.find(t=>t.windowName===e.windowName);if(!n)throw Error(`Window ${e.windowName} not found in opened windows.`);r=xP(n,e.workspaceName);break}case"CLOSE_OTHER_WINDOWS":r=t.filter(t=>t.windowName!==e.windowNameToSpare).flatMap(e=>xP(e))}return xR(r)}function x$(e,t){return xR(xP(e,t))}function xO(e,t){let r=e.openedWorkspaces.findIndex(e=>e.workspaceName===t);return r<0?e:0===r?null:{...e,openedWorkspaces:e.openedWorkspaces.slice(0,r)}}function xN(e,t,r,n){let{registeredWorkspacesByName:a}=sK.getState(),o=a[r];if(!o)throw Error(`No workspace named "${r}" registered`);let i=a[t];if(!i)throw Error(`No workspace named "${t}" registered`);if(i.window!==o.window)throw Error(`Child workspace ${r} does not belong to the same workspace window as parent workspace ${t}`);if(o.window!==e.windowName)throw Error(`Cannot open child workspace ${r} as window ${o.window} is not opened`);let{openedWorkspaces:s}=e,l=s.findIndex(e=>e.workspaceName===t);if(-1===l)throw Error(`Cannot open child workspace ${r} from parent workspace ${t} as the parent is not opened within the workspace window`);let u=s.slice(0,l+1);return{...e,openedWorkspaces:[...u,xV(r,n)]}}function xM(e,t,r){let n=e.openedWorkspaces.findIndex(e=>e.uuid===t);if(n<0)return e;let a=e.openedWorkspaces[n];if(Object.keys(r).every(e=>a[e]===r[e]))return e;let o=[...e.openedWorkspaces];return o[n]={...a,...r},{...e,openedWorkspaces:o}}function xI(e,t,r){let n=e.openedWindows.findIndex(e=>e.openedWorkspaces.some(e=>e.uuid===t));if(n<0)return e;let a=e.openedWindows[n],o=xM(a,t,r);if(o===a)return e;let i=[...e.openedWindows];return i[n]=o,{...e,openedWindows:i}}let xj={setWindowMaximized(e,t,r){let n=e.openedWindows.findIndex(e=>e.windowName===t),a=[...e.openedWindows],o={...a[n],maximized:r};return a[n]=o,{...e,openedWindows:a}},hideWindow:e=>({...e,isMostRecentlyOpenedWindowHidden:!0}),restoreWindow(e,t){let r=e.openedWindows.findIndex(e=>e.windowName===t),n=e.openedWindows[r],a=[...e.openedWindows.filter((e,t)=>t!==r),n];return{...e,openedWindows:a,isMostRecentlyOpenedWindowHidden:!1}},closeWorkspace(e,t){let r=e.openedWindows.findIndex(e=>e.openedWorkspaces.some(e=>e.workspaceName===t));if(r<0)return e;let n=xO(e.openedWindows[r],t),a=[...e.openedWindows],o=e.isMostRecentlyOpenedWindowHidden;if(null===n){let t=r===e.openedWindows.length-1;a.splice(r,1),t&&a.length>0&&(o=!1)}else a[r]=n;return{...e,openedWindows:a,isMostRecentlyOpenedWindowHidden:o}},openChildWorkspace(e,t,r,n){let a=e.registeredWorkspacesByName[r];if(!a)throw Error(`No workspace named "${r}" registered`);let o=e.openedWindows.findIndex(e=>e.windowName===a.window);if(-1==o)throw Error(`Cannot open child workspace ${r} as window ${a.window} is not opened`);let i=[...e.openedWindows];return i[o]=xN(e.openedWindows[o],t,r,n),{...e,openedWindows:i}},setHasUnsavedChanges:(e,t,r)=>xI(e,t,{hasUnsavedChanges:r}),setWorkspaceTitle:(e,t,r)=>xI(e,t,{title:r})};function xA(){return ls(sK,xj)}let xL=()=>(0,s9.useContext)(l_),xF=()=>Object.keys(sK.getState().registeredWorkspacesByName);function xB(e,t,r){let n=e.openedWorkspaces[e.openedWorkspaces.length-1];return(n?t[n.workspaceName]?.width:void 0)??r[e.windowName]?.width??"narrow"}function xV(e,t){return{workspaceName:e,props:t??{},hasUnsavedChanges:!1,uuid:xx()}}function xU(e,t,r){let n=sK.getState().registeredWorkspacesByName[e];return n?{windowName:n.window,openedWorkspaces:[xV(e,t)],props:r??null,maximized:!1}:null}let xW=({title:e,children:t,hasUnsavedChanges:r=!1})=>{let{setHasUnsavedChanges:n,setWorkspaceTitle:a}=xL();return(0,s9.useEffect)(()=>{n(r??!1)},[r,n]),(0,s9.useEffect)(()=>{a(e)},[e,a]),(0,le.jsx)(le.Fragment,{children:t})};function xH(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function xz(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?xH(Object(r),!0).forEach(function(t){xG(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):xH(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function xK(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function xG(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function xZ(e){return(xZ=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function xY(e,t){return(xY=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function xq(e){if(void 0===e)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return e}var xJ=function(e){var t=s9.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&&xY(i,t);var r,n,a,o=(r=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=xZ(i);e=r?Reflect.construct(t,arguments,xZ(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 xq(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),xG(xq(t=o.call(this,e)),"handleRef",function(e){t.el=e}),xG(xq(t),"addThingToDo",function(e,r){t.state.hasError&&"unmount"!==e||(t.nextThingToDo=(t.nextThingToDo||Promise.resolve()).then(function(){if(!t.unmounted||"unmount"===e)return r.apply(void 0,arguments)}).catch(function(r){throw t.nextThingToDo=Promise.resolve(),t.setState({hasError:!0}),r&&r.message&&(r.message="During '".concat(e,"', parcel threw an error: ").concat(r.message)),t.props.handleError?t.props.handleError(r):setTimeout(function(){throw r}),r}))}),xG(xq(t),"getParcelProps",function(){var e=xz(xz({},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 n=[{key:"componentDidMount",value:function(){var e=this;this.unmounted=!1,this.addThingToDo("mount",function(){var t,r=e.props.mountParcel||e.mountParcel;if(!r)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(r){t.style[r]=e.props.wrapStyle[r]}),e.props.appendTo.appendChild(t)),e.parcel=r(e.props.config,xz({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 l_&&l_.Consumer?s9.createElement(l_.Consumer,null,function(t){return e.mountParcel=t?t.mountParcel:null,null}):null;var t=l_&&l_.Consumer?s9.createElement(l_.Consumer,null,function(t){return e.mountParcel=t?t.mountParcel:null,null}):void 0;return s9.createElement(this.props.wrapWith,{ref:this.handleRef,style:this.props.wrapStyle,className:this.props.wrapClassName},t)}}],xK(i.prototype,n),a&&xK(i,a),i}();xG(xJ,"defaultProps",{wrapWith:"div",wrapStyle:{},parcelDidMount:function(){}});var xX=r(810),xQ=r(771);let x0={workspaceOuterContainer:"-esm-report-builder__workspace2-module__workspaceOuterContainer___W9iJN",narrowWorkspace:"-esm-report-builder__workspace2-module__narrowWorkspace___6pFGF",widerWorkspace:"-esm-report-builder__workspace2-module__widerWorkspace___aQBxL",extraWideWorkspace:"-esm-report-builder__workspace2-module__extraWideWorkspace___Hcpmd",workspaceMiddleContainer:"-esm-report-builder__workspace2-module__workspaceMiddleContainer___DlVKb",maximized:"-esm-report-builder__workspace2-module__maximized___GqZm5",hidden:"-esm-report-builder__workspace2-module__hidden___KSjDv",workspaceInnerContainer:"-esm-report-builder__workspace2-module__workspaceInnerContainer___qQKWW",workspaceSpacer:"-esm-report-builder__workspace2-module__workspaceSpacer___tx3mR",loader:"-esm-report-builder__workspace2-module__loader___f9ttF",hiddenExtraWorkspace:"-esm-report-builder__workspace2-module__hiddenExtraWorkspace___o2RHo",header:"-esm-report-builder__workspace2-module__header___4cJjV",headerButtons:"-esm-report-builder__workspace2-module__headerButtons___5vIhN",workspaceContent:"-esm-report-builder__workspace2-module__workspaceContent___ROBU9",overlayHeaderSpacer:"-esm-report-builder__workspace2-module__overlayHeaderSpacer___CFci9",isActionMenuOpened:"-esm-report-builder__workspace2-module__isActionMenuOpened___TlyIU",showActionMenu:"-esm-report-builder__workspace2-module__showActionMenu___5qVqE",marginWorkspaceContent:"-esm-report-builder__workspace2-module__marginWorkspaceContent___jB4mY",workspaceContainerWithActionMenu:"-esm-report-builder__workspace2-module__workspaceContainerWithActionMenu___+EHP1",workspaceFixedContainer:"-esm-report-builder__workspace2-module__workspaceFixedContainer___PV5s-",workspaceContainerWithoutActionMenu:"-esm-report-builder__workspace2-module__workspaceContainerWithoutActionMenu___pJYA1"},x1=e=>e.registeredWorkspacesByName,x4=({lifeCycle:e,openedWorkspace:t,openedWindow:r,groupProps:n,actions:a,renderChrome:o,isRootWorkspace:i,isLeafWorkspace:s,showActionMenu:l})=>{let u=(0,s9.useMemo)(()=>t&&{closeWorkspace:async(e={})=>{let{closeWindow:n=!1,discardUnsavedChanges:o=!1}=e;return n?!!(o||await a.promptForClosingWorkspaces())&&(a.closeWorkspace(r.openedWorkspaces[0].workspaceName),!0):!!(o||await a.promptForClosingWorkspaces(t.workspaceName))&&(a.closeWorkspace(t.workspaceName),!0)},launchChildWorkspace:async(e,n)=>{let o=t.workspaceName,{openedWorkspaces:i}=r,s=i.findIndex(e=>e.workspaceName===o);-1===s||s!==i.length-1&&i.slice(s+1).some(e=>e.hasUnsavedChanges)&&!await a.promptForClosingWorkspaces(i[s+1].workspaceName)||a.openChildWorkspace(o,e,n||{})},setWorkspaceTitle:e=>a.setWorkspaceTitle(t.uuid,e),setHasUnsavedChanges:e=>a.setHasUnsavedChanges(t.uuid,e),workspaceName:t.workspaceName,workspaceProps:t.props,windowProps:r.props,groupProps:n,workspaceMeta:sK.getState().registeredWorkspacesByName[t.workspaceName]?.meta??{},isRootWorkspace:i,isLeafWorkspace:s,windowName:r.windowName,showActionMenu:l},[t,r,n,a,i,s,l]),c=!o&&!s,d=(0,s9.useMemo)(()=>e?(0,le.jsx)(xJ,{config:e,mountParcel:s6,wrapWith:"div",wrapClassName:cn()(x0.workspaceContent,{[x0.hiddenExtraWorkspace]:c}),...u},t.workspaceName):null===e?(0,le.jsx)("div",{className:cn()(x0.workspaceContent,{[x0.hiddenExtraWorkspace]:c}),children:(0,le.jsx)(cl.jeF,{kind:"error",title:aO("error"),subtitle:aO("somethingWentWrongTryReloading"),hideCloseButton:!0})}):null,[e,t.workspaceName,u,c]);return o?(0,le.jsx)("div",{children:(0,le.jsx)(x2,{openedWorkspace:t,openedWindow:r,isRootWorkspace:i,showActionMenu:l,closeWindow:()=>u.closeWorkspace({closeWindow:!0}),children:d})}):d??(0,le.jsx)(cl.OuH,{className:cn()(x0.loader,{[x0.hiddenExtraWorkspace]:c}),description:`${aO("loading")}`})},x2=({openedWorkspace:e,openedWindow:t,isRootWorkspace:r,showActionMenu:n,closeWindow:a,children:o})=>{let i=uC(),{openedGroup:s,openedWindows:l,registeredWindowsByName:u,registeredWorkspacesByName:c,registeredGroupsByName:d,isMostRecentlyOpenedWindowHidden:m,setWindowMaximized:p,hideWindow:f}=xA(),h=t.windowName,{maximized:g}=t,y=e.title??"",v=u[h],b=xB(t,c,u),w=v?.icon,E=v?.canMaximize,D=!!s&&d[s.groupName]?.persistence==="closable",x=!!w&&!D,_=l.findIndex(e=>e.windowName===h)<l.length-1||m,S=Object.values(u).some(e=>e.group===s?.groupName&&void 0!==e.icon);return(0,le.jsxs)("div",{className:cn()(x0.workspaceOuterContainer,{[x0.narrowWorkspace]:"narrow"===b,[x0.widerWorkspace]:"wider"===b,[x0.extraWideWorkspace]:"extra-wide"===b,[x0.isActionMenuOpened]:S}),children:[(0,le.jsx)("div",{className:cn()(x0.workspaceSpacer,{[x0.hidden]:_})}),(0,le.jsx)("div",{className:cn()(x0.workspaceMiddleContainer,{[x0.maximized]:g,[x0.hidden]:_,[x0.isRootWorkspace]:r,[x0.showActionMenu]:n}),children:(0,le.jsx)("div",{className:cn()(x0.workspaceInnerContainer,{[x0.maximized]:g,[x0.hidden]:_,[x0.isRootWorkspace]:r}),children:o?(0,le.jsxs)(le.Fragment,{children:[(0,le.jsxs)(cl.Y9Y,{"aria-label":aO("workspaceHeader"),className:x0.header,children:[(0,le.jsx)(cl.bCw,{prefix:"",children:y}),(0,le.jsx)("div",{className:x0.overlayHeaderSpacer}),(0,le.jsx)(cl.wdv,{className:x0.headerButtons,children:uk(i)?(0,le.jsxs)(le.Fragment,{children:[(E||g)&&(0,le.jsx)(cl.V8d,{"aria-label":g?aO("minimize"):aO("maximize"),onClick:()=>p(h,!g),children:g?(0,le.jsx)(xX.Xj,{}):(0,le.jsx)(xX.hz,{})}),x&&(0,le.jsx)(cl.V8d,{"aria-label":aO("hide"),onClick:()=>f(),children:(0,le.jsx)(cC,{})}),!D&&(0,le.jsx)(cl.V8d,{"aria-label":aO("close"),onClick:a,children:(0,le.jsx)(cH,{})})]}):(0,le.jsxs)(le.Fragment,{children:[x&&(0,le.jsx)(cl.V8d,{"aria-label":aO("hide"),onClick:()=>f(),children:(0,le.jsx)(xQ.d3,{})}),(0,le.jsx)(cl.V8d,{"aria-label":aO("close"),onClick:()=>{D?xS():a()},children:(0,le.jsx)(cH,{})})]})})]}),o]}):(0,le.jsx)(cl.OuH,{className:x0.loader,description:`${aO("loading")} ...`})})})]})},x3=({openedWindow:e,groupProps:t,actions:r,renderChrome:n,showActionMenu:a})=>{let{openedWorkspaces:o}=e,[i,s]=(0,s9.useState)({}),l=li(sK,x1),u=(0,s9.useRef)(new Set);return(0,s9.useEffect)(()=>{let e=!1;return Promise.all(o.map(async t=>{let r=l[t.workspaceName];if(!r)return null;let{moduleName:n,component:a}=r;try{return[t.uuid,await u1(n,a)]}catch(r){return e||u.current.has(t.uuid)||(u.current.add(t.uuid),k(r)),[t.uuid,null]}})).then(t=>{e||s(Object.fromEntries(t.filter(e=>null!=e)))},k),()=>{e=!0}},[o,l]),(0,le.jsx)(le.Fragment,{children:o.map((s,l)=>(0,le.jsx)(x4,{openedWorkspace:s,openedWindow:e,groupProps:t,actions:r,renderChrome:n,lifeCycle:i[s.uuid],isRootWorkspace:0===l,isLeafWorkspace:l===o.length-1,showActionMenu:a},s.uuid))})},x6=e=>e.registeredWorkspacesByName,x5=({name:e,workspaceProps:t,windowProps:r,groupProps:n,onWindowChanged:a})=>{let o=li(sK,x6),i=li(sK,t=>{let r=t.registeredWorkspacesByName[e]?.window;return r?t.registeredWindowsByName[r]:void 0}),s={name:e,workspaceProps:t,windowProps:r,groupProps:n},l=(0,s9.useRef)(),u=(0,s9.useRef)(null);if(!l.current){let a=xU(e,t,r);l.current=V({openedWindow:a,groupProps:n??null}),a&&(u.current=s)}let c=l.current;(0,s9.useEffect)(()=>{let a=u.current;if(a&&a.name===e&&T(a.workspaceProps,t)&&T(a.windowProps,r)&&T(a.groupProps,n))return;let o=xU(e,t,r);c.setState({openedWindow:o,groupProps:n??null},!0),u.current=o?s:null},[e,t,r,n,o,c]);let d=(0,s9.useMemo)(()=>(function(e){function t(t){e.setState(e=>{if(!e.openedWindow)return e;let r=t(e.openedWindow);return r===e.openedWindow?e:{...e,openedWindow:r}})}return{closeWorkspace(e){t(t=>xO(t,e))},openChildWorkspace(e,r,n){t(t=>xN(t,e,r,n))},setWorkspaceTitle(e,r){t(t=>xM(t,e,{title:r}))},setHasUnsavedChanges(e,r){t(t=>xM(t,e,{hasUnsavedChanges:r}))},promptForClosingWorkspaces(t){let{openedWindow:r}=e.getState();return r?x$(r,t):Promise.resolve(!0)}}})(c),[c]),{openedWindow:m,groupProps:p}=li(c),f=m?.openedWorkspaces[m.openedWorkspaces.length-1],h=f?.workspaceName??null,g=f?.title??"",y=m?.openedWorkspaces.some(e=>e.hasUnsavedChanges)??!1,v=i?.width??"narrow",b=(0,s9.useRef)(a);return(0,s9.useEffect)(()=>{b.current=a}),(0,s9.useEffect)(()=>{b.current?.({workspaceName:h,windowWidth:v,title:g,hasUnsavedChanges:y})},[h,v,g,y]),(0,le.jsx)("div",{className:"-esm-report-builder__exported-workspace-module__exportedWorkspace___5yaCt",children:m?(0,le.jsx)(x3,{openedWindow:m,groupProps:p,actions:d,renderChrome:!1,showActionMenu:!1}):null})},x9="-esm-report-builder__action-menu-button2-module__container___qxTbB",x8="-esm-report-builder__action-menu-button2-module__elementContainer___MzyUg",x7="-esm-report-builder__action-menu-button2-module__active___nMKHE",_e="-esm-report-builder__action-menu-button2-module__focused___ncbDv";function _t({getIcon:e,hasUnsavedChanges:t,tagContent:r}){return(0,le.jsxs)(le.Fragment,{children:[e({size:16}),t?(0,le.jsx)("span",{className:"-esm-report-builder__action-menu-button2-module__interruptedTag___HSn-T",children:"!"}):(0,le.jsx)("span",{className:"-esm-report-builder__action-menu-button2-module__countTag___bUcY2",children:r})]})}let _r=({icon:e,label:t,tagContent:r,workspaceToLaunch:n,onBeforeWorkspaceLaunch:a,hidden:o,disabled:i})=>{let s=uC(),{openedWindows:l,restoreWindow:u,hideWindow:c,isMostRecentlyOpenedWindowHidden:d}=xA(),{extension:m}=(0,s9.useContext)(s7),p=l.findIndex(e=>e.windowName===m?.extensionId),f=l[p],h=null!=f,g=h&&(p<l.length-1||d),y=h&&!g,v=f?.openedWorkspaces.some(e=>e.hasUnsavedChanges)??!1,b=async()=>{if(h)g?u(f.windowName):c();else if(await (a?.()??!0)){let{workspaceName:e,workspaceProps:t,windowProps:r}=n;xC(e,t,r)}};return o?.(l)?null:"tablet"===s||"phone"===s?(0,le.jsxs)(cl.$nd,{className:cn()(x9,{[x7]:h&&!y,[_e]:y}),iconDescription:t,kind:"ghost",onClick:b,role:"button",tabIndex:0,size:"md",disabled:i?.(l),children:[(0,le.jsx)("span",{className:x8,children:(0,le.jsx)(_t,{hasUnsavedChanges:v,getIcon:e,tagContent:r})}),(0,le.jsx)("span",{children:t})]}):(0,le.jsx)(cl.K0,{align:"left","aria-label":t,className:cn()(x9,{[x7]:h&&!y,[_e]:y}),enterDelayMs:300,kind:"ghost",label:t,onClick:b,size:"md",disabled:i?.(l),children:(0,le.jsx)("div",{className:x8,children:(0,le.jsx)(_t,{hasUnsavedChanges:v,getIcon:e,tagContent:r})})})};function _n({showContactDetails:e,toggleContactDetails:t,className:r}){return(0,le.jsx)(cl.$nd,{className:r,iconDescription:"Toggle contact details",kind:"ghost",onClick:t,renderIcon:e?cW:cB,children:e?aO("showLess","Show less"):aO("showMore","Show more")})}let _a={contactDetails:"-esm-report-builder__patient-banner-contact-details-module__contactDetails___+ytje",deceased:"-esm-report-builder__patient-banner-contact-details-module__deceased___mxjtl",heading:"-esm-report-builder__patient-banner-contact-details-module__heading___wxIC0",row:"-esm-report-builder__patient-banner-contact-details-module__row___dafkX",col:"-esm-report-builder__patient-banner-contact-details-module__col___vGkbd",relationship:"-esm-report-builder__patient-banner-contact-details-module__relationship___ZOV9O"},_o=({patientUuid:e})=>{let{cohorts:t=[],isLoading:r}=function(e){let t=e?`${az}/cohortm/cohortmember?patient=${e}&v=custom:(uuid,patient:ref,cohort:(uuid,name,startDate,endDate))`:null,{data:r,isLoading:n}=(0,lN.u)(t,aY),a=r?.data?.results.map(e=>({uuid:e.cohort.uuid,name:e.cohort.name,startDate:e.cohort.startDate,endDate:e.cohort.endDate}));return(0,s9.useMemo)(()=>({cohorts:a,isLoading:n}),[n,a])}(e);return(0,le.jsxs)(le.Fragment,{children:[(0,le.jsxs)("p",{className:_a.heading,children:[aO("patientLists","Patient Lists")," (",t?.length??0,")"]}),r?(0,le.jsx)(cl.OuH,{description:`${aO("loading","Loading")} ...`,role:"progressbar"}):(0,le.jsxs)("ul",{children:[(()=>{if(t?.length>0){let e=t.sort((e,t)=>wv(e?.startDate).getTime()-wv(t?.startDate).getTime()).slice(0,3);return e?.map(e=>(0,le.jsx)("li",{children:(0,le.jsx)(lt,{to:`${window.spaBase}/home/patient-lists/${e.uuid}`,children:e.name},e.uuid)},e.uuid))}return(0,le.jsx)("li",{children:"--"})})(),t.length>3&&(0,le.jsx)("li",{className:_a.link,children:(0,le.jsx)(lt,{to:`${window.spaBase}/home/patient-lists`,children:aO("seeMoreLists","See {{count}} more lists",{count:t?.length-3})})})]})]})},_i=({patientId:e})=>{let{patient:t,isLoading:r}=uL(e),n=t?.address?.find(e=>"home"===e.use),a=e=>e.split("#")[1];return r?(0,le.jsx)(cl.OuH,{description:`${aO("loading","Loading")} ...`,role:"progressbar"}):(0,le.jsxs)(le.Fragment,{children:[(0,le.jsx)("p",{className:_a.heading,children:aO("address","Address")}),(0,le.jsx)("ul",{children:n?Object.entries(n).filter(([e])=>"id"!==e&&"use"!==e).map(([e,t])=>"extension"===e?n.extension?.[0]?.extension?.map((t,r)=>(0,le.jsxs)("li",{children:[aO(a(t.url),a(t.url)),": ",t.valueString]},`address-${e}-${r}`)):(0,le.jsxs)("li",{children:[aO(e,e),": ",t]},`address-${e}`)):(0,le.jsx)("li",{children:"--"})})]})},_s=({patientUuid:e})=>{let{isLoading:t,contactAttributes:r}=(e=>{let{contactAttributeTypes:t=[]}=l8({externalModuleName:"@openmrs/esm-patient-banner-app"}),{attributes:r,error:n,isLoading:a}=(e=>{let{data:t,error:r,isLoading:n}=ur(`${az}/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)))`,aY);return{isLoading:n,attributes:t?.data.person.attributes??[],error:r}})(e);return{contactAttributes:(0,s9.useMemo)(()=>r.filter(({attributeType:e})=>t?.some(t=>e.uuid===t)),[r,t]),isLoading:a,error:n}})(e),n=(0,s9.useMemo)(()=>r?[...r?.map(e=>[e.attributeType.display?aO(e.attributeType.display,e.attributeType.display):"",e.value])]:[],[r]);return(0,le.jsxs)(le.Fragment,{children:[(0,le.jsx)("p",{className:_a.heading,children:aO("contactDetails","Contact Details")}),t?(0,le.jsx)(cl.OuH,{description:`${aO("loading","Loading")} ...`,role:"progressbar"}):(0,le.jsx)("ul",{children:n.length?n.map(([e,t],r)=>(0,le.jsxs)("li",{children:[e,": ",t]},`${e}-${t}-${r}`)):(0,le.jsx)("li",{children:"--"})})]})},_l=({patientId:e})=>{let{data:t,isLoading:r}=function(e){let t=`${az}/relationship?v=custom:(display,uuid,personA:(age,display,birthdate,uuid),personB:(age,display,birthdate,uuid),relationshipType:(uuid,display,description,aIsToB,bIsToA))&person=${e}`,{data:r,error:n,isLoading:a,isValidating:o}=(0,lN.u)(e?t:null,aY),i=r?.data?.results?.length?function(e,t){let r=[];for(let n of t)e===n.personA.uuid?r.push({uuid:`${n.uuid}`,display:n.personB.display,relativeAge:n.personB.age,relativeUuid:n.personB.uuid,relationshipType:n.relationshipType.bIsToA}):r.push({uuid:`${n.uuid}`,display:n.personA.display,relativeAge:n.personA.age,relativeUuid:n.personA.uuid,relationshipType:n.relationshipType.aIsToB});return r}(e,r.data.results):null;return{data:r?i:null,error:n,isLoading:a,isValidating:o}}(e);return(0,le.jsxs)(le.Fragment,{children:[(0,le.jsx)("p",{className:_a.heading,children:aO("relationships","Relationships")}),r?(0,le.jsx)(cl.OuH,{description:`${aO("loading","Loading")} ...`,role:"progressbar"}):(0,le.jsx)("ul",{children:t&&t.length>0?(0,le.jsx)(le.Fragment,{children:t.map(e=>(0,le.jsxs)("li",{className:_a.relationship,children:[(0,le.jsx)("div",{children:(0,le.jsx)(lt,{to:`${window.spaBase}/patient/${e.relativeUuid}/chart`,children:e.display})}),(0,le.jsx)("div",{children:e.relationshipType}),(0,le.jsx)("div",{children:`${e.relativeAge?e.relativeAge:"--"} ${e.relativeAge?1===e.relativeAge?aO("yearAbbreviation","yr"):aO("yearsAbbreviation","yrs"):""}`})]},e.uuid))}):(0,le.jsx)("li",{children:"--"})})]})};function _u({patientId:e,deceased:t}){return(0,le.jsxs)("div",{className:cn()(_a.contactDetails,{[_a.deceased]:t}),children:[(0,le.jsxs)("div",{className:_a.row,children:[(0,le.jsx)("div",{className:_a.col,children:(0,le.jsx)(_i,{patientId:e})}),(0,le.jsx)("div",{className:_a.col,children:(0,le.jsx)(_s,{patientUuid:e})})]}),(0,le.jsxs)("div",{className:_a.row,children:[(0,le.jsx)("div",{className:_a.col,children:(0,le.jsx)(_l,{patientId:e})}),(0,le.jsx)("div",{className:_a.col,children:(0,le.jsx)(_o,{patientUuid:e})})]})]})}function _c(e){let t=document.querySelector("template#loading-spinner");if(t){let r=t.content.cloneNode(!0),n=Array.prototype.map.call(r.childNodes,e=>e);return e.appendChild(r),()=>n.forEach(e=>e.remove())}return()=>{}}let _d="-esm-report-builder__action-menu2-module__container___usAej";function _m({workspaceGroup:e,groupProps:t}){let r=uC(),{persistence:n}=e;return(0,le.jsx)("aside",{className:"-esm-report-builder__action-menu2-module__sideRail___dTm93",children:(0,le.jsxs)("div",{className:_d,children:["closable"==n&&uk(r)&&(0,le.jsx)(cl.K0,{align:"left",onClick:()=>xS(),label:aO("close"),kind:"ghost",children:(0,le.jsx)(cH,{})}),(0,le.jsx)(s7.Provider,{value:{moduleName:e.moduleName,featureName:e.name},children:(0,le.jsx)(lg,{className:_d,name:e.name,state:{groupProps:t}})})]})})}function _p(e){let t=new URL(e,window.location.origin).pathname,r=new URL(window.getOpenmrsSpaBase?.()??"/",window.location.origin).pathname,n=r.endsWith("/")?r.slice(0,-1):r,a=null;return n?n===t?a="/":t.startsWith(`${n}/`)&&(a=t.slice(n.length)):a=t,{full:t,spaRelative:a}}function _f(e){e&&(0,ly.createRoot)(e).render((0,le.jsx)(_h,{}))}function _h(){let{openedGroup:e,openedWindows:t,registeredGroupsByName:r,registeredWindowsByName:n}=xA();if((0,s9.useEffect)(()=>it("before-page-changed",t=>{let{newPage:n,cancelNavigation:a,oldUrl:o,newUrl:i}=t;if(!e)return;if(n)return void a(xS().then(e=>!e));let s=r[e.groupName],l=s?.scopePattern;l&&function(e,t,r){try{let n=new RegExp(e),a=_p(t),o=_p(r);if(null===a.spaRelative||null===o.spaRelative)return!0;let i=n.exec(a.spaRelative),s=n.exec(o.spaRelative);if(i&&s||(i=n.exec(a.full),s=n.exec(o.full)),!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)&&a(xS().then(e=>!e))}),[e,r]),!e)return null;let a=r[e.groupName],o=t.some(e=>e.maximized),{name:i}=a,s=Object.values(n).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,le.jsxs)("div",{className:cn()("-esm-report-builder__workspace-windows-and-menu-module__workspaceWindowsAndMenuContainer___CSZs-",{"-esm-report-builder__workspace-windows-and-menu-module__overlay___0kl8U":a.overlay,"-esm-report-builder__workspace-windows-and-menu-module__hasMaximizedWindow___+DcH9":o}),children:[(0,le.jsx)("div",{className:"-esm-report-builder__workspace-windows-and-menu-module__workspaceWindowsContainer___s8ddv",children:t.map(t=>(0,le.jsx)(_g,{openedWindow:t,groupProps:e.props,showActionMenu:s},t.windowName))}),s&&(0,le.jsx)(_m,{workspaceGroup:a,groupProps:e.props})]})}function _g({openedWindow:e,groupProps:t,showActionMenu:r}){let{windowName:n}=e,a=(0,s9.useMemo)(()=>({closeWorkspace(e){sK.setState(t=>xj.closeWorkspace(t,e))},openChildWorkspace(e,t,r){sK.setState(n=>xj.openChildWorkspace(n,e,t,r))},setWorkspaceTitle(e,t){sK.setState(r=>xj.setWorkspaceTitle(r,e,t))},setHasUnsavedChanges(e,t){sK.setState(r=>xj.setHasUnsavedChanges(r,e,t))},promptForClosingWorkspaces(e){let t=sK.getState().openedWindows.find(e=>e.windowName===n);return t?x$(t,e):Promise.resolve(!0)}}),[n]);return(0,le.jsx)(x3,{openedWindow:e,groupProps:t,actions:a,renderChrome:!0,showActionMenu:r})}function _y(e,t,r){if(null==e)return r;let n=bV(e);if(!n)return console.warn(`matchLocale: invalid requested locale tag: ${JSON.stringify(e)}`),r;let a=[];for(let e of t){let t=bV(e);if(!t){console.warn(`matchLocale: skipping invalid available locale tag: ${JSON.stringify(e)}`);continue}a.push({canonical:t,original:e})}let o=n;for(;o;){let e=a.find(e=>e.canonical===o);if(e)return e.original;let t=o+"-",r=a.find(e=>e.canonical.startsWith(t));if(r)return r.original;if("ht"===o){o="fr-HT";continue}let n=o.lastIndexOf("-");if(-1===n)break;let i=(o=o.slice(0,n)).lastIndexOf("-");-1!==i&&o.length-i==2&&(o=o.slice(0,i))}return r}function _v(e=window.localStorage){try{return e.getItem("test"),!0}catch{return!1}}function _b(e){return!!e&&e.constructor===Object}var _w=r(7638);function _E(e){let[t,r,n]=e.split(".");return`${t}.${r}.${n}`}function _D(e,t){return _w(function(e){let t=e.indexOf("-");if(t>=0){let r=_E(e.slice(0,t)),n=e.slice(t+1);return`${r}-${n}`}return _E(e)}(t),e,{includePrerelease:!0})}async function _x(e,t={}){let r,{shouldRetry:n,getDelay:a,onError:o}=t;n=n??(e=>e<=5),a=a??(e=>(function(e,t=!1){return 1e3*Math.pow(2,t?e+1:e)})(e));let i=0;do try{return await __(a(i)),await e()}catch(e){o?.(e,i),r=e}while(n(i++));throw r}async function __(e){if(!(e<=0))return new Promise(t=>setTimeout(t,e))}function _S(e,t,r,n){}function _C(e){}function _k(e){return Promise.resolve([])}function _P(e){return Promise.resolve([])}function _R(e){return Promise.resolve({success:!1,result:void 0,error:"No service worker has been registered. Offline-related features have been removed from the framework."})}function _T(e){return()=>{}}function _$(){return!0}}}]);
39
+ }`.trim(),document.head.prepend(n),o=HTMLElement.prototype.focus,Reflect.defineProperty(HTMLElement.prototype,"focus",{configurable:!0,writable:!0,value:function(e){let t=((e=document)=>e.activeElement)(),r=null!=t&&br(t);o.call(this,{...e,preventScroll:!0}),e&&e.preventScroll||bo(this,r)}}),i=d7(mW(document,"touchstart",t=>{let n=mK(t);e=gr(n)?n:gn(n,!0),r=!1;let a=n.ownerDocument.defaultView.getSelection();a&&!a.isCollapsed&&a.containsNode(n,!0)&&(r=!0),t.composedPath().some(e=>e instanceof HTMLInputElement&&"range"===e.type)&&(r=!0),"selectionStart"in n&&"selectionEnd"in n&&n.selectionStart<n.selectionEnd&&n.ownerDocument.activeElement===n&&(r=!0)},{passive:!1,capture:!0}),mW(document,"touchmove",t=>{if(2!==t.touches.length&&!r){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}),mW(document,"blur",e=>{let t=mK(e),r=e.relatedTarget;if(r&&br(r))r.focus({preventScroll:!0}),bo(r,br(t));else if(!r){let e=t.parentElement?.closest("[tabindex]");e?.focus({preventScroll:!0})}},!0)),()=>{t(),i(),n.remove(),Reflect.defineProperty(HTMLElement.prototype,"focus",{configurable:!0,writable:!0,value:o})}):d7((s=window.innerWidth-document.documentElement.clientWidth)>0&&("scrollbarGutter"in document.documentElement.style?mH(document.documentElement,"scrollbar-gutter","stable"):mH(document.documentElement,"padding-right",`${s}px`)),mH(document.documentElement,"overflow","hidden"))),()=>{0==--ba&&u()}}},[t])}({isDisabled:o||!t.isOpen}),(0,s9.useEffect)(()=>{if(t.isOpen&&n.current)if(o){var e,r,i=a?.current??n.current;let t=vB[vB.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,u,c,d,m,p,f;return e=[a?.current??n.current],o=(r={shouldUseInert:!0})instanceof(t=mV(e?.[0])).Element?{root:r}:r,i=o?.root??document.body,s=o?.shouldUseInert&&vL,l=new Set(e),u=new Set,c=(e,r)=>{s&&e instanceof t.HTMLElement?e.inert=r:r?e.setAttribute("aria-hidden","true"):(e.removeAttribute("aria-hidden"),e instanceof t.HTMLElement&&(e.inert=!1))},d=e=>{for(let t of e.querySelectorAll("[data-live-announcer], [data-react-aria-top-layer]"))l.add(t);let t=e=>{if(u.has(e)||l.has(e)||e.parentElement&&u.has(e.parentElement)&&"row"!==e.parentElement.getAttribute("role"))return NodeFilter.FILTER_REJECT;for(let t of l)if(mz(e,t))return NodeFilter.FILTER_SKIP;return NodeFilter.FILTER_ACCEPT},r=yv(mB(e),e,NodeFilter.SHOW_ELEMENT,{acceptNode:t}),n=t(e);if(n===NodeFilter.FILTER_ACCEPT&&m(e),n!==NodeFilter.FILTER_REJECT){let e=r.nextNode();for(;null!=e;)m(e),e=r.nextNode()}},m=e=>{let r=vF.get(e)??0;(s&&e instanceof t.HTMLElement?e.inert:"true"===e.getAttribute("aria-hidden"))&&0===r||(0===r&&c(e,!0),u.add(e),vF.set(e,r+1))},vB.length&&vB[vB.length-1].disconnect(),d(i),(p=new MutationObserver(e=>{for(let r of e)if("childList"===r.type&&r.target.isConnected&&![...l,...u].some(e=>mz(e,r.target)))for(let e of r.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&&d(e)}})).observe(i,{childList:!0,subtree:!0}),f={visibleNodes:l,hiddenNodes:u,observe(){p.observe(i,{childList:!0,subtree:!0})},disconnect(){p.disconnect()}},vB.push(f),()=>{for(let e of(p.disconnect(),u)){let t=vF.get(e);null!=t&&(1===t?(c(e,!1),vF.delete(e)):vF.set(e,t-1))}f===vB[vB.length-1]?(vB.pop(),vB.length&&vB[vB.length-1].observe()):vB.splice(vB.indexOf(f),1)}}},[o,t.isOpen,n,a]);let{focusWithinProps:y}=ft(e);return{popoverProps:mg(d,p,y),arrowProps:f,underlayProps:m,placement:h,triggerAnchorPoint:g}}({...a,offset:null!=(o=a.offset)?o:8,arrowRef:s,groupRef:d?c:l},e),y=a.popoverRef,v=bu(y,!!h)||a.isEntering||!1,b=mb({...a,defaultClassName:"react-aria-Popover",values:{trigger:a.trigger||null,placement:h,isEntering:v,isExiting:t}}),w=!a.isNonModal||"SubmenuTrigger"===a.trigger,[E,D]=(0,s9.useState)(!1);me(()=>{y.current&&D(w&&!y.current.querySelector("[role=dialog]"))},[y,w]),(0,s9.useEffect)(()=>{E&&("SubmenuTrigger"!==a.trigger||"pointer"!==bm)&&y.current&&!mZ(y.current)&&function(e){if(!e.isConnected)return;let t=mB(e);if("virtual"===bm){let r=((e=document)=>e.activeElement)(t);pR(()=>{let n=((e=document)=>e.activeElement)(t);(n===r||n===t.body)&&e.isConnected&&mL(e)})}else mL(e)}(y.current)},[E,y,a.trigger]);let x=(0,s9.useMemo)(()=>{let e=b.children;if(n)for(let t of n)e=s8().createElement(t.Provider,{value:null},e);return e},[b.children,n]),_={...m.style,"--trigger-anchor-point":g?`${g.x}px ${g.y}px`:void 0,...b.style},S=s8().createElement(mC.div,{...mg(mA(a,{global:!0}),m),...b,role:E?"dialog":void 0,tabIndex:E?-1:void 0,"aria-label":a["aria-label"],"aria-labelledby":a["aria-labelledby"],ref:y,slot:a.slot||void 0,style:_,dir:a.dir,"data-trigger":a.trigger,"data-placement":h,"data-entering":v||void 0,"data-exiting":t||void 0},!a.isNonModal&&s8().createElement(bl,{onDismiss:e.close}),s8().createElement(vA.Provider,{value:{...f,placement:h,ref:s}},x),s8().createElement(bl,{onDismiss:e.close}));return d?s8().createElement(v_,{...a,shouldContainFocus:E,isExiting:t,portalContainer:null!=(i=null!=r?r:null==c?void 0:c.current)?i:void 0},S):s8().createElement(v_,{...a,shouldContainFocus:E,isExiting:t,portalContainer:r},!a.isNonModal&&e.isOpen&&s8().createElement("div",{"data-testid":"underlay",...p,style:{position:"fixed",inset:0}}),s8().createElement("div",{ref:l,style:{display:"contents"}},s8().createElement(bk.Provider,{value:l},S)))}function bT(e){return e?.start!=null&&null!=e.end}let b$=(0,s9.createContext)(null),bO=(0,s9.createContext)(null),bN=(0,s9.createContext)(null),bM=(0,s9.createContext)(null),bI=[yf,fc,vI,ff],bj=(0,s9.forwardRef)(function(e,t){var r,n;[e,t]=mE(e,t,b$);let{validationBehavior:a}=mw(v$)||{},o=null!=(n=null!=(r=e.validationBehavior)?r:a)?n:"native",i=function(e){let t=bS(e),[r,n]=g5(e.value,e.defaultValue||null,e.onChange),[a]=(0,s9.useState)(r),o=r||e.placeholderValue||null,[i,s]=va(o,e.granularity),l=null!=r?r.toDate(s??"UTC"):null,u="hour"===i||"minute"===i||"second"===i,c=e.shouldCloseOnSelect??!0,[d,m]=(0,s9.useState)(null),[p,f]=(0,s9.useState)(null);if(r&&(d=r,"hour"in r&&(p=r)),o&&!(i in o))throw Error("Invalid granularity "+i+" for value "+o.toString());let h=r?.calendar.identifier==="gregory"&&"BC"===r.era,g=(0,s9.useMemo)(()=>({granularity:i,timeZone:s,hideTimeZone:e.hideTimeZone,hourCycle:e.hourCycle,shouldForceLeadingZeros:e.shouldForceLeadingZeros,showEra:h}),[i,e.hourCycle,e.shouldForceLeadingZeros,s,e.hideTimeZone,h]),{minValue:y,maxValue:v,isDateUnavailable:b}=e,w=(0,s9.useMemo)(()=>y8(r,y,v,b,g),[r,y,v,b,g]),E=y1({...e,value:r,builtinValidation:w}),D=E.displayValidation.isInvalid,x=e.validationState||(D?"invalid":null),_=(e,t)=>{n("timeZone"in t?t.set(h$(e)):hO(e,t)),m(null),f(null),E.commitValidation()};return{...E,value:r,defaultValue:e.defaultValue??a,setValue:n,dateValue:d,timeValue:p,setDateValue:r=>{let a="function"==typeof c?c():c;u?p||a?_(r,p||vr(e.defaultValue||e.placeholderValue)):m(r):(n(r),E.commitValidation()),a&&t.setOpen(!1)},setTimeValue:e=>{d&&e?_(d,e):f(e)},granularity:i,hasTime:u,...t,setOpen(n){!n&&!r&&d&&u&&_(d,p||vr(e.defaultValue||e.placeholderValue)),t.setOpen(n)},validationState:x,isInvalid:D,formatValue:(e,t)=>l?new fj(e,vt(t,g)).format(l):"",getDateFormatter:(e,t)=>new fj(e,vt({},{...g,...t}))}}({...e,validationBehavior:o}),s=(0,s9.useRef)(null),[l,u]=mD(!e["aria-label"]&&!e["aria-labelledby"]),{groupProps:c,labelProps:d,fieldProps:m,buttonProps:p,dialogProps:f,calendarProps:h,descriptionProps:g,errorMessageProps:y,...v}=function(e,t,r){var n;let a=mp(),o=mp(),i=mp(),s=fJ((n=yF)&&n.__esModule?n.default:n,"@react-aria/datepicker"),{isInvalid:l,validationErrors:u,validationDetails:c}=t.displayValidation,{labelProps:d,fieldProps:m,descriptionProps:p,errorMessageProps:f}=yU({...e,labelElementType:"span",isInvalid:l,errorMessage:e.errorMessage||u}),h=yB(t,r),g=m["aria-labelledby"]||m.id,{locale:y}=fR(),v=t.formatValue(y,{month:"long"}),b=gu(v?s.format("selectedDateDescription",{date:v}):""),w=[b["aria-describedby"],m["aria-describedby"]].filter(Boolean).join(" ")||void 0,E=mA(e),D=(0,s9.useMemo)(()=>yM(r),[r]),x=(0,s9.useRef)(!1),{focusWithinProps:_}=ft({...e,isDisabled:t.isOpen,onBlurWithin:t=>{mz(document.getElementById(o),t.relatedTarget)||(x.current=!1,e.onBlur?.(t),e.onFocusChange?.(!1))},onFocusWithin:t=>{x.current||(x.current=!0,e.onFocus?.(t),e.onFocusChange?.(!0))}});return{groupProps:mg(E,h,m,b,_,{role:"group","aria-disabled":e.isDisabled||null,"aria-labelledby":g,"aria-describedby":w,onKeyDown(r){!t.isOpen&&e.onKeyDown&&e.onKeyDown(r)},onKeyUp(r){!t.isOpen&&e.onKeyUp&&e.onKeyUp(r)}}),labelProps:{...d,onClick:()=>{D.focusFirst()}},fieldProps:{...m,id:i,[yK]:"presentation","aria-describedby":w,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,[y0]:t,autoFocus:e.autoFocus,name:e.name,form:e.form},descriptionProps:p,errorMessageProps:f,buttonProps:{...b,id:a,"aria-haspopup":"dialog","aria-label":s.format("calendar"),"aria-labelledby":`${a} ${g}`,"aria-describedby":w,"aria-expanded":t.isOpen,isDisabled:e.isDisabled||e.isReadOnly,onPress:()=>t.setOpen(!0)},dialogProps:{id:o,"aria-labelledby":`${a} ${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:u,validationDetails:c}}({...mx(e),label:u,validationBehavior:o},i,s),[b,w]=(0,s9.useState)(null),E=(0,s9.useCallback)(()=>{s.current&&w(s.current.offsetWidth+"px")},[]);v5({ref:s,onResize:E});let{focusProps:D,isFocused:x,isFocusVisible:_}=fr({within:!0}),S=mb({...e,values:{state:i,isFocusWithin:x,isFocusVisible:_,isDisabled:e.isDisabled||!1,isInvalid:i.isInvalid,isOpen:i.isOpen,isReadOnly:e.isReadOnly||!1,isRequired:e.isRequired||!1},defaultClassName:"react-aria-DatePicker"}),C=mA(e,{global:!0});return delete C.id,s8().createElement(mv,{values:[[bN,i],[yf,{...c,ref:s,isInvalid:i.isInvalid}],[vf,m],[fc,{...p,isPressed:i.isOpen}],[vI,{...d,ref:l,elementType:"span"}],[yr,h],[vC,i],[bC,{trigger:"DatePicker",triggerRef:s,placement:"bottom start",style:{"--trigger-width":b},clearContexts:bI}],[vS,f],[ff,{slots:{description:g,errorMessage:y}}],[vP,v]]},s8().createElement(mC.div,{...mg(C,S,D),ref:t,slot:e.slot||void 0,"data-focus-within":x||void 0,"data-invalid":i.isInvalid||void 0,"data-focus-visible":_||void 0,"data-disabled":e.isDisabled||void 0,"data-readonly":e.isReadOnly||void 0,"data-required":e.isRequired||void 0,"data-open":i.isOpen||void 0}),s8().createElement(vM,{autoComplete:e.autoComplete,name:e.name,isDisabled:e.isDisabled,state:i}))}),bA=(0,s9.forwardRef)(function(e,t){var r,n;[e,t]=mE(e,t,bO);let{validationBehavior:a}=mw(v$)||{},o=null!=(n=null!=(r=e.validationBehavior)?r:a)?n:"native",i=function(e){let t=bS(e),[r,n]=g5(e.value,e.defaultValue||null,e.onChange),[a]=(0,s9.useState)(r),[o,i]=(0,s9.useState)(()=>r||{start:null,end:null});null==r&&o.start&&o.end&&i(o={start:null,end:null});let s=r||o,l=e=>{i(s=e||{start:null,end:null}),bT(s)?n(s):n(null)},[u,c]=va(s?.start||s?.end||e.placeholderValue||null,e.granularity),d="hour"===u||"minute"===u||"second"===u,m=e.shouldCloseOnSelect??!0,[p,f]=(0,s9.useState)(null),[h,g]=(0,s9.useState)(null);s&&bT(s)&&(p=s,"hour"in s.start&&(h=s));let y=(e,t)=>{l({start:"timeZone"in t.start?t.start.set(h$(e.start)):hO(e.start,t.start),end:"timeZone"in t.end?t.end.set(h$(e.end)):hO(e.end,t.end)}),f(null),g(null),C.commitValidation()},v=r=>{let n="function"==typeof m?m():m;d?bT(r)&&(n||h?.start&&h?.end)?y(r,{start:h?.start||vr(e.placeholderValue),end:h?.end||vr(e.placeholderValue)}):f(r):bT(r)?(l(r),C.commitValidation()):f(r),n&&t.setOpen(!1)},b=e=>{bT(p)&&bT(e)?y(p,e):g(e)},w=s?.start?.calendar.identifier==="gregory"&&"BC"===s.start.era||s?.end?.calendar.identifier==="gregory"&&"BC"===s.end.era,E=(0,s9.useMemo)(()=>({granularity:u,timeZone:c,hideTimeZone:e.hideTimeZone,hourCycle:e.hourCycle,shouldForceLeadingZeros:e.shouldForceLeadingZeros,showEra:w}),[u,e.hourCycle,e.shouldForceLeadingZeros,c,e.hideTimeZone,w]),{minValue:D,maxValue:x,isDateUnavailable:_}=e,S=(0,s9.useMemo)(()=>{var e,t;let r;return e=s,t=_?e=>_(e,null):void 0,r=y6(y8(e?.start??null,D,x,t,E),y8(e?.end??null,D,x,t,E)),e?.end!=null&&null!=e.start&&0>e.end.compare(e.start)&&(r=y6(r,{isInvalid:!0,validationErrors:[(fz.getGlobalDictionaryForPackage("@react-stately/datepicker")||y5).getStringForLocale("rangeReversed",y9())],validationDetails:{...yq,rangeUnderflow:!0,rangeOverflow:!0,valid:!1}})),r},[s,D,x,_,E]),C=y1({...e,value:r,name:(0,s9.useMemo)(()=>[e.startName,e.endName].filter(e=>null!=e),[e.startName,e.endName]),builtinValidation:S}),k=C.displayValidation.isInvalid,P=e.validationState||(k?"invalid":null);return{...C,value:s,defaultValue:e.defaultValue??a,setValue:l,dateRange:p,timeRange:h,granularity:u,hasTime:d,setDate(e,t){"start"===e?v({start:t,end:p?.end??null}):v({start:p?.start??null,end:t})},setTime(e,t){"start"===e?b({start:t,end:h?.end??null}):b({start:h?.start??null,end:t})},setDateTime(e,t){"start"===e?l({start:t,end:s?.end??null}):l({start:s?.start??null,end:t})},setDateRange:v,setTimeRange:b,...t,setOpen(r){!r&&!(s?.start&&s?.end)&&bT(p)&&d&&y(p,{start:h?.start||vr(e.placeholderValue),end:h?.end||vr(e.placeholderValue)}),t.setOpen(r)},validationState:P,isInvalid:k,formatValue(t,r){let n;if(!s||!s.start||!s.end)return null;let a="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"),u=vt(r,{granularity:o,timeZone:a,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}),c=s.start.toDate(a||"UTC"),d=s.end.toDate(i||"UTC"),m=new fj(t,u);if(a===i&&o===l&&0!==s.start.compare(s.end)){try{let e=m.formatRangeToParts(c,d),t=-1;for(let r=0;r<e.length;r++){let n=e[r];if("shared"===n.source&&"literal"===n.type)t=r;else if("endRange"===n.source)break}let r="",n="";for(let a=0;a<e.length;a++)a<t?r+=e[a].value:a>t&&(n+=e[a].value);return{start:r,end:n}}catch{}n=m}else n=new fj(t,vt(r,{granularity:l,timeZone:i,hideTimeZone:e.hideTimeZone,hourCycle:e.hourCycle}));return{start:m.format(c),end:n.format(d)}},getDateFormatter:(e,t)=>new fj(e,vt({},{...E,...t}))}}({...e,validationBehavior:o}),s=(0,s9.useRef)(null),[l,u]=mD(!e["aria-label"]&&!e["aria-labelledby"]),{groupProps:c,labelProps:d,startFieldProps:m,endFieldProps:p,buttonProps:f,dialogProps:h,calendarProps:g,descriptionProps:y,errorMessageProps:v,...b}=function(e,t,r){var n;let a=fJ((n=yF)&&n.__esModule?n.default:n,"@react-aria/datepicker"),{isInvalid:o,validationErrors:i,validationDetails:s}=t.displayValidation,{labelProps:l,fieldProps:u,descriptionProps:c,errorMessageProps:d}=yU({...e,labelElementType:"span",isInvalid:o,errorMessage:e.errorMessage||i}),m=u["aria-labelledby"]||u.id,{locale:p}=fR(),f=t.formatValue(p,{month:"long"}),h=gu(f?a.format("selectedRangeDescription",{startDate:f.start,endDate:f.end}):""),g={"aria-label":a.format("startDate"),"aria-labelledby":m},y={"aria-label":a.format("endDate"),"aria-labelledby":m},v=mp(),b=mp(),w=yB(t,r),E=[h["aria-describedby"],u["aria-describedby"]].filter(Boolean).join(" ")||void 0,D=(0,s9.useMemo)(()=>yM(r,{accept:e=>e.id!==v}),[r,v]),x={[yG]:D,[yK]:"presentation","aria-describedby":E,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},_=mA(e),S=(0,s9.useRef)(!1),{focusWithinProps:C}=ft({...e,isDisabled:t.isOpen,onBlurWithin:t=>{mz(document.getElementById(b),t.relatedTarget)||(S.current=!1,e.onBlur?.(t),e.onFocusChange?.(!1))},onFocusWithin:t=>{S.current||(S.current=!0,e.onFocus?.(t),e.onFocusChange?.(!0))}}),k=(0,s9.useRef)(yX),P=(0,s9.useRef)(yX);return{groupProps:mg(_,w,u,h,C,{role:"group","aria-disabled":e.isDisabled||null,"aria-describedby":E,onKeyDown(r){!t.isOpen&&e.onKeyDown&&e.onKeyDown(r)},onKeyUp(r){!t.isOpen&&e.onKeyUp&&e.onKeyUp(r)}}),labelProps:{...l,onClick:()=>{D.focusFirst()}},buttonProps:{...h,id:v,"aria-haspopup":"dialog","aria-label":a.format("calendar"),"aria-labelledby":`${v} ${m}`,"aria-describedby":E,"aria-expanded":t.isOpen,isDisabled:e.isDisabled||e.isReadOnly,onPress:()=>t.setOpen(!0)},dialogProps:{id:b,"aria-labelledby":`${v} ${m}`},startFieldProps:{...g,...x,value:t.value?.start??null,defaultValue:t.defaultValue?.start,onChange:e=>t.setDateTime("start",e),autoFocus:e.autoFocus,name:e.startName,form:e.form,[y0]:{realtimeValidation:t.realtimeValidation,displayValidation:t.displayValidation,updateValidation(e){k.current=e,t.updateValidation(y6(e,P.current))},resetValidation:t.resetValidation,commitValidation:t.commitValidation}},endFieldProps:{...y,...x,value:t.value?.end??null,defaultValue:t.defaultValue?.end,onChange:e=>t.setDateTime("end",e),name:e.endName,form:e.form,[y0]:{realtimeValidation:t.realtimeValidation,displayValidation:t.displayValidation,updateValidation(e){P.current=e,t.updateValidation(y6(k.current,e))},resetValidation:t.resetValidation,commitValidation:t.commitValidation}},descriptionProps:c,errorMessageProps:d,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}}({...mx(e),label:u,validationBehavior:o},i,s),[w,E]=(0,s9.useState)(null),D=(0,s9.useCallback)(()=>{s.current&&E(s.current.offsetWidth+"px")},[]);v5({ref:s,onResize:D});let{focusProps:x,isFocused:_,isFocusVisible:S}=fr({within:!0}),C=mb({...e,values:{state:i,isFocusWithin:_,isFocusVisible:S,isDisabled:e.isDisabled||!1,isInvalid:i.isInvalid,isOpen:i.isOpen,isReadOnly:e.isReadOnly||!1,isRequired:e.isRequired||!1},defaultClassName:"react-aria-DateRangePicker"}),k=mA(e,{global:!0});return delete k.id,s8().createElement(mv,{values:[[bM,i],[yf,{...c,ref:s,isInvalid:i.isInvalid}],[fc,{...f,isPressed:i.isOpen}],[vI,{...d,ref:l,elementType:"span"}],[yn,g],[vC,i],[bC,{trigger:"DateRangePicker",triggerRef:s,placement:"bottom start",style:{"--trigger-width":w},clearContexts:bI}],[vS,h],[vf,{slots:{start:m,end:p}}],[ff,{slots:{description:y,errorMessage:v}}],[vP,b]]},s8().createElement(mC.div,{...mg(k,C,x),ref:t,slot:e.slot||void 0,"data-focus-within":_||void 0,"data-invalid":i.isInvalid||void 0,"data-focus-visible":S||void 0,"data-disabled":e.isDisabled||void 0,"data-readonly":e.isReadOnly||void 0,"data-required":e.isRequired||void 0,"data-open":i.isOpen||void 0}))});function bL(e){return s8().createElement(fP,e)}function bF(e,t,r=!1){if(null==e)return r?e:void 0;if("string"==typeof e&&!e)return r?null:void 0;if(e instanceof hb||e instanceof hE||e instanceof hD)return t?hN(e,t):e;{let r=uz()(e).toDate(),n=new hb(r.getFullYear(),r.getMonth()+1,r.getDate());return t?hN(n,t):n}}function bB(e){if(e)return e.toDate(hK())}function bV(e){if("string"==typeof e&&0!==e.trim().length)try{return new Intl.Locale(e.replace(/[_@]/g,"-")).toString()}catch{return}}function bU(e){let t=e??"",r=bV(t);if(!r)return t;try{return new Intl.DisplayNames([r],{type:"language"}).of(r)??t}catch{return t}}function bW(){let e=window.i18next.language,t=bV(e)??e;return"ht"===t&&(t="fr-HT"),t}if("u">typeof navigator){let e=navigator;ea=Array.isArray(e.languages)?e.languages[0]:e.language}else if("u">typeof process){let e=process.env;ea=e.LC_ALL||e.LC_MESSAGES||e.LANG||e.LANGUAGE}var bH=function(e){e=(e=e.replace(/_/g,"-")).replace(/[.:][\w-]*$/,"");try{return new Intl.Locale(e).baseName}catch(e){return"en-US"}}(ea||"en-US"),bz=class extends Date{invalid=null;isValid(){return!Number.isNaN(this.valueOf())}},bK={};for(let e=0;e<100;e++)bK[(e<=9?"0":"")+e]=e+(e>51?1900:2e3);var bG={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},bZ="[1234567890一二三四五六七八九〇\\d]",bY={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},bq={},bJ={"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},bX={zone:bJ,year:bK,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:{}},bQ={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(bJ).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,}"},b0={...bQ,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}"},b1={},b4=class e{locale;lookups;vars;numberingSystem;baseName;dateOptions;static factory(t=bH){return b1[t.toLowerCase()]||(b1[t.toLowerCase()]=new e(t)),b1[t.toLowerCase()]}constructor(e=bH){this.locale=e,this.lookups={...bX},this.vars={...bQ};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 r=0;r<e.length;r++)t+=String(this.lookups.digit[e[r]]);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 r=this.lookups.meridiem[t?.toLowerCase()]||0,n=this.toInt(e);return n<12&&12===r&&(n+=12),12===n&&0===r&&(n=0),n}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,r,n]=t;return("-"===e||"−"===e?-1:1)*(60*this.toInt(r)+this.toInt(n||0))}return 0}build(){"latn"===this.dateOptions.numberingSystem?this.lookups.digit=bY: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(bq[e])return bq[e];if("fullwide"===e||"hanidec"===e)return{group:bZ,lookup:{...bY}};let t=bG[e];if(!t)return{group:"\\d",lookup:{...bY}};let r=String.fromCharCode(t),n=String.fromCharCode(t+9),a={};for(let e=0;e<10;e++)a[String.fromCharCode(t+e)]=e;return bq[e]={group:`[${r}-${n}]`,lookup:a},bq[e]}(this.numberingSystem);for(let r in this.lookups.digit=t,b0)b0.hasOwnProperty(r)&&(this.vars[r]=b0[r].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((r,n)=>{["","k","kuu","kuuta"].forEach((a,o)=>{e[r+a+(o<2?"\\.?":"")]=!0,t[r+a]=n+1})});else{let r=[],n=e=>"month"===e.type;for(let e=0;e<12;e++)r.push(new Date(2017,e,1));for(let a of["full","long","medium"]){let o=Intl.DateTimeFormat(this.locale,{dateStyle:a});for(let i=0;i<12;i++){let s=o.formatToParts(r[i]).find(n).value.toLocaleLowerCase(this.locale);/^\d+$/.test(s)||(/^ko/i.test(this.locale)&&(s+="월"),"medium"===a?(s=s.replace(/\.$/,""),e[`${s}\\.?`]=!0):e[s]=!0,t[s]=i+1)}}let a=Intl.DateTimeFormat(this.locale,{month:"short"});for(let o=0;o<12;o++){let i=a.formatToParts(r[o]).find(n).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 r=[],n={};for(let a of["long","short"]){let o=Intl.DateTimeFormat(this.locale,{weekday:a});for(let i=0;i<7;i++){let s=o.formatToParts(e[i]).find(t).value.toLocaleLowerCase(this.locale);"short"===a?(s=s.replace(/\.$/,""),r.push(`${s}\\.?`)):r.push(s),n[s]=i}}this.vars.DAYNAME=r.join("|"),this.lookups.dayname=n}buildMeridiems(){let e=[new Date(2017,0,1),new Date(2017,0,1,23,0,0)],t=e=>"dayPeriod"===e.type,r=[],n={},a=Intl.DateTimeFormat(this.locale,{timeStyle:"long"});for(let o=0;o<2;o++){let i=a.formatToParts(e[o]).find(t);if(!i)return;let s=i.value.toLocaleLowerCase(this.locale);r.push(s),n[s]=12*o}this.vars.MERIDIEM=r.join("|"),this.lookups.meridiem=n}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")}},b2=["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"],b3={y:"year",M:"month",d:"day",w:"week",h:"hour",m:"minute",s:"second",ms:"millisecond"},b6=()=>new Date;function b5(e){return function(t){let r={};for(let n=0,a=e.length;n<a;n++){let a=e[n];a&&(r[a]=t[n])}return r}}var b9=class{doneChecker;fallback;patterns;formatter;constructor({doneChecker:e,fallback:t,patterns:r,formatter:n}){this.doneChecker=e,this.fallback=t,this.patterns=r,this.formatter=n}attempt(e){if("string"!=typeof e)return this.fallback(e);let t=e.trim(),r={},n=!1;for(let e of this.patterns){let a=t.match(e.regex);if(!a)continue;n=!0;let o=e.handler(a);if(o){for(let[e,t]of Object.entries(o))e in r||void 0===t||(r[e]=t);if(t=(t=t.slice(0,a.index)+t.slice(a.index+a[0].length+1)).trim(),this.doneChecker(r,t))break}}return n?this.formatter(r):this.fallback(e)}},b8=["year","month","day","hour","minute","second","millisecond","offset"],b7={};function we(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 wt=[[/([^\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"]],wr={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," "],...wt],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:wt,id:wt,fr:[[/(\d{2}) h /,"$1:"],[/(\d{2}) min /,"$1:"],[/(\d{2}) s /,"$1"]]};function wn(e,t=bH){let r=function(e){if(!b7[e]){var t,r;let n,a,o=b4.factory(e);b7[e]=new b9({doneChecker:we,fallback:(t=e,function(e){let r=String(e).slice(0,50);return""===r&&(r="(empty string)"),{invalid:`Unable to parse "${r}" with locale "${t}"`}}),patterns:(n=[{name:"timestampWithOffset",regex:o.compile("^(_YEAR4_)-(_MONTH_)-(_DAY_)[T ](_H24_):(_MIN_):(_SEC_)(?:.(_MS_))? ?(_OFFSET_|Z)?$"),handler:b5(["","year","month","day","hour","minute","second","millisecond","offset"])},{name:"timestampWithZone",regex:o.compile("^(_YEAR4_)-(_MONTH_)-(_DAY_)[T ](_H24_):(_MIN_):(_SEC_)(?:.(_MS_))?\\s*(_ZONE_)$"),handler:b5(["","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:b5(["","year","month","day","hour","minute","second","millisecond","offset"])},{name:"chinese",regex:o.compile(`^(${bZ}{2,4})\\s*\u5E74\\s*(${bZ}{1,2})\\s*\u6708\\s*(${bZ}{1,2})\\s*\u65E5$`),handler:b5(["","year","month","day"])},{name:"korean",regex:o.compile("^(_YEAR_)년\\s*(_MONTH_)월\\s*(_DAY_)일$"),handler:b5(["","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:b5(["","monthname","day","hour","minute","second","offset","year"])},{name:"today",regex:/^(now|today|tomorrow|yesterday)$/i,handler:function(e){let t=b6(),r=e[0].toLowerCase(),n={now:0,today:0,tomorrow:864e5,yesterday:-864e5}[r];0!==n&&t.setTime(t.getTime()+n);let a={year:t.getFullYear(),month:t.getMonth()+1,day:t.getDate()};return"now"===r?{...a,hour:t.getHours(),minute:t.getMinutes(),second:t.getSeconds(),millisecond:t.getMilliseconds()}:a}},{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,r,n]){t=parseFloat(t),"week"===(r=r.length<=2?b3[r]:(r=r.replace(/s$/,"")).toLowerCase())&&(r="day",t*=7),("-"===e||n)&&(t*=-1);let a=b6();return"millisecond"===r?a.setUTCMilliseconds(a.getUTCMilliseconds()+t):"second"===r?a.setUTCSeconds(a.getUTCSeconds()+t):"minute"===r?a.setUTCMinutes(a.getUTCMinutes()+t):"hour"===r?a.setUTCHours(a.getUTCHours()+t):"day"===r?a.setUTCDate(a.getUTCDate()+t):"month"===r?a.setUTCMonth(a.getUTCMonth()+t):"year"===r&&a.setUTCFullYear(a.getUTCFullYear()+t),{year:a.getUTCFullYear(),month:a.getUTCMonth()+1,day:a.getUTCDate(),hour:a.getUTCHours(),minute:a.getUTCMinutes(),second:a.getUTCSeconds(),millisecond:a.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:b5(["","hour","minute","second","millisecond","zone"])},{name:"zone24",regex:o.compile("(_H24_):(_MIN_):(_SEC_)(?:\\.(_MS_))?[\\s\\[(]*(_ZONE_)?[\\s\\])]*$"),handler:b5(["","hour","minute","second","millisecond","zone"])},{name:"hms12WithOffset",regex:o.compile("(_H12_):(_MIN_):(_SEC_)\\s*(_MERIDIEM_)\\s*(_OFFSET_)"),handler:b5(["","hour","minute","second","meridiem","offset"])},{name:"hms12",regex:o.compile("(_H12_):(_MIN_):(_SEC_)\\s*(_MERIDIEM_)"),handler:b5(["","hour","minute","second","meridiem"])},{name:"hms24",regex:o.compile("(_H24_):(_MIN_):(_SEC_)(?:\\.(_MS_))?"),handler:b5(["","hour","minute","second","millisecond"])},{name:"hm12",regex:o.compile("(_H12_):(_MIN_)\\s*(_MERIDIEM_)"),handler:b5(["","hour","minute","meridiem"])},{name:"hm24",regex:o.compile("(_H24_):(_MIN_)"),handler:b5(["","hour","minute"])},{name:"h12",regex:o.compile("(_H12_)\\s*(_MERIDIEM_)"),handler:b5(["","hour","meridiem"])},{name:"8digit",regex:/^((?:19|20)\d{2})(\d{2})(\d{2})$/,handler:b5(["","year","month","day"])},{name:"yearMonthnameDay",regex:o.compile("(_YEAR4_)[\\s.-]+(_MONTHNAME_)[\\s,.-]+(_DAY_)(_ORDINAL_)?"),handler:b5(["","year","monthname","day"])},{name:"dayMonthnameYear",regex:o.compile("(_DAY_)(_ORDINAL_)?[\\s.-]*(_MONTHNAME_)[\\s,.-]+(_YEAR_)"),handler:b5(["","day","","monthname","year"])},{name:"monthnameDayYear",regex:o.compile("(_MONTHNAME_)[\\s.-]*(_DAY_)(_ORDINAL_)?[\\s,.-]+(_YEAR_)"),handler:b5(["","monthname","day","","year"])},{name:"dayMonthname",regex:o.compile("\\b(_DAY_)(_ORDINAL_)?[\\s.-]*(_MONTHNAME_)\\b"),handler:b5(["","day","","monthname"])},{name:"monthnameDay",regex:o.compile("\\b(_MONTHNAME_)[\\s.-]*(_DAY_)(_ORDINAL_)?\\b"),handler:b5(["","monthname","day"])},{name:"hmsNoMeridiem",regex:o.compile("\\b(_H12_|_H24_):(_MIN_):(_SEC_)\\b"),handler:b5(["","hour","minute","second"])},{name:"hmNoMeridiem",regex:o.compile("\\b(_H12_|_H24_):(_MIN_)\\b"),handler:b5(["","hour","minute"])},{name:"ymd",regex:o.compile("(_YEAR4_)([./-])(_MONTH_)\\2+(_DAY_)"),handler:b5(["","year","","month","day"])},{name:"mdy",regex:o.compile("(_MONTH_)([/-])(_DAY_)\\2(_YEAR_)"),handler:b5(["","month","","day","year"])},{name:"dmy",regex:o.compile("(_DAY_)(?:_ORDINAL_)?[./\\s-]+(_MONTH_)[./\\s-]+(_YEAR_)"),handler:b5(["","day","month","year"])},{name:"yearLoose",regex:o.compile("_YEAR4_"),handler:b5(["year"])},{name:"dayMonthnameLoose",regex:o.compile("(_DAY_)[\\s.]*(_MONTHNAME_)"),handler:b5(["","day","monthname"])},{name:"monthnameDayLoose",regex:o.compile("(_MONTHNAME_)[\\s.]*(_DAY_)"),handler:b5(["","monthname","day"])},{name:"monthname",regex:o.compile("_MONTHNAME_"),handler:b5(["monthname"])},{name:"year4",regex:o.compile("_YEAR4_"),handler:b5(["year"])},{name:"md",regex:o.compile("(_MONTH_)[/-](_DAY_)"),handler:b5(["","month","day"])},{name:"dm",regex:o.compile("(_DAY_)(?:_ORDINAL_)?[./\\s-]+(_MONTH_)"),handler:b5(["","day","month"])},{name:"day",regex:o.compile("_DAY_"),handler:b5(["day"])},{name:"year2",regex:o.compile("_YEAR2_"),handler:b5(["year"])},{name:"onlyZone",regex:o.compile("_ZONE_"),handler:b5(["zone"])},{name:"onlyOffset",regex:o.compile("_OFFSET_"),handler:b5(["offset"])}],a=o.baseName.slice(0,5),b2.includes(a)?n:n.filter(e=>!["mdy","md"].includes(e.name))),formatter:(r=o,function(e){let t={};for(let[n,a]of Object.entries(e))if("monthname"===n){if(a){let e=r.monthNameToInt(a);void 0!==e&&(t.month=e)}}else if("hour"===n&&e.meridiem){let n=r.h12ToInt(a,e.meridiem);void 0!==n&&(t.hour=n)}else if("zone"===n){if(a){let e=r.zoneToOffset(a);void 0!==e&&(t.offset=e)}}else if("offset"===n){let e=r.offsetToMinutes(a);void 0!==e&&(t.offset=e)}else if("millisecond"===n){let e=r.millisecondToInt(a);"number"==typeof e&&(t.millisecond=e)}else if(b8.includes(n)){let e=r.toInt(a);"number"==typeof e&&(t[n]=e)}return t.year<100&&(t.year=bK[e.year]),t.year&&"buddhist"===r.dateOptions.calendar&&(t.year-=543),t})})}return b7[e]}(t),n=function(e,t){let r=wr[t.slice(0,2).toLowerCase()];if(!r)return e;for(let[t,n]of r)e=e.replace(t,n);return e}(e,t);return r.attempt(n)}function wa(e){e.month&&e.day&&void 0===e.year&&(e.year=new Date().getFullYear()),60===e.second&&(e.second=59);let t=new bz(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 bz(t.valueOf()-60*e.offset*1e3):t}function wo(e,t=bH){let r=wn(e,t),n=r.invalid?new bz(NaN):wa(r);return n.isValid()||(n.invalid=`Unable to parse date "${e}"`),n}function wi(e,t=bH){return e instanceof Date?new bz(e.valueOf()):"number"==typeof e?new bz(e):wo(e,t)}Date.fromString=bz.fromString=wo,Date.fromAny=bz.fromAny=wi,"u">typeof window&&(window.anyDateParser={fromString:wo,fromAny:wi,fromObject:wa,attempt:wn});var ws=r(5238),wl=r(3826);let wu=function(e){return null==e};function wc(e,t){var r=function(e,t){if(!t.has(e))throw TypeError("attempted to get private field on non-instance");return t.get(e)}(e,t);return r.get?r.get.call(e):r.value}uH.extend(uK),uH.extend(wl),uH.extend(ws);let wd="YYYY-MM-DDTHH:mm:ss.SSSZZ",wm=/^(\d{4})(?:-(\d{2})(?:-(\d{2}))?)?$/;function wp(e,t){let r=wm.exec(e);if(!r)return wn(e,t);let n=Number(r[1]),a=void 0===r[2]?void 0:Number(r[2]),o=void 0===r[3]?void 0:Number(r[3]),i=new Date(0);return(i.setUTCFullYear(n,(a??1)-1,o??1),i.getUTCFullYear()!==n||i.getUTCMonth()!==(a??1)-1||i.getUTCDate()!==(o??1))?{invalid:`Invalid ISO calendar date '${e}'`}:{year:n,...void 0!==a&&{month:a},...void 0!==o&&{day:o}}}function wf(e){return null!=e&&28===e.trim().length&&"T"===(e=e.trim())[10]&&":"===e[13]&&":"===e[16]&&"."===e[19]&&("+"===e[23]||"-"===e[23])&&uH(e,wd).isValid()}function wh(e){return uH(e).isToday()}function wg(e){return wf(e)?uH(e,wd).toDate():null}function wy(e,t=!1){let r=uH(e);return t&&(r=r.utc()),r.format(wd)}function wv(e){return uH(e).toDate()}var wb=new WeakMap;let ww=new class{register(e,t){wc(this,wb).set(e,t)}getCalendar(e){if(!e)return;if(e.calendar)return e.calendar;if(e.region){let t=`${e.language}-${e.region}`;if(wc(this,wb).has(t))return wc(this,wb).get(t)}if(e.language&&wc(this,wb).has(e.language))return wc(this,wb).get(e.language);let t=new Intl.DateTimeFormat(e.toString()).resolvedOptions().calendar;return wc(this,wb).set(`${e.language}${e.region?`-${e.region}`:""}`,t),t}constructor(){!function(e,t,r){if(t.has(e))throw TypeError("Cannot initialize the same private elements twice on an object");t.set(e,r)}(this,wb,{writable:!0,value:new Map})}};function wE(e,t){ww.register(e,t)}function wD(e){let t=e??bW();return ww.getCalendar(t instanceof Intl.Locale?t:new Intl.Locale(t))}let wx={mode:"standard",time:"for today",day:!0,month:!0,year:!0,noToday:!1};function w_(e,t={}){let r=wp(e,bW());if(r.invalid)return console.warn(`Could not parse invalid date '${e}'`),null;!wu(r.day)&&wu(r.month)&&(r=Object.assign({},nc(r,"day"),{month:r.day})),r.month&&(r.month-=1),r.day&&(r=Object.assign({},nc(r,"day"),{date:r.day}));let n=uH().set(r).toDate();return wu(r.year)&&(t.year=!1),wu(r.month)&&(t.month=!1),wu(r.date)&&(t.day=!1),wS(n,t)}function wS(e,t){let r,n=t?.locale??bW(),a=new Intl.Locale(n),{calendar:o,mode:i,time:s,day:l,month:u,year:c,noToday:d,numberingSystem:m}={...wx,...{noToday:"am"===a.language},...t},p={calendar:o??wD(a),year:c?"numeric":void 0,month:u?"short":void 0,day:l?"2-digit":void 0,numberingSystem:m},f=uH(e).isToday();if(f&&!d)r=(r=new Intl.RelativeTimeFormat(n,{numeric:"auto"}).format(0,"day"))[0].toLocaleUpperCase(n)+r.slice(1);else{"en"===a.language&&(n="en-GB");let t=new Intl.DateTimeFormat(n,p).formatToParts(e);("en"===a.language||"am"===a.language)&&"standard"==i&&c&&l&&(t=t.map(wC("-"))),"wide"==i&&(t=t.map(wC(" — "))),"ethiopic"===p.calendar&&(t=t.filter((e,t,r)=>"era"!==e.type&&("literal"!==e.type||!(t<r.length-1)||"era"!==r[t+1].type))),r=t.map(e=>e.value).join("")}return(!0===s||f&&"for today"===s)&&(r+=`, ${wk(e)}`),r}let wC=e=>(t,r,n)=>"literal"!==t.type||" "!==t.value||r<n.length-1&&"era"===n[r+1].type?t:{type:"literal",value:e};function wk(e){return e.toLocaleTimeString(bW(),{hour:"2-digit",minute:"2-digit"})}function wP(e,t){return wS(e,{...t,time:!0})}function wR(e,t){let r=wD("string"==typeof t?new Intl.Locale(t):t);return r?hN(e,gJ(r)):e}function wT(e,t){return new Intl.DurationFormat(bW(),t).format(e)}function w$(e,t){if(null==e)return null;if("string"==typeof e){let r=wp(e,bW());return r.invalid?(console.warn(`Could not interpret '${e}' as a date`),null):(r.day&&!r.month&&(r={...nc(r,"day"),...{month:r.day}}),r.month&&(r.month-=1),r.day&&(r={...nc(r,"day"),...{date:r.day}}),uH(t).set(r))}return uH(e)}let wO=["years","months","days","hours","minutes","seconds"],wN={second:"seconds",minute:"minutes",hour:"hours",day:"days",month:"months",year:"years"},wM={seconds:45,minutes:45,hours:22,days:26,months:11,years:1/0};function wI(e,t=uH(),r){let n,a=uH(t),o=w$(e,a);if(null==o)return null;if("string"==typeof r){let e=wN[r]??r;return{[e]:a.diff(o,e)}}let{thresholds:i,largestUnit:s,smallestUnit:l}=r??{};if(void 0!==s||void 0!==l){let e,t=l?wN[l]??l:void 0;return e="auto"===s||void 0===s?function(e,t,r){let n=wO.indexOf(r);for(let a=0;a<wO.length;a++){let o=wO[a];if(t.diff(e,o)>0)return a<=n?o:r}return r}(o,a,t??"seconds"):wN[s]??s,function(e,t,r,n){let a=wO.indexOf(r),o=wO.indexOf(n),i=wO.slice(a,o+1),s={},l=e;for(let e of i){let r=t.diff(l,e);s[e]=r,l=l.add(r,e)}return s}(o,a,e,t??e)}let u=(n=function(e){let t={...wM};if(e)for(let[r,n]of Object.entries(e))void 0!==n&&(t[wN[r]??r]=n);return t}(i),a.diff(o,"seconds")<n.seconds?"seconds":a.diff(o,"minutes")<n.minutes?"minutes":a.diff(o,"hours")<n.hours?"hours":a.diff(o,"days")<n.days?"days":a.diff(o,"months")<n.months?"months":"years");return{[u]:a.diff(o,u)}}let wj={style:"short",localeMatcher:"lookup"};function wA(e,t=uH(),r){let n=wI(e,t,r);return null==n?null:wT(n,"object"==typeof r&&r.formatOptions?{...wj,...r.formatOptions}:wj)}let wL=(0,s9.createContext)(null);function wF(){let e=l8({externalModuleName:"@openmrs/esm-styleguide"}).preferredDateLocale,t=(0,s9.useMemo)(()=>{let t=bW();return e[t]&&(t=e[t]),t},[window.i18next.language]),r=(0,s9.useMemo)(()=>{let e=wD(t);return void 0!==e?gJ(e):void 0},[t]),n=(0,s9.useMemo)(()=>new Intl.Locale(t,{calendar:r?.identifier}),[t,r]),a=(0,s9.useMemo)(()=>r?hN(hU(hK()),r):hU(hK()),[r]);return{calendar:r,intlLocale:n,today_:a}}let wB=new hb(1793,1,1);var wV={};function wU(){return"u">typeof window&&window.InputEvent&&"function"==typeof InputEvent.prototype.getTargetRanges}function wW(e={}){let{locale:t}=fR();return(0,s9.useMemo)(()=>new(0,vu.K)(t,e),[t,e])}wV={"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 wH={};wH={"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 wz=()=>{};function wK(e){var t;let r=(0,s9.useRef)(void 0),{value:n,textValue:a,minValue:o,maxValue:i,isDisabled:s,isReadOnly:l,isRequired:u,onIncrement:c,onIncrementPage:d,onDecrement:m,onDecrementPage:p,onDecrementToMin:f,onIncrementToMax:h}=e,g=fJ((t=wH)&&t.__esModule?t.default:t,"@react-aria/spinbutton"),y=(0,s9.useRef)(!1),v=(0,s9.useCallback)(()=>{clearTimeout(r.current),y.current=!1},[]),b=pq(()=>{v()});(0,s9.useEffect)(()=>()=>b(),[]);let{keyboardProps:w}=pL({isDisabled:s||l,shortcuts:{PageUp:()=>d?void d():!!c&&void c(),ArrowUp:()=>!!c&&void c(),PageDown:()=>p?void p():!!m&&void m(),ArrowDown:()=>!!m&&void m(),Home:()=>!!f&&void f(),End:()=>!!h&&void h()},allowRepeats:!0}),E=(0,s9.useRef)(!1),D=()=>{E.current=!0},x=()=>{E.current=!1},_=""===a?g.format("Empty"):(a||`${n}`).replace("-","−");(0,s9.useEffect)(()=>{E.current&&(fT&&fT.clear("assertive"),f$(_,"assertive"))},[_]);let S=(0,s9.useCallback)(()=>{v()},[v]),C=pq(c??wz),k=pq(m??wz),P=pq(()=>{(void 0===i||isNaN(i)||void 0===n||isNaN(n)||n<i)&&(C(),R(60))}),R=pq(e=>{b(),y.current=!0,r.current=window.setTimeout(P,e)}),T=pq(()=>{(void 0===o||isNaN(o)||void 0===n||isNaN(n)||n>o)&&(k(),$(60))}),$=pq(e=>{b(),y.current=!0,r.current=window.setTimeout(T,e)}),O=e=>{e.preventDefault()},{addGlobalListener:N,removeAllGlobalListeners:M}=pJ(),I=(0,s9.useRef)(!1),[j,A]=(0,s9.useState)(null);(0,s9.useEffect)(()=>{"touch"===j?R(600):j?R(400):j||b()},[j]);let[L,F]=(0,s9.useState)(null);return(0,s9.useEffect)(()=>{"touch"===L?$(600):L?$(400):L||b()},[L]),{spinButtonProps:{role:"spinbutton","aria-valuenow":void 0===n||isNaN(n)?void 0:n,"aria-valuetext":_,"aria-valuemin":o,"aria-valuemax":i,"aria-disabled":s||void 0,"aria-readonly":l||void 0,"aria-required":u||void 0,...w,onFocus:D,onBlur:x},incrementButtonProps:{onPressStart:e=>{v(),"touch"!==e.pointerType?(c?.(),A("mouse")):(N(window,"pointercancel",S,{capture:!0}),I.current=!1,A("touch")),N(window,"contextmenu",O)},onPressUp:e=>{v(),"touch"===e.pointerType&&(I.current=!0),M(),A(null)},onPressEnd:e=>{v(),"touch"===e.pointerType&&!y.current&&I.current&&c?.(),I.current=!1,A(null)},onFocus:D,onBlur:x},decrementButtonProps:{onPressStart:e=>{v(),"touch"!==e.pointerType?(m?.(),F("mouse")):(N(window,"pointercancel",S,{capture:!0}),I.current=!1,F("touch"))},onPressUp:e=>{v(),"touch"===e.pointerType&&(I.current=!0),M(),F(null)},onPressEnd:e=>{v(),"touch"===e.pointerType&&!y.current&&I.current&&m?.(),I.current=!1,F(null)},onFocus:D,onBlur:x}}}let wG=null;var wZ=r(6284);function wY(e,t,r){let n="+"===e?t+r:t-r;if(t%1!=0||r%1!=0){let a=t.toString().split("."),o=r.toString().split("."),i=Math.pow(10,Math.max(a[1]&&a[1].length||0,o[1]&&o[1].length||0));t=Math.round(t*i),r=Math.round(r*i),n=("+"===e?t+r:t-r)/i}return n}let wq=(0,s9.createContext)(null),wJ=(0,s9.createContext)(null),wX=(0,s9.forwardRef)(function(e,t){var r,n;[e,t]=mE(e,t,wq);let{validationBehavior:a}=mw(v$)||{},o=null!=(n=null!=(r=e.validationBehavior)?r:a)?n:"native",{locale:i}=fR(),s=function(e){let{minValue:t,maxValue:r,step:n,formatOptions:a,value:o,defaultValue:i=NaN,onChange:s,locale:l,isDisabled:u,isReadOnly:c,commitBehavior:d="snap"}=e;null===o&&(o=NaN);let m=(0,s9.useCallback)(e=>void 0===n||isNaN(n)?vV(e,t,r):vW(e,t,r,n),[n,t,r]);void 0===o||isNaN(o)||"snap"!==d||(o=m(o)),isNaN(i)||"snap"!==d||(i=m(i));let[p,f]=g5(o,isNaN(i)?NaN:i,s),[h]=(0,s9.useState)(p),[g,y]=(0,s9.useState)(()=>isNaN(p)?"":new(0,vu.K)(l,a).format(p)),v=(0,s9.useMemo)(()=>new(0,wZ.d)(l,a),[l,a]),b=(0,s9.useMemo)(()=>v.getNumberingSystem(g),[v,g]),w=(0,s9.useMemo)(()=>new(0,vu.K)(l,{...a,numberingSystem:b}),[l,a,b]),E=(0,s9.useMemo)(()=>w.resolvedOptions(),[w]),D=(0,s9.useCallback)(e=>isNaN(e)||null===e?"":w.format(e),[w]),x=y1({...e,value:p}),_=void 0===n||isNaN(n)?1:n;"percent"===E.style&&(void 0===n||isNaN(n))&&(_=.01);let[S,C]=(0,s9.useState)(p),[k,P]=(0,s9.useState)(l),[R,T]=(0,s9.useState)(a);Object.is(p,S)&&l===k&&function(e,t){if(e===t)return!0;if(!e||!t)return!1;let r=Object.keys(e),n=Object.keys(t);if(r.length!==n.length)return!1;for(let n of r)if(t[n]!==e[n])return!1;return!0}(a,R)||(y(D(p)),C(p),P(l),T(a));let $=(0,s9.useMemo)(()=>v.parse(g),[v,g]),O=(e,n=0)=>{if(isNaN($))return vW(isNaN(n)?0:n,t,r,_);{let n=vW($,t,r,_);return"+"===e&&n>$||"-"===e&&n<$?n:vW(wY(e,$,_),t,r,_)}},N=(0,s9.useMemo)(()=>!u&&!c&&(isNaN($)||void 0===r||isNaN(r)||vW($,t,r,_)>$||wY("+",$,_)<=r),[u,c,t,r,_,$]),M=(0,s9.useMemo)(()=>!u&&!c&&(isNaN($)||void 0===t||isNaN(t)||vW($,t,r,_)<$||wY("-",$,_)>=t),[u,c,t,r,_,$]);return{...x,validate:e=>v.isValidPartialNumber(e,t,r),increment:()=>{let e=O("+",t);e===p&&y(D(e)),f(e),x.commitValidation()},incrementToMax:()=>{null!=r&&(f(vW(r,t,r,_)),x.commitValidation())},decrement:()=>{let e=O("-",r);e===p&&y(D(e)),f(e),x.commitValidation()},decrementToMin:()=>{null!=t&&(f(t),x.commitValidation())},canIncrement:N,canDecrement:M,minValue:t,maxValue:r,numberValue:$,defaultNumberValue:isNaN(i)?h:i,setNumberValue:f,setInputValue:y,inputValue:g,commit:e=>{let t=void 0===e?g:e,r=$;if(void 0!==e&&(r=v.parse(t)),!t.length){f(NaN),y(void 0===o?"":D(p));return}if(isNaN(r))return void y(D(p));let n="snap"===d?m(r):r,a=(n=v.parse(D(n)))!==p;f(n),y(D(void 0===o?n:p)),a&&x.commitValidation()}}}({...e,locale:i,validationBehavior:o}),l=(0,s9.useRef)(null),[u,c]=mD(!e["aria-label"]&&!e["aria-labelledby"]),{labelProps:d,groupProps:m,inputProps:p,incrementButtonProps:f,decrementButtonProps:h,descriptionProps:g,errorMessageProps:y,...v}=function(e,t,r){var n,a,o,i,s,l,u,c,d;let m,{id:p,decrementAriaLabel:f,incrementAriaLabel:h,isDisabled:g,isReadOnly:y,isRequired:v,minValue:b,maxValue:w,autoFocus:E,label:D,formatOptions:x,onBlur:_=()=>{},onFocus:S,onFocusChange:C,onKeyDown:k,onKeyUp:P,description:R,errorMessage:T,isWheelDisabled:$,...O}=e,{increment:N,incrementToMax:M,decrement:I,decrementToMin:j,numberValue:A,inputValue:L,commit:F,commitValidation:B}=t,V=fJ((n=wV)&&n.__esModule?n.default:n,"@react-aria/numberfield"),U=(0,s9.useCallback)(()=>{let e=r.current?.value??"";(0,pX.flushSync)(()=>{F()}),r.current?.value!==e&&f$(r.current?.value??"","assertive")},[F,r]),W=mp(p),{focusProps:H}=p$({onBlur(){U()}}),z=wW(x),K=(0,s9.useMemo)(()=>z.resolvedOptions(),[z]),G=wW({...x,currencySign:void 0}),Z=(0,s9.useMemo)(()=>isNaN(A)?"":G.format(A),[G,A]),{spinButtonProps:Y,incrementButtonProps:q,decrementButtonProps:J}=wK({isDisabled:g,isReadOnly:y,isRequired:v,maxValue:w,minValue:b,onIncrement:N,onIncrementToMax:M,onDecrement:I,onDecrementToMin:j,value:A,textValue:Z}),[X,Q]=(0,s9.useState)(!1),{focusWithinProps:ee}=ft({isDisabled:g,onFocusWithinChange:Q});!function(e,t){let{onScroll:r,isDisabled:n}=e,a=(0,s9.useCallback)(e=>{!e.ctrlKey&&(e.preventDefault(),e.stopPropagation(),r&&r({deltaX:e.deltaX,deltaY:e.deltaY}))},[r]);gt(t,"wheel",n?void 0:a)}({onScroll:(0,s9.useCallback)(e=>{!(Math.abs(e.deltaY)<=Math.abs(e.deltaX))&&(e.deltaY>0?N():e.deltaY<0&&I())},[I,N]),isDisabled:$||g||y||!X},r);let et=(K.maximumFractionDigits??0)>0,er=void 0===t.minValue||isNaN(t.minValue)||t.minValue<0,en="numeric";pt()?er?en="text":et&&(en="decimal"):pi()&&(er?en="numeric":et&&(en="decimal"));let ea=mA(e),{keyboardProps:eo}=pL({isDisabled:g||y,shortcuts:{Enter:()=>((0,pX.flushSync)(()=>{F()}),B(),{shouldPreventDefault:!1})},onKeyDown:k,onKeyUp:P}),{isInvalid:ei,validationErrors:es,validationDetails:el}=t.displayValidation,{labelProps:eu,inputProps:ec,descriptionProps:ed,errorMessageProps:em}=function(e,t,r){let n=pq(e=>{let n=r.current;if(!n)return;let a=null;switch(e.inputType){case"historyUndo":case"historyRedo":case"insertLineBreak":return;case"deleteContent":case"deleteByCut":case"deleteByDrag":a=n.value.slice(0,n.selectionStart)+n.value.slice(n.selectionEnd);break;case"deleteContentForward":a=n.selectionEnd===n.selectionStart?n.value.slice(0,n.selectionStart)+n.value.slice(n.selectionEnd+1):n.value.slice(0,n.selectionStart)+n.value.slice(n.selectionEnd);break;case"deleteContentBackward":a=n.selectionEnd===n.selectionStart?n.value.slice(0,n.selectionStart-1)+n.value.slice(n.selectionStart):n.value.slice(0,n.selectionStart)+n.value.slice(n.selectionEnd);break;case"deleteSoftLineBackward":case"deleteHardLineBackward":a=n.value.slice(n.selectionStart);break;default:null!=e.data&&(a=n.value.slice(0,n.selectionStart)+e.data+n.value.slice(n.selectionEnd))}null!=a&&t.validate(a)||e.preventDefault()});(0,s9.useEffect)(()=>{if(!wU()||!r.current)return;let e=r.current;return e.addEventListener("beforeinput",n,!1),()=>{e.removeEventListener("beforeinput",n,!1)}},[r]);let a=wU()?null:e=>{let r=mK(e).value.slice(0,mK(e).selectionStart)+e.data+mK(e).value.slice(mK(e).selectionEnd);t.validate(r)||e.preventDefault()},{labelProps:o,inputProps:i,descriptionProps:s,errorMessageProps:l,...u}=function(e,t){let{inputElementType:r="input",isDisabled:n=!1,isRequired:a=!1,isReadOnly:o=!1,type:i="text",validationBehavior:s="aria"}=e,[l,u]=g5(e.value,e.defaultValue||"",e.onChange),{focusableProps:c}=pV(e,t),d=y1({...e,value:l}),{isInvalid:m,validationErrors:p,validationDetails:f}=d.displayValidation,{labelProps:h,fieldProps:g,descriptionProps:y,errorMessageProps:v}=yU({...e,isInvalid:m,errorMessage:e.errorMessage||p}),b=mA(e,{labelable:!0}),w={type:i,pattern:e.pattern},[E]=(0,s9.useState)(l);return yW(t,e.defaultValue??E,u),yH(e,d,t),{labelProps:h,inputProps:mg(b,"input"===r?w:void 0,{disabled:n,readOnly:o,required:a&&"native"===s,"aria-required":a&&"aria"===s||void 0,"aria-invalid":m||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=>u(mK(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(s8().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,...c,...g}),descriptionProps:y,errorMessageProps:v,isInvalid:m,validationErrors:p,validationDetails:f}}(e,r),c=(0,s9.useRef)(null);return{inputProps:mg(i,{onBeforeInput:a,onCompositionStart(){let{value:e,selectionStart:t,selectionEnd:n}=r.current;c.current={value:e,selectionStart:t,selectionEnd:n}},onCompositionEnd(){if(r.current&&!t.validate(r.current.value)){let{value:e,selectionStart:n,selectionEnd:a}=c.current;r.current.value=e,r.current.setSelectionRange(n,a),t.setInputValue(e)}}}),labelProps:o,descriptionProps:s,errorMessageProps:l,...u}}({...O,...ea,name:void 0,form:void 0,label:D,autoFocus:E,isDisabled:g,isReadOnly:y,isRequired:v,validate:void 0,[y0]:t,value:L,defaultValue:"!",autoComplete:"off","aria-label":e["aria-label"]||void 0,"aria-labelledby":e["aria-labelledby"]||void 0,id:W,type:"text",inputMode:en,onChange:e=>{t.validate(e)&&t.setInputValue(e)},onBlur:_,onFocus:S,onFocusChange:C,onPaste:t=>{e.onPaste?.(t);let r=mK(t);r&&(r.selectionEnd??-1)-(r.selectionStart??0)===r.value.length&&(t.preventDefault(),F(t.clipboardData?.getData?.("text/plain")?.trim()??""))},description:R,errorMessage:T},t,r),ep=mg(eo,ec);yW(r,t.defaultNumberValue,t.setNumberValue),a=t,o=e.validationBehavior,i=e.commitBehavior,s=r,l=t.minValue,u=t.maxValue,c=e.step,d=t.numberValue,me(()=>{let e=s.current;if("validate"!==i||a.realtimeValidation.isInvalid||!e||e.disabled||(!wG&&"u">typeof document&&((wG=document.createElement("input")).type="number"),!wG))return;wG.min=null==l||isNaN(l)?"":String(l),wG.max=null==u||isNaN(u)?"":String(u),wG.step=null==c||isNaN(c)?"":String(c),wG.value=null==d||isNaN(d)?"":String(d);let t=e.validity.valid&&wG.validity.valid,r=e.validationMessage||wG.validationMessage,n={isInvalid:!t,validationErrors:r?[r]:[],validationDetails:{badInput:e.validity.badInput,customError:e.validity.customError,patternMismatch:e.validity.patternMismatch,rangeOverflow:wG.validity.rangeOverflow,rangeUnderflow:wG.validity.rangeUnderflow,stepMismatch:wG.validity.stepMismatch,tooLong:e.validity.tooLong,tooShort:e.validity.tooShort,typeMismatch:e.validity.typeMismatch,valueMissing:e.validity.valueMissing,valid:t}};a.updateValidation(n),"native"!==o||wG.validity.valid||e.setCustomValidity(wG.validationMessage)});let ef=mg(Y,H,ep,{role:null,"aria-roledescription":pn()?null:V.format("numberField"),"aria-valuemax":null,"aria-valuemin":null,"aria-valuenow":null,"aria-valuetext":null,autoCorrect:"off",spellCheck:"false"});"native"===e.validationBehavior&&(ef["aria-required"]=void 0);let eh=e=>{((e=document)=>e.activeElement)()!==r.current&&("mouse"===e.pointerType?r.current?.focus():e.target.focus())},eg=e["aria-label"]||("string"==typeof e.label?e.label:"");eg||(m=null!=e.label?eu.id:e["aria-labelledby"]);let ey=mp(),ev=mp(),eb=mg(q,{"aria-label":h||V.format("increase",{fieldLabel:eg}).trim(),id:m&&!h?ey:null,"aria-labelledby":m&&!h?`${ey} ${m}`:null,"aria-controls":W,excludeFromTabOrder:!0,preventFocusOnPress:!0,allowFocusWhenDisabled:!0,isDisabled:!t.canIncrement,onPressStart:eh}),ew=mg(J,{"aria-label":f||V.format("decrease",{fieldLabel:eg}).trim(),id:m&&!f?ev:null,"aria-labelledby":m&&!f?`${ev} ${m}`:null,"aria-controls":W,excludeFromTabOrder:!0,preventFocusOnPress:!0,allowFocusWhenDisabled:!0,isDisabled:!t.canDecrement,onPressStart:eh});return{groupProps:{...ee,role:"group","aria-disabled":g,"aria-invalid":ei?"true":void 0},labelProps:eu,inputProps:ef,incrementButtonProps:eb,decrementButtonProps:ew,errorMessageProps:em,descriptionProps:ed,isInvalid:ei,validationErrors:es,validationDetails:el}}({...mx(e),label:c,validationBehavior:o},s,l),b=mb({...e,values:{state:s,isDisabled:e.isDisabled||!1,isInvalid:v.isInvalid||!1,isRequired:e.isRequired||!1},defaultClassName:"react-aria-NumberField"}),w=mA(e,{global:!0});return delete w.id,s8().createElement(mv,{values:[[wJ,s],[yf,m],[yg,{...p,ref:l}],[vI,{...d,ref:u}],[fc,{slots:{increment:f,decrement:h}}],[ff,{slots:{description:g,errorMessage:y}}],[vP,v]]},s8().createElement(mC.div,{...w,...b,ref:t,slot:e.slot||void 0,"data-disabled":e.isDisabled||void 0,"data-required":e.isRequired||void 0,"data-invalid":v.isInvalid||void 0}),e.name&&s8().createElement("input",{type:"hidden",name:e.name,form:e.form,value:isNaN(s.numberValue)?"":s.numberValue,disabled:e.isDisabled||void 0}))});function wQ(e,t){return Number.parseInt(wS(e,{calendar:t.calendar,locale:t.baseName,day:!1,month:!1,noToday:!0,numberingSystem:"latn"}))}let w0=(0,s9.forwardRef)(function(e,t){let{className:r}=e,n=(0,s9.useContext)(ya),a=(0,s9.useContext)(yo),o=n??a,i=(0,s9.useContext)(wL),s=hK(),l=wS(o.visibleRange.start.toDate(s),{calendar:i.calendar,locale:i.baseName,day:!1,year:!1,noToday:!0}),u=wQ(o.visibleRange.start.toDate(s),i),c=o.maxValue?wQ(o.maxValue.toDate(s),i):void 0,d=o.minValue?wQ(o.minValue.toDate(s),i):void 0,m=(0,s9.useCallback)(e=>{o.setFocusedDate(o.focusedDate.cycle("year",e-o.focusedDate.year))},[]);return o&&(0,le.jsxs)("span",{ref:t,className:r,children:[(0,le.jsx)("span",{children:l}),(0,le.jsxs)(wX,{formatOptions:{useGrouping:!1},maxValue:c,minValue:d,onChange:m,value:u,children:[(0,le.jsx)(yy,{}),(0,le.jsxs)(yh,{children:[(0,le.jsx)(fd,{slot:"increment",children:(0,le.jsx)(cM,{size:8})}),(0,le.jsx)(fd,{slot:"decrement",children:(0,le.jsx)(c$,{size:8})})]})]})]})}),w1="-esm-report-builder__datepicker-module__inputGroup___8HE83",w4="-esm-report-builder__datepicker-module__inputSegment___bZPCL",w2="-esm-report-builder__datepicker-module__dateInputWrapper___ZGn+P",w3="-esm-report-builder__datepicker-module__invalidText___mb1DW",w6="-esm-report-builder__datepicker-module__flatButton___DL7RZ",w5="-esm-report-builder__datepicker-module__flatButtonMd___JZlIZ",w9="-esm-report-builder__datepicker-module__flatButtonSm___bOLZt",w8="-esm-report-builder__datepicker-module__flatButtonLg___IQPkt";function w7({children:e}){let t=(0,s9.useContext)(bN),r=(0,s9.useContext)(bM),n=t??r,a=uO(()=>n?.close());return(0,le.jsx)(vk,{className:"-esm-report-builder__datepicker-module__dialog___vu+V8",ref:a,children:e})}let Ee=(0,s9.forwardRef)(function({variant:e,today_:t,minDate:r,maxDate:n},a){let o="range"===e;return(0,le.jsx)(bP,{ref:a,className:"-esm-report-builder__datepicker-module__popover___rJRGV",placement:"bottom start",offset:1,isNonModal:!0,children:(0,le.jsx)(w7,{children:(0,le.jsxs)(o?ys:yi,{...o?{minValue:r,maxValue:n,className:"cds--date-picker__calendar"}:{},children:[(0,le.jsxs)("header",{className:"-esm-report-builder__datepicker-module__header___8V465",children:[(0,le.jsx)(fd,{className:cn()(w6,w5),slot:"previous",children:(0,le.jsx)(cV,{size:16})}),(0,le.jsx)(w0,{className:"-esm-report-builder__datepicker-module__monthYear___kwBXn"}),(0,le.jsx)(fd,{className:cn()(w6,w5),slot:"next",children:(0,le.jsx)(cU,{size:16})})]}),(0,le.jsx)(yu,{className:"-esm-report-builder__datepicker-module__calendarGrid___Po5J8",children:e=>(0,le.jsx)(yp,{className:cn()("cds--date-picker__day",{"-esm-report-builder__datepicker-module__today___EotRU":0===t.compare(e)}),date:e},e.toString())})]})})})}),Et=(0,s9.forwardRef)(function(e,t){let r=(0,s9.useContext)(bN),[n,a]=mE({slot:e.slot},t,vf),{locale:o}=fR(),i=vp({...n,locale:o,createCalendar:gJ}),s=(0,s9.useRef)(null),{fieldProps:l,inputProps:u}=yZ({...n,inputRef:s},i,a),c=(0,s9.useCallback)(()=>{i.isDisabled||r.toggle()},[]);return(0,le.jsxs)(mv,{values:[[vh,i],[yg,{...u,ref:s}],[yf,{...l,ref:a,isInvalid:i.isInvalid}]],children:[(0,le.jsx)(yh,{...e,id:e.id,ref:t,slot:e.slot||void 0,className:e.className,isDisabled:i.isDisabled,isInvalid:i.isInvalid,onClick:c,children:i.segments.map((t,r)=>(0,s9.cloneElement)(e.children(t),{key:r}))}),(0,le.jsx)(yy,{})]})}),Er=(0,s9.forwardRef)(function(e,t){let r=(0,s9.useContext)(bN),n=(0,s9.useContext)(bM);return(r??n).isInvalid?(0,le.jsx)(dq,{ref:t,size:16,...e}):(0,le.jsx)(cT,{ref:t,size:16,...e})});class En{constructor(e,t){this.locale=e,this.dictionary=t}of(e){return this.dictionary.getStringForLocale(e,this.locale)}}let Ea=new Map,Eo=(0,s9.forwardRef)(function({segment:e,...t},r){let n=(0,s9.useContext)(vh),a=d5(r),{segmentProps:o}=function(e,t,r){let n,a,o,i,s=(0,s9.useRef)(""),{locale:l,direction:u}=fR(),c=function(){var e;let{locale:t}=fR(),r=fq((e=yF)&&e.__esModule?e.default:e,"@react-aria/datepicker");return(0,s9.useMemo)(()=>{try{return new Intl.DisplayNames(t,{type:"dateTimeField"})}catch{return new En(t,r)}},[t,r])}(),{ariaLabel:d,ariaLabelledBy:m,ariaDescribedBy:p,focusManager:f}=yz.get(t),h=e.isPlaceholder?"":e.text,g=(0,s9.useMemo)(()=>t.dateFormatter.resolvedOptions(),[t.dateFormatter]),y=fV({month:"long",timeZone:g.timeZone}),v=fV({hour:"numeric",hour12:g.hour12,timeZone:g.timeZone});if("month"!==e.type||e.isPlaceholder)"hour"!==e.type||e.isPlaceholder||(h=v.format(t.dateValue));else{let e=y.format(t.dateValue);h=e!==h?`${h} \u{2013} ${e}`:e}let{spinButtonProps:b}=wK({value:e.value??void 0,textValue:h,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)}}),w=(0,s9.useMemo)(()=>new(0,wZ.d)(l,{maximumFractionDigits:0}),[l]),E=()=>{if(e.text===e.placeholder&&f.focusPrevious(),!w.isValidPartialNumber(e.text)||t.isReadOnly||e.isPlaceholder)("dayPeriod"===e.type||"era"===e.type)&&t.clearSegment(e.type);else{let r=e.text.slice(0,-1),n=w.parse(r);0===(r=0===n?"":r).length||0===n?t.clearSegment(e.type):t.setSegment(e.type,n),s.current=r}},{keyboardProps:D}=pL({shortcuts:{Backspace:()=>{E()},Delete:()=>{E()},"Mod+a":()=>{}},allowRepeats:!0}),{startsWith:x}=(n=function(e){let{locale:t}=fR(),r=t+(e?Object.entries(e).sort((e,t)=>e[0]<t[0]?-1:1).join():"");if(Ea.has(r))return Ea.get(r);let n=new Intl.Collator(t,e);return Ea.set(r,n),n}({usage:"search",sensitivity:"base"}),a=(0,s9.useCallback)((e,t)=>0===t.length||(e=e.normalize("NFC"),t=t.normalize("NFC"),0===n.compare(e.slice(0,t.length),t)),[n]),o=(0,s9.useCallback)((e,t)=>0===t.length||(e=e.normalize("NFC"),t=t.normalize("NFC"),0===n.compare(e.slice(-t.length),t)),[n]),i=(0,s9.useCallback)((e,t)=>{if(0===t.length)return!0;e=e.normalize("NFC");let r=0,a=(t=t.normalize("NFC")).length;for(;r+a<=e.length;r++){let o=e.slice(r,r+a);if(0===n.compare(t,o))return!0}return!1},[n]),(0,s9.useMemo)(()=>({startsWith:a,endsWith:o,contains:i}),[a,o,i])),_=fV({hour:"numeric",hour12:!0}),S=(0,s9.useMemo)(()=>{let e=new Date;return e.setHours(0),_.formatToParts(e).find(e=>"dayPeriod"===e.type).value},[_]),C=(0,s9.useMemo)(()=>{let e=new Date;return e.setHours(12),_.formatToParts(e).find(e=>"dayPeriod"===e.type).value},[_]),k=fV({year:"numeric",era:"narrow",timeZone:"UTC"}),P=(0,s9.useMemo)(()=>{if("era"!==e.type)return[];let r=hN(new hb(1,1,1),t.calendar),n=t.calendar.getEras().map(e=>{let t=r.set({year:1,month:1,day:1,era:e}).toDate("UTC");return{era:e,formatted:k.formatToParts(t).find(e=>"era"===e.type).value}}),a=function(e){e.sort();let t=e[0],r=e[e.length-1];for(let e=0;e<t.length;e++)if(t[e]!==r[e])return e;return 0}(n.map(e=>e.formatted));if(a)for(let e of n)e.formatted=e.formatted.slice(a);return n},[k,t.calendar,e.type]),R=r=>{if(t.isDisabled||t.isReadOnly)return;let n=s.current+r;switch(e.type){case"dayPeriod":if(x(S,r))t.setSegment("dayPeriod",0);else if(x(C,r))t.setSegment("dayPeriod",1);else break;f.focusNext();break;case"era":{let e=P.find(e=>x(e.formatted,r));e&&(t.setSegment("era",e.era),f.focusNext());break}case"day":case"hour":case"minute":case"second":case"month":case"year":{if(!w.isValidPartialNumber(n))return;let a=w.parse(n),o=a;if(void 0!==e.maxValue&&a>e.maxValue&&(o=w.parse(r)),isNaN(a))return;t.setSegment(e.type,o),void 0!==e.maxValue&&(Number(a+"0")>e.maxValue||n.length>=String(e.maxValue).length)?(s.current="",f.focusNext()):s.current=n}}};gt((0,s9.useRef)("u">typeof document?document:null),"selectionchange",()=>{let e=window.getSelection();e?.anchorNode&&mz(r.current,e?.anchorNode)&&((e=document)=>e.activeElement)()===r.current&&e.collapse(r.current)});let T=(0,s9.useRef)("");gt(r,"beforeinput",n=>{if(r.current)switch(n.preventDefault(),n.inputType){case"deleteContentBackward":case"deleteContentForward":w.isValidPartialNumber(e.text)&&!t.isReadOnly&&E();break;case"insertCompositionText":T.current=r.current.textContent,r.current.textContent=r.current.textContent;break;default:null!=n.data&&R(n.data)}}),gt(r,"input",e=>{let{inputType:t,data:n}=e;"insertCompositionText"===t&&(r.current&&(r.current.textContent=T.current),null!=n&&(x(S,n)||x(C,n))&&R(n))}),me(()=>{let e=r.current;return()=>{((e=document)=>e.activeElement)()===e&&(f.focusPrevious()||f.focusNext())}},[r,f]);let $=pn()||"timeZoneName"===e.type?{role:"textbox","aria-valuemax":null,"aria-valuemin":null,"aria-valuetext":null,"aria-valuenow":null}:{};e===(0,s9.useMemo)(()=>t.segments.find(e=>e.isEditable),[t.segments])||t.isInvalid||(p=void 0);let O=mp(),N=!t.isDisabled&&!t.isReadOnly&&e.isEditable,M="literal"===e.type?"":c.of(e.type),I=h6({"aria-label":`${M}${d?`, ${d}`:""}${m?", ":""}`,"aria-labelledby":m});if("literal"===e.type)return{segmentProps:{"aria-hidden":!0}};let j={caretColor:"transparent"};if("rtl"===u){j.unicodeBidi="embed";let t=g[e.type];("numeric"===t||"2-digit"===t)&&(j.direction="ltr")}return{segmentProps:mg(b,I,{id:O,...$,...D,"aria-invalid":t.isInvalid?"true":void 0,"aria-describedby":p,"aria-readonly":t.isReadOnly||!e.isEditable?"true":void 0,"data-placeholder":e.isPlaceholder||void 0,contentEditable:N,suppressContentEditableWarning:N,spellCheck:N?"false":void 0,autoCorrect:N?"off":void 0,[parseInt(s8().version,10)>=17?"enterKeyHint":"enterkeyhint"]:N?"next":void 0,inputMode:t.isDisabled||"dayPeriod"===e.type||"era"===e.type||!N?void 0:"numeric",tabIndex:t.isDisabled?void 0:0,onFocus:()=>{s.current="",r.current&&gi(r.current,{containingElement:gn(r.current)});let e=window.getSelection();e?.collapse(r.current)},style:j,onPointerDown(e){e.stopPropagation()},onMouseDown(e){e.stopPropagation()}})}}(e,n,a),{focusProps:i,isFocused:s,isFocusVisible:l}=fr(),{hoverProps:u,isHovered:c}=fs({...t,isDisabled:n.isDisabled||"literal"===e.type}),d=function(e){let{className:t,style:r,children:n,defaultClassName:a,defaultChildren:o,defaultStyle:i,values:s}=e;return(0,s9.useMemo)(()=>{let e,l,u;return e="function"==typeof t?t({...s,defaultClassName:a}):t,l="function"==typeof r?r({...s,defaultStyle:i||{}}):r,u="function"==typeof n?n({...s,defaultChildren:o}):null==n?o:n,{className:e??a,style:l||i?{...i,...l}:void 0,children:u??o,"data-rac":""}},[t,r,n,a,o,i,s])}({...t,values:{...e,isReadOnly:!e.isEditable,isInvalid:n.isInvalid,isDisabled:n.isDisabled,isHovered:c,isFocused:s,isFocusVisible:l},defaultChildren:e.text}),m=(0,s9.useCallback)(e=>{e.stopPropagation()},[]);return(0,le.jsx)("span",{...mg(mA(t),o,i,u),...d,ref:a,style:o.style,"data-placeholder":e.isPlaceholder||void 0,"data-invalid":n.isInvalid||void 0,"data-readonly":!e.isEditable||void 0,"data-disabled":n.isDisabled||void 0,"data-type":e.type,"data-hovered":c||void 0,"data-focused":s||void 0,"data-focus-visible":l||void 0,onClick:m})}),Ei={short:!1,size:"md"},Es=(0,s9.forwardRef)(function(e,t){let{className:r,defaultValue:n,isDisabled:a,invalid:o,invalidText:i,isInvalid:s,label:l,labelText:u,light:c,maxDate:d,minDate:m,onChange:p,onChangeRaw:f,short:h,size:g,value:y,...v}={...Ei,...e},{calendar:b,intlLocale:w,today_:E}=wF(),D=(0,s9.useId)(),x=!!(u??l),_=(0,s9.useMemo)(()=>bF(n,b),[n,b]),S=(0,s9.useMemo)(()=>bF(y,b,!0),[y,b]),C=(0,s9.useMemo)(()=>bF(d,b),[d,b]),k=(0,s9.useMemo)(()=>bF(m??wB,b),[m,b]),P=(0,s9.useMemo)(()=>o||s,[o,s]),R=(0,s9.useMemo)(()=>(f&&p&&console.error("An OpenmrsDatePicker component was created with both onChange and onChangeRaw handlers defined. Only onChangeRaw will be used."),f??(e=>p?.(bB(e)))),[f,p]);return(0,le.jsx)(bL,{locale:w.toString(),children:(0,le.jsx)("div",{className:cn()("cds--form-item",r),children:(0,le.jsx)(mv,{values:[[wL,w]],children:(0,le.jsxs)(bj,{className:cn()("cds--date-picker","cds--date-picker--single",{"cds--date-picker--short":h,"cds--date-picker--light":c}),defaultValue:_,isDisabled:a,isInvalid:P,maxValue:C,minValue:k,value:S,shouldForceLeadingZeros:"en"===w.language||void 0,...v,onChange:R,children:[(0,le.jsxs)("div",{className:"cds--date-picker-container",children:[x&&(0,le.jsx)(vj,{className:cn()("cds--label",{"cds--label--disabled":a}),htmlFor:D,children:u??l}),(0,le.jsxs)(yh,{className:w1,children:[(0,le.jsx)(Et,{id:x?D:void 0,ref:t,className:cn()("cds--date-picker-input__wrapper","-esm-report-builder__datepicker-module__inputWrapper___y+8gr",{"-esm-report-builder__datepicker-module__inputWrapperSm___tpcoF":"sm"===g,"-esm-report-builder__datepicker-module__inputWrapperMd___1hH89":"md"===g||!g||0===g.length,"-esm-report-builder__datepicker-module__inputWrapperLg___CRsQW":"lg"===g}),children:e=>"era"!==e.type?(0,le.jsx)(Eo,{className:w4,segment:e}):(0,le.jsx)(s8().Fragment,{})}),(0,le.jsx)(fd,{className:cn()(w6,{[w9]:"sm"===g,[w5]:"md"===g||!g||0===g.length,[w8]:"lg"===g}),children:(0,le.jsx)(Er,{})})]}),(0,le.jsx)(vR,{className:w3,children:i})]}),(0,le.jsx)(Ee,{variant:"single",today_:E})]})})})})}),El=(0,s9.forwardRef)(function({className:e,defaultValue:t,invalid:r,invalidText:n,isDisabled:a,isInvalid:o,label:i,labelText:s,light:l,maxDate:u,minDate:c,onChange:d,onChangeRaw:m,size:p="md",value:f,...h},g){let{calendar:y,intlLocale:v,today_:b}=wF(),w=(0,s9.useId)(),E=!!(s??i),D=(0,s9.useMemo)(()=>{if(f)return{start:bF(f[0],y,!1),end:bF(f[1],y,!1)}},[f,y]),x=(0,s9.useMemo)(()=>{if(t)return{start:bF(t[0],y,!1),end:bF(t[1],y,!1)}},[t,y]),_=(0,s9.useMemo)(()=>bF(c??wB,y,!0),[c,y]),S=(0,s9.useMemo)(()=>bF(u,y,!0),[u,y]),C=(0,s9.useMemo)(()=>r||o,[r,o]),k=(0,s9.useMemo)(()=>(m&&d&&console.error("An OpenmrsDateRangePicker component was created with both onChange and onChangeRaw handlers defined. Only onChangeRaw will be used."),m??(e=>d?.([bB(e.start),bB(e.end)]))),[m,d]);return(0,le.jsx)(bL,{locale:v.toString(),children:(0,le.jsx)("div",{className:cn()("cds--form-item",e),children:(0,le.jsx)(mv,{values:[[wL,v]],children:(0,le.jsx)(bA,{id:E?w:void 0,className:cn()("cds--date-picker",{"cds--date-picker--light":l,"cds--date-picker--disabled":a}),isInvalid:C,shouldForceLeadingZeros:"en"===v.language||void 0,maxValue:S,minValue:_,value:D,defaultValue:x,ref:g,isDisabled:a,...h,onChange:k,children:(0,le.jsxs)("div",{className:"cds--date-picker-container",children:[E&&(0,le.jsx)(vj,{className:cn()("cds--label",{"cds--label--disabled":a}),htmlFor:w,children:s??i}),(0,le.jsxs)(yh,{className:w1,children:[(0,le.jsxs)("div",{className:cn()("-esm-report-builder__datepicker-module__inputsWrapper___soXTl",{"-esm-report-builder__datepicker-module__inputsWrapperSm___ES6Mr":"sm"===p,"-esm-report-builder__datepicker-module__inputsWrapperMd___4qQj-":"md"===p||!p||0===p.length,"-esm-report-builder__datepicker-module__inputsWrapperLg___apyRG":"lg"===p}),children:[(0,le.jsx)(vy,{className:cn()("cds--date-picker-input__wrapper","-esm-report-builder__datepicker-module__startInput___Rc6pT",w2),slot:"start",children:e=>(0,le.jsx)(Eo,{className:w4,segment:e})}),(0,le.jsx)("div",{className:"-esm-report-builder__datepicker-module__separator___YpWmV",children:(0,le.jsx)("span",{"aria-hidden":"true","data-readonly":!0,children:"–"})}),(0,le.jsx)(vy,{className:cn()("cds--date-picker-input__wrapper","-esm-report-builder__datepicker-module__endInput___euNmk",w2),slot:"end",children:e=>(0,le.jsx)(Eo,{className:w4,segment:e})})]}),(0,le.jsx)(fd,{className:cn()(w6,{[w9]:"sm"===p,[w5]:"md"===p||!p||0===p.length,[w8]:"lg"===p}),children:(0,le.jsx)(Er,{})})]}),(0,le.jsx)(vR,{className:w3,children:n}),(0,le.jsx)(Ee,{variant:"range",today_:b,minDate:_,maxDate:S})]})})})})})}),Eu=s8().createContext(null);function Ec(e){let{children:t}=e,r=(0,s9.useContext)(Eu),[n,a]=(0,s9.useState)(0),o=(0,s9.useMemo)(()=>({parent:r,modalCount:n,addModal(){a(e=>e+1),r&&r.addModal()},removeModal(){a(e=>e-1),r&&r.removeModal()}}),[r,n]);return s8().createElement(Eu.Provider,{value:o},t)}function Ed(e){let t,{modalProviderProps:r}={modalProviderProps:{"aria-hidden":!!(t=(0,s9.useContext)(Eu))&&t.modalCount>0||void 0}};return s8().createElement("div",{"data-overlay-container":!0,...e,...r})}function Em(e){return s8().createElement(Ec,null,s8().createElement(Ed,e))}function Ep(e){let t=mu(),{portalContainer:r=t?null:document.body,...n}=e,{getContainer:a}=vD();if(!e.portalContainer&&a&&(r=a()),s8().useEffect(()=>{if(r?.closest("[data-overlay-container]"))throw Error("An OverlayContainer must not be inside another container. Please change the portalContainer prop.")},[r]),!r)return null;let o=s8().createElement(Em,n);return pQ().createPortal(o,r)}let Ef=s8().createContext(null),Eh=s8().forwardRef(function(e,t){let{children:r,...n}=e,a=d5(t),o={...n,ref:a};return s8().createElement(Ef.Provider,{value:o},r)}),Eg={},Ey=0,Ev=!1,Eb=null,Ew=null;function EE(e={}){let{delay:t=1500,closeDelay:r=500}=e,{isOpen:n,open:a,close:o}=bS(e),[i,s]=(0,s9.useState)(!1),l=(0,s9.useMemo)(()=>`${++Ey}`,[]),u=(0,s9.useRef)(null),c=(0,s9.useRef)(o),d=()=>{Eg[l]=f},m=()=>{for(let e in Eg)e!==l&&(Eg[e](!0,!0),delete Eg[e])},p=e=>{u.current&&clearTimeout(u.current),u.current=null,m(),d(),s(!!e),Ev=!0,a(),Eb&&(clearTimeout(Eb),Eb=null),Ew&&(clearTimeout(Ew),Ew=null)},f=(e,t)=>{s(!!t),e||r<=0?(u.current&&clearTimeout(u.current),u.current=null,c.current()):u.current||(u.current=setTimeout(()=>{u.current=null,c.current()},r)),Eb&&(clearTimeout(Eb),Eb=null),Ev&&(Ew&&clearTimeout(Ew),Ew=setTimeout(()=>{delete Eg[l],Ew=null,Ev=!1},Math.max(500,r)))};return(0,s9.useEffect)(()=>{c.current=o},[o]),(0,s9.useEffect)(()=>()=>{u.current&&clearTimeout(u.current),Eg[l]&&delete Eg[l]},[l]),{isOpen:n,shouldSkipAnimation:i,open:e=>{e||!(t>0)||u.current?p(Ev):(m(),d(),n||Ev?n||p(!0):(Eb&&clearTimeout(Eb),Eb=setTimeout(()=>{Eb=null,Ev=!0,p(!1)},t)))},close:f}}let ED=(0,s9.createContext)(null),Ex=(0,s9.createContext)(null);function E_(e){let t=EE(e),r=(0,s9.useRef)(null),{triggerProps:n,tooltipProps:a}=function(e,t,r){let{isDisabled:n,trigger:a,shouldCloseOnPress:o=!0}=e,i=mp(),s=(0,s9.useRef)(!1),l=(0,s9.useRef)(!1),u=()=>{(s.current||l.current)&&t.open(l.current)},c=e=>{s.current||l.current||t.close(e)};(0,s9.useEffect)(()=>{let e=e=>{r&&r.current&&"Escape"===e.key&&(e.stopPropagation(),t.close(!0))};if(t.isOpen)return document.addEventListener("keydown",e,!0),()=>{document.removeEventListener("keydown",e,!0)}},[r,t]);let d=()=>{o&&(l.current=!1,s.current=!1,c(!0))},{hoverProps:m}=fs({isDisabled:n,onHoverStart:()=>{"focus"!==a&&("pointer"===pc?s.current=!0:s.current=!1,u())},onHoverEnd:()=>{"focus"!==a&&(l.current=!1,s.current=!1,c())}}),{focusableProps:p}=pV({isDisabled:n,onFocus:()=>{p_()&&(l.current=!0,u())},onBlur:()=>{l.current=!1,s.current=!1,c(!0)}},r);return{triggerProps:{"aria-describedby":t.isOpen?i:void 0,...mg(p,m,{onPointerDown:d,onKeyDown:d}),tabIndex:void 0},tooltipProps:{id:i}}}(e,t,r);return s8().createElement(mv,{values:[[ED,t],[Ex,{...a,triggerRef:r}]]},s8().createElement(Eh,{...n,ref:r},e.children))}let ES=(0,s9.forwardRef)(function({UNSTABLE_portalContainer:e,...t},r){[t,r]=mE(t,r,Ex);let n=(0,s9.useContext)(ED),a=EE(t),o=null==t.isOpen&&null==t.defaultOpen&&n?n:a,i=bc(r,o.isOpen)||t.isExiting||!1;return o.isOpen||i?s8().createElement(Ep,{portalContainer:e},s8().createElement(EC,{...t,tooltipRef:r,isExiting:i})):null});function EC(e){let t=(0,s9.useContext)(ED),r=(0,s9.useRef)(null),{overlayProps:n,arrowProps:a,placement:o,triggerAnchorPoint:i}=v8({placement:e.placement||"top",targetRef:e.triggerRef,overlayRef:e.tooltipRef,arrowRef:r,offset:e.offset,crossOffset:e.crossOffset,isOpen:t.isOpen,arrowBoundaryOffset:e.arrowBoundaryOffset,shouldFlip:e.shouldFlip,containerPadding:e.containerPadding,onClose:()=>t.close(!0)}),s=bu(e.tooltipRef,!!o)||e.isEntering||!1,l=mb({...e,defaultClassName:"react-aria-Tooltip",values:{placement:o,isEntering:s,isExiting:e.isExiting,state:t}}),{tooltipProps:u}=function(e,t){let r=mA(e,{labelable:!0}),{hoverProps:n}=fs({onHoverStart:()=>t?.open(!0),onHoverEnd:()=>t?.close()});return{tooltipProps:mg(r,n,{role:"tooltip"})}}(e=mg(e,n),t),c=mA(e,{global:!0});return s8().createElement(mC.div,{...mg(c,l,u),ref:e.tooltipRef,style:{...n.style,"--trigger-anchor-point":i?`${i.x}px ${i.y}px`:void 0,...l.style},"data-placement":null!=o?o:void 0,"data-entering":s||void 0,"data-exiting":e.isExiting||void 0},s8().createElement(vA.Provider,{value:{...a,placement:o,ref:r}},l.children))}let Ek=({diagnoses:e,showCertainty:t=!1})=>{let{diagnosisTags:r}=l8({externalModuleName:"@openmrs/esm-styleguide"});return(0,le.jsx)("div",{className:"-esm-report-builder__diagnosis-tags-module__container___B0P1c",children:e.map(e=>{let n=t&&"PROVISIONAL"===e.certainty,a=1===e.rank?r?.primaryColor??"blue":r?.secondaryColor??"gray";return(0,le.jsx)(EP,{color:a,isProvisional:n,name:e.display},e.uuid)})})};function EP({color:e,isProvisional:t,name:r}){let[n,a]=(0,s9.useState)(!1),[o,i]=(0,s9.useState)(!1),[s,l]=(0,s9.useState)(!1),u=s||o,c=(0,s9.useRef)(null);(0,s9.useLayoutEffect)(()=>{let e=c.current;if(!e)return;let t=()=>{let t=e.scrollWidth>e.clientWidth;l(t),t||a(!1)};t();let r=new ResizeObserver(t);return r.observe(e),()=>r.disconnect()},[r,t,u]);let d=cn()("cds--tag","cds--tag--md","cds--layout--size-md",`cds--tag--${e}`,"-esm-report-builder__diagnosis-tags-module__diagnosisTag___65CPx"),m=(0,le.jsxs)(le.Fragment,{children:[t&&(0,le.jsxs)(le.Fragment,{children:[(0,le.jsx)("span",{"aria-hidden":"true",className:"-esm-report-builder__diagnosis-tags-module__provisionalMark___XQ8DV",children:"?"}),(0,le.jsxs)("span",{className:"cds--visually-hidden",children:[aO("provisional","Provisional")," "]})]}),(0,le.jsx)("span",{ref:c,className:"cds--tag__label",children:r})]});return u?(0,le.jsxs)(E_,{delay:0,closeDelay:150,isOpen:n,onOpenChange:a,children:[(0,le.jsx)(fd,{className:d,"data-testid":"diagnosis-tag",onFocusChange:i,onPress:()=>a(!0),children:m}),(0,le.jsx)(ES,{className:"-esm-report-builder__diagnosis-tags-module__tagTooltip___XQbm8",placement:"bottom",offset:4,containerPadding:8,children:r})]}):(0,le.jsx)("span",{className:d,"data-testid":"diagnosis-tag",children:m})}let ER={action:"-esm-report-builder__empty-card-module__action___sBzfy",content:"-esm-report-builder__empty-card-module__content___oLLP3",desktopHeading:"-esm-report-builder__empty-card-module__desktopHeading___61tqo",tabletHeading:"-esm-report-builder__empty-card-module__tabletHeading___8GoOd",tile:"-esm-report-builder__empty-card-module__tile___THTb6"},ET=({width:e="64",height:t="64"})=>(0,le.jsx)("svg",{width:e,height:t,viewBox:"0 0 64 64",children:(0,le.jsx)("use",{href:"#omrs-empty-data-illustration"})}),E$=e=>{let t="tablet"===uC(),r=e.launchForm;return(0,le.jsx)(cl.Wdr,{className:ER.layer,children:(0,le.jsxs)(cl.FAs,{className:ER.tile,children:[(0,le.jsx)("div",{className:t?ER.tabletHeading:ER.desktopHeading,children:(0,le.jsx)("h4",{children:e.headerTitle})}),(0,le.jsx)(ET,{}),(0,le.jsx)("p",{className:ER.content,children:aO("emptyStateText","There are no {{displayText}} to display",{displayText:e.displayText})}),(0,le.jsx)("p",{className:ER.action,children:r&&(0,le.jsx)(cl.$nd,{onClick:()=>r(),kind:"ghost",size:t?"lg":"sm",children:aO("recordNewEntry","Record {{ displayText }}",{displayText:e.displayText})})})]})})},EO=({error:e,headerTitle:t})=>{let r="tablet"===uC();return(0,le.jsx)(cl.Wdr,{children:(0,le.jsxs)(cl.FAs,{className:"-esm-report-builder__error-state-module__tile___cCC0p",children:[(0,le.jsx)("div",{className:r?"-esm-report-builder__error-state-module__tabletHeading___bj95p":"-esm-report-builder__error-state-module__desktopHeading___cT4Z6",children:(0,le.jsx)("h4",{children:t})}),(0,le.jsxs)("p",{className:"-esm-report-builder__error-state-module__errorMessage___0VxgF",children:[aO("error","Error")," ",`${e?.response?.status}: `,e?.response?.statusText]}),(0,le.jsx)("p",{className:"-esm-report-builder__error-state-module__errorCopy___eiDlp",children:aO("errorCopy")})]})})},EN=EO,EM=s8().forwardRef((e,t)=>{let{slotName:r,basePath:n,componentContext:a,state:o}=uR(),i=window.location??{pathname:""},s=lp(r??"");return e.isChildOfHeader&&r&&s.length>0?(0,le.jsxs)(cl.f8J,{"aria-label":aO("leftNavigation","Left navigation"),className:"-esm-report-builder__left-nav-module__leftNav___+tHzD",expanded:!0,isFixedNav:!0,ref:t,...e,children:[(0,le.jsx)(lg,{name:"global-nav-menu-slot"}),r?(0,le.jsx)(lJ,{value:a,fallback:(0,le.jsx)(lg,{name:r,state:{basePath:n,currentPath:i,...o}}),children:(0,le.jsx)(s7.Provider,{value:a,children:(0,le.jsx)(lg,{name:r,state:{basePath:n,currentPath:i,...o}})})}):null]}):null}),EI=({selectedLocationUuid:e,defaultLocationUuid:t,locationTag:r,locationsPerRequest:n=50,onChange:a})=>{let[o,i]=(0,s9.useState)(""),s=(0,s9.useId)(),{location:l}=function(e){let t=e?`/ws/fhir2/R4/Location?_id=${e}`:null,{data:r,error:n,isLoading:a}=ur(t,aY,{shouldRetryOnError:e=>!!e?.response?.status&&e.response.status>=500});return(0,s9.useMemo)(()=>({location:r?.data?.entry?r.data.entry[0]:null,error:t?n:null,isLoading:!!t&&a}),[r,a,n,t])}(t),{locations:u,isLoading:c,hasMore:d,loadingNewData:m,error:p,setPage:f}=function(e,t=0,r=""){let n=ue(r),{data:a,isLoading:o,isValidating:i,setSize:s,error:l}=uv(function(r,a){if(a){let e=a.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=`${aK}/Location?`,i=new URLSearchParams;return i.append("_summary","data"),t&&i.append("_count",""+t),r&&i.append("_getpagesoffset",""+r*t),e&&i.append("_tag",e),"string"==typeof n&&""!==n&&i.append("name:contains",n),o+i.toString()},aY);return(0,s9.useMemo)(()=>({locations:a?.length?a?.flatMap(e=>e?.data?.entry??[]):[],isLoading:o,totalResults:a?.[0]?.data?.total,hasMore:!!a?.length&&a?.[a.length-1]?.data?.link?.some(e=>"next"===e.relation),loadingNewData:i,error:l||null,setPage:s}),[o,a,i,s,l])}(r,n,o),h=(0,s9.useMemo)(()=>l&&!o&&t?[l,...u.filter(({resource:e})=>e.id!==t)]:u??[],[l,u,t,o]),g=(0,s9.useCallback)(e=>{a(),i(e.trim())},[a]),y=uN((0,s9.useCallback)(()=>{!m&&d&&f(e=>e+1)},[m,d,f])),v=d?Math.max(0,Math.floor(h.length-n/2)):-1;return(0,le.jsxs)(le.Fragment,{children:[(0,le.jsx)(cl.vji,{"aria-describedby":p?`${s}-error`:void 0,labelText:aO("searchForLocation"),id:s,placeholder:aO("searchForLocation"),onChange:e=>g(e.target.value),size:"lg"}),p&&(0,le.jsx)("div",{className:"-esm-report-builder__location-picker-module__errorNotification___sh9BG",id:`${s}-error`,children:(0,le.jsx)(cl.jeF,{kind:"error",subtitle:aO("errorLoadingLoginLocations","Unable to load login locations. Please try again or contact support if the problem persists."),title:aO("error","Error")})}),(0,le.jsx)("div",{className:"-esm-report-builder__location-picker-module__searchResults___gvBsQ",children:c?(0,le.jsx)("div",{className:"-esm-report-builder__location-picker-module__loadingContainer___PR-AY",children:Array.from({length:5}).map((e,t)=>(0,le.jsx)(cl.Psq,{className:"-esm-report-builder__location-picker-module__radioButtonSkeleton___Y913N",role:"progressbar"},t))}):(0,le.jsxs)(le.Fragment,{children:[(0,le.jsx)("div",{className:"-esm-report-builder__location-picker-module__locationResultsContainer___eH1Nw",children:h.length>0?(0,le.jsx)(cl.zWQ,{name:"loginLocations",onChange:e=>{a(e?.toString())},orientation:"vertical",valueSelected:e,children:h.map((e,t)=>(0,le.jsx)(cl.aaP,{className:"-esm-report-builder__location-picker-module__locationRadioButton___5tzhj",id:e.resource.id,labelText:(0,le.jsx)("span",{ref:t===v?y:null,children:e.resource.name}),name:e.resource.name,value:e.resource.id},e.resource.id))}):(0,le.jsx)("div",{className:"-esm-report-builder__location-picker-module__emptyState___+68uf",children:(0,le.jsx)("p",{className:"-esm-report-builder__location-picker-module__locationNotFound___PBqCF",children:aO("noResultsToDisplay")})})}),m&&(0,le.jsx)("div",{className:"-esm-report-builder__location-picker-module__loadingIcon___fSVp7",children:(0,le.jsx)(cl.OuH,{description:aO("loading")})})]})})]})},Ej=B("modalState",{modalContainer:null,modalStack:[]}),EA=0;async function EL(e,t,r={}){let n=sz(t),a=null;if(e){if(!n)throw Error(`No modal named '${t}' has been registered.`);let{load:o}=n,i=await o(),s=EA++;a=await s2({...i,name:`${t}-${s}`},{...r,domElement:e})}else k(`Failed to launch modal. Please notify your administrator. Modal name: ${t}`);return a}function EF(e){return"TO_BE_DELETED"===e.state||"DELETED"===e.state}function EB(e,t){t?.unmount&&(t.unmountPromise?.catch(()=>{}),t.unmount().catch(t=>{console.error(`The modal '${e}' failed to unmount`,t)}))}function EV(e){return e.find(e=>!EF(e))}function EU(e,t){e.container&&(e.container.style.visibility=t?"unset":"hidden")}let EW=window.getComputedStyle(document.body).overflow;function EH({modalStack:e,modalContainer:t}){if(t)if(e.length){t.style.visibility||(addEventListener("keydown",EK),document.body.style.overflow="hidden",t.style.visibility="unset");let r=EV(e);e.forEach(e=>{switch(e.state){case"NEW":{let r=function({size:e}){let t=document.createElement("div");return t.className=`cds--modal-container cds--modal-container--${e}`,t.setAttribute("role","dialog"),t.setAttribute("tabindex","-1"),t.setAttribute("aria-modal","true"),t}({size:e.props?.size??"md"});e.container=r,e.state="MOUNTING",EL(r,e.modalName,e.props).then(n=>{EF(e)?EB(e.modalName,n):n?(e.parcel=n,t.prepend(r),EU(e,EV(Ej.getState().modalStack)===e),n.mountPromise.then(()=>{EF(e)||(e.state="MOUNTED")},t=>{k(t),e.parcel=null,Ez(e)})):Ez(e)},t=>{k(t),Ez(e)});break}case"MOUNTING":case"MOUNTED":EU(e,e===r);break;case"TO_BE_DELETED":e.state="DELETED",e.onClose(),EB(e.modalName,e.parcel),e.container?.remove(),setTimeout(()=>{let t=Ej.getState();Ej.setState({...t,modalStack:t.modalStack.filter(t=>t!==e)})},0)}})}else t.style.removeProperty("visibility"),document.body.style.overflow=EW,removeEventListener("keydown",EK)}function Ez(e){if(EF(e))return;e.state="TO_BE_DELETED";let t=Ej.getState();Ej.setState({...t,modalStack:[...t.modalStack]})}function EK(e){"Escape"===e.key&&function(){let[e]=Ej.getState().modalStack;e&&Ez(e)}()}function EG(e){Ej.subscribe(EH),Ej.setState({...Ej.getState(),modalContainer:e})}function EZ(e,t={},r=()=>{}){let n=()=>{let e=Ej.getState().modalStack.find(e=>e.onClose===r);e&&Ez(e)};if(sz(e)){var a;let o,i;a={state:"NEW",onClose:r,modalName:e,props:{close:n,...t}},i=[a,...(o=Ej.getState()).modalStack],Ej.setState({...o,modalStack:i})}else k(`Failed to launch modal. Please notify your administrator. Modal name: "${e}"`);return n}var EY=Object.prototype.hasOwnProperty;let Eq=function(e){if(null==e)return!0;if(tm(e)&&(tc(e)||"string"==typeof e||"function"==typeof e.splice||tg(e)||t_(e)||tu(e)))return!e.length;var t=rD(e);if("[object Map]"==t||"[object Set]"==t)return!e.size;if(tn(e))return!rr(e).length;for(var r in e)if(EY.call(e,r))return!1;return!0},EJ=({notification:e})=>{let{description:t,action:r,kind:n,critical:a,title:o,onAction:i}=e;return(0,le.jsx)(cl.kZS,{actionButtonLabel:r,kind:n||"info",lowContrast:a,subtitle:t,title:o||"",inline:!0,onActionButtonClick:i})},EX=({subject:e})=>{let[t,r]=(0,s9.useState)([]);return(0,s9.useEffect)(()=>{let t=e.subscribe(e=>r(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,le.jsx)(le.Fragment,{children:t.map(e=>(0,le.jsx)(EJ,{notification:e},e.id))})},EQ=({notification:e})=>{let{actionButtonLabel:t,onActionButtonClick:r=()=>{},subtitle:n,kind:a,title:o,critical:i,progressActionLabel:s,id:l,...u}=e,[c,d]=(0,s9.useState)(t);return(0,le.jsx)(cl.kZS,{kind:a||"info",actionButtonLabel:c,"aria-label":aO("closesActionableNotification","Closes actionable notification"),onActionButtonClick:()=>{r(),s&&d(s)},statusIconDescription:aO("actionableNotification","Actionable notification"),subtitle:n,title:o,lowContrast:i,inline:!0,...u})},E0=({subject:e})=>{let[t,r]=(0,s9.useState)([]);return(0,s9.useEffect)(()=>{let t=e.subscribe(e=>r(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,le.jsx)(le.Fragment,{children:t.map(e=>(0,le.jsx)(EQ,{notification:e},e.id))})};class E1{subscribe(e){return this.listeners.add(e),{unsubscribe:()=>{this.listeners.delete(e)}}}next(e){for(let t of[...this.listeners])t(e)}constructor(){!function(e,t,r){t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r}(this,"listeners",new Set)}}let E4=new E1,E2=0,E3=new E1,E6=0;function E5(e){e&&(0,ly.createRoot)(e).render((0,le.jsx)(EX,{subject:E4}))}function E9(e){var t;e&&("string"==typeof(t=e.description)?t.trim().length>0:"object"==typeof t&&(t instanceof Error||!Eq(t)))?(e.description instanceof Error&&(e.description=e.description.toLocaleString()),setTimeout(()=>{E4.next({...e,id:E2++})},0)):console.error("showNotification must be called with an object having a 'description' property that is a non-empty string or object")}function E8(e){e&&(0,ly.createRoot)(e).render((0,le.jsx)(E0,{subject:E3}))}function E7(e){var t;e&&("string"==typeof(t=e.actionButtonLabel)?t.trim().length>0:"object"==typeof t&&!Eq(t))?setTimeout(()=>{E3.next({...e,id:E6++})},0):console.error("showActionableNotification must be called with an actionButtonLabel that is a non-empty string")}let De=["NORMAL","HIGH","CRITICALLY_HIGH","OFF_SCALE_HIGH","LOW","CRITICALLY_LOW","OFF_SCALE_LOW"],Dt=["critically_low","critically_high","high","low","normal","off_scale_low","off_scale_high"],Dr={container:"-esm-report-builder__numeric-observation-module__container___YMIz1",card:"-esm-report-builder__numeric-observation-module__card___ZLBwz","abnormal-value":"-esm-report-builder__numeric-observation-module__abnormal-value___bzIYd","critical-value":"-esm-report-builder__numeric-observation-module__critical-value___S2-yh",cell:"-esm-report-builder__numeric-observation-module__cell___ZiLtj","critically-high":"-esm-report-builder__numeric-observation-module__critically-high___NaPDB","critically-low":"-esm-report-builder__numeric-observation-module__critically-low___S29+P",high:"-esm-report-builder__numeric-observation-module__high___qk85l",low:"-esm-report-builder__numeric-observation-module__low___Rh+hW","label-container":"-esm-report-builder__numeric-observation-module__label-container___OHVTn","value-container":"-esm-report-builder__numeric-observation-module__value-container___-5c7b",label:"-esm-report-builder__numeric-observation-module__label___MVUkz",value:"-esm-report-builder__numeric-observation-module__value___Ne+ED",units:"-esm-report-builder__numeric-observation-module__units___7BIK5","pad-right":"-esm-report-builder__numeric-observation-module__pad-right___8vJsT","off-scale-low":"-esm-report-builder__numeric-observation-module__off-scale-low___3TolK","off-scale-high":"-esm-report-builder__numeric-observation-module__off-scale-high___xMngl",arrow:"-esm-report-builder__numeric-observation-module__arrow___6Jyji"},Dn=({value:e,unit:t,label:r,interpretation:n,referenceRange:a,conceptUuid:o,variant:i="card",patientUuid:s})=>{let l=(0,s9.useId)(),{referenceRange:u,isLoading:c}=function(e,t){let r=null;e&&(r=t?`${az}/conceptreferencerange/?patient=${t}&concept=${e}&v=full`:`${az}/conceptreferencerange/?concept=${e}&v=full`);let{data:n,error:a,isLoading:o}=ur(r,aY),i=n?.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:a,isLoading:o}}(a||n?void 0:o,s),d=a??u,m=(0,s9.useMemo)(()=>{if(n)return n?"--"===n?"normal":De.includes(n)?n.toLowerCase():Dt.includes(n)?n:"normal":void 0;if(d&&!c){if(!d||null==e||""===e)return"normal";let t="string"==typeof e?Number.parseFloat(e):e;return Number.isNaN(t)?"normal":null!==d.hiAbsolute&&void 0!==d.hiAbsolute&&t>d.hiAbsolute?"off_scale_high":null!==d.hiCritical&&void 0!==d.hiCritical&&t>=d.hiCritical?"critically_high":null!==d.hiNormal&&void 0!==d.hiNormal&&t>d.hiNormal?"high":null!==d.lowAbsolute&&void 0!==d.lowAbsolute&&t<d.lowAbsolute?"off_scale_low":null!==d.lowCritical&&void 0!==d.lowCritical&&t<=d.lowCritical?"critically_low":null!==d.lowNormal&&void 0!==d.lowNormal&&t<d.lowNormal?"low":"normal"}return"normal"},[n,d,e,c])??"normal",p="critically_low"===m||"critically_high"===m||"off_scale_low"===m||"off_scale_high"===m,f="normal"!==m,h=r?`omrs-numeric-obs-label-${r.replaceAll(/\s+/g,"-").toLowerCase()}-${l}`:void 0,g=`omrs-numeric-obs-value-${l}`,y=`omrs-numeric-obs-unit-${l}`,v=null!=e&&""!==e,b=v?e:aO("notAvailable","Not available"),w=cn()({[Dr["critically-low"]]:"critically_low"===m||"off_scale_low"===m,[Dr["critically-high"]]:"critically_high"===m||"off_scale_high"===m,[Dr.low]:"low"===m,[Dr.high]:"high"===m,[Dr["off-scale-low"]]:"off_scale_low"===m,[Dr["off-scale-high"]]:"off_scale_high"===m}),E=cn()({[Dr.container]:!0,[Dr.card]:!0,[Dr["critical-value"]]:p,[Dr["abnormal-value"]]:f&&!p}),D=cn()({[Dr.cell]:!0,[w]:!0});return"cell"===i?(0,le.jsxs)("div",{className:D,children:[b,v&&t?` ${t}`:""]}):(0,le.jsxs)("section",{className:E,"data-testid":"numeric-observation-card",children:[r&&(0,le.jsxs)("div",{className:Dr["label-container"],children:[(0,le.jsx)("span",{id:h,className:Dr.label,children:r}),f&&(0,le.jsx)("span",{className:Dr[m.replace("_","-")],title:aO("abnormalValue","Abnormal value")})]}),(0,le.jsxs)("div",{className:Dr["value-container"],children:[(0,le.jsx)("span",{id:g,"aria-labelledby":h&&y?`${h} ${y}`:h||y||void 0,className:Dr.value,children:b}),v&&t&&(0,le.jsx)("span",{id:y,className:Dr.units,children:t})]})]})},Da="-esm-report-builder__page-header-module__pageHeader___sRmJ1",Do=e=>{if("children"in e){let{children:t,className:r,...n}=e;return(0,le.jsx)("div",{className:cn()(Da,r),...n,children:t})}{let{title:t,illustration:r,className:n,...a}=e;return(0,le.jsx)("div",{className:cn()(Da,n),...a,children:(0,le.jsx)(Di,{title:t,illustration:r})})}},Di=({title:e,illustration:t,className:r})=>{let[n,a]=(0,s9.useState)(null);return(0,s9.useEffect)(()=>{n4("@openmrs/esm-styleguide").then(e=>{a(e)})},[]),(0,le.jsxs)("div",{className:cn()("-esm-report-builder__page-header-module__pageHeaderContent___9CRks",r),children:[t,(0,le.jsxs)("div",{className:"-esm-report-builder__page-header-module__pageLabels___mIsS6",children:[n?.implementationName&&(0,le.jsx)("p",{children:aO(n.implementationName)}),(0,le.jsx)("h1",{className:"-esm-report-builder__page-header-module__pageName___kvdCd",children:e})]})]})},Ds=({totalItems:e,pageSize:t,onPageNumberChange:r,pageNumber:n,dashboardLinkUrl:a,currentItems:o,dashboardLinkLabel:i})=>{let{pageSizes:s,pageItemsCount:l}=uj(t,e,n,o),u="tablet"===uC(),c=aO("paginationItemsCount","{{pageItemsCount}} / {{totalItems}} items",{totalItems:e,pageItemsCount:l});return(0,le.jsx)(le.Fragment,{children:e>0&&(0,le.jsxs)("div",{className:cn()({"-esm-report-builder__pagination-module__tablet___-EohH":u,"-esm-report-builder__pagination-module__desktop___lJwLA":!u}),children:[(0,le.jsxs)("div",{children:[c,a&&(0,le.jsx)(lt,{to:a,className:"-esm-report-builder__pagination-module__configurableLink___f-IJ9",children:i??aO("seeAll","See all")})]}),(0,le.jsx)(cl.dKS,{className:"-esm-report-builder__pagination-module__pagination___XBkRY",page:n,pageSize:t,pageSizes:s,totalItems:e,onChange:r,pageRangeText:(e,t)=>aO("paginationOfPages","of {{count}} pages",{count:t}),size:u?"lg":"sm"})]})})};function Dl(e){return Dc(Dm(e,"usual","official"))}function Du(e){return Dl(e)}function Dc(e){var t;let r;return e?e.text??(r=(t=e).given??[],(t.family?r.concat(t.family):r).join(" ")):""}function Dd(e){return Dc(e)}function Dm(e,...t){for(let r of(0==t.length&&(t=["usual"]),t)){let t=e.name?.find(e=>{var t,n;return t=e,n=r,t.use?t.use===n:"usual"===n});if(t)return t}}function Dp(e,t=uH()){let r=uH(t),n=w$(e,r);if(null==n)return null;let a=r.diff(n,"hours"),o=r.diff(n,"days"),i=r.diff(n,"weeks"),s=r.diff(n,"months"),l=r.diff(n,"years"),u={};if(a<2)u.minutes=r.diff(n,"minutes");else if(o<2)u.hours=a;else if(i<4)u.days=o;else if(l<1){let e=r.subtract(i,"weeks").diff(n,"days");u.weeks=i,u.days=e}else if(l<2){let e=r.subtract(s,"months").diff(n,"days");u.months=s,u.days=e}else if(l<18){let e=r.subtract(l,"year").diff(n,"months");u.years=l,u.months=e}else u.years=l;return u}function Df(e,t=uH()){let r=Dp(e,t);if(null==r)return null;let n={style:"short",localeMatcher:"lookup"};return"minutes"in r&&0===r.minutes&&(n.minutesDisplay="always"),wT(r,n)}let Dh={container:"-esm-report-builder__patient-banner-patient-info-module__container___SbFly",activePatientContainer:"-esm-report-builder__patient-banner-patient-info-module__activePatientContainer___dPAI3",patientBanner:"-esm-report-builder__patient-banner-patient-info-module__patientBanner___RKK5o",patientName:"-esm-report-builder__patient-banner-patient-info-module__patientName___N4cBt",patientAvatar:"-esm-report-builder__patient-banner-patient-info-module__patientAvatar___S5B6e",patientAvatarButton:"-esm-report-builder__patient-banner-patient-info-module__patientAvatarButton___b4TpF",patientInfo:"-esm-report-builder__patient-banner-patient-info-module__patientInfo___k4TpF",demographics:"-esm-report-builder__patient-banner-patient-info-module__demographics___kUxEK",row:"-esm-report-builder__patient-banner-patient-info-module__row___aBH+R",flexRow:"-esm-report-builder__patient-banner-patient-info-module__flexRow___iE9YF",tagsSlot:"-esm-report-builder__patient-banner-patient-info-module__tagsSlot___qQx0X",identifiers:"-esm-report-builder__patient-banner-patient-info-module__identifiers___S+i2W",identifier:"-esm-report-builder__patient-banner-patient-info-module__identifier___V3fBY",primaryIdentifier:"-esm-report-builder__patient-banner-patient-info-module__primaryIdentifier___MGool",secondaryIdentifier:"-esm-report-builder__patient-banner-patient-info-module__secondaryIdentifier___ORbJn",value:"-esm-report-builder__patient-banner-patient-info-module__value___rZXrd",tag:"-esm-report-builder__patient-banner-patient-info-module__tag___l5yM7",gender:"-esm-report-builder__patient-banner-patient-info-module__gender___pBoq+",separator:"-esm-report-builder__patient-banner-patient-info-module__separator___kqhkj",tooltipPadding:"-esm-report-builder__patient-banner-patient-info-module__tooltipPadding___aca85",tooltipSmallText:"-esm-report-builder__patient-banner-patient-info-module__tooltipSmallText___KSHWn",actionsButtonText:"-esm-report-builder__patient-banner-patient-info-module__actionsButtonText___dfkx2"};function Dg({showIdentifierLabel:e,type:t,value:r}){return(0,le.jsx)("span",{className:Dh.primaryIdentifier,children:(0,le.jsxs)(cl.vwO,{className:Dh.tag,type:"gray",children:[e&&t?.text&&(0,le.jsxs)("span",{className:Dh.label,children:[t.text,": "]}),(0,le.jsx)("span",{className:Dh.value,children:r})]})})}function Dy({showIdentifierLabel:e,type:t,value:r}){return(0,le.jsxs)(cl.lRv,{className:Dh.secondaryIdentifier,id:`patient-banner-identifier-${r}`,children:[e&&(0,le.jsxs)("span",{className:Dh.label,children:[t?.text,": "]}),(0,le.jsx)("span",{className:Dh.value,children:r})]})}function Dv({identifiers:e,showIdentifierLabel:t}){let{excludePatientIdentifierCodeTypes:r}=l8(),{primaryIdentifierCode:n}=uF(),a=e?.filter(e=>{let t=e.type?.coding?.[0]?.code;return t&&!r?.uuids.includes(t)})??[];return(0,le.jsx)(le.Fragment,{children:a?.length?a.map(({value:e,type:r},o)=>(0,le.jsxs)(s8().Fragment,{children:[(0,le.jsx)("span",{className:Dh.identifier,children:r?.coding?.[0]?.code===n?(0,le.jsx)(Dg,{showIdentifierLabel:t,type:r,value:e}):(0,le.jsx)(Dy,{showIdentifierLabel:t,type:r,value:e})}),o<a.length-1&&(0,le.jsx)("span",{className:Dh.separator,children:"\xb7"})]},e)):""})}let Db={Female:c0,Male:c1,Other:c4,Unknown:c2},Dw=({gender:e})=>{let t=Db[e];return t?(0,le.jsx)(t,{fill:"#525252"}):null},DE={male:"Male",female:"Female",other:"Other",unknown:"Unknown"};function DD({patient:e,renderedFrom:t}){var r;let n,a,o=Dl(e),i=e?.gender&&(a=DE[n=(r=e.gender).toLowerCase()]??"Unknown",{displayText:aO(n,r),iconKey:a}),s=(0,s9.useMemo)(()=>({patientUuid:e.id,patient:e,renderedFrom:t}),[e.id,e,t]);return(0,le.jsxs)("div",{className:Dh.patientInfo,children:[(0,le.jsx)("div",{className:cn()(Dh.row,Dh.patientNameRow),children:(0,le.jsxs)("div",{className:Dh.flexRow,children:[(0,le.jsx)("span",{className:Dh.patientName,children:o}),i&&(0,le.jsxs)("div",{className:Dh.gender,children:[(0,le.jsx)(Dw,{gender:i.iconKey}),(0,le.jsx)("span",{children:i.displayText})]}),(0,le.jsx)(lg,{className:Dh.tagsSlot,name:"patient-banner-tags-slot",state:s})]})}),(0,le.jsxs)("div",{className:Dh.demographics,children:[e.birthDate&&(0,le.jsxs)(le.Fragment,{children:[(0,le.jsx)("span",{children:Df(e.birthDate)}),(0,le.jsx)("span",{className:Dh.separator,children:"\xb7"}),(0,le.jsx)("span",{children:w_(e.birthDate,{time:!1,noToday:!0})}),(0,le.jsx)("span",{className:Dh.separator,children:"\xb7"})]}),(0,le.jsx)(Dv,{identifiers:e.identifier,showIdentifierLabel:!0}),(0,le.jsx)(lg,{className:Dh.extensionSlot,name:"patient-banner-bottom-slot",state:s})]})]})}var Dx=r(1673);function D_({patient:e,patientUuid:t,actionsSlotName:r,additionalActionsSlotState:n}){let[a,o]=(0,s9.useState)(!1),{extensions:i}=lf(r),s="tablet"===uC(),l=uO(()=>o(!1),a),u=(0,s9.useRef)(null),c=(0,s9.useRef)(null),d=(0,s9.useId)(),m=`patient-actions-menu-trigger-${d}`,p=`patient-actions-menu-${d}`,f=(0,s9.useCallback)(()=>o(e=>!e),[]),h=(0,s9.useCallback)(()=>{o(!1),u.current?.focus()},[]),g=(0,s9.useCallback)(e=>{if("Escape"===e.key&&a){e.stopPropagation(),h();return}if(("ArrowDown"===e.key||"ArrowUp"===e.key)&&a){e.preventDefault();let t=c.current?.querySelectorAll('[role="menuitem"]:not([disabled])');if(!t?.length)return;let r=document.activeElement?.closest?.('[role="menuitem"]')??document.activeElement,n=Array.from(t).indexOf(r);if(-1===n)return void t["ArrowDown"===e.key?0:t.length-1]?.focus();let a=n+("ArrowDown"===e.key?1:-1),o=a<0?t.length-1:a>=t.length?0:a;t[o]?.focus()}},[h,a]);(0,s9.useEffect)(()=>{if(a&&c.current){let e=c.current.querySelector('[role="menuitem"]:not([disabled])');e?.focus()}},[a]);let y=(0,s9.useMemo)(()=>({patientUuid:t,patient:e,closeMenu:h,...n}),[t,e,h,n]);return 0===i.length?null:(0,le.jsx)("div",{className:"-esm-report-builder__patient-banner-actions-menu-module__overflowMenuContainer___kcHLp",children:(0,le.jsxs)("div",{"data-overflow-menu":!0,className:cn()("cds--overflow-menu",cd),ref:l,children:[(0,le.jsxs)("button",{className:cn()("cds--btn","cds--btn--ghost","cds--overflow-menu__trigger",{"cds--overflow-menu--open":a},cf),"aria-controls":p,"aria-expanded":a,"aria-haspopup":"true",id:m,onClick:f,onKeyDown:g,ref:u,children:[(0,le.jsx)("span",{className:"-esm-report-builder__patient-banner-actions-menu-module__actionsButtonText___w2rar",children:aO("actions","Actions")})," ",(0,le.jsx)(Dx.CH,{size:16,style:{marginLeft:"0.5rem",fill:"#78A9FF"}})]}),(0,le.jsxs)("div",{className:cn()("cds--overflow-menu-options","cds--overflow-menu--flip",cm,{[cp]:a}),"aria-labelledby":m,"data-floating-menu-direction":"bottom",id:p,onKeyDown:g,ref:c,role:"menu",tabIndex:-1,children:[(0,le.jsx)("ul",{className:cn()("cds--overflow-menu-options__content",{"cds--overflow-menu-options--lg":s}),children:(0,le.jsx)(lg,{name:r,state:y},r)}),(0,le.jsx)("span",{})]})]})})}var DS=r(6767),DC=r.n(DS);function Dk(e){let{patientPhotoConceptUuid:t}=l8({externalModuleName:"@openmrs/esm-styleguide"}),r=t?`${az}/obs?patient=${e}&concept=${t}&v=full`:null,{data:n,error:a,isLoading:o}=(0,lN.u)(e?r:null,aY),i=n?.data?.results[0];return{data:i?{dateTime:i?.obsDatetime,imageSrc:i?.value?.links?.uri}:null,error:a,isLoading:o}}let DP=({width:e=56,height:t=56,"aria-label":r})=>{let{t:n}=(0,lO.useTranslation)();return(0,le.jsxs)("svg",{"aria-label":r??n("patientPhotoPlaceholder","Patient photo placeholder"),width:e,height:t,fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[(0,le.jsx)("path",{fill:"#ffffff",d:"M0 0h56v56H0z"}),(0,le.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"})]})},DR="-esm-report-builder__patient-photo-module__avatar___SjWI2";function DT({patientUuid:e,patientName:t,alt:r}){let{data:n,isLoading:a}=Dk(e),[o,i]=(0,s9.useState)(null),[s,l]=(0,s9.useState)(!1),u=(0,s9.useMemo)(()=>DC().generate(e),[e]);(0,s9.useEffect)(()=>{if(n?.imageSrc){let e=new URL(n.imageSrc,window.location.origin).pathname;l(!0);let t=!1,r=new Image;return r.onload=()=>{t||(i(e),l(!1))},r.onerror=()=>{t||(i(null),l(!1))},r.src=e,()=>{t=!0}}i(null),l(!1)},[n?.imageSrc]);let c=(0,s9.useMemo)(()=>r||(o?aO("patientPhotoAlt","Profile photo of {{patientName}}",{patientName:t}):aO("patientAvatarAlt","Avatar for {{patientName}}",{patientName:t})),[r,o,t]);return a||s?(0,le.jsx)(cl.ryE,{className:"-esm-report-builder__patient-photo-module__skeleton___YkxcQ","data-testid":"skeleton-icon"}):n?.imageSrc&&!o?(0,le.jsx)(DP,{"aria-label":aO("patientPhotoPlaceholder","Photo placeholder for {{patientName}}",{patientName:t})}):o?(0,le.jsx)("div",{"aria-label":c,children:(0,le.jsx)("img",{className:DR,src:o,alt:c,title:t})}):(0,le.jsx)("div",{"aria-label":c,children:(0,le.jsx)("div",{className:DR,title:t,style:{backgroundImage:u.toDataUrl(),backgroundRepeat:"no-repeat",backgroundSize:"cover"},children:(0,le.jsx)("span",{className:"-esm-report-builder__patient-photo-module__initials___GrIHj",children:function(e,t=3){return e.split(/\s+/).filter(Boolean).slice(0,t).map(e=>e[0]).join("")}(t)})})})}let D$=["omrs-pict-appointments","omrs-pict-assessment-1","omrs-pict-assessment-2","omrs-pict-blood-bank","omrs-pict-cardiology","omrs-pict-cohorts","omrs-pict-concept-dictionary","omrs-pict-ct-scan","omrs-pict-data-entry","omrs-pict-dentistry","omrs-pict-digital-trust","omrs-pict-emergency-department","omrs-pict-facility","omrs-pict-geriatrics","omrs-pict-gynaecology","omrs-pict-in-patient","omrs-pict-laboratory","omrs-pict-labs-2","omrs-pict-metadata-export","omrs-pict-obstetrics","omrs-pict-patient-documents","omrs-pict-patient-search","omrs-pict-patients","omrs-pict-payments-desk","omrs-pict-pharmacy","omrs-pict-pharmacy-2","omrs-pict-registration","omrs-pict-reports","omrs-pict-service-queues","omrs-pict-stock-management","omrs-pict-system-administration","omrs-pict-transfer","omrs-pict-triage","omrs-pict-x-ray"],DO=(0,s9.memo)((0,s9.forwardRef)(function(e,t){return(0,le.jsx)(xi,{ref:t,pictogram:"omrs-pict-appointments",pictogramProps:e})})),DN=DO,DM=(0,s9.memo)((0,s9.forwardRef)(function(e,t){return(0,le.jsx)(xi,{ref:t,pictogram:"omrs-pict-assessment-1",pictogramProps:e})})),DI=(0,s9.memo)((0,s9.forwardRef)(function(e,t){return(0,le.jsx)(xi,{ref:t,pictogram:"omrs-pict-assessment-2",pictogramProps:e})})),Dj=(0,s9.memo)((0,s9.forwardRef)(function(e,t){return(0,le.jsx)(xi,{ref:t,pictogram:"omrs-pict-blood-bank",pictogramProps:e})})),DA=(0,s9.memo)((0,s9.forwardRef)(function(e,t){return(0,le.jsx)(xi,{ref:t,pictogram:"omrs-pict-cardiology",pictogramProps:e})})),DL=(0,s9.memo)((0,s9.forwardRef)(function(e,t){return(0,le.jsx)(xi,{ref:t,pictogram:"omrs-pict-cohorts",pictogramProps:e})})),DF=(0,s9.memo)((0,s9.forwardRef)(function(e,t){return(0,le.jsx)(xi,{ref:t,pictogram:"omrs-pict-concept-dictionary",pictogramProps:e})})),DB=(0,s9.memo)((0,s9.forwardRef)(function(e,t){return(0,le.jsx)(xi,{ref:t,pictogram:"omrs-pict-ct-scan",pictogramProps:e})})),DV=(0,s9.memo)((0,s9.forwardRef)(function(e,t){return(0,le.jsx)(xi,{ref:t,pictogram:"omrs-pict-data-entry",pictogramProps:e})})),DU=(0,s9.memo)((0,s9.forwardRef)(function(e,t){return(0,le.jsx)(xi,{ref:t,pictogram:"omrs-pict-dentistry",pictogramProps:e})})),DW=(0,s9.memo)((0,s9.forwardRef)(function(e,t){return(0,le.jsx)(xi,{ref:t,pictogram:"omrs-pict-digital-trust",pictogramProps:e})})),DH=(0,s9.memo)((0,s9.forwardRef)(function(e,t){return(0,le.jsx)(xi,{ref:t,pictogram:"omrs-pict-emergency-department",pictogramProps:e})})),Dz=(0,s9.memo)((0,s9.forwardRef)(function(e,t){return(0,le.jsx)(xi,{ref:t,pictogram:"omrs-pict-facility",pictogramProps:e})})),DK=(0,s9.memo)((0,s9.forwardRef)(function(e,t){return(0,le.jsx)(xi,{ref:t,pictogram:"omrs-pict-geriatrics",pictogramProps:e})})),DG=(0,s9.memo)((0,s9.forwardRef)(function(e,t){return(0,le.jsx)(xi,{ref:t,pictogram:"omrs-pict-gynaecology",pictogramProps:e})})),DZ=(0,s9.memo)((0,s9.forwardRef)(function(e,t){return(0,le.jsx)(xi,{ref:t,pictogram:"omrs-pict-in-patient",pictogramProps:e})})),DY=(0,s9.memo)((0,s9.forwardRef)(function(e,t){return(0,le.jsx)(xi,{ref:t,pictogram:"omrs-pict-laboratory",pictogramProps:e})})),Dq=(0,s9.memo)((0,s9.forwardRef)(function(e,t){return(0,le.jsx)(xi,{ref:t,pictogram:"omrs-pict-labs-2",pictogramProps:e})})),DJ=(0,s9.memo)((0,s9.forwardRef)(function(e,t){return(0,le.jsx)(xi,{ref:t,pictogram:"omrs-pict-metadata-export",pictogramProps:e})})),DX=(0,s9.memo)((0,s9.forwardRef)(function(e,t){return(0,le.jsx)(xi,{ref:t,pictogram:"omrs-pict-obstetrics",pictogramProps:e})})),DQ=(0,s9.memo)((0,s9.forwardRef)(function(e,t){return(0,le.jsx)(xi,{ref:t,pictogram:"omrs-pict-patient-documents",pictogramProps:e})})),D0=(0,s9.memo)((0,s9.forwardRef)(function(e,t){return(0,le.jsx)(xi,{ref:t,pictogram:"omrs-pict-patient-search",pictogramProps:e})})),D1=(0,s9.memo)((0,s9.forwardRef)(function(e,t){return(0,le.jsx)(xi,{ref:t,pictogram:"omrs-pict-patients",pictogramProps:e})})),D4=(0,s9.memo)((0,s9.forwardRef)(function(e,t){return(0,le.jsx)(xi,{ref:t,pictogram:"omrs-pict-payments-desk",pictogramProps:e})})),D2=(0,s9.memo)((0,s9.forwardRef)(function(e,t){return(0,le.jsx)(xi,{ref:t,pictogram:"omrs-pict-pharmacy",pictogramProps:e})})),D3=(0,s9.memo)((0,s9.forwardRef)(function(e,t){return(0,le.jsx)(xi,{ref:t,pictogram:"omrs-pict-pharmacy-2",pictogramProps:e})})),D6=(0,s9.memo)((0,s9.forwardRef)(function(e,t){return(0,le.jsx)(xi,{ref:t,pictogram:"omrs-pict-registration",pictogramProps:e})})),D5=(0,s9.memo)((0,s9.forwardRef)(function(e,t){return(0,le.jsx)(xi,{ref:t,pictogram:"omrs-pict-reports",pictogramProps:e})})),D9=(0,s9.memo)((0,s9.forwardRef)(function(e,t){return(0,le.jsx)(xi,{ref:t,pictogram:"omrs-pict-service-queues",pictogramProps:e})})),D8=(0,s9.memo)((0,s9.forwardRef)(function(e,t){return(0,le.jsx)(xi,{ref:t,pictogram:"omrs-pict-stock-management",pictogramProps:e})})),D7=(0,s9.memo)((0,s9.forwardRef)(function(e,t){return(0,le.jsx)(xi,{ref:t,pictogram:"omrs-pict-system-administration",pictogramProps:e})})),xe=(0,s9.memo)((0,s9.forwardRef)(function(e,t){return(0,le.jsx)(xi,{ref:t,pictogram:"omrs-pict-transfer",pictogramProps:e})})),xt=(0,s9.memo)((0,s9.forwardRef)(function(e,t){return(0,le.jsx)(xi,{ref:t,pictogram:"omrs-pict-triage",pictogramProps:e})})),xr=(0,s9.memo)((0,s9.forwardRef)(function(e,t){return(0,le.jsx)(xi,{ref:t,pictogram:"omrs-pict-x-ray",pictogramProps:e})})),xn=Dz,xa=D1,xo=(0,s9.memo)((0,s9.forwardRef)(function({pictogram:e,fallback:t,...r},n){let a=(0,s9.useRef)(document.getElementById(e));return(0,s9.useEffect)(()=>{let t=document.getElementById("omrs-svgs-container"),r=new MutationObserver(t=>{for(let r of t)"childList"===r.type&&(a.current=document.getElementById(e))});return t&&r.observe(t,{childList:!0}),()=>r.disconnect()},[e]),(0,le.jsx)(lJ,{value:a.current,fallback:t,children:(0,le.jsx)(xi,{ref:n,pictogram:e,pictogramProps:r})})})),xi=(0,s9.memo)((0,s9.forwardRef)(function({pictogram:e,pictogramProps:t},r){let{className:n,size:a}=Object.assign({},{size:92},t);return(a<=26||a>144)&&(console.error(`Invalid size '${a}' specified for ${e}. Defaulting to 92.`),a=92),(0,le.jsx)("svg",{ref:r,className:cn()("-esm-report-builder__pictograms-module__pictogram___ej8c6",n),height:a,width:a,children:(0,le.jsx)("use",{href:`#${e}`})})})),xs=({children:e})=>"tablet"===uC()?(0,le.jsx)(cl.Wdr,{children:e}):(0,le.jsx)(le.Fragment,{children:e}),xl=({snackbar:e,closeSnackbar:t})=>{let{actionButtonLabel:r="",kind:n="success",onActionButtonClick:a=()=>{},isLowContrast:o="error"!==n,progressActionLabel:i,subtitle:s="",timeoutInMs:l=5e3,autoClose:u="error"!==n,title:c,id:d,...m}=e,[p,f]=(0,s9.useState)(r),[h,g]=(0,s9.useState)(!0),[y,v]=(0,s9.useState)(!1),b=(0,s9.useCallback)(()=>{setTimeout(t,250)},[t]),w=(0,s9.useCallback)(()=>{v(!0),b()},[b]);return(0,s9.useEffect)(()=>{if(u){let e=setTimeout(w,l);return()=>clearTimeout(e)}},[l,u,w]),(0,s9.useEffect)(()=>{g(!1),window.setTimeout(()=>{g(!0)},0)},[]),(0,le.jsx)(cl.kZS,{actionButtonLabel:p,"aria-label":aO("closeSnackbar","Close snackbar"),className:cn()("-esm-report-builder__snackbar-module__slideIn___hMvlf",{"-esm-report-builder__snackbar-module__animated___c+ZXw":h,"-esm-report-builder__snackbar-module__slideOut___ymbgm":y}),kind:n,lowContrast:o,onActionButtonClick:()=>{a(),w(),i&&f(i)},onClose:b,statusIconDescription:aO("snackbarNotification","Snackbar notification"),subtitle:s,title:c,...m})},xu=({subject:e})=>{let[t,r]=(0,s9.useState)([]),n=(0,s9.useCallback)(e=>{r(t=>t.filter(t=>t!==e))},[]);return(0,s9.useEffect)(()=>{let t=e.subscribe(e=>r(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,le.jsx)(le.Fragment,{children:t.map(e=>(0,le.jsx)(xl,{snackbar:e,closeSnackbar:()=>n(e)},e.id))})},xc=new E1,xd=0;function xm(e){e&&(0,ly.createRoot)(e).render((0,le.jsx)(xu,{subject:xc}))}function xp(e){var t;e&&"string"==typeof(t=e.title)&&t.trim().length>0?setTimeout(()=>{xc.next({...e,id:xd++})},0):console.error("showSnackbar must be called with an object having a 'title' property that is a non-empty string")}let xf=({toast:e,closeToast:t})=>{let{description:r,kind:n,critical:a,title:o,actionButtonLabel:i,onActionButtonClick:s=()=>{}}=e,l=(0,s9.useCallback)(()=>{s(),t()},[t,s]);return(0,le.jsx)("div",{children:(0,le.jsx)(cl.kZS,{actionButtonLabel:i,kind:n||"info",lowContrast:a,subtitle:r,title:o||"",onActionButtonClick:l,onClose:t})})},xh=({subject:e})=>{let[t,r]=(0,s9.useState)([]),n=(0,s9.useCallback)(e=>{r(t=>t.filter(t=>t!==e))},[]);return(0,s9.useEffect)(()=>{let t=e.subscribe(e=>r(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,le.jsx)(le.Fragment,{children:t.map(e=>(0,le.jsx)(xf,{toast:e,closeToast:()=>n(e)},e.id))})},xg=new E1,xy=0;function xv(e){e&&(0,ly.createRoot)(e).render((0,le.jsx)(xh,{subject:xg}))}function xb(e){var t;e&&("string"==typeof(t=e.description)?t.trim().length>0:"object"==typeof t&&!Eq(t))?setTimeout(()=>{xg.next({...e,id:xy++})},0):console.error("showToast must be called with an object having a 'description' property that is a non-empty string or object")}let xw="u">typeof crypto&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),xE=new Uint8Array(16),xD=[];for(let e=0;e<256;++e)xD.push((e+256).toString(16).slice(1));let xx=function(e,t,r){if(xw&&!t&&!e)return xw();let n=(e=e||{}).random??e.rng?.()??function(){if(!c){if("u"<typeof crypto||!crypto.getRandomValues)throw Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");c=crypto.getRandomValues.bind(crypto)}return c(xE)}();if(n.length<16)throw Error("Random bytes length must be >= 16");if(n[6]=15&n[6]|64,n[8]=63&n[8]|128,t){if((r=r||0)<0||r+16>t.length)throw RangeError(`UUID byte range ${r}:${r+15} is out of buffer bounds`);for(let e=0;e<16;++e)t[r+e]=n[e];return t}return function(e,t=0){return(xD[e[t+0]]+xD[e[t+1]]+xD[e[t+2]]+xD[e[t+3]]+"-"+xD[e[t+4]]+xD[e[t+5]]+"-"+xD[e[t+6]]+xD[e[t+7]]+"-"+xD[e[t+8]]+xD[e[t+9]]+"-"+xD[e[t+10]]+xD[e[t+11]]+xD[e[t+12]]+xD[e[t+13]]+xD[e[t+14]]+xD[e[t+15]]).toLowerCase()}(n)};async function x_(e,t){let{openedGroup:r}=sK.getState();if(r){if(r.groupName===e&&xk(r.props,t))return!0;else if(!await xT({reason:"CLOSE_WORKSPACE_GROUP",explicit:!1}))return!1}return sK.setState(r=>({...r,openedGroup:{groupName:e,props:t},openedWindows:[]})),!0}async function xS(e){let{openedGroup:t,openedWindows:r}=sK.getState();if(t){if(r.length>0&&!(e||await xT({reason:"CLOSE_WORKSPACE_GROUP",explicit:!0})))return!1;sK.setState(e=>({...e,openedGroup:null,openedWindows:[]}))}return!0}async function xC(e,t=null,r=null,n=null){let a=sK.getState();if(!a.registeredWorkspacesByName[e])throw Error(`Unable to launch workspace ${e}. Workspace is not registered`);let o=sG(e);if(!o)throw Error(`Unable to launch workspace ${e}. Workspace is not registered to a workspace window`);let{openedGroup:i}=a,{name:s}=o,l=sZ(s);if(!l)throw Error(`Unable to launch workspace ${e}. Workspace window ${o.name} is not registered to a workspace group`);let u=sY(e);if(i&&(i.groupName!==l.name||!xk(i.props,n)))return!!await xT({reason:"CLOSE_WORKSPACE_GROUP",explicit:!0})&&(sK.setState({...a,openedGroup:{groupName:l.name,props:n},openedWindows:[{windowName:s,openedWorkspaces:[xV(e,t)],props:r,maximized:!1}],isMostRecentlyOpenedWindowHidden:!1}),!0);if(u>=0){let n=a.openedWindows[u],o=a.openedGroup?.props??{},i=a.isMostRecentlyOpenedWindowHidden,{openedWorkspaces:c}=n;if(xk(n.props,r)){let d=c.find(t=>t.workspaceName===e);return d&&xk(d.props,t)?((i||u!==a.openedWindows.length-1)&&sK.setState(xj.restoreWindow(a,s)),!0):!!await xT({reason:"CLOSE_WORKSPACE",explicit:!1,windowName:s,workspaceName:e})&&(sK.setState({...a,openedGroup:{groupName:l.name,props:a?.openedGroup?.props??o},openedWindows:[...a.openedWindows.filter((e,t)=>t!==u),{windowName:s,openedWorkspaces:[xV(e,t)],props:n?.props??r,maximized:!1}],isMostRecentlyOpenedWindowHidden:!1}),!0)}return!!await xT({reason:"CLOSE_WINDOW",explicit:!1,windowName:s})&&(sK.setState({...a,openedGroup:{groupName:l.name,props:o??a?.openedGroup?.props},openedWindows:[...a.openedWindows.filter((e,t)=>t!==u),{windowName:s,openedWorkspaces:[xV(e,t)],props:r,maximized:!1}],isMostRecentlyOpenedWindowHidden:!1}),!0)}return"closable"!=l.persistence?(sK.setState({...a,openedGroup:{groupName:l.name,props:n??a?.openedGroup?.props??null},openedWindows:[...a.openedWindows,{windowName:s,openedWorkspaces:[xV(e,t)],props:r,maximized:!1}],isMostRecentlyOpenedWindowHidden:!1}),!0):!!await xT({reason:"CLOSE_OTHER_WINDOWS",explicit:!1,windowNameToSpare:o.name})&&(sK.setState({...a,openedGroup:{groupName:l.name,props:n??a?.openedGroup?.props??null},openedWindows:[{windowName:s,openedWorkspaces:[xV(e,t)],props:r,maximized:!1}],isMostRecentlyOpenedWindowHidden:!1}),!0)}function xk(e,t){return null==e||null==t||T(e,t)}function xP(e,t){let r=[];for(let n=e.openedWorkspaces.length-1;n>=0;n--){let a=e.openedWorkspaces[n];if(a.hasUnsavedChanges&&r.push(a),t&&a.workspaceName===t)break}return r}function xR(e){return 0===e.length?Promise.resolve(!0):new Promise(t=>{let r=EZ("workspace2-close-prompt",{size:"sm",onConfirm:()=>{r(),t(!0)},onCancel:()=>{r(),t(!1)},affectedWorkspaceTitles:e.map(e=>e.title??"")})})}function xT(e){let{openedWindows:t}=sK.getState(),r=[];switch(e.reason){case"CLOSE_WORKSPACE_GROUP":r=t.flatMap(e=>xP(e));break;case"CLOSE_WINDOW":{let n=t.find(t=>t.windowName===e.windowName);if(!n)throw Error(`Window ${e.windowName} not found in opened windows.`);r=xP(n);break}case"CLOSE_WORKSPACE":{let n=t.find(t=>t.windowName===e.windowName);if(!n)throw Error(`Window ${e.windowName} not found in opened windows.`);r=xP(n,e.workspaceName);break}case"CLOSE_OTHER_WINDOWS":r=t.filter(t=>t.windowName!==e.windowNameToSpare).flatMap(e=>xP(e))}return xR(r)}function x$(e,t){return xR(xP(e,t))}function xO(e,t){let r=e.openedWorkspaces.findIndex(e=>e.workspaceName===t);return r<0?e:0===r?null:{...e,openedWorkspaces:e.openedWorkspaces.slice(0,r)}}function xN(e,t,r,n){let{registeredWorkspacesByName:a}=sK.getState(),o=a[r];if(!o)throw Error(`No workspace named "${r}" registered`);let i=a[t];if(!i)throw Error(`No workspace named "${t}" registered`);if(i.window!==o.window)throw Error(`Child workspace ${r} does not belong to the same workspace window as parent workspace ${t}`);if(o.window!==e.windowName)throw Error(`Cannot open child workspace ${r} as window ${o.window} is not opened`);let{openedWorkspaces:s}=e,l=s.findIndex(e=>e.workspaceName===t);if(-1===l)throw Error(`Cannot open child workspace ${r} from parent workspace ${t} as the parent is not opened within the workspace window`);let u=s.slice(0,l+1);return{...e,openedWorkspaces:[...u,xV(r,n)]}}function xM(e,t,r){let n=e.openedWorkspaces.findIndex(e=>e.uuid===t);if(n<0)return e;let a=e.openedWorkspaces[n];if(Object.keys(r).every(e=>a[e]===r[e]))return e;let o=[...e.openedWorkspaces];return o[n]={...a,...r},{...e,openedWorkspaces:o}}function xI(e,t,r){let n=e.openedWindows.findIndex(e=>e.openedWorkspaces.some(e=>e.uuid===t));if(n<0)return e;let a=e.openedWindows[n],o=xM(a,t,r);if(o===a)return e;let i=[...e.openedWindows];return i[n]=o,{...e,openedWindows:i}}let xj={setWindowMaximized(e,t,r){let n=e.openedWindows.findIndex(e=>e.windowName===t),a=[...e.openedWindows],o={...a[n],maximized:r};return a[n]=o,{...e,openedWindows:a}},hideWindow:e=>({...e,isMostRecentlyOpenedWindowHidden:!0}),restoreWindow(e,t){let r=e.openedWindows.findIndex(e=>e.windowName===t),n=e.openedWindows[r],a=[...e.openedWindows.filter((e,t)=>t!==r),n];return{...e,openedWindows:a,isMostRecentlyOpenedWindowHidden:!1}},closeWorkspace(e,t){let r=e.openedWindows.findIndex(e=>e.openedWorkspaces.some(e=>e.workspaceName===t));if(r<0)return e;let n=xO(e.openedWindows[r],t),a=[...e.openedWindows],o=e.isMostRecentlyOpenedWindowHidden;if(null===n){let t=r===e.openedWindows.length-1;a.splice(r,1),t&&a.length>0&&(o=!1)}else a[r]=n;return{...e,openedWindows:a,isMostRecentlyOpenedWindowHidden:o}},openChildWorkspace(e,t,r,n){let a=e.registeredWorkspacesByName[r];if(!a)throw Error(`No workspace named "${r}" registered`);let o=e.openedWindows.findIndex(e=>e.windowName===a.window);if(-1==o)throw Error(`Cannot open child workspace ${r} as window ${a.window} is not opened`);let i=[...e.openedWindows];return i[o]=xN(e.openedWindows[o],t,r,n),{...e,openedWindows:i}},setHasUnsavedChanges:(e,t,r)=>xI(e,t,{hasUnsavedChanges:r}),setWorkspaceTitle:(e,t,r)=>xI(e,t,{title:r})};function xA(){return ls(sK,xj)}let xL=()=>(0,s9.useContext)(l_),xF=()=>Object.keys(sK.getState().registeredWorkspacesByName);function xB(e,t,r){let n=e.openedWorkspaces[e.openedWorkspaces.length-1];return(n?t[n.workspaceName]?.width:void 0)??r[e.windowName]?.width??"narrow"}function xV(e,t){return{workspaceName:e,props:t??{},hasUnsavedChanges:!1,uuid:xx()}}function xU(e,t,r){let n=sK.getState().registeredWorkspacesByName[e];return n?{windowName:n.window,openedWorkspaces:[xV(e,t)],props:r??null,maximized:!1}:null}let xW=({title:e,children:t,hasUnsavedChanges:r=!1})=>{let{setHasUnsavedChanges:n,setWorkspaceTitle:a}=xL();return(0,s9.useEffect)(()=>{n(r??!1)},[r,n]),(0,s9.useEffect)(()=>{a(e)},[e,a]),(0,le.jsx)(le.Fragment,{children:t})};function xH(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function xz(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?xH(Object(r),!0).forEach(function(t){xG(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):xH(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function xK(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function xG(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function xZ(e){return(xZ=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function xY(e,t){return(xY=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function xq(e){if(void 0===e)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return e}var xJ=function(e){var t=s9.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&&xY(i,t);var r,n,a,o=(r=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=xZ(i);e=r?Reflect.construct(t,arguments,xZ(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 xq(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),xG(xq(t=o.call(this,e)),"handleRef",function(e){t.el=e}),xG(xq(t),"addThingToDo",function(e,r){t.state.hasError&&"unmount"!==e||(t.nextThingToDo=(t.nextThingToDo||Promise.resolve()).then(function(){if(!t.unmounted||"unmount"===e)return r.apply(void 0,arguments)}).catch(function(r){throw t.nextThingToDo=Promise.resolve(),t.setState({hasError:!0}),r&&r.message&&(r.message="During '".concat(e,"', parcel threw an error: ").concat(r.message)),t.props.handleError?t.props.handleError(r):setTimeout(function(){throw r}),r}))}),xG(xq(t),"getParcelProps",function(){var e=xz(xz({},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 n=[{key:"componentDidMount",value:function(){var e=this;this.unmounted=!1,this.addThingToDo("mount",function(){var t,r=e.props.mountParcel||e.mountParcel;if(!r)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(r){t.style[r]=e.props.wrapStyle[r]}),e.props.appendTo.appendChild(t)),e.parcel=r(e.props.config,xz({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 l_&&l_.Consumer?s9.createElement(l_.Consumer,null,function(t){return e.mountParcel=t?t.mountParcel:null,null}):null;var t=l_&&l_.Consumer?s9.createElement(l_.Consumer,null,function(t){return e.mountParcel=t?t.mountParcel:null,null}):void 0;return s9.createElement(this.props.wrapWith,{ref:this.handleRef,style:this.props.wrapStyle,className:this.props.wrapClassName},t)}}],xK(i.prototype,n),a&&xK(i,a),i}();xG(xJ,"defaultProps",{wrapWith:"div",wrapStyle:{},parcelDidMount:function(){}});var xX=r(810),xQ=r(771);let x0={workspaceOuterContainer:"-esm-report-builder__workspace2-module__workspaceOuterContainer___W9iJN",narrowWorkspace:"-esm-report-builder__workspace2-module__narrowWorkspace___6pFGF",widerWorkspace:"-esm-report-builder__workspace2-module__widerWorkspace___aQBxL",extraWideWorkspace:"-esm-report-builder__workspace2-module__extraWideWorkspace___Hcpmd",workspaceMiddleContainer:"-esm-report-builder__workspace2-module__workspaceMiddleContainer___DlVKb",maximized:"-esm-report-builder__workspace2-module__maximized___GqZm5",hidden:"-esm-report-builder__workspace2-module__hidden___KSjDv",workspaceInnerContainer:"-esm-report-builder__workspace2-module__workspaceInnerContainer___qQKWW",workspaceSpacer:"-esm-report-builder__workspace2-module__workspaceSpacer___tx3mR",loader:"-esm-report-builder__workspace2-module__loader___f9ttF",hiddenExtraWorkspace:"-esm-report-builder__workspace2-module__hiddenExtraWorkspace___o2RHo",header:"-esm-report-builder__workspace2-module__header___4cJjV",headerButtons:"-esm-report-builder__workspace2-module__headerButtons___5vIhN",workspaceContent:"-esm-report-builder__workspace2-module__workspaceContent___ROBU9",overlayHeaderSpacer:"-esm-report-builder__workspace2-module__overlayHeaderSpacer___CFci9",isActionMenuOpened:"-esm-report-builder__workspace2-module__isActionMenuOpened___TlyIU",showActionMenu:"-esm-report-builder__workspace2-module__showActionMenu___5qVqE",marginWorkspaceContent:"-esm-report-builder__workspace2-module__marginWorkspaceContent___jB4mY",workspaceContainerWithActionMenu:"-esm-report-builder__workspace2-module__workspaceContainerWithActionMenu___+EHP1",workspaceFixedContainer:"-esm-report-builder__workspace2-module__workspaceFixedContainer___PV5s-",workspaceContainerWithoutActionMenu:"-esm-report-builder__workspace2-module__workspaceContainerWithoutActionMenu___pJYA1"},x1=e=>e.registeredWorkspacesByName,x4=({lifeCycle:e,openedWorkspace:t,openedWindow:r,groupProps:n,actions:a,renderChrome:o,isRootWorkspace:i,isLeafWorkspace:s,showActionMenu:l})=>{let u=(0,s9.useMemo)(()=>t&&{closeWorkspace:async(e={})=>{let{closeWindow:n=!1,discardUnsavedChanges:o=!1}=e;return n?!!(o||await a.promptForClosingWorkspaces())&&(a.closeWorkspace(r.openedWorkspaces[0].workspaceName),!0):!!(o||await a.promptForClosingWorkspaces(t.workspaceName))&&(a.closeWorkspace(t.workspaceName),!0)},launchChildWorkspace:async(e,n)=>{let o=t.workspaceName,{openedWorkspaces:i}=r,s=i.findIndex(e=>e.workspaceName===o);-1===s||s!==i.length-1&&i.slice(s+1).some(e=>e.hasUnsavedChanges)&&!await a.promptForClosingWorkspaces(i[s+1].workspaceName)||a.openChildWorkspace(o,e,n||{})},setWorkspaceTitle:e=>a.setWorkspaceTitle(t.uuid,e),setHasUnsavedChanges:e=>a.setHasUnsavedChanges(t.uuid,e),workspaceName:t.workspaceName,workspaceProps:t.props,windowProps:r.props,groupProps:n,workspaceMeta:sK.getState().registeredWorkspacesByName[t.workspaceName]?.meta??{},isRootWorkspace:i,isLeafWorkspace:s,windowName:r.windowName,showActionMenu:l},[t,r,n,a,i,s,l]),c=!o&&!s,d=(0,s9.useMemo)(()=>e?(0,le.jsx)(xJ,{config:e,mountParcel:s6,wrapWith:"div",wrapClassName:cn()(x0.workspaceContent,{[x0.hiddenExtraWorkspace]:c}),...u},t.workspaceName):null===e?(0,le.jsx)("div",{className:cn()(x0.workspaceContent,{[x0.hiddenExtraWorkspace]:c}),children:(0,le.jsx)(cl.jeF,{kind:"error",title:aO("error"),subtitle:aO("somethingWentWrongTryReloading"),hideCloseButton:!0})}):null,[e,t.workspaceName,u,c]);return o?(0,le.jsx)("div",{children:(0,le.jsx)(x2,{openedWorkspace:t,openedWindow:r,isRootWorkspace:i,showActionMenu:l,closeWindow:()=>u.closeWorkspace({closeWindow:!0}),children:d})}):d??(0,le.jsx)(cl.OuH,{className:cn()(x0.loader,{[x0.hiddenExtraWorkspace]:c}),description:`${aO("loading")}`})},x2=({openedWorkspace:e,openedWindow:t,isRootWorkspace:r,showActionMenu:n,closeWindow:a,children:o})=>{let i=uC(),{openedGroup:s,openedWindows:l,registeredWindowsByName:u,registeredWorkspacesByName:c,registeredGroupsByName:d,isMostRecentlyOpenedWindowHidden:m,setWindowMaximized:p,hideWindow:f}=xA(),h=t.windowName,{maximized:g}=t,y=e.title??"",v=u[h],b=xB(t,c,u),w=v?.icon,E=v?.canMaximize,D=!!s&&d[s.groupName]?.persistence==="closable",x=!!w&&!D,_=l.findIndex(e=>e.windowName===h)<l.length-1||m,S=Object.values(u).some(e=>e.group===s?.groupName&&void 0!==e.icon);return(0,le.jsxs)("div",{className:cn()(x0.workspaceOuterContainer,{[x0.narrowWorkspace]:"narrow"===b,[x0.widerWorkspace]:"wider"===b,[x0.extraWideWorkspace]:"extra-wide"===b,[x0.isActionMenuOpened]:S}),children:[(0,le.jsx)("div",{className:cn()(x0.workspaceSpacer,{[x0.hidden]:_})}),(0,le.jsx)("div",{className:cn()(x0.workspaceMiddleContainer,{[x0.maximized]:g,[x0.hidden]:_,[x0.isRootWorkspace]:r,[x0.showActionMenu]:n}),children:(0,le.jsx)("div",{className:cn()(x0.workspaceInnerContainer,{[x0.maximized]:g,[x0.hidden]:_,[x0.isRootWorkspace]:r}),children:o?(0,le.jsxs)(le.Fragment,{children:[(0,le.jsxs)(cl.Y9Y,{"aria-label":aO("workspaceHeader"),className:x0.header,children:[(0,le.jsx)(cl.bCw,{prefix:"",children:y}),(0,le.jsx)("div",{className:x0.overlayHeaderSpacer}),(0,le.jsx)(cl.wdv,{className:x0.headerButtons,children:uk(i)?(0,le.jsxs)(le.Fragment,{children:[(E||g)&&(0,le.jsx)(cl.V8d,{"aria-label":g?aO("minimize"):aO("maximize"),onClick:()=>p(h,!g),children:g?(0,le.jsx)(xX.Xj,{}):(0,le.jsx)(xX.hz,{})}),x&&(0,le.jsx)(cl.V8d,{"aria-label":aO("hide"),onClick:()=>f(),children:(0,le.jsx)(cC,{})}),!D&&(0,le.jsx)(cl.V8d,{"aria-label":aO("close"),onClick:a,children:(0,le.jsx)(cH,{})})]}):(0,le.jsxs)(le.Fragment,{children:[x&&(0,le.jsx)(cl.V8d,{"aria-label":aO("hide"),onClick:()=>f(),children:(0,le.jsx)(xQ.d3,{})}),(0,le.jsx)(cl.V8d,{"aria-label":aO("close"),onClick:()=>{D?xS():a()},children:(0,le.jsx)(cH,{})})]})})]}),o]}):(0,le.jsx)(cl.OuH,{className:x0.loader,description:`${aO("loading")} ...`})})})]})},x3=({openedWindow:e,groupProps:t,actions:r,renderChrome:n,showActionMenu:a})=>{let{openedWorkspaces:o}=e,[i,s]=(0,s9.useState)({}),l=li(sK,x1),u=(0,s9.useRef)(new Set);return(0,s9.useEffect)(()=>{let e=!1;return Promise.all(o.map(async t=>{let r=l[t.workspaceName];if(!r)return null;let{moduleName:n,component:a}=r;try{return[t.uuid,await u1(n,a)]}catch(r){return e||u.current.has(t.uuid)||(u.current.add(t.uuid),k(r)),[t.uuid,null]}})).then(t=>{e||s(Object.fromEntries(t.filter(e=>null!=e)))},k),()=>{e=!0}},[o,l]),(0,le.jsx)(le.Fragment,{children:o.map((s,l)=>(0,le.jsx)(x4,{openedWorkspace:s,openedWindow:e,groupProps:t,actions:r,renderChrome:n,lifeCycle:i[s.uuid],isRootWorkspace:0===l,isLeafWorkspace:l===o.length-1,showActionMenu:a},s.uuid))})},x6=e=>e.registeredWorkspacesByName,x5=({name:e,workspaceProps:t,windowProps:r,groupProps:n,onWindowChanged:a})=>{let o=li(sK,x6),i=li(sK,t=>{let r=t.registeredWorkspacesByName[e]?.window;return r?t.registeredWindowsByName[r]:void 0}),s={name:e,workspaceProps:t,windowProps:r,groupProps:n},l=(0,s9.useRef)(null),u=(0,s9.useRef)(null);if(!l.current){let a=xU(e,t,r);l.current=V({openedWindow:a,groupProps:n??null}),a&&(u.current=s)}let c=l.current;(0,s9.useEffect)(()=>{let a=u.current;if(a&&a.name===e&&T(a.workspaceProps,t)&&T(a.windowProps,r)&&T(a.groupProps,n))return;let o=xU(e,t,r);c.setState({openedWindow:o,groupProps:n??null},!0),u.current=o?s:null},[e,t,r,n,o,c]);let d=(0,s9.useMemo)(()=>(function(e){function t(t){e.setState(e=>{if(!e.openedWindow)return e;let r=t(e.openedWindow);return r===e.openedWindow?e:{...e,openedWindow:r}})}return{closeWorkspace(e){t(t=>xO(t,e))},openChildWorkspace(e,r,n){t(t=>xN(t,e,r,n))},setWorkspaceTitle(e,r){t(t=>xM(t,e,{title:r}))},setHasUnsavedChanges(e,r){t(t=>xM(t,e,{hasUnsavedChanges:r}))},promptForClosingWorkspaces(t){let{openedWindow:r}=e.getState();return r?x$(r,t):Promise.resolve(!0)}}})(c),[c]),{openedWindow:m,groupProps:p}=li(c),f=m?.openedWorkspaces[m.openedWorkspaces.length-1],h=f?.workspaceName??null,g=f?.title??"",y=m?.openedWorkspaces.some(e=>e.hasUnsavedChanges)??!1,v=i?.width??"narrow",b=(0,s9.useRef)(a);return(0,s9.useEffect)(()=>{b.current=a}),(0,s9.useEffect)(()=>{b.current?.({workspaceName:h,windowWidth:v,title:g,hasUnsavedChanges:y})},[h,v,g,y]),(0,le.jsx)("div",{className:"-esm-report-builder__exported-workspace-module__exportedWorkspace___5yaCt",children:m?(0,le.jsx)(x3,{openedWindow:m,groupProps:p,actions:d,renderChrome:!1,showActionMenu:!1}):null})},x9="-esm-report-builder__action-menu-button2-module__container___qxTbB",x8="-esm-report-builder__action-menu-button2-module__elementContainer___MzyUg",x7="-esm-report-builder__action-menu-button2-module__active___nMKHE",_e="-esm-report-builder__action-menu-button2-module__focused___ncbDv";function _t({getIcon:e,hasUnsavedChanges:t,tagContent:r}){return(0,le.jsxs)(le.Fragment,{children:[e({size:16}),t?(0,le.jsx)("span",{className:"-esm-report-builder__action-menu-button2-module__interruptedTag___HSn-T",children:"!"}):(0,le.jsx)("span",{className:"-esm-report-builder__action-menu-button2-module__countTag___bUcY2",children:r})]})}let _r=({icon:e,label:t,tagContent:r,workspaceToLaunch:n,onBeforeWorkspaceLaunch:a,hidden:o,disabled:i})=>{let s=uC(),{openedWindows:l,restoreWindow:u,hideWindow:c,isMostRecentlyOpenedWindowHidden:d}=xA(),{extension:m}=(0,s9.useContext)(s7),p=l.findIndex(e=>e.windowName===m?.extensionId),f=l[p],h=null!=f,g=h&&(p<l.length-1||d),y=h&&!g,v=f?.openedWorkspaces.some(e=>e.hasUnsavedChanges)??!1,b=async()=>{if(h)g?u(f.windowName):c();else if(await (a?.()??!0)){let{workspaceName:e,workspaceProps:t,windowProps:r}=n;xC(e,t,r)}};return o?.(l)?null:"tablet"===s||"phone"===s?(0,le.jsxs)(cl.$nd,{className:cn()(x9,{[x7]:h&&!y,[_e]:y}),iconDescription:t,kind:"ghost",onClick:b,role:"button",tabIndex:0,size:"md",disabled:i?.(l),children:[(0,le.jsx)("span",{className:x8,children:(0,le.jsx)(_t,{hasUnsavedChanges:v,getIcon:e,tagContent:r})}),(0,le.jsx)("span",{children:t})]}):(0,le.jsx)(cl.K0,{align:"left","aria-label":t,className:cn()(x9,{[x7]:h&&!y,[_e]:y}),enterDelayMs:300,kind:"ghost",label:t,onClick:b,size:"md",disabled:i?.(l),children:(0,le.jsx)("div",{className:x8,children:(0,le.jsx)(_t,{hasUnsavedChanges:v,getIcon:e,tagContent:r})})})};function _n({showContactDetails:e,toggleContactDetails:t,className:r}){return(0,le.jsx)(cl.$nd,{className:r,iconDescription:"Toggle contact details",kind:"ghost",onClick:t,renderIcon:e?cW:cB,children:e?aO("showLess","Show less"):aO("showMore","Show more")})}let _a={contactDetails:"-esm-report-builder__patient-banner-contact-details-module__contactDetails___+ytje",deceased:"-esm-report-builder__patient-banner-contact-details-module__deceased___mxjtl",heading:"-esm-report-builder__patient-banner-contact-details-module__heading___wxIC0",row:"-esm-report-builder__patient-banner-contact-details-module__row___dafkX",col:"-esm-report-builder__patient-banner-contact-details-module__col___vGkbd",relationship:"-esm-report-builder__patient-banner-contact-details-module__relationship___ZOV9O"},_o=({patientUuid:e})=>{let{cohorts:t=[],isLoading:r}=function(e){let t=e?`${az}/cohortm/cohortmember?patient=${e}&v=custom:(uuid,patient:ref,cohort:(uuid,name,startDate,endDate))`:null,{data:r,isLoading:n}=(0,lN.u)(t,aY),a=r?.data?.results.map(e=>({uuid:e.cohort.uuid,name:e.cohort.name,startDate:e.cohort.startDate,endDate:e.cohort.endDate}));return(0,s9.useMemo)(()=>({cohorts:a,isLoading:n}),[n,a])}(e);return(0,le.jsxs)(le.Fragment,{children:[(0,le.jsxs)("p",{className:_a.heading,children:[aO("patientLists","Patient Lists")," (",t?.length??0,")"]}),r?(0,le.jsx)(cl.OuH,{description:`${aO("loading","Loading")} ...`,role:"progressbar"}):(0,le.jsxs)("ul",{children:[(()=>{if(t?.length>0){let e=t.sort((e,t)=>wv(e?.startDate).getTime()-wv(t?.startDate).getTime()).slice(0,3);return e?.map(e=>(0,le.jsx)("li",{children:(0,le.jsx)(lt,{to:`${window.spaBase}/home/patient-lists/${e.uuid}`,children:e.name},e.uuid)},e.uuid))}return(0,le.jsx)("li",{children:"--"})})(),t.length>3&&(0,le.jsx)("li",{className:_a.link,children:(0,le.jsx)(lt,{to:`${window.spaBase}/home/patient-lists`,children:aO("seeMoreLists","See {{count}} more lists",{count:t?.length-3})})})]})]})},_i=({patientId:e})=>{let{patient:t,isLoading:r}=uL(e),n=t?.address?.find(e=>"home"===e.use),a=e=>e.split("#")[1];return r?(0,le.jsx)(cl.OuH,{description:`${aO("loading","Loading")} ...`,role:"progressbar"}):(0,le.jsxs)(le.Fragment,{children:[(0,le.jsx)("p",{className:_a.heading,children:aO("address","Address")}),(0,le.jsx)("ul",{children:n?Object.entries(n).filter(([e])=>"id"!==e&&"use"!==e).map(([e,t])=>"extension"===e?n.extension?.[0]?.extension?.map((t,r)=>(0,le.jsxs)("li",{children:[aO(a(t.url),a(t.url)),": ",t.valueString]},`address-${e}-${r}`)):(0,le.jsxs)("li",{children:[aO(e,e),": ",t]},`address-${e}`)):(0,le.jsx)("li",{children:"--"})})]})},_s=({patientUuid:e})=>{let{isLoading:t,contactAttributes:r}=(e=>{let{contactAttributeTypes:t=[]}=l8({externalModuleName:"@openmrs/esm-patient-banner-app"}),{attributes:r,error:n,isLoading:a}=(e=>{let{data:t,error:r,isLoading:n}=ur(`${az}/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)))`,aY);return{isLoading:n,attributes:t?.data.person.attributes??[],error:r}})(e);return{contactAttributes:(0,s9.useMemo)(()=>r.filter(({attributeType:e})=>t?.some(t=>e.uuid===t)),[r,t]),isLoading:a,error:n}})(e),n=(0,s9.useMemo)(()=>r?[...r?.map(e=>[e.attributeType.display?aO(e.attributeType.display,e.attributeType.display):"",e.value])]:[],[r]);return(0,le.jsxs)(le.Fragment,{children:[(0,le.jsx)("p",{className:_a.heading,children:aO("contactDetails","Contact Details")}),t?(0,le.jsx)(cl.OuH,{description:`${aO("loading","Loading")} ...`,role:"progressbar"}):(0,le.jsx)("ul",{children:n.length?n.map(([e,t],r)=>(0,le.jsxs)("li",{children:[e,": ",t]},`${e}-${t}-${r}`)):(0,le.jsx)("li",{children:"--"})})]})},_l=({patientId:e})=>{let{data:t,isLoading:r}=function(e){let t=`${az}/relationship?v=custom:(display,uuid,personA:(age,display,birthdate,uuid),personB:(age,display,birthdate,uuid),relationshipType:(uuid,display,description,aIsToB,bIsToA))&person=${e}`,{data:r,error:n,isLoading:a,isValidating:o}=(0,lN.u)(e?t:null,aY),i=r?.data?.results?.length?function(e,t){let r=[];for(let n of t)e===n.personA.uuid?r.push({uuid:`${n.uuid}`,display:n.personB.display,relativeAge:n.personB.age,relativeUuid:n.personB.uuid,relationshipType:n.relationshipType.bIsToA}):r.push({uuid:`${n.uuid}`,display:n.personA.display,relativeAge:n.personA.age,relativeUuid:n.personA.uuid,relationshipType:n.relationshipType.aIsToB});return r}(e,r.data.results):null;return{data:r?i:null,error:n,isLoading:a,isValidating:o}}(e);return(0,le.jsxs)(le.Fragment,{children:[(0,le.jsx)("p",{className:_a.heading,children:aO("relationships","Relationships")}),r?(0,le.jsx)(cl.OuH,{description:`${aO("loading","Loading")} ...`,role:"progressbar"}):(0,le.jsx)("ul",{children:t&&t.length>0?(0,le.jsx)(le.Fragment,{children:t.map(e=>(0,le.jsxs)("li",{className:_a.relationship,children:[(0,le.jsx)("div",{children:(0,le.jsx)(lt,{to:`${window.spaBase}/patient/${e.relativeUuid}/chart`,children:e.display})}),(0,le.jsx)("div",{children:e.relationshipType}),(0,le.jsx)("div",{children:`${e.relativeAge?e.relativeAge:"--"} ${e.relativeAge?1===e.relativeAge?aO("yearAbbreviation","yr"):aO("yearsAbbreviation","yrs"):""}`})]},e.uuid))}):(0,le.jsx)("li",{children:"--"})})]})};function _u({patientId:e,deceased:t}){return(0,le.jsxs)("div",{className:cn()(_a.contactDetails,{[_a.deceased]:t}),children:[(0,le.jsxs)("div",{className:_a.row,children:[(0,le.jsx)("div",{className:_a.col,children:(0,le.jsx)(_i,{patientId:e})}),(0,le.jsx)("div",{className:_a.col,children:(0,le.jsx)(_s,{patientUuid:e})})]}),(0,le.jsxs)("div",{className:_a.row,children:[(0,le.jsx)("div",{className:_a.col,children:(0,le.jsx)(_l,{patientId:e})}),(0,le.jsx)("div",{className:_a.col,children:(0,le.jsx)(_o,{patientUuid:e})})]})]})}function _c(e){let t=document.querySelector("template#loading-spinner");if(t){let r=t.content.cloneNode(!0),n=Array.prototype.map.call(r.childNodes,e=>e);return e.appendChild(r),()=>n.forEach(e=>e.remove())}return()=>{}}let _d="-esm-report-builder__action-menu2-module__container___usAej";function _m({workspaceGroup:e,groupProps:t}){let r=uC(),{persistence:n}=e;return(0,le.jsx)("aside",{className:"-esm-report-builder__action-menu2-module__sideRail___dTm93",children:(0,le.jsxs)("div",{className:_d,children:["closable"==n&&uk(r)&&(0,le.jsx)(cl.K0,{align:"left",onClick:()=>xS(),label:aO("close"),kind:"ghost",children:(0,le.jsx)(cH,{})}),(0,le.jsx)(s7.Provider,{value:{moduleName:e.moduleName,featureName:e.name},children:(0,le.jsx)(lg,{className:_d,name:e.name,state:{groupProps:t}})})]})})}function _p(e){let t=new URL(e,window.location.origin).pathname,r=new URL(window.getOpenmrsSpaBase?.()??"/",window.location.origin).pathname,n=r.endsWith("/")?r.slice(0,-1):r,a=null;return n?n===t?a="/":t.startsWith(`${n}/`)&&(a=t.slice(n.length)):a=t,{full:t,spaRelative:a}}function _f(e){e&&(0,ly.createRoot)(e).render((0,le.jsx)(_h,{}))}function _h(){let{openedGroup:e,openedWindows:t,registeredGroupsByName:r,registeredWindowsByName:n}=xA();if((0,s9.useEffect)(()=>it("before-page-changed",t=>{let{newPage:n,cancelNavigation:a,oldUrl:o,newUrl:i}=t;if(!e)return;if(n)return void a(xS().then(e=>!e));let s=r[e.groupName],l=s?.scopePattern;l&&function(e,t,r){try{let n=new RegExp(e),a=_p(t),o=_p(r);if(null===a.spaRelative||null===o.spaRelative)return!0;let i=n.exec(a.spaRelative),s=n.exec(o.spaRelative);if(i&&s||(i=n.exec(a.full),s=n.exec(o.full)),!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)&&a(xS().then(e=>!e))}),[e,r]),!e)return null;let a=r[e.groupName],o=t.some(e=>e.maximized),{name:i}=a,s=Object.values(n).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,le.jsxs)("div",{className:cn()("-esm-report-builder__workspace-windows-and-menu-module__workspaceWindowsAndMenuContainer___CSZs-",{"-esm-report-builder__workspace-windows-and-menu-module__overlay___0kl8U":a.overlay,"-esm-report-builder__workspace-windows-and-menu-module__hasMaximizedWindow___+DcH9":o}),children:[(0,le.jsx)("div",{className:"-esm-report-builder__workspace-windows-and-menu-module__workspaceWindowsContainer___s8ddv",children:t.map(t=>(0,le.jsx)(_g,{openedWindow:t,groupProps:e.props,showActionMenu:s},t.windowName))}),s&&(0,le.jsx)(_m,{workspaceGroup:a,groupProps:e.props})]})}function _g({openedWindow:e,groupProps:t,showActionMenu:r}){let{windowName:n}=e,a=(0,s9.useMemo)(()=>({closeWorkspace(e){sK.setState(t=>xj.closeWorkspace(t,e))},openChildWorkspace(e,t,r){sK.setState(n=>xj.openChildWorkspace(n,e,t,r))},setWorkspaceTitle(e,t){sK.setState(r=>xj.setWorkspaceTitle(r,e,t))},setHasUnsavedChanges(e,t){sK.setState(r=>xj.setHasUnsavedChanges(r,e,t))},promptForClosingWorkspaces(e){let t=sK.getState().openedWindows.find(e=>e.windowName===n);return t?x$(t,e):Promise.resolve(!0)}}),[n]);return(0,le.jsx)(x3,{openedWindow:e,groupProps:t,actions:a,renderChrome:!0,showActionMenu:r})}function _y(e,t,r){if(null==e)return r;let n=bV(e);if(!n)return console.warn(`matchLocale: invalid requested locale tag: ${JSON.stringify(e)}`),r;let a=[];for(let e of t){let t=bV(e);if(!t){console.warn(`matchLocale: skipping invalid available locale tag: ${JSON.stringify(e)}`);continue}a.push({canonical:t,original:e})}let o=n;for(;o;){let e=a.find(e=>e.canonical===o);if(e)return e.original;let t=o+"-",r=a.find(e=>e.canonical.startsWith(t));if(r)return r.original;if("ht"===o){o="fr-HT";continue}let n=o.lastIndexOf("-");if(-1===n)break;let i=(o=o.slice(0,n)).lastIndexOf("-");-1!==i&&o.length-i==2&&(o=o.slice(0,i))}return r}function _v(e=window.localStorage){try{return e.getItem("test"),!0}catch{return!1}}function _b(e){return!!e&&e.constructor===Object}var _w=r(7638);function _E(e){let[t,r,n]=e.split(".");return`${t}.${r}.${n}`}function _D(e,t){return _w(function(e){let t=e.indexOf("-");if(t>=0){let r=_E(e.slice(0,t)),n=e.slice(t+1);return`${r}-${n}`}return _E(e)}(t),e,{includePrerelease:!0})}async function _x(e,t={}){let r,{shouldRetry:n,getDelay:a,onError:o}=t;n=n??(e=>e<=5),a=a??(e=>(function(e,t=!1){return 1e3*Math.pow(2,t?e+1:e)})(e));let i=0;do try{return await __(a(i)),await e()}catch(e){o?.(e,i),r=e}while(n(i++));throw r}async function __(e){if(!(e<=0))return new Promise(t=>setTimeout(t,e))}function _S(e,t,r,n){}function _C(e){}function _k(e){return Promise.resolve([])}function _P(e){return Promise.resolve([])}function _R(e){return Promise.resolve({success:!1,result:void 0,error:"No service worker has been registered. Offline-related features have been removed from the framework."})}function _T(e){return()=>{}}function _$(){return!0}}}]);