@openmrs/esm-stock-management-app 3.2.2-pre.1762 → 3.2.2-pre.1764

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/6168.js CHANGED
@@ -9,7 +9,7 @@ If you're the maintainer: the allowed types are ${Object.values(tM).join(", ")}.
9
9
  If you're the maintainer: all config elements must have a default. Received ${JSON.stringify(i)}`),s&&l&&![tM.Array,tM.Object].includes(l)&&console.error(`${e} has bad config schema definition for key '${o}'. ${r}.
10
10
 
11
11
  If you're the maintainer: the 'elements' key only works with '_type' equal to 'Array' or 'Object'. Received ${JSON.stringify(l)}`)}}function n_(e,t){return nk(t.map(({[e]:t})=>t).filter(e=>!!e))}function nk(e){return e.reduce((e,t)=>e4(e,t,nn),{})}function nS(e,t,n=""){for(let r of Object.keys(t)){let a=t[r],o=n+"."+r,i=e[r];if(!e.hasOwnProperty(r)){("extensionSlots"!==r||""===n)&&nA(o,`Unknown config key '${o}' provided. Ignoring.`);continue}(function e(t,n,r){nP(r,t._type,n),nO(n)?t._type===tM.Object?function(t,n,r){if(t._elements)for(let a of Object.keys(n)){let o=n[a];e(t._elements,o,`${r}.${a}`)}}(t,n,r):t.hasOwnProperty("_default")||t.hasOwnProperty("_type")||nS(t,n,r):t._type===tM.Array&&function(t,n,r){if(nP(r,tM.Array,n)){if(n$(t._elements))for(let a=0;a<n.length;a++)e(t._elements,n[a],`${r}[${a}]`);for(let e=0;e<n.length;e++)nP(`${r}[${e}]`,t._elements?._type,n[e])}}(t,n,r)})(i,a,o)}}function nC(e,t,n=""){if(e){if(t!==e._default&&nR(n,e._validators,t),nO(t))for(let r of Object.keys(t)){let a=t[r],o=n+"."+r,i=e[r];e._type===tM.Object&&e._elements?nC(e._elements,a,o):nC(i,a,o)}else if(Array.isArray(t)&&e._elements)for(let r=0;r<t.length;r++)nC(e._elements,t[r],`${n}[${r}]`)}}function nP(e,t,n){return!t||nR(e,[{Array:tF,Boolean:tB,ConceptUuid:tH,Number:tV,Object:tW,String:tU,UUID:tH,PersonAttributeTypeUuid:tH,PatientIdentifierTypeUuid:tH}[t]],n)}function nR(e,t,n){let r=!0;if(t)try{for(let a of t){let t=a(n);if("string"==typeof t){let a="object"==typeof n?`Invalid configuration for ${e}: ${t}`:`Invalid configuration value ${n} for ${e}: ${t}`;nA(e,a),r=!1}}}catch(t){console.error(`Skipping invalid validator at "${e}". Encountered error
