@openmrs/esm-api 5.6.1-pre.1905 → 5.6.1-pre.1908

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.
@@ -10,4 +10,4 @@ built modules 140 KiB [built]
10
10
  cacheable modules 139 KiB
11
11
  ./src/index.ts + 51 modules 135 KiB [built] [code generated]
12
12
  ../esm-state/dist/openmrs-esm-state.js 4.66 KiB [built] [code generated]
13
- webpack 5.88.0 compiled successfully in 3992 ms
13
+ webpack 5.88.0 compiled successfully in 3995 ms
@@ -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=a[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 a[t]={value:r,active:!0},r},e=function(t,e){var n=a[t];return n?(n.active?console.error("Cannot override an existing store. Make sure that stores are only created once."):n.value=e,n.active=!0,n.value):(a[t]={value:e,active:!0},e)},n=function(t,e){var n=a[t];if(!n){var r=u()((function(){return null!=e?e:{}}));return a[t]={value:r,active:!1},r}return n.value},r=function(t,e,n){var r=e(t.getState());return t.subscribe((function(t){var o=e(t);o!==r&&(r=o,n(o))}))},o={d:function(t,e){for(var n in e)o.o(e,n)&&!o.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})}},i={};o.r(i),o.d(i,{createGlobalStore:function(){return t},getGlobalStore:function(){return n},registerGlobalStore:function(){return e},subscribeTo:function(){return r}});var s=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?s(t):s},a={};return setTimeout((function(){"development"===window.spaEnv&&(window.stores=a)}),1e3),i}())}}}))},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 s(n){var r=e[n];if(void 0!==r)return r.exports;var o=e[n]={exports:{}};return t[n](o,o.exports,s),o.exports}s.d=(t,e)=>{for(var n in e)s.o(e,n)&&!s.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:e[n]})},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:()=>Qn,VisitStatus:()=>Xn,attachmentUrl:()=>Je,backendDependencies:()=>or,clearCurrentUser:()=>ln,createAttachment:()=>Ke,defaultVisitCustomRepresentation:()=>Fn,deleteAttachmentPermanently:()=>Qe,fetchCurrentPatient:()=>Tn,fhirBaseUrl:()=>Be,getAttachmentByUuid:()=>ze,getAttachments:()=>Ye,getCurrentUser:()=>sn,getLocations:()=>rr,getLoggedInUser:()=>pn,getSessionLocation:()=>hn,getSessionStore:()=>un,getStartedVisit:()=>Zn,getVisitStore:()=>Jn,getVisitTypes:()=>er,getVisitsForPatient:()=>Yn,makeUrl:()=>$e,openmrsFetch:()=>Ve,openmrsObservableFetch:()=>We,refetchCurrentUser:()=>cn,restBaseUrl:()=>Re,saveVisit:()=>Kn,sessionEndpoint:()=>Ge,setCurrentVisit:()=>zn,setSessionLocation:()=>dn,setUserLanguage:()=>an,setUserProperties:()=>yn,setupApiModule:()=>wn,toLocationObject:()=>nr,toVisitTypeObject:()=>tr,updateVisit:()=>qn,userHasAccess:()=>fn});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,s=r._unsubscribe,u=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(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 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 b=function(){return"function"==typeof Symbol?Symbol("rxSubscriber"):"@@rxSubscriber_"+Math.random()}(),y=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 m(i,e));break}default:i.syncErrorThrowable=!0,i.destination=new m(i,e,r,o)}return i}return e(n,t),n.prototype[b]=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),m=function(t){function r(e,r,o,i){var s,u=t.call(this)||this;u._parentSubscriber=e;var c=u;return n(r)?s=r:r&&(s=r.next,o=r.error,i=r.complete,r!==a&&(n((c=Object.create(r)).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(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}(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 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 y)return t;if(t[b])return t[b]()}return t||e||n?new y(t,e,n):new y(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 y?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[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===(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 P=Object.prototype,T=P.hasOwnProperty,A=P.toString,j=_?_.toStringTag:void 0;var x=Object.prototype.toString;var D=_?_.toStringTag:void 0;const N=function(t){return null==t?void 0===t?"[object Undefined]":"[object Null]":D&&D in Object(t)?function(t){var e=T.call(t,j),n=t[j];try{t[j]=void 0;var r=!0}catch(t){}var o=A.call(t);return r&&(e?t[j]=n:delete t[j]),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 G=function(t){if(!function(t){return null!=t&&"object"==typeof t}(t)||"[object Object]"!=N(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&&I.call(n)==B};var $=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 nt},get NOT_MOUNTED(){return rt},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 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};let z=[];function Y(t,e,n){const r=X(t,e,n);z.length?z.forEach((t=>t(r))):setTimeout((()=>{throw r}))}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((n=>{const r=n===t;return e=e||r,!r})),e}function Q(t,e,...n){return`single-spa minified message #${t}: ${e?e+" ":""}See https://single-spa.js.org/error/?code=${t}${n.length?`&arg=${n.join("&arg=")}`:""}`}function X(t,e,n){const r=`${bt(e)} '${ht(e)}' died in status ${e.status}: `;let o;if(t instanceof Error){try{t.message=r+t.message}catch(t){}o=t}else{console.warn(Q(30,!1,e.status,ht(e)));try{o=Error(r+JSON.stringify(t))}catch(e){o=t}}return o.appOrParcelName=ht(e),e.status=n,o}const Z="NOT_LOADED",tt="LOADING_SOURCE_CODE",et="NOT_BOOTSTRAPPED",nt="BOOTSTRAPPING",rt="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 n=0;n<t.length;n++)if(e(t[n]))return t[n];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 n=t[e]||[];n=Array.isArray(n)?n:[n],0===n.length&&(n=[()=>Promise.resolve()]);const r=bt(t),o=ht(t);return function(t){return n.reduce(((n,i,s)=>n.then((()=>{const n=i(t);return gt(n)?n:Promise.reject(Q(15,!1,r,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=nt,t.bootstrap?Rt(t,"bootstrap").then(n).catch((n=>{if(e)throw X(n,t,lt);return Y(n,t,lt),t})):Promise.resolve().then(n))));function n(){return t.status=rt,t}}function Ot(t,e){return Promise.resolve().then((()=>{if(t.status!==it)return t;t.status=ut;const n=Object.keys(t.parcels).map((e=>t.parcels[e].unmountThisParcel()));return Promise.all(n).then(r,(n=>r().then((()=>{const r=Error(n.message);if(e)throw X(r,t,lt);Y(r,t,lt)})))).then((()=>t));function r(){return Rt(t,"unmount").then((()=>{t.status=rt}),(n=>{if(e)throw X(n,t,lt);Y(n,t,lt)}))}}))}let _t=!1,Pt=!1;function Tt(t,e){return Promise.resolve().then((()=>t.status!==rt?t:(_t||(window.dispatchEvent(new J("single-spa:before-first-mount")),_t=!0),t.status=ot,Rt(t,"mount").then((()=>(t.status=it,Pt||(window.dispatchEvent(new J("single-spa:first-mount")),Pt=!0),t))).catch((n=>{return t.status=it,Ot(t,!0).then(r,r);function r(){if(e)throw X(n,t,lt);return Y(n,t,lt),t}})))))}let At=0;const jt={parcels:{}};function xt(){return Dt.apply(jt,arguments)}function Dt(t,e){const n=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 r=At++;let o=t.name||`parcel-${r}`;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:r,parcels:{},status:i?tt:et,customProps:e,parentName:ht(n),unmountThisParcel:()=>f.then((()=>{if(u.status!==it)throw Error(Q(6,!1,o,u.status));return Ot(u,!0)})).then((t=>(u.parentName&&delete n.parcels[u.id],t))).then((t=>(p(t),t))).catch((t=>{throw u.status=lt,h(t),t}))};let a;n.parcels[r]=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-${r}`,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"),n=wt(t,"mount"),i=wt(t,"unmount");u.status=et,u.name=o,u.bootstrap=e,u.mount=n,u.unmount=i,u.timeouts=Bt(t.timeouts),t.update&&(u.update=wt(t,"update"),a.update=function(t){return u.customProps=t,Nt((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:()=>Nt(Promise.resolve().then((()=>{if(u.status!==rt)throw Error(Q(13,!1,o,u.status));return n.parcels[r]=u,Tt(u)}))),unmount:()=>Nt(u.unmountThisParcel()),getStatus:()=>u.status,loadPromise:Nt(c),bootstrapPromise:Nt(l),mountPromise:Nt(f),unmountPromise:Nt(d)},a}function Nt(t){return t.then((()=>null))}function Ut(t){const e=ht(t);let n="function"==typeof t.customProps?t.customProps(e,window.location):t.customProps;("object"!=typeof n||null===n||Array.isArray(n))&&(n={},console.warn(Q(40,!1),e,n));const r=yt({},n,{name:e,mountParcel:Dt.bind(t),singleSpa:F});return dt(t)&&(r.unmountSelf=t.unmountThisParcel),r}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,n){if("number"!=typeof t||t<=0)throw Error(Q(16,!1));Mt.bootstrap={millis:t,dieOnTimeout:e,warningMillis:n||1e3}}function kt(t,e,n){if("number"!=typeof t||t<=0)throw Error(Q(17,!1));Mt.mount={millis:t,dieOnTimeout:e,warningMillis:n||1e3}}function Lt(t,e,n){if("number"!=typeof t||t<=0)throw Error(Q(18,!1));Mt.unmount={millis:t,dieOnTimeout:e,warningMillis:n||1e3}}function It(t,e,n){if("number"!=typeof t||t<=0)throw Error(Q(19,!1));Mt.unload={millis:t,dieOnTimeout:e,warningMillis:n||1e3}}function Rt(t,e){const n=t.timeouts[e],r=n.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)),r),setTimeout((()=>l(!0)),n.millis);const c=Q(31,!1,e,o,ht(t),n.millis);function l(t){if(!u)if(!0===t)a=!0,n.dieOnTimeout?s(Error(c)):console.error(c);else if(!a){const e=t,o=e*r;console.warn(c),o+r<n.millis&&setTimeout((()=>l(e+1)),r)}}}))}function Bt(t){const e={};for(let n in Mt)e[n]=yt({},Mt[n],t&&t[n]||{});return e}function Gt(t){return Promise.resolve().then((()=>{if(t.loadPromise)return t.loadPromise;if(t.status!==Z&&t.status!==ct)return t;let e,n;return t.status=tt,t.loadPromise=Promise.resolve().then((()=>{const r=t.loadApp(Ut(t));if(!gt(r))throw n=!0,Error(Q(33,!1,ht(t)));return r.then((n=>{let r;t.loadErrorTime=null,e=n,"object"!=typeof e&&(r=34),Object.prototype.hasOwnProperty.call(e,"bootstrap")&&!vt(e.bootstrap)&&(r=35),vt(e.mount)||(r=36),vt(e.unmount)||(r=37);const o=bt(e);if(r){let n;try{n=JSON.stringify(e)}catch(t){}return console.error(Q(r,!1,o,ht(t),n),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 r;return delete t.loadPromise,n?r=lt:(r=ct,t.loadErrorTime=(new Date).getTime()),Y(e,t,r),t}))}))}const $t="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 n=Xt(window.location.href),r=Xt(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 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 n=window.location.href,r=t.apply(this,arguments),o=window.location.href;return Jt&&n===o||window.dispatchEvent(function(t,e){let n;try{n=new PopStateEvent("popstate",{state:t})}catch(e){n=document.createEvent("PopStateEvent"),n.initPopStateEvent("popstate",!1,!1,t)}return n.singleSpa=!0,n.singleSpaTrigger=e,n}(window.history.state,e)),r}}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,n=window.removeEventListener;window.addEventListener=function(t,n){if(!("function"==typeof n&&Wt.indexOf(t)>=0)||mt(Vt[t],(t=>t===n)))return e.apply(this,arguments);Vt[t].push(n)},window.removeEventListener=function(t,e){if(!("function"==typeof e&&Wt.indexOf(t)>=0))return n.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}$t&&(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,n=t.fn.off;t.fn.on=function(t,n){return ee.call(this,e,window.addEventListener,t,n,arguments)},t.fn.off=function(t,e){return ee.call(this,n,window.removeEventListener,t,e,arguments)},Zt=!0}}function ee(t,e,n,r,o){return"string"!=typeof n?t.apply(this,o):(n.split(/\s+/).forEach((t=>{Wt.indexOf(t)>=0&&(e(t,r),n=n.replace(t,""))})),""===n.trim()?this:t.apply(this,o))}const ne={};function re(t){return Promise.resolve().then((()=>{const e=ne[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!==rt&&t.status!==ct)return t;const n=t.status===ct?Promise.resolve():Rt(t,"unload");return t.status=at,n.then((()=>(oe(t,e),t))).catch((n=>(function(t,e,n){delete ne[ht(t)],delete t.bootstrap,delete t.mount,delete t.unmount,delete t.unload,Y(n,t,lt),e.reject(n)}(t,e,n),t)))}))}function oe(t,e){delete ne[ht(t)],delete t.bootstrap,delete t.mount,delete t.unmount,delete t.unload,t.status=Z,e.resolve()}function ie(t,e,n,r){ne[ht(t)]={app:t,resolve:n,reject:r},Object.defineProperty(ne[ht(t)],"promise",{get:e})}function se(t){return ne[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,n,r){const o=function(t,e,n,r){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"],n=Object.keys(t).reduce(((t,n)=>e.indexOf(n)>=0?t:t.concat(n)),[]);if(0!==n.length)throw Error(Q(38,!1,e.join(", "),n.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 r=t=>"string"==typeof t||"function"==typeof t;if(!(r(t.activeWhen)||Array.isArray(t.activeWhen)&&t.activeWhen.every(r)))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,n,r){if("string"!=typeof t||0===t.length)throw Error(Q(20,!1));if(!e)throw Error(Q(23,!1));if("function"!=typeof n)throw Error(Q(24,!1));if(!me(r))throw Error(Q(22,!1))}(t,e,n,r),o.name=t,o.loadApp=e,o.activeWhen=n,o.customProps=r),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,n,r);if(Ae()||fe||(fe=!0,setTimeout((()=>{Ae()||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)),$t&&(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($t?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 n=mt(ue,(e=>ht(e)===t));if(!n)throw Error(Q(27,!1,t));const r=se(ht(n));if(e&&e.waitForUnmount){if(r)return r.promise;{const t=new Promise(((e,r)=>{ie(n,(()=>t),e,r)}));return t}}{let t;return r?(t=r.promise,ye(n,r.resolve,r.reject)):t=new Promise(((e,r)=>{ie(n,(()=>t),e,r),ye(n,e,r)})),t}}function ye(t,e,n){Promise.resolve().then((()=>{if(mt(he(),(e=>e===ht(t))))return Se()})).then((()=>Ot(t).then(re).then((()=>{e(),setTimeout((()=>{Oe()}))})))).catch(n)}function me(t){return!t||"function"==typeof t||"object"==typeof t&&null!==t&&!Array.isArray(t)}function ve(t,e){const n=function(t,e){let n=0,r=!1,o="^";"/"!==t[0]&&(t="/"+t);for(let e=0;e<t.length;e++){const n=t[e];(!r&&":"===n||r&&"/"===n)&&i(e)}return i(t.length),new RegExp(o,"i");function i(i){const s=t.slice(n,i).replace(/[|\\{}()[\]^$+*?.]/g,"\\$&");if(o+=r?"[^/]+/?":s,i===t.length)if(r)e&&(o+="$");else{const t=e?"":".*";o="/"===o.charAt(o.length-1)?`${o}${t}$`:`${o}(/${t})?(#.*)?$`}r=!r,n=i}}(t,e);return t=>{let e=t.origin;e||(e=`${t.protocol}//${t.host}`);const r=t.href.replace(e,"").replace(t.search,"").split("?")[0];return n.test(r)}}let we=!1,ge=[],Ee=$t&&window.location.href;function Se(){return Oe()}function Oe(t=[],e,n=!1){if(we)return new Promise(((t,n)=>{ge.push({resolve:t,reject:n,eventArguments:e})}));const{appsToUnload:r,appsToUnmount:o,appsToLoad:i,appsToMount:s}=function(){const t=[],e=[],n=[],r=[],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&&n.push(i);break;case Z:case tt:s&&n.push(i);break;case et:case rt:!s&&se(ht(i))?t.push(i):s&&r.push(i);break;case it:s||e.push(i)}})),{appsToUnload:t,appsToUnmount:e,appsToLoad:n,appsToMount:r}}();let u,a=[],c=Ee,l=Ee=window.location.href;return Ae()?(we=!0,u=r.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((n=>{if(n.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=r.map(re),a=o.map(Ot).map((t=>t.then(re))).concat(u),l=Promise.all(a);l.then((()=>{b("before-mount-routing-event",d(!0))}),(t=>{throw t}));const f=i.map((t=>Gt(t).then((t=>_e(t,l))))),y=s.filter((t=>i.indexOf(t)<0)).map((t=>_e(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(Gt);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(){n||(t.forEach((t=>{Ht(t.eventArguments)})),Ht(e))}function d(t=!1,n){const a={},f={[it]:[],[rt]:[],[Z]:[],[lt]:[]};t?(i.concat(s).forEach(((t,e)=>{h(t,it)})),r.forEach((t=>{h(t,Z)})),o.forEach((t=>{h(t,rt)}))):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 n&&yt(p.detail,n),p;function h(t,e){const n=ht(t);e=e||le(n),a[n]=e,(f[e]=f[e]||[]).push(n)}}function b(t,e){n||window.dispatchEvent(new J(`single-spa:${t}`,e))}}function _e(t,e){return pt(t)?St(t).then((t=>e.then((()=>pt(t)?Tt(t):t)))):e.then((()=>t))}let Pe=!1;function Te(t){Pe=!0,$t&&(Qt(t),Oe())}function Ae(){return Pe}var je={getRawAppData:function(){return[...ue]},reroute:Oe,NOT_LOADED:Z,toLoadPromise:Gt,toBootstrapPromise:St,unregisterApplication:de,getProfilerData:function(){return Et}};$t&&window.__SINGLE_SPA_DEVTOOLS__&&(window.__SINGLE_SPA_DEVTOOLS__.exposedMethods=je);var xe="openmrs:history";function De(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,s){try{var u=t[i](s),a=u.value}catch(t){return void n(t)}u.done?e(a):Promise.resolve(a).then(r,o)}function Ue(t,e,n){return Ue=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&&ke(o,n.prototype),o},Ue.apply(null,arguments)}function Me(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,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||(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 Ue(t,arguments,Ce(this).constructor)}return r.prototype=Object.create(t.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),ke(r,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",Ge="".concat(Re,"/session");function $e(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=$e(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(Re)&&void 0===e.headers["Disable-WWW-Authenticate"]&&(e.headers["Disable-WWW-Authenticate"]="true"),t.startsWith(Be)){var r=new URL(n,window.location.toString());r.searchParams.has("_summary")||(r.searchParams.set("_summary","data"),n=r.toString())}var o,i,s=Error();return window.fetch(n,e).then((o=function(t){var e,r;return function(t,e){var n,r,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(n)throw new TypeError("Generator is already executing.");for(;s;)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 s.label++,{value:i[1],done:!1};case 5:s.label++,r=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],r=0}finally{n=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,$.getConfig)("@openmrs/esm-api")];case 2:return r=o.sent().redirectAuthFailure,n===$e(Ge)&&403===e.status||r.enabled&&r.errors.includes(e.status)?(sessionStorage.removeItem(xe),(0,V.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,s)}),(function(t){throw new Fe(n,e,null,s)}))];case 3:return[2]}}))},i=function(){var t=this,e=arguments;return new Promise((function(n,r){var i=o.apply(t,e);function s(t){Ne(i,n,r,s,u,"next",t)}function u(t){Ne(i,n,r,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 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&&ke(t,e)}(o,t);var e,n,r=(e=o,n=Ie(),function(){var t,r=Ce(e);if(n){var o=Ce(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?De(t):e;var n}(this,t)});function o(t,e,n,i){var s;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,o),Me(De(s=r.call(this)),"response",void 0),Me(De(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=n,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,n,r,o,i,s){try{var u=t[i](s),a=u.value}catch(t){return void n(t)}u.done?e(a):Promise.resolve(a).then(r,o)}var Je="".concat(Re,"/attachment");function ze(t,e){return Ve("".concat(Je,"/").concat(t),{signal:e.signal})}function Ye(t,e,n){return Ve("".concat(Je,"?patient=").concat(t,"&includeEncounterless=").concat(e),{signal:n.signal})}function Ke(t,e){return qe.apply(this,arguments)}function qe(){var t;return t=function(t,e){var n;return function(t,e){var n,r,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(n)throw new TypeError("Generator is already executing.");for(;s;)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 s.label++,{value:i[1],done:!1};case 5:s.label++,r=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],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,u])}}}(this,(function(r){return(n=new FormData).append("fileCaption",e.fileDescription),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(Je),{method:"POST",body:n})]}))},qe=function(){var e=this,n=arguments;return new Promise((function(r,o){var i=t.apply(e,n);function s(t){He(i,r,o,s,u,"next",t)}function u(t){He(i,r,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 tn(t,e,n,r,o,i,s){try{var u=t[i](s),a=u.value}catch(t){return void n(t)}u.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 s(t){tn(i,r,o,s,u,"next",t)}function u(t){tn(i,r,o,s,u,"throw",t)}s(void 0)}))}}function nn(t,e){var n,r,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(n)throw new TypeError("Generator is already executing.");for(;s;)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 s.label++,{value:i[1],done:!1};case 5:s.label++,r=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],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,u])}}}var rn=(0,W.createGlobalStore)("session",{loaded:!1,session:null}),on=0;function sn(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{includeAuthStatus:!0};return(on<Date.now()-6e4||!rn.getState().loaded)&&cn(),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(rn.getState()),rn.subscribe(n)}))}function un(){return(on<Date.now()-6e4||!rn.getState().loaded)&&cn(),rn}function an(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 cn(t,e){on=Date.now();var n={};return t&&e&&(n.Authorization="Basic ".concat(window.btoa("".concat(t,":").concat(e)))),vn(Ve(Ge,{headers:n}))}function ln(){rn.setState({loaded:!0,session:{authenticated:!1,sessionId:""}})}function fn(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 pn(){var t,e;return new Promise((function(n){var r=function(r){r.loaded&&r.session.user&&(t=r.session.user,n(r.session.user),e&&e())};r(rn.getState()),t||(e=rn.subscribe(r))}))}function hn(){return new Promise((function(t,e){sn().subscribe((function(e){t(e.sessionLocation)}),e).unsubscribe()}))}function dn(t,e){return bn.apply(this,arguments)}function bn(){return(bn=en((function(t,e){return nn(this,(function(n){return[2,vn(Ve(Ge,{method:"POST",body:{sessionLocation:t},headers:{"Content-Type":"application/json"},signal:e.signal}))]}))}))).apply(this,arguments)}function yn(t,e,n){return mn.apply(this,arguments)}function mn(){return(mn=en((function(t,e,n){return nn(this,(function(r){switch(r.label){case 0:return n||(n=new AbortController),[4,Ve("".concat(Re,"/user/").concat(t),{method:"POST",body:{userProperties:e},headers:{"Content-Type":"application/json"},signal:n.signal})];case 1:return r.sent(),[2,cn()]}}))}))).apply(this,arguments)}function vn(t){return new Promise((function(e,n){t.then((function(t){var r;"object"==typeof(null==t?void 0:t.data)?(r={loaded:!0,session:t.data},rn.setState(r),e(r)):(r={loaded:!1,session:null},rn.setState(r),n(r))})).catch((function(t){(0,Xe.reportError)("Failed to fetch new session information: ".concat(t));var e={loaded:!1,session:null};rn.setState(e),n(e)}))}))}function wn(){(0,$.defineConfigSchema)("@openmrs/esm-api",{redirectAuthFailure:{enabled:{_type:$.Type.Boolean,_default:!0,_description:"Whether to redirect logged-out users to `redirectAuthFailure.url`"},url:{_type:$.Type.String,_default:"${openmrsSpaBase}/login",_validators:[$.validators.isUrl]},errors:{_type:$.Type.Array,_default:[401],_elements:{_type:$.Type.Number,_validators:[$.validators.inRange(100,600)]},_description:"The HTTP error codes for which users will be redirected"},resolvePromise:{_type:$.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."}}}),cn()}rn.subscribe((function(t){return t.session&&an(t.session)}));var gn=s(738);function En(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 Sn(t,e,n,r,o,i,s){try{var u=t[i](s),a=u.value}catch(t){return void n(t)}u.done?e(a):Promise.resolve(a).then(r,o)}function On(t){return function(){var e=this,n=arguments;return new Promise((function(r,o){var i=t.apply(e,n);function s(t){Sn(i,r,o,s,u,"next",t)}function u(t){Sn(i,r,o,s,u,"throw",t)}s(void 0)}))}}function _n(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=[],s=!0,u=!1;try{for(n=n.call(t);!(s=(r=n.next()).done)&&(i.push(r.value),!e||i.length!==e);s=!0);}catch(t){u=!0,o=t}finally{try{s||null==n.return||n.return()}finally{if(u)throw o}}return i}}(t,e)||function(t,e){if(t){if("string"==typeof t)return En(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)?En(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 Pn(t,e){var n,r,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(n)throw new TypeError("Generator is already executing.");for(;s;)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 s.label++,{value:i[1],done:!1};case 5:s.label++,r=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],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,u])}}}function Tn(t,e){return An.apply(this,arguments)}function An(){return An=On((function(t,e){var n,r,o,i,s,u=arguments;return Pn(this,(function(a){switch(a.label){case 0:return n=!(u.length>2&&void 0!==u[2])||u[2],t?(r=null,[4,Promise.all([Ve("".concat(Be,"/Patient/").concat(t),e).catch((function(t){return r=t})),n?jn(t):Promise.resolve(null)])]):[3,2];case 1:if(o=_n.apply(void 0,[a.sent(),2]),i=o[0],s=o[1],i.ok)return[2,i.data];if(s)return[2,s];if(r)throw r;a.label=2;case 2:return[2,null]}}))})),An.apply(this,arguments)}function jn(t){return xn.apply(this,arguments)}function xn(){return(xn=On((function(t){var e,n,r;return Pn(this,(function(o){switch(o.label){case 0:return[4,(0,gn.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 Dn=function(){function t(){return Error.call(this),this.message="object unsubscribed",this.name="ObjectUnsubscribedError",this}return t.prototype=Object.create(Error.prototype),t}(),Nn=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),Un=function(t){function n(e){var n=t.call(this,e)||this;return n.destination=e,n}return e(n,t),n}(y),Mn=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[b]=function(){return new Un(this)},n.prototype.lift=function(t){var e=new Cn(this,this);return e.operator=t,e},n.prototype.next=function(t){if(this.closed)throw new Dn;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 Dn;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 Dn;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 Dn;return t.prototype._trySubscribe.call(this,e)},n.prototype._subscribe=function(t){if(this.closed)throw new Dn;return this.hasError?(t.error(this.thrownError),h.EMPTY):this.isStopped?(t.complete(),h.EMPTY):(this.observers.push(t),new Nn(this,t))},n.prototype.asObservable=function(){var t=new g;return t.source=this,t},n.create=function(t,e){return new Cn(t,e)},n}(g),Cn=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}(Mn),kn=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 Dn;return this._value},n.prototype.next=function(e){t.prototype.next.call(this,this._value=e)},n}(Mn),Ln=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}(),In=new g((function(t){return t.complete()}));function Rn(t){return function(e){return 0===t?n?function(t){return new g((function(e){return t.schedule((function(){return e.complete()}))}))}(n):In:e.lift(new Bn(t));var n}}var Bn=function(){function t(t){if(this.total=t,this.total<0)throw new Ln}return t.prototype.call=function(t,e){return e.subscribe(new Gn(t,this.total))},t}(),Gn=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}(y);function $n(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 Vn(t,e))}}var Vn=function(){function t(t,e){this.project=t,this.thisArg=e}return t.prototype.call=function(t,e){return e.subscribe(new Wn(t,this.project,this.thisArg))},t}(),Wn=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}(y),Fn="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)",Hn=function(){try{return JSON.parse(localStorage.getItem("openmrs:visitStoreState")||"null")}catch(t){return null}}()||{patientUuid:null,manuallySetVisitUuid:null};function Jn(){return(0,W.getGlobalStore)("visit",Hn)}function zn(t,e){Jn().setState({patientUuid:t,manuallySetVisitUuid:e})}function Yn(t,e,n){var r=null!=n?n:Fn;return We("".concat(Re,"/visit?patient=").concat(t,"&v=").concat(r),{signal:e.signal,method:"GET",headers:{"Content-type":"application/json"}}).pipe(Rn(1)).pipe($n((function(t){return t})))}function Kn(t,e){return We("".concat(Re,"/visit"),{signal:e.signal,method:"POST",headers:{"Content-type":"application/json"},body:t})}function qn(t,e,n){return We("".concat(Re,"/visit/").concat(t),{signal:n.signal,method:"POST",headers:{"Content-type":"application/json"},body:e})}Jn().subscribe((function(t){var e;e=t,localStorage.setItem("openmrs:visitStoreState",JSON.stringify(e))}));var Qn,Xn,Zn=new kn(null);function tr(t){return{uuid:t.uuid,display:t.display,name:t.name}}function er(){return We("".concat(Re,"/visittype")).pipe($n((function(t){return t.data.results.map(tr)}))).pipe(Rn(1))}function nr(t){return{uuid:t.uuid,display:t.display}}function rr(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;return We("".concat(Re,"/location")+(t?"?tag="+t:"")).pipe($n((function(t){return t.data.results.map(nr)}))).pipe(Rn(1))}!function(t){t.NEWVISIT="startVisit",t.EDITVISIT="editVisit",t.LOADING="loadingVisit"}(Qn||(Qn={})),function(t){t.NOTSTARTED="notStarted",t.ONGOING="ongoing"}(Xn||(Xn={}));var or={"webservices.rest":"2.24.0",fhir2:"1.0.0-SNAPSHOT"}})(),u})())}}}));
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=a[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 a[t]={value:r,active:!0},r},e=function(t,e){var n=a[t];return n?(n.active?console.error("Cannot override an existing store. Make sure that stores are only created once."):n.value=e,n.active=!0,n.value):(a[t]={value:e,active:!0},e)},n=function(t,e){var n=a[t];if(!n){var r=u()((function(){return null!=e?e:{}}));return a[t]={value:r,active:!1},r}return n.value},r=function(t,e,n){var r=e(t.getState());return t.subscribe((function(t){var o=e(t);o!==r&&(r=o,n(o))}))},o={d:function(t,e){for(var n in e)o.o(e,n)&&!o.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})}},i={};o.r(i),o.d(i,{createGlobalStore:function(){return t},getGlobalStore:function(){return n},registerGlobalStore:function(){return e},subscribeTo:function(){return r}});var s=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?s(t):s},a={};return setTimeout((function(){"development"===window.spaEnv&&(window.stores=a)}),1e3),i}())}}}))},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 s(n){var r=e[n];if(void 0!==r)return r.exports;var o=e[n]={exports:{}};return t[n](o,o.exports,s),o.exports}s.d=(t,e)=>{for(var n in e)s.o(e,n)&&!s.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:e[n]})},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:()=>Qn,VisitStatus:()=>Xn,attachmentUrl:()=>Je,backendDependencies:()=>or,clearCurrentUser:()=>ln,createAttachment:()=>Ke,defaultVisitCustomRepresentation:()=>Fn,deleteAttachmentPermanently:()=>Qe,fetchCurrentPatient:()=>Tn,fhirBaseUrl:()=>Be,getAttachmentByUuid:()=>ze,getAttachments:()=>Ye,getCurrentUser:()=>sn,getLocations:()=>rr,getLoggedInUser:()=>pn,getSessionLocation:()=>hn,getSessionStore:()=>un,getStartedVisit:()=>Zn,getVisitStore:()=>Jn,getVisitTypes:()=>er,getVisitsForPatient:()=>Yn,makeUrl:()=>$e,openmrsFetch:()=>Ve,openmrsObservableFetch:()=>We,refetchCurrentUser:()=>cn,restBaseUrl:()=>Re,saveVisit:()=>Kn,sessionEndpoint:()=>Ge,setCurrentVisit:()=>zn,setSessionLocation:()=>dn,setUserLanguage:()=>an,setUserProperties:()=>bn,setupApiModule:()=>wn,toLocationObject:()=>nr,toVisitTypeObject:()=>tr,updateVisit:()=>qn,userHasAccess:()=>fn});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,s=r._unsubscribe,u=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(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 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 y=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 m(i,e));break}default:i.syncErrorThrowable=!0,i.destination=new m(i,e,r,o)}return i}return e(n,t),n.prototype[y]=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),m=function(t){function r(e,r,o,i){var s,u=t.call(this)||this;u._parentSubscriber=e;var c=u;return n(r)?s=r:r&&(s=r.next,o=r.error,i=r.complete,r!==a&&(n((c=Object.create(r)).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(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),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 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[y])return t[y]()}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[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===(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 P=Object.prototype,T=P.hasOwnProperty,A=P.toString,j=_?_.toStringTag:void 0;var x=Object.prototype.toString;var D=_?_.toStringTag:void 0;const N=function(t){return null==t?void 0===t?"[object Undefined]":"[object Null]":D&&D in Object(t)?function(t){var e=T.call(t,j),n=t[j];try{t[j]=void 0;var r=!0}catch(t){}var o=A.call(t);return r&&(e?t[j]=n:delete t[j]),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 G=function(t){if(!function(t){return null!=t&&"object"==typeof t}(t)||"[object Object]"!=N(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&&I.call(n)==B};var $=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 ye},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 nt},get NOT_MOUNTED(){return rt},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 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};let z=[];function Y(t,e,n){const r=X(t,e,n);z.length?z.forEach((t=>t(r))):setTimeout((()=>{throw r}))}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((n=>{const r=n===t;return e=e||r,!r})),e}function Q(t,e,...n){return`single-spa minified message #${t}: ${e?e+" ":""}See https://single-spa.js.org/error/?code=${t}${n.length?`&arg=${n.join("&arg=")}`:""}`}function X(t,e,n){const r=`${yt(e)} '${ht(e)}' died in status ${e.status}: `;let o;if(t instanceof Error){try{t.message=r+t.message}catch(t){}o=t}else{console.warn(Q(30,!1,e.status,ht(e)));try{o=Error(r+JSON.stringify(t))}catch(e){o=t}}return o.appOrParcelName=ht(e),e.status=n,o}const Z="NOT_LOADED",tt="LOADING_SOURCE_CODE",et="NOT_BOOTSTRAPPED",nt="BOOTSTRAPPING",rt="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 yt(t){return dt(t)?"parcel":"application"}function bt(){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 n=0;n<t.length;n++)if(e(t[n]))return t[n];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 n=t[e]||[];n=Array.isArray(n)?n:[n],0===n.length&&(n=[()=>Promise.resolve()]);const r=yt(t),o=ht(t);return function(t){return n.reduce(((n,i,s)=>n.then((()=>{const n=i(t);return gt(n)?n:Promise.reject(Q(15,!1,r,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=nt,t.bootstrap?Rt(t,"bootstrap").then(n).catch((n=>{if(e)throw X(n,t,lt);return Y(n,t,lt),t})):Promise.resolve().then(n))));function n(){return t.status=rt,t}}function Ot(t,e){return Promise.resolve().then((()=>{if(t.status!==it)return t;t.status=ut;const n=Object.keys(t.parcels).map((e=>t.parcels[e].unmountThisParcel()));return Promise.all(n).then(r,(n=>r().then((()=>{const r=Error(n.message);if(e)throw X(r,t,lt);Y(r,t,lt)})))).then((()=>t));function r(){return Rt(t,"unmount").then((()=>{t.status=rt}),(n=>{if(e)throw X(n,t,lt);Y(n,t,lt)}))}}))}let _t=!1,Pt=!1;function Tt(t,e){return Promise.resolve().then((()=>t.status!==rt?t:(_t||(window.dispatchEvent(new J("single-spa:before-first-mount")),_t=!0),t.status=ot,Rt(t,"mount").then((()=>(t.status=it,Pt||(window.dispatchEvent(new J("single-spa:first-mount")),Pt=!0),t))).catch((n=>{return t.status=it,Ot(t,!0).then(r,r);function r(){if(e)throw X(n,t,lt);return Y(n,t,lt),t}})))))}let At=0;const jt={parcels:{}};function xt(){return Dt.apply(jt,arguments)}function Dt(t,e){const n=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 r=At++;let o=t.name||`parcel-${r}`;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:r,parcels:{},status:i?tt:et,customProps:e,parentName:ht(n),unmountThisParcel:()=>f.then((()=>{if(u.status!==it)throw Error(Q(6,!1,o,u.status));return Ot(u,!0)})).then((t=>(u.parentName&&delete n.parcels[u.id],t))).then((t=>(p(t),t))).catch((t=>{throw u.status=lt,h(t),t}))};let a;n.parcels[r]=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-${r}`,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"),n=wt(t,"mount"),i=wt(t,"unmount");u.status=et,u.name=o,u.bootstrap=e,u.mount=n,u.unmount=i,u.timeouts=Bt(t.timeouts),t.update&&(u.update=wt(t,"update"),a.update=function(t){return u.customProps=t,Nt((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:()=>Nt(Promise.resolve().then((()=>{if(u.status!==rt)throw Error(Q(13,!1,o,u.status));return n.parcels[r]=u,Tt(u)}))),unmount:()=>Nt(u.unmountThisParcel()),getStatus:()=>u.status,loadPromise:Nt(c),bootstrapPromise:Nt(l),mountPromise:Nt(f),unmountPromise:Nt(d)},a}function Nt(t){return t.then((()=>null))}function Ut(t){const e=ht(t);let n="function"==typeof t.customProps?t.customProps(e,window.location):t.customProps;("object"!=typeof n||null===n||Array.isArray(n))&&(n={},console.warn(Q(40,!1),e,n));const r=bt({},n,{name:e,mountParcel:Dt.bind(t),singleSpa:F});return dt(t)&&(r.unmountSelf=t.unmountThisParcel),r}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,n){if("number"!=typeof t||t<=0)throw Error(Q(16,!1));Mt.bootstrap={millis:t,dieOnTimeout:e,warningMillis:n||1e3}}function kt(t,e,n){if("number"!=typeof t||t<=0)throw Error(Q(17,!1));Mt.mount={millis:t,dieOnTimeout:e,warningMillis:n||1e3}}function Lt(t,e,n){if("number"!=typeof t||t<=0)throw Error(Q(18,!1));Mt.unmount={millis:t,dieOnTimeout:e,warningMillis:n||1e3}}function It(t,e,n){if("number"!=typeof t||t<=0)throw Error(Q(19,!1));Mt.unload={millis:t,dieOnTimeout:e,warningMillis:n||1e3}}function Rt(t,e){const n=t.timeouts[e],r=n.warningMillis,o=yt(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)),r),setTimeout((()=>l(!0)),n.millis);const c=Q(31,!1,e,o,ht(t),n.millis);function l(t){if(!u)if(!0===t)a=!0,n.dieOnTimeout?s(Error(c)):console.error(c);else if(!a){const e=t,o=e*r;console.warn(c),o+r<n.millis&&setTimeout((()=>l(e+1)),r)}}}))}function Bt(t){const e={};for(let n in Mt)e[n]=bt({},Mt[n],t&&t[n]||{});return e}function Gt(t){return Promise.resolve().then((()=>{if(t.loadPromise)return t.loadPromise;if(t.status!==Z&&t.status!==ct)return t;let e,n;return t.status=tt,t.loadPromise=Promise.resolve().then((()=>{const r=t.loadApp(Ut(t));if(!gt(r))throw n=!0,Error(Q(33,!1,ht(t)));return r.then((n=>{let r;t.loadErrorTime=null,e=n,"object"!=typeof e&&(r=34),Object.prototype.hasOwnProperty.call(e,"bootstrap")&&!vt(e.bootstrap)&&(r=35),vt(e.mount)||(r=36),vt(e.unmount)||(r=37);const o=yt(e);if(r){let n;try{n=JSON.stringify(e)}catch(t){}return console.error(Q(r,!1,o,ht(t),n),e),Y(void 0,t,lt),t}return e.devtools&&e.devtools.overlays&&(t.devtools.overlays=bt({},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 r;return delete t.loadPromise,n?r=lt:(r=ct,t.loadErrorTime=(new Date).getTime()),Y(e,t,r),t}))}))}const $t="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 n=Xt(window.location.href),r=Xt(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 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 n=window.location.href,r=t.apply(this,arguments),o=window.location.href;return Jt&&n===o||window.dispatchEvent(function(t,e){let n;try{n=new PopStateEvent("popstate",{state:t})}catch(e){n=document.createEvent("PopStateEvent"),n.initPopStateEvent("popstate",!1,!1,t)}return n.singleSpa=!0,n.singleSpaTrigger=e,n}(window.history.state,e)),r}}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,n=window.removeEventListener;window.addEventListener=function(t,n){if(!("function"==typeof n&&Wt.indexOf(t)>=0)||mt(Vt[t],(t=>t===n)))return e.apply(this,arguments);Vt[t].push(n)},window.removeEventListener=function(t,e){if(!("function"==typeof e&&Wt.indexOf(t)>=0))return n.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}$t&&(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,n=t.fn.off;t.fn.on=function(t,n){return ee.call(this,e,window.addEventListener,t,n,arguments)},t.fn.off=function(t,e){return ee.call(this,n,window.removeEventListener,t,e,arguments)},Zt=!0}}function ee(t,e,n,r,o){return"string"!=typeof n?t.apply(this,o):(n.split(/\s+/).forEach((t=>{Wt.indexOf(t)>=0&&(e(t,r),n=n.replace(t,""))})),""===n.trim()?this:t.apply(this,o))}const ne={};function re(t){return Promise.resolve().then((()=>{const e=ne[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!==rt&&t.status!==ct)return t;const n=t.status===ct?Promise.resolve():Rt(t,"unload");return t.status=at,n.then((()=>(oe(t,e),t))).catch((n=>(function(t,e,n){delete ne[ht(t)],delete t.bootstrap,delete t.mount,delete t.unmount,delete t.unload,Y(n,t,lt),e.reject(n)}(t,e,n),t)))}))}function oe(t,e){delete ne[ht(t)],delete t.bootstrap,delete t.mount,delete t.unmount,delete t.unload,t.status=Z,e.resolve()}function ie(t,e,n,r){ne[ht(t)]={app:t,resolve:n,reject:r},Object.defineProperty(ne[ht(t)],"promise",{get:e})}function se(t){return ne[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,n,r){const o=function(t,e,n,r){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"],n=Object.keys(t).reduce(((t,n)=>e.indexOf(n)>=0?t:t.concat(n)),[]);if(0!==n.length)throw Error(Q(38,!1,e.join(", "),n.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 r=t=>"string"==typeof t||"function"==typeof t;if(!(r(t.activeWhen)||Array.isArray(t.activeWhen)&&t.activeWhen.every(r)))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,n,r){if("string"!=typeof t||0===t.length)throw Error(Q(20,!1));if(!e)throw Error(Q(23,!1));if("function"!=typeof n)throw Error(Q(24,!1));if(!me(r))throw Error(Q(22,!1))}(t,e,n,r),o.name=t,o.loadApp=e,o.activeWhen=n,o.customProps=r),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,n,r);if(Ae()||fe||(fe=!0,setTimeout((()=>{Ae()||console.warn(Q(1,!1))}),5e3)),-1!==ce().indexOf(o.name))throw Error(Q(21,!1,o.name));ue.push(bt({loadErrorTime:null,status:Z,parcels:{},devtools:{overlays:{options:{},selectors:[]}}},o)),$t&&(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($t?ye(t,{waitForUnmount:!1}):Promise.resolve()).then((()=>{const e=ue.map(ht).indexOf(t);ue.splice(e,1)}))}function ye(t,e={waitForUnmount:!1}){if("string"!=typeof t)throw Error(Q(26,!1));const n=mt(ue,(e=>ht(e)===t));if(!n)throw Error(Q(27,!1,t));const r=se(ht(n));if(e&&e.waitForUnmount){if(r)return r.promise;{const t=new Promise(((e,r)=>{ie(n,(()=>t),e,r)}));return t}}{let t;return r?(t=r.promise,be(n,r.resolve,r.reject)):t=new Promise(((e,r)=>{ie(n,(()=>t),e,r),be(n,e,r)})),t}}function be(t,e,n){Promise.resolve().then((()=>{if(mt(he(),(e=>e===ht(t))))return Se()})).then((()=>Ot(t).then(re).then((()=>{e(),setTimeout((()=>{Oe()}))})))).catch(n)}function me(t){return!t||"function"==typeof t||"object"==typeof t&&null!==t&&!Array.isArray(t)}function ve(t,e){const n=function(t,e){let n=0,r=!1,o="^";"/"!==t[0]&&(t="/"+t);for(let e=0;e<t.length;e++){const n=t[e];(!r&&":"===n||r&&"/"===n)&&i(e)}return i(t.length),new RegExp(o,"i");function i(i){const s=t.slice(n,i).replace(/[|\\{}()[\]^$+*?.]/g,"\\$&");if(o+=r?"[^/]+/?":s,i===t.length)if(r)e&&(o+="$");else{const t=e?"":".*";o="/"===o.charAt(o.length-1)?`${o}${t}$`:`${o}(/${t})?(#.*)?$`}r=!r,n=i}}(t,e);return t=>{let e=t.origin;e||(e=`${t.protocol}//${t.host}`);const r=t.href.replace(e,"").replace(t.search,"").split("?")[0];return n.test(r)}}let we=!1,ge=[],Ee=$t&&window.location.href;function Se(){return Oe()}function Oe(t=[],e,n=!1){if(we)return new Promise(((t,n)=>{ge.push({resolve:t,reject:n,eventArguments:e})}));const{appsToUnload:r,appsToUnmount:o,appsToLoad:i,appsToMount:s}=function(){const t=[],e=[],n=[],r=[],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&&n.push(i);break;case Z:case tt:s&&n.push(i);break;case et:case rt:!s&&se(ht(i))?t.push(i):s&&r.push(i);break;case it:s||e.push(i)}})),{appsToUnload:t,appsToUnmount:e,appsToLoad:n,appsToMount:r}}();let u,a=[],c=Ee,l=Ee=window.location.href;return Ae()?(we=!0,u=r.concat(i,o,s),Promise.resolve().then((()=>(y(0===u.length?"before-no-app-change":"before-app-change",d(!0)),y("before-routing-event",d(!0,{cancelNavigation:f})),Promise.all(a).then((n=>{if(n.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=r.map(re),a=o.map(Ot).map((t=>t.then(re))).concat(u),l=Promise.all(a);l.then((()=>{y("before-mount-routing-event",d(!0))}),(t=>{throw t}));const f=i.map((t=>Gt(t).then((t=>_e(t,l))))),b=s.filter((t=>i.indexOf(t)<0)).map((t=>_e(t,l)));return l.catch((t=>{throw h(),t})).then((()=>(h(),Promise.all(f.concat(b)).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(Gt);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{y(0===u.length?"no-app-change":"app-change",d()),y("routing-event",d())}catch(t){setTimeout((()=>{throw t}))}if(we=!1,ge.length>0){const t=ge;ge=[],Oe(t)}return e}function h(){n||(t.forEach((t=>{Ht(t.eventArguments)})),Ht(e))}function d(t=!1,n){const a={},f={[it]:[],[rt]:[],[Z]:[],[lt]:[]};t?(i.concat(s).forEach(((t,e)=>{h(t,it)})),r.forEach((t=>{h(t,Z)})),o.forEach((t=>{h(t,rt)}))):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 n&&bt(p.detail,n),p;function h(t,e){const n=ht(t);e=e||le(n),a[n]=e,(f[e]=f[e]||[]).push(n)}}function y(t,e){n||window.dispatchEvent(new J(`single-spa:${t}`,e))}}function _e(t,e){return pt(t)?St(t).then((t=>e.then((()=>pt(t)?Tt(t):t)))):e.then((()=>t))}let Pe=!1;function Te(t){Pe=!0,$t&&(Qt(t),Oe())}function Ae(){return Pe}var je={getRawAppData:function(){return[...ue]},reroute:Oe,NOT_LOADED:Z,toLoadPromise:Gt,toBootstrapPromise:St,unregisterApplication:de,getProfilerData:function(){return Et}};$t&&window.__SINGLE_SPA_DEVTOOLS__&&(window.__SINGLE_SPA_DEVTOOLS__.exposedMethods=je);var xe="openmrs:history";function De(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,s){try{var u=t[i](s),a=u.value}catch(t){return void n(t)}u.done?e(a):Promise.resolve(a).then(r,o)}function Ue(t,e,n){return Ue=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&&ke(o,n.prototype),o},Ue.apply(null,arguments)}function Me(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,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||(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 Ue(t,arguments,Ce(this).constructor)}return r.prototype=Object.create(t.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),ke(r,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",Ge="".concat(Re,"/session");function $e(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=$e(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(Re)&&void 0===e.headers["Disable-WWW-Authenticate"]&&(e.headers["Disable-WWW-Authenticate"]="true"),t.startsWith(Be)){var r=new URL(n,window.location.toString());r.searchParams.has("_summary")||(r.searchParams.set("_summary","data"),n=r.toString())}var o,i,s=Error();return window.fetch(n,e).then((o=function(t){var e,r;return function(t,e){var n,r,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(n)throw new TypeError("Generator is already executing.");for(;s;)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 s.label++,{value:i[1],done:!1};case 5:s.label++,r=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],r=0}finally{n=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,$.getConfig)("@openmrs/esm-api")];case 2:return r=o.sent().redirectAuthFailure,n===$e(Ge)&&403===e.status||r.enabled&&r.errors.includes(e.status)?(sessionStorage.removeItem(xe),(0,V.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,s)}),(function(t){throw new Fe(n,e,null,s)}))];case 3:return[2]}}))},i=function(){var t=this,e=arguments;return new Promise((function(n,r){var i=o.apply(t,e);function s(t){Ne(i,n,r,s,u,"next",t)}function u(t){Ne(i,n,r,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 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&&ke(t,e)}(o,t);var e,n,r=(e=o,n=Ie(),function(){var t,r=Ce(e);if(n){var o=Ce(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?De(t):e;var n}(this,t)});function o(t,e,n,i){var s;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,o),Me(De(s=r.call(this)),"response",void 0),Me(De(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=n,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,n,r,o,i,s){try{var u=t[i](s),a=u.value}catch(t){return void n(t)}u.done?e(a):Promise.resolve(a).then(r,o)}var Je="".concat(Re,"/attachment");function ze(t,e){return Ve("".concat(Je,"/").concat(t),{signal:e.signal})}function Ye(t,e,n){return Ve("".concat(Je,"?patient=").concat(t,"&includeEncounterless=").concat(e),{signal:n.signal})}function Ke(t,e){return qe.apply(this,arguments)}function qe(){var t;return t=function(t,e){var n;return function(t,e){var n,r,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(n)throw new TypeError("Generator is already executing.");for(;s;)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 s.label++,{value:i[1],done:!1};case 5:s.label++,r=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],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,u])}}}(this,(function(r){return(n=new FormData).append("fileCaption",e.fileDescription),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(Je),{method:"POST",body:n})]}))},qe=function(){var e=this,n=arguments;return new Promise((function(r,o){var i=t.apply(e,n);function s(t){He(i,r,o,s,u,"next",t)}function u(t){He(i,r,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 tn(t,e,n,r,o,i,s){try{var u=t[i](s),a=u.value}catch(t){return void n(t)}u.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 s(t){tn(i,r,o,s,u,"next",t)}function u(t){tn(i,r,o,s,u,"throw",t)}s(void 0)}))}}function nn(t,e){var n,r,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(n)throw new TypeError("Generator is already executing.");for(;s;)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 s.label++,{value:i[1],done:!1};case 5:s.label++,r=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],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,u])}}}var rn=(0,W.createGlobalStore)("session",{loaded:!1,session:null}),on=0;function sn(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{includeAuthStatus:!0};return(on<Date.now()-6e4||!rn.getState().loaded)&&cn(),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(rn.getState()),rn.subscribe(n)}))}function un(){return(on<Date.now()-6e4||!rn.getState().loaded)&&cn(),rn}function an(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 cn(t,e){on=Date.now();var n={};return t&&e&&(n.Authorization="Basic ".concat(window.btoa("".concat(t,":").concat(e)))),vn(Ve(Ge,{headers:n}))}function ln(){rn.setState({loaded:!0,session:{authenticated:!1,sessionId:""}})}function fn(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 pn(){var t,e;return new Promise((function(n){var r=function(r){r.loaded&&r.session.user&&(t=r.session.user,n(r.session.user),e&&e())};r(rn.getState()),t||(e=rn.subscribe(r))}))}function hn(){return new Promise((function(t,e){sn().subscribe((function(e){t(e.sessionLocation)}),e).unsubscribe()}))}function dn(t,e){return yn.apply(this,arguments)}function yn(){return(yn=en((function(t,e){return nn(this,(function(n){return[2,vn(Ve(Ge,{method:"POST",body:{sessionLocation:t},headers:{"Content-Type":"application/json"},signal:e.signal}))]}))}))).apply(this,arguments)}function bn(t,e,n){return mn.apply(this,arguments)}function mn(){return(mn=en((function(t,e,n){return nn(this,(function(r){switch(r.label){case 0:return n||(n=new AbortController),[4,Ve("".concat(Re,"/user/").concat(t),{method:"POST",body:{userProperties:e},headers:{"Content-Type":"application/json"},signal:n.signal})];case 1:return r.sent(),[2,cn()]}}))}))).apply(this,arguments)}function vn(t){return new Promise((function(e,n){t.then((function(t){var r;"object"==typeof(null==t?void 0:t.data)?(r={loaded:!0,session:t.data},rn.setState(r),e(r)):(r={loaded:!1,session:null},rn.setState(r),n(r))})).catch((function(t){(0,Xe.reportError)("Failed to fetch new session information: ".concat(t));var e={loaded:!1,session:null};rn.setState(e),n(e)}))}))}function wn(){(0,$.defineConfigSchema)("@openmrs/esm-api",{redirectAuthFailure:{enabled:{_type:$.Type.Boolean,_default:!0,_description:"Whether to redirect logged-out users to `redirectAuthFailure.url`"},url:{_type:$.Type.String,_default:"${openmrsSpaBase}/login",_validators:[$.validators.isUrl]},errors:{_type:$.Type.Array,_default:[401],_elements:{_type:$.Type.Number,_validators:[$.validators.inRange(100,600)]},_description:"The HTTP error codes for which users will be redirected"},resolvePromise:{_type:$.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."}}}),cn()}rn.subscribe((function(t){return t.session&&an(t.session)}));var gn=s(738);function En(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 Sn(t,e,n,r,o,i,s){try{var u=t[i](s),a=u.value}catch(t){return void n(t)}u.done?e(a):Promise.resolve(a).then(r,o)}function On(t){return function(){var e=this,n=arguments;return new Promise((function(r,o){var i=t.apply(e,n);function s(t){Sn(i,r,o,s,u,"next",t)}function u(t){Sn(i,r,o,s,u,"throw",t)}s(void 0)}))}}function _n(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=[],s=!0,u=!1;try{for(n=n.call(t);!(s=(r=n.next()).done)&&(i.push(r.value),!e||i.length!==e);s=!0);}catch(t){u=!0,o=t}finally{try{s||null==n.return||n.return()}finally{if(u)throw o}}return i}}(t,e)||function(t,e){if(t){if("string"==typeof t)return En(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)?En(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 Pn(t,e){var n,r,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(n)throw new TypeError("Generator is already executing.");for(;s;)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 s.label++,{value:i[1],done:!1};case 5:s.label++,r=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],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,u])}}}function Tn(t,e){return An.apply(this,arguments)}function An(){return An=On((function(t,e){var n,r,o,i,s,u=arguments;return Pn(this,(function(a){switch(a.label){case 0:return n=!(u.length>2&&void 0!==u[2])||u[2],t?(r=null,[4,Promise.all([Ve("".concat(Be,"/Patient/").concat(t),e).catch((function(t){return r=t})),n?jn(t):Promise.resolve(null)])]):[3,2];case 1:if(o=_n.apply(void 0,[a.sent(),2]),i=o[0],s=o[1],i.ok)return[2,i.data];if(s)return[2,s];if(r)throw r;a.label=2;case 2:return[2,null]}}))})),An.apply(this,arguments)}function jn(t){return xn.apply(this,arguments)}function xn(){return(xn=On((function(t){var e,n,r;return Pn(this,(function(o){switch(o.label){case 0:return[4,(0,gn.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 Dn=function(){function t(){return Error.call(this),this.message="object unsubscribed",this.name="ObjectUnsubscribedError",this}return t.prototype=Object.create(Error.prototype),t}(),Nn=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),Un=function(t){function n(e){var n=t.call(this,e)||this;return n.destination=e,n}return e(n,t),n}(b),Mn=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[y]=function(){return new Un(this)},n.prototype.lift=function(t){var e=new Cn(this,this);return e.operator=t,e},n.prototype.next=function(t){if(this.closed)throw new Dn;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 Dn;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 Dn;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 Dn;return t.prototype._trySubscribe.call(this,e)},n.prototype._subscribe=function(t){if(this.closed)throw new Dn;return this.hasError?(t.error(this.thrownError),h.EMPTY):this.isStopped?(t.complete(),h.EMPTY):(this.observers.push(t),new Nn(this,t))},n.prototype.asObservable=function(){var t=new g;return t.source=this,t},n.create=function(t,e){return new Cn(t,e)},n}(g),Cn=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}(Mn),kn=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 Dn;return this._value},n.prototype.next=function(e){t.prototype.next.call(this,this._value=e)},n}(Mn),Ln=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}(),In=new g((function(t){return t.complete()}));function Rn(t){return function(e){return 0===t?n?function(t){return new g((function(e){return t.schedule((function(){return e.complete()}))}))}(n):In:e.lift(new Bn(t));var n}}var Bn=function(){function t(t){if(this.total=t,this.total<0)throw new Ln}return t.prototype.call=function(t,e){return e.subscribe(new Gn(t,this.total))},t}(),Gn=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 $n(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 Vn(t,e))}}var Vn=function(){function t(t,e){this.project=t,this.thisArg=e}return t.prototype.call=function(t,e){return e.subscribe(new Wn(t,this.project,this.thisArg))},t}(),Wn=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),Fn="custom:(uuid,display,voided,indication,startDatetime,stopDatetime,encounters:(uuid,display,encounterDatetime,form:(uuid,name),location:ref,encounterType:ref,encounterProviders:(uuid,display,provider:(uuid,display))),patient:(uuid,display),visitType:(uuid,name,display),attributes:(uuid,display,attributeType:(name,datatypeClassname,uuid),value),location:(uuid,name,display))",Hn=function(){try{return JSON.parse(localStorage.getItem("openmrs:visitStoreState")||"null")}catch(t){return null}}()||{patientUuid:null,manuallySetVisitUuid:null};function Jn(){return(0,W.getGlobalStore)("visit",Hn)}function zn(t,e){Jn().setState({patientUuid:t,manuallySetVisitUuid:e})}function Yn(t,e,n){var r=null!=n?n:Fn;return We("".concat(Re,"/visit?patient=").concat(t,"&v=").concat(r),{signal:e.signal,method:"GET",headers:{"Content-type":"application/json"}}).pipe(Rn(1)).pipe($n((function(t){return t})))}function Kn(t,e){return We("".concat(Re,"/visit"),{signal:e.signal,method:"POST",headers:{"Content-type":"application/json"},body:t})}function qn(t,e,n){return We("".concat(Re,"/visit/").concat(t),{signal:n.signal,method:"POST",headers:{"Content-type":"application/json"},body:e})}Jn().subscribe((function(t){var e;e=t,localStorage.setItem("openmrs:visitStoreState",JSON.stringify(e))}));var Qn,Xn,Zn=new kn(null);function tr(t){return{uuid:t.uuid,display:t.display,name:t.name}}function er(){return We("".concat(Re,"/visittype")).pipe($n((function(t){return t.data.results.map(tr)}))).pipe(Rn(1))}function nr(t){return{uuid:t.uuid,display:t.display}}function rr(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;return We("".concat(Re,"/location")+(t?"?tag="+t:"")).pipe($n((function(t){return t.data.results.map(nr)}))).pipe(Rn(1))}!function(t){t.NEWVISIT="startVisit",t.EDITVISIT="editVisit",t.LOADING="loadingVisit"}(Qn||(Qn={})),function(t){t.NOTSTARTED="notStarted",t.ONGOING="ongoing"}(Xn||(Xn={}));var or={"webservices.rest":"2.24.0",fhir2:"1.0.0-SNAPSHOT"}})(),u})())}}}));
3
3
  //# sourceMappingURL=openmrs-esm-api.js.map