@openmrs/esm-app-shell 6.3.1-pre.3139 → 6.3.1-pre.3140
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.turbo/turbo-build.log +12 -10
- package/dist/3bbc439187ec5b7e.js +1 -0
- package/dist/3bbc439187ec5b7e.js.map +1 -0
- package/dist/index.html +1 -1
- package/dist/{openmrs.f48705d2b63f049c.js → openmrs.582c9ef43db388f6.js} +1 -1
- package/dist/{openmrs.f48705d2b63f049c.js.map → openmrs.582c9ef43db388f6.js.map} +1 -1
- package/dist/service-worker.js +1 -1
- package/lib/{e8db8a77a5868dd5.js → eb7d7277fb540709.js} +2 -2
- package/lib/esm-devtools-app/869.js +1 -1
- package/lib/esm-devtools-app/869.js.map +1 -1
- package/lib/esm-devtools-app/main.js +1 -1
- package/lib/esm-devtools-app/openmrs-esm-devtools-app.js +1 -1
- package/lib/esm-devtools-app/openmrs-esm-devtools-app.js.buildmanifest.json +5 -5
- package/lib/esm-devtools-app/routes.json +1 -1
- package/lib/esm-implementer-tools-app/7869.js +1 -1
- package/lib/esm-implementer-tools-app/7869.js.map +1 -1
- package/lib/esm-implementer-tools-app/main.js +1 -1
- package/lib/esm-implementer-tools-app/openmrs-esm-implementer-tools-app.js +1 -1
- package/lib/esm-implementer-tools-app/openmrs-esm-implementer-tools-app.js.buildmanifest.json +5 -5
- package/lib/esm-implementer-tools-app/routes.json +1 -1
- package/lib/esm-login-app/2434.js +1 -1
- package/lib/esm-login-app/2434.js.map +1 -1
- package/lib/esm-login-app/main.js +1 -1
- package/lib/esm-login-app/main.js.map +1 -1
- package/lib/esm-login-app/openmrs-esm-login-app.js +1 -1
- package/lib/esm-login-app/openmrs-esm-login-app.js.buildmanifest.json +5 -5
- package/lib/esm-login-app/openmrs-esm-login-app.js.map +1 -1
- package/lib/esm-login-app/routes.json +1 -1
- package/lib/esm-offline-tools-app/7869.js +1 -1
- package/lib/esm-offline-tools-app/7869.js.map +1 -1
- package/lib/esm-offline-tools-app/main.js +1 -1
- package/lib/esm-offline-tools-app/openmrs-esm-offline-tools-app.js +1 -1
- package/lib/esm-offline-tools-app/openmrs-esm-offline-tools-app.js.buildmanifest.json +5 -5
- package/lib/esm-offline-tools-app/routes.json +1 -1
- package/lib/esm-primary-navigation-app/1119.js +1 -0
- package/lib/esm-primary-navigation-app/1197.js +1 -0
- package/lib/esm-primary-navigation-app/1782.js +1 -0
- package/lib/esm-primary-navigation-app/1782.js.map +1 -0
- package/lib/esm-primary-navigation-app/2146.js +1 -0
- package/lib/esm-primary-navigation-app/2267.js +1 -0
- package/lib/esm-primary-navigation-app/2267.js.map +1 -0
- package/lib/esm-primary-navigation-app/2690.js +1 -0
- package/lib/esm-primary-navigation-app/2727.js +2 -0
- package/lib/esm-primary-navigation-app/2727.js.map +1 -0
- package/lib/esm-primary-navigation-app/3099.js +1 -0
- package/lib/esm-primary-navigation-app/3584.js +1 -0
- package/lib/esm-primary-navigation-app/3637.js +2 -0
- package/lib/esm-primary-navigation-app/3637.js.map +1 -0
- package/lib/esm-primary-navigation-app/4055.js +1 -0
- package/lib/esm-primary-navigation-app/4132.js +1 -0
- package/lib/esm-primary-navigation-app/4300.js +1 -0
- package/lib/esm-primary-navigation-app/4335.js +1 -0
- package/lib/esm-primary-navigation-app/4618.js +1 -0
- package/lib/esm-primary-navigation-app/4652.js +1 -0
- package/lib/esm-primary-navigation-app/4740.js +2 -0
- package/lib/esm-primary-navigation-app/4740.js.LICENSE.txt +5 -0
- package/lib/esm-primary-navigation-app/4740.js.map +1 -0
- package/lib/esm-primary-navigation-app/4944.js +1 -0
- package/lib/esm-primary-navigation-app/5173.js +1 -0
- package/lib/esm-primary-navigation-app/5241.js +1 -0
- package/lib/esm-primary-navigation-app/5442.js +1 -0
- package/lib/esm-primary-navigation-app/5623.js +2 -0
- package/lib/esm-primary-navigation-app/5623.js.map +1 -0
- package/lib/esm-primary-navigation-app/5661.js +1 -0
- package/lib/esm-primary-navigation-app/5770.js +2 -0
- package/lib/esm-primary-navigation-app/5770.js.map +1 -0
- package/lib/esm-primary-navigation-app/6022.js +1 -0
- package/lib/esm-primary-navigation-app/6248.js +1 -0
- package/lib/esm-primary-navigation-app/6248.js.map +1 -0
- package/lib/esm-primary-navigation-app/6326.js +2 -0
- package/lib/esm-primary-navigation-app/6326.js.map +1 -0
- package/lib/esm-primary-navigation-app/6408.js +2 -0
- package/lib/esm-primary-navigation-app/6408.js.LICENSE.txt +32 -0
- package/lib/esm-primary-navigation-app/6408.js.map +1 -0
- package/lib/esm-primary-navigation-app/6468.js +1 -0
- package/lib/esm-primary-navigation-app/6537.js +2 -0
- package/lib/esm-primary-navigation-app/6537.js.LICENSE.txt +5 -0
- package/lib/esm-primary-navigation-app/6537.js.map +1 -0
- package/lib/esm-primary-navigation-app/6679.js +1 -0
- package/lib/esm-primary-navigation-app/6840.js +1 -0
- package/lib/esm-primary-navigation-app/6859.js +1 -0
- package/lib/esm-primary-navigation-app/7097.js +1 -0
- package/lib/esm-primary-navigation-app/7159.js +1 -0
- package/lib/esm-primary-navigation-app/723.js +1 -0
- package/lib/esm-primary-navigation-app/7617.js +1 -0
- package/lib/esm-primary-navigation-app/7869.js +1 -0
- package/lib/esm-primary-navigation-app/7869.js.map +1 -0
- package/lib/esm-primary-navigation-app/795.js +1 -0
- package/lib/esm-primary-navigation-app/815.js +1 -0
- package/lib/esm-primary-navigation-app/815.js.map +1 -0
- package/lib/esm-primary-navigation-app/8163.js +1 -0
- package/lib/esm-primary-navigation-app/8349.js +1 -0
- package/lib/esm-primary-navigation-app/8577.js +1 -0
- package/lib/esm-primary-navigation-app/8577.js.map +1 -0
- package/lib/esm-primary-navigation-app/8618.js +1 -0
- package/lib/esm-primary-navigation-app/890.js +1 -0
- package/lib/esm-primary-navigation-app/9.js +1 -0
- package/lib/esm-primary-navigation-app/9.js.map +1 -0
- package/lib/esm-primary-navigation-app/9214.js +1 -0
- package/lib/esm-primary-navigation-app/9309.js +2 -0
- package/lib/esm-primary-navigation-app/9309.js.map +1 -0
- package/lib/esm-primary-navigation-app/9538.js +1 -0
- package/lib/esm-primary-navigation-app/9569.js +1 -0
- package/lib/esm-primary-navigation-app/986.js +1 -0
- package/lib/esm-primary-navigation-app/9879.js +1 -0
- package/lib/esm-primary-navigation-app/9895.js +1 -0
- package/lib/esm-primary-navigation-app/9900.js +1 -0
- package/lib/esm-primary-navigation-app/9913.js +1 -0
- package/lib/esm-primary-navigation-app/main.js +2 -0
- package/lib/esm-primary-navigation-app/main.js.LICENSE.txt +5 -0
- package/lib/esm-primary-navigation-app/main.js.map +1 -0
- package/lib/esm-primary-navigation-app/openmrs-esm-primary-navigation-app.js +1 -0
- package/lib/esm-primary-navigation-app/openmrs-esm-primary-navigation-app.js.buildmanifest.json +1392 -0
- package/lib/esm-primary-navigation-app/openmrs-esm-primary-navigation-app.js.map +1 -0
- package/lib/esm-primary-navigation-app/routes.json +1 -0
- package/lib/index.html +2 -2
- package/lib/openmrs.js +4 -4
- package/lib/service-worker.js +1 -1
- package/package.json +3 -3
- package/dist/70448c042c088737.js +0 -1
- package/dist/70448c042c088737.js.map +0 -1
- package/lib/esm-help-menu-app/108.js +0 -1
- package/lib/esm-help-menu-app/108.js.map +0 -1
- package/lib/esm-help-menu-app/11.js +0 -1
- package/lib/esm-help-menu-app/11.js.map +0 -1
- package/lib/esm-help-menu-app/248.js +0 -1
- package/lib/esm-help-menu-app/248.js.map +0 -1
- package/lib/esm-help-menu-app/322.js +0 -1
- package/lib/esm-help-menu-app/322.js.map +0 -1
- package/lib/esm-help-menu-app/326.js +0 -2
- package/lib/esm-help-menu-app/326.js.map +0 -1
- package/lib/esm-help-menu-app/451.js +0 -2
- package/lib/esm-help-menu-app/451.js.map +0 -1
- package/lib/esm-help-menu-app/555.js +0 -1
- package/lib/esm-help-menu-app/555.js.map +0 -1
- package/lib/esm-help-menu-app/623.js +0 -2
- package/lib/esm-help-menu-app/623.js.map +0 -1
- package/lib/esm-help-menu-app/660.js +0 -2
- package/lib/esm-help-menu-app/660.js.map +0 -1
- package/lib/esm-help-menu-app/770.js +0 -2
- package/lib/esm-help-menu-app/770.js.map +0 -1
- package/lib/esm-help-menu-app/802.js +0 -1
- package/lib/esm-help-menu-app/802.js.map +0 -1
- package/lib/esm-help-menu-app/869.js +0 -1
- package/lib/esm-help-menu-app/869.js.map +0 -1
- package/lib/esm-help-menu-app/90.js +0 -1
- package/lib/esm-help-menu-app/90.js.map +0 -1
- package/lib/esm-help-menu-app/932.js +0 -2
- package/lib/esm-help-menu-app/932.js.map +0 -1
- package/lib/esm-help-menu-app/main.js +0 -1
- package/lib/esm-help-menu-app/main.js.map +0 -1
- package/lib/esm-help-menu-app/openmrs-esm-help-menu-app.js +0 -1
- package/lib/esm-help-menu-app/openmrs-esm-help-menu-app.js.buildmanifest.json +0 -464
- package/lib/esm-help-menu-app/openmrs-esm-help-menu-app.js.map +0 -1
- package/lib/esm-help-menu-app/routes.json +0 -1
- /package/lib/{esm-help-menu-app/932.js.LICENSE.txt → esm-primary-navigation-app/2727.js.LICENSE.txt} +0 -0
- /package/lib/{esm-help-menu-app/660.js.LICENSE.txt → esm-primary-navigation-app/3637.js.LICENSE.txt} +0 -0
- /package/lib/{esm-help-menu-app/623.js.LICENSE.txt → esm-primary-navigation-app/5623.js.LICENSE.txt} +0 -0
- /package/lib/{esm-help-menu-app/770.js.LICENSE.txt → esm-primary-navigation-app/5770.js.LICENSE.txt} +0 -0
- /package/lib/{esm-help-menu-app/326.js.LICENSE.txt → esm-primary-navigation-app/6326.js.LICENSE.txt} +0 -0
- /package/lib/{esm-help-menu-app/451.js.LICENSE.txt → esm-primary-navigation-app/9309.js.LICENSE.txt} +0 -0
|
@@ -13,7 +13,7 @@ If you're the maintainer: the 'elements' key only works with '_type' equal to 'A
|
|
|
13
13
|
${o.stack}
|
|
14
14
|
Stacktrace for incoming response:
|
|
15
15
|
${this.stack}`}}let ns=I("session",{loaded:!1,session:null}),nl=0;function nc(e={includeAuthStatus:!0}){return(nl<Date.now()-6e4||!ns.getState().loaded)&&nu(),new F.Observable(n=>{let t=t=>{t.loaded&&(e.includeAuthStatus?n.next(t.session):n.next(t.session?.user))};return t(ns.getState()),ns.subscribe(t)})}function np(){return(nl<Date.now()-6e4||!ns.getState().loaded)&&nu(),ns}function nd(e){let n=e.user?.userProperties?.defaultLocale??e.locale;n&&n.includes("_")&&(n=n.replaceAll("_","-")),function(e){if(void 0===e||"string"!=typeof e)return!1;try{new Intl.Locale(e)}catch(e){return!1}return!0}(n)&&n!==document.documentElement.getAttribute("lang")&&document.documentElement.setAttribute("lang",n)}function nu(e,n){nl=Date.now();let t={};return e&&n&&(t.Authorization=`Basic ${window.btoa(`${e}:${n}`)}`),nb(na(nt,{headers:t}))}function nf(){ns.setState({loaded:!0,session:{authenticated:!1,sessionId:""}})}function ng(e,n){var t,o;if(void 0===n)return!!e;if(!e)return!0;return t=e,o=n,("string"==typeof t?!(0,N.Z)(o.privileges.find(e=>t===e.display)):Array.isArray(t)?t.every(e=>!(0,N.Z)(o.privileges.find(n=>e===n.display))):((0,N.Z)(t)||console.error(`Could not understand privileges "${t}"`),!0))||!(0,N.Z)(n.roles.find(e=>"System Developer"===e.display))}function nm(){let e,n;return new Promise(t=>{let o=o=>{o.loaded&&o.session.user&&(e=o.session.user,t(o.session.user),n&&n())};o(ns.getState()),e||(n=ns.subscribe(o))})}function nh(){return new Promise((e,n)=>{nc().subscribe(n=>{e(n.sessionLocation)},n).unsubscribe()})}async function n_(e,n){return nb(na(nt,{method:"POST",body:{sessionLocation:e},headers:{"Content-Type":"application/json"},signal:n.signal}))}async function ny(e,n,t){return t||(t=new AbortController),await na(`${ne}/user/${e}`,{method:"POST",body:{userProperties:n},headers:{"Content-Type":"application/json"},signal:t.signal}),nu()}function nb(e){return new Promise((n,t)=>{e.then(e=>{let o;"object"==typeof e?.data?(o={loaded:!0,session:e.data},ns.setState(o),n(o)):(o={loaded:!1,session:null},ns.setState(o),t(o))}).catch(e=>{w(`Failed to fetch new session information: ${e}`);let n={loaded:!1,session:null};ns.setState(n),t(n)})})}function nA(){return"development"===window.spaEnv||"true"===localStorage.getItem("openmrs:devtools")}ns.subscribe(e=>{e.loaded&&e.session&&nd(e.session)});let nv={"webservices.rest":"2.24.0",fhir2:"1.0.0-SNAPSHOT"};function n$(){em("@openmrs/esm-api",{redirectAuthFailure:{enabled:{_type:V.Boolean,_default:!0,_description:"Whether to redirect logged-out users to `redirectAuthFailure.url`"},url:{_type:V.String,_default:"${openmrsSpaBase}/login",_validators:[eL.isUrl]},errors:{_type:V.Array,_default:[401],_elements:{_type:V.Number,_validators:[eL.inRange(100,600)]},_description:"The HTTP error codes for which users will be redirected"},resolvePromise:{_type:V.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:V.Boolean,_default:!0,_description:"Whether openmrsFetch should support redirects returned from the backend"}}),nu()}let nk={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",actions:"Actions",address:"Address",age:"Age",cancel:"Cancel",change:"Change",Clinic:"Clinic",close:"Close",confirm:"Confirm",contactAdministratorIfIssuePersists:"Contact your system administrator if the problem persists.",contactDetails:"Contact details",delete:"Delete",edit:"Edit",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.",female:"Female",loading:"Loading",male:"Male",other:"Other",patientIdentifierSticker:"Patient identifier sticker",patientLists:"Patient lists",print:"Print",printError:"Print error",printErrorExplainer:"An error occurred in {{errorLocation}}",printIdentifierSticker:"Print identifier sticker",printing:"Printing",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.",seeMoreLists:"See {{count}} more lists",sex:"Sex",showLess:"Show less",showMore:"Show more",toggleDevTools:"Toggle dev tools",unknown:"Unknown"};var nw=t(7060);let nC=nw.ZP.default||nw.ZP;function nx(e,n,t,o){return nC.t(n,{ns:e,defaultValue:t,...o})}function nz(e,n,t){return nk[e]?nx("core",e,n??nk[e],t):(console.error(`O3 Core Translations does not provide key '${e}'. The key itself is being rendered as text.`),e)}function nE(e){return e.replace(/[\/\-@]/g,"_")}async function nS(e,n="./start",o){var a;let i,r=!o?.maxLoadingTime||o.maxLoadingTime<=0?6e5:o.maxLoadingTime;await Promise.race([nM(e,o?.importMap),new Promise((n,t)=>{i=setTimeout(()=>{var n;t(Error(`Could not resolve requested script, ${e}, within ${(n=r)<1e3?`${n} milliseconds`:n<6e4?`${Math.floor(n/1e3)} seconds`:n<36e5?`${Math.floor(n/6e4)} minutes`:n<864e5?`${Math.floor(n/36e5)} hours`:`${Math.floor(n/864e5)} days`}.`))},r)})]),i&&clearTimeout(i);let s=nE(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(t.S.default);let c=(await l.get(n))();if("object"!=typeof c||null===c){let n=`Container for ${e} did not return an ESM module as expected`;throw console.error(n),Error(n)}return c}async function nM(e,n){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 t=nE(e);if(!window[t]){let t=n??await nB();if(!t.imports.hasOwnProperty(e)){let n=`Could not find the package ${e} defined in the current importmap`;throw console.error(n),Error(n)}let o=t.imports[e];o.startsWith("./")&&(o=window.spaBase+o.substring(1));let a=!!window.localStorage.getItem(`import-map-override:${e}`);try{return await new Promise((e,n)=>{!function(e,n,t){let o=document.head.querySelector(`script[src="${e}"]`),a=window[nD];if(a||(a=window[nD]=new Set([])),o)if(a.has(e)){let e,a,i;i=()=>{e&&o.removeEventListener("load",e),a&&o.removeEventListener("error",a)},e=()=>{i(),n(null)},a=e=>{i(),t(e.message)},o.addEventListener("load",e),o.addEventListener("error",a)}else console.warn(`Script at ${e} already loaded. Not loading it again.`),n(null);else{let o,i,r;a.add(e);let s=document.createElement("script");s.src=e,s.type="text/javascript",s.async=!0;let l=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);r=()=>{clearTimeout(l),a.delete(e),o&&s.removeEventListener("load",o),i&&s.removeEventListener("error",i)},o=()=>{r(),n(null)},i=n=>{r();let o=`Failed to load script from ${e}`;console.error(o,n),t(n.message??o)},s.addEventListener("load",o),s.addEventListener("error",i),document.head.appendChild(s)}}(o,e,n)})}catch(e){return a&&b({kind:"error",title:nz("scriptLoadingFailed","Error: Script failed to load"),description:nz("scriptLoadingError","Failed to load overridden script from {{- url}}. Please check that the bundled script is available at the expected URL. Click the button below to reset all import map overrides.",{url:o}),actionButtonLabel:nz("resetOverrides","Reset overrides"),onActionButtonClick(){window.importMapOverrides.resetOverrides(),window.location.reload()}}),Promise.reject(e)}}return Promise.resolve()}async function nB(){return window.importMapOverrides.getCurrentPageMap()}nC.on("initialized",function(){window.i18next.loadNamespaces(["core"])});let nD=Symbol("__openmrs_script_loading"),nI=`${ne}/attachment`;function nO(e,n){return na(`${nI}/${e}`,{signal:n.signal})}function nT(e,n,t){return na(`${nI}?patient=${e}&includeEncounterless=${n}`,{signal:t.signal})}async function nP(e,n){let t=new FormData;return t.append("fileCaption",n.fileDescription),t.append("patient",e),n.file?t.append("file",n.file,n.fileName):(t.append("file",new File([""],n.fileName),n.fileName),t.append("base64Content",n.base64Content)),na(`${nI}`,{method:"POST",body:t})}function nN(e,n){return na(`${nI}/${e}`,{method:"DELETE",signal:n.signal})}var nF=t(23805);function nj(e,n){if(void 0!==a)return console.warn(`The application's Service Worker has already been registered. The new service worker at ${e} will not be registered.`),a;if(!("serviceWorker"in navigator))throw Error("Registering the Service Worker is not possible due to missing browser capabilities.");let t=new nF.ZW(e,n);return a=t.register().then(()=>t.controlling.then(()=>t))}function nW(){return a??Promise.resolve(void 0)}let nG="x-omrs-offline-response-body",nR="x-omrs-offline-response-status",nq="x-omrs-offline-caching-strategy";async function nL(e){let n=await nW();return n?await n.messageSW(e):{success:!1,result:void 0,error:"No service worker has been registered. This is typically the case when the application has been built without offline-related features."}}async function nV(){let e=window.sessionStorage;try{e.setItem("someKeyHere","test"),e.removeItem("someKeyHere")}catch(n){if(n.code===DOMException.QUOTA_EXCEEDED_ERR&&0===e.length)return!0}return!1}async function nH(){return!window.indexedDB}async function nU(){return new Promise(e=>{let n=indexedDB.open("test");n.onerror=()=>e(!0),n.onsuccess=()=>e(!1)})}async function nX(){return await nU()||await nH()||await nV()}let nY="openmrs3:offline-mode",nZ="unavailable";function nJ(){return{current:nZ,notAvailable:"unavailable"===nZ,active:"on"===nZ}}function nQ(e){"unavailable"!==nZ&&"unavailable"!==e&&(localStorage.setItem(nY,"on"===e?"active":"disabled"),nZ=e)}async function nK(){await nX()||(nZ="active"===localStorage.getItem(nY)?"on":"off"),navigator.onLine}var n0=t(44197);function n1(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}class n2 extends n0.ZP{constructor(){super("EsmOffline"),n1(this,"syncQueue",void 0),n1(this,"dynamicOfflineData",void 0),this.version(4).stores({syncQueue:"++id,userId,type,[userId+type]",dynamicOfflineData:"++id,type,identifier,*users,&[type+identifier]"}),this.syncQueue=this.table("syncQueue"),this.dynamicOfflineData=this.table("dynamicOfflineData")}}function n3(){return new n2}let n5=new n2,n4={},n6=I("offline-synchronization",{});function n8(){return n6}async function n7(){if(n6.getState().synchronization)return;let e=await n5.syncQueue.count(),n={},t=Object.entries(n4),o=t.length,a={},i=new AbortController,r=()=>{let e=n6.getState().synchronization;n6.setState({synchronization:{...e,pendingCount:e.pendingCount-1}})};try{n6.setState({synchronization:{totalCount:e,pendingCount:e,abortController:i}});for(let e=0;e<o&&t.length>0;e++)for(let e=t.length;e--;){let[o,s]=t[e],l=s.dependsOn.map(e=>n[e]);l.every(Boolean)&&(a[o]={},await Promise.all(l),n[o]=n9(s,a,i,r),t.splice(e,1))}await Promise.allSettled(Object.values(n))}finally{n6.setState({synchronization:void 0})}}async function n9({type:e,dependsOn:n,process:t},o,a,i){let r=[],s=[],l=await te();await n5.syncQueue.where({type:e,userId:l}).each((e,n)=>{r.push([n.primaryKey,e.content,e.descriptor]),s.push(e.content)});for(let c=0;c<r.length;c++){let[p,d,{id:u,dependencies:f=[]}]=r[c];try{let i=await t(d,{abort:a,index:c,items:s,userId:l,dependencies:f.map(({id:e,type:t})=>n.includes(t)?o[t][e]:void 0)});void 0!==u&&(o[e][u]=i),await n5.syncQueue.delete(p)}catch(e){await n5.syncQueue.update(p,{lastError:{name:e?.name,message:e?.message??e?.toString()}})}finally{i()}}}async function te(){let e=await nm();return e?.uuid||"*"}async function tn(e,n,t,o){let a=o&&o.id;return void 0!==a&&await n5.syncQueue.where({type:n,userId:e}).filter(e=>e?.descriptor.id===a).delete().catch(n0.ZP.errnames.DatabaseClosed),await n5.syncQueue.add({type:n,content:t,userId:e,descriptor:o||{},createdOn:new Date}).catch(n0.ZP.errnames.DatabaseClosed,()=>-1)}async function tt(e,n,t){let o=await te();return await tn(o,e,n,t)}async function to(e,n){return(await ta(e,n)).map(e=>e.content)}async function ta(e,n){return await n5.syncQueue.where(n?{type:n,userId:e}:{userId:e}).toArray().catch(n0.ZP.errnames.DatabaseClosed,()=>[])}async function ti(e){let n=await te();return await to(n,e)}async function tr(e){let n=await te();return await ta(n,e)}async function ts(e){return await n5.syncQueue.get(e).catch(n0.ZP.errnames.DatabaseClosed,()=>void 0)}function tl(e){return!!n4[e]?.options.onBeginEditSyncItem}async function tc(e){let n=await ts(e);if(!n)throw Error(`No sync item with the ID ${e} exists.`);let t=n4[n.type]?.options.onBeginEditSyncItem;if(!t)throw Error(`A sync item with the ID ${e} exists, but the associated handler (if one exists) doesn't support editing the item. You can avoid this error by either verifying that sync items of this type can be edited via the "canEditSynchronizationItemsOfType(type: string)" function or alternatively ensure that the synchronizaton handler for sync items of type "${n.type}" supports editing items.`);t(n)}async function tp(e){await n5.syncQueue.delete(e).catch(n0.ZP.errnames.DatabaseClosed)}function td(e,n,t,o={}){n4[e]={type:e,dependsOn:n,process:t,options:o}}var tu=t(43415);let tf="OFFLINE+";function tg(){return tf+(0,tu.Z)()}function tm(e){return e.startsWith(tf)}let th={};function t_(){return Object.values(th)}function ty(e){th[e.id]&&console.warn(`[setupDynamicOfflineDataHandler] Another second handler with the ID "${e.id}" was registered. This handler will override the previous one. This could be unintended as the previous handler might run different flows than the newly registered one. If this is the case, ensure that you are setting up the handlers with different IDs.`),th[e.id]=e}async function tb(e){let n=await tz();return await tA(n,e)}async function tA(e,n){let t=new n2;return await t.dynamicOfflineData.where(n?{type:n,users:e}:{users:e}).toArray().catch(n0.ZP.errnames.DatabaseClosed,()=>[])}async function tv(e,n){let t=await tz();return await t$(t,e,n)}async function t$(e,n,t){let o=new n2,a=await o.dynamicOfflineData.get({type:n,identifier:t}).catch(n0.ZP.errnames.DatabaseClosed,()=>void 0);a?a.users.includes(e)||await o.dynamicOfflineData.update(a.id,{users:[...a.users,e]}).catch(n0.ZP.errnames.DatabaseClosed):await o.dynamicOfflineData.add({users:[e],type:n,identifier:t}).catch(n0.ZP.errnames.DatabaseClosed)}async function tk(e,n){let t=await tz();return await tw(t,e,n)}async function tw(e,n,t){let o=new n2,a=await o.dynamicOfflineData.get({type:n,identifier:t,users:e}).catch(n0.ZP.errnames.DatabaseClosed,()=>void 0);a&&(a.users.length>1?await o.dynamicOfflineData.update(a.id,{users:a.users.filter(n=>n!==e)}).catch(n0.ZP.errnames.DatabaseClosed):await o.dynamicOfflineData.delete(a.id).catch(n0.ZP.errnames.DatabaseClosed))}async function tC(e,n){let t=await tb(e);await Promise.all(t.map(async e=>tx(e.type,e.identifier,n)))}async function tx(e,n,t){await tv(e,n);let o=new n2,a=await tz(),i=await o.dynamicOfflineData.get({type:e,identifier:n}).catch(n0.ZP.errnames.DatabaseClosed,()=>void 0),r=t_().filter(n=>n.type===e);if(!i)return;let s=await Promise.all(r.map(async e=>{try{return e.sync(n,t),{id:e.id,error:void 0}}catch(t){let n=t.message?.toString()??t.toString();return{id:e.id,error:n}}})),l=s.filter(e=>!e.error).map(e=>e.id),c=s.filter(e=>e.error).map(e=>e.id),p=s.filter(e=>e.error).map(e=>({handlerId:e.id,message:e.error})),d={syncedOn:new Date,syncedBy:a,succeededHandlers:l,erroredHandlers:c,errors:p};i.id&&await o.dynamicOfflineData.update(i.id,{syncState:d}).catch(n0.ZP.errnames.DatabaseClosed)}async function tz(){let e=(await nm()).uuid;if(!e)throw Error("Using the dynamic offline data API requires a logged in user.");return e}let tE=I("offline-patients",{offlinePatientDataSyncState:{},handlers:{}});function tS(){return tD(),tE}function tM(e,n){tD(),ty({type:"patient",displayName:n.displayName,id:e,isSynced:()=>Promise.resolve(!0),sync:(e,t)=>n.onOfflinePatientAdded({patientUuid:e,signal:t??new AbortController().signal})})}async function tB(e){tD(),await tx("patient",e)}function tD(){console.warn("The offline patient API has been deprecated and will be removed in a future release. To prevent future crashes, the functions remain available for the moment, but any invocations should be migrated ASAP.")}async function tI(e,n,t=!0){if(e){let o=null,[a,i]=await Promise.all([na(`${nn}/Patient/${e}`,n).catch(e=>o=e),t?tO(e):Promise.resolve(null)]);if(a.ok)return a.data;if(i)return i;if(o)throw o}return null}async function tO(e){let n=(await ti("patient-registration")).find(n=>n.fhirPatient.id===e);return n?.fhirPatient??null}var tT=t(34049);function tP(e){return{uuid:e.uuid,display:e.display}}function tN(e=null,n=null){let t=new URLSearchParams;e&&t.set("tag",e),n&&t.set("q",n);let o=t.toString();return ni(`${ne}/location${o?"?"+o:""}`).pipe((0,tT.map)(e=>e.data.results.map(tP))).pipe((0,tT.take)(1))}function tF(e){return{uuid:e.uuid,display:e.display,name:e.name}}function tj(){return ni(`${ne}/visittype`).pipe((0,tT.map)(e=>e.data.results.map(tF))).pipe((0,tT.take)(1))}var tW=((S={}).NEWVISIT="startVisit",S.EDITVISIT="editVisit",S.LOADING="loadingVisit",S),tG=((M={}).NOTSTARTED="notStarted",M.ONGOING="ongoing",M);let tR="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))",tq=function(){try{return JSON.parse(sessionStorage.getItem("openmrs:visitStoreState")||"null")}catch(e){return null}}()||{patientUuid:null,manuallySetVisitUuid:null,mutateVisitCallbacks:{}};function tL(){return T("visit",tq)}function tV(e,n){tL().setState({patientUuid:e,manuallySetVisitUuid:n})}function tH(e,n){return na(`${ne}/visit`,{signal:n.signal,method:"POST",headers:{"Content-type":"application/json"},body:e})}function tU(e,n,t){return na(`${ne}/visit/${e}`,{signal:t.signal,method:"POST",headers:{"Content-type":"application/json"},body:n})}function tX(e,n,t){return na(`${ne}/visit?patient=${e}&v=${t??tR}`,{signal:n.signal,method:"GET",headers:{"Content-type":"application/json"}})}tL().subscribe(e=>{var n;n=e,sessionStorage.setItem("openmrs:visitStoreState",JSON.stringify(n))});let tY=new F.BehaviorSubject(null);var tZ=t(89373),tJ=t(31204),tQ=t(68334),tK=t(11435),t0=t(75754),t1=t(63511),t2=t(73237);let t3={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)}},t5={...t3,Promise};function t4(e,n={}){return on(e,n,oa)}async function t6(e,n={}){return ot(e,n,oa)}function t8(e,n={}){return on(e,n,oi)}function t7(e,n={}){return ot(e,n,oi)}function t9(e,n={}){return on(e,n,or)}function oe(e,n={}){return ot(e,n,or)}function on(e,n={},t){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.`;null==n&&(n={});let o=oc(n,t3),a=os("string"==typeof e?(0,tZ.Z)(e):e,o);if(t(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 ot(e,n={},t){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.`);null==n&&(n={});let o=oc(n,t5);return Promise.resolve(os("string"==typeof e?(0,tZ.Z)(e):e,o)).then(n=>{if(t(n))return n;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 oo(e){return(0,tZ.Z)(e)}function oa(e){return"string"==typeof e||"number"==typeof e||"boolean"==typeof e||null==e||e instanceof Date}function oi(e){return"boolean"==typeof e}function or(e){return"number"==typeof e}function os(e,n){switch(e.type){case"UnaryExpression":var t,o,a,i,r,s,l,c,p=e,d=n;let u=os(p.argument,d);switch(p.operator){case"+":return+u;case"-":return-u;case"~":return~u;case"!":return!u;default:throw`Expression evaluator does not support operator '${p.operator}''`}case"BinaryExpression":var f=e,g=n;let m=os(f.left,g),h=os(f.right,g);switch(f.operator){case"+":return m+h;case"-":return m-h;case"*":return m*h;case"/":return m/h;case"%":return m%h;case"**":return m**h;case"==":return m==h;case"===":return m===h;case"!=":return m!=h;case"!==":return m!==h;case">":return m>h;case">=":return m>=h;case"<":return m<h;case"<=":return m<=h;case"in":return m in h;case"&&":return m&&h;case"||":return m||h;case"??":return m??h;default:throw`Expression evaluator does not support operator '${f.operator}' operator`}case"ConditionalExpression":return t=e,o=n,os(t.test,o)?os(t.consequent,o):os(t.alternate,o);case"CallExpression":var _=e,y=n;let b=_.arguments?.map(op(y)),A=os(_.callee,y);if(A){if("function"!=typeof A)throw`${ou(_.callee)} is not a function`}else throw`No function named ${ou(_.callee)} is defined in this context`;return A(...b);case"ArrowFunctionExpression":var v=e,$=n;let k=v.params?.map(e=>{if("Identifier"===e.type)return e.name;throw`Cannot handle parameter of type ${e.type}`})??[];return(function(...e){if(e.length<k.length)throw`Required argument(s) ${k.slice(e.length,-1).join(", ")} were not provided`;let n=Object.fromEntries(k.reduce((n,t,o)=>{let a=e[o];return function e(n){if("string"==typeof n||"number"==typeof n||"boolean"==typeof n||"function"==typeof n||null===n||n instanceof RegExp)return!0;if("object"==typeof n){for(let t of Object.keys(n))if(!e(n[t]))return!1;return!0}if(Array.isArray(n)){for(let t of n)if(!e(t))break}return!1}(a)&&n.push([t,a]),n},[]));return os(v.body,$.addVariables(n))}).bind($.thisObj??null);case"MemberExpression":return function(e,n){let t,o=os(e.object,n);if(void 0===o)switch(e.object.type){case"Identifier":{let t=ol(e.object,n);throw ReferenceError(`ReferenceError: ${t} is not defined`)}case"MemberExpression":{let t=ol(e.property,n);throw TypeError(`TypeError: cannot read properties of undefined (reading '${t}')`)}default:throw`VisitMemberExpression does not support operator '${e.object.type}' type`}let a=o;if("string"==typeof o)a=String.prototype;else if("number"==typeof o)a=Number.prototype;else if("function"==typeof o);else if("object"!=typeof o)throw`VisitMemberExpression does not support member access on type ${typeof o}`;switch(n.thisObj=a,e.property.type){case"Identifier":case"MemberExpression":t=os(e.property,n);break;default:{let a=os(e.property,n);if(void 0===a)throw{type:"Illegal property access",message:"No property was supplied to the property access"};od(a),t=o[a]}}return"function"==typeof t?t.bind(o):t}(e,n);case"ArrayExpression":return a=e,i=n,a.elements?.map(op(i));case"SequenceExpression":var w=e,C=n;let x=w.expressions.map(op(C));return x[x.length-1];case"NewExpression":var z=e,E=n;if(z.callee&&"Identifier"===z.callee.type){let e=z.arguments?.map(op(E));switch(z.callee.name){case"Date":return new Date(...e);case"RegExp":return new RegExp(...e);default:throw`Cannot instantiate object of type ${z.callee.name}`}}if(z.callee)throw"new must be called with either Date or RegExp";throw'Could not handle "new" without a specified class';case"Literal":return s=0,od((r=e).value),r.value;case"Identifier":var S=e,M=n;od(S.name);let B=M.thisObj;if(B&&("object"==typeof B||"function"==typeof B)&&S.name in B){let e=B[S.name];return od(e),e}if(M.variables&&S.name in M.variables){let e=M.variables[S.name];return od(e),e}return S.name in M.globals?M.globals[S.name]:void 0;case"TemplateLiteral":var D=e,I=n;let O=D.expressions?.map(op(I))??[],T=D.quasis?.map(op(I))??[];return T.filter(e=>!e.tail).map(e=>e.value).join("")+O.join("")+T.filter(e=>e.tail).map(e=>e.value).join("");case"TemplateElement":return c=0,{value:(l=e).cooked,tail:l.tail};default:throw`Expression evaluator does not support expression of type '${e.type}'`}}function ol(e,n){switch(e.type){case"Literal":return e.value;case"Identifier":return e.name;case"MemberExpression":return ol(e.property,n);default:throw`VisitExpressionName does not support expression of type '${e.type}'`}}function oc(e,n){let t={thisObj:void 0,variables:{...e},globals:{...n},addVariables(e){return this.variables={...this.variables,...e},this}};return t.addVariables.bind(t),t}function op(e){return function(n){return null===n?null:os(n,e)}}function od(e){if("__proto__"===e||"prototype"===e||"constructor"===e)throw{type:"Illegal property access",message:`Cannot access the ${e} property of objects`}}function ou(e){return e?"MemberExpression"===e.type?e.property?.name:e.name:null}function of(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 n={globals:{...t5},isLocalExpression:!1,variables:new Set};return og("string"==typeof e?(0,tZ.Z)(e):e,n),[...n.variables]}function og(e,n){switch(e.type){case"UnaryExpression":return t=e,o=n,og(t.argument,o);case"BinaryExpression":return a=e,i=n,[og(a.left,i),og(a.right,i)].filter(Boolean);case"ConditionalExpression":var t,o,a,i,r,s,l,c,p,d,u,f,g,m,h,_,y=e,b=n;return[og(y.consequent,b),og(y.test,b),og(y.alternate,b)].filter(Boolean);case"CallExpression":var A=e,v=n;let $=og(A.callee,v);return A.arguments?.map(om(v)),$;case"ArrowFunctionExpression":var k=e,w=n;let C={...w};C.isLocalExpression=!0;let x=k.params?.map(om(C))??[],z=og(k.body,C)??[];if(z&&Array.isArray(z))for(let e of z)x.includes(e)||w.variables.add(e);return;case"MemberExpression":var E=e,S=n;og(E.object,S);let M={...S};M.isLocalExpression=!0,og(E.property,M);return;case"ArrayExpression":return r=e,s=n,void r.elements?.map(om(s));case"SequenceExpression":return l=e,c=n,void l.expressions?.map(om(c));case"NewExpression":return p=e,d=n,void p.arguments?.map(om(d));case"Literal":return u=0,void(f=0);case"Identifier":var B=e,D=n;if(!(B.name in D.globals))if(D.isLocalExpression)return B.name;else D.variables.add(B.name);return;case"TemplateLiteral":return g=e,m=n,void(g.expressions?.map(om(m)),g.quasis?.map(om(m)));case"TemplateElement":return h=0,void(_=0);default:throw`Expression evaluator does not support expression of type '${e.type}'`}}function om(e){return function(n){return null===n?null:og(n,e)}}tZ.Z.plugins.register(tJ.Z),tZ.Z.plugins.register(tQ.Z),tZ.Z.plugins.register(tK.Z),tZ.Z.plugins.register(t0.Z),tZ.Z.plugins.register(t1.Z),tZ.Z.plugins.register(t2.Z),tZ.Z.addBinaryOp("in",7),tZ.Z.addBinaryOp("??",1);let oh=T("feature-flags",{flags:function(){let e={};for(let n of Object.keys(localStorage))if(n.startsWith("openmrs:feature-flag:")){let t=n.replace("openmrs:feature-flag:",""),o=JSON.parse(localStorage.getItem(`openmrs:feature-flag-meta:${t}`)||"{}");e[t]={enabled:"true"===localStorage.getItem(n),...o}}return e}()});function o_(e,n,t){oh.setState(o=>({flags:{...o.flags,[e]:{enabled:o.flags[e]?.enabled??!1,label:n,description:t}}}))}function oy(){let e=oh.getState().flags;Object.keys(localStorage).filter(e=>e.startsWith("openmrs:feature-flag:")).forEach(n=>{let t=n.replace("openmrs:feature-flag:","");e[t]||(localStorage.removeItem(n),localStorage.removeItem(`openmrs:feature-flag-meta:${t}`))})}function ob(e){return oh.getState().flags[e].enabled}function oA(e,n){oh.subscribe(t=>{n(t.flags[e].enabled)})}function ov(e,n){oh.setState(t=>({flags:{...t.flags,[e]:{...t.flags[e],enabled:n}}}))}function o$(e){return!window.offlineEnabled||(e??navigator.onLine)}oh.subscribe(e=>{for(let[n,t]of Object.entries(e.flags))localStorage.setItem(`openmrs:feature-flag:${n}`,t.enabled.toString()),localStorage.setItem(`openmrs:feature-flag-meta:${n}`,JSON.stringify({label:t.label,description:t.description}))});var ok=t(39508),ow=t(25424);function oC(e=!0,n=!1){return ox(o$(),e,n)}function ox(e,n=!0,t=!1){return!!(e?n:t)}let oz=I("extensionsInternal",{slots:{},extensions:{}}),oE=()=>T("extensionsInternal",{slots:{},extensions:{}});function oS(e){let n=oz.getState(),t=e(n);t!==n&&oz.setState(t)}let oM=()=>T("extensions",{slots:{}});function oB(e){let n=[];for(let t of Object.values(e.extensions))for(let e of t.instances)n.push({slotModuleName:e.slotModuleName,extensionModuleName:t.moduleName,slotName:e.slotName,extensionId:e.id});(0,ok.Z)(en.getState().mountedExtensions,n)||en.setState({mountedExtensions:n})}oB(oz.getState()),oz.subscribe(oB);let oD=oE(),oI=oM(),oO=eo(),oT=er();function oP(e,n,t,o,a){let i={},r=o$(),s=Object.entries(o.flags).filter(([,{enabled:e}])=>e).map(([e])=>e);for(let[o,l]of Object.entries(e.slots)){let{config:c}=ei(n,l.name),p=oU(o,e,c,t,s,r,a.session);i[o]={moduleName:l.moduleName,assignedExtensions:p}}(0,ok.Z)(oI.getState().slots,i)||oI.setState({slots:i})}function oN(){oP(oD.getState(),oO.getState(),oT.getState(),oh.getState(),ns.getState())}function oF(e,n){return{moduleName:n,name:e,attachedIds:[],config:null}}function oj(e){let[n]=e.split("#");return n}function oW(e,n){let t=oj(n);return e.extensions[t]}function oG(e){return oW(oD.getState(),e)}oD.subscribe(e=>{oP(e,oO.getState(),oT.getState(),oh.getState(),ns.getState())}),oO.subscribe(e=>{oP(oD.getState(),e,oT.getState(),oh.getState(),ns.getState())}),oT.subscribe(e=>{oP(oD.getState(),oO.getState(),e,oh.getState(),ns.getState())}),oh.subscribe(e=>{oP(oD.getState(),oO.getState(),oT.getState(),e,ns.getState())}),ns.subscribe(e=>{oP(oD.getState(),oO.getState(),oT.getState(),oh.getState(),e)}),oN(),s(oN);let oR=e=>oD.setState(n=>(n.extensions[e.name]={...e,instances:[]},n));function oq(e,n){oS(t=>{let o=t.slots[e];return o?{...t,slots:{...t.slots,[e]:{...o,attachedIds:[...o.attachedIds,n]}}}:{...t,slots:{...t.slots,[e]:{...oF(e),attachedIds:[n]}}}})}function oL(e,n){oS(t=>{let o=t.slots[e];return o&&o.attachedIds.includes(n)?{...t,slots:{...t.slots,[e]:{...o,attachedIds:o.attachedIds.filter(e=>e!==n)}}}:t})}function oV(e){oS(n=>{let t=n.slots[e];return t?{...n,slots:{...n.slots,[e]:{...t,attachedIds:[]}}}:n})}function oH(e,n,t,o){let a=n.indexOf(e);if(-1!==a)return a;{if(void 0!==t)return 1e3+t;let n=o.indexOf(e);return -1!==n?2e3+n:-1}}function oU(e,n,t,o,a,i,r){let s=function(e,n){let t=e.add||[],o=e.remove||[],a=e.order||[],{extensions:i}=oD.getState();return[...n,...t].filter(e=>!o.includes(e)).sort((e,t)=>{let o=oH(e,a,i[oj(e)]?.order,n),r=oH(t,a,i[oj(t)]?.order,n);return -1===r?-1:-1===o?1:o-r})}(t,n.slots[e].attachedIds),l=[];for(let c of s){let{config:s}=el(o,e,c),p=ec(t,e,c),d=(0,ow.Z)(s,p),u=oj(c),f=n.extensions[u];if(f){let e=d?.["Display conditions"]?.privileges??f.privileges??[];if(e&&("string"==typeof e||Array.isArray(e)&&e.length>0)&&(!r?.user||!ng(e,r.user)))continue;let n=d?.["Display conditions"]?.expression??null;if(null!==n)try{if(!t8(n,{session:r}))continue}catch(e){console.error(`Error while evaluating expression ${n}`,e);continue}if(f.featureFlag&&!a.includes(f.featureFlag)||window.offlineEnabled&&!ox(i,f.online,f.offline))continue;l.push({id:c,name:u,moduleName:f.moduleName,config:d,featureFlag:f.featureFlag,meta:f.meta,online:d?.["Display conditions"]?.online??f.online??!0,offline:d?.["Display conditions"]?.offline??f.offline??!1})}}return l}function oX(e){let n=oD.getState(),{config:t}=ea(e),o=oT.getState(),a=oh.getState(),i=ns.getState(),r=o$();return oU(e,n,t,o,Object.entries(a.flags).filter(([,{enabled:e}])=>e).map(([e])=>e),r,i.session)}let oY=(e,n)=>oD.setState(t=>{let o=t.slots[n]?.moduleName;if(o&&o!=e)return console.warn(`An extension slot with the name '${n}' already exists. Refusing to register the same slot name twice (in "registerExtensionSlot"). The existing one is from module ${o}.`),t;if(o&&o==e)return t;if(t.slots[n])return{...t,slots:{...t.slots,[n]:{...t.slots[n],moduleName:e}}};let a=oF(n,e);return{...t,slots:{...t.slots,[n]:a}}}),oZ=()=>oI.setState(()=>({slots:{},extensions:{}})),oJ=I("left-nav",{slotName:null,basePath:window.spaBase,mode:"normal"});function oQ({name:e,basePath:n,mode:t,componentContext:o}){oJ.setState({slotName:e,basePath:n,mode:t??"normal",componentContext:o})}function oK(e){oJ.getState().slotName===e&&oJ.setState(oJ.getInitialState(),!0)}let o0=I("modalRegistry",{modals:{}});function o1(e){o0.setState(n=>(n.modals[e.name]=e,n))}function o2(e){let n=o0.getState().modals[e];if(!n){let t=oG(e);t&&(n={name:e,load:t.load,moduleName:t.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.`),o1(n))}return n}let o3=I("workspaceRegistrations",{workspaces:{}}),o5=I("workspaceGroups",{workspaceGroups:{}});function o4(e){o3.setState(n=>({workspaces:{...n.workspaces,[e.name]:{...e,preferredWindowSize:e.preferredWindowSize??"normal",type:e.type??"form",canHide:e.canHide??!1,canMaximize:e.canMaximize??!1,width:e.width??"narrow",groups:e.groups??[]}}}))}function o6(e){o5.setState(n=>{let t=n.workspaceGroups[e.name];return t?{workspaceGroups:{...n.workspaceGroups,[e.name]:{...t,members:Array.from(new Set([...t.members,...e.members]))}}}:{workspaceGroups:{...n.workspaceGroups,[e.name]:{name:e.name,members:e.members}}}})}let o8=new Set;function o7(e){let n=o3.getState().workspaces;if(n[e])return n[e];{let n=oG(e);if(n)return o8.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.`),o8.add(e)),{name:n.name,title:function(e){let n=e?.meta?.title;return"string"==typeof n?n:n&&"object"==typeof n?nx(e.moduleName,n.key,n.default):e.name}(n),moduleName:n.moduleName,preferredWindowSize:n.meta?.screenSize??"normal",load:n.load,type:n.meta?.type??"form",canHide:n.meta?.canHide??!1,canMaximize:n.meta?.canMaximize??!1,width:n.meta?.width??"narrow",groups:n.meta?.groups??[]};throw Error(`No workspace named '${e}' has been registered.`)}}function o9(e){let n=o5.getState().workspaceGroups;if(n[e])return n[e];throw Error(`No workspace group named '${e}' has been registered.`)}let ae=0;async function an(e,n,t,o,a=e=>e,i={}){let r=oj(o),s=oG(o),l=null;if(e){if(!s)throw Error(`Couldn't find extension '${r}' to attach to '${n}'`);let{load:c,meta:p,moduleName:d,online:u,offline:f}=s;if(oC(u,f)){oS(a=>({...a,extensions:{...a.extensions,[r]:{...a.extensions[r],instances:[...a.extensions[r].instances,{domElement:e,id:o,slotName:n,slotModuleName:t}]}}}));let{default:s,...u}=await c(),f=ae++;l=(0,eK.BP)(a({...s??u,name:`${n}/${r}-${f}`}),{...i,_meta:p,_extensionContext:{extensionId:o,extensionSlotName:n,extensionSlotModuleName:t,extensionModuleName:d},domElement:e})}}else console.warn(`Tried to render ${o} into ${n} but no DOM element was available.`);return l}var at=t(4449),ao=t.n(at);let aa=(0,at.createContext)({moduleName:"",featureName:""});function ai({to:e,templateParams:n,onBeforeNavigate:t,children:o,...a}){return(0,at.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}`)},[]),at.createElement("a",{onClick:o=>{0===o.button&&!o.ctrlKey&&!o.shiftKey&&!o.altKey&&!o.metaKey&&(o.preventDefault(),t?.(o),e2({to:e,templateParams:n})),0===o.button&&(o.ctrlKey||o.metaKey)&&t?.(o),0===o.button&&o.shiftKey&&t?.(o),1===o.button&&t?.(o)},href:e0(e,n),...a},o)}let ar=({state:e,children:n,...t})=>{let{extension:o}=(0,at.useContext)(aa),a=(0,at.useRef)(null),i=(0,at.useRef)(Promise.resolve()),r=(0,at.useCallback)(n=>{o?.extensionSlotName&&o.extensionSlotModuleName&&o.extensionSlotModuleName&&!a.current&&an(n,o.extensionSlotName,o.extensionSlotModuleName,o.extensionId,void 0,e).then(e=>{a.current=e})},[]);return(0,at.useEffect)(()=>()=>{if(a&&a.current)switch(a.current.getStatus()){case"MOUNTING":a.current.mountPromise.then(()=>{a.current?.getStatus()==="MOUNTED"&&a.current.unmount()});break;case"MOUNTED":a.current.unmount();break;case"UPDATING":i.current&&i.current.then(()=>{a.current?.getStatus()==="MOUNTED"&&a.current.unmount()})}},[]),(0,at.useEffect)(()=>{a.current&&a.current.update&&"UNMOUNTING"!==a.current.getStatus()&&Promise.all([a.current.mountPromise,i.current]).then(()=>{a?.current?.getStatus()==="MOUNTED"&&a.current.update&&(i.current=a.current.update({...e}).catch(e=>{if(!(e instanceof Error)||!e.message.includes("minified message #32")||a.current?.getStatus()==="MOUNTED")throw e}))})},[e]),o?at.createElement("div",{ref:r,"data-extension-id":o?.extensionId,style:{position:"relative"},...t}):null};function as(e,n){"function"==typeof n&&(n=n(e));let t={};for(let[o,a]of Object.entries(n)){let n=function(...n){e.setState(e=>a(e,...n))};t[o]=n}return t}let al=()=>e=>e;function ac(e,n=al(),t){let[o,a]=(0,at.useState)(()=>n(e.getState()));(0,at.useEffect)(()=>P(e,n,a),[e,n]);let i=(0,at.useMemo)(()=>t?as(e,t):{},[e,t]);return{...o,...i}}function ap(e,n){return ac(e,al(),n)}function ad(e){return function(n){let[t,o]=(0,at.useState)(e.getState());(0,at.useEffect)(()=>e.subscribe(e=>o(e)),[]);let a=(0,at.useMemo)(()=>n?as(e,n):{},[n]);return{...t,...a}}}let au=e=>ac(oM(),n=>n.slots?.[e]);function af(e){let n=au(e);return n?.assignedExtensions??[]}function ag(e){let{moduleName:n}=(0,at.useContext)(aa);if(!n)throw Error("ComponentContext has not been provided. This should come from @openmrs/esm-react-utils.");return(0,at.useEffect)(()=>{oY(n,e)},[]),{extensions:af(e),extensionSlotName:e,extensionSlotModuleName:n}}function am(e){return e}function ah({name:e,extensionSlotName:n,select:t=am,children:o,state:a,style:i,...r}){if(o&&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??n,l=(0,at.useRef)(null),{extensions:c,extensionSlotModuleName:p}=ag(s),d=(0,at.useMemo)(()=>t(c),[t,c]),u=(0,at.useMemo)(()=>{if("function"==typeof o&&!at.isValidElement(o))return d.map(e=>o(e,a))},[o,d]);return at.createElement("div",{ref:l,"data-extension-slot-name":s,"data-extension-slot-module-name":p,style:{...i,position:"relative"},...r},s&&d?.map((e,n)=>at.createElement(aa.Provider,{key:e.id,value:{moduleName:p,featureName:"",extension:{extensionId:e.id,extensionSlotName:s,extensionSlotModuleName:p}}},u?.[n]??("function"!=typeof o?o:null)??at.createElement(ar,{state:a}))))}let a_=(0,B.M)()(()=>({}));O("openmrs-app-context",a_);let ay={};function ab(e,n){a_.setState(t=>(e in t||(t[e]={}),t[e]=n(t[e]),Object.assign({},t)))}function aA(e,n){let t=(0,at.useRef)(n??{}),o=(0,at.useRef)(n=>ab(e,n));return(0,at.useEffect)(()=>(!function(e,n=ay){a_.setState(t=>{if(e in t)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({},t,{[e]:n===ay?{}:n})})}(e,n??{}),()=>{a_.setState(n=>(e in n&&delete n[e],n))}),[e]),(0,at.useEffect)(()=>{let o=n??{};z(t.current,o)||(ab(e,()=>o),t.current=o)},[n]),o.current}function av({namespace:e,value:n}){return aA(e,n),null}let a$=({children:e,value:n,fallback:t})=>n?at.createElement(at.Fragment,null,e):t?at.createElement(at.Fragment,null,t):null,ak=({privilege:e,fallback:n,children:t})=>{let[o,a]=(0,at.useState)(null);return((0,at.useEffect)(()=>{let e=nc({includeAuthStatus:!1}).subscribe(a);return()=>e.unsubscribe()},[]),o&&ng(e,o))?at.createElement(at.Fragment,null,t):n?at.createElement(at.Fragment,null,n):null};var aw=t(44645),aC=t(92339),ax=t(86639),az=t(73139);let aE={strictMode:!0,throwErrorsToConsole:!0,disableTranslations:!1},aS=new Map,aM={errorRetryCount:3,fetcher:na,focusThrottleInterval:18e5,revalidateIfStale:!0,revalidateOnFocus:!1,revalidateOnReconnect:!1,refreshInterval:0,provider:()=>aS};function aB(e){if("object"!=typeof e||"string"!=typeof e.featureName||"string"!=typeof e.moduleName)throw Error("Invalid options");let n=Object.assign({},aE,e),t={...aM,...n.swrConfig};return function(e){var o,a,i,r,s;return i=a=class extends(o=at.Component){componentDidCatch(e,t){t&&t.componentStack&&(e.extra=Object.assign(e.extra||{},{componentStack:t.componentStack})),n.throwErrorsToConsole&&setTimeout(()=>{throw e}),this.setState({caughtError:e,caughtErrorInfo:t})}render(){if(this.state.caughtError)return at.createElement("div",null,"An error has occurred. Please try reloading the page.");{let o=at.createElement(at.Suspense,{fallback:null},at.createElement(az.J$,{value:t},at.createElement(aa.Provider,{value:this.state.config},n.disableTranslations?at.createElement(e,this.props):at.createElement(ax.I18nextProvider,{i18n:window.i18next,defaultNS:this.props._extensionContext?`${n.moduleName}___${this.props._extensionContext.extensionSlotName}___${this.props._extensionContext.extensionId}`:n.moduleName},at.createElement(e,this.props)))));return n.strictMode&&at.StrictMode?at.createElement(at.StrictMode,null,o):o}}constructor(e){super(e),this.state={caughtError:null,caughtErrorInfo:null,config:{moduleName:n.moduleName,featureName:n.featureName,extension:e._extensionContext}}}},r="displayName",s=`OpenmrsReactComponent(${n.featureName})`,r in i?Object.defineProperty(i,r,{value:s,enumerable:!0,configurable:!0,writable:!0}):i[r]=s,a}}function aD(e,n){return(0,aC.Z)({React:at,ReactDOMClient:aw,rootComponent:aB(n)(e)})}function aI(e,n){return()=>e().then(({default:e})=>aD(e,n))}function aO(e,n){return()=>Promise.resolve(aD(e,n))}let aT=aI;function aP(){let e=(0,at.useRef)();return(!e.current||e.current.signal.aborted)&&(e.current=new AbortController),(0,at.useEffect)(()=>{let n=e.current;return()=>n?.abort()},[]),e.current}function aN(e,n=e=>e??{}){let[t,o]=(0,at.useState)();return(0,at.useEffect)(()=>{if(null==e||""===e.replace(" ",""))throw Error(`The namespace supplied to useAppContext must be a non-empty string, but was "${e}".`)},[e]),(0,at.useEffect)(()=>{var a;let i;return(a=e=>{if(void 0!==e){let a=n?n(e):e??{};z(t,a)||o(a)}})(Object.freeze(Object.assign({},i=function(e,n=e=>e){let t=a_.getState();return e in t?Object.freeze(Object.assign({},n?n(t[e]):t[e])):null}(e)))),a_.subscribe(n=>{let t=e in n?n[e]:null;t!==i&&(i=t,a(Object.freeze(Object.assign({},t))))})},[]),t}function aF(e){let[n,t]=(0,at.useState)([]);return(0,at.useEffect)(()=>oM().subscribe(o=>{let a=o.slots[e]?.assignedExtensions.map(e=>e.id)??[];(0,ok.Z)(a,n)||t(a)}),[]),n}function aj(e,n){let{data:t,error:o,mutate:a,isLoading:i,isValidating:r}=(0,az.default)(`${nI}?patient=${e}&includeEncounterless=${n}`,na);return(0,at.useMemo)(()=>({isLoading:i,data:t?.data.results??[],error:o,mutate:a,isValidating:r}),[t,o,i,r,a])}function aW(e){(0,at.useEffect)(()=>{if(e){let e=window.getComputedStyle(document.body).overflow;return document.body.style.overflow="hidden",()=>{document.body.style.overflow=e}}},[e])}let aG={},aR=`No ComponentContext has been provided. This should come from "openmrsComponentDecorator".
|
|
16
|
-
Usually this is already applied when using "getAsyncLifecycle" or "getSyncLifecycle".`;function aq(e){let{moduleName:n,extension:t}=(0,at.useContext)(aa),o=e?.externalModuleName??n;if(!o&&!t)throw Error(aR);let a=function(e){let n=(0,at.useMemo)(()=>et(e),[e]),t=function(e){let[n,t]=(0,at.useState)(()=>{let n=e.getState();return n.loaded&&n.config?n.config:null});return(0,at.useEffect)(()=>e?.subscribe(e=>{e.loaded&&e.config&&t(e.config)}),[e]),n}(n);if(!t)throw aG[e]||(aG[e]=new Promise(e=>{let t=n.subscribe(n=>{n.loaded&&n.config&&(e(n.config),t())})})),aG[e];return t}(o),i=function(e){let n=(0,at.useMemo)(er,[]),t=function(e,n){let[t,o]=(0,at.useState)(n?()=>{let t=el(e.getState(),n.extensionSlotName,n.extensionId);if(t.loaded&&t.config)return t.config}:null);return(0,at.useEffect)(()=>{if(n)return e.subscribe(e=>{let a=el(e,n.extensionSlotName,n.extensionId);a.loaded&&a.config&&!(0,ok.Z)(a.config,t)&&o(a.config)})},[e,n,t]),t}(n,e);if(!t&&e){let t=`${e.extensionSlotName}-${e.extensionId}`;throw!aG[t]&&n&&(aG[t]=new Promise(t=>{let o=n.subscribe(n=>{let a=el(n,e.extensionSlotName,e.extensionId);a.loaded&&a.config&&(t(a.config),o())})})),aG[t]}return t||{}}(t);return(0,at.useMemo)(()=>e?.externalModuleName&&o===e.externalModuleName?{...a}:{...a,...i},[o,e?.externalModuleName,a,i])}let aL=af;function aV(){let[e,n]=(0,at.useState)(o$());return(0,at.useEffect)(()=>s(({online:e})=>n(e)),[]),e}function aH(e,n=300){let[t,o]=(0,at.useState)(e);return(0,at.useEffect)(()=>{let t=setTimeout(()=>{o(e)},n);return()=>{clearTimeout(t)}},[e,n]),t}var aU=t(19812),aX=t.n(aU);let aY=`custom:${[["admissionDecisionConcept","ref"],["admissionEncounterType","ref"],["admissionForm","ref"],["atFacilityVisitType","ref"],["bedAssignmentEncounterType","ref"],["cancelADTRequestEncounterType","ref"],["checkInClerkEncounterRole","ref"],["checkInEncounterType","ref"],["clinicianEncounterRole","ref"],["conceptSourcesForDiagnosisSearch","ref"],["consultEncounterType","ref"],["consultFreeTextCommentsConcept","ref"],["denyAdmissionConcept","ref"],["diagnosisMetadata","ref"],["diagnosisSets","ref"],["dischargeForm","ref"],["dispositionDescriptor","ref"],["dispositions","ref"],["emrApiConceptSource","ref"],["exitFromInpatientEncounterType","ref"],["extraPatientIdentifierTypes","ref"],["fullPrivilegeLevel","ref"],["highPrivilegeLevel","ref"],["identifierTypesToSearch","ref"],["inpatientNoteEncounterType","ref"],["lastViewedPatientSizeLimit","ref"],["metadataSourceName","ref"],["motherChildRelationshipType","ref"],["narrowerThanConceptMapType","ref"],["nonDiagnosisConceptSets","ref"],["orderingProviderEncounterRole","ref"],["patientDiedConcept","ref"],["personImageDirectory","ref"],["primaryIdentifierType","ref"],["sameAsConceptMapType","ref"],["suppressedDiagnosisConcepts","ref"],["supportsAdmissionLocationTag","(uuid,display,name,links)"],["supportsLoginLocationTag","(uuid,display,name,links)"],["supportsTransferLocationTag","(uuid,display,name,links)"],["supportsVisitsLocationTag","(uuid,display,name,links)"],["telephoneAttributeType","ref"],["testPatientPersonAttributeType","ref"],["transferForm","ref"],["transferRequestEncounterType","ref"],["transferWithinHospitalEncounterType","ref"],["unknownCauseOfDeathConcept","ref"],["unknownLocation","ref"],["unknownPatientPersonAttributeType","ref"],["unknownProvider","ref"],["visitAssignmentHandlerAdjustEncounterTimeOfDayIfNecessary","ref"],["visitExpireHours","ref"],["visitNoteEncounterType","ref"]].map(([e,n])=>`${e}:${n}`).join(",")}`;function aZ(){let e=aU(`${ne}/emrapi/configuration?v=${aY}`,na);return(0,at.useMemo)(()=>({emrConfiguration:e.data?.data,isLoadingEmrConfiguration:e.isLoading,mutateEmrConfiguration:e.mutate,errorFetchingEmrConfiguration:e.error}),[e])}let aJ=ad(oE());function aQ(e){let n=af(e);return(0,at.useMemo)(()=>Object.fromEntries(n.map(e=>[e.name,e.meta])),[n])}let aK=ad(oM());function a0(e){let{flags:n}=ac(oh);return n[e]?.enabled??!1}function a1(){let[,e]=(0,at.useState)(0);return(0,at.useCallback)(()=>{e(e=>e+1)},[])}function a2(e,n,t={}){return a5(e,n,a3,t)}let a3={getPaginatedUrl:(e,n,t)=>{if(!e)return null;{let o=new URL(no(e.toString()),window.location.toString());return o.searchParams.set("limit",""+n),o.searchParams.set("startIndex",""+t),o.searchParams.set("totalCount","true"),o.toString()}},getNextUrl:e=>{let n=e?.links?.find(e=>"next"==e.rel)?.uri;if(!n)return null;{let e=new URL(n);return e.host=window.location.host,e.protocol=window.location.protocol,e.toString()}},getTotalCount:e=>e?.totalCount??Number.NaN,getCurrentPageSize:e=>e?.results?.length??Number.NaN,getData:e=>e?.results};function a5(e,n,t,o={}){let{getPaginatedUrl:a,getTotalCount:i,getCurrentPageSize:r,getData:s}=t,{immutable:l,swrConfig:c}=o,p=o.fetcher??na,[d,u]=(0,at.useState)(1),f=(0,at.useRef)(Number.NaN),g=(0,at.useRef)(Number.NaN),m=(d-1)*n,h=(0,at.useMemo)(()=>a(e,n,m),[e,n,m]),{data:_,...y}=(l?aU:az.default)(h,p,c);_?.data&&(f.current=i(_?.data),g.current=r(_?.data));let b=Math.ceil(f.current/n),A=(0,at.useCallback)(e=>{0<e&&e<=b?u(e):console.warn("Invalid attempt to go to out of bounds page: "+e)},[e,d,b]),v=(0,at.useCallback)(()=>{A(d+1)},[e,d,b]),$=(0,at.useCallback)(()=>{A(d-1)},[e,d,b]);return{data:s(_?.data),totalPages:b,totalCount:f.current,currentPage:d,currentPageSize:g,paginated:b>1,showNextButton:d<b,showPreviousButton:d>1,goTo:A,goToNext:v,goToPrevious:$,...y}}function a4(e,n,t={}){return a5(e,n,a6(),t)}function a6(){return{getPaginatedUrl:(e,n,t)=>{if(!e)return null;{let o=new URL(no(e.toString()),window.location.toString());return o.searchParams.set("_count",""+n),o.searchParams.set("_getpagesoffset",""+t),o.toString()}},getNextUrl:e=>{let n=e?.link?.find(e=>"next"==e.relation)?.url;if(!n)return null;{let e=new URL(n);return e.host=window.location.host,e.protocol=window.location.protocol,e.toString()}},getTotalCount:e=>e?.total??Number.NaN,getCurrentPageSize:e=>e?.entry?.length??Number.NaN,getData:e=>e?.entry?.map(e=>e.resource)}}var a8=t(49309),a7=t.n(a8);function a9(e,n={}){return ie(e,a3,n)}function ie(e,n,t={}){let{swrInfiniteConfig:o,immutable:a}=t,{getNextUrl:i,getTotalCount:r,getData:s}=n,l=t.fetcher??na,{data:c,size:p,setSize:d,...u}=a8((0,at.useCallback)((t,o)=>0==t?e?.toString()??null:n.getNextUrl(o.data),[e]),l,{...o,...a?{revalidateIfStale:!1,revalidateOnFocus:!1,revalidateOnReconnect:!1}:{}}),f=i(c?.[c.length-1].data),g=r(c?.[0]?.data);return{data:c?.flatMap(e=>s(e.data)),totalCount:g,hasMore:null!=f,loadMore:()=>{d((c?.length??0)+1)},nextUri:f,...u}}function it(e,n={}){return io(e,a3,n)}function io(e,n,t={}){let o=ie(e,n,t),{hasMore:a,error:i,data:r,loadMore:s,isLoading:l,nextUri:c}=o;return((0,at.useEffect)(()=>{a&&!i&&s()},[a,c]),t.partialData)?o:{...o,data:a||i?void 0:r,isLoading:l||a}}function ia(e,n={}){return io(e,a6(),n)}function ii(e,n={}){return ie(e,a6(),n)}function ir(){let e="tablet";return document.body.classList.forEach(n=>{switch(n){case"omrs-breakpoint-lt-tablet":e="phone";break;case"omrs-breakpoint-gt-small-desktop":e="large-desktop";break;case"omrs-breakpoint-gt-tablet":e="small-desktop"}}),e}function is(){let[e,n]=(0,at.useState)(ir);return(0,at.useEffect)(()=>{let e=()=>{n(ir())};return window.addEventListener("resize",e),()=>window.removeEventListener("resize",e)},[]),e}let il=e=>"small-desktop"===e||"large-desktop"===e;function ic(e){let n=(0,at.useContext)(aa);(0,at.useEffect)(()=>(n&&n.moduleName&&(e.componentContext=n),oQ(e),()=>{oK(e.name)}),[n,e])}function ip(){return ac(oJ)}function id(e=null,n=null){let[t,o]=(0,at.useState)([]);return(0,at.useEffect)(()=>{let t=tN(e,n).subscribe(e=>{o(e)},e=>{console.error(e)});return()=>t.unsubscribe()},[e,n]),t}function iu(e,n=!0){let t=(0,at.useRef)(null);return(0,at.useEffect)(()=>{let o=o=>{!n||!t.current||t.current.contains(o.target)||e(o)};return window.addEventListener("mousedown",o),window.addEventListener("touchstart",o),()=>{window.removeEventListener("mousedown",o),window.removeEventListener("touchstart",o)}},[e,n]),t}function ig(e){let n=(0,at.useRef)();return(0,at.useEffect)(()=>{let t=new IntersectionObserver(n=>{for(let t of n)if(t.isIntersecting)return void e()},{threshold:1});return n.current&&t.observe(n.current),()=>{n.current&&t.unobserve(n.current)}},[n.current,e]),n}function im(e,n={}){let{abortController:t,fetchInit:o,url:a,swrConfig:i}=n,r=aP(),s=(0,at.useMemo)(()=>o?.signal??t?.signal??r.signal,[t?.signal,o?.signal,r.signal]),l=(0,at.useCallback)(e=>na(function(e,n){if(n)return"function"==typeof n?n(e):n;if("string"==typeof e)return e;throw Error(`When using useOpenmrsSWR with a key that is not a string, you must provide a url() function that converts the key to a valid url. The key for this hook is ${e}.`)}(e,a),{...o,signal:s}),[s,o,a]);return(0,az.default)(e,l,i)}function ih(e=[],n=10){let[t,o]=(0,at.useState)(1),a=(0,at.useMemo)(()=>"number"==typeof n&&n>0?Math.max(1,Math.ceil(e.length/n)):1,[e.length,n]),i=(0,at.useMemo)(()=>{let o=(t-1)*n,a=(t+0)*n;return e.slice(o,a)},[e,t,n]),r=(0,at.useCallback)(e=>{o(Math.max(1,Math.min(a,e)))},[o,a]),s=(0,at.useCallback)(()=>{t<a&&o(t+1)},[t,a,o]),l=(0,at.useCallback)(()=>{t>1&&o(t-1)},[t,o]);return(0,at.useMemo)(()=>({results:i,totalPages:a,currentPage:t,paginated:e.length>n,showNextButton:t<a,showPreviousButton:t>1,goTo:r,goToNext:s,goToPrevious:l}),[i,a,e.length,n,t,r,s,l])}function i_(){let e=/\/patient\/([a-zA-Z0-9\-]+)\/?/.exec(location.pathname);return e&&e[1]}function iy(e){let[n,t]=(0,at.useState)(e??i_()),{data:o,error:a,isValidating:i}=(0,az.default)(n?["patient",n]:null,()=>tI(n,{}));return(0,at.useEffect)(()=>{let e=()=>{let e=i_();e!==n&&t(e)};return window.addEventListener("single-spa:routing-event",e),()=>window.removeEventListener("single-spa:routing-event",e)},[n]),(0,at.useMemo)(()=>({isLoading:i&&!a&&!o,patient:o,patientUuid:n,error:a}),[i,a,o,n])}function ib(){let e=`${ne}/metadatamapping/termmapping?v=custom:(metadataUuid)&code=emr.primaryIdentifierType`,{data:n,error:t,isLoading:o}=(0,az.default)(e,na);return(0,at.useMemo)(()=>({primaryIdentifierCode:n?.data?.results[0]?.metadataUuid,isLoading:o,error:t}),[n,t,o])}function iA(e){let{extensions:n,extensionSlotModuleName:t}=ag(e);return e?n.map(n=>({state:o})=>at.createElement(aa.Provider,{value:{moduleName:t,featureName:"",extension:{extensionId:n.id,extensionSlotName:e,extensionSlotModuleName:t}}},at.createElement(ar,{state:o}))):[]}var iv=t(87530),i$=t.n(iv),ik=t(44332);let iw={setVisitContext:(e,n)=>({manuallySetVisitUuid:n?.uuid??null,patientUuid:n?.patient?.uuid??null}),mutateVisit(e){for(let n of Object.values(e.mutateVisitCallbacks??{}))n();return{}}};function iC(e){let n=(0,at.useId)();return(0,at.useEffect)(()=>{let t=tL();return e&&t.setState({mutateVisitCallbacks:{...t.getState().mutateVisitCallbacks,[n]:e}}),()=>{if(e){let e={...t.getState().mutateVisitCallbacks};delete e[n],t.setState({mutateVisitCallbacks:e})}}},[n,e]),ap(tL(),iw)}function ix(e,n=tR){let{patientUuid:t,manuallySetVisitUuid:o,setVisitContext:a}=iC(),i=e&&t==e?o:null,r=`?patient=${e}&v=${n}&includeInactive=false`,s=`/${i}?v=${n}`,{data:l,error:c,mutate:p,isValidating:d}=(0,az.default)(e?`${ne}/visit${r}`:null,na),{data:u,error:f,mutate:g,isValidating:m}=(0,az.default)(e&&i?`${ne}/visit${s}`:null,na),h=(0,at.useMemo)(()=>l?.data.results.find(e=>null===e.stopDatetime)??null,[l]),_=(0,at.useMemo)(()=>i&&u?u.data:null,[u,i]),y=(0,at.useRef)(null);(0,at.useEffect)(()=>{!d&&h&&(t!=e||null==o)&&a(h),m||(y.current&&_&&y.current.uuid===_.uuid&&!y.current.stopDatetime&&_.stopDatetime&&a(null),y.current=_)},[_,o,h,d,m,t]);let b=(0,at.useCallback)(()=>{p(),g()},[p,g]);return iC(b),{error:c||f,mutate:b,isValidating:d||m,activeVisit:h,currentVisit:_,currentVisitIsRetrospective:!!i,isLoading:!!((!l||i&&!u)&&(!c||!f))}}function iz(){let[e,n]=(0,at.useState)([]);return(0,at.useEffect)(()=>{let e=tj().subscribe(e=>{n(e)},e=>console.error(e));return()=>e.unsubscribe()},[]),e}function iE(){let e=(0,at.useRef)(),[n,t]=(0,at.useState)(null),a=null;if(!n){if(o){let e=np().getState();e.loaded&&(a=e.session)}else o=new Promise(n=>{let t=({loaded:t,session:o})=>{t&&(n(o),a=o,e.current&&(e.current(),e.current=void 0))};t(np().getState()),a||(e.current=np().subscribe(t))});if(a)t(a);else throw o}(0,at.useEffect)(()=>(e.current||(e.current=np().subscribe(({loaded:e,session:n})=>{e&&(a=n,t(n))})),()=>{e.current&&(e.current(),e.current=void 0)}),[]);let i=n||a;if(!i)if(o)throw console.warn("useSession is in an unexpected state. Attempting to recover."),o;else throw Error("useSession is in an invalid state.");return i}iv.extend(ik);let iS="openmrs-routes:",iM={bootstrap:()=>Promise.resolve(),mount:()=>Promise.resolve(),unmount:()=>Promise.resolve()},iB=new Map;function iD(e,n){return async()=>{let t=n.indexOf("#"),o=t>=0,a=o?n.substring(0,t):e,i=o?n.substring(t+1):n,r=await nS(a);return r&&Object.hasOwn(r,i)&&"function"==typeof r[i]?iI(a,r).then(()=>r[i]()):(r?r&&Object.hasOwn(r,i)?console.warn(`The export ${n}, defined in ${e}'s routes.json, is not a function`):console.warn(`${a} does not define a component called "${i}", referenced in ${e}'s routes.json. This cannot be loaded.`):console.warn(`Unknown app ${a} for ${n} defined in ${e}'s routes.json`),iM)}}async function iI(e,n){if(e in iB)await iB[e];else{let t=n??await nS(e);await (iB[e]=new Promise((n,o)=>{if(Object.hasOwn(t,"startupApp")){let a=t.startupApp;if("function"==typeof a)return Promise.resolve(a()).then(()=>{e_(e),n(null)}).catch(o)}e_(e),n(null)}))}}function iO(e,n){let t,o=n.name;if(!o)return void console.error(`An extension definition in ${e} is missing an name and thus cannot be
|
|
16
|
+
Usually this is already applied when using "getAsyncLifecycle" or "getSyncLifecycle".`;function aq(e){let{moduleName:n,extension:t}=(0,at.useContext)(aa),o=e?.externalModuleName??n;if(!o&&!t)throw Error(aR);let a=function(e){let n=(0,at.useMemo)(()=>et(e),[e]),t=function(e){let[n,t]=(0,at.useState)(()=>{let n=e.getState();return n.loaded&&n.config?n.config:null});return(0,at.useEffect)(()=>e?.subscribe(e=>{e.loaded&&e.config&&t(e.config)}),[e]),n}(n);if(!t)throw aG[e]||(aG[e]=new Promise(e=>{let t=n.subscribe(n=>{n.loaded&&n.config&&(e(n.config),t())})})),aG[e];return t}(o),i=function(e){let n=(0,at.useMemo)(er,[]),t=function(e,n){let[t,o]=(0,at.useState)(n?()=>{let t=el(e.getState(),n.extensionSlotName,n.extensionId);if(t.loaded&&t.config)return t.config}:null);return(0,at.useEffect)(()=>{if(n)return e.subscribe(e=>{let a=el(e,n.extensionSlotName,n.extensionId);a.loaded&&a.config&&!(0,ok.Z)(a.config,t)&&o(a.config)})},[e,n,t]),t}(n,e);if(!t&&e){let t=`${e.extensionSlotName}-${e.extensionId}`;throw!aG[t]&&n&&(aG[t]=new Promise(t=>{let o=n.subscribe(n=>{let a=el(n,e.extensionSlotName,e.extensionId);a.loaded&&a.config&&(t(a.config),o())})})),aG[t]}return t||{}}(t);return(0,at.useMemo)(()=>e?.externalModuleName&&o===e.externalModuleName?{...a}:{...a,...i},[o,e?.externalModuleName,a,i])}let aL=af;function aV(){let[e,n]=(0,at.useState)(o$());return(0,at.useEffect)(()=>s(({online:e})=>n(e)),[]),e}function aH(e,n=300){let[t,o]=(0,at.useState)(e);return(0,at.useEffect)(()=>{let t=setTimeout(()=>{o(e)},n);return()=>{clearTimeout(t)}},[e,n]),t}var aU=t(19812),aX=t.n(aU);let aY=`custom:${[["admissionDecisionConcept","ref"],["admissionEncounterType","ref"],["admissionForm","ref"],["atFacilityVisitType","ref"],["bedAssignmentEncounterType","ref"],["cancelADTRequestEncounterType","ref"],["checkInClerkEncounterRole","ref"],["checkInEncounterType","ref"],["clinicianEncounterRole","ref"],["conceptSourcesForDiagnosisSearch","ref"],["consultEncounterType","ref"],["consultFreeTextCommentsConcept","ref"],["denyAdmissionConcept","ref"],["diagnosisMetadata","ref"],["diagnosisSets","ref"],["dischargeForm","ref"],["dispositionDescriptor","ref"],["dispositions","ref"],["emrApiConceptSource","ref"],["exitFromInpatientEncounterType","ref"],["extraPatientIdentifierTypes","ref"],["fullPrivilegeLevel","ref"],["highPrivilegeLevel","ref"],["identifierTypesToSearch","ref"],["inpatientNoteEncounterType","ref"],["lastViewedPatientSizeLimit","ref"],["metadataSourceName","ref"],["motherChildRelationshipType","ref"],["narrowerThanConceptMapType","ref"],["nonDiagnosisConceptSets","ref"],["orderingProviderEncounterRole","ref"],["patientDiedConcept","ref"],["personImageDirectory","ref"],["primaryIdentifierType","ref"],["sameAsConceptMapType","ref"],["suppressedDiagnosisConcepts","ref"],["supportsAdmissionLocationTag","(uuid,display,name,links)"],["supportsLoginLocationTag","(uuid,display,name,links)"],["supportsTransferLocationTag","(uuid,display,name,links)"],["supportsVisitsLocationTag","(uuid,display,name,links)"],["telephoneAttributeType","ref"],["testPatientPersonAttributeType","ref"],["transferForm","ref"],["transferRequestEncounterType","ref"],["transferWithinHospitalEncounterType","ref"],["unknownCauseOfDeathConcept","ref"],["unknownLocation","ref"],["unknownPatientPersonAttributeType","ref"],["unknownProvider","ref"],["visitAssignmentHandlerAdjustEncounterTimeOfDayIfNecessary","ref"],["visitExpireHours","ref"],["visitNoteEncounterType","ref"]].map(([e,n])=>`${e}:${n}`).join(",")}`;function aZ(){let e=aU(`${ne}/emrapi/configuration?v=${aY}`,na);return(0,at.useMemo)(()=>({emrConfiguration:e.data?.data,isLoadingEmrConfiguration:e.isLoading,mutateEmrConfiguration:e.mutate,errorFetchingEmrConfiguration:e.error}),[e])}let aJ=ad(oE());function aQ(e){let n=af(e);return(0,at.useMemo)(()=>Object.fromEntries(n.map(e=>[e.name,e.meta])),[n])}let aK=ad(oM());function a0(e){let{flags:n}=ac(oh);return n[e]?.enabled??!1}function a1(){let[,e]=(0,at.useState)(0);return(0,at.useCallback)(()=>{e(e=>e+1)},[])}function a2(e,n,t={}){return a5(e,n,a3,t)}let a3={getPaginatedUrl:(e,n,t)=>{if(!e)return null;{let o=new URL(no(e.toString()),window.location.toString());return o.searchParams.set("limit",""+n),o.searchParams.set("startIndex",""+t),o.searchParams.set("totalCount","true"),o.toString()}},getNextUrl:e=>{let n=e?.links?.find(e=>"next"==e.rel)?.uri;if(!n)return null;{let e=new URL(n);return e.host=window.location.host,e.protocol=window.location.protocol,e.toString()}},getTotalCount:e=>e?.totalCount??Number.NaN,getCurrentPageSize:e=>e?.results?.length??Number.NaN,getData:e=>e?.results};function a5(e,n,t,o={}){let{getPaginatedUrl:a,getTotalCount:i,getCurrentPageSize:r,getData:s}=t,{immutable:l,swrConfig:c}=o,p=o.fetcher??na,[d,u]=(0,at.useState)(1),f=(0,at.useRef)(Number.NaN),g=(0,at.useRef)(Number.NaN),m=(d-1)*n,h=(0,at.useMemo)(()=>a(e,n,m),[e,n,m]),{data:_,...y}=(l?aU:az.default)(h,p,c);_?.data&&(f.current=i(_?.data),g.current=r(_?.data));let b=Math.ceil(f.current/n),A=(0,at.useCallback)(e=>{0<e&&e<=b?u(e):console.warn("Invalid attempt to go to out of bounds page: "+e)},[e,d,b]),v=(0,at.useCallback)(()=>{A(d+1)},[e,d,b]),$=(0,at.useCallback)(()=>{A(d-1)},[e,d,b]);return{data:s(_?.data),totalPages:b,totalCount:f.current,currentPage:d,currentPageSize:g,paginated:b>1,showNextButton:d<b,showPreviousButton:d>1,goTo:A,goToNext:v,goToPrevious:$,...y}}function a4(e,n,t={}){return a5(e,n,a6(),t)}function a6(){return{getPaginatedUrl:(e,n,t)=>{if(!e)return null;{let o=new URL(no(e.toString()),window.location.toString());return o.searchParams.set("_count",""+n),o.searchParams.set("_getpagesoffset",""+t),o.toString()}},getNextUrl:e=>{let n=e?.link?.find(e=>"next"==e.relation)?.url;if(!n)return null;{let e=new URL(n);return e.host=window.location.host,e.protocol=window.location.protocol,e.toString()}},getTotalCount:e=>e?.total??Number.NaN,getCurrentPageSize:e=>e?.entry?.length??Number.NaN,getData:e=>e?.entry?.map(e=>e.resource)}}var a8=t(49309),a7=t.n(a8);function a9(e,n={}){return ie(e,a3,n)}function ie(e,n,t={}){let{swrInfiniteConfig:o,immutable:a}=t,{getNextUrl:i,getTotalCount:r,getData:s}=n,l=t.fetcher??na,{data:c,size:p,setSize:d,...u}=a8((0,at.useCallback)((t,o)=>0==t?e?.toString()??null:n.getNextUrl(o.data),[e]),l,{...o,...a?{revalidateIfStale:!1,revalidateOnFocus:!1,revalidateOnReconnect:!1}:{}}),f=i(c?.[c.length-1].data),g=r(c?.[0]?.data);return{data:c?.flatMap(e=>s(e.data)),totalCount:g,hasMore:null!=f,loadMore:()=>{d((c?.length??0)+1)},nextUri:f,...u}}function it(e,n={}){return io(e,a3,n)}function io(e,n,t={}){let o=ie(e,n,t),{hasMore:a,error:i,data:r,loadMore:s,isLoading:l,nextUri:c}=o;return((0,at.useEffect)(()=>{a&&!i&&s()},[a,c]),t.partialData)?o:{...o,data:a||i?void 0:r,isLoading:l||a}}function ia(e,n={}){return io(e,a6(),n)}function ii(e,n={}){return ie(e,a6(),n)}function ir(){let e="tablet";return document.body.classList.forEach(n=>{switch(n){case"omrs-breakpoint-lt-tablet":e="phone";break;case"omrs-breakpoint-gt-small-desktop":e="large-desktop";break;case"omrs-breakpoint-gt-tablet":e="small-desktop"}}),e}function is(){let[e,n]=(0,at.useState)(ir);return(0,at.useEffect)(()=>{let e=()=>{n(ir())};return window.addEventListener("resize",e),()=>window.removeEventListener("resize",e)},[]),e}let il=e=>"small-desktop"===e||"large-desktop"===e;function ic(e){let n=(0,at.useContext)(aa);(0,at.useEffect)(()=>(n&&n.moduleName&&(e.componentContext=n),oQ(e),()=>{oK(e.name)}),[n,e])}function ip(){return ac(oJ)}function id(e=null,n=null){let[t,o]=(0,at.useState)([]);return(0,at.useEffect)(()=>{let t=tN(e,n).subscribe(e=>{o(e)},e=>{console.error(e)});return()=>t.unsubscribe()},[e,n]),t}function iu(e,n=!0){let t=(0,at.useRef)(null);return(0,at.useEffect)(()=>{let o=o=>{!n||!t.current||t.current.contains(o.target)||e(o)};return window.addEventListener("mousedown",o),window.addEventListener("touchstart",o),()=>{window.removeEventListener("mousedown",o),window.removeEventListener("touchstart",o)}},[e,n]),t}function ig(e){let n=(0,at.useRef)();return(0,at.useEffect)(()=>{let t=new IntersectionObserver(n=>{for(let t of n)if(t.isIntersecting)return void e()},{threshold:1});return n.current&&t.observe(n.current),()=>{n.current&&t.unobserve(n.current)}},[n.current,e]),n}function im(e,n={}){let{abortController:t,fetchInit:o,url:a,swrConfig:i}=n,r=aP(),s=(0,at.useMemo)(()=>o?.signal??t?.signal??r.signal,[t?.signal,o?.signal,r.signal]),l=(0,at.useCallback)(e=>na(function(e,n){if(n)return"function"==typeof n?n(e):n;if("string"==typeof e)return e;throw Error(`When using useOpenmrsSWR with a key that is not a string, you must provide a url() function that converts the key to a valid url. The key for this hook is ${e}.`)}(e,a),{...o,signal:s}),[s,o,a]);return(0,az.default)(e,l,i)}function ih(e=[],n=10){let[t,o]=(0,at.useState)(1),a=(0,at.useMemo)(()=>"number"==typeof n&&n>0?Math.max(1,Math.ceil(e.length/n)):1,[e.length,n]),i=(0,at.useMemo)(()=>{let o=(t-1)*n,a=(t+0)*n;return e.slice(o,a)},[e,t,n]),r=(0,at.useCallback)(e=>{o(Math.max(1,Math.min(a,e)))},[o,a]),s=(0,at.useCallback)(()=>{t<a&&o(t+1)},[t,a,o]),l=(0,at.useCallback)(()=>{t>1&&o(t-1)},[t,o]);return(0,at.useMemo)(()=>({results:i,totalPages:a,currentPage:t,paginated:e.length>n,showNextButton:t<a,showPreviousButton:t>1,goTo:r,goToNext:s,goToPrevious:l}),[i,a,e.length,n,t,r,s,l])}function i_(){let e=/\/patient\/([a-zA-Z0-9\-]+)\/?/.exec(location.pathname);return e&&e[1]}function iy(e){let[n,t]=(0,at.useState)(e??i_()),{data:o,error:a,isValidating:i}=(0,az.default)(n?["patient",n]:null,()=>tI(n,{}));return(0,at.useEffect)(()=>{let e=()=>{let e=i_();e!==n&&t(e)};return window.addEventListener("single-spa:routing-event",e),()=>window.removeEventListener("single-spa:routing-event",e)},[n]),(0,at.useMemo)(()=>({isLoading:i&&!a&&!o,patient:o,patientUuid:n,error:a}),[i,a,o,n])}function ib(){let e=`${ne}/metadatamapping/termmapping?v=custom:(metadataUuid)&code=emr.primaryIdentifierType`,{data:n,error:t,isLoading:o}=(0,az.default)(e,na);return(0,at.useMemo)(()=>({primaryIdentifierCode:n?.data?.results[0]?.metadataUuid,isLoading:o,error:t}),[n,t,o])}function iA(e){let{extensions:n,extensionSlotModuleName:t}=ag(e);return e?n.map(n=>({state:o})=>at.createElement(aa.Provider,{value:{moduleName:t,featureName:"",extension:{extensionId:n.id,extensionSlotName:e,extensionSlotModuleName:t}}},at.createElement(ar,{state:o}))):[]}var iv=t(87530),i$=t.n(iv),ik=t(44332);let iw={setVisitContext:(e,n)=>null==n?{manuallySetVisitUuid:null}:{manuallySetVisitUuid:n.uuid,patientUuid:n.patient?.uuid},mutateVisit(e){for(let n of Object.values(e.mutateVisitCallbacks??{}))n();return{}}};function iC(e){let n=(0,at.useId)();return(0,at.useEffect)(()=>{let t=tL();return e&&t.setState({mutateVisitCallbacks:{...t.getState().mutateVisitCallbacks,[n]:e}}),()=>{if(e){let e={...t.getState().mutateVisitCallbacks};delete e[n],t.setState({mutateVisitCallbacks:e})}}},[n,e]),ap(tL(),iw)}function ix(e,n=tR){let{patientUuid:t,manuallySetVisitUuid:o,setVisitContext:a}=iC(),i=e&&t==e?o:null,r=`?patient=${e}&v=${n}&includeInactive=false`,s=`/${i}?v=${n}`,{data:l,error:c,mutate:p,isValidating:d}=(0,az.default)(e?`${ne}/visit${r}`:null,na),{data:u,error:f,mutate:g,isValidating:m}=(0,az.default)(e&&i?`${ne}/visit${s}`:null,na),h=(0,at.useMemo)(()=>l?.data.results.find(e=>null===e.stopDatetime)??null,[l]),_=(0,at.useMemo)(()=>i&&u?u.data:null,[u,i]),y=(0,at.useRef)(null);(0,at.useEffect)(()=>{!d&&h&&t===e&&null===o&&a(h),m||(y.current&&_&&y.current.uuid===_.uuid&&!y.current.stopDatetime&&_.stopDatetime&&a(null),y.current=_)},[_,o,h,d,m,t]);let b=(0,at.useCallback)(()=>{p(),g()},[p,g]);return iC(b),{error:c||f,mutate:b,isValidating:d||m,activeVisit:h,currentVisit:_,currentVisitIsRetrospective:!!i,isLoading:!!((!l||i&&!u)&&(!c||!f))}}function iz(){let[e,n]=(0,at.useState)([]);return(0,at.useEffect)(()=>{let e=tj().subscribe(e=>{n(e)},e=>console.error(e));return()=>e.unsubscribe()},[]),e}function iE(){let e=(0,at.useRef)(),[n,t]=(0,at.useState)(null),a=null;if(!n){if(o){let e=np().getState();e.loaded&&(a=e.session)}else o=new Promise(n=>{let t=({loaded:t,session:o})=>{t&&(n(o),a=o,e.current&&(e.current(),e.current=void 0))};t(np().getState()),a||(e.current=np().subscribe(t))});if(a)t(a);else throw o}(0,at.useEffect)(()=>(e.current||(e.current=np().subscribe(({loaded:e,session:n})=>{e&&(a=n,t(n))})),()=>{e.current&&(e.current(),e.current=void 0)}),[]);let i=n||a;if(!i)if(o)throw console.warn("useSession is in an unexpected state. Attempting to recover."),o;else throw Error("useSession is in an invalid state.");return i}iv.extend(ik);let iS="openmrs-routes:",iM={bootstrap:()=>Promise.resolve(),mount:()=>Promise.resolve(),unmount:()=>Promise.resolve()},iB=new Map;function iD(e,n){return async()=>{let t=n.indexOf("#"),o=t>=0,a=o?n.substring(0,t):e,i=o?n.substring(t+1):n,r=await nS(a);return r&&Object.hasOwn(r,i)&&"function"==typeof r[i]?iI(a,r).then(()=>r[i]()):(r?r&&Object.hasOwn(r,i)?console.warn(`The export ${n}, defined in ${e}'s routes.json, is not a function`):console.warn(`${a} does not define a component called "${i}", referenced in ${e}'s routes.json. This cannot be loaded.`):console.warn(`Unknown app ${a} for ${n} defined in ${e}'s routes.json`),iM)}}async function iI(e,n){if(e in iB)await iB[e];else{let t=n??await nS(e);await (iB[e]=new Promise((n,o)=>{if(Object.hasOwn(t,"startupApp")){let a=t.startupApp;if("function"==typeof a)return Promise.resolve(a()).then(()=>{e_(e),n(null)}).catch(o)}e_(e),n(null)}))}}function iO(e,n){let t,o=n.name;if(!o)return void console.error(`An extension definition in ${e} is missing an name and thus cannot be
|
|
17
17
|
registered. To fix this, ensure that you define the "name" field inside the
|
|
18
18
|
extension definition.`,n);n.slots&&n.slot&&console.warn(`The extension ${o} from ${e} declares both a 'slots' property and
|
|
19
19
|
a 'slot' property. Only the 'slots' property will be honored.`);let a=n.slots?n.slots:n.slot?[n.slot]:[];if(!n.component&&!n.load)return void console.error(`The extension ${o} from ${e} is missing a 'component' entry and thus cannot be registered.
|