12
- ${t}`)}return r}let nT=(e,t)=>{let n=structuredClone(t);if(!e)return n;for(let t of Object.keys(e)){let r=n[t],a=e[t];if(a&&(a.hasOwnProperty("_type")||a.hasOwnProperty("_default"))){n.hasOwnProperty(t)||(n[t]=a._default);let e=a._elements;if(r&&n$(e)){if(a._type===tM.Array&&Array.isArray(r)){let a=r.map(t=>nT(e,t));n[t]=a}else if(a._type===tM.Object)for(let t of Object.keys(r))r[t]=nT(e,r[t])}}else if(nO(a)){let e=r??{};nO(e)&&(n[t]=nT(a,e))}}return n};function n$(e){return!!e&&Object.keys(e).filter(e=>!["_default","_validators"].includes(e)).length>0}function nO(e){return"object"==typeof e&&!Array.isArray(e)&&null!==e}let nN=new Set;function nA(e,t){let n=`${e}:::${t}`;nN||(nN=new Set),nN.has(n)||(console.error(t),nN.add(n))}function nI(e){e?nN.forEach(t=>{t.startsWith(e)&&nN.delete(t)}):nN.clear()}function nj(){na.forEach(e=>e()),na.length=0,nl.clear(),nb.clear(),nE.clear(),nw.clear(),ni()}let nM={"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:tM.Object,_default:{},_validators:[tL(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(", ")}.`})]}},nL={"Display conditions":{privileges:{_description:"The privilege(s) the user must have to use this extension",_type:tM.Array,_default:[]},expression:{_description:"The expression that determines whether the extension is displayed",_type:tM.String,_default:void 0}},...nM},nF=(e,t)=>tL(n=>e<=n&&n<=t,`must be between ${e} and ${t}`),nB=e=>{let t=e.concat(["openmrsBase","openmrsSpaBase"]);return tL(e=>{if(!e||"string"!=typeof e)return!1;let n=/\${(.*?)}/g,r=n.exec(e);for(;r;){if(!t.includes(r[1]))return!1;r=n.exec(e)}return!0},"Should be a URL or path. The allowed template parameters are "+t.map(e=>"${"+e+"}").join(", "))},nV=nB([]),nU=e=>tL(t=>e.includes(t),`Must be one of the following: '${e.join("', '")}'.`),nW={inRange:nF,isUrl:nV,isUrlWithTemplateParameters:nB,oneOf:nU};var nH=n(8067);let nz=F("breadcrumbs",[]);function nK(e){return nG([e])}function nG(e){let t=[...nZ(),...e.map(e=>({matcher:e.matcher instanceof RegExp?e.matcher:"string"==typeof e.matcher?(0,nH.pathToRegexp)(e.matcher).regexp:(0,nH.pathToRegexp)(e.path).regexp,settings:e}))];nz.setState(t,!0)}function nZ(){return nz.getState()}function nY(e,t){if(t)return function(e,t){let[n]=e.filter(e=>e.matcher.test(t));return n}(e,t)||function(e,t){let n=t.split("/");for(;n.length>1;){n.pop();let t=nY(e,n.join("/"));if(t)return t}}(e,t)}function nq(e,t){if(e.length>0){let n=nY(e,t);if(n){let t=[n],r=nY(e,n.settings.parent);for(;void 0!==r;)t.push(r),r=nY(e,r.settings.parent);return t.reverse()}}return[]}function nJ(e){return nq(nZ(),e)}var nX=Object.freeze({__proto__:null,get start(){return am},get ensureJQuerySupport(){return rJ},get setBootstrapMaxTime(){return rO},get setMountMaxTime(){return rN},get setUnmountMaxTime(){return rA},get setUnloadMaxTime(){return rI},get registerApplication(){return r8},get unregisterApplication(){return ae},get getMountedApps(){return r3},get getAppStatus(){return r5},get unloadApplication(){return at},get checkActivityFunctions(){return r7},get getAppNames(){return r6},get pathToActiveWhen(){return aa},get navigateToUrl(){return rU},get patchHistoryApi(){return rZ},get triggerAppChange(){return al},get addErrorHandler(){return n2},get removeErrorHandler(){return n3},get mountRootParcel(){return rC},get NOT_LOADED(){return n9},get LOADING_SOURCE_CODE(){return n8},get NOT_BOOTSTRAPPED(){return n7},get BOOTSTRAPPING(){return re},get NOT_MOUNTED(){return rt},get MOUNTING(){return rn},get UPDATING(){return ra},get LOAD_ERROR(){return rs},get MOUNTED(){return rr},get UNLOADING(){return ri},get UNMOUNTING(){return ro},get SKIP_BECAUSE_BROKEN(){return rl}}),nQ=("u">typeof globalThis?globalThis:"u">typeof window?window:"u">typeof global?global:"u">typeof self?self:{}).CustomEvent,n0=!function(){try{var e=new nQ("cat",{detail:{foo:"bar"}});return"cat"===e.type&&"bar"===e.detail.foo}catch(e){}return!1}()?"u">typeof document&&"function"==typeof document.createEvent?function(e,t){var n=document.createEvent("CustomEvent");return t?n.initCustomEvent(e,t.bubbles,t.cancelable,t.detail):n.initCustomEvent(e,!1,!1,void 0),n}:function(e,t){var n=document.createEventObject();return n.type=e,t?(n.bubbles=!!t.bubbles,n.cancelable=!!t.cancelable,n.detail=t.detail):(n.bubbles=!1,n.cancelable=!1,n.detail=void 0),n}:nQ;let n1=[];function n4(e,t,n){let r=n5(e,t,n);n1.length?n1.forEach(e=>e(r)):setTimeout(()=>{throw r})}function n2(e){if("function"!=typeof e)throw Error(n6(28,!1));n1.push(e)}function n3(e){if("function"!=typeof e)throw Error(n6(29,!1));let t=!1;return n1=n1.filter(n=>{let r=n===e;return t=t||r,!r}),t}function n6(e,t,...n){return`single-spa minified message #${e}: ${t?t+" ":""}See https://single-spa.js.org/error/?code=${e}${n.length?`&arg=${n.join("&arg=")}`:""}`}function n5(e,t,n){let r,a=`${rp(t)} '${rd(t)}' died in status ${t.status}: `;if(e instanceof Error){try{e.message=a+e.message}catch(e){}r=e}else{console.warn(n6(30,!1,t.status,rd(t)));try{r=Error(a+JSON.stringify(e))}catch(t){r=e}}return r.appOrParcelName=rd(t),t.status=n,r}let n9="NOT_LOADED",n8="LOADING_SOURCE_CODE",n7="NOT_BOOTSTRAPPED",re="BOOTSTRAPPING",rt="NOT_MOUNTED",rn="MOUNTING",rr="MOUNTED",ra="UPDATING",ro="UNMOUNTING",ri="UNLOADING",rs="LOAD_ERROR",rl="SKIP_BECAUSE_BROKEN";function ru(e){return e.status===rr}function rc(e){try{return e.activeWhen(window.location)}catch(t){return n4(t,e,rl),!1}}function rd(e){return e.name}function rm(e){return!!e.unmountThisParcel}function rp(e){return rm(e)?"parcel":"application"}function rf(){for(let e=arguments.length-1;e>0;e--)for(let t in arguments[e])"__proto__"!==t&&(arguments[e-1][t]=arguments[e][t]);return arguments[0]}function rh(e,t){for(let n=0;n<e.length;n++)if(t(e[n]))return e[n];return null}function rg(e){return e&&("function"==typeof e||Array.isArray(e)&&!rh(e,e=>"function"!=typeof e))}function ry(e,t){let n=e[t]||[];0===(n=Array.isArray(n)?n:[n]).length&&(n=[()=>Promise.resolve()]);let r=rp(e),a=rd(e);return function(e){return n.reduce((n,o,i)=>n.then(()=>{let n=o(e);return rv(n)?n:Promise.reject(n6(15,!1,r,a,t,i))}),Promise.resolve())}}function rv(e){return e&&"function"==typeof e.then&&"function"==typeof e.catch}let rb=[];function rw(e,t){return Promise.resolve().then(()=>e.status!==n7?e:(e.status=re,e.bootstrap?rj(e,"bootstrap").then(n).catch(n=>{if(t)throw n5(n,e,rl);return n4(n,e,rl),e}):Promise.resolve().then(n)));function n(){return e.status=rt,e}}function rE(e,t){return Promise.resolve().then(()=>{if(e.status!==rr)return e;return e.status=ro,Promise.all(Object.keys(e.parcels).map(t=>e.parcels[t].unmountThisParcel())).then(n,r=>n().then(()=>{let n=Error(r.message);if(t)throw n5(n,e,rl);n4(n,e,rl)})).then(()=>e);function n(){return rj(e,"unmount").then(()=>{e.status=rt},n=>{if(t)throw n5(n,e,rl);n4(n,e,rl)})}})}let rx=!1,rD=!1;function r_(e,t){return Promise.resolve().then(()=>e.status!==rt?e:(rx||(window.dispatchEvent(new n0("single-spa:before-first-mount")),rx=!0),e.status=rn,rj(e,"mount").then(()=>(e.status=rr,rD||(window.dispatchEvent(new n0("single-spa:first-mount")),rD=!0),e)).catch(n=>{return e.status=rr,rE(e,!0).then(r,r);function r(){if(t)throw n5(n,e,rl);return n4(n,e,rl),e}})))}let rk=0,rS={parcels:{}};function rC(){return rP.apply(rS,arguments)}function rP(e,t){let n,r,a,o=this;if(!e||"object"!=typeof e&&"function"!=typeof e)throw Error(n6(2,!1));if(e.name&&"string"!=typeof e.name)throw Error(n6(3,!1,typeof e.name));let i=rk++,s=e.name||`parcel-${i}`;if("object"!=typeof t)throw Error(n6(4,!1,s,typeof t));if(!t.domElement)throw Error(n6(5,!1,s));let l="function"==typeof e,u=l?e:()=>Promise.resolve(e),c={id:i,parcels:{},status:l?n8:n7,customProps:t,parentName:rd(o),unmountThisParcel:()=>p.then(()=>{if(c.status!==rr)throw Error(n6(6,!1,s,c.status));return rE(c,!0)}).then(e=>(c.parentName&&delete o.parcels[c.id],e)).then(e=>(r(e),e)).catch(e=>{throw c.status=rl,a(e),e})};o.parcels[i]=c;let d=u();if(!d||"function"!=typeof d.then)throw Error(n6(7,!1));let m=(d=d.then(e=>{if(!e)throw Error(n6(8,!1));if(s=e.name||`parcel-${i}`,Object.prototype.hasOwnProperty.call(e,"bootstrap")&&!rg(e.bootstrap))throw Error(n6(9,!1,s));if(!rg(e.mount))throw Error(n6(10,!1,s));if(!rg(e.unmount))throw Error(n6(11,!1,s));if(e.update&&!rg(e.update))throw Error(n6(12,!1,s));let t=ry(e,"bootstrap"),r=ry(e,"mount"),a=ry(e,"unmount");c.status=n7,c.name=s,c.bootstrap=t,c.mount=r,c.unmount=a,c.timeouts=rM(e.timeouts),e.update&&(c.update=ry(e,"update"),n.update=function(e){return c.customProps=e,rR(Promise.resolve().then(()=>{if(c.status!==rr)throw Error(n6(32,!1,rd(c)));return c.status=ra,rj(c,"update").then(()=>(c.status=rr,c)).catch(e=>{throw n5(e,c,rl)})}))})})).then(()=>rw(c,!0)),p=m.then(()=>r_(c,!0)),f=new Promise((e,t)=>{r=e,a=t});return n={mount:()=>rR(Promise.resolve().then(()=>{if(c.status!==rt)throw Error(n6(13,!1,s,c.status));return o.parcels[i]=c,r_(c)})),unmount:()=>rR(c.unmountThisParcel()),getStatus:()=>c.status,loadPromise:rR(d),bootstrapPromise:rR(m),mountPromise:rR(p),unmountPromise:rR(f)}}function rR(e){return e.then(()=>null)}function rT(e){let t=rd(e),n="function"==typeof e.customProps?e.customProps(t,window.location):e.customProps;("object"!=typeof n||null===n||Array.isArray(n))&&(n={},console.warn(n6(40,!1),t,n));let r=rf({},n,{name:t,mountParcel:rP.bind(e),singleSpa:nX});return rm(e)&&(r.unmountSelf=e.unmountThisParcel),r}let r$={bootstrap:{millis:4e3,dieOnTimeout:!1,warningMillis:1e3},mount:{millis:3e3,dieOnTimeout:!1,warningMillis:1e3},unmount:{millis:3e3,dieOnTimeout:!1,warningMillis:1e3},unload:{millis:3e3,dieOnTimeout:!1,warningMillis:1e3},update:{millis:3e3,dieOnTimeout:!1,warningMillis:1e3}};function rO(e,t,n){if("number"!=typeof e||e<=0)throw Error(n6(16,!1));r$.bootstrap={millis:e,dieOnTimeout:t,warningMillis:n||1e3}}function rN(e,t,n){if("number"!=typeof e||e<=0)throw Error(n6(17,!1));r$.mount={millis:e,dieOnTimeout:t,warningMillis:n||1e3}}function rA(e,t,n){if("number"!=typeof e||e<=0)throw Error(n6(18,!1));r$.unmount={millis:e,dieOnTimeout:t,warningMillis:n||1e3}}function rI(e,t,n){if("number"!=typeof e||e<=0)throw Error(n6(19,!1));r$.unload={millis:e,dieOnTimeout:t,warningMillis:n||1e3}}function rj(e,t){let n=e.timeouts[t],r=n.warningMillis,a=rp(e);return new Promise((o,i)=>{let s=!1,l=!1;e[t](rT(e)).then(e=>{s=!0,o(e)}).catch(e=>{s=!0,i(e)}),setTimeout(()=>c(1),r),setTimeout(()=>c(!0),n.millis);let u=n6(31,!1,t,a,rd(e),n.millis);function c(e){s||(!0===e?(l=!0,n.dieOnTimeout?i(Error(u)):console.error(u)):!l&&(console.warn(u),e*r+r<n.millis&&setTimeout(()=>c(e+1),r)))}})}function rM(e){let t={};for(let n in r$)t[n]=rf({},r$[n],e&&e[n]||{});return t}function rL(e){return Promise.resolve().then(()=>{let t,n;return e.loadPromise?e.loadPromise:e.status!==n9&&e.status!==rs?e:(e.status=n8,e.loadPromise=Promise.resolve().then(()=>{let r=e.loadApp(rT(e));if(!rv(r))throw n=!0,Error(n6(33,!1,rd(e)));return r.then(n=>{let r;e.loadErrorTime=null,"object"!=typeof(t=n)&&(r=34),Object.prototype.hasOwnProperty.call(t,"bootstrap")&&!rg(t.bootstrap)&&(r=35),rg(t.mount)||(r=36),rg(t.unmount)||(r=37);let a=rp(t);if(r){let n;try{n=JSON.stringify(t)}catch(e){}return console.error(n6(r,!1,a,rd(e),n),t),n4(void 0,e,rl),e}return t.devtools&&t.devtools.overlays&&(e.devtools.overlays=rf({},e.devtools.overlays,t.devtools.overlays)),e.status=n7,e.bootstrap=ry(t,"bootstrap"),e.mount=ry(t,"mount"),e.unmount=ry(t,"unmount"),e.unload=ry(t,"unload"),e.timeouts=rM(t.timeouts),delete e.loadPromise,e})}).catch(t=>{let r;return delete e.loadPromise,n?r=rl:(r=rs,e.loadErrorTime=(new Date).getTime()),n4(t,e,r),e}))})}let rF="u">typeof window,rB={hashchange:[],popstate:[]},rV=["hashchange","popstate"];function rU(e){let t;if("string"==typeof e)t=e;else if(this&&this.href)t=this.href;else{if(!(e&&e.currentTarget&&e.currentTarget.href&&e.preventDefault))throw Error(n6(14,!1));t=e.currentTarget.href,e.preventDefault()}let n=rY(window.location.href),r=rY(t);0===t.indexOf("#")?window.location.hash=r.hash:n.host!==r.host&&r.host?window.location.href=t:r.pathname===n.pathname&&r.search===n.search?window.location.hash=r.hash:window.history.pushState(null,null,t)}function rW(e){if(e){let t=e[0].type;rV.indexOf(t)>=0&&rB[t].forEach(t=>{try{t.apply(this,e)}catch(e){setTimeout(()=>{throw e})}})}}function rH(){au([],arguments)}function rz(e,t){return function(){let n=window.location.href,r=e.apply(this,arguments),o=window.location.href;return a&&n===o||window.dispatchEvent(function(e,t){let n;try{n=new PopStateEvent("popstate",{state:e})}catch(t){(n=document.createEvent("PopStateEvent")).initPopStateEvent("popstate",!1,!1,e)}return n.singleSpa=!0,n.singleSpaTrigger=t,n}(window.history.state,t)),r}}let rK=null,rG=!1;function rZ(e){if(rG)throw Error(n6(43,!1));a=!e||!e.hasOwnProperty("urlRerouteOnly")||e.urlRerouteOnly,rG=!0,rK=window.history.replaceState,window.addEventListener("hashchange",rH),window.addEventListener("popstate",rH);let t=window.addEventListener,n=window.removeEventListener;window.addEventListener=function(e,n){if(!("function"==typeof n&&rV.indexOf(e)>=0)||rh(rB[e],e=>e===n))return t.apply(this,arguments);rB[e].push(n)},window.removeEventListener=function(e,t){return"function"==typeof t&&rV.indexOf(e)>=0&&(rB[e]=rB[e].filter(e=>e!==t)),n.apply(this,arguments)},window.history.pushState=rz(window.history.pushState,"pushState"),window.history.replaceState=rz(rK,"replaceState")}function rY(e){let t=document.createElement("a");return t.href=e,t}rF&&(window.singleSpaNavigate?console.warn(n6(41,!1)):window.singleSpaNavigate=rU);let rq=!1;function rJ(e=window.jQuery){if(e||window.$&&window.$.fn&&window.$.fn.jquery&&(e=window.$),e&&!rq){let t=e.fn.on,n=e.fn.off;e.fn.on=function(e,n){return rX.call(this,t,window.addEventListener,e,n,arguments)},e.fn.off=function(e,t){return rX.call(this,n,window.removeEventListener,e,t,arguments)},rq=!0}}function rX(e,t,n,r,a){return"string"!=typeof n?e.apply(this,a):(n.split(/\s+/).forEach(e=>{rV.indexOf(e)>=0&&(t(e,r),n=n.replace(e,""))}),""===n.trim()?this:e.apply(this,a))}let rQ={};function r0(e){return Promise.resolve().then(()=>{let t=rQ[rd(e)];if(!t)return e;if(e.status===n9)return r1(e,t),e;if(e.status===ri)return t.promise.then(()=>e);if(e.status!==rt&&e.status!==rs)return e;let n=e.status===rs?Promise.resolve():rj(e,"unload");return e.status=ri,n.then(()=>(r1(e,t),e)).catch(n=>(delete rQ[rd(e)],delete e.bootstrap,delete e.mount,delete e.unmount,delete e.unload,n4(n,e,rl),t.reject(n),e))})}function r1(e,t){delete rQ[rd(e)],delete e.bootstrap,delete e.mount,delete e.unmount,delete e.unload,e.status=n9,t.resolve()}function r4(e,t,n,r){rQ[rd(e)]={app:e,resolve:n,reject:r},Object.defineProperty(rQ[rd(e)],"promise",{get:t})}let r2=[];function r3(){return r2.filter(ru).map(rd)}function r6(){return r2.map(rd)}function r5(e){let t=rh(r2,t=>rd(t)===e);return t?t.status:null}let r9=!1;function r8(e,t,n,r){var a,o;let i,s,l=(i={name:null,loadApp:null,activeWhen:null,customProps:null},"object"==typeof e?(function(e){if(Array.isArray(e)||null===e)throw Error(n6(39,!1));let t=["name","app","activeWhen","customProps"],n=Object.keys(e).reduce((e,n)=>t.indexOf(n)>=0?e:e.concat(n),[]);if(0!==n.length)throw Error(n6(38,!1,t.join(", "),n.join(", ")));if("string"!=typeof e.name||0===e.name.length||"object"!=typeof e.app&&"function"!=typeof e.app)throw Error(n6(20,!1));let r=e=>"string"==typeof e||"function"==typeof e;if(!(r(e.activeWhen)||Array.isArray(e.activeWhen)&&e.activeWhen.every(r)))throw Error(n6(24,!1));if(!ar(e.customProps))throw Error(n6(22,!1))}(e),i.name=e.name,i.loadApp=e.app,i.activeWhen=e.activeWhen,i.customProps=e.customProps):(function(e,t,n,r){if("string"!=typeof e||0===e.length)throw Error(n6(20,!1));if(!t)throw Error(n6(23,!1));if("function"!=typeof n)throw Error(n6(24,!1));if(!ar(r))throw Error(n6(22,!1))}(e,t,n,r),i.name=e,i.loadApp=t,i.activeWhen=n,i.customProps=r),i.loadApp="function"!=typeof(a=i.loadApp)?()=>Promise.resolve(a):a,i.customProps=i.customProps||{},s=(s=Array.isArray(o=i.activeWhen)?o:[o]).map(e=>"function"==typeof e?e:aa(e)),i.activeWhen=e=>s.some(t=>t(e)),i);if(ad||r9||(r9=!0,setTimeout(()=>{ad||console.warn(n6(1,!1))},5e3)),-1!==r6().indexOf(l.name))throw Error(n6(21,!1,l.name));r2.push(rf({loadErrorTime:null,status:n9,parcels:{},devtools:{overlays:{options:{},selectors:[]}}},l)),rF&&(rJ(),au())}function r7(e=window.location){return r2.filter(t=>t.activeWhen(e)).map(rd)}function ae(e){if(0===r2.filter(t=>rd(t)===e).length)throw Error(n6(25,!1,e));return(rF?at(e,{waitForUnmount:!1}):Promise.resolve()).then(()=>{let t=r2.map(rd).indexOf(e);r2.splice(t,1)})}function at(e,t={waitForUnmount:!1}){if("string"!=typeof e)throw Error(n6(26,!1));let n=rh(r2,t=>rd(t)===e);if(!n)throw Error(n6(27,!1,e));let r=rQ[rd(n)];if(t&&t.waitForUnmount){if(r)return r.promise;{let e=new Promise((t,r)=>{r4(n,()=>e,t,r)});return e}}{let e;return r?(e=r.promise,an(n,r.resolve,r.reject)):e=new Promise((t,r)=>{r4(n,()=>e,t,r),an(n,t,r)}),e}}function an(e,t,n){Promise.resolve().then(()=>{if(rh(r7(),t=>t===rd(e)))return al()}).then(()=>rE(e).then(r0).then(()=>{t(),setTimeout(()=>{au()})})).catch(n)}function ar(e){return!e||"function"==typeof e||"object"==typeof e&&null!==e&&!Array.isArray(e)}function aa(e,t){let n=function(e,t){let n=0,r=!1,a="^";"/"!==e[0]&&(e="/"+e);for(let t=0;t<e.length;t++){let n=e[t],a=r&&"/"===n;(!r&&":"===n||a)&&o(t)}return o(e.length),RegExp(a,"i");function o(o){let i=e.slice(n,o).replace(/[|\\{}()[\]^$+*?.]/g,"\\$&");if(a+=r?"[^/]+/?":i,o===e.length)if(r)t&&(a+="$");else{let e=t?"":".*";a="/"===a.charAt(a.length-1)?`${a}${e}$`:`${a}(/${e})?(#.*)?$`}r=!r,n=o}}(e,t);return e=>{let t=e.origin;t||(t=`${e.protocol}//${e.host}`);let r=e.href.replace(t,"").replace(e.search,"").split("?")[0];return n.test(r)}}let ao=!1,ai=[],as=rF&&window.location.href;function al(){return au()}function au(e=[],t,n=!1){let r,a,o,i,s;if(ao)return new Promise((e,n)=>{ai.push({resolve:e,reject:n,eventArguments:t})});let{appsToUnload:l,appsToUnmount:u,appsToLoad:c,appsToMount:d}=(r=[],a=[],o=[],i=[],s=(new Date).getTime(),r2.forEach(e=>{let t=e.status!==rl&&rc(e);switch(e.status){case rs:t&&s-e.loadErrorTime>=200&&o.push(e);break;case n9:case n8:t&&o.push(e);break;case n7:case rt:!t&&rQ[rd(e)]?r.push(e):t&&i.push(e);break;case rr:t||a.push(e)}}),{appsToUnload:r,appsToUnmount:a,appsToLoad:o,appsToMount:i}),m,p=[],f=as,h=as=window.location.href;return ad?(ao=!0,m=l.concat(c,u,d),Promise.resolve().then(()=>(w(0===m.length?"before-no-app-change":"before-app-change",b(!0)),w("before-routing-event",b(!0,{cancelNavigation:g})),Promise.all(p).then(n=>{if(n.some(e=>e))return rK.call(window.history,history.state,"",f.substring(location.origin.length)),as=location.href,ao=!1,au(e,t,!0);let r=l.map(r0),a=Promise.all(u.map(rE).map(e=>e.then(r0)).concat(r));a.then(()=>{w("before-mount-routing-event",b(!0))},e=>{throw e});let o=c.map(e=>rL(e).then(e=>ac(e,a))),i=d.filter(e=>0>c.indexOf(e)).map(e=>ac(e,a));return a.catch(e=>{throw v(),e}).then(()=>(v(),Promise.all(o.concat(i)).catch(t=>{throw e.forEach(e=>e.reject(t)),t}).then(y).then(()=>{},e=>{throw e})))})))):(m=c,Promise.resolve().then(()=>Promise.all(c.map(rL)).then(v).then(()=>[]).catch(e=>{throw v(),e}).finally(()=>{})));function g(e=!0){let t="function"==typeof(null==e?void 0:e.then)?e:Promise.resolve(e);p.push(t.catch(e=>(console.warn(Error(n6(42,!1))),console.warn(e),!1)))}function y(){let t=r3();e.forEach(e=>e.resolve(t));try{w(0===m.length?"no-app-change":"app-change",b()),w("routing-event",b())}catch(e){setTimeout(()=>{throw e})}if(ao=!1,ai.length>0){let e=ai;ai=[],au(e)}return t}function v(){n||(e.forEach(e=>{rW(e.eventArguments)}),rW(t))}function b(e=!1,n){let r={},a={[rr]:[],[rt]:[],[n9]:[],[rl]:[]};e?(c.concat(d).forEach((e,t)=>{i(e,rr)}),l.forEach(e=>{i(e,n9)}),u.forEach(e=>{i(e,rt)})):m.forEach(e=>{i(e)});let o={detail:{newAppStatuses:r,appsByNewStatus:a,totalAppChanges:m.length,originalEvent:null==t?void 0:t[0],oldUrl:f,newUrl:h}};return n&&rf(o.detail,n),o;function i(e,t){let n=rd(e);t=t||r5(n),r[n]=t,(a[t]=a[t]||[]).push(n)}}function w(e,t){n||window.dispatchEvent(new n0(`single-spa:${e}`,t))}}function ac(e,t){return rc(e)?rw(e).then(e=>t.then(()=>rc(e)?r_(e):e)):t.then(()=>e)}let ad=!1;function am(e){ad=!0,rF&&(rZ(e),au())}rF&&window.__SINGLE_SPA_DEVTOOLS__&&(window.__SINGLE_SPA_DEVTOOLS__.exposedMethods={getRawAppData:function(){return[...r2]},reroute:au,NOT_LOADED:n9,toLoadPromise:rL,toBootstrapPromise:rw,unregisterApplication:ae,getProfilerData:function(){return rb}});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",batchActionItemSelected:"{{totalSelected}} item selected",batchActionsItemsSelected:"{{totalSelected}} items selected",cancel:"Cancel",change:"Change",Clinic:"Clinic",close:"Close",closesActionableNotification:"Close actionable notification",closeSnackbar:"Close snackbar",confirm:"Confirm",contactAdministratorIfIssuePersists:"Contact your system administrator if the problem persists.",contactDetails:"Contact details",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",recordNewEntry:"Record {{displayText}}",relationships:"Relationships",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",sex:"Sex",showLess:"Show less",showMore:"Show more",snackbarNotification:"Snackbar notification",toggleDevTools:"Toggle dev tools",unknown:"Unknown",yearAbbreviation:"yr",yearsAbbreviation:"yrs"},af=e=>"string"==typeof e,ah=()=>{let e,t,n=new Promise((n,r)=>{e=n,t=r});return n.resolve=e,n.reject=t,n},ag=e=>null==e?"":""+e,ay=/###/g,av=e=>e&&e.indexOf("###")>-1?e.replace(ay,"."):e,ab=e=>!e||af(e),aw=(e,t,n)=>{let r=af(t)?t.split("."):t,a=0;for(;a<r.length-1;){if(ab(e))return{};let t=av(r[a]);!e[t]&&n&&(e[t]=new n),e=Object.prototype.hasOwnProperty.call(e,t)?e[t]:{},++a}return ab(e)?{}:{obj:e,k:av(r[a])}},aE=(e,t,n)=>{let{obj:r,k:a}=aw(e,t,Object);if(void 0!==r||1===t.length){r[a]=n;return}let o=t[t.length-1],i=t.slice(0,t.length-1),s=aw(e,i,Object);for(;void 0===s.obj&&i.length;)o=`${i[i.length-1]}.${o}`,s=aw(e,i=i.slice(0,i.length-1),Object),s?.obj&&void 0!==s.obj[`${s.k}.${o}`]&&(s.obj=void 0);s.obj[`${s.k}.${o}`]=n},ax=(e,t)=>{let{obj:n,k:r}=aw(e,t);if(n&&Object.prototype.hasOwnProperty.call(n,r))return n[r]},aD=(e,t,n)=>{for(let r in t)"__proto__"!==r&&"constructor"!==r&&(r in e?af(e[r])||e[r]instanceof String||af(t[r])||t[r]instanceof String?n&&(e[r]=t[r]):aD(e[r],t[r],n):e[r]=t[r]);return e};var a_={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;","/":"&#x2F;"};let ak=e=>af(e)?e.replace(/[&<>"'\/]/g,e=>a_[e]):e,aS=[" ",",","?","!",";"],aC=new class{constructor(e){this.capacity=e,this.regExpMap=new Map,this.regExpQueue=[]}getRegExp(e){let t=this.regExpMap.get(e);if(void 0!==t)return t;let n=new RegExp(e);return this.regExpQueue.length===this.capacity&&this.regExpMap.delete(this.regExpQueue.shift()),this.regExpMap.set(e,n),this.regExpQueue.push(e),n}}(20),aP=(e,t,n=".")=>{if(!e)return;if(e[t]){if(!Object.prototype.hasOwnProperty.call(e,t))return;return e[t]}let r=t.split(n),a=e;for(let e=0;e<r.length;){let t;if(!a||"object"!=typeof a)return;let o="";for(let i=e;i<r.length;++i)if(i!==e&&(o+=n),o+=r[i],void 0!==(t=a[o])){if(["string","number","boolean"].indexOf(typeof t)>-1&&i<r.length-1)continue;e+=i-e+1;break}a=t}return a},aR=e=>e?.replace("_","-"),aT={type:"logger",log(e){this.output("log",e)},warn(e){this.output("warn",e)},error(e){this.output("error",e)},output(e,t){console?.[e]?.apply?.(console,t)}};class a${constructor(e,t={}){this.init(e,t)}init(e,t={}){this.prefix=t.prefix||"i18next:",this.logger=e||aT,this.options=t,this.debug=t.debug}log(...e){return this.forward(e,"log","",!0)}warn(...e){return this.forward(e,"warn","",!0)}error(...e){return this.forward(e,"error","")}deprecate(...e){return this.forward(e,"warn","WARNING DEPRECATED: ",!0)}forward(e,t,n,r){return r&&!this.debug?null:(af(e[0])&&(e[0]=`${n}${this.prefix} ${e[0]}`),this.logger[t](e))}create(e){return new a$(this.logger,{...{prefix:`${this.prefix}:${e}:`},...this.options})}clone(e){return(e=e||this.options).prefix=e.prefix||this.prefix,new a$(this.logger,e)}}var aO=new a$;class aN{constructor(){this.observers={}}on(e,t){return e.split(" ").forEach(e=>{this.observers[e]||(this.observers[e]=new Map);let n=this.observers[e].get(t)||0;this.observers[e].set(t,n+1)}),this}off(e,t){if(this.observers[e]){if(!t)return void delete this.observers[e];this.observers[e].delete(t)}}emit(e,...t){this.observers[e]&&Array.from(this.observers[e].entries()).forEach(([e,n])=>{for(let r=0;r<n;r++)e(...t)}),this.observers["*"]&&Array.from(this.observers["*"].entries()).forEach(([n,r])=>{for(let a=0;a<r;a++)n.apply(n,[e,...t])})}}class aA extends aN{constructor(e,t={ns:["translation"],defaultNS:"translation"}){super(),this.data=e||{},this.options=t,void 0===this.options.keySeparator&&(this.options.keySeparator="."),void 0===this.options.ignoreJSONStructure&&(this.options.ignoreJSONStructure=!0)}addNamespaces(e){0>this.options.ns.indexOf(e)&&this.options.ns.push(e)}removeNamespaces(e){let t=this.options.ns.indexOf(e);t>-1&&this.options.ns.splice(t,1)}getResource(e,t,n,r={}){let a,o=void 0!==r.keySeparator?r.keySeparator:this.options.keySeparator,i=void 0!==r.ignoreJSONStructure?r.ignoreJSONStructure:this.options.ignoreJSONStructure;e.indexOf(".")>-1?a=e.split("."):(a=[e,t],n&&(Array.isArray(n)?a.push(...n):af(n)&&o?a.push(...n.split(o)):a.push(n)));let s=ax(this.data,a);return(!s&&!t&&!n&&e.indexOf(".")>-1&&(e=a[0],t=a[1],n=a.slice(2).join(".")),!s&&i&&af(n))?aP(this.data?.[e]?.[t],n,o):s}addResource(e,t,n,r,a={silent:!1}){let o=void 0!==a.keySeparator?a.keySeparator:this.options.keySeparator,i=[e,t];n&&(i=i.concat(o?n.split(o):n)),e.indexOf(".")>-1&&(i=e.split("."),r=t,t=i[1]),this.addNamespaces(t),aE(this.data,i,r),a.silent||this.emit("added",e,t,n,r)}addResources(e,t,n,r={silent:!1}){for(let r in n)(af(n[r])||Array.isArray(n[r]))&&this.addResource(e,t,r,n[r],{silent:!0});r.silent||this.emit("added",e,t,n)}addResourceBundle(e,t,n,r,a,o={silent:!1,skipCopy:!1}){let i=[e,t];e.indexOf(".")>-1&&(i=e.split("."),r=n,n=t,t=i[1]),this.addNamespaces(t);let s=ax(this.data,i)||{};o.skipCopy||(n=JSON.parse(JSON.stringify(n))),r?aD(s,n,a):s={...s,...n},aE(this.data,i,s),o.silent||this.emit("added",e,t,n)}removeResourceBundle(e,t){this.hasResourceBundle(e,t)&&delete this.data[e][t],this.removeNamespaces(t),this.emit("removed",e,t)}hasResourceBundle(e,t){return void 0!==this.getResource(e,t)}getResourceBundle(e,t){return t||(t=this.options.defaultNS),this.getResource(e,t)}getDataByLanguage(e){return this.data[e]}hasLanguageSomeTranslations(e){let t=this.getDataByLanguage(e);return!!(t&&Object.keys(t)||[]).find(e=>t[e]&&Object.keys(t[e]).length>0)}toJSON(){return this.data}}var aI={processors:{},addPostProcessor(e){this.processors[e.name]=e},handle(e,t,n,r,a){return e.forEach(e=>{t=this.processors[e]?.process(t,n,r,a)??t}),t}};let aj=Symbol("i18next/PATH_KEY");function aM(e,t){let n,r,a,{[aj]:o}=e((r=[],(a=Object.create(null)).get=(e,t)=>(n?.revoke?.(),t===aj)?r:(r.push(t),(n=Proxy.revocable(e,a)).proxy),Proxy.revocable(Object.create(null),a).proxy));return o.join(t?.keySeparator??".")}let aL={},aF=e=>!af(e)&&"boolean"!=typeof e&&"number"!=typeof e;class aB extends aN{constructor(e,t={}){super(),((e,t,n)=>{e.forEach(e=>{t[e]&&(n[e]=t[e])})})(["resourceStore","languageUtils","pluralResolver","interpolator","backendConnector","i18nFormat","utils"],e,this),this.options=t,void 0===this.options.keySeparator&&(this.options.keySeparator="."),this.logger=aO.create("translator")}changeLanguage(e){e&&(this.language=e)}exists(e,t={interpolation:{}}){let n={...t};if(null==e)return!1;let r=this.resolve(e,n);if(r?.res===void 0)return!1;let a=aF(r.res);return!1!==n.returnObjects||!a}extractFromKey(e,t){let n=void 0!==t.nsSeparator?t.nsSeparator:this.options.nsSeparator;void 0===n&&(n=":");let r=void 0!==t.keySeparator?t.keySeparator:this.options.keySeparator,a=t.ns||this.options.defaultNS||[],o=n&&e.indexOf(n)>-1,i=!this.options.userDefinedKeySeparator&&!t.keySeparator&&!this.options.userDefinedNsSeparator&&!t.nsSeparator&&!((e,t,n)=>{t=t||"",n=n||"";let r=aS.filter(e=>0>t.indexOf(e)&&0>n.indexOf(e));if(0===r.length)return!0;let a=aC.getRegExp(`(${r.map(e=>"?"===e?"\\?":e).join("|")})`),o=!a.test(e);if(!o){let t=e.indexOf(n);t>0&&!a.test(e.substring(0,t))&&(o=!0)}return o})(e,n,r);if(o&&!i){let t=e.match(this.interpolator.nestingRegexp);if(t&&t.length>0)return{key:e,namespaces:af(a)?[a]:a};let o=e.split(n);(n!==r||n===r&&this.options.ns.indexOf(o[0])>-1)&&(a=o.shift()),e=o.join(r)}return{key:e,namespaces:af(a)?[a]:a}}translate(e,t,n){let r="object"==typeof t?{...t}:t;if("object"!=typeof r&&this.options.overloadTranslationOptionHandler&&(r=this.options.overloadTranslationOptionHandler(arguments)),"object"==typeof r&&(r={...r}),r||(r={}),null==e)return"";"function"==typeof e&&(e=aM(e,{...this.options,...r})),Array.isArray(e)||(e=[String(e)]);let a=void 0!==r.returnDetails?r.returnDetails:this.options.returnDetails,o=void 0!==r.keySeparator?r.keySeparator:this.options.keySeparator,{key:i,namespaces:s}=this.extractFromKey(e[e.length-1],r),l=s[s.length-1],u=void 0!==r.nsSeparator?r.nsSeparator:this.options.nsSeparator;void 0===u&&(u=":");let c=r.lng||this.language,d=r.appendNamespaceToCIMode||this.options.appendNamespaceToCIMode;if(c?.toLowerCase()==="cimode")return d?a?{res:`${l}${u}${i}`,usedKey:i,exactUsedKey:i,usedLng:c,usedNS:l,usedParams:this.getUsedParamsDetails(r)}:`${l}${u}${i}`:a?{res:i,usedKey:i,exactUsedKey:i,usedLng:c,usedNS:l,usedParams:this.getUsedParamsDetails(r)}:i;let m=this.resolve(e,r),p=m?.res,f=m?.usedKey||i,h=m?.exactUsedKey||i,g=void 0!==r.joinArrays?r.joinArrays:this.options.joinArrays,y=!this.i18nFormat||this.i18nFormat.handleAsObject,v=void 0!==r.count&&!af(r.count),b=aB.hasDefaultValue(r),w=v?this.pluralResolver.getSuffix(c,r.count,r):"",E=r.ordinal&&v?this.pluralResolver.getSuffix(c,r.count,{ordinal:!1}):"",x=v&&!r.ordinal&&0===r.count,D=x&&r[`defaultValue${this.options.pluralSeparator}zero`]||r[`defaultValue${w}`]||r[`defaultValue${E}`]||r.defaultValue,_=p;y&&!p&&b&&(_=D);let k=aF(_),S=Object.prototype.toString.apply(_);if(y&&_&&k&&0>["[object Number]","[object Function]","[object RegExp]"].indexOf(S)&&!(af(g)&&Array.isArray(_))){if(!r.returnObjects&&!this.options.returnObjects){this.options.returnedObjectHandler||this.logger.warn("accessing an object - but returnObjects options is not enabled!");let e=this.options.returnedObjectHandler?this.options.returnedObjectHandler(f,_,{...r,ns:s}):`key '${i} (${this.language})' returned an object instead of string.`;return a?(m.res=e,m.usedParams=this.getUsedParamsDetails(r),m):e}if(o){let e=Array.isArray(_),t=e?[]:{},n=e?h:f;for(let e in _)if(Object.prototype.hasOwnProperty.call(_,e)){let a=`${n}${o}${e}`;b&&!p?t[e]=this.translate(a,{...r,defaultValue:aF(D)?D[e]:void 0,...{joinArrays:!1,ns:s}}):t[e]=this.translate(a,{...r,joinArrays:!1,ns:s}),t[e]===a&&(t[e]=_[e])}p=t}}else if(y&&af(g)&&Array.isArray(p))(p=p.join(g))&&(p=this.extendTranslation(p,e,r,n));else{let t=!1,a=!1;!this.isValidLookup(p)&&b&&(t=!0,p=D),this.isValidLookup(p)||(a=!0,p=i);let s=(r.missingKeyNoValueFallbackToKey||this.options.missingKeyNoValueFallbackToKey)&&a?void 0:p,d=b&&D!==p&&this.options.updateMissing;if(a||t||d){if(this.logger.log(d?"updateKey":"missingKey",c,l,i,d?D:p),o){let e=this.resolve(i,{...r,keySeparator:!1});e&&e.res&&this.logger.warn("Seems the loaded translations were in flat JSON format instead of nested. Either set keySeparator: false on init or make sure your translations are published in nested format.")}let e=[],t=this.languageUtils.getFallbackCodes(this.options.fallbackLng,r.lng||this.language);if("fallback"===this.options.saveMissingTo&&t&&t[0])for(let n=0;n<t.length;n++)e.push(t[n]);else"all"===this.options.saveMissingTo?e=this.languageUtils.toResolveHierarchy(r.lng||this.language):e.push(r.lng||this.language);let n=(e,t,n)=>{let a=b&&n!==p?n:s;this.options.missingKeyHandler?this.options.missingKeyHandler(e,l,t,a,d,r):this.backendConnector?.saveMissing&&this.backendConnector.saveMissing(e,l,t,a,d,r),this.emit("missingKey",e,l,t,p)};this.options.saveMissing&&(this.options.saveMissingPlurals&&v?e.forEach(e=>{let t=this.pluralResolver.getSuffixes(e,r);x&&r[`defaultValue${this.options.pluralSeparator}zero`]&&0>t.indexOf(`${this.options.pluralSeparator}zero`)&&t.push(`${this.options.pluralSeparator}zero`),t.forEach(t=>{n([e],i+t,r[`defaultValue${t}`]||D)})}):n(e,i,D))}p=this.extendTranslation(p,e,r,m,n),a&&p===i&&this.options.appendNamespaceToMissingKey&&(p=`${l}${u}${i}`),(a||t)&&this.options.parseMissingKeyHandler&&(p=this.options.parseMissingKeyHandler(this.options.appendNamespaceToMissingKey?`${l}${u}${i}`:i,t?p:void 0,r))}return a?(m.res=p,m.usedParams=this.getUsedParamsDetails(r),m):p}extendTranslation(e,t,n,r,a){if(this.i18nFormat?.parse)e=this.i18nFormat.parse(e,{...this.options.interpolation.defaultVariables,...n},n.lng||this.language||r.usedLng,r.usedNS,r.usedKey,{resolved:r});else if(!n.skipInterpolation){let o;n.interpolation&&this.interpolator.init({...n,...{interpolation:{...this.options.interpolation,...n.interpolation}}});let i=af(e)&&(n?.interpolation?.skipOnVariables!==void 0?n.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables);if(i){let t=e.match(this.interpolator.nestingRegexp);o=t&&t.length}let s=n.replace&&!af(n.replace)?n.replace:n;if(this.options.interpolation.defaultVariables&&(s={...this.options.interpolation.defaultVariables,...s}),e=this.interpolator.interpolate(e,s,n.lng||this.language||r.usedLng,n),i){let t=e.match(this.interpolator.nestingRegexp);o<(t&&t.length)&&(n.nest=!1)}!n.lng&&r&&r.res&&(n.lng=this.language||r.usedLng),!1!==n.nest&&(e=this.interpolator.nest(e,(...e)=>a?.[0]!==e[0]||n.context?this.translate(...e,t):(this.logger.warn(`It seems you are nesting recursively key: ${e[0]} in key: ${t[0]}`),null),n)),n.interpolation&&this.interpolator.reset()}let o=n.postProcess||this.options.postProcess,i=af(o)?[o]:o;return null!=e&&i?.length&&!1!==n.applyPostProcessor&&(e=aI.handle(i,e,t,this.options&&this.options.postProcessPassResolved?{i18nResolved:{...r,usedParams:this.getUsedParamsDetails(n)},...n}:n,this)),e}resolve(e,t={}){let n,r,a,o,i;return af(e)&&(e=[e]),e.forEach(e=>{if(this.isValidLookup(n))return;let s=this.extractFromKey(e,t),l=s.key;r=l;let u=s.namespaces;this.options.fallbackNS&&(u=u.concat(this.options.fallbackNS));let c=void 0!==t.count&&!af(t.count),d=c&&!t.ordinal&&0===t.count,m=void 0!==t.context&&(af(t.context)||"number"==typeof t.context)&&""!==t.context,p=t.lngs?t.lngs:this.languageUtils.toResolveHierarchy(t.lng||this.language,t.fallbackLng);u.forEach(e=>{this.isValidLookup(n)||(i=e,!aL[`${p[0]}-${e}`]&&this.utils?.hasLoadedNamespace&&!this.utils?.hasLoadedNamespace(i)&&(aL[`${p[0]}-${e}`]=!0,this.logger.warn(`key "${r}" for languages "${p.join(", ")}" won't get resolved as namespace "${i}" was not yet loaded`,"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!")),p.forEach(r=>{let i;if(this.isValidLookup(n))return;o=r;let s=[l];if(this.i18nFormat?.addLookupKeys)this.i18nFormat.addLookupKeys(s,l,r,e,t);else{let e;c&&(e=this.pluralResolver.getSuffix(r,t.count,t));let n=`${this.options.pluralSeparator}zero`,a=`${this.options.pluralSeparator}ordinal${this.options.pluralSeparator}`;if(c&&(t.ordinal&&0===e.indexOf(a)&&s.push(l+e.replace(a,this.options.pluralSeparator)),s.push(l+e),d&&s.push(l+n)),m){let r=`${l}${this.options.contextSeparator||"_"}${t.context}`;s.push(r),c&&(t.ordinal&&0===e.indexOf(a)&&s.push(r+e.replace(a,this.options.pluralSeparator)),s.push(r+e),d&&s.push(r+n))}}for(;i=s.pop();)this.isValidLookup(n)||(a=i,n=this.getResource(r,e,i,t))}))})}),{res:n,usedKey:r,exactUsedKey:a,usedLng:o,usedNS:i}}isValidLookup(e){return void 0!==e&&!(!this.options.returnNull&&null===e)&&!(!this.options.returnEmptyString&&""===e)}getResource(e,t,n,r={}){return this.i18nFormat?.getResource?this.i18nFormat.getResource(e,t,n,r):this.resourceStore.getResource(e,t,n,r)}getUsedParamsDetails(e={}){let t=e.replace&&!af(e.replace),n=t?e.replace:e;if(t&&void 0!==e.count&&(n.count=e.count),this.options.interpolation.defaultVariables&&(n={...this.options.interpolation.defaultVariables,...n}),!t)for(let e of(n={...n},["defaultValue","ordinal","context","replace","lng","lngs","fallbackLng","ns","keySeparator","nsSeparator","returnObjects","returnDetails","joinArrays","postProcess","interpolation"]))delete n[e];return n}static hasDefaultValue(e){let t="defaultValue";for(let n in e)if(Object.prototype.hasOwnProperty.call(e,n)&&t===n.substring(0,t.length)&&void 0!==e[n])return!0;return!1}}class aV{constructor(e){this.options=e,this.supportedLngs=this.options.supportedLngs||!1,this.logger=aO.create("languageUtils")}getScriptPartFromCode(e){if(!(e=aR(e))||0>e.indexOf("-"))return null;let t=e.split("-");return 2===t.length||(t.pop(),"x"===t[t.length-1].toLowerCase())?null:this.formatLanguageCode(t.join("-"))}getLanguagePartFromCode(e){if(!(e=aR(e))||0>e.indexOf("-"))return e;let t=e.split("-");return this.formatLanguageCode(t[0])}formatLanguageCode(e){if(af(e)&&e.indexOf("-")>-1){let t;try{t=Intl.getCanonicalLocales(e)[0]}catch(e){}return(t&&this.options.lowerCaseLng&&(t=t.toLowerCase()),t)?t:this.options.lowerCaseLng?e.toLowerCase():e}return this.options.cleanCode||this.options.lowerCaseLng?e.toLowerCase():e}isSupportedCode(e){return("languageOnly"===this.options.load||this.options.nonExplicitSupportedLngs)&&(e=this.getLanguagePartFromCode(e)),!this.supportedLngs||!this.supportedLngs.length||this.supportedLngs.indexOf(e)>-1}getBestMatchFromCodes(e){let t;return e?(e.forEach(e=>{if(t)return;let n=this.formatLanguageCode(e);(!this.options.supportedLngs||this.isSupportedCode(n))&&(t=n)}),!t&&this.options.supportedLngs&&e.forEach(e=>{if(t)return;let n=this.getScriptPartFromCode(e);if(this.isSupportedCode(n))return t=n;let r=this.getLanguagePartFromCode(e);if(this.isSupportedCode(r))return t=r;t=this.options.supportedLngs.find(e=>{if(e===r||!(0>e.indexOf("-")&&0>r.indexOf("-"))&&(e.indexOf("-")>0&&0>r.indexOf("-")&&e.substring(0,e.indexOf("-"))===r||0===e.indexOf(r)&&r.length>1))return e})}),t||(t=this.getFallbackCodes(this.options.fallbackLng)[0]),t):null}getFallbackCodes(e,t){if(!e)return[];if("function"==typeof e&&(e=e(t)),af(e)&&(e=[e]),Array.isArray(e))return e;if(!t)return e.default||[];let n=e[t];return n||(n=e[this.getScriptPartFromCode(t)]),n||(n=e[this.formatLanguageCode(t)]),n||(n=e[this.getLanguagePartFromCode(t)]),n||(n=e.default),n||[]}toResolveHierarchy(e,t){let n=this.getFallbackCodes((!1===t?[]:t)||this.options.fallbackLng||[],e),r=[],a=e=>{e&&(this.isSupportedCode(e)?r.push(e):this.logger.warn(`rejecting language code not found in supportedLngs: ${e}`))};return af(e)&&(e.indexOf("-")>-1||e.indexOf("_")>-1)?("languageOnly"!==this.options.load&&a(this.formatLanguageCode(e)),"languageOnly"!==this.options.load&&"currentOnly"!==this.options.load&&a(this.getScriptPartFromCode(e)),"currentOnly"!==this.options.load&&a(this.getLanguagePartFromCode(e))):af(e)&&a(this.formatLanguageCode(e)),n.forEach(e=>{0>r.indexOf(e)&&a(this.formatLanguageCode(e))}),r}}let aU={zero:0,one:1,two:2,few:3,many:4,other:5},aW={select:e=>1===e?"one":"other",resolvedOptions:()=>({pluralCategories:["one","other"]})};class aH{constructor(e,t={}){this.languageUtils=e,this.options=t,this.logger=aO.create("pluralResolver"),this.pluralRulesCache={}}addRule(e,t){this.rules[e]=t}clearCache(){this.pluralRulesCache={}}getRule(e,t={}){let n,r=aR("dev"===e?"en":e),a=t.ordinal?"ordinal":"cardinal",o=JSON.stringify({cleanedCode:r,type:a});if(o in this.pluralRulesCache)return this.pluralRulesCache[o];try{n=new Intl.PluralRules(r,{type:a})}catch(a){if(!Intl)return this.logger.error("No Intl support, please use an Intl polyfill!"),aW;if(!e.match(/-|_/))return aW;let r=this.languageUtils.getLanguagePartFromCode(e);n=this.getRule(r,t)}return this.pluralRulesCache[o]=n,n}needsPlural(e,t={}){let n=this.getRule(e,t);return n||(n=this.getRule("dev",t)),n?.resolvedOptions().pluralCategories.length>1}getPluralFormsOfKey(e,t,n={}){return this.getSuffixes(e,n).map(e=>`${t}${e}`)}getSuffixes(e,t={}){let n=this.getRule(e,t);return(n||(n=this.getRule("dev",t)),n)?n.resolvedOptions().pluralCategories.sort((e,t)=>aU[e]-aU[t]).map(e=>`${this.options.prepend}${t.ordinal?`ordinal${this.options.prepend}`:""}${e}`):[]}getSuffix(e,t,n={}){let r=this.getRule(e,n);return r?`${this.options.prepend}${n.ordinal?`ordinal${this.options.prepend}`:""}${r.select(t)}`:(this.logger.warn(`no plural rule found for: ${e}`),this.getSuffix("dev",t,n))}}let az=(e,t,n,r=".",a=!0)=>{let o,i=void 0!==(o=ax(e,n))?o:ax(t,n);return!i&&a&&af(n)&&void 0===(i=aP(e,n,r))&&(i=aP(t,n,r)),i};class aK{constructor(e={}){this.logger=aO.create("interpolator"),this.options=e,this.format=e?.interpolation?.format||(e=>e),this.init(e)}init(e={}){e.interpolation||(e.interpolation={escapeValue:!0});let{escape:t,escapeValue:n,useRawValueToEscape:r,prefix:a,prefixEscaped:o,suffix:i,suffixEscaped:s,formatSeparator:l,unescapeSuffix:u,unescapePrefix:c,nestingPrefix:d,nestingPrefixEscaped:m,nestingSuffix:p,nestingSuffixEscaped:f,nestingOptionsSeparator:h,maxReplaces:g,alwaysFormat:y}=e.interpolation;this.escape=void 0!==t?t:ak,this.escapeValue=void 0===n||n,this.useRawValueToEscape=void 0!==r&&r,this.prefix=a?a.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&"):o||"{{",this.suffix=i?i.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&"):s||"}}",this.formatSeparator=l||",",this.unescapePrefix=u?"":c||"-",this.unescapeSuffix=this.unescapePrefix?"":u||"",this.nestingPrefix=d?d.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&"):m||"$t(".replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&"),this.nestingSuffix=p?p.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&"):f||")".replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&"),this.nestingOptionsSeparator=h||",",this.maxReplaces=g||1e3,this.alwaysFormat=void 0!==y&&y,this.resetRegExp()}reset(){this.options&&this.init(this.options)}resetRegExp(){let e=(e,t)=>e?.source===t?(e.lastIndex=0,e):RegExp(t,"g");this.regexp=e(this.regexp,`${this.prefix}(.+?)${this.suffix}`),this.regexpUnescape=e(this.regexpUnescape,`${this.prefix}${this.unescapePrefix}(.+?)${this.unescapeSuffix}${this.suffix}`),this.nestingRegexp=e(this.nestingRegexp,`${this.nestingPrefix}((?:[^()"']+|"[^"]*"|'[^']*'|\\((?:[^()]|"[^"]*"|'[^']*')*\\))*?)${this.nestingSuffix}`)}interpolate(e,t,n,r){let a,o,i,s=this.options&&this.options.interpolation&&this.options.interpolation.defaultVariables||{},l=e=>{if(0>e.indexOf(this.formatSeparator)){let a=az(t,s,e,this.options.keySeparator,this.options.ignoreJSONStructure);return this.alwaysFormat?this.format(a,void 0,n,{...r,...t,interpolationkey:e}):a}let a=e.split(this.formatSeparator),o=a.shift().trim(),i=a.join(this.formatSeparator).trim();return this.format(az(t,s,o,this.options.keySeparator,this.options.ignoreJSONStructure),i,n,{...r,...t,interpolationkey:o})};this.resetRegExp();let u=r?.missingInterpolationHandler||this.options.missingInterpolationHandler,c=r?.interpolation?.skipOnVariables!==void 0?r.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables;return[{regex:this.regexpUnescape,safeValue:e=>e.replace(/\$/g,"$$$$")},{regex:this.regexp,safeValue:e=>this.escapeValue?this.escape(e).replace(/\$/g,"$$$$"):e.replace(/\$/g,"$$$$")}].forEach(t=>{for(i=0;a=t.regex.exec(e);){let n=a[1].trim();if(void 0===(o=l(n)))if("function"==typeof u){let t=u(e,a,r);o=af(t)?t:""}else if(r&&Object.prototype.hasOwnProperty.call(r,n))o="";else if(c){o=a[0];continue}else this.logger.warn(`missed to pass in variable ${n} for interpolating ${e}`),o="";else af(o)||this.useRawValueToEscape||(o=ag(o));let s=t.safeValue(o);if(e=e.replace(a[0],s),c?(t.regex.lastIndex+=o.length,t.regex.lastIndex-=a[0].length):t.regex.lastIndex=0,++i>=this.maxReplaces)break}}),e}nest(e,t,n={}){let r,a,o,i=(e,t)=>{let n=this.nestingOptionsSeparator;if(0>e.indexOf(n))return e;let r=e.split(RegExp(`${n}[ ]*{`)),a=`{${r[1]}`;e=r[0];let i=(a=this.interpolate(a,o)).match(/'/g),s=a.match(/"/g);((i?.length??0)%2!=0||s)&&s.length%2==0||(a=a.replace(/'/g,'"'));try{o=JSON.parse(a),t&&(o={...t,...o})}catch(t){return this.logger.warn(`failed parsing options string in nesting for key ${e}`,t),`${e}${n}${a}`}return o.defaultValue&&o.defaultValue.indexOf(this.prefix)>-1&&delete o.defaultValue,e};for(;r=this.nestingRegexp.exec(e);){let s=[];(o=(o={...n}).replace&&!af(o.replace)?o.replace:o).applyPostProcessor=!1,delete o.defaultValue;let l=/{.*}/.test(r[1])?r[1].lastIndexOf("}")+1:r[1].indexOf(this.formatSeparator);if(-1!==l&&(s=r[1].slice(l).split(this.formatSeparator).map(e=>e.trim()).filter(Boolean),r[1]=r[1].slice(0,l)),(a=t(i.call(this,r[1].trim(),o),o))&&r[0]===e&&!af(a))return a;af(a)||(a=ag(a)),a||(this.logger.warn(`missed to resolve ${r[1]} for nesting ${e}`),a=""),s.length&&(a=s.reduce((e,t)=>this.format(e,t,n.lng,{...n,interpolationkey:r[1].trim()}),a.trim())),e=e.replace(r[0],a),this.regexp.lastIndex=0}return e}}let aG=e=>{let t={};return(n,r,a)=>{let o=a;a&&a.interpolationkey&&a.formatParams&&a.formatParams[a.interpolationkey]&&a[a.interpolationkey]&&(o={...o,[a.interpolationkey]:void 0});let i=r+JSON.stringify(o),s=t[i];return s||(s=e(aR(r),a),t[i]=s),s(n)}},aZ=e=>(t,n,r)=>e(aR(n),r)(t);class aY{constructor(e={}){this.logger=aO.create("formatter"),this.options=e,this.init(e)}init(e,t={interpolation:{}}){this.formatSeparator=t.interpolation.formatSeparator||",";let n=t.cacheInBuiltFormats?aG:aZ;this.formats={number:n((e,t)=>{let n=new Intl.NumberFormat(e,{...t});return e=>n.format(e)}),currency:n((e,t)=>{let n=new Intl.NumberFormat(e,{...t,style:"currency"});return e=>n.format(e)}),datetime:n((e,t)=>{let n=new Intl.DateTimeFormat(e,{...t});return e=>n.format(e)}),relativetime:n((e,t)=>{let n=new Intl.RelativeTimeFormat(e,{...t});return e=>n.format(e,t.range||"day")}),list:n((e,t)=>{let n=new Intl.ListFormat(e,{...t});return e=>n.format(e)})}}add(e,t){this.formats[e.toLowerCase().trim()]=t}addCached(e,t){this.formats[e.toLowerCase().trim()]=aG(t)}format(e,t,n,r={}){let a=t.split(this.formatSeparator);if(a.length>1&&a[0].indexOf("(")>1&&0>a[0].indexOf(")")&&a.find(e=>e.indexOf(")")>-1)){let e=a.findIndex(e=>e.indexOf(")")>-1);a[0]=[a[0],...a.splice(1,e)].join(this.formatSeparator)}return a.reduce((e,t)=>{let{formatName:a,formatOptions:o}=(e=>{let t=e.toLowerCase().trim(),n={};if(e.indexOf("(")>-1){let r=e.split("(");t=r[0].toLowerCase().trim();let a=r[1].substring(0,r[1].length-1);"currency"===t&&0>a.indexOf(":")?n.currency||(n.currency=a.trim()):"relativetime"===t&&0>a.indexOf(":")?n.range||(n.range=a.trim()):a.split(";").forEach(e=>{if(e){let[t,...r]=e.split(":"),a=r.join(":").trim().replace(/^'+|'+$/g,""),o=t.trim();n[o]||(n[o]=a),"false"===a&&(n[o]=!1),"true"===a&&(n[o]=!0),isNaN(a)||(n[o]=parseInt(a,10))}})}return{formatName:t,formatOptions:n}})(t);if(this.formats[a]){let t=e;try{let i=r?.formatParams?.[r.interpolationkey]||{},s=i.locale||i.lng||r.locale||r.lng||n;t=this.formats[a](e,s,{...o,...r,...i})}catch(e){this.logger.warn(e)}return t}return this.logger.warn(`there was no format function for ${a}`),e},e)}}class aq extends aN{constructor(e,t,n,r={}){super(),this.backend=e,this.store=t,this.services=n,this.languageUtils=n.languageUtils,this.options=r,this.logger=aO.create("backendConnector"),this.waitingReads=[],this.maxParallelReads=r.maxParallelReads||10,this.readingCalls=0,this.maxRetries=r.maxRetries>=0?r.maxRetries:5,this.retryTimeout=r.retryTimeout>=1?r.retryTimeout:350,this.state={},this.queue=[],this.backend?.init?.(n,r.backend,r)}queueLoad(e,t,n,r){let a={},o={},i={},s={};return e.forEach(e=>{let r=!0;t.forEach(t=>{let i=`${e}|${t}`;!n.reload&&this.store.hasResourceBundle(e,t)?this.state[i]=2:this.state[i]<0||(1===this.state[i]?void 0===o[i]&&(o[i]=!0):(this.state[i]=1,r=!1,void 0===o[i]&&(o[i]=!0),void 0===a[i]&&(a[i]=!0),void 0===s[t]&&(s[t]=!0)))}),r||(i[e]=!0)}),(Object.keys(a).length||Object.keys(o).length)&&this.queue.push({pending:o,pendingCount:Object.keys(o).length,loaded:{},errors:[],callback:r}),{toLoad:Object.keys(a),pending:Object.keys(o),toLoadLanguages:Object.keys(i),toLoadNamespaces:Object.keys(s)}}loaded(e,t,n){let r=e.split("|"),a=r[0],o=r[1];t&&this.emit("failedLoading",a,o,t),!t&&n&&this.store.addResourceBundle(a,o,n,void 0,void 0,{skipCopy:!0}),this.state[e]=t?-1:2,t&&n&&(this.state[e]=0);let i={};this.queue.forEach(n=>{((e,t,n,r)=>{let{obj:a,k:o}=aw(e,t,Object);a[o]=a[o]||[],a[o].push(n)})(n.loaded,[a],o),void 0!==n.pending[e]&&(delete n.pending[e],n.pendingCount--),t&&n.errors.push(t),0!==n.pendingCount||n.done||(Object.keys(n.loaded).forEach(e=>{i[e]||(i[e]={});let t=n.loaded[e];t.length&&t.forEach(t=>{void 0===i[e][t]&&(i[e][t]=!0)})}),n.done=!0,n.errors.length?n.callback(n.errors):n.callback())}),this.emit("loaded",i),this.queue=this.queue.filter(e=>!e.done)}read(e,t,n,r=0,a=this.retryTimeout,o){if(!e.length)return o(null,{});if(this.readingCalls>=this.maxParallelReads)return void this.waitingReads.push({lng:e,ns:t,fcName:n,tried:r,wait:a,callback:o});this.readingCalls++;let i=(i,s)=>{if(this.readingCalls--,this.waitingReads.length>0){let e=this.waitingReads.shift();this.read(e.lng,e.ns,e.fcName,e.tried,e.wait,e.callback)}i&&s&&r<this.maxRetries?setTimeout(()=>{this.read.call(this,e,t,n,r+1,2*a,o)},a):o(i,s)},s=this.backend[n].bind(this.backend);if(2===s.length){try{let n=s(e,t);n&&"function"==typeof n.then?n.then(e=>i(null,e)).catch(i):i(null,n)}catch(e){i(e)}return}return s(e,t,i)}prepareLoading(e,t,n={},r){if(!this.backend)return this.logger.warn("No backend was added via i18next.use. Will not load resources."),r&&r();af(e)&&(e=this.languageUtils.toResolveHierarchy(e)),af(t)&&(t=[t]);let a=this.queueLoad(e,t,n,r);if(!a.toLoad.length)return a.pending.length||r(),null;a.toLoad.forEach(e=>{this.loadOne(e)})}load(e,t,n){this.prepareLoading(e,t,{},n)}reload(e,t,n){this.prepareLoading(e,t,{reload:!0},n)}loadOne(e,t=""){let n=e.split("|"),r=n[0],a=n[1];this.read(r,a,"read",void 0,void 0,(n,o)=>{n&&this.logger.warn(`${t}loading namespace ${a} for language ${r} failed`,n),!n&&o&&this.logger.log(`${t}loaded namespace ${a} for language ${r}`,o),this.loaded(e,n,o)})}saveMissing(e,t,n,r,a,o={},i=()=>{}){if(this.services?.utils?.hasLoadedNamespace&&!this.services?.utils?.hasLoadedNamespace(t))return void this.logger.warn(`did not save key "${n}" as the namespace "${t}" was not yet loaded`,"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!");if(null!=n&&""!==n){if(this.backend?.create){let s={...o,isUpdate:a},l=this.backend.create.bind(this.backend);if(l.length<6)try{let a;(a=5===l.length?l(e,t,n,r,s):l(e,t,n,r))&&"function"==typeof a.then?a.then(e=>i(null,e)).catch(i):i(null,a)}catch(e){i(e)}else l(e,t,n,r,i,s)}e&&e[0]&&this.store.addResource(e[0],t,n,r)}}}let aJ=()=>({debug:!1,initAsync:!0,ns:["translation"],defaultNS:["translation"],fallbackLng:["dev"],fallbackNS:!1,supportedLngs:!1,nonExplicitSupportedLngs:!1,load:"all",preload:!1,simplifyPluralSuffix:!0,keySeparator:".",nsSeparator:":",pluralSeparator:"_",contextSeparator:"_",partialBundledLanguages:!1,saveMissing:!1,updateMissing:!1,saveMissingTo:"fallback",saveMissingPlurals:!0,missingKeyHandler:!1,missingInterpolationHandler:!1,postProcess:!1,postProcessPassResolved:!1,returnNull:!1,returnEmptyString:!0,returnObjects:!1,joinArrays:!1,returnedObjectHandler:!1,parseMissingKeyHandler:!1,appendNamespaceToMissingKey:!1,appendNamespaceToCIMode:!1,overloadTranslationOptionHandler:e=>{let t={};if("object"==typeof e[1]&&(t=e[1]),af(e[1])&&(t.defaultValue=e[1]),af(e[2])&&(t.tDescription=e[2]),"object"==typeof e[2]||"object"==typeof e[3]){let n=e[3]||e[2];Object.keys(n).forEach(e=>{t[e]=n[e]})}return t},interpolation:{escapeValue:!0,format:e=>e,prefix:"{{",suffix:"}}",formatSeparator:",",unescapePrefix:"-",nestingPrefix:"$t(",nestingSuffix:")",nestingOptionsSeparator:",",maxReplaces:1e3,skipOnVariables:!0},cacheInBuiltFormats:!0}),aX=e=>(af(e.ns)&&(e.ns=[e.ns]),af(e.fallbackLng)&&(e.fallbackLng=[e.fallbackLng]),af(e.fallbackNS)&&(e.fallbackNS=[e.fallbackNS]),e.supportedLngs?.indexOf?.("cimode")<0&&(e.supportedLngs=e.supportedLngs.concat(["cimode"])),"boolean"==typeof e.initImmediate&&(e.initAsync=e.initImmediate),e),aQ=()=>{};class a0 extends aN{constructor(e={},t){if(super(),this.options=aX(e),this.services={},this.logger=aO,this.modules={external:[]},(e=>{Object.getOwnPropertyNames(Object.getPrototypeOf(e)).forEach(t=>{"function"==typeof e[t]&&(e[t]=e[t].bind(e))})})(this),t&&!this.isInitialized&&!e.isClone){if(!this.options.initAsync)return this.init(e,t),this;setTimeout(()=>{this.init(e,t)},0)}}init(e={},t){this.isInitializing=!0,"function"==typeof e&&(t=e,e={}),null==e.defaultNS&&e.ns&&(af(e.ns)?e.defaultNS=e.ns:0>e.ns.indexOf("translation")&&(e.defaultNS=e.ns[0]));let n=aJ();this.options={...n,...this.options,...aX(e)},this.options.interpolation={...n.interpolation,...this.options.interpolation},void 0!==e.keySeparator&&(this.options.userDefinedKeySeparator=e.keySeparator),void 0!==e.nsSeparator&&(this.options.userDefinedNsSeparator=e.nsSeparator);let r=e=>e?"function"==typeof e?new e:e:null;if(!this.options.isClone){let e;this.modules.logger?aO.init(r(this.modules.logger),this.options):aO.init(null,this.options),e=this.modules.formatter?this.modules.formatter:aY;let t=new aV(this.options);this.store=new aA(this.options.resources,this.options);let a=this.services;a.logger=aO,a.resourceStore=this.store,a.languageUtils=t,a.pluralResolver=new aH(t,{prepend:this.options.pluralSeparator,simplifyPluralSuffix:this.options.simplifyPluralSuffix}),this.options.interpolation.format&&this.options.interpolation.format!==n.interpolation.format&&this.logger.deprecate("init: you are still using the legacy format function, please use the new approach: https://www.i18next.com/translation-function/formatting"),e&&(!this.options.interpolation.format||this.options.interpolation.format===n.interpolation.format)&&(a.formatter=r(e),a.formatter.init&&a.formatter.init(a,this.options),this.options.interpolation.format=a.formatter.format.bind(a.formatter)),a.interpolator=new aK(this.options),a.utils={hasLoadedNamespace:this.hasLoadedNamespace.bind(this)},a.backendConnector=new aq(r(this.modules.backend),a.resourceStore,a,this.options),a.backendConnector.on("*",(e,...t)=>{this.emit(e,...t)}),this.modules.languageDetector&&(a.languageDetector=r(this.modules.languageDetector),a.languageDetector.init&&a.languageDetector.init(a,this.options.detection,this.options)),this.modules.i18nFormat&&(a.i18nFormat=r(this.modules.i18nFormat),a.i18nFormat.init&&a.i18nFormat.init(this)),this.translator=new aB(this.services,this.options),this.translator.on("*",(e,...t)=>{this.emit(e,...t)}),this.modules.external.forEach(e=>{e.init&&e.init(this)})}if(this.format=this.options.interpolation.format,t||(t=aQ),this.options.fallbackLng&&!this.services.languageDetector&&!this.options.lng){let e=this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);e.length>0&&"dev"!==e[0]&&(this.options.lng=e[0])}this.services.languageDetector||this.options.lng||this.logger.warn("init: no languageDetector is used and no lng is defined"),["getResource","hasResourceBundle","getResourceBundle","getDataByLanguage"].forEach(e=>{this[e]=(...t)=>this.store[e](...t)}),["addResource","addResources","addResourceBundle","removeResourceBundle"].forEach(e=>{this[e]=(...t)=>(this.store[e](...t),this)});let a=ah(),o=()=>{let e=(e,n)=>{this.isInitializing=!1,this.isInitialized&&!this.initializedStoreOnce&&this.logger.warn("init: i18next is already initialized. You should call init just once!"),this.isInitialized=!0,this.options.isClone||this.logger.log("initialized",this.options),this.emit("initialized",this.options),a.resolve(n),t(e,n)};if(this.languages&&!this.isInitialized)return e(null,this.t.bind(this));this.changeLanguage(this.options.lng,e)};return this.options.resources||!this.options.initAsync?o():setTimeout(o,0),a}loadResources(e,t=aQ){let n=t,r=af(e)?e:this.language;if("function"==typeof e&&(n=e),!this.options.resources||this.options.partialBundledLanguages){if(r?.toLowerCase()==="cimode"&&(!this.options.preload||0===this.options.preload.length))return n();let e=[],t=t=>{t&&"cimode"!==t&&this.services.languageUtils.toResolveHierarchy(t).forEach(t=>{"cimode"!==t&&0>e.indexOf(t)&&e.push(t)})};r?t(r):this.services.languageUtils.getFallbackCodes(this.options.fallbackLng).forEach(e=>t(e)),this.options.preload?.forEach?.(e=>t(e)),this.services.backendConnector.load(e,this.options.ns,e=>{e||this.resolvedLanguage||!this.language||this.setResolvedLanguage(this.language),n(e)})}else n(null)}reloadResources(e,t,n){let r=ah();return"function"==typeof e&&(n=e,e=void 0),"function"==typeof t&&(n=t,t=void 0),e||(e=this.languages),t||(t=this.options.ns),n||(n=aQ),this.services.backendConnector.reload(e,t,e=>{r.resolve(),n(e)}),r}use(e){if(!e)throw Error("You are passing an undefined module! Please check the object you are passing to i18next.use()");if(!e.type)throw Error("You are passing a wrong module! Please check the object you are passing to i18next.use()");return"backend"===e.type&&(this.modules.backend=e),("logger"===e.type||e.log&&e.warn&&e.error)&&(this.modules.logger=e),"languageDetector"===e.type&&(this.modules.languageDetector=e),"i18nFormat"===e.type&&(this.modules.i18nFormat=e),"postProcessor"===e.type&&aI.addPostProcessor(e),"formatter"===e.type&&(this.modules.formatter=e),"3rdParty"===e.type&&this.modules.external.push(e),this}setResolvedLanguage(e){if(e&&this.languages&&!(["cimode","dev"].indexOf(e)>-1)){for(let e=0;e<this.languages.length;e++){let t=this.languages[e];if(!(["cimode","dev"].indexOf(t)>-1)&&this.store.hasLanguageSomeTranslations(t)){this.resolvedLanguage=t;break}}!this.resolvedLanguage&&0>this.languages.indexOf(e)&&this.store.hasLanguageSomeTranslations(e)&&(this.resolvedLanguage=e,this.languages.unshift(e))}}changeLanguage(e,t){this.isLanguageChangingTo=e;let n=ah();this.emit("languageChanging",e);let r=e=>{this.language=e,this.languages=this.services.languageUtils.toResolveHierarchy(e),this.resolvedLanguage=void 0,this.setResolvedLanguage(e)},a=(a,o)=>{o?this.isLanguageChangingTo===e&&(r(o),this.translator.changeLanguage(o),this.isLanguageChangingTo=void 0,this.emit("languageChanged",o),this.logger.log("languageChanged",o)):this.isLanguageChangingTo=void 0,n.resolve((...e)=>this.t(...e)),t&&t(a,(...e)=>this.t(...e))},o=t=>{e||t||!this.services.languageDetector||(t=[]);let n=af(t)?t:t&&t[0],o=this.store.hasLanguageSomeTranslations(n)?n:this.services.languageUtils.getBestMatchFromCodes(af(t)?[t]:t);o&&(this.language||r(o),this.translator.language||this.translator.changeLanguage(o),this.services.languageDetector?.cacheUserLanguage?.(o)),this.loadResources(o,e=>{a(e,o)})};return e||!this.services.languageDetector||this.services.languageDetector.async?!e&&this.services.languageDetector&&this.services.languageDetector.async?0===this.services.languageDetector.detect.length?this.services.languageDetector.detect().then(o):this.services.languageDetector.detect(o):o(e):o(this.services.languageDetector.detect()),n}getFixedT(e,t,n){let r=(e,t,...a)=>{let o,i;(o="object"!=typeof t?this.options.overloadTranslationOptionHandler([e,t].concat(a)):{...t}).lng=o.lng||r.lng,o.lngs=o.lngs||r.lngs,o.ns=o.ns||r.ns,""!==o.keyPrefix&&(o.keyPrefix=o.keyPrefix||n||r.keyPrefix);let s=this.options.keySeparator||".";return o.keyPrefix&&Array.isArray(e)?i=e.map(e=>("function"==typeof e&&(e=aM(e,{...this.options,...t})),`${o.keyPrefix}${s}${e}`)):("function"==typeof e&&(e=aM(e,{...this.options,...t})),i=o.keyPrefix?`${o.keyPrefix}${s}${e}`:e),this.t(i,o)};return af(e)?r.lng=e:r.lngs=e,r.ns=t,r.keyPrefix=n,r}t(...e){return this.translator?.translate(...e)}exists(...e){return this.translator?.exists(...e)}setDefaultNamespace(e){this.options.defaultNS=e}hasLoadedNamespace(e,t={}){if(!this.isInitialized)return this.logger.warn("hasLoadedNamespace: i18next was not initialized",this.languages),!1;if(!this.languages||!this.languages.length)return this.logger.warn("hasLoadedNamespace: i18n.languages were undefined or empty",this.languages),!1;let n=t.lng||this.resolvedLanguage||this.languages[0],r=!!this.options&&this.options.fallbackLng,a=this.languages[this.languages.length-1];if("cimode"===n.toLowerCase())return!0;let o=(e,t)=>{let n=this.services.backendConnector.state[`${e}|${t}`];return -1===n||0===n||2===n};if(t.precheck){let e=t.precheck(this,o);if(void 0!==e)return e}return!!(this.hasResourceBundle(n,e)||!this.services.backendConnector.backend||this.options.resources&&!this.options.partialBundledLanguages||o(n,e)&&(!r||o(a,e)))}loadNamespaces(e,t){let n=ah();return this.options.ns?(af(e)&&(e=[e]),e.forEach(e=>{0>this.options.ns.indexOf(e)&&this.options.ns.push(e)}),this.loadResources(e=>{n.resolve(),t&&t(e)}),n):(t&&t(),Promise.resolve())}loadLanguages(e,t){let n=ah();af(e)&&(e=[e]);let r=this.options.preload||[],a=e.filter(e=>0>r.indexOf(e)&&this.services.languageUtils.isSupportedCode(e));return a.length?(this.options.preload=r.concat(a),this.loadResources(e=>{n.resolve(),t&&t(e)}),n):(t&&t(),Promise.resolve())}dir(e){if(e||(e=this.resolvedLanguage||(this.languages?.length>0?this.languages[0]:this.language)),!e)return"rtl";try{let t=new Intl.Locale(e);if(t&&t.getTextInfo){let e=t.getTextInfo();if(e&&e.direction)return e.direction}}catch(e){}let t=this.services?.languageUtils||new aV(aJ());return e.toLowerCase().indexOf("-latn")>1?"ltr":["ar","shu","sqr","ssh","xaa","yhd","yud","aao","abh","abv","acm","acq","acw","acx","acy","adf","ads","aeb","aec","afb","ajp","apc","apd","arb","arq","ars","ary","arz","auz","avl","ayh","ayl","ayn","ayp","bbz","pga","he","iw","ps","pbt","pbu","pst","prp","prd","ug","ur","ydd","yds","yih","ji","yi","hbo","men","xmn","fa","jpr","peo","pes","prs","dv","sam","ckb"].indexOf(t.getLanguagePartFromCode(e))>-1||e.toLowerCase().indexOf("-arab")>1?"rtl":"ltr"}static createInstance(e={},t){return new a0(e,t)}cloneInstance(e={},t=aQ){let n=e.forkResourceStore;n&&delete e.forkResourceStore;let r={...this.options,...e,isClone:!0},a=new a0(r);return(void 0!==e.debug||void 0!==e.prefix)&&(a.logger=a.logger.clone(e)),["store","services","language"].forEach(e=>{a[e]=this[e]}),a.services={...this.services},a.services.utils={hasLoadedNamespace:a.hasLoadedNamespace.bind(a)},n&&(a.store=new aA(Object.keys(this.store.data).reduce((e,t)=>(e[t]={...this.store.data[t]},e[t]=Object.keys(e[t]).reduce((n,r)=>(n[r]={...e[t][r]},n),e[t]),e),{}),r),a.services.resourceStore=a.store),a.translator=new aB(a.services,r),a.translator.on("*",(e,...t)=>{a.emit(e,...t)}),a.init(r,t),a.translator.options=r,a.translator.backendConnector.services.utils={hasLoadedNamespace:a.hasLoadedNamespace.bind(a)},a}toJSON(){return{options:this.options,store:this.store,language:this.language,languages:this.languages,resolvedLanguage:this.resolvedLanguage}}}let a1=a0.createInstance();a1.createInstance=a0.createInstance,a1.createInstance,a1.dir,a1.init,a1.loadResources,a1.reloadResources,a1.use,a1.changeLanguage,a1.getFixedT,a1.t,a1.exists,a1.setDefaultNamespace,a1.hasLoadedNamespace,a1.loadNamespaces,a1.loadLanguages;let a4=a1.default||a1;function a2(e,t,n,r){return a4.t(t,{ns:e,defaultValue:n,...r})}function a3(e,t,n){return ap[e]?a2("core",e,t??ap[e],n):(console.error(`O3 Core Translations does not provide key '${e}'. The key itself is being rendered as text.`),e)}function a6(e,t){let n=window.getOpenmrsSpaBase().replace(/\/$/,""),r=a5(e,{openmrsBase:window.openmrsBase,openmrsSpaBase:n,...t});return e.startsWith("//")?r:r.replace(/^\/\//,"/")}function a5(e,t){return Object.keys(t).reduce((e,n)=>e.split("${"+n+"}").join(t[n]),e)}function a9({to:e,templateParams:t}){let n=window.getOpenmrsSpaBase().replace(/\/$/,""),r=a6(e,t).replace(window.location.origin,""),a=new URL(r,window.location.origin);if("http:"!=a.protocol&&"https:"!=a.protocol)throw console.error(`Received request to navigate to non-http URL: ${a.toString()}`),Error(a3("navigateNonHttp"));r.startsWith(n)?rU(r):window.location.assign(r)}a4.on("initialized",function(){window.i18next.loadNamespaces(["core"])});let a8="openmrs:history";function a7(e){let t=JSON.parse(sessionStorage.getItem(a8)??"[]")||[];t.push(e),t.length>50&&(t=t.slice(-50)),sessionStorage.setItem(a8,JSON.stringify(t))}function oe(){0===JSON.parse(sessionStorage.getItem(a8)??"[]").length&&document.referrer&&a7(document.referrer),window.addEventListener("single-spa:routing-event",e=>{let t=ot();e.detail.originalEvent?.singleSpaTrigger=="replaceState"?(t[t.length-1]=window.location.href,sessionStorage.setItem(a8,JSON.stringify(t))):!e.detail.originalEvent?.singleSpa&&t.includes(window.location.href)?on({toUrl:window.location.href}):t[t.length-1]!==window.location.href&&a7(window.location.href)})}function ot(){return JSON.parse(sessionStorage.getItem(a8)??"[]")}function on({toUrl:e}){let t=ot(),n=t.lastIndexOf(e);if(-1!=n){let e=t.slice(0,n+1);a9({to:t[n]}),sessionStorage.setItem(a8,JSON.stringify(e))}else throw Error(`URL ${e} not found in history; cannot go back to it.`)}function or(){sessionStorage.removeItem(a8)}let oa="${openmrsSpaBase}/login",oo={redirectAuthFailure:{enabled:{_type:tM.Boolean,_default:!0,_description:"Whether to redirect logged-out users to `redirectAuthFailure.url`"},url:{_type:tM.String,_default:oa,_validators:[nW.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:tM.Array,_default:[401],_elements:{_type:tM.Number,_validators:[nW.inRange(100,600)]},_description:"The HTTP error codes for which users will be redirected"},resolvePromise:{_type:tM.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:tM.Boolean,_default:!0,_description:"Whether openmrsFetch should support redirects returned from the backend"}};function oi(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}let os="/ws/rest/v1",ol="/ws/fhir2/R4",ou=`${os}/session`;function oc(e){return e&&e.startsWith("http")?e:("/"!==e[0]&&(e="/"+e),window.openmrsBase+e)}function od(e,t={}){if("string"!=typeof e)throw Error("The first argument to @openmrs/api's openmrsFetch function must be a url string");if("object"!=typeof t)throw Error("The second argument to @openmrs/api's openmrsFetch function must be a plain object.");if(!window.openmrsBase)throw Error("@openmrs/api is running in a browser that doesn't have window.openmrsBase, which is provided by openmrs-module-spa's HTML file.");let n=oc(e);if(t.headers||(t.headers={}),ei(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,e.startsWith(os)&&void 0===t.headers["Disable-WWW-Authenticate"]&&(t.headers["Disable-WWW-Authenticate"]="true"),e.startsWith(ol)){let e=new URL(n,window.location.toString());e.searchParams.has("_summary")||(e.searchParams.set("_summary","data"),n=e.toString())}let r=Error();return window.fetch(n,t).then(async e=>{let{redirectAuthFailure:t,followRedirects:a}=await ng("@openmrs/esm-api");if(e.ok){let t=e.headers.get("location");return(a&&t&&(n===oc(ou)||204===e.status)&&a9({to:t}),204===e.status)?(e.data=null,e):e.clone().text().then(t=>{try{t&&(e.data=JSON.parse(t))}catch(e){}return e})}return n===oc(ou)&&403===e.status||t.enabled&&t.errors.includes(e.status)?(or(),a9({to:t.url||e.headers.get("location")||oa}),t.resolvePromise?Promise.resolve():new Promise(()=>{})):e.clone().text().then(t=>{let a=t;try{a=JSON.parse(t)}catch(e){}throw new om(n,e,a,r)},t=>{throw new om(n,e,null,r)})})}class om extends Error{constructor(e,t,n,r){super(),oi(this,"response",void 0),oi(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`,r.message=this.message,this.responseBody=n,this.response=t,this.stack=`Stacktrace for outgoing request:
12
+ ${t}`)}return r}let nT=(e,t)=>{let n=structuredClone(t);if(!e)return n;for(let t of Object.keys(e)){let r=n[t],a=e[t];if(a&&(a.hasOwnProperty("_type")||a.hasOwnProperty("_default"))){n.hasOwnProperty(t)||(n[t]=a._default);let e=a._elements;if(r&&n$(e)){if(a._type===tM.Array&&Array.isArray(r)){let a=r.map(t=>nT(e,t));n[t]=a}else if(a._type===tM.Object)for(let t of Object.keys(r))r[t]=nT(e,r[t])}}else if(nO(a)){let e=r??{};nO(e)&&(n[t]=nT(a,e))}}return n};function n$(e){return!!e&&Object.keys(e).filter(e=>!["_default","_validators"].includes(e)).length>0}function nO(e){return"object"==typeof e&&!Array.isArray(e)&&null!==e}let nN=new Set;function nA(e,t){let n=`${e}:::${t}`;nN||(nN=new Set),nN.has(n)||(console.error(t),nN.add(n))}function nI(e){e?nN.forEach(t=>{t.startsWith(e)&&nN.delete(t)}):nN.clear()}function nj(){na.forEach(e=>e()),na.length=0,nl.clear(),nb.clear(),nE.clear(),nw.clear(),ni()}let nM={"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:tM.Object,_default:{},_validators:[tL(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(", ")}.`})]}},nL={"Display conditions":{privileges:{_description:"The privilege(s) the user must have to use this extension",_type:tM.Array,_default:[]},expression:{_description:"The expression that determines whether the extension is displayed",_type:tM.String,_default:void 0}},...nM},nF=(e,t)=>tL(n=>e<=n&&n<=t,`must be between ${e} and ${t}`),nB=e=>{let t=e.concat(["openmrsBase","openmrsSpaBase"]);return tL(e=>{if(!e||"string"!=typeof e)return!1;let n=/\${(.*?)}/g,r=n.exec(e);for(;r;){if(!t.includes(r[1]))return!1;r=n.exec(e)}return!0},"Should be a URL or path. The allowed template parameters are "+t.map(e=>"${"+e+"}").join(", "))},nV=nB([]),nU=e=>tL(t=>e.includes(t),`Must be one of the following: '${e.join("', '")}'.`),nW={inRange:nF,isUrl:nV,isUrlWithTemplateParameters:nB,oneOf:nU};var nH=n(8067);let nz=F("breadcrumbs",[]);function nK(e){return nG([e])}function nG(e){let t=[...nZ(),...e.map(e=>({matcher:e.matcher instanceof RegExp?e.matcher:"string"==typeof e.matcher?(0,nH.pathToRegexp)(e.matcher).regexp:(0,nH.pathToRegexp)(e.path).regexp,settings:e}))];nz.setState(t,!0)}function nZ(){return nz.getState()}function nY(e,t){if(t)return function(e,t){let[n]=e.filter(e=>e.matcher.test(t));return n}(e,t)||function(e,t){let n=t.split("/");for(;n.length>1;){n.pop();let t=nY(e,n.join("/"));if(t)return t}}(e,t)}function nq(e,t){if(e.length>0){let n=nY(e,t);if(n){let t=[n],r=nY(e,n.settings.parent);for(;void 0!==r;)t.push(r),r=nY(e,r.settings.parent);return t.reverse()}}return[]}function nJ(e){return nq(nZ(),e)}var nX=Object.freeze({__proto__:null,get start(){return am},get ensureJQuerySupport(){return rJ},get setBootstrapMaxTime(){return rO},get setMountMaxTime(){return rN},get setUnmountMaxTime(){return rA},get setUnloadMaxTime(){return rI},get registerApplication(){return r8},get unregisterApplication(){return ae},get getMountedApps(){return r3},get getAppStatus(){return r5},get unloadApplication(){return at},get checkActivityFunctions(){return r7},get getAppNames(){return r6},get pathToActiveWhen(){return aa},get navigateToUrl(){return rU},get patchHistoryApi(){return rZ},get triggerAppChange(){return al},get addErrorHandler(){return n2},get removeErrorHandler(){return n3},get mountRootParcel(){return rC},get NOT_LOADED(){return n9},get LOADING_SOURCE_CODE(){return n8},get NOT_BOOTSTRAPPED(){return n7},get BOOTSTRAPPING(){return re},get NOT_MOUNTED(){return rt},get MOUNTING(){return rn},get UPDATING(){return ra},get LOAD_ERROR(){return rs},get MOUNTED(){return rr},get UNLOADING(){return ri},get UNMOUNTING(){return ro},get SKIP_BECAUSE_BROKEN(){return rl}}),nQ=("u">typeof globalThis?globalThis:"u">typeof window?window:"u">typeof global?global:"u">typeof self?self:{}).CustomEvent,n0=!function(){try{var e=new nQ("cat",{detail:{foo:"bar"}});return"cat"===e.type&&"bar"===e.detail.foo}catch(e){}return!1}()?"u">typeof document&&"function"==typeof document.createEvent?function(e,t){var n=document.createEvent("CustomEvent");return t?n.initCustomEvent(e,t.bubbles,t.cancelable,t.detail):n.initCustomEvent(e,!1,!1,void 0),n}:function(e,t){var n=document.createEventObject();return n.type=e,t?(n.bubbles=!!t.bubbles,n.cancelable=!!t.cancelable,n.detail=t.detail):(n.bubbles=!1,n.cancelable=!1,n.detail=void 0),n}:nQ;let n1=[];function n4(e,t,n){let r=n5(e,t,n);n1.length?n1.forEach(e=>e(r)):setTimeout(()=>{throw r})}function n2(e){if("function"!=typeof e)throw Error(n6(28,!1));n1.push(e)}function n3(e){if("function"!=typeof e)throw Error(n6(29,!1));let t=!1;return n1=n1.filter(n=>{let r=n===e;return t=t||r,!r}),t}function n6(e,t,...n){return`single-spa minified message #${e}: ${t?t+" ":""}See https://single-spa.js.org/error/?code=${e}${n.length?`&arg=${n.join("&arg=")}`:""}`}function n5(e,t,n){let r,a=`${rp(t)} '${rd(t)}' died in status ${t.status}: `;if(e instanceof Error){try{e.message=a+e.message}catch(e){}r=e}else{console.warn(n6(30,!1,t.status,rd(t)));try{r=Error(a+JSON.stringify(e))}catch(t){r=e}}return r.appOrParcelName=rd(t),t.status=n,r}let n9="NOT_LOADED",n8="LOADING_SOURCE_CODE",n7="NOT_BOOTSTRAPPED",re="BOOTSTRAPPING",rt="NOT_MOUNTED",rn="MOUNTING",rr="MOUNTED",ra="UPDATING",ro="UNMOUNTING",ri="UNLOADING",rs="LOAD_ERROR",rl="SKIP_BECAUSE_BROKEN";function ru(e){return e.status===rr}function rc(e){try{return e.activeWhen(window.location)}catch(t){return n4(t,e,rl),!1}}function rd(e){return e.name}function rm(e){return!!e.unmountThisParcel}function rp(e){return rm(e)?"parcel":"application"}function rf(){for(let e=arguments.length-1;e>0;e--)for(let t in arguments[e])"__proto__"!==t&&(arguments[e-1][t]=arguments[e][t]);return arguments[0]}function rh(e,t){for(let n=0;n<e.length;n++)if(t(e[n]))return e[n];return null}function rg(e){return e&&("function"==typeof e||Array.isArray(e)&&!rh(e,e=>"function"!=typeof e))}function ry(e,t){let n=e[t]||[];0===(n=Array.isArray(n)?n:[n]).length&&(n=[()=>Promise.resolve()]);let r=rp(e),a=rd(e);return function(e){return n.reduce((n,o,i)=>n.then(()=>{let n=o(e);return rv(n)?n:Promise.reject(n6(15,!1,r,a,t,i))}),Promise.resolve())}}function rv(e){return e&&"function"==typeof e.then&&"function"==typeof e.catch}let rb=[];function rw(e,t){return Promise.resolve().then(()=>e.status!==n7?e:(e.status=re,e.bootstrap?rj(e,"bootstrap").then(n).catch(n=>{if(t)throw n5(n,e,rl);return n4(n,e,rl),e}):Promise.resolve().then(n)));function n(){return e.status=rt,e}}function rE(e,t){return Promise.resolve().then(()=>{if(e.status!==rr)return e;return e.status=ro,Promise.all(Object.keys(e.parcels).map(t=>e.parcels[t].unmountThisParcel())).then(n,r=>n().then(()=>{let n=Error(r.message);if(t)throw n5(n,e,rl);n4(n,e,rl)})).then(()=>e);function n(){return rj(e,"unmount").then(()=>{e.status=rt},n=>{if(t)throw n5(n,e,rl);n4(n,e,rl)})}})}let rx=!1,rD=!1;function r_(e,t){return Promise.resolve().then(()=>e.status!==rt?e:(rx||(window.dispatchEvent(new n0("single-spa:before-first-mount")),rx=!0),e.status=rn,rj(e,"mount").then(()=>(e.status=rr,rD||(window.dispatchEvent(new n0("single-spa:first-mount")),rD=!0),e)).catch(n=>{return e.status=rr,rE(e,!0).then(r,r);function r(){if(t)throw n5(n,e,rl);return n4(n,e,rl),e}})))}let rk=0,rS={parcels:{}};function rC(){return rP.apply(rS,arguments)}function rP(e,t){let n,r,a,o=this;if(!e||"object"!=typeof e&&"function"!=typeof e)throw Error(n6(2,!1));if(e.name&&"string"!=typeof e.name)throw Error(n6(3,!1,typeof e.name));let i=rk++,s=e.name||`parcel-${i}`;if("object"!=typeof t)throw Error(n6(4,!1,s,typeof t));if(!t.domElement)throw Error(n6(5,!1,s));let l="function"==typeof e,u=l?e:()=>Promise.resolve(e),c={id:i,parcels:{},status:l?n8:n7,customProps:t,parentName:rd(o),unmountThisParcel:()=>p.then(()=>{if(c.status!==rr)throw Error(n6(6,!1,s,c.status));return rE(c,!0)}).then(e=>(c.parentName&&delete o.parcels[c.id],e)).then(e=>(r(e),e)).catch(e=>{throw c.status=rl,a(e),e})};o.parcels[i]=c;let d=u();if(!d||"function"!=typeof d.then)throw Error(n6(7,!1));let m=(d=d.then(e=>{if(!e)throw Error(n6(8,!1));if(s=e.name||`parcel-${i}`,Object.prototype.hasOwnProperty.call(e,"bootstrap")&&!rg(e.bootstrap))throw Error(n6(9,!1,s));if(!rg(e.mount))throw Error(n6(10,!1,s));if(!rg(e.unmount))throw Error(n6(11,!1,s));if(e.update&&!rg(e.update))throw Error(n6(12,!1,s));let t=ry(e,"bootstrap"),r=ry(e,"mount"),a=ry(e,"unmount");c.status=n7,c.name=s,c.bootstrap=t,c.mount=r,c.unmount=a,c.timeouts=rM(e.timeouts),e.update&&(c.update=ry(e,"update"),n.update=function(e){return c.customProps=e,rR(Promise.resolve().then(()=>{if(c.status!==rr)throw Error(n6(32,!1,rd(c)));return c.status=ra,rj(c,"update").then(()=>(c.status=rr,c)).catch(e=>{throw n5(e,c,rl)})}))})})).then(()=>rw(c,!0)),p=m.then(()=>r_(c,!0)),f=new Promise((e,t)=>{r=e,a=t});return n={mount:()=>rR(Promise.resolve().then(()=>{if(c.status!==rt)throw Error(n6(13,!1,s,c.status));return o.parcels[i]=c,r_(c)})),unmount:()=>rR(c.unmountThisParcel()),getStatus:()=>c.status,loadPromise:rR(d),bootstrapPromise:rR(m),mountPromise:rR(p),unmountPromise:rR(f)}}function rR(e){return e.then(()=>null)}function rT(e){let t=rd(e),n="function"==typeof e.customProps?e.customProps(t,window.location):e.customProps;("object"!=typeof n||null===n||Array.isArray(n))&&(n={},console.warn(n6(40,!1),t,n));let r=rf({},n,{name:t,mountParcel:rP.bind(e),singleSpa:nX});return rm(e)&&(r.unmountSelf=e.unmountThisParcel),r}let r$={bootstrap:{millis:4e3,dieOnTimeout:!1,warningMillis:1e3},mount:{millis:3e3,dieOnTimeout:!1,warningMillis:1e3},unmount:{millis:3e3,dieOnTimeout:!1,warningMillis:1e3},unload:{millis:3e3,dieOnTimeout:!1,warningMillis:1e3},update:{millis:3e3,dieOnTimeout:!1,warningMillis:1e3}};function rO(e,t,n){if("number"!=typeof e||e<=0)throw Error(n6(16,!1));r$.bootstrap={millis:e,dieOnTimeout:t,warningMillis:n||1e3}}function rN(e,t,n){if("number"!=typeof e||e<=0)throw Error(n6(17,!1));r$.mount={millis:e,dieOnTimeout:t,warningMillis:n||1e3}}function rA(e,t,n){if("number"!=typeof e||e<=0)throw Error(n6(18,!1));r$.unmount={millis:e,dieOnTimeout:t,warningMillis:n||1e3}}function rI(e,t,n){if("number"!=typeof e||e<=0)throw Error(n6(19,!1));r$.unload={millis:e,dieOnTimeout:t,warningMillis:n||1e3}}function rj(e,t){let n=e.timeouts[t],r=n.warningMillis,a=rp(e);return new Promise((o,i)=>{let s=!1,l=!1;e[t](rT(e)).then(e=>{s=!0,o(e)}).catch(e=>{s=!0,i(e)}),setTimeout(()=>c(1),r),setTimeout(()=>c(!0),n.millis);let u=n6(31,!1,t,a,rd(e),n.millis);function c(e){s||(!0===e?(l=!0,n.dieOnTimeout?i(Error(u)):console.error(u)):!l&&(console.warn(u),e*r+r<n.millis&&setTimeout(()=>c(e+1),r)))}})}function rM(e){let t={};for(let n in r$)t[n]=rf({},r$[n],e&&e[n]||{});return t}function rL(e){return Promise.resolve().then(()=>{let t,n;return e.loadPromise?e.loadPromise:e.status!==n9&&e.status!==rs?e:(e.status=n8,e.loadPromise=Promise.resolve().then(()=>{let r=e.loadApp(rT(e));if(!rv(r))throw n=!0,Error(n6(33,!1,rd(e)));return r.then(n=>{let r;e.loadErrorTime=null,"object"!=typeof(t=n)&&(r=34),Object.prototype.hasOwnProperty.call(t,"bootstrap")&&!rg(t.bootstrap)&&(r=35),rg(t.mount)||(r=36),rg(t.unmount)||(r=37);let a=rp(t);if(r){let n;try{n=JSON.stringify(t)}catch(e){}return console.error(n6(r,!1,a,rd(e),n),t),n4(void 0,e,rl),e}return t.devtools&&t.devtools.overlays&&(e.devtools.overlays=rf({},e.devtools.overlays,t.devtools.overlays)),e.status=n7,e.bootstrap=ry(t,"bootstrap"),e.mount=ry(t,"mount"),e.unmount=ry(t,"unmount"),e.unload=ry(t,"unload"),e.timeouts=rM(t.timeouts),delete e.loadPromise,e})}).catch(t=>{let r;return delete e.loadPromise,n?r=rl:(r=rs,e.loadErrorTime=(new Date).getTime()),n4(t,e,r),e}))})}let rF="u">typeof window,rB={hashchange:[],popstate:[]},rV=["hashchange","popstate"];function rU(e){let t;if("string"==typeof e)t=e;else if(this&&this.href)t=this.href;else{if(!(e&&e.currentTarget&&e.currentTarget.href&&e.preventDefault))throw Error(n6(14,!1));t=e.currentTarget.href,e.preventDefault()}let n=rY(window.location.href),r=rY(t);0===t.indexOf("#")?window.location.hash=r.hash:n.host!==r.host&&r.host?window.location.href=t:r.pathname===n.pathname&&r.search===n.search?window.location.hash=r.hash:window.history.pushState(null,null,t)}function rW(e){if(e){let t=e[0].type;rV.indexOf(t)>=0&&rB[t].forEach(t=>{try{t.apply(this,e)}catch(e){setTimeout(()=>{throw e})}})}}function rH(){au([],arguments)}function rz(e,t){return function(){let n=window.location.href,r=e.apply(this,arguments),o=window.location.href;return a&&n===o||window.dispatchEvent(function(e,t){let n;try{n=new PopStateEvent("popstate",{state:e})}catch(t){(n=document.createEvent("PopStateEvent")).initPopStateEvent("popstate",!1,!1,e)}return n.singleSpa=!0,n.singleSpaTrigger=t,n}(window.history.state,t)),r}}let rK=null,rG=!1;function rZ(e){if(rG)throw Error(n6(43,!1));a=!e||!e.hasOwnProperty("urlRerouteOnly")||e.urlRerouteOnly,rG=!0,rK=window.history.replaceState,window.addEventListener("hashchange",rH),window.addEventListener("popstate",rH);let t=window.addEventListener,n=window.removeEventListener;window.addEventListener=function(e,n){if(!("function"==typeof n&&rV.indexOf(e)>=0)||rh(rB[e],e=>e===n))return t.apply(this,arguments);rB[e].push(n)},window.removeEventListener=function(e,t){return"function"==typeof t&&rV.indexOf(e)>=0&&(rB[e]=rB[e].filter(e=>e!==t)),n.apply(this,arguments)},window.history.pushState=rz(window.history.pushState,"pushState"),window.history.replaceState=rz(rK,"replaceState")}function rY(e){let t=document.createElement("a");return t.href=e,t}rF&&(window.singleSpaNavigate?console.warn(n6(41,!1)):window.singleSpaNavigate=rU);let rq=!1;function rJ(e=window.jQuery){if(e||window.$&&window.$.fn&&window.$.fn.jquery&&(e=window.$),e&&!rq){let t=e.fn.on,n=e.fn.off;e.fn.on=function(e,n){return rX.call(this,t,window.addEventListener,e,n,arguments)},e.fn.off=function(e,t){return rX.call(this,n,window.removeEventListener,e,t,arguments)},rq=!0}}function rX(e,t,n,r,a){return"string"!=typeof n?e.apply(this,a):(n.split(/\s+/).forEach(e=>{rV.indexOf(e)>=0&&(t(e,r),n=n.replace(e,""))}),""===n.trim()?this:e.apply(this,a))}let rQ={};function r0(e){return Promise.resolve().then(()=>{let t=rQ[rd(e)];if(!t)return e;if(e.status===n9)return r1(e,t),e;if(e.status===ri)return t.promise.then(()=>e);if(e.status!==rt&&e.status!==rs)return e;let n=e.status===rs?Promise.resolve():rj(e,"unload");return e.status=ri,n.then(()=>(r1(e,t),e)).catch(n=>(delete rQ[rd(e)],delete e.bootstrap,delete e.mount,delete e.unmount,delete e.unload,n4(n,e,rl),t.reject(n),e))})}function r1(e,t){delete rQ[rd(e)],delete e.bootstrap,delete e.mount,delete e.unmount,delete e.unload,e.status=n9,t.resolve()}function r4(e,t,n,r){rQ[rd(e)]={app:e,resolve:n,reject:r},Object.defineProperty(rQ[rd(e)],"promise",{get:t})}let r2=[];function r3(){return r2.filter(ru).map(rd)}function r6(){return r2.map(rd)}function r5(e){let t=rh(r2,t=>rd(t)===e);return t?t.status:null}let r9=!1;function r8(e,t,n,r){var a,o;let i,s,l=(i={name:null,loadApp:null,activeWhen:null,customProps:null},"object"==typeof e?(function(e){if(Array.isArray(e)||null===e)throw Error(n6(39,!1));let t=["name","app","activeWhen","customProps"],n=Object.keys(e).reduce((e,n)=>t.indexOf(n)>=0?e:e.concat(n),[]);if(0!==n.length)throw Error(n6(38,!1,t.join(", "),n.join(", ")));if("string"!=typeof e.name||0===e.name.length||"object"!=typeof e.app&&"function"!=typeof e.app)throw Error(n6(20,!1));let r=e=>"string"==typeof e||"function"==typeof e;if(!(r(e.activeWhen)||Array.isArray(e.activeWhen)&&e.activeWhen.every(r)))throw Error(n6(24,!1));if(!ar(e.customProps))throw Error(n6(22,!1))}(e),i.name=e.name,i.loadApp=e.app,i.activeWhen=e.activeWhen,i.customProps=e.customProps):(function(e,t,n,r){if("string"!=typeof e||0===e.length)throw Error(n6(20,!1));if(!t)throw Error(n6(23,!1));if("function"!=typeof n)throw Error(n6(24,!1));if(!ar(r))throw Error(n6(22,!1))}(e,t,n,r),i.name=e,i.loadApp=t,i.activeWhen=n,i.customProps=r),i.loadApp="function"!=typeof(a=i.loadApp)?()=>Promise.resolve(a):a,i.customProps=i.customProps||{},s=(s=Array.isArray(o=i.activeWhen)?o:[o]).map(e=>"function"==typeof e?e:aa(e)),i.activeWhen=e=>s.some(t=>t(e)),i);if(ad||r9||(r9=!0,setTimeout(()=>{ad||console.warn(n6(1,!1))},5e3)),-1!==r6().indexOf(l.name))throw Error(n6(21,!1,l.name));r2.push(rf({loadErrorTime:null,status:n9,parcels:{},devtools:{overlays:{options:{},selectors:[]}}},l)),rF&&(rJ(),au())}function r7(e=window.location){return r2.filter(t=>t.activeWhen(e)).map(rd)}function ae(e){if(0===r2.filter(t=>rd(t)===e).length)throw Error(n6(25,!1,e));return(rF?at(e,{waitForUnmount:!1}):Promise.resolve()).then(()=>{let t=r2.map(rd).indexOf(e);r2.splice(t,1)})}function at(e,t={waitForUnmount:!1}){if("string"!=typeof e)throw Error(n6(26,!1));let n=rh(r2,t=>rd(t)===e);if(!n)throw Error(n6(27,!1,e));let r=rQ[rd(n)];if(t&&t.waitForUnmount){if(r)return r.promise;{let e=new Promise((t,r)=>{r4(n,()=>e,t,r)});return e}}{let e;return r?(e=r.promise,an(n,r.resolve,r.reject)):e=new Promise((t,r)=>{r4(n,()=>e,t,r),an(n,t,r)}),e}}function an(e,t,n){Promise.resolve().then(()=>{if(rh(r7(),t=>t===rd(e)))return al()}).then(()=>rE(e).then(r0).then(()=>{t(),setTimeout(()=>{au()})})).catch(n)}function ar(e){return!e||"function"==typeof e||"object"==typeof e&&null!==e&&!Array.isArray(e)}function aa(e,t){let n=function(e,t){let n=0,r=!1,a="^";"/"!==e[0]&&(e="/"+e);for(let t=0;t<e.length;t++){let n=e[t],a=r&&"/"===n;(!r&&":"===n||a)&&o(t)}return o(e.length),RegExp(a,"i");function o(o){let i=e.slice(n,o).replace(/[|\\{}()[\]^$+*?.]/g,"\\$&");if(a+=r?"[^/]+/?":i,o===e.length)if(r)t&&(a+="$");else{let e=t?"":".*";a="/"===a.charAt(a.length-1)?`${a}${e}$`:`${a}(/${e})?(#.*)?$`}r=!r,n=o}}(e,t);return e=>{let t=e.origin;t||(t=`${e.protocol}//${e.host}`);let r=e.href.replace(t,"").replace(e.search,"").split("?")[0];return n.test(r)}}let ao=!1,ai=[],as=rF&&window.location.href;function al(){return au()}function au(e=[],t,n=!1){let r,a,o,i,s;if(ao)return new Promise((e,n)=>{ai.push({resolve:e,reject:n,eventArguments:t})});let{appsToUnload:l,appsToUnmount:u,appsToLoad:c,appsToMount:d}=(r=[],a=[],o=[],i=[],s=(new Date).getTime(),r2.forEach(e=>{let t=e.status!==rl&&rc(e);switch(e.status){case rs:t&&s-e.loadErrorTime>=200&&o.push(e);break;case n9:case n8:t&&o.push(e);break;case n7:case rt:!t&&rQ[rd(e)]?r.push(e):t&&i.push(e);break;case rr:t||a.push(e)}}),{appsToUnload:r,appsToUnmount:a,appsToLoad:o,appsToMount:i}),m,p=[],f=as,h=as=window.location.href;return ad?(ao=!0,m=l.concat(c,u,d),Promise.resolve().then(()=>(w(0===m.length?"before-no-app-change":"before-app-change",b(!0)),w("before-routing-event",b(!0,{cancelNavigation:g})),Promise.all(p).then(n=>{if(n.some(e=>e))return rK.call(window.history,history.state,"",f.substring(location.origin.length)),as=location.href,ao=!1,au(e,t,!0);let r=l.map(r0),a=Promise.all(u.map(rE).map(e=>e.then(r0)).concat(r));a.then(()=>{w("before-mount-routing-event",b(!0))},e=>{throw e});let o=c.map(e=>rL(e).then(e=>ac(e,a))),i=d.filter(e=>0>c.indexOf(e)).map(e=>ac(e,a));return a.catch(e=>{throw v(),e}).then(()=>(v(),Promise.all(o.concat(i)).catch(t=>{throw e.forEach(e=>e.reject(t)),t}).then(y).then(()=>{},e=>{throw e})))})))):(m=c,Promise.resolve().then(()=>Promise.all(c.map(rL)).then(v).then(()=>[]).catch(e=>{throw v(),e}).finally(()=>{})));function g(e=!0){let t="function"==typeof(null==e?void 0:e.then)?e:Promise.resolve(e);p.push(t.catch(e=>(console.warn(Error(n6(42,!1))),console.warn(e),!1)))}function y(){let t=r3();e.forEach(e=>e.resolve(t));try{w(0===m.length?"no-app-change":"app-change",b()),w("routing-event",b())}catch(e){setTimeout(()=>{throw e})}if(ao=!1,ai.length>0){let e=ai;ai=[],au(e)}return t}function v(){n||(e.forEach(e=>{rW(e.eventArguments)}),rW(t))}function b(e=!1,n){let r={},a={[rr]:[],[rt]:[],[n9]:[],[rl]:[]};e?(c.concat(d).forEach((e,t)=>{i(e,rr)}),l.forEach(e=>{i(e,n9)}),u.forEach(e=>{i(e,rt)})):m.forEach(e=>{i(e)});let o={detail:{newAppStatuses:r,appsByNewStatus:a,totalAppChanges:m.length,originalEvent:null==t?void 0:t[0],oldUrl:f,newUrl:h}};return n&&rf(o.detail,n),o;function i(e,t){let n=rd(e);t=t||r5(n),r[n]=t,(a[t]=a[t]||[]).push(n)}}function w(e,t){n||window.dispatchEvent(new n0(`single-spa:${e}`,t))}}function ac(e,t){return rc(e)?rw(e).then(e=>t.then(()=>rc(e)?r_(e):e)):t.then(()=>e)}let ad=!1;function am(e){ad=!0,rF&&(rZ(e),au())}rF&&window.__SINGLE_SPA_DEVTOOLS__&&(window.__SINGLE_SPA_DEVTOOLS__.exposedMethods={getRawAppData:function(){return[...r2]},reroute:au,NOT_LOADED:n9,toLoadPromise:rL,toBootstrapPromise:rw,unregisterApplication:ae,getProfilerData:function(){return rb}});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",batchActionItemSelected:"{{totalSelected}} item selected",batchActionsItemsSelected:"{{totalSelected}} items selected",cancel:"Cancel",change:"Change",Clinic:"Clinic",close:"Close",closesActionableNotification:"Close actionable notification",closeSnackbar:"Close snackbar",confirm:"Confirm",contactAdministratorIfIssuePersists:"Contact your system administrator if the problem persists.",contactDetails:"Contact details",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",recordNewEntry:"Record {{displayText}}",relationships:"Relationships",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",sex:"Sex",showLess:"Show less",showMore:"Show more",snackbarNotification:"Snackbar notification",toggleDevTools:"Toggle dev tools",unknown:"Unknown",yearAbbreviation:"yr",yearsAbbreviation:"yrs"},af=e=>"string"==typeof e,ah=()=>{let e,t,n=new Promise((n,r)=>{e=n,t=r});return n.resolve=e,n.reject=t,n},ag=e=>null==e?"":""+e,ay=/###/g,av=e=>e&&e.indexOf("###")>-1?e.replace(ay,"."):e,ab=e=>!e||af(e),aw=(e,t,n)=>{let r=af(t)?t.split("."):t,a=0;for(;a<r.length-1;){if(ab(e))return{};let t=av(r[a]);!e[t]&&n&&(e[t]=new n),e=Object.prototype.hasOwnProperty.call(e,t)?e[t]:{},++a}return ab(e)?{}:{obj:e,k:av(r[a])}},aE=(e,t,n)=>{let{obj:r,k:a}=aw(e,t,Object);if(void 0!==r||1===t.length){r[a]=n;return}let o=t[t.length-1],i=t.slice(0,t.length-1),s=aw(e,i,Object);for(;void 0===s.obj&&i.length;)o=`${i[i.length-1]}.${o}`,s=aw(e,i=i.slice(0,i.length-1),Object),s?.obj&&void 0!==s.obj[`${s.k}.${o}`]&&(s.obj=void 0);s.obj[`${s.k}.${o}`]=n},ax=(e,t)=>{let{obj:n,k:r}=aw(e,t);if(n&&Object.prototype.hasOwnProperty.call(n,r))return n[r]},aD=(e,t,n)=>{for(let r in t)"__proto__"!==r&&"constructor"!==r&&(r in e?af(e[r])||e[r]instanceof String||af(t[r])||t[r]instanceof String?n&&(e[r]=t[r]):aD(e[r],t[r],n):e[r]=t[r]);return e};var a_={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;","/":"&#x2F;"};let ak=e=>af(e)?e.replace(/[&<>"'\/]/g,e=>a_[e]):e,aS=[" ",",","?","!",";"],aC=new class{constructor(e){this.capacity=e,this.regExpMap=new Map,this.regExpQueue=[]}getRegExp(e){let t=this.regExpMap.get(e);if(void 0!==t)return t;let n=new RegExp(e);return this.regExpQueue.length===this.capacity&&this.regExpMap.delete(this.regExpQueue.shift()),this.regExpMap.set(e,n),this.regExpQueue.push(e),n}}(20),aP=(e,t,n=".")=>{if(!e)return;if(e[t]){if(!Object.prototype.hasOwnProperty.call(e,t))return;return e[t]}let r=t.split(n),a=e;for(let e=0;e<r.length;){let t;if(!a||"object"!=typeof a)return;let o="";for(let i=e;i<r.length;++i)if(i!==e&&(o+=n),o+=r[i],void 0!==(t=a[o])){if(["string","number","boolean"].indexOf(typeof t)>-1&&i<r.length-1)continue;e+=i-e+1;break}a=t}return a},aR=e=>e?.replace("_","-"),aT={type:"logger",log(e){this.output("log",e)},warn(e){this.output("warn",e)},error(e){this.output("error",e)},output(e,t){console?.[e]?.apply?.(console,t)}};class a${constructor(e,t={}){this.init(e,t)}init(e,t={}){this.prefix=t.prefix||"i18next:",this.logger=e||aT,this.options=t,this.debug=t.debug}log(...e){return this.forward(e,"log","",!0)}warn(...e){return this.forward(e,"warn","",!0)}error(...e){return this.forward(e,"error","")}deprecate(...e){return this.forward(e,"warn","WARNING DEPRECATED: ",!0)}forward(e,t,n,r){return r&&!this.debug?null:(af(e[0])&&(e[0]=`${n}${this.prefix} ${e[0]}`),this.logger[t](e))}create(e){return new a$(this.logger,{...{prefix:`${this.prefix}:${e}:`},...this.options})}clone(e){return(e=e||this.options).prefix=e.prefix||this.prefix,new a$(this.logger,e)}}var aO=new a$;class aN{constructor(){this.observers={}}on(e,t){return e.split(" ").forEach(e=>{this.observers[e]||(this.observers[e]=new Map);let n=this.observers[e].get(t)||0;this.observers[e].set(t,n+1)}),this}off(e,t){if(this.observers[e]){if(!t)return void delete this.observers[e];this.observers[e].delete(t)}}emit(e,...t){this.observers[e]&&Array.from(this.observers[e].entries()).forEach(([e,n])=>{for(let r=0;r<n;r++)e(...t)}),this.observers["*"]&&Array.from(this.observers["*"].entries()).forEach(([n,r])=>{for(let a=0;a<r;a++)n.apply(n,[e,...t])})}}class aA extends aN{constructor(e,t={ns:["translation"],defaultNS:"translation"}){super(),this.data=e||{},this.options=t,void 0===this.options.keySeparator&&(this.options.keySeparator="."),void 0===this.options.ignoreJSONStructure&&(this.options.ignoreJSONStructure=!0)}addNamespaces(e){0>this.options.ns.indexOf(e)&&this.options.ns.push(e)}removeNamespaces(e){let t=this.options.ns.indexOf(e);t>-1&&this.options.ns.splice(t,1)}getResource(e,t,n,r={}){let a,o=void 0!==r.keySeparator?r.keySeparator:this.options.keySeparator,i=void 0!==r.ignoreJSONStructure?r.ignoreJSONStructure:this.options.ignoreJSONStructure;e.indexOf(".")>-1?a=e.split("."):(a=[e,t],n&&(Array.isArray(n)?a.push(...n):af(n)&&o?a.push(...n.split(o)):a.push(n)));let s=ax(this.data,a);return(!s&&!t&&!n&&e.indexOf(".")>-1&&(e=a[0],t=a[1],n=a.slice(2).join(".")),!s&&i&&af(n))?aP(this.data?.[e]?.[t],n,o):s}addResource(e,t,n,r,a={silent:!1}){let o=void 0!==a.keySeparator?a.keySeparator:this.options.keySeparator,i=[e,t];n&&(i=i.concat(o?n.split(o):n)),e.indexOf(".")>-1&&(i=e.split("."),r=t,t=i[1]),this.addNamespaces(t),aE(this.data,i,r),a.silent||this.emit("added",e,t,n,r)}addResources(e,t,n,r={silent:!1}){for(let r in n)(af(n[r])||Array.isArray(n[r]))&&this.addResource(e,t,r,n[r],{silent:!0});r.silent||this.emit("added",e,t,n)}addResourceBundle(e,t,n,r,a,o={silent:!1,skipCopy:!1}){let i=[e,t];e.indexOf(".")>-1&&(i=e.split("."),r=n,n=t,t=i[1]),this.addNamespaces(t);let s=ax(this.data,i)||{};o.skipCopy||(n=JSON.parse(JSON.stringify(n))),r?aD(s,n,a):s={...s,...n},aE(this.data,i,s),o.silent||this.emit("added",e,t,n)}removeResourceBundle(e,t){this.hasResourceBundle(e,t)&&delete this.data[e][t],this.removeNamespaces(t),this.emit("removed",e,t)}hasResourceBundle(e,t){return void 0!==this.getResource(e,t)}getResourceBundle(e,t){return t||(t=this.options.defaultNS),this.getResource(e,t)}getDataByLanguage(e){return this.data[e]}hasLanguageSomeTranslations(e){let t=this.getDataByLanguage(e);return!!(t&&Object.keys(t)||[]).find(e=>t[e]&&Object.keys(t[e]).length>0)}toJSON(){return this.data}}var aI={processors:{},addPostProcessor(e){this.processors[e.name]=e},handle(e,t,n,r,a){return e.forEach(e=>{t=this.processors[e]?.process(t,n,r,a)??t}),t}};let aj=Symbol("i18next/PATH_KEY");function aM(e,t){let n,r,a,{[aj]:o}=e((r=[],(a=Object.create(null)).get=(e,t)=>(n?.revoke?.(),t===aj)?r:(r.push(t),(n=Proxy.revocable(e,a)).proxy),Proxy.revocable(Object.create(null),a).proxy));return o.join(t?.keySeparator??".")}let aL={},aF=e=>!af(e)&&"boolean"!=typeof e&&"number"!=typeof e;class aB extends aN{constructor(e,t={}){super(),((e,t,n)=>{e.forEach(e=>{t[e]&&(n[e]=t[e])})})(["resourceStore","languageUtils","pluralResolver","interpolator","backendConnector","i18nFormat","utils"],e,this),this.options=t,void 0===this.options.keySeparator&&(this.options.keySeparator="."),this.logger=aO.create("translator")}changeLanguage(e){e&&(this.language=e)}exists(e,t={interpolation:{}}){let n={...t};if(null==e)return!1;let r=this.resolve(e,n);if(r?.res===void 0)return!1;let a=aF(r.res);return!1!==n.returnObjects||!a}extractFromKey(e,t){let n=void 0!==t.nsSeparator?t.nsSeparator:this.options.nsSeparator;void 0===n&&(n=":");let r=void 0!==t.keySeparator?t.keySeparator:this.options.keySeparator,a=t.ns||this.options.defaultNS||[],o=n&&e.indexOf(n)>-1,i=!this.options.userDefinedKeySeparator&&!t.keySeparator&&!this.options.userDefinedNsSeparator&&!t.nsSeparator&&!((e,t,n)=>{t=t||"",n=n||"";let r=aS.filter(e=>0>t.indexOf(e)&&0>n.indexOf(e));if(0===r.length)return!0;let a=aC.getRegExp(`(${r.map(e=>"?"===e?"\\?":e).join("|")})`),o=!a.test(e);if(!o){let t=e.indexOf(n);t>0&&!a.test(e.substring(0,t))&&(o=!0)}return o})(e,n,r);if(o&&!i){let t=e.match(this.interpolator.nestingRegexp);if(t&&t.length>0)return{key:e,namespaces:af(a)?[a]:a};let o=e.split(n);(n!==r||n===r&&this.options.ns.indexOf(o[0])>-1)&&(a=o.shift()),e=o.join(r)}return{key:e,namespaces:af(a)?[a]:a}}translate(e,t,n){let r="object"==typeof t?{...t}:t;if("object"!=typeof r&&this.options.overloadTranslationOptionHandler&&(r=this.options.overloadTranslationOptionHandler(arguments)),"object"==typeof r&&(r={...r}),r||(r={}),null==e)return"";"function"==typeof e&&(e=aM(e,{...this.options,...r})),Array.isArray(e)||(e=[String(e)]);let a=void 0!==r.returnDetails?r.returnDetails:this.options.returnDetails,o=void 0!==r.keySeparator?r.keySeparator:this.options.keySeparator,{key:i,namespaces:s}=this.extractFromKey(e[e.length-1],r),l=s[s.length-1],u=void 0!==r.nsSeparator?r.nsSeparator:this.options.nsSeparator;void 0===u&&(u=":");let c=r.lng||this.language,d=r.appendNamespaceToCIMode||this.options.appendNamespaceToCIMode;if(c?.toLowerCase()==="cimode")return d?a?{res:`${l}${u}${i}`,usedKey:i,exactUsedKey:i,usedLng:c,usedNS:l,usedParams:this.getUsedParamsDetails(r)}:`${l}${u}${i}`:a?{res:i,usedKey:i,exactUsedKey:i,usedLng:c,usedNS:l,usedParams:this.getUsedParamsDetails(r)}:i;let m=this.resolve(e,r),p=m?.res,f=m?.usedKey||i,h=m?.exactUsedKey||i,g=void 0!==r.joinArrays?r.joinArrays:this.options.joinArrays,y=!this.i18nFormat||this.i18nFormat.handleAsObject,v=void 0!==r.count&&!af(r.count),b=aB.hasDefaultValue(r),w=v?this.pluralResolver.getSuffix(c,r.count,r):"",E=r.ordinal&&v?this.pluralResolver.getSuffix(c,r.count,{ordinal:!1}):"",x=v&&!r.ordinal&&0===r.count,D=x&&r[`defaultValue${this.options.pluralSeparator}zero`]||r[`defaultValue${w}`]||r[`defaultValue${E}`]||r.defaultValue,_=p;y&&!p&&b&&(_=D);let k=aF(_),S=Object.prototype.toString.apply(_);if(y&&_&&k&&0>["[object Number]","[object Function]","[object RegExp]"].indexOf(S)&&!(af(g)&&Array.isArray(_))){if(!r.returnObjects&&!this.options.returnObjects){this.options.returnedObjectHandler||this.logger.warn("accessing an object - but returnObjects options is not enabled!");let e=this.options.returnedObjectHandler?this.options.returnedObjectHandler(f,_,{...r,ns:s}):`key '${i} (${this.language})' returned an object instead of string.`;return a?(m.res=e,m.usedParams=this.getUsedParamsDetails(r),m):e}if(o){let e=Array.isArray(_),t=e?[]:{},n=e?h:f;for(let e in _)if(Object.prototype.hasOwnProperty.call(_,e)){let a=`${n}${o}${e}`;b&&!p?t[e]=this.translate(a,{...r,defaultValue:aF(D)?D[e]:void 0,...{joinArrays:!1,ns:s}}):t[e]=this.translate(a,{...r,joinArrays:!1,ns:s}),t[e]===a&&(t[e]=_[e])}p=t}}else if(y&&af(g)&&Array.isArray(p))(p=p.join(g))&&(p=this.extendTranslation(p,e,r,n));else{let t=!1,a=!1;!this.isValidLookup(p)&&b&&(t=!0,p=D),this.isValidLookup(p)||(a=!0,p=i);let s=(r.missingKeyNoValueFallbackToKey||this.options.missingKeyNoValueFallbackToKey)&&a?void 0:p,d=b&&D!==p&&this.options.updateMissing;if(a||t||d){if(this.logger.log(d?"updateKey":"missingKey",c,l,i,d?D:p),o){let e=this.resolve(i,{...r,keySeparator:!1});e&&e.res&&this.logger.warn("Seems the loaded translations were in flat JSON format instead of nested. Either set keySeparator: false on init or make sure your translations are published in nested format.")}let e=[],t=this.languageUtils.getFallbackCodes(this.options.fallbackLng,r.lng||this.language);if("fallback"===this.options.saveMissingTo&&t&&t[0])for(let n=0;n<t.length;n++)e.push(t[n]);else"all"===this.options.saveMissingTo?e=this.languageUtils.toResolveHierarchy(r.lng||this.language):e.push(r.lng||this.language);let n=(e,t,n)=>{let a=b&&n!==p?n:s;this.options.missingKeyHandler?this.options.missingKeyHandler(e,l,t,a,d,r):this.backendConnector?.saveMissing&&this.backendConnector.saveMissing(e,l,t,a,d,r),this.emit("missingKey",e,l,t,p)};this.options.saveMissing&&(this.options.saveMissingPlurals&&v?e.forEach(e=>{let t=this.pluralResolver.getSuffixes(e,r);x&&r[`defaultValue${this.options.pluralSeparator}zero`]&&0>t.indexOf(`${this.options.pluralSeparator}zero`)&&t.push(`${this.options.pluralSeparator}zero`),t.forEach(t=>{n([e],i+t,r[`defaultValue${t}`]||D)})}):n(e,i,D))}p=this.extendTranslation(p,e,r,m,n),a&&p===i&&this.options.appendNamespaceToMissingKey&&(p=`${l}${u}${i}`),(a||t)&&this.options.parseMissingKeyHandler&&(p=this.options.parseMissingKeyHandler(this.options.appendNamespaceToMissingKey?`${l}${u}${i}`:i,t?p:void 0,r))}return a?(m.res=p,m.usedParams=this.getUsedParamsDetails(r),m):p}extendTranslation(e,t,n,r,a){if(this.i18nFormat?.parse)e=this.i18nFormat.parse(e,{...this.options.interpolation.defaultVariables,...n},n.lng||this.language||r.usedLng,r.usedNS,r.usedKey,{resolved:r});else if(!n.skipInterpolation){let o;n.interpolation&&this.interpolator.init({...n,...{interpolation:{...this.options.interpolation,...n.interpolation}}});let i=af(e)&&(n?.interpolation?.skipOnVariables!==void 0?n.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables);if(i){let t=e.match(this.interpolator.nestingRegexp);o=t&&t.length}let s=n.replace&&!af(n.replace)?n.replace:n;if(this.options.interpolation.defaultVariables&&(s={...this.options.interpolation.defaultVariables,...s}),e=this.interpolator.interpolate(e,s,n.lng||this.language||r.usedLng,n),i){let t=e.match(this.interpolator.nestingRegexp);o<(t&&t.length)&&(n.nest=!1)}!n.lng&&r&&r.res&&(n.lng=this.language||r.usedLng),!1!==n.nest&&(e=this.interpolator.nest(e,(...e)=>a?.[0]!==e[0]||n.context?this.translate(...e,t):(this.logger.warn(`It seems you are nesting recursively key: ${e[0]} in key: ${t[0]}`),null),n)),n.interpolation&&this.interpolator.reset()}let o=n.postProcess||this.options.postProcess,i=af(o)?[o]:o;return null!=e&&i?.length&&!1!==n.applyPostProcessor&&(e=aI.handle(i,e,t,this.options&&this.options.postProcessPassResolved?{i18nResolved:{...r,usedParams:this.getUsedParamsDetails(n)},...n}:n,this)),e}resolve(e,t={}){let n,r,a,o,i;return af(e)&&(e=[e]),e.forEach(e=>{if(this.isValidLookup(n))return;let s=this.extractFromKey(e,t),l=s.key;r=l;let u=s.namespaces;this.options.fallbackNS&&(u=u.concat(this.options.fallbackNS));let c=void 0!==t.count&&!af(t.count),d=c&&!t.ordinal&&0===t.count,m=void 0!==t.context&&(af(t.context)||"number"==typeof t.context)&&""!==t.context,p=t.lngs?t.lngs:this.languageUtils.toResolveHierarchy(t.lng||this.language,t.fallbackLng);u.forEach(e=>{this.isValidLookup(n)||(i=e,!aL[`${p[0]}-${e}`]&&this.utils?.hasLoadedNamespace&&!this.utils?.hasLoadedNamespace(i)&&(aL[`${p[0]}-${e}`]=!0,this.logger.warn(`key "${r}" for languages "${p.join(", ")}" won't get resolved as namespace "${i}" was not yet loaded`,"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!")),p.forEach(r=>{let i;if(this.isValidLookup(n))return;o=r;let s=[l];if(this.i18nFormat?.addLookupKeys)this.i18nFormat.addLookupKeys(s,l,r,e,t);else{let e;c&&(e=this.pluralResolver.getSuffix(r,t.count,t));let n=`${this.options.pluralSeparator}zero`,a=`${this.options.pluralSeparator}ordinal${this.options.pluralSeparator}`;if(c&&(t.ordinal&&0===e.indexOf(a)&&s.push(l+e.replace(a,this.options.pluralSeparator)),s.push(l+e),d&&s.push(l+n)),m){let r=`${l}${this.options.contextSeparator||"_"}${t.context}`;s.push(r),c&&(t.ordinal&&0===e.indexOf(a)&&s.push(r+e.replace(a,this.options.pluralSeparator)),s.push(r+e),d&&s.push(r+n))}}for(;i=s.pop();)this.isValidLookup(n)||(a=i,n=this.getResource(r,e,i,t))}))})}),{res:n,usedKey:r,exactUsedKey:a,usedLng:o,usedNS:i}}isValidLookup(e){return void 0!==e&&!(!this.options.returnNull&&null===e)&&!(!this.options.returnEmptyString&&""===e)}getResource(e,t,n,r={}){return this.i18nFormat?.getResource?this.i18nFormat.getResource(e,t,n,r):this.resourceStore.getResource(e,t,n,r)}getUsedParamsDetails(e={}){let t=e.replace&&!af(e.replace),n=t?e.replace:e;if(t&&void 0!==e.count&&(n.count=e.count),this.options.interpolation.defaultVariables&&(n={...this.options.interpolation.defaultVariables,...n}),!t)for(let e of(n={...n},["defaultValue","ordinal","context","replace","lng","lngs","fallbackLng","ns","keySeparator","nsSeparator","returnObjects","returnDetails","joinArrays","postProcess","interpolation"]))delete n[e];return n}static hasDefaultValue(e){let t="defaultValue";for(let n in e)if(Object.prototype.hasOwnProperty.call(e,n)&&t===n.substring(0,t.length)&&void 0!==e[n])return!0;return!1}}class aV{constructor(e){this.options=e,this.supportedLngs=this.options.supportedLngs||!1,this.logger=aO.create("languageUtils")}getScriptPartFromCode(e){if(!(e=aR(e))||0>e.indexOf("-"))return null;let t=e.split("-");return 2===t.length||(t.pop(),"x"===t[t.length-1].toLowerCase())?null:this.formatLanguageCode(t.join("-"))}getLanguagePartFromCode(e){if(!(e=aR(e))||0>e.indexOf("-"))return e;let t=e.split("-");return this.formatLanguageCode(t[0])}formatLanguageCode(e){if(af(e)&&e.indexOf("-")>-1){let t;try{t=Intl.getCanonicalLocales(e)[0]}catch(e){}return(t&&this.options.lowerCaseLng&&(t=t.toLowerCase()),t)?t:this.options.lowerCaseLng?e.toLowerCase():e}return this.options.cleanCode||this.options.lowerCaseLng?e.toLowerCase():e}isSupportedCode(e){return("languageOnly"===this.options.load||this.options.nonExplicitSupportedLngs)&&(e=this.getLanguagePartFromCode(e)),!this.supportedLngs||!this.supportedLngs.length||this.supportedLngs.indexOf(e)>-1}getBestMatchFromCodes(e){let t;return e?(e.forEach(e=>{if(t)return;let n=this.formatLanguageCode(e);(!this.options.supportedLngs||this.isSupportedCode(n))&&(t=n)}),!t&&this.options.supportedLngs&&e.forEach(e=>{if(t)return;let n=this.getScriptPartFromCode(e);if(this.isSupportedCode(n))return t=n;let r=this.getLanguagePartFromCode(e);if(this.isSupportedCode(r))return t=r;t=this.options.supportedLngs.find(e=>{if(e===r||!(0>e.indexOf("-")&&0>r.indexOf("-"))&&(e.indexOf("-")>0&&0>r.indexOf("-")&&e.substring(0,e.indexOf("-"))===r||0===e.indexOf(r)&&r.length>1))return e})}),t||(t=this.getFallbackCodes(this.options.fallbackLng)[0]),t):null}getFallbackCodes(e,t){if(!e)return[];if("function"==typeof e&&(e=e(t)),af(e)&&(e=[e]),Array.isArray(e))return e;if(!t)return e.default||[];let n=e[t];return n||(n=e[this.getScriptPartFromCode(t)]),n||(n=e[this.formatLanguageCode(t)]),n||(n=e[this.getLanguagePartFromCode(t)]),n||(n=e.default),n||[]}toResolveHierarchy(e,t){let n=this.getFallbackCodes((!1===t?[]:t)||this.options.fallbackLng||[],e),r=[],a=e=>{e&&(this.isSupportedCode(e)?r.push(e):this.logger.warn(`rejecting language code not found in supportedLngs: ${e}`))};return af(e)&&(e.indexOf("-")>-1||e.indexOf("_")>-1)?("languageOnly"!==this.options.load&&a(this.formatLanguageCode(e)),"languageOnly"!==this.options.load&&"currentOnly"!==this.options.load&&a(this.getScriptPartFromCode(e)),"currentOnly"!==this.options.load&&a(this.getLanguagePartFromCode(e))):af(e)&&a(this.formatLanguageCode(e)),n.forEach(e=>{0>r.indexOf(e)&&a(this.formatLanguageCode(e))}),r}}let aU={zero:0,one:1,two:2,few:3,many:4,other:5},aW={select:e=>1===e?"one":"other",resolvedOptions:()=>({pluralCategories:["one","other"]})};class aH{constructor(e,t={}){this.languageUtils=e,this.options=t,this.logger=aO.create("pluralResolver"),this.pluralRulesCache={}}addRule(e,t){this.rules[e]=t}clearCache(){this.pluralRulesCache={}}getRule(e,t={}){let n,r=aR("dev"===e?"en":e),a=t.ordinal?"ordinal":"cardinal",o=JSON.stringify({cleanedCode:r,type:a});if(o in this.pluralRulesCache)return this.pluralRulesCache[o];try{n=new Intl.PluralRules(r,{type:a})}catch(a){if(!Intl)return this.logger.error("No Intl support, please use an Intl polyfill!"),aW;if(!e.match(/-|_/))return aW;let r=this.languageUtils.getLanguagePartFromCode(e);n=this.getRule(r,t)}return this.pluralRulesCache[o]=n,n}needsPlural(e,t={}){let n=this.getRule(e,t);return n||(n=this.getRule("dev",t)),n?.resolvedOptions().pluralCategories.length>1}getPluralFormsOfKey(e,t,n={}){return this.getSuffixes(e,n).map(e=>`${t}${e}`)}getSuffixes(e,t={}){let n=this.getRule(e,t);return(n||(n=this.getRule("dev",t)),n)?n.resolvedOptions().pluralCategories.sort((e,t)=>aU[e]-aU[t]).map(e=>`${this.options.prepend}${t.ordinal?`ordinal${this.options.prepend}`:""}${e}`):[]}getSuffix(e,t,n={}){let r=this.getRule(e,n);return r?`${this.options.prepend}${n.ordinal?`ordinal${this.options.prepend}`:""}${r.select(t)}`:(this.logger.warn(`no plural rule found for: ${e}`),this.getSuffix("dev",t,n))}}let az=(e,t,n,r=".",a=!0)=>{let o,i=void 0!==(o=ax(e,n))?o:ax(t,n);return!i&&a&&af(n)&&void 0===(i=aP(e,n,r))&&(i=aP(t,n,r)),i};class aK{constructor(e={}){this.logger=aO.create("interpolator"),this.options=e,this.format=e?.interpolation?.format||(e=>e),this.init(e)}init(e={}){e.interpolation||(e.interpolation={escapeValue:!0});let{escape:t,escapeValue:n,useRawValueToEscape:r,prefix:a,prefixEscaped:o,suffix:i,suffixEscaped:s,formatSeparator:l,unescapeSuffix:u,unescapePrefix:c,nestingPrefix:d,nestingPrefixEscaped:m,nestingSuffix:p,nestingSuffixEscaped:f,nestingOptionsSeparator:h,maxReplaces:g,alwaysFormat:y}=e.interpolation;this.escape=void 0!==t?t:ak,this.escapeValue=void 0===n||n,this.useRawValueToEscape=void 0!==r&&r,this.prefix=a?a.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&"):o||"{{",this.suffix=i?i.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&"):s||"}}",this.formatSeparator=l||",",this.unescapePrefix=u?"":c||"-",this.unescapeSuffix=this.unescapePrefix?"":u||"",this.nestingPrefix=d?d.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&"):m||"$t(".replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&"),this.nestingSuffix=p?p.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&"):f||")".replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&"),this.nestingOptionsSeparator=h||",",this.maxReplaces=g||1e3,this.alwaysFormat=void 0!==y&&y,this.resetRegExp()}reset(){this.options&&this.init(this.options)}resetRegExp(){let e=(e,t)=>e?.source===t?(e.lastIndex=0,e):RegExp(t,"g");this.regexp=e(this.regexp,`${this.prefix}(.+?)${this.suffix}`),this.regexpUnescape=e(this.regexpUnescape,`${this.prefix}${this.unescapePrefix}(.+?)${this.unescapeSuffix}${this.suffix}`),this.nestingRegexp=e(this.nestingRegexp,`${this.nestingPrefix}((?:[^()"']+|"[^"]*"|'[^']*'|\\((?:[^()]|"[^"]*"|'[^']*')*\\))*?)${this.nestingSuffix}`)}interpolate(e,t,n,r){let a,o,i,s=this.options&&this.options.interpolation&&this.options.interpolation.defaultVariables||{},l=e=>{if(0>e.indexOf(this.formatSeparator)){let a=az(t,s,e,this.options.keySeparator,this.options.ignoreJSONStructure);return this.alwaysFormat?this.format(a,void 0,n,{...r,...t,interpolationkey:e}):a}let a=e.split(this.formatSeparator),o=a.shift().trim(),i=a.join(this.formatSeparator).trim();return this.format(az(t,s,o,this.options.keySeparator,this.options.ignoreJSONStructure),i,n,{...r,...t,interpolationkey:o})};this.resetRegExp();let u=r?.missingInterpolationHandler||this.options.missingInterpolationHandler,c=r?.interpolation?.skipOnVariables!==void 0?r.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables;return[{regex:this.regexpUnescape,safeValue:e=>e.replace(/\$/g,"$$$$")},{regex:this.regexp,safeValue:e=>this.escapeValue?this.escape(e).replace(/\$/g,"$$$$"):e.replace(/\$/g,"$$$$")}].forEach(t=>{for(i=0;a=t.regex.exec(e);){let n=a[1].trim();if(void 0===(o=l(n)))if("function"==typeof u){let t=u(e,a,r);o=af(t)?t:""}else if(r&&Object.prototype.hasOwnProperty.call(r,n))o="";else if(c){o=a[0];continue}else this.logger.warn(`missed to pass in variable ${n} for interpolating ${e}`),o="";else af(o)||this.useRawValueToEscape||(o=ag(o));let s=t.safeValue(o);if(e=e.replace(a[0],s),c?(t.regex.lastIndex+=o.length,t.regex.lastIndex-=a[0].length):t.regex.lastIndex=0,++i>=this.maxReplaces)break}}),e}nest(e,t,n={}){let r,a,o,i=(e,t)=>{let n=this.nestingOptionsSeparator;if(0>e.indexOf(n))return e;let r=e.split(RegExp(`${n}[ ]*{`)),a=`{${r[1]}`;e=r[0];let i=(a=this.interpolate(a,o)).match(/'/g),s=a.match(/"/g);((i?.length??0)%2!=0||s)&&s.length%2==0||(a=a.replace(/'/g,'"'));try{o=JSON.parse(a),t&&(o={...t,...o})}catch(t){return this.logger.warn(`failed parsing options string in nesting for key ${e}`,t),`${e}${n}${a}`}return o.defaultValue&&o.defaultValue.indexOf(this.prefix)>-1&&delete o.defaultValue,e};for(;r=this.nestingRegexp.exec(e);){let s=[];(o=(o={...n}).replace&&!af(o.replace)?o.replace:o).applyPostProcessor=!1,delete o.defaultValue;let l=/{.*}/.test(r[1])?r[1].lastIndexOf("}")+1:r[1].indexOf(this.formatSeparator);if(-1!==l&&(s=r[1].slice(l).split(this.formatSeparator).map(e=>e.trim()).filter(Boolean),r[1]=r[1].slice(0,l)),(a=t(i.call(this,r[1].trim(),o),o))&&r[0]===e&&!af(a))return a;af(a)||(a=ag(a)),a||(this.logger.warn(`missed to resolve ${r[1]} for nesting ${e}`),a=""),s.length&&(a=s.reduce((e,t)=>this.format(e,t,n.lng,{...n,interpolationkey:r[1].trim()}),a.trim())),e=e.replace(r[0],a),this.regexp.lastIndex=0}return e}}let aG=e=>{let t={};return(n,r,a)=>{let o=a;a&&a.interpolationkey&&a.formatParams&&a.formatParams[a.interpolationkey]&&a[a.interpolationkey]&&(o={...o,[a.interpolationkey]:void 0});let i=r+JSON.stringify(o),s=t[i];return s||(s=e(aR(r),a),t[i]=s),s(n)}},aZ=e=>(t,n,r)=>e(aR(n),r)(t);class aY{constructor(e={}){this.logger=aO.create("formatter"),this.options=e,this.init(e)}init(e,t={interpolation:{}}){this.formatSeparator=t.interpolation.formatSeparator||",";let n=t.cacheInBuiltFormats?aG:aZ;this.formats={number:n((e,t)=>{let n=new Intl.NumberFormat(e,{...t});return e=>n.format(e)}),currency:n((e,t)=>{let n=new Intl.NumberFormat(e,{...t,style:"currency"});return e=>n.format(e)}),datetime:n((e,t)=>{let n=new Intl.DateTimeFormat(e,{...t});return e=>n.format(e)}),relativetime:n((e,t)=>{let n=new Intl.RelativeTimeFormat(e,{...t});return e=>n.format(e,t.range||"day")}),list:n((e,t)=>{let n=new Intl.ListFormat(e,{...t});return e=>n.format(e)})}}add(e,t){this.formats[e.toLowerCase().trim()]=t}addCached(e,t){this.formats[e.toLowerCase().trim()]=aG(t)}format(e,t,n,r={}){let a=t.split(this.formatSeparator);if(a.length>1&&a[0].indexOf("(")>1&&0>a[0].indexOf(")")&&a.find(e=>e.indexOf(")")>-1)){let e=a.findIndex(e=>e.indexOf(")")>-1);a[0]=[a[0],...a.splice(1,e)].join(this.formatSeparator)}return a.reduce((e,t)=>{let{formatName:a,formatOptions:o}=(e=>{let t=e.toLowerCase().trim(),n={};if(e.indexOf("(")>-1){let r=e.split("(");t=r[0].toLowerCase().trim();let a=r[1].substring(0,r[1].length-1);"currency"===t&&0>a.indexOf(":")?n.currency||(n.currency=a.trim()):"relativetime"===t&&0>a.indexOf(":")?n.range||(n.range=a.trim()):a.split(";").forEach(e=>{if(e){let[t,...r]=e.split(":"),a=r.join(":").trim().replace(/^'+|'+$/g,""),o=t.trim();n[o]||(n[o]=a),"false"===a&&(n[o]=!1),"true"===a&&(n[o]=!0),isNaN(a)||(n[o]=parseInt(a,10))}})}return{formatName:t,formatOptions:n}})(t);if(this.formats[a]){let t=e;try{let i=r?.formatParams?.[r.interpolationkey]||{},s=i.locale||i.lng||r.locale||r.lng||n;t=this.formats[a](e,s,{...o,...r,...i})}catch(e){this.logger.warn(e)}return t}return this.logger.warn(`there was no format function for ${a}`),e},e)}}class aq extends aN{constructor(e,t,n,r={}){super(),this.backend=e,this.store=t,this.services=n,this.languageUtils=n.languageUtils,this.options=r,this.logger=aO.create("backendConnector"),this.waitingReads=[],this.maxParallelReads=r.maxParallelReads||10,this.readingCalls=0,this.maxRetries=r.maxRetries>=0?r.maxRetries:5,this.retryTimeout=r.retryTimeout>=1?r.retryTimeout:350,this.state={},this.queue=[],this.backend?.init?.(n,r.backend,r)}queueLoad(e,t,n,r){let a={},o={},i={},s={};return e.forEach(e=>{let r=!0;t.forEach(t=>{let i=`${e}|${t}`;!n.reload&&this.store.hasResourceBundle(e,t)?this.state[i]=2:this.state[i]<0||(1===this.state[i]?void 0===o[i]&&(o[i]=!0):(this.state[i]=1,r=!1,void 0===o[i]&&(o[i]=!0),void 0===a[i]&&(a[i]=!0),void 0===s[t]&&(s[t]=!0)))}),r||(i[e]=!0)}),(Object.keys(a).length||Object.keys(o).length)&&this.queue.push({pending:o,pendingCount:Object.keys(o).length,loaded:{},errors:[],callback:r}),{toLoad:Object.keys(a),pending:Object.keys(o),toLoadLanguages:Object.keys(i),toLoadNamespaces:Object.keys(s)}}loaded(e,t,n){let r=e.split("|"),a=r[0],o=r[1];t&&this.emit("failedLoading",a,o,t),!t&&n&&this.store.addResourceBundle(a,o,n,void 0,void 0,{skipCopy:!0}),this.state[e]=t?-1:2,t&&n&&(this.state[e]=0);let i={};this.queue.forEach(n=>{((e,t,n,r)=>{let{obj:a,k:o}=aw(e,t,Object);a[o]=a[o]||[],a[o].push(n)})(n.loaded,[a],o),void 0!==n.pending[e]&&(delete n.pending[e],n.pendingCount--),t&&n.errors.push(t),0!==n.pendingCount||n.done||(Object.keys(n.loaded).forEach(e=>{i[e]||(i[e]={});let t=n.loaded[e];t.length&&t.forEach(t=>{void 0===i[e][t]&&(i[e][t]=!0)})}),n.done=!0,n.errors.length?n.callback(n.errors):n.callback())}),this.emit("loaded",i),this.queue=this.queue.filter(e=>!e.done)}read(e,t,n,r=0,a=this.retryTimeout,o){if(!e.length)return o(null,{});if(this.readingCalls>=this.maxParallelReads)return void this.waitingReads.push({lng:e,ns:t,fcName:n,tried:r,wait:a,callback:o});this.readingCalls++;let i=(i,s)=>{if(this.readingCalls--,this.waitingReads.length>0){let e=this.waitingReads.shift();this.read(e.lng,e.ns,e.fcName,e.tried,e.wait,e.callback)}i&&s&&r<this.maxRetries?setTimeout(()=>{this.read.call(this,e,t,n,r+1,2*a,o)},a):o(i,s)},s=this.backend[n].bind(this.backend);if(2===s.length){try{let n=s(e,t);n&&"function"==typeof n.then?n.then(e=>i(null,e)).catch(i):i(null,n)}catch(e){i(e)}return}return s(e,t,i)}prepareLoading(e,t,n={},r){if(!this.backend)return this.logger.warn("No backend was added via i18next.use. Will not load resources."),r&&r();af(e)&&(e=this.languageUtils.toResolveHierarchy(e)),af(t)&&(t=[t]);let a=this.queueLoad(e,t,n,r);if(!a.toLoad.length)return a.pending.length||r(),null;a.toLoad.forEach(e=>{this.loadOne(e)})}load(e,t,n){this.prepareLoading(e,t,{},n)}reload(e,t,n){this.prepareLoading(e,t,{reload:!0},n)}loadOne(e,t=""){let n=e.split("|"),r=n[0],a=n[1];this.read(r,a,"read",void 0,void 0,(n,o)=>{n&&this.logger.warn(`${t}loading namespace ${a} for language ${r} failed`,n),!n&&o&&this.logger.log(`${t}loaded namespace ${a} for language ${r}`,o),this.loaded(e,n,o)})}saveMissing(e,t,n,r,a,o={},i=()=>{}){if(this.services?.utils?.hasLoadedNamespace&&!this.services?.utils?.hasLoadedNamespace(t))return void this.logger.warn(`did not save key "${n}" as the namespace "${t}" was not yet loaded`,"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!");if(null!=n&&""!==n){if(this.backend?.create){let s={...o,isUpdate:a},l=this.backend.create.bind(this.backend);if(l.length<6)try{let a;(a=5===l.length?l(e,t,n,r,s):l(e,t,n,r))&&"function"==typeof a.then?a.then(e=>i(null,e)).catch(i):i(null,a)}catch(e){i(e)}else l(e,t,n,r,i,s)}e&&e[0]&&this.store.addResource(e[0],t,n,r)}}}let aJ=()=>({debug:!1,initAsync:!0,ns:["translation"],defaultNS:["translation"],fallbackLng:["dev"],fallbackNS:!1,supportedLngs:!1,nonExplicitSupportedLngs:!1,load:"all",preload:!1,simplifyPluralSuffix:!0,keySeparator:".",nsSeparator:":",pluralSeparator:"_",contextSeparator:"_",partialBundledLanguages:!1,saveMissing:!1,updateMissing:!1,saveMissingTo:"fallback",saveMissingPlurals:!0,missingKeyHandler:!1,missingInterpolationHandler:!1,postProcess:!1,postProcessPassResolved:!1,returnNull:!1,returnEmptyString:!0,returnObjects:!1,joinArrays:!1,returnedObjectHandler:!1,parseMissingKeyHandler:!1,appendNamespaceToMissingKey:!1,appendNamespaceToCIMode:!1,overloadTranslationOptionHandler:e=>{let t={};if("object"==typeof e[1]&&(t=e[1]),af(e[1])&&(t.defaultValue=e[1]),af(e[2])&&(t.tDescription=e[2]),"object"==typeof e[2]||"object"==typeof e[3]){let n=e[3]||e[2];Object.keys(n).forEach(e=>{t[e]=n[e]})}return t},interpolation:{escapeValue:!0,format:e=>e,prefix:"{{",suffix:"}}",formatSeparator:",",unescapePrefix:"-",nestingPrefix:"$t(",nestingSuffix:")",nestingOptionsSeparator:",",maxReplaces:1e3,skipOnVariables:!0},cacheInBuiltFormats:!0}),aX=e=>(af(e.ns)&&(e.ns=[e.ns]),af(e.fallbackLng)&&(e.fallbackLng=[e.fallbackLng]),af(e.fallbackNS)&&(e.fallbackNS=[e.fallbackNS]),e.supportedLngs?.indexOf?.("cimode")<0&&(e.supportedLngs=e.supportedLngs.concat(["cimode"])),"boolean"==typeof e.initImmediate&&(e.initAsync=e.initImmediate),e),aQ=()=>{};class a0 extends aN{constructor(e={},t){if(super(),this.options=aX(e),this.services={},this.logger=aO,this.modules={external:[]},(e=>{Object.getOwnPropertyNames(Object.getPrototypeOf(e)).forEach(t=>{"function"==typeof e[t]&&(e[t]=e[t].bind(e))})})(this),t&&!this.isInitialized&&!e.isClone){if(!this.options.initAsync)return this.init(e,t),this;setTimeout(()=>{this.init(e,t)},0)}}init(e={},t){this.isInitializing=!0,"function"==typeof e&&(t=e,e={}),null==e.defaultNS&&e.ns&&(af(e.ns)?e.defaultNS=e.ns:0>e.ns.indexOf("translation")&&(e.defaultNS=e.ns[0]));let n=aJ();this.options={...n,...this.options,...aX(e)},this.options.interpolation={...n.interpolation,...this.options.interpolation},void 0!==e.keySeparator&&(this.options.userDefinedKeySeparator=e.keySeparator),void 0!==e.nsSeparator&&(this.options.userDefinedNsSeparator=e.nsSeparator);let r=e=>e?"function"==typeof e?new e:e:null;if(!this.options.isClone){let e;this.modules.logger?aO.init(r(this.modules.logger),this.options):aO.init(null,this.options),e=this.modules.formatter?this.modules.formatter:aY;let t=new aV(this.options);this.store=new aA(this.options.resources,this.options);let a=this.services;a.logger=aO,a.resourceStore=this.store,a.languageUtils=t,a.pluralResolver=new aH(t,{prepend:this.options.pluralSeparator,simplifyPluralSuffix:this.options.simplifyPluralSuffix}),this.options.interpolation.format&&this.options.interpolation.format!==n.interpolation.format&&this.logger.deprecate("init: you are still using the legacy format function, please use the new approach: https://www.i18next.com/translation-function/formatting"),e&&(!this.options.interpolation.format||this.options.interpolation.format===n.interpolation.format)&&(a.formatter=r(e),a.formatter.init&&a.formatter.init(a,this.options),this.options.interpolation.format=a.formatter.format.bind(a.formatter)),a.interpolator=new aK(this.options),a.utils={hasLoadedNamespace:this.hasLoadedNamespace.bind(this)},a.backendConnector=new aq(r(this.modules.backend),a.resourceStore,a,this.options),a.backendConnector.on("*",(e,...t)=>{this.emit(e,...t)}),this.modules.languageDetector&&(a.languageDetector=r(this.modules.languageDetector),a.languageDetector.init&&a.languageDetector.init(a,this.options.detection,this.options)),this.modules.i18nFormat&&(a.i18nFormat=r(this.modules.i18nFormat),a.i18nFormat.init&&a.i18nFormat.init(this)),this.translator=new aB(this.services,this.options),this.translator.on("*",(e,...t)=>{this.emit(e,...t)}),this.modules.external.forEach(e=>{e.init&&e.init(this)})}if(this.format=this.options.interpolation.format,t||(t=aQ),this.options.fallbackLng&&!this.services.languageDetector&&!this.options.lng){let e=this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);e.length>0&&"dev"!==e[0]&&(this.options.lng=e[0])}this.services.languageDetector||this.options.lng||this.logger.warn("init: no languageDetector is used and no lng is defined"),["getResource","hasResourceBundle","getResourceBundle","getDataByLanguage"].forEach(e=>{this[e]=(...t)=>this.store[e](...t)}),["addResource","addResources","addResourceBundle","removeResourceBundle"].forEach(e=>{this[e]=(...t)=>(this.store[e](...t),this)});let a=ah(),o=()=>{let e=(e,n)=>{this.isInitializing=!1,this.isInitialized&&!this.initializedStoreOnce&&this.logger.warn("init: i18next is already initialized. You should call init just once!"),this.isInitialized=!0,this.options.isClone||this.logger.log("initialized",this.options),this.emit("initialized",this.options),a.resolve(n),t(e,n)};if(this.languages&&!this.isInitialized)return e(null,this.t.bind(this));this.changeLanguage(this.options.lng,e)};return this.options.resources||!this.options.initAsync?o():setTimeout(o,0),a}loadResources(e,t=aQ){let n=t,r=af(e)?e:this.language;if("function"==typeof e&&(n=e),!this.options.resources||this.options.partialBundledLanguages){if(r?.toLowerCase()==="cimode"&&(!this.options.preload||0===this.options.preload.length))return n();let e=[],t=t=>{t&&"cimode"!==t&&this.services.languageUtils.toResolveHierarchy(t).forEach(t=>{"cimode"!==t&&0>e.indexOf(t)&&e.push(t)})};r?t(r):this.services.languageUtils.getFallbackCodes(this.options.fallbackLng).forEach(e=>t(e)),this.options.preload?.forEach?.(e=>t(e)),this.services.backendConnector.load(e,this.options.ns,e=>{e||this.resolvedLanguage||!this.language||this.setResolvedLanguage(this.language),n(e)})}else n(null)}reloadResources(e,t,n){let r=ah();return"function"==typeof e&&(n=e,e=void 0),"function"==typeof t&&(n=t,t=void 0),e||(e=this.languages),t||(t=this.options.ns),n||(n=aQ),this.services.backendConnector.reload(e,t,e=>{r.resolve(),n(e)}),r}use(e){if(!e)throw Error("You are passing an undefined module! Please check the object you are passing to i18next.use()");if(!e.type)throw Error("You are passing a wrong module! Please check the object you are passing to i18next.use()");return"backend"===e.type&&(this.modules.backend=e),("logger"===e.type||e.log&&e.warn&&e.error)&&(this.modules.logger=e),"languageDetector"===e.type&&(this.modules.languageDetector=e),"i18nFormat"===e.type&&(this.modules.i18nFormat=e),"postProcessor"===e.type&&aI.addPostProcessor(e),"formatter"===e.type&&(this.modules.formatter=e),"3rdParty"===e.type&&this.modules.external.push(e),this}setResolvedLanguage(e){if(e&&this.languages&&!(["cimode","dev"].indexOf(e)>-1)){for(let e=0;e<this.languages.length;e++){let t=this.languages[e];if(!(["cimode","dev"].indexOf(t)>-1)&&this.store.hasLanguageSomeTranslations(t)){this.resolvedLanguage=t;break}}!this.resolvedLanguage&&0>this.languages.indexOf(e)&&this.store.hasLanguageSomeTranslations(e)&&(this.resolvedLanguage=e,this.languages.unshift(e))}}changeLanguage(e,t){this.isLanguageChangingTo=e;let n=ah();this.emit("languageChanging",e);let r=e=>{this.language=e,this.languages=this.services.languageUtils.toResolveHierarchy(e),this.resolvedLanguage=void 0,this.setResolvedLanguage(e)},a=(a,o)=>{o?this.isLanguageChangingTo===e&&(r(o),this.translator.changeLanguage(o),this.isLanguageChangingTo=void 0,this.emit("languageChanged",o),this.logger.log("languageChanged",o)):this.isLanguageChangingTo=void 0,n.resolve((...e)=>this.t(...e)),t&&t(a,(...e)=>this.t(...e))},o=t=>{e||t||!this.services.languageDetector||(t=[]);let n=af(t)?t:t&&t[0],o=this.store.hasLanguageSomeTranslations(n)?n:this.services.languageUtils.getBestMatchFromCodes(af(t)?[t]:t);o&&(this.language||r(o),this.translator.language||this.translator.changeLanguage(o),this.services.languageDetector?.cacheUserLanguage?.(o)),this.loadResources(o,e=>{a(e,o)})};return e||!this.services.languageDetector||this.services.languageDetector.async?!e&&this.services.languageDetector&&this.services.languageDetector.async?0===this.services.languageDetector.detect.length?this.services.languageDetector.detect().then(o):this.services.languageDetector.detect(o):o(e):o(this.services.languageDetector.detect()),n}getFixedT(e,t,n){let r=(e,t,...a)=>{let o,i;(o="object"!=typeof t?this.options.overloadTranslationOptionHandler([e,t].concat(a)):{...t}).lng=o.lng||r.lng,o.lngs=o.lngs||r.lngs,o.ns=o.ns||r.ns,""!==o.keyPrefix&&(o.keyPrefix=o.keyPrefix||n||r.keyPrefix);let s=this.options.keySeparator||".";return o.keyPrefix&&Array.isArray(e)?i=e.map(e=>("function"==typeof e&&(e=aM(e,{...this.options,...t})),`${o.keyPrefix}${s}${e}`)):("function"==typeof e&&(e=aM(e,{...this.options,...t})),i=o.keyPrefix?`${o.keyPrefix}${s}${e}`:e),this.t(i,o)};return af(e)?r.lng=e:r.lngs=e,r.ns=t,r.keyPrefix=n,r}t(...e){return this.translator?.translate(...e)}exists(...e){return this.translator?.exists(...e)}setDefaultNamespace(e){this.options.defaultNS=e}hasLoadedNamespace(e,t={}){if(!this.isInitialized)return this.logger.warn("hasLoadedNamespace: i18next was not initialized",this.languages),!1;if(!this.languages||!this.languages.length)return this.logger.warn("hasLoadedNamespace: i18n.languages were undefined or empty",this.languages),!1;let n=t.lng||this.resolvedLanguage||this.languages[0],r=!!this.options&&this.options.fallbackLng,a=this.languages[this.languages.length-1];if("cimode"===n.toLowerCase())return!0;let o=(e,t)=>{let n=this.services.backendConnector.state[`${e}|${t}`];return -1===n||0===n||2===n};if(t.precheck){let e=t.precheck(this,o);if(void 0!==e)return e}return!!(this.hasResourceBundle(n,e)||!this.services.backendConnector.backend||this.options.resources&&!this.options.partialBundledLanguages||o(n,e)&&(!r||o(a,e)))}loadNamespaces(e,t){let n=ah();return this.options.ns?(af(e)&&(e=[e]),e.forEach(e=>{0>this.options.ns.indexOf(e)&&this.options.ns.push(e)}),this.loadResources(e=>{n.resolve(),t&&t(e)}),n):(t&&t(),Promise.resolve())}loadLanguages(e,t){let n=ah();af(e)&&(e=[e]);let r=this.options.preload||[],a=e.filter(e=>0>r.indexOf(e)&&this.services.languageUtils.isSupportedCode(e));return a.length?(this.options.preload=r.concat(a),this.loadResources(e=>{n.resolve(),t&&t(e)}),n):(t&&t(),Promise.resolve())}dir(e){if(e||(e=this.resolvedLanguage||(this.languages?.length>0?this.languages[0]:this.language)),!e)return"rtl";try{let t=new Intl.Locale(e);if(t&&t.getTextInfo){let e=t.getTextInfo();if(e&&e.direction)return e.direction}}catch(e){}let t=this.services?.languageUtils||new aV(aJ());return e.toLowerCase().indexOf("-latn")>1?"ltr":["ar","shu","sqr","ssh","xaa","yhd","yud","aao","abh","abv","acm","acq","acw","acx","acy","adf","ads","aeb","aec","afb","ajp","apc","apd","arb","arq","ars","ary","arz","auz","avl","ayh","ayl","ayn","ayp","bbz","pga","he","iw","ps","pbt","pbu","pst","prp","prd","ug","ur","ydd","yds","yih","ji","yi","hbo","men","xmn","fa","jpr","peo","pes","prs","dv","sam","ckb"].indexOf(t.getLanguagePartFromCode(e))>-1||e.toLowerCase().indexOf("-arab")>1?"rtl":"ltr"}static createInstance(e={},t){return new a0(e,t)}cloneInstance(e={},t=aQ){let n=e.forkResourceStore;n&&delete e.forkResourceStore;let r={...this.options,...e,isClone:!0},a=new a0(r);return(void 0!==e.debug||void 0!==e.prefix)&&(a.logger=a.logger.clone(e)),["store","services","language"].forEach(e=>{a[e]=this[e]}),a.services={...this.services},a.services.utils={hasLoadedNamespace:a.hasLoadedNamespace.bind(a)},n&&(a.store=new aA(Object.keys(this.store.data).reduce((e,t)=>(e[t]={...this.store.data[t]},e[t]=Object.keys(e[t]).reduce((n,r)=>(n[r]={...e[t][r]},n),e[t]),e),{}),r),a.services.resourceStore=a.store),a.translator=new aB(a.services,r),a.translator.on("*",(e,...t)=>{a.emit(e,...t)}),a.init(r,t),a.translator.options=r,a.translator.backendConnector.services.utils={hasLoadedNamespace:a.hasLoadedNamespace.bind(a)},a}toJSON(){return{options:this.options,store:this.store,language:this.language,languages:this.languages,resolvedLanguage:this.resolvedLanguage}}}let a1=a0.createInstance();a1.createInstance=a0.createInstance,a1.createInstance,a1.dir,a1.init,a1.loadResources,a1.reloadResources,a1.use,a1.changeLanguage,a1.getFixedT,a1.t,a1.exists,a1.setDefaultNamespace,a1.hasLoadedNamespace,a1.loadNamespaces,a1.loadLanguages;let a4=a1.default||a1;function a2(e,t,n,r){return a4.t(t,{ns:e,defaultValue:n,...r})}function a3(e,t,n){return ap[e]?a2("core",e,t??ap[e],n):(console.error(`O3 Core Translations does not provide key '${e}'. The key itself is being rendered as text.`),e)}function a6(e,t){let n=window.getOpenmrsSpaBase().replace(/\/$/,""),r=a5(e,{openmrsBase:window.openmrsBase,openmrsSpaBase:n,...t});return e.startsWith("//")?r:r.replace(/^\/\//,"/")}function a5(e,t){return Object.keys(t).reduce((e,n)=>e.split("${"+n+"}").join(t[n]),e)}function a9({to:e,templateParams:t}){let n=window.getOpenmrsSpaBase().replace(/\/$/,""),r=a6(e,t).replace(window.location.origin,""),a=new URL(r,window.location.origin);if("http:"!=a.protocol&&"https:"!=a.protocol)throw console.error(`Received request to navigate to non-http URL: ${a.toString()}`),Error(a3("navigateNonHttp"));r.startsWith(n)?rU(r):window.location.assign(r)}a4.on("initialized",function(){window.i18next.loadNamespaces(["core"])});let a8="openmrs:history";function a7(e){let t=JSON.parse(sessionStorage.getItem(a8)??"[]")||[];t.push(e),t.length>50&&(t=t.slice(-50)),sessionStorage.setItem(a8,JSON.stringify(t))}function oe(){0===JSON.parse(sessionStorage.getItem(a8)??"[]").length&&document.referrer&&a7(document.referrer),window.addEventListener("single-spa:routing-event",e=>{let t=ot();e.detail.originalEvent?.singleSpaTrigger=="replaceState"?(t[t.length-1]=window.location.href,sessionStorage.setItem(a8,JSON.stringify(t))):!e.detail.originalEvent?.singleSpa&&t.includes(window.location.href)?on({toUrl:window.location.href}):t[t.length-1]!==window.location.href&&a7(window.location.href)})}function ot(){return JSON.parse(sessionStorage.getItem(a8)??"[]")}function on({toUrl:e}){let t=ot(),n=t.lastIndexOf(e);if(-1!=n){let e=t.slice(0,n+1);a9({to:t[n]}),sessionStorage.setItem(a8,JSON.stringify(e))}else throw Error(`URL ${e} not found in history; cannot go back to it.`)}function or(){sessionStorage.removeItem(a8)}let oa="${openmrsSpaBase}/login",oo={redirectAuthFailure:{enabled:{_type:tM.Boolean,_default:!0,_description:"Whether to redirect logged-out users to `redirectAuthFailure.url`"},url:{_type:tM.String,_default:oa,_validators:[nW.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:tM.Array,_default:[401],_elements:{_type:tM.Number,_validators:[nW.inRange(100,600)]},_description:"The HTTP error codes for which users will be redirected"},resolvePromise:{_type:tM.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:tM.Boolean,_default:!0,_description:"Whether openmrsFetch should support redirects returned from the backend"}};function oi(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}let os="/ws/rest/v1",ol="/ws/fhir2/R4",ou=`${os}/session`;function oc(e){return e&&e.startsWith("http")?e:("/"!==e[0]&&(e="/"+e),window.openmrsBase+e)}function od(e,t={}){if("string"!=typeof e)throw Error("The first argument to @openmrs/api's openmrsFetch function must be a url string");if("object"!=typeof t)throw Error("The second argument to @openmrs/api's openmrsFetch function must be a plain object.");if(!window.openmrsBase)throw Error("@openmrs/api is running in a browser that doesn't have window.openmrsBase, which is provided by openmrs-module-spa's HTML file.");let n=oc(e);t.headers||(t.headers={}),ei(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 r=!1;try{let e=new URL(n,window.location.href),t=new URL(oc(os),window.location.href),a=e.pathname.replace(/\/{2,}/g,"/"),o=t.pathname.replace(/\/{2,}/g,"/");r=e.origin===t.origin&&(a===o||a.startsWith(`${o}/`))}catch{}if(r){let e=!1;for(let[n,r]of Object.entries(t.headers))"disable-www-authenticate"===n.toLowerCase()&&(void 0===r?delete t.headers[n]:e=!0);e||(t.headers["Disable-WWW-Authenticate"]="true")}if(e.startsWith(ol)){let e=new URL(n,window.location.toString());e.searchParams.has("_summary")||(e.searchParams.set("_summary","data"),n=e.toString())}let a=Error();return window.fetch(n,t).then(async e=>{let{redirectAuthFailure:t,followRedirects:r}=await ng("@openmrs/esm-api");if(e.ok){let t=e.headers.get("location");return(r&&t&&(n===oc(ou)||204===e.status)&&a9({to:t}),204===e.status)?(e.data=null,e):e.clone().text().then(t=>{try{t&&(e.data=JSON.parse(t))}catch(e){}return e})}return n===oc(ou)&&403===e.status||t.enabled&&t.errors.includes(e.status)?(or(),a9({to:t.url||e.headers.get("location")||oa}),t.resolvePromise?Promise.resolve():new Promise(()=>{})):e.clone().text().then(t=>{let r=t;try{r=JSON.parse(t)}catch(e){}throw new om(n,e,r,a)},t=>{throw new om(n,e,null,a)})})}class om extends Error{constructor(e,t,n,r){super(),oi(this,"response",void 0),oi(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`,r.message=this.message,this.responseBody=n,this.response=t,this.stack=`Stacktrace for outgoing request:
13
13
  ${r.stack}
