@openmrs/esm-billing-app 1.3.2-pre.1903 → 1.3.2-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.
package/dist/2250.js CHANGED
@@ -9,7 +9,7 @@ If you're the maintainer: the allowed types are ${Object.values(nT).join(", ")}.
9
9
  If you're the maintainer: all config elements must have a default. Received ${JSON.stringify(o)}`),s&&l&&![nT.Array,nT.Object].includes(l)&&console.error(`${e} has bad config schema definition for key '${a}'. ${i}.
10
10
 
11
11
  If you're the maintainer: the 'elements' key only works with '_type' equal to 'Array' or 'Object'. Received ${JSON.stringify(l)}`)}}function ta(e,n){return to(n.map(({[e]:n})=>n).filter(e=>!!e))}function to(e){return e.reduce((e,n)=>n0(e,n),{})}function ts(e,n,t=""){for(let i of Object.keys(n)){let r=n[i],a=t+"."+i,o=e[i];if(!e.hasOwnProperty(i)){("extensionSlots"!==i||""===t)&&tg(a,`Unknown config key '${a}' provided. Ignoring.`);continue}(function e(n,t,i){tc(i,n._type,t),tf(t)?n._type===nT.Object?function(n,t,i){if(n._elements)for(let r of Object.keys(t)){let a=t[r];e(n._elements,a,`${i}.${r}`)}}(n,t,i):n.hasOwnProperty("_default")||n.hasOwnProperty("_type")||ts(n,t,i):n._type===nT.Array&&function(n,t,i){if(tc(i,nT.Array,t)){if(td(n._elements))for(let r=0;r<t.length;r++)e(n._elements,t[r],`${i}[${r}]`);for(let e=0;e<t.length;e++)tc(`${i}[${e}]`,n._elements?._type,t[e])}}(n,t,i)})(o,r,a)}}n3();function tl(e,n,t=""){if(e){if(n!==e._default&&tu(t,e._validators,n),tf(n))for(let i of Object.keys(n)){let r=n[i],a=t+"."+i,o=e[i];e._type===nT.Object&&e._elements?tl(e._elements,r,a):tl(o,r,a)}else if(Array.isArray(n)&&e._elements)for(let i=0;i<n.length;i++)tl(e._elements,n[i],`${t}[${i}]`)}}function tc(e,n,t){return!n||tu(e,[{Array:nI,Boolean:nN,ConceptUuid:nL,Number:nj,Object:nF,String:nR,UUID:nL,PersonAttributeTypeUuid:nL,PatientIdentifierTypeUuid:nL}[n]],t)}function tu(e,n,t){let i=!0;if(n)try{for(let r of n){let n=r(t);if("string"==typeof n){let r="object"==typeof t?`Invalid configuration for ${e}: ${n}`:`Invalid configuration value ${t} for ${e}: ${n}`;tg(e,r),i=!1}}}catch(n){console.error(`Skipping invalid validator at "${e}". Encountered error
12
- ${n}`)}return i}let tp=(e,n)=>{let t=structuredClone(n);if(!e)return t;for(let n of Object.keys(e)){let i=t[n],r=e[n];if(r&&(r.hasOwnProperty("_type")||r.hasOwnProperty("_default"))){t.hasOwnProperty(n)||(t[n]=r._default);let e=r._elements;if(i&&td(e)){if(r._type===nT.Array&&Array.isArray(i)){let r=i.map(n=>tp(e,n));t[n]=r}else if(r._type===nT.Object)for(let n of Object.keys(i))i[n]=tp(e,i[n])}}else if(tf(r)){let e=i??{};tf(e)&&(t[n]=tp(r,e))}}return t};function td(e){return!!e&&Object.keys(e).filter(e=>!["_default","_validators"].includes(e)).length>0}function tf(e){return"object"==typeof e&&!Array.isArray(e)&&null!==e}let th=new Set;function tg(e,n){let t=`${e}:::${n}`;th||(th=new Set),th.has(t)||(console.error(n),th.add(t))}function tm(e){e?th.forEach(n=>{n.startsWith(e)&&th.delete(n)}):th.clear()}function tb(){n1.forEach(e=>e()),n1.length=0,n3()}let ty={"Translation overrides":{_description:"Per-language overrides for frontend translations should be keyed by language code and each language dictionary contains the translation key and the display value",_type:nT.Object,_default:{},_validators:[nB(e=>Object.keys(e).every(e=>/^[a-z]{2,3}(-[A-Z]{2,3})?$/.test(e)),e=>{let n=Object.keys(e).filter(e=>!/^[a-z]{2,3}(-[A-Z]{2,3})?$/.test(e));return`The 'Translation overrides' object should have language codes for keys. Language codes must be in the form of a two-to-three letter language code optionally followed by a hyphen and a two-to-three letter country code. The following keys do not conform: ${n.join(", ")}.`})]}},t_={"Display conditions":{privileges:{_description:"The privilege(s) the user must have to use this extension",_type:nT.Array,_default:[]},expression:{_description:"The expression that determines whether the extension is displayed",_type:nT.String,_default:void 0}},...ty},tv=(e,n)=>nB(t=>e<=t&&t<=n,`must be between ${e} and ${n}`),t$=e=>{let n=e.concat(["openmrsBase","openmrsSpaBase"]);return nB(e=>{if(!e||"string"!=typeof e)return!1;let t=/\${(.*?)}/g,i=t.exec(e);for(;i;){if(!n.includes(i[1]))return!1;i=t.exec(e)}return!0},"Should be a URL or path. The allowed template parameters are "+n.map(e=>"${"+e+"}").join(", "))},tA=t$([]),tw=e=>nB(n=>e.includes(n),`Must be one of the following: '${e.join("', '")}'.`),tk={inRange:tv,isUrl:tA,isUrlWithTemplateParameters:t$,oneOf:tw};var tx=t(48067);let tC=U("breadcrumbs",[]);function tE(e){return tS([e])}function tS(e){let n=[...tD(),...e.map(e=>({matcher:e.matcher instanceof RegExp?e.matcher:"string"==typeof e.matcher?(0,tx.pathToRegexp)(e.matcher).regexp:(0,tx.pathToRegexp)(e.path).regexp,settings:e}))];tC.setState(n,!0)}function tD(){return tC.getState()}function tM(e,n){if(n)return function(e,n){let[t]=e.filter(e=>e.matcher.test(n));return t}(e,n)||function(e,n){let t=n.split("/");for(;t.length>1;){t.pop();let n=tM(e,t.join("/"));if(n)return n}}(e,n)}function tz(e,n){if(e.length>0){let t=tM(e,n);if(t){let n=[t],i=tM(e,t.settings.parent);for(;void 0!==i;)n.push(i),i=tM(e,i.settings.parent);return n.reverse()}}return[]}function tO(e){return tz(tD(),e)}var tP=Object.freeze({__proto__:null,get start(){return i4},get ensureJQuerySupport(){return iT},get setBootstrapMaxTime(){return ig},get setMountMaxTime(){return im},get setUnmountMaxTime(){return ib},get setUnloadMaxTime(){return iy},get registerApplication(){return iU},get unregisterApplication(){return iq},get getMountedApps(){return iL},get getAppStatus(){return iV},get unloadApplication(){return iK},get checkActivityFunctions(){return iH},get getAppNames(){return iW},get pathToActiveWhen(){return iZ},get navigateToUrl(){return ix},get patchHistoryApi(){return iz},get triggerAppChange(){return i1},get addErrorHandler(){return tj},get removeErrorHandler(){return tR},get mountRootParcel(){return ic},get NOT_LOADED(){return tW},get LOADING_SOURCE_CODE(){return tV},get NOT_BOOTSTRAPPED(){return tG},get BOOTSTRAPPING(){return tU},get NOT_MOUNTED(){return tH},get MOUNTING(){return tq},get UPDATING(){return tY},get LOAD_ERROR(){return tX},get MOUNTED(){return tK},get UNLOADING(){return tZ},get UNMOUNTING(){return tJ},get SKIP_BECAUSE_BROKEN(){return tQ}}),tT=("u">typeof globalThis?globalThis:"u">typeof window?window:"u">typeof global?global:"u">typeof self?self:{}).CustomEvent,tB=!function(){try{var e=new tT("cat",{detail:{foo:"bar"}});return"cat"===e.type&&"bar"===e.detail.foo}catch(e){}return!1}()?"u">typeof document&&"function"==typeof document.createEvent?function(e,n){var t=document.createEvent("CustomEvent");return n?t.initCustomEvent(e,n.bubbles,n.cancelable,n.detail):t.initCustomEvent(e,!1,!1,void 0),t}:function(e,n){var t=document.createEventObject();return t.type=e,n?(t.bubbles=!!n.bubbles,t.cancelable=!!n.cancelable,t.detail=n.detail):(t.bubbles=!1,t.cancelable=!1,t.detail=void 0),t}:tT;let tI=[];function tN(e,n,t){let i=tL(e,n,t);tI.length?tI.forEach(e=>e(i)):setTimeout(()=>{throw i})}function tj(e){if("function"!=typeof e)throw Error(tF(28,!1));tI.push(e)}function tR(e){if("function"!=typeof e)throw Error(tF(29,!1));let n=!1;return tI=tI.filter(t=>{let i=t===e;return n=n||i,!i}),n}function tF(e,n,...t){return`single-spa minified message #${e}: ${n?n+" ":""}See https://single-spa.js.org/error/?code=${e}${t.length?`&arg=${t.join("&arg=")}`:""}`}function tL(e,n,t){let i,r=`${t5(n)} '${t2(n)}' died in status ${n.status}: `;if(e instanceof Error){try{e.message=r+e.message}catch(e){}i=e}else{console.warn(tF(30,!1,n.status,t2(n)));try{i=Error(r+JSON.stringify(e))}catch(n){i=e}}return i.appOrParcelName=t2(n),n.status=t,i}let tW="NOT_LOADED",tV="LOADING_SOURCE_CODE",tG="NOT_BOOTSTRAPPED",tU="BOOTSTRAPPING",tH="NOT_MOUNTED",tq="MOUNTING",tK="MOUNTED",tY="UPDATING",tJ="UNMOUNTING",tZ="UNLOADING",tX="LOAD_ERROR",tQ="SKIP_BECAUSE_BROKEN";function t0(e){return e.status===tK}function t1(e){try{return e.activeWhen(window.location)}catch(n){return tN(n,e,tQ),!1}}function t2(e){return e.name}function t3(e){return!!e.unmountThisParcel}function t5(e){return t3(e)?"parcel":"application"}function t4(){for(let e=arguments.length-1;e>0;e--)for(let n in arguments[e])"__proto__"!==n&&(arguments[e-1][n]=arguments[e][n]);return arguments[0]}function t6(e,n){for(let t=0;t<e.length;t++)if(n(e[t]))return e[t];return null}function t8(e){return e&&("function"==typeof e||Array.isArray(e)&&!t6(e,e=>"function"!=typeof e))}function t7(e,n){let t=e[n]||[];0===(t=Array.isArray(t)?t:[t]).length&&(t=[()=>Promise.resolve()]);let i=t5(e),r=t2(e);return function(e){return t.reduce((t,a,o)=>t.then(()=>{let t=a(e);return t9(t)?t:Promise.reject(tF(15,!1,i,r,n,o))}),Promise.resolve())}}function t9(e){return e&&"function"==typeof e.then&&"function"==typeof e.catch}let ie=[];function it(e,n){return Promise.resolve().then(()=>e.status!==tG?e:(e.status=tU,e.bootstrap?i_(e,"bootstrap").then(t).catch(t=>{if(n)throw tL(t,e,tQ);return tN(t,e,tQ),e}):Promise.resolve().then(t)));function t(){return e.status=tH,e}}function ii(e,n){return Promise.resolve().then(()=>{if(e.status!==tK)return e;return e.status=tJ,Promise.all(Object.keys(e.parcels).map(n=>e.parcels[n].unmountThisParcel())).then(t,i=>t().then(()=>{let t=Error(i.message);if(n)throw tL(t,e,tQ);tN(t,e,tQ)})).then(()=>e);function t(){return i_(e,"unmount").then(()=>{e.status=tH},t=>{if(n)throw tL(t,e,tQ);tN(t,e,tQ)})}})}let ir=!1,ia=!1;function io(e,n){return Promise.resolve().then(()=>e.status!==tH?e:(ir||(window.dispatchEvent(new tB("single-spa:before-first-mount")),ir=!0),e.status=tq,i_(e,"mount").then(()=>(e.status=tK,ia||(window.dispatchEvent(new tB("single-spa:first-mount")),ia=!0),e)).catch(t=>{return e.status=tK,ii(e,!0).then(i,i);function i(){if(n)throw tL(t,e,tQ);return tN(t,e,tQ),e}})))}let is=0,il={parcels:{}};function ic(){return iu.apply(il,arguments)}function iu(e,n){let t,i,r,a=this;if(!e||"object"!=typeof e&&"function"!=typeof e)throw Error(tF(2,!1));if(e.name&&"string"!=typeof e.name)throw Error(tF(3,!1,typeof e.name));let o=is++,s=e.name||`parcel-${o}`;if("object"!=typeof n)throw Error(tF(4,!1,s,typeof n));if(!n.domElement)throw Error(tF(5,!1,s));let l="function"==typeof e,c=l?e:()=>Promise.resolve(e),u={id:o,parcels:{},status:l?tV:tG,customProps:n,parentName:t2(a),unmountThisParcel:()=>f.then(()=>{if(u.status!==tK)throw Error(tF(6,!1,s,u.status));return ii(u,!0)}).then(e=>(u.parentName&&delete a.parcels[u.id],e)).then(e=>(i(e),e)).catch(e=>{throw u.status=tQ,r(e),e})};a.parcels[o]=u;let p=c();if(!p||"function"!=typeof p.then)throw Error(tF(7,!1));let d=(p=p.then(e=>{if(!e)throw Error(tF(8,!1));if(s=e.name||`parcel-${o}`,Object.prototype.hasOwnProperty.call(e,"bootstrap")&&!t8(e.bootstrap))throw Error(tF(9,!1,s));if(!t8(e.mount))throw Error(tF(10,!1,s));if(!t8(e.unmount))throw Error(tF(11,!1,s));if(e.update&&!t8(e.update))throw Error(tF(12,!1,s));let n=t7(e,"bootstrap"),i=t7(e,"mount"),r=t7(e,"unmount");u.status=tG,u.name=s,u.bootstrap=n,u.mount=i,u.unmount=r,u.timeouts=iv(e.timeouts),e.update&&(u.update=t7(e,"update"),t.update=function(e){return u.customProps=e,ip(Promise.resolve().then(()=>{if(u.status!==tK)throw Error(tF(32,!1,t2(u)));return u.status=tY,i_(u,"update").then(()=>(u.status=tK,u)).catch(e=>{throw tL(e,u,tQ)})}))})})).then(()=>it(u,!0)),f=d.then(()=>io(u,!0)),h=new Promise((e,n)=>{i=e,r=n});return t={mount:()=>ip(Promise.resolve().then(()=>{if(u.status!==tH)throw Error(tF(13,!1,s,u.status));return a.parcels[o]=u,io(u)})),unmount:()=>ip(u.unmountThisParcel()),getStatus:()=>u.status,loadPromise:ip(p),bootstrapPromise:ip(d),mountPromise:ip(f),unmountPromise:ip(h)}}function ip(e){return e.then(()=>null)}function id(e){let n=t2(e),t="function"==typeof e.customProps?e.customProps(n,window.location):e.customProps;("object"!=typeof t||null===t||Array.isArray(t))&&(t={},console.warn(tF(40,!1),n,t));let i=t4({},t,{name:n,mountParcel:iu.bind(e),singleSpa:tP});return t3(e)&&(i.unmountSelf=e.unmountThisParcel),i}let ih={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 ig(e,n,t){if("number"!=typeof e||e<=0)throw Error(tF(16,!1));ih.bootstrap={millis:e,dieOnTimeout:n,warningMillis:t||1e3}}function im(e,n,t){if("number"!=typeof e||e<=0)throw Error(tF(17,!1));ih.mount={millis:e,dieOnTimeout:n,warningMillis:t||1e3}}function ib(e,n,t){if("number"!=typeof e||e<=0)throw Error(tF(18,!1));ih.unmount={millis:e,dieOnTimeout:n,warningMillis:t||1e3}}function iy(e,n,t){if("number"!=typeof e||e<=0)throw Error(tF(19,!1));ih.unload={millis:e,dieOnTimeout:n,warningMillis:t||1e3}}function i_(e,n){let t=e.timeouts[n],i=t.warningMillis,r=t5(e);return new Promise((a,o)=>{let s=!1,l=!1;e[n](id(e)).then(e=>{s=!0,a(e)}).catch(e=>{s=!0,o(e)}),setTimeout(()=>u(1),i),setTimeout(()=>u(!0),t.millis);let c=tF(31,!1,n,r,t2(e),t.millis);function u(e){s||(!0===e?(l=!0,t.dieOnTimeout?o(Error(c)):console.error(c)):!l&&(console.warn(c),e*i+i<t.millis&&setTimeout(()=>u(e+1),i)))}})}function iv(e){let n={};for(let t in ih)n[t]=t4({},ih[t],e&&e[t]||{});return n}function i$(e){return Promise.resolve().then(()=>{let n,t;return e.loadPromise?e.loadPromise:e.status!==tW&&e.status!==tX?e:(e.status=tV,e.loadPromise=Promise.resolve().then(()=>{let i=e.loadApp(id(e));if(!t9(i))throw t=!0,Error(tF(33,!1,t2(e)));return i.then(t=>{let i;e.loadErrorTime=null,"object"!=typeof(n=t)&&(i=34),Object.prototype.hasOwnProperty.call(n,"bootstrap")&&!t8(n.bootstrap)&&(i=35),t8(n.mount)||(i=36),t8(n.unmount)||(i=37);let r=t5(n);if(i){let t;try{t=JSON.stringify(n)}catch(e){}return console.error(tF(i,!1,r,t2(e),t),n),tN(void 0,e,tQ),e}return n.devtools&&n.devtools.overlays&&(e.devtools.overlays=t4({},e.devtools.overlays,n.devtools.overlays)),e.status=tG,e.bootstrap=t7(n,"bootstrap"),e.mount=t7(n,"mount"),e.unmount=t7(n,"unmount"),e.unload=t7(n,"unload"),e.timeouts=iv(n.timeouts),delete e.loadPromise,e})}).catch(n=>{let i;return delete e.loadPromise,t?i=tQ:(i=tX,e.loadErrorTime=(new Date).getTime()),tN(n,e,i),e}))})}let iA="u">typeof window,iw={hashchange:[],popstate:[]},ik=["hashchange","popstate"];function ix(e){let n;if("string"==typeof e)n=e;else if(this&&this.href)n=this.href;else{if(!(e&&e.currentTarget&&e.currentTarget.href&&e.preventDefault))throw Error(tF(14,!1));n=e.currentTarget.href,e.preventDefault()}let t=iO(window.location.href),i=iO(n);0===n.indexOf("#")?window.location.hash=i.hash:t.host!==i.host&&i.host?window.location.href=n:i.pathname===t.pathname&&i.search===t.search?window.location.hash=i.hash:window.history.pushState(null,null,n)}function iC(e){if(e){let n=e[0].type;ik.indexOf(n)>=0&&iw[n].forEach(n=>{try{n.apply(this,e)}catch(e){setTimeout(()=>{throw e})}})}}function iE(){i2([],arguments)}function iS(e,n){return function(){let t=window.location.href,r=e.apply(this,arguments),a=window.location.href;return i&&t===a||window.dispatchEvent(function(e,n){let t;try{t=new PopStateEvent("popstate",{state:e})}catch(n){(t=document.createEvent("PopStateEvent")).initPopStateEvent("popstate",!1,!1,e)}return t.singleSpa=!0,t.singleSpaTrigger=n,t}(window.history.state,n)),r}}let iD=null,iM=!1;function iz(e){if(iM)throw Error(tF(43,!1));i=!e||!e.hasOwnProperty("urlRerouteOnly")||e.urlRerouteOnly,iM=!0,iD=window.history.replaceState,window.addEventListener("hashchange",iE),window.addEventListener("popstate",iE);let n=window.addEventListener,t=window.removeEventListener;window.addEventListener=function(e,t){if(!("function"==typeof t&&ik.indexOf(e)>=0)||t6(iw[e],e=>e===t))return n.apply(this,arguments);iw[e].push(t)},window.removeEventListener=function(e,n){return"function"==typeof n&&ik.indexOf(e)>=0&&(iw[e]=iw[e].filter(e=>e!==n)),t.apply(this,arguments)},window.history.pushState=iS(window.history.pushState,"pushState"),window.history.replaceState=iS(iD,"replaceState")}function iO(e){let n=document.createElement("a");return n.href=e,n}iA&&(window.singleSpaNavigate?console.warn(tF(41,!1)):window.singleSpaNavigate=ix);let iP=!1;function iT(e=window.jQuery){if(e||window.$&&window.$.fn&&window.$.fn.jquery&&(e=window.$),e&&!iP){let n=e.fn.on,t=e.fn.off;e.fn.on=function(e,t){return iB.call(this,n,window.addEventListener,e,t,arguments)},e.fn.off=function(e,n){return iB.call(this,t,window.removeEventListener,e,n,arguments)},iP=!0}}function iB(e,n,t,i,r){return"string"!=typeof t?e.apply(this,r):(t.split(/\s+/).forEach(e=>{ik.indexOf(e)>=0&&(n(e,i),t=t.replace(e,""))}),""===t.trim()?this:e.apply(this,r))}let iI={};function iN(e){return Promise.resolve().then(()=>{let n=iI[t2(e)];if(!n)return e;if(e.status===tW)return ij(e,n),e;if(e.status===tZ)return n.promise.then(()=>e);if(e.status!==tH&&e.status!==tX)return e;let t=e.status===tX?Promise.resolve():i_(e,"unload");return e.status=tZ,t.then(()=>(ij(e,n),e)).catch(t=>(delete iI[t2(e)],delete e.bootstrap,delete e.mount,delete e.unmount,delete e.unload,tN(t,e,tQ),n.reject(t),e))})}function ij(e,n){delete iI[t2(e)],delete e.bootstrap,delete e.mount,delete e.unmount,delete e.unload,e.status=tW,n.resolve()}function iR(e,n,t,i){iI[t2(e)]={app:e,resolve:t,reject:i},Object.defineProperty(iI[t2(e)],"promise",{get:n})}let iF=[];function iL(){return iF.filter(t0).map(t2)}function iW(){return iF.map(t2)}function iV(e){let n=t6(iF,n=>t2(n)===e);return n?n.status:null}let iG=!1;function iU(e,n,t,i){var r,a;let o,s,l=(o={name:null,loadApp:null,activeWhen:null,customProps:null},"object"==typeof e?(function(e){if(Array.isArray(e)||null===e)throw Error(tF(39,!1));let n=["name","app","activeWhen","customProps"],t=Object.keys(e).reduce((e,t)=>n.indexOf(t)>=0?e:e.concat(t),[]);if(0!==t.length)throw Error(tF(38,!1,n.join(", "),t.join(", ")));if("string"!=typeof e.name||0===e.name.length||"object"!=typeof e.app&&"function"!=typeof e.app)throw Error(tF(20,!1));let i=e=>"string"==typeof e||"function"==typeof e;if(!(i(e.activeWhen)||Array.isArray(e.activeWhen)&&e.activeWhen.every(i)))throw Error(tF(24,!1));if(!iJ(e.customProps))throw Error(tF(22,!1))}(e),o.name=e.name,o.loadApp=e.app,o.activeWhen=e.activeWhen,o.customProps=e.customProps):(function(e,n,t,i){if("string"!=typeof e||0===e.length)throw Error(tF(20,!1));if(!n)throw Error(tF(23,!1));if("function"!=typeof t)throw Error(tF(24,!1));if(!iJ(i))throw Error(tF(22,!1))}(e,n,t,i),o.name=e,o.loadApp=n,o.activeWhen=t,o.customProps=i),o.loadApp="function"!=typeof(r=o.loadApp)?()=>Promise.resolve(r):r,o.customProps=o.customProps||{},s=(s=Array.isArray(a=o.activeWhen)?a:[a]).map(e=>"function"==typeof e?e:iZ(e)),o.activeWhen=e=>s.some(n=>n(e)),o);if(i5||iG||(iG=!0,setTimeout(()=>{i5||console.warn(tF(1,!1))},5e3)),-1!==iW().indexOf(l.name))throw Error(tF(21,!1,l.name));iF.push(t4({loadErrorTime:null,status:tW,parcels:{},devtools:{overlays:{options:{},selectors:[]}}},l)),iA&&(iT(),i2())}function iH(e=window.location){return iF.filter(n=>n.activeWhen(e)).map(t2)}function iq(e){if(0===iF.filter(n=>t2(n)===e).length)throw Error(tF(25,!1,e));return(iA?iK(e,{waitForUnmount:!1}):Promise.resolve()).then(()=>{let n=iF.map(t2).indexOf(e);iF.splice(n,1)})}function iK(e,n={waitForUnmount:!1}){if("string"!=typeof e)throw Error(tF(26,!1));let t=t6(iF,n=>t2(n)===e);if(!t)throw Error(tF(27,!1,e));let i=iI[t2(t)];if(n&&n.waitForUnmount){if(i)return i.promise;{let e=new Promise((n,i)=>{iR(t,()=>e,n,i)});return e}}{let e;return i?(e=i.promise,iY(t,i.resolve,i.reject)):e=new Promise((n,i)=>{iR(t,()=>e,n,i),iY(t,n,i)}),e}}function iY(e,n,t){Promise.resolve().then(()=>{if(t6(iH(),n=>n===t2(e)))return i1()}).then(()=>ii(e).then(iN).then(()=>{n(),setTimeout(()=>{i2()})})).catch(t)}function iJ(e){return!e||"function"==typeof e||"object"==typeof e&&null!==e&&!Array.isArray(e)}function iZ(e,n){let t=function(e,n){let t=0,i=!1,r="^";"/"!==e[0]&&(e="/"+e);for(let n=0;n<e.length;n++){let t=e[n],r=i&&"/"===t;(!i&&":"===t||r)&&a(n)}return a(e.length),RegExp(r,"i");function a(a){let o=e.slice(t,a).replace(/[|\\{}()[\]^$+*?.]/g,"\\$&");if(r+=i?"[^/]+/?":o,a===e.length)if(i)n&&(r+="$");else{let e=n?"":".*";r="/"===r.charAt(r.length-1)?`${r}${e}$`:`${r}(/${e})?(#.*)?$`}i=!i,t=a}}(e,n);return e=>{let n=e.origin;n||(n=`${e.protocol}//${e.host}`);let i=e.href.replace(n,"").replace(e.search,"").split("?")[0];return t.test(i)}}let iX=!1,iQ=[],i0=iA&&window.location.href;function i1(){return i2()}function i2(e=[],n,t=!1){let i,r,a,o,s;if(iX)return new Promise((e,t)=>{iQ.push({resolve:e,reject:t,eventArguments:n})});let{appsToUnload:l,appsToUnmount:c,appsToLoad:u,appsToMount:p}=(i=[],r=[],a=[],o=[],s=(new Date).getTime(),iF.forEach(e=>{let n=e.status!==tQ&&t1(e);switch(e.status){case tX:n&&s-e.loadErrorTime>=200&&a.push(e);break;case tW:case tV:n&&a.push(e);break;case tG:case tH:!n&&iI[t2(e)]?i.push(e):n&&o.push(e);break;case tK:n||r.push(e)}}),{appsToUnload:i,appsToUnmount:r,appsToLoad:a,appsToMount:o}),d,f=[],h=i0,g=i0=window.location.href;return i5?(iX=!0,d=l.concat(u,c,p),Promise.resolve().then(()=>($(0===d.length?"before-no-app-change":"before-app-change",v(!0)),$("before-routing-event",v(!0,{cancelNavigation:m})),Promise.all(f).then(t=>{if(t.some(e=>e))return iD.call(window.history,history.state,"",h.substring(location.origin.length)),i0=location.href,iX=!1,i2(e,n,!0);let i=l.map(iN),r=Promise.all(c.map(ii).map(e=>e.then(iN)).concat(i));r.then(()=>{$("before-mount-routing-event",v(!0))},e=>{throw e});let a=u.map(e=>i$(e).then(e=>i3(e,r))),o=p.filter(e=>0>u.indexOf(e)).map(e=>i3(e,r));return r.catch(e=>{throw y(),e}).then(()=>(y(),Promise.all(a.concat(o)).catch(n=>{throw e.forEach(e=>e.reject(n)),n}).then(b).then(()=>{},e=>{throw e})))})))):(d=u,Promise.resolve().then(()=>Promise.all(u.map(i$)).then(y).then(()=>[]).catch(e=>{throw y(),e}).finally(()=>{})));function m(e=!0){let n="function"==typeof(null==e?void 0:e.then)?e:Promise.resolve(e);f.push(n.catch(e=>(console.warn(Error(tF(42,!1))),console.warn(e),!1)))}function b(){let n=iL();e.forEach(e=>e.resolve(n));try{$(0===d.length?"no-app-change":"app-change",v()),$("routing-event",v())}catch(e){setTimeout(()=>{throw e})}if(iX=!1,iQ.length>0){let e=iQ;iQ=[],i2(e)}return n}function y(){t||(e.forEach(e=>{iC(e.eventArguments)}),iC(n))}function v(e=!1,t){let i={},r={[tK]:[],[tH]:[],[tW]:[],[tQ]:[]};e?(u.concat(p).forEach((e,n)=>{o(e,tK)}),l.forEach(e=>{o(e,tW)}),c.forEach(e=>{o(e,tH)})):d.forEach(e=>{o(e)});let a={detail:{newAppStatuses:i,appsByNewStatus:r,totalAppChanges:d.length,originalEvent:null==n?void 0:n[0],oldUrl:h,newUrl:g}};return t&&t4(a.detail,t),a;function o(e,n){let t=t2(e);n=n||iV(t),i[t]=n,(r[n]=r[n]||[]).push(t)}}function $(e,n){t||window.dispatchEvent(new tB(`single-spa:${e}`,n))}}function i3(e,n){return t1(e)?it(e).then(e=>n.then(()=>t1(e)?io(e):e)):n.then(()=>e)}let i5=!1;function i4(e){i5=!0,iA&&(iz(e),i2())}function i6(e,n){let t=window.getOpenmrsSpaBase().replace(/\/$/,"");return i8(e,{openmrsBase:window.openmrsBase,openmrsSpaBase:t,...n}).replace(/^\/\//,"/")}function i8(e,n){return Object.keys(n).reduce((e,t)=>e.split("${"+t+"}").join(n[t]),e)}function i7({to:e,templateParams:n}){let t=window.getOpenmrsSpaBase().replace(/\/$/,""),i=i6(e,n).replace(window.location.origin,"");i.startsWith(t)?ix(i):window.location.assign(i)}iA&&window.__SINGLE_SPA_DEVTOOLS__&&(window.__SINGLE_SPA_DEVTOOLS__.exposedMethods={getRawAppData:function(){return[...iF]},reroute:i2,NOT_LOADED:tW,toLoadPromise:i$,toBootstrapPromise:it,unregisterApplication:iq,getProfilerData:function(){return ie}});let i9="openmrs:history";function re(e){let n=JSON.parse(sessionStorage.getItem(i9)??"[]")||[];n.push(e),n.length>50&&(n=n.slice(-50)),sessionStorage.setItem(i9,JSON.stringify(n))}function rn(){0===JSON.parse(sessionStorage.getItem(i9)??"[]").length&&document.referrer&&re(document.referrer),window.addEventListener("single-spa:routing-event",e=>{let n=rt();e.detail.originalEvent?.singleSpaTrigger=="replaceState"?(n[n.length-1]=window.location.href,sessionStorage.setItem(i9,JSON.stringify(n))):!e.detail.originalEvent?.singleSpa&&n.includes(window.location.href)?ri({toUrl:window.location.href}):n[n.length-1]!==window.location.href&&re(window.location.href)})}function rt(){return JSON.parse(sessionStorage.getItem(i9)??"[]")}function ri({toUrl:e}){let n=rt(),t=n.lastIndexOf(e);if(-1!=t){let e=n.slice(0,t+1);i7({to:n[t]}),sessionStorage.setItem(i9,JSON.stringify(e))}else throw Error(`URL ${e} not found in history; cannot go back to it.`)}function rr(){sessionStorage.removeItem(i9)}let ra="${openmrsSpaBase}/login",ro={redirectAuthFailure:{enabled:{_type:nT.Boolean,_default:!0,_description:"Whether to redirect logged-out users to `redirectAuthFailure.url`"},url:{_type:nT.String,_default:ra,_validators:[tk.isUrl],_description:"The url to which users will be redirected when they are logged out. If set to blank, the `location` header from the response will be used."},errors:{_type:nT.Array,_default:[401],_elements:{_type:nT.Number,_validators:[tk.inRange(100,600)]},_description:"The HTTP error codes for which users will be redirected"},resolvePromise:{_type:nT.Boolean,_default:!1,_description:"Changes how requests that fail authentication are handled. Try messing with this if redirects to the login page aren't working correctly."}},followRedirects:{_type:nT.Boolean,_default:!0,_description:"Whether openmrsFetch should support redirects returned from the backend"}};function rs(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}let rl="/ws/rest/v1",rc="/ws/fhir2/R4",ru=`${rl}/session`;function rp(e){return e&&e.startsWith("http")?e:("/"!==e[0]&&(e="/"+e),window.openmrsBase+e)}function rd(e,n={}){if("string"!=typeof e)throw Error("The first argument to @openmrs/api's openmrsFetch function must be a url string");if("object"!=typeof n)throw Error("The second argument to @openmrs/api's openmrsFetch function must be a plain object.");if(!window.openmrsBase)throw Error("@openmrs/api is running in a browser that doesn't have window.openmrsBase, which is provided by openmrs-module-spa's HTML file.");let t=rp(e);if(n.headers||(n.headers={}),ep(n.body)&&(n.body=JSON.stringify(n.body)),void 0===n.headers.Accept&&(n.headers.Accept="application/json"),null===n.headers.Accept&&delete n.headers.Accept,e.startsWith(rl)&&void 0===n.headers["Disable-WWW-Authenticate"]&&(n.headers["Disable-WWW-Authenticate"]="true"),e.startsWith(rc)){let e=new URL(t,window.location.toString());e.searchParams.has("_summary")||(e.searchParams.set("_summary","data"),t=e.toString())}let i=Error();return window.fetch(t,n).then(async e=>{let{redirectAuthFailure:n,followRedirects:r}=await te("@openmrs/esm-api");if(e.ok)if(204!==e.status)return e.clone().text().then(n=>{try{n&&(e.data=JSON.parse(n))}catch(e){}return e});else{if(r&&e.headers.has("location")){let n=e.headers.get("location");n&&i7({to:n})}return e.data=null,e}return t===rp(ru)&&403===e.status||n.enabled&&n.errors.includes(e.status)?(rr(),i7({to:n.url||e.headers.get("location")||ra}),n.resolvePromise?Promise.resolve():new Promise(()=>{})):e.clone().text().then(n=>{let r=n;try{r=JSON.parse(n)}catch(e){}throw new rh(t,e,r,i)},n=>{throw new rh(t,e,null,i)})})}function rf(e,n={}){if("object"!=typeof n)throw Error("The second argument to openmrsObservableFetch must be either omitted or an object");let t=new AbortController;return n.signal=t.signal,new ei.Observable(i=>{let r=!1;return rd(e,n).then(e=>{r=!0,i.next(e),i.complete()},e=>{r=!0,i.error(e)}),()=>{r||t.abort()}})}class rh extends Error{constructor(e,n,t,i){super(),rs(this,"response",void 0),rs(this,"responseBody",void 0),this.message=`Server responded with ${n.status} (${n.statusText}) for url ${e}. Check err.responseBody or network tab in dev tools for more info`,i.message=this.message,this.responseBody=t,this.response=n,this.stack=`Stacktrace for outgoing request:
12
+ ${n}`)}return i}let tp=(e,n)=>{let t=structuredClone(n);if(!e)return t;for(let n of Object.keys(e)){let i=t[n],r=e[n];if(r&&(r.hasOwnProperty("_type")||r.hasOwnProperty("_default"))){t.hasOwnProperty(n)||(t[n]=r._default);let e=r._elements;if(i&&td(e)){if(r._type===nT.Array&&Array.isArray(i)){let r=i.map(n=>tp(e,n));t[n]=r}else if(r._type===nT.Object)for(let n of Object.keys(i))i[n]=tp(e,i[n])}}else if(tf(r)){let e=i??{};tf(e)&&(t[n]=tp(r,e))}}return t};function td(e){return!!e&&Object.keys(e).filter(e=>!["_default","_validators"].includes(e)).length>0}function tf(e){return"object"==typeof e&&!Array.isArray(e)&&null!==e}let th=new Set;function tg(e,n){let t=`${e}:::${n}`;th||(th=new Set),th.has(t)||(console.error(n),th.add(t))}function tm(e){e?th.forEach(n=>{n.startsWith(e)&&th.delete(n)}):th.clear()}function tb(){n1.forEach(e=>e()),n1.length=0,n3()}let ty={"Translation overrides":{_description:"Per-language overrides for frontend translations should be keyed by language code and each language dictionary contains the translation key and the display value",_type:nT.Object,_default:{},_validators:[nB(e=>Object.keys(e).every(e=>/^[a-z]{2,3}(-[A-Z]{2,3})?$/.test(e)),e=>{let n=Object.keys(e).filter(e=>!/^[a-z]{2,3}(-[A-Z]{2,3})?$/.test(e));return`The 'Translation overrides' object should have language codes for keys. Language codes must be in the form of a two-to-three letter language code optionally followed by a hyphen and a two-to-three letter country code. The following keys do not conform: ${n.join(", ")}.`})]}},t_={"Display conditions":{privileges:{_description:"The privilege(s) the user must have to use this extension",_type:nT.Array,_default:[]},expression:{_description:"The expression that determines whether the extension is displayed",_type:nT.String,_default:void 0}},...ty},tv=(e,n)=>nB(t=>e<=t&&t<=n,`must be between ${e} and ${n}`),t$=e=>{let n=e.concat(["openmrsBase","openmrsSpaBase"]);return nB(e=>{if(!e||"string"!=typeof e)return!1;let t=/\${(.*?)}/g,i=t.exec(e);for(;i;){if(!n.includes(i[1]))return!1;i=t.exec(e)}return!0},"Should be a URL or path. The allowed template parameters are "+n.map(e=>"${"+e+"}").join(", "))},tA=t$([]),tw=e=>nB(n=>e.includes(n),`Must be one of the following: '${e.join("', '")}'.`),tk={inRange:tv,isUrl:tA,isUrlWithTemplateParameters:t$,oneOf:tw};var tx=t(48067);let tC=U("breadcrumbs",[]);function tE(e){return tS([e])}function tS(e){let n=[...tD(),...e.map(e=>({matcher:e.matcher instanceof RegExp?e.matcher:"string"==typeof e.matcher?(0,tx.pathToRegexp)(e.matcher).regexp:(0,tx.pathToRegexp)(e.path).regexp,settings:e}))];tC.setState(n,!0)}function tD(){return tC.getState()}function tM(e,n){if(n)return function(e,n){let[t]=e.filter(e=>e.matcher.test(n));return t}(e,n)||function(e,n){let t=n.split("/");for(;t.length>1;){t.pop();let n=tM(e,t.join("/"));if(n)return n}}(e,n)}function tz(e,n){if(e.length>0){let t=tM(e,n);if(t){let n=[t],i=tM(e,t.settings.parent);for(;void 0!==i;)n.push(i),i=tM(e,i.settings.parent);return n.reverse()}}return[]}function tO(e){return tz(tD(),e)}var tP=Object.freeze({__proto__:null,get start(){return i4},get ensureJQuerySupport(){return iT},get setBootstrapMaxTime(){return ig},get setMountMaxTime(){return im},get setUnmountMaxTime(){return ib},get setUnloadMaxTime(){return iy},get registerApplication(){return iU},get unregisterApplication(){return iq},get getMountedApps(){return iL},get getAppStatus(){return iV},get unloadApplication(){return iK},get checkActivityFunctions(){return iH},get getAppNames(){return iW},get pathToActiveWhen(){return iZ},get navigateToUrl(){return ix},get patchHistoryApi(){return iz},get triggerAppChange(){return i1},get addErrorHandler(){return tj},get removeErrorHandler(){return tR},get mountRootParcel(){return ic},get NOT_LOADED(){return tW},get LOADING_SOURCE_CODE(){return tV},get NOT_BOOTSTRAPPED(){return tG},get BOOTSTRAPPING(){return tU},get NOT_MOUNTED(){return tH},get MOUNTING(){return tq},get UPDATING(){return tY},get LOAD_ERROR(){return tX},get MOUNTED(){return tK},get UNLOADING(){return tZ},get UNMOUNTING(){return tJ},get SKIP_BECAUSE_BROKEN(){return tQ}}),tT=("u">typeof globalThis?globalThis:"u">typeof window?window:"u">typeof global?global:"u">typeof self?self:{}).CustomEvent,tB=!function(){try{var e=new tT("cat",{detail:{foo:"bar"}});return"cat"===e.type&&"bar"===e.detail.foo}catch(e){}return!1}()?"u">typeof document&&"function"==typeof document.createEvent?function(e,n){var t=document.createEvent("CustomEvent");return n?t.initCustomEvent(e,n.bubbles,n.cancelable,n.detail):t.initCustomEvent(e,!1,!1,void 0),t}:function(e,n){var t=document.createEventObject();return t.type=e,n?(t.bubbles=!!n.bubbles,t.cancelable=!!n.cancelable,t.detail=n.detail):(t.bubbles=!1,t.cancelable=!1,t.detail=void 0),t}:tT;let tI=[];function tN(e,n,t){let i=tL(e,n,t);tI.length?tI.forEach(e=>e(i)):setTimeout(()=>{throw i})}function tj(e){if("function"!=typeof e)throw Error(tF(28,!1));tI.push(e)}function tR(e){if("function"!=typeof e)throw Error(tF(29,!1));let n=!1;return tI=tI.filter(t=>{let i=t===e;return n=n||i,!i}),n}function tF(e,n,...t){return`single-spa minified message #${e}: ${n?n+" ":""}See https://single-spa.js.org/error/?code=${e}${t.length?`&arg=${t.join("&arg=")}`:""}`}function tL(e,n,t){let i,r=`${t5(n)} '${t2(n)}' died in status ${n.status}: `;if(e instanceof Error){try{e.message=r+e.message}catch(e){}i=e}else{console.warn(tF(30,!1,n.status,t2(n)));try{i=Error(r+JSON.stringify(e))}catch(n){i=e}}return i.appOrParcelName=t2(n),n.status=t,i}let tW="NOT_LOADED",tV="LOADING_SOURCE_CODE",tG="NOT_BOOTSTRAPPED",tU="BOOTSTRAPPING",tH="NOT_MOUNTED",tq="MOUNTING",tK="MOUNTED",tY="UPDATING",tJ="UNMOUNTING",tZ="UNLOADING",tX="LOAD_ERROR",tQ="SKIP_BECAUSE_BROKEN";function t0(e){return e.status===tK}function t1(e){try{return e.activeWhen(window.location)}catch(n){return tN(n,e,tQ),!1}}function t2(e){return e.name}function t3(e){return!!e.unmountThisParcel}function t5(e){return t3(e)?"parcel":"application"}function t4(){for(let e=arguments.length-1;e>0;e--)for(let n in arguments[e])"__proto__"!==n&&(arguments[e-1][n]=arguments[e][n]);return arguments[0]}function t6(e,n){for(let t=0;t<e.length;t++)if(n(e[t]))return e[t];return null}function t8(e){return e&&("function"==typeof e||Array.isArray(e)&&!t6(e,e=>"function"!=typeof e))}function t7(e,n){let t=e[n]||[];0===(t=Array.isArray(t)?t:[t]).length&&(t=[()=>Promise.resolve()]);let i=t5(e),r=t2(e);return function(e){return t.reduce((t,a,o)=>t.then(()=>{let t=a(e);return t9(t)?t:Promise.reject(tF(15,!1,i,r,n,o))}),Promise.resolve())}}function t9(e){return e&&"function"==typeof e.then&&"function"==typeof e.catch}let ie=[];function it(e,n){return Promise.resolve().then(()=>e.status!==tG?e:(e.status=tU,e.bootstrap?i_(e,"bootstrap").then(t).catch(t=>{if(n)throw tL(t,e,tQ);return tN(t,e,tQ),e}):Promise.resolve().then(t)));function t(){return e.status=tH,e}}function ii(e,n){return Promise.resolve().then(()=>{if(e.status!==tK)return e;return e.status=tJ,Promise.all(Object.keys(e.parcels).map(n=>e.parcels[n].unmountThisParcel())).then(t,i=>t().then(()=>{let t=Error(i.message);if(n)throw tL(t,e,tQ);tN(t,e,tQ)})).then(()=>e);function t(){return i_(e,"unmount").then(()=>{e.status=tH},t=>{if(n)throw tL(t,e,tQ);tN(t,e,tQ)})}})}let ir=!1,ia=!1;function io(e,n){return Promise.resolve().then(()=>e.status!==tH?e:(ir||(window.dispatchEvent(new tB("single-spa:before-first-mount")),ir=!0),e.status=tq,i_(e,"mount").then(()=>(e.status=tK,ia||(window.dispatchEvent(new tB("single-spa:first-mount")),ia=!0),e)).catch(t=>{return e.status=tK,ii(e,!0).then(i,i);function i(){if(n)throw tL(t,e,tQ);return tN(t,e,tQ),e}})))}let is=0,il={parcels:{}};function ic(){return iu.apply(il,arguments)}function iu(e,n){let t,i,r,a=this;if(!e||"object"!=typeof e&&"function"!=typeof e)throw Error(tF(2,!1));if(e.name&&"string"!=typeof e.name)throw Error(tF(3,!1,typeof e.name));let o=is++,s=e.name||`parcel-${o}`;if("object"!=typeof n)throw Error(tF(4,!1,s,typeof n));if(!n.domElement)throw Error(tF(5,!1,s));let l="function"==typeof e,c=l?e:()=>Promise.resolve(e),u={id:o,parcels:{},status:l?tV:tG,customProps:n,parentName:t2(a),unmountThisParcel:()=>f.then(()=>{if(u.status!==tK)throw Error(tF(6,!1,s,u.status));return ii(u,!0)}).then(e=>(u.parentName&&delete a.parcels[u.id],e)).then(e=>(i(e),e)).catch(e=>{throw u.status=tQ,r(e),e})};a.parcels[o]=u;let p=c();if(!p||"function"!=typeof p.then)throw Error(tF(7,!1));let d=(p=p.then(e=>{if(!e)throw Error(tF(8,!1));if(s=e.name||`parcel-${o}`,Object.prototype.hasOwnProperty.call(e,"bootstrap")&&!t8(e.bootstrap))throw Error(tF(9,!1,s));if(!t8(e.mount))throw Error(tF(10,!1,s));if(!t8(e.unmount))throw Error(tF(11,!1,s));if(e.update&&!t8(e.update))throw Error(tF(12,!1,s));let n=t7(e,"bootstrap"),i=t7(e,"mount"),r=t7(e,"unmount");u.status=tG,u.name=s,u.bootstrap=n,u.mount=i,u.unmount=r,u.timeouts=iv(e.timeouts),e.update&&(u.update=t7(e,"update"),t.update=function(e){return u.customProps=e,ip(Promise.resolve().then(()=>{if(u.status!==tK)throw Error(tF(32,!1,t2(u)));return u.status=tY,i_(u,"update").then(()=>(u.status=tK,u)).catch(e=>{throw tL(e,u,tQ)})}))})})).then(()=>it(u,!0)),f=d.then(()=>io(u,!0)),h=new Promise((e,n)=>{i=e,r=n});return t={mount:()=>ip(Promise.resolve().then(()=>{if(u.status!==tH)throw Error(tF(13,!1,s,u.status));return a.parcels[o]=u,io(u)})),unmount:()=>ip(u.unmountThisParcel()),getStatus:()=>u.status,loadPromise:ip(p),bootstrapPromise:ip(d),mountPromise:ip(f),unmountPromise:ip(h)}}function ip(e){return e.then(()=>null)}function id(e){let n=t2(e),t="function"==typeof e.customProps?e.customProps(n,window.location):e.customProps;("object"!=typeof t||null===t||Array.isArray(t))&&(t={},console.warn(tF(40,!1),n,t));let i=t4({},t,{name:n,mountParcel:iu.bind(e),singleSpa:tP});return t3(e)&&(i.unmountSelf=e.unmountThisParcel),i}let ih={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 ig(e,n,t){if("number"!=typeof e||e<=0)throw Error(tF(16,!1));ih.bootstrap={millis:e,dieOnTimeout:n,warningMillis:t||1e3}}function im(e,n,t){if("number"!=typeof e||e<=0)throw Error(tF(17,!1));ih.mount={millis:e,dieOnTimeout:n,warningMillis:t||1e3}}function ib(e,n,t){if("number"!=typeof e||e<=0)throw Error(tF(18,!1));ih.unmount={millis:e,dieOnTimeout:n,warningMillis:t||1e3}}function iy(e,n,t){if("number"!=typeof e||e<=0)throw Error(tF(19,!1));ih.unload={millis:e,dieOnTimeout:n,warningMillis:t||1e3}}function i_(e,n){let t=e.timeouts[n],i=t.warningMillis,r=t5(e);return new Promise((a,o)=>{let s=!1,l=!1;e[n](id(e)).then(e=>{s=!0,a(e)}).catch(e=>{s=!0,o(e)}),setTimeout(()=>u(1),i),setTimeout(()=>u(!0),t.millis);let c=tF(31,!1,n,r,t2(e),t.millis);function u(e){s||(!0===e?(l=!0,t.dieOnTimeout?o(Error(c)):console.error(c)):!l&&(console.warn(c),e*i+i<t.millis&&setTimeout(()=>u(e+1),i)))}})}function iv(e){let n={};for(let t in ih)n[t]=t4({},ih[t],e&&e[t]||{});return n}function i$(e){return Promise.resolve().then(()=>{let n,t;return e.loadPromise?e.loadPromise:e.status!==tW&&e.status!==tX?e:(e.status=tV,e.loadPromise=Promise.resolve().then(()=>{let i=e.loadApp(id(e));if(!t9(i))throw t=!0,Error(tF(33,!1,t2(e)));return i.then(t=>{let i;e.loadErrorTime=null,"object"!=typeof(n=t)&&(i=34),Object.prototype.hasOwnProperty.call(n,"bootstrap")&&!t8(n.bootstrap)&&(i=35),t8(n.mount)||(i=36),t8(n.unmount)||(i=37);let r=t5(n);if(i){let t;try{t=JSON.stringify(n)}catch(e){}return console.error(tF(i,!1,r,t2(e),t),n),tN(void 0,e,tQ),e}return n.devtools&&n.devtools.overlays&&(e.devtools.overlays=t4({},e.devtools.overlays,n.devtools.overlays)),e.status=tG,e.bootstrap=t7(n,"bootstrap"),e.mount=t7(n,"mount"),e.unmount=t7(n,"unmount"),e.unload=t7(n,"unload"),e.timeouts=iv(n.timeouts),delete e.loadPromise,e})}).catch(n=>{let i;return delete e.loadPromise,t?i=tQ:(i=tX,e.loadErrorTime=(new Date).getTime()),tN(n,e,i),e}))})}let iA="u">typeof window,iw={hashchange:[],popstate:[]},ik=["hashchange","popstate"];function ix(e){let n;if("string"==typeof e)n=e;else if(this&&this.href)n=this.href;else{if(!(e&&e.currentTarget&&e.currentTarget.href&&e.preventDefault))throw Error(tF(14,!1));n=e.currentTarget.href,e.preventDefault()}let t=iO(window.location.href),i=iO(n);0===n.indexOf("#")?window.location.hash=i.hash:t.host!==i.host&&i.host?window.location.href=n:i.pathname===t.pathname&&i.search===t.search?window.location.hash=i.hash:window.history.pushState(null,null,n)}function iC(e){if(e){let n=e[0].type;ik.indexOf(n)>=0&&iw[n].forEach(n=>{try{n.apply(this,e)}catch(e){setTimeout(()=>{throw e})}})}}function iE(){i2([],arguments)}function iS(e,n){return function(){let t=window.location.href,r=e.apply(this,arguments),a=window.location.href;return i&&t===a||window.dispatchEvent(function(e,n){let t;try{t=new PopStateEvent("popstate",{state:e})}catch(n){(t=document.createEvent("PopStateEvent")).initPopStateEvent("popstate",!1,!1,e)}return t.singleSpa=!0,t.singleSpaTrigger=n,t}(window.history.state,n)),r}}let iD=null,iM=!1;function iz(e){if(iM)throw Error(tF(43,!1));i=!e||!e.hasOwnProperty("urlRerouteOnly")||e.urlRerouteOnly,iM=!0,iD=window.history.replaceState,window.addEventListener("hashchange",iE),window.addEventListener("popstate",iE);let n=window.addEventListener,t=window.removeEventListener;window.addEventListener=function(e,t){if(!("function"==typeof t&&ik.indexOf(e)>=0)||t6(iw[e],e=>e===t))return n.apply(this,arguments);iw[e].push(t)},window.removeEventListener=function(e,n){return"function"==typeof n&&ik.indexOf(e)>=0&&(iw[e]=iw[e].filter(e=>e!==n)),t.apply(this,arguments)},window.history.pushState=iS(window.history.pushState,"pushState"),window.history.replaceState=iS(iD,"replaceState")}function iO(e){let n=document.createElement("a");return n.href=e,n}iA&&(window.singleSpaNavigate?console.warn(tF(41,!1)):window.singleSpaNavigate=ix);let iP=!1;function iT(e=window.jQuery){if(e||window.$&&window.$.fn&&window.$.fn.jquery&&(e=window.$),e&&!iP){let n=e.fn.on,t=e.fn.off;e.fn.on=function(e,t){return iB.call(this,n,window.addEventListener,e,t,arguments)},e.fn.off=function(e,n){return iB.call(this,t,window.removeEventListener,e,n,arguments)},iP=!0}}function iB(e,n,t,i,r){return"string"!=typeof t?e.apply(this,r):(t.split(/\s+/).forEach(e=>{ik.indexOf(e)>=0&&(n(e,i),t=t.replace(e,""))}),""===t.trim()?this:e.apply(this,r))}let iI={};function iN(e){return Promise.resolve().then(()=>{let n=iI[t2(e)];if(!n)return e;if(e.status===tW)return ij(e,n),e;if(e.status===tZ)return n.promise.then(()=>e);if(e.status!==tH&&e.status!==tX)return e;let t=e.status===tX?Promise.resolve():i_(e,"unload");return e.status=tZ,t.then(()=>(ij(e,n),e)).catch(t=>(delete iI[t2(e)],delete e.bootstrap,delete e.mount,delete e.unmount,delete e.unload,tN(t,e,tQ),n.reject(t),e))})}function ij(e,n){delete iI[t2(e)],delete e.bootstrap,delete e.mount,delete e.unmount,delete e.unload,e.status=tW,n.resolve()}function iR(e,n,t,i){iI[t2(e)]={app:e,resolve:t,reject:i},Object.defineProperty(iI[t2(e)],"promise",{get:n})}let iF=[];function iL(){return iF.filter(t0).map(t2)}function iW(){return iF.map(t2)}function iV(e){let n=t6(iF,n=>t2(n)===e);return n?n.status:null}let iG=!1;function iU(e,n,t,i){var r,a;let o,s,l=(o={name:null,loadApp:null,activeWhen:null,customProps:null},"object"==typeof e?(function(e){if(Array.isArray(e)||null===e)throw Error(tF(39,!1));let n=["name","app","activeWhen","customProps"],t=Object.keys(e).reduce((e,t)=>n.indexOf(t)>=0?e:e.concat(t),[]);if(0!==t.length)throw Error(tF(38,!1,n.join(", "),t.join(", ")));if("string"!=typeof e.name||0===e.name.length||"object"!=typeof e.app&&"function"!=typeof e.app)throw Error(tF(20,!1));let i=e=>"string"==typeof e||"function"==typeof e;if(!(i(e.activeWhen)||Array.isArray(e.activeWhen)&&e.activeWhen.every(i)))throw Error(tF(24,!1));if(!iJ(e.customProps))throw Error(tF(22,!1))}(e),o.name=e.name,o.loadApp=e.app,o.activeWhen=e.activeWhen,o.customProps=e.customProps):(function(e,n,t,i){if("string"!=typeof e||0===e.length)throw Error(tF(20,!1));if(!n)throw Error(tF(23,!1));if("function"!=typeof t)throw Error(tF(24,!1));if(!iJ(i))throw Error(tF(22,!1))}(e,n,t,i),o.name=e,o.loadApp=n,o.activeWhen=t,o.customProps=i),o.loadApp="function"!=typeof(r=o.loadApp)?()=>Promise.resolve(r):r,o.customProps=o.customProps||{},s=(s=Array.isArray(a=o.activeWhen)?a:[a]).map(e=>"function"==typeof e?e:iZ(e)),o.activeWhen=e=>s.some(n=>n(e)),o);if(i5||iG||(iG=!0,setTimeout(()=>{i5||console.warn(tF(1,!1))},5e3)),-1!==iW().indexOf(l.name))throw Error(tF(21,!1,l.name));iF.push(t4({loadErrorTime:null,status:tW,parcels:{},devtools:{overlays:{options:{},selectors:[]}}},l)),iA&&(iT(),i2())}function iH(e=window.location){return iF.filter(n=>n.activeWhen(e)).map(t2)}function iq(e){if(0===iF.filter(n=>t2(n)===e).length)throw Error(tF(25,!1,e));return(iA?iK(e,{waitForUnmount:!1}):Promise.resolve()).then(()=>{let n=iF.map(t2).indexOf(e);iF.splice(n,1)})}function iK(e,n={waitForUnmount:!1}){if("string"!=typeof e)throw Error(tF(26,!1));let t=t6(iF,n=>t2(n)===e);if(!t)throw Error(tF(27,!1,e));let i=iI[t2(t)];if(n&&n.waitForUnmount){if(i)return i.promise;{let e=new Promise((n,i)=>{iR(t,()=>e,n,i)});return e}}{let e;return i?(e=i.promise,iY(t,i.resolve,i.reject)):e=new Promise((n,i)=>{iR(t,()=>e,n,i),iY(t,n,i)}),e}}function iY(e,n,t){Promise.resolve().then(()=>{if(t6(iH(),n=>n===t2(e)))return i1()}).then(()=>ii(e).then(iN).then(()=>{n(),setTimeout(()=>{i2()})})).catch(t)}function iJ(e){return!e||"function"==typeof e||"object"==typeof e&&null!==e&&!Array.isArray(e)}function iZ(e,n){let t=function(e,n){let t=0,i=!1,r="^";"/"!==e[0]&&(e="/"+e);for(let n=0;n<e.length;n++){let t=e[n],r=i&&"/"===t;(!i&&":"===t||r)&&a(n)}return a(e.length),RegExp(r,"i");function a(a){let o=e.slice(t,a).replace(/[|\\{}()[\]^$+*?.]/g,"\\$&");if(r+=i?"[^/]+/?":o,a===e.length)if(i)n&&(r+="$");else{let e=n?"":".*";r="/"===r.charAt(r.length-1)?`${r}${e}$`:`${r}(/${e})?(#.*)?$`}i=!i,t=a}}(e,n);return e=>{let n=e.origin;n||(n=`${e.protocol}//${e.host}`);let i=e.href.replace(n,"").replace(e.search,"").split("?")[0];return t.test(i)}}let iX=!1,iQ=[],i0=iA&&window.location.href;function i1(){return i2()}function i2(e=[],n,t=!1){let i,r,a,o,s;if(iX)return new Promise((e,t)=>{iQ.push({resolve:e,reject:t,eventArguments:n})});let{appsToUnload:l,appsToUnmount:c,appsToLoad:u,appsToMount:p}=(i=[],r=[],a=[],o=[],s=(new Date).getTime(),iF.forEach(e=>{let n=e.status!==tQ&&t1(e);switch(e.status){case tX:n&&s-e.loadErrorTime>=200&&a.push(e);break;case tW:case tV:n&&a.push(e);break;case tG:case tH:!n&&iI[t2(e)]?i.push(e):n&&o.push(e);break;case tK:n||r.push(e)}}),{appsToUnload:i,appsToUnmount:r,appsToLoad:a,appsToMount:o}),d,f=[],h=i0,g=i0=window.location.href;return i5?(iX=!0,d=l.concat(u,c,p),Promise.resolve().then(()=>($(0===d.length?"before-no-app-change":"before-app-change",v(!0)),$("before-routing-event",v(!0,{cancelNavigation:m})),Promise.all(f).then(t=>{if(t.some(e=>e))return iD.call(window.history,history.state,"",h.substring(location.origin.length)),i0=location.href,iX=!1,i2(e,n,!0);let i=l.map(iN),r=Promise.all(c.map(ii).map(e=>e.then(iN)).concat(i));r.then(()=>{$("before-mount-routing-event",v(!0))},e=>{throw e});let a=u.map(e=>i$(e).then(e=>i3(e,r))),o=p.filter(e=>0>u.indexOf(e)).map(e=>i3(e,r));return r.catch(e=>{throw y(),e}).then(()=>(y(),Promise.all(a.concat(o)).catch(n=>{throw e.forEach(e=>e.reject(n)),n}).then(b).then(()=>{},e=>{throw e})))})))):(d=u,Promise.resolve().then(()=>Promise.all(u.map(i$)).then(y).then(()=>[]).catch(e=>{throw y(),e}).finally(()=>{})));function m(e=!0){let n="function"==typeof(null==e?void 0:e.then)?e:Promise.resolve(e);f.push(n.catch(e=>(console.warn(Error(tF(42,!1))),console.warn(e),!1)))}function b(){let n=iL();e.forEach(e=>e.resolve(n));try{$(0===d.length?"no-app-change":"app-change",v()),$("routing-event",v())}catch(e){setTimeout(()=>{throw e})}if(iX=!1,iQ.length>0){let e=iQ;iQ=[],i2(e)}return n}function y(){t||(e.forEach(e=>{iC(e.eventArguments)}),iC(n))}function v(e=!1,t){let i={},r={[tK]:[],[tH]:[],[tW]:[],[tQ]:[]};e?(u.concat(p).forEach((e,n)=>{o(e,tK)}),l.forEach(e=>{o(e,tW)}),c.forEach(e=>{o(e,tH)})):d.forEach(e=>{o(e)});let a={detail:{newAppStatuses:i,appsByNewStatus:r,totalAppChanges:d.length,originalEvent:null==n?void 0:n[0],oldUrl:h,newUrl:g}};return t&&t4(a.detail,t),a;function o(e,n){let t=t2(e);n=n||iV(t),i[t]=n,(r[n]=r[n]||[]).push(t)}}function $(e,n){t||window.dispatchEvent(new tB(`single-spa:${e}`,n))}}function i3(e,n){return t1(e)?it(e).then(e=>n.then(()=>t1(e)?io(e):e)):n.then(()=>e)}let i5=!1;function i4(e){i5=!0,iA&&(iz(e),i2())}function i6(e,n){let t=window.getOpenmrsSpaBase().replace(/\/$/,"");return i8(e,{openmrsBase:window.openmrsBase,openmrsSpaBase:t,...n}).replace(/^\/\//,"/")}function i8(e,n){return Object.keys(n).reduce((e,t)=>e.split("${"+t+"}").join(n[t]),e)}function i7({to:e,templateParams:n}){let t=window.getOpenmrsSpaBase().replace(/\/$/,""),i=i6(e,n).replace(window.location.origin,"");i.startsWith(t)?ix(i):window.location.assign(i)}iA&&window.__SINGLE_SPA_DEVTOOLS__&&(window.__SINGLE_SPA_DEVTOOLS__.exposedMethods={getRawAppData:function(){return[...iF]},reroute:i2,NOT_LOADED:tW,toLoadPromise:i$,toBootstrapPromise:it,unregisterApplication:iq,getProfilerData:function(){return ie}});let i9="openmrs:history";function re(e){let n=JSON.parse(sessionStorage.getItem(i9)??"[]")||[];n.push(e),n.length>50&&(n=n.slice(-50)),sessionStorage.setItem(i9,JSON.stringify(n))}function rn(){0===JSON.parse(sessionStorage.getItem(i9)??"[]").length&&document.referrer&&re(document.referrer),window.addEventListener("single-spa:routing-event",e=>{let n=rt();e.detail.originalEvent?.singleSpaTrigger=="replaceState"?(n[n.length-1]=window.location.href,sessionStorage.setItem(i9,JSON.stringify(n))):!e.detail.originalEvent?.singleSpa&&n.includes(window.location.href)?ri({toUrl:window.location.href}):n[n.length-1]!==window.location.href&&re(window.location.href)})}function rt(){return JSON.parse(sessionStorage.getItem(i9)??"[]")}function ri({toUrl:e}){let n=rt(),t=n.lastIndexOf(e);if(-1!=t){let e=n.slice(0,t+1);i7({to:n[t]}),sessionStorage.setItem(i9,JSON.stringify(e))}else throw Error(`URL ${e} not found in history; cannot go back to it.`)}function rr(){sessionStorage.removeItem(i9)}let ra="${openmrsSpaBase}/login",ro={redirectAuthFailure:{enabled:{_type:nT.Boolean,_default:!0,_description:"Whether to redirect logged-out users to `redirectAuthFailure.url`"},url:{_type:nT.String,_default:ra,_validators:[tk.isUrl],_description:"The url to which users will be redirected when they are logged out. If set to blank, the `location` header from the response will be used."},errors:{_type:nT.Array,_default:[401],_elements:{_type:nT.Number,_validators:[tk.inRange(100,600)]},_description:"The HTTP error codes for which users will be redirected"},resolvePromise:{_type:nT.Boolean,_default:!1,_description:"Changes how requests that fail authentication are handled. Try messing with this if redirects to the login page aren't working correctly."}},followRedirects:{_type:nT.Boolean,_default:!0,_description:"Whether openmrsFetch should support redirects returned from the backend"}};function rs(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}let rl="/ws/rest/v1",rc="/ws/fhir2/R4",ru=`${rl}/session`;function rp(e){return e&&e.startsWith("http")?e:("/"!==e[0]&&(e="/"+e),window.openmrsBase+e)}function rd(e,n={}){if("string"!=typeof e)throw Error("The first argument to @openmrs/api's openmrsFetch function must be a url string");if("object"!=typeof n)throw Error("The second argument to @openmrs/api's openmrsFetch function must be a plain object.");if(!window.openmrsBase)throw Error("@openmrs/api is running in a browser that doesn't have window.openmrsBase, which is provided by openmrs-module-spa's HTML file.");let t=rp(e);if(n.headers||(n.headers={}),ep(n.body)&&(n.body=JSON.stringify(n.body)),void 0===n.headers.Accept&&(n.headers.Accept="application/json"),null===n.headers.Accept&&delete n.headers.Accept,e.startsWith(rl)&&void 0===n.headers["Disable-WWW-Authenticate"]&&(n.headers["Disable-WWW-Authenticate"]="true"),e.startsWith(rc)){let e=new URL(t,window.location.toString());e.searchParams.has("_summary")||(e.searchParams.set("_summary","data"),t=e.toString())}let i=Error();return window.fetch(t,n).then(async e=>{let{redirectAuthFailure:n,followRedirects:r}=await te("@openmrs/esm-api");if(e.ok){let n=e.headers.get("location");return(r&&n&&(t===rp(ru)||204===e.status)&&i7({to:n}),204===e.status)?(e.data=null,e):e.clone().text().then(n=>{try{n&&(e.data=JSON.parse(n))}catch(e){}return e})}return t===rp(ru)&&403===e.status||n.enabled&&n.errors.includes(e.status)?(rr(),i7({to:n.url||e.headers.get("location")||ra}),n.resolvePromise?Promise.resolve():new Promise(()=>{})):e.clone().text().then(n=>{let r=n;try{r=JSON.parse(n)}catch(e){}throw new rh(t,e,r,i)},n=>{throw new rh(t,e,null,i)})})}function rf(e,n={}){if("object"!=typeof n)throw Error("The second argument to openmrsObservableFetch must be either omitted or an object");let t=new AbortController;return n.signal=t.signal,new ei.Observable(i=>{let r=!1;return rd(e,n).then(e=>{r=!0,i.next(e),i.complete()},e=>{r=!0,i.error(e)}),()=>{r||t.abort()}})}class rh extends Error{constructor(e,n,t,i){super(),rs(this,"response",void 0),rs(this,"responseBody",void 0),this.message=`Server responded with ${n.status} (${n.statusText}) for url ${e}. Check err.responseBody or network tab in dev tools for more info`,i.message=this.message,this.responseBody=t,this.response=n,this.stack=`Stacktrace for outgoing request:
13
13
  ${i.stack}
14
14
  Stacktrace for incoming response:
15
15
  ${this.stack}`}}let rg=U("session",{loaded:!1,session:null}),rm=0;function rb(e={includeAuthStatus:!0}){return(rm<Date.now()-6e4||!rg.getState().loaded)&&rv(),new ei.Observable(n=>{let t=t=>{t.loaded&&(e.includeAuthStatus?n.next(t.session):n.next(t.session?.user))};return t(rg.getState()),rg.subscribe(t)})}function ry(){return(rm<Date.now()-6e4||!rg.getState().loaded)&&rv(),rg}function r_(e){let n=e.locale??e.user?.userProperties?.defaultLocale;n&&n.includes("_")&&(n=n.replaceAll("_","-")),function(e){if(void 0===e||"string"!=typeof e)return!1;try{new Intl.Locale(e)}catch(e){return!1}return!0}(n)&&n!==document.documentElement.getAttribute("lang")&&document.documentElement.setAttribute("lang",n)}function rv(e,n){rm=Date.now();let t={};return e&&n&&(t.Authorization=`Basic ${window.btoa(`${e}:${n}`)}`),rE(rd(ru,{headers:t}))}function r$(){rg.setState({loaded:!0,session:{authenticated:!1,sessionId:""}})}function rA(e,n){var t,i;if(void 0===n)return!e;if(!e)return!0;return t=e,i=n,("string"==typeof t?!J(i.privileges.find(e=>t===e.display)):Array.isArray(t)?t.every(e=>!J(i.privileges.find(n=>e===n.display))):(J(t)||console.error(`Could not understand privileges "${t}"`),!0))||!J(n.roles.find(e=>"System Developer"===e.display))}function rw(){let e,n;return new Promise(t=>{let i=i=>{i.loaded&&i.session.user&&(e=i.session.user,t(i.session.user),n&&n())};i(rg.getState()),e||(n=rg.subscribe(i))})}function rk(){return new Promise((e,n)=>{rb().subscribe(n=>{e(n.sessionLocation)},n).unsubscribe()})}async function rx(e,n){return rE(rd(ru,{method:"POST",body:{sessionLocation:e},headers:{"Content-Type":"application/json"},signal:n.signal}))}async function rC(e,n,t){return t||(t=new AbortController),await rd(`${rl}/user/${e}`,{method:"POST",body:{userProperties:n},headers:{"Content-Type":"application/json"},signal:t.signal}),rv()}function rE(e){return new Promise((n,t)=>{e.then(e=>{let i;"object"==typeof e?.data?(i={loaded:!0,session:e.data},rg.setState(i),n(i)):(i={loaded:!1,session:null},rg.setState(i),t(i))}).catch(e=>{B(`Failed to fetch new session information: ${e}`);let n={loaded:!1,session:null};rg.setState(n),t(n)})})}function rS(){return"development"===window.spaEnv||"true"===localStorage.getItem("openmrs:devtools")}rg.subscribe(e=>{e.loaded&&e.session&&r_(e.session)});let rD={"webservices.rest":"2.24.0",fhir2:"1.0.0-SNAPSHOT"};function rM(){n5("@openmrs/esm-api",ro),rv()}let rz={address1:"Address line 1",address2:"Address line 2",address3:"Address line 3",address4:"Address line 4",address5:"Address line 5",address6:"Address line 6",city:"City",cityVillage:"City",country:"Country",countyDistrict:"District",district:"District",postalCode:"Postal code",state:"State",stateProvince:"State",closeAllOpenedWorkspaces:"Discard changes in {{count}} workspaces",closingAllWorkspacesPromptBody:"There may be unsaved changes in the following workspaces. Do you want to discard changes in the following workspaces? {{workspaceNames}}",closingAllWorkspacesPromptTitle:"You have unsaved changes",discard:"Discard",hide:"Hide",maximize:"Maximize",minimize:"Minimize",openAnyway:"Open anyway",unsavedChangesInOpenedWorkspace:"You may have unsaved changes in the opened workspace. Do you want to discard these changes?",unsavedChangesInWorkspace:'There may be unsaved changes in "{{workspaceName}}". Please save them before opening another workspace.',unsavedChangesTitleText:"Unsaved changes",workspaceHeader:"Workspace header",closeWorkspaces2PromptTitle:"Close workspace(s)",closeWorkspaces2PromptBody:"You are about to close the following workspace(s), which might have unsaved changes:",abnormalValue:"Abnormal value",actions:"Actions",actionableNotification:"Actionable notification",address:"Address",age:"Age",batchActionItemSelected:"{{totalSelected}} item selected",batchActionsItemsSelected:"{{totalSelected}} items selected",cancel:"Cancel",change:"Change",Clinic:"Clinic",close:"Close",closesActionableNotification:"Close actionable notification",closeSnackbar:"Close snackbar",confirm:"Confirm",contactAdministratorIfIssuePersists:"Contact your system administrator if the problem persists.",contactDetails:"Contact details",delete:"Delete",discardChanges:"Discard changes",edit:"Edit",emptyStateText:"There are no {{displayText}} to display",error:"Error",errorCopy:"Sorry, there was a problem displaying this information. You can try to reload this page, or contact the site administrator and quote the error code above.",errorLoadingLoginLocations:"Unable to load login locations. Please try again or contact support if the problem persists.",female:"Female",leftNavigation:"Left navigation",loading:"Loading",male:"Male",noResultsToDisplay:"No results to display",notAvailable:"Not available",other:"Other",paginationItemsCount:"{{pageItemsCount}} / {{totalItems}} items",paginationOfPages:"of {{count}} pages",patientAvatarAlt:"Avatar for {{patientName}}",patientIdentifierSticker:"Patient identifier sticker",patientLists:"Patient lists",patientPhotoAlt:"Profile photo of {{patientName}}",patientPhotoPlaceholder:"Photo placeholder for {{patientName}}",print:"Print",printError:"Print error",printErrorExplainer:"An error occurred in {{errorLocation}}",printIdentifierSticker:"Print identifier sticker",printing:"Printing",recordNewEntry:"Record {{displayText}}",relationships:"Relationships",resetOverrides:"Reset overrides",save:"Save",scriptLoadingFailed:"Error: Script failed to load",scriptLoadingError:"Failed to load overridden script from {{url}}. Please check that the bundled script is available at the expected URL. Click the button below to reset all import map overrides.",searchForLocation:"Search for a location",seeAll:"See all",seeMoreLists:"See {{count}} more lists",selectAll:"Select all",sex:"Sex",showLess:"Show less",showMore:"Show more",snackbarNotification:"Snackbar notification",toggleDevTools:"Toggle dev tools",unknown:"Unknown",yearAbbreviation:"yr",yearsAbbreviation:"yrs"},rO=e=>"string"==typeof e,rP=()=>{let e,n,t=new Promise((t,i)=>{e=t,n=i});return t.resolve=e,t.reject=n,t},rT=e=>null==e?"":""+e,rB=/###/g,rI=e=>e&&e.indexOf("###")>-1?e.replace(rB,"."):e,rN=e=>!e||rO(e),rj=(e,n,t)=>{let i=rO(n)?n.split("."):n,r=0;for(;r<i.length-1;){if(rN(e))return{};let n=rI(i[r]);!e[n]&&t&&(e[n]=new t),e=Object.prototype.hasOwnProperty.call(e,n)?e[n]:{},++r}return rN(e)?{}:{obj:e,k:rI(i[r])}},rR=(e,n,t)=>{let{obj:i,k:r}=rj(e,n,Object);if(void 0!==i||1===n.length){i[r]=t;return}let a=n[n.length-1],o=n.slice(0,n.length-1),s=rj(e,o,Object);for(;void 0===s.obj&&o.length;)a=`${o[o.length-1]}.${a}`,s=rj(e,o=o.slice(0,o.length-1),Object),s?.obj&&void 0!==s.obj[`${s.k}.${a}`]&&(s.obj=void 0);s.obj[`${s.k}.${a}`]=t},rF=(e,n)=>{let{obj:t,k:i}=rj(e,n);if(t&&Object.prototype.hasOwnProperty.call(t,i))return t[i]},rL=(e,n,t)=>{for(let i in n)"__proto__"!==i&&"constructor"!==i&&(i in e?rO(e[i])||e[i]instanceof String||rO(n[i])||n[i]instanceof String?t&&(e[i]=n[i]):rL(e[i],n[i],t):e[i]=n[i]);return e};var rW={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;","/":"&#x2F;"};let rV=e=>rO(e)?e.replace(/[&<>"'\/]/g,e=>rW[e]):e,rG=[" ",",","?","!",";"],rU=new class{constructor(e){this.capacity=e,this.regExpMap=new Map,this.regExpQueue=[]}getRegExp(e){let n=this.regExpMap.get(e);if(void 0!==n)return n;let t=new RegExp(e);return this.regExpQueue.length===this.capacity&&this.regExpMap.delete(this.regExpQueue.shift()),this.regExpMap.set(e,t),this.regExpQueue.push(e),t}}(20),rH=(e,n,t=".")=>{if(!e)return;if(e[n]){if(!Object.prototype.hasOwnProperty.call(e,n))return;return e[n]}let i=n.split(t),r=e;for(let e=0;e<i.length;){let n;if(!r||"object"!=typeof r)return;let a="";for(let o=e;o<i.length;++o)if(o!==e&&(a+=t),a+=i[o],void 0!==(n=r[a])){if(["string","number","boolean"].indexOf(typeof n)>-1&&o<i.length-1)continue;e+=o-e+1;break}r=n}return r},rq=e=>e?.replace("_","-"),rK={type:"logger",log(e){this.output("log",e)},warn(e){this.output("warn",e)},error(e){this.output("error",e)},output(e,n){console?.[e]?.apply?.(console,n)}};class rY{constructor(e,n={}){this.init(e,n)}init(e,n={}){this.prefix=n.prefix||"i18next:",this.logger=e||rK,this.options=n,this.debug=n.debug}log(...e){return this.forward(e,"log","",!0)}warn(...e){return this.forward(e,"warn","",!0)}error(...e){return this.forward(e,"error","")}deprecate(...e){return this.forward(e,"warn","WARNING DEPRECATED: ",!0)}forward(e,n,t,i){return i&&!this.debug?null:(rO(e[0])&&(e[0]=`${t}${this.prefix} ${e[0]}`),this.logger[n](e))}create(e){return new rY(this.logger,{...{prefix:`${this.prefix}:${e}:`},...this.options})}clone(e){return(e=e||this.options).prefix=e.prefix||this.prefix,new rY(this.logger,e)}}var rJ=new rY;class rZ{constructor(){this.observers={}}on(e,n){return e.split(" ").forEach(e=>{this.observers[e]||(this.observers[e]=new Map);let t=this.observers[e].get(n)||0;this.observers[e].set(n,t+1)}),this}off(e,n){if(this.observers[e]){if(!n)return void delete this.observers[e];this.observers[e].delete(n)}}emit(e,...n){this.observers[e]&&Array.from(this.observers[e].entries()).forEach(([e,t])=>{for(let i=0;i<t;i++)e(...n)}),this.observers["*"]&&Array.from(this.observers["*"].entries()).forEach(([t,i])=>{for(let r=0;r<i;r++)t.apply(t,[e,...n])})}}class rX extends rZ{constructor(e,n={ns:["translation"],defaultNS:"translation"}){super(),this.data=e||{},this.options=n,void 0===this.options.keySeparator&&(this.options.keySeparator="."),void 0===this.options.ignoreJSONStructure&&(this.options.ignoreJSONStructure=!0)}addNamespaces(e){0>this.options.ns.indexOf(e)&&this.options.ns.push(e)}removeNamespaces(e){let n=this.options.ns.indexOf(e);n>-1&&this.options.ns.splice(n,1)}getResource(e,n,t,i={}){let r,a=void 0!==i.keySeparator?i.keySeparator:this.options.keySeparator,o=void 0!==i.ignoreJSONStructure?i.ignoreJSONStructure:this.options.ignoreJSONStructure;e.indexOf(".")>-1?r=e.split("."):(r=[e,n],t&&(Array.isArray(t)?r.push(...t):rO(t)&&a?r.push(...t.split(a)):r.push(t)));let s=rF(this.data,r);return(!s&&!n&&!t&&e.indexOf(".")>-1&&(e=r[0],n=r[1],t=r.slice(2).join(".")),!s&&o&&rO(t))?rH(this.data?.[e]?.[n],t,a):s}addResource(e,n,t,i,r={silent:!1}){let a=void 0!==r.keySeparator?r.keySeparator:this.options.keySeparator,o=[e,n];t&&(o=o.concat(a?t.split(a):t)),e.indexOf(".")>-1&&(o=e.split("."),i=n,n=o[1]),this.addNamespaces(n),rR(this.data,o,i),r.silent||this.emit("added",e,n,t,i)}addResources(e,n,t,i={silent:!1}){for(let i in t)(rO(t[i])||Array.isArray(t[i]))&&this.addResource(e,n,i,t[i],{silent:!0});i.silent||this.emit("added",e,n,t)}addResourceBundle(e,n,t,i,r,a={silent:!1,skipCopy:!1}){let o=[e,n];e.indexOf(".")>-1&&(o=e.split("."),i=t,t=n,n=o[1]),this.addNamespaces(n);let s=rF(this.data,o)||{};a.skipCopy||(t=JSON.parse(JSON.stringify(t))),i?rL(s,t,r):s={...s,...t},rR(this.data,o,s),a.silent||this.emit("added",e,n,t)}removeResourceBundle(e,n){this.hasResourceBundle(e,n)&&delete this.data[e][n],this.removeNamespaces(n),this.emit("removed",e,n)}hasResourceBundle(e,n){return void 0!==this.getResource(e,n)}getResourceBundle(e,n){return n||(n=this.options.defaultNS),this.getResource(e,n)}getDataByLanguage(e){return this.data[e]}hasLanguageSomeTranslations(e){let n=this.getDataByLanguage(e);return!!(n&&Object.keys(n)||[]).find(e=>n[e]&&Object.keys(n[e]).length>0)}toJSON(){return this.data}}var rQ={processors:{},addPostProcessor(e){this.processors[e.name]=e},handle(e,n,t,i,r){return e.forEach(e=>{n=this.processors[e]?.process(n,t,i,r)??n}),n}};let r0=Symbol("i18next/PATH_KEY");function r1(e,n){let t,i,r,{[r0]:a}=e((i=[],(r=Object.create(null)).get=(e,n)=>(t?.revoke?.(),n===r0)?i:(i.push(n),(t=Proxy.revocable(e,r)).proxy),Proxy.revocable(Object.create(null),r).proxy));return a.join(n?.keySeparator??".")}let r2={},r3=e=>!rO(e)&&"boolean"!=typeof e&&"number"!=typeof e;class r5 extends rZ{constructor(e,n={}){super(),((e,n,t)=>{e.forEach(e=>{n[e]&&(t[e]=n[e])})})(["resourceStore","languageUtils","pluralResolver","interpolator","backendConnector","i18nFormat","utils"],e,this),this.options=n,void 0===this.options.keySeparator&&(this.options.keySeparator="."),this.logger=rJ.create("translator")}changeLanguage(e){e&&(this.language=e)}exists(e,n={interpolation:{}}){let t={...n};if(null==e)return!1;let i=this.resolve(e,t);if(i?.res===void 0)return!1;let r=r3(i.res);return!1!==t.returnObjects||!r}extractFromKey(e,n){let t=void 0!==n.nsSeparator?n.nsSeparator:this.options.nsSeparator;void 0===t&&(t=":");let i=void 0!==n.keySeparator?n.keySeparator:this.options.keySeparator,r=n.ns||this.options.defaultNS||[],a=t&&e.indexOf(t)>-1,o=!this.options.userDefinedKeySeparator&&!n.keySeparator&&!this.options.userDefinedNsSeparator&&!n.nsSeparator&&!((e,n,t)=>{n=n||"",t=t||"";let i=rG.filter(e=>0>n.indexOf(e)&&0>t.indexOf(e));if(0===i.length)return!0;let r=rU.getRegExp(`(${i.map(e=>"?"===e?"\\?":e).join("|")})`),a=!r.test(e);if(!a){let n=e.indexOf(t);n>0&&!r.test(e.substring(0,n))&&(a=!0)}return a})(e,t,i);if(a&&!o){let n=e.match(this.interpolator.nestingRegexp);if(n&&n.length>0)return{key:e,namespaces:rO(r)?[r]:r};let a=e.split(t);(t!==i||t===i&&this.options.ns.indexOf(a[0])>-1)&&(r=a.shift()),e=a.join(i)}return{key:e,namespaces:rO(r)?[r]:r}}translate(e,n,t){let i="object"==typeof n?{...n}:n;if("object"!=typeof i&&this.options.overloadTranslationOptionHandler&&(i=this.options.overloadTranslationOptionHandler(arguments)),"object"==typeof i&&(i={...i}),i||(i={}),null==e)return"";"function"==typeof e&&(e=r1(e,{...this.options,...i})),Array.isArray(e)||(e=[String(e)]);let r=void 0!==i.returnDetails?i.returnDetails:this.options.returnDetails,a=void 0!==i.keySeparator?i.keySeparator:this.options.keySeparator,{key:o,namespaces:s}=this.extractFromKey(e[e.length-1],i),l=s[s.length-1],c=void 0!==i.nsSeparator?i.nsSeparator:this.options.nsSeparator;void 0===c&&(c=":");let u=i.lng||this.language,p=i.appendNamespaceToCIMode||this.options.appendNamespaceToCIMode;if(u?.toLowerCase()==="cimode")return p?r?{res:`${l}${c}${o}`,usedKey:o,exactUsedKey:o,usedLng:u,usedNS:l,usedParams:this.getUsedParamsDetails(i)}:`${l}${c}${o}`:r?{res:o,usedKey:o,exactUsedKey:o,usedLng:u,usedNS:l,usedParams:this.getUsedParamsDetails(i)}:o;let d=this.resolve(e,i),f=d?.res,h=d?.usedKey||o,g=d?.exactUsedKey||o,m=void 0!==i.joinArrays?i.joinArrays:this.options.joinArrays,b=!this.i18nFormat||this.i18nFormat.handleAsObject,y=void 0!==i.count&&!rO(i.count),v=r5.hasDefaultValue(i),$=y?this.pluralResolver.getSuffix(u,i.count,i):"",A=i.ordinal&&y?this.pluralResolver.getSuffix(u,i.count,{ordinal:!1}):"",w=y&&!i.ordinal&&0===i.count,k=w&&i[`defaultValue${this.options.pluralSeparator}zero`]||i[`defaultValue${$}`]||i[`defaultValue${A}`]||i.defaultValue,x=f;b&&!f&&v&&(x=k);let C=r3(x),E=Object.prototype.toString.apply(x);if(b&&x&&C&&0>["[object Number]","[object Function]","[object RegExp]"].indexOf(E)&&!(rO(m)&&Array.isArray(x))){if(!i.returnObjects&&!this.options.returnObjects){this.options.returnedObjectHandler||this.logger.warn("accessing an object - but returnObjects options is not enabled!");let e=this.options.returnedObjectHandler?this.options.returnedObjectHandler(h,x,{...i,ns:s}):`key '${o} (${this.language})' returned an object instead of string.`;return r?(d.res=e,d.usedParams=this.getUsedParamsDetails(i),d):e}if(a){let e=Array.isArray(x),n=e?[]:{},t=e?g:h;for(let e in x)if(Object.prototype.hasOwnProperty.call(x,e)){let r=`${t}${a}${e}`;v&&!f?n[e]=this.translate(r,{...i,defaultValue:r3(k)?k[e]:void 0,...{joinArrays:!1,ns:s}}):n[e]=this.translate(r,{...i,joinArrays:!1,ns:s}),n[e]===r&&(n[e]=x[e])}f=n}}else if(b&&rO(m)&&Array.isArray(f))(f=f.join(m))&&(f=this.extendTranslation(f,e,i,t));else{let n=!1,r=!1;!this.isValidLookup(f)&&v&&(n=!0,f=k),this.isValidLookup(f)||(r=!0,f=o);let s=(i.missingKeyNoValueFallbackToKey||this.options.missingKeyNoValueFallbackToKey)&&r?void 0:f,p=v&&k!==f&&this.options.updateMissing;if(r||n||p){if(this.logger.log(p?"updateKey":"missingKey",u,l,o,p?k:f),a){let e=this.resolve(o,{...i,keySeparator:!1});e&&e.res&&this.logger.warn("Seems the loaded translations were in flat JSON format instead of nested. Either set keySeparator: false on init or make sure your translations are published in nested format.")}let e=[],n=this.languageUtils.getFallbackCodes(this.options.fallbackLng,i.lng||this.language);if("fallback"===this.options.saveMissingTo&&n&&n[0])for(let t=0;t<n.length;t++)e.push(n[t]);else"all"===this.options.saveMissingTo?e=this.languageUtils.toResolveHierarchy(i.lng||this.language):e.push(i.lng||this.language);let t=(e,n,t)=>{let r=v&&t!==f?t:s;this.options.missingKeyHandler?this.options.missingKeyHandler(e,l,n,r,p,i):this.backendConnector?.saveMissing&&this.backendConnector.saveMissing(e,l,n,r,p,i),this.emit("missingKey",e,l,n,f)};this.options.saveMissing&&(this.options.saveMissingPlurals&&y?e.forEach(e=>{let n=this.pluralResolver.getSuffixes(e,i);w&&i[`defaultValue${this.options.pluralSeparator}zero`]&&0>n.indexOf(`${this.options.pluralSeparator}zero`)&&n.push(`${this.options.pluralSeparator}zero`),n.forEach(n=>{t([e],o+n,i[`defaultValue${n}`]||k)})}):t(e,o,k))}f=this.extendTranslation(f,e,i,d,t),r&&f===o&&this.options.appendNamespaceToMissingKey&&(f=`${l}${c}${o}`),(r||n)&&this.options.parseMissingKeyHandler&&(f=this.options.parseMissingKeyHandler(this.options.appendNamespaceToMissingKey?`${l}${c}${o}`:o,n?f:void 0,i))}return r?(d.res=f,d.usedParams=this.getUsedParamsDetails(i),d):f}extendTranslation(e,n,t,i,r){if(this.i18nFormat?.parse)e=this.i18nFormat.parse(e,{...this.options.interpolation.defaultVariables,...t},t.lng||this.language||i.usedLng,i.usedNS,i.usedKey,{resolved:i});else if(!t.skipInterpolation){let a;t.interpolation&&this.interpolator.init({...t,...{interpolation:{...this.options.interpolation,...t.interpolation}}});let o=rO(e)&&(t?.interpolation?.skipOnVariables!==void 0?t.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables);if(o){let n=e.match(this.interpolator.nestingRegexp);a=n&&n.length}let s=t.replace&&!rO(t.replace)?t.replace:t;if(this.options.interpolation.defaultVariables&&(s={...this.options.interpolation.defaultVariables,...s}),e=this.interpolator.interpolate(e,s,t.lng||this.language||i.usedLng,t),o){let n=e.match(this.interpolator.nestingRegexp);a<(n&&n.length)&&(t.nest=!1)}!t.lng&&i&&i.res&&(t.lng=this.language||i.usedLng),!1!==t.nest&&(e=this.interpolator.nest(e,(...e)=>r?.[0]!==e[0]||t.context?this.translate(...e,n):(this.logger.warn(`It seems you are nesting recursively key: ${e[0]} in key: ${n[0]}`),null),t)),t.interpolation&&this.interpolator.reset()}let a=t.postProcess||this.options.postProcess,o=rO(a)?[a]:a;return null!=e&&o?.length&&!1!==t.applyPostProcessor&&(e=rQ.handle(o,e,n,this.options&&this.options.postProcessPassResolved?{i18nResolved:{...i,usedParams:this.getUsedParamsDetails(t)},...t}:t,this)),e}resolve(e,n={}){let t,i,r,a,o;return rO(e)&&(e=[e]),e.forEach(e=>{if(this.isValidLookup(t))return;let s=this.extractFromKey(e,n),l=s.key;i=l;let c=s.namespaces;this.options.fallbackNS&&(c=c.concat(this.options.fallbackNS));let u=void 0!==n.count&&!rO(n.count),p=u&&!n.ordinal&&0===n.count,d=void 0!==n.context&&(rO(n.context)||"number"==typeof n.context)&&""!==n.context,f=n.lngs?n.lngs:this.languageUtils.toResolveHierarchy(n.lng||this.language,n.fallbackLng);c.forEach(e=>{this.isValidLookup(t)||(o=e,!r2[`${f[0]}-${e}`]&&this.utils?.hasLoadedNamespace&&!this.utils?.hasLoadedNamespace(o)&&(r2[`${f[0]}-${e}`]=!0,this.logger.warn(`key "${i}" for languages "${f.join(", ")}" won't get resolved as namespace "${o}" was not yet loaded`,"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!")),f.forEach(i=>{let o;if(this.isValidLookup(t))return;a=i;let s=[l];if(this.i18nFormat?.addLookupKeys)this.i18nFormat.addLookupKeys(s,l,i,e,n);else{let e;u&&(e=this.pluralResolver.getSuffix(i,n.count,n));let t=`${this.options.pluralSeparator}zero`,r=`${this.options.pluralSeparator}ordinal${this.options.pluralSeparator}`;if(u&&(n.ordinal&&0===e.indexOf(r)&&s.push(l+e.replace(r,this.options.pluralSeparator)),s.push(l+e),p&&s.push(l+t)),d){let i=`${l}${this.options.contextSeparator||"_"}${n.context}`;s.push(i),u&&(n.ordinal&&0===e.indexOf(r)&&s.push(i+e.replace(r,this.options.pluralSeparator)),s.push(i+e),p&&s.push(i+t))}}for(;o=s.pop();)this.isValidLookup(t)||(r=o,t=this.getResource(i,e,o,n))}))})}),{res:t,usedKey:i,exactUsedKey:r,usedLng:a,usedNS:o}}isValidLookup(e){return void 0!==e&&!(!this.options.returnNull&&null===e)&&!(!this.options.returnEmptyString&&""===e)}getResource(e,n,t,i={}){return this.i18nFormat?.getResource?this.i18nFormat.getResource(e,n,t,i):this.resourceStore.getResource(e,n,t,i)}getUsedParamsDetails(e={}){let n=e.replace&&!rO(e.replace),t=n?e.replace:e;if(n&&void 0!==e.count&&(t.count=e.count),this.options.interpolation.defaultVariables&&(t={...this.options.interpolation.defaultVariables,...t}),!n)for(let e of(t={...t},["defaultValue","ordinal","context","replace","lng","lngs","fallbackLng","ns","keySeparator","nsSeparator","returnObjects","returnDetails","joinArrays","postProcess","interpolation"]))delete t[e];return t}static hasDefaultValue(e){let n="defaultValue";for(let t in e)if(Object.prototype.hasOwnProperty.call(e,t)&&n===t.substring(0,n.length)&&void 0!==e[t])return!0;return!1}}class r4{constructor(e){this.options=e,this.supportedLngs=this.options.supportedLngs||!1,this.logger=rJ.create("languageUtils")}getScriptPartFromCode(e){if(!(e=rq(e))||0>e.indexOf("-"))return null;let n=e.split("-");return 2===n.length||(n.pop(),"x"===n[n.length-1].toLowerCase())?null:this.formatLanguageCode(n.join("-"))}getLanguagePartFromCode(e){if(!(e=rq(e))||0>e.indexOf("-"))return e;let n=e.split("-");return this.formatLanguageCode(n[0])}formatLanguageCode(e){if(rO(e)&&e.indexOf("-")>-1){let n;try{n=Intl.getCanonicalLocales(e)[0]}catch(e){}return(n&&this.options.lowerCaseLng&&(n=n.toLowerCase()),n)?n:this.options.lowerCaseLng?e.toLowerCase():e}return this.options.cleanCode||this.options.lowerCaseLng?e.toLowerCase():e}isSupportedCode(e){return("languageOnly"===this.options.load||this.options.nonExplicitSupportedLngs)&&(e=this.getLanguagePartFromCode(e)),!this.supportedLngs||!this.supportedLngs.length||this.supportedLngs.indexOf(e)>-1}getBestMatchFromCodes(e){let n;return e?(e.forEach(e=>{if(n)return;let t=this.formatLanguageCode(e);(!this.options.supportedLngs||this.isSupportedCode(t))&&(n=t)}),!n&&this.options.supportedLngs&&e.forEach(e=>{if(n)return;let t=this.getScriptPartFromCode(e);if(this.isSupportedCode(t))return n=t;let i=this.getLanguagePartFromCode(e);if(this.isSupportedCode(i))return n=i;n=this.options.supportedLngs.find(e=>{if(e===i||!(0>e.indexOf("-")&&0>i.indexOf("-"))&&(e.indexOf("-")>0&&0>i.indexOf("-")&&e.substring(0,e.indexOf("-"))===i||0===e.indexOf(i)&&i.length>1))return e})}),n||(n=this.getFallbackCodes(this.options.fallbackLng)[0]),n):null}getFallbackCodes(e,n){if(!e)return[];if("function"==typeof e&&(e=e(n)),rO(e)&&(e=[e]),Array.isArray(e))return e;if(!n)return e.default||[];let t=e[n];return t||(t=e[this.getScriptPartFromCode(n)]),t||(t=e[this.formatLanguageCode(n)]),t||(t=e[this.getLanguagePartFromCode(n)]),t||(t=e.default),t||[]}toResolveHierarchy(e,n){let t=this.getFallbackCodes((!1===n?[]:n)||this.options.fallbackLng||[],e),i=[],r=e=>{e&&(this.isSupportedCode(e)?i.push(e):this.logger.warn(`rejecting language code not found in supportedLngs: ${e}`))};return rO(e)&&(e.indexOf("-")>-1||e.indexOf("_")>-1)?("languageOnly"!==this.options.load&&r(this.formatLanguageCode(e)),"languageOnly"!==this.options.load&&"currentOnly"!==this.options.load&&r(this.getScriptPartFromCode(e)),"currentOnly"!==this.options.load&&r(this.getLanguagePartFromCode(e))):rO(e)&&r(this.formatLanguageCode(e)),t.forEach(e=>{0>i.indexOf(e)&&r(this.formatLanguageCode(e))}),i}}let r6={zero:0,one:1,two:2,few:3,many:4,other:5},r8={select:e=>1===e?"one":"other",resolvedOptions:()=>({pluralCategories:["one","other"]})};class r7{constructor(e,n={}){this.languageUtils=e,this.options=n,this.logger=rJ.create("pluralResolver"),this.pluralRulesCache={}}addRule(e,n){this.rules[e]=n}clearCache(){this.pluralRulesCache={}}getRule(e,n={}){let t,i=rq("dev"===e?"en":e),r=n.ordinal?"ordinal":"cardinal",a=JSON.stringify({cleanedCode:i,type:r});if(a in this.pluralRulesCache)return this.pluralRulesCache[a];try{t=new Intl.PluralRules(i,{type:r})}catch(r){if(!Intl)return this.logger.error("No Intl support, please use an Intl polyfill!"),r8;if(!e.match(/-|_/))return r8;let i=this.languageUtils.getLanguagePartFromCode(e);t=this.getRule(i,n)}return this.pluralRulesCache[a]=t,t}needsPlural(e,n={}){let t=this.getRule(e,n);return t||(t=this.getRule("dev",n)),t?.resolvedOptions().pluralCategories.length>1}getPluralFormsOfKey(e,n,t={}){return this.getSuffixes(e,t).map(e=>`${n}${e}`)}getSuffixes(e,n={}){let t=this.getRule(e,n);return(t||(t=this.getRule("dev",n)),t)?t.resolvedOptions().pluralCategories.sort((e,n)=>r6[e]-r6[n]).map(e=>`${this.options.prepend}${n.ordinal?`ordinal${this.options.prepend}`:""}${e}`):[]}getSuffix(e,n,t={}){let i=this.getRule(e,t);return i?`${this.options.prepend}${t.ordinal?`ordinal${this.options.prepend}`:""}${i.select(n)}`:(this.logger.warn(`no plural rule found for: ${e}`),this.getSuffix("dev",n,t))}}let r9=(e,n,t,i=".",r=!0)=>{let a,o=void 0!==(a=rF(e,t))?a:rF(n,t);return!o&&r&&rO(t)&&void 0===(o=rH(e,t,i))&&(o=rH(n,t,i)),o};class ae{constructor(e={}){this.logger=rJ.create("interpolator"),this.options=e,this.format=e?.interpolation?.format||(e=>e),this.init(e)}init(e={}){e.interpolation||(e.interpolation={escapeValue:!0});let{escape:n,escapeValue:t,useRawValueToEscape:i,prefix:r,prefixEscaped:a,suffix:o,suffixEscaped:s,formatSeparator:l,unescapeSuffix:c,unescapePrefix:u,nestingPrefix:p,nestingPrefixEscaped:d,nestingSuffix:f,nestingSuffixEscaped:h,nestingOptionsSeparator:g,maxReplaces:m,alwaysFormat:b}=e.interpolation;this.escape=void 0!==n?n:rV,this.escapeValue=void 0===t||t,this.useRawValueToEscape=void 0!==i&&i,this.prefix=r?r.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&"):a||"{{",this.suffix=o?o.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&"):s||"}}",this.formatSeparator=l||",",this.unescapePrefix=c?"":u||"-",this.unescapeSuffix=this.unescapePrefix?"":c||"",this.nestingPrefix=p?p.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&"):d||"$t(".replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&"),this.nestingSuffix=f?f.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&"):h||")".replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&"),this.nestingOptionsSeparator=g||",",this.maxReplaces=m||1e3,this.alwaysFormat=void 0!==b&&b,this.resetRegExp()}reset(){this.options&&this.init(this.options)}resetRegExp(){let e=(e,n)=>e?.source===n?(e.lastIndex=0,e):RegExp(n,"g");this.regexp=e(this.regexp,`${this.prefix}(.+?)${this.suffix}`),this.regexpUnescape=e(this.regexpUnescape,`${this.prefix}${this.unescapePrefix}(.+?)${this.unescapeSuffix}${this.suffix}`),this.nestingRegexp=e(this.nestingRegexp,`${this.nestingPrefix}((?:[^()"']+|"[^"]*"|'[^']*'|\\((?:[^()]|"[^"]*"|'[^']*')*\\))*?)${this.nestingSuffix}`)}interpolate(e,n,t,i){let r,a,o,s=this.options&&this.options.interpolation&&this.options.interpolation.defaultVariables||{},l=e=>{if(0>e.indexOf(this.formatSeparator)){let r=r9(n,s,e,this.options.keySeparator,this.options.ignoreJSONStructure);return this.alwaysFormat?this.format(r,void 0,t,{...i,...n,interpolationkey:e}):r}let r=e.split(this.formatSeparator),a=r.shift().trim(),o=r.join(this.formatSeparator).trim();return this.format(r9(n,s,a,this.options.keySeparator,this.options.ignoreJSONStructure),o,t,{...i,...n,interpolationkey:a})};this.resetRegExp();let c=i?.missingInterpolationHandler||this.options.missingInterpolationHandler,u=i?.interpolation?.skipOnVariables!==void 0?i.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables;return[{regex:this.regexpUnescape,safeValue:e=>e.replace(/\$/g,"$$$$")},{regex:this.regexp,safeValue:e=>this.escapeValue?this.escape(e).replace(/\$/g,"$$$$"):e.replace(/\$/g,"$$$$")}].forEach(n=>{for(o=0;r=n.regex.exec(e);){let t=r[1].trim();if(void 0===(a=l(t)))if("function"==typeof c){let n=c(e,r,i);a=rO(n)?n:""}else if(i&&Object.prototype.hasOwnProperty.call(i,t))a="";else if(u){a=r[0];continue}else this.logger.warn(`missed to pass in variable ${t} for interpolating ${e}`),a="";else rO(a)||this.useRawValueToEscape||(a=rT(a));let s=n.safeValue(a);if(e=e.replace(r[0],s),u?(n.regex.lastIndex+=a.length,n.regex.lastIndex-=r[0].length):n.regex.lastIndex=0,++o>=this.maxReplaces)break}}),e}nest(e,n,t={}){let i,r,a,o=(e,n)=>{let t=this.nestingOptionsSeparator;if(0>e.indexOf(t))return e;let i=e.split(RegExp(`${t}[ ]*{`)),r=`{${i[1]}`;e=i[0];let o=(r=this.interpolate(r,a)).match(/'/g),s=r.match(/"/g);((o?.length??0)%2!=0||s)&&s.length%2==0||(r=r.replace(/'/g,'"'));try{a=JSON.parse(r),n&&(a={...n,...a})}catch(n){return this.logger.warn(`failed parsing options string in nesting for key ${e}`,n),`${e}${t}${r}`}return a.defaultValue&&a.defaultValue.indexOf(this.prefix)>-1&&delete a.defaultValue,e};for(;i=this.nestingRegexp.exec(e);){let s=[];(a=(a={...t}).replace&&!rO(a.replace)?a.replace:a).applyPostProcessor=!1,delete a.defaultValue;let l=/{.*}/.test(i[1])?i[1].lastIndexOf("}")+1:i[1].indexOf(this.formatSeparator);if(-1!==l&&(s=i[1].slice(l).split(this.formatSeparator).map(e=>e.trim()).filter(Boolean),i[1]=i[1].slice(0,l)),(r=n(o.call(this,i[1].trim(),a),a))&&i[0]===e&&!rO(r))return r;rO(r)||(r=rT(r)),r||(this.logger.warn(`missed to resolve ${i[1]} for nesting ${e}`),r=""),s.length&&(r=s.reduce((e,n)=>this.format(e,n,t.lng,{...t,interpolationkey:i[1].trim()}),r.trim())),e=e.replace(i[0],r),this.regexp.lastIndex=0}return e}}let an=e=>{let n={};return(t,i,r)=>{let a=r;r&&r.interpolationkey&&r.formatParams&&r.formatParams[r.interpolationkey]&&r[r.interpolationkey]&&(a={...a,[r.interpolationkey]:void 0});let o=i+JSON.stringify(a),s=n[o];return s||(s=e(rq(i),r),n[o]=s),s(t)}},at=e=>(n,t,i)=>e(rq(t),i)(n);class ai{constructor(e={}){this.logger=rJ.create("formatter"),this.options=e,this.init(e)}init(e,n={interpolation:{}}){this.formatSeparator=n.interpolation.formatSeparator||",";let t=n.cacheInBuiltFormats?an:at;this.formats={number:t((e,n)=>{let t=new Intl.NumberFormat(e,{...n});return e=>t.format(e)}),currency:t((e,n)=>{let t=new Intl.NumberFormat(e,{...n,style:"currency"});return e=>t.format(e)}),datetime:t((e,n)=>{let t=new Intl.DateTimeFormat(e,{...n});return e=>t.format(e)}),relativetime:t((e,n)=>{let t=new Intl.RelativeTimeFormat(e,{...n});return e=>t.format(e,n.range||"day")}),list:t((e,n)=>{let t=new Intl.ListFormat(e,{...n});return e=>t.format(e)})}}add(e,n){this.formats[e.toLowerCase().trim()]=n}addCached(e,n){this.formats[e.toLowerCase().trim()]=an(n)}format(e,n,t,i={}){let r=n.split(this.formatSeparator);if(r.length>1&&r[0].indexOf("(")>1&&0>r[0].indexOf(")")&&r.find(e=>e.indexOf(")")>-1)){let e=r.findIndex(e=>e.indexOf(")")>-1);r[0]=[r[0],...r.splice(1,e)].join(this.formatSeparator)}return r.reduce((e,n)=>{let{formatName:r,formatOptions:a}=(e=>{let n=e.toLowerCase().trim(),t={};if(e.indexOf("(")>-1){let i=e.split("(");n=i[0].toLowerCase().trim();let r=i[1].substring(0,i[1].length-1);"currency"===n&&0>r.indexOf(":")?t.currency||(t.currency=r.trim()):"relativetime"===n&&0>r.indexOf(":")?t.range||(t.range=r.trim()):r.split(";").forEach(e=>{if(e){let[n,...i]=e.split(":"),r=i.join(":").trim().replace(/^'+|'+$/g,""),a=n.trim();t[a]||(t[a]=r),"false"===r&&(t[a]=!1),"true"===r&&(t[a]=!0),isNaN(r)||(t[a]=parseInt(r,10))}})}return{formatName:n,formatOptions:t}})(n);if(this.formats[r]){let n=e;try{let o=i?.formatParams?.[i.interpolationkey]||{},s=o.locale||o.lng||i.locale||i.lng||t;n=this.formats[r](e,s,{...a,...i,...o})}catch(e){this.logger.warn(e)}return n}return this.logger.warn(`there was no format function for ${r}`),e},e)}}class ar extends rZ{constructor(e,n,t,i={}){super(),this.backend=e,this.store=n,this.services=t,this.languageUtils=t.languageUtils,this.options=i,this.logger=rJ.create("backendConnector"),this.waitingReads=[],this.maxParallelReads=i.maxParallelReads||10,this.readingCalls=0,this.maxRetries=i.maxRetries>=0?i.maxRetries:5,this.retryTimeout=i.retryTimeout>=1?i.retryTimeout:350,this.state={},this.queue=[],this.backend?.init?.(t,i.backend,i)}queueLoad(e,n,t,i){let r={},a={},o={},s={};return e.forEach(e=>{let i=!0;n.forEach(n=>{let o=`${e}|${n}`;!t.reload&&this.store.hasResourceBundle(e,n)?this.state[o]=2:this.state[o]<0||(1===this.state[o]?void 0===a[o]&&(a[o]=!0):(this.state[o]=1,i=!1,void 0===a[o]&&(a[o]=!0),void 0===r[o]&&(r[o]=!0),void 0===s[n]&&(s[n]=!0)))}),i||(o[e]=!0)}),(Object.keys(r).length||Object.keys(a).length)&&this.queue.push({pending:a,pendingCount:Object.keys(a).length,loaded:{},errors:[],callback:i}),{toLoad:Object.keys(r),pending:Object.keys(a),toLoadLanguages:Object.keys(o),toLoadNamespaces:Object.keys(s)}}loaded(e,n,t){let i=e.split("|"),r=i[0],a=i[1];n&&this.emit("failedLoading",r,a,n),!n&&t&&this.store.addResourceBundle(r,a,t,void 0,void 0,{skipCopy:!0}),this.state[e]=n?-1:2,n&&t&&(this.state[e]=0);let o={};this.queue.forEach(t=>{((e,n,t,i)=>{let{obj:r,k:a}=rj(e,n,Object);r[a]=r[a]||[],r[a].push(t)})(t.loaded,[r],a),void 0!==t.pending[e]&&(delete t.pending[e],t.pendingCount--),n&&t.errors.push(n),0!==t.pendingCount||t.done||(Object.keys(t.loaded).forEach(e=>{o[e]||(o[e]={});let n=t.loaded[e];n.length&&n.forEach(n=>{void 0===o[e][n]&&(o[e][n]=!0)})}),t.done=!0,t.errors.length?t.callback(t.errors):t.callback())}),this.emit("loaded",o),this.queue=this.queue.filter(e=>!e.done)}read(e,n,t,i=0,r=this.retryTimeout,a){if(!e.length)return a(null,{});if(this.readingCalls>=this.maxParallelReads)return void this.waitingReads.push({lng:e,ns:n,fcName:t,tried:i,wait:r,callback:a});this.readingCalls++;let o=(o,s)=>{if(this.readingCalls--,this.waitingReads.length>0){let e=this.waitingReads.shift();this.read(e.lng,e.ns,e.fcName,e.tried,e.wait,e.callback)}o&&s&&i<this.maxRetries?setTimeout(()=>{this.read.call(this,e,n,t,i+1,2*r,a)},r):a(o,s)},s=this.backend[t].bind(this.backend);if(2===s.length){try{let t=s(e,n);t&&"function"==typeof t.then?t.then(e=>o(null,e)).catch(o):o(null,t)}catch(e){o(e)}return}return s(e,n,o)}prepareLoading(e,n,t={},i){if(!this.backend)return this.logger.warn("No backend was added via i18next.use. Will not load resources."),i&&i();rO(e)&&(e=this.languageUtils.toResolveHierarchy(e)),rO(n)&&(n=[n]);let r=this.queueLoad(e,n,t,i);if(!r.toLoad.length)return r.pending.length||i(),null;r.toLoad.forEach(e=>{this.loadOne(e)})}load(e,n,t){this.prepareLoading(e,n,{},t)}reload(e,n,t){this.prepareLoading(e,n,{reload:!0},t)}loadOne(e,n=""){let t=e.split("|"),i=t[0],r=t[1];this.read(i,r,"read",void 0,void 0,(t,a)=>{t&&this.logger.warn(`${n}loading namespace ${r} for language ${i} failed`,t),!t&&a&&this.logger.log(`${n}loaded namespace ${r} for language ${i}`,a),this.loaded(e,t,a)})}saveMissing(e,n,t,i,r,a={},o=()=>{}){if(this.services?.utils?.hasLoadedNamespace&&!this.services?.utils?.hasLoadedNamespace(n))return void this.logger.warn(`did not save key "${t}" as the namespace "${n}" was not yet loaded`,"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!");if(null!=t&&""!==t){if(this.backend?.create){let s={...a,isUpdate:r},l=this.backend.create.bind(this.backend);if(l.length<6)try{let r;(r=5===l.length?l(e,n,t,i,s):l(e,n,t,i))&&"function"==typeof r.then?r.then(e=>o(null,e)).catch(o):o(null,r)}catch(e){o(e)}else l(e,n,t,i,o,s)}e&&e[0]&&this.store.addResource(e[0],n,t,i)}}}let aa=()=>({debug:!1,initAsync:!0,ns:["translation"],defaultNS:["translation"],fallbackLng:["dev"],fallbackNS:!1,supportedLngs:!1,nonExplicitSupportedLngs:!1,load:"all",preload:!1,simplifyPluralSuffix:!0,keySeparator:".",nsSeparator:":",pluralSeparator:"_",contextSeparator:"_",partialBundledLanguages:!1,saveMissing:!1,updateMissing:!1,saveMissingTo:"fallback",saveMissingPlurals:!0,missingKeyHandler:!1,missingInterpolationHandler:!1,postProcess:!1,postProcessPassResolved:!1,returnNull:!1,returnEmptyString:!0,returnObjects:!1,joinArrays:!1,returnedObjectHandler:!1,parseMissingKeyHandler:!1,appendNamespaceToMissingKey:!1,appendNamespaceToCIMode:!1,overloadTranslationOptionHandler:e=>{let n={};if("object"==typeof e[1]&&(n=e[1]),rO(e[1])&&(n.defaultValue=e[1]),rO(e[2])&&(n.tDescription=e[2]),"object"==typeof e[2]||"object"==typeof e[3]){let t=e[3]||e[2];Object.keys(t).forEach(e=>{n[e]=t[e]})}return n},interpolation:{escapeValue:!0,format:e=>e,prefix:"{{",suffix:"}}",formatSeparator:",",unescapePrefix:"-",nestingPrefix:"$t(",nestingSuffix:")",nestingOptionsSeparator:",",maxReplaces:1e3,skipOnVariables:!0},cacheInBuiltFormats:!0}),ao=e=>(rO(e.ns)&&(e.ns=[e.ns]),rO(e.fallbackLng)&&(e.fallbackLng=[e.fallbackLng]),rO(e.fallbackNS)&&(e.fallbackNS=[e.fallbackNS]),e.supportedLngs?.indexOf?.("cimode")<0&&(e.supportedLngs=e.supportedLngs.concat(["cimode"])),"boolean"==typeof e.initImmediate&&(e.initAsync=e.initImmediate),e),as=()=>{};class al extends rZ{constructor(e={},n){if(super(),this.options=ao(e),this.services={},this.logger=rJ,this.modules={external:[]},(e=>{Object.getOwnPropertyNames(Object.getPrototypeOf(e)).forEach(n=>{"function"==typeof e[n]&&(e[n]=e[n].bind(e))})})(this),n&&!this.isInitialized&&!e.isClone){if(!this.options.initAsync)return this.init(e,n),this;setTimeout(()=>{this.init(e,n)},0)}}init(e={},n){this.isInitializing=!0,"function"==typeof e&&(n=e,e={}),null==e.defaultNS&&e.ns&&(rO(e.ns)?e.defaultNS=e.ns:0>e.ns.indexOf("translation")&&(e.defaultNS=e.ns[0]));let t=aa();this.options={...t,...this.options,...ao(e)},this.options.interpolation={...t.interpolation,...this.options.interpolation},void 0!==e.keySeparator&&(this.options.userDefinedKeySeparator=e.keySeparator),void 0!==e.nsSeparator&&(this.options.userDefinedNsSeparator=e.nsSeparator);let i=e=>e?"function"==typeof e?new e:e:null;if(!this.options.isClone){let e;this.modules.logger?rJ.init(i(this.modules.logger),this.options):rJ.init(null,this.options),e=this.modules.formatter?this.modules.formatter:ai;let n=new r4(this.options);this.store=new rX(this.options.resources,this.options);let r=this.services;r.logger=rJ,r.resourceStore=this.store,r.languageUtils=n,r.pluralResolver=new r7(n,{prepend:this.options.pluralSeparator,simplifyPluralSuffix:this.options.simplifyPluralSuffix}),this.options.interpolation.format&&this.options.interpolation.format!==t.interpolation.format&&this.logger.deprecate("init: you are still using the legacy format function, please use the new approach: https://www.i18next.com/translation-function/formatting"),e&&(!this.options.interpolation.format||this.options.interpolation.format===t.interpolation.format)&&(r.formatter=i(e),r.formatter.init&&r.formatter.init(r,this.options),this.options.interpolation.format=r.formatter.format.bind(r.formatter)),r.interpolator=new ae(this.options),r.utils={hasLoadedNamespace:this.hasLoadedNamespace.bind(this)},r.backendConnector=new ar(i(this.modules.backend),r.resourceStore,r,this.options),r.backendConnector.on("*",(e,...n)=>{this.emit(e,...n)}),this.modules.languageDetector&&(r.languageDetector=i(this.modules.languageDetector),r.languageDetector.init&&r.languageDetector.init(r,this.options.detection,this.options)),this.modules.i18nFormat&&(r.i18nFormat=i(this.modules.i18nFormat),r.i18nFormat.init&&r.i18nFormat.init(this)),this.translator=new r5(this.services,this.options),this.translator.on("*",(e,...n)=>{this.emit(e,...n)}),this.modules.external.forEach(e=>{e.init&&e.init(this)})}if(this.format=this.options.interpolation.format,n||(n=as),this.options.fallbackLng&&!this.services.languageDetector&&!this.options.lng){let e=this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);e.length>0&&"dev"!==e[0]&&(this.options.lng=e[0])}this.services.languageDetector||this.options.lng||this.logger.warn("init: no languageDetector is used and no lng is defined"),["getResource","hasResourceBundle","getResourceBundle","getDataByLanguage"].forEach(e=>{this[e]=(...n)=>this.store[e](...n)}),["addResource","addResources","addResourceBundle","removeResourceBundle"].forEach(e=>{this[e]=(...n)=>(this.store[e](...n),this)});let r=rP(),a=()=>{let e=(e,t)=>{this.isInitializing=!1,this.isInitialized&&!this.initializedStoreOnce&&this.logger.warn("init: i18next is already initialized. You should call init just once!"),this.isInitialized=!0,this.options.isClone||this.logger.log("initialized",this.options),this.emit("initialized",this.options),r.resolve(t),n(e,t)};if(this.languages&&!this.isInitialized)return e(null,this.t.bind(this));this.changeLanguage(this.options.lng,e)};return this.options.resources||!this.options.initAsync?a():setTimeout(a,0),r}loadResources(e,n=as){let t=n,i=rO(e)?e:this.language;if("function"==typeof e&&(t=e),!this.options.resources||this.options.partialBundledLanguages){if(i?.toLowerCase()==="cimode"&&(!this.options.preload||0===this.options.preload.length))return t();let e=[],n=n=>{n&&"cimode"!==n&&this.services.languageUtils.toResolveHierarchy(n).forEach(n=>{"cimode"!==n&&0>e.indexOf(n)&&e.push(n)})};i?n(i):this.services.languageUtils.getFallbackCodes(this.options.fallbackLng).forEach(e=>n(e)),this.options.preload?.forEach?.(e=>n(e)),this.services.backendConnector.load(e,this.options.ns,e=>{e||this.resolvedLanguage||!this.language||this.setResolvedLanguage(this.language),t(e)})}else t(null)}reloadResources(e,n,t){let i=rP();return"function"==typeof e&&(t=e,e=void 0),"function"==typeof n&&(t=n,n=void 0),e||(e=this.languages),n||(n=this.options.ns),t||(t=as),this.services.backendConnector.reload(e,n,e=>{i.resolve(),t(e)}),i}use(e){if(!e)throw Error("You are passing an undefined module! Please check the object you are passing to i18next.use()");if(!e.type)throw Error("You are passing a wrong module! Please check the object you are passing to i18next.use()");return"backend"===e.type&&(this.modules.backend=e),("logger"===e.type||e.log&&e.warn&&e.error)&&(this.modules.logger=e),"languageDetector"===e.type&&(this.modules.languageDetector=e),"i18nFormat"===e.type&&(this.modules.i18nFormat=e),"postProcessor"===e.type&&rQ.addPostProcessor(e),"formatter"===e.type&&(this.modules.formatter=e),"3rdParty"===e.type&&this.modules.external.push(e),this}setResolvedLanguage(e){if(e&&this.languages&&!(["cimode","dev"].indexOf(e)>-1)){for(let e=0;e<this.languages.length;e++){let n=this.languages[e];if(!(["cimode","dev"].indexOf(n)>-1)&&this.store.hasLanguageSomeTranslations(n)){this.resolvedLanguage=n;break}}!this.resolvedLanguage&&0>this.languages.indexOf(e)&&this.store.hasLanguageSomeTranslations(e)&&(this.resolvedLanguage=e,this.languages.unshift(e))}}changeLanguage(e,n){this.isLanguageChangingTo=e;let t=rP();this.emit("languageChanging",e);let i=e=>{this.language=e,this.languages=this.services.languageUtils.toResolveHierarchy(e),this.resolvedLanguage=void 0,this.setResolvedLanguage(e)},r=(r,a)=>{a?this.isLanguageChangingTo===e&&(i(a),this.translator.changeLanguage(a),this.isLanguageChangingTo=void 0,this.emit("languageChanged",a),this.logger.log("languageChanged",a)):this.isLanguageChangingTo=void 0,t.resolve((...e)=>this.t(...e)),n&&n(r,(...e)=>this.t(...e))},a=n=>{e||n||!this.services.languageDetector||(n=[]);let t=rO(n)?n:n&&n[0],a=this.store.hasLanguageSomeTranslations(t)?t:this.services.languageUtils.getBestMatchFromCodes(rO(n)?[n]:n);a&&(this.language||i(a),this.translator.language||this.translator.changeLanguage(a),this.services.languageDetector?.cacheUserLanguage?.(a)),this.loadResources(a,e=>{r(e,a)})};return e||!this.services.languageDetector||this.services.languageDetector.async?!e&&this.services.languageDetector&&this.services.languageDetector.async?0===this.services.languageDetector.detect.length?this.services.languageDetector.detect().then(a):this.services.languageDetector.detect(a):a(e):a(this.services.languageDetector.detect()),t}getFixedT(e,n,t){let i=(e,n,...r)=>{let a,o;(a="object"!=typeof n?this.options.overloadTranslationOptionHandler([e,n].concat(r)):{...n}).lng=a.lng||i.lng,a.lngs=a.lngs||i.lngs,a.ns=a.ns||i.ns,""!==a.keyPrefix&&(a.keyPrefix=a.keyPrefix||t||i.keyPrefix);let s=this.options.keySeparator||".";return a.keyPrefix&&Array.isArray(e)?o=e.map(e=>("function"==typeof e&&(e=r1(e,{...this.options,...n})),`${a.keyPrefix}${s}${e}`)):("function"==typeof e&&(e=r1(e,{...this.options,...n})),o=a.keyPrefix?`${a.keyPrefix}${s}${e}`:e),this.t(o,a)};return rO(e)?i.lng=e:i.lngs=e,i.ns=n,i.keyPrefix=t,i}t(...e){return this.translator?.translate(...e)}exists(...e){return this.translator?.exists(...e)}setDefaultNamespace(e){this.options.defaultNS=e}hasLoadedNamespace(e,n={}){if(!this.isInitialized)return this.logger.warn("hasLoadedNamespace: i18next was not initialized",this.languages),!1;if(!this.languages||!this.languages.length)return this.logger.warn("hasLoadedNamespace: i18n.languages were undefined or empty",this.languages),!1;let t=n.lng||this.resolvedLanguage||this.languages[0],i=!!this.options&&this.options.fallbackLng,r=this.languages[this.languages.length-1];if("cimode"===t.toLowerCase())return!0;let a=(e,n)=>{let t=this.services.backendConnector.state[`${e}|${n}`];return -1===t||0===t||2===t};if(n.precheck){let e=n.precheck(this,a);if(void 0!==e)return e}return!!(this.hasResourceBundle(t,e)||!this.services.backendConnector.backend||this.options.resources&&!this.options.partialBundledLanguages||a(t,e)&&(!i||a(r,e)))}loadNamespaces(e,n){let t=rP();return this.options.ns?(rO(e)&&(e=[e]),e.forEach(e=>{0>this.options.ns.indexOf(e)&&this.options.ns.push(e)}),this.loadResources(e=>{t.resolve(),n&&n(e)}),t):(n&&n(),Promise.resolve())}loadLanguages(e,n){let t=rP();rO(e)&&(e=[e]);let i=this.options.preload||[],r=e.filter(e=>0>i.indexOf(e)&&this.services.languageUtils.isSupportedCode(e));return r.length?(this.options.preload=i.concat(r),this.loadResources(e=>{t.resolve(),n&&n(e)}),t):(n&&n(),Promise.resolve())}dir(e){if(e||(e=this.resolvedLanguage||(this.languages?.length>0?this.languages[0]:this.language)),!e)return"rtl";try{let n=new Intl.Locale(e);if(n&&n.getTextInfo){let e=n.getTextInfo();if(e&&e.direction)return e.direction}}catch(e){}let n=this.services?.languageUtils||new r4(aa());return e.toLowerCase().indexOf("-latn")>1?"ltr":["ar","shu","sqr","ssh","xaa","yhd","yud","aao","abh","abv","acm","acq","acw","acx","acy","adf","ads","aeb","aec","afb","ajp","apc","apd","arb","arq","ars","ary","arz","auz","avl","ayh","ayl","ayn","ayp","bbz","pga","he","iw","ps","pbt","pbu","pst","prp","prd","ug","ur","ydd","yds","yih","ji","yi","hbo","men","xmn","fa","jpr","peo","pes","prs","dv","sam","ckb"].indexOf(n.getLanguagePartFromCode(e))>-1||e.toLowerCase().indexOf("-arab")>1?"rtl":"ltr"}static createInstance(e={},n){return new al(e,n)}cloneInstance(e={},n=as){let t=e.forkResourceStore;t&&delete e.forkResourceStore;let i={...this.options,...e,isClone:!0},r=new al(i);return(void 0!==e.debug||void 0!==e.prefix)&&(r.logger=r.logger.clone(e)),["store","services","language"].forEach(e=>{r[e]=this[e]}),r.services={...this.services},r.services.utils={hasLoadedNamespace:r.hasLoadedNamespace.bind(r)},t&&(r.store=new rX(Object.keys(this.store.data).reduce((e,n)=>(e[n]={...this.store.data[n]},e[n]=Object.keys(e[n]).reduce((t,i)=>(t[i]={...e[n][i]},t),e[n]),e),{}),i),r.services.resourceStore=r.store),r.translator=new r5(r.services,i),r.translator.on("*",(e,...n)=>{r.emit(e,...n)}),r.init(i,n),r.translator.options=i,r.translator.backendConnector.services.utils={hasLoadedNamespace:r.hasLoadedNamespace.bind(r)},r}toJSON(){return{options:this.options,store:this.store,language:this.language,languages:this.languages,resolvedLanguage:this.resolvedLanguage}}}let ac=al.createInstance();ac.createInstance=al.createInstance,ac.createInstance,ac.dir,ac.init,ac.loadResources,ac.reloadResources,ac.use,ac.changeLanguage,ac.getFixedT,ac.t,ac.exists,ac.setDefaultNamespace,ac.hasLoadedNamespace,ac.loadNamespaces,ac.loadLanguages;let au=ac.default||ac;function ap(e,n,t,i){return au.t(n,{ns:e,defaultValue:t,...i})}function ad(e,n,t){return rz[e]?ap("core",e,n??rz[e],t):(console.error(`O3 Core Translations does not provide key '${e}'. The key itself is being rendered as text.`),e)}au.on("initialized",function(){window.i18next.loadNamespaces(["core"])});let af="import-map-override:",ah="import-map-overrides-disabled",ag="import-map-overrides:change",am=!1,ab=null;async function ay(){let e=document.querySelectorAll('script[type="systemjs-importmap"]'),n=[];for(let t=0;t<e.length;t++){let i=e[t];try{if(i.src){let e=await fetch(i.src);n.push(await e.json())}else i.textContent&&n.push(JSON.parse(i.textContent))}catch(e){console.warn(`[import-maps] Failed to parse import map from script tag at index ${t}`,e)}}return a_(n)}function a_(e){let n={imports:{}};for(let t of e)t?.imports&&Object.assign(n.imports,t.imports);return n}function av(){let e={};try{let n=ax();for(let t=0;t<localStorage.length;t++){let i=localStorage.key(t);if(i?.startsWith(af)){let t=i.slice(af.length);if(!n.includes(t)){let n=localStorage.getItem(i);n&&(e[t]=n)}}}}catch(e){console.warn("[import-maps] Failed to read import-map overrides from localStorage",e)}return{imports:e}}async function a$(){let e=await ay();return am?a_([e,ab??av()]):e}async function aA(){return ay()}async function aw(){return am?a_([await ay(),av()]):ay()}function ak(e){if(!am)return{imports:{}};if(e){let e={};for(let n=0;n<localStorage.length;n++){let t=localStorage.key(n);if(t?.startsWith(af)){let n=localStorage.getItem(t);n&&(e[t.slice(af.length)]=n)}}return{imports:e}}return av()}function ax(){if(!am)return[];try{let e=localStorage.getItem(ah);if(e){let n=JSON.parse(e);if(Array.isArray(n))return n}}catch{}return[]}function aC(e){return!!am&&ax().includes(e)}function aE(e,n){if(!am)return void console.warn("[Security] Import map overrides are disabled in production mode.");try{localStorage.setItem(af+e,n),window.dispatchEvent(new CustomEvent(ag))}catch(e){console.warn("[import-maps] Failed to write import-map override to localStorage",e)}}function aS(e){if(!am)return void console.warn("[Security] Import map overrides are disabled in production mode.");try{localStorage.removeItem(af+e);let n=ax().filter(n=>n!==e);n.length>0?localStorage.setItem(ah,JSON.stringify(n)):localStorage.removeItem(ah),window.dispatchEvent(new CustomEvent(ag))}catch(e){console.warn("[import-maps] Failed to update import-map overrides in localStorage",e)}}function aD(){if(!am)return void console.warn("[Security] Import map overrides are disabled in production mode.");try{let e=[];for(let n=0;n<localStorage.length;n++){let t=localStorage.key(n);t?.startsWith(af)&&e.push(t)}e.forEach(e=>localStorage.removeItem(e)),localStorage.removeItem(ah),window.dispatchEvent(new CustomEvent(ag))}catch(e){console.warn("[import-maps] Failed to clear import-map overrides from localStorage",e)}}function aM(e){if(!am)return void console.warn("[Security] Import map overrides are disabled in production mode.");try{let n=ax().filter(n=>n!==e);n.length>0?localStorage.setItem(ah,JSON.stringify(n)):localStorage.removeItem(ah),window.dispatchEvent(new CustomEvent(ag))}catch(e){console.warn("[import-maps] Failed to update import-map overrides in localStorage",e)}}let az=!1;function aO(){!az&&(az=!0,(am="development"===window.spaEnv)&&(ab=av()))}function aP(e){return e.replace(/[\/\-@]/g,"_")}async function aT(e,n="./start",i){var r;let a,o=!i?.maxLoadingTime||i.maxLoadingTime<=0?6e5:i.maxLoadingTime;await Promise.race([aB(e,i?.importMap),new Promise((n,t)=>{a=setTimeout(()=>{var n;t(Error(`Could not resolve requested script, ${e}, within ${(n=o)<1e3?`${n} milliseconds`:n<6e4?`${Math.floor(n/1e3)} seconds`:n<36e5?`${Math.floor(n/6e4)} minutes`:n<864e5?`${Math.floor(n/36e5)} hours`:`${Math.floor(n/864e5)} days`}.`))},o)})]),a&&clearTimeout(a);let s=aP(e),l=window[s];if(!("object"==typeof(r=l)&&null!==r&&"init"in r&&"function"==typeof r.init&&"get"in r&&"function"==typeof r.get)){let e=`The global variable ${s} does not refer to a federated module`;throw console.error(e),Error(e)}l.init(t.S.default);let c=(await l.get(n))();if("object"!=typeof c||null===c){let n=`Container for ${e} did not return an ESM module as expected`;throw console.error(n),Error(n)}return c}async function aB(e,n){if("string"!=typeof e||0===e.trim().length){let e="Attempted to call importDynamic() without supplying a package to load";throw console.error(e),Error(e)}let t=aP(e);if(!window[t]){let t=n??await aI();if(!t.imports.hasOwnProperty(e)){let n=`Could not find the package ${e} defined in the current importmap`;throw console.error(n),Error(n)}let i=t.imports[e];i.startsWith("./")&&(i=window.spaBase+i.substring(1));let r=e in ak().imports;try{return await new Promise((e,n)=>{!function(e,n,t){let i=document.head.querySelector(`script[src="${e}"]`),r=window[aN];if(r||(r=window[aN]=new Set([])),i)if(r.has(e)){let e,r,a;a=()=>{e&&i.removeEventListener("load",e),r&&i.removeEventListener("error",r)},e=()=>{a(),n(null)},r=e=>{a(),t(e.message)},i.addEventListener("load",e),i.addEventListener("error",r)}else console.warn(`Script at ${e} already loaded. Not loading it again.`),n(null);else{let i,a,o;r.add(e);let s=document.createElement("script");s.src=e,s.type="text/javascript",s.async=!0;let l=setTimeout(()=>{console.error(`The script at ${e} did not load within 5 seconds. This may indicate an issue with the imports in the script's entry-point file or with the script's bundler configuration.`)},5e3);o=()=>{clearTimeout(l),r.delete(e),i&&s.removeEventListener("load",i),a&&s.removeEventListener("error",a)},i=()=>{o(),n(null)},a=n=>{o();let i=`Failed to load script from ${e}`;console.error(i,n),t(n.message??i)},s.addEventListener("load",i),s.addEventListener("error",a),document.head.appendChild(s)}}(i,e,n)})}catch(e){return r&&M({kind:"error",title:ad("scriptLoadingFailed","Error: Script failed to load"),description:ad("scriptLoadingError","Failed to load overridden script from {{- url}}. Please check that the bundled script is available at the expected URL. Click the button below to reset all import map overrides.",{url:i}),actionButtonLabel:ad("resetOverrides","Reset overrides"),onActionButtonClick(){aD(),window.location.reload()}}),Promise.reject(e)}}return Promise.resolve()}async function aI(){return a$()}let aN=Symbol("__openmrs_script_loading");function aj(e){return!!e&&"object"==typeof e&&!(Object.hasOwn(e,"pages")&&(!e.pages||!Array.isArray(e.pages))||Object.hasOwn(e,"extensions")&&(!e.extensions||!Array.isArray(e.extensions))||Object.hasOwn(e,"workspaces")&&(!e.workspaces||!Array.isArray(e.workspaces))||Object.hasOwn(e,"modals")&&(!e.modals||!Array.isArray(e.modals)))}function aR(e){return!!e&&"object"==typeof e&&Object.entries(e).every(([e,n])=>"string"==typeof e&&aj(n))}let aF="openmrs-routes:",aL="openmrs-routes:change",aW=!1,aV=null;async function aG(){let e=document.querySelectorAll("script[type='openmrs-routes']"),n=[];for(let t=0;t<e.length;t++){let i=e[t];try{let e;if(i.src){let n=await fetch(i.src);e=await n.json()}else i.textContent&&(e=JSON.parse(i.textContent));e&&aR(e)&&n.push(e)}catch(e){console.warn(`[route-maps] Failed to parse routes from script tag at index ${t}`,e)}}return aU(n)}function aU(e){let n={};for(let t of e)t&&"object"==typeof t&&Object.assign(n,t);return n}async function aH(){let e={};try{let n=[];for(let e=0;e<localStorage.length;e++){let t=localStorage.key(e);if(t?.startsWith(aF)){let e=localStorage.getItem(t);e&&n.push({moduleName:t.slice(aF.length),raw:e})}}for(let t of(await Promise.allSettled(n.map(async({moduleName:e,raw:n})=>{let t=JSON.parse(n);if(aj(t))return{moduleName:e,routes:t};if("string"==typeof t&&t.startsWith("http")){let n=await fetch(t),i=await n.json();if(aj(i))return{moduleName:e,routes:i};throw Error(`${t} did not resolve to a valid OpenmrsAppRoutes object`)}throw Error(`Override for ${e} is neither a valid routes object nor a URL`)}))))"fulfilled"===t.status?e[t.value.moduleName]=t.value.routes:console.warn("[route-maps] Failed to load route override",t.reason)}catch(e){console.warn("[route-maps] Failed to read route overrides from localStorage",e)}return e}async function aq(){let e=await aG();return aW?aU([e,aV??await aH()]):e}async function aK(){return aG()}async function aY(){return aW?aU([await aG(),await aH()]):aG()}function aJ(){if(!aW)return{};let e={};try{for(let n=0;n<localStorage.length;n++){let t=localStorage.key(n);if(t?.startsWith(aF)){let n=localStorage.getItem(t);n&&(e[t.slice(aF.length)]=n)}}}catch(e){console.warn("[route-maps] Failed to read route overrides from localStorage",e)}return e}function aZ(e,n){if(!aW)return void console.warn("[Security] Route overrides are disabled outside development mode.");try{if("string"==typeof n)if(n.startsWith("http"))localStorage.setItem(aF+e,JSON.stringify(n));else{let t=JSON.parse(n);if(!aj(t))return void console.error(`The supplied routes for ${e} is not a valid OpenmrsAppRoutes object`,n);localStorage.setItem(aF+e,JSON.stringify(t))}else if(n instanceof URL)localStorage.setItem(aF+e,JSON.stringify(n.toString()));else{if(!aj(n))return void console.error(`Override for ${e} is not in a valid format. Expected either a Javascript Object, a JSON string of a Javascript object, or a URL`,n);localStorage.setItem(aF+e,JSON.stringify(n))}window.dispatchEvent(new CustomEvent(aL))}catch(e){console.warn("[route-maps] Failed to write route override to localStorage",e)}}function aX(e){if(!aW)return void console.warn("[Security] Route overrides are disabled outside development mode.");try{localStorage.removeItem(aF+e),window.dispatchEvent(new CustomEvent(aL))}catch(e){console.warn("[route-maps] Failed to remove route override from localStorage",e)}}function aQ(){if(!aW)return void console.warn("[Security] Route overrides are disabled outside development mode.");try{let e=[];for(let n=0;n<localStorage.length;n++){let t=localStorage.key(n);t?.startsWith(aF)&&e.push(t)}e.forEach(e=>localStorage.removeItem(e)),window.dispatchEvent(new CustomEvent(aL))}catch(e){console.warn("[route-maps] Failed to clear route overrides from localStorage",e)}}let a0=null;function a1(){return a0||(a0=(aW="development"===window.spaEnv)?aH().then(e=>{aV=e}):Promise.resolve())}let a2=`${rl}/attachment`;function a3(e,n){return rd(`${a2}/${e}`,{signal:n.signal})}function a5(e,n,t){return rd(`${a2}?patient=${e}&includeEncounterless=${n}`,{signal:t.signal})}async function a4(e,n){let t=new FormData;return t.append("fileCaption",n.fileDescription),t.append("patient",e),n.file?t.append("file",n.file,n.fileName):(t.append("file",new File([""],n.fileName),n.fileName),t.append("base64Content",n.base64Content)),rd(`${a2}`,{method:"POST",body:t})}function a6(e,n){return rd(`${a2}/${e}`,{method:"DELETE",signal:n.signal})}try{self["workbox:window:6.5.4"]&&_()}catch(e){}function a8(e,n){return new Promise(function(t){var i=new MessageChannel;i.port1.onmessage=function(e){t(e.data)},e.postMessage(n,[i.port2])})}function a7(e,n){for(var t=0;t<n.length;t++){var i=n[t];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}function a9(e,n){(null==n||n>e.length)&&(n=e.length);for(var t=0,i=Array(n);t<n;t++)i[t]=e[t];return i}try{self["workbox:core:6.5.4"]&&_()}catch(e){}var oe=function(){var e=this;this.promise=new Promise(function(n,t){e.resolve=n,e.reject=t})};function on(e,n){var t=location.href;return new URL(e,t).href===new URL(n,t).href}var ot=function(e,n){this.type=e,Object.assign(this,n)};function oi(e,n,t){return t?n?n(e):e:(e&&e.then||(e=Promise.resolve(e)),n?e.then(n):e)}function or(){}var oa={type:"SKIP_WAITING"};function oo(e,n){if(!n)return e&&e.then?e.then(or):Promise.resolve()}var os=function(e){function n(n,t){var i,r;return void 0===t&&(t={}),(i=e.call(this)||this).nn={},i.tn=0,i.rn=new oe,i.en=new oe,i.on=new oe,i.un=0,i.an=new Set,i.cn=function(){var e=i.fn,n=e.installing;i.tn>0||!on(n.scriptURL,i.sn.toString())||performance.now()>i.un+6e4?(i.vn=n,e.removeEventListener("updatefound",i.cn)):(i.hn=n,i.an.add(n),i.rn.resolve(n)),++i.tn,n.addEventListener("statechange",i.ln)},i.ln=function(e){var n=i.fn,t=e.target,r=t.state,a=t===i.vn,o={sw:t,isExternal:a,originalEvent:e};!a&&i.mn&&(o.isUpdate=!0),i.dispatchEvent(new ot(r,o)),"installed"===r?i.wn=self.setTimeout(function(){"installed"===r&&n.waiting===t&&i.dispatchEvent(new ot("waiting",o))},200):"activating"===r&&(clearTimeout(i.wn),a||i.en.resolve(t))},i.dn=function(e){var n=i.hn,t=n!==navigator.serviceWorker.controller;i.dispatchEvent(new ot("controlling",{isExternal:t,originalEvent:e,sw:n,isUpdate:i.mn})),t||i.on.resolve(n)},r=function(e){var n=e.data,t=e.ports,r=e.source;return oi(i.getSW(),function(){i.an.has(r)&&i.dispatchEvent(new ot("message",{data:n,originalEvent:e,ports:t,sw:r}))})},i.gn=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];try{return Promise.resolve(r.apply(this,e))}catch(e){return Promise.reject(e)}},i.sn=n,i.nn=t,navigator.serviceWorker.addEventListener("message",i.gn),i}n.prototype=Object.create(e.prototype),n.prototype.constructor=n,n.__proto__=e;var t,i,r=n.prototype;return r.register=function(e){var n=(void 0===e?{}:e).immediate,t=void 0!==n&&n;try{var i,r,a,o=this;return i=function(){if(!t&&"complete"!==document.readyState)return oo(new Promise(function(e){return window.addEventListener("load",e)}))},r=function(){return o.mn=!!navigator.serviceWorker.controller,o.yn=o.pn(),oi(o.bn(),function(e){o.fn=e,o.yn&&(o.hn=o.yn,o.en.resolve(o.yn),o.on.resolve(o.yn),o.yn.addEventListener("statechange",o.ln,{once:!0}));var n=o.fn.waiting;return n&&on(n.scriptURL,o.sn.toString())&&(o.hn=n,Promise.resolve().then(function(){o.dispatchEvent(new ot("waiting",{sw:n,wasWaitingBeforeRegister:!0}))}).then(function(){})),o.hn&&(o.rn.resolve(o.hn),o.an.add(o.hn)),o.fn.addEventListener("updatefound",o.cn),navigator.serviceWorker.addEventListener("controllerchange",o.dn),o.fn})},(a=i())&&a.then?a.then(r):r(a)}catch(e){return Promise.reject(e)}},r.update=function(){try{return this.fn?oo(this.fn.update()):void 0}catch(e){return Promise.reject(e)}},r.getSW=function(){return void 0!==this.hn?Promise.resolve(this.hn):this.rn.promise},r.messageSW=function(e){try{return oi(this.getSW(),function(n){return a8(n,e)})}catch(e){return Promise.reject(e)}},r.messageSkipWaiting=function(){this.fn&&this.fn.waiting&&a8(this.fn.waiting,oa)},r.pn=function(){var e=navigator.serviceWorker.controller;return e&&on(e.scriptURL,this.sn.toString())?e:void 0},r.bn=function(){try{var e=this;return function(e,n){try{var t=e()}catch(e){return n(e)}return t&&t.then?t.then(void 0,n):t}(function(){return oi(navigator.serviceWorker.register(e.sn,e.nn),function(n){return e.un=performance.now(),n})},function(e){throw e})}catch(e){return Promise.reject(e)}},t=[{key:"active",get:function(){return this.en.promise}},{key:"controlling",get:function(){return this.on.promise}}],a7(n.prototype,t),i&&a7(n,i),n}(function(){function e(){this.Pn=new Map}var n=e.prototype;return n.addEventListener=function(e,n){this.Sn(e).add(n)},n.removeEventListener=function(e,n){this.Sn(e).delete(n)},n.dispatchEvent=function(e){e.target=this;for(var n,t=function(e){var n;if("u"<typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(n=function(e){if(e){if("string"==typeof e)return a9(e,void 0);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?a9(e,void 0):void 0}}(e))){n&&(e=n);var t=0;return function(){return t>=e.length?{done:!0}:{done:!1,value:e[t++]}}}throw TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}return(n=e[Symbol.iterator]()).next.bind(n)}(this.Sn(e.type));!(n=t()).done;)(0,n.value)(e)},n.Sn=function(e){return this.Pn.has(e)||this.Pn.set(e,new Set),this.Pn.get(e)},e}());function ol(e,n){if(void 0!==p)return console.warn(`The application's Service Worker has already been registered. The new service worker at ${e} will not be registered.`),p;if(!("serviceWorker"in navigator))throw Error("Registering the Service Worker is not possible due to missing browser capabilities.");let t=new os(e,n);return p=t.register().then(()=>t.controlling.then(()=>t))}function oc(){return p??Promise.resolve(void 0)}let ou="x-omrs-offline-response-body",op="x-omrs-offline-response-status",od="x-omrs-offline-caching-strategy";async function of(e){let n=await oc();return n?await n.messageSW(e):{success:!1,result:void 0,error:"No service worker has been registered. This is typically the case when the application has been built without offline-related features."}}async function oh(){let e=window.sessionStorage;try{e.setItem("someKeyHere","test"),e.removeItem("someKeyHere")}catch(n){if(n.code===DOMException.QUOTA_EXCEEDED_ERR&&0===e.length)return!0}return!1}async function og(){return!window.indexedDB}async function om(){return new Promise(e=>{let n=indexedDB.open("test");n.onerror=()=>e(!0),n.onsuccess=()=>e(!1)})}async function ob(){return await om()||await og()||await oh()}let oy="openmrs3:offline-mode",o_="unavailable";function ov(){return{current:o_,notAvailable:"unavailable"===o_,active:"on"===o_}}function o$(e){"unavailable"!==o_&&"unavailable"!==e&&(localStorage.setItem(oy,"on"===e?"active":"disabled"),o_=e)}async function oA(){await ob()||(o_="active"===localStorage.getItem(oy)?"on":"off"),navigator.onLine}let ow="u">typeof globalThis?globalThis:"u">typeof self?self:"u">typeof window?window:global,ok=Object.keys,ox=Array.isArray;function oC(e,n){return"object"!=typeof n||ok(n).forEach(function(t){e[t]=n[t]}),e}"u"<typeof Promise||ow.Promise||(ow.Promise=Promise);let oE=Object.getPrototypeOf,oS={}.hasOwnProperty;function oD(e,n){return oS.call(e,n)}function oM(e,n){"function"==typeof n&&(n=n(oE(e))),("u"<typeof Reflect?ok:Reflect.ownKeys)(n).forEach(t=>{oO(e,t,n[t])})}let oz=Object.defineProperty;function oO(e,n,t,i){oz(e,n,oC(t&&oD(t,"get")&&"function"==typeof t.get?{get:t.get,set:t.set,configurable:!0}:{value:t,configurable:!0,writable:!0},i))}function oP(e){return{from:function(n){return e.prototype=Object.create(n.prototype),oO(e.prototype,"constructor",e),{extend:oM.bind(null,e.prototype)}}}}let oT=Object.getOwnPropertyDescriptor;function oB(e,n){let t;return oT(e,n)||(t=oE(e))&&oB(t,n)}let oI=[].slice;function oN(e,n,t){return oI.call(e,n,t)}function oj(e,n){return n(e)}function oR(e){if(!e)throw Error("Assertion Failed")}function oF(e){ow.setImmediate?setImmediate(e):setTimeout(e,0)}function oL(e,n){return e.reduce((e,t,i)=>{var r=n(t,i);return r&&(e[r[0]]=r[1]),e},{})}function oW(e,n){if(oD(e,n))return e[n];if(!n)return e;if("string"!=typeof n){for(var t=[],i=0,r=n.length;i<r;++i){var a=oW(e,n[i]);t.push(a)}return t}var o=n.indexOf(".");if(-1!==o){var s=e[n.substr(0,o)];return void 0===s?void 0:oW(s,n.substr(o+1))}}function oV(e,n,t){if(e&&void 0!==n&&(!("isFrozen"in Object)||!Object.isFrozen(e)))if("string"!=typeof n&&"length"in n){oR("string"!=typeof t&&"length"in t);for(var i=0,r=n.length;i<r;++i)oV(e,n[i],t[i])}else{var a=n.indexOf(".");if(-1!==a){var o=n.substr(0,a),s=n.substr(a+1);if(""===s)void 0===t?ox(e)&&!isNaN(parseInt(o))?e.splice(o,1):delete e[o]:e[o]=t;else{var l=e[o];l&&oD(e,o)||(l=e[o]={}),oV(l,s,t)}}else void 0===t?ox(e)&&!isNaN(parseInt(n))?e.splice(n,1):delete e[n]:e[n]=t}}function oG(e){var n={};for(var t in e)oD(e,t)&&(n[t]=e[t]);return n}let oU=[].concat;function oH(e){return oU.apply([],e)}let oq="Boolean,String,Date,RegExp,Blob,File,FileList,FileSystemFileHandle,ArrayBuffer,DataView,Uint8ClampedArray,ImageBitmap,ImageData,Map,Set,CryptoKey".split(",").concat(oH([8,16,32,64].map(e=>["Int","Uint","Float"].map(n=>n+e+"Array")))).filter(e=>ow[e]),oK=oq.map(e=>ow[e]);oL(oq,e=>[e,!0]);let oY=null;function oJ(e){oY="u">typeof WeakMap&&new WeakMap;let n=function e(n){if(!n||"object"!=typeof n)return n;let t=oY&&oY.get(n);if(t)return t;if(ox(n)){t=[],oY&&oY.set(n,t);for(var i=0,r=n.length;i<r;++i)t.push(e(n[i]))}else if(oK.indexOf(n.constructor)>=0)t=n;else{let i=oE(n);for(var a in t=i===Object.prototype?{}:Object.create(i),oY&&oY.set(n,t),n)oD(n,a)&&(t[a]=e(n[a]))}return t}(e);return oY=null,n}let{toString:oZ}={};function oX(e){return oZ.call(e).slice(8,-1)}let oQ="u">typeof Symbol?Symbol.iterator:"@@iterator",o0="symbol"==typeof oQ?function(e){var n;return null!=e&&(n=e[oQ])&&n.apply(e)}:function(){return null},o1={};function o2(e){var n,t,i,r;if(1==arguments.length){if(ox(e))return e.slice();if(this===o1&&"string"==typeof e)return[e];if(r=o0(e)){for(t=[];!(i=r.next()).done;)t.push(i.value);return t}if(null==e)return[e];if("number"==typeof(n=e.length)){for(t=Array(n);n--;)t[n]=e[n];return t}return[e]}for(n=arguments.length,t=Array(n);n--;)t[n]=arguments[n];return t}let o3="u">typeof Symbol?e=>"AsyncFunction"===e[Symbol.toStringTag]:()=>!1;var o5="u">typeof location&&/^(http|https):\/\/(localhost|127\.0\.0\.1)/.test(location.href),o4=()=>!0;let o6=!Error("").stack;function o8(){if(o6)try{throw o8.arguments,Error()}catch(e){return e}return Error()}function o7(e,n){var t=e.stack;return t?(n=n||0,0===t.indexOf(e.name)&&(n+=(e.name+e.message).split("\n").length),t.split("\n").slice(n).filter(o4).map(e=>"\n"+e).join("")):""}var o9=["Unknown","Constraint","Data","TransactionInactive","ReadOnly","Version","NotFound","InvalidState","InvalidAccess","Abort","Timeout","QuotaExceeded","Syntax","DataClone"],se=["Modify","Bulk","OpenFailed","VersionChange","Schema","Upgrade","InvalidTable","MissingAPI","NoSuchDatabase","InvalidArgument","SubTransaction","Unsupported","Internal","DatabaseClosed","PrematureCommit","ForeignAwait"].concat(o9),sn={VersionChanged:"Database version changed by other database connection",DatabaseClosed:"Database has been closed",Abort:"Transaction aborted",TransactionInactive:"Transaction has already completed or failed",MissingAPI:"IndexedDB API missing. Please visit https://tinyurl.com/y2uuvskb"};function st(e,n){this._e=o8(),this.name=e,this.message=n}function si(e,n){return e+". Errors: "+Object.keys(n).map(e=>n[e].toString()).filter((e,n,t)=>t.indexOf(e)===n).join("\n")}function sr(e,n,t,i){this._e=o8(),this.failures=n,this.failedKeys=i,this.successCount=t,this.message=si(e,n)}function sa(e,n){this._e=o8(),this.name="BulkError",this.failures=Object.keys(n).map(e=>n[e]),this.failuresByPos=n,this.message=si(e,n)}oP(st).from(Error).extend({stack:{get:function(){return this._stack||(this._stack=this.name+": "+this.message+o7(this._e,2))}},toString:function(){return this.name+": "+this.message}}),oP(sr).from(st),oP(sa).from(st);var so=se.reduce((e,n)=>(e[n]=n+"Error",e),{}),ss=se.reduce((e,n)=>{var t=n+"Error";function i(e,i){this._e=o8(),this.name=t,e?"string"==typeof e?(this.message=`${e}${i?"\n "+i:""}`,this.inner=i||null):"object"==typeof e&&(this.message=`${e.name} ${e.message}`,this.inner=e):(this.message=sn[n]||t,this.inner=null)}return oP(i).from(st),e[n]=i,e},{});ss.Syntax=SyntaxError,ss.Type=TypeError,ss.Range=RangeError;var sl=o9.reduce((e,n)=>(e[n+"Error"]=ss[n],e),{}),sc=se.reduce((e,n)=>(-1===["Syntax","Type","Range"].indexOf(n)&&(e[n+"Error"]=ss[n]),e),{});function su(){}function sp(e){return e}function sd(e,n){return null==e||e===sp?n:function(t){return n(e(t))}}function sf(e,n){return function(){e.apply(this,arguments),n.apply(this,arguments)}}function sh(e,n){return e===su?n:function(){var t=e.apply(this,arguments);void 0!==t&&(arguments[0]=t);var i=this.onsuccess,r=this.onerror;this.onsuccess=null,this.onerror=null;var a=n.apply(this,arguments);return i&&(this.onsuccess=this.onsuccess?sf(i,this.onsuccess):i),r&&(this.onerror=this.onerror?sf(r,this.onerror):r),void 0!==a?a:t}}function sg(e,n){return e===su?n:function(){e.apply(this,arguments);var t=this.onsuccess,i=this.onerror;this.onsuccess=this.onerror=null,n.apply(this,arguments),t&&(this.onsuccess=this.onsuccess?sf(t,this.onsuccess):t),i&&(this.onerror=this.onerror?sf(i,this.onerror):i)}}function sm(e,n){return e===su?n:function(t){var i=e.apply(this,arguments);oC(t,i);var r=this.onsuccess,a=this.onerror;this.onsuccess=null,this.onerror=null;var o=n.apply(this,arguments);return r&&(this.onsuccess=this.onsuccess?sf(r,this.onsuccess):r),a&&(this.onerror=this.onerror?sf(a,this.onerror):a),void 0===i?void 0===o?void 0:o:oC(i,o)}}function sb(e,n){return e===su?n:function(){return!1!==n.apply(this,arguments)&&e.apply(this,arguments)}}function sy(e,n){return e===su?n:function(){var t=e.apply(this,arguments);if(t&&"function"==typeof t.then){for(var i=this,r=arguments.length,a=Array(r);r--;)a[r]=arguments[r];return t.then(function(){return n.apply(i,a)})}return n.apply(this,arguments)}}sc.ModifyError=sr,sc.DexieError=st,sc.BulkError=sa;var s_={};let[sv,s$,sA]="u"<typeof Promise?[]:(()=>{let e=Promise.resolve();if("u"<typeof crypto||!crypto.subtle)return[e,oE(e),e];let n=crypto.subtle.digest("SHA-512",new Uint8Array([0]));return[n,oE(n),e]})(),sw=s$&&s$.then,sk=sv&&sv.constructor,sx=!!sA;var sC=!1,sE=sA?()=>{sA.then(sK)}:ow.setImmediate?setImmediate.bind(null,sK):ow.MutationObserver?()=>{var e=document.createElement("div");new MutationObserver(()=>{sK(),e=null}).observe(e,{attributes:!0}),e.setAttribute("i","1")}:()=>{setTimeout(sK,0)},sS=function(e,n){sN.push([e,n]),sM&&(sE(),sM=!1)},sD=!0,sM=!0,sz=[],sO=[],sP=null,sT=sp,sB={id:"global",global:!0,ref:0,unhandleds:[],onunhandled:ll,pgp:!1,env:{},finalize:function(){this.unhandleds.forEach(e=>{try{ll(e[0],e[1])}catch(e){}})}},sI=sB,sN=[],sj=0,sR=[];function sF(e){if("object"!=typeof this)throw TypeError("Promises must be constructed via new");this._listeners=[],this.onuncatched=su,this._lib=!1;var n=this._PSD=sI;if(o5&&(this._stackHolder=o8(),this._prev=null,this._numPrev=0),"function"!=typeof e){if(e!==s_)throw TypeError("Not a function");return this._state=arguments[1],this._value=arguments[2],void(!1===this._state&&sV(this,this._value))}this._state=null,this._value=null,++n.ref,function e(n,t){try{t(t=>{if(null===n._state){if(t===n)throw TypeError("A promise cannot be resolved with itself.");var i=n._lib&&sY();t&&"function"==typeof t.then?e(n,(e,n)=>{t instanceof sF?t._then(e,n):t.then(e,n)}):(n._state=!0,n._value=t,sG(n)),i&&sJ()}},sV.bind(null,n))}catch(e){sV(n,e)}}(this,e)}let sL={get:function(){var e=sI,n=s5;function t(t,i){var r=!e.global&&(e!==sI||n!==s5);let a=r&&!s7();var o=new sF((n,o)=>{sU(this,new sW(la(t,e,r,a),la(i,e,r,a),n,o,e))});return o5&&sq(o,this),o}return t.prototype=s_,t},set:function(e){oO(this,"then",e&&e.prototype===s_?sL:{get:function(){return e},set:sL.set})}};function sW(e,n,t,i,r){this.onFulfilled="function"==typeof e?e:null,this.onRejected="function"==typeof n?n:null,this.resolve=t,this.reject=i,this.psd=r}function sV(e,n){if(sO.push(n),null===e._state){var t=e._lib&&sY();n=sT(n),e._state=!1,e._value=n,o5&&null!==n&&"object"==typeof n&&!n._promise&&function(e){try{e.apply(null,void 0)}catch(e){}}(()=>{var t=oB(n,"stack");n._promise=e,oO(n,"stack",{get:()=>sC?t&&(t.get?t.get.apply(n):t.value):e.stack})}),sz.some(n=>n._value===e._value)||sz.push(e),sG(e),t&&sJ()}}function sG(e){var n=e._listeners;e._listeners=[];for(var t=0,i=n.length;t<i;++t)sU(e,n[t]);var r=e._PSD;--r.ref||r.finalize(),0===sj&&(++sj,sS(()=>{0==--sj&&sZ()},[]))}function sU(e,n){if(null!==e._state){var t=e._state?n.onFulfilled:n.onRejected;if(null===t)return(e._state?n.resolve:n.reject)(e._value);++n.psd.ref,++sj,sS(sH,[t,e,n])}else e._listeners.push(n)}function sH(e,n,t){try{sP=n;var i,r=n._value;n._state?i=e(r):(sO.length&&(sO=[]),i=e(r),-1===sO.indexOf(r)&&function(e){for(var n=sz.length;n;)if(sz[--n]._value===e._value)return void sz.splice(n,1)}(n)),t.resolve(i)}catch(e){t.reject(e)}finally{sP=null,0==--sj&&sZ(),--t.psd.ref||t.psd.finalize()}}function sq(e,n){var t=n?n._numPrev+1:0;t<100&&(e._prev=n,e._numPrev=t)}function sK(){sY()&&sJ()}function sY(){var e=sD;return sD=!1,sM=!1,e}function sJ(){var e,n,t;do for(;sN.length>0;)for(e=sN,sN=[],t=e.length,n=0;n<t;++n){var i=e[n];i[0].apply(null,i[1])}while(sN.length>0);sD=!0,sM=!0}function sZ(){var e=sz;sz=[],e.forEach(e=>{e._PSD.onunhandled.call(null,e._value,e)});for(var n=sR.slice(0),t=n.length;t;)n[--t]()}function sX(e){return new sF(s_,!1,e)}function sQ(e,n){var t=sI;return function(){var i=sY(),r=sI;try{return lt(t,!0),e.apply(this,arguments)}catch(e){n&&n(e)}finally{lt(r,!1),i&&sJ()}}}oM(sF.prototype,{then:sL,_then:function(e,n){sU(this,new sW(null,null,e,n,sI))},catch:function(e){if(1==arguments.length)return this.then(null,e);var n=arguments[0],t=arguments[1];return"function"==typeof n?this.then(null,e=>e instanceof n?t(e):sX(e)):this.then(null,e=>e&&e.name===n?t(e):sX(e))},finally:function(e){return this.then(n=>(e(),n),n=>(e(),sX(n)))},stack:{get:function(){if(this._stack)return this._stack;try{sC=!0;var e=(function e(n,t,i){if(t.length===i)return t;var r="";if(!1===n._state){var a,o,s=n._value;null!=s?(a=s.name||"Error",o=s.message||s,r=o7(s,0)):(a=s,o=""),t.push(a+(o?": "+o:"")+r)}return o5&&((r=o7(n._stackHolder,2))&&-1===t.indexOf(r)&&t.push(r),n._prev&&e(n._prev,t,i)),t})(this,[],20).join("\nFrom previous: ");return null!==this._state&&(this._stack=e),e}finally{sC=!1}}},timeout:function(e,n){return e<1/0?new sF((t,i)=>{var r=setTimeout(()=>i(new ss.Timeout(n)),e);this.then(t,i).finally(clearTimeout.bind(null,r))}):this}}),"u">typeof Symbol&&Symbol.toStringTag&&oO(sF.prototype,Symbol.toStringTag,"Dexie.Promise"),sB.env=li(),oM(sF,{all:function(){var e=o2.apply(null,arguments).map(s9);return new sF(function(n,t){0===e.length&&n([]);var i=e.length;e.forEach((r,a)=>sF.resolve(r).then(t=>{e[a]=t,--i||n(e)},t))})},resolve:e=>{if(e instanceof sF)return e;if(e&&"function"==typeof e.then)return new sF((n,t)=>{e.then(n,t)});var n=new sF(s_,!0,e);return sq(n,sP),n},reject:sX,race:function(){var e=o2.apply(null,arguments).map(s9);return new sF((n,t)=>{e.map(e=>sF.resolve(e).then(n,t))})},PSD:{get:()=>sI,set:e=>sI=e},totalEchoes:{get:()=>s5},newPSD:s6,usePSD:lr,scheduler:{get:()=>sS,set:e=>{sS=e}},rejectionMapper:{get:()=>sT,set:e=>{sT=e}},follow:(e,n)=>new sF((t,i)=>s6((n,t)=>{var i=sI;i.unhandleds=[],i.onunhandled=t,i.finalize=sf(function(){var e;e=()=>{0===this.unhandleds.length?n():t(this.unhandleds[0])},sR.push(function n(){e(),sR.splice(sR.indexOf(n),1)}),++sj,sS(()=>{0==--sj&&sZ()},[])},i.finalize),e()},n,t,i))}),sk&&(sk.allSettled&&oO(sF,"allSettled",function(){let e=o2.apply(null,arguments).map(s9);return new sF(n=>{0===e.length&&n([]);let t=e.length,i=Array(t);e.forEach((e,r)=>sF.resolve(e).then(e=>i[r]={status:"fulfilled",value:e},e=>i[r]={status:"rejected",reason:e}).then(()=>--t||n(i)))})}),sk.any&&"u">typeof AggregateError&&oO(sF,"any",function(){let e=o2.apply(null,arguments).map(s9);return new sF((n,t)=>{0===e.length&&t(AggregateError([]));let i=e.length,r=Array(i);e.forEach((e,a)=>sF.resolve(e).then(e=>n(e),e=>{r[a]=e,--i||t(AggregateError(r))}))})}));let s0={awaits:0,echoes:0,id:0};var s1=0,s2=[],s3=0,s5=0,s4=0;function s6(e,n,t,i){var r=sI,a=Object.create(r);a.parent=r,a.ref=0,a.global=!1,a.id=++s4;var o=sB.env;a.env=sx?{Promise:sF,PromiseProp:{value:sF,configurable:!0,writable:!0},all:sF.all,race:sF.race,allSettled:sF.allSettled,any:sF.any,resolve:sF.resolve,reject:sF.reject,nthen:lo(o.nthen,a),gthen:lo(o.gthen,a)}:{},n&&oC(a,n),++r.ref,a.finalize=function(){--this.parent.ref||this.parent.finalize()};var s=lr(a,e,t,i);return 0===a.ref&&a.finalize(),s}function s8(){return s0.id||(s0.id=++s1),++s0.awaits,s0.echoes+=100,s0.id}function s7(){return!!s0.awaits&&(0==--s0.awaits&&(s0.id=0),s0.echoes=100*s0.awaits,!0)}function s9(e){return s0.echoes&&e&&e.constructor===sk?(s8(),e.then(e=>(s7(),e),e=>(s7(),lc(e)))):e}function le(e){++s5,s0.echoes&&0!=--s0.echoes||(s0.echoes=s0.id=0),s2.push(sI),lt(e,!0)}function ln(){var e=s2[s2.length-1];s2.pop(),lt(e,!1)}function lt(e,n){var t,i=sI;if((n?!s0.echoes||s3++&&e===sI:!s3||--s3&&e===sI)||(t=n?le.bind(null,e):ln,sw.call(sv,t)),e!==sI&&(sI=e,i===sB&&(sB.env=li()),sx)){var r=sB.env.Promise,a=e.env;s$.then=a.nthen,r.prototype.then=a.gthen,(i.global||e.global)&&(Object.defineProperty(ow,"Promise",a.PromiseProp),r.all=a.all,r.race=a.race,r.resolve=a.resolve,r.reject=a.reject,a.allSettled&&(r.allSettled=a.allSettled),a.any&&(r.any=a.any))}}function li(){var e=ow.Promise;return sx?{Promise:e,PromiseProp:Object.getOwnPropertyDescriptor(ow,"Promise"),all:e.all,race:e.race,allSettled:e.allSettled,any:e.any,resolve:e.resolve,reject:e.reject,nthen:s$.then,gthen:e.prototype.then}:{}}function lr(e,n,t,i,r){var a=sI;try{return lt(e,!0),n(t,i,r)}finally{lt(a,!1)}}function la(e,n,t,i){return"function"!=typeof e?e:function(){var r,a=sI;t&&s8(),lt(n,!0);try{return e.apply(this,arguments)}finally{lt(a,!1),i&&(r=s7,sw.call(sv,r))}}}function lo(e,n){return function(t,i){return e.call(this,la(t,n),la(i,n))}}-1===(""+sw).indexOf("[native code]")&&(s8=s7=su);let ls="unhandledrejection";function ll(e,n){var t;try{t=n.onuncatched(e)}catch(e){}if(!1!==t)try{var i,r={promise:n,reason:e};if(ow.document&&document.createEvent?((i=document.createEvent("Event")).initEvent(ls,!0,!0),oC(i,r)):ow.CustomEvent&&oC(i=new CustomEvent(ls,{detail:r}),r),i&&ow.dispatchEvent&&(dispatchEvent(i),!ow.PromiseRejectionEvent&&ow.onunhandledrejection))try{ow.onunhandledrejection(i)}catch(e){}o5&&i&&!i.defaultPrevented&&console.warn(`Unhandled rejection: ${e.stack||e}`)}catch(e){}}var lc=sF.reject;let lu="3.2.4",lp=String.fromCharCode(65535),ld=-1/0,lf="Invalid key provided. Keys must be of type string, number, Date or Array<string | number | Date>.",lh="String expected.",lg=[],lm="u">typeof navigator&&/(MSIE|Trident|Edge)/.test(navigator.userAgent),lb=e=>!/(dexie\.js|dexie\.min\.js)/.test(e),ly="__dbnames",l_="readonly",lv="readwrite";function l$(e,n){return e?n?function(){return e.apply(this,arguments)&&n.apply(this,arguments)}:e:n}let lA={type:3,lower:-1/0,lowerOpen:!1,upper:[[]],upperOpen:!1};function lw(e){return"string"!=typeof e||/\./.test(e)?e=>e:n=>(void 0===n[e]&&e in n&&delete(n=oJ(n))[e],n)}class lk{_trans(e,n,t){let i=this._tx||sI.trans,r=this.name;function a(e,t,i){if(!i.schema[r])throw new ss.NotFound("Table "+r+" not part of transaction");return n(i.idbtrans,i)}let o=sY();try{return i&&i.db===this.db?i===sI.trans?i._promise(e,a,t):s6(()=>i._promise(e,a,t),{trans:i,transless:sI.transless||sI}):function e(n,t,i,r){if(n.idbdb&&(n._state.openComplete||sI.letThrough||n._vip)){var a=n._createTransaction(t,i,n._dbSchema);try{a.create(),n._state.PR1398_maxLoop=3}catch(a){return a.name===so.InvalidState&&n.isOpen()&&--n._state.PR1398_maxLoop>0?(console.warn("Dexie: Need to reopen db"),n._close(),n.open().then(()=>e(n,t,i,r))):lc(a)}return a._promise(t,(e,n)=>s6(()=>(sI.trans=a,r(e,n,a)))).then(e=>a._completion.then(()=>e))}if(n._state.openComplete)return lc(new ss.DatabaseClosed(n._state.dbOpenError));if(!n._state.isBeingOpened){if(!n._options.autoOpen)return lc(new ss.DatabaseClosed);n.open().catch(su)}return n._state.dbReadyPromise.then(()=>e(n,t,i,r))}(this.db,e,[this.name],a)}finally{o&&sJ()}}get(e,n){return e&&e.constructor===Object?this.where(e).first(n):this._trans("readonly",n=>this.core.get({trans:n,key:e}).then(e=>this.hook.reading.fire(e))).then(n)}where(e){if("string"==typeof e)return new this.db.WhereClause(this,e);if(ox(e))return new this.db.WhereClause(this,`[${e.join("+")}]`);let n=ok(e);if(1===n.length)return this.where(n[0]).equals(e[n[0]]);let t=this.schema.indexes.concat(this.schema.primKey).filter(e=>e.compound&&n.every(n=>e.keyPath.indexOf(n)>=0)&&e.keyPath.every(e=>n.indexOf(e)>=0))[0];if(t&&this.db._maxKey!==lp)return this.where(t.name).equals(t.keyPath.map(n=>e[n]));!t&&o5&&console.warn(`The query ${JSON.stringify(e)} on ${this.name} would benefit of a compound index [${n.join("+")}]`);let{idxByName:i}=this.schema,r=this.db._deps.indexedDB;function a(e,n){try{return 0===r.cmp(e,n)}catch(e){return!1}}let[o,s]=n.reduce(([n,t],r)=>{let o=i[r],s=e[r];return[n||o,n||!o?l$(t,o&&o.multi?e=>{let n=oW(e,r);return ox(n)&&n.some(e=>a(s,e))}:e=>a(s,oW(e,r))):t]},[null,null]);return o?this.where(o.name).equals(e[o.keyPath]).filter(s):t?this.filter(s):this.where(n).equals("")}filter(e){return this.toCollection().and(e)}count(e){return this.toCollection().count(e)}offset(e){return this.toCollection().offset(e)}limit(e){return this.toCollection().limit(e)}each(e){return this.toCollection().each(e)}toArray(e){return this.toCollection().toArray(e)}toCollection(){return new this.db.Collection(new this.db.WhereClause(this))}orderBy(e){return new this.db.Collection(new this.db.WhereClause(this,ox(e)?`[${e.join("+")}]`:e))}reverse(){return this.toCollection().reverse()}mapToClass(e){this.schema.mappedClass=e;let n=n=>{if(!n)return n;let t=Object.create(e.prototype);for(var i in n)if(oD(n,i))try{t[i]=n[i]}catch(e){}return t};return this.schema.readHook&&this.hook.reading.unsubscribe(this.schema.readHook),this.schema.readHook=n,this.hook("reading",n),e}defineClass(){return this.mapToClass(function(e){oC(this,e)})}add(e,n){let{auto:t,keyPath:i}=this.schema.primKey,r=e;return i&&t&&(r=lw(i)(e)),this._trans("readwrite",e=>this.core.mutate({trans:e,type:"add",keys:null!=n?[n]:null,values:[r]})).then(e=>e.numFailures?sF.reject(e.failures[0]):e.lastResult).then(n=>{if(i)try{oV(e,i,n)}catch(e){}return n})}update(e,n){if("object"!=typeof e||ox(e))return this.where(":id").equals(e).modify(n);{let t=oW(e,this.schema.primKey.keyPath);if(void 0===t)return lc(new ss.InvalidArgument("Given object does not contain its primary key"));try{"function"!=typeof n?ok(n).forEach(t=>{oV(e,t,n[t])}):n(e,{value:e,primKey:t})}catch(e){}return this.where(":id").equals(t).modify(n)}}put(e,n){let{auto:t,keyPath:i}=this.schema.primKey,r=e;return i&&t&&(r=lw(i)(e)),this._trans("readwrite",e=>this.core.mutate({trans:e,type:"put",values:[r],keys:null!=n?[n]:null})).then(e=>e.numFailures?sF.reject(e.failures[0]):e.lastResult).then(n=>{if(i)try{oV(e,i,n)}catch(e){}return n})}delete(e){return this._trans("readwrite",n=>this.core.mutate({trans:n,type:"delete",keys:[e]})).then(e=>e.numFailures?sF.reject(e.failures[0]):void 0)}clear(){return this._trans("readwrite",e=>this.core.mutate({trans:e,type:"deleteRange",range:lA})).then(e=>e.numFailures?sF.reject(e.failures[0]):void 0)}bulkGet(e){return this._trans("readonly",n=>this.core.getMany({keys:e,trans:n}).then(e=>e.map(e=>this.hook.reading.fire(e))))}bulkAdd(e,n,t){let i=Array.isArray(n)?n:void 0,r=(t=t||(i?void 0:n))?t.allKeys:void 0;return this._trans("readwrite",n=>{let{auto:t,keyPath:a}=this.schema.primKey;if(a&&i)throw new ss.InvalidArgument("bulkAdd(): keys argument invalid on tables with inbound keys");if(i&&i.length!==e.length)throw new ss.InvalidArgument("Arguments objects and keys must have the same length");let o=e.length,s=a&&t?e.map(lw(a)):e;return this.core.mutate({trans:n,type:"add",keys:i,values:s,wantResults:r}).then(({numFailures:e,results:n,lastResult:t,failures:i})=>{if(0===e)return r?n:t;throw new sa(`${this.name}.bulkAdd(): ${e} of ${o} operations failed`,i)})})}bulkPut(e,n,t){let i=Array.isArray(n)?n:void 0,r=(t=t||(i?void 0:n))?t.allKeys:void 0;return this._trans("readwrite",n=>{let{auto:t,keyPath:a}=this.schema.primKey;if(a&&i)throw new ss.InvalidArgument("bulkPut(): keys argument invalid on tables with inbound keys");if(i&&i.length!==e.length)throw new ss.InvalidArgument("Arguments objects and keys must have the same length");let o=e.length,s=a&&t?e.map(lw(a)):e;return this.core.mutate({trans:n,type:"put",keys:i,values:s,wantResults:r}).then(({numFailures:e,results:n,lastResult:t,failures:i})=>{if(0===e)return r?n:t;throw new sa(`${this.name}.bulkPut(): ${e} of ${o} operations failed`,i)})})}bulkDelete(e){let n=e.length;return this._trans("readwrite",n=>this.core.mutate({trans:n,type:"delete",keys:e})).then(({numFailures:e,lastResult:t,failures:i})=>{if(0===e)return t;throw new sa(`${this.name}.bulkDelete(): ${e} of ${n} operations failed`,i)})}}function lx(e){var n={},t=function(t,i){if(i){for(var r=arguments.length,a=Array(r-1);--r;)a[r-1]=arguments[r];return n[t].subscribe.apply(null,a),e}if("string"==typeof t)return n[t]};t.addEventType=a;for(var i=1,r=arguments.length;i<r;++i)a(arguments[i]);return t;function a(e,i,r){if("object"!=typeof e){i||(i=sb),r||(r=su);var o={subscribers:[],fire:r,subscribe:function(e){-1===o.subscribers.indexOf(e)&&(o.subscribers.push(e),o.fire=i(o.fire,e))},unsubscribe:function(e){o.subscribers=o.subscribers.filter(function(n){return n!==e}),o.fire=o.subscribers.reduce(i,r)}};return n[e]=t[e]=o,o}ok(e).forEach(function(n){var t=e[n];if(ox(t))a(n,e[n][0],e[n][1]);else{if("asap"!==t)throw new ss.InvalidArgument("Invalid event config");var i=a(n,sp,function(){for(var e=arguments.length,n=Array(e);e--;)n[e]=arguments[e];i.subscribers.forEach(function(e){oF(function(){e.apply(null,n)})})})}})}}function lC(e,n){return oP(n).from({prototype:e}),n}function lE(e,n){return!(e.filter||e.algorithm||e.or)&&(n?e.justLimit:!e.replayFilter)}function lS(e,n){e.filter=l$(e.filter,n)}function lD(e,n,t){var i=e.replayFilter;e.replayFilter=i?()=>l$(i(),n()):n,e.justLimit=t&&!i}function lM(e,n){if(e.isPrimKey)return n.primaryKey;let t=n.getIndexByKeyPath(e.index);if(!t)throw new ss.Schema("KeyPath "+e.index+" on object store "+n.name+" is not indexed");return t}function lz(e,n,t){let i=lM(e,n.schema);return n.openCursor({trans:t,values:!e.keysOnly,reverse:"prev"===e.dir,unique:!!e.unique,query:{index:i,range:e.range}})}function lO(e,n,t,i){let r=e.replayFilter?l$(e.filter,e.replayFilter()):e.filter;if(e.or){let a={},o=(e,t,i)=>{if(!r||r(t,i,e=>t.stop(e),e=>t.fail(e))){var o=t.primaryKey,s=""+o;"[object ArrayBuffer]"===s&&(s=""+new Uint8Array(o)),oD(a,s)||(a[s]=!0,n(e,t,i))}};return Promise.all([e.or._iterate(o,t),lP(lz(e,i,t),e.algorithm,o,!e.keysOnly&&e.valueMapper)])}return lP(lz(e,i,t),l$(e.algorithm,r),n,!e.keysOnly&&e.valueMapper)}function lP(e,n,t,i){var r=sQ(i?(e,n,r)=>t(i(e),n,r):t);return e.then(e=>{if(e)return e.start(()=>{var t=()=>e.continue();n&&!n(e,e=>t=e,n=>{e.stop(n),t=su},n=>{e.fail(n),t=su})||r(e.value,e,e=>t=e),t()})})}function lT(e,n){try{let t=lB(e),i=lB(n);if(t!==i)return"Array"===t?1:"Array"===i?-1:"binary"===t?1:"binary"===i?-1:"string"===t?1:"string"===i?-1:"Date"===t?1:"Date"!==i?NaN:-1;switch(t){case"number":case"Date":case"string":return e>n?1:e<n?-1:0;case"binary":return function(e,n){let t=e.length,i=n.length,r=t<i?t:i;for(let t=0;t<r;++t)if(e[t]!==n[t])return e[t]<n[t]?-1:1;return t===i?0:t<i?-1:1}(lI(e),lI(n));case"Array":return function(e,n){let t=e.length,i=n.length,r=t<i?t:i;for(let t=0;t<r;++t){let i=lT(e[t],n[t]);if(0!==i)return i}return t===i?0:t<i?-1:1}(e,n)}}catch(e){}return NaN}function lB(e){let n=typeof e;if("object"!==n)return n;if(ArrayBuffer.isView(e))return"binary";let t=oX(e);return"ArrayBuffer"===t?"binary":t}function lI(e){return e instanceof Uint8Array?e:ArrayBuffer.isView(e)?new Uint8Array(e.buffer,e.byteOffset,e.byteLength):new Uint8Array(e)}class lN{_read(e,n){var t=this._ctx;return t.error?t.table._trans(null,lc.bind(null,t.error)):t.table._trans("readonly",e).then(n)}_write(e){var n=this._ctx;return n.error?n.table._trans(null,lc.bind(null,n.error)):n.table._trans("readwrite",e,"locked")}_addAlgorithm(e){var n=this._ctx;n.algorithm=l$(n.algorithm,e)}_iterate(e,n){return lO(this._ctx,e,n,this._ctx.table.core)}clone(e){var n=Object.create(this.constructor.prototype),t=Object.create(this._ctx);return e&&oC(t,e),n._ctx=t,n}raw(){return this._ctx.valueMapper=null,this}each(e){var n=this._ctx;return this._read(t=>lO(n,e,t,n.table.core))}count(e){return this._read(e=>{let n=this._ctx,t=n.table.core;if(lE(n,!0))return t.count({trans:e,query:{index:lM(n,t.schema),range:n.range}}).then(e=>Math.min(e,n.limit));var i=0;return lO(n,()=>(++i,!1),e,t).then(()=>i)}).then(e)}sortBy(e,n){let t=e.split(".").reverse(),i=t[0],r=t.length-1;function a(e,n){return n?a(e[t[n]],n-1):e[i]}var o="next"===this._ctx.dir?1:-1;function s(e,n){var t=a(e,r),i=a(n,r);return t<i?-o:t>i?o:0}return this.toArray(function(e){return e.sort(s)}).then(n)}toArray(e){return this._read(e=>{var n=this._ctx;if("next"===n.dir&&lE(n,!0)&&n.limit>0){let{valueMapper:t}=n,i=lM(n,n.table.core.schema);return n.table.core.query({trans:e,limit:n.limit,values:!0,query:{index:i,range:n.range}}).then(({result:e})=>t?e.map(t):e)}{let t=[];return lO(n,e=>t.push(e),e,n.table.core).then(()=>t)}},e)}offset(e){var n=this._ctx;return e<=0||(n.offset+=e,lE(n)?lD(n,()=>{var n=e;return(e,t)=>0===n||(1===n?--n:t(()=>{e.advance(n),n=0}),!1)}):lD(n,()=>{var n=e;return()=>--n<0})),this}limit(e){return this._ctx.limit=Math.min(this._ctx.limit,e),lD(this._ctx,()=>{var n=e;return function(e,t,i){return--n<=0&&t(i),n>=0}},!0),this}until(e,n){return lS(this._ctx,function(t,i,r){return!e(t.value)||(i(r),n)}),this}first(e){return this.limit(1).toArray(function(e){return e[0]}).then(e)}last(e){return this.reverse().first(e)}filter(e){var n;return lS(this._ctx,function(n){return e(n.value)}),(n=this._ctx).isMatch=l$(n.isMatch,e),this}and(e){return this.filter(e)}or(e){return new this.db.WhereClause(this._ctx.table,e,this)}reverse(){return this._ctx.dir="prev"===this._ctx.dir?"next":"prev",this._ondirectionchange&&this._ondirectionchange(this._ctx.dir),this}desc(){return this.reverse()}eachKey(e){var n=this._ctx;return n.keysOnly=!n.isMatch,this.each(function(n,t){e(t.key,t)})}eachUniqueKey(e){return this._ctx.unique="unique",this.eachKey(e)}eachPrimaryKey(e){var n=this._ctx;return n.keysOnly=!n.isMatch,this.each(function(n,t){e(t.primaryKey,t)})}keys(e){var n=this._ctx;n.keysOnly=!n.isMatch;var t=[];return this.each(function(e,n){t.push(n.key)}).then(function(){return t}).then(e)}primaryKeys(e){var n=this._ctx;if("next"===n.dir&&lE(n,!0)&&n.limit>0)return this._read(e=>{var t=lM(n,n.table.core.schema);return n.table.core.query({trans:e,values:!1,limit:n.limit,query:{index:t,range:n.range}})}).then(({result:e})=>e).then(e);n.keysOnly=!n.isMatch;var t=[];return this.each(function(e,n){t.push(n.primaryKey)}).then(function(){return t}).then(e)}uniqueKeys(e){return this._ctx.unique="unique",this.keys(e)}firstKey(e){return this.limit(1).keys(function(e){return e[0]}).then(e)}lastKey(e){return this.reverse().firstKey(e)}distinct(){var e=this._ctx,n=e.index&&e.table.schema.idxByName[e.index];if(!n||!n.multi)return this;var t={};return lS(this._ctx,function(e){var n=e.primaryKey.toString(),i=oD(t,n);return t[n]=!0,!i}),this}modify(e){var n=this._ctx;return this._write(t=>{var i;if("function"==typeof e)i=e;else{var r=ok(e),a=r.length;i=function(n){for(var t=!1,i=0;i<a;++i){var o=r[i],s=e[o];oW(n,o)!==s&&(oV(n,o,s),t=!0)}return t}}let o=n.table.core,{outbound:s,extractKey:l}=o.schema.primaryKey,c=this.db._options.modifyChunkSize||200,u=[],p=0,d=[],f=(e,n)=>{let{failures:t,numFailures:i}=n;for(let n of(p+=e-i,ok(t)))u.push(t[n])};return this.clone().primaryKeys().then(r=>{let a=u=>{let p=Math.min(c,r.length-u);return o.getMany({trans:t,keys:r.slice(u,u+p),cache:"immutable"}).then(d=>{let h=[],g=[],m=s?[]:null,b=[];for(let e=0;e<p;++e){let n=d[e],t={value:oJ(n),primKey:r[u+e]};!1!==i.call(t,t.value,t)&&(null==t.value?b.push(r[u+e]):s||0===lT(l(n),l(t.value))?(g.push(t.value),s&&m.push(r[u+e])):(b.push(r[u+e]),h.push(t.value)))}let y=lE(n)&&n.limit===1/0&&("function"!=typeof e||e===lj)&&{index:n.index,range:n.range};return Promise.resolve(h.length>0&&o.mutate({trans:t,type:"add",values:h}).then(e=>{for(let n in e.failures)b.splice(parseInt(n),1);f(h.length,e)})).then(()=>(g.length>0||y&&"object"==typeof e)&&o.mutate({trans:t,type:"put",keys:m,values:g,criteria:y,changeSpec:"function"!=typeof e&&e}).then(e=>f(g.length,e))).then(()=>(b.length>0||y&&e===lj)&&o.mutate({trans:t,type:"delete",keys:b,criteria:y}).then(e=>f(b.length,e))).then(()=>r.length>u+p&&a(u+c))})};return a(0).then(()=>{if(u.length>0)throw new sr("Error modifying one or more objects",u,p,d);return r.length})})})}delete(){var e=this._ctx,n=e.range;return lE(e)&&(e.isPrimKey&&!lm||3===n.type)?this._write(t=>{let{primaryKey:i}=e.table.core.schema;return e.table.core.count({trans:t,query:{index:i,range:n}}).then(i=>e.table.core.mutate({trans:t,type:"deleteRange",range:n}).then(({failures:e,lastResult:n,results:t,numFailures:r})=>{if(r)throw new sr("Could not delete some values",Object.keys(e).map(n=>e[n]),i-r);return i-r}))}):this.modify(lj)}}let lj=(e,n)=>n.value=null;function lR(e,n){return e<n?-1:+(e!==n)}function lF(e,n){return e>n?-1:+(e!==n)}function lL(e,n,t){var i=e instanceof lH?new e.Collection(e):e;return i._ctx.error=t?new t(n):TypeError(n),i}function lW(e){return new e.Collection(e,()=>lU("")).limit(0)}function lV(e,n,t,i){var r,a,o,s,l,c,u,p=t.length;if(!t.every(e=>"string"==typeof e))return lL(e,lh);function d(e){r="next"===e?e=>e.toUpperCase():e=>e.toLowerCase(),a="next"===e?e=>e.toLowerCase():e=>e.toUpperCase(),o="next"===e?lR:lF;var n=t.map(function(e){return{lower:a(e),upper:r(e)}}).sort(function(e,n){return o(e.lower,n.lower)});s=n.map(function(e){return e.upper}),l=n.map(function(e){return e.lower}),c=e,u="next"===e?"":i}d("next");var f=new e.Collection(e,()=>lG(s[0],l[p-1]+i));f._ondirectionchange=function(e){d(e)};var h=0;return f._addAlgorithm(function(e,t,i){var r=e.key;if("string"!=typeof r)return!1;var d=a(r);if(n(d,l,h))return!0;for(var f=null,g=h;g<p;++g){var m=function(e,n,t,i,r,a){for(var o=Math.min(e.length,i.length),s=-1,l=0;l<o;++l){var c=n[l];if(c!==i[l])return 0>r(e[l],t[l])?e.substr(0,l)+t[l]+t.substr(l+1):0>r(e[l],i[l])?e.substr(0,l)+i[l]+t.substr(l+1):s>=0?e.substr(0,s)+n[s]+t.substr(s+1):null;0>r(e[l],c)&&(s=l)}return o<i.length&&"next"===a?e+t.substr(e.length):o<e.length&&"prev"===a?e.substr(0,t.length):s<0?null:e.substr(0,s)+i[s]+t.substr(s+1)}(r,d,s[g],l[g],o,c);null===m&&null===f?h=g+1:(null===f||o(f,m)>0)&&(f=m)}return t(null!==f?function(){e.continue(f+u)}:i),!1}),f}function lG(e,n,t,i){return{type:2,lower:e,upper:n,lowerOpen:t,upperOpen:i}}function lU(e){return{type:1,lower:e,upper:e}}class lH{get Collection(){return this._ctx.table.db.Collection}between(e,n,t,i){t=!1!==t,i=!0===i;try{return this._cmp(e,n)>0||0===this._cmp(e,n)&&(t||i)&&(!t||!i)?lW(this):new this.Collection(this,()=>lG(e,n,!t,!i))}catch(e){return lL(this,lf)}}equals(e){return null==e?lL(this,lf):new this.Collection(this,()=>lU(e))}above(e){return null==e?lL(this,lf):new this.Collection(this,()=>lG(e,void 0,!0))}aboveOrEqual(e){return null==e?lL(this,lf):new this.Collection(this,()=>lG(e,void 0,!1))}below(e){return null==e?lL(this,lf):new this.Collection(this,()=>lG(void 0,e,!1,!0))}belowOrEqual(e){return null==e?lL(this,lf):new this.Collection(this,()=>lG(void 0,e))}startsWith(e){return"string"!=typeof e?lL(this,lh):this.between(e,e+lp,!0,!0)}startsWithIgnoreCase(e){return""===e?this.startsWith(e):lV(this,(e,n)=>0===e.indexOf(n[0]),[e],lp)}equalsIgnoreCase(e){return lV(this,(e,n)=>e===n[0],[e],"")}anyOfIgnoreCase(){var e=o2.apply(o1,arguments);return 0===e.length?lW(this):lV(this,(e,n)=>-1!==n.indexOf(e),e,"")}startsWithAnyOfIgnoreCase(){var e=o2.apply(o1,arguments);return 0===e.length?lW(this):lV(this,(e,n)=>n.some(n=>0===e.indexOf(n)),e,lp)}anyOf(){let e=o2.apply(o1,arguments),n=this._cmp;try{e.sort(n)}catch(e){return lL(this,lf)}if(0===e.length)return lW(this);let t=new this.Collection(this,()=>lG(e[0],e[e.length-1]));t._ondirectionchange=t=>{n="next"===t?this._ascending:this._descending,e.sort(n)};let i=0;return t._addAlgorithm((t,r,a)=>{let o=t.key;for(;n(o,e[i])>0;)if(++i===e.length)return r(a),!1;return 0===n(o,e[i])||(r(()=>{t.continue(e[i])}),!1)}),t}notEqual(e){return this.inAnyRange([[ld,e],[e,this.db._maxKey]],{includeLowers:!1,includeUppers:!1})}noneOf(){let e=o2.apply(o1,arguments);if(0===e.length)return new this.Collection(this);try{e.sort(this._ascending)}catch(e){return lL(this,lf)}let n=e.reduce((e,n)=>e?e.concat([[e[e.length-1][1],n]]):[[ld,n]],null);return n.push([e[e.length-1],this.db._maxKey]),this.inAnyRange(n,{includeLowers:!1,includeUppers:!1})}inAnyRange(e,n){let t=this._cmp,i=this._ascending,r=this._descending,a=this._min,o=this._max;if(0===e.length)return lW(this);if(!e.every(e=>void 0!==e[0]&&void 0!==e[1]&&0>=i(e[0],e[1])))return lL(this,"First argument to inAnyRange() must be an Array of two-value Arrays [lower,upper] where upper must not be lower than lower",ss.InvalidArgument);let s=!n||!1!==n.includeLowers,l=n&&!0===n.includeUppers,c,u=i;function p(e,n){return u(e[0],n[0])}try{(c=e.reduce(function(e,n){let i=0,r=e.length;for(;i<r;++i){let r=e[i];if(0>t(n[0],r[1])&&t(n[1],r[0])>0){r[0]=a(r[0],n[0]),r[1]=o(r[1],n[1]);break}}return i===r&&e.push(n),e},[])).sort(p)}catch(e){return lL(this,lf)}let d=0,f=l?e=>i(e,c[d][1])>0:e=>i(e,c[d][1])>=0,h=s?e=>r(e,c[d][0])>0:e=>r(e,c[d][0])>=0,g=f,m=new this.Collection(this,()=>lG(c[0][0],c[c.length-1][1],!s,!l));return m._ondirectionchange=e=>{"next"===e?(g=f,u=i):(g=h,u=r),c.sort(p)},m._addAlgorithm((e,n,t)=>{for(var r=e.key;g(r);)if(++d===c.length)return n(t),!1;return!!(!f(r)&&!h(r))||(0===this._cmp(r,c[d][1])||0===this._cmp(r,c[d][0])||n(()=>{u===i?e.continue(c[d][0]):e.continue(c[d][1])}),!1)}),m}startsWithAnyOf(){let e=o2.apply(o1,arguments);return e.every(e=>"string"==typeof e)?0===e.length?lW(this):this.inAnyRange(e.map(e=>[e,e+lp])):lL(this,"startsWithAnyOf() only works with strings")}}function lq(e){return sQ(function(n){return lK(n),e(n.target.error),!1})}function lK(e){e.stopPropagation&&e.stopPropagation(),e.preventDefault&&e.preventDefault()}let lY="storagemutated",lJ="x-storagemutated-1",lZ=lx(null,lY);class lX{_lock(){return oR(!sI.global),++this._reculock,1!==this._reculock||sI.global||(sI.lockOwnerFor=this),this}_unlock(){if(oR(!sI.global),0==--this._reculock)for(sI.global||(sI.lockOwnerFor=null);this._blockedFuncs.length>0&&!this._locked();){var e=this._blockedFuncs.shift();try{lr(e[1],e[0])}catch(e){}}return this}_locked(){return this._reculock&&sI.lockOwnerFor!==this}create(e){if(!this.mode)return this;let n=this.db.idbdb,t=this.db._state.dbOpenError;if(oR(!this.idbtrans),!e&&!n)switch(t&&t.name){case"DatabaseClosedError":throw new ss.DatabaseClosed(t);case"MissingAPIError":throw new ss.MissingAPI(t.message,t);default:throw new ss.OpenFailed(t)}if(!this.active)throw new ss.TransactionInactive;return oR(null===this._completion._state),(e=this.idbtrans=e||(this.db.core?this.db.core.transaction(this.storeNames,this.mode,{durability:this.chromeTransactionDurability}):n.transaction(this.storeNames,this.mode,{durability:this.chromeTransactionDurability}))).onerror=sQ(n=>{lK(n),this._reject(e.error)}),e.onabort=sQ(n=>{lK(n),this.active&&this._reject(new ss.Abort(e.error)),this.active=!1,this.on("abort").fire(n)}),e.oncomplete=sQ(()=>{this.active=!1,this._resolve(),"mutatedParts"in e&&lZ.storagemutated.fire(e.mutatedParts)}),this}_promise(e,n,t){if("readwrite"===e&&"readwrite"!==this.mode)return lc(new ss.ReadOnly("Transaction is readonly"));if(!this.active)return lc(new ss.TransactionInactive);if(this._locked())return new sF((i,r)=>{this._blockedFuncs.push([()=>{this._promise(e,n,t).then(i,r)},sI])});if(t)return s6(()=>{var e=new sF((e,t)=>{this._lock();let i=n(e,t,this);i&&i.then&&i.then(e,t)});return e.finally(()=>this._unlock()),e._lib=!0,e});var i=new sF((e,t)=>{var i=n(e,t,this);i&&i.then&&i.then(e,t)});return i._lib=!0,i}_root(){return this.parent?this.parent._root():this}waitFor(e){var n=this._root();let t=sF.resolve(e);if(n._waitingFor)n._waitingFor=n._waitingFor.then(()=>t);else{n._waitingFor=t,n._waitingQueue=[];var i=n.idbtrans.objectStore(n.storeNames[0]);!function e(){for(++n._spinCount;n._waitingQueue.length;)n._waitingQueue.shift()();n._waitingFor&&(i.get(-1/0).onsuccess=e)}()}var r=n._waitingFor;return new sF((e,i)=>{t.then(t=>n._waitingQueue.push(sQ(e.bind(null,t))),e=>n._waitingQueue.push(sQ(i.bind(null,e)))).finally(()=>{n._waitingFor===r&&(n._waitingFor=null)})})}abort(){this.active&&(this.active=!1,this.idbtrans&&this.idbtrans.abort(),this._reject(new ss.Abort))}table(e){let n=this._memoizedTables||(this._memoizedTables={});if(oD(n,e))return n[e];let t=this.schema[e];if(!t)throw new ss.NotFound("Table "+e+" not part of transaction");let i=new this.db.Table(e,t,this);return i.core=this.db.core.table(e),n[e]=i,i}}function lQ(e,n,t,i,r,a,o){return{name:e,keyPath:n,unique:t,multi:i,auto:r,compound:a,src:(t&&!o?"&":"")+(i?"*":"")+(r?"++":"")+l0(n)}}function l0(e){return"string"==typeof e?e:e?"["+[].join.call(e,"+")+"]":""}function l1(e,n,t){return{name:e,primKey:n,indexes:t,mappedClass:null,idxByName:oL(t,e=>[e.name,e])}}let l2=e=>{try{return e.only([[]]),l2=()=>[[]],[[]]}catch(e){return l2=()=>lp,lp}};function l3(e){return null==e?()=>{}:"string"==typeof e?1===e.split(".").length?n=>n[e]:n=>oW(n,e):n=>oW(n,e)}function l5(e){return[].slice.call(e)}let l4=0;function l6(e){return null==e?":id":"string"==typeof e?e:`[${e.join("+")}]`}function l8({_novip:e},n){let t=n.db,i=function(e,n,{IDBKeyRange:t,indexedDB:i},r){var a;return{dbcore:(a=function(e,n,t){let i;function r(e){if(3===e.type)return null;if(4===e.type)throw Error("Cannot convert never type to IDBKeyRange");let{lower:t,upper:i,lowerOpen:r,upperOpen:a}=e;return void 0===t?void 0===i?null:n.upperBound(i,!!a):void 0===i?n.lowerBound(t,!!r):n.bound(t,i,!!r,!!a)}let{schema:a,hasGetAll:o}=(i=l5(e.objectStoreNames),{schema:{name:e.name,tables:i.map(e=>t.objectStore(e)).map(e=>{let{keyPath:n,autoIncrement:t}=e,i=ox(n),r=null==n,a={},o={name:e.name,primaryKey:{name:null,isPrimaryKey:!0,outbound:r,compound:i,keyPath:n,autoIncrement:t,unique:!0,extractKey:l3(n)},indexes:l5(e.indexNames).map(n=>e.index(n)).map(e=>{let{name:n,unique:t,multiEntry:i,keyPath:r}=e,o={name:n,compound:ox(r),keyPath:r,unique:t,multiEntry:i,extractKey:l3(r)};return a[l6(r)]=o,o}),getIndexByKeyPath:e=>a[l6(e)]};return a[":id"]=o.primaryKey,null!=n&&(a[l6(n)]=o.primaryKey),o})},hasGetAll:i.length>0&&"getAll"in t.objectStore(i[0])&&!("u">typeof navigator&&/Safari/.test(navigator.userAgent)&&!/(Chrome\/|Edge\/)/.test(navigator.userAgent)&&[].concat(navigator.userAgent.match(/Safari\/(\d*)/))[1]<604)}),s=a.tables.map(e=>{let n;return{name:n=e.name,schema:e,mutate:function({trans:e,type:t,keys:i,values:a,range:o}){return new Promise((s,l)=>{let c;s=sQ(s);let u=e.objectStore(n),p=null==u.keyPath,d="put"===t||"add"===t;if(!d&&"delete"!==t&&"deleteRange"!==t)throw Error("Invalid operation type: "+t);let{length:f}=i||a||{length:1};if(i&&a&&i.length!==a.length)throw Error("Given keys array must have same length as given values array.");if(0===f)return s({numFailures:0,failures:{},results:[],lastResult:void 0});let h=[],g=[],m=0,b=e=>{++m,lK(e)};if("deleteRange"===t){if(4===o.type)return s({numFailures:m,failures:g,results:[],lastResult:void 0});3===o.type?h.push(c=u.clear()):h.push(c=u.delete(r(o)))}else{let[e,n]=d?p?[a,i]:[a,null]:[i,null];if(d)for(let i=0;i<f;++i)h.push(c=n&&void 0!==n[i]?u[t](e[i],n[i]):u[t](e[i])),c.onerror=b;else for(let n=0;n<f;++n)h.push(c=u[t](e[n])),c.onerror=b}let y=e=>{let n=e.target.result;h.forEach((e,n)=>null!=e.error&&(g[n]=e.error)),s({numFailures:m,failures:g,results:"delete"===t?i:h.map(e=>e.result),lastResult:n})};c.onerror=e=>{b(e),y(e)},c.onsuccess=y})},getMany:({trans:e,keys:t})=>new Promise((i,r)=>{i=sQ(i);let a=e.objectStore(n),o=t.length,s=Array(o),l,c=0,u=0,p=e=>{let n=e.target;s[n._pos]=n.result,++u===c&&i(s)},d=lq(r);for(let e=0;e<o;++e)null!=t[e]&&((l=a.get(t[e]))._pos=e,l.onsuccess=p,l.onerror=d,++c);0===c&&i(s)}),get:({trans:e,key:t})=>new Promise((i,r)=>{i=sQ(i);let a=e.objectStore(n).get(t);a.onsuccess=e=>i(e.target.result),a.onerror=lq(r)}),query:e=>new Promise((t,i)=>{t=sQ(t);let{trans:a,values:s,limit:l,query:c}=e,u=l===1/0?void 0:l,{index:p,range:d}=c,f=a.objectStore(n),h=p.isPrimaryKey?f:f.index(p.name),g=r(d);if(0===l)return t({result:[]});if(o){let e=s?h.getAll(g,u):h.getAllKeys(g,u);e.onsuccess=e=>t({result:e.target.result}),e.onerror=lq(i)}else{let e=0,n=!s&&"openKeyCursor"in h?h.openKeyCursor(g):h.openCursor(g),r=[];n.onsuccess=i=>{let a=n.result;return a?(r.push(s?a.value:a.primaryKey),++e===l?t({result:r}):void a.continue()):t({result:r})},n.onerror=lq(i)}}),openCursor:function({trans:e,values:t,query:i,reverse:a,unique:o}){return new Promise((s,l)=>{s=sQ(s);let{index:c,range:u}=i,p=e.objectStore(n),d=c.isPrimaryKey?p:p.index(c.name),f=a?o?"prevunique":"prev":o?"nextunique":"next",h=!t&&"openKeyCursor"in d?d.openKeyCursor(r(u),f):d.openCursor(r(u),f);h.onerror=lq(l),h.onsuccess=sQ(n=>{let t=h.result;if(!t)return void s(null);t.___id=++l4,t.done=!1;let i=t.continue.bind(t),r=t.continuePrimaryKey;r&&(r=r.bind(t));let a=t.advance.bind(t),o=()=>{throw Error("Cursor not stopped")};t.trans=e,t.stop=t.continue=t.continuePrimaryKey=t.advance=()=>{throw Error("Cursor not started")},t.fail=sQ(l),t.next=function(){let e=1;return this.start(()=>e--?this.continue():this.stop()).then(()=>this)},t.start=e=>{let n=new Promise((e,n)=>{e=sQ(e),h.onerror=lq(n),t.fail=n,t.stop=n=>{t.stop=t.continue=t.continuePrimaryKey=t.advance=o,e(n)}}),s=()=>{if(h.result)try{e()}catch(e){t.fail(e)}else t.done=!0,t.start=()=>{throw Error("Cursor behind last entry")},t.stop()};return h.onsuccess=sQ(e=>{h.onsuccess=s,s()}),t.continue=i,t.continuePrimaryKey=r,t.advance=a,s(),n},s(t)},l)})},count({query:e,trans:t}){let{index:i,range:a}=e;return new Promise((e,o)=>{let s=t.objectStore(n),l=i.isPrimaryKey?s:s.index(i.name),c=r(a),u=c?l.count(c):l.count();u.onsuccess=sQ(n=>e(n.target.result)),u.onerror=lq(o)})}}}),l={};return s.forEach(e=>l[e.name]=e),{stack:"dbcore",transaction:e.transaction.bind(e),table(e){if(!l[e])throw Error(`Table '${e}' not found`);return l[e]},MIN_KEY:-1/0,MAX_KEY:l2(n),schema:a}}(n,t,r),e.dbcore.reduce((e,{create:n})=>({...e,...n(e)}),a))}}(e._middlewares,t,e._deps,n);e.core=i.dbcore,e.tables.forEach(n=>{let t=n.name;e.core.schema.tables.some(e=>e.name===t)&&(n.core=e.core.table(t),e[t]instanceof e.Table&&(e[t].core=n.core))})}function l7({_novip:e},n,t,i){t.forEach(t=>{let r=i[t];n.forEach(n=>{let i=oB(n,t);(!i||"value"in i&&void 0===i.value)&&(n===e.Transaction.prototype||n instanceof e.Transaction?oO(n,t,{get(){return this.table(t)},set(e){oz(this,t,{value:e,writable:!0,configurable:!0,enumerable:!0})}}):n[t]=new e.Table(t,r))})})}function l9({_novip:e},n){n.forEach(n=>{for(let t in n)n[t]instanceof e.Table&&delete n[t]})}function ce(e,n){return e._cfg.version-n._cfg.version}function cn(e,n){let t,i={del:[],add:[],change:[]};for(t in e)n[t]||i.del.push(t);for(t in n){let r=e[t],a=n[t];if(r){let e={name:t,def:a,recreate:!1,del:[],add:[],change:[]};if(""+(r.primKey.keyPath||"")==""+(a.primKey.keyPath||"")&&(r.primKey.auto===a.primKey.auto||lm)){let n,t=r.idxByName,o=a.idxByName;for(n in t)o[n]||e.del.push(n);for(n in o){let i=t[n],r=o[n];i?i.src!==r.src&&e.change.push(r):e.add.push(r)}(e.del.length>0||e.add.length>0||e.change.length>0)&&i.change.push(e)}else e.recreate=!0,i.change.push(e)}else i.add.push([t,a])}return i}function ct(e,n,t,i){let r=e.db.createObjectStore(n,t.keyPath?{keyPath:t.keyPath,autoIncrement:t.auto}:{autoIncrement:t.auto});return i.forEach(e=>ci(r,e)),r}function ci(e,n){e.createIndex(n.name,n.keyPath,{unique:n.unique,multiEntry:n.multi})}function cr(e,n,t){let i={};return oN(n.objectStoreNames,0).forEach(e=>{let n=t.objectStore(e),r=n.keyPath,a=lQ(l0(r),r||"",!1,!1,!!n.autoIncrement,r&&"string"!=typeof r,!0),o=[];for(let e=0;e<n.indexNames.length;++e){let t=n.index(n.indexNames[e]);r=t.keyPath;var s=lQ(t.name,r,!!t.unique,!!t.multiEntry,!1,r&&"string"!=typeof r,!1);o.push(s)}i[e]=l1(e,a,o)}),i}function ca({_novip:e},n,t){let i=t.db.objectStoreNames;for(let r=0;r<i.length;++r){let a=i[r],o=t.objectStore(a);e._hasGetAll="getAll"in o;for(let e=0;e<o.indexNames.length;++e){let t=o.indexNames[e],i=o.index(t).keyPath,r="string"==typeof i?i:"["+oN(i).join("+")+"]";if(n[a]){let e=n[a].idxByName[r];e&&(e.name=t,delete n[a].idxByName[r],n[a].idxByName[t]=e)}}}"u">typeof navigator&&/Safari/.test(navigator.userAgent)&&!/(Chrome\/|Edge\/)/.test(navigator.userAgent)&&ow.WorkerGlobalScope&&ow instanceof ow.WorkerGlobalScope&&[].concat(navigator.userAgent.match(/Safari\/(\d*)/))[1]<604&&(e._hasGetAll=!1)}class co{_parseStoresSpec(e,n){ok(e).forEach(t=>{if(null!==e[t]){var i=e[t].split(",").map((e,n)=>{let t=(e=e.trim()).replace(/([&*]|\+\+)/g,""),i=/^\[/.test(t)?t.match(/^\[(.*)\]$/)[1].split("+"):t;return lQ(t,i||null,/\&/.test(e),/\*/.test(e),/\+\+/.test(e),ox(i),0===n)}),r=i.shift();if(r.multi)throw new ss.Schema("Primary key cannot be multi-valued");i.forEach(e=>{if(e.auto)throw new ss.Schema("Only primary key can be marked as autoIncrement (++)");if(!e.keyPath)throw new ss.Schema("Index must have a name and cannot be an empty string")}),n[t]=l1(t,r,i)}})}stores(e){let n=this.db;this._cfg.storesSource=this._cfg.storesSource?oC(this._cfg.storesSource,e):e;let t=n._versions,i={},r={};return t.forEach(e=>{oC(i,e._cfg.storesSource),r=e._cfg.dbschema={},e._parseStoresSpec(i,r)}),n._dbSchema=r,l9(n,[n._allTables,n,n.Transaction.prototype]),l7(n,[n._allTables,n,n.Transaction.prototype,this._cfg.tables],ok(r),r),n._storeNames=ok(r),this}upgrade(e){return this._cfg.contentUpgrade=sy(this._cfg.contentUpgrade||su,e),this}}function cs(e,n){let t=e._dbNamesDB;return t||(t=e._dbNamesDB=new cC(ly,{addons:[],indexedDB:e,IDBKeyRange:n})).version(1).stores({dbnames:"name"}),t.table("dbnames")}function cl(e){return e&&"function"==typeof e.databases}function cc(e){return s6(function(){return sI.letThrough=!0,e()})}function cu(e){var n=n=>e.next(n),t=r(n),i=r(n=>e.throw(n));function r(e){return n=>{var r=e(n),a=r.value;return r.done?a:a&&"function"==typeof a.then?a.then(t,i):ox(a)?Promise.all(a).then(t,i):t(a)}}return r(n)()}function cp(e,n,t){var i=arguments.length;if(i<2)throw new ss.InvalidArgument("Too few arguments");for(var r=Array(i-1);--i;)r[i-1]=arguments[i];return t=r.pop(),[e,oH(r),t]}function cd(e,n,t){let i=ox(e)?e.slice():[e];for(let e=0;e<t;++e)i.push(n);return i}let cf={stack:"dbcore",name:"VirtualIndexMiddleware",level:1,create:function(e){return{...e,table(n){let t=e.table(n),{schema:i}=t,r={},a=[];function o(e,n,t){let i=l6(e),s=r[i]=r[i]||[],l=null==e?0:"string"==typeof e?1:e.length,c=n>0,u={...t,isVirtual:c,keyTail:n,keyLength:l,extractKey:l3(e),unique:!c&&t.unique};return s.push(u),u.isPrimaryKey||a.push(u),l>1&&o(2===l?e[0]:e.slice(0,l-1),n+1,t),s.sort((e,n)=>e.keyTail-n.keyTail),u}let s=o(i.primaryKey.keyPath,0,i.primaryKey);for(let e of(r[":id"]=[s],i.indexes))o(e.keyPath,0,e);function l(n){var t,i;let r=n.query.index;return r.isVirtual?{...n,query:{index:r,range:(t=n.query.range,i=r.keyTail,{type:1===t.type?2:t.type,lower:cd(t.lower,t.lowerOpen?e.MAX_KEY:e.MIN_KEY,i),lowerOpen:!0,upper:cd(t.upper,t.upperOpen?e.MIN_KEY:e.MAX_KEY,i),upperOpen:!0})}}:n}return{...t,schema:{...i,primaryKey:s,indexes:a,getIndexByKeyPath:function(e){let n=r[l6(e)];return n&&n[0]}},count:e=>t.count(l(e)),query:e=>t.query(l(e)),openCursor(n){let{keyTail:i,isVirtual:r,keyLength:a}=n.query.index;return r?t.openCursor(l(n)).then(t=>t&&Object.create(t,{continue:{value:function(r){null!=r?t.continue(cd(r,n.reverse?e.MAX_KEY:e.MIN_KEY,i)):n.unique?t.continue(t.key.slice(0,a).concat(n.reverse?e.MIN_KEY:e.MAX_KEY,i)):t.continue()}},continuePrimaryKey:{value(n,r){t.continuePrimaryKey(cd(n,e.MAX_KEY,i),r)}},primaryKey:{get:()=>t.primaryKey},key:{get(){let e=t.key;return 1===a?e[0]:e.slice(0,a)}},value:{get:()=>t.value}})):t.openCursor(n)}}}}}};function ch(e,n,t,i){return t=t||{},i=i||"",ok(e).forEach(r=>{if(oD(n,r)){var a=e[r],o=n[r];if("object"==typeof a&&"object"==typeof o&&a&&o){let e=oX(a);e!==oX(o)?t[i+r]=n[r]:"Object"===e?ch(a,o,t,i+r+"."):a!==o&&(t[i+r]=n[r])}else a!==o&&(t[i+r]=n[r])}else t[i+r]=void 0}),ok(n).forEach(r=>{oD(e,r)||(t[i+r]=n[r])}),t}let cg={stack:"dbcore",name:"HooksMiddleware",level:2,create:e=>({...e,table(n){let t=e.table(n),{primaryKey:i}=t.schema;return{...t,mutate(e){let r=sI.trans,{deleting:a,creating:o,updating:s}=r.table(n).hook;switch(e.type){case"add":if(o.fire===su)break;return r._promise("readwrite",()=>l(e),!0);case"put":if(o.fire===su&&s.fire===su)break;return r._promise("readwrite",()=>l(e),!0);case"delete":if(a.fire===su)break;return r._promise("readwrite",()=>l(e),!0);case"deleteRange":if(a.fire===su)break;return r._promise("readwrite",()=>(function e(n,r,a){return t.query({trans:n,values:!1,query:{index:i,range:r},limit:a}).then(({result:t})=>l({type:"delete",keys:t,trans:n}).then(i=>i.numFailures>0?Promise.reject(i.failures[0]):t.length<a?{failures:[],numFailures:0,lastResult:void 0}:e(n,{...r,lower:t[t.length-1],lowerOpen:!0},a)))})(e.trans,e.range,1e4),!0)}return t.mutate(e);function l(e){var n,r;let l=sI.trans,c=e.keys||("delete"===(n=e).type?n.keys:n.keys||n.values.map(i.extractKey));if(!c)throw Error("Keys missing");return"delete"!==(e="add"===e.type||"put"===e.type?{...e,keys:c}:{...e}).type&&(e.values=[...e.values]),e.keys&&(e.keys=[...e.keys]),("add"===(r=e).type?Promise.resolve([]):t.getMany({trans:r.trans,keys:c,cache:"immutable"})).then(n=>{let r=c.map((t,r)=>{let c=n[r],u={onerror:null,onsuccess:null};if("delete"===e.type)a.fire.call(u,t,c,l);else if("add"===e.type||void 0===c){let n=o.fire.call(u,t,e.values[r],l);null==t&&null!=n&&(t=n,e.keys[r]=t,i.outbound||oV(e.values[r],i.keyPath,t))}else{let n=ch(c,e.values[r]),i=s.fire.call(u,n,t,c,l);if(i){let n=e.values[r];Object.keys(i).forEach(e=>{oD(n,e)?n[e]=i[e]:oV(n,e,i[e])})}}return u});return t.mutate(e).then(({failures:t,results:i,numFailures:a,lastResult:o})=>{for(let a=0;a<c.length;++a){let o=i?i[a]:c[a],s=r[a];null==o?s.onerror&&s.onerror(t[a]):s.onsuccess&&s.onsuccess("put"===e.type&&n[a]?e.values[a]:o)}return{failures:t,results:i,numFailures:a,lastResult:o}}).catch(e=>(r.forEach(n=>n.onerror&&n.onerror(e)),Promise.reject(e)))})}}}}})};function cm(e,n,t){try{if(!n||n.keys.length<e.length)return null;let i=[];for(let r=0,a=0;r<n.keys.length&&a<e.length;++r)0===lT(n.keys[r],e[a])&&(i.push(t?oJ(n.values[r]):n.values[r]),++a);return i.length===e.length?i:null}catch(e){return null}}let cb={stack:"dbcore",level:-1,create:e=>({table:n=>{let t=e.table(n);return{...t,getMany:e=>{if(!e.cache)return t.getMany(e);let n=cm(e.keys,e.trans._cache,"clone"===e.cache);return n?sF.resolve(n):t.getMany(e).then(n=>(e.trans._cache={keys:e.keys,values:"clone"===e.cache?oJ(n):n},n))},mutate:e=>("add"!==e.type&&(e.trans._cache=null),t.mutate(e))}}})};function cy(e){return!("from"in e)}let c_=function(e,n){if(!this){let n=new c_;return e&&"d"in e&&oC(n,e),n}oC(this,arguments.length?{d:1,from:e,to:arguments.length>1?n:e}:{d:0})};function cv(e,n,t){let i=lT(n,t);if(isNaN(i))return;if(i>0)throw RangeError();if(cy(e))return oC(e,{from:n,to:t,d:1});let r=e.l,a=e.r;if(0>lT(t,e.from))return r?cv(r,n,t):e.l={from:n,to:t,d:1,l:null,r:null},cw(e);if(lT(n,e.to)>0)return a?cv(a,n,t):e.r={from:n,to:t,d:1,l:null,r:null},cw(e);0>lT(n,e.from)&&(e.from=n,e.l=null,e.d=a?a.d+1:1),lT(t,e.to)>0&&(e.to=t,e.r=null,e.d=e.l?e.l.d+1:1);let o=!e.r;r&&!e.l&&c$(e,r),a&&o&&c$(e,a)}function c$(e,n){cy(n)||function e(n,{from:t,to:i,l:r,r:a}){cv(n,t,i),r&&e(n,r),a&&e(n,a)}(e,n)}function cA(e){let n=cy(e)?null:{s:0,n:e};return{next(e){let t=arguments.length>0;for(;n;)switch(n.s){case 0:if(n.s=1,t)for(;n.n.l&&0>lT(e,n.n.from);)n={up:n,n:n.n.l,s:1};else for(;n.n.l;)n={up:n,n:n.n.l,s:1};case 1:if(n.s=2,!t||0>=lT(e,n.n.to))return{value:n.n,done:!1};case 2:if(n.n.r){n.s=3,n={up:n,n:n.n.r,s:0};continue}case 3:n=n.up}return{done:!0}}}}function cw(e){var n,t;let i=((null==(n=e.r)?void 0:n.d)||0)-((null==(t=e.l)?void 0:t.d)||0),r=i>1?"r":i<-1?"l":"";if(r){let n="r"===r?"l":"r",t={...e},i=e[r];e.from=i.from,e.to=i.to,e[r]=i[r],t[r]=i[n],e[n]=t,t.d=ck(t)}e.d=ck(e)}function ck({r:e,l:n}){return(e?n?Math.max(e.d,n.d):e.d:n?n.d:0)+1}oM(c_.prototype,{add(e){return c$(this,e),this},addKey(e){return cv(this,e,e),this},addKeys(e){return e.forEach(e=>cv(this,e,e)),this},[oQ](){return cA(this)}});let cx={stack:"dbcore",level:0,create:e=>{let n=e.schema.name,t=new c_(e.MIN_KEY,e.MAX_KEY);return{...e,table:i=>{let r=e.table(i),{schema:a}=r,{primaryKey:o}=a,{extractKey:s,outbound:l}=o,c={...r,mutate:e=>{let o=e.trans,s=o.mutatedParts||(o.mutatedParts={}),l=e=>{let t=`idb://${n}/${i}/${e}`;return s[t]||(s[t]=new c_)},c=l(""),u=l(":dels"),{type:p}=e,[d,f]="deleteRange"===e.type?[e.range]:"delete"===e.type?[e.keys]:e.values.length<50?[[],e.values]:[],h=e.trans._cache;return r.mutate(e).then(e=>{if(ox(d)){"delete"!==p&&(d=e.results),c.addKeys(d);let n=cm(d,h);n||"add"===p||u.addKeys(d),(n||f)&&a.indexes.forEach(function(e){let t=l(e.name||"");function i(n){return null!=n?e.extractKey(n):null}let r=n=>e.multiEntry&&ox(n)?n.forEach(e=>t.addKey(e)):t.addKey(n);(n||f).forEach((e,t)=>{let a=n&&i(n[t]),o=f&&i(f[t]);0!==lT(a,o)&&(null!=a&&r(a),null!=o&&r(o))})})}else if(d){let e={from:d.lower,to:d.upper};u.add(e),c.add(e)}else c.add(t),u.add(t),a.indexes.forEach(e=>l(e.name).add(t));return e})}},u=({query:{index:n,range:t}})=>{var i,r;return[n,new c_(null!=(i=t.lower)?i:e.MIN_KEY,null!=(r=t.upper)?r:e.MAX_KEY)]},p={get:e=>[o,new c_(e.key)],getMany:e=>[o,(new c_).addKeys(e.keys)],count:u,query:u,openCursor:u};return ok(p).forEach(e=>{c[e]=function(a){let{subscr:o}=sI;if(o){let c=e=>{let t=`idb://${n}/${i}/${e}`;return o[t]||(o[t]=new c_)},u=c(""),d=c(":dels"),[f,h]=p[e](a);if(c(f.name||"").add(h),!f.isPrimaryKey){if("count"!==e){let n="query"===e&&l&&a.values&&r.query({...a,values:!1});return r[e].apply(this,arguments).then(t=>{if("query"===e){if(l&&a.values)return n.then(({result:e})=>(u.addKeys(e),t));let e=a.values?t.result.map(s):t.result;a.values?u.addKeys(e):d.addKeys(e)}else if("openCursor"===e){let e=a.values;return t&&Object.create(t,{key:{get:()=>(d.addKey(t.primaryKey),t.key)},primaryKey:{get(){let e=t.primaryKey;return d.addKey(e),e}},value:{get:()=>(e&&u.addKey(t.primaryKey),t.value)}})}return t})}d.add(t)}}return r[e].apply(this,arguments)}}),c}}}};class cC{constructor(e,n){var t;this._middlewares={},this.verno=0;const i=cC.dependencies;this._options=n={addons:cC.addons,autoOpen:!0,indexedDB:i.indexedDB,IDBKeyRange:i.IDBKeyRange,...n},this._deps={indexedDB:n.indexedDB,IDBKeyRange:n.IDBKeyRange};const{addons:r}=n;this._dbSchema={},this._versions=[],this._storeNames=[],this._allTables={},this.idbdb=null,this._novip=this;const a={dbOpenError:null,isBeingOpened:!1,onReadyBeingFired:null,openComplete:!1,dbReadyResolve:su,dbReadyPromise:null,cancelOpen:su,openCanceller:null,autoSchema:!0,PR1398_maxLoop:3};a.dbReadyPromise=new sF(e=>{a.dbReadyResolve=e}),a.openCanceller=new sF((e,n)=>{a.cancelOpen=n}),this._state=a,this.name=e,this.on=lx(this,"populate","blocked","versionchange","close",{ready:[sy,su]}),this.on.ready.subscribe=oj(this.on.ready.subscribe,e=>(n,t)=>{cC.vip(()=>{let i=this._state;if(i.openComplete)i.dbOpenError||sF.resolve().then(n),t&&e(n);else if(i.onReadyBeingFired)i.onReadyBeingFired.push(n),t&&e(n);else{e(n);let i=this;t||e(function e(){i.on.ready.unsubscribe(n),i.on.ready.unsubscribe(e)})}})}),this.Collection=(t=this,lC(lN.prototype,function(e,n){this.db=t;let i=lA,r=null;if(n)try{i=n()}catch(e){r=e}let a=e._ctx,o=a.table,s=o.hook.reading.fire;this._ctx={table:o,index:a.index,isPrimKey:!a.index||o.schema.primKey.keyPath&&a.index===o.schema.primKey.name,range:i,keysOnly:!1,dir:"next",unique:"",algorithm:null,filter:null,replayFilter:null,justLimit:!0,isMatch:null,offset:0,limit:1/0,error:r,or:a.or,valueMapper:s!==sp?s:null}})),this.Table=function(e){return lC(lk.prototype,function(n,t,i){this.db=e,this._tx=i,this.name=n,this.schema=t,this.hook=e._allTables[n]?e._allTables[n].hook:lx(null,{creating:[sh,su],reading:[sd,sp],updating:[sm,su],deleting:[sg,su]})})}(this),this.Transaction=function(e){return lC(lX.prototype,function(n,t,i,r,a){this.db=e,this.mode=n,this.storeNames=t,this.schema=i,this.chromeTransactionDurability=r,this.idbtrans=null,this.on=lx(this,"complete","error","abort"),this.parent=a||null,this.active=!0,this._reculock=0,this._blockedFuncs=[],this._resolve=null,this._reject=null,this._waitingFor=null,this._waitingQueue=null,this._spinCount=0,this._completion=new sF((e,n)=>{this._resolve=e,this._reject=n}),this._completion.then(()=>{this.active=!1,this.on.complete.fire()},e=>{var n=this.active;return this.active=!1,this.on.error.fire(e),this.parent?this.parent._reject(e):n&&this.idbtrans&&this.idbtrans.abort(),lc(e)})})}(this),this.Version=function(e){return lC(co.prototype,function(n){this.db=e,this._cfg={version:n,storesSource:null,dbschema:{},tables:{},contentUpgrade:null}})}(this),this.WhereClause=function(e){return lC(lH.prototype,function(n,t,i){this.db=e,this._ctx={table:n,index:":id"===t?null:t,or:i};let r=e._deps.indexedDB;if(!r)throw new ss.MissingAPI;this._cmp=this._ascending=r.cmp.bind(r),this._descending=(e,n)=>r.cmp(n,e),this._max=(e,n)=>r.cmp(e,n)>0?e:n,this._min=(e,n)=>0>r.cmp(e,n)?e:n,this._IDBKeyRange=e._deps.IDBKeyRange})}(this),this.on("versionchange",e=>{e.newVersion>0?console.warn(`Another connection wants to upgrade database '${this.name}'. Closing db now to resume the upgrade.`):console.warn(`Another connection wants to delete database '${this.name}'. Closing db now to resume the delete request.`),this.close()}),this.on("blocked",e=>{!e.newVersion||e.newVersion<e.oldVersion?console.warn(`Dexie.delete('${this.name}') was blocked`):console.warn(`Upgrade '${this.name}' blocked by other connection holding version ${e.oldVersion/10}`)}),this._maxKey=l2(n.IDBKeyRange),this._createTransaction=(e,n,t,i)=>new this.Transaction(e,n,t,this._options.chromeTransactionDurability,i),this._fireOnBlocked=e=>{this.on("blocked").fire(e),lg.filter(e=>e.name===this.name&&e!==this&&!e._state.vcFired).map(n=>n.on("versionchange").fire(e))},this.use(cf),this.use(cg),this.use(cx),this.use(cb),this.vip=Object.create(this,{_vip:{value:!0}}),r.forEach(e=>e(this))}version(e){if(isNaN(e)||e<.1)throw new ss.Type("Given version is not a positive number");if(e=Math.round(10*e)/10,this.idbdb||this._state.isBeingOpened)throw new ss.Schema("Cannot add version when database is open");this.verno=Math.max(this.verno,e);let n=this._versions;var t=n.filter(n=>n._cfg.version===e)[0];return t||(t=new this.Version(e),n.push(t),n.sort(ce),t.stores({}),this._state.autoSchema=!1,t)}_whenReady(e){return this.idbdb&&(this._state.openComplete||sI.letThrough||this._vip)?e():new sF((e,n)=>{if(this._state.openComplete)return n(new ss.DatabaseClosed(this._state.dbOpenError));if(!this._state.isBeingOpened){if(!this._options.autoOpen)return void n(new ss.DatabaseClosed);this.open().catch(su)}this._state.dbReadyPromise.then(e,n)}).then(e)}use({stack:e,create:n,level:t,name:i}){i&&this.unuse({stack:e,name:i});let r=this._middlewares[e]||(this._middlewares[e]=[]);return r.push({stack:e,create:n,level:null==t?10:t,name:i}),r.sort((e,n)=>e.level-n.level),this}unuse({stack:e,name:n,create:t}){return e&&this._middlewares[e]&&(this._middlewares[e]=this._middlewares[e].filter(e=>t?e.create!==t:!!n&&e.name!==n)),this}open(){return function(e){var n;let t=e._state,{indexedDB:i}=e._deps;if(t.isBeingOpened||e.idbdb)return t.dbReadyPromise.then(()=>t.dbOpenError?lc(t.dbOpenError):e);o5&&(t.openCanceller._stackHolder=o8()),t.isBeingOpened=!0,t.dbOpenError=null,t.openComplete=!1;let r=t.openCanceller;function a(){if(t.openCanceller!==r)throw new ss.DatabaseClosed("db.open() was cancelled")}let o=t.dbReadyResolve,s=null,l=!1;return sF.race([r,("u"<typeof navigator?sF.resolve():!navigator.userAgentData&&/Safari\//.test(navigator.userAgent)&&!/Chrom(e|ium)\//.test(navigator.userAgent)&&indexedDB.databases?new Promise(function(e){var t=function(){return indexedDB.databases().finally(e)};n=setInterval(t,100),t()}).finally(function(){return clearInterval(n)}):Promise.resolve()).then(()=>new sF((n,r)=>{if(a(),!i)throw new ss.MissingAPI;let o=e.name,c=t.autoSchema?i.open(o):i.open(o,Math.round(10*e.verno));if(!c)throw new ss.MissingAPI;c.onerror=lq(r),c.onblocked=sQ(e._fireOnBlocked),c.onupgradeneeded=sQ(n=>{if(s=c.transaction,t.autoSchema&&!e._options.allowEmptyDB){c.onerror=lK,s.abort(),c.result.close();let e=i.deleteDatabase(o);e.onsuccess=e.onerror=sQ(()=>{r(new ss.NoSuchDatabase(`Database ${o} doesnt exist`))})}else{let t,i,o,d;s.onerror=lq(r);var a,u,p=n.oldVersion>0x4000000000000000?0:n.oldVersion;l=p<1,e._novip.idbdb=c.result,a=p/10,u=s,t=e._dbSchema,(i=e._createTransaction("readwrite",e._storeNames,t)).create(u),i._completion.catch(r),o=i._reject.bind(i),d=sI.transless||sI,s6(()=>{sI.trans=i,sI.transless=d,0===a?(ok(t).forEach(e=>{ct(u,e,t[e].primKey,t[e].indexes)}),l8(e,u),sF.follow(()=>e.on.populate.fire(i)).catch(o)):(function({_novip:e},n,t,i){let r=[],a=e._versions,o=e._dbSchema=cr(e,e.idbdb,i),s=!1;return a.filter(e=>e._cfg.version>=n).forEach(a=>{r.push(()=>{let r=o,l=a._cfg.dbschema;ca(e,r,i),ca(e,l,i),o=e._dbSchema=l;let c=cn(r,l);c.add.forEach(e=>{ct(i,e[0],e[1].primKey,e[1].indexes)}),c.change.forEach(e=>{if(e.recreate)throw new ss.Upgrade("Not yet support for changing primary key");{let n=i.objectStore(e.name);e.add.forEach(e=>ci(n,e)),e.change.forEach(e=>{n.deleteIndex(e.name),ci(n,e)}),e.del.forEach(e=>n.deleteIndex(e))}});let u=a._cfg.contentUpgrade;if(u&&a._cfg.version>n){let n;l8(e,i),t._memoizedTables={},s=!0;let a=oG(l);c.del.forEach(e=>{a[e]=r[e]}),l9(e,[e.Transaction.prototype]),l7(e,[e.Transaction.prototype],ok(a),a),t.schema=a;let o=o3(u);o&&s8();let p=sF.follow(()=>{if((n=u(t))&&o){var e=s7.bind(null,null);n.then(e,e)}});return n&&"function"==typeof n.then?sF.resolve(n):p.then(()=>n)}}),r.push(n=>{var i;s&&lm||(i=a._cfg.dbschema,[].slice.call(n.db.objectStoreNames).forEach(e=>null==i[e]&&n.db.deleteObjectStore(e))),l9(e,[e.Transaction.prototype]),l7(e,[e.Transaction.prototype],e._storeNames,e._dbSchema),t.schema=e._dbSchema})}),(function e(){return r.length?sF.resolve(r.shift()(t.idbtrans)).then(e):sF.resolve()})().then(()=>{var e;ok(e=o).forEach(n=>{i.db.objectStoreNames.contains(n)||ct(i,n,e[n].primKey,e[n].indexes)})})})(e,a,i,u).catch(o)})}},r),c.onsuccess=sQ(()=>{s=null;let i=e._novip.idbdb=c.result,r=oN(i.objectStoreNames);if(r.length>0)try{let n,a=i.transaction(1===r.length?r[0]:r,"readonly");t.autoSchema?function({_novip:e},n,t){e.verno=n.version/10;let i=e._dbSchema=cr(0,n,t);e._storeNames=oN(n.objectStoreNames,0),l7(e,[e._allTables],ok(i),i)}(e,i,a):(ca(e,e._dbSchema,a),((n=cn(cr(0,e.idbdb,a),e._dbSchema)).add.length||n.change.some(e=>e.add.length||e.change.length))&&console.warn("Dexie SchemaDiff: Schema was extended without increasing the number passed to db.version(). Some queries may fail.")),l8(e,a)}catch(e){}lg.push(e),i.onversionchange=sQ(n=>{t.vcFired=!0,e.on("versionchange").fire(n)}),i.onclose=sQ(n=>{e.on("close").fire(n)}),l&&function({indexedDB:e,IDBKeyRange:n},t){cl(e)||t===ly||cs(e,n).put({name:t}).catch(su)}(e._deps,o),n()},r)}))]).then(()=>(a(),t.onReadyBeingFired=[],sF.resolve(cc(()=>e.on.ready.fire(e.vip))).then(function n(){if(t.onReadyBeingFired.length>0){let i=t.onReadyBeingFired.reduce(sy,su);return t.onReadyBeingFired=[],sF.resolve(cc(()=>i(e.vip))).then(n)}}))).finally(()=>{t.onReadyBeingFired=null,t.isBeingOpened=!1}).then(()=>e).catch(n=>{t.dbOpenError=n;try{s&&s.abort()}catch(e){}return r===t.openCanceller&&e._close(),lc(n)}).finally(()=>{t.openComplete=!0,o()})}(this)}_close(){let e=this._state,n=lg.indexOf(this);if(n>=0&&lg.splice(n,1),this.idbdb){try{this.idbdb.close()}catch(e){}this._novip.idbdb=null}e.dbReadyPromise=new sF(n=>{e.dbReadyResolve=n}),e.openCanceller=new sF((n,t)=>{e.cancelOpen=t})}close(){this._close();let e=this._state;this._options.autoOpen=!1,e.dbOpenError=new ss.DatabaseClosed,e.isBeingOpened&&e.cancelOpen(e.dbOpenError)}delete(){let e=arguments.length>0,n=this._state;return new sF((t,i)=>{let r=()=>{this.close();var e=this._deps.indexedDB.deleteDatabase(this.name);e.onsuccess=sQ(()=>{!function({indexedDB:e,IDBKeyRange:n},t){cl(e)||t===ly||cs(e,n).delete(t).catch(su)}(this._deps,this.name),t()}),e.onerror=lq(i),e.onblocked=this._fireOnBlocked};if(e)throw new ss.InvalidArgument("Arguments not allowed in db.delete()");n.isBeingOpened?n.dbReadyPromise.then(r):r()})}backendDB(){return this.idbdb}isOpen(){return null!==this.idbdb}hasBeenClosed(){let e=this._state.dbOpenError;return e&&"DatabaseClosed"===e.name}hasFailed(){return null!==this._state.dbOpenError}dynamicallyOpened(){return this._state.autoSchema}get tables(){return ok(this._allTables).map(e=>this._allTables[e])}transaction(){let e=cp.apply(this,arguments);return this._transaction.apply(this,e)}_transaction(e,n,t){let i,r,a=sI.trans;a&&a.db===this&&-1===e.indexOf("!")||(a=null);let o=-1!==e.indexOf("?");e=e.replace("!","").replace("?","");try{if(r=n.map(e=>{var n=e instanceof this.Table?e.name:e;if("string"!=typeof n)throw TypeError("Invalid table argument to Dexie.transaction(). Only Table or String are allowed");return n}),"r"==e||e===l_)i=l_;else{if("rw"!=e&&e!=lv)throw new ss.InvalidArgument("Invalid transaction mode: "+e);i=lv}if(a){if(a.mode===l_&&i===lv){if(!o)throw new ss.SubTransaction("Cannot enter a sub-transaction with READWRITE mode when parent transaction is READONLY");a=null}a&&r.forEach(e=>{if(a&&-1===a.storeNames.indexOf(e)){if(!o)throw new ss.SubTransaction("Table "+e+" not included in parent transaction.");a=null}}),o&&a&&!a.active&&(a=null)}}catch(e){return a?a._promise(null,(n,t)=>{t(e)}):lc(e)}let s=(function e(n,t,i,r,a){return sF.resolve().then(()=>{let o,s=sI.transless||sI,l=n._createTransaction(t,i,n._dbSchema,r);if(r)l.idbtrans=r.idbtrans;else try{l.create(),n._state.PR1398_maxLoop=3}catch(r){return r.name===so.InvalidState&&n.isOpen()&&--n._state.PR1398_maxLoop>0?(console.warn("Dexie: Need to reopen db"),n._close(),n.open().then(()=>e(n,t,i,null,a))):lc(r)}let c=o3(a);c&&s8();let u=sF.follow(()=>{if(o=a.call(l,l))if(c){var e=s7.bind(null,null);o.then(e,e)}else"function"==typeof o.next&&"function"==typeof o.throw&&(o=cu(o))},{trans:l,transless:s});return(o&&"function"==typeof o.then?sF.resolve(o).then(e=>l.active?e:lc(new ss.PrematureCommit("Transaction committed too early. See http://bit.ly/2kdckMn"))):u.then(()=>o)).then(e=>(r&&l._resolve(),l._completion.then(()=>e))).catch(e=>(l._reject(e),lc(e)))})}).bind(null,this,i,r,a,t);return a?a._promise(i,s,"lock"):sI.trans?lr(sI.transless,()=>this._whenReady(s)):this._whenReady(s)}table(e){if(!oD(this._allTables,e))throw new ss.InvalidTable(`Table ${e} does not exist`);return this._allTables[e]}}let cE="u">typeof Symbol&&"observable"in Symbol?Symbol.observable:"@@observable";class cS{constructor(e){this._subscribe=e}subscribe(e,n,t){return this._subscribe(e&&"function"!=typeof e?e:{next:e,error:n,complete:t})}[cE](){return this}}function cD(e,n){return ok(n).forEach(t=>{c$(e[t]||(e[t]=new c_),n[t])}),e}try{r={indexedDB:ow.indexedDB||ow.mozIndexedDB||ow.webkitIndexedDB||ow.msIndexedDB,IDBKeyRange:ow.IDBKeyRange||ow.webkitIDBKeyRange}}catch(e){r={indexedDB:null,IDBKeyRange:null}}function cM(e){let n=cz;try{cz=!0,lZ.storagemutated.fire(e)}finally{cz=n}}oM(cC,{...sc,delete:e=>new cC(e,{addons:[]}).delete(),exists:e=>new cC(e,{addons:[]}).open().then(e=>(e.close(),!0)).catch("NoSuchDatabaseError",()=>!1),getDatabaseNames(e){try{return(function({indexedDB:e,IDBKeyRange:n}){return cl(e)?Promise.resolve(e.databases()).then(e=>e.map(e=>e.name).filter(e=>e!==ly)):cs(e,n).toCollection().primaryKeys()})(cC.dependencies).then(e)}catch(e){return lc(new ss.MissingAPI)}},defineClass:()=>function(e){oC(this,e)},ignoreTransaction:e=>sI.trans?lr(sI.transless,e):e(),vip:cc,async:function(e){return function(){try{var n=cu(e.apply(this,arguments));return n&&"function"==typeof n.then?n:sF.resolve(n)}catch(e){return lc(e)}}},spawn:function(e,n,t){try{var i=cu(e.apply(t,n||[]));return i&&"function"==typeof i.then?i:sF.resolve(i)}catch(e){return lc(e)}},currentTransaction:{get:()=>sI.trans||null},waitFor:function(e,n){let t=sF.resolve("function"==typeof e?cC.ignoreTransaction(e):e).timeout(n||6e4);return sI.trans?sI.trans.waitFor(t):t},Promise:sF,debug:{get:()=>o5,set:e=>{o5=e,o4="dexie"===e?()=>!0:lb}},derive:oP,extend:oC,props:oM,override:oj,Events:lx,on:lZ,liveQuery:function(e){let n,t=!1,i=new cS(i=>{let r=o3(e),a=!1,o={},s={},l={get closed(){return a},unsubscribe:()=>{a=!0,lZ.storagemutated.unsubscribe(d)}};i.start&&i.start(l);let c=!1,u=!1;function p(){return ok(s).some(e=>o[e]&&function(e,n){let t=cA(n),i=t.next();if(i.done)return!1;let r=i.value,a=cA(e),o=a.next(r.from),s=o.value;for(;!i.done&&!o.done;){if(0>=lT(s.from,r.to)&&lT(s.to,r.from)>=0)return!0;0>lT(r.from,s.from)?r=(i=t.next(s.from)).value:s=(o=a.next(r.from)).value}return!1}(o[e],s[e]))}let d=e=>{cD(o,e),p()&&f()},f=()=>{let h,g;if(c||a)return;o={};let m={},b=(r&&s8(),h=()=>s6(e,{subscr:m,trans:null}),g=sI.trans?lr(sI.transless,h):h(),r&&g.then(s7,s7),g);u||(lZ(lY,d),u=!0),c=!0,Promise.resolve(b).then(e=>{t=!0,n=e,c=!1,a||(p()?f():(o={},s=m,i.next&&i.next(e)))},e=>{c=!1,t=!1,i.error&&i.error(e),l.unsubscribe()})};return f(),l});return i.hasValue=()=>t,i.getValue=()=>n,i},extendObservabilitySet:cD,getByKeyPath:oW,setByKeyPath:oV,delByKeyPath:function(e,n){"string"==typeof n?oV(e,n,void 0):"length"in n&&[].map.call(n,function(n){oV(e,n,void 0)})},shallowClone:oG,deepClone:oJ,getObjectDiff:ch,cmp:lT,asap:oF,minKey:ld,addons:[],connections:lg,errnames:so,dependencies:r,semVer:lu,version:lu.split(".").map(e=>parseInt(e)).reduce((e,n,t)=>e+n/Math.pow(10,2*t))}),cC.maxKey=l2(cC.dependencies.IDBKeyRange),"u">typeof dispatchEvent&&"u">typeof addEventListener&&(lZ(lY,e=>{if(!cz){let n;lm?(n=document.createEvent("CustomEvent")).initCustomEvent(lJ,!0,!0,e):n=new CustomEvent(lJ,{detail:e}),cz=!0,dispatchEvent(n),cz=!1}}),addEventListener(lJ,({detail:e})=>{cz||cM(e)}));let cz=!1;if("u">typeof BroadcastChannel){let e=new BroadcastChannel(lJ);"function"==typeof e.unref&&e.unref(),lZ(lY,n=>{cz||e.postMessage(n)}),e.onmessage=e=>{e.data&&cM(e.data)}}else if("u">typeof self&&"u">typeof navigator){lZ(lY,e=>{try{cz||("u">typeof localStorage&&localStorage.setItem(lJ,JSON.stringify({trig:Math.random(),changedParts:e})),"object"==typeof self.clients&&[...self.clients.matchAll({includeUncontrolled:!0})].forEach(n=>n.postMessage({type:lJ,changedParts:e})))}catch(e){}}),"u">typeof addEventListener&&addEventListener("storage",e=>{if(e.key===lJ){let n=JSON.parse(e.newValue);n&&cM(n.changedParts)}});let e=self.document&&navigator.serviceWorker;e&&e.addEventListener("message",function({data:e}){e&&e.type===lJ&&cM(e.changedParts)})}function cO(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}sF.rejectionMapper=function(e,n){if(!e||e instanceof st||e instanceof TypeError||e instanceof SyntaxError||!e.name||!sl[e.name])return e;var t=new sl[e.name](n||e.message,e);return"stack"in e&&oO(t,"stack",{get:function(){return this.inner.stack}}),t},o4=lb;class cP extends cC{constructor(){super("EsmOffline"),cO(this,"syncQueue",void 0),cO(this,"dynamicOfflineData",void 0),this.version(4).stores({syncQueue:"++id,userId,type,[userId+type]",dynamicOfflineData:"++id,type,identifier,*users,&[type+identifier]"}),this.syncQueue=this.table("syncQueue"),this.dynamicOfflineData=this.table("dynamicOfflineData")}}function cT(){return new cP}let cB=new cP,cI={},cN=U("offline-synchronization",{});function cj(){return cN}async function cR(){if(cN.getState().synchronization)return;let e=await cB.syncQueue.count(),n={},t=Object.entries(cI),i=t.length,r={},a=new AbortController,o=()=>{let e=cN.getState().synchronization;cN.setState({synchronization:{...e,pendingCount:e.pendingCount-1}})};try{cN.setState({synchronization:{totalCount:e,pendingCount:e,abortController:a}});for(let e=0;e<i&&t.length>0;e++)for(let e=t.length;e--;){let[i,s]=t[e],l=s.dependsOn.map(e=>n[e]);l.every(Boolean)&&(r[i]={},await Promise.all(l),n[i]=cF(s,r,a,o),t.splice(e,1))}await Promise.allSettled(Object.values(n))}finally{cN.setState({synchronization:void 0})}}async function cF({type:e,dependsOn:n,process:t},i,r,a){let o=[],s=[],l=await cL();await cB.syncQueue.where({type:e,userId:l}).each((e,n)=>{o.push([n.primaryKey,e.content,e.descriptor]),s.push(e.content)});for(let c=0;c<o.length;c++){let[u,p,{id:d,dependencies:f=[]}]=o[c];try{let a=await t(p,{abort:r,index:c,items:s,userId:l,dependencies:f.map(({id:e,type:t})=>n.includes(t)?i[t][e]:void 0)});void 0!==d&&(i[e][d]=a),await cB.syncQueue.delete(u)}catch(e){await cB.syncQueue.update(u,{lastError:{name:e?.name,message:e?.message??e?.toString()}})}finally{a()}}}async function cL(){let e=await rw();return e?.uuid||"*"}async function cW(e,n,t,i){let r=i&&i.id;return void 0!==r&&await cB.syncQueue.where({type:n,userId:e}).filter(e=>e?.descriptor.id===r).delete().catch(cC.errnames.DatabaseClosed),await cB.syncQueue.add({type:n,content:t,userId:e,descriptor:i||{},createdOn:new Date}).catch(cC.errnames.DatabaseClosed,()=>-1)}async function cV(e,n,t){let i=await cL();return await cW(i,e,n,t)}async function cG(e,n){return(await cU(e,n)).map(e=>e.content)}async function cU(e,n){return await cB.syncQueue.where(n?{type:n,userId:e}:{userId:e}).toArray().catch(cC.errnames.DatabaseClosed,()=>[])}async function cH(e){let n=await cL();return await cG(n,e)}async function cq(e){let n=await cL();return await cU(n,e)}async function cK(e){return await cB.syncQueue.get(e).catch(cC.errnames.DatabaseClosed,()=>void 0)}function cY(e){return!!cI[e]?.options.onBeginEditSyncItem}async function cJ(e){let n=await cK(e);if(!n)throw Error(`No sync item with the ID ${e} exists.`);let t=cI[n.type]?.options.onBeginEditSyncItem;if(!t)throw Error(`A sync item with the ID ${e} exists, but the associated handler (if one exists) doesn't support editing the item. You can avoid this error by either verifying that sync items of this type can be edited via the "canEditSynchronizationItemsOfType(type: string)" function or alternatively ensure that the synchronizaton handler for sync items of type "${n.type}" supports editing items.`);t(n)}async function cZ(e){await cB.syncQueue.delete(e).catch(cC.errnames.DatabaseClosed)}function cX(e,n,t,i={}){cI[e]={type:e,dependsOn:n,process:t,options:i}}let cQ="u">typeof crypto&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),c0=new Uint8Array(16),c1=[];for(let e=0;e<256;++e)c1.push((e+256).toString(16).slice(1));let c2=function(e,n,t){if(cQ&&!n&&!e)return cQ();let i=(e=e||{}).random||(e.rng||function(){if(!a&&!(a="u">typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)))throw Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return a(c0)})();if(i[6]=15&i[6]|64,i[8]=63&i[8]|128,n){t=t||0;for(let e=0;e<16;++e)n[t+e]=i[e];return n}return function(e,n=0){return c1[e[n+0]]+c1[e[n+1]]+c1[e[n+2]]+c1[e[n+3]]+"-"+c1[e[n+4]]+c1[e[n+5]]+"-"+c1[e[n+6]]+c1[e[n+7]]+"-"+c1[e[n+8]]+c1[e[n+9]]+"-"+c1[e[n+10]]+c1[e[n+11]]+c1[e[n+12]]+c1[e[n+13]]+c1[e[n+14]]+c1[e[n+15]]}(i)},c3="OFFLINE+";function c5(){return c3+c2()}function c4(e){return e.startsWith(c3)}let c6={};function c8(){return Object.values(c6)}function c7(e){c6[e.id]&&console.warn(`[setupDynamicOfflineDataHandler] Another second handler with the ID "${e.id}" was registered. This handler will override the previous one. This could be unintended as the previous handler might run different flows than the newly registered one. If this is the case, ensure that you are setting up the handlers with different IDs.`),c6[e.id]=e}async function c9(e){let n=await us();return await ue(n,e)}async function ue(e,n){let t=new cP;return await t.dynamicOfflineData.where(n?{type:n,users:e}:{users:e}).toArray().catch(cC.errnames.DatabaseClosed,()=>[])}async function un(e,n){let t=await us();return await ut(t,e,n)}async function ut(e,n,t){let i=new cP,r=await i.dynamicOfflineData.get({type:n,identifier:t}).catch(cC.errnames.DatabaseClosed,()=>void 0);r?r.users.includes(e)||await i.dynamicOfflineData.update(r.id,{users:[...r.users,e]}).catch(cC.errnames.DatabaseClosed):await i.dynamicOfflineData.add({users:[e],type:n,identifier:t}).catch(cC.errnames.DatabaseClosed)}async function ui(e,n){let t=await us();return await ur(t,e,n)}async function ur(e,n,t){let i=new cP,r=await i.dynamicOfflineData.get({type:n,identifier:t,users:e}).catch(cC.errnames.DatabaseClosed,()=>void 0);r&&(r.users.length>1?await i.dynamicOfflineData.update(r.id,{users:r.users.filter(n=>n!==e)}).catch(cC.errnames.DatabaseClosed):await i.dynamicOfflineData.delete(r.id).catch(cC.errnames.DatabaseClosed))}async function ua(e,n){let t=await c9(e);await Promise.all(t.map(async e=>uo(e.type,e.identifier,n)))}async function uo(e,n,t){await un(e,n);let i=new cP,r=await us(),a=await i.dynamicOfflineData.get({type:e,identifier:n}).catch(cC.errnames.DatabaseClosed,()=>void 0),o=c8().filter(n=>n.type===e);if(!a)return;let s=await Promise.all(o.map(async e=>{try{return e.sync(n,t),{id:e.id,error:void 0}}catch(t){let n=t.message?.toString()??t.toString();return{id:e.id,error:n}}})),l=s.filter(e=>!e.error).map(e=>e.id),c=s.filter(e=>e.error).map(e=>e.id),u=s.filter(e=>e.error).map(e=>({handlerId:e.id,message:e.error})),p={syncedOn:new Date,syncedBy:r,succeededHandlers:l,erroredHandlers:c,errors:u};a.id&&await i.dynamicOfflineData.update(a.id,{syncState:p}).catch(cC.errnames.DatabaseClosed)}async function us(){let e=(await rw()).uuid;if(!e)throw Error("Using the dynamic offline data API requires a logged in user.");return e}let ul=U("offline-patients",{offlinePatientDataSyncState:{},handlers:{}});function uc(){return ud(),ul}function uu(e,n){ud(),c7({type:"patient",displayName:n.displayName,id:e,isSynced:()=>Promise.resolve(!0),sync:(e,t)=>n.onOfflinePatientAdded({patientUuid:e,signal:t??new AbortController().signal})})}async function up(e){ud(),await uo("patient",e)}function ud(){console.warn("The offline patient API has been deprecated and will be removed in a future release. To prevent future crashes, the functions remain available for the moment, but any invocations should be migrated ASAP.")}async function uf(e,n,t=!0){if(e){let i=null,[r,a]=await Promise.all([rd(`${rc}/Patient/${e}`,n).catch(e=>i=e),t?uh(e):Promise.resolve(null)]);if(r.ok)return r.data;if(a)return a;if(i)throw i}return null}async function uh(e){let n=(await cH("patient-registration")).find(n=>n.fhirPatient.id===e);return n?.fhirPatient??null}function ug(e,n){let t=new CustomEvent(`openmrs:${e}`,{detail:n??void 0,cancelable:!0,bubbles:!0});return window.dispatchEvent(t)}function um(e,n){let t=e=>{n("detail"in e&&null!==e.detail?e.detail:void 0)};return window.addEventListener(`openmrs:${e}`,t),()=>{window.removeEventListener(`openmrs:${e}`,t)}}var ub=t(56170);function uy(e){return{uuid:e.uuid,display:e.display}}function u_(e=null,n=null){let t=new URLSearchParams;e&&t.set("tag",e),n&&t.set("q",n);let i=t.toString();return rf(`${rl}/location${i?"?"+i:""}`).pipe((0,ub.map)(e=>e.data.results.map(uy))).pipe((0,ub.take)(1))}function uv(e){return{uuid:e.uuid,display:e.display,name:e.name}}function u$(){return rf(`${rl}/visittype`).pipe((0,ub.map)(e=>e.data.results.map(uv))).pipe((0,ub.take)(1))}var uA=((Q={}).NEWVISIT="startVisit",Q.EDITVISIT="editVisit",Q.LOADING="loadingVisit",Q),uw=((ee={}).NOTSTARTED="notStarted",ee.ONGOING="ongoing",ee);let uk="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))",ux=function(){try{return JSON.parse(sessionStorage.getItem("openmrs:visitStoreState")||"null")}catch(e){return null}}()||{patientUuid:null,manuallySetVisitUuid:null,mutateVisitCallbacks:{}};function uC(){return q("visit",ux)}function uE(e,n){uC().setState({patientUuid:e,manuallySetVisitUuid:n})}function uS(e,n){return rd(`${rl}/visit`,{signal:n.signal,method:"POST",headers:{"Content-type":"application/json"},body:e})}function uD(e,n,t){return rd(`${rl}/visit/${e}`,{signal:t.signal,method:"POST",headers:{"Content-type":"application/json"},body:n})}function uM(e,n,t){return rd(`${rl}/visit?patient=${e}&v=${t??uk}`,{signal:n.signal,method:"GET",headers:{"Content-type":"application/json"}})}uC().subscribe(e=>{var n;n=e,sessionStorage.setItem("openmrs:visitStoreState",JSON.stringify(n))});let uz=new ei.BehaviorSubject(null);class uO{static get version(){return"1.4.0"}static toString(){return"JavaScript Expression Parser (JSEP) v"+uO.version}static addUnaryOp(e){return uO.max_unop_len=Math.max(e.length,uO.max_unop_len),uO.unary_ops[e]=1,uO}static addBinaryOp(e,n,t){return uO.max_binop_len=Math.max(e.length,uO.max_binop_len),uO.binary_ops[e]=n,t?uO.right_associative.add(e):uO.right_associative.delete(e),uO}static addIdentifierChar(e){return uO.additional_identifier_chars.add(e),uO}static addLiteral(e,n){return uO.literals[e]=n,uO}static removeUnaryOp(e){return delete uO.unary_ops[e],e.length===uO.max_unop_len&&(uO.max_unop_len=uO.getMaxKeyLen(uO.unary_ops)),uO}static removeAllUnaryOps(){return uO.unary_ops={},uO.max_unop_len=0,uO}static removeIdentifierChar(e){return uO.additional_identifier_chars.delete(e),uO}static removeBinaryOp(e){return delete uO.binary_ops[e],e.length===uO.max_binop_len&&(uO.max_binop_len=uO.getMaxKeyLen(uO.binary_ops)),uO.right_associative.delete(e),uO}static removeAllBinaryOps(){return uO.binary_ops={},uO.max_binop_len=0,uO}static removeLiteral(e){return delete uO.literals[e],uO}static removeAllLiterals(){return uO.literals={},uO}get char(){return this.expr.charAt(this.index)}get code(){return this.expr.charCodeAt(this.index)}constructor(e){this.expr=e,this.index=0}static parse(e){return new uO(e).parse()}static getMaxKeyLen(e){return Math.max(0,...Object.keys(e).map(e=>e.length))}static isDecimalDigit(e){return e>=48&&e<=57}static binaryPrecedence(e){return uO.binary_ops[e]||0}static isIdentifierStart(e){return e>=65&&e<=90||e>=97&&e<=122||e>=128&&!uO.binary_ops[String.fromCharCode(e)]||uO.additional_identifier_chars.has(String.fromCharCode(e))}static isIdentifierPart(e){return uO.isIdentifierStart(e)||uO.isDecimalDigit(e)}throwError(e){let n=Error(e+" at character "+this.index);throw n.index=this.index,n.description=e,n}runHook(e,n){if(uO.hooks[e]){let t={context:this,node:n};return uO.hooks.run(e,t),t.node}return n}searchHook(e){if(uO.hooks[e]){let n={context:this};return uO.hooks[e].find(function(e){return e.call(n.context,n),n.node}),n.node}}gobbleSpaces(){let e=this.code;for(;e===uO.SPACE_CODE||e===uO.TAB_CODE||e===uO.LF_CODE||e===uO.CR_CODE;)e=this.expr.charCodeAt(++this.index);this.runHook("gobble-spaces")}parse(){this.runHook("before-all");let e=this.gobbleExpressions(),n=1===e.length?e[0]:{type:uO.COMPOUND,body:e};return this.runHook("after-all",n)}gobbleExpressions(e){let n=[],t,i;for(;this.index<this.expr.length;)if((t=this.code)===uO.SEMCOL_CODE||t===uO.COMMA_CODE)this.index++;else if(i=this.gobbleExpression())n.push(i);else if(this.index<this.expr.length){if(t===e)break;this.throwError('Unexpected "'+this.char+'"')}return n}gobbleExpression(){let e=this.searchHook("gobble-expression")||this.gobbleBinaryExpression();return this.gobbleSpaces(),this.runHook("after-expression",e)}gobbleBinaryOp(){this.gobbleSpaces();let e=this.expr.substr(this.index,uO.max_binop_len),n=e.length;for(;n>0;){if(uO.binary_ops.hasOwnProperty(e)&&(!uO.isIdentifierStart(this.code)||this.index+e.length<this.expr.length&&!uO.isIdentifierPart(this.expr.charCodeAt(this.index+e.length))))return this.index+=n,e;e=e.substr(0,--n)}return!1}gobbleBinaryExpression(){let e,n,t,i,r,a,o,s,l;if(!(a=this.gobbleToken())||!(n=this.gobbleBinaryOp()))return a;for(r={value:n,prec:uO.binaryPrecedence(n),right_a:uO.right_associative.has(n)},(o=this.gobbleToken())||this.throwError("Expected expression after "+n),i=[a,r,o];n=this.gobbleBinaryOp();){if(0===(t=uO.binaryPrecedence(n))){this.index-=n.length;break}r={value:n,prec:t,right_a:uO.right_associative.has(n)},l=n;let s=e=>r.right_a&&e.right_a?t>e.prec:t<=e.prec;for(;i.length>2&&s(i[i.length-2]);)o=i.pop(),n=i.pop().value,a=i.pop(),e={type:uO.BINARY_EXP,operator:n,left:a,right:o},i.push(e);(e=this.gobbleToken())||this.throwError("Expected expression after "+l),i.push(r,e)}for(s=i.length-1,e=i[s];s>1;)e={type:uO.BINARY_EXP,operator:i[s-1].value,left:i[s-2],right:e},s-=2;return e}gobbleToken(){let e,n,t,i;if(this.gobbleSpaces(),i=this.searchHook("gobble-token"))return this.runHook("after-token",i);if(e=this.code,uO.isDecimalDigit(e)||e===uO.PERIOD_CODE)return this.gobbleNumericLiteral();if(e===uO.SQUOTE_CODE||e===uO.DQUOTE_CODE)i=this.gobbleStringLiteral();else if(e===uO.OBRACK_CODE)i=this.gobbleArray();else{for(t=(n=this.expr.substr(this.index,uO.max_unop_len)).length;t>0;){if(uO.unary_ops.hasOwnProperty(n)&&(!uO.isIdentifierStart(this.code)||this.index+n.length<this.expr.length&&!uO.isIdentifierPart(this.expr.charCodeAt(this.index+n.length)))){this.index+=t;let e=this.gobbleToken();return e||this.throwError("missing unaryOp argument"),this.runHook("after-token",{type:uO.UNARY_EXP,operator:n,argument:e,prefix:!0})}n=n.substr(0,--t)}uO.isIdentifierStart(e)?(i=this.gobbleIdentifier(),uO.literals.hasOwnProperty(i.name)?i={type:uO.LITERAL,value:uO.literals[i.name],raw:i.name}:i.name===uO.this_str&&(i={type:uO.THIS_EXP})):e===uO.OPAREN_CODE&&(i=this.gobbleGroup())}return i?(i=this.gobbleTokenProperty(i),this.runHook("after-token",i)):this.runHook("after-token",!1)}gobbleTokenProperty(e){this.gobbleSpaces();let n=this.code;for(;n===uO.PERIOD_CODE||n===uO.OBRACK_CODE||n===uO.OPAREN_CODE||n===uO.QUMARK_CODE;){let t;if(n===uO.QUMARK_CODE){if(this.expr.charCodeAt(this.index+1)!==uO.PERIOD_CODE)break;t=!0,this.index+=2,this.gobbleSpaces(),n=this.code}this.index++,n===uO.OBRACK_CODE?((e={type:uO.MEMBER_EXP,computed:!0,object:e,property:this.gobbleExpression()}).property||this.throwError('Unexpected "'+this.char+'"'),this.gobbleSpaces(),(n=this.code)!==uO.CBRACK_CODE&&this.throwError("Unclosed ["),this.index++):n===uO.OPAREN_CODE?e={type:uO.CALL_EXP,arguments:this.gobbleArguments(uO.CPAREN_CODE),callee:e}:(n===uO.PERIOD_CODE||t)&&(t&&this.index--,this.gobbleSpaces(),e={type:uO.MEMBER_EXP,computed:!1,object:e,property:this.gobbleIdentifier()}),t&&(e.optional=!0),this.gobbleSpaces(),n=this.code}return e}gobbleNumericLiteral(){let e="",n,t;for(;uO.isDecimalDigit(this.code);)e+=this.expr.charAt(this.index++);if(this.code===uO.PERIOD_CODE)for(e+=this.expr.charAt(this.index++);uO.isDecimalDigit(this.code);)e+=this.expr.charAt(this.index++);if("e"===(n=this.char)||"E"===n){for(e+=this.expr.charAt(this.index++),("+"===(n=this.char)||"-"===n)&&(e+=this.expr.charAt(this.index++));uO.isDecimalDigit(this.code);)e+=this.expr.charAt(this.index++);uO.isDecimalDigit(this.expr.charCodeAt(this.index-1))||this.throwError("Expected exponent ("+e+this.char+")")}return t=this.code,uO.isIdentifierStart(t)?this.throwError("Variable names cannot start with a number ("+e+this.char+")"):(t===uO.PERIOD_CODE||1===e.length&&e.charCodeAt(0)===uO.PERIOD_CODE)&&this.throwError("Unexpected period"),{type:uO.LITERAL,value:parseFloat(e),raw:e}}gobbleStringLiteral(){let e="",n=this.index,t=this.expr.charAt(this.index++),i=!1;for(;this.index<this.expr.length;){let n=this.expr.charAt(this.index++);if(n===t){i=!0;break}if("\\"===n)switch(n=this.expr.charAt(this.index++)){case"n":e+="\n";break;case"r":e+="\r";break;case"t":e+=" ";break;case"b":e+="\b";break;case"f":e+="\f";break;case"v":e+="\v";break;default:e+=n}else e+=n}return i||this.throwError('Unclosed quote after "'+e+'"'),{type:uO.LITERAL,value:e,raw:this.expr.substring(n,this.index)}}gobbleIdentifier(){let e=this.code,n=this.index;for(uO.isIdentifierStart(e)?this.index++:this.throwError("Unexpected "+this.char);this.index<this.expr.length;)if(e=this.code,uO.isIdentifierPart(e))this.index++;else break;return{type:uO.IDENTIFIER,name:this.expr.slice(n,this.index)}}gobbleArguments(e){let n=[],t=!1,i=0;for(;this.index<this.expr.length;){this.gobbleSpaces();let r=this.code;if(r===e){t=!0,this.index++,e===uO.CPAREN_CODE&&i&&i>=n.length&&this.throwError("Unexpected token "+String.fromCharCode(e));break}if(r===uO.COMMA_CODE){if(this.index++,++i!==n.length){if(e===uO.CPAREN_CODE)this.throwError("Unexpected token ,");else if(e===uO.CBRACK_CODE)for(let e=n.length;e<i;e++)n.push(null)}}else if(n.length!==i&&0!==i)this.throwError("Expected comma");else{let e=this.gobbleExpression();e&&e.type!==uO.COMPOUND||this.throwError("Expected comma"),n.push(e)}}return t||this.throwError("Expected "+String.fromCharCode(e)),n}gobbleGroup(){this.index++;let e=this.gobbleExpressions(uO.CPAREN_CODE);if(this.code===uO.CPAREN_CODE)return(this.index++,1===e.length)?e[0]:!!e.length&&{type:uO.SEQUENCE_EXP,expressions:e};this.throwError("Unclosed (")}gobbleArray(){return this.index++,{type:uO.ARRAY_EXP,elements:this.gobbleArguments(uO.CBRACK_CODE)}}}Object.assign(uO,{hooks:new class{add(e,n,t){if("string"!=typeof arguments[0])for(let e in arguments[0])this.add(e,arguments[0][e],arguments[1]);else(Array.isArray(e)?e:[e]).forEach(function(e){this[e]=this[e]||[],n&&this[e][t?"unshift":"push"](n)},this)}run(e,n){this[e]=this[e]||[],this[e].forEach(function(e){e.call(n&&n.context?n.context:n,n)})}},plugins:new class{constructor(e){this.jsep=e,this.registered={}}register(...e){e.forEach(e=>{if("object"!=typeof e||!e.name||!e.init)throw Error("Invalid JSEP plugin format");this.registered[e.name]||(e.init(this.jsep),this.registered[e.name]=e)})}}(uO),COMPOUND:"Compound",SEQUENCE_EXP:"SequenceExpression",IDENTIFIER:"Identifier",MEMBER_EXP:"MemberExpression",LITERAL:"Literal",THIS_EXP:"ThisExpression",CALL_EXP:"CallExpression",UNARY_EXP:"UnaryExpression",BINARY_EXP:"BinaryExpression",ARRAY_EXP:"ArrayExpression",TAB_CODE:9,LF_CODE:10,CR_CODE:13,SPACE_CODE:32,PERIOD_CODE:46,COMMA_CODE:44,SQUOTE_CODE:39,DQUOTE_CODE:34,OPAREN_CODE:40,CPAREN_CODE:41,OBRACK_CODE:91,CBRACK_CODE:93,QUMARK_CODE:63,SEMCOL_CODE:59,COLON_CODE:58,unary_ops:{"-":1,"!":1,"~":1,"+":1},binary_ops:{"||":1,"??":1,"&&":2,"|":3,"^":4,"&":5,"==":6,"!=":6,"===":6,"!==":6,"<":7,">":7,"<=":7,">=":7,"<<":8,">>":8,">>>":8,"+":9,"-":9,"*":10,"/":10,"%":10,"**":11},right_associative:new Set(["**"]),additional_identifier_chars:new Set(["$","_"]),literals:{true:!0,false:!1,null:null},this_str:"this"}),uO.max_unop_len=uO.getMaxKeyLen(uO.unary_ops),uO.max_binop_len=uO.getMaxKeyLen(uO.binary_ops);let uP=e=>new uO(e).parse(),uT=Object.getOwnPropertyNames(class{});Object.getOwnPropertyNames(uO).filter(e=>!uT.includes(e)&&void 0===uP[e]).forEach(e=>{uP[e]=uO[e]}),uP.Jsep=uO,uP.plugins.register({name:"ternary",init(e){e.hooks.add("after-expression",function(n){if(n.node&&this.code===e.QUMARK_CODE){this.index++;let t=n.node,i=this.gobbleExpression();if(i||this.throwError("Expected expression"),this.gobbleSpaces(),this.code===e.COLON_CODE){this.index++;let r=this.gobbleExpression();if(r||this.throwError("Expected expression"),n.node={type:"ConditionalExpression",test:t,consequent:i,alternate:r},t.operator&&e.binary_ops[t.operator]<=.9){let i=t;for(;i.right.operator&&e.binary_ops[i.right.operator]<=.9;)i=i.right;n.node.test=i.right,i.right=n.node,n.node=t}}else this.throwError("Expected :")}})}});let uB="ArrowFunctionExpression",uI={Array,Boolean,Symbol,Infinity,NaN,Math,Number,BigInt,String,RegExp,JSON,isFinite,isNaN,parseFloat,parseInt,decodeURI,encodeURI,encodeURIComponent,Object:{__proto__:void 0,assign:Object.assign.bind(null),fromEntries:Object.fromEntries.bind(null),hasOwn:Object.hasOwn.bind(null),keys:Object.keys.bind(null),is:Object.is.bind(null),values:Object.values.bind(null)}},uN={...uI,Promise};function uj(e,n={}){return uG(e,n,uq)}async function uR(e,n={}){return uU(e,n,uq)}function uF(e,n={}){return uG(e,n,uK)}function uL(e,n={}){return uU(e,n,uK)}function uW(e,n={}){return uG(e,n,uY)}function uV(e,n={}){return uU(e,n,uY)}function uG(e,n={},t){if("string"!=typeof e&&("object"!=typeof e||!e||!("type"in e)))throw`Unknown expression type ${e}. Expressions must either be a string or pre-compiled string.`;if("string"==typeof e&&0===e.trim().length)throw{type:"Empty expression",message:"Expression cannot be an empty string"};null==n&&(n={});let i=uX(n,uI),r=uJ("string"==typeof e?uP(e):e,i);if(t(r))return r;throw{type:"Invalid result",message:"string"==typeof e?`The expression ${e} did not produce a valid result`:"The expression did not produce a valid result"}}async function uU(e,n={},t){if("string"!=typeof e&&("object"!=typeof e||!e||!("type"in e)))return Promise.reject(`Unknown expression type ${e}. Expressions must either be a string or pre-compiled string.`);if("string"==typeof e&&0===e.trim().length)throw{type:"Empty expression",message:"Expression cannot be an empty string"};null==n&&(n={});let i=uX(n,uN);return Promise.resolve(uJ("string"==typeof e?uP(e):e,i)).then(n=>{if(t(n))return n;throw{type:"Invalid result",message:"string"==typeof e?`The expression ${e} did not produce a valid result`:"The expression did not produce a valid result"}})}function uH(e){return uP(e)}function uq(e){return"string"==typeof e||"number"==typeof e||"boolean"==typeof e||null==e||e instanceof Date}function uK(e){return"boolean"==typeof e}function uY(e){return"number"==typeof e}function uJ(e,n){switch(e.type){case"UnaryExpression":var t,i,r,a,o,s,l,c,u,p,d,f,h=e,g=n;let m=uJ(h.argument,g);switch(h.operator){case"+":return+m;case"-":return-m;case"~":return~m;case"!":return!m;default:throw`Expression evaluator does not support operator '${h.operator}''`}case"BinaryExpression":var b=e,y=n;let v=uJ(b.left,y),$=uJ(b.right,y);switch(b.operator){case"+":return v+$;case"-":return v-$;case"*":return v*$;case"/":return v/$;case"%":return v%$;case"**":return v**$;case"==":return v==$;case"===":return v===$;case"!=":return v!=$;case"!==":return v!==$;case">":return v>$;case">=":return v>=$;case"<":return v<$;case"<=":return v<=$;case"in":return v in $;case"&&":return v&&$;case"||":return v||$;case"??":return v??$;default:throw`Expression evaluator does not support operator '${b.operator}' operator`}case"ConditionalExpression":return t=e,i=n,uJ(t.test,i)?uJ(t.consequent,i):uJ(t.alternate,i);case"CallExpression":var A=e,w=n;let k=A.arguments?.map(uQ(w)),x=uJ(A.callee,w);if(x){if("function"!=typeof x)throw`${u1(A.callee)} is not a function`}else throw`No function named ${u1(A.callee)} is defined in this context`;return x(...k);case"ArrowFunctionExpression":let C;return r=e,a=n,C=r.params?.map(e=>{if("Identifier"===e.type)return e.name;throw`Cannot handle parameter of type ${e.type}`})??[],(function(...e){if(e.length<C.length)throw`Required argument(s) ${C.slice(e.length,-1).join(", ")} were not provided`;let n=Object.fromEntries(C.reduce((n,t,i)=>{let r=e[i];return function e(n){if("string"==typeof n||"number"==typeof n||"boolean"==typeof n||"function"==typeof n||null===n||n instanceof RegExp)return!0;if("object"==typeof n){for(let t of Object.keys(n))if(!e(n[t]))return!1;return!0}if(Array.isArray(n)){for(let t of n)if(!e(t))break}return!1}(r)&&n.push([t,r]),n},[]));return uJ(r.body,a.addVariables(n))}).bind(a.thisObj??null);case"MemberExpression":return function(e,n){let t,i=uJ(e.object,n);if(void 0===i)switch(e.object.type){case"Identifier":{let t=uZ(e.object,n);throw ReferenceError(`ReferenceError: ${t} is not defined`)}case"MemberExpression":{let t=uZ(e.property,n);throw TypeError(`TypeError: cannot read properties of undefined (reading '${t}')`)}default:throw`VisitMemberExpression does not support operator '${e.object.type}' type`}let r=i;if("string"==typeof i)r=String.prototype;else if("number"==typeof i)r=Number.prototype;else if("function"==typeof i);else if("object"!=typeof i)throw`VisitMemberExpression does not support member access on type ${typeof i}`;switch(n.thisObj=r,e.property.type){case"Identifier":case"MemberExpression":t=uJ(e.property,n);break;default:{let r=uJ(e.property,n);if(void 0===r)throw{type:"Illegal property access",message:"No property was supplied to the property access"};u0(r),t=i[r]}}return"function"==typeof t?t.bind(i):t}(e,n);case"ArrayExpression":return o=e,s=n,o.elements?.map(uQ(s));case"SequenceExpression":let E;return l=e,c=n,(E=l.expressions.map(uQ(c)))[E.length-1];case"NewExpression":var S=e,D=n;if(S.callee&&"Identifier"===S.callee.type){let e=S.arguments?.map(uQ(D));switch(S.callee.name){case"Date":return new Date(...e);case"RegExp":return new RegExp(...e);default:throw`Cannot instantiate object of type ${S.callee.name}`}}if(S.callee)throw"new must be called with either Date or RegExp";throw'Could not handle "new" without a specified class';case"Literal":return u0((u=e).value),u.value;case"Identifier":var M=e,z=n;u0(M.name);let O=z.thisObj;if(O&&("object"==typeof O||"function"==typeof O)&&M.name in O){let e=O[M.name];return u0(e),e}if(z.variables&&M.name in z.variables){let e=z.variables[M.name];return u0(e),e}return M.name in z.globals?z.globals[M.name]:void 0;case"TemplateLiteral":let P,T;return p=e,d=n,P=p.expressions?.map(uQ(d))??[],(T=p.quasis?.map(uQ(d))??[]).filter(e=>!e.tail).map(e=>e.value).join("")+P.join("")+T.filter(e=>e.tail).map(e=>e.value).join("");case"TemplateElement":return{value:(f=e).cooked,tail:f.tail};default:throw`Expression evaluator does not support expression of type '${e.type}'`}}function uZ(e,n){switch(e.type){case"Literal":return e.value;case"Identifier":return e.name;case"MemberExpression":return uZ(e.property,n);default:throw`VisitExpressionName does not support expression of type '${e.type}'`}}function uX(e,n){let t={thisObj:void 0,variables:{...e},globals:{...n},addVariables(e){return this.variables={...this.variables,...e},this}};return t.addVariables.bind(t),t}function uQ(e){return function(n){return null===n?null:uJ(n,e)}}function u0(e){if("__proto__"===e||"prototype"===e||"constructor"===e)throw{type:"Illegal property access",message:`Cannot access the ${e} property of objects`}}function u1(e){return e?"MemberExpression"===e.type?e.property?.name:e.name:null}function u2(e){if("string"!=typeof e&&("object"!=typeof e||!e||!("type"in e)))throw`Unknown expression type ${e}. Expressions must either be a string or pre-compiled string.`;let n={globals:{...uN},isLocalExpression:!1,variables:new Set};return u3("string"==typeof e?uP(e):e,n),[...n.variables]}function u3(e,n){switch(e.type){case"UnaryExpression":return i=e,r=n,u3(i.argument,r);case"BinaryExpression":return a=e,o=n,[u3(a.left,o),u3(a.right,o)].filter(Boolean);case"ConditionalExpression":return s=e,l=n,[u3(s.consequent,l),u3(s.test,l),u3(s.alternate,l)].filter(Boolean);case"CallExpression":let t;return c=e,u=n,t=u3(c.callee,u),c.arguments?.map(u5(u)),t;case"ArrowFunctionExpression":var i,r,a,o,s,l,c,u,p,d,f,h,g,m,b,y,v,$,A=e,w=n;let k={...w};k.isLocalExpression=!0;let x=A.params?.map(u5(k))??[],C=u3(A.body,k)??[];if(C&&Array.isArray(C))for(let e of C)x.includes(e)||w.variables.add(e);return;case"MemberExpression":let E;return p=e,d=n,u3(p.object,d),void((E={...d}).isLocalExpression=!0,u3(p.property,E));case"ArrayExpression":return f=e,h=n,void f.elements?.map(u5(h));case"SequenceExpression":return g=e,m=n,void g.expressions?.map(u5(m));case"NewExpression":return b=e,y=n,void b.arguments?.map(u5(y));case"Literal":case"TemplateElement":return;case"Identifier":var S=e,D=n;if(!(S.name in D.globals))if(D.isLocalExpression)return S.name;else D.variables.add(S.name);return;case"TemplateLiteral":return v=e,$=n,void(v.expressions?.map(u5($)),v.quasis?.map(u5($)));default:throw`Expression evaluator does not support expression of type '${e.type}'`}}function u5(e){return function(n){return null===n?null:u3(n,e)}}uP.plugins.register({name:"arrow",init(e){e.addBinaryOp("=>",.1,!0),e.hooks.add("gobble-expression",function(n){if(this.gobbleSpaces(),this.code===e.OPAREN_CODE){let t=this.index;if(this.index++,this.gobbleSpaces(),this.code===e.CPAREN_CODE){this.index++;let e=this.gobbleBinaryOp();if("=>"===e){let t=this.gobbleBinaryExpression();t||this.throwError("Expected expression after "+e),n.node={type:uB,params:null,body:t};return}}this.index=t}}),e.hooks.add("after-expression",function(n){!function n(t){t&&(Object.values(t).forEach(e=>{e&&"object"==typeof e&&n(e)}),"=>"===t.operator&&(t.type=uB,t.params=t.left?[t.left]:null,t.body=t.right,t.params&&t.params[0].type===e.SEQUENCE_EXP&&(t.params=t.params[0].expressions),delete t.left,delete t.right,delete t.operator))}(n.node)})}}),uP.plugins.register({name:"new",init(e){e.addUnaryOp("new"),e.hooks.add("after-token",function(n){let t=n.node;if(t&&"new"===t.operator){t.argument&&[e.CALL_EXP,e.MEMBER_EXP].includes(t.argument.type)||this.throwError("Expected new function()"),n.node=t.argument;let i=n.node;for(;i.type===e.MEMBER_EXP||i.type===e.CALL_EXP&&i.callee.type===e.MEMBER_EXP;)i=i.type===e.MEMBER_EXP?i.object:i.callee.object;i.type="NewExpression"}})}}),uP.plugins.register({name:"numbers",init(e){function n(e){return"x"===e||"X"===e?(this.index+=2,[[48,57],[65,70],[97,102]]):"b"===e||"B"===e?(this.index+=2,[[48,49]]):"o"===e||"O"===e||e>="0"&&e<="7"?(this.index+=e<="7"?1:2,[[48,55]]):null}function t(n){let t=this.index,i="",r=()=>{for(;e.isDecimalDigit(this.code)||95===this.code;)95===this.code?this.index++:i+=this.expr.charAt(this.index++)};r(),this.code===e.PERIOD_CODE&&(i+=this.expr.charAt(this.index++),r());let a=this.char;("e"===a||"E"===a)&&(i+=this.expr.charAt(this.index++),("+"===(a=this.char)||"-"===a)&&(i+=this.expr.charAt(this.index++)),r(),e.isDecimalDigit(this.expr.charCodeAt(this.index-1))||this.throwError("Expected exponent ("+i+this.char+")"));let o=this.code;if(e.isIdentifierStart(o))this.throwError("Variable names cannot start with a number ("+i+this.char+")");else if(o===e.PERIOD_CODE){i.length>1&&this.throwError(`Unexpected period ${JSON.stringify({chCode:o,number:i},null,2)}`),this.index=t;return}n.node={type:e.LITERAL,value:parseFloat(i),raw:this.expr.substring(t,this.index)}}e.hooks.add("gobble-token",function(i){if(48===this.code){var r,a,o;let s=this.index,l=this.expr.charAt(this.index+1),c=n.call(this,l);if(!c)return;let u="";for(;r=this.code,a=c,95===r||a.some(([e,n])=>r>=e&&r<=n);)95===this.code?this.index++:u+=this.expr.charAt(this.index++);if(e.isIdentifierPart(this.code)){if(e.isDecimalDigit(this.code)&&e.isDecimalDigit(l.charCodeAt(0))){this.index=s+1,t.call(this,i);return}this.throwError("unexpected char within number")}i.node={type:e.LITERAL,value:parseInt(u,"x"===(o=l)||"X"===o?16:"b"===o||"B"===o?2:8),raw:this.expr.substring(s,this.index)}}else(e.isDecimalDigit(this.code)||this.code===e.PERIOD_CODE)&&t.call(this,i)})}}),uP.plugins.register({name:"regex",init(e){e.hooks.add("gobble-token",function(n){if(47===this.code){let t=++this.index,i=!1;for(;this.index<this.expr.length;){if(47===this.code&&!i){let i,r=this.expr.slice(t,this.index),a="";for(;++this.index<this.expr.length;){let e=this.code;if(e>=97&&e<=122||e>=65&&e<=90||e>=48&&e<=57)a+=this.char;else break}try{i=new RegExp(r,a)}catch(e){this.throwError(e.message)}return n.node={type:e.LITERAL,value:i,raw:this.expr.slice(t-1,this.index)},n.node=this.gobbleTokenProperty(n.node),n.node}this.code===e.OBRACK_CODE?i=!0:i&&this.code===e.CBRACK_CODE&&(i=!1),this.index+=92===this.code?2:1}this.throwError("Unclosed Regex")}})}}),uP.plugins.register({name:"ternary",init(e){e.hooks.add("after-expression",function(n){if(n.node&&this.code===e.QUMARK_CODE){this.index++;let t=n.node,i=this.gobbleExpression();if(i||this.throwError("Expected expression"),this.gobbleSpaces(),this.code===e.COLON_CODE){this.index++;let r=this.gobbleExpression();if(r||this.throwError("Expected expression"),n.node={type:"ConditionalExpression",test:t,consequent:i,alternate:r},t.operator&&e.binary_ops[t.operator]<=.9){let i=t;for(;i.right.operator&&e.binary_ops[i.right.operator]<=.9;)i=i.right;n.node.test=i.right,i.right=n.node,n.node=t}}else this.throwError("Expected :")}})}}),uP.plugins.register({name:"jsepTemplateLiteral",init(e){function n(e,t=!0){if(96===this.code){let n={type:"TemplateLiteral",quasis:[],expressions:[]},i="",r="",a=!1,o=this.expr.length,s=()=>n.quasis.push({type:"TemplateElement",value:{raw:r,cooked:i},tail:a});for(;this.index<o;){let o=this.expr.charAt(++this.index);if("`"===o)return this.index+=1,a=!0,s(),e.node=n,t&&(e.node=this.gobbleTokenProperty(e.node)),e.node;if("$"===o&&"{"===this.expr.charAt(this.index+1))this.index+=2,s(),r="",i="",n.expressions.push(...this.gobbleExpressions(125)),125!==this.code&&this.throwError("unclosed ${");else if("\\"===o)switch(r+=o,o=this.expr.charAt(++this.index),r+=o,o){case"n":i+="\n";break;case"r":i+="\r";break;case"t":i+=" ";break;case"b":i+="\b";break;case"f":i+="\f";break;case"v":i+="\v";break;default:i+=o}else i+=o,r+=o}this.throwError("Unclosed `")}}e.hooks.add("gobble-token",n),e.hooks.add("after-token",function(t){if((t.node.type===e.IDENTIFIER||t.node.type===e.MEMBER_EXP)&&96===this.code)return t.node={type:"TaggedTemplateExpression",tag:t.node,quasi:n.bind(this)(t,!1)},t.node=this.gobbleTokenProperty(t.node),t.node})}}),uP.addBinaryOp("in",7),uP.addBinaryOp("??",1);let u4=q("feature-flags",{flags:function(){let e={};for(let n of Object.keys(localStorage))if(n.startsWith("openmrs:feature-flag:")){let t=n.replace("openmrs:feature-flag:",""),i=JSON.parse(localStorage.getItem(`openmrs:feature-flag-meta:${t}`)||"{}");e[t]={enabled:"true"===localStorage.getItem(n),...i}}return e}()});function u6(e,n,t){u4.setState(i=>({flags:{...i.flags,[e]:{enabled:i.flags[e]?.enabled??!1,label:n,description:t}}}))}function u8(){let e=u4.getState().flags;Object.keys(localStorage).filter(e=>e.startsWith("openmrs:feature-flag:")).forEach(n=>{let t=n.replace("openmrs:feature-flag:","");e[t]||(localStorage.removeItem(n),localStorage.removeItem(`openmrs:feature-flag-meta:${t}`))})}function u7(e){return u4.getState().flags[e].enabled}function u9(e,n){u4.subscribe(t=>{n(t.flags[e].enabled)})}function pe(e,n){u4.setState(t=>({flags:{...t.flags,[e]:{...t.flags[e],enabled:n}}}))}function pn(e){return!window.offlineEnabled||(e??navigator.onLine)}u4.subscribe(e=>{for(let[n,t]of Object.entries(e.flags))localStorage.setItem(`openmrs:feature-flag:${n}`,t.enabled.toString()),localStorage.setItem(`openmrs:feature-flag-meta:${n}`,JSON.stringify({label:t.label,description:t.description}))});var pt=eX(function(e,n,t){eY(e,n,t)});function pi(e=!0,n=!1){return pr(pn(),e,n)}function pr(e,n=!0,t=!1){return!!(e?n:t)}let pa=U("extensionsInternal",{slots:{},extensions:{}}),po=()=>q("extensionsInternal",{slots:{},extensions:{}});function ps(e){let n=pa.getState(),t=e(n);t!==n&&pa.setState(t)}let pl=()=>q("extensions",{slots:{}});function pc(e){let n=[];for(let t of Object.values(e.extensions))for(let e of t.instances)n.push({slotModuleName:e.slotModuleName,extensionModuleName:t.moduleName,slotName:e.slotName,extensionId:e.id});e1(nG.getState().mountedExtensions,n)||nG.setState({mountedExtensions:n})}pc(pa.getState()),pa.subscribe(pc);let pu=po(),pp=pl(),pd=nH(),pf=nY();function ph(e,n,t,i,r){let a={},o=pn(),s=Object.entries(i.flags).filter(([,{enabled:e}])=>e).map(([e])=>e);for(let[i,l]of Object.entries(e.slots)){let{config:c}=nK(n,l.name),u=px(i,e,c,t,s,o,r.session);a[i]={moduleName:l.moduleName,assignedExtensions:u}}e1(pp.getState().slots,a)||pp.setState({slots:a})}function pg(){ph(pu.getState(),pd.getState(),pf.getState(),u4.getState(),rg.getState())}function pm(e,n,t){return{moduleName:n,name:e,attachedIds:[],config:null,state:t}}function pb(e){let[n]=e.split("#");return n}function py(e,n){let t=pb(n);return e.extensions[t]}function p_(e){return py(pu.getState(),e)}pu.subscribe(e=>{ph(e,pd.getState(),pf.getState(),u4.getState(),rg.getState())}),pd.subscribe(e=>{ph(pu.getState(),e,pf.getState(),u4.getState(),rg.getState())}),pf.subscribe(e=>{ph(pu.getState(),pd.getState(),e,u4.getState(),rg.getState())}),u4.subscribe(e=>{ph(pu.getState(),pd.getState(),pf.getState(),e,rg.getState())}),rg.subscribe(e=>{ph(pu.getState(),pd.getState(),pf.getState(),u4.getState(),e)}),pg(),b(pg);let pv=e=>pu.setState(n=>(n.extensions[e.name]={...e,instances:[]},n));function p$(e,n){ps(t=>{let i=t.slots[e];return i?{...t,slots:{...t.slots,[e]:{...i,attachedIds:[...i.attachedIds,n]}}}:{...t,slots:{...t.slots,[e]:{...pm(e),attachedIds:[n]}}}})}function pA(e,n){ps(t=>{let i=t.slots[e];return i&&i.attachedIds.includes(n)?{...t,slots:{...t.slots,[e]:{...i,attachedIds:i.attachedIds.filter(e=>e!==n)}}}:t})}function pw(e){ps(n=>{let t=n.slots[e];return t?{...n,slots:{...n.slots,[e]:{...t,attachedIds:[]}}}:n})}function pk(e,n,t,i){let r=n.indexOf(e);if(-1!==r)return r;{if(void 0!==t)return 1e3+t;let n=i.indexOf(e);return -1!==n?2e3+n:-1}}function px(e,n,t,i,r,a,o){let s=function(e,n){let t=e.add||[],i=e.remove||[],r=e.order||[],{extensions:a}=pu.getState();return[...n,...t].filter(e=>!i.includes(e)).sort((e,t)=>{let i=pk(e,r,a[pb(e)]?.order,n),o=pk(t,r,a[pb(t)]?.order,n);return -1===o?-1:-1===i?1:i-o})}(t,n.slots[e].attachedIds),l=[],c=n.slots[e]?.state,u=c&&"object"==typeof c?{session:o,...c}:{session:o};for(let c of s){let{config:s}=nZ(i,e,c),p=pt(s,nX(t,e,c)),d=pb(c),f=n.extensions[d];if(f){let n=p?.["Display conditions"]?.privileges??f.privileges??[];if(n&&("string"==typeof n||Array.isArray(n)&&n.length>0)&&(!o?.user||!rA(n,o.user)))continue;let t=p?.["Display conditions"]?.expression||f.displayExpression;if(void 0!==t&&"string"==typeof t&&t.trim().length>0)try{if(!uF(t,u))continue}catch(n){console.error(`Error while evaluating expression '${t}' for extension ${d} in slot ${e}`,n);continue}if(f.featureFlag&&!r.includes(f.featureFlag)||window.offlineEnabled&&!pr(a,f.online,f.offline))continue;l.push({id:c,name:d,moduleName:f.moduleName,config:p,featureFlag:f.featureFlag,meta:f.meta,online:p?.["Display conditions"]?.online??f.online??!0,offline:p?.["Display conditions"]?.offline??f.offline??!1})}}return l}function pC(e){let n=pu.getState(),{config:t}=nq(e),i=pf.getState(),r=u4.getState(),a=rg.getState(),o=pn();return px(e,n,t,i,Object.entries(r.flags).filter(([,{enabled:e}])=>e).map(([e])=>e),o,a.session)}let pE=(e,n,t)=>pu.setState(i=>{let r=i.slots[n]?.moduleName;if(r&&r!=e)return console.warn(`An extension slot with the name '${n}' already exists. Refusing to register the same slot name twice (in "registerExtensionSlot"). The existing one is from module ${r}.`),i;if(r&&r==e)return i;if(i.slots[n])return{...i,slots:{...i.slots,[n]:{...i.slots[n],moduleName:e,state:t}}};let a=pm(n,e,t);return{...i,slots:{...i.slots,[n]:{...a}}}});function pS(e,n,t=!1){pu.setState(i=>{let r=t?pt(i.slots[e].state,n):n;return{...i,slots:{...i.slots,[e]:{...i.slots[e],state:r}}}})}let pD=()=>pp.setState(()=>({slots:{},extensions:{}})),pM=U("left-nav",{slotName:null,basePath:window.spaBase,mode:"normal"});function pz({name:e,basePath:n,mode:t,componentContext:i,state:r}){pM.setState({slotName:e,basePath:n,mode:t??"normal",componentContext:i,state:r})}function pO(e){pM.getState().slotName===e&&pM.setState(pM.getInitialState(),!0)}let pP=U("modalRegistry",{modals:{}});function pT(e){pP.setState(n=>(n.modals[e.name]=e,n))}function pB(e){let n=pP.getState().modals[e];if(!n){let t=p_(e);t&&(n={name:e,load:t.load,moduleName:t.moduleName},console.warn(`Modal ${e} was registered as an extension. This is deprecated and will be removed in the future. Please register it in the "modals" section of routes.json instead of the "extensions" section.`),pT(n))}return n}let pI=U("workspaceRegistrations",{workspaces:{}}),pN=U("workspaceGroups",{workspaceGroups:{}});function pj(e){pI.setState(n=>({workspaces:{...n.workspaces,[e.name]:{...e,load:e.load,preferredWindowSize:e.preferredWindowSize??"normal",type:e.type??"form",canHide:e.canHide??!1,canMaximize:e.canMaximize??!1,width:e.width??"narrow",groups:e.groups??[]}}}))}function pR(e){pN.setState(n=>{let t=n.workspaceGroups[e.name];return t?{workspaceGroups:{...n.workspaceGroups,[e.name]:{...t,members:Array.from(new Set([...t.members,...e.members]))}}}:{workspaceGroups:{...n.workspaceGroups,[e.name]:{name:e.name,members:e.members}}}})}let pF=new Set;function pL(e){let n=pI.getState().workspaces;if(n[e])return n[e];{let n=p_(e);if(n){var t;let i;return pF.has(e)||(console.warn(`The workspace '${e}' is registered as an extension. This is deprecated. Please register it in the "workspaces" section of the routes.json file.`),pF.add(e)),{name:n.name,title:(t=n,"string"==typeof(i=t?.meta?.title)?i:i&&"object"==typeof i?ap(t.moduleName,i.key,i.default):t.name),moduleName:n.moduleName,preferredWindowSize:n.meta?.screenSize??"normal",load:n.load,type:n.meta?.type??"form",canHide:n.meta?.canHide??!1,canMaximize:n.meta?.canMaximize??!1,width:n.meta?.width??"narrow",groups:n.meta?.groups??[]}}throw Error(`No workspace named '${e}' has been registered.`)}}function pW(e){let n=pN.getState().workspaceGroups;if(n[e])return n[e];throw Error(`No workspace group named '${e}' has been registered.`)}let pV=U("workspace2",{registeredGroupsByName:{},registeredWindowsByName:{},registeredWorkspacesByName:{},openedGroup:null,openedWindows:[],workspaceTitleByWorkspaceName:{},isMostRecentlyOpenedWindowHidden:!1});function pG(e){let{registeredWorkspacesByName:n,registeredWindowsByName:t}=pV.getState(),i=n[e];if(i){let n=t[i.window];if(n)return n;throw Error(`No workspace window found with name: ${i.window} for workspace: ${e}`)}throw Error(`No workspace found with name: ${e}`)}function pU(e){let{registeredGroupsByName:n,registeredWindowsByName:t}=pV.getState(),i=t[e];if(i){let t=n[i.group];if(t)return t;throw Error(`No workspace group found with name: ${i.group} for window: ${e}`)}throw Error(`No workspace window found with name: ${e}`)}function pH(e){let{openedWindows:n}=pV.getState();return n.findIndex(n=>n.openedWorkspaces.find(n=>n.workspaceName===e))}function pq(e,n){if(0==n.length)return;let{registeredGroupsByName:t}=pV.getState(),i={...t};for(let t of n){if(i[t.name])throw Error(`Cannot register workspace group ${t.name} more than once`);i[t.name]={...t,moduleName:e}}pV.setState({registeredGroupsByName:i})}function pK(e,n){if(0==n.length)return;let{registeredWindowsByName:t}=pV.getState(),i={...t};for(let t of n){if(i[t.name])throw Error(`Cannot register workspace window ${t.name} more than once`);let n={...t,moduleName:e};i[t.name]=n}pV.setState({registeredWindowsByName:i})}function pY(e,n){if(0==n.length)return;let{registeredWorkspacesByName:t}=pV.getState(),i={...t};for(let t of n){if(i[t.name])throw Error(`Cannot register workspace ${t.name} more than once`);let n={...t,moduleName:e};i[t.name]=n}pV.setState({registeredWorkspacesByName:i})}let pJ=0;async function pZ(e,n,t,i,r=e=>e,a={}){let o=pb(i),s=p_(i),l=null;if(e){if(!s)throw Error(`Couldn't find extension '${o}' to attach to '${n}'`);let{meta:c,moduleName:u,online:p,offline:d,load:f}=s;if(pi(p,d)){ps(r=>({...r,extensions:{...r.extensions,[o]:{...r.extensions[o],instances:[...r.extensions[o].instances,{domElement:e,id:i,slotName:n,slotModuleName:t}]}}}));let s=await f(),p=pJ++;l=ic(r({...s,name:`${n}/${o}-${p}`}),{...a,_meta:c,_extensionContext:{extensionId:i,extensionSlotName:n,extensionSlotModuleName:t,extensionModuleName:u},domElement:e})}}else console.warn(`Tried to render ${i} into ${n} but no DOM element was available.`);return l}var pX=t(15275),pQ=t.n(pX);let p0=(0,pX.createContext)({moduleName:"",featureName:""});function p1({to:e,templateParams:n,onBeforeNavigate:t,children:i,...r}){return(0,pX.useEffect)(()=>{r.href&&console.warn(`ConfigurableLink does not support the href prop. Use the 'to' prop instead. The provided href value is '${r.href}'`),r.onClick&&console.warn(`ConfigurableLink does not support the onClick prop. Use the 'onBeforeNavigate' prop instead. The 'to' prop of the offending link is ${e}`)},[]),pQ().createElement("a",{onClick:i=>{0===i.button&&!i.ctrlKey&&!i.shiftKey&&!i.altKey&&!i.metaKey&&(i.preventDefault(),t?.(i),i7({to:e,templateParams:n})),0===i.button&&(i.ctrlKey||i.metaKey)&&t?.(i),0===i.button&&i.shiftKey&&t?.(i),1===i.button&&t?.(i)},href:i6(e,n),...r},i)}let p2=({state:e,children:n,...t})=>{let{extension:i}=(0,pX.useContext)(p0),r=(0,pX.useRef)(null),a=(0,pX.useRef)(Promise.resolve()),o=(0,pX.useCallback)(n=>{i?.extensionSlotName&&i.extensionSlotModuleName&&i.extensionSlotModuleName&&!r.current&&pZ(n,i.extensionSlotName,i.extensionSlotModuleName,i.extensionId,void 0,e).then(e=>{r.current=e})},[]);return(0,pX.useEffect)(()=>()=>{if(r&&r.current)switch(r.current.getStatus()){case"MOUNTING":r.current.mountPromise.then(()=>{r.current?.getStatus()==="MOUNTED"&&r.current.unmount()});break;case"MOUNTED":r.current.unmount();break;case"UPDATING":a.current&&a.current.then(()=>{r.current?.getStatus()==="MOUNTED"&&r.current.unmount()})}},[]),(0,pX.useEffect)(()=>{r.current&&r.current.update&&"UNMOUNTING"!==r.current.getStatus()&&Promise.all([r.current.mountPromise,a.current]).then(()=>{r?.current?.getStatus()==="MOUNTED"&&r.current.update&&(a.current=r.current.update({...e}).catch(e=>{if(!(e instanceof Error)||!e.message.includes("minified message #32")||r.current?.getStatus()==="MOUNTED")throw e}))})},[e]),i?pQ().createElement("div",{ref:o,"data-extension-id":i?.extensionId,style:{position:"relative"},...t}):null};function p3(e,n){"function"==typeof n&&(n=n(e));let t={};for(let[i,r]of Object.entries(n)){let n=function(...n){e.setState(e=>r(e,...n))};t[i]=n}return t}let p5=()=>e=>e;function p4(e,n=p5(),t){let i=(0,pX.useCallback)(n=>e.subscribe(n),[e]),r=(0,pX.useCallback)(()=>n(e.getState()),[e,n]),a=(0,pX.useSyncExternalStore)(i,r,r),o=(0,pX.useMemo)(()=>t?p3(e,t):{},[e,t]);return{...a,...o}}function p6(e,n){return p4(e,p5(),n)}function p8(e){return function(n){let t=(0,pX.useCallback)(n=>e.subscribe(n),[]),i=(0,pX.useCallback)(()=>e.getState(),[]),r=(0,pX.useSyncExternalStore)(t,i,i),a=(0,pX.useMemo)(()=>n?p3(e,n):{},[n]);return{...r,...a}}}let p7=e=>p4(pl(),n=>n.slots?.[e]);function p9(e){let n=p7(e);return n?.assignedExtensions??[]}function de(e,n){let{moduleName:t}=(0,pX.useContext)(p0),i=(0,pX.useRef)(!0);if(!t)throw Error("ComponentContext has not been provided. This should come from @openmrs/esm-react-utils.");return(0,pX.useEffect)(()=>{pE(t,e,n),i.current=!1},[]),(0,pX.useEffect)(()=>{i.current||pS(e,n)},[e,n]),{extensions:p9(e),extensionSlotName:e,extensionSlotModuleName:t}}function dn(e){return e}function dt({name:e,extensionSlotName:n,select:t=dn,children:i,state:r,style:a,...o}){if(i&&r)throw Error("Both children and state have been provided. If children are provided, the state must be passed as a prop to the `Extension` component.");let s=e??n,l=(0,pX.useRef)(null),{extensions:c,extensionSlotModuleName:u}=de(s,r),p=(0,pX.useMemo)(()=>t(c),[t,c]),d=(0,pX.useMemo)(()=>{if("function"==typeof i&&!pQ().isValidElement(i))return p.map(e=>i(e,r))},[i,p]);return pQ().createElement("div",{ref:l,"data-extension-slot-name":s,"data-extension-slot-module-name":u,style:{...a,position:"relative"},...o},s&&p?.map((e,n)=>pQ().createElement(p0.Provider,{key:e.id,value:{moduleName:u,featureName:"",extension:{extensionId:e.id,extensionSlotName:s,extensionSlotModuleName:u}}},d?.[n]??("function"!=typeof i?i:null)??pQ().createElement(p2,{state:r}))))}var di=t(5338);function dr(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);n&&(i=i.filter(function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable})),t.push.apply(t,i)}return t}function da(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?dr(Object(t),!0).forEach(function(n){var i,r,a;i=e,r=n,a=t[n],r in i?Object.defineProperty(i,r,{value:a,enumerable:!0,configurable:!0,writable:!0}):i[r]=a}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):dr(Object(t)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))})}return e}function ds(e){return(ds="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function dl(e){return(dl="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function dc(e,n){var t;if("function"!=typeof(t=n.domElement?function(){return n.domElement}:n.domElementGetter?n.domElementGetter:e.domElementGetter?e.domElementGetter:function(e){var n=e.appName||e.name;if(!n)throw Error("single-spa's dom-element-getter-helpers was not given an application name as a prop, so it can't make a unique dom element container for the react application");var t="single-spa-application:".concat(n);return function(){var e=document.getElementById(t);return e||((e=document.createElement("div")).id=t,document.body.appendChild(e)),e}}(n)))throw Error("single-spa's dom-element-getter-helpers was given an invalid domElementGetter for application or parcel '".concat(n.name,"'. Expected a function, received ").concat(dl(t)));return function(){var e=t(n);if(!(e instanceof HTMLElement))throw Error("single-spa's dom-element-getter-helpers: domElementGetter returned an invalid dom element for application or parcel '".concat(n.name,"'. Expected HTMLElement, received ").concat(dl(e)));return e}}var du=null;try{du=require("react").createContext()}catch(e){}var dp={React:null,ReactDOM:null,ReactDOMClient:null,rootComponent:null,loadRootComponent:null,errorBoundary:null,errorBoundaryClass:null,domElementGetter:null,parcelCanUpdate:!0,suppressComponentDidCatchWarning:!1,domElements:{},renderResults:{},updateResolves:{},unmountResolves:{}};function dd(e,n){return e.rootComponent?Promise.resolve():e.loadRootComponent(n).then(function(n){e.rootComponent=n})}function df(e,n){return new Promise(function(t,i){e.suppressComponentDidCatchWarning||!function(e){if(!(e&&"string"==typeof e.version&&e.version.indexOf(".")>=0))return!1;var n=e.version.slice(0,e.version.indexOf("."));try{return Number(n)>=16}catch(e){return!1}}(e.React)||e.errorBoundary||e.errorBoundaryClass||(e.rootComponent.prototype?e.rootComponent.prototype.componentDidCatch||console.warn("single-spa-react: ".concat(n.name||n.appName||n.childAppName,"'s rootComponent should implement componentDidCatch to avoid accidentally unmounting the entire single-spa application.")):console.warn("single-spa-react: ".concat(n.name||n.appName||n.childAppName,"'s rootComponent does not implement an error boundary. If using a functional component, consider providing an opts.errorBoundary to singleSpaReact(opts).")));var r,a=db(e,n,function(){t(this)}),o=dc(e,n)(),s=function(e){var n=e.reactDom,t=e.renderType,i=e.elementToRender,r=e.domElement,a=n[t];if("function"!=typeof a)throw Error('renderType "'.concat(t,'" did not return a function.'));switch(t){case"createRoot":case"unstable_createRoot":case"createBlockingRoot":case"unstable_createBlockingRoot":var o=a(r);return o.render(i),o;case"hydrateRoot":return a(r,i);default:return a(i,r),null}}({elementToRender:a,domElement:o,reactDom:dm(e),renderType:"function"==typeof(r=e).renderType?r.renderType():r.renderType});e.domElements[n.name]=o,e.renderResults[n.name]=s})}function dh(e,n){return new Promise(function(t){e.unmountResolves[n.name]=t;var i=e.renderResults[n.name];i&&i.unmount?i.unmount():dm(e).unmountComponentAtNode(e.domElements[n.name]),delete e.domElements[n.name],delete e.renderResults[n.name]})}function dg(e,n){return new Promise(function(t){e.updateResolves[n.name]||(e.updateResolves[n.name]=[]),e.updateResolves[n.name].push(t);var i=db(e,n,null),r=e.renderResults[n.name];if(r&&r.render)r.render(i);else{var a=dc(e,n)();dm(e).render(i,a)}})}function dm(e){return e.ReactDOMClient||e.ReactDOM}function db(e,n,t){var i=e.React.createElement(e.rootComponent,n),r=du?e.React.createElement(du.Provider,{value:n},i):i;return(e.errorBoundary||n.errorBoundary||e.errorBoundaryClass||n.errorBoundaryClass)&&(e.errorBoundaryClass=e.errorBoundaryClass||n.errorBoundaryClass||function(e,n){function t(n){e.React.Component.apply(this,arguments),this.state={caughtError:null,caughtErrorInfo:null},t.displayName="SingleSpaReactErrorBoundary(".concat(n.name,")")}return t.prototype=Object.create(e.React.Component.prototype),t.prototype.render=function(){return this.state.caughtError?(e.errorBoundary||n.errorBoundary)(this.state.caughtError,this.state.caughtErrorInfo,this.props):this.props.children},t.prototype.componentDidCatch=function(e,n){this.setState({caughtError:e,caughtErrorInfo:n})},t}(e,n),r=e.React.createElement(e.errorBoundaryClass,n,r)),r=e.React.createElement(e.SingleSpaRoot,da(da({},n),{},{mountFinished:t,updateFinished:function(){e.updateResolves[n.name]&&(e.updateResolves[n.name].forEach(function(e){return e()}),delete e.updateResolves[n.name])},unmountFinished:function(){e.unmountResolves[n.name]&&(e.unmountResolves[n.name](),delete e.unmountResolves[n.name])}}),r)}var dy=t(38395),d_=t(59324),dv=t(88716);let d$={strictMode:!0,throwErrorsToConsole:!0,disableTranslations:!1},dA=new Map;(0,dv.initCache)(dA);let dw={errorRetryCount:3,fetcher:rd,focusThrottleInterval:18e5,revalidateIfStale:!0,revalidateOnFocus:!1,revalidateOnReconnect:!1,refreshInterval:0,shouldRetryOnError:e=>{if(e instanceof rh){let n=e.response.status;return!!(n>=500)||401===n||403===n||429===n}return!0},provider:()=>dA};function dk(e){if("object"!=typeof e||"string"!=typeof e.featureName||"string"!=typeof e.moduleName)throw Error("Invalid options");let n=Object.assign({},d$,e),t={...dw,...n.swrConfig};return function(e){var i,r,a,o,s;return a=r=class extends(i=pQ().Component){componentDidCatch(e,t){t&&t.componentStack&&(e.extra=Object.assign(e.extra||{},{componentStack:t.componentStack})),n.throwErrorsToConsole&&setTimeout(()=>{throw e}),this.setState({caughtError:e,caughtErrorInfo:t})}render(){if(this.state.caughtError)return pQ().createElement("div",null,"An error has occurred. Please try reloading the page.");{let i=pQ().createElement(pX.Suspense,{fallback:null},pQ().createElement(d_.BE,{value:t},pQ().createElement(p0.Provider,{value:this.state.config},n.disableTranslations?pQ().createElement(e,this.props):pQ().createElement(dy.I18nextProvider,{i18n:window.i18next,defaultNS:this.state.config.extension?`${this.state.config.moduleName}___${this.state.config.extension.extensionSlotName}___${this.state.config.extension.extensionId}`:this.state.config.moduleName},pQ().createElement(e,this.props)))));return n.strictMode&&pQ().StrictMode?pQ().createElement(pQ().StrictMode,null,i):i}}constructor(e){super(e),this.state={caughtError:null,caughtErrorInfo:null,config:{moduleName:n.moduleName,featureName:n.featureName,extension:e._extensionContext}}}},o="displayName",s=`OpenmrsReactComponent(${n.featureName})`,o in a?Object.defineProperty(a,o,{value:s,enumerable:!0,configurable:!0,writable:!0}):a[o]=s,r}}function dx(e,n){return function(e){if("object"!==ds(e))throw Error("single-spa-react requires a configuration object");var n,t=da(da({},dp),e);if(!t.React)throw Error("single-spa-react must be passed opts.React");if(!t.ReactDOM&&!t.ReactDOMClient)throw Error("single-spa-react must be passed opts.ReactDOM or opts.ReactDOMClient");if(t.renderType||(null!=(n=t.ReactDOMClient)&&n.createRoot?t.renderType="createRoot":t.renderType="render"),!t.rootComponent&&!t.loadRootComponent)throw Error("single-spa-react must be passed opts.rootComponent or opts.loadRootComponent");if(t.errorBoundary&&"function"!=typeof t.errorBoundary)throw Error("The errorBoundary opt for single-spa-react must either be omitted or be a function that returns React elements");!du&&t.React.createContext&&(du=t.React.createContext()),t.SingleSpaRoot=function(e){function n(e){n.displayName="SingleSpaRoot(".concat(e.name,")")}return n.prototype=Object.create(e.React.Component.prototype),n.prototype.componentDidMount=function(){setTimeout(this.props.mountFinished)},n.prototype.componentWillUnmount=function(){setTimeout(this.props.unmountFinished)},n.prototype.render=function(){return setTimeout(this.props.updateFinished),this.props.children},n}(t);var i={bootstrap:dd.bind(null,t),mount:df.bind(null,t),unmount:dh.bind(null,t)};return t.parcelCanUpdate&&(i.update=dg.bind(null,t)),i}({React:pQ(),ReactDOMClient:di,rootComponent:dk(n)(e)})}function dC(e,n){return()=>e().then(({default:e})=>dx(e,n))}function dE(e,n){return()=>Promise.resolve(dx(e,n))}let dS=dC,dD=W()(()=>({}));H("openmrs-app-context",dD);let dM={};function dz(e,n=e=>e){let t=dD.getState();return e in t?Object.freeze(Object.assign({},n?n(t[e]):t[e])):null}function dO(e,n){dD.setState(t=>(e in t||(t[e]={}),t[e]=n(t[e]),Object.assign({},t)))}function dP(e){return null===e?null:Object.freeze(Object.assign({},e))}let dT=new Map;function dB(e,n){let t=(0,pX.useRef)(n??{}),i=(0,pX.useRef)(n=>dO(e,n)),r=(0,pX.useRef)(Symbol());return(0,pX.useEffect)(()=>{let t=n??{},i=r.current;return null===dz(e)?!function(e,n=dM){dD.setState(t=>{if(e in t)throw Error(`Attempted to re-register namespace ${e} in the app context. Each namespace must be unregistered before the name can be registered again.`);return Object.assign({},t,{[e]:n===dM?{}:n})})}(e,t):(console.warn(`Namespace ${e} is already registered in the app context. This is likely a race condition during navigation, but may indicate two components are trying to own the same namespace. Updating the existing context.`),dO(e,()=>t)),dT.set(e,i),()=>{dT.get(e)===i&&(dD.setState(n=>(e in n&&delete n[e],n)),dT.delete(e))}},[e]),(0,pX.useEffect)(()=>{let i=n??{};j(t.current,i)||(dO(e,()=>i),t.current=i)},[n]),i.current}function dI({namespace:e,value:n}){return dB(e,n),null}let dN=({children:e,value:n,fallback:t})=>n?pQ().createElement(pQ().Fragment,null,e):t?pQ().createElement(pQ().Fragment,null,t):null;function dj(){let e=(0,pX.useRef)();return(!e.current||e.current.signal.aborted)&&(e.current=new AbortController),(0,pX.useEffect)(()=>{let n=e.current;return()=>n?.abort()},[]),e.current}function dR(e,n=e=>e??{}){let[t,i]=(0,pX.useState)(()=>{if(dF(e))return;let t=dz(e);if(null!==t)return n?n(t):t});return(0,pX.useEffect)(()=>{if(dF(e))throw Error(`The namespace supplied to useAppContext must be a non-empty string, but was "${e}".`)},[e]),(0,pX.useEffect)(()=>{var t;let r;return(t=e=>{if(null==e)return void i(void 0);let t=n?n(e):e;i(e=>j(e,t)?e:t)})(dP(r=dz(e))),dD.subscribe(n=>{let i=e in n?n[e]:null;i!==r&&(r=i,t(dP(i)))})},[e,n]),t}function dF(e){return"string"!=typeof e||0===e.trim().length}function dL(e){let[n,t]=(0,pX.useState)([]);return(0,pX.useEffect)(()=>pl().subscribe(i=>{let r=i.slots[e]?.assignedExtensions.map(e=>e.id)??[];e1(r,n)||t(r)}),[]),n}function dW(e,n){let{data:t,error:i,mutate:r,isLoading:a,isValidating:o}=(0,d_.Ay)(`${a2}?patient=${e}&includeEncounterless=${n}`,rd);return(0,pX.useMemo)(()=>({isLoading:a,data:t?.data.results??[],error:i,mutate:r,isValidating:o}),[t,i,a,o,r])}function dV(e){(0,pX.useEffect)(()=>{if(e){let e=window.getComputedStyle(document.body).overflow;return document.body.style.overflow="hidden",()=>{document.body.style.overflow=e}}},[e])}let dG={},dU=`No ComponentContext has been provided. This should come from "openmrsComponentDecorator".