@openmrs/esm-form-builder-app 3.5.2-pre.3716 → 3.5.2-pre.3718

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/4559.js CHANGED
@@ -12,7 +12,7 @@ If you're the maintainer: the 'elements' key only works with '_type' equal to 'A
12
12
  ${n}`)}return r}let tt=(e,n)=>{let t=structuredClone(n);if(!e)return t;for(let n of Object.keys(e)){let r=t[n],o=e[n];if(o&&(o.hasOwnProperty("_type")||o.hasOwnProperty("_default"))){t.hasOwnProperty(n)||(t[n]=o._default);let e=o._elements;if(r&&tr(e)){if(o._type===nx.Array&&Array.isArray(r)){let o=r.map(n=>tt(e,n));t[n]=o}else if(o._type===nx.Object)for(let n of Object.keys(r))r[n]=tt(e,r[n])}}else if(to(o)){let e=r??{};to(e)&&(t[n]=tt(o,e))}}return t};function tr(e){return!!e&&Object.keys(e).filter(e=>!["_default","_validators"].includes(e)).length>0}function to(e){return"object"==typeof e&&!Array.isArray(e)&&null!==e}let ti=new Set;function ta(e,n){let t=`${e}:::${n}`;ti||(ti=new Set),ti.has(t)||(console.error(n),ti.add(t))}let ts={"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:nx.Object,_default:{},_validators:[nC(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(", ")}.`})]}},tl={"Display conditions":{privileges:{_description:"The privilege(s) the user must have to use this extension",_type:nx.Array,_default:[]},expression:{_description:"The expression that determines whether the extension is displayed",_type:nx.String,_default:void 0}},...ts},tc=(e,n)=>nC(t=>e<=t&&t<=n,`must be between ${e} and ${n}`),tu=e=>{let n=e.concat(["openmrsBase","openmrsSpaBase"]);return nC(e=>{if(!e||"string"!=typeof e)return!1;let t=/\${(.*?)}/g,r=t.exec(e);for(;r;){if(!n.includes(r[1]))return!1;r=t.exec(e)}return!0},"Should be a URL or path. The allowed template parameters are "+n.map(e=>"${"+e+"}").join(", "))},tp=tu([]),td=e=>nC(n=>e.includes(n),`Must be one of the following: '${e.join("', '")}'.`),tf={inRange:tc,isUrl:tp,isUrlWithTemplateParameters:tu,oneOf:td};var th=t(48067);let tm=L("breadcrumbs",[]);function tg(e){return tb([e])}function tb(e){let n=[...ty(),...e.map(e=>({matcher:e.matcher instanceof RegExp?e.matcher:"string"==typeof e.matcher?(0,th.pathToRegexp)(e.matcher).regexp:(0,th.pathToRegexp)(e.path).regexp,settings:e}))];tm.setState(n,!0)}function ty(){return tm.getState()}function t_(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=t_(e,t.join("/"));if(n)return n}}(e,n)}function tv(e,n){if(e.length>0){let t=t_(e,n);if(t){let n=[t],r=t_(e,t.settings.parent);for(;void 0!==r;)n.push(r),r=t_(e,r.settings.parent);return n.reverse()}}return[]}function t$(e){return tv(ty(),e)}var tA=Object.freeze({__proto__:null,get start(){return rq},get ensureJQuerySupport(){return r$},get setBootstrapMaxTime(){return rt},get setMountMaxTime(){return rr},get setUnmountMaxTime(){return ro},get setUnloadMaxTime(){return ri},get registerApplication(){return rP},get unregisterApplication(){return rT},get getMountedApps(){return rD},get getAppStatus(){return rM},get unloadApplication(){return rB},get checkActivityFunctions(){return rO},get getAppNames(){return rS},get pathToActiveWhen(){return rj},get navigateToUrl(){return rd},get patchHistoryApi(){return ry},get triggerAppChange(){return rW},get addErrorHandler(){return tE},get removeErrorHandler(){return tD},get mountRootParcel(){return t8},get NOT_LOADED(){return tz},get LOADING_SOURCE_CODE(){return tP},get NOT_BOOTSTRAPPED(){return tO},get BOOTSTRAPPING(){return tT},get NOT_MOUNTED(){return tB},get MOUNTING(){return tI},get UPDATING(){return tj},get LOAD_ERROR(){return tL},get MOUNTED(){return tN},get UNLOADING(){return tF},get UNMOUNTING(){return tR},get SKIP_BECAUSE_BROKEN(){return tW}}),tw=("u">typeof globalThis?globalThis:"u">typeof window?window:"u">typeof global?global:"u">typeof self?self:{}).CustomEvent,tk=!function(){try{var e=new tw("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}:tw;let tx=[];function tC(e,n,t){let r=tM(e,n,t);tx.length?tx.forEach(e=>e(r)):setTimeout(()=>{throw r})}function tE(e){if("function"!=typeof e)throw Error(tS(28,!1));tx.push(e)}function tD(e){if("function"!=typeof e)throw Error(tS(29,!1));let n=!1;return tx=tx.filter(t=>{let r=t===e;return n=n||r,!r}),n}function tS(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 tM(e,n,t){let r,o=`${tH(n)} '${tU(n)}' died in status ${n.status}: `;if(e instanceof Error){try{e.message=o+e.message}catch(e){}r=e}else{console.warn(tS(30,!1,n.status,tU(n)));try{r=Error(o+JSON.stringify(e))}catch(n){r=e}}return r.appOrParcelName=tU(n),n.status=t,r}let tz="NOT_LOADED",tP="LOADING_SOURCE_CODE",tO="NOT_BOOTSTRAPPED",tT="BOOTSTRAPPING",tB="NOT_MOUNTED",tI="MOUNTING",tN="MOUNTED",tj="UPDATING",tR="UNMOUNTING",tF="UNLOADING",tL="LOAD_ERROR",tW="SKIP_BECAUSE_BROKEN";function tV(e){return e.status===tN}function tG(e){try{return e.activeWhen(window.location)}catch(n){return tC(n,e,tW),!1}}function tU(e){return e.name}function tq(e){return!!e.unmountThisParcel}function tH(e){return tq(e)?"parcel":"application"}function tK(){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 tY(e,n){for(let t=0;t<e.length;t++)if(n(e[t]))return e[t];return null}function tJ(e){return e&&("function"==typeof e||Array.isArray(e)&&!tY(e,e=>"function"!=typeof e))}function tZ(e,n){let t=e[n]||[];0===(t=Array.isArray(t)?t:[t]).length&&(t=[()=>Promise.resolve()]);let r=tH(e),o=tU(e);return function(e){return t.reduce((t,i,a)=>t.then(()=>{let t=i(e);return tX(t)?t:Promise.reject(tS(15,!1,r,o,n,a))}),Promise.resolve())}}function tX(e){return e&&"function"==typeof e.then&&"function"==typeof e.catch}let tQ=[];function t0(e,n){return Promise.resolve().then(()=>e.status!==tO?e:(e.status=tT,e.bootstrap?ra(e,"bootstrap").then(t).catch(t=>{if(n)throw tM(t,e,tW);return tC(t,e,tW),e}):Promise.resolve().then(t)));function t(){return e.status=tB,e}}function t1(e,n){return Promise.resolve().then(()=>{if(e.status!==tN)return e;return e.status=tR,Promise.all(Object.keys(e.parcels).map(n=>e.parcels[n].unmountThisParcel())).then(t,r=>t().then(()=>{let t=Error(r.message);if(n)throw tM(t,e,tW);tC(t,e,tW)})).then(()=>e);function t(){return ra(e,"unmount").then(()=>{e.status=tB},t=>{if(n)throw tM(t,e,tW);tC(t,e,tW)})}})}let t2=!1,t3=!1;function t5(e,n){return Promise.resolve().then(()=>e.status!==tB?e:(t2||(window.dispatchEvent(new tk("single-spa:before-first-mount")),t2=!0),e.status=tI,ra(e,"mount").then(()=>(e.status=tN,t3||(window.dispatchEvent(new tk("single-spa:first-mount")),t3=!0),e)).catch(t=>{return e.status=tN,t1(e,!0).then(r,r);function r(){if(n)throw tM(t,e,tW);return tC(t,e,tW),e}})))}let t4=0,t6={parcels:{}};function t8(){return t7.apply(t6,arguments)}function t7(e,n){let t,r,o,i=this;if(!e||"object"!=typeof e&&"function"!=typeof e)throw Error(tS(2,!1));if(e.name&&"string"!=typeof e.name)throw Error(tS(3,!1,typeof e.name));let a=t4++,s=e.name||`parcel-${a}`;if("object"!=typeof n)throw Error(tS(4,!1,s,typeof n));if(!n.domElement)throw Error(tS(5,!1,s));let l="function"==typeof e,c=l?e:()=>Promise.resolve(e),u={id:a,parcels:{},status:l?tP:tO,customProps:n,parentName:tU(i),unmountThisParcel:()=>f.then(()=>{if(u.status!==tN)throw Error(tS(6,!1,s,u.status));return t1(u,!0)}).then(e=>(u.parentName&&delete i.parcels[u.id],e)).then(e=>(r(e),e)).catch(e=>{throw u.status=tW,o(e),e})};i.parcels[a]=u;let p=c();if(!p||"function"!=typeof p.then)throw Error(tS(7,!1));let d=(p=p.then(e=>{if(!e)throw Error(tS(8,!1));if(s=e.name||`parcel-${a}`,Object.prototype.hasOwnProperty.call(e,"bootstrap")&&!tJ(e.bootstrap))throw Error(tS(9,!1,s));if(!tJ(e.mount))throw Error(tS(10,!1,s));if(!tJ(e.unmount))throw Error(tS(11,!1,s));if(e.update&&!tJ(e.update))throw Error(tS(12,!1,s));let n=tZ(e,"bootstrap"),r=tZ(e,"mount"),o=tZ(e,"unmount");u.status=tO,u.name=s,u.bootstrap=n,u.mount=r,u.unmount=o,u.timeouts=rs(e.timeouts),e.update&&(u.update=tZ(e,"update"),t.update=function(e){return u.customProps=e,t9(Promise.resolve().then(()=>{if(u.status!==tN)throw Error(tS(32,!1,tU(u)));return u.status=tj,ra(u,"update").then(()=>(u.status=tN,u)).catch(e=>{throw tM(e,u,tW)})}))})})).then(()=>t0(u,!0)),f=d.then(()=>t5(u,!0)),h=new Promise((e,n)=>{r=e,o=n});return t={mount:()=>t9(Promise.resolve().then(()=>{if(u.status!==tB)throw Error(tS(13,!1,s,u.status));return i.parcels[a]=u,t5(u)})),unmount:()=>t9(u.unmountThisParcel()),getStatus:()=>u.status,loadPromise:t9(p),bootstrapPromise:t9(d),mountPromise:t9(f),unmountPromise:t9(h)}}function t9(e){return e.then(()=>null)}function re(e){let n=tU(e),t="function"==typeof e.customProps?e.customProps(n,window.location):e.customProps;("object"!=typeof t||null===t||Array.isArray(t))&&(t={},console.warn(tS(40,!1),n,t));let r=tK({},t,{name:n,mountParcel:t7.bind(e),singleSpa:tA});return tq(e)&&(r.unmountSelf=e.unmountThisParcel),r}let rn={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 rt(e,n,t){if("number"!=typeof e||e<=0)throw Error(tS(16,!1));rn.bootstrap={millis:e,dieOnTimeout:n,warningMillis:t||1e3}}function rr(e,n,t){if("number"!=typeof e||e<=0)throw Error(tS(17,!1));rn.mount={millis:e,dieOnTimeout:n,warningMillis:t||1e3}}function ro(e,n,t){if("number"!=typeof e||e<=0)throw Error(tS(18,!1));rn.unmount={millis:e,dieOnTimeout:n,warningMillis:t||1e3}}function ri(e,n,t){if("number"!=typeof e||e<=0)throw Error(tS(19,!1));rn.unload={millis:e,dieOnTimeout:n,warningMillis:t||1e3}}function ra(e,n){let t=e.timeouts[n],r=t.warningMillis,o=tH(e);return new Promise((i,a)=>{let s=!1,l=!1;e[n](re(e)).then(e=>{s=!0,i(e)}).catch(e=>{s=!0,a(e)}),setTimeout(()=>u(1),r),setTimeout(()=>u(!0),t.millis);let c=tS(31,!1,n,o,tU(e),t.millis);function u(e){s||(!0===e?(l=!0,t.dieOnTimeout?a(Error(c)):console.error(c)):!l&&(console.warn(c),e*r+r<t.millis&&setTimeout(()=>u(e+1),r)))}})}function rs(e){let n={};for(let t in rn)n[t]=tK({},rn[t],e&&e[t]||{});return n}function rl(e){return Promise.resolve().then(()=>{let n,t;return e.loadPromise?e.loadPromise:e.status!==tz&&e.status!==tL?e:(e.status=tP,e.loadPromise=Promise.resolve().then(()=>{let r=e.loadApp(re(e));if(!tX(r))throw t=!0,Error(tS(33,!1,tU(e)));return r.then(t=>{let r;e.loadErrorTime=null,"object"!=typeof(n=t)&&(r=34),Object.prototype.hasOwnProperty.call(n,"bootstrap")&&!tJ(n.bootstrap)&&(r=35),tJ(n.mount)||(r=36),tJ(n.unmount)||(r=37);let o=tH(n);if(r){let t;try{t=JSON.stringify(n)}catch(e){}return console.error(tS(r,!1,o,tU(e),t),n),tC(void 0,e,tW),e}return n.devtools&&n.devtools.overlays&&(e.devtools.overlays=tK({},e.devtools.overlays,n.devtools.overlays)),e.status=tO,e.bootstrap=tZ(n,"bootstrap"),e.mount=tZ(n,"mount"),e.unmount=tZ(n,"unmount"),e.unload=tZ(n,"unload"),e.timeouts=rs(n.timeouts),delete e.loadPromise,e})}).catch(n=>{let r;return delete e.loadPromise,t?r=tW:(r=tL,e.loadErrorTime=(new Date).getTime()),tC(n,e,r),e}))})}let rc="u">typeof window,ru={hashchange:[],popstate:[]},rp=["hashchange","popstate"];function rd(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(tS(14,!1));n=e.currentTarget.href,e.preventDefault()}let t=r_(window.location.href),r=r_(n);0===n.indexOf("#")?window.location.hash=r.hash:t.host!==r.host&&r.host?window.location.href=n:r.pathname===t.pathname&&r.search===t.search?window.location.hash=r.hash:window.history.pushState(null,null,n)}function rf(e){if(e){let n=e[0].type;rp.indexOf(n)>=0&&ru[n].forEach(n=>{try{n.apply(this,e)}catch(e){setTimeout(()=>{throw e})}})}}function rh(){rV([],arguments)}function rm(e,n){return function(){let t=window.location.href,r=e.apply(this,arguments),i=window.location.href;return o&&t===i||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 rg=null,rb=!1;function ry(e){if(rb)throw Error(tS(43,!1));o=!e||!e.hasOwnProperty("urlRerouteOnly")||e.urlRerouteOnly,rb=!0,rg=window.history.replaceState,window.addEventListener("hashchange",rh),window.addEventListener("popstate",rh);let n=window.addEventListener,t=window.removeEventListener;window.addEventListener=function(e,t){if(!("function"==typeof t&&rp.indexOf(e)>=0)||tY(ru[e],e=>e===t))return n.apply(this,arguments);ru[e].push(t)},window.removeEventListener=function(e,n){return"function"==typeof n&&rp.indexOf(e)>=0&&(ru[e]=ru[e].filter(e=>e!==n)),t.apply(this,arguments)},window.history.pushState=rm(window.history.pushState,"pushState"),window.history.replaceState=rm(rg,"replaceState")}function r_(e){let n=document.createElement("a");return n.href=e,n}rc&&(window.singleSpaNavigate?console.warn(tS(41,!1)):window.singleSpaNavigate=rd);let rv=!1;function r$(e=window.jQuery){if(e||window.$&&window.$.fn&&window.$.fn.jquery&&(e=window.$),e&&!rv){let n=e.fn.on,t=e.fn.off;e.fn.on=function(e,t){return rA.call(this,n,window.addEventListener,e,t,arguments)},e.fn.off=function(e,n){return rA.call(this,t,window.removeEventListener,e,n,arguments)},rv=!0}}function rA(e,n,t,r,o){return"string"!=typeof t?e.apply(this,o):(t.split(/\s+/).forEach(e=>{rp.indexOf(e)>=0&&(n(e,r),t=t.replace(e,""))}),""===t.trim()?this:e.apply(this,o))}let rw={};function rk(e){return Promise.resolve().then(()=>{let n=rw[tU(e)];if(!n)return e;if(e.status===tz)return rx(e,n),e;if(e.status===tF)return n.promise.then(()=>e);if(e.status!==tB&&e.status!==tL)return e;let t=e.status===tL?Promise.resolve():ra(e,"unload");return e.status=tF,t.then(()=>(rx(e,n),e)).catch(t=>(delete rw[tU(e)],delete e.bootstrap,delete e.mount,delete e.unmount,delete e.unload,tC(t,e,tW),n.reject(t),e))})}function rx(e,n){delete rw[tU(e)],delete e.bootstrap,delete e.mount,delete e.unmount,delete e.unload,e.status=tz,n.resolve()}function rC(e,n,t,r){rw[tU(e)]={app:e,resolve:t,reject:r},Object.defineProperty(rw[tU(e)],"promise",{get:n})}let rE=[];function rD(){return rE.filter(tV).map(tU)}function rS(){return rE.map(tU)}function rM(e){let n=tY(rE,n=>tU(n)===e);return n?n.status:null}let rz=!1;function rP(e,n,t,r){var o,i;let a,s,l=(a={name:null,loadApp:null,activeWhen:null,customProps:null},"object"==typeof e?(function(e){if(Array.isArray(e)||null===e)throw Error(tS(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(tS(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(tS(20,!1));let r=e=>"string"==typeof e||"function"==typeof e;if(!(r(e.activeWhen)||Array.isArray(e.activeWhen)&&e.activeWhen.every(r)))throw Error(tS(24,!1));if(!rN(e.customProps))throw Error(tS(22,!1))}(e),a.name=e.name,a.loadApp=e.app,a.activeWhen=e.activeWhen,a.customProps=e.customProps):(function(e,n,t,r){if("string"!=typeof e||0===e.length)throw Error(tS(20,!1));if(!n)throw Error(tS(23,!1));if("function"!=typeof t)throw Error(tS(24,!1));if(!rN(r))throw Error(tS(22,!1))}(e,n,t,r),a.name=e,a.loadApp=n,a.activeWhen=t,a.customProps=r),a.loadApp="function"!=typeof(o=a.loadApp)?()=>Promise.resolve(o):o,a.customProps=a.customProps||{},s=(s=Array.isArray(i=a.activeWhen)?i:[i]).map(e=>"function"==typeof e?e:rj(e)),a.activeWhen=e=>s.some(n=>n(e)),a);if(rU||rz||(rz=!0,setTimeout(()=>{rU||console.warn(tS(1,!1))},5e3)),-1!==rS().indexOf(l.name))throw Error(tS(21,!1,l.name));rE.push(tK({loadErrorTime:null,status:tz,parcels:{},devtools:{overlays:{options:{},selectors:[]}}},l)),rc&&(r$(),rV())}function rO(e=window.location){return rE.filter(n=>n.activeWhen(e)).map(tU)}function rT(e){if(0===rE.filter(n=>tU(n)===e).length)throw Error(tS(25,!1,e));return(rc?rB(e,{waitForUnmount:!1}):Promise.resolve()).then(()=>{let n=rE.map(tU).indexOf(e);rE.splice(n,1)})}function rB(e,n={waitForUnmount:!1}){if("string"!=typeof e)throw Error(tS(26,!1));let t=tY(rE,n=>tU(n)===e);if(!t)throw Error(tS(27,!1,e));let r=rw[tU(t)];if(n&&n.waitForUnmount){if(r)return r.promise;{let e=new Promise((n,r)=>{rC(t,()=>e,n,r)});return e}}{let e;return r?(e=r.promise,rI(t,r.resolve,r.reject)):e=new Promise((n,r)=>{rC(t,()=>e,n,r),rI(t,n,r)}),e}}function rI(e,n,t){Promise.resolve().then(()=>{if(tY(rO(),n=>n===tU(e)))return rW()}).then(()=>t1(e).then(rk).then(()=>{n(),setTimeout(()=>{rV()})})).catch(t)}function rN(e){return!e||"function"==typeof e||"object"==typeof e&&null!==e&&!Array.isArray(e)}function rj(e,n){let t=function(e,n){let t=0,r=!1,o="^";"/"!==e[0]&&(e="/"+e);for(let n=0;n<e.length;n++){let t=e[n],o=r&&"/"===t;(!r&&":"===t||o)&&i(n)}return i(e.length),RegExp(o,"i");function i(i){let a=e.slice(t,i).replace(/[|\\{}()[\]^$+*?.]/g,"\\$&");if(o+=r?"[^/]+/?":a,i===e.length)if(r)n&&(o+="$");else{let e=n?"":".*";o="/"===o.charAt(o.length-1)?`${o}${e}$`:`${o}(/${e})?(#.*)?$`}r=!r,t=i}}(e,n);return e=>{let n=e.origin;n||(n=`${e.protocol}//${e.host}`);let r=e.href.replace(n,"").replace(e.search,"").split("?")[0];return t.test(r)}}let rR=!1,rF=[],rL=rc&&window.location.href;function rW(){return rV()}function rV(e=[],n,t=!1){let r,o,i,a,s;if(rR)return new Promise((e,t)=>{rF.push({resolve:e,reject:t,eventArguments:n})});let{appsToUnload:l,appsToUnmount:c,appsToLoad:u,appsToMount:p}=(r=[],o=[],i=[],a=[],s=(new Date).getTime(),rE.forEach(e=>{let n=e.status!==tW&&tG(e);switch(e.status){case tL:n&&s-e.loadErrorTime>=200&&i.push(e);break;case tz:case tP:n&&i.push(e);break;case tO:case tB:!n&&rw[tU(e)]?r.push(e):n&&a.push(e);break;case tN:n||o.push(e)}}),{appsToUnload:r,appsToUnmount:o,appsToLoad:i,appsToMount:a}),d,f=[],h=rL,m=rL=window.location.href;return rU?(rR=!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:g})),Promise.all(f).then(t=>{if(t.some(e=>e))return rg.call(window.history,history.state,"",h.substring(location.origin.length)),rL=location.href,rR=!1,rV(e,n,!0);let r=l.map(rk),o=Promise.all(c.map(t1).map(e=>e.then(rk)).concat(r));o.then(()=>{$("before-mount-routing-event",v(!0))},e=>{throw e});let i=u.map(e=>rl(e).then(e=>rG(e,o))),a=p.filter(e=>0>u.indexOf(e)).map(e=>rG(e,o));return o.catch(e=>{throw y(),e}).then(()=>(y(),Promise.all(i.concat(a)).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(rl)).then(y).then(()=>[]).catch(e=>{throw y(),e}).finally(()=>{})));function g(e=!0){let n="function"==typeof(null==e?void 0:e.then)?e:Promise.resolve(e);f.push(n.catch(e=>(console.warn(Error(tS(42,!1))),console.warn(e),!1)))}function b(){let n=rD();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(rR=!1,rF.length>0){let e=rF;rF=[],rV(e)}return n}function y(){t||(e.forEach(e=>{rf(e.eventArguments)}),rf(n))}function v(e=!1,t){let r={},o={[tN]:[],[tB]:[],[tz]:[],[tW]:[]};e?(u.concat(p).forEach((e,n)=>{a(e,tN)}),l.forEach(e=>{a(e,tz)}),c.forEach(e=>{a(e,tB)})):d.forEach(e=>{a(e)});let i={detail:{newAppStatuses:r,appsByNewStatus:o,totalAppChanges:d.length,originalEvent:null==n?void 0:n[0],oldUrl:h,newUrl:m}};return t&&tK(i.detail,t),i;function a(e,n){let t=tU(e);n=n||rM(t),r[t]=n,(o[n]=o[n]||[]).push(t)}}function $(e,n){t||window.dispatchEvent(new tk(`single-spa:${e}`,n))}}function rG(e,n){return tG(e)?t0(e).then(e=>n.then(()=>tG(e)?t5(e):e)):n.then(()=>e)}let rU=!1;function rq(e){rU=!0,rc&&(ry(e),rV())}function rH(e,n){let t=window.getOpenmrsSpaBase().replace(/\/$/,"");return rK(e,{openmrsBase:window.openmrsBase,openmrsSpaBase:t,...n}).replace(/^\/\//,"/")}function rK(e,n){return Object.keys(n).reduce((e,t)=>e.split("${"+t+"}").join(n[t]),e)}function rY({to:e,templateParams:n}){let t=window.getOpenmrsSpaBase().replace(/\/$/,""),r=rH(e,n).replace(window.location.origin,"");r.startsWith(t)?rd(r):window.location.assign(r)}rc&&window.__SINGLE_SPA_DEVTOOLS__&&(window.__SINGLE_SPA_DEVTOOLS__.exposedMethods={getRawAppData:function(){return[...rE]},reroute:rV,NOT_LOADED:tz,toLoadPromise:rl,toBootstrapPromise:t0,unregisterApplication:rT,getProfilerData:function(){return tQ}});let rJ="openmrs:history";function rZ(){return JSON.parse(sessionStorage.getItem(rJ)??"[]")}function rX({toUrl:e}){let n=rZ(),t=n.lastIndexOf(e);if(-1!=t){let e=n.slice(0,t+1);rY({to:n[t]}),sessionStorage.setItem(rJ,JSON.stringify(e))}else throw Error(`URL ${e} not found in history; cannot go back to it.`)}function rQ(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}nx.Boolean,nx.String,tf.isUrl,nx.Array,nx.Number,tf.inRange(100,600),nx.Boolean,nx.Boolean;let r0="/ws/rest/v1",r1="/ws/fhir2/R4",r2=`${r0}/session`;function r3(e){return e&&e.startsWith("http")?e:("/"!==e[0]&&(e="/"+e),window.openmrsBase+e)}function r5(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=r3(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(r0)&&void 0===n.headers["Disable-WWW-Authenticate"]&&(n.headers["Disable-WWW-Authenticate"]="true"),e.startsWith(r1)){let e=new URL(t,window.location.toString());e.searchParams.has("_summary")||(e.searchParams.set("_summary","data"),t=e.toString())}let r=Error();return window.fetch(t,n).then(async e=>{let{redirectAuthFailure:n,followRedirects:o}=await n0("@openmrs/esm-api");if(e.ok){let n=e.headers.get("location");return(o&&n&&(t===r3(r2)||204===e.status)&&rY({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===r3(r2)&&403===e.status||n.enabled&&n.errors.includes(e.status)?(sessionStorage.removeItem(rJ),rY({to:n.url||e.headers.get("location")||"${openmrsSpaBase}/login"}),n.resolvePromise?Promise.resolve():new Promise(()=>{})):e.clone().text().then(n=>{let o=n;try{o=JSON.parse(n)}catch(e){}throw new r6(t,e,o,r)},n=>{throw new r6(t,e,null,r)})})}function r4(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 er.Observable(r=>{let o=!1;return r5(e,n).then(e=>{o=!0,r.next(e),r.complete()},e=>{o=!0,r.error(e)}),()=>{o||t.abort()}})}class r6 extends Error{constructor(e,n,t,r){super(),rQ(this,"response",void 0),rQ(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`,r.message=this.message,this.responseBody=t,this.response=n,this.stack=`Stacktrace for outgoing request:
13
13
  ${r.stack}
14
14
  Stacktrace for incoming response:
15
- ${this.stack}`}}let r8=L("session",{loaded:!1,session:null}),r7=0;function r9(e={includeAuthStatus:!0}){return(r7<Date.now()-6e4||!r8.getState().loaded)&&ot(),new er.Observable(n=>{let t=t=>{t.loaded&&(e.includeAuthStatus?n.next(t.session):n.next(t.session?.user))};return t(r8.getState()),r8.subscribe(t)})}function oe(){return(r7<Date.now()-6e4||!r8.getState().loaded)&&ot(),r8}function on(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 ot(e,n){r7=Date.now();let t={};return e&&n&&(t.Authorization=`Basic ${window.btoa(`${e}:${n}`)}`),oc(r5(r2,{headers:t}))}function or(){r8.setState({loaded:!0,session:{authenticated:!1,sessionId:""}})}function oo(e,n){var t,r;if(void 0===n)return!e;if(!e)return!0;return t=e,r=n,("string"==typeof t?!q(r.privileges.find(e=>t===e.display)):Array.isArray(t)?t.every(e=>!q(r.privileges.find(n=>e===n.display))):(q(t)||console.error(`Could not understand privileges "${t}"`),!0))||!q(n.roles.find(e=>"System Developer"===e.display))}function oi(){let e,n;return new Promise(t=>{let r=r=>{r.loaded&&r.session.user&&(e=r.session.user,t(r.session.user),n&&n())};r(r8.getState()),e||(n=r8.subscribe(r))})}function oa(){return new Promise((e,n)=>{r9().subscribe(n=>{e(n.sessionLocation)},n).unsubscribe()})}async function os(e,n){return oc(r5(r2,{method:"POST",body:{sessionLocation:e},headers:{"Content-Type":"application/json"},signal:n.signal}))}async function ol(e,n,t){return t||(t=new AbortController),await r5(`${r0}/user/${e}`,{method:"POST",body:{userProperties:n},headers:{"Content-Type":"application/json"},signal:t.signal}),ot()}function oc(e){return new Promise((n,t)=>{e.then(e=>{let r;"object"==typeof e?.data?(r={loaded:!0,session:e.data},r8.setState(r),n(r)):(r={loaded:!1,session:null},r8.setState(r),t(r))}).catch(e=>{z(`Failed to fetch new session information: ${e}`);let n={loaded:!1,session:null};r8.setState(n),t(n)})})}function ou(){return"development"===window.spaEnv||"true"===localStorage.getItem("openmrs:devtools")}r8.subscribe(e=>{e.loaded&&e.session&&on(e.session)});let op={"webservices.rest":"2.24.0",fhir2:"1.0.0-SNAPSHOT"},od=j()(()=>({}));W("openmrs-app-context",od);let of={};function oh(e,n=of){od.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===of?{}:n})})}function om(e){od.setState(n=>(e in n&&delete n[e],n))}function og(e,n=e=>e){let t=od.getState();return e in t?Object.freeze(Object.assign({},n?n(t[e]):t[e])):null}function ob(e,n){od.setState(t=>(e in t||(t[e]={}),t[e]=n(t[e]),Object.assign({},t)))}function oy(e,n){let t=og(e);return n(o_(t)),od.subscribe(r=>{let o=e in r?r[e]:null;o!==t&&(t=o,n(o_(o)))})}function o_(e){return null===e?null:Object.freeze(Object.assign({},e))}let ov={address1:"Address line 1",address2:"Address line 2",address3:"Address line 3",address4:"Address line 4",address5:"Address line 5",address6:"Address line 6",city:"City",cityVillage:"City",country:"Country",countyDistrict:"District",district:"District",postalCode:"Postal code",state:"State",stateProvince:"State",closeAllOpenedWorkspaces:"Discard changes in {{count}} workspaces",closingAllWorkspacesPromptBody:"There may be unsaved changes in the following workspaces. Do you want to discard changes in the following workspaces? {{workspaceNames}}",closingAllWorkspacesPromptTitle:"You have unsaved changes",discard:"Discard",hide:"Hide",maximize:"Maximize",minimize:"Minimize",openAnyway:"Open anyway",unsavedChangesInOpenedWorkspace:"You may have unsaved changes in the opened workspace. Do you want to discard these changes?",unsavedChangesInWorkspace:'There may be unsaved changes in "{{workspaceName}}". Please save them before opening another workspace.',unsavedChangesTitleText:"Unsaved changes",workspaceHeader:"Workspace header",discardUnsavedChangesPromptBodyMultiple:"{{count}} workspaces have unsaved changes. Closing them will discard the changes:",discardUnsavedChangesPromptBodySingle:"<strong>{{workspaceTitle}}</strong> has unsaved changes. Closing it will discard them.",discardUnsavedChangesPromptTitle:"Discard unsaved changes?",keepEditing:"Keep editing",abnormalValue:"Abnormal value",actions:"Actions",actionableNotification:"Actionable notification",address:"Address",age:"Age",batchActionItemSelected:"{{totalSelected}} item selected",batchActionsItemsSelected:"{{totalSelected}} items selected",cancel:"Cancel",change:"Change",Clinic:"Clinic",close:"Close",closesActionableNotification:"Close actionable notification",closeSnackbar:"Close snackbar",confirm:"Confirm",contactAdministratorIfIssuePersists:"Contact your system administrator if the problem persists.",contactDetails:"Contact details",delete:"Delete",discardChanges:"Discard changes",edit:"Edit",emptyStateText:"There are no {{displayText}} to display",error:"Error",errorCopy:"Sorry, there was a problem displaying this information. You can try to reload this page, or contact the site administrator and quote the error code above.",errorLoadingLoginLocations:"Unable to load login locations. Please try again or contact support if the problem persists.",female:"Female",leftNavigation:"Left navigation",loading:"Loading",localVersion:"Local Build",male:"Male",noResultsToDisplay:"No results to display",notAvailable:"Not available",other:"Other",paginationItemsCount:"{{pageItemsCount}} / {{totalItems}} items",paginationOfPages:"of {{count}} pages",patientAvatarAlt:"Avatar for {{patientName}}",patientIdentifierSticker:"Patient identifier sticker",patientLists:"Patient lists",patientPhotoAlt:"Profile photo of {{patientName}}",patientPhotoPlaceholder:"Photo placeholder for {{patientName}}",prereleaseVersion:"Prerelease",print:"Print",printError:"Print error",printErrorExplainer:"An error occurred in {{errorLocation}}",printIdentifierSticker:"Print identifier sticker",printing:"Printing",recordNewEntry:"Record {{displayText}}",relationships:"Relationships",resetOverrides:"Reset overrides",save:"Save",scriptLoadingFailed:"Error: Script failed to load",scriptLoadingError:"Failed to load overridden script from {{url}}. Please check that the bundled script is available at the expected URL. Click the button below to reset all import map overrides.",searchForLocation:"Search for a location",seeAll:"See all",seeMoreLists:"See {{count}} more lists",selectAll:"Select all",sex:"Sex",showLess:"Show less",showMore:"Show more",snackbarNotification:"Snackbar notification",toggleDevTools:"Toggle dev tools",unknown:"Unknown",yearAbbreviation:"yr",yearsAbbreviation:"yrs"},o$=e=>"string"==typeof e,oA=()=>{let e,n,t=new Promise((t,r)=>{e=t,n=r});return t.resolve=e,t.reject=n,t},ow=e=>null==e?"":""+e,ok=/###/g,ox=e=>e&&e.indexOf("###")>-1?e.replace(ok,"."):e,oC=e=>!e||o$(e),oE=(e,n,t)=>{let r=o$(n)?n.split("."):n,o=0;for(;o<r.length-1;){if(oC(e))return{};let n=ox(r[o]);!e[n]&&t&&(e[n]=new t),e=Object.prototype.hasOwnProperty.call(e,n)?e[n]:{},++o}return oC(e)?{}:{obj:e,k:ox(r[o])}},oD=(e,n,t)=>{let{obj:r,k:o}=oE(e,n,Object);if(void 0!==r||1===n.length){r[o]=t;return}let i=n[n.length-1],a=n.slice(0,n.length-1),s=oE(e,a,Object);for(;void 0===s.obj&&a.length;)i=`${a[a.length-1]}.${i}`,s=oE(e,a=a.slice(0,a.length-1),Object),s?.obj&&void 0!==s.obj[`${s.k}.${i}`]&&(s.obj=void 0);s.obj[`${s.k}.${i}`]=t},oS=(e,n)=>{let{obj:t,k:r}=oE(e,n);if(t&&Object.prototype.hasOwnProperty.call(t,r))return t[r]},oM=(e,n,t)=>{for(let r in n)"__proto__"!==r&&"constructor"!==r&&(r in e?o$(e[r])||e[r]instanceof String||o$(n[r])||n[r]instanceof String?t&&(e[r]=n[r]):oM(e[r],n[r],t):e[r]=n[r]);return e};var oz={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;","/":"&#x2F;"};let oP=e=>o$(e)?e.replace(/[&<>"'\/]/g,e=>oz[e]):e,oO=[" ",",","?","!",";"],oT=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),oB=(e,n,t=".")=>{if(!e)return;if(e[n]){if(!Object.prototype.hasOwnProperty.call(e,n))return;return e[n]}let r=n.split(t),o=e;for(let e=0;e<r.length;){let n;if(!o||"object"!=typeof o)return;let i="";for(let a=e;a<r.length;++a)if(a!==e&&(i+=t),i+=r[a],void 0!==(n=o[i])){if(["string","number","boolean"].indexOf(typeof n)>-1&&a<r.length-1)continue;e+=a-e+1;break}o=n}return o},oI=e=>e?.replace("_","-"),oN={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 oj{constructor(e,n={}){this.init(e,n)}init(e,n={}){this.prefix=n.prefix||"i18next:",this.logger=e||oN,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,r){return r&&!this.debug?null:(o$(e[0])&&(e[0]=`${t}${this.prefix} ${e[0]}`),this.logger[n](e))}create(e){return new oj(this.logger,{...{prefix:`${this.prefix}:${e}:`},...this.options})}clone(e){return(e=e||this.options).prefix=e.prefix||this.prefix,new oj(this.logger,e)}}var oR=new oj;class oF{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 r=0;r<t;r++)e(...n)}),this.observers["*"]&&Array.from(this.observers["*"].entries()).forEach(([t,r])=>{for(let o=0;o<r;o++)t.apply(t,[e,...n])})}}class oL extends oF{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,r={}){let o,i=void 0!==r.keySeparator?r.keySeparator:this.options.keySeparator,a=void 0!==r.ignoreJSONStructure?r.ignoreJSONStructure:this.options.ignoreJSONStructure;e.indexOf(".")>-1?o=e.split("."):(o=[e,n],t&&(Array.isArray(t)?o.push(...t):o$(t)&&i?o.push(...t.split(i)):o.push(t)));let s=oS(this.data,o);return(!s&&!n&&!t&&e.indexOf(".")>-1&&(e=o[0],n=o[1],t=o.slice(2).join(".")),!s&&a&&o$(t))?oB(this.data?.[e]?.[n],t,i):s}addResource(e,n,t,r,o={silent:!1}){let i=void 0!==o.keySeparator?o.keySeparator:this.options.keySeparator,a=[e,n];t&&(a=a.concat(i?t.split(i):t)),e.indexOf(".")>-1&&(a=e.split("."),r=n,n=a[1]),this.addNamespaces(n),oD(this.data,a,r),o.silent||this.emit("added",e,n,t,r)}addResources(e,n,t,r={silent:!1}){for(let r in t)(o$(t[r])||Array.isArray(t[r]))&&this.addResource(e,n,r,t[r],{silent:!0});r.silent||this.emit("added",e,n,t)}addResourceBundle(e,n,t,r,o,i={silent:!1,skipCopy:!1}){let a=[e,n];e.indexOf(".")>-1&&(a=e.split("."),r=t,t=n,n=a[1]),this.addNamespaces(n);let s=oS(this.data,a)||{};i.skipCopy||(t=JSON.parse(JSON.stringify(t))),r?oM(s,t,o):s={...s,...t},oD(this.data,a,s),i.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 oW={processors:{},addPostProcessor(e){this.processors[e.name]=e},handle(e,n,t,r,o){return e.forEach(e=>{n=this.processors[e]?.process(n,t,r,o)??n}),n}};let oV=Symbol("i18next/PATH_KEY");function oG(e,n){let t,r,o,{[oV]:i}=e((r=[],(o=Object.create(null)).get=(e,n)=>(t?.revoke?.(),n===oV)?r:(r.push(n),(t=Proxy.revocable(e,o)).proxy),Proxy.revocable(Object.create(null),o).proxy));return i.join(n?.keySeparator??".")}let oU={},oq=e=>!o$(e)&&"boolean"!=typeof e&&"number"!=typeof e;class oH extends oF{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=oR.create("translator")}changeLanguage(e){e&&(this.language=e)}exists(e,n={interpolation:{}}){let t={...n};if(null==e)return!1;let r=this.resolve(e,t);if(r?.res===void 0)return!1;let o=oq(r.res);return!1!==t.returnObjects||!o}extractFromKey(e,n){let t=void 0!==n.nsSeparator?n.nsSeparator:this.options.nsSeparator;void 0===t&&(t=":");let r=void 0!==n.keySeparator?n.keySeparator:this.options.keySeparator,o=n.ns||this.options.defaultNS||[],i=t&&e.indexOf(t)>-1,a=!this.options.userDefinedKeySeparator&&!n.keySeparator&&!this.options.userDefinedNsSeparator&&!n.nsSeparator&&!((e,n,t)=>{n=n||"",t=t||"";let r=oO.filter(e=>0>n.indexOf(e)&&0>t.indexOf(e));if(0===r.length)return!0;let o=oT.getRegExp(`(${r.map(e=>"?"===e?"\\?":e).join("|")})`),i=!o.test(e);if(!i){let n=e.indexOf(t);n>0&&!o.test(e.substring(0,n))&&(i=!0)}return i})(e,t,r);if(i&&!a){let n=e.match(this.interpolator.nestingRegexp);if(n&&n.length>0)return{key:e,namespaces:o$(o)?[o]:o};let i=e.split(t);(t!==r||t===r&&this.options.ns.indexOf(i[0])>-1)&&(o=i.shift()),e=i.join(r)}return{key:e,namespaces:o$(o)?[o]:o}}translate(e,n,t){let r="object"==typeof n?{...n}:n;if("object"!=typeof r&&this.options.overloadTranslationOptionHandler&&(r=this.options.overloadTranslationOptionHandler(arguments)),"object"==typeof r&&(r={...r}),r||(r={}),null==e)return"";"function"==typeof e&&(e=oG(e,{...this.options,...r})),Array.isArray(e)||(e=[String(e)]);let o=void 0!==r.returnDetails?r.returnDetails:this.options.returnDetails,i=void 0!==r.keySeparator?r.keySeparator:this.options.keySeparator,{key:a,namespaces:s}=this.extractFromKey(e[e.length-1],r),l=s[s.length-1],c=void 0!==r.nsSeparator?r.nsSeparator:this.options.nsSeparator;void 0===c&&(c=":");let u=r.lng||this.language,p=r.appendNamespaceToCIMode||this.options.appendNamespaceToCIMode;if(u?.toLowerCase()==="cimode")return p?o?{res:`${l}${c}${a}`,usedKey:a,exactUsedKey:a,usedLng:u,usedNS:l,usedParams:this.getUsedParamsDetails(r)}:`${l}${c}${a}`:o?{res:a,usedKey:a,exactUsedKey:a,usedLng:u,usedNS:l,usedParams:this.getUsedParamsDetails(r)}:a;let d=this.resolve(e,r),f=d?.res,h=d?.usedKey||a,m=d?.exactUsedKey||a,g=void 0!==r.joinArrays?r.joinArrays:this.options.joinArrays,b=!this.i18nFormat||this.i18nFormat.handleAsObject,y=void 0!==r.count&&!o$(r.count),v=oH.hasDefaultValue(r),$=y?this.pluralResolver.getSuffix(u,r.count,r):"",A=r.ordinal&&y?this.pluralResolver.getSuffix(u,r.count,{ordinal:!1}):"",w=y&&!r.ordinal&&0===r.count,k=w&&r[`defaultValue${this.options.pluralSeparator}zero`]||r[`defaultValue${$}`]||r[`defaultValue${A}`]||r.defaultValue,x=f;b&&!f&&v&&(x=k);let C=oq(x),E=Object.prototype.toString.apply(x);if(b&&x&&C&&0>["[object Number]","[object Function]","[object RegExp]"].indexOf(E)&&!(o$(g)&&Array.isArray(x))){if(!r.returnObjects&&!this.options.returnObjects){this.options.returnedObjectHandler||this.logger.warn("accessing an object - but returnObjects options is not enabled!");let e=this.options.returnedObjectHandler?this.options.returnedObjectHandler(h,x,{...r,ns:s}):`key '${a} (${this.language})' returned an object instead of string.`;return o?(d.res=e,d.usedParams=this.getUsedParamsDetails(r),d):e}if(i){let e=Array.isArray(x),n=e?[]:{},t=e?m:h;for(let e in x)if(Object.prototype.hasOwnProperty.call(x,e)){let o=`${t}${i}${e}`;v&&!f?n[e]=this.translate(o,{...r,defaultValue:oq(k)?k[e]:void 0,...{joinArrays:!1,ns:s}}):n[e]=this.translate(o,{...r,joinArrays:!1,ns:s}),n[e]===o&&(n[e]=x[e])}f=n}}else if(b&&o$(g)&&Array.isArray(f))(f=f.join(g))&&(f=this.extendTranslation(f,e,r,t));else{let n=!1,o=!1;!this.isValidLookup(f)&&v&&(n=!0,f=k),this.isValidLookup(f)||(o=!0,f=a);let s=(r.missingKeyNoValueFallbackToKey||this.options.missingKeyNoValueFallbackToKey)&&o?void 0:f,p=v&&k!==f&&this.options.updateMissing;if(o||n||p){if(this.logger.log(p?"updateKey":"missingKey",u,l,a,p?k:f),i){let e=this.resolve(a,{...r,keySeparator:!1});e&&e.res&&this.logger.warn("Seems the loaded translations were in flat JSON format instead of nested. Either set keySeparator: false on init or make sure your translations are published in nested format.")}let e=[],n=this.languageUtils.getFallbackCodes(this.options.fallbackLng,r.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(r.lng||this.language):e.push(r.lng||this.language);let t=(e,n,t)=>{let o=v&&t!==f?t:s;this.options.missingKeyHandler?this.options.missingKeyHandler(e,l,n,o,p,r):this.backendConnector?.saveMissing&&this.backendConnector.saveMissing(e,l,n,o,p,r),this.emit("missingKey",e,l,n,f)};this.options.saveMissing&&(this.options.saveMissingPlurals&&y?e.forEach(e=>{let n=this.pluralResolver.getSuffixes(e,r);w&&r[`defaultValue${this.options.pluralSeparator}zero`]&&0>n.indexOf(`${this.options.pluralSeparator}zero`)&&n.push(`${this.options.pluralSeparator}zero`),n.forEach(n=>{t([e],a+n,r[`defaultValue${n}`]||k)})}):t(e,a,k))}f=this.extendTranslation(f,e,r,d,t),o&&f===a&&this.options.appendNamespaceToMissingKey&&(f=`${l}${c}${a}`),(o||n)&&this.options.parseMissingKeyHandler&&(f=this.options.parseMissingKeyHandler(this.options.appendNamespaceToMissingKey?`${l}${c}${a}`:a,n?f:void 0,r))}return o?(d.res=f,d.usedParams=this.getUsedParamsDetails(r),d):f}extendTranslation(e,n,t,r,o){if(this.i18nFormat?.parse)e=this.i18nFormat.parse(e,{...this.options.interpolation.defaultVariables,...t},t.lng||this.language||r.usedLng,r.usedNS,r.usedKey,{resolved:r});else if(!t.skipInterpolation){let i;t.interpolation&&this.interpolator.init({...t,...{interpolation:{...this.options.interpolation,...t.interpolation}}});let a=o$(e)&&(t?.interpolation?.skipOnVariables!==void 0?t.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables);if(a){let n=e.match(this.interpolator.nestingRegexp);i=n&&n.length}let s=t.replace&&!o$(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||r.usedLng,t),a){let n=e.match(this.interpolator.nestingRegexp);i<(n&&n.length)&&(t.nest=!1)}!t.lng&&r&&r.res&&(t.lng=this.language||r.usedLng),!1!==t.nest&&(e=this.interpolator.nest(e,(...e)=>o?.[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 i=t.postProcess||this.options.postProcess,a=o$(i)?[i]:i;return null!=e&&a?.length&&!1!==t.applyPostProcessor&&(e=oW.handle(a,e,n,this.options&&this.options.postProcessPassResolved?{i18nResolved:{...r,usedParams:this.getUsedParamsDetails(t)},...t}:t,this)),e}resolve(e,n={}){let t,r,o,i,a;return o$(e)&&(e=[e]),e.forEach(e=>{if(this.isValidLookup(t))return;let s=this.extractFromKey(e,n),l=s.key;r=l;let c=s.namespaces;this.options.fallbackNS&&(c=c.concat(this.options.fallbackNS));let u=void 0!==n.count&&!o$(n.count),p=u&&!n.ordinal&&0===n.count,d=void 0!==n.context&&(o$(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)||(a=e,!oU[`${f[0]}-${e}`]&&this.utils?.hasLoadedNamespace&&!this.utils?.hasLoadedNamespace(a)&&(oU[`${f[0]}-${e}`]=!0,this.logger.warn(`key "${r}" for languages "${f.join(", ")}" won't get resolved as namespace "${a}" 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(r=>{let a;if(this.isValidLookup(t))return;i=r;let s=[l];if(this.i18nFormat?.addLookupKeys)this.i18nFormat.addLookupKeys(s,l,r,e,n);else{let e;u&&(e=this.pluralResolver.getSuffix(r,n.count,n));let t=`${this.options.pluralSeparator}zero`,o=`${this.options.pluralSeparator}ordinal${this.options.pluralSeparator}`;if(u&&(n.ordinal&&0===e.indexOf(o)&&s.push(l+e.replace(o,this.options.pluralSeparator)),s.push(l+e),p&&s.push(l+t)),d){let r=`${l}${this.options.contextSeparator||"_"}${n.context}`;s.push(r),u&&(n.ordinal&&0===e.indexOf(o)&&s.push(r+e.replace(o,this.options.pluralSeparator)),s.push(r+e),p&&s.push(r+t))}}for(;a=s.pop();)this.isValidLookup(t)||(o=a,t=this.getResource(r,e,a,n))}))})}),{res:t,usedKey:r,exactUsedKey:o,usedLng:i,usedNS:a}}isValidLookup(e){return void 0!==e&&!(!this.options.returnNull&&null===e)&&!(!this.options.returnEmptyString&&""===e)}getResource(e,n,t,r={}){return this.i18nFormat?.getResource?this.i18nFormat.getResource(e,n,t,r):this.resourceStore.getResource(e,n,t,r)}getUsedParamsDetails(e={}){let n=e.replace&&!o$(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 oK{constructor(e){this.options=e,this.supportedLngs=this.options.supportedLngs||!1,this.logger=oR.create("languageUtils")}getScriptPartFromCode(e){if(!(e=oI(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=oI(e))||0>e.indexOf("-"))return e;let n=e.split("-");return this.formatLanguageCode(n[0])}formatLanguageCode(e){if(o$(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 r=this.getLanguagePartFromCode(e);if(this.isSupportedCode(r))return n=r;n=this.options.supportedLngs.find(e=>{if(e===r||!(0>e.indexOf("-")&&0>r.indexOf("-"))&&(e.indexOf("-")>0&&0>r.indexOf("-")&&e.substring(0,e.indexOf("-"))===r||0===e.indexOf(r)&&r.length>1))return e})}),n||(n=this.getFallbackCodes(this.options.fallbackLng)[0]),n):null}getFallbackCodes(e,n){if(!e)return[];if("function"==typeof e&&(e=e(n)),o$(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),r=[],o=e=>{e&&(this.isSupportedCode(e)?r.push(e):this.logger.warn(`rejecting language code not found in supportedLngs: ${e}`))};return o$(e)&&(e.indexOf("-")>-1||e.indexOf("_")>-1)?("languageOnly"!==this.options.load&&o(this.formatLanguageCode(e)),"languageOnly"!==this.options.load&&"currentOnly"!==this.options.load&&o(this.getScriptPartFromCode(e)),"currentOnly"!==this.options.load&&o(this.getLanguagePartFromCode(e))):o$(e)&&o(this.formatLanguageCode(e)),t.forEach(e=>{0>r.indexOf(e)&&o(this.formatLanguageCode(e))}),r}}let oY={zero:0,one:1,two:2,few:3,many:4,other:5},oJ={select:e=>1===e?"one":"other",resolvedOptions:()=>({pluralCategories:["one","other"]})};class oZ{constructor(e,n={}){this.languageUtils=e,this.options=n,this.logger=oR.create("pluralResolver"),this.pluralRulesCache={}}addRule(e,n){this.rules[e]=n}clearCache(){this.pluralRulesCache={}}getRule(e,n={}){let t,r=oI("dev"===e?"en":e),o=n.ordinal?"ordinal":"cardinal",i=JSON.stringify({cleanedCode:r,type:o});if(i in this.pluralRulesCache)return this.pluralRulesCache[i];try{t=new Intl.PluralRules(r,{type:o})}catch(o){if(!Intl)return this.logger.error("No Intl support, please use an Intl polyfill!"),oJ;if(!e.match(/-|_/))return oJ;let r=this.languageUtils.getLanguagePartFromCode(e);t=this.getRule(r,n)}return this.pluralRulesCache[i]=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)=>oY[e]-oY[n]).map(e=>`${this.options.prepend}${n.ordinal?`ordinal${this.options.prepend}`:""}${e}`):[]}getSuffix(e,n,t={}){let r=this.getRule(e,t);return r?`${this.options.prepend}${t.ordinal?`ordinal${this.options.prepend}`:""}${r.select(n)}`:(this.logger.warn(`no plural rule found for: ${e}`),this.getSuffix("dev",n,t))}}let oX=(e,n,t,r=".",o=!0)=>{let i,a=void 0!==(i=oS(e,t))?i:oS(n,t);return!a&&o&&o$(t)&&void 0===(a=oB(e,t,r))&&(a=oB(n,t,r)),a};class oQ{constructor(e={}){this.logger=oR.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:r,prefix:o,prefixEscaped:i,suffix:a,suffixEscaped:s,formatSeparator:l,unescapeSuffix:c,unescapePrefix:u,nestingPrefix:p,nestingPrefixEscaped:d,nestingSuffix:f,nestingSuffixEscaped:h,nestingOptionsSeparator:m,maxReplaces:g,alwaysFormat:b}=e.interpolation;this.escape=void 0!==n?n:oP,this.escapeValue=void 0===t||t,this.useRawValueToEscape=void 0!==r&&r,this.prefix=o?o.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&"):i||"{{",this.suffix=a?a.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=m||",",this.maxReplaces=g||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,r){let o,i,a,s=this.options&&this.options.interpolation&&this.options.interpolation.defaultVariables||{},l=e=>{if(0>e.indexOf(this.formatSeparator)){let o=oX(n,s,e,this.options.keySeparator,this.options.ignoreJSONStructure);return this.alwaysFormat?this.format(o,void 0,t,{...r,...n,interpolationkey:e}):o}let o=e.split(this.formatSeparator),i=o.shift().trim(),a=o.join(this.formatSeparator).trim();return this.format(oX(n,s,i,this.options.keySeparator,this.options.ignoreJSONStructure),a,t,{...r,...n,interpolationkey:i})};this.resetRegExp();let c=r?.missingInterpolationHandler||this.options.missingInterpolationHandler,u=r?.interpolation?.skipOnVariables!==void 0?r.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables;return[{regex:this.regexpUnescape,safeValue:e=>e.replace(/\$/g,"$$$$")},{regex:this.regexp,safeValue:e=>this.escapeValue?this.escape(e).replace(/\$/g,"$$$$"):e.replace(/\$/g,"$$$$")}].forEach(n=>{for(a=0;o=n.regex.exec(e);){let t=o[1].trim();if(void 0===(i=l(t)))if("function"==typeof c){let n=c(e,o,r);i=o$(n)?n:""}else if(r&&Object.prototype.hasOwnProperty.call(r,t))i="";else if(u){i=o[0];continue}else this.logger.warn(`missed to pass in variable ${t} for interpolating ${e}`),i="";else o$(i)||this.useRawValueToEscape||(i=ow(i));let s=n.safeValue(i);if(e=e.replace(o[0],s),u?(n.regex.lastIndex+=i.length,n.regex.lastIndex-=o[0].length):n.regex.lastIndex=0,++a>=this.maxReplaces)break}}),e}nest(e,n,t={}){let r,o,i,a=(e,n)=>{let t=this.nestingOptionsSeparator;if(0>e.indexOf(t))return e;let r=e.split(RegExp(`${t}[ ]*{`)),o=`{${r[1]}`;e=r[0];let a=(o=this.interpolate(o,i)).match(/'/g),s=o.match(/"/g);((a?.length??0)%2!=0||s)&&s.length%2==0||(o=o.replace(/'/g,'"'));try{i=JSON.parse(o),n&&(i={...n,...i})}catch(n){return this.logger.warn(`failed parsing options string in nesting for key ${e}`,n),`${e}${t}${o}`}return i.defaultValue&&i.defaultValue.indexOf(this.prefix)>-1&&delete i.defaultValue,e};for(;r=this.nestingRegexp.exec(e);){let s=[];(i=(i={...t}).replace&&!o$(i.replace)?i.replace:i).applyPostProcessor=!1,delete i.defaultValue;let l=/{.*}/.test(r[1])?r[1].lastIndexOf("}")+1:r[1].indexOf(this.formatSeparator);if(-1!==l&&(s=r[1].slice(l).split(this.formatSeparator).map(e=>e.trim()).filter(Boolean),r[1]=r[1].slice(0,l)),(o=n(a.call(this,r[1].trim(),i),i))&&r[0]===e&&!o$(o))return o;o$(o)||(o=ow(o)),o||(this.logger.warn(`missed to resolve ${r[1]} for nesting ${e}`),o=""),s.length&&(o=s.reduce((e,n)=>this.format(e,n,t.lng,{...t,interpolationkey:r[1].trim()}),o.trim())),e=e.replace(r[0],o),this.regexp.lastIndex=0}return e}}let o0=e=>{let n={};return(t,r,o)=>{let i=o;o&&o.interpolationkey&&o.formatParams&&o.formatParams[o.interpolationkey]&&o[o.interpolationkey]&&(i={...i,[o.interpolationkey]:void 0});let a=r+JSON.stringify(i),s=n[a];return s||(s=e(oI(r),o),n[a]=s),s(t)}},o1=e=>(n,t,r)=>e(oI(t),r)(n);class o2{constructor(e={}){this.logger=oR.create("formatter"),this.options=e,this.init(e)}init(e,n={interpolation:{}}){this.formatSeparator=n.interpolation.formatSeparator||",";let t=n.cacheInBuiltFormats?o0:o1;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()]=o0(n)}format(e,n,t,r={}){let o=n.split(this.formatSeparator);if(o.length>1&&o[0].indexOf("(")>1&&0>o[0].indexOf(")")&&o.find(e=>e.indexOf(")")>-1)){let e=o.findIndex(e=>e.indexOf(")")>-1);o[0]=[o[0],...o.splice(1,e)].join(this.formatSeparator)}return o.reduce((e,n)=>{let{formatName:o,formatOptions:i}=(e=>{let n=e.toLowerCase().trim(),t={};if(e.indexOf("(")>-1){let r=e.split("(");n=r[0].toLowerCase().trim();let o=r[1].substring(0,r[1].length-1);"currency"===n&&0>o.indexOf(":")?t.currency||(t.currency=o.trim()):"relativetime"===n&&0>o.indexOf(":")?t.range||(t.range=o.trim()):o.split(";").forEach(e=>{if(e){let[n,...r]=e.split(":"),o=r.join(":").trim().replace(/^'+|'+$/g,""),i=n.trim();t[i]||(t[i]=o),"false"===o&&(t[i]=!1),"true"===o&&(t[i]=!0),isNaN(o)||(t[i]=parseInt(o,10))}})}return{formatName:n,formatOptions:t}})(n);if(this.formats[o]){let n=e;try{let a=r?.formatParams?.[r.interpolationkey]||{},s=a.locale||a.lng||r.locale||r.lng||t;n=this.formats[o](e,s,{...i,...r,...a})}catch(e){this.logger.warn(e)}return n}return this.logger.warn(`there was no format function for ${o}`),e},e)}}class o3 extends oF{constructor(e,n,t,r={}){super(),this.backend=e,this.store=n,this.services=t,this.languageUtils=t.languageUtils,this.options=r,this.logger=oR.create("backendConnector"),this.waitingReads=[],this.maxParallelReads=r.maxParallelReads||10,this.readingCalls=0,this.maxRetries=r.maxRetries>=0?r.maxRetries:5,this.retryTimeout=r.retryTimeout>=1?r.retryTimeout:350,this.state={},this.queue=[],this.backend?.init?.(t,r.backend,r)}queueLoad(e,n,t,r){let o={},i={},a={},s={};return e.forEach(e=>{let r=!0;n.forEach(n=>{let a=`${e}|${n}`;!t.reload&&this.store.hasResourceBundle(e,n)?this.state[a]=2:this.state[a]<0||(1===this.state[a]?void 0===i[a]&&(i[a]=!0):(this.state[a]=1,r=!1,void 0===i[a]&&(i[a]=!0),void 0===o[a]&&(o[a]=!0),void 0===s[n]&&(s[n]=!0)))}),r||(a[e]=!0)}),(Object.keys(o).length||Object.keys(i).length)&&this.queue.push({pending:i,pendingCount:Object.keys(i).length,loaded:{},errors:[],callback:r}),{toLoad:Object.keys(o),pending:Object.keys(i),toLoadLanguages:Object.keys(a),toLoadNamespaces:Object.keys(s)}}loaded(e,n,t){let r=e.split("|"),o=r[0],i=r[1];n&&this.emit("failedLoading",o,i,n),!n&&t&&this.store.addResourceBundle(o,i,t,void 0,void 0,{skipCopy:!0}),this.state[e]=n?-1:2,n&&t&&(this.state[e]=0);let a={};this.queue.forEach(t=>{((e,n,t,r)=>{let{obj:o,k:i}=oE(e,n,Object);o[i]=o[i]||[],o[i].push(t)})(t.loaded,[o],i),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=>{a[e]||(a[e]={});let n=t.loaded[e];n.length&&n.forEach(n=>{void 0===a[e][n]&&(a[e][n]=!0)})}),t.done=!0,t.errors.length?t.callback(t.errors):t.callback())}),this.emit("loaded",a),this.queue=this.queue.filter(e=>!e.done)}read(e,n,t,r=0,o=this.retryTimeout,i){if(!e.length)return i(null,{});if(this.readingCalls>=this.maxParallelReads)return void this.waitingReads.push({lng:e,ns:n,fcName:t,tried:r,wait:o,callback:i});this.readingCalls++;let a=(a,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)}a&&s&&r<this.maxRetries?setTimeout(()=>{this.read.call(this,e,n,t,r+1,2*o,i)},o):i(a,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=>a(null,e)).catch(a):a(null,t)}catch(e){a(e)}return}return s(e,n,a)}prepareLoading(e,n,t={},r){if(!this.backend)return this.logger.warn("No backend was added via i18next.use. Will not load resources."),r&&r();o$(e)&&(e=this.languageUtils.toResolveHierarchy(e)),o$(n)&&(n=[n]);let o=this.queueLoad(e,n,t,r);if(!o.toLoad.length)return o.pending.length||r(),null;o.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("|"),r=t[0],o=t[1];this.read(r,o,"read",void 0,void 0,(t,i)=>{t&&this.logger.warn(`${n}loading namespace ${o} for language ${r} failed`,t),!t&&i&&this.logger.log(`${n}loaded namespace ${o} for language ${r}`,i),this.loaded(e,t,i)})}saveMissing(e,n,t,r,o,i={},a=()=>{}){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={...i,isUpdate:o},l=this.backend.create.bind(this.backend);if(l.length<6)try{let o;(o=5===l.length?l(e,n,t,r,s):l(e,n,t,r))&&"function"==typeof o.then?o.then(e=>a(null,e)).catch(a):a(null,o)}catch(e){a(e)}else l(e,n,t,r,a,s)}e&&e[0]&&this.store.addResource(e[0],n,t,r)}}}let o5=()=>({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]),o$(e[1])&&(n.defaultValue=e[1]),o$(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}),o4=e=>(o$(e.ns)&&(e.ns=[e.ns]),o$(e.fallbackLng)&&(e.fallbackLng=[e.fallbackLng]),o$(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),o6=()=>{};class o8 extends oF{constructor(e={},n){if(super(),this.options=o4(e),this.services={},this.logger=oR,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&&(o$(e.ns)?e.defaultNS=e.ns:0>e.ns.indexOf("translation")&&(e.defaultNS=e.ns[0]));let t=o5();this.options={...t,...this.options,...o4(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 r=e=>e?"function"==typeof e?new e:e:null;if(!this.options.isClone){let e;this.modules.logger?oR.init(r(this.modules.logger),this.options):oR.init(null,this.options),e=this.modules.formatter?this.modules.formatter:o2;let n=new oK(this.options);this.store=new oL(this.options.resources,this.options);let o=this.services;o.logger=oR,o.resourceStore=this.store,o.languageUtils=n,o.pluralResolver=new oZ(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)&&(o.formatter=r(e),o.formatter.init&&o.formatter.init(o,this.options),this.options.interpolation.format=o.formatter.format.bind(o.formatter)),o.interpolator=new oQ(this.options),o.utils={hasLoadedNamespace:this.hasLoadedNamespace.bind(this)},o.backendConnector=new o3(r(this.modules.backend),o.resourceStore,o,this.options),o.backendConnector.on("*",(e,...n)=>{this.emit(e,...n)}),this.modules.languageDetector&&(o.languageDetector=r(this.modules.languageDetector),o.languageDetector.init&&o.languageDetector.init(o,this.options.detection,this.options)),this.modules.i18nFormat&&(o.i18nFormat=r(this.modules.i18nFormat),o.i18nFormat.init&&o.i18nFormat.init(this)),this.translator=new oH(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=o6),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 o=oA(),i=()=>{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),o.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?i():setTimeout(i,0),o}loadResources(e,n=o6){let t=n,r=o$(e)?e:this.language;if("function"==typeof e&&(t=e),!this.options.resources||this.options.partialBundledLanguages){if(r?.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)})};r?n(r):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 r=oA();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=o6),this.services.backendConnector.reload(e,n,e=>{r.resolve(),t(e)}),r}use(e){if(!e)throw Error("You are passing an undefined module! Please check the object you are passing to i18next.use()");if(!e.type)throw Error("You are passing a wrong module! Please check the object you are passing to i18next.use()");return"backend"===e.type&&(this.modules.backend=e),("logger"===e.type||e.log&&e.warn&&e.error)&&(this.modules.logger=e),"languageDetector"===e.type&&(this.modules.languageDetector=e),"i18nFormat"===e.type&&(this.modules.i18nFormat=e),"postProcessor"===e.type&&oW.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=oA();this.emit("languageChanging",e);let r=e=>{this.language=e,this.languages=this.services.languageUtils.toResolveHierarchy(e),this.resolvedLanguage=void 0,this.setResolvedLanguage(e)},o=(o,i)=>{i?this.isLanguageChangingTo===e&&(r(i),this.translator.changeLanguage(i),this.isLanguageChangingTo=void 0,this.emit("languageChanged",i),this.logger.log("languageChanged",i)):this.isLanguageChangingTo=void 0,t.resolve((...e)=>this.t(...e)),n&&n(o,(...e)=>this.t(...e))},i=n=>{e||n||!this.services.languageDetector||(n=[]);let t=o$(n)?n:n&&n[0],i=this.store.hasLanguageSomeTranslations(t)?t:this.services.languageUtils.getBestMatchFromCodes(o$(n)?[n]:n);i&&(this.language||r(i),this.translator.language||this.translator.changeLanguage(i),this.services.languageDetector?.cacheUserLanguage?.(i)),this.loadResources(i,e=>{o(e,i)})};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(i):this.services.languageDetector.detect(i):i(e):i(this.services.languageDetector.detect()),t}getFixedT(e,n,t){let r=(e,n,...o)=>{let i,a;(i="object"!=typeof n?this.options.overloadTranslationOptionHandler([e,n].concat(o)):{...n}).lng=i.lng||r.lng,i.lngs=i.lngs||r.lngs,i.ns=i.ns||r.ns,""!==i.keyPrefix&&(i.keyPrefix=i.keyPrefix||t||r.keyPrefix);let s=this.options.keySeparator||".";return i.keyPrefix&&Array.isArray(e)?a=e.map(e=>("function"==typeof e&&(e=oG(e,{...this.options,...n})),`${i.keyPrefix}${s}${e}`)):("function"==typeof e&&(e=oG(e,{...this.options,...n})),a=i.keyPrefix?`${i.keyPrefix}${s}${e}`:e),this.t(a,i)};return o$(e)?r.lng=e:r.lngs=e,r.ns=n,r.keyPrefix=t,r}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],r=!!this.options&&this.options.fallbackLng,o=this.languages[this.languages.length-1];if("cimode"===t.toLowerCase())return!0;let i=(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,i);if(void 0!==e)return e}return!!(this.hasResourceBundle(t,e)||!this.services.backendConnector.backend||this.options.resources&&!this.options.partialBundledLanguages||i(t,e)&&(!r||i(o,e)))}loadNamespaces(e,n){let t=oA();return this.options.ns?(o$(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=oA();o$(e)&&(e=[e]);let r=this.options.preload||[],o=e.filter(e=>0>r.indexOf(e)&&this.services.languageUtils.isSupportedCode(e));return o.length?(this.options.preload=r.concat(o),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 oK(o5());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 o8(e,n)}cloneInstance(e={},n=o6){let t=e.forkResourceStore;t&&delete e.forkResourceStore;let r={...this.options,...e,isClone:!0},o=new o8(r);return(void 0!==e.debug||void 0!==e.prefix)&&(o.logger=o.logger.clone(e)),["store","services","language"].forEach(e=>{o[e]=this[e]}),o.services={...this.services},o.services.utils={hasLoadedNamespace:o.hasLoadedNamespace.bind(o)},t&&(o.store=new oL(Object.keys(this.store.data).reduce((e,n)=>(e[n]={...this.store.data[n]},e[n]=Object.keys(e[n]).reduce((t,r)=>(t[r]={...e[n][r]},t),e[n]),e),{}),r),o.services.resourceStore=o.store),o.translator=new oH(o.services,r),o.translator.on("*",(e,...n)=>{o.emit(e,...n)}),o.init(r,n),o.translator.options=r,o.translator.backendConnector.services.utils={hasLoadedNamespace:o.hasLoadedNamespace.bind(o)},o}toJSON(){return{options:this.options,store:this.store,language:this.language,languages:this.languages,resolvedLanguage:this.resolvedLanguage}}}let o7=o8.createInstance();o7.createInstance=o8.createInstance,o7.createInstance,o7.dir,o7.init,o7.loadResources,o7.reloadResources,o7.use,o7.changeLanguage,o7.getFixedT,o7.t,o7.exists,o7.setDefaultNamespace,o7.hasLoadedNamespace,o7.loadNamespaces,o7.loadLanguages;let o9=o7.default||o7;function ie(e,n,t,r){return o9.t(n,{ns:e,defaultValue:t,...r})}function it(e,n,t){return ov[e]?ie("core",e,n??ov[e],t):(console.error(`O3 Core Translations does not provide key '${e}'. The key itself is being rendered as text.`),e)}o9.on("initialized",function(){window.i18next.loadNamespaces(["core"])});let ir=null;async function io(){return ir??(ir=ii().then(({map:e,complete:n})=>(n||(ir=null),e))),ir}async function ii(){let e=document.querySelectorAll('script[type="systemjs-importmap"]'),n=[],t=!0;for(let r=0;r<e.length;r++){let o=e[r];try{if(o.src){let e=await fetch(o.src);if(!e.ok)throw Error(`Request for ${o.src} returned ${e.status} ${e.statusText}`);n.push(await e.json())}else o.textContent&&n.push(JSON.parse(o.textContent))}catch(e){t=!1,console.warn(`[import-maps] Failed to parse import map from script tag at index ${r}`,e)}}return{map:function(e){let n={imports:{}};for(let t of e)t?.imports&&Object.assign(n.imports,t.imports);return n}(n),complete:t}}async function ia(){return await io()}function is(e){return e.replace(/[\/\-@]/g,"_")}async function il(e,n="./start",r){var o;let i,a=!r?.maxLoadingTime||r.maxLoadingTime<=0?6e5:r.maxLoadingTime;await Promise.race([ic(e,r?.importMap),new Promise((n,t)=>{i=setTimeout(()=>{var n;t(Error(`Could not resolve requested script, ${e}, within ${(n=a)<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`}.`))},a)})]),i&&clearTimeout(i);let s=is(e),l=window[s];if(!("object"==typeof(o=l)&&null!==o&&"init"in o&&"function"==typeof o.init&&"get"in o&&"function"==typeof o.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 ic(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=is(e);if(!window[t]){let t=n??await iu();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 r=t.imports[e];r.startsWith("./")&&(r=window.spaBase+r.substring(1));let o=e in{};try{return await new Promise((e,n)=>{!function(e,n,t){let r=document.head.querySelector(`script[src="${e}"]`),o=window[ip];if(o||(o=window[ip]=new Set([])),r)if(o.has(e)){let e,o,i;i=()=>{e&&r.removeEventListener("load",e),o&&r.removeEventListener("error",o)},e=()=>{i(),n(null)},o=e=>{i(),t(e.message)},r.addEventListener("load",e),r.addEventListener("error",o)}else console.warn(`Script at ${e} already loaded. Not loading it again.`),n(null);else{let r,i,a;o.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);a=()=>{clearTimeout(l),o.delete(e),r&&s.removeEventListener("load",r),i&&s.removeEventListener("error",i)},r=()=>{a(),n(null)},i=n=>{a();let r=`Failed to load script from ${e}`;console.error(r,n),t(n.message??r)},s.addEventListener("load",r),s.addEventListener("error",i),document.head.appendChild(s)}}(r,e,n)})}catch(e){return o&&C({kind:"error",title:it("scriptLoadingFailed","Error: Script failed to load"),description:it("scriptLoadingError","Failed to load overridden script from {{- url}}. Please check that the bundled script is available at the expected URL. Click the button below to reset all import map overrides.",{url:r}),actionButtonLabel:it("resetOverrides","Reset overrides"),onActionButtonClick(){console.warn("[Security] Import map overrides are disabled in production mode."),window.location.reload()}}),Promise.reject(e)}}return Promise.resolve()}async function iu(){return ia()}let ip=Symbol("__openmrs_script_loading"),id=`${r0}/attachment`;function ih(e,n){return r5(`${id}/${e}`,{signal:n.signal})}function im(e,n,t){return r5(`${id}?patient=${e}&includeEncounterless=${n}`,{signal:t.signal})}async function ig(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)),r5(`${id}`,{method:"POST",body:t})}function ib(e,n){return r5(`${id}/${e}`,{method:"DELETE",signal:n.signal})}try{self["workbox:window:6.5.4"]&&_()}catch(e){}function iy(e,n){return new Promise(function(t){var r=new MessageChannel;r.port1.onmessage=function(e){t(e.data)},e.postMessage(n,[r.port2])})}function i_(e,n){for(var t=0;t<n.length;t++){var r=n[t];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function iv(e,n){(null==n||n>e.length)&&(n=e.length);for(var t=0,r=Array(n);t<n;t++)r[t]=e[t];return r}try{self["workbox:core:6.5.4"]&&_()}catch(e){}var i$=function(){var e=this;this.promise=new Promise(function(n,t){e.resolve=n,e.reject=t})};function iA(e,n){var t=location.href;return new URL(e,t).href===new URL(n,t).href}var iw=function(e,n){this.type=e,Object.assign(this,n)};function ik(e,n,t){return t?n?n(e):e:(e&&e.then||(e=Promise.resolve(e)),n?e.then(n):e)}function ix(){}var iC={type:"SKIP_WAITING"};function iE(e,n){if(!n)return e&&e.then?e.then(ix):Promise.resolve()}async function iD(e){let n=await (d??Promise.resolve(void 0));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."}}!function(e){function n(n,t){var r,o;return void 0===t&&(t={}),(r=e.call(this)||this).nn={},r.tn=0,r.rn=new i$,r.en=new i$,r.on=new i$,r.un=0,r.an=new Set,r.cn=function(){var e=r.fn,n=e.installing;r.tn>0||!iA(n.scriptURL,r.sn.toString())||performance.now()>r.un+6e4?(r.vn=n,e.removeEventListener("updatefound",r.cn)):(r.hn=n,r.an.add(n),r.rn.resolve(n)),++r.tn,n.addEventListener("statechange",r.ln)},r.ln=function(e){var n=r.fn,t=e.target,o=t.state,i=t===r.vn,a={sw:t,isExternal:i,originalEvent:e};!i&&r.mn&&(a.isUpdate=!0),r.dispatchEvent(new iw(o,a)),"installed"===o?r.wn=self.setTimeout(function(){"installed"===o&&n.waiting===t&&r.dispatchEvent(new iw("waiting",a))},200):"activating"===o&&(clearTimeout(r.wn),i||r.en.resolve(t))},r.dn=function(e){var n=r.hn,t=n!==navigator.serviceWorker.controller;r.dispatchEvent(new iw("controlling",{isExternal:t,originalEvent:e,sw:n,isUpdate:r.mn})),t||r.on.resolve(n)},o=function(e){var n=e.data,t=e.ports,o=e.source;return ik(r.getSW(),function(){r.an.has(o)&&r.dispatchEvent(new iw("message",{data:n,originalEvent:e,ports:t,sw:o}))})},r.gn=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];try{return Promise.resolve(o.apply(this,e))}catch(e){return Promise.reject(e)}},r.sn=n,r.nn=t,navigator.serviceWorker.addEventListener("message",r.gn),r}n.prototype=Object.create(e.prototype),n.prototype.constructor=n,n.__proto__=e;var t,r=n.prototype;r.register=function(e){var n=(void 0===e?{}:e).immediate,t=void 0!==n&&n;try{var r,o,i,a=this;return r=function(){if(!t&&"complete"!==document.readyState)return iE(new Promise(function(e){return window.addEventListener("load",e)}))},o=function(){return a.mn=!!navigator.serviceWorker.controller,a.yn=a.pn(),ik(a.bn(),function(e){a.fn=e,a.yn&&(a.hn=a.yn,a.en.resolve(a.yn),a.on.resolve(a.yn),a.yn.addEventListener("statechange",a.ln,{once:!0}));var n=a.fn.waiting;return n&&iA(n.scriptURL,a.sn.toString())&&(a.hn=n,Promise.resolve().then(function(){a.dispatchEvent(new iw("waiting",{sw:n,wasWaitingBeforeRegister:!0}))}).then(function(){})),a.hn&&(a.rn.resolve(a.hn),a.an.add(a.hn)),a.fn.addEventListener("updatefound",a.cn),navigator.serviceWorker.addEventListener("controllerchange",a.dn),a.fn})},(i=r())&&i.then?i.then(o):o(i)}catch(e){return Promise.reject(e)}},r.update=function(){try{return this.fn?iE(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 ik(this.getSW(),function(n){return iy(n,e)})}catch(e){return Promise.reject(e)}},r.messageSkipWaiting=function(){this.fn&&this.fn.waiting&&iy(this.fn.waiting,iC)},r.pn=function(){var e=navigator.serviceWorker.controller;return e&&iA(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 ik(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)}},i_(n.prototype,[{key:"active",get:function(){return this.en.promise}},{key:"controlling",get:function(){return this.on.promise}}]),t&&i_(n,t)}(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 iv(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)?iv(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}());let iS="u">typeof globalThis?globalThis:"u">typeof self?self:"u">typeof window?window:global,iM=Object.keys,iz=Array.isArray;function iP(e,n){return"object"!=typeof n||iM(n).forEach(function(t){e[t]=n[t]}),e}"u"<typeof Promise||iS.Promise||(iS.Promise=Promise);let iO=Object.getPrototypeOf,iT={}.hasOwnProperty;function iB(e,n){return iT.call(e,n)}function iI(e,n){"function"==typeof n&&(n=n(iO(e))),("u"<typeof Reflect?iM:Reflect.ownKeys)(n).forEach(t=>{ij(e,t,n[t])})}let iN=Object.defineProperty;function ij(e,n,t,r){iN(e,n,iP(t&&iB(t,"get")&&"function"==typeof t.get?{get:t.get,set:t.set,configurable:!0}:{value:t,configurable:!0,writable:!0},r))}function iR(e){return{from:function(n){return e.prototype=Object.create(n.prototype),ij(e.prototype,"constructor",e),{extend:iI.bind(null,e.prototype)}}}}let iF=Object.getOwnPropertyDescriptor;function iL(e,n){let t;return iF(e,n)||(t=iO(e))&&iL(t,n)}let iW=[].slice;function iV(e,n,t){return iW.call(e,n,t)}function iG(e,n){return n(e)}function iU(e){if(!e)throw Error("Assertion Failed")}function iq(e){iS.setImmediate?setImmediate(e):setTimeout(e,0)}function iH(e,n){return e.reduce((e,t,r)=>{var o=n(t,r);return o&&(e[o[0]]=o[1]),e},{})}function iK(e,n){if("string"==typeof n&&iB(e,n))return e[n];if(!n)return e;if("string"!=typeof n){for(var t=[],r=0,o=n.length;r<o;++r){var i=iK(e,n[r]);t.push(i)}return t}var a=n.indexOf(".");if(-1!==a){var s=e[n.substr(0,a)];return null==s?void 0:iK(s,n.substr(a+1))}}function iY(e,n,t){if(e&&void 0!==n&&(!("isFrozen"in Object)||!Object.isFrozen(e)))if("string"!=typeof n&&"length"in n){iU("string"!=typeof t&&"length"in t);for(var r=0,o=n.length;r<o;++r)iY(e,n[r],t[r])}else{var i=n.indexOf(".");if(-1!==i){var a=n.substr(0,i),s=n.substr(i+1);if(""===s)void 0===t?iz(e)&&!isNaN(parseInt(a))?e.splice(a,1):delete e[a]:e[a]=t;else{var l=e[a];l&&iB(e,a)||(l=e[a]={}),iY(l,s,t)}}else void 0===t?iz(e)&&!isNaN(parseInt(n))?e.splice(n,1):delete e[n]:e[n]=t}}function iJ(e){var n={};for(var t in e)iB(e,t)&&(n[t]=e[t]);return n}let iZ=[].concat;function iX(e){return iZ.apply([],e)}let iQ="BigUint64Array,BigInt64Array,Array,Boolean,String,Date,RegExp,Blob,File,FileList,FileSystemFileHandle,FileSystemDirectoryHandle,ArrayBuffer,DataView,Uint8ClampedArray,ImageBitmap,ImageData,Map,Set,CryptoKey".split(",").concat(iX([8,16,32,64].map(e=>["Int","Uint","Float"].map(n=>n+e+"Array")))).filter(e=>iS[e]),i0=iQ.map(e=>iS[e]);iH(iQ,e=>[e,!0]);let i1=null;function i2(e){i1="u">typeof WeakMap&&new WeakMap;let n=function e(n){if(!n||"object"!=typeof n)return n;let t=i1&&i1.get(n);if(t)return t;if(iz(n)){t=[],i1&&i1.set(n,t);for(var r=0,o=n.length;r<o;++r)t.push(e(n[r]))}else if(i0.indexOf(n.constructor)>=0)t=n;else{let r=iO(n);for(var i in t=r===Object.prototype?{}:Object.create(r),i1&&i1.set(n,t),n)iB(n,i)&&(t[i]=e(n[i]))}return t}(e);return i1=null,n}let{toString:i3}={};function i5(e){return i3.call(e).slice(8,-1)}let i4="u">typeof Symbol?Symbol.iterator:"@@iterator",i6="symbol"==typeof i4?function(e){var n;return null!=e&&(n=e[i4])&&n.apply(e)}:function(){return null},i8={};function i7(e){var n,t,r,o;if(1==arguments.length){if(iz(e))return e.slice();if(this===i8&&"string"==typeof e)return[e];if(o=i6(e)){for(t=[];!(r=o.next()).done;)t.push(r.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 i9="u">typeof Symbol?e=>"AsyncFunction"===e[Symbol.toStringTag]:()=>!1;var ae="u">typeof location&&/^(http|https):\/\/(localhost|127\.0\.0\.1)/.test(location.href),an=()=>!0;let at=!Error("").stack;function ar(){if(at)try{throw ar.arguments,Error()}catch(e){return e}return Error()}function ao(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(an).map(e=>"\n"+e).join("")):""}var ai=["Unknown","Constraint","Data","TransactionInactive","ReadOnly","Version","NotFound","InvalidState","InvalidAccess","Abort","Timeout","QuotaExceeded","Syntax","DataClone"],aa=["Modify","Bulk","OpenFailed","VersionChange","Schema","Upgrade","InvalidTable","MissingAPI","NoSuchDatabase","InvalidArgument","SubTransaction","Unsupported","Internal","DatabaseClosed","PrematureCommit","ForeignAwait"].concat(ai),as={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 al(e,n){this._e=ar(),this.name=e,this.message=n}function ac(e,n){return e+". Errors: "+Object.keys(n).map(e=>n[e].toString()).filter((e,n,t)=>t.indexOf(e)===n).join("\n")}function au(e,n,t,r){this._e=ar(),this.failures=n,this.failedKeys=r,this.successCount=t,this.message=ac(e,n)}function ap(e,n){this._e=ar(),this.name="BulkError",this.failures=Object.keys(n).map(e=>n[e]),this.failuresByPos=n,this.message=ac(e,n)}iR(al).from(Error).extend({stack:{get:function(){return this._stack||(this._stack=this.name+": "+this.message+ao(this._e,2))}},toString:function(){return this.name+": "+this.message}}),iR(au).from(al),iR(ap).from(al);var ad=aa.reduce((e,n)=>(e[n]=n+"Error",e),{}),af=aa.reduce((e,n)=>{var t=n+"Error";function r(e,r){this._e=ar(),this.name=t,e?"string"==typeof e?(this.message=`${e}${r?"\n "+r:""}`,this.inner=r||null):"object"==typeof e&&(this.message=`${e.name} ${e.message}`,this.inner=e):(this.message=as[n]||t,this.inner=null)}return iR(r).from(al),e[n]=r,e},{});af.Syntax=SyntaxError,af.Type=TypeError,af.Range=RangeError;var ah=ai.reduce((e,n)=>(e[n+"Error"]=af[n],e),{}),am=aa.reduce((e,n)=>(-1===["Syntax","Type","Range"].indexOf(n)&&(e[n+"Error"]=af[n]),e),{});function ag(){}function ab(e){return e}function ay(e,n){return null==e||e===ab?n:function(t){return n(e(t))}}function a_(e,n){return function(){e.apply(this,arguments),n.apply(this,arguments)}}function av(e,n){return e===ag?n:function(){var t=e.apply(this,arguments);void 0!==t&&(arguments[0]=t);var r=this.onsuccess,o=this.onerror;this.onsuccess=null,this.onerror=null;var i=n.apply(this,arguments);return r&&(this.onsuccess=this.onsuccess?a_(r,this.onsuccess):r),o&&(this.onerror=this.onerror?a_(o,this.onerror):o),void 0!==i?i:t}}function a$(e,n){return e===ag?n:function(){e.apply(this,arguments);var t=this.onsuccess,r=this.onerror;this.onsuccess=this.onerror=null,n.apply(this,arguments),t&&(this.onsuccess=this.onsuccess?a_(t,this.onsuccess):t),r&&(this.onerror=this.onerror?a_(r,this.onerror):r)}}function aA(e,n){return e===ag?n:function(t){var r=e.apply(this,arguments);iP(t,r);var o=this.onsuccess,i=this.onerror;this.onsuccess=null,this.onerror=null;var a=n.apply(this,arguments);return o&&(this.onsuccess=this.onsuccess?a_(o,this.onsuccess):o),i&&(this.onerror=this.onerror?a_(i,this.onerror):i),void 0===r?void 0===a?void 0:a:iP(r,a)}}function aw(e,n){return e===ag?n:function(){return!1!==n.apply(this,arguments)&&e.apply(this,arguments)}}function ak(e,n){return e===ag?n:function(){var t=e.apply(this,arguments);if(t&&"function"==typeof t.then){for(var r=this,o=arguments.length,i=Array(o);o--;)i[o]=arguments[o];return t.then(function(){return n.apply(r,i)})}return n.apply(this,arguments)}}am.ModifyError=au,am.DexieError=al,am.BulkError=ap;var ax={};let[aC,aE,aD]="u"<typeof Promise?[]:(()=>{let e=Promise.resolve();if("u"<typeof crypto||!crypto.subtle)return[e,iO(e),e];let n=crypto.subtle.digest("SHA-512",new Uint8Array([0]));return[n,iO(n),e]})(),aS=aE&&aE.then,aM=aC&&aC.constructor,az=!!aD;var aP=!1,aO=aD?()=>{aD.then(a0)}:iS.setImmediate?setImmediate.bind(null,a0):iS.MutationObserver?()=>{var e=document.createElement("div");new MutationObserver(()=>{a0(),e=null}).observe(e,{attributes:!0}),e.setAttribute("i","1")}:()=>{setTimeout(a0,0)},aT=function(e,n){aV.push([e,n]),aI&&(aO(),aI=!1)},aB=!0,aI=!0,aN=[],aj=[],aR=null,aF=ab,aL={id:"global",global:!0,ref:0,unhandleds:[],onunhandled:sh,pgp:!1,env:{},finalize:function(){this.unhandleds.forEach(e=>{try{sh(e[0],e[1])}catch(e){}})}},aW=aL,aV=[],aG=0,aU=[];function aq(e){if("object"!=typeof this)throw TypeError("Promises must be constructed via new");this._listeners=[],this.onuncatched=ag,this._lib=!1;var n=this._PSD=aW;if(ae&&(this._stackHolder=ar(),this._prev=null,this._numPrev=0),"function"!=typeof e){if(e!==ax)throw TypeError("Not a function");return this._state=arguments[1],this._value=arguments[2],void(!1===this._state&&aY(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 r=n._lib&&a1();t&&"function"==typeof t.then?e(n,(e,n)=>{t instanceof aq?t._then(e,n):t.then(e,n)}):(n._state=!0,n._value=t,aJ(n)),r&&a2()}},aY.bind(null,n))}catch(e){aY(n,e)}}(this,e)}let aH={get:function(){var e=aW,n=se;function t(t,r){var o=!e.global&&(e!==aW||n!==se);let i=o&&!so();var a=new aq((n,a)=>{aZ(this,new aK(sp(t,e,o,i),sp(r,e,o,i),n,a,e))});return ae&&aQ(a,this),a}return t.prototype=ax,t},set:function(e){ij(this,"then",e&&e.prototype===ax?aH:{get:function(){return e},set:aH.set})}};function aK(e,n,t,r,o){this.onFulfilled="function"==typeof e?e:null,this.onRejected="function"==typeof n?n:null,this.resolve=t,this.reject=r,this.psd=o}function aY(e,n){if(aj.push(n),null===e._state){var t=e._lib&&a1();n=aF(n),e._state=!1,e._value=n,ae&&null!==n&&"object"==typeof n&&!n._promise&&function(e){try{e.apply(null,void 0)}catch(e){}}(()=>{var t=iL(n,"stack");n._promise=e,ij(n,"stack",{get:()=>aP?t&&(t.get?t.get.apply(n):t.value):e.stack})}),aN.some(n=>n._value===e._value)||aN.push(e),aJ(e),t&&a2()}}function aJ(e){var n=e._listeners;e._listeners=[];for(var t=0,r=n.length;t<r;++t)aZ(e,n[t]);var o=e._PSD;--o.ref||o.finalize(),0===aG&&(++aG,aT(()=>{0==--aG&&a3()},[]))}function aZ(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,++aG,aT(aX,[t,e,n])}else e._listeners.push(n)}function aX(e,n,t){try{aR=n;var r,o=n._value;n._state?r=e(o):(aj.length&&(aj=[]),r=e(o),-1===aj.indexOf(o)&&function(e){for(var n=aN.length;n;)if(aN[--n]._value===e._value)return void aN.splice(n,1)}(n)),t.resolve(r)}catch(e){t.reject(e)}finally{aR=null,0==--aG&&a3(),--t.psd.ref||t.psd.finalize()}}function aQ(e,n){var t=n?n._numPrev+1:0;t<100&&(e._prev=n,e._numPrev=t)}function a0(){a1()&&a2()}function a1(){var e=aB;return aB=!1,aI=!1,e}function a2(){var e,n,t;do for(;aV.length>0;)for(e=aV,aV=[],t=e.length,n=0;n<t;++n){var r=e[n];r[0].apply(null,r[1])}while(aV.length>0);aB=!0,aI=!0}function a3(){var e=aN;aN=[],e.forEach(e=>{e._PSD.onunhandled.call(null,e._value,e)});for(var n=aU.slice(0),t=n.length;t;)n[--t]()}function a5(e){return new aq(ax,!1,e)}function a4(e,n){var t=aW;return function(){var r=a1(),o=aW;try{return sl(t,!0),e.apply(this,arguments)}catch(e){n&&n(e)}finally{sl(o,!1),r&&a2()}}}iI(aq.prototype,{then:aH,_then:function(e,n){aZ(this,new aK(null,null,e,n,aW))},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):a5(e)):this.then(null,e=>e&&e.name===n?t(e):a5(e))},finally:function(e){return this.then(n=>(e(),n),n=>(e(),a5(n)))},stack:{get:function(){if(this._stack)return this._stack;try{aP=!0;var e=(function e(n,t,r){if(t.length===r)return t;var o="";if(!1===n._state){var i,a,s=n._value;null!=s?(i=s.name||"Error",a=s.message||s,o=ao(s,0)):(i=s,a=""),t.push(i+(a?": "+a:"")+o)}return ae&&((o=ao(n._stackHolder,2))&&-1===t.indexOf(o)&&t.push(o),n._prev&&e(n._prev,t,r)),t})(this,[],20).join("\nFrom previous: ");return null!==this._state&&(this._stack=e),e}finally{aP=!1}}},timeout:function(e,n){return e<1/0?new aq((t,r)=>{var o=setTimeout(()=>r(new af.Timeout(n)),e);this.then(t,r).finally(clearTimeout.bind(null,o))}):this}}),"u">typeof Symbol&&Symbol.toStringTag&&ij(aq.prototype,Symbol.toStringTag,"Dexie.Promise"),aL.env=sc(),iI(aq,{all:function(){var e=i7.apply(null,arguments).map(si);return new aq(function(n,t){0===e.length&&n([]);var r=e.length;e.forEach((o,i)=>aq.resolve(o).then(t=>{e[i]=t,--r||n(e)},t))})},resolve:e=>{if(e instanceof aq)return e;if(e&&"function"==typeof e.then)return new aq((n,t)=>{e.then(n,t)});var n=new aq(ax,!0,e);return aQ(n,aR),n},reject:a5,race:function(){var e=i7.apply(null,arguments).map(si);return new aq((n,t)=>{e.map(e=>aq.resolve(e).then(n,t))})},PSD:{get:()=>aW,set:e=>aW=e},totalEchoes:{get:()=>se},newPSD:st,usePSD:su,scheduler:{get:()=>aT,set:e=>{aT=e}},rejectionMapper:{get:()=>aF,set:e=>{aF=e}},follow:(e,n)=>new aq((t,r)=>st((n,t)=>{var r=aW;r.unhandleds=[],r.onunhandled=t,r.finalize=a_(function(){var e;e=()=>{0===this.unhandleds.length?n():t(this.unhandleds[0])},aU.push(function n(){e(),aU.splice(aU.indexOf(n),1)}),++aG,aT(()=>{0==--aG&&a3()},[])},r.finalize),e()},n,t,r))}),aM&&(aM.allSettled&&ij(aq,"allSettled",function(){let e=i7.apply(null,arguments).map(si);return new aq(n=>{0===e.length&&n([]);let t=e.length,r=Array(t);e.forEach((e,o)=>aq.resolve(e).then(e=>r[o]={status:"fulfilled",value:e},e=>r[o]={status:"rejected",reason:e}).then(()=>--t||n(r)))})}),aM.any&&"u">typeof AggregateError&&ij(aq,"any",function(){let e=i7.apply(null,arguments).map(si);return new aq((n,t)=>{0===e.length&&t(AggregateError([]));let r=e.length,o=Array(r);e.forEach((e,i)=>aq.resolve(e).then(e=>n(e),e=>{o[i]=e,--r||t(AggregateError(o))}))})}));let a6={awaits:0,echoes:0,id:0};var a8=0,a7=[],a9=0,se=0,sn=0;function st(e,n,t,r){var o=aW,i=Object.create(o);i.parent=o,i.ref=0,i.global=!1,i.id=++sn;var a=aL.env;i.env=az?{Promise:aq,PromiseProp:{value:aq,configurable:!0,writable:!0},all:aq.all,race:aq.race,allSettled:aq.allSettled,any:aq.any,resolve:aq.resolve,reject:aq.reject,nthen:sd(a.nthen,i),gthen:sd(a.gthen,i)}:{},n&&iP(i,n),++o.ref,i.finalize=function(){--this.parent.ref||this.parent.finalize()};var s=su(i,e,t,r);return 0===i.ref&&i.finalize(),s}function sr(){return a6.id||(a6.id=++a8),++a6.awaits,a6.echoes+=100,a6.id}function so(){return!!a6.awaits&&(0==--a6.awaits&&(a6.id=0),a6.echoes=100*a6.awaits,!0)}function si(e){return a6.echoes&&e&&e.constructor===aM?(sr(),e.then(e=>(so(),e),e=>(so(),sm(e)))):e}function sa(e){++se,a6.echoes&&0!=--a6.echoes||(a6.echoes=a6.id=0),a7.push(aW),sl(e,!0)}function ss(){var e=a7[a7.length-1];a7.pop(),sl(e,!1)}function sl(e,n){var t,r=aW;if((n?!a6.echoes||a9++&&e===aW:!a9||--a9&&e===aW)||(t=n?sa.bind(null,e):ss,aS.call(aC,t)),e!==aW&&(aW=e,r===aL&&(aL.env=sc()),az)){var o=aL.env.Promise,i=e.env;aE.then=i.nthen,o.prototype.then=i.gthen,(r.global||e.global)&&(Object.defineProperty(iS,"Promise",i.PromiseProp),o.all=i.all,o.race=i.race,o.resolve=i.resolve,o.reject=i.reject,i.allSettled&&(o.allSettled=i.allSettled),i.any&&(o.any=i.any))}}function sc(){var e=iS.Promise;return az?{Promise:e,PromiseProp:Object.getOwnPropertyDescriptor(iS,"Promise"),all:e.all,race:e.race,allSettled:e.allSettled,any:e.any,resolve:e.resolve,reject:e.reject,nthen:aE.then,gthen:e.prototype.then}:{}}function su(e,n,t,r,o){var i=aW;try{return sl(e,!0),n(t,r,o)}finally{sl(i,!1)}}function sp(e,n,t,r){return"function"!=typeof e?e:function(){var o,i=aW;t&&sr(),sl(n,!0);try{return e.apply(this,arguments)}finally{sl(i,!1),r&&(o=so,aS.call(aC,o))}}}function sd(e,n){return function(t,r){return e.call(this,sp(t,n),sp(r,n))}}-1===(""+aS).indexOf("[native code]")&&(sr=so=ag);let sf="unhandledrejection";function sh(e,n){var t;try{t=n.onuncatched(e)}catch(e){}if(!1!==t)try{var r,o={promise:n,reason:e};if(iS.document&&document.createEvent?((r=document.createEvent("Event")).initEvent(sf,!0,!0),iP(r,o)):iS.CustomEvent&&iP(r=new CustomEvent(sf,{detail:o}),o),r&&iS.dispatchEvent&&(dispatchEvent(r),!iS.PromiseRejectionEvent&&iS.onunhandledrejection))try{iS.onunhandledrejection(r)}catch(e){}ae&&r&&!r.defaultPrevented&&console.warn(`Unhandled rejection: ${e.stack||e}`)}catch(e){}}var sm=aq.reject;let sg="3.2.7",sb=String.fromCharCode(65535),sy=-1/0,s_="Invalid key provided. Keys must be of type string, number, Date or Array<string | number | Date>.",sv="String expected.",s$=[],sA="u">typeof navigator&&/(MSIE|Trident|Edge)/.test(navigator.userAgent),sw=e=>!/(dexie\.js|dexie\.min\.js)/.test(e),sk="__dbnames",sx="readonly",sC="readwrite";function sE(e,n){return e?n?function(){return e.apply(this,arguments)&&n.apply(this,arguments)}:e:n}let sD={type:3,lower:-1/0,lowerOpen:!1,upper:[[]],upperOpen:!1};function sS(e){return"string"!=typeof e||/\./.test(e)?e=>e:n=>(void 0===n[e]&&e in n&&delete(n=i2(n))[e],n)}class sM{_trans(e,n,t){let r=this._tx||aW.trans,o=this.name;function i(e,t,r){if(!r.schema[o])throw new af.NotFound("Table "+o+" not part of transaction");return n(r.idbtrans,r)}let a=a1();try{return r&&r.db===this.db?r===aW.trans?r._promise(e,i,t):st(()=>r._promise(e,i,t),{trans:r,transless:aW.transless||aW}):function e(n,t,r,o){if(n.idbdb&&(n._state.openComplete||aW.letThrough||n._vip)){var i=n._createTransaction(t,r,n._dbSchema);try{i.create(),n._state.PR1398_maxLoop=3}catch(i){return i.name===ad.InvalidState&&n.isOpen()&&--n._state.PR1398_maxLoop>0?(console.warn("Dexie: Need to reopen db"),n._close(),n.open().then(()=>e(n,t,r,o))):sm(i)}return i._promise(t,(e,n)=>st(()=>(aW.trans=i,o(e,n,i)))).then(e=>i._completion.then(()=>e))}if(n._state.openComplete)return sm(new af.DatabaseClosed(n._state.dbOpenError));if(!n._state.isBeingOpened){if(!n._options.autoOpen)return sm(new af.DatabaseClosed);n.open().catch(ag)}return n._state.dbReadyPromise.then(()=>e(n,t,r,o))}(this.db,e,[this.name],i)}finally{a&&a2()}}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(iz(e))return new this.db.WhereClause(this,`[${e.join("+")}]`);let n=iM(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=>{if(e.compound&&n.every(n=>e.keyPath.indexOf(n)>=0)){for(let t=0;t<n.length;++t)if(-1===n.indexOf(e.keyPath[t]))return!1;return!0}return!1}).sort((e,n)=>e.keyPath.length-n.keyPath.length)[0];if(t&&this.db._maxKey!==sb){let r=t.keyPath.slice(0,n.length);return this.where(r).equals(r.map(n=>e[n]))}!t&&ae&&console.warn(`The query ${JSON.stringify(e)} on ${this.name} would benefit of a compound index [${n.join("+")}]`);let{idxByName:r}=this.schema,o=this.db._deps.indexedDB;function i(e,n){try{return 0===o.cmp(e,n)}catch(e){return!1}}let[a,s]=n.reduce(([n,t],o)=>{let a=r[o],s=e[o];return[n||a,n||!a?sE(t,a&&a.multi?e=>{let n=iK(e,o);return iz(n)&&n.some(e=>i(s,e))}:e=>i(s,iK(e,o))):t]},[null,null]);return a?this.where(a.name).equals(e[a.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,iz(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 r in n)if(iB(n,r))try{t[r]=n[r]}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){iP(this,e)})}add(e,n){let{auto:t,keyPath:r}=this.schema.primKey,o=e;return r&&t&&(o=sS(r)(e)),this._trans("readwrite",e=>this.core.mutate({trans:e,type:"add",keys:null!=n?[n]:null,values:[o]})).then(e=>e.numFailures?aq.reject(e.failures[0]):e.lastResult).then(n=>{if(r)try{iY(e,r,n)}catch(e){}return n})}update(e,n){if("object"!=typeof e||iz(e))return this.where(":id").equals(e).modify(n);{let t=iK(e,this.schema.primKey.keyPath);if(void 0===t)return sm(new af.InvalidArgument("Given object does not contain its primary key"));try{"function"!=typeof n?iM(n).forEach(t=>{iY(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:r}=this.schema.primKey,o=e;return r&&t&&(o=sS(r)(e)),this._trans("readwrite",e=>this.core.mutate({trans:e,type:"put",values:[o],keys:null!=n?[n]:null})).then(e=>e.numFailures?aq.reject(e.failures[0]):e.lastResult).then(n=>{if(r)try{iY(e,r,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?aq.reject(e.failures[0]):void 0)}clear(){return this._trans("readwrite",e=>this.core.mutate({trans:e,type:"deleteRange",range:sD})).then(e=>e.numFailures?aq.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 r=Array.isArray(n)?n:void 0,o=(t=t||(r?void 0:n))?t.allKeys:void 0;return this._trans("readwrite",n=>{let{auto:t,keyPath:i}=this.schema.primKey;if(i&&r)throw new af.InvalidArgument("bulkAdd(): keys argument invalid on tables with inbound keys");if(r&&r.length!==e.length)throw new af.InvalidArgument("Arguments objects and keys must have the same length");let a=e.length,s=i&&t?e.map(sS(i)):e;return this.core.mutate({trans:n,type:"add",keys:r,values:s,wantResults:o}).then(({numFailures:e,results:n,lastResult:t,failures:r})=>{if(0===e)return o?n:t;throw new ap(`${this.name}.bulkAdd(): ${e} of ${a} operations failed`,r)})})}bulkPut(e,n,t){let r=Array.isArray(n)?n:void 0,o=(t=t||(r?void 0:n))?t.allKeys:void 0;return this._trans("readwrite",n=>{let{auto:t,keyPath:i}=this.schema.primKey;if(i&&r)throw new af.InvalidArgument("bulkPut(): keys argument invalid on tables with inbound keys");if(r&&r.length!==e.length)throw new af.InvalidArgument("Arguments objects and keys must have the same length");let a=e.length,s=i&&t?e.map(sS(i)):e;return this.core.mutate({trans:n,type:"put",keys:r,values:s,wantResults:o}).then(({numFailures:e,results:n,lastResult:t,failures:r})=>{if(0===e)return o?n:t;throw new ap(`${this.name}.bulkPut(): ${e} of ${a} operations failed`,r)})})}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:r})=>{if(0===e)return t;throw new ap(`${this.name}.bulkDelete(): ${e} of ${n} operations failed`,r)})}}function sz(e){var n={},t=function(t,r){if(r){for(var o=arguments.length,i=Array(o-1);--o;)i[o-1]=arguments[o];return n[t].subscribe.apply(null,i),e}if("string"==typeof t)return n[t]};t.addEventType=i;for(var r=1,o=arguments.length;r<o;++r)i(arguments[r]);return t;function i(e,r,o){if("object"!=typeof e){r||(r=aw),o||(o=ag);var a={subscribers:[],fire:o,subscribe:function(e){-1===a.subscribers.indexOf(e)&&(a.subscribers.push(e),a.fire=r(a.fire,e))},unsubscribe:function(e){a.subscribers=a.subscribers.filter(function(n){return n!==e}),a.fire=a.subscribers.reduce(r,o)}};return n[e]=t[e]=a,a}iM(e).forEach(function(n){var t=e[n];if(iz(t))i(n,e[n][0],e[n][1]);else{if("asap"!==t)throw new af.InvalidArgument("Invalid event config");var r=i(n,ab,function(){for(var e=arguments.length,n=Array(e);e--;)n[e]=arguments[e];r.subscribers.forEach(function(e){iq(function(){e.apply(null,n)})})})}})}}function sP(e,n){return iR(n).from({prototype:e}),n}function sO(e,n){return!(e.filter||e.algorithm||e.or)&&(n?e.justLimit:!e.replayFilter)}function sT(e,n){e.filter=sE(e.filter,n)}function sB(e,n,t){var r=e.replayFilter;e.replayFilter=r?()=>sE(r(),n()):n,e.justLimit=t&&!r}function sI(e,n){if(e.isPrimKey)return n.primaryKey;let t=n.getIndexByKeyPath(e.index);if(!t)throw new af.Schema("KeyPath "+e.index+" on object store "+n.name+" is not indexed");return t}function sN(e,n,t){let r=sI(e,n.schema);return n.openCursor({trans:t,values:!e.keysOnly,reverse:"prev"===e.dir,unique:!!e.unique,query:{index:r,range:e.range}})}function sj(e,n,t,r){let o=e.replayFilter?sE(e.filter,e.replayFilter()):e.filter;if(e.or){let i={},a=(e,t,r)=>{if(!o||o(t,r,e=>t.stop(e),e=>t.fail(e))){var a=t.primaryKey,s=""+a;"[object ArrayBuffer]"===s&&(s=""+new Uint8Array(a)),iB(i,s)||(i[s]=!0,n(e,t,r))}};return Promise.all([e.or._iterate(a,t),sR(sN(e,r,t),e.algorithm,a,!e.keysOnly&&e.valueMapper)])}return sR(sN(e,r,t),sE(e.algorithm,o),n,!e.keysOnly&&e.valueMapper)}function sR(e,n,t,r){var o=a4(r?(e,n,o)=>t(r(e),n,o):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=ag},n=>{e.fail(n),t=ag})||o(e.value,e,e=>t=e),t()})})}function sF(e,n){try{let t=sL(e),r=sL(n);if(t!==r)return"Array"===t?1:"Array"===r?-1:"binary"===t?1:"binary"===r?-1:"string"===t?1:"string"===r?-1:"Date"===t?1:"Date"!==r?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,r=n.length,o=t<r?t:r;for(let t=0;t<o;++t)if(e[t]!==n[t])return e[t]<n[t]?-1:1;return t===r?0:t<r?-1:1}(sW(e),sW(n));case"Array":return function(e,n){let t=e.length,r=n.length,o=t<r?t:r;for(let t=0;t<o;++t){let r=sF(e[t],n[t]);if(0!==r)return r}return t===r?0:t<r?-1:1}(e,n)}}catch(e){}return NaN}function sL(e){let n=typeof e;if("object"!==n)return n;if(ArrayBuffer.isView(e))return"binary";let t=i5(e);return"ArrayBuffer"===t?"binary":t}function sW(e){return e instanceof Uint8Array?e:ArrayBuffer.isView(e)?new Uint8Array(e.buffer,e.byteOffset,e.byteLength):new Uint8Array(e)}class sV{_read(e,n){var t=this._ctx;return t.error?t.table._trans(null,sm.bind(null,t.error)):t.table._trans("readonly",e).then(n)}_write(e){var n=this._ctx;return n.error?n.table._trans(null,sm.bind(null,n.error)):n.table._trans("readwrite",e,"locked")}_addAlgorithm(e){var n=this._ctx;n.algorithm=sE(n.algorithm,e)}_iterate(e,n){return sj(this._ctx,e,n,this._ctx.table.core)}clone(e){var n=Object.create(this.constructor.prototype),t=Object.create(this._ctx);return e&&iP(t,e),n._ctx=t,n}raw(){return this._ctx.valueMapper=null,this}each(e){var n=this._ctx;return this._read(t=>sj(n,e,t,n.table.core))}count(e){return this._read(e=>{let n=this._ctx,t=n.table.core;if(sO(n,!0))return t.count({trans:e,query:{index:sI(n,t.schema),range:n.range}}).then(e=>Math.min(e,n.limit));var r=0;return sj(n,()=>(++r,!1),e,t).then(()=>r)}).then(e)}sortBy(e,n){let t=e.split(".").reverse(),r=t[0],o=t.length-1;function i(e,n){return n?i(e[t[n]],n-1):e[r]}var a="next"===this._ctx.dir?1:-1;function s(e,n){var t=i(e,o),r=i(n,o);return t<r?-a:t>r?a: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&&sO(n,!0)&&n.limit>0){let{valueMapper:t}=n,r=sI(n,n.table.core.schema);return n.table.core.query({trans:e,limit:n.limit,values:!0,query:{index:r,range:n.range}}).then(({result:e})=>t?e.map(t):e)}{let t=[];return sj(n,e=>t.push(e),e,n.table.core).then(()=>t)}},e)}offset(e){var n=this._ctx;return e<=0||(n.offset+=e,sO(n)?sB(n,()=>{var n=e;return(e,t)=>0===n||(1===n?--n:t(()=>{e.advance(n),n=0}),!1)}):sB(n,()=>{var n=e;return()=>--n<0})),this}limit(e){return this._ctx.limit=Math.min(this._ctx.limit,e),sB(this._ctx,()=>{var n=e;return function(e,t,r){return--n<=0&&t(r),n>=0}},!0),this}until(e,n){return sT(this._ctx,function(t,r,o){return!e(t.value)||(r(o),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 sT(this._ctx,function(n){return e(n.value)}),(n=this._ctx).isMatch=sE(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&&sO(n,!0)&&n.limit>0)return this._read(e=>{var t=sI(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 sT(this._ctx,function(e){var n=e.primaryKey.toString(),r=iB(t,n);return t[n]=!0,!r}),this}modify(e){var n=this._ctx;return this._write(t=>{var r;if("function"==typeof e)r=e;else{var o=iM(e),i=o.length;r=function(n){for(var t=!1,r=0;r<i;++r){var a=o[r],s=e[a];iK(n,a)!==s&&(iY(n,a,s),t=!0)}return t}}let a=n.table.core,{outbound:s,extractKey:l}=a.schema.primaryKey,c=this.db._options.modifyChunkSize||200,u=[],p=0,d=[],f=(e,n)=>{let{failures:t,numFailures:r}=n;for(let n of(p+=e-r,iM(t)))u.push(t[n])};return this.clone().primaryKeys().then(o=>{let i=u=>{let p=Math.min(c,o.length-u);return a.getMany({trans:t,keys:o.slice(u,u+p),cache:"immutable"}).then(d=>{let h=[],m=[],g=s?[]:null,b=[];for(let e=0;e<p;++e){let n=d[e],t={value:i2(n),primKey:o[u+e]};!1!==r.call(t,t.value,t)&&(null==t.value?b.push(o[u+e]):s||0===sF(l(n),l(t.value))?(m.push(t.value),s&&g.push(o[u+e])):(b.push(o[u+e]),h.push(t.value)))}let y=sO(n)&&n.limit===1/0&&("function"!=typeof e||e===sG)&&{index:n.index,range:n.range};return Promise.resolve(h.length>0&&a.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(()=>(m.length>0||y&&"object"==typeof e)&&a.mutate({trans:t,type:"put",keys:g,values:m,criteria:y,changeSpec:"function"!=typeof e&&e}).then(e=>f(m.length,e))).then(()=>(b.length>0||y&&e===sG)&&a.mutate({trans:t,type:"delete",keys:b,criteria:y}).then(e=>f(b.length,e))).then(()=>o.length>u+p&&i(u+c))})};return i(0).then(()=>{if(u.length>0)throw new au("Error modifying one or more objects",u,p,d);return o.length})})})}delete(){var e=this._ctx,n=e.range;return sO(e)&&(e.isPrimKey&&!sA||3===n.type)?this._write(t=>{let{primaryKey:r}=e.table.core.schema;return e.table.core.count({trans:t,query:{index:r,range:n}}).then(r=>e.table.core.mutate({trans:t,type:"deleteRange",range:n}).then(({failures:e,lastResult:n,results:t,numFailures:o})=>{if(o)throw new au("Could not delete some values",Object.keys(e).map(n=>e[n]),r-o);return r-o}))}):this.modify(sG)}}let sG=(e,n)=>n.value=null;function sU(e,n){return e<n?-1:+(e!==n)}function sq(e,n){return e>n?-1:+(e!==n)}function sH(e,n,t){var r=e instanceof sX?new e.Collection(e):e;return r._ctx.error=t?new t(n):TypeError(n),r}function sK(e){return new e.Collection(e,()=>sZ("")).limit(0)}function sY(e,n,t,r){var o,i,a,s,l,c,u,p=t.length;if(!t.every(e=>"string"==typeof e))return sH(e,sv);function d(e){o="next"===e?e=>e.toUpperCase():e=>e.toLowerCase(),i="next"===e?e=>e.toLowerCase():e=>e.toUpperCase(),a="next"===e?sU:sq;var n=t.map(function(e){return{lower:i(e),upper:o(e)}}).sort(function(e,n){return a(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?"":r}d("next");var f=new e.Collection(e,()=>sJ(s[0],l[p-1]+r));f._ondirectionchange=function(e){d(e)};var h=0;return f._addAlgorithm(function(e,t,r){var o=e.key;if("string"!=typeof o)return!1;var d=i(o);if(n(d,l,h))return!0;for(var f=null,m=h;m<p;++m){var g=function(e,n,t,r,o,i){for(var a=Math.min(e.length,r.length),s=-1,l=0;l<a;++l){var c=n[l];if(c!==r[l])return 0>o(e[l],t[l])?e.substr(0,l)+t[l]+t.substr(l+1):0>o(e[l],r[l])?e.substr(0,l)+r[l]+t.substr(l+1):s>=0?e.substr(0,s)+n[s]+t.substr(s+1):null;0>o(e[l],c)&&(s=l)}return a<r.length&&"next"===i?e+t.substr(e.length):a<e.length&&"prev"===i?e.substr(0,t.length):s<0?null:e.substr(0,s)+r[s]+t.substr(s+1)}(o,d,s[m],l[m],a,c);null===g&&null===f?h=m+1:(null===f||a(f,g)>0)&&(f=g)}return t(null!==f?function(){e.continue(f+u)}:r),!1}),f}function sJ(e,n,t,r){return{type:2,lower:e,upper:n,lowerOpen:t,upperOpen:r}}function sZ(e){return{type:1,lower:e,upper:e}}class sX{get Collection(){return this._ctx.table.db.Collection}between(e,n,t,r){t=!1!==t,r=!0===r;try{return this._cmp(e,n)>0||0===this._cmp(e,n)&&(t||r)&&(!t||!r)?sK(this):new this.Collection(this,()=>sJ(e,n,!t,!r))}catch(e){return sH(this,s_)}}equals(e){return null==e?sH(this,s_):new this.Collection(this,()=>sZ(e))}above(e){return null==e?sH(this,s_):new this.Collection(this,()=>sJ(e,void 0,!0))}aboveOrEqual(e){return null==e?sH(this,s_):new this.Collection(this,()=>sJ(e,void 0,!1))}below(e){return null==e?sH(this,s_):new this.Collection(this,()=>sJ(void 0,e,!1,!0))}belowOrEqual(e){return null==e?sH(this,s_):new this.Collection(this,()=>sJ(void 0,e))}startsWith(e){return"string"!=typeof e?sH(this,sv):this.between(e,e+sb,!0,!0)}startsWithIgnoreCase(e){return""===e?this.startsWith(e):sY(this,(e,n)=>0===e.indexOf(n[0]),[e],sb)}equalsIgnoreCase(e){return sY(this,(e,n)=>e===n[0],[e],"")}anyOfIgnoreCase(){var e=i7.apply(i8,arguments);return 0===e.length?sK(this):sY(this,(e,n)=>-1!==n.indexOf(e),e,"")}startsWithAnyOfIgnoreCase(){var e=i7.apply(i8,arguments);return 0===e.length?sK(this):sY(this,(e,n)=>n.some(n=>0===e.indexOf(n)),e,sb)}anyOf(){let e=i7.apply(i8,arguments),n=this._cmp;try{e.sort(n)}catch(e){return sH(this,s_)}if(0===e.length)return sK(this);let t=new this.Collection(this,()=>sJ(e[0],e[e.length-1]));t._ondirectionchange=t=>{n="next"===t?this._ascending:this._descending,e.sort(n)};let r=0;return t._addAlgorithm((t,o,i)=>{let a=t.key;for(;n(a,e[r])>0;)if(++r===e.length)return o(i),!1;return 0===n(a,e[r])||(o(()=>{t.continue(e[r])}),!1)}),t}notEqual(e){return this.inAnyRange([[sy,e],[e,this.db._maxKey]],{includeLowers:!1,includeUppers:!1})}noneOf(){let e=i7.apply(i8,arguments);if(0===e.length)return new this.Collection(this);try{e.sort(this._ascending)}catch(e){return sH(this,s_)}let n=e.reduce((e,n)=>e?e.concat([[e[e.length-1][1],n]]):[[sy,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,r=this._ascending,o=this._descending,i=this._min,a=this._max;if(0===e.length)return sK(this);if(!e.every(e=>void 0!==e[0]&&void 0!==e[1]&&0>=r(e[0],e[1])))return sH(this,"First argument to inAnyRange() must be an Array of two-value Arrays [lower,upper] where upper must not be lower than lower",af.InvalidArgument);let s=!n||!1!==n.includeLowers,l=n&&!0===n.includeUppers,c,u=r;function p(e,n){return u(e[0],n[0])}try{(c=e.reduce(function(e,n){let r=0,o=e.length;for(;r<o;++r){let o=e[r];if(0>t(n[0],o[1])&&t(n[1],o[0])>0){o[0]=i(o[0],n[0]),o[1]=a(o[1],n[1]);break}}return r===o&&e.push(n),e},[])).sort(p)}catch(e){return sH(this,s_)}let d=0,f=l?e=>r(e,c[d][1])>0:e=>r(e,c[d][1])>=0,h=s?e=>o(e,c[d][0])>0:e=>o(e,c[d][0])>=0,m=f,g=new this.Collection(this,()=>sJ(c[0][0],c[c.length-1][1],!s,!l));return g._ondirectionchange=e=>{"next"===e?(m=f,u=r):(m=h,u=o),c.sort(p)},g._addAlgorithm((e,n,t)=>{for(var o=e.key;m(o);)if(++d===c.length)return n(t),!1;return!!(!f(o)&&!h(o))||(0===this._cmp(o,c[d][1])||0===this._cmp(o,c[d][0])||n(()=>{u===r?e.continue(c[d][0]):e.continue(c[d][1])}),!1)}),g}startsWithAnyOf(){let e=i7.apply(i8,arguments);return e.every(e=>"string"==typeof e)?0===e.length?sK(this):this.inAnyRange(e.map(e=>[e,e+sb])):sH(this,"startsWithAnyOf() only works with strings")}}function sQ(e){return a4(function(n){return s0(n),e(n.target.error),!1})}function s0(e){e.stopPropagation&&e.stopPropagation(),e.preventDefault&&e.preventDefault()}let s1="storagemutated",s2="x-storagemutated-1",s3=sz(null,s1);class s5{_lock(){return iU(!aW.global),++this._reculock,1!==this._reculock||aW.global||(aW.lockOwnerFor=this),this}_unlock(){if(iU(!aW.global),0==--this._reculock)for(aW.global||(aW.lockOwnerFor=null);this._blockedFuncs.length>0&&!this._locked();){var e=this._blockedFuncs.shift();try{su(e[1],e[0])}catch(e){}}return this}_locked(){return this._reculock&&aW.lockOwnerFor!==this}create(e){if(!this.mode)return this;let n=this.db.idbdb,t=this.db._state.dbOpenError;if(iU(!this.idbtrans),!e&&!n)switch(t&&t.name){case"DatabaseClosedError":throw new af.DatabaseClosed(t);case"MissingAPIError":throw new af.MissingAPI(t.message,t);default:throw new af.OpenFailed(t)}if(!this.active)throw new af.TransactionInactive;return iU(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=a4(n=>{s0(n),this._reject(e.error)}),e.onabort=a4(n=>{s0(n),this.active&&this._reject(new af.Abort(e.error)),this.active=!1,this.on("abort").fire(n)}),e.oncomplete=a4(()=>{this.active=!1,this._resolve(),"mutatedParts"in e&&s3.storagemutated.fire(e.mutatedParts)}),this}_promise(e,n,t){if("readwrite"===e&&"readwrite"!==this.mode)return sm(new af.ReadOnly("Transaction is readonly"));if(!this.active)return sm(new af.TransactionInactive);if(this._locked())return new aq((r,o)=>{this._blockedFuncs.push([()=>{this._promise(e,n,t).then(r,o)},aW])});if(t)return st(()=>{var e=new aq((e,t)=>{this._lock();let r=n(e,t,this);r&&r.then&&r.then(e,t)});return e.finally(()=>this._unlock()),e._lib=!0,e});var r=new aq((e,t)=>{var r=n(e,t,this);r&&r.then&&r.then(e,t)});return r._lib=!0,r}_root(){return this.parent?this.parent._root():this}waitFor(e){var n=this._root();let t=aq.resolve(e);if(n._waitingFor)n._waitingFor=n._waitingFor.then(()=>t);else{n._waitingFor=t,n._waitingQueue=[];var r=n.idbtrans.objectStore(n.storeNames[0]);!function e(){for(++n._spinCount;n._waitingQueue.length;)n._waitingQueue.shift()();n._waitingFor&&(r.get(-1/0).onsuccess=e)}()}var o=n._waitingFor;return new aq((e,r)=>{t.then(t=>n._waitingQueue.push(a4(e.bind(null,t))),e=>n._waitingQueue.push(a4(r.bind(null,e)))).finally(()=>{n._waitingFor===o&&(n._waitingFor=null)})})}abort(){this.active&&(this.active=!1,this.idbtrans&&this.idbtrans.abort(),this._reject(new af.Abort))}table(e){let n=this._memoizedTables||(this._memoizedTables={});if(iB(n,e))return n[e];let t=this.schema[e];if(!t)throw new af.NotFound("Table "+e+" not part of transaction");let r=new this.db.Table(e,t,this);return r.core=this.db.core.table(e),n[e]=r,r}}function s4(e,n,t,r,o,i,a){return{name:e,keyPath:n,unique:t,multi:r,auto:o,compound:i,src:(t&&!a?"&":"")+(r?"*":"")+(o?"++":"")+s6(n)}}function s6(e){return"string"==typeof e?e:e?"["+[].join.call(e,"+")+"]":""}function s8(e,n,t){return{name:e,primKey:n,indexes:t,mappedClass:null,idxByName:iH(t,e=>[e.name,e])}}let s7=e=>{try{return e.only([[]]),s7=()=>[[]],[[]]}catch(e){return s7=()=>sb,sb}};function s9(e){return null==e?()=>{}:"string"==typeof e?1===e.split(".").length?n=>n[e]:n=>iK(n,e):n=>iK(n,e)}function le(e){return[].slice.call(e)}let ln=0;function lt(e){return null==e?":id":"string"==typeof e?e:`[${e.join("+")}]`}function lr({_novip:e},n){let t=n.db,r=function(e,n,{IDBKeyRange:t,indexedDB:r},o){var i;return{dbcore:(i=function(e,n,t){let r;function o(e){if(3===e.type)return null;if(4===e.type)throw Error("Cannot convert never type to IDBKeyRange");let{lower:t,upper:r,lowerOpen:o,upperOpen:i}=e;return void 0===t?void 0===r?null:n.upperBound(r,!!i):void 0===r?n.lowerBound(t,!!o):n.bound(t,r,!!o,!!i)}let{schema:i,hasGetAll:a}=(r=le(e.objectStoreNames),{schema:{name:e.name,tables:r.map(e=>t.objectStore(e)).map(e=>{let{keyPath:n,autoIncrement:t}=e,r=iz(n),o=null==n,i={},a={name:e.name,primaryKey:{name:null,isPrimaryKey:!0,outbound:o,compound:r,keyPath:n,autoIncrement:t,unique:!0,extractKey:s9(n)},indexes:le(e.indexNames).map(n=>e.index(n)).map(e=>{let{name:n,unique:t,multiEntry:r,keyPath:o}=e,a={name:n,compound:iz(o),keyPath:o,unique:t,multiEntry:r,extractKey:s9(o)};return i[lt(o)]=a,a}),getIndexByKeyPath:e=>i[lt(e)]};return i[":id"]=a.primaryKey,null!=n&&(i[lt(n)]=a.primaryKey),a})},hasGetAll:r.length>0&&"getAll"in t.objectStore(r[0])&&!("u">typeof navigator&&/Safari/.test(navigator.userAgent)&&!/(Chrome\/|Edge\/)/.test(navigator.userAgent)&&[].concat(navigator.userAgent.match(/Safari\/(\d*)/))[1]<604)}),s=i.tables.map(e=>{let n;return{name:n=e.name,schema:e,mutate:function({trans:e,type:t,keys:r,values:i,range:a}){return new Promise((s,l)=>{let c;s=a4(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}=r||i||{length:1};if(r&&i&&r.length!==i.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=[],m=[],g=0,b=e=>{++g,s0(e)};if("deleteRange"===t){if(4===a.type)return s({numFailures:g,failures:m,results:[],lastResult:void 0});3===a.type?h.push(c=u.clear()):h.push(c=u.delete(o(a)))}else{let[e,n]=d?p?[i,r]:[i,null]:[r,null];if(d)for(let r=0;r<f;++r)h.push(c=n&&void 0!==n[r]?u[t](e[r],n[r]):u[t](e[r])),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&&(m[n]=e.error)),s({numFailures:g,failures:m,results:"delete"===t?r:h.map(e=>e.result),lastResult:n})};c.onerror=e=>{b(e),y(e)},c.onsuccess=y})},getMany:({trans:e,keys:t})=>new Promise((r,o)=>{r=a4(r);let i=e.objectStore(n),a=t.length,s=Array(a),l,c=0,u=0,p=e=>{let n=e.target;s[n._pos]=n.result,++u===c&&r(s)},d=sQ(o);for(let e=0;e<a;++e)null!=t[e]&&((l=i.get(t[e]))._pos=e,l.onsuccess=p,l.onerror=d,++c);0===c&&r(s)}),get:({trans:e,key:t})=>new Promise((r,o)=>{r=a4(r);let i=e.objectStore(n).get(t);i.onsuccess=e=>r(e.target.result),i.onerror=sQ(o)}),query:e=>new Promise((t,r)=>{t=a4(t);let{trans:i,values:s,limit:l,query:c}=e,u=l===1/0?void 0:l,{index:p,range:d}=c,f=i.objectStore(n),h=p.isPrimaryKey?f:f.index(p.name),m=o(d);if(0===l)return t({result:[]});if(a){let e=s?h.getAll(m,u):h.getAllKeys(m,u);e.onsuccess=e=>t({result:e.target.result}),e.onerror=sQ(r)}else{let e=0,n=!s&&"openKeyCursor"in h?h.openKeyCursor(m):h.openCursor(m),o=[];n.onsuccess=r=>{let i=n.result;return i?(o.push(s?i.value:i.primaryKey),++e===l?t({result:o}):void i.continue()):t({result:o})},n.onerror=sQ(r)}}),openCursor:function({trans:e,values:t,query:r,reverse:i,unique:a}){return new Promise((s,l)=>{s=a4(s);let{index:c,range:u}=r,p=e.objectStore(n),d=c.isPrimaryKey?p:p.index(c.name),f=i?a?"prevunique":"prev":a?"nextunique":"next",h=!t&&"openKeyCursor"in d?d.openKeyCursor(o(u),f):d.openCursor(o(u),f);h.onerror=sQ(l),h.onsuccess=a4(n=>{let t=h.result;if(!t)return void s(null);t.___id=++ln,t.done=!1;let r=t.continue.bind(t),o=t.continuePrimaryKey;o&&(o=o.bind(t));let i=t.advance.bind(t),a=()=>{throw Error("Cursor not stopped")};t.trans=e,t.stop=t.continue=t.continuePrimaryKey=t.advance=()=>{throw Error("Cursor not started")},t.fail=a4(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=a4(e),h.onerror=sQ(n),t.fail=n,t.stop=n=>{t.stop=t.continue=t.continuePrimaryKey=t.advance=a,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=a4(e=>{h.onsuccess=s,s()}),t.continue=r,t.continuePrimaryKey=o,t.advance=i,s(),n},s(t)},l)})},count({query:e,trans:t}){let{index:r,range:i}=e;return new Promise((e,a)=>{let s=t.objectStore(n),l=r.isPrimaryKey?s:s.index(r.name),c=o(i),u=c?l.count(c):l.count();u.onsuccess=a4(n=>e(n.target.result)),u.onerror=sQ(a)})}}}),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:s7(n),schema:i}}(n,t,o),e.dbcore.reduce((e,{create:n})=>({...e,...n(e)}),i))}}(e._middlewares,t,e._deps,n);e.core=r.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 lo({_novip:e},n,t,r){t.forEach(t=>{let o=r[t];n.forEach(n=>{let r=iL(n,t);(!r||"value"in r&&void 0===r.value)&&(n===e.Transaction.prototype||n instanceof e.Transaction?ij(n,t,{get(){return this.table(t)},set(e){iN(this,t,{value:e,writable:!0,configurable:!0,enumerable:!0})}}):n[t]=new e.Table(t,o))})})}function li({_novip:e},n){n.forEach(n=>{for(let t in n)n[t]instanceof e.Table&&delete n[t]})}function la(e,n){return e._cfg.version-n._cfg.version}function ls(e,n){let t,r={del:[],add:[],change:[]};for(t in e)n[t]||r.del.push(t);for(t in n){let o=e[t],i=n[t];if(o){let e={name:t,def:i,recreate:!1,del:[],add:[],change:[]};if(""+(o.primKey.keyPath||"")==""+(i.primKey.keyPath||"")&&(o.primKey.auto===i.primKey.auto||sA)){let n,t=o.idxByName,a=i.idxByName;for(n in t)a[n]||e.del.push(n);for(n in a){let r=t[n],o=a[n];r?r.src!==o.src&&e.change.push(o):e.add.push(o)}(e.del.length>0||e.add.length>0||e.change.length>0)&&r.change.push(e)}else e.recreate=!0,r.change.push(e)}else r.add.push([t,i])}return r}function ll(e,n,t,r){let o=e.db.createObjectStore(n,t.keyPath?{keyPath:t.keyPath,autoIncrement:t.auto}:{autoIncrement:t.auto});return r.forEach(e=>lc(o,e)),o}function lc(e,n){e.createIndex(n.name,n.keyPath,{unique:n.unique,multiEntry:n.multi})}function lu(e,n,t){let r={};return iV(n.objectStoreNames,0).forEach(e=>{let n=t.objectStore(e),o=n.keyPath,i=s4(s6(o),o||"",!1,!1,!!n.autoIncrement,o&&"string"!=typeof o,!0),a=[];for(let e=0;e<n.indexNames.length;++e){let t=n.index(n.indexNames[e]);o=t.keyPath;var s=s4(t.name,o,!!t.unique,!!t.multiEntry,!1,o&&"string"!=typeof o,!1);a.push(s)}r[e]=s8(e,i,a)}),r}function lp({_novip:e},n,t){let r=t.db.objectStoreNames;for(let o=0;o<r.length;++o){let i=r[o],a=t.objectStore(i);e._hasGetAll="getAll"in a;for(let e=0;e<a.indexNames.length;++e){let t=a.indexNames[e],r=a.index(t).keyPath,o="string"==typeof r?r:"["+iV(r).join("+")+"]";if(n[i]){let e=n[i].idxByName[o];e&&(e.name=t,delete n[i].idxByName[o],n[i].idxByName[t]=e)}}}"u">typeof navigator&&/Safari/.test(navigator.userAgent)&&!/(Chrome\/|Edge\/)/.test(navigator.userAgent)&&iS.WorkerGlobalScope&&iS instanceof iS.WorkerGlobalScope&&[].concat(navigator.userAgent.match(/Safari\/(\d*)/))[1]<604&&(e._hasGetAll=!1)}class ld{_parseStoresSpec(e,n){iM(e).forEach(t=>{if(null!==e[t]){var r=e[t].split(",").map((e,n)=>{let t=(e=e.trim()).replace(/([&*]|\+\+)/g,""),r=/^\[/.test(t)?t.match(/^\[(.*)\]$/)[1].split("+"):t;return s4(t,r||null,/\&/.test(e),/\*/.test(e),/\+\+/.test(e),iz(r),0===n)}),o=r.shift();if(o.multi)throw new af.Schema("Primary key cannot be multi-valued");r.forEach(e=>{if(e.auto)throw new af.Schema("Only primary key can be marked as autoIncrement (++)");if(!e.keyPath)throw new af.Schema("Index must have a name and cannot be an empty string")}),n[t]=s8(t,o,r)}})}stores(e){let n=this.db;this._cfg.storesSource=this._cfg.storesSource?iP(this._cfg.storesSource,e):e;let t=n._versions,r={},o={};return t.forEach(e=>{iP(r,e._cfg.storesSource),o=e._cfg.dbschema={},e._parseStoresSpec(r,o)}),n._dbSchema=o,li(n,[n._allTables,n,n.Transaction.prototype]),lo(n,[n._allTables,n,n.Transaction.prototype,this._cfg.tables],iM(o),o),n._storeNames=iM(o),this}upgrade(e){return this._cfg.contentUpgrade=ak(this._cfg.contentUpgrade||ag,e),this}}function lf(e,n){let t=e._dbNamesDB;return t||(t=e._dbNamesDB=new lP(sk,{addons:[],indexedDB:e,IDBKeyRange:n})).version(1).stores({dbnames:"name"}),t.table("dbnames")}function lh(e){return e&&"function"==typeof e.databases}function lm(e){return st(function(){return aW.letThrough=!0,e()})}function lg(e){var n=n=>e.next(n),t=o(n),r=o(n=>e.throw(n));function o(e){return n=>{var o=e(n),i=o.value;return o.done?i:i&&"function"==typeof i.then?i.then(t,r):iz(i)?Promise.all(i).then(t,r):t(i)}}return o(n)()}function lb(e,n,t){var r=arguments.length;if(r<2)throw new af.InvalidArgument("Too few arguments");for(var o=Array(r-1);--r;)o[r-1]=arguments[r];return t=o.pop(),[e,iX(o),t]}function ly(e,n,t){let r=iz(e)?e.slice():[e];for(let e=0;e<t;++e)r.push(n);return r}let l_={stack:"dbcore",name:"VirtualIndexMiddleware",level:1,create:function(e){return{...e,table(n){let t=e.table(n),{schema:r}=t,o={},i=[];function a(e,n,t){let r=lt(e),s=o[r]=o[r]||[],l=null==e?0:"string"==typeof e?1:e.length,c=n>0,u={...t,isVirtual:c,keyTail:n,keyLength:l,extractKey:s9(e),unique:!c&&t.unique};return s.push(u),u.isPrimaryKey||i.push(u),l>1&&a(2===l?e[0]:e.slice(0,l-1),n+1,t),s.sort((e,n)=>e.keyTail-n.keyTail),u}let s=a(r.primaryKey.keyPath,0,r.primaryKey);for(let e of(o[":id"]=[s],r.indexes))a(e.keyPath,0,e);function l(n){var t,r;let o=n.query.index;return o.isVirtual?{...n,query:{index:o,range:(t=n.query.range,r=o.keyTail,{type:1===t.type?2:t.type,lower:ly(t.lower,t.lowerOpen?e.MAX_KEY:e.MIN_KEY,r),lowerOpen:!0,upper:ly(t.upper,t.upperOpen?e.MIN_KEY:e.MAX_KEY,r),upperOpen:!0})}}:n}return{...t,schema:{...r,primaryKey:s,indexes:i,getIndexByKeyPath:function(e){let n=o[lt(e)];return n&&n[0]}},count:e=>t.count(l(e)),query:e=>t.query(l(e)),openCursor(n){let{keyTail:r,isVirtual:o,keyLength:i}=n.query.index;return o?t.openCursor(l(n)).then(t=>t&&Object.create(t,{continue:{value:function(o){null!=o?t.continue(ly(o,n.reverse?e.MAX_KEY:e.MIN_KEY,r)):n.unique?t.continue(t.key.slice(0,i).concat(n.reverse?e.MIN_KEY:e.MAX_KEY,r)):t.continue()}},continuePrimaryKey:{value(n,o){t.continuePrimaryKey(ly(n,e.MAX_KEY,r),o)}},primaryKey:{get:()=>t.primaryKey},key:{get(){let e=t.key;return 1===i?e[0]:e.slice(0,i)}},value:{get:()=>t.value}})):t.openCursor(n)}}}}}};function lv(e,n,t,r){return t=t||{},r=r||"",iM(e).forEach(o=>{if(iB(n,o)){var i=e[o],a=n[o];if("object"==typeof i&&"object"==typeof a&&i&&a){let e=i5(i);e!==i5(a)?t[r+o]=n[o]:"Object"===e?lv(i,a,t,r+o+"."):i!==a&&(t[r+o]=n[o])}else i!==a&&(t[r+o]=n[o])}else t[r+o]=void 0}),iM(n).forEach(o=>{iB(e,o)||(t[r+o]=n[o])}),t}let l$={stack:"dbcore",name:"HooksMiddleware",level:2,create:e=>({...e,table(n){let t=e.table(n),{primaryKey:r}=t.schema;return{...t,mutate(e){let o=aW.trans,{deleting:i,creating:a,updating:s}=o.table(n).hook;switch(e.type){case"add":if(a.fire===ag)break;return o._promise("readwrite",()=>l(e),!0);case"put":if(a.fire===ag&&s.fire===ag)break;return o._promise("readwrite",()=>l(e),!0);case"delete":if(i.fire===ag)break;return o._promise("readwrite",()=>l(e),!0);case"deleteRange":if(i.fire===ag)break;return o._promise("readwrite",()=>(function e(n,o,i){return t.query({trans:n,values:!1,query:{index:r,range:o},limit:i}).then(({result:t})=>l({type:"delete",keys:t,trans:n}).then(r=>r.numFailures>0?Promise.reject(r.failures[0]):t.length<i?{failures:[],numFailures:0,lastResult:void 0}:e(n,{...o,lower:t[t.length-1],lowerOpen:!0},i)))})(e.trans,e.range,1e4),!0)}return t.mutate(e);function l(e){var n,o;let l=aW.trans,c=e.keys||("delete"===(n=e).type?n.keys:n.keys||n.values.map(r.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"===(o=e).type?Promise.resolve([]):t.getMany({trans:o.trans,keys:c,cache:"immutable"})).then(n=>{let o=c.map((t,o)=>{let c=n[o],u={onerror:null,onsuccess:null};if("delete"===e.type)i.fire.call(u,t,c,l);else if("add"===e.type||void 0===c){let n=a.fire.call(u,t,e.values[o],l);null==t&&null!=n&&(t=n,e.keys[o]=t,r.outbound||iY(e.values[o],r.keyPath,t))}else{let n=lv(c,e.values[o]),r=s.fire.call(u,n,t,c,l);if(r){let n=e.values[o];Object.keys(r).forEach(e=>{iB(n,e)?n[e]=r[e]:iY(n,e,r[e])})}}return u});return t.mutate(e).then(({failures:t,results:r,numFailures:i,lastResult:a})=>{for(let i=0;i<c.length;++i){let a=r?r[i]:c[i],s=o[i];null==a?s.onerror&&s.onerror(t[i]):s.onsuccess&&s.onsuccess("put"===e.type&&n[i]?e.values[i]:a)}return{failures:t,results:r,numFailures:i,lastResult:a}}).catch(e=>(o.forEach(n=>n.onerror&&n.onerror(e)),Promise.reject(e)))})}}}}})};function lA(e,n,t){try{if(!n||n.keys.length<e.length)return null;let r=[];for(let o=0,i=0;o<n.keys.length&&i<e.length;++o)0===sF(n.keys[o],e[i])&&(r.push(t?i2(n.values[o]):n.values[o]),++i);return r.length===e.length?r:null}catch(e){return null}}let lw={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=lA(e.keys,e.trans._cache,"clone"===e.cache);return n?aq.resolve(n):t.getMany(e).then(n=>(e.trans._cache={keys:e.keys,values:"clone"===e.cache?i2(n):n},n))},mutate:e=>("add"!==e.type&&(e.trans._cache=null),t.mutate(e))}}})};function lk(e){return!("from"in e)}let lx=function(e,n){if(!this){let n=new lx;return e&&"d"in e&&iP(n,e),n}iP(this,arguments.length?{d:1,from:e,to:arguments.length>1?n:e}:{d:0})};function lC(e,n,t){let r=sF(n,t);if(isNaN(r))return;if(r>0)throw RangeError();if(lk(e))return iP(e,{from:n,to:t,d:1});let o=e.l,i=e.r;if(0>sF(t,e.from))return o?lC(o,n,t):e.l={from:n,to:t,d:1,l:null,r:null},lS(e);if(sF(n,e.to)>0)return i?lC(i,n,t):e.r={from:n,to:t,d:1,l:null,r:null},lS(e);0>sF(n,e.from)&&(e.from=n,e.l=null,e.d=i?i.d+1:1),sF(t,e.to)>0&&(e.to=t,e.r=null,e.d=e.l?e.l.d+1:1);let a=!e.r;o&&!e.l&&lE(e,o),i&&a&&lE(e,i)}function lE(e,n){lk(n)||function e(n,{from:t,to:r,l:o,r:i}){lC(n,t,r),o&&e(n,o),i&&e(n,i)}(e,n)}function lD(e){let n=lk(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>sF(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>=sF(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 lS(e){var n,t;let r=((null==(n=e.r)?void 0:n.d)||0)-((null==(t=e.l)?void 0:t.d)||0),o=r>1?"r":r<-1?"l":"";if(o){let n="r"===o?"l":"r",t={...e},r=e[o];e.from=r.from,e.to=r.to,e[o]=r[o],t[o]=r[n],e[n]=t,t.d=lM(t)}e.d=lM(e)}function lM({r:e,l:n}){return(e?n?Math.max(e.d,n.d):e.d:n?n.d:0)+1}iI(lx.prototype,{add(e){return lE(this,e),this},addKey(e){return lC(this,e,e),this},addKeys(e){return e.forEach(e=>lC(this,e,e)),this},[i4](){return lD(this)}});let lz={stack:"dbcore",level:0,create:e=>{let n=e.schema.name,t=new lx(e.MIN_KEY,e.MAX_KEY);return{...e,table:r=>{let o=e.table(r),{schema:i}=o,{primaryKey:a}=i,{extractKey:s,outbound:l}=a,c={...o,mutate:e=>{let a=e.trans,s=a.mutatedParts||(a.mutatedParts={}),l=e=>{let t=`idb://${n}/${r}/${e}`;return s[t]||(s[t]=new lx)},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 o.mutate(e).then(e=>{if(iz(d)){"delete"!==p&&(d=e.results),c.addKeys(d);let n=lA(d,h);n||"add"===p||u.addKeys(d),(n||f)&&i.indexes.forEach(function(e){let t=l(e.name||"");function r(n){return null!=n?e.extractKey(n):null}let o=n=>e.multiEntry&&iz(n)?n.forEach(e=>t.addKey(e)):t.addKey(n);(n||f).forEach((e,t)=>{let i=n&&r(n[t]),a=f&&r(f[t]);0!==sF(i,a)&&(null!=i&&o(i),null!=a&&o(a))})})}else if(d){let e={from:d.lower,to:d.upper};u.add(e),c.add(e)}else c.add(t),u.add(t),i.indexes.forEach(e=>l(e.name).add(t));return e})}},u=({query:{index:n,range:t}})=>{var r,o;return[n,new lx(null!=(r=t.lower)?r:e.MIN_KEY,null!=(o=t.upper)?o:e.MAX_KEY)]},p={get:e=>[a,new lx(e.key)],getMany:e=>[a,(new lx).addKeys(e.keys)],count:u,query:u,openCursor:u};return iM(p).forEach(e=>{c[e]=function(i){let{subscr:a}=aW;if(a){let c=e=>{let t=`idb://${n}/${r}/${e}`;return a[t]||(a[t]=new lx)},u=c(""),d=c(":dels"),[f,h]=p[e](i);if(c(f.name||"").add(h),!f.isPrimaryKey){if("count"!==e){let n="query"===e&&l&&i.values&&o.query({...i,values:!1});return o[e].apply(this,arguments).then(t=>{if("query"===e){if(l&&i.values)return n.then(({result:e})=>(u.addKeys(e),t));let e=i.values?t.result.map(s):t.result;i.values?u.addKeys(e):d.addKeys(e)}else if("openCursor"===e){let e=i.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 o[e].apply(this,arguments)}}),c}}}};class lP{constructor(e,n){var t;this._middlewares={},this.verno=0;const r=lP.dependencies;this._options=n={addons:lP.addons,autoOpen:!0,indexedDB:r.indexedDB,IDBKeyRange:r.IDBKeyRange,...n},this._deps={indexedDB:n.indexedDB,IDBKeyRange:n.IDBKeyRange};const{addons:o}=n;this._dbSchema={},this._versions=[],this._storeNames=[],this._allTables={},this.idbdb=null,this._novip=this;const i={dbOpenError:null,isBeingOpened:!1,onReadyBeingFired:null,openComplete:!1,dbReadyResolve:ag,dbReadyPromise:null,cancelOpen:ag,openCanceller:null,autoSchema:!0,PR1398_maxLoop:3};i.dbReadyPromise=new aq(e=>{i.dbReadyResolve=e}),i.openCanceller=new aq((e,n)=>{i.cancelOpen=n}),this._state=i,this.name=e,this.on=sz(this,"populate","blocked","versionchange","close",{ready:[ak,ag]}),this.on.ready.subscribe=iG(this.on.ready.subscribe,e=>(n,t)=>{lP.vip(()=>{let r=this._state;if(r.openComplete)r.dbOpenError||aq.resolve().then(n),t&&e(n);else if(r.onReadyBeingFired)r.onReadyBeingFired.push(n),t&&e(n);else{e(n);let r=this;t||e(function e(){r.on.ready.unsubscribe(n),r.on.ready.unsubscribe(e)})}})}),this.Collection=(t=this,sP(sV.prototype,function(e,n){this.db=t;let r=sD,o=null;if(n)try{r=n()}catch(e){o=e}let i=e._ctx,a=i.table,s=a.hook.reading.fire;this._ctx={table:a,index:i.index,isPrimKey:!i.index||a.schema.primKey.keyPath&&i.index===a.schema.primKey.name,range:r,keysOnly:!1,dir:"next",unique:"",algorithm:null,filter:null,replayFilter:null,justLimit:!0,isMatch:null,offset:0,limit:1/0,error:o,or:i.or,valueMapper:s!==ab?s:null}})),this.Table=function(e){return sP(sM.prototype,function(n,t,r){this.db=e,this._tx=r,this.name=n,this.schema=t,this.hook=e._allTables[n]?e._allTables[n].hook:sz(null,{creating:[av,ag],reading:[ay,ab],updating:[aA,ag],deleting:[a$,ag]})})}(this),this.Transaction=function(e){return sP(s5.prototype,function(n,t,r,o,i){this.db=e,this.mode=n,this.storeNames=t,this.schema=r,this.chromeTransactionDurability=o,this.idbtrans=null,this.on=sz(this,"complete","error","abort"),this.parent=i||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 aq((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(),sm(e)})})}(this),this.Version=function(e){return sP(ld.prototype,function(n){this.db=e,this._cfg={version:n,storesSource:null,dbschema:{},tables:{},contentUpgrade:null}})}(this),this.WhereClause=function(e){return sP(sX.prototype,function(n,t,r){this.db=e,this._ctx={table:n,index:":id"===t?null:t,or:r};let o=e._deps.indexedDB;if(!o)throw new af.MissingAPI;this._cmp=this._ascending=o.cmp.bind(o),this._descending=(e,n)=>o.cmp(n,e),this._max=(e,n)=>o.cmp(e,n)>0?e:n,this._min=(e,n)=>0>o.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=s7(n.IDBKeyRange),this._createTransaction=(e,n,t,r)=>new this.Transaction(e,n,t,this._options.chromeTransactionDurability,r),this._fireOnBlocked=e=>{this.on("blocked").fire(e),s$.filter(e=>e.name===this.name&&e!==this&&!e._state.vcFired).map(n=>n.on("versionchange").fire(e))},this.use(l_),this.use(l$),this.use(lz),this.use(lw),this.vip=Object.create(this,{_vip:{value:!0}}),o.forEach(e=>e(this))}version(e){if(isNaN(e)||e<.1)throw new af.Type("Given version is not a positive number");if(e=Math.round(10*e)/10,this.idbdb||this._state.isBeingOpened)throw new af.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(la),t.stores({}),this._state.autoSchema=!1,t)}_whenReady(e){return this.idbdb&&(this._state.openComplete||aW.letThrough||this._vip)?e():new aq((e,n)=>{if(this._state.openComplete)return n(new af.DatabaseClosed(this._state.dbOpenError));if(!this._state.isBeingOpened){if(!this._options.autoOpen)return void n(new af.DatabaseClosed);this.open().catch(ag)}this._state.dbReadyPromise.then(e,n)}).then(e)}use({stack:e,create:n,level:t,name:r}){r&&this.unuse({stack:e,name:r});let o=this._middlewares[e]||(this._middlewares[e]=[]);return o.push({stack:e,create:n,level:null==t?10:t,name:r}),o.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:r}=e._deps;if(t.isBeingOpened||e.idbdb)return t.dbReadyPromise.then(()=>t.dbOpenError?sm(t.dbOpenError):e);ae&&(t.openCanceller._stackHolder=ar()),t.isBeingOpened=!0,t.dbOpenError=null,t.openComplete=!1;let o=t.openCanceller;function i(){if(t.openCanceller!==o)throw new af.DatabaseClosed("db.open() was cancelled")}let a=t.dbReadyResolve,s=null,l=!1,c=()=>new aq((n,o)=>{if(i(),!r)throw new af.MissingAPI;let a=e.name,c=t.autoSchema?r.open(a):r.open(a,Math.round(10*e.verno));if(!c)throw new af.MissingAPI;c.onerror=sQ(o),c.onblocked=a4(e._fireOnBlocked),c.onupgradeneeded=a4(n=>{if(s=c.transaction,t.autoSchema&&!e._options.allowEmptyDB){c.onerror=s0,s.abort(),c.result.close();let e=r.deleteDatabase(a);e.onsuccess=e.onerror=a4(()=>{o(new af.NoSuchDatabase(`Database ${a} doesnt exist`))})}else{let t,r,a,d;s.onerror=sQ(o);var i,u,p=n.oldVersion>0x4000000000000000?0:n.oldVersion;l=p<1,e._novip.idbdb=c.result,i=p/10,u=s,t=e._dbSchema,(r=e._createTransaction("readwrite",e._storeNames,t)).create(u),r._completion.catch(o),a=r._reject.bind(r),d=aW.transless||aW,st(()=>{aW.trans=r,aW.transless=d,0===i?(iM(t).forEach(e=>{ll(u,e,t[e].primKey,t[e].indexes)}),lr(e,u),aq.follow(()=>e.on.populate.fire(r)).catch(a)):(function({_novip:e},n,t,r){let o=[],i=e._versions,a=e._dbSchema=lu(e,e.idbdb,r),s=!1;return i.filter(e=>e._cfg.version>=n).forEach(i=>{o.push(()=>{let o=a,l=i._cfg.dbschema;lp(e,o,r),lp(e,l,r),a=e._dbSchema=l;let c=ls(o,l);c.add.forEach(e=>{ll(r,e[0],e[1].primKey,e[1].indexes)}),c.change.forEach(e=>{if(e.recreate)throw new af.Upgrade("Not yet support for changing primary key");{let n=r.objectStore(e.name);e.add.forEach(e=>lc(n,e)),e.change.forEach(e=>{n.deleteIndex(e.name),lc(n,e)}),e.del.forEach(e=>n.deleteIndex(e))}});let u=i._cfg.contentUpgrade;if(u&&i._cfg.version>n){let n;lr(e,r),t._memoizedTables={},s=!0;let i=iJ(l);c.del.forEach(e=>{i[e]=o[e]}),li(e,[e.Transaction.prototype]),lo(e,[e.Transaction.prototype],iM(i),i),t.schema=i;let a=i9(u);a&&sr();let p=aq.follow(()=>{if((n=u(t))&&a){var e=so.bind(null,null);n.then(e,e)}});return n&&"function"==typeof n.then?aq.resolve(n):p.then(()=>n)}}),o.push(n=>{var r;s&&sA||(r=i._cfg.dbschema,[].slice.call(n.db.objectStoreNames).forEach(e=>null==r[e]&&n.db.deleteObjectStore(e))),li(e,[e.Transaction.prototype]),lo(e,[e.Transaction.prototype],e._storeNames,e._dbSchema),t.schema=e._dbSchema})}),(function e(){return o.length?aq.resolve(o.shift()(t.idbtrans)).then(e):aq.resolve()})().then(()=>{var e;iM(e=a).forEach(n=>{r.db.objectStoreNames.contains(n)||ll(r,n,e[n].primKey,e[n].indexes)})})})(e,i,r,u).catch(a)})}},o),c.onsuccess=a4(()=>{s=null;let r=e._novip.idbdb=c.result,o=iV(r.objectStoreNames);if(o.length>0)try{let n,i=r.transaction(1===o.length?o[0]:o,"readonly");t.autoSchema?function({_novip:e},n,t){e.verno=n.version/10;let r=e._dbSchema=lu(0,n,t);e._storeNames=iV(n.objectStoreNames,0),lo(e,[e._allTables],iM(r),r)}(e,r,i):(lp(e,e._dbSchema,i),((n=ls(lu(0,e.idbdb,i),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.")),lr(e,i)}catch(e){}s$.push(e),r.onversionchange=a4(n=>{t.vcFired=!0,e.on("versionchange").fire(n)}),r.onclose=a4(n=>{e.on("close").fire(n)}),l&&function({indexedDB:e,IDBKeyRange:n},t){lh(e)||t===sk||lf(e,n).put({name:t}).catch(ag)}(e._deps,a),n()},o)}).catch(e=>e&&"UnknownError"===e.name&&t.PR1398_maxLoop>0?(t.PR1398_maxLoop--,console.warn("Dexie: Workaround for Chrome UnknownError on open()"),c()):aq.reject(e));return aq.race([o,("u"<typeof navigator?aq.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(c)]).then(()=>(i(),t.onReadyBeingFired=[],aq.resolve(lm(()=>e.on.ready.fire(e.vip))).then(function n(){if(t.onReadyBeingFired.length>0){let r=t.onReadyBeingFired.reduce(ak,ag);return t.onReadyBeingFired=[],aq.resolve(lm(()=>r(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 o===t.openCanceller&&e._close(),sm(n)}).finally(()=>{t.openComplete=!0,a()})}(this)}_close(){let e=this._state,n=s$.indexOf(this);if(n>=0&&s$.splice(n,1),this.idbdb){try{this.idbdb.close()}catch(e){}this._novip.idbdb=null}e.dbReadyPromise=new aq(n=>{e.dbReadyResolve=n}),e.openCanceller=new aq((n,t)=>{e.cancelOpen=t})}close(){this._close();let e=this._state;this._options.autoOpen=!1,e.dbOpenError=new af.DatabaseClosed,e.isBeingOpened&&e.cancelOpen(e.dbOpenError)}delete(){let e=arguments.length>0,n=this._state;return new aq((t,r)=>{let o=()=>{this.close();var e=this._deps.indexedDB.deleteDatabase(this.name);e.onsuccess=a4(()=>{!function({indexedDB:e,IDBKeyRange:n},t){lh(e)||t===sk||lf(e,n).delete(t).catch(ag)}(this._deps,this.name),t()}),e.onerror=sQ(r),e.onblocked=this._fireOnBlocked};if(e)throw new af.InvalidArgument("Arguments not allowed in db.delete()");n.isBeingOpened?n.dbReadyPromise.then(o):o()})}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 iM(this._allTables).map(e=>this._allTables[e])}transaction(){let e=lb.apply(this,arguments);return this._transaction.apply(this,e)}_transaction(e,n,t){let r,o,i=aW.trans;i&&i.db===this&&-1===e.indexOf("!")||(i=null);let a=-1!==e.indexOf("?");e=e.replace("!","").replace("?","");try{if(o=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===sx)r=sx;else{if("rw"!=e&&e!=sC)throw new af.InvalidArgument("Invalid transaction mode: "+e);r=sC}if(i){if(i.mode===sx&&r===sC){if(!a)throw new af.SubTransaction("Cannot enter a sub-transaction with READWRITE mode when parent transaction is READONLY");i=null}i&&o.forEach(e=>{if(i&&-1===i.storeNames.indexOf(e)){if(!a)throw new af.SubTransaction("Table "+e+" not included in parent transaction.");i=null}}),a&&i&&!i.active&&(i=null)}}catch(e){return i?i._promise(null,(n,t)=>{t(e)}):sm(e)}let s=(function e(n,t,r,o,i){return aq.resolve().then(()=>{let a,s=aW.transless||aW,l=n._createTransaction(t,r,n._dbSchema,o);if(o)l.idbtrans=o.idbtrans;else try{l.create(),n._state.PR1398_maxLoop=3}catch(o){return o.name===ad.InvalidState&&n.isOpen()&&--n._state.PR1398_maxLoop>0?(console.warn("Dexie: Need to reopen db"),n._close(),n.open().then(()=>e(n,t,r,null,i))):sm(o)}let c=i9(i);c&&sr();let u=aq.follow(()=>{if(a=i.call(l,l))if(c){var e=so.bind(null,null);a.then(e,e)}else"function"==typeof a.next&&"function"==typeof a.throw&&(a=lg(a))},{trans:l,transless:s});return(a&&"function"==typeof a.then?aq.resolve(a).then(e=>l.active?e:sm(new af.PrematureCommit("Transaction committed too early. See http://bit.ly/2kdckMn"))):u.then(()=>a)).then(e=>(o&&l._resolve(),l._completion.then(()=>e))).catch(e=>(l._reject(e),sm(e)))})}).bind(null,this,r,o,i,t);return i?i._promise(r,s,"lock"):aW.trans?su(aW.transless,()=>this._whenReady(s)):this._whenReady(s)}table(e){if(!iB(this._allTables,e))throw new af.InvalidTable(`Table ${e} does not exist`);return this._allTables[e]}}let lO="u">typeof Symbol&&"observable"in Symbol?Symbol.observable:"@@observable";class lT{constructor(e){this._subscribe=e}subscribe(e,n,t){return this._subscribe(e&&"function"!=typeof e?e:{next:e,error:n,complete:t})}[lO](){return this}}function lB(e,n){return iM(n).forEach(t=>{lE(e[t]||(e[t]=new lx),n[t])}),e}try{i={indexedDB:iS.indexedDB||iS.mozIndexedDB||iS.webkitIndexedDB||iS.msIndexedDB,IDBKeyRange:iS.IDBKeyRange||iS.webkitIDBKeyRange}}catch(e){i={indexedDB:null,IDBKeyRange:null}}function lI(e){let n=lN;try{lN=!0,s3.storagemutated.fire(e)}finally{lN=n}}iI(lP,{...am,delete:e=>new lP(e,{addons:[]}).delete(),exists:e=>new lP(e,{addons:[]}).open().then(e=>(e.close(),!0)).catch("NoSuchDatabaseError",()=>!1),getDatabaseNames(e){try{return(function({indexedDB:e,IDBKeyRange:n}){return lh(e)?Promise.resolve(e.databases()).then(e=>e.map(e=>e.name).filter(e=>e!==sk)):lf(e,n).toCollection().primaryKeys()})(lP.dependencies).then(e)}catch(e){return sm(new af.MissingAPI)}},defineClass:()=>function(e){iP(this,e)},ignoreTransaction:e=>aW.trans?su(aW.transless,e):e(),vip:lm,async:function(e){return function(){try{var n=lg(e.apply(this,arguments));return n&&"function"==typeof n.then?n:aq.resolve(n)}catch(e){return sm(e)}}},spawn:function(e,n,t){try{var r=lg(e.apply(t,n||[]));return r&&"function"==typeof r.then?r:aq.resolve(r)}catch(e){return sm(e)}},currentTransaction:{get:()=>aW.trans||null},waitFor:function(e,n){let t=aq.resolve("function"==typeof e?lP.ignoreTransaction(e):e).timeout(n||6e4);return aW.trans?aW.trans.waitFor(t):t},Promise:aq,debug:{get:()=>ae,set:e=>{ae=e,an="dexie"===e?()=>!0:sw}},derive:iR,extend:iP,props:iI,override:iG,Events:sz,on:s3,liveQuery:function(e){let n,t=!1,r=new lT(r=>{let o=i9(e),i=!1,a={},s={},l={get closed(){return i},unsubscribe:()=>{i=!0,s3.storagemutated.unsubscribe(d)}};r.start&&r.start(l);let c=!1,u=!1;function p(){return iM(s).some(e=>a[e]&&function(e,n){let t=lD(n),r=t.next();if(r.done)return!1;let o=r.value,i=lD(e),a=i.next(o.from),s=a.value;for(;!r.done&&!a.done;){if(0>=sF(s.from,o.to)&&sF(s.to,o.from)>=0)return!0;0>sF(o.from,s.from)?o=(r=t.next(s.from)).value:s=(a=i.next(o.from)).value}return!1}(a[e],s[e]))}let d=e=>{lB(a,e),p()&&f()},f=()=>{let h,m;if(c||i)return;a={};let g={},b=(o&&sr(),h=()=>st(e,{subscr:g,trans:null}),m=aW.trans?su(aW.transless,h):h(),o&&m.then(so,so),m);u||(s3(s1,d),u=!0),c=!0,Promise.resolve(b).then(e=>{t=!0,n=e,c=!1,i||(p()?f():(a={},s=g,r.next&&r.next(e)))},e=>{c=!1,t=!1,r.error&&r.error(e),l.unsubscribe()})};return f(),l});return r.hasValue=()=>t,r.getValue=()=>n,r},extendObservabilitySet:lB,getByKeyPath:iK,setByKeyPath:iY,delByKeyPath:function(e,n){"string"==typeof n?iY(e,n,void 0):"length"in n&&[].map.call(n,function(n){iY(e,n,void 0)})},shallowClone:iJ,deepClone:i2,getObjectDiff:lv,cmp:sF,asap:iq,minKey:sy,addons:[],connections:s$,errnames:ad,dependencies:i,semVer:sg,version:sg.split(".").map(e=>parseInt(e)).reduce((e,n,t)=>e+n/Math.pow(10,2*t))}),lP.maxKey=s7(lP.dependencies.IDBKeyRange),"u">typeof dispatchEvent&&"u">typeof addEventListener&&(s3(s1,e=>{if(!lN){let n;sA?(n=document.createEvent("CustomEvent")).initCustomEvent(s2,!0,!0,e):n=new CustomEvent(s2,{detail:e}),lN=!0,dispatchEvent(n),lN=!1}}),addEventListener(s2,({detail:e})=>{lN||lI(e)}));let lN=!1;if("u">typeof BroadcastChannel){let e=new BroadcastChannel(s2);"function"==typeof e.unref&&e.unref(),s3(s1,n=>{lN||e.postMessage(n)}),e.onmessage=e=>{e.data&&lI(e.data)}}else if("u">typeof self&&"u">typeof navigator){s3(s1,e=>{try{lN||("u">typeof localStorage&&localStorage.setItem(s2,JSON.stringify({trig:Math.random(),changedParts:e})),"object"==typeof self.clients&&[...self.clients.matchAll({includeUncontrolled:!0})].forEach(n=>n.postMessage({type:s2,changedParts:e})))}catch(e){}}),"u">typeof addEventListener&&addEventListener("storage",e=>{if(e.key===s2){let n=JSON.parse(e.newValue);n&&lI(n.changedParts)}});let e=self.document&&navigator.serviceWorker;e&&e.addEventListener("message",function({data:e}){e&&e.type===s2&&lI(e.changedParts)})}function lj(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}aq.rejectionMapper=function(e,n){if(!e||e instanceof al||e instanceof TypeError||e instanceof SyntaxError||!e.name||!ah[e.name])return e;var t=new ah[e.name](n||e.message,e);return"stack"in e&&ij(t,"stack",{get:function(){return this.inner.stack}}),t},an=sw;class lR extends lP{constructor(){super("EsmOffline"),lj(this,"syncQueue",void 0),lj(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 lF(){return new lR}let lL=new lR,lW={};async function lV(){let e=await oi();return e?.uuid||"*"}async function lG(e,n,t,r){let o=r&&r.id;return void 0!==o&&await lL.syncQueue.where({type:n,userId:e}).filter(e=>e?.descriptor.id===o).delete().catch(lP.errnames.DatabaseClosed),await lL.syncQueue.add({type:n,content:t,userId:e,descriptor:r||{},createdOn:new Date}).catch(lP.errnames.DatabaseClosed,()=>-1)}async function lU(e,n,t){let r=await lV();return await lG(r,e,n,t)}async function lq(e,n){return(await lH(e,n)).map(e=>e.content)}async function lH(e,n){return await lL.syncQueue.where(n?{type:n,userId:e}:{userId:e}).toArray().catch(lP.errnames.DatabaseClosed,()=>[])}async function lK(e){let n=await lV();return await lq(n,e)}async function lY(e){let n=await lV();return await lH(n,e)}async function lJ(e){return await lL.syncQueue.get(e).catch(lP.errnames.DatabaseClosed,()=>void 0)}function lZ(e){return!!lW[e]?.options.onBeginEditSyncItem}async function lX(e){let n=await lJ(e);if(!n)throw Error(`No sync item with the ID ${e} exists.`);let t=lW[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 lQ(e){await lL.syncQueue.delete(e).catch(lP.errnames.DatabaseClosed)}function l0(e,n,t,r={}){lW[e]={type:e,dependsOn:n,process:t,options:r}}L("offline-synchronization",{});let l1={};function l2(){return Object.values(l1)}function l3(e){l1[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.`),l1[e.id]=e}async function l5(e){let n=await ct();return await l4(n,e)}async function l4(e,n){let t=new lR;return await t.dynamicOfflineData.where(n?{type:n,users:e}:{users:e}).toArray().catch(lP.errnames.DatabaseClosed,()=>[])}async function l6(e,n){let t=await ct();return await l8(t,e,n)}async function l8(e,n,t){let r=new lR,o=await r.dynamicOfflineData.get({type:n,identifier:t}).catch(lP.errnames.DatabaseClosed,()=>void 0);o?o.users.includes(e)||await r.dynamicOfflineData.update(o.id,{users:[...o.users,e]}).catch(lP.errnames.DatabaseClosed):await r.dynamicOfflineData.add({users:[e],type:n,identifier:t}).catch(lP.errnames.DatabaseClosed)}async function l7(e,n){let t=await ct();return await l9(t,e,n)}async function l9(e,n,t){let r=new lR,o=await r.dynamicOfflineData.get({type:n,identifier:t,users:e}).catch(lP.errnames.DatabaseClosed,()=>void 0);o&&(o.users.length>1?await r.dynamicOfflineData.update(o.id,{users:o.users.filter(n=>n!==e)}).catch(lP.errnames.DatabaseClosed):await r.dynamicOfflineData.delete(o.id).catch(lP.errnames.DatabaseClosed))}async function ce(e,n){let t=await l5(e);await Promise.all(t.map(async e=>cn(e.type,e.identifier,n)))}async function cn(e,n,t){await l6(e,n);let r=new lR,o=await ct(),i=await r.dynamicOfflineData.get({type:e,identifier:n}).catch(lP.errnames.DatabaseClosed,()=>void 0),a=l2().filter(n=>n.type===e);if(!i)return;let s=await Promise.all(a.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:o,succeededHandlers:l,erroredHandlers:c,errors:u};i.id&&await r.dynamicOfflineData.update(i.id,{syncState:p}).catch(lP.errnames.DatabaseClosed)}async function ct(){let e=(await oi()).uuid;if(!e)throw Error("Using the dynamic offline data API requires a logged in user.");return e}let cr=L("offline-patients",{offlinePatientDataSyncState:{},handlers:{}});function co(){return cs(),cr}function ci(e,n){cs(),l3({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 ca(e){cs(),await cn("patient",e)}function cs(){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 cl(e,n,t=!0){if(e){let r=null,[o,i]=await Promise.all([r5(`${r1}/Patient/${e}`,n).catch(e=>r=e),t?cc(e):Promise.resolve(null)]);if(o.ok)return o.data;if(i)return i;if(r)throw r}return null}async function cc(e){let n=(await lK("patient-registration")).find(n=>n.fhirPatient.id===e);return n?.fhirPatient??null}function cu(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 cp=((Q={}).NEWVISIT="startVisit",Q.EDITVISIT="editVisit",Q.LOADING="loadingVisit",Q),cd=((ee={}).NOTSTARTED="notStarted",ee.ONGOING="ongoing",ee);let cf="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))",ch=function(){try{return JSON.parse(sessionStorage.getItem("openmrs:visitStoreState")||"null")}catch(e){return null}}()||{patientUuid:null,manuallySetVisitUuid:null};function cm(){return V("visit",ch)}function cg(e,n){cm().setState({patientUuid:e,manuallySetVisitUuid:n})}function cb(e,n){return r5(`${r0}/visit`,{signal:n.signal,method:"POST",headers:{"Content-type":"application/json"},body:e})}function cy(e,n,t){return r5(`${r0}/visit/${e}`,{signal:t.signal,method:"POST",headers:{"Content-type":"application/json"},body:n})}function c_(e,n,t){return r5(`${r0}/visit?patient=${e}&v=${t??cf}`,{signal:n.signal,method:"GET",headers:{"Content-type":"application/json"}})}cm().subscribe(e=>{var n;n=e,sessionStorage.setItem("openmrs:visitStoreState",JSON.stringify(n))});let cv=new er.BehaviorSubject(null);var c$=t(33789);function cA(e){return{uuid:e.uuid,display:e.display,name:e.name}}function cw(){return r4(`${r0}/visittype`).pipe((0,c$.map)(e=>e.data.results.map(cA))).pipe((0,c$.take)(1))}function ck(e){return{uuid:e.uuid,display:e.display}}function cx(e=null,n=null){let t=new URLSearchParams;e&&t.set("tag",e),n&&t.set("q",n);let r=t.toString();return r4(`${r0}/location${r?"?"+r:""}`).pipe((0,c$.map)(e=>e.data.results.map(ck))).pipe((0,c$.take)(1))}class cC{static get version(){return"1.4.0"}static toString(){return"JavaScript Expression Parser (JSEP) v"+cC.version}static addUnaryOp(e){return cC.max_unop_len=Math.max(e.length,cC.max_unop_len),cC.unary_ops[e]=1,cC}static addBinaryOp(e,n,t){return cC.max_binop_len=Math.max(e.length,cC.max_binop_len),cC.binary_ops[e]=n,t?cC.right_associative.add(e):cC.right_associative.delete(e),cC}static addIdentifierChar(e){return cC.additional_identifier_chars.add(e),cC}static addLiteral(e,n){return cC.literals[e]=n,cC}static removeUnaryOp(e){return delete cC.unary_ops[e],e.length===cC.max_unop_len&&(cC.max_unop_len=cC.getMaxKeyLen(cC.unary_ops)),cC}static removeAllUnaryOps(){return cC.unary_ops={},cC.max_unop_len=0,cC}static removeIdentifierChar(e){return cC.additional_identifier_chars.delete(e),cC}static removeBinaryOp(e){return delete cC.binary_ops[e],e.length===cC.max_binop_len&&(cC.max_binop_len=cC.getMaxKeyLen(cC.binary_ops)),cC.right_associative.delete(e),cC}static removeAllBinaryOps(){return cC.binary_ops={},cC.max_binop_len=0,cC}static removeLiteral(e){return delete cC.literals[e],cC}static removeAllLiterals(){return cC.literals={},cC}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 cC(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 cC.binary_ops[e]||0}static isIdentifierStart(e){return e>=65&&e<=90||e>=97&&e<=122||e>=128&&!cC.binary_ops[String.fromCharCode(e)]||cC.additional_identifier_chars.has(String.fromCharCode(e))}static isIdentifierPart(e){return cC.isIdentifierStart(e)||cC.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(cC.hooks[e]){let t={context:this,node:n};return cC.hooks.run(e,t),t.node}return n}searchHook(e){if(cC.hooks[e]){let n={context:this};return cC.hooks[e].find(function(e){return e.call(n.context,n),n.node}),n.node}}gobbleSpaces(){let e=this.code;for(;e===cC.SPACE_CODE||e===cC.TAB_CODE||e===cC.LF_CODE||e===cC.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:cC.COMPOUND,body:e};return this.runHook("after-all",n)}gobbleExpressions(e){let n=[],t,r;for(;this.index<this.expr.length;)if((t=this.code)===cC.SEMCOL_CODE||t===cC.COMMA_CODE)this.index++;else if(r=this.gobbleExpression())n.push(r);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,cC.max_binop_len),n=e.length;for(;n>0;){if(cC.binary_ops.hasOwnProperty(e)&&(!cC.isIdentifierStart(this.code)||this.index+e.length<this.expr.length&&!cC.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,r,o,i,a,s,l;if(!(i=this.gobbleToken())||!(n=this.gobbleBinaryOp()))return i;for(o={value:n,prec:cC.binaryPrecedence(n),right_a:cC.right_associative.has(n)},(a=this.gobbleToken())||this.throwError("Expected expression after "+n),r=[i,o,a];n=this.gobbleBinaryOp();){if(0===(t=cC.binaryPrecedence(n))){this.index-=n.length;break}o={value:n,prec:t,right_a:cC.right_associative.has(n)},l=n;let s=e=>o.right_a&&e.right_a?t>e.prec:t<=e.prec;for(;r.length>2&&s(r[r.length-2]);)a=r.pop(),n=r.pop().value,i=r.pop(),e={type:cC.BINARY_EXP,operator:n,left:i,right:a},r.push(e);(e=this.gobbleToken())||this.throwError("Expected expression after "+l),r.push(o,e)}for(s=r.length-1,e=r[s];s>1;)e={type:cC.BINARY_EXP,operator:r[s-1].value,left:r[s-2],right:e},s-=2;return e}gobbleToken(){let e,n,t,r;if(this.gobbleSpaces(),r=this.searchHook("gobble-token"))return this.runHook("after-token",r);if(e=this.code,cC.isDecimalDigit(e)||e===cC.PERIOD_CODE)return this.gobbleNumericLiteral();if(e===cC.SQUOTE_CODE||e===cC.DQUOTE_CODE)r=this.gobbleStringLiteral();else if(e===cC.OBRACK_CODE)r=this.gobbleArray();else{for(t=(n=this.expr.substr(this.index,cC.max_unop_len)).length;t>0;){if(cC.unary_ops.hasOwnProperty(n)&&(!cC.isIdentifierStart(this.code)||this.index+n.length<this.expr.length&&!cC.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:cC.UNARY_EXP,operator:n,argument:e,prefix:!0})}n=n.substr(0,--t)}cC.isIdentifierStart(e)?(r=this.gobbleIdentifier(),cC.literals.hasOwnProperty(r.name)?r={type:cC.LITERAL,value:cC.literals[r.name],raw:r.name}:r.name===cC.this_str&&(r={type:cC.THIS_EXP})):e===cC.OPAREN_CODE&&(r=this.gobbleGroup())}return r?(r=this.gobbleTokenProperty(r),this.runHook("after-token",r)):this.runHook("after-token",!1)}gobbleTokenProperty(e){this.gobbleSpaces();let n=this.code;for(;n===cC.PERIOD_CODE||n===cC.OBRACK_CODE||n===cC.OPAREN_CODE||n===cC.QUMARK_CODE;){let t;if(n===cC.QUMARK_CODE){if(this.expr.charCodeAt(this.index+1)!==cC.PERIOD_CODE)break;t=!0,this.index+=2,this.gobbleSpaces(),n=this.code}this.index++,n===cC.OBRACK_CODE?((e={type:cC.MEMBER_EXP,computed:!0,object:e,property:this.gobbleExpression()}).property||this.throwError('Unexpected "'+this.char+'"'),this.gobbleSpaces(),(n=this.code)!==cC.CBRACK_CODE&&this.throwError("Unclosed ["),this.index++):n===cC.OPAREN_CODE?e={type:cC.CALL_EXP,arguments:this.gobbleArguments(cC.CPAREN_CODE),callee:e}:(n===cC.PERIOD_CODE||t)&&(t&&this.index--,this.gobbleSpaces(),e={type:cC.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(;cC.isDecimalDigit(this.code);)e+=this.expr.charAt(this.index++);if(this.code===cC.PERIOD_CODE)for(e+=this.expr.charAt(this.index++);cC.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++));cC.isDecimalDigit(this.code);)e+=this.expr.charAt(this.index++);cC.isDecimalDigit(this.expr.charCodeAt(this.index-1))||this.throwError("Expected exponent ("+e+this.char+")")}return t=this.code,cC.isIdentifierStart(t)?this.throwError("Variable names cannot start with a number ("+e+this.char+")"):(t===cC.PERIOD_CODE||1===e.length&&e.charCodeAt(0)===cC.PERIOD_CODE)&&this.throwError("Unexpected period"),{type:cC.LITERAL,value:parseFloat(e),raw:e}}gobbleStringLiteral(){let e="",n=this.index,t=this.expr.charAt(this.index++),r=!1;for(;this.index<this.expr.length;){let n=this.expr.charAt(this.index++);if(n===t){r=!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 r||this.throwError('Unclosed quote after "'+e+'"'),{type:cC.LITERAL,value:e,raw:this.expr.substring(n,this.index)}}gobbleIdentifier(){let e=this.code,n=this.index;for(cC.isIdentifierStart(e)?this.index++:this.throwError("Unexpected "+this.char);this.index<this.expr.length;)if(e=this.code,cC.isIdentifierPart(e))this.index++;else break;return{type:cC.IDENTIFIER,name:this.expr.slice(n,this.index)}}gobbleArguments(e){let n=[],t=!1,r=0;for(;this.index<this.expr.length;){this.gobbleSpaces();let o=this.code;if(o===e){t=!0,this.index++,e===cC.CPAREN_CODE&&r&&r>=n.length&&this.throwError("Unexpected token "+String.fromCharCode(e));break}if(o===cC.COMMA_CODE){if(this.index++,++r!==n.length){if(e===cC.CPAREN_CODE)this.throwError("Unexpected token ,");else if(e===cC.CBRACK_CODE)for(let e=n.length;e<r;e++)n.push(null)}}else if(n.length!==r&&0!==r)this.throwError("Expected comma");else{let e=this.gobbleExpression();e&&e.type!==cC.COMPOUND||this.throwError("Expected comma"),n.push(e)}}return t||this.throwError("Expected "+String.fromCharCode(e)),n}gobbleGroup(){this.index++;let e=this.gobbleExpressions(cC.CPAREN_CODE);if(this.code===cC.CPAREN_CODE)return(this.index++,1===e.length)?e[0]:!!e.length&&{type:cC.SEQUENCE_EXP,expressions:e};this.throwError("Unclosed (")}gobbleArray(){return this.index++,{type:cC.ARRAY_EXP,elements:this.gobbleArguments(cC.CBRACK_CODE)}}}Object.assign(cC,{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)})}}(cC),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"}),cC.max_unop_len=cC.getMaxKeyLen(cC.unary_ops),cC.max_binop_len=cC.getMaxKeyLen(cC.binary_ops);let cE=e=>new cC(e).parse(),cD=Object.getOwnPropertyNames(class{});Object.getOwnPropertyNames(cC).filter(e=>!cD.includes(e)&&void 0===cE[e]).forEach(e=>{cE[e]=cC[e]}),cE.Jsep=cC,cE.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,r=this.gobbleExpression();if(r||this.throwError("Expected expression"),this.gobbleSpaces(),this.code===e.COLON_CODE){this.index++;let o=this.gobbleExpression();if(o||this.throwError("Expected expression"),n.node={type:"ConditionalExpression",test:t,consequent:r,alternate:o},t.operator&&e.binary_ops[t.operator]<=.9){let r=t;for(;r.right.operator&&e.binary_ops[r.right.operator]<=.9;)r=r.right;n.node.test=r.right,r.right=n.node,n.node=t}}else this.throwError("Expected :")}})}});let cS="ArrowFunctionExpression",cM={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)}},cz={...cM,Promise};function cP(e,n={}){return cj(e,n,cL)}async function cO(e,n={}){return cR(e,n,cL)}function cT(e,n={}){return cj(e,n,cW)}function cB(e,n={}){return cR(e,n,cW)}function cI(e,n={}){return cj(e,n,cV)}function cN(e,n={}){return cR(e,n,cV)}function cj(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 r=cq(n,cM),o=cG("string"==typeof e?cE(e):e,r);if(t(o))return o;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 cR(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 r=cq(n,cz);return Promise.resolve(cG("string"==typeof e?cE(e):e,r)).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 cF(e){return cE(e)}function cL(e){return"string"==typeof e||"number"==typeof e||"boolean"==typeof e||null==e||e instanceof Date}function cW(e){return"boolean"==typeof e}function cV(e){return"number"==typeof e}function cG(e,n){switch(e.type){case"UnaryExpression":var t,r,o,i,a,s,l,c,u,p,d,f,h=e,m=n;let g=cG(h.argument,m);switch(h.operator){case"+":return+g;case"-":return-g;case"~":return~g;case"!":return!g;default:throw`Expression evaluator does not support operator '${h.operator}''`}case"BinaryExpression":var b=e,y=n;let v=cG(b.left,y),$=cG(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,r=n,cG(t.test,r)?cG(t.consequent,r):cG(t.alternate,r);case"CallExpression":var A=e,w=n;let k=A.arguments?.map(cH(w)),x=cG(A.callee,w);if(x){if("function"!=typeof x)throw`${cY(A.callee)} is not a function`}else throw`No function named ${cY(A.callee)} is defined in this context`;return x(...k);case"ArrowFunctionExpression":let C;return o=e,i=n,C=o.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,r)=>{let o=e[r];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}(o)&&n.push([t,o]),n},[]));return cG(o.body,i.addVariables(n))}).bind(i.thisObj??null);case"MemberExpression":return function(e,n){let t,r=cG(e.object,n);if(void 0===r)switch(e.object.type){case"Identifier":{let t=cU(e.object,n);throw ReferenceError(`ReferenceError: ${t} is not defined`)}case"MemberExpression":{let t=cU(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 o=r;if("string"==typeof r)o=String.prototype;else if("number"==typeof r)o=Number.prototype;else if("function"==typeof r);else if("object"!=typeof r)throw`VisitMemberExpression does not support member access on type ${typeof r}`;switch(n.thisObj=o,e.property.type){case"Identifier":case"MemberExpression":t=cG(e.property,n);break;default:{let o=cG(e.property,n);if(void 0===o)throw{type:"Illegal property access",message:"No property was supplied to the property access"};cK(o),t=r[o]}}return"function"==typeof t?t.bind(r):t}(e,n);case"ArrayExpression":return a=e,s=n,a.elements?.map(cH(s));case"SequenceExpression":let E;return l=e,c=n,(E=l.expressions.map(cH(c)))[E.length-1];case"NewExpression":var D=e,S=n;if(D.callee&&"Identifier"===D.callee.type){let e=D.arguments?.map(cH(S));switch(D.callee.name){case"Date":return new Date(...e);case"RegExp":return new RegExp(...e);default:throw`Cannot instantiate object of type ${D.callee.name}`}}if(D.callee)throw"new must be called with either Date or RegExp";throw'Could not handle "new" without a specified class';case"Literal":return cK((u=e).value),u.value;case"Identifier":var M=e,z=n;cK(M.name);let P=z.thisObj;if(P&&("object"==typeof P||"function"==typeof P)&&M.name in P){let e=P[M.name];return cK(e),e}if(z.variables&&M.name in z.variables){let e=z.variables[M.name];return cK(e),e}return M.name in z.globals?z.globals[M.name]:void 0;case"TemplateLiteral":let O,T;return p=e,d=n,O=p.expressions?.map(cH(d))??[],(T=p.quasis?.map(cH(d))??[]).filter(e=>!e.tail).map(e=>e.value).join("")+O.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 cU(e,n){switch(e.type){case"Literal":return e.value;case"Identifier":return e.name;case"MemberExpression":return cU(e.property,n);default:throw`VisitExpressionName does not support expression of type '${e.type}'`}}function cq(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 cH(e){return function(n){return null===n?null:cG(n,e)}}function cK(e){if("__proto__"===e||"prototype"===e||"constructor"===e)throw{type:"Illegal property access",message:`Cannot access the ${e} property of objects`}}function cY(e){return e?"MemberExpression"===e.type?e.property?.name:e.name:null}function cJ(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:{...cz},isLocalExpression:!1,variables:new Set};return cZ("string"==typeof e?cE(e):e,n),[...n.variables]}function cZ(e,n){switch(e.type){case"UnaryExpression":return r=e,o=n,cZ(r.argument,o);case"BinaryExpression":return i=e,a=n,[cZ(i.left,a),cZ(i.right,a)].filter(Boolean);case"ConditionalExpression":return s=e,l=n,[cZ(s.consequent,l),cZ(s.test,l),cZ(s.alternate,l)].filter(Boolean);case"CallExpression":let t;return c=e,u=n,t=cZ(c.callee,u),c.arguments?.map(cX(u)),t;case"ArrowFunctionExpression":var r,o,i,a,s,l,c,u,p,d,f,h,m,g,b,y,v,$,A=e,w=n;let k={...w};k.isLocalExpression=!0;let x=A.params?.map(cX(k))??[],C=cZ(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,cZ(p.object,d),void((E={...d}).isLocalExpression=!0,cZ(p.property,E));case"ArrayExpression":return f=e,h=n,void f.elements?.map(cX(h));case"SequenceExpression":return m=e,g=n,void m.expressions?.map(cX(g));case"NewExpression":return b=e,y=n,void b.arguments?.map(cX(y));case"Literal":case"TemplateElement":return;case"Identifier":var D=e,S=n;if(!(D.name in S.globals))if(S.isLocalExpression)return D.name;else S.variables.add(D.name);return;case"TemplateLiteral":return v=e,$=n,void(v.expressions?.map(cX($)),v.quasis?.map(cX($)));default:throw`Expression evaluator does not support expression of type '${e.type}'`}}function cX(e){return function(n){return null===n?null:cZ(n,e)}}cE.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:cS,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=cS,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)})}}),cE.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 r=n.node;for(;r.type===e.MEMBER_EXP||r.type===e.CALL_EXP&&r.callee.type===e.MEMBER_EXP;)r=r.type===e.MEMBER_EXP?r.object:r.callee.object;r.type="NewExpression"}})}}),cE.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,r="",o=()=>{for(;e.isDecimalDigit(this.code)||95===this.code;)95===this.code?this.index++:r+=this.expr.charAt(this.index++)};o(),this.code===e.PERIOD_CODE&&(r+=this.expr.charAt(this.index++),o());let i=this.char;("e"===i||"E"===i)&&(r+=this.expr.charAt(this.index++),("+"===(i=this.char)||"-"===i)&&(r+=this.expr.charAt(this.index++)),o(),e.isDecimalDigit(this.expr.charCodeAt(this.index-1))||this.throwError("Expected exponent ("+r+this.char+")"));let a=this.code;if(e.isIdentifierStart(a))this.throwError("Variable names cannot start with a number ("+r+this.char+")");else if(a===e.PERIOD_CODE){r.length>1&&this.throwError(`Unexpected period ${JSON.stringify({chCode:a,number:r},null,2)}`),this.index=t;return}n.node={type:e.LITERAL,value:parseFloat(r),raw:this.expr.substring(t,this.index)}}e.hooks.add("gobble-token",function(r){if(48===this.code){var o,i,a;let s=this.index,l=this.expr.charAt(this.index+1),c=n.call(this,l);if(!c)return;let u="";for(;o=this.code,i=c,95===o||i.some(([e,n])=>o>=e&&o<=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,r);return}this.throwError("unexpected char within number")}r.node={type:e.LITERAL,value:parseInt(u,"x"===(a=l)||"X"===a?16:"b"===a||"B"===a?2:8),raw:this.expr.substring(s,this.index)}}else(e.isDecimalDigit(this.code)||this.code===e.PERIOD_CODE)&&t.call(this,r)})}}),cE.plugins.register({name:"regex",init(e){e.hooks.add("gobble-token",function(n){if(47===this.code){let t=++this.index,r=!1;for(;this.index<this.expr.length;){if(47===this.code&&!r){let r,o=this.expr.slice(t,this.index),i="";for(;++this.index<this.expr.length;){let e=this.code;if(e>=97&&e<=122||e>=65&&e<=90||e>=48&&e<=57)i+=this.char;else break}try{r=new RegExp(o,i)}catch(e){this.throwError(e.message)}return n.node={type:e.LITERAL,value:r,raw:this.expr.slice(t-1,this.index)},n.node=this.gobbleTokenProperty(n.node),n.node}this.code===e.OBRACK_CODE?r=!0:r&&this.code===e.CBRACK_CODE&&(r=!1),this.index+=92===this.code?2:1}this.throwError("Unclosed Regex")}})}}),cE.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,r=this.gobbleExpression();if(r||this.throwError("Expected expression"),this.gobbleSpaces(),this.code===e.COLON_CODE){this.index++;let o=this.gobbleExpression();if(o||this.throwError("Expected expression"),n.node={type:"ConditionalExpression",test:t,consequent:r,alternate:o},t.operator&&e.binary_ops[t.operator]<=.9){let r=t;for(;r.right.operator&&e.binary_ops[r.right.operator]<=.9;)r=r.right;n.node.test=r.right,r.right=n.node,n.node=t}}else this.throwError("Expected :")}})}}),cE.plugins.register({name:"jsepTemplateLiteral",init(e){function n(e,t=!0){if(96===this.code){let n={type:"TemplateLiteral",quasis:[],expressions:[]},r="",o="",i=!1,a=this.expr.length,s=()=>n.quasis.push({type:"TemplateElement",value:{raw:o,cooked:r},tail:i});for(;this.index<a;){let a=this.expr.charAt(++this.index);if("`"===a)return this.index+=1,i=!0,s(),e.node=n,t&&(e.node=this.gobbleTokenProperty(e.node)),e.node;if("$"===a&&"{"===this.expr.charAt(this.index+1))this.index+=2,s(),o="",r="",n.expressions.push(...this.gobbleExpressions(125)),125!==this.code&&this.throwError("unclosed ${");else if("\\"===a)switch(o+=a,a=this.expr.charAt(++this.index),o+=a,a){case"n":r+="\n";break;case"r":r+="\r";break;case"t":r+=" ";break;case"b":r+="\b";break;case"f":r+="\f";break;case"v":r+="\v";break;default:r+=a}else r+=a,o+=a}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})}}),cE.addBinaryOp("in",7),cE.addBinaryOp("??",1);let cQ=V("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:",""),r=JSON.parse(localStorage.getItem(`openmrs:feature-flag-meta:${t}`)||"{}");e[t]={enabled:"true"===localStorage.getItem(n),...r}}return e}()});function c0(e,n,t){cQ.setState(r=>({flags:{...r.flags,[e]:{enabled:r.flags[e]?.enabled??!1,label:n,description:t}}}))}function c1(e){return cQ.getState().flags[e].enabled}function c2(e){return!window.offlineEnabled||(e??navigator.onLine)}cQ.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 c3=eV(function(e,n,t){eP(e,n,t)});function c5(e,n=!0,t=!1){return!!(e?n:t)}let c4=L("extensionsInternal",{slots:{},extensions:{}}),c6=L("extensionRenderings",{renderings:new Map}),c8=()=>V("extensionsInternal",{slots:{},extensions:{}});function c7(e){let n=c4.getState(),t=e(n);t!==n&&c4.setState(t)}let c9=null,ue=null;function un(){let e=c6.getState();return c9&&e===ue||(c9=new Map(e.renderings),ue=e,function(e){for(let n of(ui.clear(),e.values()))us(n,1);ua=!0}(c9)),c9}function ut(e){ue={renderings:e},c6.setState(ue,!0)}let ur=()=>V("extensions",{slots:{}});function uo(e){try{e()}catch(n){console.error(`The extension system's '${e.name}' recomputation failed`,n)}}let ui=new Map,ua=!1;function us(e,n){let t=JSON.stringify([e.slotName,e.extensionId,e.slotModuleName,e.extensionModuleName]),r=ui.get(t);if(!r){if(n<0)return;ui.set(t,{count:1,record:{slotModuleName:e.slotModuleName,extensionModuleName:e.extensionModuleName,slotName:e.slotName,extensionId:e.extensionId}}),ua=!0;return}r.count+=n,r.count<1&&(ui.delete(t),ua=!0)}function ul(){var e,n;if(un(),!ua)return;ua=!1;let t=Array.from(ui.values(),({record:e})=>e);t.sort(uc),e=nB.getState().mountedExtensions,n=t,e.length===n.length&&e.every((e,t)=>0===uc(e,n[t]))||nB.setState({mountedExtensions:t})}function uc(e,n){return uu(e.slotName,n.slotName)||uu(e.extensionId,n.extensionId)||uu(e.slotModuleName,n.slotModuleName)||uu(e.extensionModuleName,n.extensionModuleName)}function uu(e,n){return e===n?0:e<n?-1:1}ul(),c6.subscribe(()=>uo(ul));let up=c8(),ud=ur(),uf=nN(),uh=nj(),um=new Set,ug=!1;function ub(e){if(null===e)um=null;else if(null!==um)for(let n of e)um.add(n);uo(uy)}function uy(){if(!ug){ug=!0;try{for(let e=1;;e++){let n=um;if(null!==n&&0===n.size)return;um=new Set;try{!function(e,n,t,r,o,i=null){let a=ud.getState().slots,s={},l=!1,c=c2(),u=Object.entries(r.flags).filter(([,{enabled:e}])=>e).map(([e])=>e);for(let[r,d]of Object.entries(e.slots)){var p;let f=a[r];if(f&&i&&!i.has(r)){s[r]=f;continue}let{config:h}=(p=d.name,n.slots[p]??{loaded:!1,config:{}}),m=function(e,n,t,r,o,i,a){let s=function(e,n){let t=e.add||[],r=e.remove||[],o=e.order||[],{extensions:i}=up.getState();return[...n,...t].filter(e=>!r.includes(e)).sort((e,t)=>uD(e,o,i[uA(e)]?.order,n)-uD(t,o,i[uA(t)]?.order,n))}(t,n.slots[e].attachedIds),l=[];for(let c of s){let{config:s}=nR(r,e,c),u=t.configure?.[c]??null,p=u?c3({},s,u):s,d=uA(c),f=n.extensions[d];if(f){let e=p?.["Display conditions"]?.privileges??f.privileges??[];if(e&&("string"==typeof e||Array.isArray(e)&&e.length>0)&&(!a?.user||!oo(e,a.user))||f.featureFlag&&!o.includes(f.featureFlag)||window.offlineEnabled&&!c5(i,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,displayConditionExpression:p?.["Display conditions"]?.expression||f.displayExpression})}}return l}(r,e,h,t,u,c,o.session);f&&f.moduleName===d.moduleName&&nn(f.candidateExtensions,m)?s[r]=f:(s[r]={moduleName:d.moduleName,candidateExtensions:m},l=!0)}(l||Object.keys(a).length!==Object.keys(s).length)&&ud.setState({slots:s})}(up.getState(),uf.getState(),uh.getState(),cQ.getState(),r8.getState(),n)}catch(e){throw um=null===n||null===um?null:new Set([...n,...um]),e}if(e>=20)return void console.error("The extension system stopped recomputing after 20 passes because something keeps invalidating slots in response to the extension store being written. Some slots are left stale until the next write.")}}finally{ug=!1}}}function u_(e,n){let t=new Set;for(let r of Object.keys(e))e[r]!==n[r]&&t.add(r);for(let r of Object.keys(n))r in e||t.add(r);return t}function uv(){ub(null)}function u$(e,n){return{moduleName:n,name:e,attachedIds:[]}}function uA(e){let[n]=e.split("#");return n}function uw(e){var n;let t;return n=up.getState(),t=uA(e),n.extensions[t]}up.subscribe((e,n)=>{ub(e.extensions!==n.extensions?null:u_(e.slots,n.slots))}),uf.subscribe((e,n)=>{ub(u_(e.slots,n.slots))}),uh.subscribe((e,n)=>{ub(u_(e.configs,n.configs))}),cQ.subscribe(()=>ub(null)),r8.subscribe(()=>ub(null)),uv(),b(uv);let uk=e=>c7(n=>({...n,extensions:{...n.extensions,[e.name]:{...e}}}));function ux(e,n){c7(t=>{let r=t.slots[e];return r?{...t,slots:{...t.slots,[e]:{...r,attachedIds:[...r.attachedIds,n]}}}:{...t,slots:{...t.slots,[e]:{...u$(e),attachedIds:[n]}}}})}function uC(e,n){c7(t=>{let r=t.slots[e];return r&&r.attachedIds.includes(n)?{...t,slots:{...t.slots,[e]:{...r,attachedIds:r.attachedIds.filter(e=>e!==n)}}}:t})}function uE(e){c7(n=>{let t=n.slots[e];return t?{...n,slots:{...n.slots,[e]:{...t,attachedIds:[]}}}:n})}function uD(e,n,t,r){let o=n.indexOf(e);if(-1!==o)return o;{if(void 0!==t)return 1e3+t;let n=r.indexOf(e);return -1!==n?2e3+n:3e3}}function uS(e,n){var t;return function(e,n,t=null,r){let o;return e.filter(e=>{let i=e.displayConditionExpression;if("string"!=typeof i||0===i.trim().length)return!0;o??(o=n&&"object"==typeof n?{session:t,...n}:{session:t});try{return!!cT(i,o)}catch(n){return console.error(`Error while evaluating expression '${i}' for ${e.id}`+(r?` in ${r}`:""),n),!1}})}((t=e,ud.getState().slots[t]?.candidateExtensions??[]),n,r8.getState().session,e)}let uM=(e,n)=>up.setState(t=>{let r=t.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}.`),t;if(r&&r==e)return t;if(t.slots[n])return{...t,slots:{...t.slots,[n]:{...t.slots[n],moduleName:e}}};let o=u$(n,e);return{...t,slots:{...t.slots,[n]:{...o}}}}),uz=L("left-nav",{slotName:null,basePath:window.spaBase,mode:"normal"});function uP({name:e,basePath:n,mode:t,componentContext:r,state:o}){uz.setState({slotName:e,basePath:n,mode:t??"normal",componentContext:r,state:o})}function uO(e){uz.getState().slotName===e&&uz.setState(uz.getInitialState(),!0)}let uT=0,uB=null,uI={bootstrap:{millis:15e3,dieOnTimeout:!0},mount:{millis:15e3,dieOnTimeout:!0},unmount:{millis:15e3,dieOnTimeout:!0}};async function uN(e,n){return(await (uB??(uB=new Promise((e,n)=>{t8({name:"openmrs-extension-host",bootstrap:()=>Promise.resolve(),mount:n=>(e(n.mountParcel),Promise.resolve()),unmount:()=>Promise.resolve()},{domElement:document.createElement("div")}).mountPromise.catch(n)}).catch(e=>(console.error("The host parcel used to mount extensions could not be mounted. Falling back to mounting extensions as root parcels, which leaks their DOM elements.",e),t8))),uB))("function"==typeof e?()=>e().then(e=>({timeouts:uI,...e})):{timeouts:uI,...e},n)}function uj(e,n){let t,r=uN(e,n).then(e=>t=e);return{mount:()=>r.then(e=>e.mount()),unmount:()=>r.then(e=>e.unmount()),update:e=>r.then(n=>n.update?.(e)),getStatus:()=>t?.getStatus()??"LOADING_SOURCE_CODE",get loadPromise(){return r.then(e=>e.loadPromise)},get bootstrapPromise(){return r.then(e=>e.bootstrapPromise)},get mountPromise(){return r.then(e=>e.mountPromise)},get unmountPromise(){return r.then(e=>e.unmountPromise)}}}async function uR(e,n,t,r,o=e=>e,i={}){let a=uA(r),s=uw(r),l=null;if(e){if(!s)throw Error(`Couldn't find extension '${a}' to attach to '${n}'`);let{meta:u,moduleName:p,online:d,offline:f,load:h}=s;if(function(e=!0,n=!1){return c5(c2(),e,n)}(d,f)){let s,d=uT++,f=`${n}/${r}-${d}`;e.dataset.extensionRenderingId=f;let m=e=>{try{let e,n;(n=(e=un()).get(f))&&(e.delete(f),us(n,-1),ut(e))}catch(n){console.error(e,n)}};try{var c;let e;c={renderingId:f,extensionName:a,extensionModuleName:p,extensionId:r,slotName:n,slotModuleName:t},(e=un()).has(c.renderingId)||(e.set(c.renderingId,c),us(c,1),ut(e))}catch(e){throw m(`Recomputing configuration after registering '${r}' failed also failed`),e}try{s=await h()}catch(e){throw m(`Recomputing configuration after '${r}' failed to load also failed`),e}try{l=await uN(o({...s,name:`${n}/${a}-${d}`}),{...i,_meta:u,_extensionContext:{extensionId:r,extensionSlotName:n,extensionSlotModuleName:t,extensionModuleName:p},domElement:e})}catch(e){throw m(`Recomputing configuration after '${r}' failed to mount also failed`),e}l.mountPromise.then(void 0,e=>{console.error(`Extension '${r}' in slot '${n}' failed to mount`,e),m(`Recomputing configuration after '${r}' failed to mount also failed`)}),l.unmountPromise.then(()=>m(`Recomputing configuration after unmounting '${r}' failed`),e=>{console.error(`Extension '${r}' in slot '${n}' failed to unmount`,e),m(`Recomputing configuration after '${r}' failed to unmount also failed`)})}}else console.warn(`Tried to render ${r} into ${n} but no DOM element was available.`);return l}function uF(){return{current:"unavailable",notAvailable:!0,active:!1}}let uL="x-omrs-offline-response-body",uW="x-omrs-offline-response-status",uV="x-omrs-offline-caching-strategy",uG="u">typeof crypto&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),uU=new Uint8Array(16),uq=[];for(let e=0;e<256;++e)uq.push((e+256).toString(16).slice(1));let uH=function(e,n,t){if(uG&&!n&&!e)return uG();let r=(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(uU)})();if(r[6]=15&r[6]|64,r[8]=63&r[8]|128,n){t=t||0;for(let e=0;e<16;++e)n[t+e]=r[e];return n}return function(e,n=0){return uq[e[n+0]]+uq[e[n+1]]+uq[e[n+2]]+uq[e[n+3]]+"-"+uq[e[n+4]]+uq[e[n+5]]+"-"+uq[e[n+6]]+uq[e[n+7]]+"-"+uq[e[n+8]]+uq[e[n+9]]+"-"+uq[e[n+10]]+uq[e[n+11]]+uq[e[n+12]]+uq[e[n+13]]+uq[e[n+14]]+uq[e[n+15]]}(r)},uK="OFFLINE+";function uY(){return uK+uH()}function uJ(e){return e.startsWith(uK)}var uZ=t(47499),uX=t.n(uZ);function uQ({to:e,templateParams:n,onBeforeNavigate:t,children:r,...o}){return(0,uZ.useEffect)(()=>{o.href&&console.warn(`ConfigurableLink does not support the href prop. Use the 'to' prop instead. The provided href value is '${o.href}'`),o.onClick&&console.warn(`ConfigurableLink does not support the onClick prop. Use the 'onBeforeNavigate' prop instead. The 'to' prop of the offending link is ${e}`)},[]),uX().createElement("a",{onClick:r=>{0===r.button&&!r.ctrlKey&&!r.shiftKey&&!r.altKey&&!r.metaKey&&(r.preventDefault(),t?.(r),rY({to:e,templateParams:n})),0===r.button&&(r.ctrlKey||r.metaKey)&&t?.(r),0===r.button&&r.shiftKey&&t?.(r),1===r.button&&t?.(r)},href:rH(e,n),...o},r)}let u0=L("modalRegistry",{modals:{}}),u1=L("workspaceRegistrations",{workspaces:{}}),u2=L("workspaceGroups",{workspaceGroups:{}}),u3=new Set;function u5(e){let n=u1.getState().workspaces;if(n[e])return n[e];{let n=uw(e);if(n){var t;let r;return u3.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.`),u3.add(e)),{name:n.name,title:(t=n,"string"==typeof(r=t?.meta?.title)?r:r&&"object"==typeof r?ie(t.moduleName,r.key,r.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.`)}}let u4=L("workspace2",{registeredGroupsByName:{},registeredWindowsByName:{},registeredWorkspacesByName:{},openedGroup:null,openedWindows:[],workspaceTitleByWorkspaceName:{},isMostRecentlyOpenedWindowHidden:!1});function u6(e){let{openedWindows:n}=u4.getState();return n.findIndex(n=>n.openedWorkspaces.find(n=>n.workspaceName===e))}let u8=(0,uZ.createContext)({moduleName:"",featureName:""});function u7(e,n){"function"==typeof n&&(n=n(e));let t={};for(let[r,o]of Object.entries(n)){let n=function(...n){e.setState(e=>o(e,...n))};t[r]=n}return t}let u9=e=>e;function pe(e,n=u9,t){let r=(0,uZ.useCallback)(n=>e.subscribe(n),[e]),o=(0,uZ.useCallback)(()=>n(e.getState()),[e,n]),i=(0,uZ.useSyncExternalStore)(r,o,o),a=(0,uZ.useMemo)(()=>t?u7(e,t):null,[e,t]);return(0,uZ.useMemo)(()=>a?{...i,...a}:i,[i,a])}function pn(e,n){return pe(e,u9,n)}function pt(e){return function(n){let t=(0,uZ.useCallback)(n=>e.subscribe(n),[]),r=(0,uZ.useCallback)(()=>e.getState(),[]),o=(0,uZ.useSyncExternalStore)(t,r,r),i=(0,uZ.useMemo)(()=>n?u7(e,n):null,[n]);return(0,uZ.useMemo)(()=>i?{...o,...i}:o,[o,i])}}let pr=[];Object.freeze(pr);let po={candidateExtensions:pr};Object.freeze(po);let pi=e=>{let n=(0,uZ.useCallback)(n=>n.slots?.[e]??po,[e]);return pe(ur(),n)},pa=e=>e.session;function ps(e,n){let t,{candidateExtensions:r}=pi(e),o=pe(r8,pa),i=(T((t=(0,uZ.useRef)(n)).current,n)||(t.current=n),t.current);return(0,uZ.useMemo)(()=>uS(e,i),[e,i,o,r])}function pl(e,n){let{moduleName:t}=(0,uZ.useContext)(u8);if(!t)throw Error("ComponentContext has not been provided. This should come from @openmrs/esm-react-utils.");return(0,uZ.useEffect)(()=>{uM(t,e)},[t,e]),{extensions:ps(e,n),extensionSlotName:e,extensionSlotModuleName:t}}function pc(e){return e}function pu({name:e,extensionSlotName:n,select:t=pc,children:r,state:o,style:i,...a}){if(r&&o)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,uZ.useRef)(null),{extensions:c,extensionSlotModuleName:u}=pl(s,o),p=(0,uZ.useMemo)(()=>t(c),[t,c]),d=(0,uZ.useMemo)(()=>{if("function"==typeof r&&!uX().isValidElement(r))return p.map(e=>r(e,o))},[r,p]);return uX().createElement("div",{ref:l,"data-extension-slot-name":s,"data-extension-slot-module-name":u,style:{...i,position:"relative"},...a},s&&p?.map((e,n)=>uX().createElement(u8.Provider,{key:e.id,value:{moduleName:u,featureName:"",extension:{extensionId:e.id,extensionSlotName:s,extensionSlotModuleName:u}}},d?.[n]??("function"!=typeof r?r:null)??uX().createElement(dj,{state:o}))))}var pp=t(5338);function pd(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n&&(r=r.filter(function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable})),t.push.apply(t,r)}return t}function pf(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?pd(Object(t),!0).forEach(function(n){var r,o,i;r=e,o=n,i=t[n],o in r?Object.defineProperty(r,o,{value:i,enumerable:!0,configurable:!0,writable:!0}):r[o]=i}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):pd(Object(t)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))})}return e}function ph(e){return(ph="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 pm(e){return(pm="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 pg(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(pm(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(pm(e)));return e}}var pb=null;try{pb=require("react").createContext()}catch(e){}var py={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 p_(e,n){return e.rootComponent?Promise.resolve():e.loadRootComponent(n).then(function(n){e.rootComponent=n})}function pv(e,n){return new Promise(function(t,r){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 o,i=pk(e,n,function(){t(this)}),a=pg(e,n)(),s=function(e){var n=e.reactDom,t=e.renderType,r=e.elementToRender,o=e.domElement,i=n[t];if("function"!=typeof i)throw Error('renderType "'.concat(t,'" did not return a function.'));switch(t){case"createRoot":case"unstable_createRoot":case"createBlockingRoot":case"unstable_createBlockingRoot":var a=i(o);return a.render(r),a;case"hydrateRoot":return i(o,r);default:return i(r,o),null}}({elementToRender:i,domElement:a,reactDom:pw(e),renderType:"function"==typeof(o=e).renderType?o.renderType():o.renderType});e.domElements[n.name]=a,e.renderResults[n.name]=s})}function p$(e,n){return new Promise(function(t){e.unmountResolves[n.name]=t;var r=e.renderResults[n.name];r&&r.unmount?r.unmount():pw(e).unmountComponentAtNode(e.domElements[n.name]),delete e.domElements[n.name],delete e.renderResults[n.name]})}function pA(e,n){return new Promise(function(t){e.updateResolves[n.name]||(e.updateResolves[n.name]=[]),e.updateResolves[n.name].push(t);var r=pk(e,n,null),o=e.renderResults[n.name];if(o&&o.render)o.render(r);else{var i=pg(e,n)();pw(e).render(r,i)}})}function pw(e){return e.ReactDOMClient||e.ReactDOM}function pk(e,n,t){var r=e.React.createElement(e.rootComponent,n),o=pb?e.React.createElement(pb.Provider,{value:n},r):r;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),o=e.React.createElement(e.errorBoundaryClass,n,o)),o=e.React.createElement(e.SingleSpaRoot,pf(pf({},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])}}),o)}var px=t(58779),pC=t(59324),pE=t(14993);let pD={strictMode:!0,throwErrorsToConsole:!0,disableTranslations:!1},pS=new Map;(0,pE.r2)(pS);let pM={errorRetryCount:3,fetcher:r5,focusThrottleInterval:18e5,revalidateIfStale:!0,revalidateOnFocus:!1,revalidateOnReconnect:!1,refreshInterval:0,shouldRetryOnError:e=>{if(e instanceof r6){let n=e.response.status;return!!(n>=500)||401===n||403===n||429===n}return!0},provider:()=>pS};function pz(e,n){return function(e){if("object"!==ph(e))throw Error("single-spa-react requires a configuration object");var n,t=pf(pf({},py),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");!pb&&t.React.createContext&&(pb=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 r={bootstrap:p_.bind(null,t),mount:pv.bind(null,t),unmount:p$.bind(null,t)};return t.parcelCanUpdate&&(r.update=pA.bind(null,t)),r}({React:uX(),ReactDOMClient:pp,rootComponent:(function(e){if("object"!=typeof e||"string"!=typeof e.featureName||"string"!=typeof e.moduleName)throw Error("Invalid options");let n=Object.assign({},pD,e),t={...pM,...n.swrConfig};return function(e){var r,o,i,a,s;return i=o=class extends(r=uX().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 uX().createElement("div",null,"An error has occurred. Please try reloading the page.");{let r=uX().createElement(uZ.Suspense,{fallback:null},uX().createElement(pC.BE,{value:t},uX().createElement(u8.Provider,{value:this.state.config},n.disableTranslations?uX().createElement(e,this.props):uX().createElement(px.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},uX().createElement(e,this.props)))));return n.strictMode&&uX().StrictMode?uX().createElement(uX().StrictMode,null,r):r}}constructor(e){super(e),this.state={caughtError:null,caughtErrorInfo:null,config:{moduleName:n.moduleName,featureName:n.featureName,extension:e._extensionContext}}}},a="displayName",s=`OpenmrsReactComponent(${n.featureName})`,a in i?Object.defineProperty(i,a,{value:s,enumerable:!0,configurable:!0,writable:!0}):i[a]=s,o}})(n)(e)})}function pP(e,n){return()=>e().then(({default:e})=>pz(e,n))}function pO(e,n){return()=>Promise.resolve(pz(e,n))}let pT=pP,pB=new Map;function pI(e,n){let t=(0,uZ.useRef)(n??{}),r=(0,uZ.useRef)(n=>ob(e,n)),o=(0,uZ.useRef)(Symbol());return(0,uZ.useEffect)(()=>{let t=n??{},r=o.current;return null===og(e)?oh(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.`),ob(e,()=>t)),pB.set(e,r),()=>{pB.get(e)===r&&(om(e),pB.delete(e))}},[e]),(0,uZ.useEffect)(()=>{let r=n??{};T(t.current,r)||(ob(e,()=>r),t.current=r)},[n]),r.current}function pN({namespace:e,value:n}){return pI(e,n),null}let pj=({children:e,value:n,fallback:t})=>n?uX().createElement(uX().Fragment,null,e):t?uX().createElement(uX().Fragment,null,t):null;function pR(){let e=(0,uZ.useRef)();return(!e.current||e.current.signal.aborted)&&(e.current=new AbortController),(0,uZ.useEffect)(()=>{let n=e.current;return()=>n?.abort()},[]),e.current}function pF(e,n=e=>e??{}){let[t,r]=(0,uZ.useState)(()=>{if(pL(e))return;let t=og(e);if(null!==t)return n?n(t):t});return(0,uZ.useEffect)(()=>{if(pL(e))throw Error(`The namespace supplied to useAppContext must be a non-empty string, but was "${e}".`)},[e]),(0,uZ.useEffect)(()=>oy(e,e=>{if(null==e)return void r(void 0);let t=n?n(e):e;r(e=>T(e,t)?e:t)}),[e,n]),t}function pL(e){return"string"!=typeof e||0===e.trim().length}function pW(e){let n=ps(e);return(0,uZ.useMemo)(()=>n.map(e=>e.id),[n])}function pV(e,n){let{data:t,error:r,mutate:o,isLoading:i,isValidating:a}=(0,pC.Ay)(`${id}?patient=${e}&includeEncounterless=${n}`,r5);return(0,uZ.useMemo)(()=>({isLoading:i,data:t?.data.results??[],error:r,mutate:o,isValidating:a}),[t,r,i,a,o])}function pG(e){(0,uZ.useEffect)(()=>{if(e){let e=window.getComputedStyle(document.body).overflow;return document.body.style.overflow="hidden",()=>{document.body.style.overflow=e}}},[e])}let pU={},pq=`No ComponentContext has been provided. This should come from "openmrsComponentDecorator".
15
+ ${this.stack}`}}let r8=L("session",{loaded:!1,session:null}),r7=0;function r9(e={includeAuthStatus:!0}){return(r7<Date.now()-6e4||!r8.getState().loaded)&&ot(),new er.Observable(n=>{let t=t=>{t.loaded&&(e.includeAuthStatus?n.next(t.session):n.next(t.session?.user))};return t(r8.getState()),r8.subscribe(t)})}function oe(){return(r7<Date.now()-6e4||!r8.getState().loaded)&&ot(),r8}function on(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 ot(e,n){r7=Date.now();let t={};return e&&n&&(t.Authorization=`Basic ${window.btoa(`${e}:${n}`)}`),oc(r5(r2,{headers:t}))}function or(){r8.setState({loaded:!0,session:{authenticated:!1,sessionId:""}})}function oo(e,n){var t,r;if(void 0===n)return!e;if(!e)return!0;return t=e,r=n,("string"==typeof t?!q(r.privileges.find(e=>t===e.display)):Array.isArray(t)?t.every(e=>!q(r.privileges.find(n=>e===n.display))):(q(t)||console.error(`Could not understand privileges "${t}"`),!0))||!q(n.roles.find(e=>"System Developer"===e.display))}function oi(){let e,n;return new Promise(t=>{let r=r=>{r.loaded&&r.session.user&&(e=r.session.user,t(r.session.user),n&&n())};r(r8.getState()),e||(n=r8.subscribe(r))})}function oa(){return new Promise((e,n)=>{r9().subscribe(n=>{e(n.sessionLocation)},n).unsubscribe()})}async function os(e,n){return oc(r5(r2,{method:"POST",body:{sessionLocation:e},headers:{"Content-Type":"application/json"},signal:n.signal}))}async function ol(e,n,t){return t||(t=new AbortController),await r5(`${r0}/user/${e}`,{method:"POST",body:{userProperties:n},headers:{"Content-Type":"application/json"},signal:t.signal}),ot()}function oc(e){return new Promise((n,t)=>{e.then(e=>{let r;"object"==typeof e?.data?(r={loaded:!0,session:e.data},r8.setState(r),n(r)):(r={loaded:!1,session:null},r8.setState(r),t(r))}).catch(e=>{z(`Failed to fetch new session information: ${e}`);let n={loaded:!1,session:null};r8.setState(n),t(n)})})}function ou(){return"development"===window.spaEnv||"true"===localStorage.getItem("openmrs:devtools")}r8.subscribe(e=>{e.loaded&&e.session&&on(e.session)});let op={"webservices.rest":"2.24.0",fhir2:"1.0.0-SNAPSHOT"},od=j()(()=>({}));W("openmrs-app-context",od);let of={};function oh(e,n=of){od.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===of?{}:n})})}function om(e){od.setState(n=>(e in n&&delete n[e],n))}function og(e,n=e=>e){let t=od.getState();return e in t?Object.freeze(Object.assign({},n?n(t[e]):t[e])):null}function ob(e,n){od.setState(t=>(e in t||(t[e]={}),t[e]=n(t[e]),Object.assign({},t)))}function oy(e,n){let t=og(e);return n(o_(t)),od.subscribe(r=>{let o=e in r?r[e]:null;o!==t&&(t=o,n(o_(o)))})}function o_(e){return null===e?null:Object.freeze(Object.assign({},e))}let ov={address1:"Address line 1",address2:"Address line 2",address3:"Address line 3",address4:"Address line 4",address5:"Address line 5",address6:"Address line 6",city:"City",cityVillage:"City",country:"Country",countyDistrict:"District",district:"District",postalCode:"Postal code",state:"State",stateProvince:"State",closeAllOpenedWorkspaces:"Discard changes in {{count}} workspaces",closingAllWorkspacesPromptBody:"There may be unsaved changes in the following workspaces. Do you want to discard changes in the following workspaces? {{workspaceNames}}",closingAllWorkspacesPromptTitle:"You have unsaved changes",discard:"Discard",hide:"Hide",maximize:"Maximize",minimize:"Minimize",openAnyway:"Open anyway",unsavedChangesInOpenedWorkspace:"You may have unsaved changes in the opened workspace. Do you want to discard these changes?",unsavedChangesInWorkspace:'There may be unsaved changes in "{{workspaceName}}". Please save them before opening another workspace.',unsavedChangesTitleText:"Unsaved changes",workspaceHeader:"Workspace header",discardUnsavedChangesPromptBodyMultiple:"{{count}} workspaces have unsaved changes. Closing them will discard the changes:",discardUnsavedChangesPromptBodySingle:"<strong>{{workspaceTitle}}</strong> has unsaved changes. Closing it will discard them.",discardUnsavedChangesPromptTitle:"Discard unsaved changes?",keepEditing:"Keep editing",abnormalValue:"Abnormal value",actions:"Actions",actionableNotification:"Actionable notification",address:"Address",age:"Age",batchActionItemSelected:"{{totalSelected}} item selected",batchActionsItemsSelected:"{{totalSelected}} items selected",cancel:"Cancel",change:"Change",Clinic:"Clinic",close:"Close",closesActionableNotification:"Close actionable notification",closeSnackbar:"Close snackbar",confirm:"Confirm",contactAdministratorIfIssuePersists:"Contact your system administrator if the problem persists.",contactDetails:"Contact details",delete:"Delete",discardChanges:"Discard changes",edit:"Edit",emptyStateText:"There are no {{displayText}} to display",error:"Error",errorCopy:"Sorry, there was a problem displaying this information. You can try to reload this page, or contact the site administrator and quote the error code above.",errorLoadingLoginLocations:"Unable to load login locations. Please try again or contact support if the problem persists.",female:"Female",leftNavigation:"Left navigation",loading:"Loading",localVersion:"Local Build",male:"Male",noResultsToDisplay:"No results to display",notAvailable:"Not available",other:"Other",paginationItemsCount:"{{pageItemsCount}} / {{totalItems}} items",paginationOfPages:"of {{count}} pages",patientAvatarAlt:"Avatar for {{patientName}}",patientIdentifierSticker:"Patient identifier sticker",patientLists:"Patient lists",patientPhotoAlt:"Profile photo of {{patientName}}",patientPhotoPlaceholder:"Photo placeholder for {{patientName}}",prereleaseVersion:"Prerelease",print:"Print",printError:"Print error",printErrorExplainer:"An error occurred in {{errorLocation}}",printIdentifierSticker:"Print identifier sticker",printing:"Printing",recordNewEntry:"Record {{displayText}}",relationships:"Relationships",resetOverrides:"Reset overrides",save:"Save",scriptLoadingFailed:"Error: Script failed to load",scriptLoadingError:"Failed to load overridden script from {{url}}. Please check that the bundled script is available at the expected URL. Click the button below to reset all import map overrides.",searchForLocation:"Search for a location",seeAll:"See all",seeMoreLists:"See {{count}} more lists",selectAll:"Select all",sex:"Sex",showLess:"Show less",showMore:"Show more",snackbarNotification:"Snackbar notification",toggleDevTools:"Toggle dev tools",unknown:"Unknown",yearAbbreviation:"yr",yearsAbbreviation:"yrs"},o$=e=>"string"==typeof e,oA=()=>{let e,n,t=new Promise((t,r)=>{e=t,n=r});return t.resolve=e,t.reject=n,t},ow=e=>null==e?"":""+e,ok=/###/g,ox=e=>e&&e.indexOf("###")>-1?e.replace(ok,"."):e,oC=e=>!e||o$(e),oE=(e,n,t)=>{let r=o$(n)?n.split("."):n,o=0;for(;o<r.length-1;){if(oC(e))return{};let n=ox(r[o]);!e[n]&&t&&(e[n]=new t),e=Object.prototype.hasOwnProperty.call(e,n)?e[n]:{},++o}return oC(e)?{}:{obj:e,k:ox(r[o])}},oD=(e,n,t)=>{let{obj:r,k:o}=oE(e,n,Object);if(void 0!==r||1===n.length){r[o]=t;return}let i=n[n.length-1],a=n.slice(0,n.length-1),s=oE(e,a,Object);for(;void 0===s.obj&&a.length;)i=`${a[a.length-1]}.${i}`,s=oE(e,a=a.slice(0,a.length-1),Object),s?.obj&&void 0!==s.obj[`${s.k}.${i}`]&&(s.obj=void 0);s.obj[`${s.k}.${i}`]=t},oS=(e,n)=>{let{obj:t,k:r}=oE(e,n);if(t&&Object.prototype.hasOwnProperty.call(t,r))return t[r]},oM=(e,n,t)=>{for(let r in n)"__proto__"!==r&&"constructor"!==r&&(r in e?o$(e[r])||e[r]instanceof String||o$(n[r])||n[r]instanceof String?t&&(e[r]=n[r]):oM(e[r],n[r],t):e[r]=n[r]);return e};var oz={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;","/":"&#x2F;"};let oP=e=>o$(e)?e.replace(/[&<>"'\/]/g,e=>oz[e]):e,oO=[" ",",","?","!",";"],oT=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),oB=(e,n,t=".")=>{if(!e)return;if(e[n]){if(!Object.prototype.hasOwnProperty.call(e,n))return;return e[n]}let r=n.split(t),o=e;for(let e=0;e<r.length;){let n;if(!o||"object"!=typeof o)return;let i="";for(let a=e;a<r.length;++a)if(a!==e&&(i+=t),i+=r[a],void 0!==(n=o[i])){if(["string","number","boolean"].indexOf(typeof n)>-1&&a<r.length-1)continue;e+=a-e+1;break}o=n}return o},oI=e=>e?.replace("_","-"),oN={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 oj{constructor(e,n={}){this.init(e,n)}init(e,n={}){this.prefix=n.prefix||"i18next:",this.logger=e||oN,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,r){return r&&!this.debug?null:(o$(e[0])&&(e[0]=`${t}${this.prefix} ${e[0]}`),this.logger[n](e))}create(e){return new oj(this.logger,{...{prefix:`${this.prefix}:${e}:`},...this.options})}clone(e){return(e=e||this.options).prefix=e.prefix||this.prefix,new oj(this.logger,e)}}var oR=new oj;class oF{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 r=0;r<t;r++)e(...n)}),this.observers["*"]&&Array.from(this.observers["*"].entries()).forEach(([t,r])=>{for(let o=0;o<r;o++)t.apply(t,[e,...n])})}}class oL extends oF{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,r={}){let o,i=void 0!==r.keySeparator?r.keySeparator:this.options.keySeparator,a=void 0!==r.ignoreJSONStructure?r.ignoreJSONStructure:this.options.ignoreJSONStructure;e.indexOf(".")>-1?o=e.split("."):(o=[e,n],t&&(Array.isArray(t)?o.push(...t):o$(t)&&i?o.push(...t.split(i)):o.push(t)));let s=oS(this.data,o);return(!s&&!n&&!t&&e.indexOf(".")>-1&&(e=o[0],n=o[1],t=o.slice(2).join(".")),!s&&a&&o$(t))?oB(this.data?.[e]?.[n],t,i):s}addResource(e,n,t,r,o={silent:!1}){let i=void 0!==o.keySeparator?o.keySeparator:this.options.keySeparator,a=[e,n];t&&(a=a.concat(i?t.split(i):t)),e.indexOf(".")>-1&&(a=e.split("."),r=n,n=a[1]),this.addNamespaces(n),oD(this.data,a,r),o.silent||this.emit("added",e,n,t,r)}addResources(e,n,t,r={silent:!1}){for(let r in t)(o$(t[r])||Array.isArray(t[r]))&&this.addResource(e,n,r,t[r],{silent:!0});r.silent||this.emit("added",e,n,t)}addResourceBundle(e,n,t,r,o,i={silent:!1,skipCopy:!1}){let a=[e,n];e.indexOf(".")>-1&&(a=e.split("."),r=t,t=n,n=a[1]),this.addNamespaces(n);let s=oS(this.data,a)||{};i.skipCopy||(t=JSON.parse(JSON.stringify(t))),r?oM(s,t,o):s={...s,...t},oD(this.data,a,s),i.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 oW={processors:{},addPostProcessor(e){this.processors[e.name]=e},handle(e,n,t,r,o){return e.forEach(e=>{n=this.processors[e]?.process(n,t,r,o)??n}),n}};let oV=Symbol("i18next/PATH_KEY");function oG(e,n){let t,r,o,{[oV]:i}=e((r=[],(o=Object.create(null)).get=(e,n)=>(t?.revoke?.(),n===oV)?r:(r.push(n),(t=Proxy.revocable(e,o)).proxy),Proxy.revocable(Object.create(null),o).proxy));return i.join(n?.keySeparator??".")}let oU={},oq=e=>!o$(e)&&"boolean"!=typeof e&&"number"!=typeof e;class oH extends oF{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=oR.create("translator")}changeLanguage(e){e&&(this.language=e)}exists(e,n={interpolation:{}}){let t={...n};if(null==e)return!1;let r=this.resolve(e,t);if(r?.res===void 0)return!1;let o=oq(r.res);return!1!==t.returnObjects||!o}extractFromKey(e,n){let t=void 0!==n.nsSeparator?n.nsSeparator:this.options.nsSeparator;void 0===t&&(t=":");let r=void 0!==n.keySeparator?n.keySeparator:this.options.keySeparator,o=n.ns||this.options.defaultNS||[],i=t&&e.indexOf(t)>-1,a=!this.options.userDefinedKeySeparator&&!n.keySeparator&&!this.options.userDefinedNsSeparator&&!n.nsSeparator&&!((e,n,t)=>{n=n||"",t=t||"";let r=oO.filter(e=>0>n.indexOf(e)&&0>t.indexOf(e));if(0===r.length)return!0;let o=oT.getRegExp(`(${r.map(e=>"?"===e?"\\?":e).join("|")})`),i=!o.test(e);if(!i){let n=e.indexOf(t);n>0&&!o.test(e.substring(0,n))&&(i=!0)}return i})(e,t,r);if(i&&!a){let n=e.match(this.interpolator.nestingRegexp);if(n&&n.length>0)return{key:e,namespaces:o$(o)?[o]:o};let i=e.split(t);(t!==r||t===r&&this.options.ns.indexOf(i[0])>-1)&&(o=i.shift()),e=i.join(r)}return{key:e,namespaces:o$(o)?[o]:o}}translate(e,n,t){let r="object"==typeof n?{...n}:n;if("object"!=typeof r&&this.options.overloadTranslationOptionHandler&&(r=this.options.overloadTranslationOptionHandler(arguments)),"object"==typeof r&&(r={...r}),r||(r={}),null==e)return"";"function"==typeof e&&(e=oG(e,{...this.options,...r})),Array.isArray(e)||(e=[String(e)]);let o=void 0!==r.returnDetails?r.returnDetails:this.options.returnDetails,i=void 0!==r.keySeparator?r.keySeparator:this.options.keySeparator,{key:a,namespaces:s}=this.extractFromKey(e[e.length-1],r),l=s[s.length-1],c=void 0!==r.nsSeparator?r.nsSeparator:this.options.nsSeparator;void 0===c&&(c=":");let u=r.lng||this.language,p=r.appendNamespaceToCIMode||this.options.appendNamespaceToCIMode;if(u?.toLowerCase()==="cimode")return p?o?{res:`${l}${c}${a}`,usedKey:a,exactUsedKey:a,usedLng:u,usedNS:l,usedParams:this.getUsedParamsDetails(r)}:`${l}${c}${a}`:o?{res:a,usedKey:a,exactUsedKey:a,usedLng:u,usedNS:l,usedParams:this.getUsedParamsDetails(r)}:a;let d=this.resolve(e,r),f=d?.res,h=d?.usedKey||a,m=d?.exactUsedKey||a,g=void 0!==r.joinArrays?r.joinArrays:this.options.joinArrays,b=!this.i18nFormat||this.i18nFormat.handleAsObject,y=void 0!==r.count&&!o$(r.count),v=oH.hasDefaultValue(r),$=y?this.pluralResolver.getSuffix(u,r.count,r):"",A=r.ordinal&&y?this.pluralResolver.getSuffix(u,r.count,{ordinal:!1}):"",w=y&&!r.ordinal&&0===r.count,k=w&&r[`defaultValue${this.options.pluralSeparator}zero`]||r[`defaultValue${$}`]||r[`defaultValue${A}`]||r.defaultValue,x=f;b&&!f&&v&&(x=k);let C=oq(x),E=Object.prototype.toString.apply(x);if(b&&x&&C&&0>["[object Number]","[object Function]","[object RegExp]"].indexOf(E)&&!(o$(g)&&Array.isArray(x))){if(!r.returnObjects&&!this.options.returnObjects){this.options.returnedObjectHandler||this.logger.warn("accessing an object - but returnObjects options is not enabled!");let e=this.options.returnedObjectHandler?this.options.returnedObjectHandler(h,x,{...r,ns:s}):`key '${a} (${this.language})' returned an object instead of string.`;return o?(d.res=e,d.usedParams=this.getUsedParamsDetails(r),d):e}if(i){let e=Array.isArray(x),n=e?[]:{},t=e?m:h;for(let e in x)if(Object.prototype.hasOwnProperty.call(x,e)){let o=`${t}${i}${e}`;v&&!f?n[e]=this.translate(o,{...r,defaultValue:oq(k)?k[e]:void 0,...{joinArrays:!1,ns:s}}):n[e]=this.translate(o,{...r,joinArrays:!1,ns:s}),n[e]===o&&(n[e]=x[e])}f=n}}else if(b&&o$(g)&&Array.isArray(f))(f=f.join(g))&&(f=this.extendTranslation(f,e,r,t));else{let n=!1,o=!1;!this.isValidLookup(f)&&v&&(n=!0,f=k),this.isValidLookup(f)||(o=!0,f=a);let s=(r.missingKeyNoValueFallbackToKey||this.options.missingKeyNoValueFallbackToKey)&&o?void 0:f,p=v&&k!==f&&this.options.updateMissing;if(o||n||p){if(this.logger.log(p?"updateKey":"missingKey",u,l,a,p?k:f),i){let e=this.resolve(a,{...r,keySeparator:!1});e&&e.res&&this.logger.warn("Seems the loaded translations were in flat JSON format instead of nested. Either set keySeparator: false on init or make sure your translations are published in nested format.")}let e=[],n=this.languageUtils.getFallbackCodes(this.options.fallbackLng,r.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(r.lng||this.language):e.push(r.lng||this.language);let t=(e,n,t)=>{let o=v&&t!==f?t:s;this.options.missingKeyHandler?this.options.missingKeyHandler(e,l,n,o,p,r):this.backendConnector?.saveMissing&&this.backendConnector.saveMissing(e,l,n,o,p,r),this.emit("missingKey",e,l,n,f)};this.options.saveMissing&&(this.options.saveMissingPlurals&&y?e.forEach(e=>{let n=this.pluralResolver.getSuffixes(e,r);w&&r[`defaultValue${this.options.pluralSeparator}zero`]&&0>n.indexOf(`${this.options.pluralSeparator}zero`)&&n.push(`${this.options.pluralSeparator}zero`),n.forEach(n=>{t([e],a+n,r[`defaultValue${n}`]||k)})}):t(e,a,k))}f=this.extendTranslation(f,e,r,d,t),o&&f===a&&this.options.appendNamespaceToMissingKey&&(f=`${l}${c}${a}`),(o||n)&&this.options.parseMissingKeyHandler&&(f=this.options.parseMissingKeyHandler(this.options.appendNamespaceToMissingKey?`${l}${c}${a}`:a,n?f:void 0,r))}return o?(d.res=f,d.usedParams=this.getUsedParamsDetails(r),d):f}extendTranslation(e,n,t,r,o){if(this.i18nFormat?.parse)e=this.i18nFormat.parse(e,{...this.options.interpolation.defaultVariables,...t},t.lng||this.language||r.usedLng,r.usedNS,r.usedKey,{resolved:r});else if(!t.skipInterpolation){let i;t.interpolation&&this.interpolator.init({...t,...{interpolation:{...this.options.interpolation,...t.interpolation}}});let a=o$(e)&&(t?.interpolation?.skipOnVariables!==void 0?t.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables);if(a){let n=e.match(this.interpolator.nestingRegexp);i=n&&n.length}let s=t.replace&&!o$(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||r.usedLng,t),a){let n=e.match(this.interpolator.nestingRegexp);i<(n&&n.length)&&(t.nest=!1)}!t.lng&&r&&r.res&&(t.lng=this.language||r.usedLng),!1!==t.nest&&(e=this.interpolator.nest(e,(...e)=>o?.[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 i=t.postProcess||this.options.postProcess,a=o$(i)?[i]:i;return null!=e&&a?.length&&!1!==t.applyPostProcessor&&(e=oW.handle(a,e,n,this.options&&this.options.postProcessPassResolved?{i18nResolved:{...r,usedParams:this.getUsedParamsDetails(t)},...t}:t,this)),e}resolve(e,n={}){let t,r,o,i,a;return o$(e)&&(e=[e]),e.forEach(e=>{if(this.isValidLookup(t))return;let s=this.extractFromKey(e,n),l=s.key;r=l;let c=s.namespaces;this.options.fallbackNS&&(c=c.concat(this.options.fallbackNS));let u=void 0!==n.count&&!o$(n.count),p=u&&!n.ordinal&&0===n.count,d=void 0!==n.context&&(o$(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)||(a=e,!oU[`${f[0]}-${e}`]&&this.utils?.hasLoadedNamespace&&!this.utils?.hasLoadedNamespace(a)&&(oU[`${f[0]}-${e}`]=!0,this.logger.warn(`key "${r}" for languages "${f.join(", ")}" won't get resolved as namespace "${a}" 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(r=>{let a;if(this.isValidLookup(t))return;i=r;let s=[l];if(this.i18nFormat?.addLookupKeys)this.i18nFormat.addLookupKeys(s,l,r,e,n);else{let e;u&&(e=this.pluralResolver.getSuffix(r,n.count,n));let t=`${this.options.pluralSeparator}zero`,o=`${this.options.pluralSeparator}ordinal${this.options.pluralSeparator}`;if(u&&(n.ordinal&&0===e.indexOf(o)&&s.push(l+e.replace(o,this.options.pluralSeparator)),s.push(l+e),p&&s.push(l+t)),d){let r=`${l}${this.options.contextSeparator||"_"}${n.context}`;s.push(r),u&&(n.ordinal&&0===e.indexOf(o)&&s.push(r+e.replace(o,this.options.pluralSeparator)),s.push(r+e),p&&s.push(r+t))}}for(;a=s.pop();)this.isValidLookup(t)||(o=a,t=this.getResource(r,e,a,n))}))})}),{res:t,usedKey:r,exactUsedKey:o,usedLng:i,usedNS:a}}isValidLookup(e){return void 0!==e&&!(!this.options.returnNull&&null===e)&&!(!this.options.returnEmptyString&&""===e)}getResource(e,n,t,r={}){return this.i18nFormat?.getResource?this.i18nFormat.getResource(e,n,t,r):this.resourceStore.getResource(e,n,t,r)}getUsedParamsDetails(e={}){let n=e.replace&&!o$(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 oK{constructor(e){this.options=e,this.supportedLngs=this.options.supportedLngs||!1,this.logger=oR.create("languageUtils")}getScriptPartFromCode(e){if(!(e=oI(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=oI(e))||0>e.indexOf("-"))return e;let n=e.split("-");return this.formatLanguageCode(n[0])}formatLanguageCode(e){if(o$(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 r=this.getLanguagePartFromCode(e);if(this.isSupportedCode(r))return n=r;n=this.options.supportedLngs.find(e=>{if(e===r||!(0>e.indexOf("-")&&0>r.indexOf("-"))&&(e.indexOf("-")>0&&0>r.indexOf("-")&&e.substring(0,e.indexOf("-"))===r||0===e.indexOf(r)&&r.length>1))return e})}),n||(n=this.getFallbackCodes(this.options.fallbackLng)[0]),n):null}getFallbackCodes(e,n){if(!e)return[];if("function"==typeof e&&(e=e(n)),o$(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),r=[],o=e=>{e&&(this.isSupportedCode(e)?r.push(e):this.logger.warn(`rejecting language code not found in supportedLngs: ${e}`))};return o$(e)&&(e.indexOf("-")>-1||e.indexOf("_")>-1)?("languageOnly"!==this.options.load&&o(this.formatLanguageCode(e)),"languageOnly"!==this.options.load&&"currentOnly"!==this.options.load&&o(this.getScriptPartFromCode(e)),"currentOnly"!==this.options.load&&o(this.getLanguagePartFromCode(e))):o$(e)&&o(this.formatLanguageCode(e)),t.forEach(e=>{0>r.indexOf(e)&&o(this.formatLanguageCode(e))}),r}}let oY={zero:0,one:1,two:2,few:3,many:4,other:5},oJ={select:e=>1===e?"one":"other",resolvedOptions:()=>({pluralCategories:["one","other"]})};class oZ{constructor(e,n={}){this.languageUtils=e,this.options=n,this.logger=oR.create("pluralResolver"),this.pluralRulesCache={}}addRule(e,n){this.rules[e]=n}clearCache(){this.pluralRulesCache={}}getRule(e,n={}){let t,r=oI("dev"===e?"en":e),o=n.ordinal?"ordinal":"cardinal",i=JSON.stringify({cleanedCode:r,type:o});if(i in this.pluralRulesCache)return this.pluralRulesCache[i];try{t=new Intl.PluralRules(r,{type:o})}catch(o){if(!Intl)return this.logger.error("No Intl support, please use an Intl polyfill!"),oJ;if(!e.match(/-|_/))return oJ;let r=this.languageUtils.getLanguagePartFromCode(e);t=this.getRule(r,n)}return this.pluralRulesCache[i]=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)=>oY[e]-oY[n]).map(e=>`${this.options.prepend}${n.ordinal?`ordinal${this.options.prepend}`:""}${e}`):[]}getSuffix(e,n,t={}){let r=this.getRule(e,t);return r?`${this.options.prepend}${t.ordinal?`ordinal${this.options.prepend}`:""}${r.select(n)}`:(this.logger.warn(`no plural rule found for: ${e}`),this.getSuffix("dev",n,t))}}let oX=(e,n,t,r=".",o=!0)=>{let i,a=void 0!==(i=oS(e,t))?i:oS(n,t);return!a&&o&&o$(t)&&void 0===(a=oB(e,t,r))&&(a=oB(n,t,r)),a};class oQ{constructor(e={}){this.logger=oR.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:r,prefix:o,prefixEscaped:i,suffix:a,suffixEscaped:s,formatSeparator:l,unescapeSuffix:c,unescapePrefix:u,nestingPrefix:p,nestingPrefixEscaped:d,nestingSuffix:f,nestingSuffixEscaped:h,nestingOptionsSeparator:m,maxReplaces:g,alwaysFormat:b}=e.interpolation;this.escape=void 0!==n?n:oP,this.escapeValue=void 0===t||t,this.useRawValueToEscape=void 0!==r&&r,this.prefix=o?o.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&"):i||"{{",this.suffix=a?a.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=m||",",this.maxReplaces=g||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,r){let o,i,a,s=this.options&&this.options.interpolation&&this.options.interpolation.defaultVariables||{},l=e=>{if(0>e.indexOf(this.formatSeparator)){let o=oX(n,s,e,this.options.keySeparator,this.options.ignoreJSONStructure);return this.alwaysFormat?this.format(o,void 0,t,{...r,...n,interpolationkey:e}):o}let o=e.split(this.formatSeparator),i=o.shift().trim(),a=o.join(this.formatSeparator).trim();return this.format(oX(n,s,i,this.options.keySeparator,this.options.ignoreJSONStructure),a,t,{...r,...n,interpolationkey:i})};this.resetRegExp();let c=r?.missingInterpolationHandler||this.options.missingInterpolationHandler,u=r?.interpolation?.skipOnVariables!==void 0?r.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables;return[{regex:this.regexpUnescape,safeValue:e=>e.replace(/\$/g,"$$$$")},{regex:this.regexp,safeValue:e=>this.escapeValue?this.escape(e).replace(/\$/g,"$$$$"):e.replace(/\$/g,"$$$$")}].forEach(n=>{for(a=0;o=n.regex.exec(e);){let t=o[1].trim();if(void 0===(i=l(t)))if("function"==typeof c){let n=c(e,o,r);i=o$(n)?n:""}else if(r&&Object.prototype.hasOwnProperty.call(r,t))i="";else if(u){i=o[0];continue}else this.logger.warn(`missed to pass in variable ${t} for interpolating ${e}`),i="";else o$(i)||this.useRawValueToEscape||(i=ow(i));let s=n.safeValue(i);if(e=e.replace(o[0],s),u?(n.regex.lastIndex+=i.length,n.regex.lastIndex-=o[0].length):n.regex.lastIndex=0,++a>=this.maxReplaces)break}}),e}nest(e,n,t={}){let r,o,i,a=(e,n)=>{let t=this.nestingOptionsSeparator;if(0>e.indexOf(t))return e;let r=e.split(RegExp(`${t}[ ]*{`)),o=`{${r[1]}`;e=r[0];let a=(o=this.interpolate(o,i)).match(/'/g),s=o.match(/"/g);((a?.length??0)%2!=0||s)&&s.length%2==0||(o=o.replace(/'/g,'"'));try{i=JSON.parse(o),n&&(i={...n,...i})}catch(n){return this.logger.warn(`failed parsing options string in nesting for key ${e}`,n),`${e}${t}${o}`}return i.defaultValue&&i.defaultValue.indexOf(this.prefix)>-1&&delete i.defaultValue,e};for(;r=this.nestingRegexp.exec(e);){let s=[];(i=(i={...t}).replace&&!o$(i.replace)?i.replace:i).applyPostProcessor=!1,delete i.defaultValue;let l=/{.*}/.test(r[1])?r[1].lastIndexOf("}")+1:r[1].indexOf(this.formatSeparator);if(-1!==l&&(s=r[1].slice(l).split(this.formatSeparator).map(e=>e.trim()).filter(Boolean),r[1]=r[1].slice(0,l)),(o=n(a.call(this,r[1].trim(),i),i))&&r[0]===e&&!o$(o))return o;o$(o)||(o=ow(o)),o||(this.logger.warn(`missed to resolve ${r[1]} for nesting ${e}`),o=""),s.length&&(o=s.reduce((e,n)=>this.format(e,n,t.lng,{...t,interpolationkey:r[1].trim()}),o.trim())),e=e.replace(r[0],o),this.regexp.lastIndex=0}return e}}let o0=e=>{let n={};return(t,r,o)=>{let i=o;o&&o.interpolationkey&&o.formatParams&&o.formatParams[o.interpolationkey]&&o[o.interpolationkey]&&(i={...i,[o.interpolationkey]:void 0});let a=r+JSON.stringify(i),s=n[a];return s||(s=e(oI(r),o),n[a]=s),s(t)}},o1=e=>(n,t,r)=>e(oI(t),r)(n);class o2{constructor(e={}){this.logger=oR.create("formatter"),this.options=e,this.init(e)}init(e,n={interpolation:{}}){this.formatSeparator=n.interpolation.formatSeparator||",";let t=n.cacheInBuiltFormats?o0:o1;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()]=o0(n)}format(e,n,t,r={}){let o=n.split(this.formatSeparator);if(o.length>1&&o[0].indexOf("(")>1&&0>o[0].indexOf(")")&&o.find(e=>e.indexOf(")")>-1)){let e=o.findIndex(e=>e.indexOf(")")>-1);o[0]=[o[0],...o.splice(1,e)].join(this.formatSeparator)}return o.reduce((e,n)=>{let{formatName:o,formatOptions:i}=(e=>{let n=e.toLowerCase().trim(),t={};if(e.indexOf("(")>-1){let r=e.split("(");n=r[0].toLowerCase().trim();let o=r[1].substring(0,r[1].length-1);"currency"===n&&0>o.indexOf(":")?t.currency||(t.currency=o.trim()):"relativetime"===n&&0>o.indexOf(":")?t.range||(t.range=o.trim()):o.split(";").forEach(e=>{if(e){let[n,...r]=e.split(":"),o=r.join(":").trim().replace(/^'+|'+$/g,""),i=n.trim();t[i]||(t[i]=o),"false"===o&&(t[i]=!1),"true"===o&&(t[i]=!0),isNaN(o)||(t[i]=parseInt(o,10))}})}return{formatName:n,formatOptions:t}})(n);if(this.formats[o]){let n=e;try{let a=r?.formatParams?.[r.interpolationkey]||{},s=a.locale||a.lng||r.locale||r.lng||t;n=this.formats[o](e,s,{...i,...r,...a})}catch(e){this.logger.warn(e)}return n}return this.logger.warn(`there was no format function for ${o}`),e},e)}}class o3 extends oF{constructor(e,n,t,r={}){super(),this.backend=e,this.store=n,this.services=t,this.languageUtils=t.languageUtils,this.options=r,this.logger=oR.create("backendConnector"),this.waitingReads=[],this.maxParallelReads=r.maxParallelReads||10,this.readingCalls=0,this.maxRetries=r.maxRetries>=0?r.maxRetries:5,this.retryTimeout=r.retryTimeout>=1?r.retryTimeout:350,this.state={},this.queue=[],this.backend?.init?.(t,r.backend,r)}queueLoad(e,n,t,r){let o={},i={},a={},s={};return e.forEach(e=>{let r=!0;n.forEach(n=>{let a=`${e}|${n}`;!t.reload&&this.store.hasResourceBundle(e,n)?this.state[a]=2:this.state[a]<0||(1===this.state[a]?void 0===i[a]&&(i[a]=!0):(this.state[a]=1,r=!1,void 0===i[a]&&(i[a]=!0),void 0===o[a]&&(o[a]=!0),void 0===s[n]&&(s[n]=!0)))}),r||(a[e]=!0)}),(Object.keys(o).length||Object.keys(i).length)&&this.queue.push({pending:i,pendingCount:Object.keys(i).length,loaded:{},errors:[],callback:r}),{toLoad:Object.keys(o),pending:Object.keys(i),toLoadLanguages:Object.keys(a),toLoadNamespaces:Object.keys(s)}}loaded(e,n,t){let r=e.split("|"),o=r[0],i=r[1];n&&this.emit("failedLoading",o,i,n),!n&&t&&this.store.addResourceBundle(o,i,t,void 0,void 0,{skipCopy:!0}),this.state[e]=n?-1:2,n&&t&&(this.state[e]=0);let a={};this.queue.forEach(t=>{((e,n,t,r)=>{let{obj:o,k:i}=oE(e,n,Object);o[i]=o[i]||[],o[i].push(t)})(t.loaded,[o],i),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=>{a[e]||(a[e]={});let n=t.loaded[e];n.length&&n.forEach(n=>{void 0===a[e][n]&&(a[e][n]=!0)})}),t.done=!0,t.errors.length?t.callback(t.errors):t.callback())}),this.emit("loaded",a),this.queue=this.queue.filter(e=>!e.done)}read(e,n,t,r=0,o=this.retryTimeout,i){if(!e.length)return i(null,{});if(this.readingCalls>=this.maxParallelReads)return void this.waitingReads.push({lng:e,ns:n,fcName:t,tried:r,wait:o,callback:i});this.readingCalls++;let a=(a,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)}a&&s&&r<this.maxRetries?setTimeout(()=>{this.read.call(this,e,n,t,r+1,2*o,i)},o):i(a,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=>a(null,e)).catch(a):a(null,t)}catch(e){a(e)}return}return s(e,n,a)}prepareLoading(e,n,t={},r){if(!this.backend)return this.logger.warn("No backend was added via i18next.use. Will not load resources."),r&&r();o$(e)&&(e=this.languageUtils.toResolveHierarchy(e)),o$(n)&&(n=[n]);let o=this.queueLoad(e,n,t,r);if(!o.toLoad.length)return o.pending.length||r(),null;o.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("|"),r=t[0],o=t[1];this.read(r,o,"read",void 0,void 0,(t,i)=>{t&&this.logger.warn(`${n}loading namespace ${o} for language ${r} failed`,t),!t&&i&&this.logger.log(`${n}loaded namespace ${o} for language ${r}`,i),this.loaded(e,t,i)})}saveMissing(e,n,t,r,o,i={},a=()=>{}){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={...i,isUpdate:o},l=this.backend.create.bind(this.backend);if(l.length<6)try{let o;(o=5===l.length?l(e,n,t,r,s):l(e,n,t,r))&&"function"==typeof o.then?o.then(e=>a(null,e)).catch(a):a(null,o)}catch(e){a(e)}else l(e,n,t,r,a,s)}e&&e[0]&&this.store.addResource(e[0],n,t,r)}}}let o5=()=>({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]),o$(e[1])&&(n.defaultValue=e[1]),o$(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}),o4=e=>(o$(e.ns)&&(e.ns=[e.ns]),o$(e.fallbackLng)&&(e.fallbackLng=[e.fallbackLng]),o$(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),o6=()=>{};class o8 extends oF{constructor(e={},n){if(super(),this.options=o4(e),this.services={},this.logger=oR,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&&(o$(e.ns)?e.defaultNS=e.ns:0>e.ns.indexOf("translation")&&(e.defaultNS=e.ns[0]));let t=o5();this.options={...t,...this.options,...o4(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 r=e=>e?"function"==typeof e?new e:e:null;if(!this.options.isClone){let e;this.modules.logger?oR.init(r(this.modules.logger),this.options):oR.init(null,this.options),e=this.modules.formatter?this.modules.formatter:o2;let n=new oK(this.options);this.store=new oL(this.options.resources,this.options);let o=this.services;o.logger=oR,o.resourceStore=this.store,o.languageUtils=n,o.pluralResolver=new oZ(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)&&(o.formatter=r(e),o.formatter.init&&o.formatter.init(o,this.options),this.options.interpolation.format=o.formatter.format.bind(o.formatter)),o.interpolator=new oQ(this.options),o.utils={hasLoadedNamespace:this.hasLoadedNamespace.bind(this)},o.backendConnector=new o3(r(this.modules.backend),o.resourceStore,o,this.options),o.backendConnector.on("*",(e,...n)=>{this.emit(e,...n)}),this.modules.languageDetector&&(o.languageDetector=r(this.modules.languageDetector),o.languageDetector.init&&o.languageDetector.init(o,this.options.detection,this.options)),this.modules.i18nFormat&&(o.i18nFormat=r(this.modules.i18nFormat),o.i18nFormat.init&&o.i18nFormat.init(this)),this.translator=new oH(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=o6),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 o=oA(),i=()=>{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),o.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?i():setTimeout(i,0),o}loadResources(e,n=o6){let t=n,r=o$(e)?e:this.language;if("function"==typeof e&&(t=e),!this.options.resources||this.options.partialBundledLanguages){if(r?.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)})};r?n(r):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 r=oA();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=o6),this.services.backendConnector.reload(e,n,e=>{r.resolve(),t(e)}),r}use(e){if(!e)throw Error("You are passing an undefined module! Please check the object you are passing to i18next.use()");if(!e.type)throw Error("You are passing a wrong module! Please check the object you are passing to i18next.use()");return"backend"===e.type&&(this.modules.backend=e),("logger"===e.type||e.log&&e.warn&&e.error)&&(this.modules.logger=e),"languageDetector"===e.type&&(this.modules.languageDetector=e),"i18nFormat"===e.type&&(this.modules.i18nFormat=e),"postProcessor"===e.type&&oW.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=oA();this.emit("languageChanging",e);let r=e=>{this.language=e,this.languages=this.services.languageUtils.toResolveHierarchy(e),this.resolvedLanguage=void 0,this.setResolvedLanguage(e)},o=(o,i)=>{i?this.isLanguageChangingTo===e&&(r(i),this.translator.changeLanguage(i),this.isLanguageChangingTo=void 0,this.emit("languageChanged",i),this.logger.log("languageChanged",i)):this.isLanguageChangingTo=void 0,t.resolve((...e)=>this.t(...e)),n&&n(o,(...e)=>this.t(...e))},i=n=>{e||n||!this.services.languageDetector||(n=[]);let t=o$(n)?n:n&&n[0],i=this.store.hasLanguageSomeTranslations(t)?t:this.services.languageUtils.getBestMatchFromCodes(o$(n)?[n]:n);i&&(this.language||r(i),this.translator.language||this.translator.changeLanguage(i),this.services.languageDetector?.cacheUserLanguage?.(i)),this.loadResources(i,e=>{o(e,i)})};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(i):this.services.languageDetector.detect(i):i(e):i(this.services.languageDetector.detect()),t}getFixedT(e,n,t){let r=(e,n,...o)=>{let i,a;(i="object"!=typeof n?this.options.overloadTranslationOptionHandler([e,n].concat(o)):{...n}).lng=i.lng||r.lng,i.lngs=i.lngs||r.lngs,i.ns=i.ns||r.ns,""!==i.keyPrefix&&(i.keyPrefix=i.keyPrefix||t||r.keyPrefix);let s=this.options.keySeparator||".";return i.keyPrefix&&Array.isArray(e)?a=e.map(e=>("function"==typeof e&&(e=oG(e,{...this.options,...n})),`${i.keyPrefix}${s}${e}`)):("function"==typeof e&&(e=oG(e,{...this.options,...n})),a=i.keyPrefix?`${i.keyPrefix}${s}${e}`:e),this.t(a,i)};return o$(e)?r.lng=e:r.lngs=e,r.ns=n,r.keyPrefix=t,r}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],r=!!this.options&&this.options.fallbackLng,o=this.languages[this.languages.length-1];if("cimode"===t.toLowerCase())return!0;let i=(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,i);if(void 0!==e)return e}return!!(this.hasResourceBundle(t,e)||!this.services.backendConnector.backend||this.options.resources&&!this.options.partialBundledLanguages||i(t,e)&&(!r||i(o,e)))}loadNamespaces(e,n){let t=oA();return this.options.ns?(o$(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=oA();o$(e)&&(e=[e]);let r=this.options.preload||[],o=e.filter(e=>0>r.indexOf(e)&&this.services.languageUtils.isSupportedCode(e));return o.length?(this.options.preload=r.concat(o),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 oK(o5());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 o8(e,n)}cloneInstance(e={},n=o6){let t=e.forkResourceStore;t&&delete e.forkResourceStore;let r={...this.options,...e,isClone:!0},o=new o8(r);return(void 0!==e.debug||void 0!==e.prefix)&&(o.logger=o.logger.clone(e)),["store","services","language"].forEach(e=>{o[e]=this[e]}),o.services={...this.services},o.services.utils={hasLoadedNamespace:o.hasLoadedNamespace.bind(o)},t&&(o.store=new oL(Object.keys(this.store.data).reduce((e,n)=>(e[n]={...this.store.data[n]},e[n]=Object.keys(e[n]).reduce((t,r)=>(t[r]={...e[n][r]},t),e[n]),e),{}),r),o.services.resourceStore=o.store),o.translator=new oH(o.services,r),o.translator.on("*",(e,...n)=>{o.emit(e,...n)}),o.init(r,n),o.translator.options=r,o.translator.backendConnector.services.utils={hasLoadedNamespace:o.hasLoadedNamespace.bind(o)},o}toJSON(){return{options:this.options,store:this.store,language:this.language,languages:this.languages,resolvedLanguage:this.resolvedLanguage}}}let o7=o8.createInstance();o7.createInstance=o8.createInstance,o7.createInstance,o7.dir,o7.init,o7.loadResources,o7.reloadResources,o7.use,o7.changeLanguage,o7.getFixedT,o7.t,o7.exists,o7.setDefaultNamespace,o7.hasLoadedNamespace,o7.loadNamespaces,o7.loadLanguages;let o9=o7.default||o7;function ie(e,n,t,r){return o9.t(n,{ns:e,defaultValue:t,...r})}function it(e,n,t){return ov[e]?ie("core",e,n??ov[e],t):(console.error(`O3 Core Translations does not provide key '${e}'. The key itself is being rendered as text.`),e)}o9.on("initialized",function(){window.i18next.loadNamespaces(["core"])});let ir=null;async function io(){return ir??(ir=ii().then(({map:e,complete:n})=>(n||(ir=null),e))),ir}async function ii(){let e=document.querySelectorAll('script[type="systemjs-importmap"]'),n=[],t=!0;for(let r=0;r<e.length;r++){let o=e[r];try{if(o.src){let e=await fetch(o.src);if(!e.ok)throw Error(`Request for ${o.src} returned ${e.status} ${e.statusText}`);n.push(await e.json())}else o.textContent&&n.push(JSON.parse(o.textContent))}catch(e){t=!1,console.warn(`[import-maps] Failed to parse import map from script tag at index ${r}`,e)}}return{map:function(e){let n={imports:{}};for(let t of e)t?.imports&&Object.assign(n.imports,t.imports);return n}(n),complete:t}}async function ia(){return await io()}function is(e){return e.replace(/[\/\-@]/g,"_")}async function il(e,n="./start",r){var o;let i,a=!r?.maxLoadingTime||r.maxLoadingTime<=0?6e5:r.maxLoadingTime;await Promise.race([ic(e,r?.importMap),new Promise((n,t)=>{i=setTimeout(()=>{var n;t(Error(`Could not resolve requested script, ${e}, within ${(n=a)<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`}.`))},a)})]),i&&clearTimeout(i);let s=is(e),l=window[s];if(!("object"==typeof(o=l)&&null!==o&&"init"in o&&"function"==typeof o.init&&"get"in o&&"function"==typeof o.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 ic(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=is(e);if(!window[t]){let t=n??await iu();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 r=t.imports[e];r.startsWith("./")&&(r=window.spaBase+r.substring(1));let o=e in{};try{return await function(e){var n;let t=(n=window)[ip]??(n[ip]=new Map),r=t.get(e);if(r)return r;if(document.head.querySelector(`script[src="${e}"]`))return console.warn(`Script at ${e} already loaded. Not loading it again.`),Promise.resolve();let o=document.createElement("script");o.src=e,o.type="text/javascript",o.async=!0;let i=new Promise((n,r)=>{let i=setTimeout(()=>{console.error(`The script at ${e} did not load within 5 seconds. This may indicate an issue with the imports in the script's entry-point file or with the script's bundler configuration.`)},5e3);function a(){clearTimeout(i),o.removeEventListener("load",s),o.removeEventListener("error",l)}function s(){a(),n()}function l(n){a(),t.delete(e),o.remove();let i=`Failed to load script from ${e}`;console.error(i,n),r(n.message??i)}o.addEventListener("load",s),o.addEventListener("error",l),document.head.appendChild(o)});return t.set(e,i),i}(r)}catch(e){return o&&C({kind:"error",title:it("scriptLoadingFailed","Error: Script failed to load"),description:it("scriptLoadingError","Failed to load overridden script from {{- url}}. Please check that the bundled script is available at the expected URL. Click the button below to reset all import map overrides.",{url:r}),actionButtonLabel:it("resetOverrides","Reset overrides"),onActionButtonClick(){console.warn("[Security] Import map overrides are disabled in production mode."),window.location.reload()}}),Promise.reject(e)}}return Promise.resolve()}async function iu(){return ia()}let ip=Symbol.for("__openmrs_script_loading"),id=`${r0}/attachment`;function ih(e,n){return r5(`${id}/${e}`,{signal:n.signal})}function im(e,n,t){return r5(`${id}?patient=${e}&includeEncounterless=${n}`,{signal:t.signal})}async function ig(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)),r5(`${id}`,{method:"POST",body:t})}function ib(e,n){return r5(`${id}/${e}`,{method:"DELETE",signal:n.signal})}try{self["workbox:window:6.5.4"]&&_()}catch(e){}function iy(e,n){return new Promise(function(t){var r=new MessageChannel;r.port1.onmessage=function(e){t(e.data)},e.postMessage(n,[r.port2])})}function i_(e,n){for(var t=0;t<n.length;t++){var r=n[t];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function iv(e,n){(null==n||n>e.length)&&(n=e.length);for(var t=0,r=Array(n);t<n;t++)r[t]=e[t];return r}try{self["workbox:core:6.5.4"]&&_()}catch(e){}var i$=function(){var e=this;this.promise=new Promise(function(n,t){e.resolve=n,e.reject=t})};function iA(e,n){var t=location.href;return new URL(e,t).href===new URL(n,t).href}var iw=function(e,n){this.type=e,Object.assign(this,n)};function ik(e,n,t){return t?n?n(e):e:(e&&e.then||(e=Promise.resolve(e)),n?e.then(n):e)}function ix(){}var iC={type:"SKIP_WAITING"};function iE(e,n){if(!n)return e&&e.then?e.then(ix):Promise.resolve()}async function iD(e){let n=await (d??Promise.resolve(void 0));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."}}!function(e){function n(n,t){var r,o;return void 0===t&&(t={}),(r=e.call(this)||this).nn={},r.tn=0,r.rn=new i$,r.en=new i$,r.on=new i$,r.un=0,r.an=new Set,r.cn=function(){var e=r.fn,n=e.installing;r.tn>0||!iA(n.scriptURL,r.sn.toString())||performance.now()>r.un+6e4?(r.vn=n,e.removeEventListener("updatefound",r.cn)):(r.hn=n,r.an.add(n),r.rn.resolve(n)),++r.tn,n.addEventListener("statechange",r.ln)},r.ln=function(e){var n=r.fn,t=e.target,o=t.state,i=t===r.vn,a={sw:t,isExternal:i,originalEvent:e};!i&&r.mn&&(a.isUpdate=!0),r.dispatchEvent(new iw(o,a)),"installed"===o?r.wn=self.setTimeout(function(){"installed"===o&&n.waiting===t&&r.dispatchEvent(new iw("waiting",a))},200):"activating"===o&&(clearTimeout(r.wn),i||r.en.resolve(t))},r.dn=function(e){var n=r.hn,t=n!==navigator.serviceWorker.controller;r.dispatchEvent(new iw("controlling",{isExternal:t,originalEvent:e,sw:n,isUpdate:r.mn})),t||r.on.resolve(n)},o=function(e){var n=e.data,t=e.ports,o=e.source;return ik(r.getSW(),function(){r.an.has(o)&&r.dispatchEvent(new iw("message",{data:n,originalEvent:e,ports:t,sw:o}))})},r.gn=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];try{return Promise.resolve(o.apply(this,e))}catch(e){return Promise.reject(e)}},r.sn=n,r.nn=t,navigator.serviceWorker.addEventListener("message",r.gn),r}n.prototype=Object.create(e.prototype),n.prototype.constructor=n,n.__proto__=e;var t,r=n.prototype;r.register=function(e){var n=(void 0===e?{}:e).immediate,t=void 0!==n&&n;try{var r,o,i,a=this;return r=function(){if(!t&&"complete"!==document.readyState)return iE(new Promise(function(e){return window.addEventListener("load",e)}))},o=function(){return a.mn=!!navigator.serviceWorker.controller,a.yn=a.pn(),ik(a.bn(),function(e){a.fn=e,a.yn&&(a.hn=a.yn,a.en.resolve(a.yn),a.on.resolve(a.yn),a.yn.addEventListener("statechange",a.ln,{once:!0}));var n=a.fn.waiting;return n&&iA(n.scriptURL,a.sn.toString())&&(a.hn=n,Promise.resolve().then(function(){a.dispatchEvent(new iw("waiting",{sw:n,wasWaitingBeforeRegister:!0}))}).then(function(){})),a.hn&&(a.rn.resolve(a.hn),a.an.add(a.hn)),a.fn.addEventListener("updatefound",a.cn),navigator.serviceWorker.addEventListener("controllerchange",a.dn),a.fn})},(i=r())&&i.then?i.then(o):o(i)}catch(e){return Promise.reject(e)}},r.update=function(){try{return this.fn?iE(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 ik(this.getSW(),function(n){return iy(n,e)})}catch(e){return Promise.reject(e)}},r.messageSkipWaiting=function(){this.fn&&this.fn.waiting&&iy(this.fn.waiting,iC)},r.pn=function(){var e=navigator.serviceWorker.controller;return e&&iA(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 ik(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)}},i_(n.prototype,[{key:"active",get:function(){return this.en.promise}},{key:"controlling",get:function(){return this.on.promise}}]),t&&i_(n,t)}(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 iv(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)?iv(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}());let iS="u">typeof globalThis?globalThis:"u">typeof self?self:"u">typeof window?window:global,iM=Object.keys,iz=Array.isArray;function iP(e,n){return"object"!=typeof n||iM(n).forEach(function(t){e[t]=n[t]}),e}"u"<typeof Promise||iS.Promise||(iS.Promise=Promise);let iO=Object.getPrototypeOf,iT={}.hasOwnProperty;function iB(e,n){return iT.call(e,n)}function iI(e,n){"function"==typeof n&&(n=n(iO(e))),("u"<typeof Reflect?iM:Reflect.ownKeys)(n).forEach(t=>{ij(e,t,n[t])})}let iN=Object.defineProperty;function ij(e,n,t,r){iN(e,n,iP(t&&iB(t,"get")&&"function"==typeof t.get?{get:t.get,set:t.set,configurable:!0}:{value:t,configurable:!0,writable:!0},r))}function iR(e){return{from:function(n){return e.prototype=Object.create(n.prototype),ij(e.prototype,"constructor",e),{extend:iI.bind(null,e.prototype)}}}}let iF=Object.getOwnPropertyDescriptor;function iL(e,n){let t;return iF(e,n)||(t=iO(e))&&iL(t,n)}let iW=[].slice;function iV(e,n,t){return iW.call(e,n,t)}function iG(e,n){return n(e)}function iU(e){if(!e)throw Error("Assertion Failed")}function iq(e){iS.setImmediate?setImmediate(e):setTimeout(e,0)}function iH(e,n){return e.reduce((e,t,r)=>{var o=n(t,r);return o&&(e[o[0]]=o[1]),e},{})}function iK(e,n){if("string"==typeof n&&iB(e,n))return e[n];if(!n)return e;if("string"!=typeof n){for(var t=[],r=0,o=n.length;r<o;++r){var i=iK(e,n[r]);t.push(i)}return t}var a=n.indexOf(".");if(-1!==a){var s=e[n.substr(0,a)];return null==s?void 0:iK(s,n.substr(a+1))}}function iY(e,n,t){if(e&&void 0!==n&&(!("isFrozen"in Object)||!Object.isFrozen(e)))if("string"!=typeof n&&"length"in n){iU("string"!=typeof t&&"length"in t);for(var r=0,o=n.length;r<o;++r)iY(e,n[r],t[r])}else{var i=n.indexOf(".");if(-1!==i){var a=n.substr(0,i),s=n.substr(i+1);if(""===s)void 0===t?iz(e)&&!isNaN(parseInt(a))?e.splice(a,1):delete e[a]:e[a]=t;else{var l=e[a];l&&iB(e,a)||(l=e[a]={}),iY(l,s,t)}}else void 0===t?iz(e)&&!isNaN(parseInt(n))?e.splice(n,1):delete e[n]:e[n]=t}}function iJ(e){var n={};for(var t in e)iB(e,t)&&(n[t]=e[t]);return n}let iZ=[].concat;function iX(e){return iZ.apply([],e)}let iQ="BigUint64Array,BigInt64Array,Array,Boolean,String,Date,RegExp,Blob,File,FileList,FileSystemFileHandle,FileSystemDirectoryHandle,ArrayBuffer,DataView,Uint8ClampedArray,ImageBitmap,ImageData,Map,Set,CryptoKey".split(",").concat(iX([8,16,32,64].map(e=>["Int","Uint","Float"].map(n=>n+e+"Array")))).filter(e=>iS[e]),i0=iQ.map(e=>iS[e]);iH(iQ,e=>[e,!0]);let i1=null;function i2(e){i1="u">typeof WeakMap&&new WeakMap;let n=function e(n){if(!n||"object"!=typeof n)return n;let t=i1&&i1.get(n);if(t)return t;if(iz(n)){t=[],i1&&i1.set(n,t);for(var r=0,o=n.length;r<o;++r)t.push(e(n[r]))}else if(i0.indexOf(n.constructor)>=0)t=n;else{let r=iO(n);for(var i in t=r===Object.prototype?{}:Object.create(r),i1&&i1.set(n,t),n)iB(n,i)&&(t[i]=e(n[i]))}return t}(e);return i1=null,n}let{toString:i3}={};function i5(e){return i3.call(e).slice(8,-1)}let i4="u">typeof Symbol?Symbol.iterator:"@@iterator",i6="symbol"==typeof i4?function(e){var n;return null!=e&&(n=e[i4])&&n.apply(e)}:function(){return null},i8={};function i7(e){var n,t,r,o;if(1==arguments.length){if(iz(e))return e.slice();if(this===i8&&"string"==typeof e)return[e];if(o=i6(e)){for(t=[];!(r=o.next()).done;)t.push(r.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 i9="u">typeof Symbol?e=>"AsyncFunction"===e[Symbol.toStringTag]:()=>!1;var ae="u">typeof location&&/^(http|https):\/\/(localhost|127\.0\.0\.1)/.test(location.href),an=()=>!0;let at=!Error("").stack;function ar(){if(at)try{throw ar.arguments,Error()}catch(e){return e}return Error()}function ao(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(an).map(e=>"\n"+e).join("")):""}var ai=["Unknown","Constraint","Data","TransactionInactive","ReadOnly","Version","NotFound","InvalidState","InvalidAccess","Abort","Timeout","QuotaExceeded","Syntax","DataClone"],aa=["Modify","Bulk","OpenFailed","VersionChange","Schema","Upgrade","InvalidTable","MissingAPI","NoSuchDatabase","InvalidArgument","SubTransaction","Unsupported","Internal","DatabaseClosed","PrematureCommit","ForeignAwait"].concat(ai),as={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 al(e,n){this._e=ar(),this.name=e,this.message=n}function ac(e,n){return e+". Errors: "+Object.keys(n).map(e=>n[e].toString()).filter((e,n,t)=>t.indexOf(e)===n).join("\n")}function au(e,n,t,r){this._e=ar(),this.failures=n,this.failedKeys=r,this.successCount=t,this.message=ac(e,n)}function ap(e,n){this._e=ar(),this.name="BulkError",this.failures=Object.keys(n).map(e=>n[e]),this.failuresByPos=n,this.message=ac(e,n)}iR(al).from(Error).extend({stack:{get:function(){return this._stack||(this._stack=this.name+": "+this.message+ao(this._e,2))}},toString:function(){return this.name+": "+this.message}}),iR(au).from(al),iR(ap).from(al);var ad=aa.reduce((e,n)=>(e[n]=n+"Error",e),{}),af=aa.reduce((e,n)=>{var t=n+"Error";function r(e,r){this._e=ar(),this.name=t,e?"string"==typeof e?(this.message=`${e}${r?"\n "+r:""}`,this.inner=r||null):"object"==typeof e&&(this.message=`${e.name} ${e.message}`,this.inner=e):(this.message=as[n]||t,this.inner=null)}return iR(r).from(al),e[n]=r,e},{});af.Syntax=SyntaxError,af.Type=TypeError,af.Range=RangeError;var ah=ai.reduce((e,n)=>(e[n+"Error"]=af[n],e),{}),am=aa.reduce((e,n)=>(-1===["Syntax","Type","Range"].indexOf(n)&&(e[n+"Error"]=af[n]),e),{});function ag(){}function ab(e){return e}function ay(e,n){return null==e||e===ab?n:function(t){return n(e(t))}}function a_(e,n){return function(){e.apply(this,arguments),n.apply(this,arguments)}}function av(e,n){return e===ag?n:function(){var t=e.apply(this,arguments);void 0!==t&&(arguments[0]=t);var r=this.onsuccess,o=this.onerror;this.onsuccess=null,this.onerror=null;var i=n.apply(this,arguments);return r&&(this.onsuccess=this.onsuccess?a_(r,this.onsuccess):r),o&&(this.onerror=this.onerror?a_(o,this.onerror):o),void 0!==i?i:t}}function a$(e,n){return e===ag?n:function(){e.apply(this,arguments);var t=this.onsuccess,r=this.onerror;this.onsuccess=this.onerror=null,n.apply(this,arguments),t&&(this.onsuccess=this.onsuccess?a_(t,this.onsuccess):t),r&&(this.onerror=this.onerror?a_(r,this.onerror):r)}}function aA(e,n){return e===ag?n:function(t){var r=e.apply(this,arguments);iP(t,r);var o=this.onsuccess,i=this.onerror;this.onsuccess=null,this.onerror=null;var a=n.apply(this,arguments);return o&&(this.onsuccess=this.onsuccess?a_(o,this.onsuccess):o),i&&(this.onerror=this.onerror?a_(i,this.onerror):i),void 0===r?void 0===a?void 0:a:iP(r,a)}}function aw(e,n){return e===ag?n:function(){return!1!==n.apply(this,arguments)&&e.apply(this,arguments)}}function ak(e,n){return e===ag?n:function(){var t=e.apply(this,arguments);if(t&&"function"==typeof t.then){for(var r=this,o=arguments.length,i=Array(o);o--;)i[o]=arguments[o];return t.then(function(){return n.apply(r,i)})}return n.apply(this,arguments)}}am.ModifyError=au,am.DexieError=al,am.BulkError=ap;var ax={};let[aC,aE,aD]="u"<typeof Promise?[]:(()=>{let e=Promise.resolve();if("u"<typeof crypto||!crypto.subtle)return[e,iO(e),e];let n=crypto.subtle.digest("SHA-512",new Uint8Array([0]));return[n,iO(n),e]})(),aS=aE&&aE.then,aM=aC&&aC.constructor,az=!!aD;var aP=!1,aO=aD?()=>{aD.then(a0)}:iS.setImmediate?setImmediate.bind(null,a0):iS.MutationObserver?()=>{var e=document.createElement("div");new MutationObserver(()=>{a0(),e=null}).observe(e,{attributes:!0}),e.setAttribute("i","1")}:()=>{setTimeout(a0,0)},aT=function(e,n){aV.push([e,n]),aI&&(aO(),aI=!1)},aB=!0,aI=!0,aN=[],aj=[],aR=null,aF=ab,aL={id:"global",global:!0,ref:0,unhandleds:[],onunhandled:sh,pgp:!1,env:{},finalize:function(){this.unhandleds.forEach(e=>{try{sh(e[0],e[1])}catch(e){}})}},aW=aL,aV=[],aG=0,aU=[];function aq(e){if("object"!=typeof this)throw TypeError("Promises must be constructed via new");this._listeners=[],this.onuncatched=ag,this._lib=!1;var n=this._PSD=aW;if(ae&&(this._stackHolder=ar(),this._prev=null,this._numPrev=0),"function"!=typeof e){if(e!==ax)throw TypeError("Not a function");return this._state=arguments[1],this._value=arguments[2],void(!1===this._state&&aY(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 r=n._lib&&a1();t&&"function"==typeof t.then?e(n,(e,n)=>{t instanceof aq?t._then(e,n):t.then(e,n)}):(n._state=!0,n._value=t,aJ(n)),r&&a2()}},aY.bind(null,n))}catch(e){aY(n,e)}}(this,e)}let aH={get:function(){var e=aW,n=se;function t(t,r){var o=!e.global&&(e!==aW||n!==se);let i=o&&!so();var a=new aq((n,a)=>{aZ(this,new aK(sp(t,e,o,i),sp(r,e,o,i),n,a,e))});return ae&&aQ(a,this),a}return t.prototype=ax,t},set:function(e){ij(this,"then",e&&e.prototype===ax?aH:{get:function(){return e},set:aH.set})}};function aK(e,n,t,r,o){this.onFulfilled="function"==typeof e?e:null,this.onRejected="function"==typeof n?n:null,this.resolve=t,this.reject=r,this.psd=o}function aY(e,n){if(aj.push(n),null===e._state){var t=e._lib&&a1();n=aF(n),e._state=!1,e._value=n,ae&&null!==n&&"object"==typeof n&&!n._promise&&function(e){try{e.apply(null,void 0)}catch(e){}}(()=>{var t=iL(n,"stack");n._promise=e,ij(n,"stack",{get:()=>aP?t&&(t.get?t.get.apply(n):t.value):e.stack})}),aN.some(n=>n._value===e._value)||aN.push(e),aJ(e),t&&a2()}}function aJ(e){var n=e._listeners;e._listeners=[];for(var t=0,r=n.length;t<r;++t)aZ(e,n[t]);var o=e._PSD;--o.ref||o.finalize(),0===aG&&(++aG,aT(()=>{0==--aG&&a3()},[]))}function aZ(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,++aG,aT(aX,[t,e,n])}else e._listeners.push(n)}function aX(e,n,t){try{aR=n;var r,o=n._value;n._state?r=e(o):(aj.length&&(aj=[]),r=e(o),-1===aj.indexOf(o)&&function(e){for(var n=aN.length;n;)if(aN[--n]._value===e._value)return void aN.splice(n,1)}(n)),t.resolve(r)}catch(e){t.reject(e)}finally{aR=null,0==--aG&&a3(),--t.psd.ref||t.psd.finalize()}}function aQ(e,n){var t=n?n._numPrev+1:0;t<100&&(e._prev=n,e._numPrev=t)}function a0(){a1()&&a2()}function a1(){var e=aB;return aB=!1,aI=!1,e}function a2(){var e,n,t;do for(;aV.length>0;)for(e=aV,aV=[],t=e.length,n=0;n<t;++n){var r=e[n];r[0].apply(null,r[1])}while(aV.length>0);aB=!0,aI=!0}function a3(){var e=aN;aN=[],e.forEach(e=>{e._PSD.onunhandled.call(null,e._value,e)});for(var n=aU.slice(0),t=n.length;t;)n[--t]()}function a5(e){return new aq(ax,!1,e)}function a4(e,n){var t=aW;return function(){var r=a1(),o=aW;try{return sl(t,!0),e.apply(this,arguments)}catch(e){n&&n(e)}finally{sl(o,!1),r&&a2()}}}iI(aq.prototype,{then:aH,_then:function(e,n){aZ(this,new aK(null,null,e,n,aW))},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):a5(e)):this.then(null,e=>e&&e.name===n?t(e):a5(e))},finally:function(e){return this.then(n=>(e(),n),n=>(e(),a5(n)))},stack:{get:function(){if(this._stack)return this._stack;try{aP=!0;var e=(function e(n,t,r){if(t.length===r)return t;var o="";if(!1===n._state){var i,a,s=n._value;null!=s?(i=s.name||"Error",a=s.message||s,o=ao(s,0)):(i=s,a=""),t.push(i+(a?": "+a:"")+o)}return ae&&((o=ao(n._stackHolder,2))&&-1===t.indexOf(o)&&t.push(o),n._prev&&e(n._prev,t,r)),t})(this,[],20).join("\nFrom previous: ");return null!==this._state&&(this._stack=e),e}finally{aP=!1}}},timeout:function(e,n){return e<1/0?new aq((t,r)=>{var o=setTimeout(()=>r(new af.Timeout(n)),e);this.then(t,r).finally(clearTimeout.bind(null,o))}):this}}),"u">typeof Symbol&&Symbol.toStringTag&&ij(aq.prototype,Symbol.toStringTag,"Dexie.Promise"),aL.env=sc(),iI(aq,{all:function(){var e=i7.apply(null,arguments).map(si);return new aq(function(n,t){0===e.length&&n([]);var r=e.length;e.forEach((o,i)=>aq.resolve(o).then(t=>{e[i]=t,--r||n(e)},t))})},resolve:e=>{if(e instanceof aq)return e;if(e&&"function"==typeof e.then)return new aq((n,t)=>{e.then(n,t)});var n=new aq(ax,!0,e);return aQ(n,aR),n},reject:a5,race:function(){var e=i7.apply(null,arguments).map(si);return new aq((n,t)=>{e.map(e=>aq.resolve(e).then(n,t))})},PSD:{get:()=>aW,set:e=>aW=e},totalEchoes:{get:()=>se},newPSD:st,usePSD:su,scheduler:{get:()=>aT,set:e=>{aT=e}},rejectionMapper:{get:()=>aF,set:e=>{aF=e}},follow:(e,n)=>new aq((t,r)=>st((n,t)=>{var r=aW;r.unhandleds=[],r.onunhandled=t,r.finalize=a_(function(){var e;e=()=>{0===this.unhandleds.length?n():t(this.unhandleds[0])},aU.push(function n(){e(),aU.splice(aU.indexOf(n),1)}),++aG,aT(()=>{0==--aG&&a3()},[])},r.finalize),e()},n,t,r))}),aM&&(aM.allSettled&&ij(aq,"allSettled",function(){let e=i7.apply(null,arguments).map(si);return new aq(n=>{0===e.length&&n([]);let t=e.length,r=Array(t);e.forEach((e,o)=>aq.resolve(e).then(e=>r[o]={status:"fulfilled",value:e},e=>r[o]={status:"rejected",reason:e}).then(()=>--t||n(r)))})}),aM.any&&"u">typeof AggregateError&&ij(aq,"any",function(){let e=i7.apply(null,arguments).map(si);return new aq((n,t)=>{0===e.length&&t(AggregateError([]));let r=e.length,o=Array(r);e.forEach((e,i)=>aq.resolve(e).then(e=>n(e),e=>{o[i]=e,--r||t(AggregateError(o))}))})}));let a6={awaits:0,echoes:0,id:0};var a8=0,a7=[],a9=0,se=0,sn=0;function st(e,n,t,r){var o=aW,i=Object.create(o);i.parent=o,i.ref=0,i.global=!1,i.id=++sn;var a=aL.env;i.env=az?{Promise:aq,PromiseProp:{value:aq,configurable:!0,writable:!0},all:aq.all,race:aq.race,allSettled:aq.allSettled,any:aq.any,resolve:aq.resolve,reject:aq.reject,nthen:sd(a.nthen,i),gthen:sd(a.gthen,i)}:{},n&&iP(i,n),++o.ref,i.finalize=function(){--this.parent.ref||this.parent.finalize()};var s=su(i,e,t,r);return 0===i.ref&&i.finalize(),s}function sr(){return a6.id||(a6.id=++a8),++a6.awaits,a6.echoes+=100,a6.id}function so(){return!!a6.awaits&&(0==--a6.awaits&&(a6.id=0),a6.echoes=100*a6.awaits,!0)}function si(e){return a6.echoes&&e&&e.constructor===aM?(sr(),e.then(e=>(so(),e),e=>(so(),sm(e)))):e}function sa(e){++se,a6.echoes&&0!=--a6.echoes||(a6.echoes=a6.id=0),a7.push(aW),sl(e,!0)}function ss(){var e=a7[a7.length-1];a7.pop(),sl(e,!1)}function sl(e,n){var t,r=aW;if((n?!a6.echoes||a9++&&e===aW:!a9||--a9&&e===aW)||(t=n?sa.bind(null,e):ss,aS.call(aC,t)),e!==aW&&(aW=e,r===aL&&(aL.env=sc()),az)){var o=aL.env.Promise,i=e.env;aE.then=i.nthen,o.prototype.then=i.gthen,(r.global||e.global)&&(Object.defineProperty(iS,"Promise",i.PromiseProp),o.all=i.all,o.race=i.race,o.resolve=i.resolve,o.reject=i.reject,i.allSettled&&(o.allSettled=i.allSettled),i.any&&(o.any=i.any))}}function sc(){var e=iS.Promise;return az?{Promise:e,PromiseProp:Object.getOwnPropertyDescriptor(iS,"Promise"),all:e.all,race:e.race,allSettled:e.allSettled,any:e.any,resolve:e.resolve,reject:e.reject,nthen:aE.then,gthen:e.prototype.then}:{}}function su(e,n,t,r,o){var i=aW;try{return sl(e,!0),n(t,r,o)}finally{sl(i,!1)}}function sp(e,n,t,r){return"function"!=typeof e?e:function(){var o,i=aW;t&&sr(),sl(n,!0);try{return e.apply(this,arguments)}finally{sl(i,!1),r&&(o=so,aS.call(aC,o))}}}function sd(e,n){return function(t,r){return e.call(this,sp(t,n),sp(r,n))}}-1===(""+aS).indexOf("[native code]")&&(sr=so=ag);let sf="unhandledrejection";function sh(e,n){var t;try{t=n.onuncatched(e)}catch(e){}if(!1!==t)try{var r,o={promise:n,reason:e};if(iS.document&&document.createEvent?((r=document.createEvent("Event")).initEvent(sf,!0,!0),iP(r,o)):iS.CustomEvent&&iP(r=new CustomEvent(sf,{detail:o}),o),r&&iS.dispatchEvent&&(dispatchEvent(r),!iS.PromiseRejectionEvent&&iS.onunhandledrejection))try{iS.onunhandledrejection(r)}catch(e){}ae&&r&&!r.defaultPrevented&&console.warn(`Unhandled rejection: ${e.stack||e}`)}catch(e){}}var sm=aq.reject;let sg="3.2.7",sb=String.fromCharCode(65535),sy=-1/0,s_="Invalid key provided. Keys must be of type string, number, Date or Array<string | number | Date>.",sv="String expected.",s$=[],sA="u">typeof navigator&&/(MSIE|Trident|Edge)/.test(navigator.userAgent),sw=e=>!/(dexie\.js|dexie\.min\.js)/.test(e),sk="__dbnames",sx="readonly",sC="readwrite";function sE(e,n){return e?n?function(){return e.apply(this,arguments)&&n.apply(this,arguments)}:e:n}let sD={type:3,lower:-1/0,lowerOpen:!1,upper:[[]],upperOpen:!1};function sS(e){return"string"!=typeof e||/\./.test(e)?e=>e:n=>(void 0===n[e]&&e in n&&delete(n=i2(n))[e],n)}class sM{_trans(e,n,t){let r=this._tx||aW.trans,o=this.name;function i(e,t,r){if(!r.schema[o])throw new af.NotFound("Table "+o+" not part of transaction");return n(r.idbtrans,r)}let a=a1();try{return r&&r.db===this.db?r===aW.trans?r._promise(e,i,t):st(()=>r._promise(e,i,t),{trans:r,transless:aW.transless||aW}):function e(n,t,r,o){if(n.idbdb&&(n._state.openComplete||aW.letThrough||n._vip)){var i=n._createTransaction(t,r,n._dbSchema);try{i.create(),n._state.PR1398_maxLoop=3}catch(i){return i.name===ad.InvalidState&&n.isOpen()&&--n._state.PR1398_maxLoop>0?(console.warn("Dexie: Need to reopen db"),n._close(),n.open().then(()=>e(n,t,r,o))):sm(i)}return i._promise(t,(e,n)=>st(()=>(aW.trans=i,o(e,n,i)))).then(e=>i._completion.then(()=>e))}if(n._state.openComplete)return sm(new af.DatabaseClosed(n._state.dbOpenError));if(!n._state.isBeingOpened){if(!n._options.autoOpen)return sm(new af.DatabaseClosed);n.open().catch(ag)}return n._state.dbReadyPromise.then(()=>e(n,t,r,o))}(this.db,e,[this.name],i)}finally{a&&a2()}}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(iz(e))return new this.db.WhereClause(this,`[${e.join("+")}]`);let n=iM(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=>{if(e.compound&&n.every(n=>e.keyPath.indexOf(n)>=0)){for(let t=0;t<n.length;++t)if(-1===n.indexOf(e.keyPath[t]))return!1;return!0}return!1}).sort((e,n)=>e.keyPath.length-n.keyPath.length)[0];if(t&&this.db._maxKey!==sb){let r=t.keyPath.slice(0,n.length);return this.where(r).equals(r.map(n=>e[n]))}!t&&ae&&console.warn(`The query ${JSON.stringify(e)} on ${this.name} would benefit of a compound index [${n.join("+")}]`);let{idxByName:r}=this.schema,o=this.db._deps.indexedDB;function i(e,n){try{return 0===o.cmp(e,n)}catch(e){return!1}}let[a,s]=n.reduce(([n,t],o)=>{let a=r[o],s=e[o];return[n||a,n||!a?sE(t,a&&a.multi?e=>{let n=iK(e,o);return iz(n)&&n.some(e=>i(s,e))}:e=>i(s,iK(e,o))):t]},[null,null]);return a?this.where(a.name).equals(e[a.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,iz(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 r in n)if(iB(n,r))try{t[r]=n[r]}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){iP(this,e)})}add(e,n){let{auto:t,keyPath:r}=this.schema.primKey,o=e;return r&&t&&(o=sS(r)(e)),this._trans("readwrite",e=>this.core.mutate({trans:e,type:"add",keys:null!=n?[n]:null,values:[o]})).then(e=>e.numFailures?aq.reject(e.failures[0]):e.lastResult).then(n=>{if(r)try{iY(e,r,n)}catch(e){}return n})}update(e,n){if("object"!=typeof e||iz(e))return this.where(":id").equals(e).modify(n);{let t=iK(e,this.schema.primKey.keyPath);if(void 0===t)return sm(new af.InvalidArgument("Given object does not contain its primary key"));try{"function"!=typeof n?iM(n).forEach(t=>{iY(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:r}=this.schema.primKey,o=e;return r&&t&&(o=sS(r)(e)),this._trans("readwrite",e=>this.core.mutate({trans:e,type:"put",values:[o],keys:null!=n?[n]:null})).then(e=>e.numFailures?aq.reject(e.failures[0]):e.lastResult).then(n=>{if(r)try{iY(e,r,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?aq.reject(e.failures[0]):void 0)}clear(){return this._trans("readwrite",e=>this.core.mutate({trans:e,type:"deleteRange",range:sD})).then(e=>e.numFailures?aq.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 r=Array.isArray(n)?n:void 0,o=(t=t||(r?void 0:n))?t.allKeys:void 0;return this._trans("readwrite",n=>{let{auto:t,keyPath:i}=this.schema.primKey;if(i&&r)throw new af.InvalidArgument("bulkAdd(): keys argument invalid on tables with inbound keys");if(r&&r.length!==e.length)throw new af.InvalidArgument("Arguments objects and keys must have the same length");let a=e.length,s=i&&t?e.map(sS(i)):e;return this.core.mutate({trans:n,type:"add",keys:r,values:s,wantResults:o}).then(({numFailures:e,results:n,lastResult:t,failures:r})=>{if(0===e)return o?n:t;throw new ap(`${this.name}.bulkAdd(): ${e} of ${a} operations failed`,r)})})}bulkPut(e,n,t){let r=Array.isArray(n)?n:void 0,o=(t=t||(r?void 0:n))?t.allKeys:void 0;return this._trans("readwrite",n=>{let{auto:t,keyPath:i}=this.schema.primKey;if(i&&r)throw new af.InvalidArgument("bulkPut(): keys argument invalid on tables with inbound keys");if(r&&r.length!==e.length)throw new af.InvalidArgument("Arguments objects and keys must have the same length");let a=e.length,s=i&&t?e.map(sS(i)):e;return this.core.mutate({trans:n,type:"put",keys:r,values:s,wantResults:o}).then(({numFailures:e,results:n,lastResult:t,failures:r})=>{if(0===e)return o?n:t;throw new ap(`${this.name}.bulkPut(): ${e} of ${a} operations failed`,r)})})}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:r})=>{if(0===e)return t;throw new ap(`${this.name}.bulkDelete(): ${e} of ${n} operations failed`,r)})}}function sz(e){var n={},t=function(t,r){if(r){for(var o=arguments.length,i=Array(o-1);--o;)i[o-1]=arguments[o];return n[t].subscribe.apply(null,i),e}if("string"==typeof t)return n[t]};t.addEventType=i;for(var r=1,o=arguments.length;r<o;++r)i(arguments[r]);return t;function i(e,r,o){if("object"!=typeof e){r||(r=aw),o||(o=ag);var a={subscribers:[],fire:o,subscribe:function(e){-1===a.subscribers.indexOf(e)&&(a.subscribers.push(e),a.fire=r(a.fire,e))},unsubscribe:function(e){a.subscribers=a.subscribers.filter(function(n){return n!==e}),a.fire=a.subscribers.reduce(r,o)}};return n[e]=t[e]=a,a}iM(e).forEach(function(n){var t=e[n];if(iz(t))i(n,e[n][0],e[n][1]);else{if("asap"!==t)throw new af.InvalidArgument("Invalid event config");var r=i(n,ab,function(){for(var e=arguments.length,n=Array(e);e--;)n[e]=arguments[e];r.subscribers.forEach(function(e){iq(function(){e.apply(null,n)})})})}})}}function sP(e,n){return iR(n).from({prototype:e}),n}function sO(e,n){return!(e.filter||e.algorithm||e.or)&&(n?e.justLimit:!e.replayFilter)}function sT(e,n){e.filter=sE(e.filter,n)}function sB(e,n,t){var r=e.replayFilter;e.replayFilter=r?()=>sE(r(),n()):n,e.justLimit=t&&!r}function sI(e,n){if(e.isPrimKey)return n.primaryKey;let t=n.getIndexByKeyPath(e.index);if(!t)throw new af.Schema("KeyPath "+e.index+" on object store "+n.name+" is not indexed");return t}function sN(e,n,t){let r=sI(e,n.schema);return n.openCursor({trans:t,values:!e.keysOnly,reverse:"prev"===e.dir,unique:!!e.unique,query:{index:r,range:e.range}})}function sj(e,n,t,r){let o=e.replayFilter?sE(e.filter,e.replayFilter()):e.filter;if(e.or){let i={},a=(e,t,r)=>{if(!o||o(t,r,e=>t.stop(e),e=>t.fail(e))){var a=t.primaryKey,s=""+a;"[object ArrayBuffer]"===s&&(s=""+new Uint8Array(a)),iB(i,s)||(i[s]=!0,n(e,t,r))}};return Promise.all([e.or._iterate(a,t),sR(sN(e,r,t),e.algorithm,a,!e.keysOnly&&e.valueMapper)])}return sR(sN(e,r,t),sE(e.algorithm,o),n,!e.keysOnly&&e.valueMapper)}function sR(e,n,t,r){var o=a4(r?(e,n,o)=>t(r(e),n,o):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=ag},n=>{e.fail(n),t=ag})||o(e.value,e,e=>t=e),t()})})}function sF(e,n){try{let t=sL(e),r=sL(n);if(t!==r)return"Array"===t?1:"Array"===r?-1:"binary"===t?1:"binary"===r?-1:"string"===t?1:"string"===r?-1:"Date"===t?1:"Date"!==r?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,r=n.length,o=t<r?t:r;for(let t=0;t<o;++t)if(e[t]!==n[t])return e[t]<n[t]?-1:1;return t===r?0:t<r?-1:1}(sW(e),sW(n));case"Array":return function(e,n){let t=e.length,r=n.length,o=t<r?t:r;for(let t=0;t<o;++t){let r=sF(e[t],n[t]);if(0!==r)return r}return t===r?0:t<r?-1:1}(e,n)}}catch(e){}return NaN}function sL(e){let n=typeof e;if("object"!==n)return n;if(ArrayBuffer.isView(e))return"binary";let t=i5(e);return"ArrayBuffer"===t?"binary":t}function sW(e){return e instanceof Uint8Array?e:ArrayBuffer.isView(e)?new Uint8Array(e.buffer,e.byteOffset,e.byteLength):new Uint8Array(e)}class sV{_read(e,n){var t=this._ctx;return t.error?t.table._trans(null,sm.bind(null,t.error)):t.table._trans("readonly",e).then(n)}_write(e){var n=this._ctx;return n.error?n.table._trans(null,sm.bind(null,n.error)):n.table._trans("readwrite",e,"locked")}_addAlgorithm(e){var n=this._ctx;n.algorithm=sE(n.algorithm,e)}_iterate(e,n){return sj(this._ctx,e,n,this._ctx.table.core)}clone(e){var n=Object.create(this.constructor.prototype),t=Object.create(this._ctx);return e&&iP(t,e),n._ctx=t,n}raw(){return this._ctx.valueMapper=null,this}each(e){var n=this._ctx;return this._read(t=>sj(n,e,t,n.table.core))}count(e){return this._read(e=>{let n=this._ctx,t=n.table.core;if(sO(n,!0))return t.count({trans:e,query:{index:sI(n,t.schema),range:n.range}}).then(e=>Math.min(e,n.limit));var r=0;return sj(n,()=>(++r,!1),e,t).then(()=>r)}).then(e)}sortBy(e,n){let t=e.split(".").reverse(),r=t[0],o=t.length-1;function i(e,n){return n?i(e[t[n]],n-1):e[r]}var a="next"===this._ctx.dir?1:-1;function s(e,n){var t=i(e,o),r=i(n,o);return t<r?-a:t>r?a: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&&sO(n,!0)&&n.limit>0){let{valueMapper:t}=n,r=sI(n,n.table.core.schema);return n.table.core.query({trans:e,limit:n.limit,values:!0,query:{index:r,range:n.range}}).then(({result:e})=>t?e.map(t):e)}{let t=[];return sj(n,e=>t.push(e),e,n.table.core).then(()=>t)}},e)}offset(e){var n=this._ctx;return e<=0||(n.offset+=e,sO(n)?sB(n,()=>{var n=e;return(e,t)=>0===n||(1===n?--n:t(()=>{e.advance(n),n=0}),!1)}):sB(n,()=>{var n=e;return()=>--n<0})),this}limit(e){return this._ctx.limit=Math.min(this._ctx.limit,e),sB(this._ctx,()=>{var n=e;return function(e,t,r){return--n<=0&&t(r),n>=0}},!0),this}until(e,n){return sT(this._ctx,function(t,r,o){return!e(t.value)||(r(o),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 sT(this._ctx,function(n){return e(n.value)}),(n=this._ctx).isMatch=sE(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&&sO(n,!0)&&n.limit>0)return this._read(e=>{var t=sI(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 sT(this._ctx,function(e){var n=e.primaryKey.toString(),r=iB(t,n);return t[n]=!0,!r}),this}modify(e){var n=this._ctx;return this._write(t=>{var r;if("function"==typeof e)r=e;else{var o=iM(e),i=o.length;r=function(n){for(var t=!1,r=0;r<i;++r){var a=o[r],s=e[a];iK(n,a)!==s&&(iY(n,a,s),t=!0)}return t}}let a=n.table.core,{outbound:s,extractKey:l}=a.schema.primaryKey,c=this.db._options.modifyChunkSize||200,u=[],p=0,d=[],f=(e,n)=>{let{failures:t,numFailures:r}=n;for(let n of(p+=e-r,iM(t)))u.push(t[n])};return this.clone().primaryKeys().then(o=>{let i=u=>{let p=Math.min(c,o.length-u);return a.getMany({trans:t,keys:o.slice(u,u+p),cache:"immutable"}).then(d=>{let h=[],m=[],g=s?[]:null,b=[];for(let e=0;e<p;++e){let n=d[e],t={value:i2(n),primKey:o[u+e]};!1!==r.call(t,t.value,t)&&(null==t.value?b.push(o[u+e]):s||0===sF(l(n),l(t.value))?(m.push(t.value),s&&g.push(o[u+e])):(b.push(o[u+e]),h.push(t.value)))}let y=sO(n)&&n.limit===1/0&&("function"!=typeof e||e===sG)&&{index:n.index,range:n.range};return Promise.resolve(h.length>0&&a.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(()=>(m.length>0||y&&"object"==typeof e)&&a.mutate({trans:t,type:"put",keys:g,values:m,criteria:y,changeSpec:"function"!=typeof e&&e}).then(e=>f(m.length,e))).then(()=>(b.length>0||y&&e===sG)&&a.mutate({trans:t,type:"delete",keys:b,criteria:y}).then(e=>f(b.length,e))).then(()=>o.length>u+p&&i(u+c))})};return i(0).then(()=>{if(u.length>0)throw new au("Error modifying one or more objects",u,p,d);return o.length})})})}delete(){var e=this._ctx,n=e.range;return sO(e)&&(e.isPrimKey&&!sA||3===n.type)?this._write(t=>{let{primaryKey:r}=e.table.core.schema;return e.table.core.count({trans:t,query:{index:r,range:n}}).then(r=>e.table.core.mutate({trans:t,type:"deleteRange",range:n}).then(({failures:e,lastResult:n,results:t,numFailures:o})=>{if(o)throw new au("Could not delete some values",Object.keys(e).map(n=>e[n]),r-o);return r-o}))}):this.modify(sG)}}let sG=(e,n)=>n.value=null;function sU(e,n){return e<n?-1:+(e!==n)}function sq(e,n){return e>n?-1:+(e!==n)}function sH(e,n,t){var r=e instanceof sX?new e.Collection(e):e;return r._ctx.error=t?new t(n):TypeError(n),r}function sK(e){return new e.Collection(e,()=>sZ("")).limit(0)}function sY(e,n,t,r){var o,i,a,s,l,c,u,p=t.length;if(!t.every(e=>"string"==typeof e))return sH(e,sv);function d(e){o="next"===e?e=>e.toUpperCase():e=>e.toLowerCase(),i="next"===e?e=>e.toLowerCase():e=>e.toUpperCase(),a="next"===e?sU:sq;var n=t.map(function(e){return{lower:i(e),upper:o(e)}}).sort(function(e,n){return a(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?"":r}d("next");var f=new e.Collection(e,()=>sJ(s[0],l[p-1]+r));f._ondirectionchange=function(e){d(e)};var h=0;return f._addAlgorithm(function(e,t,r){var o=e.key;if("string"!=typeof o)return!1;var d=i(o);if(n(d,l,h))return!0;for(var f=null,m=h;m<p;++m){var g=function(e,n,t,r,o,i){for(var a=Math.min(e.length,r.length),s=-1,l=0;l<a;++l){var c=n[l];if(c!==r[l])return 0>o(e[l],t[l])?e.substr(0,l)+t[l]+t.substr(l+1):0>o(e[l],r[l])?e.substr(0,l)+r[l]+t.substr(l+1):s>=0?e.substr(0,s)+n[s]+t.substr(s+1):null;0>o(e[l],c)&&(s=l)}return a<r.length&&"next"===i?e+t.substr(e.length):a<e.length&&"prev"===i?e.substr(0,t.length):s<0?null:e.substr(0,s)+r[s]+t.substr(s+1)}(o,d,s[m],l[m],a,c);null===g&&null===f?h=m+1:(null===f||a(f,g)>0)&&(f=g)}return t(null!==f?function(){e.continue(f+u)}:r),!1}),f}function sJ(e,n,t,r){return{type:2,lower:e,upper:n,lowerOpen:t,upperOpen:r}}function sZ(e){return{type:1,lower:e,upper:e}}class sX{get Collection(){return this._ctx.table.db.Collection}between(e,n,t,r){t=!1!==t,r=!0===r;try{return this._cmp(e,n)>0||0===this._cmp(e,n)&&(t||r)&&(!t||!r)?sK(this):new this.Collection(this,()=>sJ(e,n,!t,!r))}catch(e){return sH(this,s_)}}equals(e){return null==e?sH(this,s_):new this.Collection(this,()=>sZ(e))}above(e){return null==e?sH(this,s_):new this.Collection(this,()=>sJ(e,void 0,!0))}aboveOrEqual(e){return null==e?sH(this,s_):new this.Collection(this,()=>sJ(e,void 0,!1))}below(e){return null==e?sH(this,s_):new this.Collection(this,()=>sJ(void 0,e,!1,!0))}belowOrEqual(e){return null==e?sH(this,s_):new this.Collection(this,()=>sJ(void 0,e))}startsWith(e){return"string"!=typeof e?sH(this,sv):this.between(e,e+sb,!0,!0)}startsWithIgnoreCase(e){return""===e?this.startsWith(e):sY(this,(e,n)=>0===e.indexOf(n[0]),[e],sb)}equalsIgnoreCase(e){return sY(this,(e,n)=>e===n[0],[e],"")}anyOfIgnoreCase(){var e=i7.apply(i8,arguments);return 0===e.length?sK(this):sY(this,(e,n)=>-1!==n.indexOf(e),e,"")}startsWithAnyOfIgnoreCase(){var e=i7.apply(i8,arguments);return 0===e.length?sK(this):sY(this,(e,n)=>n.some(n=>0===e.indexOf(n)),e,sb)}anyOf(){let e=i7.apply(i8,arguments),n=this._cmp;try{e.sort(n)}catch(e){return sH(this,s_)}if(0===e.length)return sK(this);let t=new this.Collection(this,()=>sJ(e[0],e[e.length-1]));t._ondirectionchange=t=>{n="next"===t?this._ascending:this._descending,e.sort(n)};let r=0;return t._addAlgorithm((t,o,i)=>{let a=t.key;for(;n(a,e[r])>0;)if(++r===e.length)return o(i),!1;return 0===n(a,e[r])||(o(()=>{t.continue(e[r])}),!1)}),t}notEqual(e){return this.inAnyRange([[sy,e],[e,this.db._maxKey]],{includeLowers:!1,includeUppers:!1})}noneOf(){let e=i7.apply(i8,arguments);if(0===e.length)return new this.Collection(this);try{e.sort(this._ascending)}catch(e){return sH(this,s_)}let n=e.reduce((e,n)=>e?e.concat([[e[e.length-1][1],n]]):[[sy,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,r=this._ascending,o=this._descending,i=this._min,a=this._max;if(0===e.length)return sK(this);if(!e.every(e=>void 0!==e[0]&&void 0!==e[1]&&0>=r(e[0],e[1])))return sH(this,"First argument to inAnyRange() must be an Array of two-value Arrays [lower,upper] where upper must not be lower than lower",af.InvalidArgument);let s=!n||!1!==n.includeLowers,l=n&&!0===n.includeUppers,c,u=r;function p(e,n){return u(e[0],n[0])}try{(c=e.reduce(function(e,n){let r=0,o=e.length;for(;r<o;++r){let o=e[r];if(0>t(n[0],o[1])&&t(n[1],o[0])>0){o[0]=i(o[0],n[0]),o[1]=a(o[1],n[1]);break}}return r===o&&e.push(n),e},[])).sort(p)}catch(e){return sH(this,s_)}let d=0,f=l?e=>r(e,c[d][1])>0:e=>r(e,c[d][1])>=0,h=s?e=>o(e,c[d][0])>0:e=>o(e,c[d][0])>=0,m=f,g=new this.Collection(this,()=>sJ(c[0][0],c[c.length-1][1],!s,!l));return g._ondirectionchange=e=>{"next"===e?(m=f,u=r):(m=h,u=o),c.sort(p)},g._addAlgorithm((e,n,t)=>{for(var o=e.key;m(o);)if(++d===c.length)return n(t),!1;return!!(!f(o)&&!h(o))||(0===this._cmp(o,c[d][1])||0===this._cmp(o,c[d][0])||n(()=>{u===r?e.continue(c[d][0]):e.continue(c[d][1])}),!1)}),g}startsWithAnyOf(){let e=i7.apply(i8,arguments);return e.every(e=>"string"==typeof e)?0===e.length?sK(this):this.inAnyRange(e.map(e=>[e,e+sb])):sH(this,"startsWithAnyOf() only works with strings")}}function sQ(e){return a4(function(n){return s0(n),e(n.target.error),!1})}function s0(e){e.stopPropagation&&e.stopPropagation(),e.preventDefault&&e.preventDefault()}let s1="storagemutated",s2="x-storagemutated-1",s3=sz(null,s1);class s5{_lock(){return iU(!aW.global),++this._reculock,1!==this._reculock||aW.global||(aW.lockOwnerFor=this),this}_unlock(){if(iU(!aW.global),0==--this._reculock)for(aW.global||(aW.lockOwnerFor=null);this._blockedFuncs.length>0&&!this._locked();){var e=this._blockedFuncs.shift();try{su(e[1],e[0])}catch(e){}}return this}_locked(){return this._reculock&&aW.lockOwnerFor!==this}create(e){if(!this.mode)return this;let n=this.db.idbdb,t=this.db._state.dbOpenError;if(iU(!this.idbtrans),!e&&!n)switch(t&&t.name){case"DatabaseClosedError":throw new af.DatabaseClosed(t);case"MissingAPIError":throw new af.MissingAPI(t.message,t);default:throw new af.OpenFailed(t)}if(!this.active)throw new af.TransactionInactive;return iU(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=a4(n=>{s0(n),this._reject(e.error)}),e.onabort=a4(n=>{s0(n),this.active&&this._reject(new af.Abort(e.error)),this.active=!1,this.on("abort").fire(n)}),e.oncomplete=a4(()=>{this.active=!1,this._resolve(),"mutatedParts"in e&&s3.storagemutated.fire(e.mutatedParts)}),this}_promise(e,n,t){if("readwrite"===e&&"readwrite"!==this.mode)return sm(new af.ReadOnly("Transaction is readonly"));if(!this.active)return sm(new af.TransactionInactive);if(this._locked())return new aq((r,o)=>{this._blockedFuncs.push([()=>{this._promise(e,n,t).then(r,o)},aW])});if(t)return st(()=>{var e=new aq((e,t)=>{this._lock();let r=n(e,t,this);r&&r.then&&r.then(e,t)});return e.finally(()=>this._unlock()),e._lib=!0,e});var r=new aq((e,t)=>{var r=n(e,t,this);r&&r.then&&r.then(e,t)});return r._lib=!0,r}_root(){return this.parent?this.parent._root():this}waitFor(e){var n=this._root();let t=aq.resolve(e);if(n._waitingFor)n._waitingFor=n._waitingFor.then(()=>t);else{n._waitingFor=t,n._waitingQueue=[];var r=n.idbtrans.objectStore(n.storeNames[0]);!function e(){for(++n._spinCount;n._waitingQueue.length;)n._waitingQueue.shift()();n._waitingFor&&(r.get(-1/0).onsuccess=e)}()}var o=n._waitingFor;return new aq((e,r)=>{t.then(t=>n._waitingQueue.push(a4(e.bind(null,t))),e=>n._waitingQueue.push(a4(r.bind(null,e)))).finally(()=>{n._waitingFor===o&&(n._waitingFor=null)})})}abort(){this.active&&(this.active=!1,this.idbtrans&&this.idbtrans.abort(),this._reject(new af.Abort))}table(e){let n=this._memoizedTables||(this._memoizedTables={});if(iB(n,e))return n[e];let t=this.schema[e];if(!t)throw new af.NotFound("Table "+e+" not part of transaction");let r=new this.db.Table(e,t,this);return r.core=this.db.core.table(e),n[e]=r,r}}function s4(e,n,t,r,o,i,a){return{name:e,keyPath:n,unique:t,multi:r,auto:o,compound:i,src:(t&&!a?"&":"")+(r?"*":"")+(o?"++":"")+s6(n)}}function s6(e){return"string"==typeof e?e:e?"["+[].join.call(e,"+")+"]":""}function s8(e,n,t){return{name:e,primKey:n,indexes:t,mappedClass:null,idxByName:iH(t,e=>[e.name,e])}}let s7=e=>{try{return e.only([[]]),s7=()=>[[]],[[]]}catch(e){return s7=()=>sb,sb}};function s9(e){return null==e?()=>{}:"string"==typeof e?1===e.split(".").length?n=>n[e]:n=>iK(n,e):n=>iK(n,e)}function le(e){return[].slice.call(e)}let ln=0;function lt(e){return null==e?":id":"string"==typeof e?e:`[${e.join("+")}]`}function lr({_novip:e},n){let t=n.db,r=function(e,n,{IDBKeyRange:t,indexedDB:r},o){var i;return{dbcore:(i=function(e,n,t){let r;function o(e){if(3===e.type)return null;if(4===e.type)throw Error("Cannot convert never type to IDBKeyRange");let{lower:t,upper:r,lowerOpen:o,upperOpen:i}=e;return void 0===t?void 0===r?null:n.upperBound(r,!!i):void 0===r?n.lowerBound(t,!!o):n.bound(t,r,!!o,!!i)}let{schema:i,hasGetAll:a}=(r=le(e.objectStoreNames),{schema:{name:e.name,tables:r.map(e=>t.objectStore(e)).map(e=>{let{keyPath:n,autoIncrement:t}=e,r=iz(n),o=null==n,i={},a={name:e.name,primaryKey:{name:null,isPrimaryKey:!0,outbound:o,compound:r,keyPath:n,autoIncrement:t,unique:!0,extractKey:s9(n)},indexes:le(e.indexNames).map(n=>e.index(n)).map(e=>{let{name:n,unique:t,multiEntry:r,keyPath:o}=e,a={name:n,compound:iz(o),keyPath:o,unique:t,multiEntry:r,extractKey:s9(o)};return i[lt(o)]=a,a}),getIndexByKeyPath:e=>i[lt(e)]};return i[":id"]=a.primaryKey,null!=n&&(i[lt(n)]=a.primaryKey),a})},hasGetAll:r.length>0&&"getAll"in t.objectStore(r[0])&&!("u">typeof navigator&&/Safari/.test(navigator.userAgent)&&!/(Chrome\/|Edge\/)/.test(navigator.userAgent)&&[].concat(navigator.userAgent.match(/Safari\/(\d*)/))[1]<604)}),s=i.tables.map(e=>{let n;return{name:n=e.name,schema:e,mutate:function({trans:e,type:t,keys:r,values:i,range:a}){return new Promise((s,l)=>{let c;s=a4(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}=r||i||{length:1};if(r&&i&&r.length!==i.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=[],m=[],g=0,b=e=>{++g,s0(e)};if("deleteRange"===t){if(4===a.type)return s({numFailures:g,failures:m,results:[],lastResult:void 0});3===a.type?h.push(c=u.clear()):h.push(c=u.delete(o(a)))}else{let[e,n]=d?p?[i,r]:[i,null]:[r,null];if(d)for(let r=0;r<f;++r)h.push(c=n&&void 0!==n[r]?u[t](e[r],n[r]):u[t](e[r])),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&&(m[n]=e.error)),s({numFailures:g,failures:m,results:"delete"===t?r:h.map(e=>e.result),lastResult:n})};c.onerror=e=>{b(e),y(e)},c.onsuccess=y})},getMany:({trans:e,keys:t})=>new Promise((r,o)=>{r=a4(r);let i=e.objectStore(n),a=t.length,s=Array(a),l,c=0,u=0,p=e=>{let n=e.target;s[n._pos]=n.result,++u===c&&r(s)},d=sQ(o);for(let e=0;e<a;++e)null!=t[e]&&((l=i.get(t[e]))._pos=e,l.onsuccess=p,l.onerror=d,++c);0===c&&r(s)}),get:({trans:e,key:t})=>new Promise((r,o)=>{r=a4(r);let i=e.objectStore(n).get(t);i.onsuccess=e=>r(e.target.result),i.onerror=sQ(o)}),query:e=>new Promise((t,r)=>{t=a4(t);let{trans:i,values:s,limit:l,query:c}=e,u=l===1/0?void 0:l,{index:p,range:d}=c,f=i.objectStore(n),h=p.isPrimaryKey?f:f.index(p.name),m=o(d);if(0===l)return t({result:[]});if(a){let e=s?h.getAll(m,u):h.getAllKeys(m,u);e.onsuccess=e=>t({result:e.target.result}),e.onerror=sQ(r)}else{let e=0,n=!s&&"openKeyCursor"in h?h.openKeyCursor(m):h.openCursor(m),o=[];n.onsuccess=r=>{let i=n.result;return i?(o.push(s?i.value:i.primaryKey),++e===l?t({result:o}):void i.continue()):t({result:o})},n.onerror=sQ(r)}}),openCursor:function({trans:e,values:t,query:r,reverse:i,unique:a}){return new Promise((s,l)=>{s=a4(s);let{index:c,range:u}=r,p=e.objectStore(n),d=c.isPrimaryKey?p:p.index(c.name),f=i?a?"prevunique":"prev":a?"nextunique":"next",h=!t&&"openKeyCursor"in d?d.openKeyCursor(o(u),f):d.openCursor(o(u),f);h.onerror=sQ(l),h.onsuccess=a4(n=>{let t=h.result;if(!t)return void s(null);t.___id=++ln,t.done=!1;let r=t.continue.bind(t),o=t.continuePrimaryKey;o&&(o=o.bind(t));let i=t.advance.bind(t),a=()=>{throw Error("Cursor not stopped")};t.trans=e,t.stop=t.continue=t.continuePrimaryKey=t.advance=()=>{throw Error("Cursor not started")},t.fail=a4(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=a4(e),h.onerror=sQ(n),t.fail=n,t.stop=n=>{t.stop=t.continue=t.continuePrimaryKey=t.advance=a,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=a4(e=>{h.onsuccess=s,s()}),t.continue=r,t.continuePrimaryKey=o,t.advance=i,s(),n},s(t)},l)})},count({query:e,trans:t}){let{index:r,range:i}=e;return new Promise((e,a)=>{let s=t.objectStore(n),l=r.isPrimaryKey?s:s.index(r.name),c=o(i),u=c?l.count(c):l.count();u.onsuccess=a4(n=>e(n.target.result)),u.onerror=sQ(a)})}}}),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:s7(n),schema:i}}(n,t,o),e.dbcore.reduce((e,{create:n})=>({...e,...n(e)}),i))}}(e._middlewares,t,e._deps,n);e.core=r.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 lo({_novip:e},n,t,r){t.forEach(t=>{let o=r[t];n.forEach(n=>{let r=iL(n,t);(!r||"value"in r&&void 0===r.value)&&(n===e.Transaction.prototype||n instanceof e.Transaction?ij(n,t,{get(){return this.table(t)},set(e){iN(this,t,{value:e,writable:!0,configurable:!0,enumerable:!0})}}):n[t]=new e.Table(t,o))})})}function li({_novip:e},n){n.forEach(n=>{for(let t in n)n[t]instanceof e.Table&&delete n[t]})}function la(e,n){return e._cfg.version-n._cfg.version}function ls(e,n){let t,r={del:[],add:[],change:[]};for(t in e)n[t]||r.del.push(t);for(t in n){let o=e[t],i=n[t];if(o){let e={name:t,def:i,recreate:!1,del:[],add:[],change:[]};if(""+(o.primKey.keyPath||"")==""+(i.primKey.keyPath||"")&&(o.primKey.auto===i.primKey.auto||sA)){let n,t=o.idxByName,a=i.idxByName;for(n in t)a[n]||e.del.push(n);for(n in a){let r=t[n],o=a[n];r?r.src!==o.src&&e.change.push(o):e.add.push(o)}(e.del.length>0||e.add.length>0||e.change.length>0)&&r.change.push(e)}else e.recreate=!0,r.change.push(e)}else r.add.push([t,i])}return r}function ll(e,n,t,r){let o=e.db.createObjectStore(n,t.keyPath?{keyPath:t.keyPath,autoIncrement:t.auto}:{autoIncrement:t.auto});return r.forEach(e=>lc(o,e)),o}function lc(e,n){e.createIndex(n.name,n.keyPath,{unique:n.unique,multiEntry:n.multi})}function lu(e,n,t){let r={};return iV(n.objectStoreNames,0).forEach(e=>{let n=t.objectStore(e),o=n.keyPath,i=s4(s6(o),o||"",!1,!1,!!n.autoIncrement,o&&"string"!=typeof o,!0),a=[];for(let e=0;e<n.indexNames.length;++e){let t=n.index(n.indexNames[e]);o=t.keyPath;var s=s4(t.name,o,!!t.unique,!!t.multiEntry,!1,o&&"string"!=typeof o,!1);a.push(s)}r[e]=s8(e,i,a)}),r}function lp({_novip:e},n,t){let r=t.db.objectStoreNames;for(let o=0;o<r.length;++o){let i=r[o],a=t.objectStore(i);e._hasGetAll="getAll"in a;for(let e=0;e<a.indexNames.length;++e){let t=a.indexNames[e],r=a.index(t).keyPath,o="string"==typeof r?r:"["+iV(r).join("+")+"]";if(n[i]){let e=n[i].idxByName[o];e&&(e.name=t,delete n[i].idxByName[o],n[i].idxByName[t]=e)}}}"u">typeof navigator&&/Safari/.test(navigator.userAgent)&&!/(Chrome\/|Edge\/)/.test(navigator.userAgent)&&iS.WorkerGlobalScope&&iS instanceof iS.WorkerGlobalScope&&[].concat(navigator.userAgent.match(/Safari\/(\d*)/))[1]<604&&(e._hasGetAll=!1)}class ld{_parseStoresSpec(e,n){iM(e).forEach(t=>{if(null!==e[t]){var r=e[t].split(",").map((e,n)=>{let t=(e=e.trim()).replace(/([&*]|\+\+)/g,""),r=/^\[/.test(t)?t.match(/^\[(.*)\]$/)[1].split("+"):t;return s4(t,r||null,/\&/.test(e),/\*/.test(e),/\+\+/.test(e),iz(r),0===n)}),o=r.shift();if(o.multi)throw new af.Schema("Primary key cannot be multi-valued");r.forEach(e=>{if(e.auto)throw new af.Schema("Only primary key can be marked as autoIncrement (++)");if(!e.keyPath)throw new af.Schema("Index must have a name and cannot be an empty string")}),n[t]=s8(t,o,r)}})}stores(e){let n=this.db;this._cfg.storesSource=this._cfg.storesSource?iP(this._cfg.storesSource,e):e;let t=n._versions,r={},o={};return t.forEach(e=>{iP(r,e._cfg.storesSource),o=e._cfg.dbschema={},e._parseStoresSpec(r,o)}),n._dbSchema=o,li(n,[n._allTables,n,n.Transaction.prototype]),lo(n,[n._allTables,n,n.Transaction.prototype,this._cfg.tables],iM(o),o),n._storeNames=iM(o),this}upgrade(e){return this._cfg.contentUpgrade=ak(this._cfg.contentUpgrade||ag,e),this}}function lf(e,n){let t=e._dbNamesDB;return t||(t=e._dbNamesDB=new lP(sk,{addons:[],indexedDB:e,IDBKeyRange:n})).version(1).stores({dbnames:"name"}),t.table("dbnames")}function lh(e){return e&&"function"==typeof e.databases}function lm(e){return st(function(){return aW.letThrough=!0,e()})}function lg(e){var n=n=>e.next(n),t=o(n),r=o(n=>e.throw(n));function o(e){return n=>{var o=e(n),i=o.value;return o.done?i:i&&"function"==typeof i.then?i.then(t,r):iz(i)?Promise.all(i).then(t,r):t(i)}}return o(n)()}function lb(e,n,t){var r=arguments.length;if(r<2)throw new af.InvalidArgument("Too few arguments");for(var o=Array(r-1);--r;)o[r-1]=arguments[r];return t=o.pop(),[e,iX(o),t]}function ly(e,n,t){let r=iz(e)?e.slice():[e];for(let e=0;e<t;++e)r.push(n);return r}let l_={stack:"dbcore",name:"VirtualIndexMiddleware",level:1,create:function(e){return{...e,table(n){let t=e.table(n),{schema:r}=t,o={},i=[];function a(e,n,t){let r=lt(e),s=o[r]=o[r]||[],l=null==e?0:"string"==typeof e?1:e.length,c=n>0,u={...t,isVirtual:c,keyTail:n,keyLength:l,extractKey:s9(e),unique:!c&&t.unique};return s.push(u),u.isPrimaryKey||i.push(u),l>1&&a(2===l?e[0]:e.slice(0,l-1),n+1,t),s.sort((e,n)=>e.keyTail-n.keyTail),u}let s=a(r.primaryKey.keyPath,0,r.primaryKey);for(let e of(o[":id"]=[s],r.indexes))a(e.keyPath,0,e);function l(n){var t,r;let o=n.query.index;return o.isVirtual?{...n,query:{index:o,range:(t=n.query.range,r=o.keyTail,{type:1===t.type?2:t.type,lower:ly(t.lower,t.lowerOpen?e.MAX_KEY:e.MIN_KEY,r),lowerOpen:!0,upper:ly(t.upper,t.upperOpen?e.MIN_KEY:e.MAX_KEY,r),upperOpen:!0})}}:n}return{...t,schema:{...r,primaryKey:s,indexes:i,getIndexByKeyPath:function(e){let n=o[lt(e)];return n&&n[0]}},count:e=>t.count(l(e)),query:e=>t.query(l(e)),openCursor(n){let{keyTail:r,isVirtual:o,keyLength:i}=n.query.index;return o?t.openCursor(l(n)).then(t=>t&&Object.create(t,{continue:{value:function(o){null!=o?t.continue(ly(o,n.reverse?e.MAX_KEY:e.MIN_KEY,r)):n.unique?t.continue(t.key.slice(0,i).concat(n.reverse?e.MIN_KEY:e.MAX_KEY,r)):t.continue()}},continuePrimaryKey:{value(n,o){t.continuePrimaryKey(ly(n,e.MAX_KEY,r),o)}},primaryKey:{get:()=>t.primaryKey},key:{get(){let e=t.key;return 1===i?e[0]:e.slice(0,i)}},value:{get:()=>t.value}})):t.openCursor(n)}}}}}};function lv(e,n,t,r){return t=t||{},r=r||"",iM(e).forEach(o=>{if(iB(n,o)){var i=e[o],a=n[o];if("object"==typeof i&&"object"==typeof a&&i&&a){let e=i5(i);e!==i5(a)?t[r+o]=n[o]:"Object"===e?lv(i,a,t,r+o+"."):i!==a&&(t[r+o]=n[o])}else i!==a&&(t[r+o]=n[o])}else t[r+o]=void 0}),iM(n).forEach(o=>{iB(e,o)||(t[r+o]=n[o])}),t}let l$={stack:"dbcore",name:"HooksMiddleware",level:2,create:e=>({...e,table(n){let t=e.table(n),{primaryKey:r}=t.schema;return{...t,mutate(e){let o=aW.trans,{deleting:i,creating:a,updating:s}=o.table(n).hook;switch(e.type){case"add":if(a.fire===ag)break;return o._promise("readwrite",()=>l(e),!0);case"put":if(a.fire===ag&&s.fire===ag)break;return o._promise("readwrite",()=>l(e),!0);case"delete":if(i.fire===ag)break;return o._promise("readwrite",()=>l(e),!0);case"deleteRange":if(i.fire===ag)break;return o._promise("readwrite",()=>(function e(n,o,i){return t.query({trans:n,values:!1,query:{index:r,range:o},limit:i}).then(({result:t})=>l({type:"delete",keys:t,trans:n}).then(r=>r.numFailures>0?Promise.reject(r.failures[0]):t.length<i?{failures:[],numFailures:0,lastResult:void 0}:e(n,{...o,lower:t[t.length-1],lowerOpen:!0},i)))})(e.trans,e.range,1e4),!0)}return t.mutate(e);function l(e){var n,o;let l=aW.trans,c=e.keys||("delete"===(n=e).type?n.keys:n.keys||n.values.map(r.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"===(o=e).type?Promise.resolve([]):t.getMany({trans:o.trans,keys:c,cache:"immutable"})).then(n=>{let o=c.map((t,o)=>{let c=n[o],u={onerror:null,onsuccess:null};if("delete"===e.type)i.fire.call(u,t,c,l);else if("add"===e.type||void 0===c){let n=a.fire.call(u,t,e.values[o],l);null==t&&null!=n&&(t=n,e.keys[o]=t,r.outbound||iY(e.values[o],r.keyPath,t))}else{let n=lv(c,e.values[o]),r=s.fire.call(u,n,t,c,l);if(r){let n=e.values[o];Object.keys(r).forEach(e=>{iB(n,e)?n[e]=r[e]:iY(n,e,r[e])})}}return u});return t.mutate(e).then(({failures:t,results:r,numFailures:i,lastResult:a})=>{for(let i=0;i<c.length;++i){let a=r?r[i]:c[i],s=o[i];null==a?s.onerror&&s.onerror(t[i]):s.onsuccess&&s.onsuccess("put"===e.type&&n[i]?e.values[i]:a)}return{failures:t,results:r,numFailures:i,lastResult:a}}).catch(e=>(o.forEach(n=>n.onerror&&n.onerror(e)),Promise.reject(e)))})}}}}})};function lA(e,n,t){try{if(!n||n.keys.length<e.length)return null;let r=[];for(let o=0,i=0;o<n.keys.length&&i<e.length;++o)0===sF(n.keys[o],e[i])&&(r.push(t?i2(n.values[o]):n.values[o]),++i);return r.length===e.length?r:null}catch(e){return null}}let lw={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=lA(e.keys,e.trans._cache,"clone"===e.cache);return n?aq.resolve(n):t.getMany(e).then(n=>(e.trans._cache={keys:e.keys,values:"clone"===e.cache?i2(n):n},n))},mutate:e=>("add"!==e.type&&(e.trans._cache=null),t.mutate(e))}}})};function lk(e){return!("from"in e)}let lx=function(e,n){if(!this){let n=new lx;return e&&"d"in e&&iP(n,e),n}iP(this,arguments.length?{d:1,from:e,to:arguments.length>1?n:e}:{d:0})};function lC(e,n,t){let r=sF(n,t);if(isNaN(r))return;if(r>0)throw RangeError();if(lk(e))return iP(e,{from:n,to:t,d:1});let o=e.l,i=e.r;if(0>sF(t,e.from))return o?lC(o,n,t):e.l={from:n,to:t,d:1,l:null,r:null},lS(e);if(sF(n,e.to)>0)return i?lC(i,n,t):e.r={from:n,to:t,d:1,l:null,r:null},lS(e);0>sF(n,e.from)&&(e.from=n,e.l=null,e.d=i?i.d+1:1),sF(t,e.to)>0&&(e.to=t,e.r=null,e.d=e.l?e.l.d+1:1);let a=!e.r;o&&!e.l&&lE(e,o),i&&a&&lE(e,i)}function lE(e,n){lk(n)||function e(n,{from:t,to:r,l:o,r:i}){lC(n,t,r),o&&e(n,o),i&&e(n,i)}(e,n)}function lD(e){let n=lk(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>sF(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>=sF(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 lS(e){var n,t;let r=((null==(n=e.r)?void 0:n.d)||0)-((null==(t=e.l)?void 0:t.d)||0),o=r>1?"r":r<-1?"l":"";if(o){let n="r"===o?"l":"r",t={...e},r=e[o];e.from=r.from,e.to=r.to,e[o]=r[o],t[o]=r[n],e[n]=t,t.d=lM(t)}e.d=lM(e)}function lM({r:e,l:n}){return(e?n?Math.max(e.d,n.d):e.d:n?n.d:0)+1}iI(lx.prototype,{add(e){return lE(this,e),this},addKey(e){return lC(this,e,e),this},addKeys(e){return e.forEach(e=>lC(this,e,e)),this},[i4](){return lD(this)}});let lz={stack:"dbcore",level:0,create:e=>{let n=e.schema.name,t=new lx(e.MIN_KEY,e.MAX_KEY);return{...e,table:r=>{let o=e.table(r),{schema:i}=o,{primaryKey:a}=i,{extractKey:s,outbound:l}=a,c={...o,mutate:e=>{let a=e.trans,s=a.mutatedParts||(a.mutatedParts={}),l=e=>{let t=`idb://${n}/${r}/${e}`;return s[t]||(s[t]=new lx)},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 o.mutate(e).then(e=>{if(iz(d)){"delete"!==p&&(d=e.results),c.addKeys(d);let n=lA(d,h);n||"add"===p||u.addKeys(d),(n||f)&&i.indexes.forEach(function(e){let t=l(e.name||"");function r(n){return null!=n?e.extractKey(n):null}let o=n=>e.multiEntry&&iz(n)?n.forEach(e=>t.addKey(e)):t.addKey(n);(n||f).forEach((e,t)=>{let i=n&&r(n[t]),a=f&&r(f[t]);0!==sF(i,a)&&(null!=i&&o(i),null!=a&&o(a))})})}else if(d){let e={from:d.lower,to:d.upper};u.add(e),c.add(e)}else c.add(t),u.add(t),i.indexes.forEach(e=>l(e.name).add(t));return e})}},u=({query:{index:n,range:t}})=>{var r,o;return[n,new lx(null!=(r=t.lower)?r:e.MIN_KEY,null!=(o=t.upper)?o:e.MAX_KEY)]},p={get:e=>[a,new lx(e.key)],getMany:e=>[a,(new lx).addKeys(e.keys)],count:u,query:u,openCursor:u};return iM(p).forEach(e=>{c[e]=function(i){let{subscr:a}=aW;if(a){let c=e=>{let t=`idb://${n}/${r}/${e}`;return a[t]||(a[t]=new lx)},u=c(""),d=c(":dels"),[f,h]=p[e](i);if(c(f.name||"").add(h),!f.isPrimaryKey){if("count"!==e){let n="query"===e&&l&&i.values&&o.query({...i,values:!1});return o[e].apply(this,arguments).then(t=>{if("query"===e){if(l&&i.values)return n.then(({result:e})=>(u.addKeys(e),t));let e=i.values?t.result.map(s):t.result;i.values?u.addKeys(e):d.addKeys(e)}else if("openCursor"===e){let e=i.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 o[e].apply(this,arguments)}}),c}}}};class lP{constructor(e,n){var t;this._middlewares={},this.verno=0;const r=lP.dependencies;this._options=n={addons:lP.addons,autoOpen:!0,indexedDB:r.indexedDB,IDBKeyRange:r.IDBKeyRange,...n},this._deps={indexedDB:n.indexedDB,IDBKeyRange:n.IDBKeyRange};const{addons:o}=n;this._dbSchema={},this._versions=[],this._storeNames=[],this._allTables={},this.idbdb=null,this._novip=this;const i={dbOpenError:null,isBeingOpened:!1,onReadyBeingFired:null,openComplete:!1,dbReadyResolve:ag,dbReadyPromise:null,cancelOpen:ag,openCanceller:null,autoSchema:!0,PR1398_maxLoop:3};i.dbReadyPromise=new aq(e=>{i.dbReadyResolve=e}),i.openCanceller=new aq((e,n)=>{i.cancelOpen=n}),this._state=i,this.name=e,this.on=sz(this,"populate","blocked","versionchange","close",{ready:[ak,ag]}),this.on.ready.subscribe=iG(this.on.ready.subscribe,e=>(n,t)=>{lP.vip(()=>{let r=this._state;if(r.openComplete)r.dbOpenError||aq.resolve().then(n),t&&e(n);else if(r.onReadyBeingFired)r.onReadyBeingFired.push(n),t&&e(n);else{e(n);let r=this;t||e(function e(){r.on.ready.unsubscribe(n),r.on.ready.unsubscribe(e)})}})}),this.Collection=(t=this,sP(sV.prototype,function(e,n){this.db=t;let r=sD,o=null;if(n)try{r=n()}catch(e){o=e}let i=e._ctx,a=i.table,s=a.hook.reading.fire;this._ctx={table:a,index:i.index,isPrimKey:!i.index||a.schema.primKey.keyPath&&i.index===a.schema.primKey.name,range:r,keysOnly:!1,dir:"next",unique:"",algorithm:null,filter:null,replayFilter:null,justLimit:!0,isMatch:null,offset:0,limit:1/0,error:o,or:i.or,valueMapper:s!==ab?s:null}})),this.Table=function(e){return sP(sM.prototype,function(n,t,r){this.db=e,this._tx=r,this.name=n,this.schema=t,this.hook=e._allTables[n]?e._allTables[n].hook:sz(null,{creating:[av,ag],reading:[ay,ab],updating:[aA,ag],deleting:[a$,ag]})})}(this),this.Transaction=function(e){return sP(s5.prototype,function(n,t,r,o,i){this.db=e,this.mode=n,this.storeNames=t,this.schema=r,this.chromeTransactionDurability=o,this.idbtrans=null,this.on=sz(this,"complete","error","abort"),this.parent=i||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 aq((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(),sm(e)})})}(this),this.Version=function(e){return sP(ld.prototype,function(n){this.db=e,this._cfg={version:n,storesSource:null,dbschema:{},tables:{},contentUpgrade:null}})}(this),this.WhereClause=function(e){return sP(sX.prototype,function(n,t,r){this.db=e,this._ctx={table:n,index:":id"===t?null:t,or:r};let o=e._deps.indexedDB;if(!o)throw new af.MissingAPI;this._cmp=this._ascending=o.cmp.bind(o),this._descending=(e,n)=>o.cmp(n,e),this._max=(e,n)=>o.cmp(e,n)>0?e:n,this._min=(e,n)=>0>o.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=s7(n.IDBKeyRange),this._createTransaction=(e,n,t,r)=>new this.Transaction(e,n,t,this._options.chromeTransactionDurability,r),this._fireOnBlocked=e=>{this.on("blocked").fire(e),s$.filter(e=>e.name===this.name&&e!==this&&!e._state.vcFired).map(n=>n.on("versionchange").fire(e))},this.use(l_),this.use(l$),this.use(lz),this.use(lw),this.vip=Object.create(this,{_vip:{value:!0}}),o.forEach(e=>e(this))}version(e){if(isNaN(e)||e<.1)throw new af.Type("Given version is not a positive number");if(e=Math.round(10*e)/10,this.idbdb||this._state.isBeingOpened)throw new af.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(la),t.stores({}),this._state.autoSchema=!1,t)}_whenReady(e){return this.idbdb&&(this._state.openComplete||aW.letThrough||this._vip)?e():new aq((e,n)=>{if(this._state.openComplete)return n(new af.DatabaseClosed(this._state.dbOpenError));if(!this._state.isBeingOpened){if(!this._options.autoOpen)return void n(new af.DatabaseClosed);this.open().catch(ag)}this._state.dbReadyPromise.then(e,n)}).then(e)}use({stack:e,create:n,level:t,name:r}){r&&this.unuse({stack:e,name:r});let o=this._middlewares[e]||(this._middlewares[e]=[]);return o.push({stack:e,create:n,level:null==t?10:t,name:r}),o.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:r}=e._deps;if(t.isBeingOpened||e.idbdb)return t.dbReadyPromise.then(()=>t.dbOpenError?sm(t.dbOpenError):e);ae&&(t.openCanceller._stackHolder=ar()),t.isBeingOpened=!0,t.dbOpenError=null,t.openComplete=!1;let o=t.openCanceller;function i(){if(t.openCanceller!==o)throw new af.DatabaseClosed("db.open() was cancelled")}let a=t.dbReadyResolve,s=null,l=!1,c=()=>new aq((n,o)=>{if(i(),!r)throw new af.MissingAPI;let a=e.name,c=t.autoSchema?r.open(a):r.open(a,Math.round(10*e.verno));if(!c)throw new af.MissingAPI;c.onerror=sQ(o),c.onblocked=a4(e._fireOnBlocked),c.onupgradeneeded=a4(n=>{if(s=c.transaction,t.autoSchema&&!e._options.allowEmptyDB){c.onerror=s0,s.abort(),c.result.close();let e=r.deleteDatabase(a);e.onsuccess=e.onerror=a4(()=>{o(new af.NoSuchDatabase(`Database ${a} doesnt exist`))})}else{let t,r,a,d;s.onerror=sQ(o);var i,u,p=n.oldVersion>0x4000000000000000?0:n.oldVersion;l=p<1,e._novip.idbdb=c.result,i=p/10,u=s,t=e._dbSchema,(r=e._createTransaction("readwrite",e._storeNames,t)).create(u),r._completion.catch(o),a=r._reject.bind(r),d=aW.transless||aW,st(()=>{aW.trans=r,aW.transless=d,0===i?(iM(t).forEach(e=>{ll(u,e,t[e].primKey,t[e].indexes)}),lr(e,u),aq.follow(()=>e.on.populate.fire(r)).catch(a)):(function({_novip:e},n,t,r){let o=[],i=e._versions,a=e._dbSchema=lu(e,e.idbdb,r),s=!1;return i.filter(e=>e._cfg.version>=n).forEach(i=>{o.push(()=>{let o=a,l=i._cfg.dbschema;lp(e,o,r),lp(e,l,r),a=e._dbSchema=l;let c=ls(o,l);c.add.forEach(e=>{ll(r,e[0],e[1].primKey,e[1].indexes)}),c.change.forEach(e=>{if(e.recreate)throw new af.Upgrade("Not yet support for changing primary key");{let n=r.objectStore(e.name);e.add.forEach(e=>lc(n,e)),e.change.forEach(e=>{n.deleteIndex(e.name),lc(n,e)}),e.del.forEach(e=>n.deleteIndex(e))}});let u=i._cfg.contentUpgrade;if(u&&i._cfg.version>n){let n;lr(e,r),t._memoizedTables={},s=!0;let i=iJ(l);c.del.forEach(e=>{i[e]=o[e]}),li(e,[e.Transaction.prototype]),lo(e,[e.Transaction.prototype],iM(i),i),t.schema=i;let a=i9(u);a&&sr();let p=aq.follow(()=>{if((n=u(t))&&a){var e=so.bind(null,null);n.then(e,e)}});return n&&"function"==typeof n.then?aq.resolve(n):p.then(()=>n)}}),o.push(n=>{var r;s&&sA||(r=i._cfg.dbschema,[].slice.call(n.db.objectStoreNames).forEach(e=>null==r[e]&&n.db.deleteObjectStore(e))),li(e,[e.Transaction.prototype]),lo(e,[e.Transaction.prototype],e._storeNames,e._dbSchema),t.schema=e._dbSchema})}),(function e(){return o.length?aq.resolve(o.shift()(t.idbtrans)).then(e):aq.resolve()})().then(()=>{var e;iM(e=a).forEach(n=>{r.db.objectStoreNames.contains(n)||ll(r,n,e[n].primKey,e[n].indexes)})})})(e,i,r,u).catch(a)})}},o),c.onsuccess=a4(()=>{s=null;let r=e._novip.idbdb=c.result,o=iV(r.objectStoreNames);if(o.length>0)try{let n,i=r.transaction(1===o.length?o[0]:o,"readonly");t.autoSchema?function({_novip:e},n,t){e.verno=n.version/10;let r=e._dbSchema=lu(0,n,t);e._storeNames=iV(n.objectStoreNames,0),lo(e,[e._allTables],iM(r),r)}(e,r,i):(lp(e,e._dbSchema,i),((n=ls(lu(0,e.idbdb,i),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.")),lr(e,i)}catch(e){}s$.push(e),r.onversionchange=a4(n=>{t.vcFired=!0,e.on("versionchange").fire(n)}),r.onclose=a4(n=>{e.on("close").fire(n)}),l&&function({indexedDB:e,IDBKeyRange:n},t){lh(e)||t===sk||lf(e,n).put({name:t}).catch(ag)}(e._deps,a),n()},o)}).catch(e=>e&&"UnknownError"===e.name&&t.PR1398_maxLoop>0?(t.PR1398_maxLoop--,console.warn("Dexie: Workaround for Chrome UnknownError on open()"),c()):aq.reject(e));return aq.race([o,("u"<typeof navigator?aq.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(c)]).then(()=>(i(),t.onReadyBeingFired=[],aq.resolve(lm(()=>e.on.ready.fire(e.vip))).then(function n(){if(t.onReadyBeingFired.length>0){let r=t.onReadyBeingFired.reduce(ak,ag);return t.onReadyBeingFired=[],aq.resolve(lm(()=>r(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 o===t.openCanceller&&e._close(),sm(n)}).finally(()=>{t.openComplete=!0,a()})}(this)}_close(){let e=this._state,n=s$.indexOf(this);if(n>=0&&s$.splice(n,1),this.idbdb){try{this.idbdb.close()}catch(e){}this._novip.idbdb=null}e.dbReadyPromise=new aq(n=>{e.dbReadyResolve=n}),e.openCanceller=new aq((n,t)=>{e.cancelOpen=t})}close(){this._close();let e=this._state;this._options.autoOpen=!1,e.dbOpenError=new af.DatabaseClosed,e.isBeingOpened&&e.cancelOpen(e.dbOpenError)}delete(){let e=arguments.length>0,n=this._state;return new aq((t,r)=>{let o=()=>{this.close();var e=this._deps.indexedDB.deleteDatabase(this.name);e.onsuccess=a4(()=>{!function({indexedDB:e,IDBKeyRange:n},t){lh(e)||t===sk||lf(e,n).delete(t).catch(ag)}(this._deps,this.name),t()}),e.onerror=sQ(r),e.onblocked=this._fireOnBlocked};if(e)throw new af.InvalidArgument("Arguments not allowed in db.delete()");n.isBeingOpened?n.dbReadyPromise.then(o):o()})}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 iM(this._allTables).map(e=>this._allTables[e])}transaction(){let e=lb.apply(this,arguments);return this._transaction.apply(this,e)}_transaction(e,n,t){let r,o,i=aW.trans;i&&i.db===this&&-1===e.indexOf("!")||(i=null);let a=-1!==e.indexOf("?");e=e.replace("!","").replace("?","");try{if(o=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===sx)r=sx;else{if("rw"!=e&&e!=sC)throw new af.InvalidArgument("Invalid transaction mode: "+e);r=sC}if(i){if(i.mode===sx&&r===sC){if(!a)throw new af.SubTransaction("Cannot enter a sub-transaction with READWRITE mode when parent transaction is READONLY");i=null}i&&o.forEach(e=>{if(i&&-1===i.storeNames.indexOf(e)){if(!a)throw new af.SubTransaction("Table "+e+" not included in parent transaction.");i=null}}),a&&i&&!i.active&&(i=null)}}catch(e){return i?i._promise(null,(n,t)=>{t(e)}):sm(e)}let s=(function e(n,t,r,o,i){return aq.resolve().then(()=>{let a,s=aW.transless||aW,l=n._createTransaction(t,r,n._dbSchema,o);if(o)l.idbtrans=o.idbtrans;else try{l.create(),n._state.PR1398_maxLoop=3}catch(o){return o.name===ad.InvalidState&&n.isOpen()&&--n._state.PR1398_maxLoop>0?(console.warn("Dexie: Need to reopen db"),n._close(),n.open().then(()=>e(n,t,r,null,i))):sm(o)}let c=i9(i);c&&sr();let u=aq.follow(()=>{if(a=i.call(l,l))if(c){var e=so.bind(null,null);a.then(e,e)}else"function"==typeof a.next&&"function"==typeof a.throw&&(a=lg(a))},{trans:l,transless:s});return(a&&"function"==typeof a.then?aq.resolve(a).then(e=>l.active?e:sm(new af.PrematureCommit("Transaction committed too early. See http://bit.ly/2kdckMn"))):u.then(()=>a)).then(e=>(o&&l._resolve(),l._completion.then(()=>e))).catch(e=>(l._reject(e),sm(e)))})}).bind(null,this,r,o,i,t);return i?i._promise(r,s,"lock"):aW.trans?su(aW.transless,()=>this._whenReady(s)):this._whenReady(s)}table(e){if(!iB(this._allTables,e))throw new af.InvalidTable(`Table ${e} does not exist`);return this._allTables[e]}}let lO="u">typeof Symbol&&"observable"in Symbol?Symbol.observable:"@@observable";class lT{constructor(e){this._subscribe=e}subscribe(e,n,t){return this._subscribe(e&&"function"!=typeof e?e:{next:e,error:n,complete:t})}[lO](){return this}}function lB(e,n){return iM(n).forEach(t=>{lE(e[t]||(e[t]=new lx),n[t])}),e}try{i={indexedDB:iS.indexedDB||iS.mozIndexedDB||iS.webkitIndexedDB||iS.msIndexedDB,IDBKeyRange:iS.IDBKeyRange||iS.webkitIDBKeyRange}}catch(e){i={indexedDB:null,IDBKeyRange:null}}function lI(e){let n=lN;try{lN=!0,s3.storagemutated.fire(e)}finally{lN=n}}iI(lP,{...am,delete:e=>new lP(e,{addons:[]}).delete(),exists:e=>new lP(e,{addons:[]}).open().then(e=>(e.close(),!0)).catch("NoSuchDatabaseError",()=>!1),getDatabaseNames(e){try{return(function({indexedDB:e,IDBKeyRange:n}){return lh(e)?Promise.resolve(e.databases()).then(e=>e.map(e=>e.name).filter(e=>e!==sk)):lf(e,n).toCollection().primaryKeys()})(lP.dependencies).then(e)}catch(e){return sm(new af.MissingAPI)}},defineClass:()=>function(e){iP(this,e)},ignoreTransaction:e=>aW.trans?su(aW.transless,e):e(),vip:lm,async:function(e){return function(){try{var n=lg(e.apply(this,arguments));return n&&"function"==typeof n.then?n:aq.resolve(n)}catch(e){return sm(e)}}},spawn:function(e,n,t){try{var r=lg(e.apply(t,n||[]));return r&&"function"==typeof r.then?r:aq.resolve(r)}catch(e){return sm(e)}},currentTransaction:{get:()=>aW.trans||null},waitFor:function(e,n){let t=aq.resolve("function"==typeof e?lP.ignoreTransaction(e):e).timeout(n||6e4);return aW.trans?aW.trans.waitFor(t):t},Promise:aq,debug:{get:()=>ae,set:e=>{ae=e,an="dexie"===e?()=>!0:sw}},derive:iR,extend:iP,props:iI,override:iG,Events:sz,on:s3,liveQuery:function(e){let n,t=!1,r=new lT(r=>{let o=i9(e),i=!1,a={},s={},l={get closed(){return i},unsubscribe:()=>{i=!0,s3.storagemutated.unsubscribe(d)}};r.start&&r.start(l);let c=!1,u=!1;function p(){return iM(s).some(e=>a[e]&&function(e,n){let t=lD(n),r=t.next();if(r.done)return!1;let o=r.value,i=lD(e),a=i.next(o.from),s=a.value;for(;!r.done&&!a.done;){if(0>=sF(s.from,o.to)&&sF(s.to,o.from)>=0)return!0;0>sF(o.from,s.from)?o=(r=t.next(s.from)).value:s=(a=i.next(o.from)).value}return!1}(a[e],s[e]))}let d=e=>{lB(a,e),p()&&f()},f=()=>{let h,m;if(c||i)return;a={};let g={},b=(o&&sr(),h=()=>st(e,{subscr:g,trans:null}),m=aW.trans?su(aW.transless,h):h(),o&&m.then(so,so),m);u||(s3(s1,d),u=!0),c=!0,Promise.resolve(b).then(e=>{t=!0,n=e,c=!1,i||(p()?f():(a={},s=g,r.next&&r.next(e)))},e=>{c=!1,t=!1,r.error&&r.error(e),l.unsubscribe()})};return f(),l});return r.hasValue=()=>t,r.getValue=()=>n,r},extendObservabilitySet:lB,getByKeyPath:iK,setByKeyPath:iY,delByKeyPath:function(e,n){"string"==typeof n?iY(e,n,void 0):"length"in n&&[].map.call(n,function(n){iY(e,n,void 0)})},shallowClone:iJ,deepClone:i2,getObjectDiff:lv,cmp:sF,asap:iq,minKey:sy,addons:[],connections:s$,errnames:ad,dependencies:i,semVer:sg,version:sg.split(".").map(e=>parseInt(e)).reduce((e,n,t)=>e+n/Math.pow(10,2*t))}),lP.maxKey=s7(lP.dependencies.IDBKeyRange),"u">typeof dispatchEvent&&"u">typeof addEventListener&&(s3(s1,e=>{if(!lN){let n;sA?(n=document.createEvent("CustomEvent")).initCustomEvent(s2,!0,!0,e):n=new CustomEvent(s2,{detail:e}),lN=!0,dispatchEvent(n),lN=!1}}),addEventListener(s2,({detail:e})=>{lN||lI(e)}));let lN=!1;if("u">typeof BroadcastChannel){let e=new BroadcastChannel(s2);"function"==typeof e.unref&&e.unref(),s3(s1,n=>{lN||e.postMessage(n)}),e.onmessage=e=>{e.data&&lI(e.data)}}else if("u">typeof self&&"u">typeof navigator){s3(s1,e=>{try{lN||("u">typeof localStorage&&localStorage.setItem(s2,JSON.stringify({trig:Math.random(),changedParts:e})),"object"==typeof self.clients&&[...self.clients.matchAll({includeUncontrolled:!0})].forEach(n=>n.postMessage({type:s2,changedParts:e})))}catch(e){}}),"u">typeof addEventListener&&addEventListener("storage",e=>{if(e.key===s2){let n=JSON.parse(e.newValue);n&&lI(n.changedParts)}});let e=self.document&&navigator.serviceWorker;e&&e.addEventListener("message",function({data:e}){e&&e.type===s2&&lI(e.changedParts)})}function lj(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}aq.rejectionMapper=function(e,n){if(!e||e instanceof al||e instanceof TypeError||e instanceof SyntaxError||!e.name||!ah[e.name])return e;var t=new ah[e.name](n||e.message,e);return"stack"in e&&ij(t,"stack",{get:function(){return this.inner.stack}}),t},an=sw;class lR extends lP{constructor(){super("EsmOffline"),lj(this,"syncQueue",void 0),lj(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 lF(){return new lR}let lL=new lR,lW={};async function lV(){let e=await oi();return e?.uuid||"*"}async function lG(e,n,t,r){let o=r&&r.id;return void 0!==o&&await lL.syncQueue.where({type:n,userId:e}).filter(e=>e?.descriptor.id===o).delete().catch(lP.errnames.DatabaseClosed),await lL.syncQueue.add({type:n,content:t,userId:e,descriptor:r||{},createdOn:new Date}).catch(lP.errnames.DatabaseClosed,()=>-1)}async function lU(e,n,t){let r=await lV();return await lG(r,e,n,t)}async function lq(e,n){return(await lH(e,n)).map(e=>e.content)}async function lH(e,n){return await lL.syncQueue.where(n?{type:n,userId:e}:{userId:e}).toArray().catch(lP.errnames.DatabaseClosed,()=>[])}async function lK(e){let n=await lV();return await lq(n,e)}async function lY(e){let n=await lV();return await lH(n,e)}async function lJ(e){return await lL.syncQueue.get(e).catch(lP.errnames.DatabaseClosed,()=>void 0)}function lZ(e){return!!lW[e]?.options.onBeginEditSyncItem}async function lX(e){let n=await lJ(e);if(!n)throw Error(`No sync item with the ID ${e} exists.`);let t=lW[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 lQ(e){await lL.syncQueue.delete(e).catch(lP.errnames.DatabaseClosed)}function l0(e,n,t,r={}){lW[e]={type:e,dependsOn:n,process:t,options:r}}L("offline-synchronization",{});let l1={};function l2(){return Object.values(l1)}function l3(e){l1[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.`),l1[e.id]=e}async function l5(e){let n=await ct();return await l4(n,e)}async function l4(e,n){let t=new lR;return await t.dynamicOfflineData.where(n?{type:n,users:e}:{users:e}).toArray().catch(lP.errnames.DatabaseClosed,()=>[])}async function l6(e,n){let t=await ct();return await l8(t,e,n)}async function l8(e,n,t){let r=new lR,o=await r.dynamicOfflineData.get({type:n,identifier:t}).catch(lP.errnames.DatabaseClosed,()=>void 0);o?o.users.includes(e)||await r.dynamicOfflineData.update(o.id,{users:[...o.users,e]}).catch(lP.errnames.DatabaseClosed):await r.dynamicOfflineData.add({users:[e],type:n,identifier:t}).catch(lP.errnames.DatabaseClosed)}async function l7(e,n){let t=await ct();return await l9(t,e,n)}async function l9(e,n,t){let r=new lR,o=await r.dynamicOfflineData.get({type:n,identifier:t,users:e}).catch(lP.errnames.DatabaseClosed,()=>void 0);o&&(o.users.length>1?await r.dynamicOfflineData.update(o.id,{users:o.users.filter(n=>n!==e)}).catch(lP.errnames.DatabaseClosed):await r.dynamicOfflineData.delete(o.id).catch(lP.errnames.DatabaseClosed))}async function ce(e,n){let t=await l5(e);await Promise.all(t.map(async e=>cn(e.type,e.identifier,n)))}async function cn(e,n,t){await l6(e,n);let r=new lR,o=await ct(),i=await r.dynamicOfflineData.get({type:e,identifier:n}).catch(lP.errnames.DatabaseClosed,()=>void 0),a=l2().filter(n=>n.type===e);if(!i)return;let s=await Promise.all(a.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:o,succeededHandlers:l,erroredHandlers:c,errors:u};i.id&&await r.dynamicOfflineData.update(i.id,{syncState:p}).catch(lP.errnames.DatabaseClosed)}async function ct(){let e=(await oi()).uuid;if(!e)throw Error("Using the dynamic offline data API requires a logged in user.");return e}let cr=L("offline-patients",{offlinePatientDataSyncState:{},handlers:{}});function co(){return cs(),cr}function ci(e,n){cs(),l3({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 ca(e){cs(),await cn("patient",e)}function cs(){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 cl(e,n,t=!0){if(e){let r=null,[o,i]=await Promise.all([r5(`${r1}/Patient/${e}`,n).catch(e=>r=e),t?cc(e):Promise.resolve(null)]);if(o.ok)return o.data;if(i)return i;if(r)throw r}return null}async function cc(e){let n=(await lK("patient-registration")).find(n=>n.fhirPatient.id===e);return n?.fhirPatient??null}function cu(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 cp=((Q={}).NEWVISIT="startVisit",Q.EDITVISIT="editVisit",Q.LOADING="loadingVisit",Q),cd=((ee={}).NOTSTARTED="notStarted",ee.ONGOING="ongoing",ee);let cf="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))",ch=function(){try{return JSON.parse(sessionStorage.getItem("openmrs:visitStoreState")||"null")}catch(e){return null}}()||{patientUuid:null,manuallySetVisitUuid:null};function cm(){return V("visit",ch)}function cg(e,n){cm().setState({patientUuid:e,manuallySetVisitUuid:n})}function cb(e,n){return r5(`${r0}/visit`,{signal:n.signal,method:"POST",headers:{"Content-type":"application/json"},body:e})}function cy(e,n,t){return r5(`${r0}/visit/${e}`,{signal:t.signal,method:"POST",headers:{"Content-type":"application/json"},body:n})}function c_(e,n,t){return r5(`${r0}/visit?patient=${e}&v=${t??cf}`,{signal:n.signal,method:"GET",headers:{"Content-type":"application/json"}})}cm().subscribe(e=>{var n;n=e,sessionStorage.setItem("openmrs:visitStoreState",JSON.stringify(n))});let cv=new er.BehaviorSubject(null);var c$=t(33789);function cA(e){return{uuid:e.uuid,display:e.display,name:e.name}}function cw(){return r4(`${r0}/visittype`).pipe((0,c$.map)(e=>e.data.results.map(cA))).pipe((0,c$.take)(1))}function ck(e){return{uuid:e.uuid,display:e.display}}function cx(e=null,n=null){let t=new URLSearchParams;e&&t.set("tag",e),n&&t.set("q",n);let r=t.toString();return r4(`${r0}/location${r?"?"+r:""}`).pipe((0,c$.map)(e=>e.data.results.map(ck))).pipe((0,c$.take)(1))}class cC{static get version(){return"1.4.0"}static toString(){return"JavaScript Expression Parser (JSEP) v"+cC.version}static addUnaryOp(e){return cC.max_unop_len=Math.max(e.length,cC.max_unop_len),cC.unary_ops[e]=1,cC}static addBinaryOp(e,n,t){return cC.max_binop_len=Math.max(e.length,cC.max_binop_len),cC.binary_ops[e]=n,t?cC.right_associative.add(e):cC.right_associative.delete(e),cC}static addIdentifierChar(e){return cC.additional_identifier_chars.add(e),cC}static addLiteral(e,n){return cC.literals[e]=n,cC}static removeUnaryOp(e){return delete cC.unary_ops[e],e.length===cC.max_unop_len&&(cC.max_unop_len=cC.getMaxKeyLen(cC.unary_ops)),cC}static removeAllUnaryOps(){return cC.unary_ops={},cC.max_unop_len=0,cC}static removeIdentifierChar(e){return cC.additional_identifier_chars.delete(e),cC}static removeBinaryOp(e){return delete cC.binary_ops[e],e.length===cC.max_binop_len&&(cC.max_binop_len=cC.getMaxKeyLen(cC.binary_ops)),cC.right_associative.delete(e),cC}static removeAllBinaryOps(){return cC.binary_ops={},cC.max_binop_len=0,cC}static removeLiteral(e){return delete cC.literals[e],cC}static removeAllLiterals(){return cC.literals={},cC}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 cC(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 cC.binary_ops[e]||0}static isIdentifierStart(e){return e>=65&&e<=90||e>=97&&e<=122||e>=128&&!cC.binary_ops[String.fromCharCode(e)]||cC.additional_identifier_chars.has(String.fromCharCode(e))}static isIdentifierPart(e){return cC.isIdentifierStart(e)||cC.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(cC.hooks[e]){let t={context:this,node:n};return cC.hooks.run(e,t),t.node}return n}searchHook(e){if(cC.hooks[e]){let n={context:this};return cC.hooks[e].find(function(e){return e.call(n.context,n),n.node}),n.node}}gobbleSpaces(){let e=this.code;for(;e===cC.SPACE_CODE||e===cC.TAB_CODE||e===cC.LF_CODE||e===cC.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:cC.COMPOUND,body:e};return this.runHook("after-all",n)}gobbleExpressions(e){let n=[],t,r;for(;this.index<this.expr.length;)if((t=this.code)===cC.SEMCOL_CODE||t===cC.COMMA_CODE)this.index++;else if(r=this.gobbleExpression())n.push(r);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,cC.max_binop_len),n=e.length;for(;n>0;){if(cC.binary_ops.hasOwnProperty(e)&&(!cC.isIdentifierStart(this.code)||this.index+e.length<this.expr.length&&!cC.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,r,o,i,a,s,l;if(!(i=this.gobbleToken())||!(n=this.gobbleBinaryOp()))return i;for(o={value:n,prec:cC.binaryPrecedence(n),right_a:cC.right_associative.has(n)},(a=this.gobbleToken())||this.throwError("Expected expression after "+n),r=[i,o,a];n=this.gobbleBinaryOp();){if(0===(t=cC.binaryPrecedence(n))){this.index-=n.length;break}o={value:n,prec:t,right_a:cC.right_associative.has(n)},l=n;let s=e=>o.right_a&&e.right_a?t>e.prec:t<=e.prec;for(;r.length>2&&s(r[r.length-2]);)a=r.pop(),n=r.pop().value,i=r.pop(),e={type:cC.BINARY_EXP,operator:n,left:i,right:a},r.push(e);(e=this.gobbleToken())||this.throwError("Expected expression after "+l),r.push(o,e)}for(s=r.length-1,e=r[s];s>1;)e={type:cC.BINARY_EXP,operator:r[s-1].value,left:r[s-2],right:e},s-=2;return e}gobbleToken(){let e,n,t,r;if(this.gobbleSpaces(),r=this.searchHook("gobble-token"))return this.runHook("after-token",r);if(e=this.code,cC.isDecimalDigit(e)||e===cC.PERIOD_CODE)return this.gobbleNumericLiteral();if(e===cC.SQUOTE_CODE||e===cC.DQUOTE_CODE)r=this.gobbleStringLiteral();else if(e===cC.OBRACK_CODE)r=this.gobbleArray();else{for(t=(n=this.expr.substr(this.index,cC.max_unop_len)).length;t>0;){if(cC.unary_ops.hasOwnProperty(n)&&(!cC.isIdentifierStart(this.code)||this.index+n.length<this.expr.length&&!cC.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:cC.UNARY_EXP,operator:n,argument:e,prefix:!0})}n=n.substr(0,--t)}cC.isIdentifierStart(e)?(r=this.gobbleIdentifier(),cC.literals.hasOwnProperty(r.name)?r={type:cC.LITERAL,value:cC.literals[r.name],raw:r.name}:r.name===cC.this_str&&(r={type:cC.THIS_EXP})):e===cC.OPAREN_CODE&&(r=this.gobbleGroup())}return r?(r=this.gobbleTokenProperty(r),this.runHook("after-token",r)):this.runHook("after-token",!1)}gobbleTokenProperty(e){this.gobbleSpaces();let n=this.code;for(;n===cC.PERIOD_CODE||n===cC.OBRACK_CODE||n===cC.OPAREN_CODE||n===cC.QUMARK_CODE;){let t;if(n===cC.QUMARK_CODE){if(this.expr.charCodeAt(this.index+1)!==cC.PERIOD_CODE)break;t=!0,this.index+=2,this.gobbleSpaces(),n=this.code}this.index++,n===cC.OBRACK_CODE?((e={type:cC.MEMBER_EXP,computed:!0,object:e,property:this.gobbleExpression()}).property||this.throwError('Unexpected "'+this.char+'"'),this.gobbleSpaces(),(n=this.code)!==cC.CBRACK_CODE&&this.throwError("Unclosed ["),this.index++):n===cC.OPAREN_CODE?e={type:cC.CALL_EXP,arguments:this.gobbleArguments(cC.CPAREN_CODE),callee:e}:(n===cC.PERIOD_CODE||t)&&(t&&this.index--,this.gobbleSpaces(),e={type:cC.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(;cC.isDecimalDigit(this.code);)e+=this.expr.charAt(this.index++);if(this.code===cC.PERIOD_CODE)for(e+=this.expr.charAt(this.index++);cC.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++));cC.isDecimalDigit(this.code);)e+=this.expr.charAt(this.index++);cC.isDecimalDigit(this.expr.charCodeAt(this.index-1))||this.throwError("Expected exponent ("+e+this.char+")")}return t=this.code,cC.isIdentifierStart(t)?this.throwError("Variable names cannot start with a number ("+e+this.char+")"):(t===cC.PERIOD_CODE||1===e.length&&e.charCodeAt(0)===cC.PERIOD_CODE)&&this.throwError("Unexpected period"),{type:cC.LITERAL,value:parseFloat(e),raw:e}}gobbleStringLiteral(){let e="",n=this.index,t=this.expr.charAt(this.index++),r=!1;for(;this.index<this.expr.length;){let n=this.expr.charAt(this.index++);if(n===t){r=!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 r||this.throwError('Unclosed quote after "'+e+'"'),{type:cC.LITERAL,value:e,raw:this.expr.substring(n,this.index)}}gobbleIdentifier(){let e=this.code,n=this.index;for(cC.isIdentifierStart(e)?this.index++:this.throwError("Unexpected "+this.char);this.index<this.expr.length;)if(e=this.code,cC.isIdentifierPart(e))this.index++;else break;return{type:cC.IDENTIFIER,name:this.expr.slice(n,this.index)}}gobbleArguments(e){let n=[],t=!1,r=0;for(;this.index<this.expr.length;){this.gobbleSpaces();let o=this.code;if(o===e){t=!0,this.index++,e===cC.CPAREN_CODE&&r&&r>=n.length&&this.throwError("Unexpected token "+String.fromCharCode(e));break}if(o===cC.COMMA_CODE){if(this.index++,++r!==n.length){if(e===cC.CPAREN_CODE)this.throwError("Unexpected token ,");else if(e===cC.CBRACK_CODE)for(let e=n.length;e<r;e++)n.push(null)}}else if(n.length!==r&&0!==r)this.throwError("Expected comma");else{let e=this.gobbleExpression();e&&e.type!==cC.COMPOUND||this.throwError("Expected comma"),n.push(e)}}return t||this.throwError("Expected "+String.fromCharCode(e)),n}gobbleGroup(){this.index++;let e=this.gobbleExpressions(cC.CPAREN_CODE);if(this.code===cC.CPAREN_CODE)return(this.index++,1===e.length)?e[0]:!!e.length&&{type:cC.SEQUENCE_EXP,expressions:e};this.throwError("Unclosed (")}gobbleArray(){return this.index++,{type:cC.ARRAY_EXP,elements:this.gobbleArguments(cC.CBRACK_CODE)}}}Object.assign(cC,{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)})}}(cC),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"}),cC.max_unop_len=cC.getMaxKeyLen(cC.unary_ops),cC.max_binop_len=cC.getMaxKeyLen(cC.binary_ops);let cE=e=>new cC(e).parse(),cD=Object.getOwnPropertyNames(class{});Object.getOwnPropertyNames(cC).filter(e=>!cD.includes(e)&&void 0===cE[e]).forEach(e=>{cE[e]=cC[e]}),cE.Jsep=cC,cE.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,r=this.gobbleExpression();if(r||this.throwError("Expected expression"),this.gobbleSpaces(),this.code===e.COLON_CODE){this.index++;let o=this.gobbleExpression();if(o||this.throwError("Expected expression"),n.node={type:"ConditionalExpression",test:t,consequent:r,alternate:o},t.operator&&e.binary_ops[t.operator]<=.9){let r=t;for(;r.right.operator&&e.binary_ops[r.right.operator]<=.9;)r=r.right;n.node.test=r.right,r.right=n.node,n.node=t}}else this.throwError("Expected :")}})}});let cS="ArrowFunctionExpression",cM={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)}},cz={...cM,Promise};function cP(e,n={}){return cj(e,n,cL)}async function cO(e,n={}){return cR(e,n,cL)}function cT(e,n={}){return cj(e,n,cW)}function cB(e,n={}){return cR(e,n,cW)}function cI(e,n={}){return cj(e,n,cV)}function cN(e,n={}){return cR(e,n,cV)}function cj(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 r=cq(n,cM),o=cG("string"==typeof e?cE(e):e,r);if(t(o))return o;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 cR(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 r=cq(n,cz);return Promise.resolve(cG("string"==typeof e?cE(e):e,r)).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 cF(e){return cE(e)}function cL(e){return"string"==typeof e||"number"==typeof e||"boolean"==typeof e||null==e||e instanceof Date}function cW(e){return"boolean"==typeof e}function cV(e){return"number"==typeof e}function cG(e,n){switch(e.type){case"UnaryExpression":var t,r,o,i,a,s,l,c,u,p,d,f,h=e,m=n;let g=cG(h.argument,m);switch(h.operator){case"+":return+g;case"-":return-g;case"~":return~g;case"!":return!g;default:throw`Expression evaluator does not support operator '${h.operator}''`}case"BinaryExpression":var b=e,y=n;let v=cG(b.left,y),$=cG(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,r=n,cG(t.test,r)?cG(t.consequent,r):cG(t.alternate,r);case"CallExpression":var A=e,w=n;let k=A.arguments?.map(cH(w)),x=cG(A.callee,w);if(x){if("function"!=typeof x)throw`${cY(A.callee)} is not a function`}else throw`No function named ${cY(A.callee)} is defined in this context`;return x(...k);case"ArrowFunctionExpression":let C;return o=e,i=n,C=o.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,r)=>{let o=e[r];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}(o)&&n.push([t,o]),n},[]));return cG(o.body,i.addVariables(n))}).bind(i.thisObj??null);case"MemberExpression":return function(e,n){let t,r=cG(e.object,n);if(void 0===r)switch(e.object.type){case"Identifier":{let t=cU(e.object,n);throw ReferenceError(`ReferenceError: ${t} is not defined`)}case"MemberExpression":{let t=cU(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 o=r;if("string"==typeof r)o=String.prototype;else if("number"==typeof r)o=Number.prototype;else if("function"==typeof r);else if("object"!=typeof r)throw`VisitMemberExpression does not support member access on type ${typeof r}`;switch(n.thisObj=o,e.property.type){case"Identifier":case"MemberExpression":t=cG(e.property,n);break;default:{let o=cG(e.property,n);if(void 0===o)throw{type:"Illegal property access",message:"No property was supplied to the property access"};cK(o),t=r[o]}}return"function"==typeof t?t.bind(r):t}(e,n);case"ArrayExpression":return a=e,s=n,a.elements?.map(cH(s));case"SequenceExpression":let E;return l=e,c=n,(E=l.expressions.map(cH(c)))[E.length-1];case"NewExpression":var D=e,S=n;if(D.callee&&"Identifier"===D.callee.type){let e=D.arguments?.map(cH(S));switch(D.callee.name){case"Date":return new Date(...e);case"RegExp":return new RegExp(...e);default:throw`Cannot instantiate object of type ${D.callee.name}`}}if(D.callee)throw"new must be called with either Date or RegExp";throw'Could not handle "new" without a specified class';case"Literal":return cK((u=e).value),u.value;case"Identifier":var M=e,z=n;cK(M.name);let P=z.thisObj;if(P&&("object"==typeof P||"function"==typeof P)&&M.name in P){let e=P[M.name];return cK(e),e}if(z.variables&&M.name in z.variables){let e=z.variables[M.name];return cK(e),e}return M.name in z.globals?z.globals[M.name]:void 0;case"TemplateLiteral":let O,T;return p=e,d=n,O=p.expressions?.map(cH(d))??[],(T=p.quasis?.map(cH(d))??[]).filter(e=>!e.tail).map(e=>e.value).join("")+O.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 cU(e,n){switch(e.type){case"Literal":return e.value;case"Identifier":return e.name;case"MemberExpression":return cU(e.property,n);default:throw`VisitExpressionName does not support expression of type '${e.type}'`}}function cq(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 cH(e){return function(n){return null===n?null:cG(n,e)}}function cK(e){if("__proto__"===e||"prototype"===e||"constructor"===e)throw{type:"Illegal property access",message:`Cannot access the ${e} property of objects`}}function cY(e){return e?"MemberExpression"===e.type?e.property?.name:e.name:null}function cJ(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:{...cz},isLocalExpression:!1,variables:new Set};return cZ("string"==typeof e?cE(e):e,n),[...n.variables]}function cZ(e,n){switch(e.type){case"UnaryExpression":return r=e,o=n,cZ(r.argument,o);case"BinaryExpression":return i=e,a=n,[cZ(i.left,a),cZ(i.right,a)].filter(Boolean);case"ConditionalExpression":return s=e,l=n,[cZ(s.consequent,l),cZ(s.test,l),cZ(s.alternate,l)].filter(Boolean);case"CallExpression":let t;return c=e,u=n,t=cZ(c.callee,u),c.arguments?.map(cX(u)),t;case"ArrowFunctionExpression":var r,o,i,a,s,l,c,u,p,d,f,h,m,g,b,y,v,$,A=e,w=n;let k={...w};k.isLocalExpression=!0;let x=A.params?.map(cX(k))??[],C=cZ(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,cZ(p.object,d),void((E={...d}).isLocalExpression=!0,cZ(p.property,E));case"ArrayExpression":return f=e,h=n,void f.elements?.map(cX(h));case"SequenceExpression":return m=e,g=n,void m.expressions?.map(cX(g));case"NewExpression":return b=e,y=n,void b.arguments?.map(cX(y));case"Literal":case"TemplateElement":return;case"Identifier":var D=e,S=n;if(!(D.name in S.globals))if(S.isLocalExpression)return D.name;else S.variables.add(D.name);return;case"TemplateLiteral":return v=e,$=n,void(v.expressions?.map(cX($)),v.quasis?.map(cX($)));default:throw`Expression evaluator does not support expression of type '${e.type}'`}}function cX(e){return function(n){return null===n?null:cZ(n,e)}}cE.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:cS,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=cS,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)})}}),cE.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 r=n.node;for(;r.type===e.MEMBER_EXP||r.type===e.CALL_EXP&&r.callee.type===e.MEMBER_EXP;)r=r.type===e.MEMBER_EXP?r.object:r.callee.object;r.type="NewExpression"}})}}),cE.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,r="",o=()=>{for(;e.isDecimalDigit(this.code)||95===this.code;)95===this.code?this.index++:r+=this.expr.charAt(this.index++)};o(),this.code===e.PERIOD_CODE&&(r+=this.expr.charAt(this.index++),o());let i=this.char;("e"===i||"E"===i)&&(r+=this.expr.charAt(this.index++),("+"===(i=this.char)||"-"===i)&&(r+=this.expr.charAt(this.index++)),o(),e.isDecimalDigit(this.expr.charCodeAt(this.index-1))||this.throwError("Expected exponent ("+r+this.char+")"));let a=this.code;if(e.isIdentifierStart(a))this.throwError("Variable names cannot start with a number ("+r+this.char+")");else if(a===e.PERIOD_CODE){r.length>1&&this.throwError(`Unexpected period ${JSON.stringify({chCode:a,number:r},null,2)}`),this.index=t;return}n.node={type:e.LITERAL,value:parseFloat(r),raw:this.expr.substring(t,this.index)}}e.hooks.add("gobble-token",function(r){if(48===this.code){var o,i,a;let s=this.index,l=this.expr.charAt(this.index+1),c=n.call(this,l);if(!c)return;let u="";for(;o=this.code,i=c,95===o||i.some(([e,n])=>o>=e&&o<=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,r);return}this.throwError("unexpected char within number")}r.node={type:e.LITERAL,value:parseInt(u,"x"===(a=l)||"X"===a?16:"b"===a||"B"===a?2:8),raw:this.expr.substring(s,this.index)}}else(e.isDecimalDigit(this.code)||this.code===e.PERIOD_CODE)&&t.call(this,r)})}}),cE.plugins.register({name:"regex",init(e){e.hooks.add("gobble-token",function(n){if(47===this.code){let t=++this.index,r=!1;for(;this.index<this.expr.length;){if(47===this.code&&!r){let r,o=this.expr.slice(t,this.index),i="";for(;++this.index<this.expr.length;){let e=this.code;if(e>=97&&e<=122||e>=65&&e<=90||e>=48&&e<=57)i+=this.char;else break}try{r=new RegExp(o,i)}catch(e){this.throwError(e.message)}return n.node={type:e.LITERAL,value:r,raw:this.expr.slice(t-1,this.index)},n.node=this.gobbleTokenProperty(n.node),n.node}this.code===e.OBRACK_CODE?r=!0:r&&this.code===e.CBRACK_CODE&&(r=!1),this.index+=92===this.code?2:1}this.throwError("Unclosed Regex")}})}}),cE.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,r=this.gobbleExpression();if(r||this.throwError("Expected expression"),this.gobbleSpaces(),this.code===e.COLON_CODE){this.index++;let o=this.gobbleExpression();if(o||this.throwError("Expected expression"),n.node={type:"ConditionalExpression",test:t,consequent:r,alternate:o},t.operator&&e.binary_ops[t.operator]<=.9){let r=t;for(;r.right.operator&&e.binary_ops[r.right.operator]<=.9;)r=r.right;n.node.test=r.right,r.right=n.node,n.node=t}}else this.throwError("Expected :")}})}}),cE.plugins.register({name:"jsepTemplateLiteral",init(e){function n(e,t=!0){if(96===this.code){let n={type:"TemplateLiteral",quasis:[],expressions:[]},r="",o="",i=!1,a=this.expr.length,s=()=>n.quasis.push({type:"TemplateElement",value:{raw:o,cooked:r},tail:i});for(;this.index<a;){let a=this.expr.charAt(++this.index);if("`"===a)return this.index+=1,i=!0,s(),e.node=n,t&&(e.node=this.gobbleTokenProperty(e.node)),e.node;if("$"===a&&"{"===this.expr.charAt(this.index+1))this.index+=2,s(),o="",r="",n.expressions.push(...this.gobbleExpressions(125)),125!==this.code&&this.throwError("unclosed ${");else if("\\"===a)switch(o+=a,a=this.expr.charAt(++this.index),o+=a,a){case"n":r+="\n";break;case"r":r+="\r";break;case"t":r+=" ";break;case"b":r+="\b";break;case"f":r+="\f";break;case"v":r+="\v";break;default:r+=a}else r+=a,o+=a}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})}}),cE.addBinaryOp("in",7),cE.addBinaryOp("??",1);let cQ=V("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:",""),r=JSON.parse(localStorage.getItem(`openmrs:feature-flag-meta:${t}`)||"{}");e[t]={enabled:"true"===localStorage.getItem(n),...r}}return e}()});function c0(e,n,t){cQ.setState(r=>({flags:{...r.flags,[e]:{enabled:r.flags[e]?.enabled??!1,label:n,description:t}}}))}function c1(e){return cQ.getState().flags[e].enabled}function c2(e){return!window.offlineEnabled||(e??navigator.onLine)}cQ.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 c3=eV(function(e,n,t){eP(e,n,t)});function c5(e,n=!0,t=!1){return!!(e?n:t)}let c4=L("extensionsInternal",{slots:{},extensions:{}}),c6=L("extensionRenderings",{renderings:new Map}),c8=()=>V("extensionsInternal",{slots:{},extensions:{}});function c7(e){let n=c4.getState(),t=e(n);t!==n&&c4.setState(t)}let c9=null,ue=null;function un(){let e=c6.getState();return c9&&e===ue||(c9=new Map(e.renderings),ue=e,function(e){for(let n of(ui.clear(),e.values()))us(n,1);ua=!0}(c9)),c9}function ut(e){ue={renderings:e},c6.setState(ue,!0)}let ur=()=>V("extensions",{slots:{}});function uo(e){try{e()}catch(n){console.error(`The extension system's '${e.name}' recomputation failed`,n)}}let ui=new Map,ua=!1;function us(e,n){let t=JSON.stringify([e.slotName,e.extensionId,e.slotModuleName,e.extensionModuleName]),r=ui.get(t);if(!r){if(n<0)return;ui.set(t,{count:1,record:{slotModuleName:e.slotModuleName,extensionModuleName:e.extensionModuleName,slotName:e.slotName,extensionId:e.extensionId}}),ua=!0;return}r.count+=n,r.count<1&&(ui.delete(t),ua=!0)}function ul(){var e,n;if(un(),!ua)return;ua=!1;let t=Array.from(ui.values(),({record:e})=>e);t.sort(uc),e=nB.getState().mountedExtensions,n=t,e.length===n.length&&e.every((e,t)=>0===uc(e,n[t]))||nB.setState({mountedExtensions:t})}function uc(e,n){return uu(e.slotName,n.slotName)||uu(e.extensionId,n.extensionId)||uu(e.slotModuleName,n.slotModuleName)||uu(e.extensionModuleName,n.extensionModuleName)}function uu(e,n){return e===n?0:e<n?-1:1}ul(),c6.subscribe(()=>uo(ul));let up=c8(),ud=ur(),uf=nN(),uh=nj(),um=new Set,ug=!1;function ub(e){if(null===e)um=null;else if(null!==um)for(let n of e)um.add(n);uo(uy)}function uy(){if(!ug){ug=!0;try{for(let e=1;;e++){let n=um;if(null!==n&&0===n.size)return;um=new Set;try{!function(e,n,t,r,o,i=null){let a=ud.getState().slots,s={},l=!1,c=c2(),u=Object.entries(r.flags).filter(([,{enabled:e}])=>e).map(([e])=>e);for(let[r,d]of Object.entries(e.slots)){var p;let f=a[r];if(f&&i&&!i.has(r)){s[r]=f;continue}let{config:h}=(p=d.name,n.slots[p]??{loaded:!1,config:{}}),m=function(e,n,t,r,o,i,a){let s=function(e,n){let t=e.add||[],r=e.remove||[],o=e.order||[],{extensions:i}=up.getState();return[...n,...t].filter(e=>!r.includes(e)).sort((e,t)=>uD(e,o,i[uA(e)]?.order,n)-uD(t,o,i[uA(t)]?.order,n))}(t,n.slots[e].attachedIds),l=[];for(let c of s){let{config:s}=nR(r,e,c),u=t.configure?.[c]??null,p=u?c3({},s,u):s,d=uA(c),f=n.extensions[d];if(f){let e=p?.["Display conditions"]?.privileges??f.privileges??[];if(e&&("string"==typeof e||Array.isArray(e)&&e.length>0)&&(!a?.user||!oo(e,a.user))||f.featureFlag&&!o.includes(f.featureFlag)||window.offlineEnabled&&!c5(i,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,displayConditionExpression:p?.["Display conditions"]?.expression||f.displayExpression})}}return l}(r,e,h,t,u,c,o.session);f&&f.moduleName===d.moduleName&&nn(f.candidateExtensions,m)?s[r]=f:(s[r]={moduleName:d.moduleName,candidateExtensions:m},l=!0)}(l||Object.keys(a).length!==Object.keys(s).length)&&ud.setState({slots:s})}(up.getState(),uf.getState(),uh.getState(),cQ.getState(),r8.getState(),n)}catch(e){throw um=null===n||null===um?null:new Set([...n,...um]),e}if(e>=20)return void console.error("The extension system stopped recomputing after 20 passes because something keeps invalidating slots in response to the extension store being written. Some slots are left stale until the next write.")}}finally{ug=!1}}}function u_(e,n){let t=new Set;for(let r of Object.keys(e))e[r]!==n[r]&&t.add(r);for(let r of Object.keys(n))r in e||t.add(r);return t}function uv(){ub(null)}function u$(e,n){return{moduleName:n,name:e,attachedIds:[]}}function uA(e){let[n]=e.split("#");return n}function uw(e){var n;let t;return n=up.getState(),t=uA(e),n.extensions[t]}up.subscribe((e,n)=>{ub(e.extensions!==n.extensions?null:u_(e.slots,n.slots))}),uf.subscribe((e,n)=>{ub(u_(e.slots,n.slots))}),uh.subscribe((e,n)=>{ub(u_(e.configs,n.configs))}),cQ.subscribe(()=>ub(null)),r8.subscribe(()=>ub(null)),uv(),b(uv);let uk=e=>c7(n=>({...n,extensions:{...n.extensions,[e.name]:{...e}}}));function ux(e,n){c7(t=>{let r=t.slots[e];return r?{...t,slots:{...t.slots,[e]:{...r,attachedIds:[...r.attachedIds,n]}}}:{...t,slots:{...t.slots,[e]:{...u$(e),attachedIds:[n]}}}})}function uC(e,n){c7(t=>{let r=t.slots[e];return r&&r.attachedIds.includes(n)?{...t,slots:{...t.slots,[e]:{...r,attachedIds:r.attachedIds.filter(e=>e!==n)}}}:t})}function uE(e){c7(n=>{let t=n.slots[e];return t?{...n,slots:{...n.slots,[e]:{...t,attachedIds:[]}}}:n})}function uD(e,n,t,r){let o=n.indexOf(e);if(-1!==o)return o;{if(void 0!==t)return 1e3+t;let n=r.indexOf(e);return -1!==n?2e3+n:3e3}}function uS(e,n){var t;return function(e,n,t=null,r){let o;return e.filter(e=>{let i=e.displayConditionExpression;if("string"!=typeof i||0===i.trim().length)return!0;o??(o=n&&"object"==typeof n?{session:t,...n}:{session:t});try{return!!cT(i,o)}catch(n){return console.error(`Error while evaluating expression '${i}' for ${e.id}`+(r?` in ${r}`:""),n),!1}})}((t=e,ud.getState().slots[t]?.candidateExtensions??[]),n,r8.getState().session,e)}let uM=(e,n)=>up.setState(t=>{let r=t.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}.`),t;if(r&&r==e)return t;if(t.slots[n])return{...t,slots:{...t.slots,[n]:{...t.slots[n],moduleName:e}}};let o=u$(n,e);return{...t,slots:{...t.slots,[n]:{...o}}}}),uz=L("left-nav",{slotName:null,basePath:window.spaBase,mode:"normal"});function uP({name:e,basePath:n,mode:t,componentContext:r,state:o}){uz.setState({slotName:e,basePath:n,mode:t??"normal",componentContext:r,state:o})}function uO(e){uz.getState().slotName===e&&uz.setState(uz.getInitialState(),!0)}let uT=0,uB=null,uI={bootstrap:{millis:15e3,dieOnTimeout:!0},mount:{millis:15e3,dieOnTimeout:!0},unmount:{millis:15e3,dieOnTimeout:!0}};async function uN(e,n){return(await (uB??(uB=new Promise((e,n)=>{t8({name:"openmrs-extension-host",bootstrap:()=>Promise.resolve(),mount:n=>(e(n.mountParcel),Promise.resolve()),unmount:()=>Promise.resolve()},{domElement:document.createElement("div")}).mountPromise.catch(n)}).catch(e=>(console.error("The host parcel used to mount extensions could not be mounted. Falling back to mounting extensions as root parcels, which leaks their DOM elements.",e),t8))),uB))("function"==typeof e?()=>e().then(e=>({timeouts:uI,...e})):{timeouts:uI,...e},n)}function uj(e,n){let t,r=uN(e,n).then(e=>t=e);return{mount:()=>r.then(e=>e.mount()),unmount:()=>r.then(e=>e.unmount()),update:e=>r.then(n=>n.update?.(e)),getStatus:()=>t?.getStatus()??"LOADING_SOURCE_CODE",get loadPromise(){return r.then(e=>e.loadPromise)},get bootstrapPromise(){return r.then(e=>e.bootstrapPromise)},get mountPromise(){return r.then(e=>e.mountPromise)},get unmountPromise(){return r.then(e=>e.unmountPromise)}}}async function uR(e,n,t,r,o=e=>e,i={}){let a=uA(r),s=uw(r),l=null;if(e){if(!s)throw Error(`Couldn't find extension '${a}' to attach to '${n}'`);let{meta:u,moduleName:p,online:d,offline:f,load:h}=s;if(function(e=!0,n=!1){return c5(c2(),e,n)}(d,f)){let s,d=uT++,f=`${n}/${r}-${d}`;e.dataset.extensionRenderingId=f;let m=e=>{try{let e,n;(n=(e=un()).get(f))&&(e.delete(f),us(n,-1),ut(e))}catch(n){console.error(e,n)}};try{var c;let e;c={renderingId:f,extensionName:a,extensionModuleName:p,extensionId:r,slotName:n,slotModuleName:t},(e=un()).has(c.renderingId)||(e.set(c.renderingId,c),us(c,1),ut(e))}catch(e){throw m(`Recomputing configuration after registering '${r}' failed also failed`),e}try{s=await h()}catch(e){throw m(`Recomputing configuration after '${r}' failed to load also failed`),e}try{l=await uN(o({...s,name:`${n}/${a}-${d}`}),{...i,_meta:u,_extensionContext:{extensionId:r,extensionSlotName:n,extensionSlotModuleName:t,extensionModuleName:p},domElement:e})}catch(e){throw m(`Recomputing configuration after '${r}' failed to mount also failed`),e}l.mountPromise.then(void 0,e=>{console.error(`Extension '${r}' in slot '${n}' failed to mount`,e),m(`Recomputing configuration after '${r}' failed to mount also failed`)}),l.unmountPromise.then(()=>m(`Recomputing configuration after unmounting '${r}' failed`),e=>{console.error(`Extension '${r}' in slot '${n}' failed to unmount`,e),m(`Recomputing configuration after '${r}' failed to unmount also failed`)})}}else console.warn(`Tried to render ${r} into ${n} but no DOM element was available.`);return l}function uF(){return{current:"unavailable",notAvailable:!0,active:!1}}let uL="x-omrs-offline-response-body",uW="x-omrs-offline-response-status",uV="x-omrs-offline-caching-strategy",uG="u">typeof crypto&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),uU=new Uint8Array(16),uq=[];for(let e=0;e<256;++e)uq.push((e+256).toString(16).slice(1));let uH=function(e,n,t){if(uG&&!n&&!e)return uG();let r=(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(uU)})();if(r[6]=15&r[6]|64,r[8]=63&r[8]|128,n){t=t||0;for(let e=0;e<16;++e)n[t+e]=r[e];return n}return function(e,n=0){return uq[e[n+0]]+uq[e[n+1]]+uq[e[n+2]]+uq[e[n+3]]+"-"+uq[e[n+4]]+uq[e[n+5]]+"-"+uq[e[n+6]]+uq[e[n+7]]+"-"+uq[e[n+8]]+uq[e[n+9]]+"-"+uq[e[n+10]]+uq[e[n+11]]+uq[e[n+12]]+uq[e[n+13]]+uq[e[n+14]]+uq[e[n+15]]}(r)},uK="OFFLINE+";function uY(){return uK+uH()}function uJ(e){return e.startsWith(uK)}var uZ=t(47499),uX=t.n(uZ);function uQ({to:e,templateParams:n,onBeforeNavigate:t,children:r,...o}){return(0,uZ.useEffect)(()=>{o.href&&console.warn(`ConfigurableLink does not support the href prop. Use the 'to' prop instead. The provided href value is '${o.href}'`),o.onClick&&console.warn(`ConfigurableLink does not support the onClick prop. Use the 'onBeforeNavigate' prop instead. The 'to' prop of the offending link is ${e}`)},[]),uX().createElement("a",{onClick:r=>{0===r.button&&!r.ctrlKey&&!r.shiftKey&&!r.altKey&&!r.metaKey&&(r.preventDefault(),t?.(r),rY({to:e,templateParams:n})),0===r.button&&(r.ctrlKey||r.metaKey)&&t?.(r),0===r.button&&r.shiftKey&&t?.(r),1===r.button&&t?.(r)},href:rH(e,n),...o},r)}let u0=L("modalRegistry",{modals:{}}),u1=L("workspaceRegistrations",{workspaces:{}}),u2=L("workspaceGroups",{workspaceGroups:{}}),u3=new Set;function u5(e){let n=u1.getState().workspaces;if(n[e])return n[e];{let n=uw(e);if(n){var t;let r;return u3.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.`),u3.add(e)),{name:n.name,title:(t=n,"string"==typeof(r=t?.meta?.title)?r:r&&"object"==typeof r?ie(t.moduleName,r.key,r.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.`)}}let u4=L("workspace2",{registeredGroupsByName:{},registeredWindowsByName:{},registeredWorkspacesByName:{},openedGroup:null,openedWindows:[],workspaceTitleByWorkspaceName:{},isMostRecentlyOpenedWindowHidden:!1});function u6(e){let{openedWindows:n}=u4.getState();return n.findIndex(n=>n.openedWorkspaces.find(n=>n.workspaceName===e))}let u8=(0,uZ.createContext)({moduleName:"",featureName:""});function u7(e,n){"function"==typeof n&&(n=n(e));let t={};for(let[r,o]of Object.entries(n)){let n=function(...n){e.setState(e=>o(e,...n))};t[r]=n}return t}let u9=e=>e;function pe(e,n=u9,t){let r=(0,uZ.useCallback)(n=>e.subscribe(n),[e]),o=(0,uZ.useCallback)(()=>n(e.getState()),[e,n]),i=(0,uZ.useSyncExternalStore)(r,o,o),a=(0,uZ.useMemo)(()=>t?u7(e,t):null,[e,t]);return(0,uZ.useMemo)(()=>a?{...i,...a}:i,[i,a])}function pn(e,n){return pe(e,u9,n)}function pt(e){return function(n){let t=(0,uZ.useCallback)(n=>e.subscribe(n),[]),r=(0,uZ.useCallback)(()=>e.getState(),[]),o=(0,uZ.useSyncExternalStore)(t,r,r),i=(0,uZ.useMemo)(()=>n?u7(e,n):null,[n]);return(0,uZ.useMemo)(()=>i?{...o,...i}:o,[o,i])}}let pr=[];Object.freeze(pr);let po={candidateExtensions:pr};Object.freeze(po);let pi=e=>{let n=(0,uZ.useCallback)(n=>n.slots?.[e]??po,[e]);return pe(ur(),n)},pa=e=>e.session;function ps(e,n){let t,{candidateExtensions:r}=pi(e),o=pe(r8,pa),i=(T((t=(0,uZ.useRef)(n)).current,n)||(t.current=n),t.current);return(0,uZ.useMemo)(()=>uS(e,i),[e,i,o,r])}function pl(e,n){let{moduleName:t}=(0,uZ.useContext)(u8);if(!t)throw Error("ComponentContext has not been provided. This should come from @openmrs/esm-react-utils.");return(0,uZ.useEffect)(()=>{uM(t,e)},[t,e]),{extensions:ps(e,n),extensionSlotName:e,extensionSlotModuleName:t}}function pc(e){return e}function pu({name:e,extensionSlotName:n,select:t=pc,children:r,state:o,style:i,...a}){if(r&&o)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,uZ.useRef)(null),{extensions:c,extensionSlotModuleName:u}=pl(s,o),p=(0,uZ.useMemo)(()=>t(c),[t,c]),d=(0,uZ.useMemo)(()=>{if("function"==typeof r&&!uX().isValidElement(r))return p.map(e=>r(e,o))},[r,p]);return uX().createElement("div",{ref:l,"data-extension-slot-name":s,"data-extension-slot-module-name":u,style:{...i,position:"relative"},...a},s&&p?.map((e,n)=>uX().createElement(u8.Provider,{key:e.id,value:{moduleName:u,featureName:"",extension:{extensionId:e.id,extensionSlotName:s,extensionSlotModuleName:u}}},d?.[n]??("function"!=typeof r?r:null)??uX().createElement(dj,{state:o}))))}var pp=t(5338);function pd(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n&&(r=r.filter(function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable})),t.push.apply(t,r)}return t}function pf(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?pd(Object(t),!0).forEach(function(n){var r,o,i;r=e,o=n,i=t[n],o in r?Object.defineProperty(r,o,{value:i,enumerable:!0,configurable:!0,writable:!0}):r[o]=i}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):pd(Object(t)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))})}return e}function ph(e){return(ph="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 pm(e){return(pm="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 pg(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(pm(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(pm(e)));return e}}var pb=null;try{pb=require("react").createContext()}catch(e){}var py={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 p_(e,n){return e.rootComponent?Promise.resolve():e.loadRootComponent(n).then(function(n){e.rootComponent=n})}function pv(e,n){return new Promise(function(t,r){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 o,i=pk(e,n,function(){t(this)}),a=pg(e,n)(),s=function(e){var n=e.reactDom,t=e.renderType,r=e.elementToRender,o=e.domElement,i=n[t];if("function"!=typeof i)throw Error('renderType "'.concat(t,'" did not return a function.'));switch(t){case"createRoot":case"unstable_createRoot":case"createBlockingRoot":case"unstable_createBlockingRoot":var a=i(o);return a.render(r),a;case"hydrateRoot":return i(o,r);default:return i(r,o),null}}({elementToRender:i,domElement:a,reactDom:pw(e),renderType:"function"==typeof(o=e).renderType?o.renderType():o.renderType});e.domElements[n.name]=a,e.renderResults[n.name]=s})}function p$(e,n){return new Promise(function(t){e.unmountResolves[n.name]=t;var r=e.renderResults[n.name];r&&r.unmount?r.unmount():pw(e).unmountComponentAtNode(e.domElements[n.name]),delete e.domElements[n.name],delete e.renderResults[n.name]})}function pA(e,n){return new Promise(function(t){e.updateResolves[n.name]||(e.updateResolves[n.name]=[]),e.updateResolves[n.name].push(t);var r=pk(e,n,null),o=e.renderResults[n.name];if(o&&o.render)o.render(r);else{var i=pg(e,n)();pw(e).render(r,i)}})}function pw(e){return e.ReactDOMClient||e.ReactDOM}function pk(e,n,t){var r=e.React.createElement(e.rootComponent,n),o=pb?e.React.createElement(pb.Provider,{value:n},r):r;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),o=e.React.createElement(e.errorBoundaryClass,n,o)),o=e.React.createElement(e.SingleSpaRoot,pf(pf({},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])}}),o)}var px=t(58779),pC=t(59324),pE=t(14993);let pD={strictMode:!0,throwErrorsToConsole:!0,disableTranslations:!1},pS=new Map;(0,pE.r2)(pS);let pM={errorRetryCount:3,fetcher:r5,focusThrottleInterval:18e5,revalidateIfStale:!0,revalidateOnFocus:!1,revalidateOnReconnect:!1,refreshInterval:0,shouldRetryOnError:e=>{if(e instanceof r6){let n=e.response.status;return!!(n>=500)||401===n||403===n||429===n}return!0},provider:()=>pS};function pz(e,n){return function(e){if("object"!==ph(e))throw Error("single-spa-react requires a configuration object");var n,t=pf(pf({},py),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");!pb&&t.React.createContext&&(pb=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 r={bootstrap:p_.bind(null,t),mount:pv.bind(null,t),unmount:p$.bind(null,t)};return t.parcelCanUpdate&&(r.update=pA.bind(null,t)),r}({React:uX(),ReactDOMClient:pp,rootComponent:(function(e){if("object"!=typeof e||"string"!=typeof e.featureName||"string"!=typeof e.moduleName)throw Error("Invalid options");let n=Object.assign({},pD,e),t={...pM,...n.swrConfig};return function(e){var r,o,i,a,s;return i=o=class extends(r=uX().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 uX().createElement("div",null,"An error has occurred. Please try reloading the page.");{let r=uX().createElement(uZ.Suspense,{fallback:null},uX().createElement(pC.BE,{value:t},uX().createElement(u8.Provider,{value:this.state.config},n.disableTranslations?uX().createElement(e,this.props):uX().createElement(px.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},uX().createElement(e,this.props)))));return n.strictMode&&uX().StrictMode?uX().createElement(uX().StrictMode,null,r):r}}constructor(e){super(e),this.state={caughtError:null,caughtErrorInfo:null,config:{moduleName:n.moduleName,featureName:n.featureName,extension:e._extensionContext}}}},a="displayName",s=`OpenmrsReactComponent(${n.featureName})`,a in i?Object.defineProperty(i,a,{value:s,enumerable:!0,configurable:!0,writable:!0}):i[a]=s,o}})(n)(e)})}function pP(e,n){return()=>e().then(({default:e})=>pz(e,n))}function pO(e,n){return()=>Promise.resolve(pz(e,n))}let pT=pP,pB=new Map;function pI(e,n){let t=(0,uZ.useRef)(n??{}),r=(0,uZ.useRef)(n=>ob(e,n)),o=(0,uZ.useRef)(Symbol());return(0,uZ.useEffect)(()=>{let t=n??{},r=o.current;return null===og(e)?oh(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.`),ob(e,()=>t)),pB.set(e,r),()=>{pB.get(e)===r&&(om(e),pB.delete(e))}},[e]),(0,uZ.useEffect)(()=>{let r=n??{};T(t.current,r)||(ob(e,()=>r),t.current=r)},[n]),r.current}function pN({namespace:e,value:n}){return pI(e,n),null}let pj=({children:e,value:n,fallback:t})=>n?uX().createElement(uX().Fragment,null,e):t?uX().createElement(uX().Fragment,null,t):null;function pR(){let e=(0,uZ.useRef)();return(!e.current||e.current.signal.aborted)&&(e.current=new AbortController),(0,uZ.useEffect)(()=>{let n=e.current;return()=>n?.abort()},[]),e.current}function pF(e,n=e=>e??{}){let[t,r]=(0,uZ.useState)(()=>{if(pL(e))return;let t=og(e);if(null!==t)return n?n(t):t});return(0,uZ.useEffect)(()=>{if(pL(e))throw Error(`The namespace supplied to useAppContext must be a non-empty string, but was "${e}".`)},[e]),(0,uZ.useEffect)(()=>oy(e,e=>{if(null==e)return void r(void 0);let t=n?n(e):e;r(e=>T(e,t)?e:t)}),[e,n]),t}function pL(e){return"string"!=typeof e||0===e.trim().length}function pW(e){let n=ps(e);return(0,uZ.useMemo)(()=>n.map(e=>e.id),[n])}function pV(e,n){let{data:t,error:r,mutate:o,isLoading:i,isValidating:a}=(0,pC.Ay)(`${id}?patient=${e}&includeEncounterless=${n}`,r5);return(0,uZ.useMemo)(()=>({isLoading:i,data:t?.data.results??[],error:r,mutate:o,isValidating:a}),[t,r,i,a,o])}function pG(e){(0,uZ.useEffect)(()=>{if(e){let e=window.getComputedStyle(document.body).overflow;return document.body.style.overflow="hidden",()=>{document.body.style.overflow=e}}},[e])}let pU={},pq=`No ComponentContext has been provided. This should come from "openmrsComponentDecorator".
16
16
  Usually this is already applied when using "getAsyncLifecycle" or "getSyncLifecycle".`;function pH(e){let{moduleName:n,extension:t}=(0,uZ.useContext)(u8),r=e?.externalModuleName??n;if(!r&&!t)throw Error(pq);let o=function(e){let n=(0,uZ.useMemo)(()=>nI(e),[e]),t=function(e){let[n,t]=(0,uZ.useState)(()=>{let n=e.getState();return n.loaded&&n.config?n.config:null});return(0,uZ.useEffect)(()=>e?.subscribe(e=>{e.loaded&&e.config&&t(e.config)}),[e]),n}(n);if(!t)throw pU[e]||(pU[e]=new Promise(e=>{let t=n.subscribe(n=>{n.loaded&&n.config&&(e(n.config),t())})})),pU[e];return t}(r),i=function(e){let n=(0,uZ.useMemo)(nj,[]),t=function(e,n){let[t,r]=(0,uZ.useState)(n?()=>{let t=nR(e.getState(),n.extensionSlotName,n.extensionId);if(t.loaded&&t.config)return t.config}:null);return(0,uZ.useEffect)(()=>{if(n)return e.subscribe(e=>{let o=nR(e,n.extensionSlotName,n.extensionId);o.loaded&&o.config&&!nn(o.config,t)&&r(o.config)})},[e,n,t]),t}(n,e);if(!t&&e){let t=`${e.extensionSlotName}-${e.extensionId}`;throw!pU[t]&&n&&(pU[t]=new Promise(t=>{let r=n.subscribe(n=>{let o=nR(n,e.extensionSlotName,e.extensionId);o.loaded&&o.config&&(t(o.config),r())})})),pU[t]}return t||{}}(t);return(0,uZ.useMemo)(()=>e?.externalModuleName&&r===e.externalModuleName?{...o}:{...o,...i},[r,e?.externalModuleName,o,i])}let pK=ps;function pY(){let[e,n]=(0,uZ.useState)(c2());return(0,uZ.useEffect)(()=>b(({online:e})=>n(e)),[]),e}function pJ(e,n=300){let[t,r]=(0,uZ.useState)(e);return(0,uZ.useEffect)(()=>{let t=setTimeout(()=>{r(e)},n);return()=>{clearTimeout(t)}},[e,n]),t}var pZ=t(54225);let pX=`custom:${[["admissionDecisionConcept","ref"],["admissionEncounterType","ref"],["admissionForm","ref"],["atFacilityVisitType","ref"],["bedAssignmentEncounterType","ref"],["cancelADTRequestEncounterType","ref"],["checkInClerkEncounterRole","ref"],["checkInEncounterType","ref"],["clinicianEncounterRole","ref"],["conceptSourcesForDiagnosisSearch","ref"],["consultEncounterType","ref"],["consultFreeTextCommentsConcept","ref"],["denyAdmissionConcept","ref"],["diagnosisMetadata","ref"],["diagnosisSets","ref"],["dischargeForm","ref"],["dispositionDescriptor","ref"],["dispositions","ref"],["emrApiConceptSource","ref"],["exitFromInpatientEncounterType","ref"],["extraPatientIdentifierTypes","ref"],["fullPrivilegeLevel","ref"],["highPrivilegeLevel","ref"],["identifierTypesToSearch","ref"],["inpatientNoteEncounterType","ref"],["lastViewedPatientSizeLimit","ref"],["metadataSourceName","ref"],["motherChildRelationshipType","ref"],["narrowerThanConceptMapType","ref"],["nonDiagnosisConceptSets","ref"],["orderingProviderEncounterRole","ref"],["patientDiedConcept","ref"],["personImageDirectory","ref"],["primaryIdentifierType","ref"],["sameAsConceptMapType","ref"],["suppressedDiagnosisConcepts","ref"],["supportsAdmissionLocationTag","(uuid,display,name,links)"],["supportsLoginLocationTag","(uuid,display,name,links)"],["supportsTransferLocationTag","(uuid,display,name,links)"],["supportsVisitsLocationTag","(uuid,display,name,links)"],["telephoneAttributeType","ref"],["testPatientPersonAttributeType","ref"],["transferForm","ref"],["transferRequestEncounterType","ref"],["transferWithinHospitalEncounterType","ref"],["unknownCauseOfDeathConcept","ref"],["unknownLocation","ref"],["unknownPatientPersonAttributeType","ref"],["unknownProvider","ref"],["visitAssignmentHandlerAdjustEncounterTimeOfDayIfNecessary","ref"],["visitExpireHours","ref"],["visitNoteEncounterType","ref"]].map(([e,n])=>`${e}:${n}`).join(",")}`;function pQ(){let e=`${r0}/emrapi/configuration?v=${pX}`,n=(0,pZ.A)(e,r5);return(0,uZ.useMemo)(()=>({emrConfiguration:n.data?.data,isLoadingEmrConfiguration:n.isLoading,mutateEmrConfiguration:n.mutate,errorFetchingEmrConfiguration:n.error}),[n])}function p0(e){let n=ps(e);return(0,uZ.useMemo)(()=>Object.fromEntries(n.map(e=>[e.name,e.meta])),[n])}pt(c8());let p1=pt(ur());function p2(e){let{flags:n}=pe(cQ);return n[e]?.enabled??!1}function p3(){let[,e]=(0,uZ.useState)(0);return(0,uZ.useCallback)(()=>{e(e=>e+1)},[])}function p5(e,n,t={}){return p6(e,n,p4,t)}let p4={getPaginatedUrl:(e,n,t)=>{if(!e)return null;{let r=new URL(r3(e.toString()),window.location.toString());return r.searchParams.set("limit",""+n),r.searchParams.set("startIndex",""+t),r.searchParams.set("totalCount","true"),r.toString()}},getNextUrl:e=>{let n=e?.links?.find(e=>"next"==e.rel)?.uri;if(!n)return null;{let e=new URL(n);return e.host=window.location.host,e.protocol=window.location.protocol,e.toString()}},getTotalCount:e=>e?.totalCount??NaN,getCurrentPageSize:e=>e?.results?.length??NaN,getData:e=>e?.results};function p6(e,n,t,r={}){let{getPaginatedUrl:o,getTotalCount:i,getCurrentPageSize:a,getData:s}=t,{immutable:l,swrConfig:c}=r,u=r.fetcher??r5,[p,d]=(0,uZ.useState)(1),f=(0,uZ.useRef)(NaN),h=(0,uZ.useRef)(NaN),m=(0,uZ.useRef)(p),g=(0,uZ.useRef)(!1),b=(0,uZ.useRef)(!1),y=e?.toString()??"",[v,$]=(0,uZ.useState)(y);y!==v&&($(y),d(1),m.current=1,f.current=NaN,h.current=NaN,g.current=!1,b.current=!1);let A=(p-1)*n,w=(0,uZ.useMemo)(()=>o(e,n,A),[e,n,A]),{data:k,...x}=(l?pZ.A:pC.Ay)(w,u,c);k?.data&&(f.current=i(k?.data),h.current=a(k?.data),g.current=!0);let C=Math.ceil(f.current/n),E=(0,uZ.useCallback)(e=>{if(!Number.isInteger(e)||e<1)return void console.warn(`useServerPagination: ignoring goTo(${e}); page must be a positive integer.`);let t=Math.ceil(f.current/n);!g.current||Number.isNaN(t)||e<=t?(m.current=e,d(e)):console.warn("Invalid attempt to go to out of bounds page: "+e)},[n]);(0,uZ.useEffect)(()=>{if(!g.current)return;if(Number.isNaN(f.current)){b.current||(b.current=!0,console.warn(`useServerPagination: ${y} returned no total count, so out-of-range pages cannot be detected.`));return}let e=Math.max(1,Math.ceil(f.current/n));p>e&&(console.warn(`Invalid attempt to go to out of bounds page: ${p}; returning to page ${e}.`),m.current=e,d(e))},[p,n,y,k]);let D=(0,uZ.useCallback)(()=>{E(m.current+1)},[E]),S=(0,uZ.useCallback)(()=>{E(m.current-1)},[E]);return{data:s(k?.data),totalPages:C,totalCount:f.current,currentPage:p,currentPageSize:h.current,paginated:C>1,showNextButton:p<C,showPreviousButton:p>1,goTo:E,goToNext:D,goToPrevious:S,...x}}function p8(e,n,t={}){return p6(e,n,p7(),t)}function p7(){return{getPaginatedUrl:(e,n,t)=>{if(!e)return null;{let r=new URL(r3(e.toString()),window.location.toString());return r.searchParams.set("_count",""+n),r.searchParams.set("_getpagesoffset",""+t),r.toString()}},getNextUrl:e=>{let n=e?.link?.find(e=>"next"==e.relation)?.url;if(!n)return null;{let e=new URL(n);return e.host=window.location.host,e.protocol=window.location.protocol,e.toString()}},getTotalCount:e=>e?.total??NaN,getCurrentPageSize:e=>e?.entry?.length??NaN,getData:e=>e?.entry?.map(e=>e.resource)}}var p9=t(19888);let de=uX().use||(e=>{if("pending"===e.status)throw e;if("fulfilled"===e.status)return e.value;if("rejected"===e.status)throw e.reason;throw e.status="pending",e.then(n=>{e.status="fulfilled",e.value=n},n=>{e.status="rejected",e.reason=n}),e}),dn={dedupe:!0};pE.qv.defineProperty(pE.BE,"defaultValue",{value:pE.sb});let dt=(0,pE.qm)((e,n,t)=>{let{cache:r,compare:o,suspense:i,fallbackData:a,revalidateOnMount:s,revalidateIfStale:l,refreshInterval:c,refreshWhenHidden:u,refreshWhenOffline:p,keepPreviousData:d}=t,[f,h,m,g]=pE.bZ.get(r),[b,y]=(0,pE.lK)(e),v=(0,uZ.useRef)(!1),$=(0,uZ.useRef)(!1),A=(0,uZ.useRef)(b),w=(0,uZ.useRef)(n),k=(0,uZ.useRef)(t),x=()=>k.current.isVisible()&&k.current.isOnline(),[C,E,D,S]=(0,pE.r9)(r,b),M=(0,uZ.useRef)({}).current,z=(0,pE.b0)(a)?t.fallback[b]:a,P=(e,n)=>{for(let t in M)if("data"===t){if(!o(e[t],n[t])&&(!(0,pE.b0)(e[t])||!o(L,n[t])))return!1}else if(n[t]!==e[t])return!1;return!0},O=(0,uZ.useMemo)(()=>{let e=!!b&&!!n&&((0,pE.b0)(s)?!k.current.isPaused()&&!i&&(!!(0,pE.b0)(l)||l):s),t=n=>{let t=(0,pE.rL)(n);return(delete t._k,e)?{isValidating:!0,isLoading:!0,...t}:t},r=C(),o=S(),a=t(r),c=r===o?a:t(o),u=a;return[()=>{let e=t(C());return P(e,u)?(u.data=e.data,u.isLoading=e.isLoading,u.isValidating=e.isValidating,u.error=e.error,u):(u=e,e)},()=>c]},[r,b]),T=(0,p9.useSyncExternalStore)((0,uZ.useCallback)(e=>D(b,(n,t)=>{P(t,n)||e()}),[r,b]),O[0],O[1]),B=!v.current,I=f[b]&&f[b].length>0,N=T.data,j=(0,pE.b0)(N)?z:N,R=T.error,F=(0,uZ.useRef)(j),L=d?(0,pE.b0)(N)?F.current:N:j,W=(!I||!!(0,pE.b0)(R))&&(B&&!(0,pE.b0)(s)?s:!k.current.isPaused()&&(i?!(0,pE.b0)(j)&&l:(0,pE.b0)(j)||l)),V=!!(b&&n&&B&&W),G=(0,pE.b0)(T.isValidating)?V:T.isValidating,U=(0,pE.b0)(T.isLoading)?V:T.isLoading,q=(0,uZ.useCallback)(async e=>{let n,r,i=w.current;if(!b||!i||$.current||k.current.isPaused())return!1;let a=!0,s=e||{},l=!m[b]||!s.dedupe,c=()=>pE.dO?!$.current&&b===A.current&&v.current:b===A.current,u={isValidating:!1,isLoading:!1},p=()=>{E(u)},d=()=>{let e=m[b];e&&e[1]===r&&delete m[b]},g={isValidating:!0};(0,pE.b0)(C().data)&&(g.isLoading=!0);try{if(l&&(E(g),t.loadingTimeout&&(0,pE.b0)(C().data)&&setTimeout(()=>{a&&c()&&k.current.onLoadingSlow(b,t)},t.loadingTimeout),m[b]=[i(y),(0,pE.lg)()]),[n,r]=m[b],n=await n,l&&setTimeout(d,t.dedupingInterval),!m[b]||m[b][1]!==r)return l&&c()&&k.current.onDiscarded(b),!1;u.error=pE.ZH;let e=h[b];if(!(0,pE.b0)(e)&&(r<=e[0]||r<=e[1]||0===e[1]))return p(),l&&c()&&k.current.onDiscarded(b),!1;let s=C().data;u.data=o(s,n)?s:n,l&&c()&&k.current.onSuccess(n,b,t)}catch(t){d();let e=k.current,{shouldRetryOnError:n}=e;!e.isPaused()&&(u.error=t,l&&c()&&(e.onError(t,b,e),(!0===n||(0,pE.Tn)(n)&&n(t))&&(!k.current.revalidateOnFocus||!k.current.revalidateOnReconnect||x())&&e.onErrorRetry(t,b,e,e=>{let n=f[b];n&&n[0]&&n[0](pE.bu.ERROR_REVALIDATE_EVENT,e)},{retryCount:(s.retryCount||0)+1,dedupe:!0})))}return a=!1,p(),!0},[b,r]),H=(0,uZ.useCallback)((...e)=>(0,pE.mF)(r,A.current,...e),[]);if((0,pE.Es)(()=>{w.current=n,k.current=t,(0,pE.b0)(N)||(F.current=N)}),(0,pE.Es)(()=>{if(!b)return;let e=q.bind(pE.ZH,dn),n=0,t=(0,pE.aw)(b,f,(t,r={})=>{if(t==pE.bu.FOCUS_EVENT){let t=Date.now();k.current.revalidateOnFocus&&t>n&&x()&&(n=t+k.current.focusThrottleInterval,e())}else if(t==pE.bu.RECONNECT_EVENT)k.current.revalidateOnReconnect&&x()&&e();else if(t==pE.bu.MUTATE_EVENT)return q();else if(t==pE.bu.ERROR_REVALIDATE_EVENT)return q(r)});return $.current=!1,A.current=b,v.current=!0,E({_k:y}),W&&((0,pE.b0)(j)||pE.X3?e():(0,pE.mf)(e)),()=>{$.current=!0,t()}},[b]),(0,pE.Es)(()=>{let e;function n(){let n=(0,pE.Tn)(c)?c(C().data):c;n&&-1!==e&&(e=setTimeout(t,n))}function t(){!C().error&&(u||k.current.isVisible())&&(p||k.current.isOnline())?q(dn).then(n):n()}return n(),()=>{e&&(clearTimeout(e),e=-1)}},[c,u,p,b]),(0,uZ.useDebugValue)(L),i&&(0,pE.b0)(j)&&b){if(!pE.dO&&pE.X3)throw Error("Fallback data is required when using suspense in SSR.");w.current=n,k.current=t,$.current=!1;let e=g[b];if((0,pE.b0)(e)||de(H(e)),(0,pE.b0)(R)){let e=q(dn);(0,pE.b0)(L)||(e.status="fulfilled",e.value=!0),de(e)}else throw R}return{mutate:H,get data(){return M.data=!0,L},get error(){return M.error=!0,R},get isValidating(){return M.isValidating=!0,G},get isLoading(){return M.isLoading=!0,U}}}),dr=Promise.resolve(),di=(0,pE.Ht)(dt,e=>(n,t,r)=>{let o,i=(0,uZ.useRef)(!1),{cache:a,initialSize:s=1,revalidateAll:l=!1,persistSize:c=!1,revalidateFirstPage:u=!0,revalidateOnMount:p=!1,parallel:d=!1}=r,[,,,f]=pE.bZ.get(pE.PP);try{(o=(0,pE.lK)(n?n(0,null):null)[0])&&(o=pE.q9+o)}catch(e){}let[h,m,g]=(0,pE.r9)(a,o),b=(0,uZ.useCallback)(()=>(0,pE.b0)(h()._l)?s:h()._l,[a,o,s]);(0,p9.useSyncExternalStore)((0,uZ.useCallback)(e=>o?g(o,()=>{e()}):()=>{},[a,o]),b,b);let y=(0,uZ.useCallback)(()=>{let e=h()._l;return(0,pE.b0)(e)?s:e},[o,s]),v=(0,uZ.useRef)(y());(0,pE.Es)(()=>{if(!i.current){i.current=!0;return}o&&m({_l:c?v.current:y()})},[o,a]);let $=p&&!i.current,A=e(o,async e=>{let o=h()._i,i=h()._r;m({_r:pE.ZH});let s=[],c=y(),[p]=(0,pE.r9)(a,e),g=p().data,b=[],v=null;for(let e=0;e<c;++e){let[c,p]=(0,pE.lK)(n(e,d?null:v));if(!c)break;let[h,m]=(0,pE.r9)(a,c),y=h().data,A=l||o||(0,pE.b0)(y)||u&&!e&&!(0,pE.b0)(g)||$||g&&!(0,pE.b0)(g[e])&&!r.compare(g[e],y);if(t&&("function"==typeof i?i(y,p):A)){let n=async()=>{if(c in f){let e=f[c];delete f[c],y=await e}else y=await t(p);m({data:y,_k:p}),s[e]=y};d?b.push(n):await n()}else s[e]=y;d||(v=y)}return d&&await Promise.all(b.map(e=>e())),m({_i:pE.ZH}),s},r),w=(0,uZ.useCallback)(function(e,n){let t="boolean"==typeof n?{revalidate:n}:n||{},r=!1!==t.revalidate;return o?(r&&((0,pE.b0)(e)?m({_i:!0,_r:t.revalidate}):m({_i:!1,_r:t.revalidate})),arguments.length?A.mutate(e,{...t,revalidate:r}):A.mutate()):dr},[o,a]),k=(0,uZ.useCallback)(e=>{let t;if(!o)return dr;let[,r]=(0,pE.r9)(a,o);if((0,pE.Tn)(e)?t=e(y()):"number"==typeof e&&(t=e),"number"!=typeof t)return dr;r({_l:t}),v.current=t;let i=[],[s]=(0,pE.r9)(a,o),l=null;for(let e=0;e<t;++e){let[t]=(0,pE.lK)(n(e,l)),[r]=(0,pE.r9)(a,t),o=t?r().data:pE.ZH;if((0,pE.b0)(o))return w(s().data);i.push(o),l=o}return w(i)},[o,a,w,y]);return{size:y(),setSize:k,mutate:w,get data(){return A.data},get error(){return A.error},get isValidating(){return A.isValidating},get isLoading(){return A.isLoading}}});function da(e,n={}){return ds(e,p4,n)}function ds(e,n,t={}){let{swrInfiniteConfig:r,immutable:o}=t,{getNextUrl:i,getTotalCount:a,getData:s}=n,l=t.fetcher??r5,{data:c,size:u,setSize:p,...d}=di((0,uZ.useCallback)((t,r)=>0==t?e?.toString()??null:n.getNextUrl(r.data),[e]),l,{...r,...o?{revalidateIfStale:!1,revalidateOnFocus:!1,revalidateOnReconnect:!1}:{}}),f=i(c?.[c.length-1].data),h=a(c?.[0]?.data);return{data:c?.flatMap(e=>s(e.data)),totalCount:h,hasMore:null!=f,loadMore:()=>{p((c?.length??0)+1)},nextUri:f,...d}}function dl(e,n={}){return dc(e,p4,n)}function dc(e,n,t={}){let r=ds(e,n,t),{hasMore:o,error:i,data:a,loadMore:s,isLoading:l,nextUri:c}=r;return((0,uZ.useEffect)(()=>{o&&!i&&s()},[o,c]),t.partialData)?r:{...r,data:o||i?void 0:a,isLoading:l||o}}function du(e,n={}){return dc(e,p7(),n)}function dp(e,n={}){return ds(e,p7(),n)}function dd(){let e="tablet";return document.body.classList.forEach(n=>{switch(n){case"omrs-breakpoint-lt-tablet":e="phone";break;case"omrs-breakpoint-gt-small-desktop":e="large-desktop";break;case"omrs-breakpoint-gt-tablet":e="small-desktop"}}),e}function df(){let[e,n]=(0,uZ.useState)(dd);return(0,uZ.useEffect)(()=>{let e=()=>{n(dd())};return window.addEventListener("resize",e),()=>window.removeEventListener("resize",e)},[]),e}let dh=e=>"small-desktop"===e||"large-desktop"===e;function dm(e){let n=(0,uZ.useContext)(u8);(0,uZ.useEffect)(()=>(n&&n.moduleName&&(e.componentContext=n),uP(e),()=>{uO(e.name)}),[n,e])}function dg(){return pe(uz)}function db(e=null,n=null){let[t,r]=(0,uZ.useState)([]);return(0,uZ.useEffect)(()=>{let t=cx(e,n).subscribe(e=>{r(e)},e=>{console.error(e)});return()=>t.unsubscribe()},[e,n]),t}function dy(e,n=!0){let t=(0,uZ.useRef)(null);return(0,uZ.useEffect)(()=>{let r=r=>{n&&t.current&&r.target&&r.target instanceof Node&&(t.current.contains(r.target)||e(r))};return window.addEventListener("mousedown",r),window.addEventListener("touchstart",r),()=>{window.removeEventListener("mousedown",r),window.removeEventListener("touchstart",r)}},[e,n]),t}function d_(e){let n=(0,uZ.useRef)();return(0,uZ.useEffect)(()=>{let t=new IntersectionObserver(n=>{for(let t of n)if(t.isIntersecting)return void e()},{threshold:1});return n.current&&t.observe(n.current),()=>{n.current&&t.unobserve(n.current)}},[n.current,e]),n}function dv(e,n={}){let{abortController:t,fetchInit:r,url:o,swrConfig:i}=n,a=pR(),s=(0,uZ.useMemo)(()=>r?.signal??t?.signal??a.signal,[t?.signal,r?.signal,a.signal]),l=(0,uZ.useCallback)(e=>r5(function(e,n){if(n)return"function"==typeof n?n(e):n;if("string"==typeof e)return e;throw Error(`When using useOpenmrsSWR with a key that is not a string, you must provide a url() function that converts the key to a valid url. The key for this hook is ${e}.`)}(e,o),{...r,signal:s}),[s,r,o]);return(0,pC.Ay)(e,l,i)}function d$(e=[],n=10){let[t,r]=(0,uZ.useState)(1),o=(0,uZ.useMemo)(()=>"number"==typeof n&&n>0?Math.max(1,Math.ceil(e.length/n)):1,[e.length,n]);t>o&&r(o);let i=Math.min(Math.max(1,t),o),a=(0,uZ.useMemo)(()=>{let t=(i-1)*n,r=(i+0)*n;return e.slice(t,r)},[e,i,n]),s=(0,uZ.useCallback)(e=>{!Number.isInteger(e)||e<1?console.warn(`usePagination: ignoring goTo(${e}); page must be a positive integer.`):r(e)},[]),l=(0,uZ.useCallback)(()=>{r(e=>e+1)},[]),c=(0,uZ.useCallback)(()=>{r(e=>Math.max(1,e-1))},[]);return(0,uZ.useMemo)(()=>({results:a,totalPages:o,currentPage:i,paginated:e.length>n,showNextButton:i<o,showPreviousButton:i>1,goTo:s,goToNext:l,goToPrevious:c}),[a,o,e.length,n,i,s,l,c])}function dA(e,n,t,r){return{pageSizes:(0,uZ.useMemo)(()=>{let t=Math.ceil(n/e);return isNaN(t)&&(t=0),[...Array(t).keys()].map(n=>(n+1)*e)},[e,n]),pageItemsCount:(0,uZ.useMemo)(()=>e>n?n:e*t>n?e*(t-1)+r:e*t,[e,n,t,r])}}function dw(){let e=/\/patient\/([a-zA-Z0-9\-]+)\/?/.exec(location.pathname);return e&&e[1]}function dk(e){let[n,t]=(0,uZ.useState)(e??dw()),{data:r,error:o,isValidating:i}=(0,pC.Ay)(n?["patient",n]:null,()=>cl(n,{}));return(0,uZ.useEffect)(()=>{let e=()=>{let e=dw();e!==n&&t(e)};return window.addEventListener("single-spa:routing-event",e),()=>window.removeEventListener("single-spa:routing-event",e)},[n]),(0,uZ.useMemo)(()=>({isLoading:i&&!o&&!r,patient:r,patientUuid:n,error:o}),[i,o,r,n])}function dx(){let e=`${r0}/metadatamapping/termmapping?v=custom:(metadataUuid)&code=emr.primaryIdentifierType`,{data:n,error:t,isLoading:r}=(0,pC.Ay)(e,r5);return(0,uZ.useMemo)(()=>({primaryIdentifierCode:n?.data?.results[0]?.metadataUuid,isLoading:r,error:t}),[n,t,r])}function dC(e){let{extensions:n,extensionSlotModuleName:t}=pl(e);return e?n.map(n=>({state:r})=>uX().createElement(u8.Provider,{value:{moduleName:t,featureName:"",extension:{extensionId:n.id,extensionSlotName:e,extensionSlotModuleName:t}}},uX().createElement(dj,{state:r}))):[]}function dE(){let e=(0,uZ.useRef)(),[n,t]=(0,uZ.useState)(null),r=null;if(!n){if(s){let e=oe().getState();e.loaded&&(r=e.session)}else s=new Promise(n=>{let t=({loaded:t,session:o})=>{t&&(n(o),r=o,e.current&&(e.current(),e.current=void 0))};t(oe().getState()),r||(e.current=oe().subscribe(t))});if(r)t(r);else throw s}(0,uZ.useEffect)(()=>(e.current||(e.current=oe().subscribe(({loaded:e,session:n})=>{e&&(r=n,t(n))})),()=>{e.current&&(e.current(),e.current=void 0)}),[]);let o=n||r;if(!o)if(s)throw console.warn("useSession is in an unexpected state. Attempting to recover."),s;else throw Error("useSession is in an invalid state.");return o}let dD=({privilege:e,fallback:n,children:t})=>{let[r,o]=(0,uZ.useState)(null);return((0,uZ.useEffect)(()=>{let e=r9({includeAuthStatus:!1}).subscribe(o);return()=>e.unsubscribe()},[]),r&&oo(e,r))?uX().createElement(uX().Fragment,null,t):n?uX().createElement(uX().Fragment,null,n):null};var dS=t(74353),dM=t.n(dS),dz=t(47581);let dP=new Map;function dO(){for(let e of Array.from(dP.values()))e()}let dT={setVisitContext:(e,n)=>null==n?{manuallySetVisitUuid:null}:{manuallySetVisitUuid:n.uuid,patientUuid:n.patient?.uuid}};function dB(e){let n=(0,uZ.useId)();return(0,uZ.useEffect)(()=>{if(e)return dP.set(n,e),()=>{dP.delete(n)}},[n,e]),{...pn(cm(),dT),mutateVisit:dO}}function dI(e,n=cf){let t=(0,uZ.useRef)(void 0),{patientUuid:r,manuallySetVisitUuid:o,setVisitContext:i}=dB((0,uZ.useCallback)(()=>t.current?.(),[])),a=e&&r==e?o:null,s=`?patient=${e}&v=${n}&includeInactive=false`,l=`/${a}?v=${n}`,{data:c,error:u,mutate:p,isValidating:d}=(0,pC.Ay)(e?`${r0}/visit${s}`:null,r5),{data:f,error:h,mutate:m,isValidating:g}=(0,pC.Ay)(e&&a?`${r0}/visit${l}`:null,r5),b=(0,uZ.useMemo)(()=>c?.data.results.find(e=>null===e.stopDatetime)??null,[c]),y=(0,uZ.useMemo)(()=>a&&f?f.data:null,[f,a]),v=(0,uZ.useRef)(null);(0,uZ.useEffect)(()=>{!d&&b&&r===e&&null===o&&i(b),g||(v.current&&y&&v.current.uuid===y.uuid&&!v.current.stopDatetime&&y.stopDatetime&&i(null),v.current=y)},[y,o,b,d,g,r]);let $=(0,uZ.useCallback)(()=>{p(),m()},[p,m]);(0,uZ.useEffect)(()=>{t.current=$},[$]);let A=!!(!c||a&&!f),w=!!(a?h:u);return{error:u||h,mutate:$,isValidating:d||g,activeVisit:b,currentVisit:y,currentVisitIsRetrospective:!!a,isLoading:A&&!w}}function dN(){let[e,n]=(0,uZ.useState)([]);return(0,uZ.useEffect)(()=>{let e=cw().subscribe(e=>{n(e)},e=>console.error(e));return()=>e.unsubscribe()},[]),e}dS.extend(dz);let dj=({state:e,children:n,...t})=>{let{extension:r}=(0,uZ.useContext)(u8),o=(0,uZ.useRef)(null),i=(0,uZ.useRef)(Promise.resolve()),a=(0,uZ.useRef)(!1),s=(0,uZ.useRef)(!1),l=(0,uZ.useRef)(e),c=(0,uZ.useCallback)(e=>{if(!e)return;let n=()=>{"MOUNTED"===e.getStatus()&&e.unmount()};switch(e.getStatus()){case"MOUNTED":e.unmount();break;case"UPDATING":i.current?.then(n,n);break;default:e.mountPromise.then(n,()=>{})}},[]),u=(0,uZ.useCallback)((e,n)=>{e.update&&"UNMOUNTING"!==e.getStatus()&&(i.current=Promise.all([e.mountPromise,i.current]).then(()=>{if(o.current?.getStatus()==="MOUNTED"&&o.current.update)return o.current.update({...n})}).catch(e=>{let n=o.current?.getStatus();"UNMOUNTING"!==n&&"NOT_MOUNTED"!==n&&"UNLOADING"!==n&&console.error(`The extension '${r?.extensionId}' failed to update`,e)}))},[]),p=(0,uZ.useCallback)(n=>{n&&!o.current&&!s.current&&r?.extensionSlotName&&r.extensionSlotModuleName&&(s.current=!0,uR(n,r.extensionSlotName,r.extensionSlotModuleName,r.extensionId,void 0,e).then(n=>{(s.current=!1,o.current=n,a.current)?c(n):n&&l.current!==e&&u(n,l.current)},()=>{s.current=!1}))},[]);return(0,uZ.useEffect)(()=>(a.current=!1,()=>{a.current=!0,c(o.current)}),[]),(0,uZ.useEffect)(()=>{l.current=e,o.current&&u(o.current,e)},[e]),r?uX().createElement("div",{ref:p,"data-extension-id":r?.extensionId,style:{position:"relative"},...t}):null};var dR=t(74848),dF=t(46942),dL=t.n(dF),dW=t(85072),dV=t.n(dW),dG=t(97825),dU=t.n(dG),dq=t(77659),dH=t.n(dq),dK=t(55056),dY=t.n(dK),dJ=t(10540),dZ=t.n(dJ),dX=t(41113),dQ=t.n(dX),d0=t(76097),d1={};d1.styleTagTransform=dQ(),d1.setAttributes=dY(),d1.insert=dH().bind(null,"head"),d1.domAPI=dU(),d1.insertStyleElement=dZ(),dV()(d0.A,d1);let d2=d0.A&&d0.A.locals?d0.A.locals:void 0;function d3({title:e,children:n}){let t="tablet"===df();return(0,dR.jsxs)("div",{className:dL()({[d2.tabletHeader]:t,[d2.desktopHeader]:!t}),children:[(0,dR.jsx)("h4",{children:e}),n]})}var d5=t(68108),d4=t(99158),d6={};d6.styleTagTransform=dQ(),d6.setAttributes=dY(),d6.insert=dH().bind(null,"head"),d6.domAPI=dU(),d6.insertStyleElement=dZ(),dV()(d4.A,d6);let d8=d4.A&&d4.A.locals?d4.A.locals:void 0,d7=(0,uZ.createContext)(null);function d9(){let e=(0,uZ.useContext)(d7);if(!e)throw Error("useCustomOverflowMenu must be used within a CustomOverflowMenu");return e}function fe({menuTitle:e,children:n}){let[t,r]=uX().useState(!1),o=dy(()=>r(!1),t),i="tablet"===df(),a=(0,uZ.useCallback)(()=>r(e=>!e),[]),s=(0,uZ.useRef)(null),l=(0,uZ.useRef)(null),c=(0,uZ.useId)(),u=`custom-overflow-menu-trigger-${c}`,p=`custom-overflow-menu-${c}`,d=(0,uZ.useCallback)(()=>{r(!1),s.current?.focus()},[]),f=(0,uZ.useMemo)(()=>({closeMenu:d}),[d]),h=(0,uZ.useCallback)(e=>{"Escape"===e.key&&t&&(e.stopPropagation(),d())},[d,t]),m=uZ.Children.toArray(n);(0,uZ.useEffect)(()=>{if(t&&l.current){let e=l.current.querySelector('[role="menuitem"]:not([disabled])');e?.focus()}},[t]);let g=(0,uZ.useCallback)(({currentIndex:e,direction:n})=>{let t=l.current?.querySelectorAll('[role="menuitem"]:not([disabled])');if(!t?.length)return;let r=document.activeElement?.closest?.('[role="menuitem"]')??document.activeElement,o=Array.from(t).indexOf(r);if(-1===o)return void t[n>0?0:t.length-1]?.focus();let i=o+n,a=i<0?t.length-1:i>=t.length?0:i;t[a]?.focus()},[]),b=m.map((e,n)=>(0,uZ.isValidElement)(e)?(0,uZ.cloneElement)(e,{closeMenu:d,handleOverflowMenuItemFocus:g,index:n}):e);return(0,dR.jsxs)("div",{"data-overflow-menu":!0,className:dL()("cds--overflow-menu",d8.container),ref:o,children:[(0,dR.jsx)("button",{className:dL()("cds--btn","cds--btn--ghost","cds--overflow-menu__trigger",{"cds--overflow-menu--open":t},d8.overflowMenuButton),"aria-controls":p,"aria-expanded":t,"aria-haspopup":"true",id:u,onClick:a,onKeyDown:h,ref:s,children:e}),(0,dR.jsxs)("div",{className:dL()("cds--overflow-menu-options","cds--overflow-menu--flip",d8.menu,{[d8.show]:t}),"aria-labelledby":u,"data-floating-menu-direction":"bottom",id:p,onKeyDown:h,ref:l,role:"menu",tabIndex:-1,children:[(0,dR.jsx)("ul",{className:dL()("cds--overflow-menu-options__content",{"cds--overflow-menu-options--lg":i}),children:(0,dR.jsx)(d7.Provider,{value:f,children:b})}),(0,dR.jsx)("span",{})]})]})}function fn(e){let n=(0,uZ.useContext)(d7);return(0,dR.jsx)(d5.XSD,{...e,closeMenu:n?.closeMenu})}let ft={"carbon.table.batch.cancel":"cancel","carbon.table.batch.items.selected":"batchActionsItemsSelected","carbon.table.batch.item.selected":"batchActionItemSelected","carbon.table.batch.selectAll":"selectAll"},fr=e=>(0,dR.jsx)(d5.GGC,{translateWithId:(e,n)=>{let t=ft[e];return t?it(t,e,n):e},...e});var fo=t(47767),fi=t(84976),fa=t(30424),fs={};fs.styleTagTransform=dQ(),fs.setAttributes=dY(),fs.insert=dH().bind(null,"head"),fs.domAPI=dU(),fs.insertStyleElement=dZ(),dV()(fa.A,fs);let fl=fa.A&&fa.A.locals?fa.A.locals:void 0,fc=["omrs-icon-activity","omrs-icon-add","omrs-icon-arrow-down","omrs-icon-arrow-left","omrs-icon-arrow-right","omrs-icon-arrow-up","omrs-icon-baby","omrs-icon-calendar-heat-map","omrs-icon-calendar","omrs-icon-caret-down","omrs-icon-caret-left","omrs-icon-caret-right","omrs-icon-caret-up","omrs-icon-chart-average","omrs-icon-chart-line","omrs-icon-checkmark-filled","omrs-icon-checkmark-outline","omrs-icon-chemistry","omrs-icon-chevron-down","omrs-icon-chevron-left","omrs-icon-chevron-right","omrs-icon-chevron-up","omrs-icon-close","omrs-icon-close-filled","omrs-icon-close-outline","omrs-icon-document","omrs-icon-document-attachment","omrs-icon-download","omrs-icon-drug-order","omrs-icon-edit","omrs-icon-event-schedule","omrs-icon-events","omrs-icon-gender-female","omrs-icon-gender-male","omrs-icon-gender-other","omrs-icon-gender-unknown","omrs-icon-generic-order-type","omrs-icon-group","omrs-icon-group-access","omrs-icon-hospital-bed","omrs-icon-image-medical","omrs-icon-information","omrs-icon-information-filled","omrs-icon-information-square","omrs-icon-inventory-management","omrs-icon-lab-order","omrs-icon-list-checked","omrs-icon-location","omrs-icon-material-order","omrs-icon-maximize","omrs-icon-medication","omrs-icon-message-queue","omrs-icon-microscope","omrs-icon-mobile-check","omrs-icon-money","omrs-icon-mother","omrs-icon-movement","omrs-icon-overflow-menu--horizontal","omrs-icon-overflow-menu--vertical","omrs-icon-password","omrs-icon-pedestrian-family","omrs-icon-pen","omrs-icon-printer","omrs-icon-procedure-order","omrs-icon-programs","omrs-icon-renew","omrs-icon-referral-order","omrs-icon-report","omrs-icon-reset","omrs-icon-save","omrs-icon-search","omrs-icon-settings","omrs-icon-shopping-cart","omrs-icon-shopping-cart--arrow-down","omrs-icon-sticky-note-add","omrs-icon-switcher","omrs-icon-syringe","omrs-icon-table-of-contents","omrs-icon-table","omrs-icon-time","omrs-icon-tools","omrs-icon-translate","omrs-icon-trash-can","omrs-icon-tree-view--alt","omrs-icon-two-factor-authentication","omrs-icon-user-avatar","omrs-icon-user-follow","omrs-icon-user-xray","omrs-icon-user","omrs-icon-view-off","omrs-icon-view","omrs-icon-warning"],fu=(0,uZ.memo)((0,uZ.forwardRef)(function(e,n){return(0,dR.jsx)(hG,{ref:n,icon:"omrs-icon-activity",iconProps:e})})),fp=(0,uZ.memo)((0,uZ.forwardRef)(function(e,n){return(0,dR.jsx)(hG,{ref:n,icon:"omrs-icon-add",iconProps:e})})),fd=(0,uZ.memo)((0,uZ.forwardRef)(function(e,n){return(0,dR.jsx)(hG,{ref:n,icon:"omrs-icon-arrow-down",iconProps:e})})),ff=(0,uZ.memo)((0,uZ.forwardRef)(function(e,n){return(0,dR.jsx)(hG,{ref:n,icon:"omrs-icon-arrow-left",iconProps:e})})),fh=(0,uZ.memo)((0,uZ.forwardRef)(function(e,n){return(0,dR.jsx)(hG,{ref:n,icon:"omrs-icon-arrow-right",iconProps:e})})),fm=(0,uZ.memo)((0,uZ.forwardRef)(function(e,n){return(0,dR.jsx)(hG,{ref:n,icon:"omrs-icon-arrow-up",iconProps:e})})),fg=(0,uZ.memo)((0,uZ.forwardRef)(function(e,n){return(0,dR.jsx)(hG,{ref:n,icon:"omrs-icon-baby",iconProps:e})})),fb=(0,uZ.memo)((0,uZ.forwardRef)(function(e,n){return(0,dR.jsx)(hG,{ref:n,icon:"omrs-icon-calendar-heat-map",iconProps:e})})),fy=(0,uZ.memo)((0,uZ.forwardRef)(function(e,n){return(0,dR.jsx)(hG,{ref:n,icon:"omrs-icon-calendar",iconProps:e})})),f_=(0,uZ.memo)((0,uZ.forwardRef)(function(e,n){return(0,dR.jsx)(hG,{ref:n,icon:"omrs-icon-caret-down",iconProps:e})})),fv=(0,uZ.memo)((0,uZ.forwardRef)(function(e,n){return(0,dR.jsx)(hG,{ref:n,icon:"omrs-icon-caret-left",iconProps:e})})),f$=(0,uZ.memo)((0,uZ.forwardRef)(function(e,n){return(0,dR.jsx)(hG,{ref:n,icon:"omrs-icon-caret-right",iconProps:e})})),fA=(0,uZ.memo)((0,uZ.forwardRef)(function(e,n){return(0,dR.jsx)(hG,{ref:n,icon:"omrs-icon-caret-up",iconProps:e})})),fw=(0,uZ.memo)((0,uZ.forwardRef)(function(e,n){return(0,dR.jsx)(hG,{ref:n,icon:"omrs-icon-chart-average",iconProps:e})})),fk=(0,uZ.memo)((0,uZ.forwardRef)(function(e,n){return(0,dR.jsx)(hG,{ref:n,icon:"omrs-icon-chart-line",iconProps:e})})),fx=(0,uZ.memo)((0,uZ.forwardRef)(function(e,n){return(0,dR.jsx)(hG,{ref:n,icon:"omrs-icon-checkmark-filled",iconProps:e})})),fC=(0,uZ.memo)((0,uZ.forwardRef)(function(e,n){return(0,dR.jsx)(hG,{ref:n,icon:"omrs-icon-checkmark-outline",iconProps:e})})),fE=(0,uZ.memo)((0,uZ.forwardRef)(function(e,n){return(0,dR.jsx)(hG,{ref:n,icon:"omrs-icon-chemistry",iconProps:e})})),fD=(0,uZ.memo)((0,uZ.forwardRef)(function(e,n){return(0,dR.jsx)(hG,{ref:n,icon:"omrs-icon-chevron-down",iconProps:e})})),fS=(0,uZ.memo)((0,uZ.forwardRef)(function(e,n){return(0,dR.jsx)(hG,{ref:n,icon:"omrs-icon-chevron-left",iconProps:e})})),fM=(0,uZ.memo)((0,uZ.forwardRef)(function(e,n){return(0,dR.jsx)(hG,{ref:n,icon:"omrs-icon-chevron-right",iconProps:e})})),fz=(0,uZ.memo)((0,uZ.forwardRef)(function(e,n){return(0,dR.jsx)(hG,{ref:n,icon:"omrs-icon-chevron-up",iconProps:e})})),fP=(0,uZ.memo)((0,uZ.forwardRef)(function(e,n){return(0,dR.jsx)(hG,{ref:n,icon:"omrs-icon-close",iconProps:e})})),fO=(0,uZ.memo)((0,uZ.forwardRef)(function(e,n){return(0,dR.jsx)(hG,{ref:n,icon:"omrs-icon-close-filled",iconProps:e})})),fT=(0,uZ.memo)((0,uZ.forwardRef)(function(e,n){return(0,dR.jsx)(hG,{ref:n,icon:"omrs-icon-close-outline",iconProps:e})})),fB=(0,uZ.memo)((0,uZ.forwardRef)(function(e,n){return(0,dR.jsx)(hG,{ref:n,icon:"omrs-icon-document",iconProps:e})})),fI=(0,uZ.memo)((0,uZ.forwardRef)(function(e,n){return(0,dR.jsx)(hG,{ref:n,icon:"omrs-icon-document-attachment",iconProps:e})})),fN=(0,uZ.memo)((0,uZ.forwardRef)(function(e,n){return(0,dR.jsx)(hG,{ref:n,icon:"omrs-icon-download",iconProps:e})})),fj=(0,uZ.memo)((0,uZ.forwardRef)(function(e,n){return(0,dR.jsx)(hG,{ref:n,icon:"omrs-icon-drug-order",iconProps:e})})),fR=(0,uZ.memo)((0,uZ.forwardRef)(function(e,n){return(0,dR.jsx)(hG,{ref:n,icon:"omrs-icon-edit",iconProps:e})})),fF=(0,uZ.memo)((0,uZ.forwardRef)(function(e,n){return(0,dR.jsx)(hG,{ref:n,icon:"omrs-icon-event-schedule",iconProps:e})})),fL=(0,uZ.memo)((0,uZ.forwardRef)(function(e,n){return(0,dR.jsx)(hG,{ref:n,icon:"omrs-icon-events",iconProps:e})})),fW=(0,uZ.memo)((0,uZ.forwardRef)(function(e,n){return(0,dR.jsx)(hG,{ref:n,icon:"omrs-icon-gender-female",iconProps:e})})),fV=(0,uZ.memo)((0,uZ.forwardRef)(function(e,n){return(0,dR.jsx)(hG,{ref:n,icon:"omrs-icon-gender-male",iconProps:e})})),fG=(0,uZ.memo)((0,uZ.forwardRef)(function(e,n){return(0,dR.jsx)(hG,{ref:n,icon:"omrs-icon-gender-other",iconProps:e})})),fU=(0,uZ.memo)((0,uZ.forwardRef)(function(e,n){return(0,dR.jsx)(hG,{ref:n,icon:"omrs-icon-gender-unknown",iconProps:e})})),fq=(0,uZ.memo)((0,uZ.forwardRef)(function(e,n){return(0,dR.jsx)(hG,{ref:n,icon:"omrs-icon-generic-order-type",iconProps:e})})),fH=(0,uZ.memo)((0,uZ.forwardRef)(function(e,n){return(0,dR.jsx)(hG,{ref:n,icon:"omrs-icon-group",iconProps:e})})),fK=(0,uZ.memo)((0,uZ.forwardRef)(function(e,n){return(0,dR.jsx)(hG,{ref:n,icon:"omrs-icon-group-access",iconProps:e})})),fY=(0,uZ.memo)((0,uZ.forwardRef)(function(e,n){return(0,dR.jsx)(hG,{ref:n,icon:"omrs-icon-hospital-bed",iconProps:e})})),fJ=(0,uZ.memo)((0,uZ.forwardRef)(function(e,n){return(0,dR.jsx)(hG,{ref:n,icon:"omrs-icon-image-medical",iconProps:e})})),fZ=(0,uZ.memo)((0,uZ.forwardRef)(function(e,n){return(0,dR.jsx)(hG,{ref:n,icon:"omrs-icon-information",iconProps:e})})),fX=(0,uZ.memo)((0,uZ.forwardRef)(function(e,n){return(0,dR.jsx)(hG,{ref:n,icon:"omrs-icon-information-filled",iconProps:e})})),fQ=(0,uZ.memo)((0,uZ.forwardRef)(function(e,n){return(0,dR.jsx)(hG,{ref:n,icon:"omrs-icon-information-square",iconProps:e})})),f0=(0,uZ.memo)((0,uZ.forwardRef)(function(e,n){return(0,dR.jsx)(hG,{ref:n,icon:"omrs-icon-inventory-management",iconProps:e})})),f1=(0,uZ.memo)((0,uZ.forwardRef)(function(e,n){return(0,dR.jsx)(hG,{ref:n,icon:"omrs-icon-lab-order",iconProps:e})})),f2=(0,uZ.memo)((0,uZ.forwardRef)(function(e,n){return(0,dR.jsx)(hG,{ref:n,icon:"omrs-icon-list-checked",iconProps:e})})),f3=(0,uZ.memo)((0,uZ.forwardRef)(function(e,n){return(0,dR.jsx)(hG,{ref:n,icon:"omrs-icon-location",iconProps:e})})),f5=(0,uZ.memo)((0,uZ.forwardRef)(function(e,n){return(0,dR.jsx)(hG,{ref:n,icon:"omrs-icon-material-order",iconProps:e})})),f4=(0,uZ.memo)((0,uZ.forwardRef)(function(e,n){return(0,dR.jsx)(hG,{ref:n,icon:"omrs-icon-maximize",iconProps:e})})),f6=(0,uZ.memo)((0,uZ.forwardRef)(function(e,n){return(0,dR.jsx)(hG,{ref:n,icon:"omrs-icon-medication",iconProps:e})})),f8=(0,uZ.memo)((0,uZ.forwardRef)(function(e,n){return(0,dR.jsx)(hG,{ref:n,icon:"omrs-icon-message-queue",iconProps:e})})),f7=(0,uZ.memo)((0,uZ.forwardRef)(function(e,n){return(0,dR.jsx)(hG,{ref:n,icon:"omrs-icon-microscope",iconProps:e})})),f9=(0,uZ.memo)((0,uZ.forwardRef)(function(e,n){return(0,dR.jsx)(hG,{ref:n,icon:"omrs-icon-mobile-check",iconProps:e})})),he=(0,uZ.memo)((0,uZ.forwardRef)(function(e,n){return(0,dR.jsx)(hG,{ref:n,icon:"omrs-icon-money",iconProps:e})})),hn=(0,uZ.memo)((0,uZ.forwardRef)(function(e,n){return(0,dR.jsx)(hG,{ref:n,icon:"omrs-icon-mother",iconProps:e})})),ht=(0,uZ.memo)((0,uZ.forwardRef)(function(e,n){return(0,dR.jsx)(hG,{ref:n,icon:"omrs-icon-movement",iconProps:e})})),hr=(0,uZ.memo)((0,uZ.forwardRef)(function(e,n){return(0,dR.jsx)(hG,{ref:n,icon:"omrs-icon-overflow-menu--horizontal",iconProps:e})})),ho=(0,uZ.memo)((0,uZ.forwardRef)(function(e,n){return(0,dR.jsx)(hG,{ref:n,icon:"omrs-icon-overflow-menu--horizontal",iconProps:e})})),hi=(0,uZ.memo)((0,uZ.forwardRef)(function(e,n){return(0,dR.jsx)(hG,{ref:n,icon:"omrs-icon-password",iconProps:e})})),ha=(0,uZ.memo)((0,uZ.forwardRef)(function(e,n){return(0,dR.jsx)(hG,{ref:n,icon:"omrs-icon-pedestrian-family",iconProps:e})})),hs=(0,uZ.memo)((0,uZ.forwardRef)(function(e,n){return(0,dR.jsx)(hG,{ref:n,icon:"omrs-icon-pen",iconProps:e})})),hl=(0,uZ.memo)((0,uZ.forwardRef)(function(e,n){return(0,dR.jsx)(hG,{ref:n,icon:"omrs-icon-printer",iconProps:e})})),hc=(0,uZ.memo)((0,uZ.forwardRef)(function(e,n){return(0,dR.jsx)(hG,{ref:n,icon:"omrs-icon-procedure-order",iconProps:e})})),hu=(0,uZ.memo)((0,uZ.forwardRef)(function(e,n){return(0,dR.jsx)(hG,{ref:n,icon:"omrs-icon-programs",iconProps:e})})),hp=(0,uZ.memo)((0,uZ.forwardRef)(function(e,n){return(0,dR.jsx)(hG,{ref:n,icon:"omrs-icon-referral-order",iconProps:e})})),hd=(0,uZ.memo)((0,uZ.forwardRef)(function(e,n){return(0,dR.jsx)(hG,{ref:n,icon:"omrs-icon-renew",iconProps:e})})),hf=(0,uZ.memo)((0,uZ.forwardRef)(function(e,n){return(0,dR.jsx)(hG,{ref:n,icon:"omrs-icon-report",iconProps:e})})),hh=(0,uZ.memo)((0,uZ.forwardRef)(function(e,n){return(0,dR.jsx)(hG,{ref:n,icon:"omrs-icon-reset",iconProps:e})})),hm=(0,uZ.memo)((0,uZ.forwardRef)(function(e,n){return(0,dR.jsx)(hG,{ref:n,icon:"omrs-icon-save",iconProps:e})})),hg=(0,uZ.memo)((0,uZ.forwardRef)(function(e,n){return(0,dR.jsx)(hG,{ref:n,icon:"omrs-icon-search",iconProps:e})})),hb=(0,uZ.memo)((0,uZ.forwardRef)(function(e,n){return(0,dR.jsx)(hG,{ref:n,icon:"omrs-icon-settings",iconProps:e})})),hy=(0,uZ.memo)((0,uZ.forwardRef)(function(e,n){return(0,dR.jsx)(hG,{ref:n,icon:"omrs-icon-switcher",iconProps:e})})),h_=(0,uZ.memo)((0,uZ.forwardRef)(function(e,n){return(0,dR.jsx)(hG,{ref:n,icon:"omrs-icon-shopping-cart",iconProps:e})})),hv=(0,uZ.memo)((0,uZ.forwardRef)(function(e,n){return(0,dR.jsx)(hG,{ref:n,icon:"omrs-icon-shopping-cart--arrow-down",iconProps:e})})),h$=(0,uZ.memo)((0,uZ.forwardRef)(function(e,n){return(0,dR.jsx)(hG,{ref:n,icon:"omrs-icon-sticky-note-add",iconProps:e})})),hA=(0,uZ.memo)((0,uZ.forwardRef)(function(e,n){return(0,dR.jsx)(hG,{ref:n,icon:"omrs-icon-syringe",iconProps:e})})),hw=(0,uZ.memo)((0,uZ.forwardRef)(function(e,n){return(0,dR.jsx)(hG,{ref:n,icon:"omrs-icon-table-of-contents",iconProps:e})})),hk=(0,uZ.memo)((0,uZ.forwardRef)(function(e,n){return(0,dR.jsx)(hG,{ref:n,icon:"omrs-icon-table",iconProps:e})})),hx=(0,uZ.memo)((0,uZ.forwardRef)(function(e,n){return(0,dR.jsx)(hG,{ref:n,icon:"omrs-icon-time",iconProps:e})})),hC=(0,uZ.memo)((0,uZ.forwardRef)(function(e,n){return(0,dR.jsx)(hG,{ref:n,icon:"omrs-icon-tools",iconProps:e})})),hE=(0,uZ.memo)((0,uZ.forwardRef)(function(e,n){return(0,dR.jsx)(hG,{ref:n,icon:"omrs-icon-translate",iconProps:e})})),hD=(0,uZ.memo)((0,uZ.forwardRef)(function(e,n){return(0,dR.jsx)(hG,{ref:n,icon:"omrs-icon-trash-can",iconProps:e})})),hS=(0,uZ.memo)((0,uZ.forwardRef)(function(e,n){return(0,dR.jsx)(hG,{ref:n,icon:"omrs-icon-tree-view--alt",iconProps:e})})),hM=(0,uZ.memo)((0,uZ.forwardRef)(function(e,n){return(0,dR.jsx)(hG,{ref:n,icon:"omrs-icon-two-factor-authentication",iconProps:e})})),hz=(0,uZ.memo)((0,uZ.forwardRef)(function(e,n){return(0,dR.jsx)(hG,{ref:n,icon:"omrs-icon-user-avatar",iconProps:e})})),hP=(0,uZ.memo)((0,uZ.forwardRef)(function(e,n){return(0,dR.jsx)(hG,{ref:n,icon:"omrs-icon-user-follow",iconProps:e})})),hO=(0,uZ.memo)((0,uZ.forwardRef)(function(e,n){return(0,dR.jsx)(hG,{ref:n,icon:"omrs-icon-user-xray",iconProps:e})})),hT=(0,uZ.memo)((0,uZ.forwardRef)(function(e,n){return(0,dR.jsx)(hG,{ref:n,icon:"omrs-icon-user",iconProps:e})})),hB=(0,uZ.memo)((0,uZ.forwardRef)(function(e,n){return(0,dR.jsx)(hG,{ref:n,icon:"omrs-icon-view-off",iconProps:e})})),hI=(0,uZ.memo)((0,uZ.forwardRef)(function(e,n){return(0,dR.jsx)(hG,{ref:n,icon:"omrs-icon-view",iconProps:e})})),hN=(0,uZ.memo)((0,uZ.forwardRef)(function(e,n){return(0,dR.jsx)(hG,{ref:n,icon:"omrs-icon-warning",iconProps:e})})),hj=hN,hR=fI,hF=f2,hL=fJ,hW=hv,hV=(0,uZ.memo)((0,uZ.forwardRef)(function({icon:e,fallback:n,...t},r){let o=(0,uZ.useRef)(e?document.getElementById(e):void 0);return(0,uZ.useEffect)(()=>{let n=document.getElementById("omrs-svgs-container"),t=new MutationObserver(n=>{for(let t of n)"childList"===t.type&&(o.current=e?document.getElementById(e):void 0)});return n&&t.observe(n,{childList:!0}),()=>t.disconnect()},[e]),(0,dR.jsx)(pj,{value:o.current,fallback:n,children:(0,dR.jsx)(hG,{ref:r,icon:e,iconProps:t})})})),hG=(0,uZ.memo)((0,uZ.forwardRef)(function({icon:e,iconProps:n},t){let{className:r,fill:o,size:i}=Object.assign({},{fill:"currentColor",size:20},n);(i<=0||i>72)&&(console.error(`Invalid size '${i}' specified for ${e}. Defaulting to 20.`),i=20);let a=(0,uZ.useRef)(null);return(0,uZ.useImperativeHandle)(t,()=>a.current),(0,uZ.useEffect)(()=>{a.current&&"currentColor"!==o&&a.current.style.setProperty("--omrs-icon-fill",o)},[]),(0,dR.jsx)("svg",{ref:a,className:dL()("omrs-icon",fl.icon,r),height:i,width:i,viewBox:"0 0 16 16",children:(0,dR.jsx)("use",{href:`#${e}`})})}));var hU=t(28852),hq={};hq.styleTagTransform=dQ(),hq.setAttributes=dY(),hq.insert=dH().bind(null,"head"),hq.domAPI=dU(),hq.insertStyleElement=dZ(),dV()(hU.A,hq);let hH=hU.A&&hU.A.locals?hU.A.locals:void 0,hK=({path:e,title:n,basePath:t,icon:r})=>{let{t:o}=(0,px.useTranslation)(),i=(0,fo.zy)(),a=(0,uZ.useMemo)(()=>{if(!e)return!1;let n=e.startsWith("/")?e.slice(1):e;if(n.startsWith("http"))return n===window.location.href;let t=n.split("/").map(e=>decodeURIComponent(e)),r=(i.pathname??"").split("/").slice(1).map(e=>decodeURIComponent(e));return r.some((e,n)=>t.every((e,t)=>r[n+t]===e))},[i.pathname,e]);return(0,dR.jsx)("div",{children:(0,dR.jsx)(uQ,{className:dL()("cds--side-nav__link",{"active-left-nav-link":a}),to:`${t}/${encodeURIComponent(e)}`,children:(0,dR.jsxs)("span",{className:hH.menu,children:[(0,dR.jsx)(hV,{icon:r,className:hH.icon,size:16}),(0,dR.jsx)("span",{children:o(n)})]})})},e)};function hY(e){return function({basePath:n}){return(0,dR.jsx)(fi.Kd,{children:(0,dR.jsx)(hK,{basePath:n,...e})})}}function hJ(e){let n=(0,uZ.useRef)(null),t=(0,uZ.useRef)(void 0),r=(0,uZ.useCallback)(n=>{if("function"==typeof e){let t=e(n);return()=>{"function"==typeof t?t():e(null)}}if(e)return e.current=n,()=>{e.current=null}},[e]);return(0,uZ.useMemo)(()=>({get current(){return n.current},set current(value){n.current=value,t.current&&(t.current(),t.current=void 0),null!=value&&(t.current=r(value))}}),[r])}function hZ(...e){return 1===e.length&&e[0]?e[0]:n=>{let t=!1,r=e.map(e=>{let r=hX(e,n);return t||="function"==typeof r,r});if(t)return()=>{r.forEach((n,t)=>{"function"==typeof n?n():hX(e[t],null)})}}}function hX(e,n){if("function"==typeof e)return e(n);null!=e&&(e.current=n)}function hQ(...e){return(...n)=>{for(let t of e)"function"==typeof t&&t(...n)}}let h0="u">typeof document?uX().useLayoutEffect:()=>{},h1={prefix:String(Math.round(1e10*Math.random())),current:0},h2=uX().createContext(h1),h3=uX().createContext(!1),h5=("u">typeof window&&window.document&&window.document.createElement,new WeakMap),h4="function"==typeof uX().useId?function(e){let n=uX().useId(),[t]=(0,uZ.useState)(h9()),r=t?"react-aria":`react-aria${h1.prefix}`;return e||`${r}-${n}`}:function(e){let n=(0,uZ.useContext)(h2),t=function(e=!1){let n=(0,uZ.useContext)(h2),t=(0,uZ.useRef)(null);if(null===t.current&&!e){let e=uX().__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED?.ReactCurrentOwner?.current;if(e){let t=h5.get(e);null==t?h5.set(e,{id:n.current,state:e.memoizedState}):e.memoizedState!==t.state&&(n.current=t.id,h5.delete(e))}t.current=++n.current}return t.current}(!!e),r=`react-aria${n.prefix}`;return e||`${r}-${t}`};function h6(){return!1}function h8(){return!0}function h7(e){return()=>{}}function h9(){return"function"==typeof uX().useSyncExternalStore?uX().useSyncExternalStore(h7,h6,h8):(0,uZ.useContext)(h3)}let me=!!("u">typeof window&&window.document&&window.document.createElement),mn=new Map;function mt(e){let[n,t]=(0,uZ.useState)(e),r=(0,uZ.useRef)(null),o=h4(n),i=(0,uZ.useRef)(null);if(l&&l.register(i,o),me){let e=mn.get(o);e&&!e.includes(r)?e.push(r):mn.set(o,[r])}return h0(()=>()=>{l&&l.unregister(i),mn.delete(o)},[o]),(0,uZ.useEffect)(()=>{let e=r.current;return e&&t(e),()=>{e&&(r.current=null)}}),o}function mr(e=[]){let n=mt(),[t,r]=function(e){let[n,t]=(0,uZ.useState)(e),r=(0,uZ.useRef)(n),o=(0,uZ.useRef)(null),i=(0,uZ.useRef)(()=>{if(!o.current)return;let e=o.current.next();if(e.done){o.current=null;return}r.current===e.value?i.current():t(e.value)});return h0(()=>{r.current=n,o.current&&i.current()}),[n,(0,uZ.useCallback)(e=>{o.current=e(r.current),i.current()},[i])]}(n),o=(0,uZ.useCallback)(()=>{r(function*(){yield n,yield document.getElementById(n)?n:void 0})},[n,r]);return h0(o,[n,o,...e]),t}"u">typeof FinalizationRegistry&&(l=new FinalizationRegistry(e=>{mn.delete(e)}));let mo=function(){for(var e,n,t=0,r="",o=arguments.length;t<o;t++)(e=arguments[t])&&(n=function e(n){var t,r,o="";if("string"==typeof n||"number"==typeof n)o+=n;else if("object"==typeof n)if(Array.isArray(n)){var i=n.length;for(t=0;t<i;t++)n[t]&&(r=e(n[t]))&&(o&&(o+=" "),o+=r)}else for(r in n)n[r]&&(o&&(o+=" "),o+=r);return o}(e))&&(r&&(r+=" "),r+=n);return r};function mi(...e){let n={...e[0]};for(let t=1;t<e.length;t++){let r=e[t];for(let e in r){let t=n[e],o=r[e];"function"==typeof t&&"function"==typeof o&&"o"===e[0]&&"n"===e[1]&&e.charCodeAt(2)>=65&&90>=e.charCodeAt(2)?n[e]=hQ(t,o):("className"===e||"UNSAFE_className"===e)&&"string"==typeof t&&"string"==typeof o?n[e]=mo(t,o):"id"===e&&t&&o?n.id=function(e,n){if(e===n)return e;let t=mn.get(e);if(t)return t.forEach(e=>e.current=n),n;let r=mn.get(n);return r?(r.forEach(n=>n.current=e),e):n}(t,o):"ref"===e&&t&&o?n.ref=hZ(t,o):n[e]=void 0!==o?o:t}}return n}let ma=Symbol("default");function ms({values:e,children:n}){for(let[t,r]of e)n=uX().createElement(t.Provider,{value:r},n);return n}function ml(e){let{className:n,style:t,children:r,defaultClassName:o,defaultChildren:i,defaultStyle:a,values:s}=e;return(0,uZ.useMemo)(()=>{let e,l,c;return e="function"==typeof n?n({...s,defaultClassName:o}):n,l="function"==typeof t?t({...s,defaultStyle:a||{}}):t,c="function"==typeof r?r({...s,defaultChildren:i}):null==r?i:r,{className:null!=e?e:o,style:l||a?{...a,...l}:void 0,children:null!=c?c:i,"data-rac":""}},[n,t,r,o,i,a,s])}function mc(e,n){let t=(0,uZ.useContext)(e);if(null===n)return null;if(t&&"object"==typeof t&&"slots"in t&&t.slots){let e=n||ma;if(!t.slots[e]){let e=new Intl.ListFormat().format(Object.keys(t.slots).map(e=>`"${e}"`)),r=n?`Invalid slot "${n}".`:"A slot prop is required.";throw Error(`${r} Valid slot names are ${e}.`)}return t.slots[e]}return t}function mu(e,n,t){let{ref:r,...o}=mc(t,e.slot)||{},i=hJ((0,uZ.useMemo)(()=>hZ(n,r),[n,r])),a=mi(o,e);return"style"in o&&o.style&&"style"in e&&e.style&&("function"==typeof o.style||"function"==typeof e.style?a.style=n=>{let t="function"==typeof o.style?o.style(n):o.style,r={...n.defaultStyle,...t},i="function"==typeof e.style?e.style({...n,defaultStyle:r}):e.style;return{...r,...i}}:a.style={...o.style,...e.style}),[a,i]}function mp(e=!0){let[n,t]=(0,uZ.useState)(e),r=(0,uZ.useRef)(!1),o=(0,uZ.useCallback)(e=>{r.current=!0,t(!!e)},[]);return h0(()=>{r.current||t(!1)},[]),[o,n]}function md(e){let n=/^(data-.*)$/,t={};for(let r in e)n.test(r)||(t[r]=e[r]);return t}let mf=(0,uZ.createContext)(null),mh=null;function mm(e,n="assertive",t=7e3){mh?mh.announce(e,n,t):(mh=new mg,("boolean"==typeof IS_REACT_ACT_ENVIRONMENT?IS_REACT_ACT_ENVIRONMENT:"u">typeof jest)?mh.announce(e,n,t):setTimeout(()=>{(null==mh?void 0:mh.isAttached())&&(null==mh||mh.announce(e,n,t))},100))}class mg{isAttached(){var e;return null==(e=this.node)?void 0:e.isConnected}createLog(e){let n=document.createElement("div");return n.setAttribute("role","log"),n.setAttribute("aria-live",e),n.setAttribute("aria-relevant","additions"),n}destroy(){this.node&&(document.body.removeChild(this.node),this.node=null)}announce(e,n="assertive",t=7e3){var r,o;if(!this.node)return;let i=document.createElement("div");"object"==typeof e?(i.setAttribute("role","img"),i.setAttribute("aria-labelledby",e["aria-labelledby"])):i.textContent=e,"assertive"===n?null==(r=this.assertiveLog)||r.appendChild(i):null==(o=this.politeLog)||o.appendChild(i),""!==e&&setTimeout(()=>{i.remove()},t)}clear(e){this.node&&((!e||"assertive"===e)&&this.assertiveLog&&(this.assertiveLog.innerHTML=""),(!e||"polite"===e)&&this.politeLog&&(this.politeLog.innerHTML=""))}constructor(){this.node=null,this.assertiveLog=null,this.politeLog=null,"u">typeof document&&(this.node=document.createElement("div"),this.node.dataset.liveAnnouncer="true",Object.assign(this.node.style,{border:0,clip:"rect(0 0 0 0)",clipPath:"inset(50%)",height:"1px",margin:"-1px",overflow:"hidden",padding:0,position:"absolute",width:"1px",whiteSpace:"nowrap"}),this.assertiveLog=this.createLog("assertive"),this.node.appendChild(this.assertiveLog),this.politeLog=this.createLog("polite"),this.node.appendChild(this.politeLog),document.body.prepend(this.node))}}let mb=new Set(["id"]),my=new Set(["aria-label","aria-labelledby","aria-describedby","aria-details"]),m_=new Set(["href","hrefLang","target","rel","download","ping","referrerPolicy"]),mv=new Set(["dir","lang","hidden","inert","translate"]),m$=new Set(["onClick","onAuxClick","onContextMenu","onDoubleClick","onMouseDown","onMouseEnter","onMouseLeave","onMouseMove","onMouseOut","onMouseOver","onMouseUp","onTouchCancel","onTouchEnd","onTouchMove","onTouchStart","onPointerDown","onPointerMove","onPointerUp","onPointerCancel","onPointerEnter","onPointerLeave","onPointerOver","onPointerOut","onGotPointerCapture","onLostPointerCapture","onScroll","onWheel","onAnimationStart","onAnimationEnd","onAnimationIteration","onTransitionCancel","onTransitionEnd","onTransitionRun","onTransitionStart"]),mA=/^(data-.*)$/;function mw(e,n={}){let{labelable:t,isLink:r,global:o,events:i=o,propNames:a}=n,s={};for(let n in e)Object.prototype.hasOwnProperty.call(e,n)&&(mb.has(n)||t&&my.has(n)||r&&m_.has(n)||o&&mv.has(n)||i&&(m$.has(n)||n.endsWith("Capture")&&m$.has(n.slice(0,-7)))||a?.has(n)||mA.test(n))&&(s[n]=e[n]);return s}function mk(e){if(function(){if(null==mx){mx=!1;try{document.createElement("div").focus({get preventScroll(){return mx=!0,!0}})}catch{}}return mx}())e.focus({preventScroll:!0});else{let n=function(e){let n=e.parentNode,t=[],r=document.scrollingElement||document.documentElement;for(;n instanceof HTMLElement&&n!==r;)(n.offsetHeight<n.scrollHeight||n.offsetWidth<n.scrollWidth)&&t.push({element:n,scrollTop:n.scrollTop,scrollLeft:n.scrollLeft}),n=n.parentNode;return r instanceof HTMLElement&&t.push({element:r,scrollTop:r.scrollTop,scrollLeft:r.scrollLeft}),t}(e);e.focus(),function(e){for(let{element:n,scrollTop:t,scrollLeft:r}of e)n.scrollTop=t,n.scrollLeft=r}(n)}}let mx=null,mC=e=>e?.ownerDocument??document,mE=e=>e&&"window"in e&&e.window===e?e:mC(e).defaultView||window;function mD(e,n){return!!n&&!!e&&e.contains(n)}function mS(e){return e.target}function mM(e){if(!e)return!1;let n=e.getRootNode(),t=mE(e);if(!(n instanceof t.Document||n instanceof t.ShadowRoot))return!1;let r=n.activeElement;return null!=r&&e.contains(r)}let mz="u">typeof Element&&"checkVisibility"in Element.prototype;function mP(e,n){return mz?e.checkVisibility({visibilityProperty:!0})&&!e.closest("[data-react-aria-prevent-focus]"):"#comment"!==e.nodeName&&function(e){let n=mE(e);if(!(e instanceof n.HTMLElement)&&!(e instanceof n.SVGElement))return!1;let{display:t,visibility:r}=e.style,o="none"!==t&&"hidden"!==r&&"collapse"!==r;if(o){let{getComputedStyle:n}=e.ownerDocument.defaultView,{display:t,visibility:r}=n(e);o="none"!==t&&"hidden"!==r&&"collapse"!==r}return o}(e)&&!e.hasAttribute("hidden")&&!e.hasAttribute("data-react-aria-prevent-focus")&&("DETAILS"!==e.nodeName||!n||"SUMMARY"===n.nodeName||e.hasAttribute("open"))&&(!e.parentElement||mP(e.parentElement,e))}let mO=["input:not([disabled]):not([type=hidden])","select:not([disabled])","textarea:not([disabled])","button:not([disabled])","a[href]","area[href]","summary","iframe","object","embed","audio[controls]","video[controls]",'[contenteditable]:not([contenteditable^="false"])',"permission"],mT=mO.join(":not([hidden]),")+",[tabindex]:not([disabled]):not([hidden])";mO.push('[tabindex]:not([tabindex="-1"]):not([disabled])');let mB=mO.join(':not([hidden]):not([tabindex="-1"]),');function mI(e,n){return e.matches(mT)&&!mj(e)&&(n?.skipVisibilityCheck||mP(e))}function mN(e){return e.matches(mB)&&mP(e)&&!mj(e)}function mj(e){let n=e;for(;null!=n;){if(n instanceof n.ownerDocument.defaultView.HTMLElement&&n.inert)return!0;n=n.parentElement}return!1}function mR(e){return e.nativeEvent=e,e.isDefaultPrevented=()=>e.defaultPrevented,e.isPropagationStopped=()=>e.cancelBubble,e.persist=()=>{},e}function mF(e,n){Object.defineProperty(e,"target",{value:n}),Object.defineProperty(e,"currentTarget",{value:n})}function mL(e){let n=(0,uZ.useRef)({isFocused:!1,observer:null});return h0(()=>{let e=n.current;return()=>{e.observer&&(e.observer.disconnect(),e.observer=null)}},[]),(0,uZ.useCallback)(t=>{let r=mS(t);(r instanceof HTMLButtonElement||r instanceof HTMLInputElement||r instanceof HTMLTextAreaElement||r instanceof HTMLSelectElement)&&(n.current.isFocused=!0,r.addEventListener("focusout",t=>{if(n.current.isFocused=!1,r.disabled){let n=mR(t);e?.(n)}n.current.observer&&(n.current.observer.disconnect(),n.current.observer=null)},{once:!0}),n.current.observer=new MutationObserver(()=>{if(n.current.isFocused&&r.disabled){n.current.observer?.disconnect();let e=r===((e=document)=>e.activeElement)()?null:((e=document)=>e.activeElement)();r.dispatchEvent(new FocusEvent("blur",{relatedTarget:e})),r.dispatchEvent(new FocusEvent("focusout",{bubbles:!0,relatedTarget:e}))}}),n.current.observer.observe(r,{attributes:!0,attributeFilter:["disabled"]}))},[e])}let mW=!1;function mV(e){if("u"<typeof window||null==window.navigator)return!1;let n=window.navigator.userAgentData?.brands;return Array.isArray(n)&&n.some(n=>e.test(n.brand))||e.test(window.navigator.userAgent)}function mG(e){return"u">typeof window&&null!=window.navigator&&e.test(window.navigator.userAgentData?.platform||window.navigator.platform)}function mU(e){let n=null;return()=>(null==n&&(n=e()),n)}let mq=mU(function(){return mG(/^Mac/i)}),mH=mU(function(){return mG(/^iPhone/i)}),mK=mU(function(){return mG(/^iPad/i)||mq()&&navigator.maxTouchPoints>1}),mY=mU(function(){return mH()||mK()});mU(function(){return mq()||mY()});let mJ=mU(function(){return mV(/AppleWebKit/i)&&!mZ()}),mZ=mU(function(){return mV(/Chrome/i)}),mX=mU(function(){return mV(/Android/i)}),mQ=mU(function(){return mV(/Firefox/i)});function m0(e){return""===e.pointerType&&!!e.isTrusted||(mX()&&e.pointerType?"click"===e.type&&1===e.buttons:0===e.detail&&!e.pointerType)}function m1(e,n,t=!0){let{metaKey:r,ctrlKey:o,altKey:i,shiftKey:a}=n;mQ()&&window.event?.type?.startsWith("key")&&"_blank"===e.target&&(mq()?r=!0:o=!0);let s=mJ()&&mq()&&!mK()&&1?new KeyboardEvent("keydown",{keyIdentifier:"Enter",metaKey:r,ctrlKey:o,altKey:i,shiftKey:a}):new MouseEvent("click",{metaKey:r,ctrlKey:o,altKey:i,shiftKey:a,detail:1,bubbles:!0,cancelable:!0});m1.isOpening=t,mk(e),e.dispatchEvent(s),m1.isOpening=!1}m1.isOpening=!1;let m2=null,m3=new Set,m5=new Map,m4=!1,m6=!1,m8={Tab:!0,Escape:!0};function m7(e,n){for(let t of m3)t(e,n)}function m9(e){m4=!0,m1.isOpening||e.metaKey||!mq()&&e.altKey||e.ctrlKey||"Control"===e.key||"Shift"===e.key||"Meta"===e.key||(m2="keyboard",m7("keyboard",e))}function ge(e){m2="pointer","pointerType"in e&&e.pointerType,("mousedown"===e.type||"pointerdown"===e.type)&&(m4=!0,m7("pointer",e))}function gn(e){!m1.isOpening&&m0(e)&&(m4=!0,m2="virtual")}function gt(e){let n=mE(mS(e)),t=mC(mS(e));mS(e)!==n&&mS(e)!==t&&!mW&&e.isTrusted&&(m4||m6||(m2="virtual",m7("virtual",e)),m4=!1,m6=!1)}function gr(){mW||(m4=!1,m6=!0)}function go(e){if("u"<typeof window||"u"<typeof document)return;let n=mE(e),t=mC(e);if(m5.get(n))return;let r=n.HTMLElement.prototype.focus;n.HTMLElement.prototype.focus=function(){m4=!0,r.apply(this,arguments)},t.addEventListener("keydown",m9,!0),t.addEventListener("keyup",m9,!0),t.addEventListener("click",gn,!0),n.addEventListener("focus",gt,!0),n.addEventListener("blur",gr,!1),"u">typeof PointerEvent&&(t.addEventListener("pointerdown",ge,!0),t.addEventListener("pointermove",ge,!0),t.addEventListener("pointerup",ge,!0)),n.addEventListener("beforeunload",()=>{gi(e)},{once:!0}),m5.set(n,{focus:r})}let gi=(e,n)=>{let t=mE(e),r=mC(e);n&&r.removeEventListener("DOMContentLoaded",n),m5.has(t)&&(t.HTMLElement.prototype.focus=m5.get(t).focus,r.removeEventListener("keydown",m9,!0),r.removeEventListener("keyup",m9,!0),r.removeEventListener("click",gn,!0),t.removeEventListener("focus",gt,!0),t.removeEventListener("blur",gr,!1),"u">typeof PointerEvent&&(r.removeEventListener("pointerdown",ge,!0),r.removeEventListener("pointermove",ge,!0),r.removeEventListener("pointerup",ge,!0)),m5.delete(t))};function ga(){return"pointer"!==m2}"u">typeof document&&("loading"!==(f=mC(void 0)).readyState?go(void 0):f.addEventListener("DOMContentLoaded",()=>{go(void 0)}));let gs=new Set(["checkbox","radio","range","color","file","image","button","submit","reset"]),gl=new Map,gc=new Set;function gu(){if("u"<typeof window)return;function e(e){return"propertyName"in e}let n=t=>{let r=mS(t);if(!e(t)||!r)return;let o=gl.get(r);if(o&&(o.delete(t.propertyName),0===o.size&&(r.removeEventListener("transitioncancel",n),gl.delete(r)),0===gl.size)){for(let e of gc)e();gc.clear()}};document.body.addEventListener("transitionrun",t=>{let r=mS(t);if(!e(t)||!r)return;let o=gl.get(r);o||(o=new Set,gl.set(r,o),r.addEventListener("transitioncancel",n,{once:!0})),o.add(t.propertyName)}),document.body.addEventListener("transitionend",n)}function gp(e){requestAnimationFrame(()=>{for(let[e]of gl)"isConnected"in e&&!e.isConnected&&gl.delete(e);0===gl.size?e():gc.add(e)})}function gd(e){if(!e.isConnected)return;let n=mC(e);if("virtual"===m2){let t=((e=document)=>e.activeElement)(n);gp(()=>{let r=((e=document)=>e.activeElement)(n);(r===t||r===n.body)&&e.isConnected&&mk(e)})}else mk(e)}function gf(e){let{isDisabled:n,onFocus:t,onBlur:r,onFocusChange:o}=e,i=(0,uZ.useCallback)(e=>{if(mS(e)===e.currentTarget)return r&&r(e),o&&o(!1),!0},[r,o]),a=mL(i),s=(0,uZ.useCallback)(e=>{let n=mS(e),r=mC(n),i=r?((e=document)=>e.activeElement)(r):((e=document)=>e.activeElement)();n===e.currentTarget&&n===i&&(t&&t(e),o&&o(!0),a(e))},[o,t,a]);return{focusProps:{onFocus:!n&&(t||o||r)?s:void 0,onBlur:!n&&(r||o)?i:void 0}}}function gh(e){if(!e)return;let n=!0;return t=>{e({...t,preventDefault(){t.preventDefault()},isDefaultPrevented:()=>t.isDefaultPrevented(),stopPropagation(){n=!0},continuePropagation(){n=!1},isPropagationStopped:()=>n}),n&&t.stopPropagation()}}function gm(e,n){h0(()=>{if(e&&e.ref&&n)return e.ref.current=n.current,()=>{e.ref&&(e.ref.current=null)}})}"u">typeof document&&("loading"!==document.readyState?gu():document.addEventListener("DOMContentLoaded",gu));let gg=uX().createContext(null);function gb(e,n){let{focusProps:t}=gf(e),{keyboardProps:r}={keyboardProps:e.isDisabled?{}:{onKeyDown:gh(e.onKeyDown),onKeyUp:gh(e.onKeyUp)}},o=mi(t,r),i=function(e){let n=(0,uZ.useContext)(gg)||{};gm(n,e);let{ref:t,...r}=n;return r}(n),a=e.isDisabled?{}:i,s=(0,uZ.useRef)(e.autoFocus);(0,uZ.useEffect)(()=>{s.current&&n.current&&gd(n.current),s.current=!1},[n]);let l=e.excludeFromTabOrder?-1:0;return e.isDisabled&&(l=void 0),{focusableProps:mi({...o,tabIndex:l},a)}}uX().forwardRef(function(e,n){let{children:t,...r}=e,o=hJ(n),i={...r,ref:o};return uX().createElement(gg.Provider,{value:i},t)});let gy="default",g_="",gv=new WeakMap;function g$(e){if(mY())"disabled"===gy&&(gy="restoring",setTimeout(()=>{gp(()=>{if("restoring"===gy){let n=mC(e);"none"===n.documentElement.style.webkitUserSelect&&(n.documentElement.style.webkitUserSelect=g_||""),g_="",gy="default"}})},300));else if((e instanceof HTMLElement||e instanceof SVGElement)&&e&&gv.has(e)){let n=gv.get(e),t="userSelect"in e.style?"userSelect":"webkitUserSelect";"none"===e.style[t]&&(e.style[t]=n),""===e.getAttribute("style")&&e.removeAttribute("style"),gv.delete(e)}}function gA(e){let n=e?.defaultView;return n?.__webpack_nonce__||globalThis.__webpack_nonce__||void 0}let gw=new WeakMap;function gk(e){let n=e??("u">typeof document?document:void 0);if(!n)return gA(n);if(gw.has(n))return gw.get(n);let t=n.querySelector('meta[property="csp-nonce"]'),r=t&&t instanceof mE(t).HTMLMetaElement&&(t.nonce||t.content)||gA(n)||void 0;return void 0!==r&&gw.set(n,r),r}let gx=uX().createContext({register:()=>{}});gx.displayName="PressResponderContext";let gC=uX().useInsertionEffect??h0;function gE(e){let n=(0,uZ.useRef)(null);return gC(()=>{n.current=e},[e]),(0,uZ.useCallback)((...e)=>{let t=n.current;return t?.(...e)},[])}function gD(){let e=(0,uZ.useRef)(new Map),n=(0,uZ.useCallback)((n,t,r,o)=>{let i=o?.once?(...n)=>{e.current.delete(r),r(...n)}:r;e.current.set(r,{type:t,eventTarget:n,fn:i,options:o}),n.addEventListener(t,i,o)},[]),t=(0,uZ.useCallback)((n,t,r,o)=>{let i=e.current.get(r)?.fn||r;n.removeEventListener(t,i,o),e.current.delete(r)},[]),r=(0,uZ.useCallback)(()=>{e.current.forEach((e,n)=>{t(e.eventTarget,e.type,n,e.options)})},[t]);return(0,uZ.useEffect)(()=>r,[r]),{addGlobalListener:n,removeGlobalListener:t,removeAllGlobalListeners:r}}var gS=t(54575),gM=t.n(gS);class gz{#e;constructor(e,n,t,r){this.#e=!0;let o=r?.target??t.currentTarget;const i=o?.getBoundingClientRect();let a,s=0,l,c=null;null!=t.clientX&&null!=t.clientY&&(l=t.clientX,c=t.clientY),i&&(null!=l&&null!=c?(a=l-i.left,s=c-i.top):(a=i.width/2,s=i.height/2)),this.type=e,this.pointerType=n,this.target=t.currentTarget,this.shiftKey=t.shiftKey,this.metaKey=t.metaKey,this.ctrlKey=t.ctrlKey,this.altKey=t.altKey,this.x=a,this.y=s,this.key=t.key}continuePropagation(){this.#e=!1}get shouldStopPropagation(){return this.#e}}let gP=Symbol("linkClicked"),gO="react-aria-pressable-style",gT="data-react-aria-pressable";function gB(e){let{onPress:n,onPressChange:t,onPressStart:r,onPressEnd:o,onPressUp:i,onClick:a,isDisabled:s,isPressed:l,preventFocusOnPress:c,shouldCancelOnPointerExit:u,allowTextSelectionOnPress:p,ref:d,...f}=function(e){let n=(0,uZ.useContext)(gx);if(n){let{register:t,ref:r,...o}=n;e=mi(o,e),t()}return gm(n,e.ref),e}(e),[h,m]=(0,uZ.useState)(!1),g=(0,uZ.useRef)({isPressed:!1,ignoreEmulatedMouseEvents:!1,didFirePressStart:!1,isTriggeringEvent:!1,activePointerId:null,target:null,isOverTarget:!1,pointerType:null,disposables:[]}),{addGlobalListener:b,removeAllGlobalListeners:y}=gD(),v=(0,uZ.useCallback)((e,n)=>{let o=g.current;if(s||o.didFirePressStart)return!1;let i=!0;if(o.isTriggeringEvent=!0,r){let t=new gz("pressstart",n,e);r(t),i=t.shouldStopPropagation}return t&&t(!0),o.isTriggeringEvent=!1,o.didFirePressStart=!0,m(!0),i},[s,r,t]),$=(0,uZ.useCallback)((e,r,i=!0)=>{let a=g.current;if(!a.didFirePressStart)return!1;a.didFirePressStart=!1,a.isTriggeringEvent=!0;let l=!0;if(o){let n=new gz("pressend",r,e);o(n),l=n.shouldStopPropagation}if(t&&t(!1),m(!1),n&&i&&!s){let t=new gz("press",r,e);n(t),l&&=t.shouldStopPropagation}return a.isTriggeringEvent=!1,l},[s,o,t,n]),A=gE($),w=gE((0,uZ.useCallback)((e,n)=>{let t=g.current;if(s)return!1;if(i){t.isTriggeringEvent=!0;let r=new gz("pressup",n,e);return i(r),t.isTriggeringEvent=!1,r.shouldStopPropagation}return!0},[s,i])),k=(0,uZ.useCallback)(e=>{let n=g.current;if(n.isPressed&&n.target){for(let t of(n.didFirePressStart&&null!=n.pointerType&&$(gj(n.target,e),n.pointerType,!1),n.isPressed=!1,n.isOverTarget=!1,n.activePointerId=null,n.pointerType=null,y(),p||g$(n.target),n.disposables))t();n.disposables=[]}},[p,y,$]),x=gE(k),C=(0,uZ.useCallback)(e=>{u&&k(e)},[u,k]),E=(0,uZ.useCallback)(e=>{s||a?.(e)},[s,a]),D=(0,uZ.useCallback)((e,n)=>{if(!s&&a){let t=new MouseEvent("click",e);mF(t,n),a(mR(t))}},[s,a]),S=(0,uZ.useMemo)(()=>{let e=g.current,n={onKeyDown(n){if(gN(n.nativeEvent,n.currentTarget)&&mD(n.currentTarget,mS(n))){gR(mS(n),n.key)&&n.preventDefault();let r=!0;e.isPressed||n.repeat||(e.target=n.currentTarget,e.isPressed=!0,e.pointerType="keyboard",r=v(n,"keyboard"));let o=n.currentTarget;b(mC(n.currentTarget),"keyup",hQ(n=>{gN(n,o)&&!n.repeat&&mD(o,mS(n))&&e.target&&w(gj(e.target,n),"keyboard")},t),!0),r&&n.stopPropagation(),n.metaKey&&mq()&&e.metaKeyEvents?.set(n.key,n.nativeEvent)}else"Meta"===n.key&&(e.metaKeyEvents=new Map)},onClick(n){if((!n||mD(n.currentTarget,mS(n)))&&n&&0===n.button&&!e.isTriggeringEvent&&!m1.isOpening){let t=!0;if(s&&n.preventDefault(),!e.ignoreEmulatedMouseEvents&&!e.isPressed&&("virtual"===e.pointerType||m0(n.nativeEvent))){let e=v(n,"virtual"),r=w(n,"virtual"),o=A(n,"virtual");E(n),t=e&&r&&o}else if(e.isPressed&&"keyboard"!==e.pointerType){let r=e.pointerType||n.nativeEvent.pointerType||"virtual",o=w(gj(n.currentTarget,n),r),i=A(gj(n.currentTarget,n),r,!0);t=o&&i,e.isOverTarget=!1,E(n),x(n)}e.ignoreEmulatedMouseEvents=!1,t&&n.stopPropagation()}}},t=n=>{if(e.isPressed&&e.target&&gN(n,e.target)){gR(mS(n),n.key)&&n.preventDefault();let t=mS(n),r=mD(e.target,t);A(gj(e.target,n),"keyboard",r),r&&D(n,e.target),y(),"Enter"!==n.key&&gI(e.target)&&mD(e.target,t)&&!n[gP]&&(n[gP]=!0,m1(e.target,n,!1)),e.isPressed=!1,e.metaKeyEvents?.delete(n.key)}else if("Meta"===n.key&&e.metaKeyEvents?.size){let n=e.metaKeyEvents;for(let t of(e.metaKeyEvents=void 0,n.values()))e.target?.dispatchEvent(new KeyboardEvent("keyup",t))}};if("u">typeof PointerEvent){n.onPointerDown=n=>{var o;if(0!==n.button||!mD(n.currentTarget,mS(n)))return;if(o=n.nativeEvent,!mX()&&0===o.width&&0===o.height||1===o.width&&1===o.height&&0===o.pressure&&0===o.detail&&"mouse"===o.pointerType){e.pointerType="virtual";return}e.pointerType=n.pointerType;let i=!0;if(!e.isPressed){e.isPressed=!0,e.isOverTarget=!0,e.activePointerId=n.pointerId,e.target=n.currentTarget,p||function(e){if(mY()){if("default"===gy){let n=mC(e);g_=n.documentElement.style.webkitUserSelect,n.documentElement.style.webkitUserSelect="none"}gy="disabled"}else if(e instanceof HTMLElement||e instanceof SVGElement){let n="userSelect"in e.style?"userSelect":"webkitUserSelect";gv.set(e,e.style[n]),e.style[n]="none"}}(e.target),i=v(n,e.pointerType);let o=mS(n);"releasePointerCapture"in o&&("hasPointerCapture"in o?o.hasPointerCapture(n.pointerId)&&o.releasePointerCapture(n.pointerId):o.releasePointerCapture(n.pointerId)),b(mC(n.currentTarget),"pointerup",t,!1),b(mC(n.currentTarget),"pointercancel",r,!1)}i&&n.stopPropagation()},n.onMouseDown=n=>{if(mD(n.currentTarget,mS(n))&&0===n.button){if(c){let t=function(e){for(;e&&!mI(e,{skipVisibilityCheck:!0});)e=e.parentElement;let n=mE(e),t=n.document.activeElement;if(!t||t===e)return;mW=!0;let r=!1,o=e=>{(mS(e)===t||r)&&e.stopImmediatePropagation()},i=n=>{(mS(n)===t||r)&&(n.stopImmediatePropagation(),e||r||(r=!0,mk(t),l()))},a=n=>{(mS(n)===e||r)&&n.stopImmediatePropagation()},s=n=>{(mS(n)===e||r)&&(n.stopImmediatePropagation(),r||(r=!0,mk(t),l()))};n.addEventListener("blur",o,!0),n.addEventListener("focusout",i,!0),n.addEventListener("focusin",s,!0),n.addEventListener("focus",a,!0);let l=()=>{cancelAnimationFrame(c),n.removeEventListener("blur",o,!0),n.removeEventListener("focusout",i,!0),n.removeEventListener("focusin",s,!0),n.removeEventListener("focus",a,!0),mW=!1,r=!1},c=requestAnimationFrame(l);return l}(n.target);t&&e.disposables.push(t)}n.stopPropagation()}},n.onPointerUp=n=>{mD(n.currentTarget,mS(n))&&"virtual"!==e.pointerType&&(0!==n.button||e.isPressed||w(n,e.pointerType||n.pointerType))},n.onPointerEnter=n=>{n.pointerId===e.activePointerId&&e.target&&!e.isOverTarget&&null!=e.pointerType&&(e.isOverTarget=!0,v(gj(e.target,n),e.pointerType))},n.onPointerLeave=n=>{n.pointerId===e.activePointerId&&e.target&&e.isOverTarget&&null!=e.pointerType&&(e.isOverTarget=!1,A(gj(e.target,n),e.pointerType,!1),C(n))};let t=n=>{if(n.pointerId===e.activePointerId&&e.isPressed&&0===n.button&&e.target){if(mD(e.target,mS(n))&&null!=e.pointerType){let t=!1,r=setTimeout(()=>{e.isPressed&&e.target instanceof HTMLElement&&(t?x(n):(mk(e.target),e.target.click()))},80);b(n.currentTarget,"click",()=>t=!0,!0),e.disposables.push(()=>clearTimeout(r))}else x(n);e.isOverTarget=!1}},r=e=>{x(e)};n.onDragStart=e=>{mD(e.currentTarget,mS(e))&&x(e)}}return n},[b,s,c,y,p,C,v,E,D]);return(0,uZ.useEffect)(()=>{if(!d)return;let e=mC(d.current);if(!e||!e.head||e.getElementById(gO))return;let n=e.createElement("style");n.id=gO;let t=gk(e);t&&(n.nonce=t),n.textContent=`
17
17
  @layer {
18
18
  [${gT}] {