14
14
  Stacktrace for incoming response:
15
15
  ${this.stack}`}}let op=F("session",{loaded:!1,session:null}),of=0,oh=null;function og(){return oh||(op.getState().loaded&&of>=Date.now()-6e4?null:ow())}function oy(e){let t=e?.includeAuthStatus??!0,n=e=>t?e:e.user;return og()?new Promise(e=>{let t=op.subscribe(r=>{r.loaded&&(t(),e(n(r.session)))})}):Promise.resolve(n(op.getState().session))}function ov(){return og(),op}function ob(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 ow(e,t){of=Date.now();let n={};e&&t&&(n.Authorization=`Basic ${window.btoa(`${e}:${t}`)}`);let r=oC(od(ou,{headers:n})),a=()=>{oh===r&&(oh=null)};return r.then(a,a),oh=r,r}function oE(){op.setState({loaded:!0,session:{authenticated:!1,sessionId:""}})}function ox(e,t){var n,r;if(void 0===t)return!e;if(!e)return!0;return n=e,r=t,("string"==typeof n?!H(r.privileges.find(e=>n===e.display)):Array.isArray(n)?n.every(e=>!H(r.privileges.find(t=>e===t.display))):(H(n)||console.error(`Could not understand privileges "${n}"`),!0))||!H(t.roles.find(e=>"System Developer"===e.display))}function oD(){let e,t;return new Promise(n=>{let r=r=>{r.loaded&&r.session.user&&(e=r.session.user,n(r.session.user),t&&t())};r(op.getState()),e||(t=op.subscribe(r))})}async function o_(){return(await oy()).sessionLocation}async function ok(e,t){return oC(od(ou,{method:"POST",body:{sessionLocation:e},headers:{"Content-Type":"application/json"},signal:t.signal}))}async function oS(e,t,n){return n||(n=new AbortController),await od(`${os}/user/${e}`,{method:"POST",body:{userProperties:t},headers:{"Content-Type":"application/json"},signal:n.signal}),ow()}function oC(e){return new Promise((t,n)=>{e.then(e=>{let r;"object"==typeof e?.data?(r={loaded:!0,session:e.data},op.setState(r),t(r)):(r={loaded:!1,session:null},op.setState(r),n(r))}).catch(e=>{S(`Failed to fetch new session information: ${e}`);let t={loaded:!1,session:null};op.setState(t),n(t)})})}function oP(){return"development"===window.spaEnv||"true"===localStorage.getItem("openmrs:devtools")}op.subscribe(e=>{e.loaded&&e.session&&ob(e.session)});let oR={"webservices.rest":"2.24.0",fhir2:"1.0.0-SNAPSHOT"};function oT(){nu("@openmrs/esm-api",oo),ow()}let o$="import-map-override:",oO="import-map-overrides-disabled",oN="import-map-overrides:change",oA=!1,oI=null,oj=null;async function oM(){return oj??(oj=oL().then(({map:e,complete:t})=>(t||(oj=null),e))),oj}async function oL(){let e=document.querySelectorAll('script[type="systemjs-importmap"]'),t=[],n=!0;for(let r=0;r<e.length;r++){let a=e[r];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){n=!1,console.warn(`[import-maps] Failed to parse import map from script tag at index ${r}`,e)}}return{map:oF(t),complete:n}}function oF(e){let t={imports:{}};for(let n of e)n?.imports&&Object.assign(t.imports,n.imports);return t}function oB(){let e={};try{let t=oz();for(let n=0;n<localStorage.length;n++){let r=localStorage.key(n);if(r?.startsWith(o$)){let n=r.slice(o$.length);if(!t.includes(n)){let t=localStorage.getItem(r);t&&(e[n]=t)}}}}catch(e){console.warn("[import-maps] Failed to read import-map overrides from localStorage",e)}return{imports:e}}async function oV(){let e=await oM();return oA?oF([e,oI??oB()]):e}async function oU(){return oM()}async function oW(){return oA?oF([await oM(),oB()]):oM()}function oH(e){if(!oA)return{imports:{}};if(e){let e={};for(let t=0;t<localStorage.length;t++){let n=localStorage.key(t);if(n?.startsWith(o$)){let t=localStorage.getItem(n);t&&(e[n.slice(o$.length)]=t)}}return{imports:e}}return oB()}function oz(){if(!oA)return[];try{let e=localStorage.getItem(oO);if(e){let t=JSON.parse(e);if(Array.isArray(t))return t}}catch{}return[]}function oK(e){return!!oA&&oz().includes(e)}function oG(e,t){if(!oA)return void console.warn("[Security] Import map overrides are disabled in production mode.");try{localStorage.setItem(o$+e,t),window.dispatchEvent(new CustomEvent(oN))}catch(e){console.warn("[import-maps] Failed to write import-map override to localStorage",e)}}function oZ(e){if(!oA)return void console.warn("[Security] Import map overrides are disabled in production mode.");try{localStorage.removeItem(o$+e);let t=oz().filter(t=>t!==e);t.length>0?localStorage.setItem(oO,JSON.stringify(t)):localStorage.removeItem(oO),window.dispatchEvent(new CustomEvent(oN))}catch(e){console.warn("[import-maps] Failed to update import-map overrides in localStorage",e)}}function oY(){if(!oA)return void console.warn("[Security] Import map overrides are disabled in production mode.");try{let e=[];for(let t=0;t<localStorage.length;t++){let n=localStorage.key(t);n?.startsWith(o$)&&e.push(n)}e.forEach(e=>localStorage.removeItem(e)),localStorage.removeItem(oO),window.dispatchEvent(new CustomEvent(oN))}catch(e){console.warn("[import-maps] Failed to clear import-map overrides from localStorage",e)}}function oq(e){if(!oA)return void console.warn("[Security] Import map overrides are disabled in production mode.");try{let t=oz().filter(t=>t!==e);t.length>0?localStorage.setItem(oO,JSON.stringify(t)):localStorage.removeItem(oO),window.dispatchEvent(new CustomEvent(oN))}catch(e){console.warn("[import-maps] Failed to update import-map overrides in localStorage",e)}}let oJ=!1;function oX(){!oJ&&(oJ=!0,(oA="development"===window.spaEnv)&&(oI=oB()))}function oQ(e){return e.replace(/[\/\-@]/g,"_")}async function o0(e,t="./start",r){var a;let o,i=!r?.maxLoadingTime||r.maxLoadingTime<=0?6e5:r.maxLoadingTime;await Promise.race([o1(e,r?.importMap),new Promise((t,n)=>{o=setTimeout(()=>{var t;n(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=oQ(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(n.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 o1(e,t){if("string"!=typeof e||0===e.trim().length){let e="Attempted to call importDynamic() without supplying a package to load";throw console.error(e),Error(e)}let n=oQ(e);if(!window[n]){let n=t??await o4();if(!n.imports.hasOwnProperty(e)){let t=`Could not find the package ${e} defined in the current importmap`;throw console.error(t),Error(t)}let r=n.imports[e];r.startsWith("./")&&(r=window.spaBase+r.substring(1));let a=e in oH().imports;try{return await function(e){var t;let n=(t=window)[o2]??(t[o2]=new Map),r=n.get(e);if(r)return r;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,r)=>{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(),n.delete(e),a.remove();let o=`Failed to load script from ${e}`;console.error(o,t),r(t.message??o)}a.addEventListener("load",s),a.addEventListener("error",l),document.head.appendChild(a)});return n.set(e,o),o}(r)}catch(e){return a&&w({kind:"error",title:a3("scriptLoadingFailed","Error: Script failed to load"),description:a3("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:r}),actionButtonLabel:a3("resetOverrides","Reset overrides"),onActionButtonClick(){oY(),window.location.reload()}}),Promise.reject(e)}}return Promise.resolve()}async function o4(){return oV()}let o2=Symbol.for("__openmrs_script_loading");function o3(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,"workspaces")&&(!e.workspaces||!Array.isArray(e.workspaces))||Object.hasOwn(e,"modals")&&(!e.modals||!Array.isArray(e.modals)))}function o6(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&&o3(t))}let o5="openmrs-routes:",o9="openmrs-routes:change",o8=!1,o7=null,ie=null;async function it(){return ie??(ie=ir().then(({map:e,complete:t})=>(t||(ie=null),e))),ie}async function ir(){let e=document.querySelectorAll("script[type='openmrs-routes']"),t=[],n=!0;for(let r=0;r<e.length;r++){let a=e[r];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&&o6(e)&&t.push(e)}catch(e){n=!1,console.warn(`[route-maps] Failed to parse routes from script tag at index ${r}`,e)}}return{map:ia(t),complete:n}}function ia(e){let t={routes:{}};for(let n of e)n&&"object"==typeof n&&!Array.isArray(n)&&(Object.assign(t.routes,n.routes),void 0===t.version&&void 0!==n.version&&(t.version=n.version));return t}async function io(){let e={version:void 0,routes:{}};try{let t=[];for(let e=0;e<localStorage.length;e++){let n=localStorage.key(e);if(n?.startsWith(o5)){let e=localStorage.getItem(n);e&&t.push({moduleName:n.slice(o5.length),raw:e})}}for(let n of(await Promise.allSettled(t.map(async({moduleName:e,raw:t})=>{let n=JSON.parse(t);if(o3(n))return{moduleName:e,routes:n};if("string"==typeof n&&n.startsWith("http")){let t=await fetch(n),r=await t.json();if(o3(r))return{moduleName:e,routes:r};throw Error(`${n} did not resolve to a valid OpenmrsAppRoutes object`)}throw Error(`Override for ${e} is neither a valid routes object nor a URL`)}))))"fulfilled"===n.status?e.routes[n.value.moduleName]=n.value.routes:console.warn("[route-maps] Failed to load route override",n.reason)}catch(e){console.warn("[route-maps] Failed to read route overrides from localStorage",e)}return e}async function ii(){let e=await it();return o8?ia([e,o7??await io()]):e}async function is(){return it()}async function il(){return o8?ia([await it(),await io()]):it()}function iu(){if(!o8)return{};let e={};try{for(let t=0;t<localStorage.length;t++){let n=localStorage.key(t);if(n?.startsWith(o5)){let t=localStorage.getItem(n);t&&(e[n.slice(o5.length)]=t)}}}catch(e){console.warn("[route-maps] Failed to read route overrides from localStorage",e)}return e}function ic(e,t){if(!o8)return void console.warn("[Security] Route overrides are disabled outside development mode.");try{if("string"==typeof t)if(t.startsWith("http"))localStorage.setItem(o5+e,JSON.stringify(t));else{let n=JSON.parse(t);if(!o3(n))return void console.error(`The supplied routes for ${e} is not a valid OpenmrsAppRoutes object`,t);localStorage.setItem(o5+e,JSON.stringify(n))}else if(t instanceof URL)localStorage.setItem(o5+e,JSON.stringify(t.toString()));else{if(!o3(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(o5+e,JSON.stringify(t))}window.dispatchEvent(new CustomEvent(o9))}catch(e){console.warn("[route-maps] Failed to write route override to localStorage",e)}}function id(e){if(!o8)return void console.warn("[Security] Route overrides are disabled outside development mode.");try{localStorage.removeItem(o5+e),window.dispatchEvent(new CustomEvent(o9))}catch(e){console.warn("[route-maps] Failed to remove route override from localStorage",e)}}function im(){if(!o8)return void console.warn("[Security] Route overrides are disabled outside development mode.");try{let e=[];for(let t=0;t<localStorage.length;t++){let n=localStorage.key(t);n?.startsWith(o5)&&e.push(n)}e.forEach(e=>localStorage.removeItem(e)),window.dispatchEvent(new CustomEvent(o9))}catch(e){console.warn("[route-maps] Failed to clear route overrides from localStorage",e)}}let ip=null;function ih(){return ip||(ip=(o8="development"===window.spaEnv)?io().then(e=>{o7=e}):Promise.resolve())}let ig=`${os}/attachment`;function iy(e,t){return od(`${ig}/${e}`,{signal:t.signal})}function iv(e,t,n,r){return od(ib(e,t,r),{signal:n.signal})}function ib(e,t,n){return n?`${ig}?patient=${e}&encounter=${n}`:`${ig}?patient=${e}&includeEncounterless=${t}`}async function iw(e,t,n){let r=new FormData;return r.append("fileCaption",t.fileDescription),r.append("patient",e),n&&r.append("encounter",n),t.file?r.append("file",t.file,t.fileName):(r.append("file",new File([""],t.fileName),t.fileName),r.append("base64Content",t.base64Content)),od(`${ig}`,{method:"POST",body:r})}function iE(e,t){return od(`${ig}/${e}`,{method:"DELETE",signal:t.signal})}async function ix(e,t){return e?(await od(`${ol}/Patient/${e}`,t)).data:null}function iD(e,t){let n=new CustomEvent(`openmrs:${e}`,{detail:t??void 0,cancelable:!0,bubbles:!0});return window.dispatchEvent(n)}function i_(e,t){let n=e=>{t("detail"in e&&null!==e.detail?e.detail:void 0)};return window.addEventListener(`openmrs:${e}`,n),()=>{window.removeEventListener(`openmrs:${e}`,n)}}function ik(e){return{uuid:e.uuid,display:e.display}}function iS(e=null,t=null){let n=new URLSearchParams;e&&n.set("tag",e),t&&n.set("q",t);let r=n.toString();return od(`${os}/location${r?"?"+r:""}`).then(e=>e.data.results.map(ik))}function iC(e){return{uuid:e.uuid,display:e.display,name:e.name}}let iP=`${os}/visittype`;function iR(e=iP){return od(e).then(e=>e.data.results.map(iC))}var iT=((Y={}).NEWVISIT="startVisit",Y.EDITVISIT="editVisit",Y.LOADING="loadingVisit",Y),i$=((q={}).NOTSTARTED="notStarted",q.ONGOING="ongoing",q);let iO="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))",iN=function(){try{return JSON.parse(sessionStorage.getItem("openmrs:visitStoreState")||"null")}catch(e){return null}}()||{patientUuid:null,manuallySetVisitUuid:null};function iA(){return V("visit",iN)}function iI(e,t){iA().setState({patientUuid:e,manuallySetVisitUuid:t})}function ij(e,t){return od(`${os}/visit`,{signal:t.signal,method:"POST",headers:{"Content-type":"application/json"},body:e})}function iM(e,t,n){return od(`${os}/visit/${e}`,{signal:n.signal,method:"POST",headers:{"Content-type":"application/json"},body:t})}function iL(e,t,n){return od(`${os}/visit?patient=${e}&v=${n??iO}`,{signal:t.signal,method:"GET",headers:{"Content-type":"application/json"}})}iA().subscribe(e=>{var t;t=e,sessionStorage.setItem("openmrs:visitStoreState",JSON.stringify(t))});class iF{static get version(){return"1.4.0"}static toString(){return"JavaScript Expression Parser (JSEP) v"+iF.version}static addUnaryOp(e){return iF.max_unop_len=Math.max(e.length,iF.max_unop_len),iF.unary_ops[e]=1,iF}static addBinaryOp(e,t,n){return iF.max_binop_len=Math.max(e.length,iF.max_binop_len),iF.binary_ops[e]=t,n?iF.right_associative.add(e):iF.right_associative.delete(e),iF}static addIdentifierChar(e){return iF.additional_identifier_chars.add(e),iF}static addLiteral(e,t){return iF.literals[e]=t,iF}static removeUnaryOp(e){return delete iF.unary_ops[e],e.length===iF.max_unop_len&&(iF.max_unop_len=iF.getMaxKeyLen(iF.unary_ops)),iF}static removeAllUnaryOps(){return iF.unary_ops={},iF.max_unop_len=0,iF}static removeIdentifierChar(e){return iF.additional_identifier_chars.delete(e),iF}static removeBinaryOp(e){return delete iF.binary_ops[e],e.length===iF.max_binop_len&&(iF.max_binop_len=iF.getMaxKeyLen(iF.binary_ops)),iF.right_associative.delete(e),iF}static removeAllBinaryOps(){return iF.binary_ops={},iF.max_binop_len=0,iF}static removeLiteral(e){return delete iF.literals[e],iF}static removeAllLiterals(){return iF.literals={},iF}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 iF(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 iF.binary_ops[e]||0}static isIdentifierStart(e){return e>=65&&e<=90||e>=97&&e<=122||e>=128&&!iF.binary_ops[String.fromCharCode(e)]||iF.additional_identifier_chars.has(String.fromCharCode(e))}static isIdentifierPart(e){return iF.isIdentifierStart(e)||iF.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(iF.hooks[e]){let n={context:this,node:t};return iF.hooks.run(e,n),n.node}return t}searchHook(e){if(iF.hooks[e]){let t={context:this};return iF.hooks[e].find(function(e){return e.call(t.context,t),t.node}),t.node}}gobbleSpaces(){let e=this.code;for(;e===iF.SPACE_CODE||e===iF.TAB_CODE||e===iF.LF_CODE||e===iF.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:iF.COMPOUND,body:e};return this.runHook("after-all",t)}gobbleExpressions(e){let t=[],n,r;for(;this.index<this.expr.length;)if((n=this.code)===iF.SEMCOL_CODE||n===iF.COMMA_CODE)this.index++;else if(r=this.gobbleExpression())t.push(r);else if(this.index<this.expr.length){if(n===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,iF.max_binop_len),t=e.length;for(;t>0;){if(iF.binary_ops.hasOwnProperty(e)&&(!iF.isIdentifierStart(this.code)||this.index+e.length<this.expr.length&&!iF.isIdentifierPart(this.expr.charCodeAt(this.index+e.length))))return this.index+=t,e;e=e.substr(0,--t)}return!1}gobbleBinaryExpression(){let e,t,n,r,a,o,i,s,l;if(!(o=this.gobbleToken())||!(t=this.gobbleBinaryOp()))return o;for(a={value:t,prec:iF.binaryPrecedence(t),right_a:iF.right_associative.has(t)},(i=this.gobbleToken())||this.throwError("Expected expression after "+t),r=[o,a,i];t=this.gobbleBinaryOp();){if(0===(n=iF.binaryPrecedence(t))){this.index-=t.length;break}a={value:t,prec:n,right_a:iF.right_associative.has(t)},l=t;let s=e=>a.right_a&&e.right_a?n>e.prec:n<=e.prec;for(;r.length>2&&s(r[r.length-2]);)i=r.pop(),t=r.pop().value,o=r.pop(),e={type:iF.BINARY_EXP,operator:t,left:o,right:i},r.push(e);(e=this.gobbleToken())||this.throwError("Expected expression after "+l),r.push(a,e)}for(s=r.length-1,e=r[s];s>1;)e={type:iF.BINARY_EXP,operator:r[s-1].value,left:r[s-2],right:e},s-=2;return e}gobbleToken(){let e,t,n,r;if(this.gobbleSpaces(),r=this.searchHook("gobble-token"))return this.runHook("after-token",r);if(e=this.code,iF.isDecimalDigit(e)||e===iF.PERIOD_CODE)return this.gobbleNumericLiteral();if(e===iF.SQUOTE_CODE||e===iF.DQUOTE_CODE)r=this.gobbleStringLiteral();else if(e===iF.OBRACK_CODE)r=this.gobbleArray();else{for(n=(t=this.expr.substr(this.index,iF.max_unop_len)).length;n>0;){if(iF.unary_ops.hasOwnProperty(t)&&(!iF.isIdentifierStart(this.code)||this.index+t.length<this.expr.length&&!iF.isIdentifierPart(this.expr.charCodeAt(this.index+t.length)))){this.index+=n;let e=this.gobbleToken();return e||this.throwError("missing unaryOp argument"),this.runHook("after-token",{type:iF.UNARY_EXP,operator:t,argument:e,prefix:!0})}t=t.substr(0,--n)}iF.isIdentifierStart(e)?(r=this.gobbleIdentifier(),iF.literals.hasOwnProperty(r.name)?r={type:iF.LITERAL,value:iF.literals[r.name],raw:r.name}:r.name===iF.this_str&&(r={type:iF.THIS_EXP})):e===iF.OPAREN_CODE&&(r=this.gobbleGroup())}return r?(r=this.gobbleTokenProperty(r),this.runHook("after-token",r)):this.runHook("after-token",!1)}gobbleTokenProperty(e){this.gobbleSpaces();let t=this.code;for(;t===iF.PERIOD_CODE||t===iF.OBRACK_CODE||t===iF.OPAREN_CODE||t===iF.QUMARK_CODE;){let n;if(t===iF.QUMARK_CODE){if(this.expr.charCodeAt(this.index+1)!==iF.PERIOD_CODE)break;n=!0,this.index+=2,this.gobbleSpaces(),t=this.code}this.index++,t===iF.OBRACK_CODE?((e={type:iF.MEMBER_EXP,computed:!0,object:e,property:this.gobbleExpression()}).property||this.throwError('Unexpected "'+this.char+'"'),this.gobbleSpaces(),(t=this.code)!==iF.CBRACK_CODE&&this.throwError("Unclosed ["),this.index++):t===iF.OPAREN_CODE?e={type:iF.CALL_EXP,arguments:this.gobbleArguments(iF.CPAREN_CODE),callee:e}:(t===iF.PERIOD_CODE||n)&&(n&&this.index--,this.gobbleSpaces(),e={type:iF.MEMBER_EXP,computed:!1,object:e,property:this.gobbleIdentifier()}),n&&(e.optional=!0),this.gobbleSpaces(),t=this.code}return e}gobbleNumericLiteral(){let e="",t,n;for(;iF.isDecimalDigit(this.code);)e+=this.expr.charAt(this.index++);if(this.code===iF.PERIOD_CODE)for(e+=this.expr.charAt(this.index++);iF.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++));iF.isDecimalDigit(this.code);)e+=this.expr.charAt(this.index++);iF.isDecimalDigit(this.expr.charCodeAt(this.index-1))||this.throwError("Expected exponent ("+e+this.char+")")}return n=this.code,iF.isIdentifierStart(n)?this.throwError("Variable names cannot start with a number ("+e+this.char+")"):(n===iF.PERIOD_CODE||1===e.length&&e.charCodeAt(0)===iF.PERIOD_CODE)&&this.throwError("Unexpected period"),{type:iF.LITERAL,value:parseFloat(e),raw:e}}gobbleStringLiteral(){let e="",t=this.index,n=this.expr.charAt(this.index++),r=!1;for(;this.index<this.expr.length;){let t=this.expr.charAt(this.index++);if(t===n){r=!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 r||this.throwError('Unclosed quote after "'+e+'"'),{type:iF.LITERAL,value:e,raw:this.expr.substring(t,this.index)}}gobbleIdentifier(){let e=this.code,t=this.index;for(iF.isIdentifierStart(e)?this.index++:this.throwError("Unexpected "+this.char);this.index<this.expr.length;)if(e=this.code,iF.isIdentifierPart(e))this.index++;else break;return{type:iF.IDENTIFIER,name:this.expr.slice(t,this.index)}}gobbleArguments(e){let t=[],n=!1,r=0;for(;this.index<this.expr.length;){this.gobbleSpaces();let a=this.code;if(a===e){n=!0,this.index++,e===iF.CPAREN_CODE&&r&&r>=t.length&&this.throwError("Unexpected token "+String.fromCharCode(e));break}if(a===iF.COMMA_CODE){if(this.index++,++r!==t.length){if(e===iF.CPAREN_CODE)this.throwError("Unexpected token ,");else if(e===iF.CBRACK_CODE)for(let e=t.length;e<r;e++)t.push(null)}}else if(t.length!==r&&0!==r)this.throwError("Expected comma");else{let e=this.gobbleExpression();e&&e.type!==iF.COMPOUND||this.throwError("Expected comma"),t.push(e)}}return n||this.throwError("Expected "+String.fromCharCode(e)),t}gobbleGroup(){this.index++;let e=this.gobbleExpressions(iF.CPAREN_CODE);if(this.code===iF.CPAREN_CODE)return(this.index++,1===e.length)?e[0]:!!e.length&&{type:iF.SEQUENCE_EXP,expressions:e};this.throwError("Unclosed (")}gobbleArray(){return this.index++,{type:iF.ARRAY_EXP,elements:this.gobbleArguments(iF.CBRACK_CODE)}}}Object.assign(iF,{hooks:new class{add(e,t,n){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][n?"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)})}}(iF),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"}),iF.max_unop_len=iF.getMaxKeyLen(iF.unary_ops),iF.max_binop_len=iF.getMaxKeyLen(iF.binary_ops);let iB=e=>new iF(e).parse(),iV=Object.getOwnPropertyNames(class{});Object.getOwnPropertyNames(iF).filter(e=>!iV.includes(e)&&void 0===iB[e]).forEach(e=>{iB[e]=iF[e]}),iB.Jsep=iF,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 n=t.node,r=this.gobbleExpression();if(r||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:n,consequent:r,alternate:a},n.operator&&e.binary_ops[n.operator]<=.9){let r=n;for(;r.right.operator&&e.binary_ops[r.right.operator]<=.9;)r=r.right;t.node.test=r.right,r.right=t.node,t.node=n}}else this.throwError("Expected :")}})}});let iU="ArrowFunctionExpression",iW={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)}},iH={...iW,Promise};function iz(e,t={}){return iJ(e,t,i0)}async function iK(e,t={}){return iX(e,t,i0)}function iG(e,t={}){return iJ(e,t,i1)}function iZ(e,t={}){return iX(e,t,i1)}function iY(e,t={}){return iJ(e,t,i4)}function iq(e,t={}){return iX(e,t,i4)}function iJ(e,t={},n){if("string"!=typeof e&&("object"!=typeof e||!e||!("type"in e)))throw`Unknown expression type ${e}. Expressions must either be a string or pre-compiled string.`;if("string"==typeof e&&0===e.trim().length)throw{type:"Empty expression",message:"Expression cannot be an empty string"};null==t&&(t={});let r=i9(t,iW),a=i2("string"==typeof e?iB(e):e,r);if(n(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 iX(e,t={},n){if("string"!=typeof e&&("object"!=typeof e||!e||!("type"in e)))return Promise.reject(`Unknown expression type ${e}. Expressions must either be a string or pre-compiled string.`);if("string"==typeof e&&0===e.trim().length)throw{type:"Empty expression",message:"Expression cannot be an empty string"};null==t&&(t={});let r=i9(t,iH);return Promise.resolve(i2("string"==typeof e?iB(e):e,r)).then(t=>{if(n(t))return t;throw{type:"Invalid result",message:"string"==typeof e?`The expression ${e} did not produce a valid result`:"The expression did not produce a valid result"}})}function iQ(e){return iB(e)}function i0(e){return"string"==typeof e||"number"==typeof e||"boolean"==typeof e||null==e||e instanceof Date}function i1(e){return"boolean"==typeof e}function i4(e){return"number"==typeof e}function i2(e,t){switch(e.type){case"UnaryExpression":var n,r,a,o,i,s,l,u,c,d,m,p,f,h=e,g=t;let y=i2(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 i2(v.left,b)&&i2(v.right,b);case"||":return i2(v.left,b)||i2(v.right,b);case"??":return i2(v.left,b)??i2(v.right,b)}let w=i2(v.left,b),E=i2(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 n=e,r=t,i2(n.test,r)?i2(n.consequent,r):i2(n.alternate,r);case"CallExpression":return se(i6(e,t));case"ArrowFunctionExpression":let x;return a=e,o=t,x=a.params?.map(e=>{if("Identifier"===e.type)return e.name;throw`Cannot handle parameter of type ${e.type}`})??[],(function(...e){if(e.length<x.length)throw`Required argument(s) ${x.slice(e.length,-1).join(", ")} were not provided`;let t=Object.fromEntries(x.reduce((t,n,r)=>{let a=e[r];return function e(t){if("string"==typeof t||"number"==typeof t||"boolean"==typeof t||"function"==typeof t||null===t||t instanceof RegExp)return!0;if("object"==typeof t){for(let n of Object.keys(t))if(!e(t[n]))return!1;return!0}if(Array.isArray(t)){for(let n of t)if(!e(n))break}return!1}(a)&&t.push([n,a]),t},[]));return i2(a.body,o.addVariables(t))}).bind(null);case"MemberExpression":return se(i5(e,t));case"ArrayExpression":return i=e,s=t,i.elements?.map(st(s));case"SequenceExpression":let D;return l=e,u=t,(D=l.expressions.map(st(u)))[D.length-1];case"NewExpression":var _=e,k=t;if(_.callee&&"Identifier"===_.callee.type){let e=_.arguments?.map(st(k));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,(sn(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 S,C;return m=e,p=t,S=m.expressions?.map(st(p))??[],(C=m.quasis?.map(st(p))??[]).filter(e=>!e.tail).map(e=>e.value).join("")+S.join("")+C.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 i3(e,t){switch(e.type){case"Literal":return e.value;case"Identifier":return e.name;case"MemberExpression":return i3(e.property,t);default:throw`VisitExpressionName does not support expression of type '${e.type}'`}}function i6(e,t){let n=i7(e.callee,t);if(n===i8||e.optional&&null==n)return i8;let r=e.arguments?.map(st(t));if(n){if("function"!=typeof n)throw`${so(e.callee)} is not a function`}else throw`No function named ${so(e.callee)} is defined in this context`;return n(...r)}function i5(e,t){let n=i7(e.object,t);if(n===i8||e.optional&&null==n)return i8;if(null===n)throw TypeError(`TypeError: cannot read properties of null (reading '${sa(e.property,t)}')`);if(void 0===n)switch(e.object.type){case"Identifier":{let n=i3(e.object,t);throw ReferenceError(`ReferenceError: ${n} is not defined`)}case"MemberExpression":throw TypeError(`TypeError: cannot read properties of undefined (reading '${sa(e.property,t)}')`);default:throw`VisitMemberExpression does not support operator '${e.object.type}' type`}if("object"!=typeof n&&"function"!=typeof n&&"string"!=typeof n&&"number"!=typeof n)throw`VisitMemberExpression does not support member access on type ${typeof n}`;let r=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}(i2(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);sn(r),function(e,t){if(sr.has(String(t)))return;let n=Object(e);for(;null!==n;){if(Object.hasOwn(n,t)){if(n===Object.prototype||n===Function.prototype)throw{type:"Illegal property access",message:`Cannot access the ${t} property of objects`};return}n=Object.getPrototypeOf(n)}}(n,r);let a=n[r];return"function"==typeof a?a.bind(n):a}function i9(e,t){let n={variables:{...e},globals:{...t},addVariables(e){return this.variables={...this.variables,...e},this}};return n.addVariables.bind(n),n}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 n=this.index;if(this.index++,this.gobbleSpaces(),this.code===e.CPAREN_CODE){this.index++;let e=this.gobbleBinaryOp();if("=>"===e){let n=this.gobbleBinaryExpression();n||this.throwError("Expected expression after "+e),t.node={type:iU,params:null,body:n};return}}this.index=n}}),e.hooks.add("after-expression",function(t){!function t(n){n&&(Object.values(n).forEach(e=>{e&&"object"==typeof e&&t(e)}),"=>"===n.operator&&(n.type=iU,n.params=n.left?[n.left]:null,n.body=n.right,n.params&&n.params[0].type===e.SEQUENCE_EXP&&(n.params=n.params[0].expressions),delete n.left,delete n.right,delete n.operator))}(t.node)})}}),iB.plugins.register({name:"new",init(e){e.addUnaryOp("new"),e.hooks.add("after-token",function(t){let n=t.node;if(n&&"new"===n.operator){n.argument&&[e.CALL_EXP,e.MEMBER_EXP].includes(n.argument.type)||this.throwError("Expected new function()"),t.node=n.argument;let r=t.node;for(;r.type===e.MEMBER_EXP||r.type===e.CALL_EXP&&r.callee.type===e.MEMBER_EXP;)r=r.type===e.MEMBER_EXP?r.object:r.callee.object;r.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 n(t){let n=this.index,r="",a=()=>{for(;e.isDecimalDigit(this.code)||95===this.code;)95===this.code?this.index++:r+=this.expr.charAt(this.index++)};a(),this.code===e.PERIOD_CODE&&(r+=this.expr.charAt(this.index++),a());let o=this.char;("e"===o||"E"===o)&&(r+=this.expr.charAt(this.index++),("+"===(o=this.char)||"-"===o)&&(r+=this.expr.charAt(this.index++)),a(),e.isDecimalDigit(this.expr.charCodeAt(this.index-1))||this.throwError("Expected exponent ("+r+this.char+")"));let i=this.code;if(e.isIdentifierStart(i))this.throwError("Variable names cannot start with a number ("+r+this.char+")");else if(i===e.PERIOD_CODE){r.length>1&&this.throwError(`Unexpected period ${JSON.stringify({chCode:i,number:r},null,2)}`),this.index=n;return}t.node={type:e.LITERAL,value:parseFloat(r),raw:this.expr.substring(n,this.index)}}e.hooks.add("gobble-token",function(r){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,n.call(this,r);return}this.throwError("unexpected char within number")}r.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)&&n.call(this,r)})}}),iB.plugins.register({name:"regex",init(e){e.hooks.add("gobble-token",function(t){if(47===this.code){let n=++this.index,r=!1;for(;this.index<this.expr.length;){if(47===this.code&&!r){let r,a=this.expr.slice(n,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{r=new RegExp(a,o)}catch(e){this.throwError(e.message)}return t.node={type:e.LITERAL,value:r,raw:this.expr.slice(n-1,this.index)},t.node=this.gobbleTokenProperty(t.node),t.node}this.code===e.OBRACK_CODE?r=!0:r&&this.code===e.CBRACK_CODE&&(r=!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 n=t.node,r=this.gobbleExpression();if(r||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:n,consequent:r,alternate:a},n.operator&&e.binary_ops[n.operator]<=.9){let r=n;for(;r.right.operator&&e.binary_ops[r.right.operator]<=.9;)r=r.right;t.node.test=r.right,r.right=t.node,t.node=n}}else this.throwError("Expected :")}})}}),iB.plugins.register({name:"jsepTemplateLiteral",init(e){function t(e,n=!0){if(96===this.code){let t={type:"TemplateLiteral",quasis:[],expressions:[]},r="",a="",o=!1,i=this.expr.length,s=()=>t.quasis.push({type:"TemplateElement",value:{raw:a,cooked:r},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,n&&(e.node=this.gobbleTokenProperty(e.node)),e.node;if("$"===i&&"{"===this.expr.charAt(this.index+1))this.index+=2,s(),a="",r="",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":r+="\n";break;case"r":r+="\r";break;case"t":r+=" ";break;case"b":r+="\b";break;case"f":r+="\f";break;case"v":r+="\v";break;default:r+=i}else r+=i,a+=i}this.throwError("Unclosed `")}}e.hooks.add("gobble-token",t),e.hooks.add("after-token",function(n){if((n.node.type===e.IDENTIFIER||n.node.type===e.MEMBER_EXP)&&96===this.code)return n.node={type:"TaggedTemplateExpression",tag:n.node,quasi:t.bind(this)(n,!1)},n.node=this.gobbleTokenProperty(n.node),n.node})}}),iB.addBinaryOp("in",7),iB.addBinaryOp("??",1);let i8=Symbol("optional chain short-circuited");function i7(e,t){switch(e.type){case"MemberExpression":return i5(e,t);case"CallExpression":return i6(e,t);default:return i2(e,t)}}function se(e){return e===i8?void 0:e}function st(e){return function(t){return null===t?null:i2(t,e)}}function sn(e){if("__proto__"===e||"prototype"===e||"constructor"===e)throw{type:"Illegal property access",message:`Cannot access the ${e} property of objects`}}let sr=new Set(["toString","valueOf","hasOwnProperty"]);function sa(e,t){try{return i3(e,t)}catch{return"<computed>"}}function so(e){return e?"MemberExpression"===e.type?e.property?.name:e.name:null}function si(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:{...iH},isLocalExpression:!1,variables:new Set};return ss("string"==typeof e?iB(e):e,t),[...t.variables]}function ss(e,t){switch(e.type){case"UnaryExpression":return r=e,a=t,ss(r.argument,a);case"BinaryExpression":return o=e,i=t,[ss(o.left,i),ss(o.right,i)].filter(Boolean);case"ConditionalExpression":return s=e,l=t,[ss(s.consequent,l),ss(s.test,l),ss(s.alternate,l)].filter(Boolean);case"CallExpression":let n;return u=e,c=t,n=ss(u.callee,c),u.arguments?.map(sl(c)),n;case"ArrowFunctionExpression":var r,a,o,i,s,l,u,c,d,m,p,f,h,g,y,v,b=e,w=t;let E={...w};E.isLocalExpression=!0;let x=b.params?.map(sl(E))??[],D=ss(b.body,E)??[];if(D&&Array.isArray(D))for(let e of D)x.includes(e)||w.variables.add(e);return;case"MemberExpression":var _=e,k=t;if(ss(_.object,k),_.computed)return void ss(_.property,k);let S={...k};S.isLocalExpression=!0,ss(_.property,S);return;case"ArrayExpression":return d=e,m=t,void d.elements?.map(sl(m));case"SequenceExpression":return p=e,f=t,void p.expressions?.map(sl(f));case"NewExpression":return h=e,g=t,void h.arguments?.map(sl(g));case"Literal":case"TemplateElement":return;case"Identifier":var C=e,P=t;if(!(C.name in P.globals))if(P.isLocalExpression)return C.name;else P.variables.add(C.name);return;case"TemplateLiteral":return y=e,v=t,void(y.expressions?.map(sl(v)),y.quasis?.map(sl(v)));default:throw`Expression evaluator does not support expression of type '${e.type}'`}}function sl(e){return function(t){return null===t?null:ss(t,e)}}let su=V("feature-flags",{flags:function(){let e={};for(let t of Object.keys(localStorage))if(t.startsWith("openmrs:feature-flag:")){let n=t.replace("openmrs:feature-flag:",""),r=JSON.parse(localStorage.getItem(`openmrs:feature-flag-meta:${n}`)||"{}");e[n]={enabled:"true"===localStorage.getItem(t),...r}}return e}()});function sc(e,t,n){su.setState(r=>({flags:{...r.flags,[e]:{enabled:r.flags[e]?.enabled??!1,label:t,description:n}}}))}function sd(){let e=su.getState().flags;Object.keys(localStorage).filter(e=>e.startsWith("openmrs:feature-flag:")).forEach(t=>{let n=t.replace("openmrs:feature-flag:","");e[n]||(localStorage.removeItem(t),localStorage.removeItem(`openmrs:feature-flag-meta:${n}`))})}function sm(e){return su.getState().flags[e].enabled}function sp(e,t){su.subscribe(n=>{t(n.flags[e].enabled)})}function sf(e,t){su.setState(n=>({flags:{...n.flags,[e]:{...n.flags[e],enabled:t}}}))}su.subscribe(e=>{for(let[t,n]of Object.entries(e.flags))localStorage.setItem(`openmrs:feature-flag:${t}`,n.enabled.toString()),localStorage.setItem(`openmrs:feature-flag-meta:${t}`,JSON.stringify({label:n.label,description:n.description}))});var sh=e1(function(e,t,n){ez(e,t,n)});let sg=F("extensionsInternal",{slots:{},extensions:{}}),sy=F("extensionRenderings",{renderings:new Map}),sv=()=>V("extensionsInternal",{slots:{},extensions:{}}),sb=()=>V("extensionRenderings",{renderings:new Map});function sw(e){let t=sg.getState(),n=e(t);n!==t&&sg.setState(n)}let sE=null,sx=null;function sD(){let e=sy.getState();return sE&&e===sx||(sE=new Map(e.renderings),sx=e,function(e){for(let t of(sN.clear(),e.values()))sI(t,1);sA=!0}(sE)),sE}function s_(e){sx={renderings:e},sy.setState(sx,!0)}function sk(e){let t=sD();t.has(e.renderingId)||(t.set(e.renderingId,e),sI(e,1),s_(t))}function sS(e){let t=sD(),n=t.get(e);n&&(t.delete(e),sI(n,-1),s_(t))}let sC=()=>V("extensions",{slots:{}}),sP=0,sR=new Set;function sT(e){sP++;try{return e()}finally{if(0==--sP&&sR.size>0){let e=Array.from(sR);for(let t of(sR.clear(),e))s$(t)}}}function s$(e){try{e()}catch(t){console.error(`The extension system's '${e.name}' recomputation failed`,t)}}function sO(e){sP>0?sR.add(e):s$(e)}let sN=new Map,sA=!1;function sI(e,t){let n=JSON.stringify([e.slotName,e.extensionId,e.slotModuleName,e.extensionModuleName]),r=sN.get(n);if(!r){if(t<0)return;sN.set(n,{count:1,record:{slotModuleName:e.slotModuleName,extensionModuleName:e.extensionModuleName,slotName:e.slotName,extensionId:e.extensionId}}),sA=!0;return}r.count+=t,r.count<1&&(sN.delete(n),sA=!0)}function sj(){var e,t;if(sD(),!sA)return;sA=!1;let n=Array.from(sN.values(),({record:e})=>e);n.sort(sM),e=tG.getState().mountedExtensions,t=n,e.length===t.length&&e.every((e,n)=>0===sM(e,t[n]))||tG.setState({mountedExtensions:n})}function sM(e,t){return sL(e.slotName,t.slotName)||sL(e.extensionId,t.extensionId)||sL(e.slotModuleName,t.slotModuleName)||sL(e.extensionModuleName,t.extensionModuleName)}function sL(e,t){return e===t?0:e<t?-1:1}sj(),sy.subscribe(()=>sO(sj));let sF=sv(),sB=sC(),sV=tY(),sU=tX(),sW=new Set,sH=!1;function sz(e){if(null===e)sW=null;else if(null!==sW)for(let t of e)sW.add(t);sO(sK)}function sK(){if(!sH){sH=!0;try{for(let e=1;;e++){let t=sW;if(null!==t&&0===t.size)return;sW=new Set;try{!function(e,t,n,r,a,o=null){let i=sB.getState().slots,s={},l=!1,u=Object.entries(r.flags).filter(([,{enabled:e}])=>e).map(([e])=>e);for(let[r,c]of Object.entries(e.slots)){let d=i[r];if(d&&o&&!o.has(r)){s[r]=d;continue}let{config:m}=tJ(t,c.name),p=function(e,t,n,r,a,o){let i=function(e,t){let n=e.add||[],r=e.remove||[],a=e.order||[],{extensions:o}=sF.getState();return[...t,...n].filter(e=>!r.includes(e)).sort((e,n)=>s4(e,a,o[sY(e)]?.order,t)-s4(n,a,o[sY(n)]?.order,t))}(n,t.slots[e].attachedIds),s=[];for(let l of i){let{config:i}=t0(r,e,l),u=t1(n,e,l),c=u?sh({},i,u):i,d=sY(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||!ox(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}(r,e,m,n,u,a.session);d&&d.moduleName===c.moduleName&&e3(d.candidateExtensions,p)?s[r]=d:(s[r]={moduleName:c.moduleName,candidateExtensions:p},l=!0)}(l||Object.keys(i).length!==Object.keys(s).length)&&sB.setState({slots:s})}(sF.getState(),sV.getState(),sU.getState(),su.getState(),op.getState(),t)}catch(e){throw sW=null===t||null===sW?null:new Set([...t,...sW]),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{sH=!1}}}function sG(e,t){let n=new Set;for(let r of Object.keys(e))e[r]!==t[r]&&n.add(r);for(let r of Object.keys(t))r in e||n.add(r);return n}function sZ(e,t){return{moduleName:t,name:e,attachedIds:[]}}function sY(e){let[t]=e.split("#");return t}function sq(e,t){let n=sY(t);return e.extensions[n]}function sJ(e){return sq(sF.getState(),e)}sF.subscribe((e,t)=>{sz(e.extensions!==t.extensions?null:sG(e.slots,t.slots))}),sV.subscribe((e,t)=>{sz(sG(e.slots,t.slots))}),sU.subscribe((e,t)=>{sz(sG(e.configs,t.configs))}),su.subscribe(()=>sz(null)),op.subscribe(()=>sz(null)),sz(null);let sX=e=>sw(t=>({...t,extensions:{...t.extensions,[e.name]:{...e}}}));function sQ(e,t){sw(n=>{let r=n.slots[e];return r?{...n,slots:{...n.slots,[e]:{...r,attachedIds:[...r.attachedIds,t]}}}:{...n,slots:{...n.slots,[e]:{...sZ(e),attachedIds:[t]}}}})}function s0(e,t){sw(n=>{let r=n.slots[e];return r&&r.attachedIds.includes(t)?{...n,slots:{...n.slots,[e]:{...r,attachedIds:r.attachedIds.filter(e=>e!==t)}}}:n})}function s1(e){sw(t=>{let n=t.slots[e];return n?{...t,slots:{...t.slots,[e]:{...n,attachedIds:[]}}}:t})}function s4(e,t,n,r){let a=t.indexOf(e);if(-1!==a)return a;{if(void 0!==n)return 1e3+n;let t=r.indexOf(e);return -1!==t?2e3+t:3e3}}function s2(e,t){return function(e,t,n=null,r){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:n,...t}:{session:n});try{return!!iG(o,a)}catch(t){return console.error(`Error while evaluating expression '${o}' for ${e.id}`+(r?` in ${r}`:""),t),!1}})}(s3(e),t,op.getState().session,e)}function s3(e){return sB.getState().slots[e]?.candidateExtensions??[]}let s6=(e,t)=>sF.setState(n=>{let r=n.slots[t]?.moduleName;if(r&&r!=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 ${r}.`),n;if(r&&r==e)return n;if(n.slots[t])return{...n,slots:{...n.slots,[t]:{...n.slots[t],moduleName:e}}};let a=sZ(t,e);return{...n,slots:{...n.slots,[t]:{...a}}}}),s5=()=>{sW=null,sw(()=>({slots:{},extensions:{}})),sb().setState({renderings:new Map}),sB.setState({slots:{}})},s9=F("left-nav",{slotName:null,basePath:window.spaBase,mode:"normal"});function s8({name:e,basePath:t,mode:n,componentContext:r,state:a}){s9.setState({slotName:e,basePath:t,mode:n??"normal",componentContext:r,state:a})}function s7(e){s9.getState().slotName===e&&s9.setState(s9.getInitialState(),!0)}let le=F("modalRegistry",{modals:{}});function lt(e){le.setState(t=>(t.modals[e.name]=e,t))}function ln(e){let t=le.getState().modals[e];if(!t){let n=sJ(e);n&&(t={name:e,load:n.load,moduleName:n.moduleName},console.warn(`Modal ${e} was registered as an extension. This is deprecated and will be removed in the future. Please register it in the "modals" section of routes.json instead of the "extensions" section.`),lt(t))}return t}let lr=F("workspaceRegistrations",{workspaces:{}}),la=F("workspaceGroups",{workspaceGroups:{}});function lo(e){lr.setState(t=>({workspaces:{...t.workspaces,[e.name]:{...e,load:e.load,preferredWindowSize:e.preferredWindowSize??"normal",type:e.type??"form",canHide:e.canHide??!1,canMaximize:e.canMaximize??!1,width:e.width??"narrow",groups:e.groups??[]}}}))}function li(e){la.setState(t=>{let n=t.workspaceGroups[e.name];return n?{workspaceGroups:{...t.workspaceGroups,[e.name]:{...n,members:Array.from(new Set([...n.members,...e.members]))}}}:{workspaceGroups:{...t.workspaceGroups,[e.name]:{name:e.name,members:e.members}}}})}let ls=new Set;function ll(e){let t=lr.getState().workspaces;if(t[e])return t[e];{let t=sJ(e);if(t){var n;let r;return ls.has(e)||(console.warn(`The workspace '${e}' is registered as an extension. This is deprecated. Please register it in the "workspaces" section of the routes.json file.`),ls.add(e)),{name:t.name,title:(n=t,"string"==typeof(r=n?.meta?.title)?r:r&&"object"==typeof r?a2(n.moduleName,r.key,r.default):n.name),moduleName:t.moduleName,preferredWindowSize:t.meta?.screenSize??"normal",load:t.load,type:t.meta?.type??"form",canHide:t.meta?.canHide??!1,canMaximize:t.meta?.canMaximize??!1,width:t.meta?.width??"narrow",groups:t.meta?.groups??[]}}throw Error(`No workspace named '${e}' has been registered.`)}}function lu(e){let t=la.getState().workspaceGroups;if(t[e])return t[e];throw Error(`No workspace group named '${e}' has been registered.`)}let lc=F("workspace2",{registeredGroupsByName:{},registeredWindowsByName:{},registeredWorkspacesByName:{},openedGroup:null,openedWindows:[],workspaceTitleByWorkspaceName:{},isMostRecentlyOpenedWindowHidden:!1});function ld(e){let{registeredWorkspacesByName:t,registeredWindowsByName:n}=lc.getState(),r=t[e];if(r){let t=n[r.window];if(t)return t;throw Error(`No workspace window found with name: ${r.window} for workspace: ${e}`)}throw Error(`No workspace found with name: ${e}`)}function lm(e){let{registeredGroupsByName:t,registeredWindowsByName:n}=lc.getState(),r=n[e];if(r){let n=t[r.group];if(n)return n;throw Error(`No workspace group found with name: ${r.group} for window: ${e}`)}throw Error(`No workspace window found with name: ${e}`)}function lp(e){let{openedWindows:t}=lc.getState();return t.findIndex(t=>t.openedWorkspaces.find(t=>t.workspaceName===e))}function lf(e,t){if(0==t.length)return;let{registeredGroupsByName:n}=lc.getState(),r={...n};for(let n of t){if(r[n.name])throw Error(`Cannot register workspace group ${n.name} more than once`);r[n.name]={...n,moduleName:e}}lc.setState({registeredGroupsByName:r})}function lh(e,t){if(0==t.length)return;let{registeredWindowsByName:n}=lc.getState(),r={...n};for(let n of t){if(r[n.name])throw Error(`Cannot register workspace window ${n.name} more than once`);let t={...n,moduleName:e};r[n.name]=t}lc.setState({registeredWindowsByName:r})}function lg(e,t){if(0==t.length)return;let{registeredWorkspacesByName:n}=lc.getState(),r={...n};for(let n of t){if(r[n.name])throw Error(`Cannot register workspace ${n.name} more than once`);let t={...n,moduleName:e};r[n.name]=t}lc.setState({registeredWorkspacesByName:r})}let ly=0,lv=null,lb={bootstrap:15e3,mount:15e3,unmount:15e3};function lw(e,t){if(e.timeouts)return e;let n=e.name??"parcel",r=Object.fromEntries(Object.keys(lb).filter(t=>e[t]).map(r=>{var a,o;let i,s;return[r,(a=e[r],o=lb[r],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 ${r} at array index ${o} for parcel ${n} did not return a promise`))}),Promise.resolve(void 0)),e=>{let a,i=new Promise((e,t)=>{a=setTimeout(()=>t(Error(`Lifecycle function ${r} for parcel ${n} did not settle within ${o}ms`)),o)});return Promise.race([s(e),i]).finally(()=>clearTimeout(a)).then(e=>(t(r,!1),e),e=>{throw t(r,!0),e})})]}));return{...e,...r}}async function lE(e,t){var n,r;let a,o,i,s,l,u=await (lv??(lv=new Promise((e,t)=>{rC({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),rC))),lv),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 r=u((n=d.onSettled,"function"==typeof e?()=>e().then(e=>lw(e,n)):lw(e,n)),c),s=e=>t=>e.call(r,d.retarget(t)).catch(e=>{throw"SKIP_BECAUSE_BROKEN"===r.getStatus()&&d.release(),e}),l=r.update&&s(r.update),Object.defineProperty(r,"update",{configurable:!0,enumerable:!0,get:()=>l,set:e=>{l=e&&s(e)}})}function lx(){return lD}function lD(e,t){let n,r=lE(e,t).then(e=>n=e);return{mount:()=>r.then(e=>e.mount()),unmount:()=>r.then(e=>e.unmount()),update:e=>r.then(t=>t.update?.(e)),getStatus:()=>n?.getStatus()??"LOADING_SOURCE_CODE",get loadPromise(){return r.then(e=>e.loadPromise)},get bootstrapPromise(){return r.then(e=>e.bootstrapPromise)},get mountPromise(){return r.then(e=>e.mountPromise)},get unmountPromise(){return r.then(e=>e.unmountPromise)}}}async function l_(e,t,n,r,a=e=>e,o={}){let i=sY(r),s=sJ(r),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=ly++,f=`${t}/${r}-${p}`;e.dataset.extensionRenderingId=f;let h=e=>{try{sS(f)}catch(t){console.error(e,t)}};try{sk({renderingId:f,extensionName:i,extensionModuleName:d,extensionId:r,slotName:t,slotModuleName:n})}catch(e){throw h(`Recomputing configuration after registering '${r}' failed also failed`),e}try{u=await m()}catch(e){throw h(`Recomputing configuration after '${r}' failed to load also failed`),e}try{l=await lE(a({...u,name:`${t}/${i}-${p}`}),{...o,_meta:c,_extensionContext:{extensionId:r,extensionSlotName:t,extensionSlotModuleName:n,extensionModuleName:d,extensionMeta:c},domElement:e})}catch(e){throw h(`Recomputing configuration after '${r}' failed to mount also failed`),e}l.mountPromise.then(void 0,e=>{console.error(`Extension '${r}' in slot '${t}' failed to mount`,e),h(`Recomputing configuration after '${r}' failed to mount also failed`)}),l.unmountPromise.then(()=>h(`Recomputing configuration after unmounting '${r}' failed`),e=>{console.error(`Extension '${r}' in slot '${t}' failed to unmount`,e),h(`Recomputing configuration after '${r}' failed to unmount also failed`)})}else console.warn(`Tried to render ${r} into ${t} but no DOM element was available.`);return l}var lk=n(695),lS=n.n(lk);let lC=(0,lk.createContext)({moduleName:"",featureName:""});function lP({to:e,templateParams:t,onBeforeNavigate:n,children:r,...a}){return(0,lk.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}`)},[]),lS().createElement("a",{onClick:r=>{0===r.button&&!r.ctrlKey&&!r.shiftKey&&!r.altKey&&!r.metaKey&&(r.preventDefault(),n?.(r),a9({to:e,templateParams:t})),0===r.button&&(r.ctrlKey||r.metaKey)&&n?.(r),0===r.button&&r.shiftKey&&n?.(r),1===r.button&&n?.(r)},href:a6(e,t),...a},r)}let lR=({state:e,children:t,...n})=>{let{extension:r}=(0,lk.useContext)(lC),a=(0,lk.useRef)(null),o=(0,lk.useRef)(Promise.resolve()),i=(0,lk.useRef)(!1),s=(0,lk.useRef)(!1),l=(0,lk.useRef)(e),u=(0,lk.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,lk.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 '${r?.extensionId}' failed to update`,e)}))},[]),d=(0,lk.useCallback)(t=>{t&&!a.current&&!s.current&&r?.extensionSlotName&&r.extensionSlotModuleName&&(s.current=!0,l_(t,r.extensionSlotName,r.extensionSlotModuleName,r.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,lk.useEffect)(()=>(i.current=!1,()=>{i.current=!0,u(a.current)}),[]),(0,lk.useEffect)(()=>{l.current=e,a.current&&c(a.current,e)},[e]),r?lS().createElement("div",{ref:d,"data-extension-id":r?.extensionId,style:{position:"relative"},...n}):null};function lT(e){let t=(0,lk.useRef)(e);return R(t.current,e)||(t.current=e),t.current}function l$(e,t){"function"==typeof t&&(t=t(e));let n={};for(let[r,a]of Object.entries(t)){let t=function(...t){e.setState(e=>a(e,...t))};n[r]=t}return n}let lO=e=>e;function lN(e,t=lO,n){let r=(0,lk.useCallback)(t=>e.subscribe(t),[e]),a=(0,lk.useCallback)(()=>t(e.getState()),[e,t]),o=(0,lk.useSyncExternalStore)(r,a,a),i=(0,lk.useMemo)(()=>n?l$(e,n):null,[e,n]);return(0,lk.useMemo)(()=>i?{...o,...i}:o,[o,i])}function lA(e,t){return lN(e,lO,t)}function lI(e){return function(t){let n=(0,lk.useCallback)(t=>e.subscribe(t),[]),r=(0,lk.useCallback)(()=>e.getState(),[]),a=(0,lk.useSyncExternalStore)(n,r,r),o=(0,lk.useMemo)(()=>t?l$(e,t):null,[t]);return(0,lk.useMemo)(()=>o?{...a,...o}:a,[a,o])}}let lj=[];Object.freeze(lj);let lM={candidateExtensions:lj};Object.freeze(lM);let lL=e=>{let t=(0,lk.useCallback)(t=>t.slots?.[e]??lM,[e]);return lN(sC(),t)},lF=e=>e.session;function lB(e,t){let{candidateExtensions:n}=lL(e),r=lN(op,lF),a=lT(t);return(0,lk.useMemo)(()=>s2(e,a),[e,a,r,n])}function lV(e,t){let{moduleName:n}=(0,lk.useContext)(lC);if(!n)throw Error("ComponentContext has not been provided. This should come from @openmrs/esm-react-utils.");return(0,lk.useEffect)(()=>{s6(n,e)},[n,e]),{extensions:lB(e,t),extensionSlotName:e,extensionSlotModuleName:n}}function lU(e){return e}function lW({name:e,extensionSlotName:t,select:n=lU,children:r,state:a,style:o,...i}){if(r&&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,lk.useRef)(null),{extensions:u,extensionSlotModuleName:c}=lV(s,a),d=(0,lk.useMemo)(()=>n(u),[n,u]),m=(0,lk.useMemo)(()=>{if("function"==typeof r&&!lS().isValidElement(r))return d.map(e=>r(e,a))},[r,d]);return lS().createElement("div",{ref:l,"data-extension-slot-name":s,"data-extension-slot-module-name":c,style:{...o,position:"relative"},...i},s&&d?.map((e,t)=>lS().createElement(lC.Provider,{key:e.id,value:{moduleName:c,featureName:"",extension:{extensionId:e.id,extensionSlotName:s,extensionSlotModuleName:c,extensionMeta:e.meta}}},m?.[t]??("function"!=typeof r?r:null)??lS().createElement(lR,{state:a}))))}var lH=n(5338);function lz(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function lK(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?lz(Object(n),!0).forEach(function(t){var r,a,o;r=e,a=t,o=n[t],a in r?Object.defineProperty(r,a,{value:o,enumerable:!0,configurable:!0,writable:!0}):r[a]=o}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):lz(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function lG(e){return(lG="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 lZ(e){return(lZ="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 lY(e,t){var n;if("function"!=typeof(n=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 n="single-spa-application:".concat(t);return function(){var e=document.getElementById(n);return e||((e=document.createElement("div")).id=n,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(lZ(n)));return function(){var e=n(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(lZ(e)));return e}}var lq=null;try{lq=require("react").createContext()}catch(e){}var lJ={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 lX(e,t){return e.rootComponent?Promise.resolve():e.loadRootComponent(t).then(function(t){e.rootComponent=t})}function lQ(e,t){return new Promise(function(n,r){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=l2(e,t,function(){n(this)}),i=lY(e,t)(),s=function(e){var t=e.reactDom,n=e.renderType,r=e.elementToRender,a=e.domElement,o=t[n];if("function"!=typeof o)throw Error('renderType "'.concat(n,'" did not return a function.'));switch(n){case"createRoot":case"unstable_createRoot":case"createBlockingRoot":case"unstable_createBlockingRoot":var i=o(a);return i.render(r),i;case"hydrateRoot":return o(a,r);default:return o(r,a),null}}({elementToRender:o,domElement:i,reactDom:l4(e),renderType:"function"==typeof(a=e).renderType?a.renderType():a.renderType});e.domElements[t.name]=i,e.renderResults[t.name]=s})}function l0(e,t){return new Promise(function(n){e.unmountResolves[t.name]=n;var r=e.renderResults[t.name];r&&r.unmount?r.unmount():l4(e).unmountComponentAtNode(e.domElements[t.name]),delete e.domElements[t.name],delete e.renderResults[t.name]})}function l1(e,t){return new Promise(function(n){e.updateResolves[t.name]||(e.updateResolves[t.name]=[]),e.updateResolves[t.name].push(n);var r=l2(e,t,null),a=e.renderResults[t.name];if(a&&a.render)a.render(r);else{var o=lY(e,t)();l4(e).render(r,o)}})}function l4(e){return e.ReactDOMClient||e.ReactDOM}function l2(e,t,n){var r=e.React.createElement(e.rootComponent,t),a=lq?e.React.createElement(lq.Provider,{value:t},r):r;return(e.errorBoundary||t.errorBoundary||e.errorBoundaryClass||t.errorBoundaryClass)&&(e.errorBoundaryClass=e.errorBoundaryClass||t.errorBoundaryClass||function(e,t){function n(t){e.React.Component.apply(this,arguments),this.state={caughtError:null,caughtErrorInfo:null},n.displayName="SingleSpaReactErrorBoundary(".concat(t.name,")")}return n.prototype=Object.create(e.React.Component.prototype),n.prototype.render=function(){return this.state.caughtError?(e.errorBoundary||t.errorBoundary)(this.state.caughtError,this.state.caughtErrorInfo,this.props):this.props.children},n.prototype.componentDidCatch=function(e,t){this.setState({caughtError:e,caughtErrorInfo:t})},n}(e,t),a=e.React.createElement(e.errorBoundaryClass,t,a)),a=e.React.createElement(e.SingleSpaRoot,lK(lK({},t),{},{mountFinished:n,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 l3=n(287),l6=n(3),l5=n.n(l6),l9=n(2108);let l8={strictMode:!0,throwErrorsToConsole:!0,disableTranslations:!1},l7=new Map;(0,l9.initCache)(l7);let ue={errorRetryCount:3,fetcher:od,focusThrottleInterval:18e5,revalidateIfStale:!0,revalidateOnFocus:!1,revalidateOnReconnect:!1,refreshInterval:0,shouldRetryOnError:e=>{if(e instanceof om){let t=e.response.status;return!!(t>=500)||401===t||403===t||429===t}return!0},provider:()=>l7};function ut(e){if("object"!=typeof e||"string"!=typeof e.featureName||"string"!=typeof e.moduleName)throw Error("Invalid options");let t=Object.assign({},l8,e),n={...ue,...t.swrConfig};return function(e){var r,a,o,i,s;return o=a=class extends(r=lS().Component){componentDidCatch(e,n){n&&n.componentStack&&(e.extra=Object.assign(e.extra||{},{componentStack:n.componentStack})),t.throwErrorsToConsole&&setTimeout(()=>{throw e}),this.setState({caughtError:e,caughtErrorInfo:n})}render(){if(this.state.caughtError)return lS().createElement("div",null,"An error has occurred. Please try reloading the page.");{let r=lS().createElement(lk.Suspense,{fallback:null},lS().createElement(l6.SWRConfig,{value:n},lS().createElement(lC.Provider,{value:this.state.config},t.disableTranslations?lS().createElement(e,this.props):lS().createElement(l3.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},lS().createElement(e,this.props)))));return t.strictMode&&lS().StrictMode?lS().createElement(lS().StrictMode,null,r):r}}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 un(e,t){return function(e){if("object"!==lG(e))throw Error("single-spa-react requires a configuration object");var t,n=lK(lK({},lJ),e);if(!n.React)throw Error("single-spa-react must be passed opts.React");if(!n.ReactDOM&&!n.ReactDOMClient)throw Error("single-spa-react must be passed opts.ReactDOM or opts.ReactDOMClient");if(n.renderType||(null!=(t=n.ReactDOMClient)&&t.createRoot?n.renderType="createRoot":n.renderType="render"),!n.rootComponent&&!n.loadRootComponent)throw Error("single-spa-react must be passed opts.rootComponent or opts.loadRootComponent");if(n.errorBoundary&&"function"!=typeof n.errorBoundary)throw Error("The errorBoundary opt for single-spa-react must either be omitted or be a function that returns React elements");!lq&&n.React.createContext&&(lq=n.React.createContext()),n.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}(n);var r={bootstrap:lX.bind(null,n),mount:lQ.bind(null,n),unmount:l0.bind(null,n)};return n.parcelCanUpdate&&(r.update=l1.bind(null,n)),r}({React:lS(),ReactDOMClient:lH,rootComponent:ut(t)(e)})}function ur(e,t){return()=>e().then(({default:e})=>un(e,t))}function ua(e,t){return()=>Promise.resolve(un(e,t))}let uo=ur,ui=N()(()=>({}));B("openmrs-app-context",ui);let us={};function ul(e,t=e=>e){let n=ui.getState();return e in n?Object.freeze(Object.assign({},t?t(n[e]):n[e])):null}function uu(e,t){ui.setState(n=>(e in n||(n[e]={}),n[e]=t(n[e]),Object.assign({},n)))}function uc(e){return null===e?null:Object.freeze(Object.assign({},e))}let ud=new Map;function um(e,t){let n=(0,lk.useRef)(t??{}),r=(0,lk.useRef)(t=>uu(e,t)),a=(0,lk.useRef)(Symbol());return(0,lk.useEffect)(()=>{let n=t??{},r=a.current;return null===ul(e)?!function(e,t=us){ui.setState(n=>{if(e in n)throw Error(`Attempted to re-register namespace ${e} in the app context. Each namespace must be unregistered before the name can be registered again.`);return Object.assign({},n,{[e]:t===us?{}:t})})}(e,n):(console.warn(`Namespace ${e} is already registered in the app context. This is likely a race condition during navigation, but may indicate two components are trying to own the same namespace. Updating the existing context.`),uu(e,()=>n)),ud.set(e,r),()=>{ud.get(e)===r&&(ui.setState(t=>(e in t&&delete t[e],t)),ud.delete(e))}},[e]),(0,lk.useEffect)(()=>{let r=t??{};R(n.current,r)||(uu(e,()=>r),n.current=r)},[t]),r.current}function up({namespace:e,value:t}){return um(e,t),null}let uf=({children:e,value:t,fallback:n})=>t?lS().createElement(lS().Fragment,null,e):n?lS().createElement(lS().Fragment,null,n):null;function uh(){let e=(0,lk.useRef)();return(!e.current||e.current.signal.aborted)&&(e.current=new AbortController),(0,lk.useEffect)(()=>{let t=e.current;return()=>t?.abort()},[]),e.current}function ug(e,t=e=>e??{}){let[n,r]=(0,lk.useState)(()=>{if(uy(e))return;let n=ul(e);if(null!==n)return t?t(n):n});return(0,lk.useEffect)(()=>{if(uy(e))throw Error(`The namespace supplied to useAppContext must be a non-empty string, but was "${e}".`)},[e]),(0,lk.useEffect)(()=>{var n;let a;return(n=e=>{if(null==e)return void r(void 0);let n=t?t(e):e;r(e=>R(e,n)?e:n)})(uc(a=ul(e))),ui.subscribe(t=>{let r=e in t?t[e]:null;r!==a&&(a=r,n(uc(r)))})},[e,t]),n}function uy(e){return"string"!=typeof e||0===e.trim().length}function uv(e){let t=lB(e);return(0,lk.useMemo)(()=>t.map(e=>e.id),[t])}function ub(e){return lL(e).candidateExtensions}function uw(e,t,n){let{data:r,error:a,mutate:o,isLoading:i,isValidating:s}=l5()(e?ib(e,t,n):null,od);return(0,lk.useMemo)(()=>({isLoading:i,data:r?.data.results??[],error:a,mutate:o,isValidating:s}),[r,a,i,s,o])}function uE(e){(0,lk.useEffect)(()=>{if(e){let e=window.getComputedStyle(document.body).overflow;return document.body.style.overflow="hidden",()=>{document.body.style.overflow=e}}},[e])}let ux={},uD=`No ComponentContext has been provided. This should come from "openmrsComponentDecorator".