@openmrs/esm-api 5.3.3-pre.1383 → 5.3.3-pre.1386
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
CHANGED
|
@@ -1,17 +1,14 @@
|
|
|
1
|
-
[35m@openmrs/esm-api:build[0m: cache hit, replaying output [
|
|
2
|
-
[35m@openmrs/esm-api:build: [
|
|
3
|
-
[35m@openmrs/esm-api:build: [
|
|
4
|
-
[35m@openmrs/esm-api:build: [
|
|
5
|
-
[35m@openmrs/esm-api:build: [
|
|
6
|
-
[35m@openmrs/esm-api:build: [0morphan modules 440 KiB [1m[33m[orphan][39m[22m 237 modules
|
|
7
|
-
[35m@openmrs/esm-api:build: [0mruntime modules 891 bytes 4 modules
|
|
8
|
-
[35m@openmrs/esm-api:build: [0mbuilt modules 140 KiB [1m[33m[built][39m[22m
|
|
1
|
+
[35m@openmrs/esm-api:build[0m: cache hit, replaying output [2m98dd85fbf6fb1a26[0m
|
|
2
|
+
[35m@openmrs/esm-api:build: [0masset [1m[32mopenmrs-esm-api.js[39m[22m 53 KiB [1m[32m[emitted][39m[22m [1m[32m[minimized][39m[22m (name: main) 2 related assets
|
|
3
|
+
[35m@openmrs/esm-api:build: [0morphan modules 439 KiB [1m[33m[orphan][39m[22m 237 modules
|
|
4
|
+
[35m@openmrs/esm-api:build: [0mruntime modules 670 bytes 3 modules
|
|
5
|
+
[35m@openmrs/esm-api:build: [0mbuilt modules 138 KiB [1m[33m[built][39m[22m
|
|
9
6
|
[35m@openmrs/esm-api:build: [0m modules by path [1mexternal "@openmrs/[39m[22m 168 bytes
|
|
10
7
|
[35m@openmrs/esm-api:build: [0m [1mexternal "@openmrs/esm-config"[39m[22m 42 bytes [1m[33m[built][39m[22m [1m[33m[code generated][39m[22m
|
|
11
8
|
[35m@openmrs/esm-api:build: [0m [1mexternal "@openmrs/esm-navigation"[39m[22m 42 bytes [1m[33m[built][39m[22m [1m[33m[code generated][39m[22m
|
|
12
9
|
[35m@openmrs/esm-api:build: [0m [1mexternal "@openmrs/esm-error-handling"[39m[22m 42 bytes [1m[33m[built][39m[22m [1m[33m[code generated][39m[22m
|
|
13
10
|
[35m@openmrs/esm-api:build: [0m [1mexternal "@openmrs/esm-offline"[39m[22m 42 bytes [1m[33m[built][39m[22m [1m[33m[code generated][39m[22m
|
|
14
|
-
[35m@openmrs/esm-api:build: [0m cacheable modules
|
|
15
|
-
[35m@openmrs/esm-api:build: [0m [1m./src/index.ts + 51 modules[39m[22m
|
|
11
|
+
[35m@openmrs/esm-api:build: [0m cacheable modules 138 KiB
|
|
12
|
+
[35m@openmrs/esm-api:build: [0m [1m./src/index.ts + 51 modules[39m[22m 134 KiB [1m[33m[built][39m[22m [1m[33m[code generated][39m[22m
|
|
16
13
|
[35m@openmrs/esm-api:build: [0m [1m../esm-state/dist/openmrs-esm-state.js[39m[22m 4.17 KiB [1m[33m[built][39m[22m [1m[33m[code generated][39m[22m
|
|
17
|
-
[35m@openmrs/esm-api:build: [0mwebpack 5.88.0 compiled [1m[32msuccessfully[39m[22m in
|
|
14
|
+
[35m@openmrs/esm-api:build: [0mwebpack 5.88.0 compiled [1m[32msuccessfully[39m[22m in 3987 ms
|
package/dist/openmrs-esm-api.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
/*! For license information please see openmrs-esm-api.js.LICENSE.txt */
|
|
2
|
-
System.register(["@openmrs/esm-config","@openmrs/esm-navigation","@openmrs/esm-error-handling","@openmrs/esm-offline"],(function(t,e){var n={},r={},o={},i={};return{setters:[function(t){n.Type=t.Type,n.defineConfigSchema=t.defineConfigSchema,n.getConfig=t.getConfig,n.validators=t.validators},function(t){r.navigate=t.navigate},function(t){o.reportError=t.reportError},function(t){i.getSynchronizationItems=t.getSynchronizationItems}],execute:function(){t((()=>{var t={385:()=>{System.register([],(function(t,e){return{execute:function(){t(function(){"use strict";var t=function(t,e){var n=s[t];if(n)return n.active?console.error("Cannot override an existing store. Make sure that stores are only created once."):n.value.setState(e,!0),n.active=!0,n.value;var r=u()((function(){return e}));return s[t]={value:r,active:!0},r},e=function(t,e){var n=s[t];if(!n){var r=u()((function(){return null!=e?e:{}}));return s[t]={value:r,active:!1},r}return n.value},n=function(t,e,n){var r=e(t.getState());return t.subscribe((function(t){var o=e(t);o!==r&&(r=o,n(o))}))},r={d:function(t,e){for(var n in e)r.o(e,n)&&!r.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:e[n]})},o:function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},r:function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})}},o={};r.r(o),r.d(o,{createGlobalStore:function(){return t},getGlobalStore:function(){return e},subscribeTo:function(){return n}});var i=function(t){var e,n=new Set,r=function(t,r){var o="function"==typeof t?t(e):t;if(!Object.is(o,e)){var i=e;e=(null!=r?r:"object"!=typeof o)?o:Object.assign({},e,o),n.forEach((function(t){return t(e,i)}))}},o=function(){return e},i={setState:r,getState:o,subscribe:function(t){return n.add(t),function(){return n.delete(t)}},destroy:function(){console.warn("[DEPRECATED] The `destroy` method will be unsupported in a future version. Instead use unsubscribe function returned by subscribe. Everything will be garbage-collected if store is garbage-collected."),n.clear()}};return e=t(r,o,i),i},u=function(t){return t?i(t):i},s={};return setTimeout((function(){"development"===window.spaEnv&&(window.stores=s)}),1e3),o}())}}}))},824:t=>{"use strict";t.exports=n},254:t=>{"use strict";t.exports=o},513:t=>{"use strict";t.exports=r},738:t=>{"use strict";t.exports=i}},e={};function u(n){var r=e[n];if(void 0!==r)return r.exports;var o=e[n]={exports:{}};return t[n](o,o.exports,u),o.exports}u.d=(t,e)=>{for(var n in e)u.o(e,n)&&!u.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:e[n]})},u.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(t){if("object"==typeof window)return window}}(),u.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),u.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})};var s={};return(()=>{"use strict";u.r(s),u.d(s,{OpenmrsFetchError:()=>Fe,VisitMode:()=>Kn,VisitStatus:()=>qn,attachmentUrl:()=>$e,backendDependencies:()=>nr,clearCurrentUser:()=>cn,createAttachment:()=>Ye,defaultVisitCustomRepresentation:()=>Wn,deleteAttachmentPermanently:()=>qe,fetchCurrentPatient:()=>_n,fhirBaseUrl:()=>Re,getAttachmentByUuid:()=>Je,getAttachments:()=>ze,getCurrentUser:()=>on,getLocations:()=>er,getLoggedInUser:()=>fn,getSessionLocation:()=>pn,getSessionStore:()=>un,getStartedVisit:()=>Qn,getVisitStore:()=>Hn,getVisitTypes:()=>Zn,getVisitsForPatient:()=>Jn,makeUrl:()=>Ge,openmrsFetch:()=>Ve,openmrsObservableFetch:()=>We,refetchCurrentUser:()=>an,restBaseUrl:()=>Le,saveVisit:()=>zn,sessionEndpoint:()=>Be,setCurrentVisit:()=>$n,setSessionLocation:()=>hn,setUserLanguage:()=>sn,setUserProperties:()=>vn,setupApiModule:()=>yn,toLocationObject:()=>tr,toVisitTypeObject:()=>Xn,updateVisit:()=>Yn,userHasAccess:()=>ln});var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])},t(e,n)};function e(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}function n(t){return"function"==typeof t}var r=!1,o={Promise:void 0,set useDeprecatedSynchronousErrorHandling(t){t&&(new Error).stack,r=t},get useDeprecatedSynchronousErrorHandling(){return r}};function i(t){setTimeout((function(){throw t}),0)}var a={closed:!0,next:function(t){},error:function(t){if(o.useDeprecatedSynchronousErrorHandling)throw t;i(t)},complete:function(){}},c=function(){return Array.isArray||function(t){return t&&"number"==typeof t.length}}();function l(t){return null!==t&&"object"==typeof t}var f=function(){function t(t){return Error.call(this),this.message=t?t.length+" errors occurred during unsubscription:\n"+t.map((function(t,e){return e+1+") "+t.toString()})).join("\n "):"",this.name="UnsubscriptionError",this.errors=t,this}return t.prototype=Object.create(Error.prototype),t}(),p=f,h=function(){function t(t){this.closed=!1,this._parentOrParents=null,this._subscriptions=null,t&&(this._ctorUnsubscribe=!0,this._unsubscribe=t)}return t.prototype.unsubscribe=function(){var e;if(!this.closed){var r=this,o=r._parentOrParents,i=r._ctorUnsubscribe,u=r._unsubscribe,s=r._subscriptions;if(this.closed=!0,this._parentOrParents=null,this._subscriptions=null,o instanceof t)o.remove(this);else if(null!==o)for(var a=0;a<o.length;++a)o[a].remove(this);if(n(u)){i&&(this._unsubscribe=void 0);try{u.call(this)}catch(t){e=t instanceof p?d(t.errors):[t]}}if(c(s)){a=-1;for(var f=s.length;++a<f;){var h=s[a];if(l(h))try{h.unsubscribe()}catch(t){e=e||[],t instanceof p?e=e.concat(d(t.errors)):e.push(t)}}}if(e)throw new p(e)}},t.prototype.add=function(e){var n=e;if(!e)return t.EMPTY;switch(typeof e){case"function":n=new t(e);case"object":if(n===this||n.closed||"function"!=typeof n.unsubscribe)return n;if(this.closed)return n.unsubscribe(),n;if(!(n instanceof t)){var r=n;(n=new t)._subscriptions=[r]}break;default:throw new Error("unrecognized teardown "+e+" added to Subscription.")}var o=n._parentOrParents;if(null===o)n._parentOrParents=this;else if(o instanceof t){if(o===this)return n;n._parentOrParents=[o,this]}else{if(-1!==o.indexOf(this))return n;o.push(this)}var i=this._subscriptions;return null===i?this._subscriptions=[n]:i.push(n),n},t.prototype.remove=function(t){var e=this._subscriptions;if(e){var n=e.indexOf(t);-1!==n&&e.splice(n,1)}},t.EMPTY=function(t){return t.closed=!0,t}(new t),t}();function d(t){return t.reduce((function(t,e){return t.concat(e instanceof p?e.errors:e)}),[])}var v=function(){return"function"==typeof Symbol?Symbol("rxSubscriber"):"@@rxSubscriber_"+Math.random()}(),b=function(t){function n(e,r,o){var i=t.call(this)||this;switch(i.syncErrorValue=null,i.syncErrorThrown=!1,i.syncErrorThrowable=!1,i.isStopped=!1,arguments.length){case 0:i.destination=a;break;case 1:if(!e){i.destination=a;break}if("object"==typeof e){e instanceof n?(i.syncErrorThrowable=e.syncErrorThrowable,i.destination=e,e.add(i)):(i.syncErrorThrowable=!0,i.destination=new y(i,e));break}default:i.syncErrorThrowable=!0,i.destination=new y(i,e,r,o)}return i}return e(n,t),n.prototype[v]=function(){return this},n.create=function(t,e,r){var o=new n(t,e,r);return o.syncErrorThrowable=!1,o},n.prototype.next=function(t){this.isStopped||this._next(t)},n.prototype.error=function(t){this.isStopped||(this.isStopped=!0,this._error(t))},n.prototype.complete=function(){this.isStopped||(this.isStopped=!0,this._complete())},n.prototype.unsubscribe=function(){this.closed||(this.isStopped=!0,t.prototype.unsubscribe.call(this))},n.prototype._next=function(t){this.destination.next(t)},n.prototype._error=function(t){this.destination.error(t),this.unsubscribe()},n.prototype._complete=function(){this.destination.complete(),this.unsubscribe()},n.prototype._unsubscribeAndRecycle=function(){var t=this._parentOrParents;return this._parentOrParents=null,this.unsubscribe(),this.closed=!1,this.isStopped=!1,this._parentOrParents=t,this},n}(h),y=function(t){function r(e,r,o,i){var u,s=t.call(this)||this;s._parentSubscriber=e;var c=s;return n(r)?u=r:r&&(u=r.next,o=r.error,i=r.complete,r!==a&&(n((c=Object.create(r)).unsubscribe)&&s.add(c.unsubscribe.bind(c)),c.unsubscribe=s.unsubscribe.bind(s))),s._context=c,s._next=u,s._error=o,s._complete=i,s}return e(r,t),r.prototype.next=function(t){if(!this.isStopped&&this._next){var e=this._parentSubscriber;o.useDeprecatedSynchronousErrorHandling&&e.syncErrorThrowable?this.__tryOrSetError(e,this._next,t)&&this.unsubscribe():this.__tryOrUnsub(this._next,t)}},r.prototype.error=function(t){if(!this.isStopped){var e=this._parentSubscriber,n=o.useDeprecatedSynchronousErrorHandling;if(this._error)n&&e.syncErrorThrowable?(this.__tryOrSetError(e,this._error,t),this.unsubscribe()):(this.__tryOrUnsub(this._error,t),this.unsubscribe());else if(e.syncErrorThrowable)n?(e.syncErrorValue=t,e.syncErrorThrown=!0):i(t),this.unsubscribe();else{if(this.unsubscribe(),n)throw t;i(t)}}},r.prototype.complete=function(){var t=this;if(!this.isStopped){var e=this._parentSubscriber;if(this._complete){var n=function(){return t._complete.call(t._context)};o.useDeprecatedSynchronousErrorHandling&&e.syncErrorThrowable?(this.__tryOrSetError(e,n),this.unsubscribe()):(this.__tryOrUnsub(n),this.unsubscribe())}else this.unsubscribe()}},r.prototype.__tryOrUnsub=function(t,e){try{t.call(this._context,e)}catch(t){if(this.unsubscribe(),o.useDeprecatedSynchronousErrorHandling)throw t;i(t)}},r.prototype.__tryOrSetError=function(t,e,n){if(!o.useDeprecatedSynchronousErrorHandling)throw new Error("bad call");try{e.call(this._context,n)}catch(e){return o.useDeprecatedSynchronousErrorHandling?(t.syncErrorValue=e,t.syncErrorThrown=!0,!0):(i(e),!0)}return!1},r.prototype._unsubscribe=function(){var t=this._parentSubscriber;this._context=null,this._parentSubscriber=null,t.unsubscribe()},r}(b),m=function(){return"function"==typeof Symbol&&Symbol.observable||"@@observable"}();function w(t){return t}var g=function(){function t(t){this._isScalar=!1,t&&(this._subscribe=t)}return t.prototype.lift=function(e){var n=new t;return n.source=this,n.operator=e,n},t.prototype.subscribe=function(t,e,n){var r=this.operator,i=function(t,e,n){if(t){if(t instanceof b)return t;if(t[v])return t[v]()}return t||e||n?new b(t,e,n):new b(a)}(t,e,n);if(r?i.add(r.call(i,this.source)):i.add(this.source||o.useDeprecatedSynchronousErrorHandling&&!i.syncErrorThrowable?this._subscribe(i):this._trySubscribe(i)),o.useDeprecatedSynchronousErrorHandling&&i.syncErrorThrowable&&(i.syncErrorThrowable=!1,i.syncErrorThrown))throw i.syncErrorValue;return i},t.prototype._trySubscribe=function(t){try{return this._subscribe(t)}catch(e){o.useDeprecatedSynchronousErrorHandling&&(t.syncErrorThrown=!0,t.syncErrorValue=e),function(t){for(;t;){var e=t,n=e.closed,r=e.destination,o=e.isStopped;if(n||o)return!1;t=r&&r instanceof b?r:null}return!0}(t)?t.error(e):console.warn(e)}},t.prototype.forEach=function(t,e){var n=this;return new(e=E(e))((function(e,r){var o;o=n.subscribe((function(e){try{t(e)}catch(t){r(t),o&&o.unsubscribe()}}),r,e)}))},t.prototype._subscribe=function(t){var e=this.source;return e&&e.subscribe(t)},t.prototype[m]=function(){return this},t.prototype.pipe=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return 0===t.length?this:(0===(n=t).length?w:1===n.length?n[0]:function(t){return n.reduce((function(t,e){return e(t)}),t)})(this);var n},t.prototype.toPromise=function(t){var e=this;return new(t=E(t))((function(t,n){var r;e.subscribe((function(t){return r=t}),(function(t){return n(t)}),(function(){return t(r)}))}))},t.create=function(e){return new t(e)},t}();function E(t){if(t||(t=o.Promise||Promise),!t)throw new Error("no Promise impl found");return t}const S="object"==typeof global&&global&&global.Object===Object&&global;var O="object"==typeof self&&self&&self.Object===Object&&self;const _=(S||O||Function("return this")()).Symbol;var T=Object.prototype,P=T.hasOwnProperty,j=T.toString,A=_?_.toStringTag:void 0;var x=Object.prototype.toString;var N=_?_.toStringTag:void 0;const D=function(t){return null==t?void 0===t?"[object Undefined]":"[object Null]":N&&N in Object(t)?function(t){var e=P.call(t,A),n=t[A];try{t[A]=void 0;var r=!0}catch(t){}var o=j.call(t);return r&&(e?t[A]=n:delete t[A]),o}(t):function(t){return x.call(t)}(t)},U=(M=Object.getPrototypeOf,C=Object,function(t){return M(C(t))});var M,C;var k=Function.prototype,I=Object.prototype,L=k.toString,R=I.hasOwnProperty,B=L.call(Object);const G=function(t){if(!function(t){return null!=t&&"object"==typeof t}(t)||"[object Object]"!=D(t))return!1;var e=U(t);if(null===e)return!0;var n=R.call(e,"constructor")&&e.constructor;return"function"==typeof n&&n instanceof n&&L.call(n)==B};var V=u(824),W=u(513),F=u(385);(0,F.createGlobalStore)("breadcrumbs",[]);var H=Object.freeze({__proto__:null,get start(){return Te},get ensureJQuerySupport(){return Zt},get setBootstrapMaxTime(){return Ct},get setMountMaxTime(){return kt},get setUnmountMaxTime(){return It},get setUnloadMaxTime(){return Lt},get registerApplication(){return fe},get unregisterApplication(){return he},get getMountedApps(){return ae},get getAppStatus(){return le},get unloadApplication(){return de},get checkActivityFunctions(){return pe},get getAppNames(){return ce},get pathToActiveWhen(){return ye},get navigateToUrl(){return $t},get triggerAppChange(){return Ee},get addErrorHandler(){return Q},get removeErrorHandler(){return X},get mountRootParcel(){return xt},get NOT_LOADED(){return et},get LOADING_SOURCE_CODE(){return nt},get NOT_BOOTSTRAPPED(){return rt},get BOOTSTRAPPING(){return ot},get NOT_MOUNTED(){return it},get MOUNTING(){return ut},get UPDATING(){return at},get LOAD_ERROR(){return lt},get MOUNTED(){return st},get UNMOUNTING(){return ct},get SKIP_BECAUSE_BROKEN(){return ft}});function $(t){return($="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function J(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}var z=("undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:void 0!==u.g?u.g:"undefined"!=typeof self?self:{}).CustomEvent,Y=function(){try{var t=new z("cat",{detail:{foo:"bar"}});return"cat"===t.type&&"bar"===t.detail.foo}catch(t){}return!1}()?z:"undefined"!=typeof document&&"function"==typeof document.createEvent?function(t,e){var n=document.createEvent("CustomEvent");return e?n.initCustomEvent(t,e.bubbles,e.cancelable,e.detail):n.initCustomEvent(t,!1,!1,void 0),n}:function(t,e){var n=document.createEventObject();return n.type=t,e?(n.bubbles=Boolean(e.bubbles),n.cancelable=Boolean(e.cancelable),n.detail=e.detail):(n.bubbles=!1,n.cancelable=!1,n.detail=void 0),n},K=[];function q(t,e,n){var r=tt(t,e,n);K.length?K.forEach((function(t){return t(r)})):setTimeout((function(){throw r}))}function Q(t){if("function"!=typeof t)throw Error(Z(28,!1));K.push(t)}function X(t){if("function"!=typeof t)throw Error(Z(29,!1));var e=!1;return K=K.filter((function(n){var r=n===t;return e=e||r,!r})),e}function Z(t,e){for(var n=arguments.length,r=new Array(n>2?n-2:0),o=2;o<n;o++)r[o-2]=arguments[o];return"single-spa minified message #".concat(t,": ").concat(e?e+" ":"","See https://single-spa.js.org/error/?code=").concat(t).concat(r.length?"&arg=".concat(r.join("&arg=")):"")}function tt(t,e,n){var r,o="".concat(bt(e)," '").concat(dt(e),"' died in status ").concat(e.status,": ");if(t instanceof Error){try{t.message=o+t.message}catch(t){}r=t}else{console.warn(Z(30,!1,e.status,dt(e)));try{r=Error(o+JSON.stringify(t))}catch(e){r=t}}return r.appOrParcelName=dt(e),e.status=n,r}var et="NOT_LOADED",nt="LOADING_SOURCE_CODE",rt="NOT_BOOTSTRAPPED",ot="BOOTSTRAPPING",it="NOT_MOUNTED",ut="MOUNTING",st="MOUNTED",at="UPDATING",ct="UNMOUNTING",lt="LOAD_ERROR",ft="SKIP_BECAUSE_BROKEN";function pt(t){return t.status===st}function ht(t){try{return t.activeWhen(window.location)}catch(e){return q(e,t,ft),!1}}function dt(t){return t.name}function vt(t){return Boolean(t.unmountThisParcel)}function bt(t){return vt(t)?"parcel":"application"}function yt(){for(var t=arguments.length-1;t>0;t--)for(var e in arguments[t])"__proto__"!==e&&(arguments[t-1][e]=arguments[t][e]);return arguments[0]}function mt(t,e){for(var n=0;n<t.length;n++)if(e(t[n]))return t[n];return null}function wt(t){return t&&("function"==typeof t||(e=t,Array.isArray(e)&&!mt(e,(function(t){return"function"!=typeof t}))));var e}function gt(t,e){var n=t[e]||[];0===(n=Array.isArray(n)?n:[n]).length&&(n=[function(){return Promise.resolve()}]);var r=bt(t),o=dt(t);return function(t){return n.reduce((function(n,i,u){return n.then((function(){var n=i(t);return Et(n)?n:Promise.reject(Z(15,!1,r,o,e,u))}))}),Promise.resolve())}}function Et(t){return t&&"function"==typeof t.then&&"function"==typeof t.catch}function St(t,e){return Promise.resolve().then((function(){return t.status!==rt?t:(t.status=ot,t.bootstrap?Rt(t,"bootstrap").then(n).catch((function(n){if(e)throw tt(n,t,ft);return q(n,t,ft),t})):Promise.resolve().then(n))}));function n(){return t.status=it,t}}function Ot(t,e){return Promise.resolve().then((function(){if(t.status!==st)return t;t.status=ct;var n=Object.keys(t.parcels).map((function(e){return t.parcels[e].unmountThisParcel()}));return Promise.all(n).then(r,(function(n){return r().then((function(){var r=Error(n.message);if(e)throw tt(r,t,ft);q(r,t,ft)}))})).then((function(){return t}));function r(){return Rt(t,"unmount").then((function(){t.status=it})).catch((function(n){if(e)throw tt(n,t,ft);q(n,t,ft)}))}}))}var _t=!1,Tt=!1;function Pt(t,e){return Promise.resolve().then((function(){return t.status!==it?t:(_t||(window.dispatchEvent(new Y("single-spa:before-first-mount")),_t=!0),Rt(t,"mount").then((function(){return t.status=st,Tt||(window.dispatchEvent(new Y("single-spa:first-mount")),Tt=!0),t})).catch((function(n){return t.status=st,Ot(t,!0).then(r,r);function r(){if(e)throw tt(n,t,ft);return q(n,t,ft),t}})))}))}var jt=0,At={parcels:{}};function xt(){return Nt.apply(At,arguments)}function Nt(t,e){var n=this;if(!t||"object"!==$(t)&&"function"!=typeof t)throw Error(Z(2,!1));if(t.name&&"string"!=typeof t.name)throw Error(Z(3,!1,$(t.name)));if("object"!==$(e))throw Error(Z(4,!1,name,$(e)));if(!e.domElement)throw Error(Z(5,!1,name));var r,o=jt++,i="function"==typeof t,u=i?t:function(){return Promise.resolve(t)},s={id:o,parcels:{},status:i?nt:rt,customProps:e,parentName:dt(n),unmountThisParcel:function(){return p.then((function(){if(s.status!==st)throw Error(Z(6,!1,name,s.status));return Ot(s,!0)})).then((function(t){return s.parentName&&delete n.parcels[s.id],t})).then((function(t){return c(t),t})).catch((function(t){throw s.status=ft,l(t),t}))}};n.parcels[o]=s;var a=u();if(!a||"function"!=typeof a.then)throw Error(Z(7,!1));var c,l,f=(a=a.then((function(t){if(!t)throw Error(Z(8,!1));var e=t.name||"parcel-".concat(o);if(Object.prototype.hasOwnProperty.call(t,"bootstrap")&&!wt(t.bootstrap))throw Error(Z(9,!1,e));if(!wt(t.mount))throw Error(Z(10,!1,e));if(!wt(t.unmount))throw Error(Z(11,!1,e));if(t.update&&!wt(t.update))throw Error(Z(12,!1,e));var n=gt(t,"bootstrap"),i=gt(t,"mount"),u=gt(t,"unmount");s.status=rt,s.name=e,s.bootstrap=n,s.mount=i,s.unmount=u,s.timeouts=Bt(t.timeouts),t.update&&(s.update=gt(t,"update"),r.update=function(t){return s.customProps=t,Dt(function(t){return Promise.resolve().then((function(){if(t.status!==st)throw Error(Z(32,!1,dt(t)));return t.status=at,Rt(t,"update").then((function(){return t.status=st,t})).catch((function(e){throw tt(e,t,ft)}))}))}(s))})}))).then((function(){return St(s,!0)})),p=f.then((function(){return Pt(s,!0)})),h=new Promise((function(t,e){c=t,l=e}));return r={mount:function(){return Dt(Promise.resolve().then((function(){if(s.status!==it)throw Error(Z(13,!1,name,s.status));return n.parcels[o]=s,Pt(s)})))},unmount:function(){return Dt(s.unmountThisParcel())},getStatus:function(){return s.status},loadPromise:Dt(a),bootstrapPromise:Dt(f),mountPromise:Dt(p),unmountPromise:Dt(h)}}function Dt(t){return t.then((function(){return null}))}function Ut(t){var e=dt(t),n="function"==typeof t.customProps?t.customProps(e,window.location):t.customProps;("object"!==$(n)||null===n||Array.isArray(n))&&(n={},console.warn(Z(40,!1),e,n));var r=yt({},n,{name:e,mountParcel:Nt.bind(t),singleSpa:H});return vt(t)&&(r.unmountSelf=t.unmountThisParcel),r}var Mt={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 Ct(t,e,n){if("number"!=typeof t||t<=0)throw Error(Z(16,!1));Mt.bootstrap={millis:t,dieOnTimeout:e,warningMillis:n||1e3}}function kt(t,e,n){if("number"!=typeof t||t<=0)throw Error(Z(17,!1));Mt.mount={millis:t,dieOnTimeout:e,warningMillis:n||1e3}}function It(t,e,n){if("number"!=typeof t||t<=0)throw Error(Z(18,!1));Mt.unmount={millis:t,dieOnTimeout:e,warningMillis:n||1e3}}function Lt(t,e,n){if("number"!=typeof t||t<=0)throw Error(Z(19,!1));Mt.unload={millis:t,dieOnTimeout:e,warningMillis:n||1e3}}function Rt(t,e){var n=t.timeouts[e],r=n.warningMillis,o=bt(t);return new Promise((function(i,u){var s=!1,a=!1;t[e](Ut(t)).then((function(t){s=!0,i(t)})).catch((function(t){s=!0,u(t)})),setTimeout((function(){return l(1)}),r),setTimeout((function(){return l(!0)}),n.millis);var c=Z(31,!1,e,o,dt(t),n.millis);function l(t){if(!s)if(!0===t)a=!0,n.dieOnTimeout?u(Error(c)):console.error(c);else if(!a){var e=t,o=e*r;console.warn(c),o+r<n.millis&&setTimeout((function(){return l(e+1)}),r)}}}))}function Bt(t){var e={};for(var n in Mt)e[n]=yt({},Mt[n],t&&t[n]||{});return e}function Gt(t){return Promise.resolve().then((function(){return t.loadPromise?t.loadPromise:t.status!==et&&t.status!==lt?t:(t.status=nt,t.loadPromise=Promise.resolve().then((function(){var r=t.loadApp(Ut(t));if(!Et(r))throw n=!0,Error(Z(33,!1,dt(t)));return r.then((function(n){var r;t.loadErrorTime=null,"object"!==$(e=n)&&(r=34),Object.prototype.hasOwnProperty.call(e,"bootstrap")&&!wt(e.bootstrap)&&(r=35),wt(e.mount)||(r=36),wt(e.unmount)||(r=37);var o=bt(e);if(r){var i;try{i=JSON.stringify(e)}catch(t){}return console.error(Z(r,!1,o,dt(t),i),e),q(void 0,t,ft),t}return e.devtools&&e.devtools.overlays&&(t.devtools.overlays=yt({},t.devtools.overlays,e.devtools.overlays)),t.status=rt,t.bootstrap=gt(e,"bootstrap"),t.mount=gt(e,"mount"),t.unmount=gt(e,"unmount"),t.unload=gt(e,"unload"),t.timeouts=Bt(e.timeouts),delete t.loadPromise,t}))})).catch((function(e){var r;return delete t.loadPromise,n?r=ft:(r=lt,t.loadErrorTime=(new Date).getTime()),q(e,t,r),t})));var e,n}))}var Vt,Wt="undefined"!=typeof window,Ft={hashchange:[],popstate:[]},Ht=["hashchange","popstate"];function $t(t){var e;if("string"==typeof t)e=t;else if(this&&this.href)e=this.href;else{if(!(t&&t.currentTarget&&t.currentTarget.href&&t.preventDefault))throw Error(Z(14,!1));e=t.currentTarget.href,t.preventDefault()}var n=Qt(window.location.href),r=Qt(e);0===e.indexOf("#")?window.location.hash=r.hash:n.host!==r.host&&r.host?window.location.href=e:r.pathname===n.pathname&&r.search===n.search?window.location.hash=r.hash:window.history.pushState(null,null,e)}function Jt(t){var e=this;if(t){var n=t[0].type;Ht.indexOf(n)>=0&&Ft[n].forEach((function(n){try{n.apply(e,t)}catch(t){setTimeout((function(){throw t}))}}))}}function zt(){Se([],arguments)}function Yt(t,e){return function(){var n=window.location.href,r=t.apply(this,arguments),o=window.location.href;return Vt&&n===o||(Pe()?window.dispatchEvent(function(t,e){var n;try{n=new PopStateEvent("popstate",{state:t})}catch(e){(n=document.createEvent("PopStateEvent")).initPopStateEvent("popstate",!1,!1,t)}return n.singleSpa=!0,n.singleSpaTrigger=e,n}(window.history.state,e)):Se([])),r}}if(Wt){window.addEventListener("hashchange",zt),window.addEventListener("popstate",zt);var Kt=window.addEventListener,qt=window.removeEventListener;window.addEventListener=function(t,e){if(!("function"==typeof e&&Ht.indexOf(t)>=0)||mt(Ft[t],(function(t){return t===e})))return Kt.apply(this,arguments);Ft[t].push(e)},window.removeEventListener=function(t,e){if(!("function"==typeof e&&Ht.indexOf(t)>=0))return qt.apply(this,arguments);Ft[t]=Ft[t].filter((function(t){return t!==e}))},window.history.pushState=Yt(window.history.pushState,"pushState"),window.history.replaceState=Yt(window.history.replaceState,"replaceState"),window.singleSpaNavigate?console.warn(Z(41,!1)):window.singleSpaNavigate=$t}function Qt(t){var e=document.createElement("a");return e.href=t,e}var Xt=!1;function Zt(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:window.jQuery;if(t||window.$&&window.$.fn&&window.$.fn.jquery&&(t=window.$),t&&!Xt){var e=t.fn.on,n=t.fn.off;t.fn.on=function(t,n){return te.call(this,e,window.addEventListener,t,n,arguments)},t.fn.off=function(t,e){return te.call(this,n,window.removeEventListener,t,e,arguments)},Xt=!0}}function te(t,e,n,r,o){return"string"!=typeof n?t.apply(this,o):(n.split(/\s+/).forEach((function(t){Ht.indexOf(t)>=0&&(e(t,r),n=n.replace(t,""))})),""===n.trim()?this:t.apply(this,o))}var ee={};function ne(t){return Promise.resolve().then((function(){var e=ee[dt(t)];if(!e)return t;if(t.status===et)return re(t,e),t;if("UNLOADING"===t.status)return e.promise.then((function(){return t}));if(t.status!==it&&t.status!==lt)return t;var n=t.status===lt?Promise.resolve():Rt(t,"unload");return t.status="UNLOADING",n.then((function(){return re(t,e),t})).catch((function(n){return function(t,e,n){delete ee[dt(t)],delete t.bootstrap,delete t.mount,delete t.unmount,delete t.unload,q(n,t,ft),e.reject(n)}(t,e,n),t}))}))}function re(t,e){delete ee[dt(t)],delete t.bootstrap,delete t.mount,delete t.unmount,delete t.unload,t.status=et,e.resolve()}function oe(t,e,n,r){ee[dt(t)]={app:t,resolve:n,reject:r},Object.defineProperty(ee[dt(t)],"promise",{get:e})}function ie(t){return ee[t]}var ue=[];function se(){var t=[],e=[],n=[],r=[],o=(new Date).getTime();return ue.forEach((function(i){var u=i.status!==ft&&ht(i);switch(i.status){case lt:u&&o-i.loadErrorTime>=200&&n.push(i);break;case et:case nt:u&&n.push(i);break;case rt:case it:!u&&ie(dt(i))?t.push(i):u&&r.push(i);break;case st:u||e.push(i)}})),{appsToUnload:t,appsToUnmount:e,appsToLoad:n,appsToMount:r}}function ae(){return ue.filter(pt).map(dt)}function ce(){return ue.map(dt)}function le(t){var e=mt(ue,(function(e){return dt(e)===t}));return e?e.status:null}function fe(t,e,n,r){var o=function(t,e,n,r){var o,i={name:null,loadApp:null,activeWhen:null,customProps:null};return"object"===$(t)?(function(t){if(Array.isArray(t)||null===t)throw Error(Z(39,!1));var e=["name","app","activeWhen","customProps"],n=Object.keys(t).reduce((function(t,n){return e.indexOf(n)>=0?t:t.concat(n)}),[]);if(0!==n.length)throw Error(Z(38,!1,e.join(", "),n.join(", ")));if("string"!=typeof t.name||0===t.name.length)throw Error(Z(20,!1));if("object"!==$(t.app)&&"function"!=typeof t.app)throw Error(Z(20,!1));var r=function(t){return"string"==typeof t||"function"==typeof t};if(!(r(t.activeWhen)||Array.isArray(t.activeWhen)&&t.activeWhen.every(r)))throw Error(Z(24,!1));if(!be(t.customProps))throw Error(Z(22,!1))}(t),i.name=t.name,i.loadApp=t.app,i.activeWhen=t.activeWhen,i.customProps=t.customProps):(function(t,e,n,r){if("string"!=typeof t||0===t.length)throw Error(Z(20,!1));if(!e)throw Error(Z(23,!1));if("function"!=typeof n)throw Error(Z(24,!1));if(!be(r))throw Error(Z(22,!1))}(t,e,n,r),i.name=t,i.loadApp=e,i.activeWhen=n,i.customProps=r),i.loadApp="function"!=typeof(o=i.loadApp)?function(){return Promise.resolve(o)}:o,i.customProps=function(t){return t||{}}(i.customProps),i.activeWhen=function(t){var e=Array.isArray(t)?t:[t];return e=e.map((function(t){return"function"==typeof t?t:ye(t)})),function(t){return e.some((function(e){return e(t)}))}}(i.activeWhen),i}(t,e,n,r);if(-1!==ce().indexOf(o.name))throw Error(Z(21,!1,o.name));ue.push(yt({loadErrorTime:null,status:et,parcels:{},devtools:{overlays:{options:{},selectors:[]}}},o)),Wt&&(Zt(),Se())}function pe(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:window.location;return ue.filter((function(e){return e.activeWhen(t)})).map(dt)}function he(t){if(0===ue.filter((function(e){return dt(e)===t})).length)throw Error(Z(25,!1,t));return de(t).then((function(){var e=ue.map(dt).indexOf(t);ue.splice(e,1)}))}function de(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{waitForUnmount:!1};if("string"!=typeof t)throw Error(Z(26,!1));var n=mt(ue,(function(e){return dt(e)===t}));if(!n)throw Error(Z(27,!1,t));var r,o=ie(dt(n));if(e&&e.waitForUnmount){if(o)return o.promise;var i=new Promise((function(t,e){oe(n,(function(){return i}),t,e)}));return i}return o?(r=o.promise,ve(n,o.resolve,o.reject)):r=new Promise((function(t,e){oe(n,(function(){return r}),t,e),ve(n,t,e)})),r}function ve(t,e,n){Ot(t).then(ne).then((function(){e(),setTimeout((function(){Se()}))})).catch(n)}function be(t){return!t||"function"==typeof t||"object"===$(t)&&null!==t&&!Array.isArray(t)}function ye(t,e){var n=function(t,e){var n=0,r=!1,o="^";"/"!==t[0]&&(t="/"+t);for(var i=0;i<t.length;i++){var u=t[i];(!r&&":"===u||r&&"/"===u)&&s(i)}return s(t.length),new RegExp(o,"i");function s(i){var u=t.slice(n,i).replace(/[|\\{}()[\]^$+*?.]/g,"\\$&");if(o+=r?"[^/]+/?":u,i===t.length)if(r)e&&(o+="$");else{var s=e?"":".*";o="/"===o.charAt(o.length-1)?"".concat(o).concat(s,"$"):"".concat(o,"(/").concat(s,")?(#.*)?$")}r=!r,n=i}}(t,e);return function(t){var e=t.origin;e||(e="".concat(t.protocol,"//").concat(t.host));var r=t.href.replace(e,"").replace(t.search,"").split("?")[0];return n.test(r)}}var me=!1,we=[],ge=Wt&&window.location.href;function Ee(){return Se()}function Se(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],e=arguments.length>1?arguments[1]:void 0;if(me)return new Promise((function(t,n){we.push({resolve:t,reject:n,eventArguments:e})}));var n,r=se(),o=r.appsToUnload,i=r.appsToUnmount,u=r.appsToLoad,s=r.appsToMount,a=!1,c=ge,l=ge=window.location.href;return Pe()?(me=!0,n=o.concat(u,i,s),Promise.resolve().then((function(){if(window.dispatchEvent(new Y(0===n.length?"single-spa:before-no-app-change":"single-spa:before-app-change",d(!0))),window.dispatchEvent(new Y("single-spa:before-routing-event",d(!0,{cancelNavigation:f}))),a)return window.dispatchEvent(new Y("single-spa:before-mount-routing-event",d(!0))),p(),void $t(c);var e=o.map(ne),r=i.map(Ot).map((function(t){return t.then(ne)})).concat(e),l=Promise.all(r);l.then((function(){window.dispatchEvent(new Y("single-spa:before-mount-routing-event",d(!0)))}));var v=u.map((function(t){return Gt(t).then((function(t){return Oe(t,l)}))})),b=s.filter((function(t){return u.indexOf(t)<0})).map((function(t){return Oe(t,l)}));return l.catch((function(t){throw h(),t})).then((function(){return h(),Promise.all(v.concat(b)).catch((function(e){throw t.forEach((function(t){return t.reject(e)})),e})).then(p)}))}))):(n=u,Promise.resolve().then((function(){var t=u.map(Gt);return Promise.all(t).then(h).then((function(){return[]})).catch((function(t){throw h(),t}))})));function f(){a=!0}function p(){var e=ae();t.forEach((function(t){return t.resolve(e)}));try{var r=0===n.length?"single-spa:no-app-change":"single-spa:app-change";window.dispatchEvent(new Y(r,d())),window.dispatchEvent(new Y("single-spa:routing-event",d()))}catch(t){setTimeout((function(){throw t}))}if(me=!1,we.length>0){var o=we;we=[],Se(o)}return e}function h(){t.forEach((function(t){Jt(t.eventArguments)})),Jt(e)}function d(){var t,r=arguments.length>0&&void 0!==arguments[0]&&arguments[0],f=arguments.length>1?arguments[1]:void 0,p={},h=(J(t={},st,[]),J(t,it,[]),J(t,et,[]),J(t,ft,[]),t);r?(u.concat(s).forEach((function(t,e){v(t,st)})),o.forEach((function(t){v(t,et)})),i.forEach((function(t){v(t,it)}))):n.forEach((function(t){v(t)}));var d={detail:{newAppStatuses:p,appsByNewStatus:h,totalAppChanges:n.length,originalEvent:null==e?void 0:e[0],oldUrl:c,newUrl:l,navigationIsCanceled:a}};return f&&yt(d.detail,f),d;function v(t,e){var n=dt(t);e=e||le(n),p[n]=e,(h[e]=h[e]||[]).push(n)}}}function Oe(t,e){return ht(t)?St(t).then((function(t){return e.then((function(){return ht(t)?Pt(t):t}))})):e.then((function(){return t}))}var _e=!1;function Te(t){var e;_e=!0,t&&t.urlRerouteOnly&&(e=t.urlRerouteOnly,Vt=e),Wt&&Se()}function Pe(){return _e}Wt&&setTimeout((function(){_e||console.warn(Z(1,!1))}),5e3);var je={getRawAppData:function(){return[].concat(ue)},reroute:Se,NOT_LOADED:et,toLoadPromise:Gt,toBootstrapPromise:St,unregisterApplication:he};Wt&&window.__SINGLE_SPA_DEVTOOLS__&&(window.__SINGLE_SPA_DEVTOOLS__.exposedMethods=je);var Ae="openmrs:history";function xe(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function Ne(t,e,n,r,o,i,u){try{var s=t[i](u),a=s.value}catch(t){return void n(t)}s.done?e(a):Promise.resolve(a).then(r,o)}function De(t,e,n){return De=Ie()?Reflect.construct:function(t,e,n){var r=[null];r.push.apply(r,e);var o=new(Function.bind.apply(t,r));return n&&Ce(o,n.prototype),o},De.apply(null,arguments)}function Ue(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function Me(t){return Me=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},Me(t)}function Ce(t,e){return Ce=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},Ce(t,e)}function ke(t){var e="function"==typeof Map?new Map:void 0;return ke=function(t){if(null===t||(n=t,-1===Function.toString.call(n).indexOf("[native code]")))return t;var n;if("function"!=typeof t)throw new TypeError("Super expression must either be null or a function");if(void 0!==e){if(e.has(t))return e.get(t);e.set(t,r)}function r(){return De(t,arguments,Me(this).constructor)}return r.prototype=Object.create(t.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),Ce(r,t)},ke(t)}function Ie(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}var Le="/ws/rest/v1/",Re="/ws/fhir2/R4",Be="".concat(Le,"session");function Ge(t){return t&&t.startsWith("http")?t:("/"!==t[0]&&(t="/"+t),window.openmrsBase+t)}function Ve(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if("string"!=typeof t)throw Error("The first argument to @openmrs/api's openmrsFetch function must be a url string");if("object"!=typeof e)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.");var n=Ge(t);if(e.headers||(e.headers={}),G(e.body)&&(e.body=JSON.stringify(e.body)),void 0===e.headers.Accept&&(e.headers.Accept="application/json"),null===e.headers.Accept&&delete e.headers.Accept,t.startsWith(Le)&&void 0===e.headers["Disable-WWW-Authenticate"]&&(e.headers["Disable-WWW-Authenticate"]="true"),t.startsWith(Re)){var r=new URL(n,window.location.toString());r.searchParams.has("_summary")||(r.searchParams.set("_summary","data"),n=r.toString())}var o,i,u=Error();return window.fetch(n,e).then((o=function(t){var e,r;return function(t,e){var n,r,o,i,u={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(i){return function(s){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;u;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return u.label++,{value:i[1],done:!1};case 5:u.label++,r=i[1],i=[0];continue;case 7:i=u.ops.pop(),u.trys.pop();continue;default:if(!((o=(o=u.trys).length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){u=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){u.label=i[1];break}if(6===i[0]&&u.label<o[1]){u.label=o[1],o=i;break}if(o&&u.label<o[2]){u.label=o[2],u.ops.push(i);break}o[2]&&u.ops.pop(),u.trys.pop();continue}i=e.call(t,u)}catch(t){i=[6,t],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,s])}}}(this,(function(o){switch(o.label){case 0:return(e=t).ok?204===e.status?(e.data=null,[2,e]):[2,e.clone().text().then((function(t){try{t&&(e.data=JSON.parse(t))}catch(t){}return e}))]:[3,1];case 1:return[4,(0,V.getConfig)("@openmrs/esm-api")];case 2:return r=o.sent().redirectAuthFailure,n===Ge(Be)&&403===e.status||r.enabled&&r.errors.includes(e.status)?(sessionStorage.removeItem(Ae),(0,W.navigate)({to:r.url}),[2,r.resolvePromise?Promise.resolve():new Promise((function(){}))]):[2,e.clone().text().then((function(t){var r=t;try{r=JSON.parse(t)}catch(t){}throw new Fe(n,e,r,u)}),(function(t){throw new Fe(n,e,null,u)}))];case 3:return[2]}}))},i=function(){var t=this,e=arguments;return new Promise((function(n,r){var i=o.apply(t,e);function u(t){Ne(i,n,r,u,s,"next",t)}function s(t){Ne(i,n,r,u,s,"throw",t)}u(void 0)}))},function(t){return i.apply(this,arguments)}))}function We(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if("object"!=typeof e)throw Error("The second argument to openmrsObservableFetch must be either omitted or an object");var n=new AbortController;return e.signal=n.signal,new g((function(r){var o=!1;return Ve(t,e).then((function(t){o=!0,r.next(t),r.complete()}),(function(t){o=!0,r.error(t)})),function(){o||n.abort()}}))}var Fe=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&Ce(t,e)}(o,t);var e,n,r=(e=o,n=Ie(),function(){var t,r=Me(e);if(n){var o=Me(this).constructor;t=Reflect.construct(r,arguments,o)}else t=r.apply(this,arguments);return function(t,e){return!e||"object"!=((n=e)&&"undefined"!=typeof Symbol&&n.constructor===Symbol?"symbol":typeof n)&&"function"!=typeof e?xe(t):e;var n}(this,t)});function o(t,e,n,i){var u;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,o),Ue(xe(u=r.call(this)),"response",void 0),Ue(xe(u),"responseBody",void 0),u.message="Server responded with ".concat(e.status," (").concat(e.statusText,") for url ").concat(t,". Check err.responseBody or network tab in dev tools for more info"),i.message=u.message,u.responseBody=n,u.response=e,u.stack="Stacktrace for outgoing request:\n".concat(i.stack,"\nStacktrace for incoming response:\n").concat(u.stack),u}return o}(ke(Error));function He(t,e,n,r,o,i,u){try{var s=t[i](u),a=s.value}catch(t){return void n(t)}s.done?e(a):Promise.resolve(a).then(r,o)}var $e="/ws/rest/v1/attachment";function Je(t,e){return Ve("".concat($e,"/").concat(t),{signal:e.signal})}function ze(t,e,n){return Ve("".concat($e,"?patient=").concat(t,"&includeEncounterless=").concat(e),{signal:n.signal})}function Ye(t,e){return Ke.apply(this,arguments)}function Ke(){var t;return t=function(t,e){var n;return function(t,e){var n,r,o,i,u={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(i){return function(s){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;u;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return u.label++,{value:i[1],done:!1};case 5:u.label++,r=i[1],i=[0];continue;case 7:i=u.ops.pop(),u.trys.pop();continue;default:if(!((o=(o=u.trys).length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){u=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){u.label=i[1];break}if(6===i[0]&&u.label<o[1]){u.label=o[1],o=i;break}if(o&&u.label<o[2]){u.label=o[2],u.ops.push(i);break}o[2]&&u.ops.pop(),u.trys.pop();continue}i=e.call(t,u)}catch(t){i=[6,t],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,s])}}}(this,(function(r){return(n=new FormData).append("fileCaption",e.fileName),n.append("patient",t),e.file?n.append("file",e.file):(n.append("file",new File([""],e.fileName),e.fileName),n.append("base64Content",e.base64Content)),[2,Ve("".concat($e),{method:"POST",body:n})]}))},Ke=function(){var e=this,n=arguments;return new Promise((function(r,o){var i=t.apply(e,n);function u(t){He(i,r,o,u,s,"next",t)}function s(t){He(i,r,o,u,s,"throw",t)}u(void 0)}))},Ke.apply(this,arguments)}function qe(t,e){return Ve("".concat($e,"/").concat(t),{method:"DELETE",signal:e.signal})}var Qe=u(254);const Xe=function(t){return void 0===t};function Ze(t,e,n,r,o,i,u){try{var s=t[i](u),a=s.value}catch(t){return void n(t)}s.done?e(a):Promise.resolve(a).then(r,o)}function tn(t){return function(){var e=this,n=arguments;return new Promise((function(r,o){var i=t.apply(e,n);function u(t){Ze(i,r,o,u,s,"next",t)}function s(t){Ze(i,r,o,u,s,"throw",t)}u(void 0)}))}}function en(t,e){var n,r,o,i,u={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(i){return function(s){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;u;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return u.label++,{value:i[1],done:!1};case 5:u.label++,r=i[1],i=[0];continue;case 7:i=u.ops.pop(),u.trys.pop();continue;default:if(!((o=(o=u.trys).length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){u=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){u.label=i[1];break}if(6===i[0]&&u.label<o[1]){u.label=o[1],o=i;break}if(o&&u.label<o[2]){u.label=o[2],u.ops.push(i);break}o[2]&&u.ops.pop(),u.trys.pop();continue}i=e.call(t,u)}catch(t){i=[6,t],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,s])}}}var nn=(0,F.createGlobalStore)("session",{loaded:!1,session:null}),rn=0;function on(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{includeAuthStatus:!0};return(rn<Date.now()-6e4||!nn.getState().loaded)&&an(),new g((function(e){var n=function(n){var r;n.loaded&&(t.includeAuthStatus?e.next(n.session):e.next(null===(r=n.session)||void 0===r?void 0:r.user))};return n(nn.getState()),nn.subscribe(n)}))}function un(){return(rn<Date.now()-6e4||!nn.getState().loaded)&&an(),nn}function sn(t){var e,n,r,o=null!==(r=null==t||null===(e=t.user)||void 0===e||null===(n=e.userProperties)||void 0===n?void 0:n.defaultLocale)&&void 0!==r?r:t.locale,i=document.documentElement.getAttribute("lang");(function(t){if(void 0===t||"string"!=typeof t)return!1;try{new Intl.Locale(t)}catch(t){return!1}return!0})(o)&&o!==i&&document.documentElement.setAttribute("lang",o)}function an(){return new Promise((function(t,e){rn=Date.now(),Ve(Be).then((function(n){if("object"!=typeof(null==n?void 0:n.data))return e(),Promise.reject();sn(n.data),t(n.data),nn.setState({loaded:!0,session:n.data})})).catch((function(t){return(0,Qe.reportError)("Failed to fetch new session information: ".concat(t)),e(t),{sessionId:"",authenticated:!1}}))}))}function cn(){nn.setState({loaded:!0,session:{authenticated:!1,sessionId:""}})}function ln(t,e){return void 0===e?Boolean(t):!Boolean(t)||function(t,e){return"string"==typeof t?!Xe(e.privileges.find((function(e){return t===e.display}))):Array.isArray(t)?t.every((function(t){return!Xe(e.privileges.find((function(e){return t===e.display})))})):(Xe(t)||console.error('Could not understand privileges "'.concat(t,'"')),!0)}(t,e)||function(t){return!Xe(t.roles.find((function(t){return"System Developer"===t.display})))}(e)}function fn(){var t,e;return new Promise((function(n,r){var o=function(r){r.loaded&&r.session.user&&(t=r.session.user,n(r.session.user),e&&e())};o(nn.getState()),t||(e=nn.subscribe(o))}))}function pn(){return new Promise((function(t,e){on().subscribe((function(e){t(e.sessionLocation)}),e).unsubscribe()}))}function hn(t,e){return dn.apply(this,arguments)}function dn(){return(dn=tn((function(t,e){return en(this,(function(n){switch(n.label){case 0:return[4,Ve(Be,{method:"POST",body:{sessionLocation:t},headers:{"Content-Type":"application/json"},signal:e.signal})];case 1:return n.sent(),[4,an()];case 2:return n.sent(),[2]}}))}))).apply(this,arguments)}function vn(t,e,n){return bn.apply(this,arguments)}function bn(){return(bn=tn((function(t,e,n){return en(this,(function(r){switch(r.label){case 0:return n||(n=new AbortController),[4,Ve("/ws/rest/v1/user/".concat(t),{method:"POST",body:{userProperties:e},headers:{"Content-Type":"application/json"},signal:n.signal})];case 1:return r.sent(),[4,an()];case 2:return r.sent(),[2]}}))}))).apply(this,arguments)}function yn(){(0,V.defineConfigSchema)("@openmrs/esm-api",{redirectAuthFailure:{enabled:{_type:V.Type.Boolean,_default:!0,_description:"Whether to redirect logged-out users to `redirectAuthFailure.url`"},url:{_type:V.Type.String,_default:"${openmrsSpaBase}/login",_validators:[V.validators.isUrl]},errors:{_type:V.Type.Array,_default:[401],_elements:{_type:V.Type.Number,_validators:[V.validators.inRange(100,600)]},_description:"The HTTP error codes for which users will be redirected"},resolvePromise:{_type:V.Type.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."}}}),an()}var mn=u(738);function wn(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}function gn(t,e,n,r,o,i,u){try{var s=t[i](u),a=s.value}catch(t){return void n(t)}s.done?e(a):Promise.resolve(a).then(r,o)}function En(t){return function(){var e=this,n=arguments;return new Promise((function(r,o){var i=t.apply(e,n);function u(t){gn(i,r,o,u,s,"next",t)}function s(t){gn(i,r,o,u,s,"throw",t)}u(void 0)}))}}function Sn(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=n){var r,o,i=[],u=!0,s=!1;try{for(n=n.call(t);!(u=(r=n.next()).done)&&(i.push(r.value),!e||i.length!==e);u=!0);}catch(t){s=!0,o=t}finally{try{u||null==n.return||n.return()}finally{if(s)throw o}}return i}}(t,e)||function(t,e){if(t){if("string"==typeof t)return wn(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?wn(t,e):void 0}}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function On(t,e){var n,r,o,i,u={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(i){return function(s){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;u;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return u.label++,{value:i[1],done:!1};case 5:u.label++,r=i[1],i=[0];continue;case 7:i=u.ops.pop(),u.trys.pop();continue;default:if(!((o=(o=u.trys).length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){u=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){u.label=i[1];break}if(6===i[0]&&u.label<o[1]){u.label=o[1],o=i;break}if(o&&u.label<o[2]){u.label=o[2],u.ops.push(i);break}o[2]&&u.ops.pop(),u.trys.pop();continue}i=e.call(t,u)}catch(t){i=[6,t],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,s])}}}function _n(t,e){return Tn.apply(this,arguments)}function Tn(){return Tn=En((function(t,e){var n,r,o,i,u,s=arguments;return On(this,(function(a){switch(a.label){case 0:return n=!(s.length>2&&void 0!==s[2])||s[2],t?(r=null,[4,Promise.all([Ve("".concat(Re,"/Patient/").concat(t),e).catch((function(t){return r=t})),n?Pn(t):Promise.resolve(null)])]):[3,2];case 1:if(o=Sn.apply(void 0,[a.sent(),2]),i=o[0],u=o[1],i.ok)return[2,i.data];if(u)return[2,u];if(r)throw r;a.label=2;case 2:return[2,null]}}))})),Tn.apply(this,arguments)}function Pn(t){return jn.apply(this,arguments)}function jn(){return(jn=En((function(t){var e,n,r;return On(this,(function(o){switch(o.label){case 0:return[4,(0,mn.getSynchronizationItems)("patient-registration")];case 1:return e=o.sent(),n=e.find((function(e){return e.fhirPatient.id===t})),[2,null!==(r=null==n?void 0:n.fhirPatient)&&void 0!==r?r:null]}}))}))).apply(this,arguments)}var An=function(){function t(){return Error.call(this),this.message="object unsubscribed",this.name="ObjectUnsubscribedError",this}return t.prototype=Object.create(Error.prototype),t}(),xn=function(t){function n(e,n){var r=t.call(this)||this;return r.subject=e,r.subscriber=n,r.closed=!1,r}return e(n,t),n.prototype.unsubscribe=function(){if(!this.closed){this.closed=!0;var t=this.subject,e=t.observers;if(this.subject=null,e&&0!==e.length&&!t.isStopped&&!t.closed){var n=e.indexOf(this.subscriber);-1!==n&&e.splice(n,1)}}},n}(h),Nn=function(t){function n(e){var n=t.call(this,e)||this;return n.destination=e,n}return e(n,t),n}(b),Dn=function(t){function n(){var e=t.call(this)||this;return e.observers=[],e.closed=!1,e.isStopped=!1,e.hasError=!1,e.thrownError=null,e}return e(n,t),n.prototype[v]=function(){return new Nn(this)},n.prototype.lift=function(t){var e=new Un(this,this);return e.operator=t,e},n.prototype.next=function(t){if(this.closed)throw new An;if(!this.isStopped)for(var e=this.observers,n=e.length,r=e.slice(),o=0;o<n;o++)r[o].next(t)},n.prototype.error=function(t){if(this.closed)throw new An;this.hasError=!0,this.thrownError=t,this.isStopped=!0;for(var e=this.observers,n=e.length,r=e.slice(),o=0;o<n;o++)r[o].error(t);this.observers.length=0},n.prototype.complete=function(){if(this.closed)throw new An;this.isStopped=!0;for(var t=this.observers,e=t.length,n=t.slice(),r=0;r<e;r++)n[r].complete();this.observers.length=0},n.prototype.unsubscribe=function(){this.isStopped=!0,this.closed=!0,this.observers=null},n.prototype._trySubscribe=function(e){if(this.closed)throw new An;return t.prototype._trySubscribe.call(this,e)},n.prototype._subscribe=function(t){if(this.closed)throw new An;return this.hasError?(t.error(this.thrownError),h.EMPTY):this.isStopped?(t.complete(),h.EMPTY):(this.observers.push(t),new xn(this,t))},n.prototype.asObservable=function(){var t=new g;return t.source=this,t},n.create=function(t,e){return new Un(t,e)},n}(g),Un=function(t){function n(e,n){var r=t.call(this)||this;return r.destination=e,r.source=n,r}return e(n,t),n.prototype.next=function(t){var e=this.destination;e&&e.next&&e.next(t)},n.prototype.error=function(t){var e=this.destination;e&&e.error&&this.destination.error(t)},n.prototype.complete=function(){var t=this.destination;t&&t.complete&&this.destination.complete()},n.prototype._subscribe=function(t){return this.source?this.source.subscribe(t):h.EMPTY},n}(Dn),Mn=function(t){function n(e){var n=t.call(this)||this;return n._value=e,n}return e(n,t),Object.defineProperty(n.prototype,"value",{get:function(){return this.getValue()},enumerable:!0,configurable:!0}),n.prototype._subscribe=function(e){var n=t.prototype._subscribe.call(this,e);return n&&!n.closed&&e.next(this._value),n},n.prototype.getValue=function(){if(this.hasError)throw this.thrownError;if(this.closed)throw new An;return this._value},n.prototype.next=function(e){t.prototype.next.call(this,this._value=e)},n}(Dn),Cn=function(){function t(){return Error.call(this),this.message="argument out of range",this.name="ArgumentOutOfRangeError",this}return t.prototype=Object.create(Error.prototype),t}(),kn=new g((function(t){return t.complete()}));function In(t){return function(e){return 0===t?n?function(t){return new g((function(e){return t.schedule((function(){return e.complete()}))}))}(n):kn:e.lift(new Ln(t));var n}}var Ln=function(){function t(t){if(this.total=t,this.total<0)throw new Cn}return t.prototype.call=function(t,e){return e.subscribe(new Rn(t,this.total))},t}(),Rn=function(t){function n(e,n){var r=t.call(this,e)||this;return r.total=n,r.count=0,r}return e(n,t),n.prototype._next=function(t){var e=this.total,n=++this.count;n<=e&&(this.destination.next(t),n===e&&(this.destination.complete(),this.unsubscribe()))},n}(b);function Bn(t,e){return function(n){if("function"!=typeof t)throw new TypeError("argument is not a function. Are you looking for `mapTo()`?");return n.lift(new Gn(t,e))}}var Gn=function(){function t(t,e){this.project=t,this.thisArg=e}return t.prototype.call=function(t,e){return e.subscribe(new Vn(t,this.project,this.thisArg))},t}(),Vn=function(t){function n(e,n,r){var o=t.call(this,e)||this;return o.project=n,o.count=0,o.thisArg=r||o,o}return e(n,t),n.prototype._next=function(t){var e;try{e=this.project.call(this.thisArg,t,this.count++)}catch(t){return void this.destination.error(t)}this.destination.next(e)},n}(b),Wn="custom:(uuid,encounters:(uuid,encounterDatetime,form:(uuid,name),location:ref,encounterType:ref,encounterProviders:(uuid,display,provider:(uuid,display))),patient:(uuid,uuid),visitType:(uuid,name,display),attributes:(uuid,display,attributeType:(name,datatypeClassname,uuid),value),location:(uuid,name,display),startDatetime,stopDatetime)",Fn=function(){try{return JSON.parse(localStorage.getItem("openmrs:visitStoreState")||"null")}catch(t){return null}}()||{patientUuid:null,manuallySetVisitUuid:null};function Hn(){return(0,F.getGlobalStore)("visit",Fn)}function $n(t,e){Hn().setState({patientUuid:t,manuallySetVisitUuid:e})}function Jn(t,e,n){var r=null!=n?n:Wn;return We("/ws/rest/v1/visit?patient=".concat(t,"&v=").concat(r),{signal:e.signal,method:"GET",headers:{"Content-type":"application/json"}}).pipe(In(1)).pipe(Bn((function(t){return t})))}function zn(t,e){return We("/ws/rest/v1/visit",{signal:e.signal,method:"POST",headers:{"Content-type":"application/json"},body:t})}function Yn(t,e,n){return We("/ws/rest/v1/visit/".concat(t),{signal:n.signal,method:"POST",headers:{"Content-type":"application/json"},body:e})}Hn().subscribe((function(t){var e;e=t,localStorage.setItem("openmrs:visitStoreState",JSON.stringify(e))}));var Kn,qn,Qn=new Mn(null);function Xn(t){return{uuid:t.uuid,display:t.display,name:t.name}}function Zn(){return We("/ws/rest/v1/visittype").pipe(Bn((function(t){return t.data.results.map(Xn)}))).pipe(In(1))}function tr(t){return{uuid:t.uuid,display:t.display}}function er(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;return We("/ws/rest/v1/location"+(t?"?tag="+t:"")).pipe(Bn((function(t){return t.data.results.map(tr)}))).pipe(In(1))}!function(t){t.NEWVISIT="startVisit",t.EDITVISIT="editVisit",t.LOADING="loadingVisit"}(Kn||(Kn={})),function(t){t.NOTSTARTED="notStarted",t.ONGOING="ongoing"}(qn||(qn={}));var nr={"webservices.rest":"2.24.0",fhir2:"1.0.0-SNAPSHOT"}})(),s})())}}}));
|
|
2
|
+
System.register(["@openmrs/esm-config","@openmrs/esm-navigation","@openmrs/esm-error-handling","@openmrs/esm-offline"],(function(t,e){var r={},n={},o={},i={};return{setters:[function(t){r.Type=t.Type,r.defineConfigSchema=t.defineConfigSchema,r.getConfig=t.getConfig,r.validators=t.validators},function(t){n.navigate=t.navigate},function(t){o.reportError=t.reportError},function(t){i.getSynchronizationItems=t.getSynchronizationItems}],execute:function(){t((()=>{var t={385:()=>{System.register([],(function(t,e){return{execute:function(){t(function(){"use strict";var t=function(t,e){var r=u[t];if(r)return r.active?console.error("Cannot override an existing store. Make sure that stores are only created once."):r.value.setState(e,!0),r.active=!0,r.value;var n=s()((function(){return e}));return u[t]={value:n,active:!0},n},e=function(t,e){var r=u[t];if(!r){var n=s()((function(){return null!=e?e:{}}));return u[t]={value:n,active:!1},n}return r.value},r=function(t,e,r){var n=e(t.getState());return t.subscribe((function(t){var o=e(t);o!==n&&(n=o,r(o))}))},n={d:function(t,e){for(var r in e)n.o(e,r)&&!n.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:e[r]})},o:function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},r:function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})}},o={};n.r(o),n.d(o,{createGlobalStore:function(){return t},getGlobalStore:function(){return e},subscribeTo:function(){return r}});var i=function(t){var e,r=new Set,n=function(t,n){var o="function"==typeof t?t(e):t;if(!Object.is(o,e)){var i=e;e=(null!=n?n:"object"!=typeof o)?o:Object.assign({},e,o),r.forEach((function(t){return t(e,i)}))}},o=function(){return e},i={setState:n,getState:o,subscribe:function(t){return r.add(t),function(){return r.delete(t)}},destroy:function(){console.warn("[DEPRECATED] The `destroy` method will be unsupported in a future version. Instead use unsubscribe function returned by subscribe. Everything will be garbage-collected if store is garbage-collected."),r.clear()}};return e=t(n,o,i),i},s=function(t){return t?i(t):i},u={};return setTimeout((function(){"development"===window.spaEnv&&(window.stores=u)}),1e3),o}())}}}))},824:t=>{"use strict";t.exports=r},254:t=>{"use strict";t.exports=o},513:t=>{"use strict";t.exports=n},738:t=>{"use strict";t.exports=i}},e={};function s(r){var n=e[r];if(void 0!==n)return n.exports;var o=e[r]={exports:{}};return t[r](o,o.exports,s),o.exports}s.d=(t,e)=>{for(var r in e)s.o(e,r)&&!s.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:e[r]})},s.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),s.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})};var u={};return(()=>{"use strict";s.r(u),s.d(u,{OpenmrsFetchError:()=>Fe,VisitMode:()=>Kr,VisitStatus:()=>qr,attachmentUrl:()=>Je,backendDependencies:()=>rn,clearCurrentUser:()=>cr,createAttachment:()=>Ke,defaultVisitCustomRepresentation:()=>Vr,deleteAttachmentPermanently:()=>Qe,fetchCurrentPatient:()=>Pr,fhirBaseUrl:()=>Be,getAttachmentByUuid:()=>ze,getAttachments:()=>Ye,getCurrentUser:()=>ir,getLocations:()=>en,getLoggedInUser:()=>fr,getSessionLocation:()=>pr,getSessionStore:()=>sr,getStartedVisit:()=>Qr,getVisitStore:()=>Fr,getVisitTypes:()=>Zr,getVisitsForPatient:()=>Jr,makeUrl:()=>Ge,openmrsFetch:()=>Ve,openmrsObservableFetch:()=>We,refetchCurrentUser:()=>ar,restBaseUrl:()=>Re,saveVisit:()=>zr,sessionEndpoint:()=>$e,setCurrentVisit:()=>Hr,setSessionLocation:()=>hr,setUserLanguage:()=>ur,setUserProperties:()=>br,setupApiModule:()=>mr,toLocationObject:()=>tn,toVisitTypeObject:()=>Xr,updateVisit:()=>Yr,userHasAccess:()=>lr});var t=function(e,r){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])},t(e,r)};function e(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}function r(t){return"function"==typeof t}var n=!1,o={Promise:void 0,set useDeprecatedSynchronousErrorHandling(t){t&&(new Error).stack,n=t},get useDeprecatedSynchronousErrorHandling(){return n}};function i(t){setTimeout((function(){throw t}),0)}var a={closed:!0,next:function(t){},error:function(t){if(o.useDeprecatedSynchronousErrorHandling)throw t;i(t)},complete:function(){}},c=function(){return Array.isArray||function(t){return t&&"number"==typeof t.length}}();function l(t){return null!==t&&"object"==typeof t}var f=function(){function t(t){return Error.call(this),this.message=t?t.length+" errors occurred during unsubscription:\n"+t.map((function(t,e){return e+1+") "+t.toString()})).join("\n "):"",this.name="UnsubscriptionError",this.errors=t,this}return t.prototype=Object.create(Error.prototype),t}(),p=f,h=function(){function t(t){this.closed=!1,this._parentOrParents=null,this._subscriptions=null,t&&(this._ctorUnsubscribe=!0,this._unsubscribe=t)}return t.prototype.unsubscribe=function(){var e;if(!this.closed){var n=this,o=n._parentOrParents,i=n._ctorUnsubscribe,s=n._unsubscribe,u=n._subscriptions;if(this.closed=!0,this._parentOrParents=null,this._subscriptions=null,o instanceof t)o.remove(this);else if(null!==o)for(var a=0;a<o.length;++a)o[a].remove(this);if(r(s)){i&&(this._unsubscribe=void 0);try{s.call(this)}catch(t){e=t instanceof p?d(t.errors):[t]}}if(c(u)){a=-1;for(var f=u.length;++a<f;){var h=u[a];if(l(h))try{h.unsubscribe()}catch(t){e=e||[],t instanceof p?e=e.concat(d(t.errors)):e.push(t)}}}if(e)throw new p(e)}},t.prototype.add=function(e){var r=e;if(!e)return t.EMPTY;switch(typeof e){case"function":r=new t(e);case"object":if(r===this||r.closed||"function"!=typeof r.unsubscribe)return r;if(this.closed)return r.unsubscribe(),r;if(!(r instanceof t)){var n=r;(r=new t)._subscriptions=[n]}break;default:throw new Error("unrecognized teardown "+e+" added to Subscription.")}var o=r._parentOrParents;if(null===o)r._parentOrParents=this;else if(o instanceof t){if(o===this)return r;r._parentOrParents=[o,this]}else{if(-1!==o.indexOf(this))return r;o.push(this)}var i=this._subscriptions;return null===i?this._subscriptions=[r]:i.push(r),r},t.prototype.remove=function(t){var e=this._subscriptions;if(e){var r=e.indexOf(t);-1!==r&&e.splice(r,1)}},t.EMPTY=function(t){return t.closed=!0,t}(new t),t}();function d(t){return t.reduce((function(t,e){return t.concat(e instanceof p?e.errors:e)}),[])}var b=function(){return"function"==typeof Symbol?Symbol("rxSubscriber"):"@@rxSubscriber_"+Math.random()}(),y=function(t){function r(e,n,o){var i=t.call(this)||this;switch(i.syncErrorValue=null,i.syncErrorThrown=!1,i.syncErrorThrowable=!1,i.isStopped=!1,arguments.length){case 0:i.destination=a;break;case 1:if(!e){i.destination=a;break}if("object"==typeof e){e instanceof r?(i.syncErrorThrowable=e.syncErrorThrowable,i.destination=e,e.add(i)):(i.syncErrorThrowable=!0,i.destination=new m(i,e));break}default:i.syncErrorThrowable=!0,i.destination=new m(i,e,n,o)}return i}return e(r,t),r.prototype[b]=function(){return this},r.create=function(t,e,n){var o=new r(t,e,n);return o.syncErrorThrowable=!1,o},r.prototype.next=function(t){this.isStopped||this._next(t)},r.prototype.error=function(t){this.isStopped||(this.isStopped=!0,this._error(t))},r.prototype.complete=function(){this.isStopped||(this.isStopped=!0,this._complete())},r.prototype.unsubscribe=function(){this.closed||(this.isStopped=!0,t.prototype.unsubscribe.call(this))},r.prototype._next=function(t){this.destination.next(t)},r.prototype._error=function(t){this.destination.error(t),this.unsubscribe()},r.prototype._complete=function(){this.destination.complete(),this.unsubscribe()},r.prototype._unsubscribeAndRecycle=function(){var t=this._parentOrParents;return this._parentOrParents=null,this.unsubscribe(),this.closed=!1,this.isStopped=!1,this._parentOrParents=t,this},r}(h),m=function(t){function n(e,n,o,i){var s,u=t.call(this)||this;u._parentSubscriber=e;var c=u;return r(n)?s=n:n&&(s=n.next,o=n.error,i=n.complete,n!==a&&(r((c=Object.create(n)).unsubscribe)&&u.add(c.unsubscribe.bind(c)),c.unsubscribe=u.unsubscribe.bind(u))),u._context=c,u._next=s,u._error=o,u._complete=i,u}return e(n,t),n.prototype.next=function(t){if(!this.isStopped&&this._next){var e=this._parentSubscriber;o.useDeprecatedSynchronousErrorHandling&&e.syncErrorThrowable?this.__tryOrSetError(e,this._next,t)&&this.unsubscribe():this.__tryOrUnsub(this._next,t)}},n.prototype.error=function(t){if(!this.isStopped){var e=this._parentSubscriber,r=o.useDeprecatedSynchronousErrorHandling;if(this._error)r&&e.syncErrorThrowable?(this.__tryOrSetError(e,this._error,t),this.unsubscribe()):(this.__tryOrUnsub(this._error,t),this.unsubscribe());else if(e.syncErrorThrowable)r?(e.syncErrorValue=t,e.syncErrorThrown=!0):i(t),this.unsubscribe();else{if(this.unsubscribe(),r)throw t;i(t)}}},n.prototype.complete=function(){var t=this;if(!this.isStopped){var e=this._parentSubscriber;if(this._complete){var r=function(){return t._complete.call(t._context)};o.useDeprecatedSynchronousErrorHandling&&e.syncErrorThrowable?(this.__tryOrSetError(e,r),this.unsubscribe()):(this.__tryOrUnsub(r),this.unsubscribe())}else this.unsubscribe()}},n.prototype.__tryOrUnsub=function(t,e){try{t.call(this._context,e)}catch(t){if(this.unsubscribe(),o.useDeprecatedSynchronousErrorHandling)throw t;i(t)}},n.prototype.__tryOrSetError=function(t,e,r){if(!o.useDeprecatedSynchronousErrorHandling)throw new Error("bad call");try{e.call(this._context,r)}catch(e){return o.useDeprecatedSynchronousErrorHandling?(t.syncErrorValue=e,t.syncErrorThrown=!0,!0):(i(e),!0)}return!1},n.prototype._unsubscribe=function(){var t=this._parentSubscriber;this._context=null,this._parentSubscriber=null,t.unsubscribe()},n}(y),v=function(){return"function"==typeof Symbol&&Symbol.observable||"@@observable"}();function w(t){return t}var g=function(){function t(t){this._isScalar=!1,t&&(this._subscribe=t)}return t.prototype.lift=function(e){var r=new t;return r.source=this,r.operator=e,r},t.prototype.subscribe=function(t,e,r){var n=this.operator,i=function(t,e,r){if(t){if(t instanceof y)return t;if(t[b])return t[b]()}return t||e||r?new y(t,e,r):new y(a)}(t,e,r);if(n?i.add(n.call(i,this.source)):i.add(this.source||o.useDeprecatedSynchronousErrorHandling&&!i.syncErrorThrowable?this._subscribe(i):this._trySubscribe(i)),o.useDeprecatedSynchronousErrorHandling&&i.syncErrorThrowable&&(i.syncErrorThrowable=!1,i.syncErrorThrown))throw i.syncErrorValue;return i},t.prototype._trySubscribe=function(t){try{return this._subscribe(t)}catch(e){o.useDeprecatedSynchronousErrorHandling&&(t.syncErrorThrown=!0,t.syncErrorValue=e),function(t){for(;t;){var e=t,r=e.closed,n=e.destination,o=e.isStopped;if(r||o)return!1;t=n&&n instanceof y?n:null}return!0}(t)?t.error(e):console.warn(e)}},t.prototype.forEach=function(t,e){var r=this;return new(e=E(e))((function(e,n){var o;o=r.subscribe((function(e){try{t(e)}catch(t){n(t),o&&o.unsubscribe()}}),n,e)}))},t.prototype._subscribe=function(t){var e=this.source;return e&&e.subscribe(t)},t.prototype[v]=function(){return this},t.prototype.pipe=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return 0===t.length?this:(0===(r=t).length?w:1===r.length?r[0]:function(t){return r.reduce((function(t,e){return e(t)}),t)})(this);var r},t.prototype.toPromise=function(t){var e=this;return new(t=E(t))((function(t,r){var n;e.subscribe((function(t){return n=t}),(function(t){return r(t)}),(function(){return t(n)}))}))},t.create=function(e){return new t(e)},t}();function E(t){if(t||(t=o.Promise||Promise),!t)throw new Error("no Promise impl found");return t}const S="object"==typeof global&&global&&global.Object===Object&&global;var O="object"==typeof self&&self&&self.Object===Object&&self;const P=(S||O||Function("return this")()).Symbol;var _=Object.prototype,T=_.hasOwnProperty,j=_.toString,A=P?P.toStringTag:void 0;var x=Object.prototype.toString;var N=P?P.toStringTag:void 0;const D=function(t){return null==t?void 0===t?"[object Undefined]":"[object Null]":N&&N in Object(t)?function(t){var e=T.call(t,A),r=t[A];try{t[A]=void 0;var n=!0}catch(t){}var o=j.call(t);return n&&(e?t[A]=r:delete t[A]),o}(t):function(t){return x.call(t)}(t)},U=(M=Object.getPrototypeOf,C=Object,function(t){return M(C(t))});var M,C;var k=Function.prototype,L=Object.prototype,I=k.toString,R=L.hasOwnProperty,B=I.call(Object);const $=function(t){if(!function(t){return null!=t&&"object"==typeof t}(t)||"[object Object]"!=D(t))return!1;var e=U(t);if(null===e)return!0;var r=R.call(e,"constructor")&&e.constructor;return"function"==typeof r&&r instanceof r&&I.call(r)==B};var G=s(824),V=s(513),W=s(385);(0,W.createGlobalStore)("breadcrumbs",[]);var F=Object.freeze({__proto__:null,get start(){return Te},get ensureJQuerySupport(){return te},get setBootstrapMaxTime(){return Ct},get setMountMaxTime(){return kt},get setUnmountMaxTime(){return Lt},get setUnloadMaxTime(){return It},get registerApplication(){return pe},get unregisterApplication(){return de},get getMountedApps(){return ae},get getAppStatus(){return le},get unloadApplication(){return be},get checkActivityFunctions(){return he},get getAppNames(){return ce},get pathToActiveWhen(){return ve},get navigateToUrl(){return Ft},get patchHistoryApi(){return Qt},get triggerAppChange(){return Se},get addErrorHandler(){return K},get removeErrorHandler(){return q},get mountRootParcel(){return xt},get NOT_LOADED(){return Z},get LOADING_SOURCE_CODE(){return tt},get NOT_BOOTSTRAPPED(){return et},get BOOTSTRAPPING(){return rt},get NOT_MOUNTED(){return nt},get MOUNTING(){return ot},get UPDATING(){return st},get LOAD_ERROR(){return ct},get MOUNTED(){return it},get UNLOADING(){return at},get UNMOUNTING(){return ut},get SKIP_BECAUSE_BROKEN(){return lt}}),H=("undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{}).CustomEvent,J=function(){try{var t=new H("cat",{detail:{foo:"bar"}});return"cat"===t.type&&"bar"===t.detail.foo}catch(t){}return!1}()?H:"undefined"!=typeof document&&"function"==typeof document.createEvent?function(t,e){var r=document.createEvent("CustomEvent");return e?r.initCustomEvent(t,e.bubbles,e.cancelable,e.detail):r.initCustomEvent(t,!1,!1,void 0),r}:function(t,e){var r=document.createEventObject();return r.type=t,e?(r.bubbles=Boolean(e.bubbles),r.cancelable=Boolean(e.cancelable),r.detail=e.detail):(r.bubbles=!1,r.cancelable=!1,r.detail=void 0),r};let z=[];function Y(t,e,r){const n=X(t,e,r);z.length?z.forEach((t=>t(n))):setTimeout((()=>{throw n}))}function K(t){if("function"!=typeof t)throw Error(Q(28,!1));z.push(t)}function q(t){if("function"!=typeof t)throw Error(Q(29,!1));let e=!1;return z=z.filter((r=>{const n=r===t;return e=e||n,!n})),e}function Q(t,e,...r){return`single-spa minified message #${t}: ${e?e+" ":""}See https://single-spa.js.org/error/?code=${t}${r.length?`&arg=${r.join("&arg=")}`:""}`}function X(t,e,r){const n=`${bt(e)} '${ht(e)}' died in status ${e.status}: `;let o;if(t instanceof Error){try{t.message=n+t.message}catch(t){}o=t}else{console.warn(Q(30,!1,e.status,ht(e)));try{o=Error(n+JSON.stringify(t))}catch(e){o=t}}return o.appOrParcelName=ht(e),e.status=r,o}const Z="NOT_LOADED",tt="LOADING_SOURCE_CODE",et="NOT_BOOTSTRAPPED",rt="BOOTSTRAPPING",nt="NOT_MOUNTED",ot="MOUNTING",it="MOUNTED",st="UPDATING",ut="UNMOUNTING",at="UNLOADING",ct="LOAD_ERROR",lt="SKIP_BECAUSE_BROKEN";function ft(t){return t.status===it}function pt(t){try{return t.activeWhen(window.location)}catch(e){return Y(e,t,lt),!1}}function ht(t){return t.name}function dt(t){return Boolean(t.unmountThisParcel)}function bt(t){return dt(t)?"parcel":"application"}function yt(){for(let t=arguments.length-1;t>0;t--)for(let e in arguments[t])"__proto__"!==e&&(arguments[t-1][e]=arguments[t][e]);return arguments[0]}function mt(t,e){for(let r=0;r<t.length;r++)if(e(t[r]))return t[r];return null}function vt(t){return t&&("function"==typeof t||(e=t,Array.isArray(e)&&!mt(e,(t=>"function"!=typeof t))));var e}function wt(t,e){let r=t[e]||[];r=Array.isArray(r)?r:[r],0===r.length&&(r=[()=>Promise.resolve()]);const n=bt(t),o=ht(t);return function(t){return r.reduce(((r,i,s)=>r.then((()=>{const r=i(t);return gt(r)?r:Promise.reject(Q(15,!1,n,o,e,s))}))),Promise.resolve())}}function gt(t){return t&&"function"==typeof t.then&&"function"==typeof t.catch}let Et=[];function St(t,e){return Promise.resolve().then((()=>t.status!==et?t:(t.status=rt,t.bootstrap?Rt(t,"bootstrap").then(r).catch((r=>{if(e)throw X(r,t,lt);return Y(r,t,lt),t})):Promise.resolve().then(r))));function r(){return t.status=nt,t}}function Ot(t,e){return Promise.resolve().then((()=>{if(t.status!==it)return t;t.status=ut;const r=Object.keys(t.parcels).map((e=>t.parcels[e].unmountThisParcel()));return Promise.all(r).then(n,(r=>n().then((()=>{const n=Error(r.message);if(e)throw X(n,t,lt);Y(n,t,lt)})))).then((()=>t));function n(){return Rt(t,"unmount").then((()=>{t.status=nt}),(r=>{if(e)throw X(r,t,lt);Y(r,t,lt)}))}}))}let Pt=!1,_t=!1;function Tt(t,e){return Promise.resolve().then((()=>t.status!==nt?t:(Pt||(window.dispatchEvent(new J("single-spa:before-first-mount")),Pt=!0),t.status=ot,Rt(t,"mount").then((()=>(t.status=it,_t||(window.dispatchEvent(new J("single-spa:first-mount")),_t=!0),t))).catch((r=>{return t.status=it,Ot(t,!0).then(n,n);function n(){if(e)throw X(r,t,lt);return Y(r,t,lt),t}})))))}let jt=0;const At={parcels:{}};function xt(){return Nt.apply(At,arguments)}function Nt(t,e){const r=this;if(!t||"object"!=typeof t&&"function"!=typeof t)throw Error(Q(2,!1));if(t.name&&"string"!=typeof t.name)throw Error(Q(3,!1,typeof t.name));const n=jt++;let o=t.name||`parcel-${n}`;if("object"!=typeof e)throw Error(Q(4,!1,o,typeof e));if(!e.domElement)throw Error(Q(5,!1,o));const i="function"==typeof t,s=i?t:()=>Promise.resolve(t),u={id:n,parcels:{},status:i?tt:et,customProps:e,parentName:ht(r),unmountThisParcel:()=>f.then((()=>{if(u.status!==it)throw Error(Q(6,!1,o,u.status));return Ot(u,!0)})).then((t=>(u.parentName&&delete r.parcels[u.id],t))).then((t=>(p(t),t))).catch((t=>{throw u.status=lt,h(t),t}))};let a;r.parcels[n]=u;let c=s();if(!c||"function"!=typeof c.then)throw Error(Q(7,!1));c=c.then((t=>{if(!t)throw Error(Q(8,!1));if(o=t.name||`parcel-${n}`,Object.prototype.hasOwnProperty.call(t,"bootstrap")&&!vt(t.bootstrap))throw Error(Q(9,!1,o));if(!vt(t.mount))throw Error(Q(10,!1,o));if(!vt(t.unmount))throw Error(Q(11,!1,o));if(t.update&&!vt(t.update))throw Error(Q(12,!1,o));const e=wt(t,"bootstrap"),r=wt(t,"mount"),i=wt(t,"unmount");u.status=et,u.name=o,u.bootstrap=e,u.mount=r,u.unmount=i,u.timeouts=Bt(t.timeouts),t.update&&(u.update=wt(t,"update"),a.update=function(t){return u.customProps=t,Dt((e=u,Promise.resolve().then((()=>{if(e.status!==it)throw Error(Q(32,!1,ht(e)));return e.status=st,Rt(e,"update").then((()=>(e.status=it,e))).catch((t=>{throw X(t,e,lt)}))}))));var e})}));const l=c.then((()=>St(u,!0))),f=l.then((()=>Tt(u,!0)));let p,h;const d=new Promise(((t,e)=>{p=t,h=e}));return a={mount:()=>Dt(Promise.resolve().then((()=>{if(u.status!==nt)throw Error(Q(13,!1,o,u.status));return r.parcels[n]=u,Tt(u)}))),unmount:()=>Dt(u.unmountThisParcel()),getStatus:()=>u.status,loadPromise:Dt(c),bootstrapPromise:Dt(l),mountPromise:Dt(f),unmountPromise:Dt(d)},a}function Dt(t){return t.then((()=>null))}function Ut(t){const e=ht(t);let r="function"==typeof t.customProps?t.customProps(e,window.location):t.customProps;("object"!=typeof r||null===r||Array.isArray(r))&&(r={},console.warn(Q(40,!1),e,r));const n=yt({},r,{name:e,mountParcel:Nt.bind(t),singleSpa:F});return dt(t)&&(n.unmountSelf=t.unmountThisParcel),n}const Mt={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 Ct(t,e,r){if("number"!=typeof t||t<=0)throw Error(Q(16,!1));Mt.bootstrap={millis:t,dieOnTimeout:e,warningMillis:r||1e3}}function kt(t,e,r){if("number"!=typeof t||t<=0)throw Error(Q(17,!1));Mt.mount={millis:t,dieOnTimeout:e,warningMillis:r||1e3}}function Lt(t,e,r){if("number"!=typeof t||t<=0)throw Error(Q(18,!1));Mt.unmount={millis:t,dieOnTimeout:e,warningMillis:r||1e3}}function It(t,e,r){if("number"!=typeof t||t<=0)throw Error(Q(19,!1));Mt.unload={millis:t,dieOnTimeout:e,warningMillis:r||1e3}}function Rt(t,e){const r=t.timeouts[e],n=r.warningMillis,o=bt(t);return new Promise(((i,s)=>{let u=!1,a=!1;t[e](Ut(t)).then((t=>{u=!0,i(t)})).catch((t=>{u=!0,s(t)})),setTimeout((()=>l(1)),n),setTimeout((()=>l(!0)),r.millis);const c=Q(31,!1,e,o,ht(t),r.millis);function l(t){if(!u)if(!0===t)a=!0,r.dieOnTimeout?s(Error(c)):console.error(c);else if(!a){const e=t,o=e*n;console.warn(c),o+n<r.millis&&setTimeout((()=>l(e+1)),n)}}}))}function Bt(t){const e={};for(let r in Mt)e[r]=yt({},Mt[r],t&&t[r]||{});return e}function $t(t){return Promise.resolve().then((()=>{if(t.loadPromise)return t.loadPromise;if(t.status!==Z&&t.status!==ct)return t;let e,r;return t.status=tt,t.loadPromise=Promise.resolve().then((()=>{const n=t.loadApp(Ut(t));if(!gt(n))throw r=!0,Error(Q(33,!1,ht(t)));return n.then((r=>{let n;t.loadErrorTime=null,e=r,"object"!=typeof e&&(n=34),Object.prototype.hasOwnProperty.call(e,"bootstrap")&&!vt(e.bootstrap)&&(n=35),vt(e.mount)||(n=36),vt(e.unmount)||(n=37);const o=bt(e);if(n){let r;try{r=JSON.stringify(e)}catch(t){}return console.error(Q(n,!1,o,ht(t),r),e),Y(void 0,t,lt),t}return e.devtools&&e.devtools.overlays&&(t.devtools.overlays=yt({},t.devtools.overlays,e.devtools.overlays)),t.status=et,t.bootstrap=wt(e,"bootstrap"),t.mount=wt(e,"mount"),t.unmount=wt(e,"unmount"),t.unload=wt(e,"unload"),t.timeouts=Bt(e.timeouts),delete t.loadPromise,t}))})).catch((e=>{let n;return delete t.loadPromise,r?n=lt:(n=ct,t.loadErrorTime=(new Date).getTime()),Y(e,t,n),t}))}))}const Gt="undefined"!=typeof window,Vt={hashchange:[],popstate:[]},Wt=["hashchange","popstate"];function Ft(t){let e;if("string"==typeof t)e=t;else if(this&&this.href)e=this.href;else{if(!(t&&t.currentTarget&&t.currentTarget.href&&t.preventDefault))throw Error(Q(14,!1));e=t.currentTarget.href,t.preventDefault()}const r=Xt(window.location.href),n=Xt(e);0===e.indexOf("#")?window.location.hash=n.hash:r.host!==n.host&&n.host?window.location.href=e:n.pathname===r.pathname&&n.search===r.search?window.location.hash=n.hash:window.history.pushState(null,null,e)}function Ht(t){if(t){const e=t[0].type;Wt.indexOf(e)>=0&&Vt[e].forEach((e=>{try{e.apply(this,t)}catch(t){setTimeout((()=>{throw t}))}}))}}let Jt;function zt(){Oe([],arguments)}function Yt(t,e){return function(){const r=window.location.href,n=t.apply(this,arguments),o=window.location.href;return Jt&&r===o||window.dispatchEvent(function(t,e){let r;try{r=new PopStateEvent("popstate",{state:t})}catch(e){r=document.createEvent("PopStateEvent"),r.initPopStateEvent("popstate",!1,!1,t)}return r.singleSpa=!0,r.singleSpaTrigger=e,r}(window.history.state,e)),n}}let Kt=null,qt=!1;function Qt(t){if(qt)throw Error(Q(43,!1));Jt=!t||!t.hasOwnProperty("urlRerouteOnly")||t.urlRerouteOnly,qt=!0,Kt=window.history.replaceState,window.addEventListener("hashchange",zt),window.addEventListener("popstate",zt);const e=window.addEventListener,r=window.removeEventListener;window.addEventListener=function(t,r){if(!("function"==typeof r&&Wt.indexOf(t)>=0)||mt(Vt[t],(t=>t===r)))return e.apply(this,arguments);Vt[t].push(r)},window.removeEventListener=function(t,e){if(!("function"==typeof e&&Wt.indexOf(t)>=0))return r.apply(this,arguments);Vt[t]=Vt[t].filter((t=>t!==e))},window.history.pushState=Yt(window.history.pushState,"pushState"),window.history.replaceState=Yt(Kt,"replaceState")}function Xt(t){const e=document.createElement("a");return e.href=t,e}Gt&&(window.singleSpaNavigate?console.warn(Q(41,!1)):window.singleSpaNavigate=Ft);let Zt=!1;function te(t=window.jQuery){if(t||window.$&&window.$.fn&&window.$.fn.jquery&&(t=window.$),t&&!Zt){const e=t.fn.on,r=t.fn.off;t.fn.on=function(t,r){return ee.call(this,e,window.addEventListener,t,r,arguments)},t.fn.off=function(t,e){return ee.call(this,r,window.removeEventListener,t,e,arguments)},Zt=!0}}function ee(t,e,r,n,o){return"string"!=typeof r?t.apply(this,o):(r.split(/\s+/).forEach((t=>{Wt.indexOf(t)>=0&&(e(t,n),r=r.replace(t,""))})),""===r.trim()?this:t.apply(this,o))}const re={};function ne(t){return Promise.resolve().then((()=>{const e=re[ht(t)];if(!e)return t;if(t.status===Z)return oe(t,e),t;if(t.status===at)return e.promise.then((()=>t));if(t.status!==nt&&t.status!==ct)return t;const r=t.status===ct?Promise.resolve():Rt(t,"unload");return t.status=at,r.then((()=>(oe(t,e),t))).catch((r=>(function(t,e,r){delete re[ht(t)],delete t.bootstrap,delete t.mount,delete t.unmount,delete t.unload,Y(r,t,lt),e.reject(r)}(t,e,r),t)))}))}function oe(t,e){delete re[ht(t)],delete t.bootstrap,delete t.mount,delete t.unmount,delete t.unload,t.status=Z,e.resolve()}function ie(t,e,r,n){re[ht(t)]={app:t,resolve:r,reject:n},Object.defineProperty(re[ht(t)],"promise",{get:e})}function se(t){return re[t]}const ue=[];function ae(){return ue.filter(ft).map(ht)}function ce(){return ue.map(ht)}function le(t){const e=mt(ue,(e=>ht(e)===t));return e?e.status:null}let fe=!1;function pe(t,e,r,n){const o=function(t,e,r,n){const o={name:null,loadApp:null,activeWhen:null,customProps:null};return"object"==typeof t?(function(t){if(Array.isArray(t)||null===t)throw Error(Q(39,!1));const e=["name","app","activeWhen","customProps"],r=Object.keys(t).reduce(((t,r)=>e.indexOf(r)>=0?t:t.concat(r)),[]);if(0!==r.length)throw Error(Q(38,!1,e.join(", "),r.join(", ")));if("string"!=typeof t.name||0===t.name.length)throw Error(Q(20,!1));if("object"!=typeof t.app&&"function"!=typeof t.app)throw Error(Q(20,!1));const n=t=>"string"==typeof t||"function"==typeof t;if(!(n(t.activeWhen)||Array.isArray(t.activeWhen)&&t.activeWhen.every(n)))throw Error(Q(24,!1));if(!me(t.customProps))throw Error(Q(22,!1))}(t),o.name=t.name,o.loadApp=t.app,o.activeWhen=t.activeWhen,o.customProps=t.customProps):(function(t,e,r,n){if("string"!=typeof t||0===t.length)throw Error(Q(20,!1));if(!e)throw Error(Q(23,!1));if("function"!=typeof r)throw Error(Q(24,!1));if(!me(n))throw Error(Q(22,!1))}(t,e,r,n),o.name=t,o.loadApp=e,o.activeWhen=r,o.customProps=n),o.loadApp="function"!=typeof(i=o.loadApp)?()=>Promise.resolve(i):i,o.customProps=function(t){return t||{}}(o.customProps),o.activeWhen=function(t){let e=Array.isArray(t)?t:[t];return e=e.map((t=>"function"==typeof t?t:ve(t))),t=>e.some((e=>e(t)))}(o.activeWhen),o;var i}(t,e,r,n);if(je()||fe||(fe=!0,setTimeout((()=>{je()||console.warn(Q(1,!1))}),5e3)),-1!==ce().indexOf(o.name))throw Error(Q(21,!1,o.name));ue.push(yt({loadErrorTime:null,status:Z,parcels:{},devtools:{overlays:{options:{},selectors:[]}}},o)),Gt&&(te(),Oe())}function he(t=window.location){return ue.filter((e=>e.activeWhen(t))).map(ht)}function de(t){if(0===ue.filter((e=>ht(e)===t)).length)throw Error(Q(25,!1,t));return(Gt?be(t,{waitForUnmount:!1}):Promise.resolve()).then((()=>{const e=ue.map(ht).indexOf(t);ue.splice(e,1)}))}function be(t,e={waitForUnmount:!1}){if("string"!=typeof t)throw Error(Q(26,!1));const r=mt(ue,(e=>ht(e)===t));if(!r)throw Error(Q(27,!1,t));const n=se(ht(r));if(e&&e.waitForUnmount){if(n)return n.promise;{const t=new Promise(((e,n)=>{ie(r,(()=>t),e,n)}));return t}}{let t;return n?(t=n.promise,ye(r,n.resolve,n.reject)):t=new Promise(((e,n)=>{ie(r,(()=>t),e,n),ye(r,e,n)})),t}}function ye(t,e,r){Promise.resolve().then((()=>{if(mt(he(),(e=>e===ht(t))))return Se()})).then((()=>Ot(t).then(ne).then((()=>{e(),setTimeout((()=>{Oe()}))})))).catch(r)}function me(t){return!t||"function"==typeof t||"object"==typeof t&&null!==t&&!Array.isArray(t)}function ve(t,e){const r=function(t,e){let r=0,n=!1,o="^";"/"!==t[0]&&(t="/"+t);for(let e=0;e<t.length;e++){const r=t[e];(!n&&":"===r||n&&"/"===r)&&i(e)}return i(t.length),new RegExp(o,"i");function i(i){const s=t.slice(r,i).replace(/[|\\{}()[\]^$+*?.]/g,"\\$&");if(o+=n?"[^/]+/?":s,i===t.length)if(n)e&&(o+="$");else{const t=e?"":".*";o="/"===o.charAt(o.length-1)?`${o}${t}$`:`${o}(/${t})?(#.*)?$`}n=!n,r=i}}(t,e);return t=>{let e=t.origin;e||(e=`${t.protocol}//${t.host}`);const n=t.href.replace(e,"").replace(t.search,"").split("?")[0];return r.test(n)}}let we=!1,ge=[],Ee=Gt&&window.location.href;function Se(){return Oe()}function Oe(t=[],e,r=!1){if(we)return new Promise(((t,r)=>{ge.push({resolve:t,reject:r,eventArguments:e})}));const{appsToUnload:n,appsToUnmount:o,appsToLoad:i,appsToMount:s}=function(){const t=[],e=[],r=[],n=[],o=(new Date).getTime();return ue.forEach((i=>{const s=i.status!==lt&&pt(i);switch(i.status){case ct:s&&o-i.loadErrorTime>=200&&r.push(i);break;case Z:case tt:s&&r.push(i);break;case et:case nt:!s&&se(ht(i))?t.push(i):s&&n.push(i);break;case it:s||e.push(i)}})),{appsToUnload:t,appsToUnmount:e,appsToLoad:r,appsToMount:n}}();let u,a=[],c=Ee,l=Ee=window.location.href;return je()?(we=!0,u=n.concat(i,o,s),Promise.resolve().then((()=>(b(0===u.length?"before-no-app-change":"before-app-change",d(!0)),b("before-routing-event",d(!0,{cancelNavigation:f})),Promise.all(a).then((r=>{if(r.some((t=>t)))return Kt.call(window.history,history.state,"",c.substring(location.origin.length)),Ee=location.href,we=!1,Oe(t,e,!0);const u=n.map(ne),a=o.map(Ot).map((t=>t.then(ne))).concat(u),l=Promise.all(a);l.then((()=>{b("before-mount-routing-event",d(!0))}),(t=>{throw t}));const f=i.map((t=>$t(t).then((t=>Pe(t,l))))),y=s.filter((t=>i.indexOf(t)<0)).map((t=>Pe(t,l)));return l.catch((t=>{throw h(),t})).then((()=>(h(),Promise.all(f.concat(y)).catch((e=>{throw t.forEach((t=>t.reject(e))),e})).then(p).then((()=>{}),(t=>{throw t})))))})))))):(u=i,Promise.resolve().then((()=>{const t=i.map($t);return Promise.all(t).then(h).then((()=>[])).catch((t=>{throw h(),t})).finally((()=>{}))})));function f(t=!0){const e="function"==typeof(null==t?void 0:t.then)?t:Promise.resolve(t);a.push(e.catch((t=>(console.warn(Error(Q(42,!1))),console.warn(t),!1))))}function p(){const e=ae();t.forEach((t=>t.resolve(e)));try{b(0===u.length?"no-app-change":"app-change",d()),b("routing-event",d())}catch(t){setTimeout((()=>{throw t}))}if(we=!1,ge.length>0){const t=ge;ge=[],Oe(t)}return e}function h(){r||(t.forEach((t=>{Ht(t.eventArguments)})),Ht(e))}function d(t=!1,r){const a={},f={[it]:[],[nt]:[],[Z]:[],[lt]:[]};t?(i.concat(s).forEach(((t,e)=>{h(t,it)})),n.forEach((t=>{h(t,Z)})),o.forEach((t=>{h(t,nt)}))):u.forEach((t=>{h(t)}));const p={detail:{newAppStatuses:a,appsByNewStatus:f,totalAppChanges:u.length,originalEvent:null==e?void 0:e[0],oldUrl:c,newUrl:l}};return r&&yt(p.detail,r),p;function h(t,e){const r=ht(t);e=e||le(r),a[r]=e,(f[e]=f[e]||[]).push(r)}}function b(t,e){r||window.dispatchEvent(new J(`single-spa:${t}`,e))}}function Pe(t,e){return pt(t)?St(t).then((t=>e.then((()=>pt(t)?Tt(t):t)))):e.then((()=>t))}let _e=!1;function Te(t){_e=!0,Gt&&(Qt(t),Oe())}function je(){return _e}var Ae={getRawAppData:function(){return[...ue]},reroute:Oe,NOT_LOADED:Z,toLoadPromise:$t,toBootstrapPromise:St,unregisterApplication:de,getProfilerData:function(){return Et}};Gt&&window.__SINGLE_SPA_DEVTOOLS__&&(window.__SINGLE_SPA_DEVTOOLS__.exposedMethods=Ae);var xe="openmrs:history";function Ne(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function De(t,e,r,n,o,i,s){try{var u=t[i](s),a=u.value}catch(t){return void r(t)}u.done?e(a):Promise.resolve(a).then(n,o)}function Ue(t,e,r){return Ue=Ie()?Reflect.construct:function(t,e,r){var n=[null];n.push.apply(n,e);var o=new(Function.bind.apply(t,n));return r&&ke(o,r.prototype),o},Ue.apply(null,arguments)}function Me(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function Ce(t){return Ce=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},Ce(t)}function ke(t,e){return ke=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},ke(t,e)}function Le(t){var e="function"==typeof Map?new Map:void 0;return Le=function(t){if(null===t||(r=t,-1===Function.toString.call(r).indexOf("[native code]")))return t;var r;if("function"!=typeof t)throw new TypeError("Super expression must either be null or a function");if(void 0!==e){if(e.has(t))return e.get(t);e.set(t,n)}function n(){return Ue(t,arguments,Ce(this).constructor)}return n.prototype=Object.create(t.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),ke(n,t)},Le(t)}function Ie(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}var Re="/ws/rest/v1/",Be="/ws/fhir2/R4",$e="".concat(Re,"session");function Ge(t){return t&&t.startsWith("http")?t:("/"!==t[0]&&(t="/"+t),window.openmrsBase+t)}function Ve(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if("string"!=typeof t)throw Error("The first argument to @openmrs/api's openmrsFetch function must be a url string");if("object"!=typeof e)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.");var r=Ge(t);if(e.headers||(e.headers={}),$(e.body)&&(e.body=JSON.stringify(e.body)),void 0===e.headers.Accept&&(e.headers.Accept="application/json"),null===e.headers.Accept&&delete e.headers.Accept,t.startsWith(Re)&&void 0===e.headers["Disable-WWW-Authenticate"]&&(e.headers["Disable-WWW-Authenticate"]="true"),t.startsWith(Be)){var n=new URL(r,window.location.toString());n.searchParams.has("_summary")||(n.searchParams.set("_summary","data"),r=n.toString())}var o,i,s=Error();return window.fetch(r,e).then((o=function(t){var e,n;return function(t,e){var r,n,o,i,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:u(0),throw:u(1),return:u(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function u(i){return function(u){return function(i){if(r)throw new TypeError("Generator is already executing.");for(;s;)try{if(r=1,n&&(o=2&i[0]?n.return:i[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,i[1])).done)return o;switch(n=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return s.label++,{value:i[1],done:!1};case 5:s.label++,n=i[1],i=[0];continue;case 7:i=s.ops.pop(),s.trys.pop();continue;default:if(!((o=(o=s.trys).length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){s=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){s.label=i[1];break}if(6===i[0]&&s.label<o[1]){s.label=o[1],o=i;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(i);break}o[2]&&s.ops.pop(),s.trys.pop();continue}i=e.call(t,s)}catch(t){i=[6,t],n=0}finally{r=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,u])}}}(this,(function(o){switch(o.label){case 0:return(e=t).ok?204===e.status?(e.data=null,[2,e]):[2,e.clone().text().then((function(t){try{t&&(e.data=JSON.parse(t))}catch(t){}return e}))]:[3,1];case 1:return[4,(0,G.getConfig)("@openmrs/esm-api")];case 2:return n=o.sent().redirectAuthFailure,r===Ge($e)&&403===e.status||n.enabled&&n.errors.includes(e.status)?(sessionStorage.removeItem(xe),(0,V.navigate)({to:n.url}),[2,n.resolvePromise?Promise.resolve():new Promise((function(){}))]):[2,e.clone().text().then((function(t){var n=t;try{n=JSON.parse(t)}catch(t){}throw new Fe(r,e,n,s)}),(function(t){throw new Fe(r,e,null,s)}))];case 3:return[2]}}))},i=function(){var t=this,e=arguments;return new Promise((function(r,n){var i=o.apply(t,e);function s(t){De(i,r,n,s,u,"next",t)}function u(t){De(i,r,n,s,u,"throw",t)}s(void 0)}))},function(t){return i.apply(this,arguments)}))}function We(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if("object"!=typeof e)throw Error("The second argument to openmrsObservableFetch must be either omitted or an object");var r=new AbortController;return e.signal=r.signal,new g((function(n){var o=!1;return Ve(t,e).then((function(t){o=!0,n.next(t),n.complete()}),(function(t){o=!0,n.error(t)})),function(){o||r.abort()}}))}var Fe=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&ke(t,e)}(o,t);var e,r,n=(e=o,r=Ie(),function(){var t,n=Ce(e);if(r){var o=Ce(this).constructor;t=Reflect.construct(n,arguments,o)}else t=n.apply(this,arguments);return function(t,e){return!e||"object"!=((r=e)&&"undefined"!=typeof Symbol&&r.constructor===Symbol?"symbol":typeof r)&&"function"!=typeof e?Ne(t):e;var r}(this,t)});function o(t,e,r,i){var s;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,o),Me(Ne(s=n.call(this)),"response",void 0),Me(Ne(s),"responseBody",void 0),s.message="Server responded with ".concat(e.status," (").concat(e.statusText,") for url ").concat(t,". Check err.responseBody or network tab in dev tools for more info"),i.message=s.message,s.responseBody=r,s.response=e,s.stack="Stacktrace for outgoing request:\n".concat(i.stack,"\nStacktrace for incoming response:\n").concat(s.stack),s}return o}(Le(Error));function He(t,e,r,n,o,i,s){try{var u=t[i](s),a=u.value}catch(t){return void r(t)}u.done?e(a):Promise.resolve(a).then(n,o)}var Je="/ws/rest/v1/attachment";function ze(t,e){return Ve("".concat(Je,"/").concat(t),{signal:e.signal})}function Ye(t,e,r){return Ve("".concat(Je,"?patient=").concat(t,"&includeEncounterless=").concat(e),{signal:r.signal})}function Ke(t,e){return qe.apply(this,arguments)}function qe(){var t;return t=function(t,e){var r;return function(t,e){var r,n,o,i,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:u(0),throw:u(1),return:u(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function u(i){return function(u){return function(i){if(r)throw new TypeError("Generator is already executing.");for(;s;)try{if(r=1,n&&(o=2&i[0]?n.return:i[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,i[1])).done)return o;switch(n=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return s.label++,{value:i[1],done:!1};case 5:s.label++,n=i[1],i=[0];continue;case 7:i=s.ops.pop(),s.trys.pop();continue;default:if(!((o=(o=s.trys).length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){s=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){s.label=i[1];break}if(6===i[0]&&s.label<o[1]){s.label=o[1],o=i;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(i);break}o[2]&&s.ops.pop(),s.trys.pop();continue}i=e.call(t,s)}catch(t){i=[6,t],n=0}finally{r=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,u])}}}(this,(function(n){return(r=new FormData).append("fileCaption",e.fileName),r.append("patient",t),e.file?r.append("file",e.file):(r.append("file",new File([""],e.fileName),e.fileName),r.append("base64Content",e.base64Content)),[2,Ve("".concat(Je),{method:"POST",body:r})]}))},qe=function(){var e=this,r=arguments;return new Promise((function(n,o){var i=t.apply(e,r);function s(t){He(i,n,o,s,u,"next",t)}function u(t){He(i,n,o,s,u,"throw",t)}s(void 0)}))},qe.apply(this,arguments)}function Qe(t,e){return Ve("".concat(Je,"/").concat(t),{method:"DELETE",signal:e.signal})}var Xe=s(254);const Ze=function(t){return void 0===t};function tr(t,e,r,n,o,i,s){try{var u=t[i](s),a=u.value}catch(t){return void r(t)}u.done?e(a):Promise.resolve(a).then(n,o)}function er(t){return function(){var e=this,r=arguments;return new Promise((function(n,o){var i=t.apply(e,r);function s(t){tr(i,n,o,s,u,"next",t)}function u(t){tr(i,n,o,s,u,"throw",t)}s(void 0)}))}}function rr(t,e){var r,n,o,i,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:u(0),throw:u(1),return:u(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function u(i){return function(u){return function(i){if(r)throw new TypeError("Generator is already executing.");for(;s;)try{if(r=1,n&&(o=2&i[0]?n.return:i[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,i[1])).done)return o;switch(n=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return s.label++,{value:i[1],done:!1};case 5:s.label++,n=i[1],i=[0];continue;case 7:i=s.ops.pop(),s.trys.pop();continue;default:if(!((o=(o=s.trys).length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){s=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){s.label=i[1];break}if(6===i[0]&&s.label<o[1]){s.label=o[1],o=i;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(i);break}o[2]&&s.ops.pop(),s.trys.pop();continue}i=e.call(t,s)}catch(t){i=[6,t],n=0}finally{r=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,u])}}}var nr=(0,W.createGlobalStore)("session",{loaded:!1,session:null}),or=0;function ir(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{includeAuthStatus:!0};return(or<Date.now()-6e4||!nr.getState().loaded)&&ar(),new g((function(e){var r=function(r){var n;r.loaded&&(t.includeAuthStatus?e.next(r.session):e.next(null===(n=r.session)||void 0===n?void 0:n.user))};return r(nr.getState()),nr.subscribe(r)}))}function sr(){return(or<Date.now()-6e4||!nr.getState().loaded)&&ar(),nr}function ur(t){var e,r,n,o=null!==(n=null==t||null===(e=t.user)||void 0===e||null===(r=e.userProperties)||void 0===r?void 0:r.defaultLocale)&&void 0!==n?n:t.locale,i=document.documentElement.getAttribute("lang");(function(t){if(void 0===t||"string"!=typeof t)return!1;try{new Intl.Locale(t)}catch(t){return!1}return!0})(o)&&o!==i&&document.documentElement.setAttribute("lang",o)}function ar(){return new Promise((function(t,e){or=Date.now(),Ve($e).then((function(r){if("object"!=typeof(null==r?void 0:r.data))return e(),Promise.reject();ur(r.data),t(r.data),nr.setState({loaded:!0,session:r.data})})).catch((function(t){return(0,Xe.reportError)("Failed to fetch new session information: ".concat(t)),e(t),{sessionId:"",authenticated:!1}}))}))}function cr(){nr.setState({loaded:!0,session:{authenticated:!1,sessionId:""}})}function lr(t,e){return void 0===e?Boolean(t):!Boolean(t)||function(t,e){return"string"==typeof t?!Ze(e.privileges.find((function(e){return t===e.display}))):Array.isArray(t)?t.every((function(t){return!Ze(e.privileges.find((function(e){return t===e.display})))})):(Ze(t)||console.error('Could not understand privileges "'.concat(t,'"')),!0)}(t,e)||function(t){return!Ze(t.roles.find((function(t){return"System Developer"===t.display})))}(e)}function fr(){var t,e;return new Promise((function(r,n){var o=function(n){n.loaded&&n.session.user&&(t=n.session.user,r(n.session.user),e&&e())};o(nr.getState()),t||(e=nr.subscribe(o))}))}function pr(){return new Promise((function(t,e){ir().subscribe((function(e){t(e.sessionLocation)}),e).unsubscribe()}))}function hr(t,e){return dr.apply(this,arguments)}function dr(){return(dr=er((function(t,e){return rr(this,(function(r){switch(r.label){case 0:return[4,Ve($e,{method:"POST",body:{sessionLocation:t},headers:{"Content-Type":"application/json"},signal:e.signal})];case 1:return r.sent(),[4,ar()];case 2:return r.sent(),[2]}}))}))).apply(this,arguments)}function br(t,e,r){return yr.apply(this,arguments)}function yr(){return(yr=er((function(t,e,r){return rr(this,(function(n){switch(n.label){case 0:return r||(r=new AbortController),[4,Ve("/ws/rest/v1/user/".concat(t),{method:"POST",body:{userProperties:e},headers:{"Content-Type":"application/json"},signal:r.signal})];case 1:return n.sent(),[4,ar()];case 2:return n.sent(),[2]}}))}))).apply(this,arguments)}function mr(){(0,G.defineConfigSchema)("@openmrs/esm-api",{redirectAuthFailure:{enabled:{_type:G.Type.Boolean,_default:!0,_description:"Whether to redirect logged-out users to `redirectAuthFailure.url`"},url:{_type:G.Type.String,_default:"${openmrsSpaBase}/login",_validators:[G.validators.isUrl]},errors:{_type:G.Type.Array,_default:[401],_elements:{_type:G.Type.Number,_validators:[G.validators.inRange(100,600)]},_description:"The HTTP error codes for which users will be redirected"},resolvePromise:{_type:G.Type.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."}}}),ar()}var vr=s(738);function wr(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function gr(t,e,r,n,o,i,s){try{var u=t[i](s),a=u.value}catch(t){return void r(t)}u.done?e(a):Promise.resolve(a).then(n,o)}function Er(t){return function(){var e=this,r=arguments;return new Promise((function(n,o){var i=t.apply(e,r);function s(t){gr(i,n,o,s,u,"next",t)}function u(t){gr(i,n,o,s,u,"throw",t)}s(void 0)}))}}function Sr(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=r){var n,o,i=[],s=!0,u=!1;try{for(r=r.call(t);!(s=(n=r.next()).done)&&(i.push(n.value),!e||i.length!==e);s=!0);}catch(t){u=!0,o=t}finally{try{s||null==r.return||r.return()}finally{if(u)throw o}}return i}}(t,e)||function(t,e){if(t){if("string"==typeof t)return wr(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(r):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?wr(t,e):void 0}}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Or(t,e){var r,n,o,i,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:u(0),throw:u(1),return:u(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function u(i){return function(u){return function(i){if(r)throw new TypeError("Generator is already executing.");for(;s;)try{if(r=1,n&&(o=2&i[0]?n.return:i[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,i[1])).done)return o;switch(n=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return s.label++,{value:i[1],done:!1};case 5:s.label++,n=i[1],i=[0];continue;case 7:i=s.ops.pop(),s.trys.pop();continue;default:if(!((o=(o=s.trys).length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){s=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){s.label=i[1];break}if(6===i[0]&&s.label<o[1]){s.label=o[1],o=i;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(i);break}o[2]&&s.ops.pop(),s.trys.pop();continue}i=e.call(t,s)}catch(t){i=[6,t],n=0}finally{r=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,u])}}}function Pr(t,e){return _r.apply(this,arguments)}function _r(){return _r=Er((function(t,e){var r,n,o,i,s,u=arguments;return Or(this,(function(a){switch(a.label){case 0:return r=!(u.length>2&&void 0!==u[2])||u[2],t?(n=null,[4,Promise.all([Ve("".concat(Be,"/Patient/").concat(t),e).catch((function(t){return n=t})),r?Tr(t):Promise.resolve(null)])]):[3,2];case 1:if(o=Sr.apply(void 0,[a.sent(),2]),i=o[0],s=o[1],i.ok)return[2,i.data];if(s)return[2,s];if(n)throw n;a.label=2;case 2:return[2,null]}}))})),_r.apply(this,arguments)}function Tr(t){return jr.apply(this,arguments)}function jr(){return(jr=Er((function(t){var e,r,n;return Or(this,(function(o){switch(o.label){case 0:return[4,(0,vr.getSynchronizationItems)("patient-registration")];case 1:return e=o.sent(),r=e.find((function(e){return e.fhirPatient.id===t})),[2,null!==(n=null==r?void 0:r.fhirPatient)&&void 0!==n?n:null]}}))}))).apply(this,arguments)}var Ar=function(){function t(){return Error.call(this),this.message="object unsubscribed",this.name="ObjectUnsubscribedError",this}return t.prototype=Object.create(Error.prototype),t}(),xr=function(t){function r(e,r){var n=t.call(this)||this;return n.subject=e,n.subscriber=r,n.closed=!1,n}return e(r,t),r.prototype.unsubscribe=function(){if(!this.closed){this.closed=!0;var t=this.subject,e=t.observers;if(this.subject=null,e&&0!==e.length&&!t.isStopped&&!t.closed){var r=e.indexOf(this.subscriber);-1!==r&&e.splice(r,1)}}},r}(h),Nr=function(t){function r(e){var r=t.call(this,e)||this;return r.destination=e,r}return e(r,t),r}(y),Dr=function(t){function r(){var e=t.call(this)||this;return e.observers=[],e.closed=!1,e.isStopped=!1,e.hasError=!1,e.thrownError=null,e}return e(r,t),r.prototype[b]=function(){return new Nr(this)},r.prototype.lift=function(t){var e=new Ur(this,this);return e.operator=t,e},r.prototype.next=function(t){if(this.closed)throw new Ar;if(!this.isStopped)for(var e=this.observers,r=e.length,n=e.slice(),o=0;o<r;o++)n[o].next(t)},r.prototype.error=function(t){if(this.closed)throw new Ar;this.hasError=!0,this.thrownError=t,this.isStopped=!0;for(var e=this.observers,r=e.length,n=e.slice(),o=0;o<r;o++)n[o].error(t);this.observers.length=0},r.prototype.complete=function(){if(this.closed)throw new Ar;this.isStopped=!0;for(var t=this.observers,e=t.length,r=t.slice(),n=0;n<e;n++)r[n].complete();this.observers.length=0},r.prototype.unsubscribe=function(){this.isStopped=!0,this.closed=!0,this.observers=null},r.prototype._trySubscribe=function(e){if(this.closed)throw new Ar;return t.prototype._trySubscribe.call(this,e)},r.prototype._subscribe=function(t){if(this.closed)throw new Ar;return this.hasError?(t.error(this.thrownError),h.EMPTY):this.isStopped?(t.complete(),h.EMPTY):(this.observers.push(t),new xr(this,t))},r.prototype.asObservable=function(){var t=new g;return t.source=this,t},r.create=function(t,e){return new Ur(t,e)},r}(g),Ur=function(t){function r(e,r){var n=t.call(this)||this;return n.destination=e,n.source=r,n}return e(r,t),r.prototype.next=function(t){var e=this.destination;e&&e.next&&e.next(t)},r.prototype.error=function(t){var e=this.destination;e&&e.error&&this.destination.error(t)},r.prototype.complete=function(){var t=this.destination;t&&t.complete&&this.destination.complete()},r.prototype._subscribe=function(t){return this.source?this.source.subscribe(t):h.EMPTY},r}(Dr),Mr=function(t){function r(e){var r=t.call(this)||this;return r._value=e,r}return e(r,t),Object.defineProperty(r.prototype,"value",{get:function(){return this.getValue()},enumerable:!0,configurable:!0}),r.prototype._subscribe=function(e){var r=t.prototype._subscribe.call(this,e);return r&&!r.closed&&e.next(this._value),r},r.prototype.getValue=function(){if(this.hasError)throw this.thrownError;if(this.closed)throw new Ar;return this._value},r.prototype.next=function(e){t.prototype.next.call(this,this._value=e)},r}(Dr),Cr=function(){function t(){return Error.call(this),this.message="argument out of range",this.name="ArgumentOutOfRangeError",this}return t.prototype=Object.create(Error.prototype),t}(),kr=new g((function(t){return t.complete()}));function Lr(t){return function(e){return 0===t?r?function(t){return new g((function(e){return t.schedule((function(){return e.complete()}))}))}(r):kr:e.lift(new Ir(t));var r}}var Ir=function(){function t(t){if(this.total=t,this.total<0)throw new Cr}return t.prototype.call=function(t,e){return e.subscribe(new Rr(t,this.total))},t}(),Rr=function(t){function r(e,r){var n=t.call(this,e)||this;return n.total=r,n.count=0,n}return e(r,t),r.prototype._next=function(t){var e=this.total,r=++this.count;r<=e&&(this.destination.next(t),r===e&&(this.destination.complete(),this.unsubscribe()))},r}(y);function Br(t,e){return function(r){if("function"!=typeof t)throw new TypeError("argument is not a function. Are you looking for `mapTo()`?");return r.lift(new $r(t,e))}}var $r=function(){function t(t,e){this.project=t,this.thisArg=e}return t.prototype.call=function(t,e){return e.subscribe(new Gr(t,this.project,this.thisArg))},t}(),Gr=function(t){function r(e,r,n){var o=t.call(this,e)||this;return o.project=r,o.count=0,o.thisArg=n||o,o}return e(r,t),r.prototype._next=function(t){var e;try{e=this.project.call(this.thisArg,t,this.count++)}catch(t){return void this.destination.error(t)}this.destination.next(e)},r}(y),Vr="custom:(uuid,encounters:(uuid,encounterDatetime,form:(uuid,name),location:ref,encounterType:ref,encounterProviders:(uuid,display,provider:(uuid,display))),patient:(uuid,uuid),visitType:(uuid,name,display),attributes:(uuid,display,attributeType:(name,datatypeClassname,uuid),value),location:(uuid,name,display),startDatetime,stopDatetime)",Wr=function(){try{return JSON.parse(localStorage.getItem("openmrs:visitStoreState")||"null")}catch(t){return null}}()||{patientUuid:null,manuallySetVisitUuid:null};function Fr(){return(0,W.getGlobalStore)("visit",Wr)}function Hr(t,e){Fr().setState({patientUuid:t,manuallySetVisitUuid:e})}function Jr(t,e,r){var n=null!=r?r:Vr;return We("/ws/rest/v1/visit?patient=".concat(t,"&v=").concat(n),{signal:e.signal,method:"GET",headers:{"Content-type":"application/json"}}).pipe(Lr(1)).pipe(Br((function(t){return t})))}function zr(t,e){return We("/ws/rest/v1/visit",{signal:e.signal,method:"POST",headers:{"Content-type":"application/json"},body:t})}function Yr(t,e,r){return We("/ws/rest/v1/visit/".concat(t),{signal:r.signal,method:"POST",headers:{"Content-type":"application/json"},body:e})}Fr().subscribe((function(t){var e;e=t,localStorage.setItem("openmrs:visitStoreState",JSON.stringify(e))}));var Kr,qr,Qr=new Mr(null);function Xr(t){return{uuid:t.uuid,display:t.display,name:t.name}}function Zr(){return We("/ws/rest/v1/visittype").pipe(Br((function(t){return t.data.results.map(Xr)}))).pipe(Lr(1))}function tn(t){return{uuid:t.uuid,display:t.display}}function en(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;return We("/ws/rest/v1/location"+(t?"?tag="+t:"")).pipe(Br((function(t){return t.data.results.map(tn)}))).pipe(Lr(1))}!function(t){t.NEWVISIT="startVisit",t.EDITVISIT="editVisit",t.LOADING="loadingVisit"}(Kr||(Kr={})),function(t){t.NOTSTARTED="notStarted",t.ONGOING="ongoing"}(qr||(qr={}));var rn={"webservices.rest":"2.24.0",fhir2:"1.0.0-SNAPSHOT"}})(),u})())}}}));
|
|
3
3
|
//# sourceMappingURL=openmrs-esm-api.js.map
|