@openmrs/esm-form-builder-app 3.5.2-pre.3630 → 3.5.2-pre.3632

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/4538.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 n3=(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&&n5(e)){if(o._type===nx.Array&&Array.isArray(r)){let o=r.map(n=>n3(e,n));t[n]=o}else if(o._type===nx.Object)for(let n of Object.keys(r))r[n]=n3(e,r[n])}}else if(n4(o)){let e=r??{};n4(e)&&(t[n]=n3(o,e))}}return t};function n5(e){return!!e&&Object.keys(e).filter(e=>!["_default","_validators"].includes(e)).length>0}function n4(e){return"object"==typeof e&&!Array.isArray(e)&&null!==e}let n6=new Set;function n8(e,n){let t=`${e}:::${n}`;n6||(n6=new Set),n6.has(t)||(console.error(n),n6.add(t))}let n7={"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(", ")}.`})]}},n9={"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}},...n7},te=(e,n)=>nC(t=>e<=t&&t<=n,`must be between ${e} and ${n}`),tn=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(", "))},tt=tn([]),tr=e=>nC(n=>e.includes(n),`Must be one of the following: '${e.join("', '")}'.`),to={inRange:te,isUrl:tt,isUrlWithTemplateParameters:tn,oneOf:tr};var ti=t(48067);let ta=L("breadcrumbs",[]);function ts(e){return tl([e])}function tl(e){let n=[...tc(),...e.map(e=>({matcher:e.matcher instanceof RegExp?e.matcher:"string"==typeof e.matcher?(0,ti.pathToRegexp)(e.matcher).regexp:(0,ti.pathToRegexp)(e.path).regexp,settings:e}))];ta.setState(n,!0)}function tc(){return ta.getState()}function tu(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=tu(e,t.join("/"));if(n)return n}}(e,n)}function tp(e,n){if(e.length>0){let t=tu(e,n);if(t){let n=[t],r=tu(e,t.settings.parent);for(;void 0!==r;)n.push(r),r=tu(e,r.settings.parent);return n.reverse()}}return[]}function td(e){return tp(tc(),e)}var tf=Object.freeze({__proto__:null,get start(){return rN},get ensureJQuerySupport(){return rd},get setBootstrapMaxTime(){return t3},get setMountMaxTime(){return t5},get setUnmountMaxTime(){return t4},get setUnloadMaxTime(){return t6},get registerApplication(){return rw},get unregisterApplication(){return rx},get getMountedApps(){return r_},get getAppStatus(){return r$},get unloadApplication(){return rC},get checkActivityFunctions(){return rk},get getAppNames(){return rv},get pathToActiveWhen(){return rS},get navigateToUrl(){return rr},get patchHistoryApi(){return rc},get triggerAppChange(){return rO},get addErrorHandler(){return ty},get removeErrorHandler(){return t_},get mountRootParcel(){return tX},get NOT_LOADED(){return tA},get LOADING_SOURCE_CODE(){return tw},get NOT_BOOTSTRAPPED(){return tk},get BOOTSTRAPPING(){return tx},get NOT_MOUNTED(){return tC},get MOUNTING(){return tE},get UPDATING(){return tS},get LOAD_ERROR(){return tP},get MOUNTED(){return tD},get UNLOADING(){return tz},get UNMOUNTING(){return tM},get SKIP_BECAUSE_BROKEN(){return tO}}),th=("u">typeof globalThis?globalThis:"u">typeof window?window:"u">typeof global?global:"u">typeof self?self:{}).CustomEvent,tm=!function(){try{var e=new th("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}:th;let tg=[];function tb(e,n,t){let r=t$(e,n,t);tg.length?tg.forEach(e=>e(r)):setTimeout(()=>{throw r})}function ty(e){if("function"!=typeof e)throw Error(tv(28,!1));tg.push(e)}function t_(e){if("function"!=typeof e)throw Error(tv(29,!1));let n=!1;return tg=tg.filter(t=>{let r=t===e;return n=n||r,!r}),n}function tv(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 t$(e,n,t){let r,o=`${tj(n)} '${tI(n)}' died in status ${n.status}: `;if(e instanceof Error){try{e.message=o+e.message}catch(e){}r=e}else{console.warn(tv(30,!1,n.status,tI(n)));try{r=Error(o+JSON.stringify(e))}catch(n){r=e}}return r.appOrParcelName=tI(n),n.status=t,r}let tA="NOT_LOADED",tw="LOADING_SOURCE_CODE",tk="NOT_BOOTSTRAPPED",tx="BOOTSTRAPPING",tC="NOT_MOUNTED",tE="MOUNTING",tD="MOUNTED",tS="UPDATING",tM="UNMOUNTING",tz="UNLOADING",tP="LOAD_ERROR",tO="SKIP_BECAUSE_BROKEN";function tT(e){return e.status===tD}function tB(e){try{return e.activeWhen(window.location)}catch(n){return tb(n,e,tO),!1}}function tI(e){return e.name}function tN(e){return!!e.unmountThisParcel}function tj(e){return tN(e)?"parcel":"application"}function tR(){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 tF(e,n){for(let t=0;t<e.length;t++)if(n(e[t]))return e[t];return null}function tL(e){return e&&("function"==typeof e||Array.isArray(e)&&!tF(e,e=>"function"!=typeof e))}function tW(e,n){let t=e[n]||[];0===(t=Array.isArray(t)?t:[t]).length&&(t=[()=>Promise.resolve()]);let r=tj(e),o=tI(e);return function(e){return t.reduce((t,i,a)=>t.then(()=>{let t=i(e);return tV(t)?t:Promise.reject(tv(15,!1,r,o,n,a))}),Promise.resolve())}}function tV(e){return e&&"function"==typeof e.then&&"function"==typeof e.catch}let tG=[];function tU(e,n){return Promise.resolve().then(()=>e.status!==tk?e:(e.status=tx,e.bootstrap?t8(e,"bootstrap").then(t).catch(t=>{if(n)throw t$(t,e,tO);return tb(t,e,tO),e}):Promise.resolve().then(t)));function t(){return e.status=tC,e}}function tq(e,n){return Promise.resolve().then(()=>{if(e.status!==tD)return e;return e.status=tM,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 t$(t,e,tO);tb(t,e,tO)})).then(()=>e);function t(){return t8(e,"unmount").then(()=>{e.status=tC},t=>{if(n)throw t$(t,e,tO);tb(t,e,tO)})}})}let tH=!1,tK=!1;function tY(e,n){return Promise.resolve().then(()=>e.status!==tC?e:(tH||(window.dispatchEvent(new tm("single-spa:before-first-mount")),tH=!0),e.status=tE,t8(e,"mount").then(()=>(e.status=tD,tK||(window.dispatchEvent(new tm("single-spa:first-mount")),tK=!0),e)).catch(t=>{return e.status=tD,tq(e,!0).then(r,r);function r(){if(n)throw t$(t,e,tO);return tb(t,e,tO),e}})))}let tJ=0,tZ={parcels:{}};function tX(){return tQ.apply(tZ,arguments)}function tQ(e,n){let t,r,o,i=this;if(!e||"object"!=typeof e&&"function"!=typeof e)throw Error(tv(2,!1));if(e.name&&"string"!=typeof e.name)throw Error(tv(3,!1,typeof e.name));let a=tJ++,s=e.name||`parcel-${a}`;if("object"!=typeof n)throw Error(tv(4,!1,s,typeof n));if(!n.domElement)throw Error(tv(5,!1,s));let l="function"==typeof e,c=l?e:()=>Promise.resolve(e),u={id:a,parcels:{},status:l?tw:tk,customProps:n,parentName:tI(i),unmountThisParcel:()=>f.then(()=>{if(u.status!==tD)throw Error(tv(6,!1,s,u.status));return tq(u,!0)}).then(e=>(u.parentName&&delete i.parcels[u.id],e)).then(e=>(r(e),e)).catch(e=>{throw u.status=tO,o(e),e})};i.parcels[a]=u;let p=c();if(!p||"function"!=typeof p.then)throw Error(tv(7,!1));let d=(p=p.then(e=>{if(!e)throw Error(tv(8,!1));if(s=e.name||`parcel-${a}`,Object.prototype.hasOwnProperty.call(e,"bootstrap")&&!tL(e.bootstrap))throw Error(tv(9,!1,s));if(!tL(e.mount))throw Error(tv(10,!1,s));if(!tL(e.unmount))throw Error(tv(11,!1,s));if(e.update&&!tL(e.update))throw Error(tv(12,!1,s));let n=tW(e,"bootstrap"),r=tW(e,"mount"),o=tW(e,"unmount");u.status=tk,u.name=s,u.bootstrap=n,u.mount=r,u.unmount=o,u.timeouts=t7(e.timeouts),e.update&&(u.update=tW(e,"update"),t.update=function(e){return u.customProps=e,t0(Promise.resolve().then(()=>{if(u.status!==tD)throw Error(tv(32,!1,tI(u)));return u.status=tS,t8(u,"update").then(()=>(u.status=tD,u)).catch(e=>{throw t$(e,u,tO)})}))})})).then(()=>tU(u,!0)),f=d.then(()=>tY(u,!0)),h=new Promise((e,n)=>{r=e,o=n});return t={mount:()=>t0(Promise.resolve().then(()=>{if(u.status!==tC)throw Error(tv(13,!1,s,u.status));return i.parcels[a]=u,tY(u)})),unmount:()=>t0(u.unmountThisParcel()),getStatus:()=>u.status,loadPromise:t0(p),bootstrapPromise:t0(d),mountPromise:t0(f),unmountPromise:t0(h)}}function t0(e){return e.then(()=>null)}function t1(e){let n=tI(e),t="function"==typeof e.customProps?e.customProps(n,window.location):e.customProps;("object"!=typeof t||null===t||Array.isArray(t))&&(t={},console.warn(tv(40,!1),n,t));let r=tR({},t,{name:n,mountParcel:tQ.bind(e),singleSpa:tf});return tN(e)&&(r.unmountSelf=e.unmountThisParcel),r}let t2={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 t3(e,n,t){if("number"!=typeof e||e<=0)throw Error(tv(16,!1));t2.bootstrap={millis:e,dieOnTimeout:n,warningMillis:t||1e3}}function t5(e,n,t){if("number"!=typeof e||e<=0)throw Error(tv(17,!1));t2.mount={millis:e,dieOnTimeout:n,warningMillis:t||1e3}}function t4(e,n,t){if("number"!=typeof e||e<=0)throw Error(tv(18,!1));t2.unmount={millis:e,dieOnTimeout:n,warningMillis:t||1e3}}function t6(e,n,t){if("number"!=typeof e||e<=0)throw Error(tv(19,!1));t2.unload={millis:e,dieOnTimeout:n,warningMillis:t||1e3}}function t8(e,n){let t=e.timeouts[n],r=t.warningMillis,o=tj(e);return new Promise((i,a)=>{let s=!1,l=!1;e[n](t1(e)).then(e=>{s=!0,i(e)}).catch(e=>{s=!0,a(e)}),setTimeout(()=>u(1),r),setTimeout(()=>u(!0),t.millis);let c=tv(31,!1,n,o,tI(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 t7(e){let n={};for(let t in t2)n[t]=tR({},t2[t],e&&e[t]||{});return n}function t9(e){return Promise.resolve().then(()=>{let n,t;return e.loadPromise?e.loadPromise:e.status!==tA&&e.status!==tP?e:(e.status=tw,e.loadPromise=Promise.resolve().then(()=>{let r=e.loadApp(t1(e));if(!tV(r))throw t=!0,Error(tv(33,!1,tI(e)));return r.then(t=>{let r;e.loadErrorTime=null,"object"!=typeof(n=t)&&(r=34),Object.prototype.hasOwnProperty.call(n,"bootstrap")&&!tL(n.bootstrap)&&(r=35),tL(n.mount)||(r=36),tL(n.unmount)||(r=37);let o=tj(n);if(r){let t;try{t=JSON.stringify(n)}catch(e){}return console.error(tv(r,!1,o,tI(e),t),n),tb(void 0,e,tO),e}return n.devtools&&n.devtools.overlays&&(e.devtools.overlays=tR({},e.devtools.overlays,n.devtools.overlays)),e.status=tk,e.bootstrap=tW(n,"bootstrap"),e.mount=tW(n,"mount"),e.unmount=tW(n,"unmount"),e.unload=tW(n,"unload"),e.timeouts=t7(n.timeouts),delete e.loadPromise,e})}).catch(n=>{let r;return delete e.loadPromise,t?r=tO:(r=tP,e.loadErrorTime=(new Date).getTime()),tb(n,e,r),e}))})}let re="u">typeof window,rn={hashchange:[],popstate:[]},rt=["hashchange","popstate"];function rr(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(tv(14,!1));n=e.currentTarget.href,e.preventDefault()}let t=ru(window.location.href),r=ru(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 ro(e){if(e){let n=e[0].type;rt.indexOf(n)>=0&&rn[n].forEach(n=>{try{n.apply(this,e)}catch(e){setTimeout(()=>{throw e})}})}}function ri(){rT([],arguments)}function ra(e,n){return function(){let t=window.location.href,o=e.apply(this,arguments),i=window.location.href;return r&&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)),o}}let rs=null,rl=!1;function rc(e){if(rl)throw Error(tv(43,!1));r=!e||!e.hasOwnProperty("urlRerouteOnly")||e.urlRerouteOnly,rl=!0,rs=window.history.replaceState,window.addEventListener("hashchange",ri),window.addEventListener("popstate",ri);let n=window.addEventListener,t=window.removeEventListener;window.addEventListener=function(e,t){if(!("function"==typeof t&&rt.indexOf(e)>=0)||tF(rn[e],e=>e===t))return n.apply(this,arguments);rn[e].push(t)},window.removeEventListener=function(e,n){return"function"==typeof n&&rt.indexOf(e)>=0&&(rn[e]=rn[e].filter(e=>e!==n)),t.apply(this,arguments)},window.history.pushState=ra(window.history.pushState,"pushState"),window.history.replaceState=ra(rs,"replaceState")}function ru(e){let n=document.createElement("a");return n.href=e,n}re&&(window.singleSpaNavigate?console.warn(tv(41,!1)):window.singleSpaNavigate=rr);let rp=!1;function rd(e=window.jQuery){if(e||window.$&&window.$.fn&&window.$.fn.jquery&&(e=window.$),e&&!rp){let n=e.fn.on,t=e.fn.off;e.fn.on=function(e,t){return rf.call(this,n,window.addEventListener,e,t,arguments)},e.fn.off=function(e,n){return rf.call(this,t,window.removeEventListener,e,n,arguments)},rp=!0}}function rf(e,n,t,r,o){return"string"!=typeof t?e.apply(this,o):(t.split(/\s+/).forEach(e=>{rt.indexOf(e)>=0&&(n(e,r),t=t.replace(e,""))}),""===t.trim()?this:e.apply(this,o))}let rh={};function rm(e){return Promise.resolve().then(()=>{let n=rh[tI(e)];if(!n)return e;if(e.status===tA)return rg(e,n),e;if(e.status===tz)return n.promise.then(()=>e);if(e.status!==tC&&e.status!==tP)return e;let t=e.status===tP?Promise.resolve():t8(e,"unload");return e.status=tz,t.then(()=>(rg(e,n),e)).catch(t=>(delete rh[tI(e)],delete e.bootstrap,delete e.mount,delete e.unmount,delete e.unload,tb(t,e,tO),n.reject(t),e))})}function rg(e,n){delete rh[tI(e)],delete e.bootstrap,delete e.mount,delete e.unmount,delete e.unload,e.status=tA,n.resolve()}function rb(e,n,t,r){rh[tI(e)]={app:e,resolve:t,reject:r},Object.defineProperty(rh[tI(e)],"promise",{get:n})}let ry=[];function r_(){return ry.filter(tT).map(tI)}function rv(){return ry.map(tI)}function r$(e){let n=tF(ry,n=>tI(n)===e);return n?n.status:null}let rA=!1;function rw(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(tv(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(tv(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(tv(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(tv(24,!1));if(!rD(e.customProps))throw Error(tv(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(tv(20,!1));if(!n)throw Error(tv(23,!1));if("function"!=typeof t)throw Error(tv(24,!1));if(!rD(r))throw Error(tv(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:rS(e)),a.activeWhen=e=>s.some(n=>n(e)),a);if(rI||rA||(rA=!0,setTimeout(()=>{rI||console.warn(tv(1,!1))},5e3)),-1!==rv().indexOf(l.name))throw Error(tv(21,!1,l.name));ry.push(tR({loadErrorTime:null,status:tA,parcels:{},devtools:{overlays:{options:{},selectors:[]}}},l)),re&&(rd(),rT())}function rk(e=window.location){return ry.filter(n=>n.activeWhen(e)).map(tI)}function rx(e){if(0===ry.filter(n=>tI(n)===e).length)throw Error(tv(25,!1,e));return(re?rC(e,{waitForUnmount:!1}):Promise.resolve()).then(()=>{let n=ry.map(tI).indexOf(e);ry.splice(n,1)})}function rC(e,n={waitForUnmount:!1}){if("string"!=typeof e)throw Error(tv(26,!1));let t=tF(ry,n=>tI(n)===e);if(!t)throw Error(tv(27,!1,e));let r=rh[tI(t)];if(n&&n.waitForUnmount){if(r)return r.promise;{let e=new Promise((n,r)=>{rb(t,()=>e,n,r)});return e}}{let e;return r?(e=r.promise,rE(t,r.resolve,r.reject)):e=new Promise((n,r)=>{rb(t,()=>e,n,r),rE(t,n,r)}),e}}function rE(e,n,t){Promise.resolve().then(()=>{if(tF(rk(),n=>n===tI(e)))return rO()}).then(()=>tq(e).then(rm).then(()=>{n(),setTimeout(()=>{rT()})})).catch(t)}function rD(e){return!e||"function"==typeof e||"object"==typeof e&&null!==e&&!Array.isArray(e)}function rS(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 rM=!1,rz=[],rP=re&&window.location.href;function rO(){return rT()}function rT(e=[],n,t=!1){let r,o,i,a,s;if(rM)return new Promise((e,t)=>{rz.push({resolve:e,reject:t,eventArguments:n})});let{appsToUnload:l,appsToUnmount:c,appsToLoad:u,appsToMount:p}=(r=[],o=[],i=[],a=[],s=(new Date).getTime(),ry.forEach(e=>{let n=e.status!==tO&&tB(e);switch(e.status){case tP:n&&s-e.loadErrorTime>=200&&i.push(e);break;case tA:case tw:n&&i.push(e);break;case tk:case tC:!n&&rh[tI(e)]?r.push(e):n&&a.push(e);break;case tD:n||o.push(e)}}),{appsToUnload:r,appsToUnmount:o,appsToLoad:i,appsToMount:a}),d,f=[],h=rP,m=rP=window.location.href;return rI?(rM=!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 rs.call(window.history,history.state,"",h.substring(location.origin.length)),rP=location.href,rM=!1,rT(e,n,!0);let r=l.map(rm),o=Promise.all(c.map(tq).map(e=>e.then(rm)).concat(r));o.then(()=>{$("before-mount-routing-event",v(!0))},e=>{throw e});let i=u.map(e=>t9(e).then(e=>rB(e,o))),a=p.filter(e=>0>u.indexOf(e)).map(e=>rB(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(t9)).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(tv(42,!1))),console.warn(e),!1)))}function b(){let n=r_();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(rM=!1,rz.length>0){let e=rz;rz=[],rT(e)}return n}function y(){t||(e.forEach(e=>{ro(e.eventArguments)}),ro(n))}function v(e=!1,t){let r={},o={[tD]:[],[tC]:[],[tA]:[],[tO]:[]};e?(u.concat(p).forEach((e,n)=>{a(e,tD)}),l.forEach(e=>{a(e,tA)}),c.forEach(e=>{a(e,tC)})):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&&tR(i.detail,t),i;function a(e,n){let t=tI(e);n=n||r$(t),r[t]=n,(o[n]=o[n]||[]).push(t)}}function $(e,n){t||window.dispatchEvent(new tm(`single-spa:${e}`,n))}}function rB(e,n){return tB(e)?tU(e).then(e=>n.then(()=>tB(e)?tY(e):e)):n.then(()=>e)}let rI=!1;function rN(e){rI=!0,re&&(rc(e),rT())}function rj(e,n){let t=window.getOpenmrsSpaBase().replace(/\/$/,"");return rR(e,{openmrsBase:window.openmrsBase,openmrsSpaBase:t,...n}).replace(/^\/\//,"/")}function rR(e,n){return Object.keys(n).reduce((e,t)=>e.split("${"+t+"}").join(n[t]),e)}function rF({to:e,templateParams:n}){let t=window.getOpenmrsSpaBase().replace(/\/$/,""),r=rj(e,n).replace(window.location.origin,"");r.startsWith(t)?rr(r):window.location.assign(r)}re&&window.__SINGLE_SPA_DEVTOOLS__&&(window.__SINGLE_SPA_DEVTOOLS__.exposedMethods={getRawAppData:function(){return[...ry]},reroute:rT,NOT_LOADED:tA,toLoadPromise:t9,toBootstrapPromise:tU,unregisterApplication:rx,getProfilerData:function(){return tG}});let rL="openmrs:history";function rW(){return JSON.parse(sessionStorage.getItem(rL)??"[]")}function rV({toUrl:e}){let n=rW(),t=n.lastIndexOf(e);if(-1!=t){let e=n.slice(0,t+1);rF({to:n[t]}),sessionStorage.setItem(rL,JSON.stringify(e))}else throw Error(`URL ${e} not found in history; cannot go back to it.`)}function rG(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,to.isUrl,nx.Array,nx.Number,to.inRange(100,600),nx.Boolean,nx.Boolean;let rU="/ws/rest/v1",rq="/ws/fhir2/R4",rH=`${rU}/session`;function rK(e){return e&&e.startsWith("http")?e:("/"!==e[0]&&(e="/"+e),window.openmrsBase+e)}function rY(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=rK(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(rU)&&void 0===n.headers["Disable-WWW-Authenticate"]&&(n.headers["Disable-WWW-Authenticate"]="true"),e.startsWith(rq)){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 nK("@openmrs/esm-api");if(e.ok){let n=e.headers.get("location");return(o&&n&&(t===rK(rH)||204===e.status)&&rF({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===rK(rH)&&403===e.status||n.enabled&&n.errors.includes(e.status)?(sessionStorage.removeItem(rL),rF({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 rZ(t,e,o,r)},n=>{throw new rZ(t,e,null,r)})})}function rJ(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 rY(e,n).then(e=>{o=!0,r.next(e),r.complete()},e=>{o=!0,r.error(e)}),()=>{o||t.abort()}})}class rZ extends Error{constructor(e,n,t,r){super(),rG(this,"response",void 0),rG(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 rX=L("session",{loaded:!1,session:null}),rQ=0;function r0(e={includeAuthStatus:!0}){return(rQ<Date.now()-6e4||!rX.getState().loaded)&&r3(),new er.Observable(n=>{let t=t=>{t.loaded&&(e.includeAuthStatus?n.next(t.session):n.next(t.session?.user))};return t(rX.getState()),rX.subscribe(t)})}function r1(){return(rQ<Date.now()-6e4||!rX.getState().loaded)&&r3(),rX}function r2(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 r3(e,n){rQ=Date.now();let t={};return e&&n&&(t.Authorization=`Basic ${window.btoa(`${e}:${n}`)}`),oe(rY(rH,{headers:t}))}function r5(){rX.setState({loaded:!0,session:{authenticated:!1,sessionId:""}})}function r4(e,n){var t,r;if(void 0===n)return!e;if(!e)return!0;return t=e,r=n,("string"==typeof t?!U(r.privileges.find(e=>t===e.display)):Array.isArray(t)?t.every(e=>!U(r.privileges.find(n=>e===n.display))):(U(t)||console.error(`Could not understand privileges "${t}"`),!0))||!U(n.roles.find(e=>"System Developer"===e.display))}function r6(){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(rX.getState()),e||(n=rX.subscribe(r))})}function r8(){return new Promise((e,n)=>{r0().subscribe(n=>{e(n.sessionLocation)},n).unsubscribe()})}async function r7(e,n){return oe(rY(rH,{method:"POST",body:{sessionLocation:e},headers:{"Content-Type":"application/json"},signal:n.signal}))}async function r9(e,n,t){return t||(t=new AbortController),await rY(`${rU}/user/${e}`,{method:"POST",body:{userProperties:n},headers:{"Content-Type":"application/json"},signal:t.signal}),r3()}function oe(e){return new Promise((n,t)=>{e.then(e=>{let r;"object"==typeof e?.data?(r={loaded:!0,session:e.data},rX.setState(r),n(r)):(r={loaded:!1,session:null},rX.setState(r),t(r))}).catch(e=>{z(`Failed to fetch new session information: ${e}`);let n={loaded:!1,session:null};rX.setState(n),t(n)})})}function on(){return"development"===window.spaEnv||"true"===localStorage.getItem("openmrs:devtools")}rX.subscribe(e=>{e.loaded&&e.session&&r2(e.session)});let ot={"webservices.rest":"2.24.0",fhir2:"1.0.0-SNAPSHOT"},or=j()(()=>({}));(p=F[X="openmrs-app-context"])?(p.active?R()||console.error(`Attempted to override the existing store ${X}. Make sure that stores are only created once.`):p.value=or,p.active=!0,p.value):F[X]={value:or,active:!0};let oo={};function oi(e,n=oo){or.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===oo?{}:n})})}function oa(e){or.setState(n=>(e in n&&delete n[e],n))}function os(e,n=e=>e){let t=or.getState();return e in t?Object.freeze(Object.assign({},n?n(t[e]):t[e])):null}function ol(e,n){or.setState(t=>(e in t||(t[e]={}),t[e]=n(t[e]),Object.assign({},t)))}function oc(e,n){let t=os(e);return n(ou(t)),or.subscribe(r=>{let o=e in r?r[e]:null;o!==t&&(t=o,n(ou(o)))})}function ou(e){return null===e?null:Object.freeze(Object.assign({},e))}let op={address1:"Address line 1",address2:"Address line 2",address3:"Address line 3",address4:"Address line 4",address5:"Address line 5",address6:"Address line 6",city:"City",cityVillage:"City",country:"Country",countyDistrict:"District",district:"District",postalCode:"Postal code",state:"State",stateProvince:"State",closeAllOpenedWorkspaces:"Discard changes in {{count}} workspaces",closingAllWorkspacesPromptBody:"There may be unsaved changes in the following workspaces. Do you want to discard changes in the following workspaces? {{workspaceNames}}",closingAllWorkspacesPromptTitle:"You have unsaved changes",discard:"Discard",hide:"Hide",maximize:"Maximize",minimize:"Minimize",openAnyway:"Open anyway",unsavedChangesInOpenedWorkspace:"You may have unsaved changes in the opened workspace. Do you want to discard these changes?",unsavedChangesInWorkspace:'There may be unsaved changes in "{{workspaceName}}". Please save them before opening another workspace.',unsavedChangesTitleText:"Unsaved changes",workspaceHeader:"Workspace header",closeWorkspaces2PromptTitle:"Close workspace(s)",closeWorkspaces2PromptBody:"You are about to close the following workspace(s), which might have unsaved changes:",abnormalValue:"Abnormal value",actions:"Actions",actionableNotification:"Actionable notification",address:"Address",age:"Age",batchActionItemSelected:"{{totalSelected}} item selected",batchActionsItemsSelected:"{{totalSelected}} items selected",cancel:"Cancel",change:"Change",Clinic:"Clinic",close:"Close",closesActionableNotification:"Close actionable notification",closeSnackbar:"Close snackbar",confirm:"Confirm",contactAdministratorIfIssuePersists:"Contact your system administrator if the problem persists.",contactDetails:"Contact details",delete:"Delete",discardChanges:"Discard changes",edit:"Edit",emptyStateText:"There are no {{displayText}} to display",error:"Error",errorCopy:"Sorry, there was a problem displaying this information. You can try to reload this page, or contact the site administrator and quote the error code above.",errorLoadingLoginLocations:"Unable to load login locations. Please try again or contact support if the problem persists.",female:"Female",leftNavigation:"Left navigation",loading:"Loading",male:"Male",noResultsToDisplay:"No results to display",notAvailable:"Not available",other:"Other",paginationItemsCount:"{{pageItemsCount}} / {{totalItems}} items",paginationOfPages:"of {{count}} pages",patientAvatarAlt:"Avatar for {{patientName}}",patientIdentifierSticker:"Patient identifier sticker",patientLists:"Patient lists",patientPhotoAlt:"Profile photo of {{patientName}}",patientPhotoPlaceholder:"Photo placeholder for {{patientName}}",print:"Print",printError:"Print error",printErrorExplainer:"An error occurred in {{errorLocation}}",printIdentifierSticker:"Print identifier sticker",printing:"Printing",recordNewEntry:"Record {{displayText}}",relationships:"Relationships",resetOverrides:"Reset overrides",save:"Save",scriptLoadingFailed:"Error: Script failed to load",scriptLoadingError:"Failed to load overridden script from {{url}}. Please check that the bundled script is available at the expected URL. Click the button below to reset all import map overrides.",searchForLocation:"Search for a location",seeAll:"See all",seeMoreLists:"See {{count}} more lists",selectAll:"Select all",sex:"Sex",showLess:"Show less",showMore:"Show more",snackbarNotification:"Snackbar notification",toggleDevTools:"Toggle dev tools",unknown:"Unknown",yearAbbreviation:"yr",yearsAbbreviation:"yrs"},od=e=>"string"==typeof e,of=()=>{let e,n,t=new Promise((t,r)=>{e=t,n=r});return t.resolve=e,t.reject=n,t},oh=e=>null==e?"":""+e,om=/###/g,og=e=>e&&e.indexOf("###")>-1?e.replace(om,"."):e,ob=e=>!e||od(e),oy=(e,n,t)=>{let r=od(n)?n.split("."):n,o=0;for(;o<r.length-1;){if(ob(e))return{};let n=og(r[o]);!e[n]&&t&&(e[n]=new t),e=Object.prototype.hasOwnProperty.call(e,n)?e[n]:{},++o}return ob(e)?{}:{obj:e,k:og(r[o])}},o_=(e,n,t)=>{let{obj:r,k:o}=oy(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=oy(e,a,Object);for(;void 0===s.obj&&a.length;)i=`${a[a.length-1]}.${i}`,s=oy(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},ov=(e,n)=>{let{obj:t,k:r}=oy(e,n);if(t&&Object.prototype.hasOwnProperty.call(t,r))return t[r]},o$=(e,n,t)=>{for(let r in n)"__proto__"!==r&&"constructor"!==r&&(r in e?od(e[r])||e[r]instanceof String||od(n[r])||n[r]instanceof String?t&&(e[r]=n[r]):o$(e[r],n[r],t):e[r]=n[r]);return e};var oA={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;","/":"&#x2F;"};let ow=e=>od(e)?e.replace(/[&<>"'\/]/g,e=>oA[e]):e,ok=[" ",",","?","!",";"],ox=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),oC=(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},oE=e=>e?.replace("_","-"),oD={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 oS{constructor(e,n={}){this.init(e,n)}init(e,n={}){this.prefix=n.prefix||"i18next:",this.logger=e||oD,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:(od(e[0])&&(e[0]=`${t}${this.prefix} ${e[0]}`),this.logger[n](e))}create(e){return new oS(this.logger,{...{prefix:`${this.prefix}:${e}:`},...this.options})}clone(e){return(e=e||this.options).prefix=e.prefix||this.prefix,new oS(this.logger,e)}}var oM=new oS;class oz{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 oP extends oz{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):od(t)&&i?o.push(...t.split(i)):o.push(t)));let s=ov(this.data,o);return(!s&&!n&&!t&&e.indexOf(".")>-1&&(e=o[0],n=o[1],t=o.slice(2).join(".")),!s&&a&&od(t))?oC(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),o_(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)(od(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=ov(this.data,a)||{};i.skipCopy||(t=JSON.parse(JSON.stringify(t))),r?o$(s,t,o):s={...s,...t},o_(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 oO={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 oT=Symbol("i18next/PATH_KEY");function oB(e,n){let t,r,o,{[oT]:i}=e((r=[],(o=Object.create(null)).get=(e,n)=>(t?.revoke?.(),n===oT)?r:(r.push(n),(t=Proxy.revocable(e,o)).proxy),Proxy.revocable(Object.create(null),o).proxy));return i.join(n?.keySeparator??".")}let oI={},oN=e=>!od(e)&&"boolean"!=typeof e&&"number"!=typeof e;class oj extends oz{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=oM.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=oN(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=ok.filter(e=>0>n.indexOf(e)&&0>t.indexOf(e));if(0===r.length)return!0;let o=ox.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:od(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:od(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=oB(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&&!od(r.count),v=oj.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=oN(x),E=Object.prototype.toString.apply(x);if(b&&x&&C&&0>["[object Number]","[object Function]","[object RegExp]"].indexOf(E)&&!(od(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:oN(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&&od(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=od(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&&!od(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=od(i)?[i]:i;return null!=e&&a?.length&&!1!==t.applyPostProcessor&&(e=oO.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 od(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&&!od(n.count),p=u&&!n.ordinal&&0===n.count,d=void 0!==n.context&&(od(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,!oI[`${f[0]}-${e}`]&&this.utils?.hasLoadedNamespace&&!this.utils?.hasLoadedNamespace(a)&&(oI[`${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&&!od(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 oR{constructor(e){this.options=e,this.supportedLngs=this.options.supportedLngs||!1,this.logger=oM.create("languageUtils")}getScriptPartFromCode(e){if(!(e=oE(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=oE(e))||0>e.indexOf("-"))return e;let n=e.split("-");return this.formatLanguageCode(n[0])}formatLanguageCode(e){if(od(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)),od(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 od(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))):od(e)&&o(this.formatLanguageCode(e)),t.forEach(e=>{0>r.indexOf(e)&&o(this.formatLanguageCode(e))}),r}}let oF={zero:0,one:1,two:2,few:3,many:4,other:5},oL={select:e=>1===e?"one":"other",resolvedOptions:()=>({pluralCategories:["one","other"]})};class oW{constructor(e,n={}){this.languageUtils=e,this.options=n,this.logger=oM.create("pluralResolver"),this.pluralRulesCache={}}addRule(e,n){this.rules[e]=n}clearCache(){this.pluralRulesCache={}}getRule(e,n={}){let t,r=oE("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!"),oL;if(!e.match(/-|_/))return oL;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)=>oF[e]-oF[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 oV=(e,n,t,r=".",o=!0)=>{let i,a=void 0!==(i=ov(e,t))?i:ov(n,t);return!a&&o&&od(t)&&void 0===(a=oC(e,t,r))&&(a=oC(n,t,r)),a};class oG{constructor(e={}){this.logger=oM.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:ow,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=oV(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(oV(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=od(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 od(i)||this.useRawValueToEscape||(i=oh(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&&!od(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&&!od(o))return o;od(o)||(o=oh(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 oU=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(oE(r),o),n[a]=s),s(t)}},oq=e=>(n,t,r)=>e(oE(t),r)(n);class oH{constructor(e={}){this.logger=oM.create("formatter"),this.options=e,this.init(e)}init(e,n={interpolation:{}}){this.formatSeparator=n.interpolation.formatSeparator||",";let t=n.cacheInBuiltFormats?oU:oq;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()]=oU(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 oK extends oz{constructor(e,n,t,r={}){super(),this.backend=e,this.store=n,this.services=t,this.languageUtils=t.languageUtils,this.options=r,this.logger=oM.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}=oy(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();od(e)&&(e=this.languageUtils.toResolveHierarchy(e)),od(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 oY=()=>({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]),od(e[1])&&(n.defaultValue=e[1]),od(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}),oJ=e=>(od(e.ns)&&(e.ns=[e.ns]),od(e.fallbackLng)&&(e.fallbackLng=[e.fallbackLng]),od(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),oZ=()=>{};class oX extends oz{constructor(e={},n){if(super(),this.options=oJ(e),this.services={},this.logger=oM,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&&(od(e.ns)?e.defaultNS=e.ns:0>e.ns.indexOf("translation")&&(e.defaultNS=e.ns[0]));let t=oY();this.options={...t,...this.options,...oJ(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?oM.init(r(this.modules.logger),this.options):oM.init(null,this.options),e=this.modules.formatter?this.modules.formatter:oH;let n=new oR(this.options);this.store=new oP(this.options.resources,this.options);let o=this.services;o.logger=oM,o.resourceStore=this.store,o.languageUtils=n,o.pluralResolver=new oW(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 oG(this.options),o.utils={hasLoadedNamespace:this.hasLoadedNamespace.bind(this)},o.backendConnector=new oK(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 oj(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=oZ),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=of(),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=oZ){let t=n,r=od(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=of();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=oZ),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&&oO.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=of();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=od(n)?n:n&&n[0],i=this.store.hasLanguageSomeTranslations(t)?t:this.services.languageUtils.getBestMatchFromCodes(od(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=oB(e,{...this.options,...n})),`${i.keyPrefix}${s}${e}`)):("function"==typeof e&&(e=oB(e,{...this.options,...n})),a=i.keyPrefix?`${i.keyPrefix}${s}${e}`:e),this.t(a,i)};return od(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=of();return this.options.ns?(od(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=of();od(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 oR(oY());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 oX(e,n)}cloneInstance(e={},n=oZ){let t=e.forkResourceStore;t&&delete e.forkResourceStore;let r={...this.options,...e,isClone:!0},o=new oX(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 oP(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 oj(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 oQ=oX.createInstance();oQ.createInstance=oX.createInstance,oQ.createInstance,oQ.dir,oQ.init,oQ.loadResources,oQ.reloadResources,oQ.use,oQ.changeLanguage,oQ.getFixedT,oQ.t,oQ.exists,oQ.setDefaultNamespace,oQ.hasLoadedNamespace,oQ.loadNamespaces,oQ.loadLanguages;let o0=oQ.default||oQ;function o1(e,n,t,r){return o0.t(n,{ns:e,defaultValue:t,...r})}function o2(e,n,t){return op[e]?o1("core",e,n??op[e],t):(console.error(`O3 Core Translations does not provide key '${e}'. The key itself is being rendered as text.`),e)}o0.on("initialized",function(){window.i18next.loadNamespaces(["core"])});async function o3(){let e=document.querySelectorAll('script[type="systemjs-importmap"]'),n=[];for(let t=0;t<e.length;t++){let r=e[t];try{if(r.src){let e=await fetch(r.src);n.push(await e.json())}else r.textContent&&n.push(JSON.parse(r.textContent))}catch(e){console.warn(`[import-maps] Failed to parse import map from script tag at index ${t}`,e)}}return function(e){let n={imports:{}};for(let t of e)t?.imports&&Object.assign(n.imports,t.imports);return n}(n)}async function o5(){return await o3()}function o4(e){return e.replace(/[\/\-@]/g,"_")}async function o6(e,n="./start",r){var o;let i,a=!r?.maxLoadingTime||r.maxLoadingTime<=0?6e5:r.maxLoadingTime;await Promise.race([o8(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=o4(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 o8(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=o4(e);if(!window[t]){let t=n??await o7();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[o9];if(o||(o=window[o9]=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:o2("scriptLoadingFailed","Error: Script failed to load"),description:o2("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:o2("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 o7(){return o5()}let o9=Symbol("__openmrs_script_loading"),ie=`${rU}/attachment`;function it(e,n){return rY(`${ie}/${e}`,{signal:n.signal})}function ir(e,n,t){return rY(`${ie}?patient=${e}&includeEncounterless=${n}`,{signal:t.signal})}async function io(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)),rY(`${ie}`,{method:"POST",body:t})}function ii(e,n){return rY(`${ie}/${e}`,{method:"DELETE",signal:n.signal})}try{self["workbox:window:6.5.4"]&&_()}catch(e){}function ia(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 is(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 il(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 ic=function(){var e=this;this.promise=new Promise(function(n,t){e.resolve=n,e.reject=t})};function iu(e,n){var t=location.href;return new URL(e,t).href===new URL(n,t).href}var ip=function(e,n){this.type=e,Object.assign(this,n)};function id(e,n,t){return t?n?n(e):e:(e&&e.then||(e=Promise.resolve(e)),n?e.then(n):e)}function ih(){}var im={type:"SKIP_WAITING"};function ig(e,n){if(!n)return e&&e.then?e.then(ih):Promise.resolve()}async function ib(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 ic,r.en=new ic,r.on=new ic,r.un=0,r.an=new Set,r.cn=function(){var e=r.fn,n=e.installing;r.tn>0||!iu(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 ip(o,a)),"installed"===o?r.wn=self.setTimeout(function(){"installed"===o&&n.waiting===t&&r.dispatchEvent(new ip("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 ip("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 id(r.getSW(),function(){r.an.has(o)&&r.dispatchEvent(new ip("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 ig(new Promise(function(e){return window.addEventListener("load",e)}))},o=function(){return a.mn=!!navigator.serviceWorker.controller,a.yn=a.pn(),id(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&&iu(n.scriptURL,a.sn.toString())&&(a.hn=n,Promise.resolve().then(function(){a.dispatchEvent(new ip("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?ig(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 id(this.getSW(),function(n){return ia(n,e)})}catch(e){return Promise.reject(e)}},r.messageSkipWaiting=function(){this.fn&&this.fn.waiting&&ia(this.fn.waiting,im)},r.pn=function(){var e=navigator.serviceWorker.controller;return e&&iu(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 id(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)}},is(n.prototype,[{key:"active",get:function(){return this.en.promise}},{key:"controlling",get:function(){return this.on.promise}}]),t&&is(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 il(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)?il(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 iy="u">typeof globalThis?globalThis:"u">typeof self?self:"u">typeof window?window:global,i_=Object.keys,iv=Array.isArray;function i$(e,n){return"object"!=typeof n||i_(n).forEach(function(t){e[t]=n[t]}),e}"u"<typeof Promise||iy.Promise||(iy.Promise=Promise);let iA=Object.getPrototypeOf,iw={}.hasOwnProperty;function ik(e,n){return iw.call(e,n)}function ix(e,n){"function"==typeof n&&(n=n(iA(e))),("u"<typeof Reflect?i_:Reflect.ownKeys)(n).forEach(t=>{iE(e,t,n[t])})}let iC=Object.defineProperty;function iE(e,n,t,r){iC(e,n,i$(t&&ik(t,"get")&&"function"==typeof t.get?{get:t.get,set:t.set,configurable:!0}:{value:t,configurable:!0,writable:!0},r))}function iD(e){return{from:function(n){return e.prototype=Object.create(n.prototype),iE(e.prototype,"constructor",e),{extend:ix.bind(null,e.prototype)}}}}let iS=Object.getOwnPropertyDescriptor;function iM(e,n){let t;return iS(e,n)||(t=iA(e))&&iM(t,n)}let iz=[].slice;function iP(e,n,t){return iz.call(e,n,t)}function iO(e,n){return n(e)}function iT(e){if(!e)throw Error("Assertion Failed")}function iB(e){iy.setImmediate?setImmediate(e):setTimeout(e,0)}function iI(e,n){return e.reduce((e,t,r)=>{var o=n(t,r);return o&&(e[o[0]]=o[1]),e},{})}function iN(e,n){if("string"==typeof n&&ik(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=iN(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:iN(s,n.substr(a+1))}}function ij(e,n,t){if(e&&void 0!==n&&(!("isFrozen"in Object)||!Object.isFrozen(e)))if("string"!=typeof n&&"length"in n){iT("string"!=typeof t&&"length"in t);for(var r=0,o=n.length;r<o;++r)ij(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?iv(e)&&!isNaN(parseInt(a))?e.splice(a,1):delete e[a]:e[a]=t;else{var l=e[a];l&&ik(e,a)||(l=e[a]={}),ij(l,s,t)}}else void 0===t?iv(e)&&!isNaN(parseInt(n))?e.splice(n,1):delete e[n]:e[n]=t}}function iR(e){var n={};for(var t in e)ik(e,t)&&(n[t]=e[t]);return n}let iF=[].concat;function iL(e){return iF.apply([],e)}let iW="BigUint64Array,BigInt64Array,Array,Boolean,String,Date,RegExp,Blob,File,FileList,FileSystemFileHandle,FileSystemDirectoryHandle,ArrayBuffer,DataView,Uint8ClampedArray,ImageBitmap,ImageData,Map,Set,CryptoKey".split(",").concat(iL([8,16,32,64].map(e=>["Int","Uint","Float"].map(n=>n+e+"Array")))).filter(e=>iy[e]),iV=iW.map(e=>iy[e]);iI(iW,e=>[e,!0]);let iG=null;function iU(e){iG="u">typeof WeakMap&&new WeakMap;let n=function e(n){if(!n||"object"!=typeof n)return n;let t=iG&&iG.get(n);if(t)return t;if(iv(n)){t=[],iG&&iG.set(n,t);for(var r=0,o=n.length;r<o;++r)t.push(e(n[r]))}else if(iV.indexOf(n.constructor)>=0)t=n;else{let r=iA(n);for(var i in t=r===Object.prototype?{}:Object.create(r),iG&&iG.set(n,t),n)ik(n,i)&&(t[i]=e(n[i]))}return t}(e);return iG=null,n}let{toString:iq}={};function iH(e){return iq.call(e).slice(8,-1)}let iK="u">typeof Symbol?Symbol.iterator:"@@iterator",iY="symbol"==typeof iK?function(e){var n;return null!=e&&(n=e[iK])&&n.apply(e)}:function(){return null},iJ={};function iZ(e){var n,t,r,o;if(1==arguments.length){if(iv(e))return e.slice();if(this===iJ&&"string"==typeof e)return[e];if(o=iY(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 iX="u">typeof Symbol?e=>"AsyncFunction"===e[Symbol.toStringTag]:()=>!1;var iQ="u">typeof location&&/^(http|https):\/\/(localhost|127\.0\.0\.1)/.test(location.href),i0=()=>!0;let i1=!Error("").stack;function i2(){if(i1)try{throw i2.arguments,Error()}catch(e){return e}return Error()}function i3(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(i0).map(e=>"\n"+e).join("")):""}var i5=["Unknown","Constraint","Data","TransactionInactive","ReadOnly","Version","NotFound","InvalidState","InvalidAccess","Abort","Timeout","QuotaExceeded","Syntax","DataClone"],i4=["Modify","Bulk","OpenFailed","VersionChange","Schema","Upgrade","InvalidTable","MissingAPI","NoSuchDatabase","InvalidArgument","SubTransaction","Unsupported","Internal","DatabaseClosed","PrematureCommit","ForeignAwait"].concat(i5),i6={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 i8(e,n){this._e=i2(),this.name=e,this.message=n}function i7(e,n){return e+". Errors: "+Object.keys(n).map(e=>n[e].toString()).filter((e,n,t)=>t.indexOf(e)===n).join("\n")}function i9(e,n,t,r){this._e=i2(),this.failures=n,this.failedKeys=r,this.successCount=t,this.message=i7(e,n)}function ae(e,n){this._e=i2(),this.name="BulkError",this.failures=Object.keys(n).map(e=>n[e]),this.failuresByPos=n,this.message=i7(e,n)}iD(i8).from(Error).extend({stack:{get:function(){return this._stack||(this._stack=this.name+": "+this.message+i3(this._e,2))}},toString:function(){return this.name+": "+this.message}}),iD(i9).from(i8),iD(ae).from(i8);var an=i4.reduce((e,n)=>(e[n]=n+"Error",e),{}),at=i4.reduce((e,n)=>{var t=n+"Error";function r(e,r){this._e=i2(),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=i6[n]||t,this.inner=null)}return iD(r).from(i8),e[n]=r,e},{});at.Syntax=SyntaxError,at.Type=TypeError,at.Range=RangeError;var ar=i5.reduce((e,n)=>(e[n+"Error"]=at[n],e),{}),ao=i4.reduce((e,n)=>(-1===["Syntax","Type","Range"].indexOf(n)&&(e[n+"Error"]=at[n]),e),{});function ai(){}function aa(e){return e}function as(e,n){return null==e||e===aa?n:function(t){return n(e(t))}}function al(e,n){return function(){e.apply(this,arguments),n.apply(this,arguments)}}function ac(e,n){return e===ai?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?al(r,this.onsuccess):r),o&&(this.onerror=this.onerror?al(o,this.onerror):o),void 0!==i?i:t}}function au(e,n){return e===ai?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?al(t,this.onsuccess):t),r&&(this.onerror=this.onerror?al(r,this.onerror):r)}}function ap(e,n){return e===ai?n:function(t){var r=e.apply(this,arguments);i$(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?al(o,this.onsuccess):o),i&&(this.onerror=this.onerror?al(i,this.onerror):i),void 0===r?void 0===a?void 0:a:i$(r,a)}}function ad(e,n){return e===ai?n:function(){return!1!==n.apply(this,arguments)&&e.apply(this,arguments)}}function af(e,n){return e===ai?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)}}ao.ModifyError=i9,ao.DexieError=i8,ao.BulkError=ae;var ah={};let[am,ag,ab]="u"<typeof Promise?[]:(()=>{let e=Promise.resolve();if("u"<typeof crypto||!crypto.subtle)return[e,iA(e),e];let n=crypto.subtle.digest("SHA-512",new Uint8Array([0]));return[n,iA(n),e]})(),ay=ag&&ag.then,a_=am&&am.constructor,av=!!ab;var a$=!1,aA=ab?()=>{ab.then(aV)}:iy.setImmediate?setImmediate.bind(null,aV):iy.MutationObserver?()=>{var e=document.createElement("div");new MutationObserver(()=>{aV(),e=null}).observe(e,{attributes:!0}),e.setAttribute("i","1")}:()=>{setTimeout(aV,0)},aw=function(e,n){aP.push([e,n]),ax&&(aA(),ax=!1)},ak=!0,ax=!0,aC=[],aE=[],aD=null,aS=aa,aM={id:"global",global:!0,ref:0,unhandleds:[],onunhandled:sr,pgp:!1,env:{},finalize:function(){this.unhandleds.forEach(e=>{try{sr(e[0],e[1])}catch(e){}})}},az=aM,aP=[],aO=0,aT=[];function aB(e){if("object"!=typeof this)throw TypeError("Promises must be constructed via new");this._listeners=[],this.onuncatched=ai,this._lib=!1;var n=this._PSD=az;if(iQ&&(this._stackHolder=i2(),this._prev=null,this._numPrev=0),"function"!=typeof e){if(e!==ah)throw TypeError("Not a function");return this._state=arguments[1],this._value=arguments[2],void(!1===this._state&&aj(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&&aG();t&&"function"==typeof t.then?e(n,(e,n)=>{t instanceof aB?t._then(e,n):t.then(e,n)}):(n._state=!0,n._value=t,aR(n)),r&&aU()}},aj.bind(null,n))}catch(e){aj(n,e)}}(this,e)}let aI={get:function(){var e=az,n=aQ;function t(t,r){var o=!e.global&&(e!==az||n!==aQ);let i=o&&!a3();var a=new aB((n,a)=>{aF(this,new aN(se(t,e,o,i),se(r,e,o,i),n,a,e))});return iQ&&aW(a,this),a}return t.prototype=ah,t},set:function(e){iE(this,"then",e&&e.prototype===ah?aI:{get:function(){return e},set:aI.set})}};function aN(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 aj(e,n){if(aE.push(n),null===e._state){var t=e._lib&&aG();n=aS(n),e._state=!1,e._value=n,iQ&&null!==n&&"object"==typeof n&&!n._promise&&function(e){try{e.apply(null,void 0)}catch(e){}}(()=>{var t=iM(n,"stack");n._promise=e,iE(n,"stack",{get:()=>a$?t&&(t.get?t.get.apply(n):t.value):e.stack})}),aC.some(n=>n._value===e._value)||aC.push(e),aR(e),t&&aU()}}function aR(e){var n=e._listeners;e._listeners=[];for(var t=0,r=n.length;t<r;++t)aF(e,n[t]);var o=e._PSD;--o.ref||o.finalize(),0===aO&&(++aO,aw(()=>{0==--aO&&aq()},[]))}function aF(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,++aO,aw(aL,[t,e,n])}else e._listeners.push(n)}function aL(e,n,t){try{aD=n;var r,o=n._value;n._state?r=e(o):(aE.length&&(aE=[]),r=e(o),-1===aE.indexOf(o)&&function(e){for(var n=aC.length;n;)if(aC[--n]._value===e._value)return void aC.splice(n,1)}(n)),t.resolve(r)}catch(e){t.reject(e)}finally{aD=null,0==--aO&&aq(),--t.psd.ref||t.psd.finalize()}}function aW(e,n){var t=n?n._numPrev+1:0;t<100&&(e._prev=n,e._numPrev=t)}function aV(){aG()&&aU()}function aG(){var e=ak;return ak=!1,ax=!1,e}function aU(){var e,n,t;do for(;aP.length>0;)for(e=aP,aP=[],t=e.length,n=0;n<t;++n){var r=e[n];r[0].apply(null,r[1])}while(aP.length>0);ak=!0,ax=!0}function aq(){var e=aC;aC=[],e.forEach(e=>{e._PSD.onunhandled.call(null,e._value,e)});for(var n=aT.slice(0),t=n.length;t;)n[--t]()}function aH(e){return new aB(ah,!1,e)}function aK(e,n){var t=az;return function(){var r=aG(),o=az;try{return a8(t,!0),e.apply(this,arguments)}catch(e){n&&n(e)}finally{a8(o,!1),r&&aU()}}}ix(aB.prototype,{then:aI,_then:function(e,n){aF(this,new aN(null,null,e,n,az))},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):aH(e)):this.then(null,e=>e&&e.name===n?t(e):aH(e))},finally:function(e){return this.then(n=>(e(),n),n=>(e(),aH(n)))},stack:{get:function(){if(this._stack)return this._stack;try{a$=!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=i3(s,0)):(i=s,a=""),t.push(i+(a?": "+a:"")+o)}return iQ&&((o=i3(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{a$=!1}}},timeout:function(e,n){return e<1/0?new aB((t,r)=>{var o=setTimeout(()=>r(new at.Timeout(n)),e);this.then(t,r).finally(clearTimeout.bind(null,o))}):this}}),"u">typeof Symbol&&Symbol.toStringTag&&iE(aB.prototype,Symbol.toStringTag,"Dexie.Promise"),aM.env=a7(),ix(aB,{all:function(){var e=iZ.apply(null,arguments).map(a5);return new aB(function(n,t){0===e.length&&n([]);var r=e.length;e.forEach((o,i)=>aB.resolve(o).then(t=>{e[i]=t,--r||n(e)},t))})},resolve:e=>{if(e instanceof aB)return e;if(e&&"function"==typeof e.then)return new aB((n,t)=>{e.then(n,t)});var n=new aB(ah,!0,e);return aW(n,aD),n},reject:aH,race:function(){var e=iZ.apply(null,arguments).map(a5);return new aB((n,t)=>{e.map(e=>aB.resolve(e).then(n,t))})},PSD:{get:()=>az,set:e=>az=e},totalEchoes:{get:()=>aQ},newPSD:a1,usePSD:a9,scheduler:{get:()=>aw,set:e=>{aw=e}},rejectionMapper:{get:()=>aS,set:e=>{aS=e}},follow:(e,n)=>new aB((t,r)=>a1((n,t)=>{var r=az;r.unhandleds=[],r.onunhandled=t,r.finalize=al(function(){var e;e=()=>{0===this.unhandleds.length?n():t(this.unhandleds[0])},aT.push(function n(){e(),aT.splice(aT.indexOf(n),1)}),++aO,aw(()=>{0==--aO&&aq()},[])},r.finalize),e()},n,t,r))}),a_&&(a_.allSettled&&iE(aB,"allSettled",function(){let e=iZ.apply(null,arguments).map(a5);return new aB(n=>{0===e.length&&n([]);let t=e.length,r=Array(t);e.forEach((e,o)=>aB.resolve(e).then(e=>r[o]={status:"fulfilled",value:e},e=>r[o]={status:"rejected",reason:e}).then(()=>--t||n(r)))})}),a_.any&&"u">typeof AggregateError&&iE(aB,"any",function(){let e=iZ.apply(null,arguments).map(a5);return new aB((n,t)=>{0===e.length&&t(AggregateError([]));let r=e.length,o=Array(r);e.forEach((e,i)=>aB.resolve(e).then(e=>n(e),e=>{o[i]=e,--r||t(AggregateError(o))}))})}));let aY={awaits:0,echoes:0,id:0};var aJ=0,aZ=[],aX=0,aQ=0,a0=0;function a1(e,n,t,r){var o=az,i=Object.create(o);i.parent=o,i.ref=0,i.global=!1,i.id=++a0;var a=aM.env;i.env=av?{Promise:aB,PromiseProp:{value:aB,configurable:!0,writable:!0},all:aB.all,race:aB.race,allSettled:aB.allSettled,any:aB.any,resolve:aB.resolve,reject:aB.reject,nthen:sn(a.nthen,i),gthen:sn(a.gthen,i)}:{},n&&i$(i,n),++o.ref,i.finalize=function(){--this.parent.ref||this.parent.finalize()};var s=a9(i,e,t,r);return 0===i.ref&&i.finalize(),s}function a2(){return aY.id||(aY.id=++aJ),++aY.awaits,aY.echoes+=100,aY.id}function a3(){return!!aY.awaits&&(0==--aY.awaits&&(aY.id=0),aY.echoes=100*aY.awaits,!0)}function a5(e){return aY.echoes&&e&&e.constructor===a_?(a2(),e.then(e=>(a3(),e),e=>(a3(),so(e)))):e}function a4(e){++aQ,aY.echoes&&0!=--aY.echoes||(aY.echoes=aY.id=0),aZ.push(az),a8(e,!0)}function a6(){var e=aZ[aZ.length-1];aZ.pop(),a8(e,!1)}function a8(e,n){var t,r=az;if((n?!aY.echoes||aX++&&e===az:!aX||--aX&&e===az)||(t=n?a4.bind(null,e):a6,ay.call(am,t)),e!==az&&(az=e,r===aM&&(aM.env=a7()),av)){var o=aM.env.Promise,i=e.env;ag.then=i.nthen,o.prototype.then=i.gthen,(r.global||e.global)&&(Object.defineProperty(iy,"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 a7(){var e=iy.Promise;return av?{Promise:e,PromiseProp:Object.getOwnPropertyDescriptor(iy,"Promise"),all:e.all,race:e.race,allSettled:e.allSettled,any:e.any,resolve:e.resolve,reject:e.reject,nthen:ag.then,gthen:e.prototype.then}:{}}function a9(e,n,t,r,o){var i=az;try{return a8(e,!0),n(t,r,o)}finally{a8(i,!1)}}function se(e,n,t,r){return"function"!=typeof e?e:function(){var o,i=az;t&&a2(),a8(n,!0);try{return e.apply(this,arguments)}finally{a8(i,!1),r&&(o=a3,ay.call(am,o))}}}function sn(e,n){return function(t,r){return e.call(this,se(t,n),se(r,n))}}-1===(""+ay).indexOf("[native code]")&&(a2=a3=ai);let st="unhandledrejection";function sr(e,n){var t;try{t=n.onuncatched(e)}catch(e){}if(!1!==t)try{var r,o={promise:n,reason:e};if(iy.document&&document.createEvent?((r=document.createEvent("Event")).initEvent(st,!0,!0),i$(r,o)):iy.CustomEvent&&i$(r=new CustomEvent(st,{detail:o}),o),r&&iy.dispatchEvent&&(dispatchEvent(r),!iy.PromiseRejectionEvent&&iy.onunhandledrejection))try{iy.onunhandledrejection(r)}catch(e){}iQ&&r&&!r.defaultPrevented&&console.warn(`Unhandled rejection: ${e.stack||e}`)}catch(e){}}var so=aB.reject;let si="3.2.7",sa=String.fromCharCode(65535),ss=-1/0,sl="Invalid key provided. Keys must be of type string, number, Date or Array<string | number | Date>.",sc="String expected.",su=[],sp="u">typeof navigator&&/(MSIE|Trident|Edge)/.test(navigator.userAgent),sd=e=>!/(dexie\.js|dexie\.min\.js)/.test(e),sf="__dbnames",sh="readonly",sm="readwrite";function sg(e,n){return e?n?function(){return e.apply(this,arguments)&&n.apply(this,arguments)}:e:n}let sb={type:3,lower:-1/0,lowerOpen:!1,upper:[[]],upperOpen:!1};function sy(e){return"string"!=typeof e||/\./.test(e)?e=>e:n=>(void 0===n[e]&&e in n&&delete(n=iU(n))[e],n)}class s_{_trans(e,n,t){let r=this._tx||az.trans,o=this.name;function i(e,t,r){if(!r.schema[o])throw new at.NotFound("Table "+o+" not part of transaction");return n(r.idbtrans,r)}let a=aG();try{return r&&r.db===this.db?r===az.trans?r._promise(e,i,t):a1(()=>r._promise(e,i,t),{trans:r,transless:az.transless||az}):function e(n,t,r,o){if(n.idbdb&&(n._state.openComplete||az.letThrough||n._vip)){var i=n._createTransaction(t,r,n._dbSchema);try{i.create(),n._state.PR1398_maxLoop=3}catch(i){return i.name===an.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))):so(i)}return i._promise(t,(e,n)=>a1(()=>(az.trans=i,o(e,n,i)))).then(e=>i._completion.then(()=>e))}if(n._state.openComplete)return so(new at.DatabaseClosed(n._state.dbOpenError));if(!n._state.isBeingOpened){if(!n._options.autoOpen)return so(new at.DatabaseClosed);n.open().catch(ai)}return n._state.dbReadyPromise.then(()=>e(n,t,r,o))}(this.db,e,[this.name],i)}finally{a&&aU()}}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(iv(e))return new this.db.WhereClause(this,`[${e.join("+")}]`);let n=i_(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!==sa){let r=t.keyPath.slice(0,n.length);return this.where(r).equals(r.map(n=>e[n]))}!t&&iQ&&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?sg(t,a&&a.multi?e=>{let n=iN(e,o);return iv(n)&&n.some(e=>i(s,e))}:e=>i(s,iN(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,iv(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(ik(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){i$(this,e)})}add(e,n){let{auto:t,keyPath:r}=this.schema.primKey,o=e;return r&&t&&(o=sy(r)(e)),this._trans("readwrite",e=>this.core.mutate({trans:e,type:"add",keys:null!=n?[n]:null,values:[o]})).then(e=>e.numFailures?aB.reject(e.failures[0]):e.lastResult).then(n=>{if(r)try{ij(e,r,n)}catch(e){}return n})}update(e,n){if("object"!=typeof e||iv(e))return this.where(":id").equals(e).modify(n);{let t=iN(e,this.schema.primKey.keyPath);if(void 0===t)return so(new at.InvalidArgument("Given object does not contain its primary key"));try{"function"!=typeof n?i_(n).forEach(t=>{ij(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=sy(r)(e)),this._trans("readwrite",e=>this.core.mutate({trans:e,type:"put",values:[o],keys:null!=n?[n]:null})).then(e=>e.numFailures?aB.reject(e.failures[0]):e.lastResult).then(n=>{if(r)try{ij(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?aB.reject(e.failures[0]):void 0)}clear(){return this._trans("readwrite",e=>this.core.mutate({trans:e,type:"deleteRange",range:sb})).then(e=>e.numFailures?aB.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 at.InvalidArgument("bulkAdd(): keys argument invalid on tables with inbound keys");if(r&&r.length!==e.length)throw new at.InvalidArgument("Arguments objects and keys must have the same length");let a=e.length,s=i&&t?e.map(sy(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 ae(`${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 at.InvalidArgument("bulkPut(): keys argument invalid on tables with inbound keys");if(r&&r.length!==e.length)throw new at.InvalidArgument("Arguments objects and keys must have the same length");let a=e.length,s=i&&t?e.map(sy(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 ae(`${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 ae(`${this.name}.bulkDelete(): ${e} of ${n} operations failed`,r)})}}function sv(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=ad),o||(o=ai);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}i_(e).forEach(function(n){var t=e[n];if(iv(t))i(n,e[n][0],e[n][1]);else{if("asap"!==t)throw new at.InvalidArgument("Invalid event config");var r=i(n,aa,function(){for(var e=arguments.length,n=Array(e);e--;)n[e]=arguments[e];r.subscribers.forEach(function(e){iB(function(){e.apply(null,n)})})})}})}}function s$(e,n){return iD(n).from({prototype:e}),n}function sA(e,n){return!(e.filter||e.algorithm||e.or)&&(n?e.justLimit:!e.replayFilter)}function sw(e,n){e.filter=sg(e.filter,n)}function sk(e,n,t){var r=e.replayFilter;e.replayFilter=r?()=>sg(r(),n()):n,e.justLimit=t&&!r}function sx(e,n){if(e.isPrimKey)return n.primaryKey;let t=n.getIndexByKeyPath(e.index);if(!t)throw new at.Schema("KeyPath "+e.index+" on object store "+n.name+" is not indexed");return t}function sC(e,n,t){let r=sx(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 sE(e,n,t,r){let o=e.replayFilter?sg(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)),ik(i,s)||(i[s]=!0,n(e,t,r))}};return Promise.all([e.or._iterate(a,t),sD(sC(e,r,t),e.algorithm,a,!e.keysOnly&&e.valueMapper)])}return sD(sC(e,r,t),sg(e.algorithm,o),n,!e.keysOnly&&e.valueMapper)}function sD(e,n,t,r){var o=aK(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=ai},n=>{e.fail(n),t=ai})||o(e.value,e,e=>t=e),t()})})}function sS(e,n){try{let t=sM(e),r=sM(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}(sz(e),sz(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=sS(e[t],n[t]);if(0!==r)return r}return t===r?0:t<r?-1:1}(e,n)}}catch(e){}return NaN}function sM(e){let n=typeof e;if("object"!==n)return n;if(ArrayBuffer.isView(e))return"binary";let t=iH(e);return"ArrayBuffer"===t?"binary":t}function sz(e){return e instanceof Uint8Array?e:ArrayBuffer.isView(e)?new Uint8Array(e.buffer,e.byteOffset,e.byteLength):new Uint8Array(e)}class sP{_read(e,n){var t=this._ctx;return t.error?t.table._trans(null,so.bind(null,t.error)):t.table._trans("readonly",e).then(n)}_write(e){var n=this._ctx;return n.error?n.table._trans(null,so.bind(null,n.error)):n.table._trans("readwrite",e,"locked")}_addAlgorithm(e){var n=this._ctx;n.algorithm=sg(n.algorithm,e)}_iterate(e,n){return sE(this._ctx,e,n,this._ctx.table.core)}clone(e){var n=Object.create(this.constructor.prototype),t=Object.create(this._ctx);return e&&i$(t,e),n._ctx=t,n}raw(){return this._ctx.valueMapper=null,this}each(e){var n=this._ctx;return this._read(t=>sE(n,e,t,n.table.core))}count(e){return this._read(e=>{let n=this._ctx,t=n.table.core;if(sA(n,!0))return t.count({trans:e,query:{index:sx(n,t.schema),range:n.range}}).then(e=>Math.min(e,n.limit));var r=0;return sE(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&&sA(n,!0)&&n.limit>0){let{valueMapper:t}=n,r=sx(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 sE(n,e=>t.push(e),e,n.table.core).then(()=>t)}},e)}offset(e){var n=this._ctx;return e<=0||(n.offset+=e,sA(n)?sk(n,()=>{var n=e;return(e,t)=>0===n||(1===n?--n:t(()=>{e.advance(n),n=0}),!1)}):sk(n,()=>{var n=e;return()=>--n<0})),this}limit(e){return this._ctx.limit=Math.min(this._ctx.limit,e),sk(this._ctx,()=>{var n=e;return function(e,t,r){return--n<=0&&t(r),n>=0}},!0),this}until(e,n){return sw(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 sw(this._ctx,function(n){return e(n.value)}),(n=this._ctx).isMatch=sg(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&&sA(n,!0)&&n.limit>0)return this._read(e=>{var t=sx(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 sw(this._ctx,function(e){var n=e.primaryKey.toString(),r=ik(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=i_(e),i=o.length;r=function(n){for(var t=!1,r=0;r<i;++r){var a=o[r],s=e[a];iN(n,a)!==s&&(ij(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,i_(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:iU(n),primKey:o[u+e]};!1!==r.call(t,t.value,t)&&(null==t.value?b.push(o[u+e]):s||0===sS(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=sA(n)&&n.limit===1/0&&("function"!=typeof e||e===sO)&&{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===sO)&&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 i9("Error modifying one or more objects",u,p,d);return o.length})})})}delete(){var e=this._ctx,n=e.range;return sA(e)&&(e.isPrimKey&&!sp||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 i9("Could not delete some values",Object.keys(e).map(n=>e[n]),r-o);return r-o}))}):this.modify(sO)}}let sO=(e,n)=>n.value=null;function sT(e,n){return e<n?-1:+(e!==n)}function sB(e,n){return e>n?-1:+(e!==n)}function sI(e,n,t){var r=e instanceof sL?new e.Collection(e):e;return r._ctx.error=t?new t(n):TypeError(n),r}function sN(e){return new e.Collection(e,()=>sF("")).limit(0)}function sj(e,n,t,r){var o,i,a,s,l,c,u,p=t.length;if(!t.every(e=>"string"==typeof e))return sI(e,sc);function d(e){o="next"===e?e=>e.toUpperCase():e=>e.toLowerCase(),i="next"===e?e=>e.toLowerCase():e=>e.toUpperCase(),a="next"===e?sT:sB;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,()=>sR(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 sR(e,n,t,r){return{type:2,lower:e,upper:n,lowerOpen:t,upperOpen:r}}function sF(e){return{type:1,lower:e,upper:e}}class sL{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)?sN(this):new this.Collection(this,()=>sR(e,n,!t,!r))}catch(e){return sI(this,sl)}}equals(e){return null==e?sI(this,sl):new this.Collection(this,()=>sF(e))}above(e){return null==e?sI(this,sl):new this.Collection(this,()=>sR(e,void 0,!0))}aboveOrEqual(e){return null==e?sI(this,sl):new this.Collection(this,()=>sR(e,void 0,!1))}below(e){return null==e?sI(this,sl):new this.Collection(this,()=>sR(void 0,e,!1,!0))}belowOrEqual(e){return null==e?sI(this,sl):new this.Collection(this,()=>sR(void 0,e))}startsWith(e){return"string"!=typeof e?sI(this,sc):this.between(e,e+sa,!0,!0)}startsWithIgnoreCase(e){return""===e?this.startsWith(e):sj(this,(e,n)=>0===e.indexOf(n[0]),[e],sa)}equalsIgnoreCase(e){return sj(this,(e,n)=>e===n[0],[e],"")}anyOfIgnoreCase(){var e=iZ.apply(iJ,arguments);return 0===e.length?sN(this):sj(this,(e,n)=>-1!==n.indexOf(e),e,"")}startsWithAnyOfIgnoreCase(){var e=iZ.apply(iJ,arguments);return 0===e.length?sN(this):sj(this,(e,n)=>n.some(n=>0===e.indexOf(n)),e,sa)}anyOf(){let e=iZ.apply(iJ,arguments),n=this._cmp;try{e.sort(n)}catch(e){return sI(this,sl)}if(0===e.length)return sN(this);let t=new this.Collection(this,()=>sR(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([[ss,e],[e,this.db._maxKey]],{includeLowers:!1,includeUppers:!1})}noneOf(){let e=iZ.apply(iJ,arguments);if(0===e.length)return new this.Collection(this);try{e.sort(this._ascending)}catch(e){return sI(this,sl)}let n=e.reduce((e,n)=>e?e.concat([[e[e.length-1][1],n]]):[[ss,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 sN(this);if(!e.every(e=>void 0!==e[0]&&void 0!==e[1]&&0>=r(e[0],e[1])))return sI(this,"First argument to inAnyRange() must be an Array of two-value Arrays [lower,upper] where upper must not be lower than lower",at.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 sI(this,sl)}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,()=>sR(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=iZ.apply(iJ,arguments);return e.every(e=>"string"==typeof e)?0===e.length?sN(this):this.inAnyRange(e.map(e=>[e,e+sa])):sI(this,"startsWithAnyOf() only works with strings")}}function sW(e){return aK(function(n){return sV(n),e(n.target.error),!1})}function sV(e){e.stopPropagation&&e.stopPropagation(),e.preventDefault&&e.preventDefault()}let sG="storagemutated",sU="x-storagemutated-1",sq=sv(null,sG);class sH{_lock(){return iT(!az.global),++this._reculock,1!==this._reculock||az.global||(az.lockOwnerFor=this),this}_unlock(){if(iT(!az.global),0==--this._reculock)for(az.global||(az.lockOwnerFor=null);this._blockedFuncs.length>0&&!this._locked();){var e=this._blockedFuncs.shift();try{a9(e[1],e[0])}catch(e){}}return this}_locked(){return this._reculock&&az.lockOwnerFor!==this}create(e){if(!this.mode)return this;let n=this.db.idbdb,t=this.db._state.dbOpenError;if(iT(!this.idbtrans),!e&&!n)switch(t&&t.name){case"DatabaseClosedError":throw new at.DatabaseClosed(t);case"MissingAPIError":throw new at.MissingAPI(t.message,t);default:throw new at.OpenFailed(t)}if(!this.active)throw new at.TransactionInactive;return iT(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=aK(n=>{sV(n),this._reject(e.error)}),e.onabort=aK(n=>{sV(n),this.active&&this._reject(new at.Abort(e.error)),this.active=!1,this.on("abort").fire(n)}),e.oncomplete=aK(()=>{this.active=!1,this._resolve(),"mutatedParts"in e&&sq.storagemutated.fire(e.mutatedParts)}),this}_promise(e,n,t){if("readwrite"===e&&"readwrite"!==this.mode)return so(new at.ReadOnly("Transaction is readonly"));if(!this.active)return so(new at.TransactionInactive);if(this._locked())return new aB((r,o)=>{this._blockedFuncs.push([()=>{this._promise(e,n,t).then(r,o)},az])});if(t)return a1(()=>{var e=new aB((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 aB((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=aB.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 aB((e,r)=>{t.then(t=>n._waitingQueue.push(aK(e.bind(null,t))),e=>n._waitingQueue.push(aK(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 at.Abort))}table(e){let n=this._memoizedTables||(this._memoizedTables={});if(ik(n,e))return n[e];let t=this.schema[e];if(!t)throw new at.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 sK(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?"++":"")+sY(n)}}function sY(e){return"string"==typeof e?e:e?"["+[].join.call(e,"+")+"]":""}function sJ(e,n,t){return{name:e,primKey:n,indexes:t,mappedClass:null,idxByName:iI(t,e=>[e.name,e])}}let sZ=e=>{try{return e.only([[]]),sZ=()=>[[]],[[]]}catch(e){return sZ=()=>sa,sa}};function sX(e){return null==e?()=>{}:"string"==typeof e?1===e.split(".").length?n=>n[e]:n=>iN(n,e):n=>iN(n,e)}function sQ(e){return[].slice.call(e)}let s0=0;function s1(e){return null==e?":id":"string"==typeof e?e:`[${e.join("+")}]`}function s2({_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=sQ(e.objectStoreNames),{schema:{name:e.name,tables:r.map(e=>t.objectStore(e)).map(e=>{let{keyPath:n,autoIncrement:t}=e,r=iv(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:sX(n)},indexes:sQ(e.indexNames).map(n=>e.index(n)).map(e=>{let{name:n,unique:t,multiEntry:r,keyPath:o}=e,a={name:n,compound:iv(o),keyPath:o,unique:t,multiEntry:r,extractKey:sX(o)};return i[s1(o)]=a,a}),getIndexByKeyPath:e=>i[s1(e)]};return i[":id"]=a.primaryKey,null!=n&&(i[s1(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=aK(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,sV(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=aK(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=sW(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=aK(r);let i=e.objectStore(n).get(t);i.onsuccess=e=>r(e.target.result),i.onerror=sW(o)}),query:e=>new Promise((t,r)=>{t=aK(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=sW(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=sW(r)}}),openCursor:function({trans:e,values:t,query:r,reverse:i,unique:a}){return new Promise((s,l)=>{s=aK(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=sW(l),h.onsuccess=aK(n=>{let t=h.result;if(!t)return void s(null);t.___id=++s0,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=aK(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=aK(e),h.onerror=sW(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=aK(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=aK(n=>e(n.target.result)),u.onerror=sW(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:sZ(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 s3({_novip:e},n,t,r){t.forEach(t=>{let o=r[t];n.forEach(n=>{let r=iM(n,t);(!r||"value"in r&&void 0===r.value)&&(n===e.Transaction.prototype||n instanceof e.Transaction?iE(n,t,{get(){return this.table(t)},set(e){iC(this,t,{value:e,writable:!0,configurable:!0,enumerable:!0})}}):n[t]=new e.Table(t,o))})})}function s5({_novip:e},n){n.forEach(n=>{for(let t in n)n[t]instanceof e.Table&&delete n[t]})}function s4(e,n){return e._cfg.version-n._cfg.version}function s6(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||sp)){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 s8(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=>s7(o,e)),o}function s7(e,n){e.createIndex(n.name,n.keyPath,{unique:n.unique,multiEntry:n.multi})}function s9(e,n,t){let r={};return iP(n.objectStoreNames,0).forEach(e=>{let n=t.objectStore(e),o=n.keyPath,i=sK(sY(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=sK(t.name,o,!!t.unique,!!t.multiEntry,!1,o&&"string"!=typeof o,!1);a.push(s)}r[e]=sJ(e,i,a)}),r}function le({_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:"["+iP(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)&&iy.WorkerGlobalScope&&iy instanceof iy.WorkerGlobalScope&&[].concat(navigator.userAgent.match(/Safari\/(\d*)/))[1]<604&&(e._hasGetAll=!1)}class ln{_parseStoresSpec(e,n){i_(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 sK(t,r||null,/\&/.test(e),/\*/.test(e),/\+\+/.test(e),iv(r),0===n)}),o=r.shift();if(o.multi)throw new at.Schema("Primary key cannot be multi-valued");r.forEach(e=>{if(e.auto)throw new at.Schema("Only primary key can be marked as autoIncrement (++)");if(!e.keyPath)throw new at.Schema("Index must have a name and cannot be an empty string")}),n[t]=sJ(t,o,r)}})}stores(e){let n=this.db;this._cfg.storesSource=this._cfg.storesSource?i$(this._cfg.storesSource,e):e;let t=n._versions,r={},o={};return t.forEach(e=>{i$(r,e._cfg.storesSource),o=e._cfg.dbschema={},e._parseStoresSpec(r,o)}),n._dbSchema=o,s5(n,[n._allTables,n,n.Transaction.prototype]),s3(n,[n._allTables,n,n.Transaction.prototype,this._cfg.tables],i_(o),o),n._storeNames=i_(o),this}upgrade(e){return this._cfg.contentUpgrade=af(this._cfg.contentUpgrade||ai,e),this}}function lt(e,n){let t=e._dbNamesDB;return t||(t=e._dbNamesDB=new l$(sf,{addons:[],indexedDB:e,IDBKeyRange:n})).version(1).stores({dbnames:"name"}),t.table("dbnames")}function lr(e){return e&&"function"==typeof e.databases}function lo(e){return a1(function(){return az.letThrough=!0,e()})}function li(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):iv(i)?Promise.all(i).then(t,r):t(i)}}return o(n)()}function la(e,n,t){var r=arguments.length;if(r<2)throw new at.InvalidArgument("Too few arguments");for(var o=Array(r-1);--r;)o[r-1]=arguments[r];return t=o.pop(),[e,iL(o),t]}function ls(e,n,t){let r=iv(e)?e.slice():[e];for(let e=0;e<t;++e)r.push(n);return r}let ll={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=s1(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:sX(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:ls(t.lower,t.lowerOpen?e.MAX_KEY:e.MIN_KEY,r),lowerOpen:!0,upper:ls(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[s1(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(ls(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(ls(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 lc(e,n,t,r){return t=t||{},r=r||"",i_(e).forEach(o=>{if(ik(n,o)){var i=e[o],a=n[o];if("object"==typeof i&&"object"==typeof a&&i&&a){let e=iH(i);e!==iH(a)?t[r+o]=n[o]:"Object"===e?lc(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}),i_(n).forEach(o=>{ik(e,o)||(t[r+o]=n[o])}),t}let lu={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=az.trans,{deleting:i,creating:a,updating:s}=o.table(n).hook;switch(e.type){case"add":if(a.fire===ai)break;return o._promise("readwrite",()=>l(e),!0);case"put":if(a.fire===ai&&s.fire===ai)break;return o._promise("readwrite",()=>l(e),!0);case"delete":if(i.fire===ai)break;return o._promise("readwrite",()=>l(e),!0);case"deleteRange":if(i.fire===ai)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=az.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||ij(e.values[o],r.keyPath,t))}else{let n=lc(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=>{ik(n,e)?n[e]=r[e]:ij(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 lp(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===sS(n.keys[o],e[i])&&(r.push(t?iU(n.values[o]):n.values[o]),++i);return r.length===e.length?r:null}catch(e){return null}}let ld={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=lp(e.keys,e.trans._cache,"clone"===e.cache);return n?aB.resolve(n):t.getMany(e).then(n=>(e.trans._cache={keys:e.keys,values:"clone"===e.cache?iU(n):n},n))},mutate:e=>("add"!==e.type&&(e.trans._cache=null),t.mutate(e))}}})};function lf(e){return!("from"in e)}let lh=function(e,n){if(!this){let n=new lh;return e&&"d"in e&&i$(n,e),n}i$(this,arguments.length?{d:1,from:e,to:arguments.length>1?n:e}:{d:0})};function lm(e,n,t){let r=sS(n,t);if(isNaN(r))return;if(r>0)throw RangeError();if(lf(e))return i$(e,{from:n,to:t,d:1});let o=e.l,i=e.r;if(0>sS(t,e.from))return o?lm(o,n,t):e.l={from:n,to:t,d:1,l:null,r:null},ly(e);if(sS(n,e.to)>0)return i?lm(i,n,t):e.r={from:n,to:t,d:1,l:null,r:null},ly(e);0>sS(n,e.from)&&(e.from=n,e.l=null,e.d=i?i.d+1:1),sS(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&&lg(e,o),i&&a&&lg(e,i)}function lg(e,n){lf(n)||function e(n,{from:t,to:r,l:o,r:i}){lm(n,t,r),o&&e(n,o),i&&e(n,i)}(e,n)}function lb(e){let n=lf(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>sS(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>=sS(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 ly(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=l_(t)}e.d=l_(e)}function l_({r:e,l:n}){return(e?n?Math.max(e.d,n.d):e.d:n?n.d:0)+1}ix(lh.prototype,{add(e){return lg(this,e),this},addKey(e){return lm(this,e,e),this},addKeys(e){return e.forEach(e=>lm(this,e,e)),this},[iK](){return lb(this)}});let lv={stack:"dbcore",level:0,create:e=>{let n=e.schema.name,t=new lh(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 lh)},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(iv(d)){"delete"!==p&&(d=e.results),c.addKeys(d);let n=lp(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&&iv(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!==sS(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 lh(null!=(r=t.lower)?r:e.MIN_KEY,null!=(o=t.upper)?o:e.MAX_KEY)]},p={get:e=>[a,new lh(e.key)],getMany:e=>[a,(new lh).addKeys(e.keys)],count:u,query:u,openCursor:u};return i_(p).forEach(e=>{c[e]=function(i){let{subscr:a}=az;if(a){let c=e=>{let t=`idb://${n}/${r}/${e}`;return a[t]||(a[t]=new lh)},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 l${constructor(e,n){var t;this._middlewares={},this.verno=0;const r=l$.dependencies;this._options=n={addons:l$.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:ai,dbReadyPromise:null,cancelOpen:ai,openCanceller:null,autoSchema:!0,PR1398_maxLoop:3};i.dbReadyPromise=new aB(e=>{i.dbReadyResolve=e}),i.openCanceller=new aB((e,n)=>{i.cancelOpen=n}),this._state=i,this.name=e,this.on=sv(this,"populate","blocked","versionchange","close",{ready:[af,ai]}),this.on.ready.subscribe=iO(this.on.ready.subscribe,e=>(n,t)=>{l$.vip(()=>{let r=this._state;if(r.openComplete)r.dbOpenError||aB.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,s$(sP.prototype,function(e,n){this.db=t;let r=sb,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!==aa?s:null}})),this.Table=function(e){return s$(s_.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:sv(null,{creating:[ac,ai],reading:[as,aa],updating:[ap,ai],deleting:[au,ai]})})}(this),this.Transaction=function(e){return s$(sH.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=sv(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 aB((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(),so(e)})})}(this),this.Version=function(e){return s$(ln.prototype,function(n){this.db=e,this._cfg={version:n,storesSource:null,dbschema:{},tables:{},contentUpgrade:null}})}(this),this.WhereClause=function(e){return s$(sL.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 at.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=sZ(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),su.filter(e=>e.name===this.name&&e!==this&&!e._state.vcFired).map(n=>n.on("versionchange").fire(e))},this.use(ll),this.use(lu),this.use(lv),this.use(ld),this.vip=Object.create(this,{_vip:{value:!0}}),o.forEach(e=>e(this))}version(e){if(isNaN(e)||e<.1)throw new at.Type("Given version is not a positive number");if(e=Math.round(10*e)/10,this.idbdb||this._state.isBeingOpened)throw new at.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(s4),t.stores({}),this._state.autoSchema=!1,t)}_whenReady(e){return this.idbdb&&(this._state.openComplete||az.letThrough||this._vip)?e():new aB((e,n)=>{if(this._state.openComplete)return n(new at.DatabaseClosed(this._state.dbOpenError));if(!this._state.isBeingOpened){if(!this._options.autoOpen)return void n(new at.DatabaseClosed);this.open().catch(ai)}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?so(t.dbOpenError):e);iQ&&(t.openCanceller._stackHolder=i2()),t.isBeingOpened=!0,t.dbOpenError=null,t.openComplete=!1;let o=t.openCanceller;function i(){if(t.openCanceller!==o)throw new at.DatabaseClosed("db.open() was cancelled")}let a=t.dbReadyResolve,s=null,l=!1,c=()=>new aB((n,o)=>{if(i(),!r)throw new at.MissingAPI;let a=e.name,c=t.autoSchema?r.open(a):r.open(a,Math.round(10*e.verno));if(!c)throw new at.MissingAPI;c.onerror=sW(o),c.onblocked=aK(e._fireOnBlocked),c.onupgradeneeded=aK(n=>{if(s=c.transaction,t.autoSchema&&!e._options.allowEmptyDB){c.onerror=sV,s.abort(),c.result.close();let e=r.deleteDatabase(a);e.onsuccess=e.onerror=aK(()=>{o(new at.NoSuchDatabase(`Database ${a} doesnt exist`))})}else{let t,r,a,d;s.onerror=sW(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=az.transless||az,a1(()=>{az.trans=r,az.transless=d,0===i?(i_(t).forEach(e=>{s8(u,e,t[e].primKey,t[e].indexes)}),s2(e,u),aB.follow(()=>e.on.populate.fire(r)).catch(a)):(function({_novip:e},n,t,r){let o=[],i=e._versions,a=e._dbSchema=s9(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;le(e,o,r),le(e,l,r),a=e._dbSchema=l;let c=s6(o,l);c.add.forEach(e=>{s8(r,e[0],e[1].primKey,e[1].indexes)}),c.change.forEach(e=>{if(e.recreate)throw new at.Upgrade("Not yet support for changing primary key");{let n=r.objectStore(e.name);e.add.forEach(e=>s7(n,e)),e.change.forEach(e=>{n.deleteIndex(e.name),s7(n,e)}),e.del.forEach(e=>n.deleteIndex(e))}});let u=i._cfg.contentUpgrade;if(u&&i._cfg.version>n){let n;s2(e,r),t._memoizedTables={},s=!0;let i=iR(l);c.del.forEach(e=>{i[e]=o[e]}),s5(e,[e.Transaction.prototype]),s3(e,[e.Transaction.prototype],i_(i),i),t.schema=i;let a=iX(u);a&&a2();let p=aB.follow(()=>{if((n=u(t))&&a){var e=a3.bind(null,null);n.then(e,e)}});return n&&"function"==typeof n.then?aB.resolve(n):p.then(()=>n)}}),o.push(n=>{var r;s&&sp||(r=i._cfg.dbschema,[].slice.call(n.db.objectStoreNames).forEach(e=>null==r[e]&&n.db.deleteObjectStore(e))),s5(e,[e.Transaction.prototype]),s3(e,[e.Transaction.prototype],e._storeNames,e._dbSchema),t.schema=e._dbSchema})}),(function e(){return o.length?aB.resolve(o.shift()(t.idbtrans)).then(e):aB.resolve()})().then(()=>{var e;i_(e=a).forEach(n=>{r.db.objectStoreNames.contains(n)||s8(r,n,e[n].primKey,e[n].indexes)})})})(e,i,r,u).catch(a)})}},o),c.onsuccess=aK(()=>{s=null;let r=e._novip.idbdb=c.result,o=iP(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=s9(0,n,t);e._storeNames=iP(n.objectStoreNames,0),s3(e,[e._allTables],i_(r),r)}(e,r,i):(le(e,e._dbSchema,i),((n=s6(s9(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.")),s2(e,i)}catch(e){}su.push(e),r.onversionchange=aK(n=>{t.vcFired=!0,e.on("versionchange").fire(n)}),r.onclose=aK(n=>{e.on("close").fire(n)}),l&&function({indexedDB:e,IDBKeyRange:n},t){lr(e)||t===sf||lt(e,n).put({name:t}).catch(ai)}(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()):aB.reject(e));return aB.race([o,("u"<typeof navigator?aB.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=[],aB.resolve(lo(()=>e.on.ready.fire(e.vip))).then(function n(){if(t.onReadyBeingFired.length>0){let r=t.onReadyBeingFired.reduce(af,ai);return t.onReadyBeingFired=[],aB.resolve(lo(()=>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(),so(n)}).finally(()=>{t.openComplete=!0,a()})}(this)}_close(){let e=this._state,n=su.indexOf(this);if(n>=0&&su.splice(n,1),this.idbdb){try{this.idbdb.close()}catch(e){}this._novip.idbdb=null}e.dbReadyPromise=new aB(n=>{e.dbReadyResolve=n}),e.openCanceller=new aB((n,t)=>{e.cancelOpen=t})}close(){this._close();let e=this._state;this._options.autoOpen=!1,e.dbOpenError=new at.DatabaseClosed,e.isBeingOpened&&e.cancelOpen(e.dbOpenError)}delete(){let e=arguments.length>0,n=this._state;return new aB((t,r)=>{let o=()=>{this.close();var e=this._deps.indexedDB.deleteDatabase(this.name);e.onsuccess=aK(()=>{!function({indexedDB:e,IDBKeyRange:n},t){lr(e)||t===sf||lt(e,n).delete(t).catch(ai)}(this._deps,this.name),t()}),e.onerror=sW(r),e.onblocked=this._fireOnBlocked};if(e)throw new at.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 i_(this._allTables).map(e=>this._allTables[e])}transaction(){let e=la.apply(this,arguments);return this._transaction.apply(this,e)}_transaction(e,n,t){let r,o,i=az.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===sh)r=sh;else{if("rw"!=e&&e!=sm)throw new at.InvalidArgument("Invalid transaction mode: "+e);r=sm}if(i){if(i.mode===sh&&r===sm){if(!a)throw new at.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 at.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)}):so(e)}let s=(function e(n,t,r,o,i){return aB.resolve().then(()=>{let a,s=az.transless||az,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===an.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))):so(o)}let c=iX(i);c&&a2();let u=aB.follow(()=>{if(a=i.call(l,l))if(c){var e=a3.bind(null,null);a.then(e,e)}else"function"==typeof a.next&&"function"==typeof a.throw&&(a=li(a))},{trans:l,transless:s});return(a&&"function"==typeof a.then?aB.resolve(a).then(e=>l.active?e:so(new at.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),so(e)))})}).bind(null,this,r,o,i,t);return i?i._promise(r,s,"lock"):az.trans?a9(az.transless,()=>this._whenReady(s)):this._whenReady(s)}table(e){if(!ik(this._allTables,e))throw new at.InvalidTable(`Table ${e} does not exist`);return this._allTables[e]}}let lA="u">typeof Symbol&&"observable"in Symbol?Symbol.observable:"@@observable";class lw{constructor(e){this._subscribe=e}subscribe(e,n,t){return this._subscribe(e&&"function"!=typeof e?e:{next:e,error:n,complete:t})}[lA](){return this}}function lk(e,n){return i_(n).forEach(t=>{lg(e[t]||(e[t]=new lh),n[t])}),e}try{o={indexedDB:iy.indexedDB||iy.mozIndexedDB||iy.webkitIndexedDB||iy.msIndexedDB,IDBKeyRange:iy.IDBKeyRange||iy.webkitIDBKeyRange}}catch(e){o={indexedDB:null,IDBKeyRange:null}}function lx(e){let n=lC;try{lC=!0,sq.storagemutated.fire(e)}finally{lC=n}}ix(l$,{...ao,delete:e=>new l$(e,{addons:[]}).delete(),exists:e=>new l$(e,{addons:[]}).open().then(e=>(e.close(),!0)).catch("NoSuchDatabaseError",()=>!1),getDatabaseNames(e){try{return(function({indexedDB:e,IDBKeyRange:n}){return lr(e)?Promise.resolve(e.databases()).then(e=>e.map(e=>e.name).filter(e=>e!==sf)):lt(e,n).toCollection().primaryKeys()})(l$.dependencies).then(e)}catch(e){return so(new at.MissingAPI)}},defineClass:()=>function(e){i$(this,e)},ignoreTransaction:e=>az.trans?a9(az.transless,e):e(),vip:lo,async:function(e){return function(){try{var n=li(e.apply(this,arguments));return n&&"function"==typeof n.then?n:aB.resolve(n)}catch(e){return so(e)}}},spawn:function(e,n,t){try{var r=li(e.apply(t,n||[]));return r&&"function"==typeof r.then?r:aB.resolve(r)}catch(e){return so(e)}},currentTransaction:{get:()=>az.trans||null},waitFor:function(e,n){let t=aB.resolve("function"==typeof e?l$.ignoreTransaction(e):e).timeout(n||6e4);return az.trans?az.trans.waitFor(t):t},Promise:aB,debug:{get:()=>iQ,set:e=>{iQ=e,i0="dexie"===e?()=>!0:sd}},derive:iD,extend:i$,props:ix,override:iO,Events:sv,on:sq,liveQuery:function(e){let n,t=!1,r=new lw(r=>{let o=iX(e),i=!1,a={},s={},l={get closed(){return i},unsubscribe:()=>{i=!0,sq.storagemutated.unsubscribe(d)}};r.start&&r.start(l);let c=!1,u=!1;function p(){return i_(s).some(e=>a[e]&&function(e,n){let t=lb(n),r=t.next();if(r.done)return!1;let o=r.value,i=lb(e),a=i.next(o.from),s=a.value;for(;!r.done&&!a.done;){if(0>=sS(s.from,o.to)&&sS(s.to,o.from)>=0)return!0;0>sS(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=>{lk(a,e),p()&&f()},f=()=>{let h,m;if(c||i)return;a={};let g={},b=(o&&a2(),h=()=>a1(e,{subscr:g,trans:null}),m=az.trans?a9(az.transless,h):h(),o&&m.then(a3,a3),m);u||(sq(sG,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:lk,getByKeyPath:iN,setByKeyPath:ij,delByKeyPath:function(e,n){"string"==typeof n?ij(e,n,void 0):"length"in n&&[].map.call(n,function(n){ij(e,n,void 0)})},shallowClone:iR,deepClone:iU,getObjectDiff:lc,cmp:sS,asap:iB,minKey:ss,addons:[],connections:su,errnames:an,dependencies:o,semVer:si,version:si.split(".").map(e=>parseInt(e)).reduce((e,n,t)=>e+n/Math.pow(10,2*t))}),l$.maxKey=sZ(l$.dependencies.IDBKeyRange),"u">typeof dispatchEvent&&"u">typeof addEventListener&&(sq(sG,e=>{if(!lC){let n;sp?(n=document.createEvent("CustomEvent")).initCustomEvent(sU,!0,!0,e):n=new CustomEvent(sU,{detail:e}),lC=!0,dispatchEvent(n),lC=!1}}),addEventListener(sU,({detail:e})=>{lC||lx(e)}));let lC=!1;if("u">typeof BroadcastChannel){let e=new BroadcastChannel(sU);"function"==typeof e.unref&&e.unref(),sq(sG,n=>{lC||e.postMessage(n)}),e.onmessage=e=>{e.data&&lx(e.data)}}else if("u">typeof self&&"u">typeof navigator){sq(sG,e=>{try{lC||("u">typeof localStorage&&localStorage.setItem(sU,JSON.stringify({trig:Math.random(),changedParts:e})),"object"==typeof self.clients&&[...self.clients.matchAll({includeUncontrolled:!0})].forEach(n=>n.postMessage({type:sU,changedParts:e})))}catch(e){}}),"u">typeof addEventListener&&addEventListener("storage",e=>{if(e.key===sU){let n=JSON.parse(e.newValue);n&&lx(n.changedParts)}});let e=self.document&&navigator.serviceWorker;e&&e.addEventListener("message",function({data:e}){e&&e.type===sU&&lx(e.changedParts)})}function lE(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}aB.rejectionMapper=function(e,n){if(!e||e instanceof i8||e instanceof TypeError||e instanceof SyntaxError||!e.name||!ar[e.name])return e;var t=new ar[e.name](n||e.message,e);return"stack"in e&&iE(t,"stack",{get:function(){return this.inner.stack}}),t},i0=sd;class lD extends l${constructor(){super("EsmOffline"),lE(this,"syncQueue",void 0),lE(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 lS(){return new lD}let lM=new lD,lz={};async function lP(){let e=await r6();return e?.uuid||"*"}async function lO(e,n,t,r){let o=r&&r.id;return void 0!==o&&await lM.syncQueue.where({type:n,userId:e}).filter(e=>e?.descriptor.id===o).delete().catch(l$.errnames.DatabaseClosed),await lM.syncQueue.add({type:n,content:t,userId:e,descriptor:r||{},createdOn:new Date}).catch(l$.errnames.DatabaseClosed,()=>-1)}async function lT(e,n,t){let r=await lP();return await lO(r,e,n,t)}async function lB(e,n){return(await lI(e,n)).map(e=>e.content)}async function lI(e,n){return await lM.syncQueue.where(n?{type:n,userId:e}:{userId:e}).toArray().catch(l$.errnames.DatabaseClosed,()=>[])}async function lN(e){let n=await lP();return await lB(n,e)}async function lj(e){let n=await lP();return await lI(n,e)}async function lR(e){return await lM.syncQueue.get(e).catch(l$.errnames.DatabaseClosed,()=>void 0)}function lF(e){return!!lz[e]?.options.onBeginEditSyncItem}async function lL(e){let n=await lR(e);if(!n)throw Error(`No sync item with the ID ${e} exists.`);let t=lz[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 lW(e){await lM.syncQueue.delete(e).catch(l$.errnames.DatabaseClosed)}function lV(e,n,t,r={}){lz[e]={type:e,dependsOn:n,process:t,options:r}}L("offline-synchronization",{});let lG={};function lU(){return Object.values(lG)}function lq(e){lG[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.`),lG[e.id]=e}async function lH(e){let n=await l1();return await lK(n,e)}async function lK(e,n){let t=new lD;return await t.dynamicOfflineData.where(n?{type:n,users:e}:{users:e}).toArray().catch(l$.errnames.DatabaseClosed,()=>[])}async function lY(e,n){let t=await l1();return await lJ(t,e,n)}async function lJ(e,n,t){let r=new lD,o=await r.dynamicOfflineData.get({type:n,identifier:t}).catch(l$.errnames.DatabaseClosed,()=>void 0);o?o.users.includes(e)||await r.dynamicOfflineData.update(o.id,{users:[...o.users,e]}).catch(l$.errnames.DatabaseClosed):await r.dynamicOfflineData.add({users:[e],type:n,identifier:t}).catch(l$.errnames.DatabaseClosed)}async function lZ(e,n){let t=await l1();return await lX(t,e,n)}async function lX(e,n,t){let r=new lD,o=await r.dynamicOfflineData.get({type:n,identifier:t,users:e}).catch(l$.errnames.DatabaseClosed,()=>void 0);o&&(o.users.length>1?await r.dynamicOfflineData.update(o.id,{users:o.users.filter(n=>n!==e)}).catch(l$.errnames.DatabaseClosed):await r.dynamicOfflineData.delete(o.id).catch(l$.errnames.DatabaseClosed))}async function lQ(e,n){let t=await lH(e);await Promise.all(t.map(async e=>l0(e.type,e.identifier,n)))}async function l0(e,n,t){await lY(e,n);let r=new lD,o=await l1(),i=await r.dynamicOfflineData.get({type:e,identifier:n}).catch(l$.errnames.DatabaseClosed,()=>void 0),a=lU().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(l$.errnames.DatabaseClosed)}async function l1(){let e=(await r6()).uuid;if(!e)throw Error("Using the dynamic offline data API requires a logged in user.");return e}let l2=L("offline-patients",{offlinePatientDataSyncState:{},handlers:{}});function l3(){return l6(),l2}function l5(e,n){l6(),lq({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 l4(e){l6(),await l0("patient",e)}function l6(){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 l8(e,n,t=!0){if(e){let r=null,[o,i]=await Promise.all([rY(`${rq}/Patient/${e}`,n).catch(e=>r=e),t?l7(e):Promise.resolve(null)]);if(o.ok)return o.data;if(i)return i;if(r)throw r}return null}async function l7(e){let n=(await lN("patient-registration")).find(n=>n.fhirPatient.id===e);return n?.fhirPatient??null}function l9(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 ce=((Q={}).NEWVISIT="startVisit",Q.EDITVISIT="editVisit",Q.LOADING="loadingVisit",Q),cn=((ee={}).NOTSTARTED="notStarted",ee.ONGOING="ongoing",ee);let ct="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))",cr=function(){try{return JSON.parse(sessionStorage.getItem("openmrs:visitStoreState")||"null")}catch(e){return null}}()||{patientUuid:null,manuallySetVisitUuid:null,mutateVisitCallbacks:{}};function co(){return W("visit",cr)}function ci(e,n){co().setState({patientUuid:e,manuallySetVisitUuid:n})}function ca(e,n){return rY(`${rU}/visit`,{signal:n.signal,method:"POST",headers:{"Content-type":"application/json"},body:e})}function cs(e,n,t){return rY(`${rU}/visit/${e}`,{signal:t.signal,method:"POST",headers:{"Content-type":"application/json"},body:n})}function cl(e,n,t){return rY(`${rU}/visit?patient=${e}&v=${t??ct}`,{signal:n.signal,method:"GET",headers:{"Content-type":"application/json"}})}co().subscribe(e=>{var n;n=e,sessionStorage.setItem("openmrs:visitStoreState",JSON.stringify(n))});let cc=new er.BehaviorSubject(null);var cu=t(33789);function cp(e){return{uuid:e.uuid,display:e.display,name:e.name}}function cd(){return rJ(`${rU}/visittype`).pipe((0,cu.map)(e=>e.data.results.map(cp))).pipe((0,cu.take)(1))}function cf(e){return{uuid:e.uuid,display:e.display}}function ch(e=null,n=null){let t=new URLSearchParams;e&&t.set("tag",e),n&&t.set("q",n);let r=t.toString();return rJ(`${rU}/location${r?"?"+r:""}`).pipe((0,cu.map)(e=>e.data.results.map(cf))).pipe((0,cu.take)(1))}class cm{static get version(){return"1.4.0"}static toString(){return"JavaScript Expression Parser (JSEP) v"+cm.version}static addUnaryOp(e){return cm.max_unop_len=Math.max(e.length,cm.max_unop_len),cm.unary_ops[e]=1,cm}static addBinaryOp(e,n,t){return cm.max_binop_len=Math.max(e.length,cm.max_binop_len),cm.binary_ops[e]=n,t?cm.right_associative.add(e):cm.right_associative.delete(e),cm}static addIdentifierChar(e){return cm.additional_identifier_chars.add(e),cm}static addLiteral(e,n){return cm.literals[e]=n,cm}static removeUnaryOp(e){return delete cm.unary_ops[e],e.length===cm.max_unop_len&&(cm.max_unop_len=cm.getMaxKeyLen(cm.unary_ops)),cm}static removeAllUnaryOps(){return cm.unary_ops={},cm.max_unop_len=0,cm}static removeIdentifierChar(e){return cm.additional_identifier_chars.delete(e),cm}static removeBinaryOp(e){return delete cm.binary_ops[e],e.length===cm.max_binop_len&&(cm.max_binop_len=cm.getMaxKeyLen(cm.binary_ops)),cm.right_associative.delete(e),cm}static removeAllBinaryOps(){return cm.binary_ops={},cm.max_binop_len=0,cm}static removeLiteral(e){return delete cm.literals[e],cm}static removeAllLiterals(){return cm.literals={},cm}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 cm(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 cm.binary_ops[e]||0}static isIdentifierStart(e){return e>=65&&e<=90||e>=97&&e<=122||e>=128&&!cm.binary_ops[String.fromCharCode(e)]||cm.additional_identifier_chars.has(String.fromCharCode(e))}static isIdentifierPart(e){return cm.isIdentifierStart(e)||cm.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(cm.hooks[e]){let t={context:this,node:n};return cm.hooks.run(e,t),t.node}return n}searchHook(e){if(cm.hooks[e]){let n={context:this};return cm.hooks[e].find(function(e){return e.call(n.context,n),n.node}),n.node}}gobbleSpaces(){let e=this.code;for(;e===cm.SPACE_CODE||e===cm.TAB_CODE||e===cm.LF_CODE||e===cm.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:cm.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)===cm.SEMCOL_CODE||t===cm.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,cm.max_binop_len),n=e.length;for(;n>0;){if(cm.binary_ops.hasOwnProperty(e)&&(!cm.isIdentifierStart(this.code)||this.index+e.length<this.expr.length&&!cm.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:cm.binaryPrecedence(n),right_a:cm.right_associative.has(n)},(a=this.gobbleToken())||this.throwError("Expected expression after "+n),r=[i,o,a];n=this.gobbleBinaryOp();){if(0===(t=cm.binaryPrecedence(n))){this.index-=n.length;break}o={value:n,prec:t,right_a:cm.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:cm.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:cm.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,cm.isDecimalDigit(e)||e===cm.PERIOD_CODE)return this.gobbleNumericLiteral();if(e===cm.SQUOTE_CODE||e===cm.DQUOTE_CODE)r=this.gobbleStringLiteral();else if(e===cm.OBRACK_CODE)r=this.gobbleArray();else{for(t=(n=this.expr.substr(this.index,cm.max_unop_len)).length;t>0;){if(cm.unary_ops.hasOwnProperty(n)&&(!cm.isIdentifierStart(this.code)||this.index+n.length<this.expr.length&&!cm.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:cm.UNARY_EXP,operator:n,argument:e,prefix:!0})}n=n.substr(0,--t)}cm.isIdentifierStart(e)?(r=this.gobbleIdentifier(),cm.literals.hasOwnProperty(r.name)?r={type:cm.LITERAL,value:cm.literals[r.name],raw:r.name}:r.name===cm.this_str&&(r={type:cm.THIS_EXP})):e===cm.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===cm.PERIOD_CODE||n===cm.OBRACK_CODE||n===cm.OPAREN_CODE||n===cm.QUMARK_CODE;){let t;if(n===cm.QUMARK_CODE){if(this.expr.charCodeAt(this.index+1)!==cm.PERIOD_CODE)break;t=!0,this.index+=2,this.gobbleSpaces(),n=this.code}this.index++,n===cm.OBRACK_CODE?((e={type:cm.MEMBER_EXP,computed:!0,object:e,property:this.gobbleExpression()}).property||this.throwError('Unexpected "'+this.char+'"'),this.gobbleSpaces(),(n=this.code)!==cm.CBRACK_CODE&&this.throwError("Unclosed ["),this.index++):n===cm.OPAREN_CODE?e={type:cm.CALL_EXP,arguments:this.gobbleArguments(cm.CPAREN_CODE),callee:e}:(n===cm.PERIOD_CODE||t)&&(t&&this.index--,this.gobbleSpaces(),e={type:cm.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(;cm.isDecimalDigit(this.code);)e+=this.expr.charAt(this.index++);if(this.code===cm.PERIOD_CODE)for(e+=this.expr.charAt(this.index++);cm.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++));cm.isDecimalDigit(this.code);)e+=this.expr.charAt(this.index++);cm.isDecimalDigit(this.expr.charCodeAt(this.index-1))||this.throwError("Expected exponent ("+e+this.char+")")}return t=this.code,cm.isIdentifierStart(t)?this.throwError("Variable names cannot start with a number ("+e+this.char+")"):(t===cm.PERIOD_CODE||1===e.length&&e.charCodeAt(0)===cm.PERIOD_CODE)&&this.throwError("Unexpected period"),{type:cm.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:cm.LITERAL,value:e,raw:this.expr.substring(n,this.index)}}gobbleIdentifier(){let e=this.code,n=this.index;for(cm.isIdentifierStart(e)?this.index++:this.throwError("Unexpected "+this.char);this.index<this.expr.length;)if(e=this.code,cm.isIdentifierPart(e))this.index++;else break;return{type:cm.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===cm.CPAREN_CODE&&r&&r>=n.length&&this.throwError("Unexpected token "+String.fromCharCode(e));break}if(o===cm.COMMA_CODE){if(this.index++,++r!==n.length){if(e===cm.CPAREN_CODE)this.throwError("Unexpected token ,");else if(e===cm.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!==cm.COMPOUND||this.throwError("Expected comma"),n.push(e)}}return t||this.throwError("Expected "+String.fromCharCode(e)),n}gobbleGroup(){this.index++;let e=this.gobbleExpressions(cm.CPAREN_CODE);if(this.code===cm.CPAREN_CODE)return(this.index++,1===e.length)?e[0]:!!e.length&&{type:cm.SEQUENCE_EXP,expressions:e};this.throwError("Unclosed (")}gobbleArray(){return this.index++,{type:cm.ARRAY_EXP,elements:this.gobbleArguments(cm.CBRACK_CODE)}}}Object.assign(cm,{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)})}}(cm),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"}),cm.max_unop_len=cm.getMaxKeyLen(cm.unary_ops),cm.max_binop_len=cm.getMaxKeyLen(cm.binary_ops);let cg=e=>new cm(e).parse(),cb=Object.getOwnPropertyNames(class{});Object.getOwnPropertyNames(cm).filter(e=>!cb.includes(e)&&void 0===cg[e]).forEach(e=>{cg[e]=cm[e]}),cg.Jsep=cm,cg.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 cy="ArrowFunctionExpression",c_={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)}},cv={...c_,Promise};function c$(e,n={}){return cE(e,n,cM)}async function cA(e,n={}){return cD(e,n,cM)}function cw(e,n={}){return cE(e,n,cz)}function ck(e,n={}){return cD(e,n,cz)}function cx(e,n={}){return cE(e,n,cP)}function cC(e,n={}){return cD(e,n,cP)}function cE(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=cB(n,c_),o=cO("string"==typeof e?cg(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 cD(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=cB(n,cv);return Promise.resolve(cO("string"==typeof e?cg(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 cS(e){return cg(e)}function cM(e){return"string"==typeof e||"number"==typeof e||"boolean"==typeof e||null==e||e instanceof Date}function cz(e){return"boolean"==typeof e}function cP(e){return"number"==typeof e}function cO(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=cO(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=cO(b.left,y),$=cO(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,cO(t.test,r)?cO(t.consequent,r):cO(t.alternate,r);case"CallExpression":var A=e,w=n;let k=A.arguments?.map(cI(w)),x=cO(A.callee,w);if(x){if("function"!=typeof x)throw`${cj(A.callee)} is not a function`}else throw`No function named ${cj(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 cO(o.body,i.addVariables(n))}).bind(i.thisObj??null);case"MemberExpression":return function(e,n){let t,r=cO(e.object,n);if(void 0===r)switch(e.object.type){case"Identifier":{let t=cT(e.object,n);throw ReferenceError(`ReferenceError: ${t} is not defined`)}case"MemberExpression":{let t=cT(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=cO(e.property,n);break;default:{let o=cO(e.property,n);if(void 0===o)throw{type:"Illegal property access",message:"No property was supplied to the property access"};cN(o),t=r[o]}}return"function"==typeof t?t.bind(r):t}(e,n);case"ArrayExpression":return a=e,s=n,a.elements?.map(cI(s));case"SequenceExpression":let E;return l=e,c=n,(E=l.expressions.map(cI(c)))[E.length-1];case"NewExpression":var D=e,S=n;if(D.callee&&"Identifier"===D.callee.type){let e=D.arguments?.map(cI(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 cN((u=e).value),u.value;case"Identifier":var M=e,z=n;cN(M.name);let P=z.thisObj;if(P&&("object"==typeof P||"function"==typeof P)&&M.name in P){let e=P[M.name];return cN(e),e}if(z.variables&&M.name in z.variables){let e=z.variables[M.name];return cN(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(cI(d))??[],(T=p.quasis?.map(cI(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 cT(e,n){switch(e.type){case"Literal":return e.value;case"Identifier":return e.name;case"MemberExpression":return cT(e.property,n);default:throw`VisitExpressionName does not support expression of type '${e.type}'`}}function cB(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 cI(e){return function(n){return null===n?null:cO(n,e)}}function cN(e){if("__proto__"===e||"prototype"===e||"constructor"===e)throw{type:"Illegal property access",message:`Cannot access the ${e} property of objects`}}function cj(e){return e?"MemberExpression"===e.type?e.property?.name:e.name:null}function cR(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:{...cv},isLocalExpression:!1,variables:new Set};return cF("string"==typeof e?cg(e):e,n),[...n.variables]}function cF(e,n){switch(e.type){case"UnaryExpression":return r=e,o=n,cF(r.argument,o);case"BinaryExpression":return i=e,a=n,[cF(i.left,a),cF(i.right,a)].filter(Boolean);case"ConditionalExpression":return s=e,l=n,[cF(s.consequent,l),cF(s.test,l),cF(s.alternate,l)].filter(Boolean);case"CallExpression":let t;return c=e,u=n,t=cF(c.callee,u),c.arguments?.map(cL(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(cL(k))??[],C=cF(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,cF(p.object,d),void((E={...d}).isLocalExpression=!0,cF(p.property,E));case"ArrayExpression":return f=e,h=n,void f.elements?.map(cL(h));case"SequenceExpression":return m=e,g=n,void m.expressions?.map(cL(g));case"NewExpression":return b=e,y=n,void b.arguments?.map(cL(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(cL($)),v.quasis?.map(cL($)));default:throw`Expression evaluator does not support expression of type '${e.type}'`}}function cL(e){return function(n){return null===n?null:cF(n,e)}}cg.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:cy,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=cy,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)})}}),cg.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"}})}}),cg.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)})}}),cg.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")}})}}),cg.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 :")}})}}),cg.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})}}),cg.addBinaryOp("in",7),cg.addBinaryOp("??",1);let cW=W("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 cV(e,n,t){cW.setState(r=>({flags:{...r.flags,[e]:{enabled:r.flags[e]?.enabled??!1,label:n,description:t}}}))}function cG(e){return cW.getState().flags[e].enabled}function cU(e){return!window.offlineEnabled||(e??navigator.onLine)}cW.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 cq=eV(function(e,n,t){eP(e,n,t)});function cH(e,n=!0,t=!1){return!!(e?n:t)}let cK=L("extensionsInternal",{slots:{},extensions:{}}),cY=()=>W("extensionsInternal",{slots:{},extensions:{}});function cJ(e){let n=cK.getState(),t=e(n);t!==n&&cK.setState(t)}let cZ=()=>W("extensions",{slots:{}});function cX(e){let n=[];for(let t of Object.values(e.extensions))for(let e of t.instances)n.push({slotModuleName:e.slotModuleName,extensionModuleName:t.moduleName,slotName:e.slotName,extensionId:e.id});nn(nB.getState().mountedExtensions,n)||nB.setState({mountedExtensions:n})}cX(cK.getState()),cK.subscribe(cX);let cQ=cY(),c0=cZ(),c1=nN(),c2=nR();function c3(e,n,t,r,o){let i={},a=cU(),s=Object.entries(r.flags).filter(([,{enabled:e}])=>e).map(([e])=>e);for(let[r,l]of Object.entries(e.slots)){let{config:c}=nj(n,l.name),u=ur(r,e,c,t,s,a,o.session);i[r]={moduleName:l.moduleName,assignedExtensions:u}}nn(c0.getState().slots,i)||c0.setState({slots:i})}function c5(){c3(cQ.getState(),c1.getState(),c2.getState(),cW.getState(),rX.getState())}function c4(e,n,t){return{moduleName:n,name:e,attachedIds:[],config:null,state:t}}function c6(e){let[n]=e.split("#");return n}function c8(e){var n;let t;return n=cQ.getState(),t=c6(e),n.extensions[t]}cQ.subscribe(e=>{c3(e,c1.getState(),c2.getState(),cW.getState(),rX.getState())}),c1.subscribe(e=>{c3(cQ.getState(),e,c2.getState(),cW.getState(),rX.getState())}),c2.subscribe(e=>{c3(cQ.getState(),c1.getState(),e,cW.getState(),rX.getState())}),cW.subscribe(e=>{c3(cQ.getState(),c1.getState(),c2.getState(),e,rX.getState())}),rX.subscribe(e=>{c3(cQ.getState(),c1.getState(),c2.getState(),cW.getState(),e)}),c5(),b(c5);let c7=e=>cQ.setState(n=>(n.extensions[e.name]={...e,instances:[]},n));function c9(e,n){cJ(t=>{let r=t.slots[e];return r?{...t,slots:{...t.slots,[e]:{...r,attachedIds:[...r.attachedIds,n]}}}:{...t,slots:{...t.slots,[e]:{...c4(e),attachedIds:[n]}}}})}function ue(e,n){cJ(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 un(e){cJ(n=>{let t=n.slots[e];return t?{...n,slots:{...n.slots,[e]:{...t,attachedIds:[]}}}:n})}function ut(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:-1}}function ur(e,n,t,r,o,i,a){let s=function(e,n){let t=e.add||[],r=e.remove||[],o=e.order||[],{extensions:i}=cQ.getState();return[...n,...t].filter(e=>!r.includes(e)).sort((e,t)=>{let r=ut(e,o,i[c6(e)]?.order,n),a=ut(t,o,i[c6(t)]?.order,n);return -1===a?-1:-1===r?1:r-a})}(t,n.slots[e].attachedIds),l=[],c=n.slots[e]?.state,u=c&&"object"==typeof c?{session:a,...c}:{session:a};for(let c of s){let{config:s}=nF(r,e,c),p=cq(s,t.configure?.[c]??null),d=c6(c),f=n.extensions[d];if(f){let n=p?.["Display conditions"]?.privileges??f.privileges??[];if(n&&("string"==typeof n||Array.isArray(n)&&n.length>0)&&(!a?.user||!r4(n,a.user)))continue;let t=p?.["Display conditions"]?.expression||f.displayExpression;if(void 0!==t&&"string"==typeof t&&t.trim().length>0)try{if(!cw(t,u))continue}catch(n){console.error(`Error while evaluating expression '${t}' for extension ${d} in slot ${e}`,n);continue}if(f.featureFlag&&!o.includes(f.featureFlag)||window.offlineEnabled&&!cH(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})}}return l}function uo(e){let n=cQ.getState(),{config:t}=nj(nN().getState(),e),r=c2.getState(),o=cW.getState(),i=rX.getState(),a=cU();return ur(e,n,t,r,Object.entries(o.flags).filter(([,{enabled:e}])=>e).map(([e])=>e),a,i.session)}let ui=(e,n,t)=>cQ.setState(r=>{let o=r.slots[n]?.moduleName;if(o&&o!=e)return console.warn(`An extension slot with the name '${n}' already exists. Refusing to register the same slot name twice (in "registerExtensionSlot"). The existing one is from module ${o}.`),r;if(o&&o==e)return r;if(r.slots[n])return{...r,slots:{...r.slots,[n]:{...r.slots[n],moduleName:e,state:t}}};let i=c4(n,e,t);return{...r,slots:{...r.slots,[n]:{...i}}}}),ua=L("left-nav",{slotName:null,basePath:window.spaBase,mode:"normal"});function us({name:e,basePath:n,mode:t,componentContext:r,state:o}){ua.setState({slotName:e,basePath:n,mode:t??"normal",componentContext:r,state:o})}function ul(e){ua.getState().slotName===e&&ua.setState(ua.getInitialState(),!0)}let uc=0;async function uu(e,n,t,r,o=e=>e,i={}){let a=c6(r),s=c8(r),l=null;if(e){if(!s)throw Error(`Couldn't find extension '${a}' to attach to '${n}'`);let{meta:c,moduleName:u,online:p,offline:d,load:f}=s;if(function(e=!0,n=!1){return cH(cU(),e,n)}(p,d)){cJ(o=>({...o,extensions:{...o.extensions,[a]:{...o.extensions[a],instances:[...o.extensions[a].instances,{domElement:e,id:r,slotName:n,slotModuleName:t}]}}}));let s=await f(),p=uc++;l=tX(o({...s,name:`${n}/${a}-${p}`}),{...i,_meta:c,_extensionContext:{extensionId:r,extensionSlotName:n,extensionSlotModuleName:t,extensionModuleName:u},domElement:e})}}else console.warn(`Tried to render ${r} into ${n} but no DOM element was available.`);return l}function up(){return{current:"unavailable",notAvailable:!0,active:!1}}let ud="x-omrs-offline-response-body",uf="x-omrs-offline-response-status",uh="x-omrs-offline-caching-strategy",um="u">typeof crypto&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),ug=new Uint8Array(16),ub=[];for(let e=0;e<256;++e)ub.push((e+256).toString(16).slice(1));let uy=function(e,n,t){if(um&&!n&&!e)return um();let r=(e=e||{}).random||(e.rng||function(){if(!i&&!(i="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 i(ug)})();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 ub[e[n+0]]+ub[e[n+1]]+ub[e[n+2]]+ub[e[n+3]]+"-"+ub[e[n+4]]+ub[e[n+5]]+"-"+ub[e[n+6]]+ub[e[n+7]]+"-"+ub[e[n+8]]+ub[e[n+9]]+"-"+ub[e[n+10]]+ub[e[n+11]]+ub[e[n+12]]+ub[e[n+13]]+ub[e[n+14]]+ub[e[n+15]]}(r)},u_="OFFLINE+";function uv(){return u_+uy()}function u$(e){return e.startsWith(u_)}var uA=t(47499),uw=t.n(uA);function uk({to:e,templateParams:n,onBeforeNavigate:t,children:r,...o}){return(0,uA.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}`)},[]),uw().createElement("a",{onClick:r=>{0===r.button&&!r.ctrlKey&&!r.shiftKey&&!r.altKey&&!r.metaKey&&(r.preventDefault(),t?.(r),rF({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:rj(e,n),...o},r)}let ux=L("modalRegistry",{modals:{}}),uC=L("workspaceRegistrations",{workspaces:{}}),uE=L("workspaceGroups",{workspaceGroups:{}}),uD=new Set;function uS(e){let n=uC.getState().workspaces;if(n[e])return n[e];{let n=c8(e);if(n){var t;let r;return uD.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.`),uD.add(e)),{name:n.name,title:(t=n,"string"==typeof(r=t?.meta?.title)?r:r&&"object"==typeof r?o1(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 uM=L("workspace2",{registeredGroupsByName:{},registeredWindowsByName:{},registeredWorkspacesByName:{},openedGroup:null,openedWindows:[],workspaceTitleByWorkspaceName:{},isMostRecentlyOpenedWindowHidden:!1});function uz(e){let{openedWindows:n}=uM.getState();return n.findIndex(n=>n.openedWorkspaces.find(n=>n.workspaceName===e))}let uP=(0,uA.createContext)({moduleName:"",featureName:""});function uO(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 uT=()=>e=>e;function uB(e,n=uT(),t){let r=(0,uA.useCallback)(n=>e.subscribe(n),[e]),o=(0,uA.useCallback)(()=>n(e.getState()),[e,n]),i=(0,uA.useSyncExternalStore)(r,o,o),a=(0,uA.useMemo)(()=>t?uO(e,t):{},[e,t]);return{...i,...a}}function uI(e,n){return uB(e,uT(),n)}function uN(e){return function(n){let t=(0,uA.useCallback)(n=>e.subscribe(n),[]),r=(0,uA.useCallback)(()=>e.getState(),[]),o=(0,uA.useSyncExternalStore)(t,r,r),i=(0,uA.useMemo)(()=>n?uO(e,n):{},[n]);return{...o,...i}}}let uj=e=>uB(cZ(),n=>n.slots?.[e]);function uR(e){let n=uj(e);return n?.assignedExtensions??[]}function uF(e,n){let{moduleName:t}=(0,uA.useContext)(uP),r=(0,uA.useRef)(!0);if(!t)throw Error("ComponentContext has not been provided. This should come from @openmrs/esm-react-utils.");return(0,uA.useEffect)(()=>{ui(t,e,n),r.current=!1},[]),(0,uA.useEffect)(()=>{r.current||function(e,n,t=!1){cQ.setState(r=>{let o=t?cq(r.slots[e].state,n):n;return{...r,slots:{...r.slots,[e]:{...r.slots[e],state:o}}}})}(e,n)},[e,n]),{extensions:uR(e),extensionSlotName:e,extensionSlotModuleName:t}}function uL(e){return e}function uW({name:e,extensionSlotName:n,select:t=uL,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,uA.useRef)(null),{extensions:c,extensionSlotModuleName:u}=uF(s,o),p=(0,uA.useMemo)(()=>t(c),[t,c]),d=(0,uA.useMemo)(()=>{if("function"==typeof r&&!uw().isValidElement(r))return p.map(e=>r(e,o))},[r,p]);return uw().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)=>uw().createElement(uP.Provider,{key:e.id,value:{moduleName:u,featureName:"",extension:{extensionId:e.id,extensionSlotName:s,extensionSlotModuleName:u}}},d?.[n]??("function"!=typeof r?r:null)??uw().createElement(dr,{state:o}))))}var uV=t(5338);function uG(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 uU(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?uG(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)):uG(Object(t)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))})}return e}function uq(e){return(uq="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 uH(e){return(uH="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 uK(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(uH(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(uH(e)));return e}}var uY=null;try{uY=require("react").createContext()}catch(e){}var uJ={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 uZ(e,n){return e.rootComponent?Promise.resolve():e.loadRootComponent(n).then(function(n){e.rootComponent=n})}function uX(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=u2(e,n,function(){t(this)}),a=uK(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:u1(e),renderType:"function"==typeof(o=e).renderType?o.renderType():o.renderType});e.domElements[n.name]=a,e.renderResults[n.name]=s})}function uQ(e,n){return new Promise(function(t){e.unmountResolves[n.name]=t;var r=e.renderResults[n.name];r&&r.unmount?r.unmount():u1(e).unmountComponentAtNode(e.domElements[n.name]),delete e.domElements[n.name],delete e.renderResults[n.name]})}function u0(e,n){return new Promise(function(t){e.updateResolves[n.name]||(e.updateResolves[n.name]=[]),e.updateResolves[n.name].push(t);var r=u2(e,n,null),o=e.renderResults[n.name];if(o&&o.render)o.render(r);else{var i=uK(e,n)();u1(e).render(r,i)}})}function u1(e){return e.ReactDOMClient||e.ReactDOM}function u2(e,n,t){var r=e.React.createElement(e.rootComponent,n),o=uY?e.React.createElement(uY.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,uU(uU({},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 u3=t(58779),u5=t(59324),u4=t(14993);let u6={strictMode:!0,throwErrorsToConsole:!0,disableTranslations:!1},u8=new Map;(0,u4.r2)(u8);let u7={errorRetryCount:3,fetcher:rY,focusThrottleInterval:18e5,revalidateIfStale:!0,revalidateOnFocus:!1,revalidateOnReconnect:!1,refreshInterval:0,shouldRetryOnError:e=>{if(e instanceof rZ){let n=e.response.status;return!!(n>=500)||401===n||403===n||429===n}return!0},provider:()=>u8};function u9(e,n){return function(e){if("object"!==uq(e))throw Error("single-spa-react requires a configuration object");var n,t=uU(uU({},uJ),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");!uY&&t.React.createContext&&(uY=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:uZ.bind(null,t),mount:uX.bind(null,t),unmount:uQ.bind(null,t)};return t.parcelCanUpdate&&(r.update=u0.bind(null,t)),r}({React:uw(),ReactDOMClient:uV,rootComponent:(function(e){if("object"!=typeof e||"string"!=typeof e.featureName||"string"!=typeof e.moduleName)throw Error("Invalid options");let n=Object.assign({},u6,e),t={...u7,...n.swrConfig};return function(e){var r,o,i,a,s;return i=o=class extends(r=uw().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 uw().createElement("div",null,"An error has occurred. Please try reloading the page.");{let r=uw().createElement(uA.Suspense,{fallback:null},uw().createElement(u5.BE,{value:t},uw().createElement(uP.Provider,{value:this.state.config},n.disableTranslations?uw().createElement(e,this.props):uw().createElement(u3.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},uw().createElement(e,this.props)))));return n.strictMode&&uw().StrictMode?uw().createElement(uw().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 pe(e,n){return()=>e().then(({default:e})=>u9(e,n))}function pn(e,n){return()=>Promise.resolve(u9(e,n))}let pt=pe,pr=new Map;function po(e,n){let t=(0,uA.useRef)(n??{}),r=(0,uA.useRef)(n=>ol(e,n)),o=(0,uA.useRef)(Symbol());return(0,uA.useEffect)(()=>{let t=n??{},r=o.current;return null===os(e)?oi(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.`),ol(e,()=>t)),pr.set(e,r),()=>{pr.get(e)===r&&(oa(e),pr.delete(e))}},[e]),(0,uA.useEffect)(()=>{let r=n??{};T(t.current,r)||(ol(e,()=>r),t.current=r)},[n]),r.current}function pi({namespace:e,value:n}){return po(e,n),null}let pa=({children:e,value:n,fallback:t})=>n?uw().createElement(uw().Fragment,null,e):t?uw().createElement(uw().Fragment,null,t):null;function ps(){let e=(0,uA.useRef)();return(!e.current||e.current.signal.aborted)&&(e.current=new AbortController),(0,uA.useEffect)(()=>{let n=e.current;return()=>n?.abort()},[]),e.current}function pl(e,n=e=>e??{}){let[t,r]=(0,uA.useState)(()=>{if(pc(e))return;let t=os(e);if(null!==t)return n?n(t):t});return(0,uA.useEffect)(()=>{if(pc(e))throw Error(`The namespace supplied to useAppContext must be a non-empty string, but was "${e}".`)},[e]),(0,uA.useEffect)(()=>oc(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 pc(e){return"string"!=typeof e||0===e.trim().length}function pu(e){let[n,t]=(0,uA.useState)([]);return(0,uA.useEffect)(()=>cZ().subscribe(r=>{let o=r.slots[e]?.assignedExtensions.map(e=>e.id)??[];nn(o,n)||t(o)}),[]),n}function pp(e,n){let{data:t,error:r,mutate:o,isLoading:i,isValidating:a}=(0,u5.Ay)(`${ie}?patient=${e}&includeEncounterless=${n}`,rY);return(0,uA.useMemo)(()=>({isLoading:i,data:t?.data.results??[],error:r,mutate:o,isValidating:a}),[t,r,i,a,o])}function pd(e){(0,uA.useEffect)(()=>{if(e){let e=window.getComputedStyle(document.body).overflow;return document.body.style.overflow="hidden",()=>{document.body.style.overflow=e}}},[e])}let pf={},ph=`No ComponentContext has been provided. This should come from "openmrsComponentDecorator".
15
+ ${this.stack}`}}let rX=L("session",{loaded:!1,session:null}),rQ=0;function r0(e={includeAuthStatus:!0}){return(rQ<Date.now()-6e4||!rX.getState().loaded)&&r3(),new er.Observable(n=>{let t=t=>{t.loaded&&(e.includeAuthStatus?n.next(t.session):n.next(t.session?.user))};return t(rX.getState()),rX.subscribe(t)})}function r1(){return(rQ<Date.now()-6e4||!rX.getState().loaded)&&r3(),rX}function r2(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 r3(e,n){rQ=Date.now();let t={};return e&&n&&(t.Authorization=`Basic ${window.btoa(`${e}:${n}`)}`),oe(rY(rH,{headers:t}))}function r5(){rX.setState({loaded:!0,session:{authenticated:!1,sessionId:""}})}function r4(e,n){var t,r;if(void 0===n)return!e;if(!e)return!0;return t=e,r=n,("string"==typeof t?!U(r.privileges.find(e=>t===e.display)):Array.isArray(t)?t.every(e=>!U(r.privileges.find(n=>e===n.display))):(U(t)||console.error(`Could not understand privileges "${t}"`),!0))||!U(n.roles.find(e=>"System Developer"===e.display))}function r6(){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(rX.getState()),e||(n=rX.subscribe(r))})}function r8(){return new Promise((e,n)=>{r0().subscribe(n=>{e(n.sessionLocation)},n).unsubscribe()})}async function r7(e,n){return oe(rY(rH,{method:"POST",body:{sessionLocation:e},headers:{"Content-Type":"application/json"},signal:n.signal}))}async function r9(e,n,t){return t||(t=new AbortController),await rY(`${rU}/user/${e}`,{method:"POST",body:{userProperties:n},headers:{"Content-Type":"application/json"},signal:t.signal}),r3()}function oe(e){return new Promise((n,t)=>{e.then(e=>{let r;"object"==typeof e?.data?(r={loaded:!0,session:e.data},rX.setState(r),n(r)):(r={loaded:!1,session:null},rX.setState(r),t(r))}).catch(e=>{z(`Failed to fetch new session information: ${e}`);let n={loaded:!1,session:null};rX.setState(n),t(n)})})}function on(){return"development"===window.spaEnv||"true"===localStorage.getItem("openmrs:devtools")}rX.subscribe(e=>{e.loaded&&e.session&&r2(e.session)});let ot={"webservices.rest":"2.24.0",fhir2:"1.0.0-SNAPSHOT"},or=j()(()=>({}));(p=F[X="openmrs-app-context"])?(p.active?R()||console.error(`Attempted to override the existing store ${X}. Make sure that stores are only created once.`):p.value=or,p.active=!0,p.value):F[X]={value:or,active:!0};let oo={};function oi(e,n=oo){or.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===oo?{}:n})})}function oa(e){or.setState(n=>(e in n&&delete n[e],n))}function os(e,n=e=>e){let t=or.getState();return e in t?Object.freeze(Object.assign({},n?n(t[e]):t[e])):null}function ol(e,n){or.setState(t=>(e in t||(t[e]={}),t[e]=n(t[e]),Object.assign({},t)))}function oc(e,n){let t=os(e);return n(ou(t)),or.subscribe(r=>{let o=e in r?r[e]:null;o!==t&&(t=o,n(ou(o)))})}function ou(e){return null===e?null:Object.freeze(Object.assign({},e))}let op={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",male:"Male",noResultsToDisplay:"No results to display",notAvailable:"Not available",other:"Other",paginationItemsCount:"{{pageItemsCount}} / {{totalItems}} items",paginationOfPages:"of {{count}} pages",patientAvatarAlt:"Avatar for {{patientName}}",patientIdentifierSticker:"Patient identifier sticker",patientLists:"Patient lists",patientPhotoAlt:"Profile photo of {{patientName}}",patientPhotoPlaceholder:"Photo placeholder for {{patientName}}",print:"Print",printError:"Print error",printErrorExplainer:"An error occurred in {{errorLocation}}",printIdentifierSticker:"Print identifier sticker",printing:"Printing",recordNewEntry:"Record {{displayText}}",relationships:"Relationships",resetOverrides:"Reset overrides",save:"Save",scriptLoadingFailed:"Error: Script failed to load",scriptLoadingError:"Failed to load overridden script from {{url}}. Please check that the bundled script is available at the expected URL. Click the button below to reset all import map overrides.",searchForLocation:"Search for a location",seeAll:"See all",seeMoreLists:"See {{count}} more lists",selectAll:"Select all",sex:"Sex",showLess:"Show less",showMore:"Show more",snackbarNotification:"Snackbar notification",toggleDevTools:"Toggle dev tools",unknown:"Unknown",yearAbbreviation:"yr",yearsAbbreviation:"yrs"},od=e=>"string"==typeof e,of=()=>{let e,n,t=new Promise((t,r)=>{e=t,n=r});return t.resolve=e,t.reject=n,t},oh=e=>null==e?"":""+e,om=/###/g,og=e=>e&&e.indexOf("###")>-1?e.replace(om,"."):e,ob=e=>!e||od(e),oy=(e,n,t)=>{let r=od(n)?n.split("."):n,o=0;for(;o<r.length-1;){if(ob(e))return{};let n=og(r[o]);!e[n]&&t&&(e[n]=new t),e=Object.prototype.hasOwnProperty.call(e,n)?e[n]:{},++o}return ob(e)?{}:{obj:e,k:og(r[o])}},o_=(e,n,t)=>{let{obj:r,k:o}=oy(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=oy(e,a,Object);for(;void 0===s.obj&&a.length;)i=`${a[a.length-1]}.${i}`,s=oy(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},ov=(e,n)=>{let{obj:t,k:r}=oy(e,n);if(t&&Object.prototype.hasOwnProperty.call(t,r))return t[r]},o$=(e,n,t)=>{for(let r in n)"__proto__"!==r&&"constructor"!==r&&(r in e?od(e[r])||e[r]instanceof String||od(n[r])||n[r]instanceof String?t&&(e[r]=n[r]):o$(e[r],n[r],t):e[r]=n[r]);return e};var oA={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;","/":"&#x2F;"};let ow=e=>od(e)?e.replace(/[&<>"'\/]/g,e=>oA[e]):e,ok=[" ",",","?","!",";"],ox=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),oC=(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},oE=e=>e?.replace("_","-"),oD={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 oS{constructor(e,n={}){this.init(e,n)}init(e,n={}){this.prefix=n.prefix||"i18next:",this.logger=e||oD,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:(od(e[0])&&(e[0]=`${t}${this.prefix} ${e[0]}`),this.logger[n](e))}create(e){return new oS(this.logger,{...{prefix:`${this.prefix}:${e}:`},...this.options})}clone(e){return(e=e||this.options).prefix=e.prefix||this.prefix,new oS(this.logger,e)}}var oM=new oS;class oz{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 oP extends oz{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):od(t)&&i?o.push(...t.split(i)):o.push(t)));let s=ov(this.data,o);return(!s&&!n&&!t&&e.indexOf(".")>-1&&(e=o[0],n=o[1],t=o.slice(2).join(".")),!s&&a&&od(t))?oC(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),o_(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)(od(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=ov(this.data,a)||{};i.skipCopy||(t=JSON.parse(JSON.stringify(t))),r?o$(s,t,o):s={...s,...t},o_(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 oO={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 oT=Symbol("i18next/PATH_KEY");function oB(e,n){let t,r,o,{[oT]:i}=e((r=[],(o=Object.create(null)).get=(e,n)=>(t?.revoke?.(),n===oT)?r:(r.push(n),(t=Proxy.revocable(e,o)).proxy),Proxy.revocable(Object.create(null),o).proxy));return i.join(n?.keySeparator??".")}let oI={},oN=e=>!od(e)&&"boolean"!=typeof e&&"number"!=typeof e;class oj extends oz{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=oM.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=oN(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=ok.filter(e=>0>n.indexOf(e)&&0>t.indexOf(e));if(0===r.length)return!0;let o=ox.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:od(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:od(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=oB(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&&!od(r.count),v=oj.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=oN(x),E=Object.prototype.toString.apply(x);if(b&&x&&C&&0>["[object Number]","[object Function]","[object RegExp]"].indexOf(E)&&!(od(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:oN(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&&od(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=od(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&&!od(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=od(i)?[i]:i;return null!=e&&a?.length&&!1!==t.applyPostProcessor&&(e=oO.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 od(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&&!od(n.count),p=u&&!n.ordinal&&0===n.count,d=void 0!==n.context&&(od(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,!oI[`${f[0]}-${e}`]&&this.utils?.hasLoadedNamespace&&!this.utils?.hasLoadedNamespace(a)&&(oI[`${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&&!od(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 oR{constructor(e){this.options=e,this.supportedLngs=this.options.supportedLngs||!1,this.logger=oM.create("languageUtils")}getScriptPartFromCode(e){if(!(e=oE(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=oE(e))||0>e.indexOf("-"))return e;let n=e.split("-");return this.formatLanguageCode(n[0])}formatLanguageCode(e){if(od(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)),od(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 od(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))):od(e)&&o(this.formatLanguageCode(e)),t.forEach(e=>{0>r.indexOf(e)&&o(this.formatLanguageCode(e))}),r}}let oF={zero:0,one:1,two:2,few:3,many:4,other:5},oL={select:e=>1===e?"one":"other",resolvedOptions:()=>({pluralCategories:["one","other"]})};class oW{constructor(e,n={}){this.languageUtils=e,this.options=n,this.logger=oM.create("pluralResolver"),this.pluralRulesCache={}}addRule(e,n){this.rules[e]=n}clearCache(){this.pluralRulesCache={}}getRule(e,n={}){let t,r=oE("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!"),oL;if(!e.match(/-|_/))return oL;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)=>oF[e]-oF[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 oV=(e,n,t,r=".",o=!0)=>{let i,a=void 0!==(i=ov(e,t))?i:ov(n,t);return!a&&o&&od(t)&&void 0===(a=oC(e,t,r))&&(a=oC(n,t,r)),a};class oG{constructor(e={}){this.logger=oM.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:ow,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=oV(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(oV(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=od(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 od(i)||this.useRawValueToEscape||(i=oh(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&&!od(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&&!od(o))return o;od(o)||(o=oh(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 oU=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(oE(r),o),n[a]=s),s(t)}},oq=e=>(n,t,r)=>e(oE(t),r)(n);class oH{constructor(e={}){this.logger=oM.create("formatter"),this.options=e,this.init(e)}init(e,n={interpolation:{}}){this.formatSeparator=n.interpolation.formatSeparator||",";let t=n.cacheInBuiltFormats?oU:oq;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()]=oU(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 oK extends oz{constructor(e,n,t,r={}){super(),this.backend=e,this.store=n,this.services=t,this.languageUtils=t.languageUtils,this.options=r,this.logger=oM.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}=oy(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();od(e)&&(e=this.languageUtils.toResolveHierarchy(e)),od(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 oY=()=>({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]),od(e[1])&&(n.defaultValue=e[1]),od(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}),oJ=e=>(od(e.ns)&&(e.ns=[e.ns]),od(e.fallbackLng)&&(e.fallbackLng=[e.fallbackLng]),od(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),oZ=()=>{};class oX extends oz{constructor(e={},n){if(super(),this.options=oJ(e),this.services={},this.logger=oM,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&&(od(e.ns)?e.defaultNS=e.ns:0>e.ns.indexOf("translation")&&(e.defaultNS=e.ns[0]));let t=oY();this.options={...t,...this.options,...oJ(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?oM.init(r(this.modules.logger),this.options):oM.init(null,this.options),e=this.modules.formatter?this.modules.formatter:oH;let n=new oR(this.options);this.store=new oP(this.options.resources,this.options);let o=this.services;o.logger=oM,o.resourceStore=this.store,o.languageUtils=n,o.pluralResolver=new oW(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 oG(this.options),o.utils={hasLoadedNamespace:this.hasLoadedNamespace.bind(this)},o.backendConnector=new oK(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 oj(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=oZ),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=of(),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=oZ){let t=n,r=od(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=of();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=oZ),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&&oO.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=of();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=od(n)?n:n&&n[0],i=this.store.hasLanguageSomeTranslations(t)?t:this.services.languageUtils.getBestMatchFromCodes(od(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=oB(e,{...this.options,...n})),`${i.keyPrefix}${s}${e}`)):("function"==typeof e&&(e=oB(e,{...this.options,...n})),a=i.keyPrefix?`${i.keyPrefix}${s}${e}`:e),this.t(a,i)};return od(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=of();return this.options.ns?(od(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=of();od(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 oR(oY());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 oX(e,n)}cloneInstance(e={},n=oZ){let t=e.forkResourceStore;t&&delete e.forkResourceStore;let r={...this.options,...e,isClone:!0},o=new oX(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 oP(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 oj(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 oQ=oX.createInstance();oQ.createInstance=oX.createInstance,oQ.createInstance,oQ.dir,oQ.init,oQ.loadResources,oQ.reloadResources,oQ.use,oQ.changeLanguage,oQ.getFixedT,oQ.t,oQ.exists,oQ.setDefaultNamespace,oQ.hasLoadedNamespace,oQ.loadNamespaces,oQ.loadLanguages;let o0=oQ.default||oQ;function o1(e,n,t,r){return o0.t(n,{ns:e,defaultValue:t,...r})}function o2(e,n,t){return op[e]?o1("core",e,n??op[e],t):(console.error(`O3 Core Translations does not provide key '${e}'. The key itself is being rendered as text.`),e)}o0.on("initialized",function(){window.i18next.loadNamespaces(["core"])});async function o3(){let e=document.querySelectorAll('script[type="systemjs-importmap"]'),n=[];for(let t=0;t<e.length;t++){let r=e[t];try{if(r.src){let e=await fetch(r.src);n.push(await e.json())}else r.textContent&&n.push(JSON.parse(r.textContent))}catch(e){console.warn(`[import-maps] Failed to parse import map from script tag at index ${t}`,e)}}return function(e){let n={imports:{}};for(let t of e)t?.imports&&Object.assign(n.imports,t.imports);return n}(n)}async function o5(){return await o3()}function o4(e){return e.replace(/[\/\-@]/g,"_")}async function o6(e,n="./start",r){var o;let i,a=!r?.maxLoadingTime||r.maxLoadingTime<=0?6e5:r.maxLoadingTime;await Promise.race([o8(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=o4(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 o8(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=o4(e);if(!window[t]){let t=n??await o7();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[o9];if(o||(o=window[o9]=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:o2("scriptLoadingFailed","Error: Script failed to load"),description:o2("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:o2("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 o7(){return o5()}let o9=Symbol("__openmrs_script_loading"),ie=`${rU}/attachment`;function it(e,n){return rY(`${ie}/${e}`,{signal:n.signal})}function ir(e,n,t){return rY(`${ie}?patient=${e}&includeEncounterless=${n}`,{signal:t.signal})}async function io(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)),rY(`${ie}`,{method:"POST",body:t})}function ii(e,n){return rY(`${ie}/${e}`,{method:"DELETE",signal:n.signal})}try{self["workbox:window:6.5.4"]&&_()}catch(e){}function ia(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 is(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 il(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 ic=function(){var e=this;this.promise=new Promise(function(n,t){e.resolve=n,e.reject=t})};function iu(e,n){var t=location.href;return new URL(e,t).href===new URL(n,t).href}var ip=function(e,n){this.type=e,Object.assign(this,n)};function id(e,n,t){return t?n?n(e):e:(e&&e.then||(e=Promise.resolve(e)),n?e.then(n):e)}function ih(){}var im={type:"SKIP_WAITING"};function ig(e,n){if(!n)return e&&e.then?e.then(ih):Promise.resolve()}async function ib(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 ic,r.en=new ic,r.on=new ic,r.un=0,r.an=new Set,r.cn=function(){var e=r.fn,n=e.installing;r.tn>0||!iu(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 ip(o,a)),"installed"===o?r.wn=self.setTimeout(function(){"installed"===o&&n.waiting===t&&r.dispatchEvent(new ip("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 ip("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 id(r.getSW(),function(){r.an.has(o)&&r.dispatchEvent(new ip("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 ig(new Promise(function(e){return window.addEventListener("load",e)}))},o=function(){return a.mn=!!navigator.serviceWorker.controller,a.yn=a.pn(),id(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&&iu(n.scriptURL,a.sn.toString())&&(a.hn=n,Promise.resolve().then(function(){a.dispatchEvent(new ip("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?ig(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 id(this.getSW(),function(n){return ia(n,e)})}catch(e){return Promise.reject(e)}},r.messageSkipWaiting=function(){this.fn&&this.fn.waiting&&ia(this.fn.waiting,im)},r.pn=function(){var e=navigator.serviceWorker.controller;return e&&iu(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 id(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)}},is(n.prototype,[{key:"active",get:function(){return this.en.promise}},{key:"controlling",get:function(){return this.on.promise}}]),t&&is(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 il(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)?il(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 iy="u">typeof globalThis?globalThis:"u">typeof self?self:"u">typeof window?window:global,i_=Object.keys,iv=Array.isArray;function i$(e,n){return"object"!=typeof n||i_(n).forEach(function(t){e[t]=n[t]}),e}"u"<typeof Promise||iy.Promise||(iy.Promise=Promise);let iA=Object.getPrototypeOf,iw={}.hasOwnProperty;function ik(e,n){return iw.call(e,n)}function ix(e,n){"function"==typeof n&&(n=n(iA(e))),("u"<typeof Reflect?i_:Reflect.ownKeys)(n).forEach(t=>{iE(e,t,n[t])})}let iC=Object.defineProperty;function iE(e,n,t,r){iC(e,n,i$(t&&ik(t,"get")&&"function"==typeof t.get?{get:t.get,set:t.set,configurable:!0}:{value:t,configurable:!0,writable:!0},r))}function iD(e){return{from:function(n){return e.prototype=Object.create(n.prototype),iE(e.prototype,"constructor",e),{extend:ix.bind(null,e.prototype)}}}}let iS=Object.getOwnPropertyDescriptor;function iM(e,n){let t;return iS(e,n)||(t=iA(e))&&iM(t,n)}let iz=[].slice;function iP(e,n,t){return iz.call(e,n,t)}function iO(e,n){return n(e)}function iT(e){if(!e)throw Error("Assertion Failed")}function iB(e){iy.setImmediate?setImmediate(e):setTimeout(e,0)}function iI(e,n){return e.reduce((e,t,r)=>{var o=n(t,r);return o&&(e[o[0]]=o[1]),e},{})}function iN(e,n){if("string"==typeof n&&ik(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=iN(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:iN(s,n.substr(a+1))}}function ij(e,n,t){if(e&&void 0!==n&&(!("isFrozen"in Object)||!Object.isFrozen(e)))if("string"!=typeof n&&"length"in n){iT("string"!=typeof t&&"length"in t);for(var r=0,o=n.length;r<o;++r)ij(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?iv(e)&&!isNaN(parseInt(a))?e.splice(a,1):delete e[a]:e[a]=t;else{var l=e[a];l&&ik(e,a)||(l=e[a]={}),ij(l,s,t)}}else void 0===t?iv(e)&&!isNaN(parseInt(n))?e.splice(n,1):delete e[n]:e[n]=t}}function iR(e){var n={};for(var t in e)ik(e,t)&&(n[t]=e[t]);return n}let iF=[].concat;function iL(e){return iF.apply([],e)}let iW="BigUint64Array,BigInt64Array,Array,Boolean,String,Date,RegExp,Blob,File,FileList,FileSystemFileHandle,FileSystemDirectoryHandle,ArrayBuffer,DataView,Uint8ClampedArray,ImageBitmap,ImageData,Map,Set,CryptoKey".split(",").concat(iL([8,16,32,64].map(e=>["Int","Uint","Float"].map(n=>n+e+"Array")))).filter(e=>iy[e]),iV=iW.map(e=>iy[e]);iI(iW,e=>[e,!0]);let iG=null;function iU(e){iG="u">typeof WeakMap&&new WeakMap;let n=function e(n){if(!n||"object"!=typeof n)return n;let t=iG&&iG.get(n);if(t)return t;if(iv(n)){t=[],iG&&iG.set(n,t);for(var r=0,o=n.length;r<o;++r)t.push(e(n[r]))}else if(iV.indexOf(n.constructor)>=0)t=n;else{let r=iA(n);for(var i in t=r===Object.prototype?{}:Object.create(r),iG&&iG.set(n,t),n)ik(n,i)&&(t[i]=e(n[i]))}return t}(e);return iG=null,n}let{toString:iq}={};function iH(e){return iq.call(e).slice(8,-1)}let iK="u">typeof Symbol?Symbol.iterator:"@@iterator",iY="symbol"==typeof iK?function(e){var n;return null!=e&&(n=e[iK])&&n.apply(e)}:function(){return null},iJ={};function iZ(e){var n,t,r,o;if(1==arguments.length){if(iv(e))return e.slice();if(this===iJ&&"string"==typeof e)return[e];if(o=iY(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 iX="u">typeof Symbol?e=>"AsyncFunction"===e[Symbol.toStringTag]:()=>!1;var iQ="u">typeof location&&/^(http|https):\/\/(localhost|127\.0\.0\.1)/.test(location.href),i0=()=>!0;let i1=!Error("").stack;function i2(){if(i1)try{throw i2.arguments,Error()}catch(e){return e}return Error()}function i3(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(i0).map(e=>"\n"+e).join("")):""}var i5=["Unknown","Constraint","Data","TransactionInactive","ReadOnly","Version","NotFound","InvalidState","InvalidAccess","Abort","Timeout","QuotaExceeded","Syntax","DataClone"],i4=["Modify","Bulk","OpenFailed","VersionChange","Schema","Upgrade","InvalidTable","MissingAPI","NoSuchDatabase","InvalidArgument","SubTransaction","Unsupported","Internal","DatabaseClosed","PrematureCommit","ForeignAwait"].concat(i5),i6={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 i8(e,n){this._e=i2(),this.name=e,this.message=n}function i7(e,n){return e+". Errors: "+Object.keys(n).map(e=>n[e].toString()).filter((e,n,t)=>t.indexOf(e)===n).join("\n")}function i9(e,n,t,r){this._e=i2(),this.failures=n,this.failedKeys=r,this.successCount=t,this.message=i7(e,n)}function ae(e,n){this._e=i2(),this.name="BulkError",this.failures=Object.keys(n).map(e=>n[e]),this.failuresByPos=n,this.message=i7(e,n)}iD(i8).from(Error).extend({stack:{get:function(){return this._stack||(this._stack=this.name+": "+this.message+i3(this._e,2))}},toString:function(){return this.name+": "+this.message}}),iD(i9).from(i8),iD(ae).from(i8);var an=i4.reduce((e,n)=>(e[n]=n+"Error",e),{}),at=i4.reduce((e,n)=>{var t=n+"Error";function r(e,r){this._e=i2(),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=i6[n]||t,this.inner=null)}return iD(r).from(i8),e[n]=r,e},{});at.Syntax=SyntaxError,at.Type=TypeError,at.Range=RangeError;var ar=i5.reduce((e,n)=>(e[n+"Error"]=at[n],e),{}),ao=i4.reduce((e,n)=>(-1===["Syntax","Type","Range"].indexOf(n)&&(e[n+"Error"]=at[n]),e),{});function ai(){}function aa(e){return e}function as(e,n){return null==e||e===aa?n:function(t){return n(e(t))}}function al(e,n){return function(){e.apply(this,arguments),n.apply(this,arguments)}}function ac(e,n){return e===ai?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?al(r,this.onsuccess):r),o&&(this.onerror=this.onerror?al(o,this.onerror):o),void 0!==i?i:t}}function au(e,n){return e===ai?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?al(t,this.onsuccess):t),r&&(this.onerror=this.onerror?al(r,this.onerror):r)}}function ap(e,n){return e===ai?n:function(t){var r=e.apply(this,arguments);i$(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?al(o,this.onsuccess):o),i&&(this.onerror=this.onerror?al(i,this.onerror):i),void 0===r?void 0===a?void 0:a:i$(r,a)}}function ad(e,n){return e===ai?n:function(){return!1!==n.apply(this,arguments)&&e.apply(this,arguments)}}function af(e,n){return e===ai?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)}}ao.ModifyError=i9,ao.DexieError=i8,ao.BulkError=ae;var ah={};let[am,ag,ab]="u"<typeof Promise?[]:(()=>{let e=Promise.resolve();if("u"<typeof crypto||!crypto.subtle)return[e,iA(e),e];let n=crypto.subtle.digest("SHA-512",new Uint8Array([0]));return[n,iA(n),e]})(),ay=ag&&ag.then,a_=am&&am.constructor,av=!!ab;var a$=!1,aA=ab?()=>{ab.then(aV)}:iy.setImmediate?setImmediate.bind(null,aV):iy.MutationObserver?()=>{var e=document.createElement("div");new MutationObserver(()=>{aV(),e=null}).observe(e,{attributes:!0}),e.setAttribute("i","1")}:()=>{setTimeout(aV,0)},aw=function(e,n){aP.push([e,n]),ax&&(aA(),ax=!1)},ak=!0,ax=!0,aC=[],aE=[],aD=null,aS=aa,aM={id:"global",global:!0,ref:0,unhandleds:[],onunhandled:sr,pgp:!1,env:{},finalize:function(){this.unhandleds.forEach(e=>{try{sr(e[0],e[1])}catch(e){}})}},az=aM,aP=[],aO=0,aT=[];function aB(e){if("object"!=typeof this)throw TypeError("Promises must be constructed via new");this._listeners=[],this.onuncatched=ai,this._lib=!1;var n=this._PSD=az;if(iQ&&(this._stackHolder=i2(),this._prev=null,this._numPrev=0),"function"!=typeof e){if(e!==ah)throw TypeError("Not a function");return this._state=arguments[1],this._value=arguments[2],void(!1===this._state&&aj(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&&aG();t&&"function"==typeof t.then?e(n,(e,n)=>{t instanceof aB?t._then(e,n):t.then(e,n)}):(n._state=!0,n._value=t,aR(n)),r&&aU()}},aj.bind(null,n))}catch(e){aj(n,e)}}(this,e)}let aI={get:function(){var e=az,n=aQ;function t(t,r){var o=!e.global&&(e!==az||n!==aQ);let i=o&&!a3();var a=new aB((n,a)=>{aF(this,new aN(se(t,e,o,i),se(r,e,o,i),n,a,e))});return iQ&&aW(a,this),a}return t.prototype=ah,t},set:function(e){iE(this,"then",e&&e.prototype===ah?aI:{get:function(){return e},set:aI.set})}};function aN(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 aj(e,n){if(aE.push(n),null===e._state){var t=e._lib&&aG();n=aS(n),e._state=!1,e._value=n,iQ&&null!==n&&"object"==typeof n&&!n._promise&&function(e){try{e.apply(null,void 0)}catch(e){}}(()=>{var t=iM(n,"stack");n._promise=e,iE(n,"stack",{get:()=>a$?t&&(t.get?t.get.apply(n):t.value):e.stack})}),aC.some(n=>n._value===e._value)||aC.push(e),aR(e),t&&aU()}}function aR(e){var n=e._listeners;e._listeners=[];for(var t=0,r=n.length;t<r;++t)aF(e,n[t]);var o=e._PSD;--o.ref||o.finalize(),0===aO&&(++aO,aw(()=>{0==--aO&&aq()},[]))}function aF(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,++aO,aw(aL,[t,e,n])}else e._listeners.push(n)}function aL(e,n,t){try{aD=n;var r,o=n._value;n._state?r=e(o):(aE.length&&(aE=[]),r=e(o),-1===aE.indexOf(o)&&function(e){for(var n=aC.length;n;)if(aC[--n]._value===e._value)return void aC.splice(n,1)}(n)),t.resolve(r)}catch(e){t.reject(e)}finally{aD=null,0==--aO&&aq(),--t.psd.ref||t.psd.finalize()}}function aW(e,n){var t=n?n._numPrev+1:0;t<100&&(e._prev=n,e._numPrev=t)}function aV(){aG()&&aU()}function aG(){var e=ak;return ak=!1,ax=!1,e}function aU(){var e,n,t;do for(;aP.length>0;)for(e=aP,aP=[],t=e.length,n=0;n<t;++n){var r=e[n];r[0].apply(null,r[1])}while(aP.length>0);ak=!0,ax=!0}function aq(){var e=aC;aC=[],e.forEach(e=>{e._PSD.onunhandled.call(null,e._value,e)});for(var n=aT.slice(0),t=n.length;t;)n[--t]()}function aH(e){return new aB(ah,!1,e)}function aK(e,n){var t=az;return function(){var r=aG(),o=az;try{return a8(t,!0),e.apply(this,arguments)}catch(e){n&&n(e)}finally{a8(o,!1),r&&aU()}}}ix(aB.prototype,{then:aI,_then:function(e,n){aF(this,new aN(null,null,e,n,az))},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):aH(e)):this.then(null,e=>e&&e.name===n?t(e):aH(e))},finally:function(e){return this.then(n=>(e(),n),n=>(e(),aH(n)))},stack:{get:function(){if(this._stack)return this._stack;try{a$=!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=i3(s,0)):(i=s,a=""),t.push(i+(a?": "+a:"")+o)}return iQ&&((o=i3(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{a$=!1}}},timeout:function(e,n){return e<1/0?new aB((t,r)=>{var o=setTimeout(()=>r(new at.Timeout(n)),e);this.then(t,r).finally(clearTimeout.bind(null,o))}):this}}),"u">typeof Symbol&&Symbol.toStringTag&&iE(aB.prototype,Symbol.toStringTag,"Dexie.Promise"),aM.env=a7(),ix(aB,{all:function(){var e=iZ.apply(null,arguments).map(a5);return new aB(function(n,t){0===e.length&&n([]);var r=e.length;e.forEach((o,i)=>aB.resolve(o).then(t=>{e[i]=t,--r||n(e)},t))})},resolve:e=>{if(e instanceof aB)return e;if(e&&"function"==typeof e.then)return new aB((n,t)=>{e.then(n,t)});var n=new aB(ah,!0,e);return aW(n,aD),n},reject:aH,race:function(){var e=iZ.apply(null,arguments).map(a5);return new aB((n,t)=>{e.map(e=>aB.resolve(e).then(n,t))})},PSD:{get:()=>az,set:e=>az=e},totalEchoes:{get:()=>aQ},newPSD:a1,usePSD:a9,scheduler:{get:()=>aw,set:e=>{aw=e}},rejectionMapper:{get:()=>aS,set:e=>{aS=e}},follow:(e,n)=>new aB((t,r)=>a1((n,t)=>{var r=az;r.unhandleds=[],r.onunhandled=t,r.finalize=al(function(){var e;e=()=>{0===this.unhandleds.length?n():t(this.unhandleds[0])},aT.push(function n(){e(),aT.splice(aT.indexOf(n),1)}),++aO,aw(()=>{0==--aO&&aq()},[])},r.finalize),e()},n,t,r))}),a_&&(a_.allSettled&&iE(aB,"allSettled",function(){let e=iZ.apply(null,arguments).map(a5);return new aB(n=>{0===e.length&&n([]);let t=e.length,r=Array(t);e.forEach((e,o)=>aB.resolve(e).then(e=>r[o]={status:"fulfilled",value:e},e=>r[o]={status:"rejected",reason:e}).then(()=>--t||n(r)))})}),a_.any&&"u">typeof AggregateError&&iE(aB,"any",function(){let e=iZ.apply(null,arguments).map(a5);return new aB((n,t)=>{0===e.length&&t(AggregateError([]));let r=e.length,o=Array(r);e.forEach((e,i)=>aB.resolve(e).then(e=>n(e),e=>{o[i]=e,--r||t(AggregateError(o))}))})}));let aY={awaits:0,echoes:0,id:0};var aJ=0,aZ=[],aX=0,aQ=0,a0=0;function a1(e,n,t,r){var o=az,i=Object.create(o);i.parent=o,i.ref=0,i.global=!1,i.id=++a0;var a=aM.env;i.env=av?{Promise:aB,PromiseProp:{value:aB,configurable:!0,writable:!0},all:aB.all,race:aB.race,allSettled:aB.allSettled,any:aB.any,resolve:aB.resolve,reject:aB.reject,nthen:sn(a.nthen,i),gthen:sn(a.gthen,i)}:{},n&&i$(i,n),++o.ref,i.finalize=function(){--this.parent.ref||this.parent.finalize()};var s=a9(i,e,t,r);return 0===i.ref&&i.finalize(),s}function a2(){return aY.id||(aY.id=++aJ),++aY.awaits,aY.echoes+=100,aY.id}function a3(){return!!aY.awaits&&(0==--aY.awaits&&(aY.id=0),aY.echoes=100*aY.awaits,!0)}function a5(e){return aY.echoes&&e&&e.constructor===a_?(a2(),e.then(e=>(a3(),e),e=>(a3(),so(e)))):e}function a4(e){++aQ,aY.echoes&&0!=--aY.echoes||(aY.echoes=aY.id=0),aZ.push(az),a8(e,!0)}function a6(){var e=aZ[aZ.length-1];aZ.pop(),a8(e,!1)}function a8(e,n){var t,r=az;if((n?!aY.echoes||aX++&&e===az:!aX||--aX&&e===az)||(t=n?a4.bind(null,e):a6,ay.call(am,t)),e!==az&&(az=e,r===aM&&(aM.env=a7()),av)){var o=aM.env.Promise,i=e.env;ag.then=i.nthen,o.prototype.then=i.gthen,(r.global||e.global)&&(Object.defineProperty(iy,"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 a7(){var e=iy.Promise;return av?{Promise:e,PromiseProp:Object.getOwnPropertyDescriptor(iy,"Promise"),all:e.all,race:e.race,allSettled:e.allSettled,any:e.any,resolve:e.resolve,reject:e.reject,nthen:ag.then,gthen:e.prototype.then}:{}}function a9(e,n,t,r,o){var i=az;try{return a8(e,!0),n(t,r,o)}finally{a8(i,!1)}}function se(e,n,t,r){return"function"!=typeof e?e:function(){var o,i=az;t&&a2(),a8(n,!0);try{return e.apply(this,arguments)}finally{a8(i,!1),r&&(o=a3,ay.call(am,o))}}}function sn(e,n){return function(t,r){return e.call(this,se(t,n),se(r,n))}}-1===(""+ay).indexOf("[native code]")&&(a2=a3=ai);let st="unhandledrejection";function sr(e,n){var t;try{t=n.onuncatched(e)}catch(e){}if(!1!==t)try{var r,o={promise:n,reason:e};if(iy.document&&document.createEvent?((r=document.createEvent("Event")).initEvent(st,!0,!0),i$(r,o)):iy.CustomEvent&&i$(r=new CustomEvent(st,{detail:o}),o),r&&iy.dispatchEvent&&(dispatchEvent(r),!iy.PromiseRejectionEvent&&iy.onunhandledrejection))try{iy.onunhandledrejection(r)}catch(e){}iQ&&r&&!r.defaultPrevented&&console.warn(`Unhandled rejection: ${e.stack||e}`)}catch(e){}}var so=aB.reject;let si="3.2.7",sa=String.fromCharCode(65535),ss=-1/0,sl="Invalid key provided. Keys must be of type string, number, Date or Array<string | number | Date>.",sc="String expected.",su=[],sp="u">typeof navigator&&/(MSIE|Trident|Edge)/.test(navigator.userAgent),sd=e=>!/(dexie\.js|dexie\.min\.js)/.test(e),sf="__dbnames",sh="readonly",sm="readwrite";function sg(e,n){return e?n?function(){return e.apply(this,arguments)&&n.apply(this,arguments)}:e:n}let sb={type:3,lower:-1/0,lowerOpen:!1,upper:[[]],upperOpen:!1};function sy(e){return"string"!=typeof e||/\./.test(e)?e=>e:n=>(void 0===n[e]&&e in n&&delete(n=iU(n))[e],n)}class s_{_trans(e,n,t){let r=this._tx||az.trans,o=this.name;function i(e,t,r){if(!r.schema[o])throw new at.NotFound("Table "+o+" not part of transaction");return n(r.idbtrans,r)}let a=aG();try{return r&&r.db===this.db?r===az.trans?r._promise(e,i,t):a1(()=>r._promise(e,i,t),{trans:r,transless:az.transless||az}):function e(n,t,r,o){if(n.idbdb&&(n._state.openComplete||az.letThrough||n._vip)){var i=n._createTransaction(t,r,n._dbSchema);try{i.create(),n._state.PR1398_maxLoop=3}catch(i){return i.name===an.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))):so(i)}return i._promise(t,(e,n)=>a1(()=>(az.trans=i,o(e,n,i)))).then(e=>i._completion.then(()=>e))}if(n._state.openComplete)return so(new at.DatabaseClosed(n._state.dbOpenError));if(!n._state.isBeingOpened){if(!n._options.autoOpen)return so(new at.DatabaseClosed);n.open().catch(ai)}return n._state.dbReadyPromise.then(()=>e(n,t,r,o))}(this.db,e,[this.name],i)}finally{a&&aU()}}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(iv(e))return new this.db.WhereClause(this,`[${e.join("+")}]`);let n=i_(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!==sa){let r=t.keyPath.slice(0,n.length);return this.where(r).equals(r.map(n=>e[n]))}!t&&iQ&&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?sg(t,a&&a.multi?e=>{let n=iN(e,o);return iv(n)&&n.some(e=>i(s,e))}:e=>i(s,iN(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,iv(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(ik(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){i$(this,e)})}add(e,n){let{auto:t,keyPath:r}=this.schema.primKey,o=e;return r&&t&&(o=sy(r)(e)),this._trans("readwrite",e=>this.core.mutate({trans:e,type:"add",keys:null!=n?[n]:null,values:[o]})).then(e=>e.numFailures?aB.reject(e.failures[0]):e.lastResult).then(n=>{if(r)try{ij(e,r,n)}catch(e){}return n})}update(e,n){if("object"!=typeof e||iv(e))return this.where(":id").equals(e).modify(n);{let t=iN(e,this.schema.primKey.keyPath);if(void 0===t)return so(new at.InvalidArgument("Given object does not contain its primary key"));try{"function"!=typeof n?i_(n).forEach(t=>{ij(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=sy(r)(e)),this._trans("readwrite",e=>this.core.mutate({trans:e,type:"put",values:[o],keys:null!=n?[n]:null})).then(e=>e.numFailures?aB.reject(e.failures[0]):e.lastResult).then(n=>{if(r)try{ij(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?aB.reject(e.failures[0]):void 0)}clear(){return this._trans("readwrite",e=>this.core.mutate({trans:e,type:"deleteRange",range:sb})).then(e=>e.numFailures?aB.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 at.InvalidArgument("bulkAdd(): keys argument invalid on tables with inbound keys");if(r&&r.length!==e.length)throw new at.InvalidArgument("Arguments objects and keys must have the same length");let a=e.length,s=i&&t?e.map(sy(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 ae(`${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 at.InvalidArgument("bulkPut(): keys argument invalid on tables with inbound keys");if(r&&r.length!==e.length)throw new at.InvalidArgument("Arguments objects and keys must have the same length");let a=e.length,s=i&&t?e.map(sy(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 ae(`${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 ae(`${this.name}.bulkDelete(): ${e} of ${n} operations failed`,r)})}}function sv(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=ad),o||(o=ai);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}i_(e).forEach(function(n){var t=e[n];if(iv(t))i(n,e[n][0],e[n][1]);else{if("asap"!==t)throw new at.InvalidArgument("Invalid event config");var r=i(n,aa,function(){for(var e=arguments.length,n=Array(e);e--;)n[e]=arguments[e];r.subscribers.forEach(function(e){iB(function(){e.apply(null,n)})})})}})}}function s$(e,n){return iD(n).from({prototype:e}),n}function sA(e,n){return!(e.filter||e.algorithm||e.or)&&(n?e.justLimit:!e.replayFilter)}function sw(e,n){e.filter=sg(e.filter,n)}function sk(e,n,t){var r=e.replayFilter;e.replayFilter=r?()=>sg(r(),n()):n,e.justLimit=t&&!r}function sx(e,n){if(e.isPrimKey)return n.primaryKey;let t=n.getIndexByKeyPath(e.index);if(!t)throw new at.Schema("KeyPath "+e.index+" on object store "+n.name+" is not indexed");return t}function sC(e,n,t){let r=sx(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 sE(e,n,t,r){let o=e.replayFilter?sg(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)),ik(i,s)||(i[s]=!0,n(e,t,r))}};return Promise.all([e.or._iterate(a,t),sD(sC(e,r,t),e.algorithm,a,!e.keysOnly&&e.valueMapper)])}return sD(sC(e,r,t),sg(e.algorithm,o),n,!e.keysOnly&&e.valueMapper)}function sD(e,n,t,r){var o=aK(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=ai},n=>{e.fail(n),t=ai})||o(e.value,e,e=>t=e),t()})})}function sS(e,n){try{let t=sM(e),r=sM(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}(sz(e),sz(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=sS(e[t],n[t]);if(0!==r)return r}return t===r?0:t<r?-1:1}(e,n)}}catch(e){}return NaN}function sM(e){let n=typeof e;if("object"!==n)return n;if(ArrayBuffer.isView(e))return"binary";let t=iH(e);return"ArrayBuffer"===t?"binary":t}function sz(e){return e instanceof Uint8Array?e:ArrayBuffer.isView(e)?new Uint8Array(e.buffer,e.byteOffset,e.byteLength):new Uint8Array(e)}class sP{_read(e,n){var t=this._ctx;return t.error?t.table._trans(null,so.bind(null,t.error)):t.table._trans("readonly",e).then(n)}_write(e){var n=this._ctx;return n.error?n.table._trans(null,so.bind(null,n.error)):n.table._trans("readwrite",e,"locked")}_addAlgorithm(e){var n=this._ctx;n.algorithm=sg(n.algorithm,e)}_iterate(e,n){return sE(this._ctx,e,n,this._ctx.table.core)}clone(e){var n=Object.create(this.constructor.prototype),t=Object.create(this._ctx);return e&&i$(t,e),n._ctx=t,n}raw(){return this._ctx.valueMapper=null,this}each(e){var n=this._ctx;return this._read(t=>sE(n,e,t,n.table.core))}count(e){return this._read(e=>{let n=this._ctx,t=n.table.core;if(sA(n,!0))return t.count({trans:e,query:{index:sx(n,t.schema),range:n.range}}).then(e=>Math.min(e,n.limit));var r=0;return sE(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&&sA(n,!0)&&n.limit>0){let{valueMapper:t}=n,r=sx(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 sE(n,e=>t.push(e),e,n.table.core).then(()=>t)}},e)}offset(e){var n=this._ctx;return e<=0||(n.offset+=e,sA(n)?sk(n,()=>{var n=e;return(e,t)=>0===n||(1===n?--n:t(()=>{e.advance(n),n=0}),!1)}):sk(n,()=>{var n=e;return()=>--n<0})),this}limit(e){return this._ctx.limit=Math.min(this._ctx.limit,e),sk(this._ctx,()=>{var n=e;return function(e,t,r){return--n<=0&&t(r),n>=0}},!0),this}until(e,n){return sw(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 sw(this._ctx,function(n){return e(n.value)}),(n=this._ctx).isMatch=sg(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&&sA(n,!0)&&n.limit>0)return this._read(e=>{var t=sx(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 sw(this._ctx,function(e){var n=e.primaryKey.toString(),r=ik(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=i_(e),i=o.length;r=function(n){for(var t=!1,r=0;r<i;++r){var a=o[r],s=e[a];iN(n,a)!==s&&(ij(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,i_(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:iU(n),primKey:o[u+e]};!1!==r.call(t,t.value,t)&&(null==t.value?b.push(o[u+e]):s||0===sS(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=sA(n)&&n.limit===1/0&&("function"!=typeof e||e===sO)&&{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===sO)&&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 i9("Error modifying one or more objects",u,p,d);return o.length})})})}delete(){var e=this._ctx,n=e.range;return sA(e)&&(e.isPrimKey&&!sp||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 i9("Could not delete some values",Object.keys(e).map(n=>e[n]),r-o);return r-o}))}):this.modify(sO)}}let sO=(e,n)=>n.value=null;function sT(e,n){return e<n?-1:+(e!==n)}function sB(e,n){return e>n?-1:+(e!==n)}function sI(e,n,t){var r=e instanceof sL?new e.Collection(e):e;return r._ctx.error=t?new t(n):TypeError(n),r}function sN(e){return new e.Collection(e,()=>sF("")).limit(0)}function sj(e,n,t,r){var o,i,a,s,l,c,u,p=t.length;if(!t.every(e=>"string"==typeof e))return sI(e,sc);function d(e){o="next"===e?e=>e.toUpperCase():e=>e.toLowerCase(),i="next"===e?e=>e.toLowerCase():e=>e.toUpperCase(),a="next"===e?sT:sB;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,()=>sR(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 sR(e,n,t,r){return{type:2,lower:e,upper:n,lowerOpen:t,upperOpen:r}}function sF(e){return{type:1,lower:e,upper:e}}class sL{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)?sN(this):new this.Collection(this,()=>sR(e,n,!t,!r))}catch(e){return sI(this,sl)}}equals(e){return null==e?sI(this,sl):new this.Collection(this,()=>sF(e))}above(e){return null==e?sI(this,sl):new this.Collection(this,()=>sR(e,void 0,!0))}aboveOrEqual(e){return null==e?sI(this,sl):new this.Collection(this,()=>sR(e,void 0,!1))}below(e){return null==e?sI(this,sl):new this.Collection(this,()=>sR(void 0,e,!1,!0))}belowOrEqual(e){return null==e?sI(this,sl):new this.Collection(this,()=>sR(void 0,e))}startsWith(e){return"string"!=typeof e?sI(this,sc):this.between(e,e+sa,!0,!0)}startsWithIgnoreCase(e){return""===e?this.startsWith(e):sj(this,(e,n)=>0===e.indexOf(n[0]),[e],sa)}equalsIgnoreCase(e){return sj(this,(e,n)=>e===n[0],[e],"")}anyOfIgnoreCase(){var e=iZ.apply(iJ,arguments);return 0===e.length?sN(this):sj(this,(e,n)=>-1!==n.indexOf(e),e,"")}startsWithAnyOfIgnoreCase(){var e=iZ.apply(iJ,arguments);return 0===e.length?sN(this):sj(this,(e,n)=>n.some(n=>0===e.indexOf(n)),e,sa)}anyOf(){let e=iZ.apply(iJ,arguments),n=this._cmp;try{e.sort(n)}catch(e){return sI(this,sl)}if(0===e.length)return sN(this);let t=new this.Collection(this,()=>sR(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([[ss,e],[e,this.db._maxKey]],{includeLowers:!1,includeUppers:!1})}noneOf(){let e=iZ.apply(iJ,arguments);if(0===e.length)return new this.Collection(this);try{e.sort(this._ascending)}catch(e){return sI(this,sl)}let n=e.reduce((e,n)=>e?e.concat([[e[e.length-1][1],n]]):[[ss,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 sN(this);if(!e.every(e=>void 0!==e[0]&&void 0!==e[1]&&0>=r(e[0],e[1])))return sI(this,"First argument to inAnyRange() must be an Array of two-value Arrays [lower,upper] where upper must not be lower than lower",at.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 sI(this,sl)}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,()=>sR(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=iZ.apply(iJ,arguments);return e.every(e=>"string"==typeof e)?0===e.length?sN(this):this.inAnyRange(e.map(e=>[e,e+sa])):sI(this,"startsWithAnyOf() only works with strings")}}function sW(e){return aK(function(n){return sV(n),e(n.target.error),!1})}function sV(e){e.stopPropagation&&e.stopPropagation(),e.preventDefault&&e.preventDefault()}let sG="storagemutated",sU="x-storagemutated-1",sq=sv(null,sG);class sH{_lock(){return iT(!az.global),++this._reculock,1!==this._reculock||az.global||(az.lockOwnerFor=this),this}_unlock(){if(iT(!az.global),0==--this._reculock)for(az.global||(az.lockOwnerFor=null);this._blockedFuncs.length>0&&!this._locked();){var e=this._blockedFuncs.shift();try{a9(e[1],e[0])}catch(e){}}return this}_locked(){return this._reculock&&az.lockOwnerFor!==this}create(e){if(!this.mode)return this;let n=this.db.idbdb,t=this.db._state.dbOpenError;if(iT(!this.idbtrans),!e&&!n)switch(t&&t.name){case"DatabaseClosedError":throw new at.DatabaseClosed(t);case"MissingAPIError":throw new at.MissingAPI(t.message,t);default:throw new at.OpenFailed(t)}if(!this.active)throw new at.TransactionInactive;return iT(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=aK(n=>{sV(n),this._reject(e.error)}),e.onabort=aK(n=>{sV(n),this.active&&this._reject(new at.Abort(e.error)),this.active=!1,this.on("abort").fire(n)}),e.oncomplete=aK(()=>{this.active=!1,this._resolve(),"mutatedParts"in e&&sq.storagemutated.fire(e.mutatedParts)}),this}_promise(e,n,t){if("readwrite"===e&&"readwrite"!==this.mode)return so(new at.ReadOnly("Transaction is readonly"));if(!this.active)return so(new at.TransactionInactive);if(this._locked())return new aB((r,o)=>{this._blockedFuncs.push([()=>{this._promise(e,n,t).then(r,o)},az])});if(t)return a1(()=>{var e=new aB((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 aB((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=aB.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 aB((e,r)=>{t.then(t=>n._waitingQueue.push(aK(e.bind(null,t))),e=>n._waitingQueue.push(aK(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 at.Abort))}table(e){let n=this._memoizedTables||(this._memoizedTables={});if(ik(n,e))return n[e];let t=this.schema[e];if(!t)throw new at.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 sK(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?"++":"")+sY(n)}}function sY(e){return"string"==typeof e?e:e?"["+[].join.call(e,"+")+"]":""}function sJ(e,n,t){return{name:e,primKey:n,indexes:t,mappedClass:null,idxByName:iI(t,e=>[e.name,e])}}let sZ=e=>{try{return e.only([[]]),sZ=()=>[[]],[[]]}catch(e){return sZ=()=>sa,sa}};function sX(e){return null==e?()=>{}:"string"==typeof e?1===e.split(".").length?n=>n[e]:n=>iN(n,e):n=>iN(n,e)}function sQ(e){return[].slice.call(e)}let s0=0;function s1(e){return null==e?":id":"string"==typeof e?e:`[${e.join("+")}]`}function s2({_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=sQ(e.objectStoreNames),{schema:{name:e.name,tables:r.map(e=>t.objectStore(e)).map(e=>{let{keyPath:n,autoIncrement:t}=e,r=iv(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:sX(n)},indexes:sQ(e.indexNames).map(n=>e.index(n)).map(e=>{let{name:n,unique:t,multiEntry:r,keyPath:o}=e,a={name:n,compound:iv(o),keyPath:o,unique:t,multiEntry:r,extractKey:sX(o)};return i[s1(o)]=a,a}),getIndexByKeyPath:e=>i[s1(e)]};return i[":id"]=a.primaryKey,null!=n&&(i[s1(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=aK(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,sV(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=aK(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=sW(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=aK(r);let i=e.objectStore(n).get(t);i.onsuccess=e=>r(e.target.result),i.onerror=sW(o)}),query:e=>new Promise((t,r)=>{t=aK(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=sW(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=sW(r)}}),openCursor:function({trans:e,values:t,query:r,reverse:i,unique:a}){return new Promise((s,l)=>{s=aK(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=sW(l),h.onsuccess=aK(n=>{let t=h.result;if(!t)return void s(null);t.___id=++s0,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=aK(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=aK(e),h.onerror=sW(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=aK(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=aK(n=>e(n.target.result)),u.onerror=sW(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:sZ(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 s3({_novip:e},n,t,r){t.forEach(t=>{let o=r[t];n.forEach(n=>{let r=iM(n,t);(!r||"value"in r&&void 0===r.value)&&(n===e.Transaction.prototype||n instanceof e.Transaction?iE(n,t,{get(){return this.table(t)},set(e){iC(this,t,{value:e,writable:!0,configurable:!0,enumerable:!0})}}):n[t]=new e.Table(t,o))})})}function s5({_novip:e},n){n.forEach(n=>{for(let t in n)n[t]instanceof e.Table&&delete n[t]})}function s4(e,n){return e._cfg.version-n._cfg.version}function s6(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||sp)){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 s8(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=>s7(o,e)),o}function s7(e,n){e.createIndex(n.name,n.keyPath,{unique:n.unique,multiEntry:n.multi})}function s9(e,n,t){let r={};return iP(n.objectStoreNames,0).forEach(e=>{let n=t.objectStore(e),o=n.keyPath,i=sK(sY(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=sK(t.name,o,!!t.unique,!!t.multiEntry,!1,o&&"string"!=typeof o,!1);a.push(s)}r[e]=sJ(e,i,a)}),r}function le({_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:"["+iP(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)&&iy.WorkerGlobalScope&&iy instanceof iy.WorkerGlobalScope&&[].concat(navigator.userAgent.match(/Safari\/(\d*)/))[1]<604&&(e._hasGetAll=!1)}class ln{_parseStoresSpec(e,n){i_(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 sK(t,r||null,/\&/.test(e),/\*/.test(e),/\+\+/.test(e),iv(r),0===n)}),o=r.shift();if(o.multi)throw new at.Schema("Primary key cannot be multi-valued");r.forEach(e=>{if(e.auto)throw new at.Schema("Only primary key can be marked as autoIncrement (++)");if(!e.keyPath)throw new at.Schema("Index must have a name and cannot be an empty string")}),n[t]=sJ(t,o,r)}})}stores(e){let n=this.db;this._cfg.storesSource=this._cfg.storesSource?i$(this._cfg.storesSource,e):e;let t=n._versions,r={},o={};return t.forEach(e=>{i$(r,e._cfg.storesSource),o=e._cfg.dbschema={},e._parseStoresSpec(r,o)}),n._dbSchema=o,s5(n,[n._allTables,n,n.Transaction.prototype]),s3(n,[n._allTables,n,n.Transaction.prototype,this._cfg.tables],i_(o),o),n._storeNames=i_(o),this}upgrade(e){return this._cfg.contentUpgrade=af(this._cfg.contentUpgrade||ai,e),this}}function lt(e,n){let t=e._dbNamesDB;return t||(t=e._dbNamesDB=new l$(sf,{addons:[],indexedDB:e,IDBKeyRange:n})).version(1).stores({dbnames:"name"}),t.table("dbnames")}function lr(e){return e&&"function"==typeof e.databases}function lo(e){return a1(function(){return az.letThrough=!0,e()})}function li(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):iv(i)?Promise.all(i).then(t,r):t(i)}}return o(n)()}function la(e,n,t){var r=arguments.length;if(r<2)throw new at.InvalidArgument("Too few arguments");for(var o=Array(r-1);--r;)o[r-1]=arguments[r];return t=o.pop(),[e,iL(o),t]}function ls(e,n,t){let r=iv(e)?e.slice():[e];for(let e=0;e<t;++e)r.push(n);return r}let ll={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=s1(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:sX(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:ls(t.lower,t.lowerOpen?e.MAX_KEY:e.MIN_KEY,r),lowerOpen:!0,upper:ls(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[s1(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(ls(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(ls(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 lc(e,n,t,r){return t=t||{},r=r||"",i_(e).forEach(o=>{if(ik(n,o)){var i=e[o],a=n[o];if("object"==typeof i&&"object"==typeof a&&i&&a){let e=iH(i);e!==iH(a)?t[r+o]=n[o]:"Object"===e?lc(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}),i_(n).forEach(o=>{ik(e,o)||(t[r+o]=n[o])}),t}let lu={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=az.trans,{deleting:i,creating:a,updating:s}=o.table(n).hook;switch(e.type){case"add":if(a.fire===ai)break;return o._promise("readwrite",()=>l(e),!0);case"put":if(a.fire===ai&&s.fire===ai)break;return o._promise("readwrite",()=>l(e),!0);case"delete":if(i.fire===ai)break;return o._promise("readwrite",()=>l(e),!0);case"deleteRange":if(i.fire===ai)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=az.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||ij(e.values[o],r.keyPath,t))}else{let n=lc(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=>{ik(n,e)?n[e]=r[e]:ij(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 lp(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===sS(n.keys[o],e[i])&&(r.push(t?iU(n.values[o]):n.values[o]),++i);return r.length===e.length?r:null}catch(e){return null}}let ld={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=lp(e.keys,e.trans._cache,"clone"===e.cache);return n?aB.resolve(n):t.getMany(e).then(n=>(e.trans._cache={keys:e.keys,values:"clone"===e.cache?iU(n):n},n))},mutate:e=>("add"!==e.type&&(e.trans._cache=null),t.mutate(e))}}})};function lf(e){return!("from"in e)}let lh=function(e,n){if(!this){let n=new lh;return e&&"d"in e&&i$(n,e),n}i$(this,arguments.length?{d:1,from:e,to:arguments.length>1?n:e}:{d:0})};function lm(e,n,t){let r=sS(n,t);if(isNaN(r))return;if(r>0)throw RangeError();if(lf(e))return i$(e,{from:n,to:t,d:1});let o=e.l,i=e.r;if(0>sS(t,e.from))return o?lm(o,n,t):e.l={from:n,to:t,d:1,l:null,r:null},ly(e);if(sS(n,e.to)>0)return i?lm(i,n,t):e.r={from:n,to:t,d:1,l:null,r:null},ly(e);0>sS(n,e.from)&&(e.from=n,e.l=null,e.d=i?i.d+1:1),sS(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&&lg(e,o),i&&a&&lg(e,i)}function lg(e,n){lf(n)||function e(n,{from:t,to:r,l:o,r:i}){lm(n,t,r),o&&e(n,o),i&&e(n,i)}(e,n)}function lb(e){let n=lf(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>sS(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>=sS(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 ly(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=l_(t)}e.d=l_(e)}function l_({r:e,l:n}){return(e?n?Math.max(e.d,n.d):e.d:n?n.d:0)+1}ix(lh.prototype,{add(e){return lg(this,e),this},addKey(e){return lm(this,e,e),this},addKeys(e){return e.forEach(e=>lm(this,e,e)),this},[iK](){return lb(this)}});let lv={stack:"dbcore",level:0,create:e=>{let n=e.schema.name,t=new lh(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 lh)},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(iv(d)){"delete"!==p&&(d=e.results),c.addKeys(d);let n=lp(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&&iv(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!==sS(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 lh(null!=(r=t.lower)?r:e.MIN_KEY,null!=(o=t.upper)?o:e.MAX_KEY)]},p={get:e=>[a,new lh(e.key)],getMany:e=>[a,(new lh).addKeys(e.keys)],count:u,query:u,openCursor:u};return i_(p).forEach(e=>{c[e]=function(i){let{subscr:a}=az;if(a){let c=e=>{let t=`idb://${n}/${r}/${e}`;return a[t]||(a[t]=new lh)},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 l${constructor(e,n){var t;this._middlewares={},this.verno=0;const r=l$.dependencies;this._options=n={addons:l$.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:ai,dbReadyPromise:null,cancelOpen:ai,openCanceller:null,autoSchema:!0,PR1398_maxLoop:3};i.dbReadyPromise=new aB(e=>{i.dbReadyResolve=e}),i.openCanceller=new aB((e,n)=>{i.cancelOpen=n}),this._state=i,this.name=e,this.on=sv(this,"populate","blocked","versionchange","close",{ready:[af,ai]}),this.on.ready.subscribe=iO(this.on.ready.subscribe,e=>(n,t)=>{l$.vip(()=>{let r=this._state;if(r.openComplete)r.dbOpenError||aB.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,s$(sP.prototype,function(e,n){this.db=t;let r=sb,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!==aa?s:null}})),this.Table=function(e){return s$(s_.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:sv(null,{creating:[ac,ai],reading:[as,aa],updating:[ap,ai],deleting:[au,ai]})})}(this),this.Transaction=function(e){return s$(sH.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=sv(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 aB((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(),so(e)})})}(this),this.Version=function(e){return s$(ln.prototype,function(n){this.db=e,this._cfg={version:n,storesSource:null,dbschema:{},tables:{},contentUpgrade:null}})}(this),this.WhereClause=function(e){return s$(sL.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 at.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=sZ(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),su.filter(e=>e.name===this.name&&e!==this&&!e._state.vcFired).map(n=>n.on("versionchange").fire(e))},this.use(ll),this.use(lu),this.use(lv),this.use(ld),this.vip=Object.create(this,{_vip:{value:!0}}),o.forEach(e=>e(this))}version(e){if(isNaN(e)||e<.1)throw new at.Type("Given version is not a positive number");if(e=Math.round(10*e)/10,this.idbdb||this._state.isBeingOpened)throw new at.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(s4),t.stores({}),this._state.autoSchema=!1,t)}_whenReady(e){return this.idbdb&&(this._state.openComplete||az.letThrough||this._vip)?e():new aB((e,n)=>{if(this._state.openComplete)return n(new at.DatabaseClosed(this._state.dbOpenError));if(!this._state.isBeingOpened){if(!this._options.autoOpen)return void n(new at.DatabaseClosed);this.open().catch(ai)}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?so(t.dbOpenError):e);iQ&&(t.openCanceller._stackHolder=i2()),t.isBeingOpened=!0,t.dbOpenError=null,t.openComplete=!1;let o=t.openCanceller;function i(){if(t.openCanceller!==o)throw new at.DatabaseClosed("db.open() was cancelled")}let a=t.dbReadyResolve,s=null,l=!1,c=()=>new aB((n,o)=>{if(i(),!r)throw new at.MissingAPI;let a=e.name,c=t.autoSchema?r.open(a):r.open(a,Math.round(10*e.verno));if(!c)throw new at.MissingAPI;c.onerror=sW(o),c.onblocked=aK(e._fireOnBlocked),c.onupgradeneeded=aK(n=>{if(s=c.transaction,t.autoSchema&&!e._options.allowEmptyDB){c.onerror=sV,s.abort(),c.result.close();let e=r.deleteDatabase(a);e.onsuccess=e.onerror=aK(()=>{o(new at.NoSuchDatabase(`Database ${a} doesnt exist`))})}else{let t,r,a,d;s.onerror=sW(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=az.transless||az,a1(()=>{az.trans=r,az.transless=d,0===i?(i_(t).forEach(e=>{s8(u,e,t[e].primKey,t[e].indexes)}),s2(e,u),aB.follow(()=>e.on.populate.fire(r)).catch(a)):(function({_novip:e},n,t,r){let o=[],i=e._versions,a=e._dbSchema=s9(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;le(e,o,r),le(e,l,r),a=e._dbSchema=l;let c=s6(o,l);c.add.forEach(e=>{s8(r,e[0],e[1].primKey,e[1].indexes)}),c.change.forEach(e=>{if(e.recreate)throw new at.Upgrade("Not yet support for changing primary key");{let n=r.objectStore(e.name);e.add.forEach(e=>s7(n,e)),e.change.forEach(e=>{n.deleteIndex(e.name),s7(n,e)}),e.del.forEach(e=>n.deleteIndex(e))}});let u=i._cfg.contentUpgrade;if(u&&i._cfg.version>n){let n;s2(e,r),t._memoizedTables={},s=!0;let i=iR(l);c.del.forEach(e=>{i[e]=o[e]}),s5(e,[e.Transaction.prototype]),s3(e,[e.Transaction.prototype],i_(i),i),t.schema=i;let a=iX(u);a&&a2();let p=aB.follow(()=>{if((n=u(t))&&a){var e=a3.bind(null,null);n.then(e,e)}});return n&&"function"==typeof n.then?aB.resolve(n):p.then(()=>n)}}),o.push(n=>{var r;s&&sp||(r=i._cfg.dbschema,[].slice.call(n.db.objectStoreNames).forEach(e=>null==r[e]&&n.db.deleteObjectStore(e))),s5(e,[e.Transaction.prototype]),s3(e,[e.Transaction.prototype],e._storeNames,e._dbSchema),t.schema=e._dbSchema})}),(function e(){return o.length?aB.resolve(o.shift()(t.idbtrans)).then(e):aB.resolve()})().then(()=>{var e;i_(e=a).forEach(n=>{r.db.objectStoreNames.contains(n)||s8(r,n,e[n].primKey,e[n].indexes)})})})(e,i,r,u).catch(a)})}},o),c.onsuccess=aK(()=>{s=null;let r=e._novip.idbdb=c.result,o=iP(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=s9(0,n,t);e._storeNames=iP(n.objectStoreNames,0),s3(e,[e._allTables],i_(r),r)}(e,r,i):(le(e,e._dbSchema,i),((n=s6(s9(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.")),s2(e,i)}catch(e){}su.push(e),r.onversionchange=aK(n=>{t.vcFired=!0,e.on("versionchange").fire(n)}),r.onclose=aK(n=>{e.on("close").fire(n)}),l&&function({indexedDB:e,IDBKeyRange:n},t){lr(e)||t===sf||lt(e,n).put({name:t}).catch(ai)}(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()):aB.reject(e));return aB.race([o,("u"<typeof navigator?aB.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=[],aB.resolve(lo(()=>e.on.ready.fire(e.vip))).then(function n(){if(t.onReadyBeingFired.length>0){let r=t.onReadyBeingFired.reduce(af,ai);return t.onReadyBeingFired=[],aB.resolve(lo(()=>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(),so(n)}).finally(()=>{t.openComplete=!0,a()})}(this)}_close(){let e=this._state,n=su.indexOf(this);if(n>=0&&su.splice(n,1),this.idbdb){try{this.idbdb.close()}catch(e){}this._novip.idbdb=null}e.dbReadyPromise=new aB(n=>{e.dbReadyResolve=n}),e.openCanceller=new aB((n,t)=>{e.cancelOpen=t})}close(){this._close();let e=this._state;this._options.autoOpen=!1,e.dbOpenError=new at.DatabaseClosed,e.isBeingOpened&&e.cancelOpen(e.dbOpenError)}delete(){let e=arguments.length>0,n=this._state;return new aB((t,r)=>{let o=()=>{this.close();var e=this._deps.indexedDB.deleteDatabase(this.name);e.onsuccess=aK(()=>{!function({indexedDB:e,IDBKeyRange:n},t){lr(e)||t===sf||lt(e,n).delete(t).catch(ai)}(this._deps,this.name),t()}),e.onerror=sW(r),e.onblocked=this._fireOnBlocked};if(e)throw new at.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 i_(this._allTables).map(e=>this._allTables[e])}transaction(){let e=la.apply(this,arguments);return this._transaction.apply(this,e)}_transaction(e,n,t){let r,o,i=az.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===sh)r=sh;else{if("rw"!=e&&e!=sm)throw new at.InvalidArgument("Invalid transaction mode: "+e);r=sm}if(i){if(i.mode===sh&&r===sm){if(!a)throw new at.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 at.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)}):so(e)}let s=(function e(n,t,r,o,i){return aB.resolve().then(()=>{let a,s=az.transless||az,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===an.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))):so(o)}let c=iX(i);c&&a2();let u=aB.follow(()=>{if(a=i.call(l,l))if(c){var e=a3.bind(null,null);a.then(e,e)}else"function"==typeof a.next&&"function"==typeof a.throw&&(a=li(a))},{trans:l,transless:s});return(a&&"function"==typeof a.then?aB.resolve(a).then(e=>l.active?e:so(new at.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),so(e)))})}).bind(null,this,r,o,i,t);return i?i._promise(r,s,"lock"):az.trans?a9(az.transless,()=>this._whenReady(s)):this._whenReady(s)}table(e){if(!ik(this._allTables,e))throw new at.InvalidTable(`Table ${e} does not exist`);return this._allTables[e]}}let lA="u">typeof Symbol&&"observable"in Symbol?Symbol.observable:"@@observable";class lw{constructor(e){this._subscribe=e}subscribe(e,n,t){return this._subscribe(e&&"function"!=typeof e?e:{next:e,error:n,complete:t})}[lA](){return this}}function lk(e,n){return i_(n).forEach(t=>{lg(e[t]||(e[t]=new lh),n[t])}),e}try{o={indexedDB:iy.indexedDB||iy.mozIndexedDB||iy.webkitIndexedDB||iy.msIndexedDB,IDBKeyRange:iy.IDBKeyRange||iy.webkitIDBKeyRange}}catch(e){o={indexedDB:null,IDBKeyRange:null}}function lx(e){let n=lC;try{lC=!0,sq.storagemutated.fire(e)}finally{lC=n}}ix(l$,{...ao,delete:e=>new l$(e,{addons:[]}).delete(),exists:e=>new l$(e,{addons:[]}).open().then(e=>(e.close(),!0)).catch("NoSuchDatabaseError",()=>!1),getDatabaseNames(e){try{return(function({indexedDB:e,IDBKeyRange:n}){return lr(e)?Promise.resolve(e.databases()).then(e=>e.map(e=>e.name).filter(e=>e!==sf)):lt(e,n).toCollection().primaryKeys()})(l$.dependencies).then(e)}catch(e){return so(new at.MissingAPI)}},defineClass:()=>function(e){i$(this,e)},ignoreTransaction:e=>az.trans?a9(az.transless,e):e(),vip:lo,async:function(e){return function(){try{var n=li(e.apply(this,arguments));return n&&"function"==typeof n.then?n:aB.resolve(n)}catch(e){return so(e)}}},spawn:function(e,n,t){try{var r=li(e.apply(t,n||[]));return r&&"function"==typeof r.then?r:aB.resolve(r)}catch(e){return so(e)}},currentTransaction:{get:()=>az.trans||null},waitFor:function(e,n){let t=aB.resolve("function"==typeof e?l$.ignoreTransaction(e):e).timeout(n||6e4);return az.trans?az.trans.waitFor(t):t},Promise:aB,debug:{get:()=>iQ,set:e=>{iQ=e,i0="dexie"===e?()=>!0:sd}},derive:iD,extend:i$,props:ix,override:iO,Events:sv,on:sq,liveQuery:function(e){let n,t=!1,r=new lw(r=>{let o=iX(e),i=!1,a={},s={},l={get closed(){return i},unsubscribe:()=>{i=!0,sq.storagemutated.unsubscribe(d)}};r.start&&r.start(l);let c=!1,u=!1;function p(){return i_(s).some(e=>a[e]&&function(e,n){let t=lb(n),r=t.next();if(r.done)return!1;let o=r.value,i=lb(e),a=i.next(o.from),s=a.value;for(;!r.done&&!a.done;){if(0>=sS(s.from,o.to)&&sS(s.to,o.from)>=0)return!0;0>sS(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=>{lk(a,e),p()&&f()},f=()=>{let h,m;if(c||i)return;a={};let g={},b=(o&&a2(),h=()=>a1(e,{subscr:g,trans:null}),m=az.trans?a9(az.transless,h):h(),o&&m.then(a3,a3),m);u||(sq(sG,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:lk,getByKeyPath:iN,setByKeyPath:ij,delByKeyPath:function(e,n){"string"==typeof n?ij(e,n,void 0):"length"in n&&[].map.call(n,function(n){ij(e,n,void 0)})},shallowClone:iR,deepClone:iU,getObjectDiff:lc,cmp:sS,asap:iB,minKey:ss,addons:[],connections:su,errnames:an,dependencies:o,semVer:si,version:si.split(".").map(e=>parseInt(e)).reduce((e,n,t)=>e+n/Math.pow(10,2*t))}),l$.maxKey=sZ(l$.dependencies.IDBKeyRange),"u">typeof dispatchEvent&&"u">typeof addEventListener&&(sq(sG,e=>{if(!lC){let n;sp?(n=document.createEvent("CustomEvent")).initCustomEvent(sU,!0,!0,e):n=new CustomEvent(sU,{detail:e}),lC=!0,dispatchEvent(n),lC=!1}}),addEventListener(sU,({detail:e})=>{lC||lx(e)}));let lC=!1;if("u">typeof BroadcastChannel){let e=new BroadcastChannel(sU);"function"==typeof e.unref&&e.unref(),sq(sG,n=>{lC||e.postMessage(n)}),e.onmessage=e=>{e.data&&lx(e.data)}}else if("u">typeof self&&"u">typeof navigator){sq(sG,e=>{try{lC||("u">typeof localStorage&&localStorage.setItem(sU,JSON.stringify({trig:Math.random(),changedParts:e})),"object"==typeof self.clients&&[...self.clients.matchAll({includeUncontrolled:!0})].forEach(n=>n.postMessage({type:sU,changedParts:e})))}catch(e){}}),"u">typeof addEventListener&&addEventListener("storage",e=>{if(e.key===sU){let n=JSON.parse(e.newValue);n&&lx(n.changedParts)}});let e=self.document&&navigator.serviceWorker;e&&e.addEventListener("message",function({data:e}){e&&e.type===sU&&lx(e.changedParts)})}function lE(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}aB.rejectionMapper=function(e,n){if(!e||e instanceof i8||e instanceof TypeError||e instanceof SyntaxError||!e.name||!ar[e.name])return e;var t=new ar[e.name](n||e.message,e);return"stack"in e&&iE(t,"stack",{get:function(){return this.inner.stack}}),t},i0=sd;class lD extends l${constructor(){super("EsmOffline"),lE(this,"syncQueue",void 0),lE(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 lS(){return new lD}let lM=new lD,lz={};async function lP(){let e=await r6();return e?.uuid||"*"}async function lO(e,n,t,r){let o=r&&r.id;return void 0!==o&&await lM.syncQueue.where({type:n,userId:e}).filter(e=>e?.descriptor.id===o).delete().catch(l$.errnames.DatabaseClosed),await lM.syncQueue.add({type:n,content:t,userId:e,descriptor:r||{},createdOn:new Date}).catch(l$.errnames.DatabaseClosed,()=>-1)}async function lT(e,n,t){let r=await lP();return await lO(r,e,n,t)}async function lB(e,n){return(await lI(e,n)).map(e=>e.content)}async function lI(e,n){return await lM.syncQueue.where(n?{type:n,userId:e}:{userId:e}).toArray().catch(l$.errnames.DatabaseClosed,()=>[])}async function lN(e){let n=await lP();return await lB(n,e)}async function lj(e){let n=await lP();return await lI(n,e)}async function lR(e){return await lM.syncQueue.get(e).catch(l$.errnames.DatabaseClosed,()=>void 0)}function lF(e){return!!lz[e]?.options.onBeginEditSyncItem}async function lL(e){let n=await lR(e);if(!n)throw Error(`No sync item with the ID ${e} exists.`);let t=lz[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 lW(e){await lM.syncQueue.delete(e).catch(l$.errnames.DatabaseClosed)}function lV(e,n,t,r={}){lz[e]={type:e,dependsOn:n,process:t,options:r}}L("offline-synchronization",{});let lG={};function lU(){return Object.values(lG)}function lq(e){lG[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.`),lG[e.id]=e}async function lH(e){let n=await l1();return await lK(n,e)}async function lK(e,n){let t=new lD;return await t.dynamicOfflineData.where(n?{type:n,users:e}:{users:e}).toArray().catch(l$.errnames.DatabaseClosed,()=>[])}async function lY(e,n){let t=await l1();return await lJ(t,e,n)}async function lJ(e,n,t){let r=new lD,o=await r.dynamicOfflineData.get({type:n,identifier:t}).catch(l$.errnames.DatabaseClosed,()=>void 0);o?o.users.includes(e)||await r.dynamicOfflineData.update(o.id,{users:[...o.users,e]}).catch(l$.errnames.DatabaseClosed):await r.dynamicOfflineData.add({users:[e],type:n,identifier:t}).catch(l$.errnames.DatabaseClosed)}async function lZ(e,n){let t=await l1();return await lX(t,e,n)}async function lX(e,n,t){let r=new lD,o=await r.dynamicOfflineData.get({type:n,identifier:t,users:e}).catch(l$.errnames.DatabaseClosed,()=>void 0);o&&(o.users.length>1?await r.dynamicOfflineData.update(o.id,{users:o.users.filter(n=>n!==e)}).catch(l$.errnames.DatabaseClosed):await r.dynamicOfflineData.delete(o.id).catch(l$.errnames.DatabaseClosed))}async function lQ(e,n){let t=await lH(e);await Promise.all(t.map(async e=>l0(e.type,e.identifier,n)))}async function l0(e,n,t){await lY(e,n);let r=new lD,o=await l1(),i=await r.dynamicOfflineData.get({type:e,identifier:n}).catch(l$.errnames.DatabaseClosed,()=>void 0),a=lU().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(l$.errnames.DatabaseClosed)}async function l1(){let e=(await r6()).uuid;if(!e)throw Error("Using the dynamic offline data API requires a logged in user.");return e}let l2=L("offline-patients",{offlinePatientDataSyncState:{},handlers:{}});function l3(){return l6(),l2}function l5(e,n){l6(),lq({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 l4(e){l6(),await l0("patient",e)}function l6(){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 l8(e,n,t=!0){if(e){let r=null,[o,i]=await Promise.all([rY(`${rq}/Patient/${e}`,n).catch(e=>r=e),t?l7(e):Promise.resolve(null)]);if(o.ok)return o.data;if(i)return i;if(r)throw r}return null}async function l7(e){let n=(await lN("patient-registration")).find(n=>n.fhirPatient.id===e);return n?.fhirPatient??null}function l9(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 ce=((Q={}).NEWVISIT="startVisit",Q.EDITVISIT="editVisit",Q.LOADING="loadingVisit",Q),cn=((ee={}).NOTSTARTED="notStarted",ee.ONGOING="ongoing",ee);let ct="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))",cr=function(){try{return JSON.parse(sessionStorage.getItem("openmrs:visitStoreState")||"null")}catch(e){return null}}()||{patientUuid:null,manuallySetVisitUuid:null,mutateVisitCallbacks:{}};function co(){return W("visit",cr)}function ci(e,n){co().setState({patientUuid:e,manuallySetVisitUuid:n})}function ca(e,n){return rY(`${rU}/visit`,{signal:n.signal,method:"POST",headers:{"Content-type":"application/json"},body:e})}function cs(e,n,t){return rY(`${rU}/visit/${e}`,{signal:t.signal,method:"POST",headers:{"Content-type":"application/json"},body:n})}function cl(e,n,t){return rY(`${rU}/visit?patient=${e}&v=${t??ct}`,{signal:n.signal,method:"GET",headers:{"Content-type":"application/json"}})}co().subscribe(e=>{var n;n=e,sessionStorage.setItem("openmrs:visitStoreState",JSON.stringify(n))});let cc=new er.BehaviorSubject(null);var cu=t(33789);function cp(e){return{uuid:e.uuid,display:e.display,name:e.name}}function cd(){return rJ(`${rU}/visittype`).pipe((0,cu.map)(e=>e.data.results.map(cp))).pipe((0,cu.take)(1))}function cf(e){return{uuid:e.uuid,display:e.display}}function ch(e=null,n=null){let t=new URLSearchParams;e&&t.set("tag",e),n&&t.set("q",n);let r=t.toString();return rJ(`${rU}/location${r?"?"+r:""}`).pipe((0,cu.map)(e=>e.data.results.map(cf))).pipe((0,cu.take)(1))}class cm{static get version(){return"1.4.0"}static toString(){return"JavaScript Expression Parser (JSEP) v"+cm.version}static addUnaryOp(e){return cm.max_unop_len=Math.max(e.length,cm.max_unop_len),cm.unary_ops[e]=1,cm}static addBinaryOp(e,n,t){return cm.max_binop_len=Math.max(e.length,cm.max_binop_len),cm.binary_ops[e]=n,t?cm.right_associative.add(e):cm.right_associative.delete(e),cm}static addIdentifierChar(e){return cm.additional_identifier_chars.add(e),cm}static addLiteral(e,n){return cm.literals[e]=n,cm}static removeUnaryOp(e){return delete cm.unary_ops[e],e.length===cm.max_unop_len&&(cm.max_unop_len=cm.getMaxKeyLen(cm.unary_ops)),cm}static removeAllUnaryOps(){return cm.unary_ops={},cm.max_unop_len=0,cm}static removeIdentifierChar(e){return cm.additional_identifier_chars.delete(e),cm}static removeBinaryOp(e){return delete cm.binary_ops[e],e.length===cm.max_binop_len&&(cm.max_binop_len=cm.getMaxKeyLen(cm.binary_ops)),cm.right_associative.delete(e),cm}static removeAllBinaryOps(){return cm.binary_ops={},cm.max_binop_len=0,cm}static removeLiteral(e){return delete cm.literals[e],cm}static removeAllLiterals(){return cm.literals={},cm}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 cm(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 cm.binary_ops[e]||0}static isIdentifierStart(e){return e>=65&&e<=90||e>=97&&e<=122||e>=128&&!cm.binary_ops[String.fromCharCode(e)]||cm.additional_identifier_chars.has(String.fromCharCode(e))}static isIdentifierPart(e){return cm.isIdentifierStart(e)||cm.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(cm.hooks[e]){let t={context:this,node:n};return cm.hooks.run(e,t),t.node}return n}searchHook(e){if(cm.hooks[e]){let n={context:this};return cm.hooks[e].find(function(e){return e.call(n.context,n),n.node}),n.node}}gobbleSpaces(){let e=this.code;for(;e===cm.SPACE_CODE||e===cm.TAB_CODE||e===cm.LF_CODE||e===cm.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:cm.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)===cm.SEMCOL_CODE||t===cm.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,cm.max_binop_len),n=e.length;for(;n>0;){if(cm.binary_ops.hasOwnProperty(e)&&(!cm.isIdentifierStart(this.code)||this.index+e.length<this.expr.length&&!cm.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:cm.binaryPrecedence(n),right_a:cm.right_associative.has(n)},(a=this.gobbleToken())||this.throwError("Expected expression after "+n),r=[i,o,a];n=this.gobbleBinaryOp();){if(0===(t=cm.binaryPrecedence(n))){this.index-=n.length;break}o={value:n,prec:t,right_a:cm.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:cm.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:cm.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,cm.isDecimalDigit(e)||e===cm.PERIOD_CODE)return this.gobbleNumericLiteral();if(e===cm.SQUOTE_CODE||e===cm.DQUOTE_CODE)r=this.gobbleStringLiteral();else if(e===cm.OBRACK_CODE)r=this.gobbleArray();else{for(t=(n=this.expr.substr(this.index,cm.max_unop_len)).length;t>0;){if(cm.unary_ops.hasOwnProperty(n)&&(!cm.isIdentifierStart(this.code)||this.index+n.length<this.expr.length&&!cm.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:cm.UNARY_EXP,operator:n,argument:e,prefix:!0})}n=n.substr(0,--t)}cm.isIdentifierStart(e)?(r=this.gobbleIdentifier(),cm.literals.hasOwnProperty(r.name)?r={type:cm.LITERAL,value:cm.literals[r.name],raw:r.name}:r.name===cm.this_str&&(r={type:cm.THIS_EXP})):e===cm.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===cm.PERIOD_CODE||n===cm.OBRACK_CODE||n===cm.OPAREN_CODE||n===cm.QUMARK_CODE;){let t;if(n===cm.QUMARK_CODE){if(this.expr.charCodeAt(this.index+1)!==cm.PERIOD_CODE)break;t=!0,this.index+=2,this.gobbleSpaces(),n=this.code}this.index++,n===cm.OBRACK_CODE?((e={type:cm.MEMBER_EXP,computed:!0,object:e,property:this.gobbleExpression()}).property||this.throwError('Unexpected "'+this.char+'"'),this.gobbleSpaces(),(n=this.code)!==cm.CBRACK_CODE&&this.throwError("Unclosed ["),this.index++):n===cm.OPAREN_CODE?e={type:cm.CALL_EXP,arguments:this.gobbleArguments(cm.CPAREN_CODE),callee:e}:(n===cm.PERIOD_CODE||t)&&(t&&this.index--,this.gobbleSpaces(),e={type:cm.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(;cm.isDecimalDigit(this.code);)e+=this.expr.charAt(this.index++);if(this.code===cm.PERIOD_CODE)for(e+=this.expr.charAt(this.index++);cm.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++));cm.isDecimalDigit(this.code);)e+=this.expr.charAt(this.index++);cm.isDecimalDigit(this.expr.charCodeAt(this.index-1))||this.throwError("Expected exponent ("+e+this.char+")")}return t=this.code,cm.isIdentifierStart(t)?this.throwError("Variable names cannot start with a number ("+e+this.char+")"):(t===cm.PERIOD_CODE||1===e.length&&e.charCodeAt(0)===cm.PERIOD_CODE)&&this.throwError("Unexpected period"),{type:cm.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:cm.LITERAL,value:e,raw:this.expr.substring(n,this.index)}}gobbleIdentifier(){let e=this.code,n=this.index;for(cm.isIdentifierStart(e)?this.index++:this.throwError("Unexpected "+this.char);this.index<this.expr.length;)if(e=this.code,cm.isIdentifierPart(e))this.index++;else break;return{type:cm.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===cm.CPAREN_CODE&&r&&r>=n.length&&this.throwError("Unexpected token "+String.fromCharCode(e));break}if(o===cm.COMMA_CODE){if(this.index++,++r!==n.length){if(e===cm.CPAREN_CODE)this.throwError("Unexpected token ,");else if(e===cm.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!==cm.COMPOUND||this.throwError("Expected comma"),n.push(e)}}return t||this.throwError("Expected "+String.fromCharCode(e)),n}gobbleGroup(){this.index++;let e=this.gobbleExpressions(cm.CPAREN_CODE);if(this.code===cm.CPAREN_CODE)return(this.index++,1===e.length)?e[0]:!!e.length&&{type:cm.SEQUENCE_EXP,expressions:e};this.throwError("Unclosed (")}gobbleArray(){return this.index++,{type:cm.ARRAY_EXP,elements:this.gobbleArguments(cm.CBRACK_CODE)}}}Object.assign(cm,{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)})}}(cm),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"}),cm.max_unop_len=cm.getMaxKeyLen(cm.unary_ops),cm.max_binop_len=cm.getMaxKeyLen(cm.binary_ops);let cg=e=>new cm(e).parse(),cb=Object.getOwnPropertyNames(class{});Object.getOwnPropertyNames(cm).filter(e=>!cb.includes(e)&&void 0===cg[e]).forEach(e=>{cg[e]=cm[e]}),cg.Jsep=cm,cg.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 cy="ArrowFunctionExpression",c_={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)}},cv={...c_,Promise};function c$(e,n={}){return cE(e,n,cM)}async function cA(e,n={}){return cD(e,n,cM)}function cw(e,n={}){return cE(e,n,cz)}function ck(e,n={}){return cD(e,n,cz)}function cx(e,n={}){return cE(e,n,cP)}function cC(e,n={}){return cD(e,n,cP)}function cE(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=cB(n,c_),o=cO("string"==typeof e?cg(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 cD(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=cB(n,cv);return Promise.resolve(cO("string"==typeof e?cg(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 cS(e){return cg(e)}function cM(e){return"string"==typeof e||"number"==typeof e||"boolean"==typeof e||null==e||e instanceof Date}function cz(e){return"boolean"==typeof e}function cP(e){return"number"==typeof e}function cO(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=cO(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=cO(b.left,y),$=cO(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,cO(t.test,r)?cO(t.consequent,r):cO(t.alternate,r);case"CallExpression":var A=e,w=n;let k=A.arguments?.map(cI(w)),x=cO(A.callee,w);if(x){if("function"!=typeof x)throw`${cj(A.callee)} is not a function`}else throw`No function named ${cj(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 cO(o.body,i.addVariables(n))}).bind(i.thisObj??null);case"MemberExpression":return function(e,n){let t,r=cO(e.object,n);if(void 0===r)switch(e.object.type){case"Identifier":{let t=cT(e.object,n);throw ReferenceError(`ReferenceError: ${t} is not defined`)}case"MemberExpression":{let t=cT(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=cO(e.property,n);break;default:{let o=cO(e.property,n);if(void 0===o)throw{type:"Illegal property access",message:"No property was supplied to the property access"};cN(o),t=r[o]}}return"function"==typeof t?t.bind(r):t}(e,n);case"ArrayExpression":return a=e,s=n,a.elements?.map(cI(s));case"SequenceExpression":let E;return l=e,c=n,(E=l.expressions.map(cI(c)))[E.length-1];case"NewExpression":var D=e,S=n;if(D.callee&&"Identifier"===D.callee.type){let e=D.arguments?.map(cI(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 cN((u=e).value),u.value;case"Identifier":var M=e,z=n;cN(M.name);let P=z.thisObj;if(P&&("object"==typeof P||"function"==typeof P)&&M.name in P){let e=P[M.name];return cN(e),e}if(z.variables&&M.name in z.variables){let e=z.variables[M.name];return cN(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(cI(d))??[],(T=p.quasis?.map(cI(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 cT(e,n){switch(e.type){case"Literal":return e.value;case"Identifier":return e.name;case"MemberExpression":return cT(e.property,n);default:throw`VisitExpressionName does not support expression of type '${e.type}'`}}function cB(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 cI(e){return function(n){return null===n?null:cO(n,e)}}function cN(e){if("__proto__"===e||"prototype"===e||"constructor"===e)throw{type:"Illegal property access",message:`Cannot access the ${e} property of objects`}}function cj(e){return e?"MemberExpression"===e.type?e.property?.name:e.name:null}function cR(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:{...cv},isLocalExpression:!1,variables:new Set};return cF("string"==typeof e?cg(e):e,n),[...n.variables]}function cF(e,n){switch(e.type){case"UnaryExpression":return r=e,o=n,cF(r.argument,o);case"BinaryExpression":return i=e,a=n,[cF(i.left,a),cF(i.right,a)].filter(Boolean);case"ConditionalExpression":return s=e,l=n,[cF(s.consequent,l),cF(s.test,l),cF(s.alternate,l)].filter(Boolean);case"CallExpression":let t;return c=e,u=n,t=cF(c.callee,u),c.arguments?.map(cL(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(cL(k))??[],C=cF(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,cF(p.object,d),void((E={...d}).isLocalExpression=!0,cF(p.property,E));case"ArrayExpression":return f=e,h=n,void f.elements?.map(cL(h));case"SequenceExpression":return m=e,g=n,void m.expressions?.map(cL(g));case"NewExpression":return b=e,y=n,void b.arguments?.map(cL(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(cL($)),v.quasis?.map(cL($)));default:throw`Expression evaluator does not support expression of type '${e.type}'`}}function cL(e){return function(n){return null===n?null:cF(n,e)}}cg.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:cy,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=cy,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)})}}),cg.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"}})}}),cg.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)})}}),cg.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")}})}}),cg.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 :")}})}}),cg.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})}}),cg.addBinaryOp("in",7),cg.addBinaryOp("??",1);let cW=W("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 cV(e,n,t){cW.setState(r=>({flags:{...r.flags,[e]:{enabled:r.flags[e]?.enabled??!1,label:n,description:t}}}))}function cG(e){return cW.getState().flags[e].enabled}function cU(e){return!window.offlineEnabled||(e??navigator.onLine)}cW.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 cq=eV(function(e,n,t){eP(e,n,t)});function cH(e,n=!0,t=!1){return!!(e?n:t)}let cK=L("extensionsInternal",{slots:{},extensions:{}}),cY=()=>W("extensionsInternal",{slots:{},extensions:{}});function cJ(e){let n=cK.getState(),t=e(n);t!==n&&cK.setState(t)}let cZ=()=>W("extensions",{slots:{}});function cX(e){let n=[];for(let t of Object.values(e.extensions))for(let e of t.instances)n.push({slotModuleName:e.slotModuleName,extensionModuleName:t.moduleName,slotName:e.slotName,extensionId:e.id});nn(nB.getState().mountedExtensions,n)||nB.setState({mountedExtensions:n})}cX(cK.getState()),cK.subscribe(cX);let cQ=cY(),c0=cZ(),c1=nN(),c2=nR();function c3(e,n,t,r,o){let i={},a=cU(),s=Object.entries(r.flags).filter(([,{enabled:e}])=>e).map(([e])=>e);for(let[r,l]of Object.entries(e.slots)){let{config:c}=nj(n,l.name),u=ur(r,e,c,t,s,a,o.session);i[r]={moduleName:l.moduleName,assignedExtensions:u}}nn(c0.getState().slots,i)||c0.setState({slots:i})}function c5(){c3(cQ.getState(),c1.getState(),c2.getState(),cW.getState(),rX.getState())}function c4(e,n,t){return{moduleName:n,name:e,attachedIds:[],config:null,state:t}}function c6(e){let[n]=e.split("#");return n}function c8(e){var n;let t;return n=cQ.getState(),t=c6(e),n.extensions[t]}cQ.subscribe(e=>{c3(e,c1.getState(),c2.getState(),cW.getState(),rX.getState())}),c1.subscribe(e=>{c3(cQ.getState(),e,c2.getState(),cW.getState(),rX.getState())}),c2.subscribe(e=>{c3(cQ.getState(),c1.getState(),e,cW.getState(),rX.getState())}),cW.subscribe(e=>{c3(cQ.getState(),c1.getState(),c2.getState(),e,rX.getState())}),rX.subscribe(e=>{c3(cQ.getState(),c1.getState(),c2.getState(),cW.getState(),e)}),c5(),b(c5);let c7=e=>cQ.setState(n=>(n.extensions[e.name]={...e,instances:[]},n));function c9(e,n){cJ(t=>{let r=t.slots[e];return r?{...t,slots:{...t.slots,[e]:{...r,attachedIds:[...r.attachedIds,n]}}}:{...t,slots:{...t.slots,[e]:{...c4(e),attachedIds:[n]}}}})}function ue(e,n){cJ(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 un(e){cJ(n=>{let t=n.slots[e];return t?{...n,slots:{...n.slots,[e]:{...t,attachedIds:[]}}}:n})}function ut(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:-1}}function ur(e,n,t,r,o,i,a){let s=function(e,n){let t=e.add||[],r=e.remove||[],o=e.order||[],{extensions:i}=cQ.getState();return[...n,...t].filter(e=>!r.includes(e)).sort((e,t)=>{let r=ut(e,o,i[c6(e)]?.order,n),a=ut(t,o,i[c6(t)]?.order,n);return -1===a?-1:-1===r?1:r-a})}(t,n.slots[e].attachedIds),l=[],c=n.slots[e]?.state,u=c&&"object"==typeof c?{session:a,...c}:{session:a};for(let c of s){let{config:s}=nF(r,e,c),p=cq(s,t.configure?.[c]??null),d=c6(c),f=n.extensions[d];if(f){let n=p?.["Display conditions"]?.privileges??f.privileges??[];if(n&&("string"==typeof n||Array.isArray(n)&&n.length>0)&&(!a?.user||!r4(n,a.user)))continue;let t=p?.["Display conditions"]?.expression||f.displayExpression;if(void 0!==t&&"string"==typeof t&&t.trim().length>0)try{if(!cw(t,u))continue}catch(n){console.error(`Error while evaluating expression '${t}' for extension ${d} in slot ${e}`,n);continue}if(f.featureFlag&&!o.includes(f.featureFlag)||window.offlineEnabled&&!cH(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})}}return l}function uo(e){let n=cQ.getState(),{config:t}=nj(nN().getState(),e),r=c2.getState(),o=cW.getState(),i=rX.getState(),a=cU();return ur(e,n,t,r,Object.entries(o.flags).filter(([,{enabled:e}])=>e).map(([e])=>e),a,i.session)}let ui=(e,n,t)=>cQ.setState(r=>{let o=r.slots[n]?.moduleName;if(o&&o!=e)return console.warn(`An extension slot with the name '${n}' already exists. Refusing to register the same slot name twice (in "registerExtensionSlot"). The existing one is from module ${o}.`),r;if(o&&o==e)return r;if(r.slots[n])return{...r,slots:{...r.slots,[n]:{...r.slots[n],moduleName:e,state:t}}};let i=c4(n,e,t);return{...r,slots:{...r.slots,[n]:{...i}}}}),ua=L("left-nav",{slotName:null,basePath:window.spaBase,mode:"normal"});function us({name:e,basePath:n,mode:t,componentContext:r,state:o}){ua.setState({slotName:e,basePath:n,mode:t??"normal",componentContext:r,state:o})}function ul(e){ua.getState().slotName===e&&ua.setState(ua.getInitialState(),!0)}let uc=0;async function uu(e,n,t,r,o=e=>e,i={}){let a=c6(r),s=c8(r),l=null;if(e){if(!s)throw Error(`Couldn't find extension '${a}' to attach to '${n}'`);let{meta:c,moduleName:u,online:p,offline:d,load:f}=s;if(function(e=!0,n=!1){return cH(cU(),e,n)}(p,d)){cJ(o=>({...o,extensions:{...o.extensions,[a]:{...o.extensions[a],instances:[...o.extensions[a].instances,{domElement:e,id:r,slotName:n,slotModuleName:t}]}}}));let s=await f(),p=uc++;l=tX(o({...s,name:`${n}/${a}-${p}`}),{...i,_meta:c,_extensionContext:{extensionId:r,extensionSlotName:n,extensionSlotModuleName:t,extensionModuleName:u},domElement:e})}}else console.warn(`Tried to render ${r} into ${n} but no DOM element was available.`);return l}function up(){return{current:"unavailable",notAvailable:!0,active:!1}}let ud="x-omrs-offline-response-body",uf="x-omrs-offline-response-status",uh="x-omrs-offline-caching-strategy",um="u">typeof crypto&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),ug=new Uint8Array(16),ub=[];for(let e=0;e<256;++e)ub.push((e+256).toString(16).slice(1));let uy=function(e,n,t){if(um&&!n&&!e)return um();let r=(e=e||{}).random||(e.rng||function(){if(!i&&!(i="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 i(ug)})();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 ub[e[n+0]]+ub[e[n+1]]+ub[e[n+2]]+ub[e[n+3]]+"-"+ub[e[n+4]]+ub[e[n+5]]+"-"+ub[e[n+6]]+ub[e[n+7]]+"-"+ub[e[n+8]]+ub[e[n+9]]+"-"+ub[e[n+10]]+ub[e[n+11]]+ub[e[n+12]]+ub[e[n+13]]+ub[e[n+14]]+ub[e[n+15]]}(r)},u_="OFFLINE+";function uv(){return u_+uy()}function u$(e){return e.startsWith(u_)}var uA=t(47499),uw=t.n(uA);function uk({to:e,templateParams:n,onBeforeNavigate:t,children:r,...o}){return(0,uA.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}`)},[]),uw().createElement("a",{onClick:r=>{0===r.button&&!r.ctrlKey&&!r.shiftKey&&!r.altKey&&!r.metaKey&&(r.preventDefault(),t?.(r),rF({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:rj(e,n),...o},r)}let ux=L("modalRegistry",{modals:{}}),uC=L("workspaceRegistrations",{workspaces:{}}),uE=L("workspaceGroups",{workspaceGroups:{}}),uD=new Set;function uS(e){let n=uC.getState().workspaces;if(n[e])return n[e];{let n=c8(e);if(n){var t;let r;return uD.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.`),uD.add(e)),{name:n.name,title:(t=n,"string"==typeof(r=t?.meta?.title)?r:r&&"object"==typeof r?o1(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 uM=L("workspace2",{registeredGroupsByName:{},registeredWindowsByName:{},registeredWorkspacesByName:{},openedGroup:null,openedWindows:[],workspaceTitleByWorkspaceName:{},isMostRecentlyOpenedWindowHidden:!1});function uz(e){let{openedWindows:n}=uM.getState();return n.findIndex(n=>n.openedWorkspaces.find(n=>n.workspaceName===e))}let uP=(0,uA.createContext)({moduleName:"",featureName:""});function uO(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 uT=()=>e=>e;function uB(e,n=uT(),t){let r=(0,uA.useCallback)(n=>e.subscribe(n),[e]),o=(0,uA.useCallback)(()=>n(e.getState()),[e,n]),i=(0,uA.useSyncExternalStore)(r,o,o),a=(0,uA.useMemo)(()=>t?uO(e,t):{},[e,t]);return{...i,...a}}function uI(e,n){return uB(e,uT(),n)}function uN(e){return function(n){let t=(0,uA.useCallback)(n=>e.subscribe(n),[]),r=(0,uA.useCallback)(()=>e.getState(),[]),o=(0,uA.useSyncExternalStore)(t,r,r),i=(0,uA.useMemo)(()=>n?uO(e,n):{},[n]);return{...o,...i}}}let uj=e=>uB(cZ(),n=>n.slots?.[e]);function uR(e){let n=uj(e);return n?.assignedExtensions??[]}function uF(e,n){let{moduleName:t}=(0,uA.useContext)(uP),r=(0,uA.useRef)(!0);if(!t)throw Error("ComponentContext has not been provided. This should come from @openmrs/esm-react-utils.");return(0,uA.useEffect)(()=>{ui(t,e,n),r.current=!1},[]),(0,uA.useEffect)(()=>{r.current||function(e,n,t=!1){cQ.setState(r=>{let o=t?cq(r.slots[e].state,n):n;return{...r,slots:{...r.slots,[e]:{...r.slots[e],state:o}}}})}(e,n)},[e,n]),{extensions:uR(e),extensionSlotName:e,extensionSlotModuleName:t}}function uL(e){return e}function uW({name:e,extensionSlotName:n,select:t=uL,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,uA.useRef)(null),{extensions:c,extensionSlotModuleName:u}=uF(s,o),p=(0,uA.useMemo)(()=>t(c),[t,c]),d=(0,uA.useMemo)(()=>{if("function"==typeof r&&!uw().isValidElement(r))return p.map(e=>r(e,o))},[r,p]);return uw().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)=>uw().createElement(uP.Provider,{key:e.id,value:{moduleName:u,featureName:"",extension:{extensionId:e.id,extensionSlotName:s,extensionSlotModuleName:u}}},d?.[n]??("function"!=typeof r?r:null)??uw().createElement(dr,{state:o}))))}var uV=t(5338);function uG(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 uU(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?uG(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)):uG(Object(t)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))})}return e}function uq(e){return(uq="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 uH(e){return(uH="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 uK(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(uH(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(uH(e)));return e}}var uY=null;try{uY=require("react").createContext()}catch(e){}var uJ={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 uZ(e,n){return e.rootComponent?Promise.resolve():e.loadRootComponent(n).then(function(n){e.rootComponent=n})}function uX(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=u2(e,n,function(){t(this)}),a=uK(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:u1(e),renderType:"function"==typeof(o=e).renderType?o.renderType():o.renderType});e.domElements[n.name]=a,e.renderResults[n.name]=s})}function uQ(e,n){return new Promise(function(t){e.unmountResolves[n.name]=t;var r=e.renderResults[n.name];r&&r.unmount?r.unmount():u1(e).unmountComponentAtNode(e.domElements[n.name]),delete e.domElements[n.name],delete e.renderResults[n.name]})}function u0(e,n){return new Promise(function(t){e.updateResolves[n.name]||(e.updateResolves[n.name]=[]),e.updateResolves[n.name].push(t);var r=u2(e,n,null),o=e.renderResults[n.name];if(o&&o.render)o.render(r);else{var i=uK(e,n)();u1(e).render(r,i)}})}function u1(e){return e.ReactDOMClient||e.ReactDOM}function u2(e,n,t){var r=e.React.createElement(e.rootComponent,n),o=uY?e.React.createElement(uY.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,uU(uU({},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 u3=t(58779),u5=t(59324),u4=t(14993);let u6={strictMode:!0,throwErrorsToConsole:!0,disableTranslations:!1},u8=new Map;(0,u4.r2)(u8);let u7={errorRetryCount:3,fetcher:rY,focusThrottleInterval:18e5,revalidateIfStale:!0,revalidateOnFocus:!1,revalidateOnReconnect:!1,refreshInterval:0,shouldRetryOnError:e=>{if(e instanceof rZ){let n=e.response.status;return!!(n>=500)||401===n||403===n||429===n}return!0},provider:()=>u8};function u9(e,n){return function(e){if("object"!==uq(e))throw Error("single-spa-react requires a configuration object");var n,t=uU(uU({},uJ),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");!uY&&t.React.createContext&&(uY=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:uZ.bind(null,t),mount:uX.bind(null,t),unmount:uQ.bind(null,t)};return t.parcelCanUpdate&&(r.update=u0.bind(null,t)),r}({React:uw(),ReactDOMClient:uV,rootComponent:(function(e){if("object"!=typeof e||"string"!=typeof e.featureName||"string"!=typeof e.moduleName)throw Error("Invalid options");let n=Object.assign({},u6,e),t={...u7,...n.swrConfig};return function(e){var r,o,i,a,s;return i=o=class extends(r=uw().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 uw().createElement("div",null,"An error has occurred. Please try reloading the page.");{let r=uw().createElement(uA.Suspense,{fallback:null},uw().createElement(u5.BE,{value:t},uw().createElement(uP.Provider,{value:this.state.config},n.disableTranslations?uw().createElement(e,this.props):uw().createElement(u3.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},uw().createElement(e,this.props)))));return n.strictMode&&uw().StrictMode?uw().createElement(uw().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 pe(e,n){return()=>e().then(({default:e})=>u9(e,n))}function pn(e,n){return()=>Promise.resolve(u9(e,n))}let pt=pe,pr=new Map;function po(e,n){let t=(0,uA.useRef)(n??{}),r=(0,uA.useRef)(n=>ol(e,n)),o=(0,uA.useRef)(Symbol());return(0,uA.useEffect)(()=>{let t=n??{},r=o.current;return null===os(e)?oi(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.`),ol(e,()=>t)),pr.set(e,r),()=>{pr.get(e)===r&&(oa(e),pr.delete(e))}},[e]),(0,uA.useEffect)(()=>{let r=n??{};T(t.current,r)||(ol(e,()=>r),t.current=r)},[n]),r.current}function pi({namespace:e,value:n}){return po(e,n),null}let pa=({children:e,value:n,fallback:t})=>n?uw().createElement(uw().Fragment,null,e):t?uw().createElement(uw().Fragment,null,t):null;function ps(){let e=(0,uA.useRef)();return(!e.current||e.current.signal.aborted)&&(e.current=new AbortController),(0,uA.useEffect)(()=>{let n=e.current;return()=>n?.abort()},[]),e.current}function pl(e,n=e=>e??{}){let[t,r]=(0,uA.useState)(()=>{if(pc(e))return;let t=os(e);if(null!==t)return n?n(t):t});return(0,uA.useEffect)(()=>{if(pc(e))throw Error(`The namespace supplied to useAppContext must be a non-empty string, but was "${e}".`)},[e]),(0,uA.useEffect)(()=>oc(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 pc(e){return"string"!=typeof e||0===e.trim().length}function pu(e){let[n,t]=(0,uA.useState)([]);return(0,uA.useEffect)(()=>cZ().subscribe(r=>{let o=r.slots[e]?.assignedExtensions.map(e=>e.id)??[];nn(o,n)||t(o)}),[]),n}function pp(e,n){let{data:t,error:r,mutate:o,isLoading:i,isValidating:a}=(0,u5.Ay)(`${ie}?patient=${e}&includeEncounterless=${n}`,rY);return(0,uA.useMemo)(()=>({isLoading:i,data:t?.data.results??[],error:r,mutate:o,isValidating:a}),[t,r,i,a,o])}function pd(e){(0,uA.useEffect)(()=>{if(e){let e=window.getComputedStyle(document.body).overflow;return document.body.style.overflow="hidden",()=>{document.body.style.overflow=e}}},[e])}let pf={},ph=`No ComponentContext has been provided. This should come from "openmrsComponentDecorator".
16
16
  Usually this is already applied when using "getAsyncLifecycle" or "getSyncLifecycle".`;function pm(e){let{moduleName:n,extension:t}=(0,uA.useContext)(uP),r=e?.externalModuleName??n;if(!r&&!t)throw Error(ph);let o=function(e){let n=(0,uA.useMemo)(()=>nI(e),[e]),t=function(e){let[n,t]=(0,uA.useState)(()=>{let n=e.getState();return n.loaded&&n.config?n.config:null});return(0,uA.useEffect)(()=>e?.subscribe(e=>{e.loaded&&e.config&&t(e.config)}),[e]),n}(n);if(!t)throw pf[e]||(pf[e]=new Promise(e=>{let t=n.subscribe(n=>{n.loaded&&n.config&&(e(n.config),t())})})),pf[e];return t}(r),i=function(e){let n=(0,uA.useMemo)(nR,[]),t=function(e,n){let[t,r]=(0,uA.useState)(n?()=>{let t=nF(e.getState(),n.extensionSlotName,n.extensionId);if(t.loaded&&t.config)return t.config}:null);return(0,uA.useEffect)(()=>{if(n)return e.subscribe(e=>{let o=nF(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!pf[t]&&n&&(pf[t]=new Promise(t=>{let r=n.subscribe(n=>{let o=nF(n,e.extensionSlotName,e.extensionId);o.loaded&&o.config&&(t(o.config),r())})})),pf[t]}return t||{}}(t);return(0,uA.useMemo)(()=>e?.externalModuleName&&r===e.externalModuleName?{...o}:{...o,...i},[r,e?.externalModuleName,o,i])}let pg=uR;function pb(){let[e,n]=(0,uA.useState)(cU());return(0,uA.useEffect)(()=>b(({online:e})=>n(e)),[]),e}function py(e,n=300){let[t,r]=(0,uA.useState)(e);return(0,uA.useEffect)(()=>{let t=setTimeout(()=>{r(e)},n);return()=>{clearTimeout(t)}},[e,n]),t}var p_=t(54225);let pv=`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 p$(){let e=`${rU}/emrapi/configuration?v=${pv}`,n=(0,p_.A)(e,rY);return(0,uA.useMemo)(()=>({emrConfiguration:n.data?.data,isLoadingEmrConfiguration:n.isLoading,mutateEmrConfiguration:n.mutate,errorFetchingEmrConfiguration:n.error}),[n])}function pA(e){let n=uR(e);return(0,uA.useMemo)(()=>Object.fromEntries(n.map(e=>[e.name,e.meta])),[n])}uN(cY());let pw=uN(cZ());function pk(e){let{flags:n}=uB(cW);return n[e]?.enabled??!1}function px(){let[,e]=(0,uA.useState)(0);return(0,uA.useCallback)(()=>{e(e=>e+1)},[])}function pC(e,n,t={}){return pD(e,n,pE,t)}let pE={getPaginatedUrl:(e,n,t)=>{if(!e)return null;{let r=new URL(rK(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 pD(e,n,t,r={}){let{getPaginatedUrl:o,getTotalCount:i,getCurrentPageSize:a,getData:s}=t,{immutable:l,swrConfig:c}=r,u=r.fetcher??rY,[p,d]=(0,uA.useState)(1),f=(0,uA.useRef)(NaN),h=(0,uA.useRef)(NaN),m=(p-1)*n,g=(0,uA.useMemo)(()=>o(e,n,m),[e,n,m]),{data:b,...y}=(l?p_.A:u5.Ay)(g,u,c);b?.data&&(f.current=i(b?.data),h.current=a(b?.data));let v=Math.ceil(f.current/n),$=(0,uA.useCallback)(e=>{0<e&&e<=v?d(e):console.warn("Invalid attempt to go to out of bounds page: "+e)},[e,p,v]),A=(0,uA.useCallback)(()=>{$(p+1)},[e,p,v]),w=(0,uA.useCallback)(()=>{$(p-1)},[e,p,v]);return{data:s(b?.data),totalPages:v,totalCount:f.current,currentPage:p,currentPageSize:h,paginated:v>1,showNextButton:p<v,showPreviousButton:p>1,goTo:$,goToNext:A,goToPrevious:w,...y}}function pS(e,n,t={}){return pD(e,n,pM(),t)}function pM(){return{getPaginatedUrl:(e,n,t)=>{if(!e)return null;{let r=new URL(rK(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 pz=t(19888);let pP=uw().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}),pO={dedupe:!0};u4.qv.defineProperty(u4.BE,"defaultValue",{value:u4.sb});let pT=(0,u4.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]=u4.bZ.get(r),[b,y]=(0,u4.lK)(e),v=(0,uA.useRef)(!1),$=(0,uA.useRef)(!1),A=(0,uA.useRef)(b),w=(0,uA.useRef)(n),k=(0,uA.useRef)(t),x=()=>k.current.isVisible()&&k.current.isOnline(),[C,E,D,S]=(0,u4.r9)(r,b),M=(0,uA.useRef)({}).current,z=(0,u4.b0)(a)?t.fallback[b]:a,P=(e,n)=>{for(let t in M)if("data"===t){if(!o(e[t],n[t])&&(!(0,u4.b0)(e[t])||!o(L,n[t])))return!1}else if(n[t]!==e[t])return!1;return!0},O=(0,uA.useMemo)(()=>{let e=!!b&&!!n&&((0,u4.b0)(s)?!k.current.isPaused()&&!i&&(!!(0,u4.b0)(l)||l):s),t=n=>{let t=(0,u4.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,pz.useSyncExternalStore)((0,uA.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,u4.b0)(N)?z:N,R=T.error,F=(0,uA.useRef)(j),L=d?(0,u4.b0)(N)?F.current:N:j,W=(!I||!!(0,u4.b0)(R))&&(B&&!(0,u4.b0)(s)?s:!k.current.isPaused()&&(i?!(0,u4.b0)(j)&&l:(0,u4.b0)(j)||l)),V=!!(b&&n&&B&&W),G=(0,u4.b0)(T.isValidating)?V:T.isValidating,U=(0,u4.b0)(T.isLoading)?V:T.isLoading,q=(0,uA.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=()=>u4.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,u4.b0)(C().data)&&(g.isLoading=!0);try{if(l&&(E(g),t.loadingTimeout&&(0,u4.b0)(C().data)&&setTimeout(()=>{a&&c()&&k.current.onLoadingSlow(b,t)},t.loadingTimeout),m[b]=[i(y),(0,u4.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=u4.ZH;let e=h[b];if(!(0,u4.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,u4.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](u4.bu.ERROR_REVALIDATE_EVENT,e)},{retryCount:(s.retryCount||0)+1,dedupe:!0})))}return a=!1,p(),!0},[b,r]),H=(0,uA.useCallback)((...e)=>(0,u4.mF)(r,A.current,...e),[]);if((0,u4.Es)(()=>{w.current=n,k.current=t,(0,u4.b0)(N)||(F.current=N)}),(0,u4.Es)(()=>{if(!b)return;let e=q.bind(u4.ZH,pO),n=0,t=(0,u4.aw)(b,f,(t,r={})=>{if(t==u4.bu.FOCUS_EVENT){let t=Date.now();k.current.revalidateOnFocus&&t>n&&x()&&(n=t+k.current.focusThrottleInterval,e())}else if(t==u4.bu.RECONNECT_EVENT)k.current.revalidateOnReconnect&&x()&&e();else if(t==u4.bu.MUTATE_EVENT)return q();else if(t==u4.bu.ERROR_REVALIDATE_EVENT)return q(r)});return $.current=!1,A.current=b,v.current=!0,E({_k:y}),W&&((0,u4.b0)(j)||u4.X3?e():(0,u4.mf)(e)),()=>{$.current=!0,t()}},[b]),(0,u4.Es)(()=>{let e;function n(){let n=(0,u4.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(pO).then(n):n()}return n(),()=>{e&&(clearTimeout(e),e=-1)}},[c,u,p,b]),(0,uA.useDebugValue)(L),i&&(0,u4.b0)(j)&&b){if(!u4.dO&&u4.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,u4.b0)(e)||pP(H(e)),(0,u4.b0)(R)){let e=q(pO);(0,u4.b0)(L)||(e.status="fulfilled",e.value=!0),pP(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}}}),pB=Promise.resolve(),pI=(0,u4.Ht)(pT,e=>(n,t,r)=>{let o,i=(0,uA.useRef)(!1),{cache:a,initialSize:s=1,revalidateAll:l=!1,persistSize:c=!1,revalidateFirstPage:u=!0,revalidateOnMount:p=!1,parallel:d=!1}=r,[,,,f]=u4.bZ.get(u4.PP);try{(o=(0,u4.lK)(n?n(0,null):null)[0])&&(o=u4.q9+o)}catch(e){}let[h,m,g]=(0,u4.r9)(a,o),b=(0,uA.useCallback)(()=>(0,u4.b0)(h()._l)?s:h()._l,[a,o,s]);(0,pz.useSyncExternalStore)((0,uA.useCallback)(e=>o?g(o,()=>{e()}):()=>{},[a,o]),b,b);let y=(0,uA.useCallback)(()=>{let e=h()._l;return(0,u4.b0)(e)?s:e},[o,s]),v=(0,uA.useRef)(y());(0,u4.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:u4.ZH});let s=[],c=y(),[p]=(0,u4.r9)(a,e),g=p().data,b=[],v=null;for(let e=0;e<c;++e){let[c,p]=(0,u4.lK)(n(e,d?null:v));if(!c)break;let[h,m]=(0,u4.r9)(a,c),y=h().data,A=l||o||(0,u4.b0)(y)||u&&!e&&!(0,u4.b0)(g)||$||g&&!(0,u4.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:u4.ZH}),s},r),w=(0,uA.useCallback)(function(e,n){let t="boolean"==typeof n?{revalidate:n}:n||{},r=!1!==t.revalidate;return o?(r&&((0,u4.b0)(e)?m({_i:!0,_r:t.revalidate}):m({_i:!1,_r:t.revalidate})),arguments.length?A.mutate(e,{...t,revalidate:r}):A.mutate()):pB},[o,a]),k=(0,uA.useCallback)(e=>{let t;if(!o)return pB;let[,r]=(0,u4.r9)(a,o);if((0,u4.Tn)(e)?t=e(y()):"number"==typeof e&&(t=e),"number"!=typeof t)return pB;r({_l:t}),v.current=t;let i=[],[s]=(0,u4.r9)(a,o),l=null;for(let e=0;e<t;++e){let[t]=(0,u4.lK)(n(e,l)),[r]=(0,u4.r9)(a,t),o=t?r().data:u4.ZH;if((0,u4.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 pN(e,n={}){return pj(e,pE,n)}function pj(e,n,t={}){let{swrInfiniteConfig:r,immutable:o}=t,{getNextUrl:i,getTotalCount:a,getData:s}=n,l=t.fetcher??rY,{data:c,size:u,setSize:p,...d}=pI((0,uA.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 pR(e,n={}){return pF(e,pE,n)}function pF(e,n,t={}){let r=pj(e,n,t),{hasMore:o,error:i,data:a,loadMore:s,isLoading:l,nextUri:c}=r;return((0,uA.useEffect)(()=>{o&&!i&&s()},[o,c]),t.partialData)?r:{...r,data:o||i?void 0:a,isLoading:l||o}}function pL(e,n={}){return pF(e,pM(),n)}function pW(e,n={}){return pj(e,pM(),n)}function pV(){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 pG(){let[e,n]=(0,uA.useState)(pV);return(0,uA.useEffect)(()=>{let e=()=>{n(pV())};return window.addEventListener("resize",e),()=>window.removeEventListener("resize",e)},[]),e}let pU=e=>"small-desktop"===e||"large-desktop"===e;function pq(e){let n=(0,uA.useContext)(uP);(0,uA.useEffect)(()=>(n&&n.moduleName&&(e.componentContext=n),us(e),()=>{ul(e.name)}),[n,e])}function pH(){return uB(ua)}function pK(e=null,n=null){let[t,r]=(0,uA.useState)([]);return(0,uA.useEffect)(()=>{let t=ch(e,n).subscribe(e=>{r(e)},e=>{console.error(e)});return()=>t.unsubscribe()},[e,n]),t}function pY(e,n=!0){let t=(0,uA.useRef)(null);return(0,uA.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 pJ(e){let n=(0,uA.useRef)();return(0,uA.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 pZ(e,n={}){let{abortController:t,fetchInit:r,url:o,swrConfig:i}=n,a=ps(),s=(0,uA.useMemo)(()=>r?.signal??t?.signal??a.signal,[t?.signal,r?.signal,a.signal]),l=(0,uA.useCallback)(e=>rY(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,u5.Ay)(e,l,i)}function pX(e=[],n=10){let[t,r]=(0,uA.useState)(1),o=(0,uA.useMemo)(()=>"number"==typeof n&&n>0?Math.max(1,Math.ceil(e.length/n)):1,[e.length,n]),i=(0,uA.useMemo)(()=>{let r=(t-1)*n,o=(t+0)*n;return e.slice(r,o)},[e,t,n]),a=(0,uA.useCallback)(e=>{r(Math.max(1,Math.min(o,e)))},[r,o]),s=(0,uA.useCallback)(()=>{t<o&&r(t+1)},[t,o,r]),l=(0,uA.useCallback)(()=>{t>1&&r(t-1)},[t,r]);return(0,uA.useMemo)(()=>({results:i,totalPages:o,currentPage:t,paginated:e.length>n,showNextButton:t<o,showPreviousButton:t>1,goTo:a,goToNext:s,goToPrevious:l}),[i,o,e.length,n,t,a,s,l])}function pQ(e,n,t,r){return{pageSizes:(0,uA.useMemo)(()=>{let t=Math.ceil(n/e);return isNaN(t)&&(t=0),[...Array(t).keys()].map(n=>(n+1)*e)},[e,n]),pageItemsCount:(0,uA.useMemo)(()=>e>n?n:e*t>n?e*(t-1)+r:e*t,[e,n,t,r])}}function p0(){let e=/\/patient\/([a-zA-Z0-9\-]+)\/?/.exec(location.pathname);return e&&e[1]}function p1(e){let[n,t]=(0,uA.useState)(e??p0()),{data:r,error:o,isValidating:i}=(0,u5.Ay)(n?["patient",n]:null,()=>l8(n,{}));return(0,uA.useEffect)(()=>{let e=()=>{let e=p0();e!==n&&t(e)};return window.addEventListener("single-spa:routing-event",e),()=>window.removeEventListener("single-spa:routing-event",e)},[n]),(0,uA.useMemo)(()=>({isLoading:i&&!o&&!r,patient:r,patientUuid:n,error:o}),[i,o,r,n])}function p2(){let e=`${rU}/metadatamapping/termmapping?v=custom:(metadataUuid)&code=emr.primaryIdentifierType`,{data:n,error:t,isLoading:r}=(0,u5.Ay)(e,rY);return(0,uA.useMemo)(()=>({primaryIdentifierCode:n?.data?.results[0]?.metadataUuid,isLoading:r,error:t}),[n,t,r])}function p3(e){let{extensions:n,extensionSlotModuleName:t}=uF(e);return e?n.map(n=>({state:r})=>uw().createElement(uP.Provider,{value:{moduleName:t,featureName:"",extension:{extensionId:n.id,extensionSlotName:e,extensionSlotModuleName:t}}},uw().createElement(dr,{state:r}))):[]}function p5(){let e=(0,uA.useRef)(),[n,t]=(0,uA.useState)(null),r=null;if(!n){if(a){let e=r1().getState();e.loaded&&(r=e.session)}else a=new Promise(n=>{let t=({loaded:t,session:o})=>{t&&(n(o),r=o,e.current&&(e.current(),e.current=void 0))};t(r1().getState()),r||(e.current=r1().subscribe(t))});if(r)t(r);else throw a}(0,uA.useEffect)(()=>(e.current||(e.current=r1().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(a)throw console.warn("useSession is in an unexpected state. Attempting to recover."),a;else throw Error("useSession is in an invalid state.");return o}let p4=({privilege:e,fallback:n,children:t})=>{let[r,o]=(0,uA.useState)(null);return((0,uA.useEffect)(()=>{let e=r0({includeAuthStatus:!1}).subscribe(o);return()=>e.unsubscribe()},[]),r&&r4(e,r))?uw().createElement(uw().Fragment,null,t):n?uw().createElement(uw().Fragment,null,n):null};var p6=t(74353),p8=t.n(p6),p7=t(47581);let p9={setVisitContext:(e,n)=>null==n?{manuallySetVisitUuid:null}:{manuallySetVisitUuid:n.uuid,patientUuid:n.patient?.uuid},mutateVisit(e){for(let n of Object.values(e.mutateVisitCallbacks??{}))n();return{}}};function de(e){let n=(0,uA.useId)();return(0,uA.useEffect)(()=>{let t=co();return e&&t.setState({mutateVisitCallbacks:{...t.getState().mutateVisitCallbacks,[n]:e}}),()=>{if(e){let e={...t.getState().mutateVisitCallbacks};delete e[n],t.setState({mutateVisitCallbacks:e})}}},[n,e]),uI(co(),p9)}function dn(e,n=ct){let{patientUuid:t,manuallySetVisitUuid:r,setVisitContext:o}=de(),i=e&&t==e?r:null,a=`?patient=${e}&v=${n}&includeInactive=false`,s=`/${i}?v=${n}`,{data:l,error:c,mutate:u,isValidating:p}=(0,u5.Ay)(e?`${rU}/visit${a}`:null,rY),{data:d,error:f,mutate:h,isValidating:m}=(0,u5.Ay)(e&&i?`${rU}/visit${s}`:null,rY),g=(0,uA.useMemo)(()=>l?.data.results.find(e=>null===e.stopDatetime)??null,[l]),b=(0,uA.useMemo)(()=>i&&d?d.data:null,[d,i]),y=(0,uA.useRef)(null);(0,uA.useEffect)(()=>{!p&&g&&t===e&&null===r&&o(g),m||(y.current&&b&&y.current.uuid===b.uuid&&!y.current.stopDatetime&&b.stopDatetime&&o(null),y.current=b)},[b,r,g,p,m,t]);let v=(0,uA.useCallback)(()=>{u(),h()},[u,h]);de(v);let $=!!(!l||i&&!d),A=!!(i?f:c);return{error:c||f,mutate:v,isValidating:p||m,activeVisit:g,currentVisit:b,currentVisitIsRetrospective:!!i,isLoading:$&&!A}}function dt(){let[e,n]=(0,uA.useState)([]);return(0,uA.useEffect)(()=>{let e=cd().subscribe(e=>{n(e)},e=>console.error(e));return()=>e.unsubscribe()},[]),e}p6.extend(p7);let dr=({state:e,children:n,...t})=>{let{extension:r}=(0,uA.useContext)(uP),o=(0,uA.useRef)(null),i=(0,uA.useRef)(Promise.resolve()),a=(0,uA.useCallback)(n=>{r?.extensionSlotName&&r.extensionSlotModuleName&&r.extensionSlotModuleName&&!o.current&&uu(n,r.extensionSlotName,r.extensionSlotModuleName,r.extensionId,void 0,e).then(e=>{o.current=e})},[]);return(0,uA.useEffect)(()=>()=>{if(o&&o.current)switch(o.current.getStatus()){case"MOUNTING":o.current.mountPromise.then(()=>{o.current?.getStatus()==="MOUNTED"&&o.current.unmount()});break;case"MOUNTED":o.current.unmount();break;case"UPDATING":i.current&&i.current.then(()=>{o.current?.getStatus()==="MOUNTED"&&o.current.unmount()})}},[]),(0,uA.useEffect)(()=>{o.current&&o.current.update&&"UNMOUNTING"!==o.current.getStatus()&&Promise.all([o.current.mountPromise,i.current]).then(()=>{o?.current?.getStatus()==="MOUNTED"&&o.current.update&&(i.current=o.current.update({...e}).catch(e=>{if(!(e instanceof Error)||!e.message.includes("minified message #32")||o.current?.getStatus()==="MOUNTED")throw e}))})},[e]),r?uw().createElement("div",{ref:a,"data-extension-id":r?.extensionId,style:{position:"relative"},...t}):null};var di=t(74848),da=t(46942),ds=t.n(da),dl=t(85072),dc=t.n(dl),du=t(97825),dp=t.n(du),dd=t(77659),df=t.n(dd),dh=t(55056),dm=t.n(dh),dg=t(10540),db=t.n(dg),dy=t(41113),d_=t.n(dy),dv=t(76097),d$={};d$.styleTagTransform=d_(),d$.setAttributes=dm(),d$.insert=df().bind(null,"head"),d$.domAPI=dp(),d$.insertStyleElement=db(),dc()(dv.A,d$);let dA=dv.A&&dv.A.locals?dv.A.locals:void 0;function dw({title:e,children:n}){let t="tablet"===pG();return(0,di.jsxs)("div",{className:ds()({[dA.tabletHeader]:t,[dA.desktopHeader]:!t}),children:[(0,di.jsx)("h4",{children:e}),n]})}var dk=t(68108),dx=t(99158),dC={};dC.styleTagTransform=d_(),dC.setAttributes=dm(),dC.insert=df().bind(null,"head"),dC.domAPI=dp(),dC.insertStyleElement=db(),dc()(dx.A,dC);let dE=dx.A&&dx.A.locals?dx.A.locals:void 0,dD=(0,uA.createContext)(null);function dS(){let e=(0,uA.useContext)(dD);if(!e)throw Error("useCustomOverflowMenu must be used within a CustomOverflowMenu");return e}function dM({menuTitle:e,children:n}){let[t,r]=uw().useState(!1),o=pY(()=>r(!1),t),i="tablet"===pG(),a=(0,uA.useCallback)(()=>r(e=>!e),[]),s=(0,uA.useRef)(null),l=(0,uA.useRef)(null),c=(0,uA.useId)(),u=`custom-overflow-menu-trigger-${c}`,p=`custom-overflow-menu-${c}`,d=(0,uA.useCallback)(()=>{r(!1),s.current?.focus()},[]),f=(0,uA.useMemo)(()=>({closeMenu:d}),[d]),h=(0,uA.useCallback)(e=>{"Escape"===e.key&&t&&(e.stopPropagation(),d())},[d,t]),m=uA.Children.toArray(n);(0,uA.useEffect)(()=>{if(t&&l.current){let e=l.current.querySelector('[role="menuitem"]:not([disabled])');e?.focus()}},[t]);let g=(0,uA.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,uA.isValidElement)(e)?(0,uA.cloneElement)(e,{closeMenu:d,handleOverflowMenuItemFocus:g,index:n}):e);return(0,di.jsxs)("div",{"data-overflow-menu":!0,className:ds()("cds--overflow-menu",dE.container),ref:o,children:[(0,di.jsx)("button",{className:ds()("cds--btn","cds--btn--ghost","cds--overflow-menu__trigger",{"cds--overflow-menu--open":t},dE.overflowMenuButton),"aria-controls":p,"aria-expanded":t,"aria-haspopup":"true",id:u,onClick:a,onKeyDown:h,ref:s,children:e}),(0,di.jsxs)("div",{className:ds()("cds--overflow-menu-options","cds--overflow-menu--flip",dE.menu,{[dE.show]:t}),"aria-labelledby":u,"data-floating-menu-direction":"bottom",id:p,onKeyDown:h,ref:l,role:"menu",tabIndex:-1,children:[(0,di.jsx)("ul",{className:ds()("cds--overflow-menu-options__content",{"cds--overflow-menu-options--lg":i}),children:(0,di.jsx)(dD.Provider,{value:f,children:b})}),(0,di.jsx)("span",{})]})]})}function dz(e){let n=(0,uA.useContext)(dD);return(0,di.jsx)(dk.XSD,{...e,closeMenu:n?.closeMenu})}let dP={"carbon.table.batch.cancel":"cancel","carbon.table.batch.items.selected":"batchActionsItemsSelected","carbon.table.batch.item.selected":"batchActionItemSelected","carbon.table.batch.selectAll":"selectAll"},dO=e=>(0,di.jsx)(dk.GGC,{translateWithId:(e,n)=>{let t=dP[e];return t?o2(t,e,n):e},...e});var dT=t(47767),dB=t(84976),dI=t(30424),dN={};dN.styleTagTransform=d_(),dN.setAttributes=dm(),dN.insert=df().bind(null,"head"),dN.domAPI=dp(),dN.insertStyleElement=db(),dc()(dI.A,dN);let dj=dI.A&&dI.A.locals?dI.A.locals:void 0,dR=["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-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-user-avatar","omrs-icon-user-follow","omrs-icon-user-xray","omrs-icon-user","omrs-icon-view-off","omrs-icon-view","omrs-icon-warning"],dF=(0,uA.memo)((0,uA.forwardRef)(function(e,n){return(0,di.jsx)(hl,{ref:n,icon:"omrs-icon-activity",iconProps:e})})),dL=(0,uA.memo)((0,uA.forwardRef)(function(e,n){return(0,di.jsx)(hl,{ref:n,icon:"omrs-icon-add",iconProps:e})})),dW=(0,uA.memo)((0,uA.forwardRef)(function(e,n){return(0,di.jsx)(hl,{ref:n,icon:"omrs-icon-arrow-down",iconProps:e})})),dV=(0,uA.memo)((0,uA.forwardRef)(function(e,n){return(0,di.jsx)(hl,{ref:n,icon:"omrs-icon-arrow-left",iconProps:e})})),dG=(0,uA.memo)((0,uA.forwardRef)(function(e,n){return(0,di.jsx)(hl,{ref:n,icon:"omrs-icon-arrow-right",iconProps:e})})),dU=(0,uA.memo)((0,uA.forwardRef)(function(e,n){return(0,di.jsx)(hl,{ref:n,icon:"omrs-icon-arrow-up",iconProps:e})})),dq=(0,uA.memo)((0,uA.forwardRef)(function(e,n){return(0,di.jsx)(hl,{ref:n,icon:"omrs-icon-baby",iconProps:e})})),dH=(0,uA.memo)((0,uA.forwardRef)(function(e,n){return(0,di.jsx)(hl,{ref:n,icon:"omrs-icon-calendar-heat-map",iconProps:e})})),dK=(0,uA.memo)((0,uA.forwardRef)(function(e,n){return(0,di.jsx)(hl,{ref:n,icon:"omrs-icon-calendar",iconProps:e})})),dY=(0,uA.memo)((0,uA.forwardRef)(function(e,n){return(0,di.jsx)(hl,{ref:n,icon:"omrs-icon-caret-down",iconProps:e})})),dJ=(0,uA.memo)((0,uA.forwardRef)(function(e,n){return(0,di.jsx)(hl,{ref:n,icon:"omrs-icon-caret-left",iconProps:e})})),dZ=(0,uA.memo)((0,uA.forwardRef)(function(e,n){return(0,di.jsx)(hl,{ref:n,icon:"omrs-icon-caret-right",iconProps:e})})),dX=(0,uA.memo)((0,uA.forwardRef)(function(e,n){return(0,di.jsx)(hl,{ref:n,icon:"omrs-icon-caret-up",iconProps:e})})),dQ=(0,uA.memo)((0,uA.forwardRef)(function(e,n){return(0,di.jsx)(hl,{ref:n,icon:"omrs-icon-chart-average",iconProps:e})})),d0=(0,uA.memo)((0,uA.forwardRef)(function(e,n){return(0,di.jsx)(hl,{ref:n,icon:"omrs-icon-chart-line",iconProps:e})})),d1=(0,uA.memo)((0,uA.forwardRef)(function(e,n){return(0,di.jsx)(hl,{ref:n,icon:"omrs-icon-checkmark-filled",iconProps:e})})),d2=(0,uA.memo)((0,uA.forwardRef)(function(e,n){return(0,di.jsx)(hl,{ref:n,icon:"omrs-icon-checkmark-outline",iconProps:e})})),d3=(0,uA.memo)((0,uA.forwardRef)(function(e,n){return(0,di.jsx)(hl,{ref:n,icon:"omrs-icon-chemistry",iconProps:e})})),d5=(0,uA.memo)((0,uA.forwardRef)(function(e,n){return(0,di.jsx)(hl,{ref:n,icon:"omrs-icon-chevron-down",iconProps:e})})),d4=(0,uA.memo)((0,uA.forwardRef)(function(e,n){return(0,di.jsx)(hl,{ref:n,icon:"omrs-icon-chevron-left",iconProps:e})})),d6=(0,uA.memo)((0,uA.forwardRef)(function(e,n){return(0,di.jsx)(hl,{ref:n,icon:"omrs-icon-chevron-right",iconProps:e})})),d8=(0,uA.memo)((0,uA.forwardRef)(function(e,n){return(0,di.jsx)(hl,{ref:n,icon:"omrs-icon-chevron-up",iconProps:e})})),d7=(0,uA.memo)((0,uA.forwardRef)(function(e,n){return(0,di.jsx)(hl,{ref:n,icon:"omrs-icon-close",iconProps:e})})),d9=(0,uA.memo)((0,uA.forwardRef)(function(e,n){return(0,di.jsx)(hl,{ref:n,icon:"omrs-icon-close-filled",iconProps:e})})),fe=(0,uA.memo)((0,uA.forwardRef)(function(e,n){return(0,di.jsx)(hl,{ref:n,icon:"omrs-icon-close-outline",iconProps:e})})),fn=(0,uA.memo)((0,uA.forwardRef)(function(e,n){return(0,di.jsx)(hl,{ref:n,icon:"omrs-icon-document",iconProps:e})})),ft=(0,uA.memo)((0,uA.forwardRef)(function(e,n){return(0,di.jsx)(hl,{ref:n,icon:"omrs-icon-document-attachment",iconProps:e})})),fr=(0,uA.memo)((0,uA.forwardRef)(function(e,n){return(0,di.jsx)(hl,{ref:n,icon:"omrs-icon-download",iconProps:e})})),fo=(0,uA.memo)((0,uA.forwardRef)(function(e,n){return(0,di.jsx)(hl,{ref:n,icon:"omrs-icon-drug-order",iconProps:e})})),fi=(0,uA.memo)((0,uA.forwardRef)(function(e,n){return(0,di.jsx)(hl,{ref:n,icon:"omrs-icon-edit",iconProps:e})})),fa=(0,uA.memo)((0,uA.forwardRef)(function(e,n){return(0,di.jsx)(hl,{ref:n,icon:"omrs-icon-event-schedule",iconProps:e})})),fs=(0,uA.memo)((0,uA.forwardRef)(function(e,n){return(0,di.jsx)(hl,{ref:n,icon:"omrs-icon-events",iconProps:e})})),fl=(0,uA.memo)((0,uA.forwardRef)(function(e,n){return(0,di.jsx)(hl,{ref:n,icon:"omrs-icon-gender-female",iconProps:e})})),fc=(0,uA.memo)((0,uA.forwardRef)(function(e,n){return(0,di.jsx)(hl,{ref:n,icon:"omrs-icon-gender-male",iconProps:e})})),fu=(0,uA.memo)((0,uA.forwardRef)(function(e,n){return(0,di.jsx)(hl,{ref:n,icon:"omrs-icon-gender-other",iconProps:e})})),fp=(0,uA.memo)((0,uA.forwardRef)(function(e,n){return(0,di.jsx)(hl,{ref:n,icon:"omrs-icon-gender-unknown",iconProps:e})})),fd=(0,uA.memo)((0,uA.forwardRef)(function(e,n){return(0,di.jsx)(hl,{ref:n,icon:"omrs-icon-generic-order-type",iconProps:e})})),ff=(0,uA.memo)((0,uA.forwardRef)(function(e,n){return(0,di.jsx)(hl,{ref:n,icon:"omrs-icon-group",iconProps:e})})),fh=(0,uA.memo)((0,uA.forwardRef)(function(e,n){return(0,di.jsx)(hl,{ref:n,icon:"omrs-icon-group-access",iconProps:e})})),fm=(0,uA.memo)((0,uA.forwardRef)(function(e,n){return(0,di.jsx)(hl,{ref:n,icon:"omrs-icon-hospital-bed",iconProps:e})})),fg=(0,uA.memo)((0,uA.forwardRef)(function(e,n){return(0,di.jsx)(hl,{ref:n,icon:"omrs-icon-image-medical",iconProps:e})})),fb=(0,uA.memo)((0,uA.forwardRef)(function(e,n){return(0,di.jsx)(hl,{ref:n,icon:"omrs-icon-information",iconProps:e})})),fy=(0,uA.memo)((0,uA.forwardRef)(function(e,n){return(0,di.jsx)(hl,{ref:n,icon:"omrs-icon-information-filled",iconProps:e})})),f_=(0,uA.memo)((0,uA.forwardRef)(function(e,n){return(0,di.jsx)(hl,{ref:n,icon:"omrs-icon-information-square",iconProps:e})})),fv=(0,uA.memo)((0,uA.forwardRef)(function(e,n){return(0,di.jsx)(hl,{ref:n,icon:"omrs-icon-inventory-management",iconProps:e})})),f$=(0,uA.memo)((0,uA.forwardRef)(function(e,n){return(0,di.jsx)(hl,{ref:n,icon:"omrs-icon-lab-order",iconProps:e})})),fA=(0,uA.memo)((0,uA.forwardRef)(function(e,n){return(0,di.jsx)(hl,{ref:n,icon:"omrs-icon-list-checked",iconProps:e})})),fw=(0,uA.memo)((0,uA.forwardRef)(function(e,n){return(0,di.jsx)(hl,{ref:n,icon:"omrs-icon-location",iconProps:e})})),fk=(0,uA.memo)((0,uA.forwardRef)(function(e,n){return(0,di.jsx)(hl,{ref:n,icon:"omrs-icon-material-order",iconProps:e})})),fx=(0,uA.memo)((0,uA.forwardRef)(function(e,n){return(0,di.jsx)(hl,{ref:n,icon:"omrs-icon-maximize",iconProps:e})})),fC=(0,uA.memo)((0,uA.forwardRef)(function(e,n){return(0,di.jsx)(hl,{ref:n,icon:"omrs-icon-medication",iconProps:e})})),fE=(0,uA.memo)((0,uA.forwardRef)(function(e,n){return(0,di.jsx)(hl,{ref:n,icon:"omrs-icon-message-queue",iconProps:e})})),fD=(0,uA.memo)((0,uA.forwardRef)(function(e,n){return(0,di.jsx)(hl,{ref:n,icon:"omrs-icon-microscope",iconProps:e})})),fS=(0,uA.memo)((0,uA.forwardRef)(function(e,n){return(0,di.jsx)(hl,{ref:n,icon:"omrs-icon-money",iconProps:e})})),fM=(0,uA.memo)((0,uA.forwardRef)(function(e,n){return(0,di.jsx)(hl,{ref:n,icon:"omrs-icon-mother",iconProps:e})})),fz=(0,uA.memo)((0,uA.forwardRef)(function(e,n){return(0,di.jsx)(hl,{ref:n,icon:"omrs-icon-movement",iconProps:e})})),fP=(0,uA.memo)((0,uA.forwardRef)(function(e,n){return(0,di.jsx)(hl,{ref:n,icon:"omrs-icon-overflow-menu--horizontal",iconProps:e})})),fO=(0,uA.memo)((0,uA.forwardRef)(function(e,n){return(0,di.jsx)(hl,{ref:n,icon:"omrs-icon-overflow-menu--horizontal",iconProps:e})})),fT=(0,uA.memo)((0,uA.forwardRef)(function(e,n){return(0,di.jsx)(hl,{ref:n,icon:"omrs-icon-password",iconProps:e})})),fB=(0,uA.memo)((0,uA.forwardRef)(function(e,n){return(0,di.jsx)(hl,{ref:n,icon:"omrs-icon-pedestrian-family",iconProps:e})})),fI=(0,uA.memo)((0,uA.forwardRef)(function(e,n){return(0,di.jsx)(hl,{ref:n,icon:"omrs-icon-pen",iconProps:e})})),fN=(0,uA.memo)((0,uA.forwardRef)(function(e,n){return(0,di.jsx)(hl,{ref:n,icon:"omrs-icon-printer",iconProps:e})})),fj=(0,uA.memo)((0,uA.forwardRef)(function(e,n){return(0,di.jsx)(hl,{ref:n,icon:"omrs-icon-procedure-order",iconProps:e})})),fR=(0,uA.memo)((0,uA.forwardRef)(function(e,n){return(0,di.jsx)(hl,{ref:n,icon:"omrs-icon-programs",iconProps:e})})),fF=(0,uA.memo)((0,uA.forwardRef)(function(e,n){return(0,di.jsx)(hl,{ref:n,icon:"omrs-icon-referral-order",iconProps:e})})),fL=(0,uA.memo)((0,uA.forwardRef)(function(e,n){return(0,di.jsx)(hl,{ref:n,icon:"omrs-icon-renew",iconProps:e})})),fW=(0,uA.memo)((0,uA.forwardRef)(function(e,n){return(0,di.jsx)(hl,{ref:n,icon:"omrs-icon-report",iconProps:e})})),fV=(0,uA.memo)((0,uA.forwardRef)(function(e,n){return(0,di.jsx)(hl,{ref:n,icon:"omrs-icon-reset",iconProps:e})})),fG=(0,uA.memo)((0,uA.forwardRef)(function(e,n){return(0,di.jsx)(hl,{ref:n,icon:"omrs-icon-save",iconProps:e})})),fU=(0,uA.memo)((0,uA.forwardRef)(function(e,n){return(0,di.jsx)(hl,{ref:n,icon:"omrs-icon-search",iconProps:e})})),fq=(0,uA.memo)((0,uA.forwardRef)(function(e,n){return(0,di.jsx)(hl,{ref:n,icon:"omrs-icon-settings",iconProps:e})})),fH=(0,uA.memo)((0,uA.forwardRef)(function(e,n){return(0,di.jsx)(hl,{ref:n,icon:"omrs-icon-switcher",iconProps:e})})),fK=(0,uA.memo)((0,uA.forwardRef)(function(e,n){return(0,di.jsx)(hl,{ref:n,icon:"omrs-icon-shopping-cart",iconProps:e})})),fY=(0,uA.memo)((0,uA.forwardRef)(function(e,n){return(0,di.jsx)(hl,{ref:n,icon:"omrs-icon-shopping-cart--arrow-down",iconProps:e})})),fJ=(0,uA.memo)((0,uA.forwardRef)(function(e,n){return(0,di.jsx)(hl,{ref:n,icon:"omrs-icon-sticky-note-add",iconProps:e})})),fZ=(0,uA.memo)((0,uA.forwardRef)(function(e,n){return(0,di.jsx)(hl,{ref:n,icon:"omrs-icon-syringe",iconProps:e})})),fX=(0,uA.memo)((0,uA.forwardRef)(function(e,n){return(0,di.jsx)(hl,{ref:n,icon:"omrs-icon-table-of-contents",iconProps:e})})),fQ=(0,uA.memo)((0,uA.forwardRef)(function(e,n){return(0,di.jsx)(hl,{ref:n,icon:"omrs-icon-table",iconProps:e})})),f0=(0,uA.memo)((0,uA.forwardRef)(function(e,n){return(0,di.jsx)(hl,{ref:n,icon:"omrs-icon-time",iconProps:e})})),f1=(0,uA.memo)((0,uA.forwardRef)(function(e,n){return(0,di.jsx)(hl,{ref:n,icon:"omrs-icon-tools",iconProps:e})})),f2=(0,uA.memo)((0,uA.forwardRef)(function(e,n){return(0,di.jsx)(hl,{ref:n,icon:"omrs-icon-translate",iconProps:e})})),f3=(0,uA.memo)((0,uA.forwardRef)(function(e,n){return(0,di.jsx)(hl,{ref:n,icon:"omrs-icon-trash-can",iconProps:e})})),f5=(0,uA.memo)((0,uA.forwardRef)(function(e,n){return(0,di.jsx)(hl,{ref:n,icon:"omrs-icon-tree-view--alt",iconProps:e})})),f4=(0,uA.memo)((0,uA.forwardRef)(function(e,n){return(0,di.jsx)(hl,{ref:n,icon:"omrs-icon-user-avatar",iconProps:e})})),f6=(0,uA.memo)((0,uA.forwardRef)(function(e,n){return(0,di.jsx)(hl,{ref:n,icon:"omrs-icon-user-follow",iconProps:e})})),f8=(0,uA.memo)((0,uA.forwardRef)(function(e,n){return(0,di.jsx)(hl,{ref:n,icon:"omrs-icon-user-xray",iconProps:e})})),f7=(0,uA.memo)((0,uA.forwardRef)(function(e,n){return(0,di.jsx)(hl,{ref:n,icon:"omrs-icon-user",iconProps:e})})),f9=(0,uA.memo)((0,uA.forwardRef)(function(e,n){return(0,di.jsx)(hl,{ref:n,icon:"omrs-icon-view-off",iconProps:e})})),he=(0,uA.memo)((0,uA.forwardRef)(function(e,n){return(0,di.jsx)(hl,{ref:n,icon:"omrs-icon-view",iconProps:e})})),hn=(0,uA.memo)((0,uA.forwardRef)(function(e,n){return(0,di.jsx)(hl,{ref:n,icon:"omrs-icon-warning",iconProps:e})})),ht=hn,hr=ft,ho=fA,hi=fg,ha=fY,hs=(0,uA.memo)((0,uA.forwardRef)(function({icon:e,fallback:n,...t},r){let o=(0,uA.useRef)(e?document.getElementById(e):void 0);return(0,uA.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,di.jsx)(pa,{value:o.current,fallback:n,children:(0,di.jsx)(hl,{ref:r,icon:e,iconProps:t})})})),hl=(0,uA.memo)((0,uA.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,uA.useRef)(null);return(0,uA.useImperativeHandle)(t,()=>a.current),(0,uA.useEffect)(()=>{a.current&&"currentColor"!==o&&a.current.style.setProperty("--omrs-icon-fill",o)},[]),(0,di.jsx)("svg",{ref:a,className:ds()("omrs-icon",dj.icon,r),height:i,width:i,viewBox:"0 0 16 16",children:(0,di.jsx)("use",{href:`#${e}`})})}));var hc=t(28852),hu={};hu.styleTagTransform=d_(),hu.setAttributes=dm(),hu.insert=df().bind(null,"head"),hu.domAPI=dp(),hu.insertStyleElement=db(),dc()(hc.A,hu);let hp=hc.A&&hc.A.locals?hc.A.locals:void 0,hd=({path:e,title:n,basePath:t,icon:r})=>{let{t:o}=(0,u3.useTranslation)(),i=(0,dT.zy)(),a=(0,uA.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,di.jsx)("div",{children:(0,di.jsx)(uk,{className:ds()("cds--side-nav__link",{"active-left-nav-link":a}),to:`${t}/${encodeURIComponent(e)}`,children:(0,di.jsxs)("span",{className:hp.menu,children:[(0,di.jsx)(hs,{icon:r,className:hp.icon,size:16}),(0,di.jsx)("span",{children:o(n)})]})})},e)};function hf(e){return function({basePath:n}){return(0,di.jsx)(dB.Kd,{children:(0,di.jsx)(hd,{basePath:n,...e})})}}function hh(e){let n=(0,uA.useRef)(null),t=(0,uA.useRef)(void 0),r=(0,uA.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,uA.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 hm(...e){return 1===e.length&&e[0]?e[0]:n=>{let t=!1,r=e.map(e=>{let r=hg(e,n);return t||="function"==typeof r,r});if(t)return()=>{r.forEach((n,t)=>{"function"==typeof n?n():hg(e[t],null)})}}}function hg(e,n){if("function"==typeof e)return e(n);null!=e&&(e.current=n)}function hb(...e){return(...n)=>{for(let t of e)"function"==typeof t&&t(...n)}}let hy="u">typeof document?uw().useLayoutEffect:()=>{},h_={prefix:String(Math.round(1e10*Math.random())),current:0},hv=uw().createContext(h_),h$=uw().createContext(!1),hA=("u">typeof window&&window.document&&window.document.createElement,new WeakMap),hw="function"==typeof uw().useId?function(e){let n=uw().useId(),[t]=(0,uA.useState)(hE()),r=t?"react-aria":`react-aria${h_.prefix}`;return e||`${r}-${n}`}:function(e){let n=(0,uA.useContext)(hv),t=function(e=!1){let n=(0,uA.useContext)(hv),t=(0,uA.useRef)(null);if(null===t.current&&!e){let e=uw().__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED?.ReactCurrentOwner?.current;if(e){let t=hA.get(e);null==t?hA.set(e,{id:n.current,state:e.memoizedState}):e.memoizedState!==t.state&&(n.current=t.id,hA.delete(e))}t.current=++n.current}return t.current}(!!e),r=`react-aria${n.prefix}`;return e||`${r}-${t}`};function hk(){return!1}function hx(){return!0}function hC(e){return()=>{}}function hE(){return"function"==typeof uw().useSyncExternalStore?uw().useSyncExternalStore(hC,hk,hx):(0,uA.useContext)(h$)}let hD=!!("u">typeof window&&window.document&&window.document.createElement),hS=new Map;function hM(e){let[n,t]=(0,uA.useState)(e),r=(0,uA.useRef)(null),o=hw(n),i=(0,uA.useRef)(null);if(s&&s.register(i,o),hD){let e=hS.get(o);e&&!e.includes(r)?e.push(r):hS.set(o,[r])}return hy(()=>()=>{s&&s.unregister(i),hS.delete(o)},[o]),(0,uA.useEffect)(()=>{let e=r.current;return e&&t(e),()=>{e&&(r.current=null)}}),o}function hz(e=[]){let n=hM(),[t,r]=function(e){let[n,t]=(0,uA.useState)(e),r=(0,uA.useRef)(n),o=(0,uA.useRef)(null),i=(0,uA.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 hy(()=>{r.current=n,o.current&&i.current()}),[n,(0,uA.useCallback)(e=>{o.current=e(r.current),i.current()},[i])]}(n),o=(0,uA.useCallback)(()=>{r(function*(){yield n,yield document.getElementById(n)?n:void 0})},[n,r]);return hy(o,[n,o,...e]),t}"u">typeof FinalizationRegistry&&(s=new FinalizationRegistry(e=>{hS.delete(e)}));let hP=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 hO(...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]=hb(t,o):("className"===e||"UNSAFE_className"===e)&&"string"==typeof t&&"string"==typeof o?n[e]=hP(t,o):"id"===e&&t&&o?n.id=function(e,n){if(e===n)return e;let t=hS.get(e);if(t)return t.forEach(e=>e.current=n),n;let r=hS.get(n);return r?(r.forEach(n=>n.current=e),e):n}(t,o):"ref"===e&&t&&o?n.ref=hm(t,o):n[e]=void 0!==o?o:t}}return n}let hT=Symbol("default");function hB({values:e,children:n}){for(let[t,r]of e)n=uw().createElement(t.Provider,{value:r},n);return n}function hI(e){let{className:n,style:t,children:r,defaultClassName:o,defaultChildren:i,defaultStyle:a,values:s}=e;return(0,uA.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 hN(e,n){let t=(0,uA.useContext)(e);if(null===n)return null;if(t&&"object"==typeof t&&"slots"in t&&t.slots){let e=n||hT;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 hj(e,n,t){let{ref:r,...o}=hN(t,e.slot)||{},i=hh((0,uA.useMemo)(()=>hm(n,r),[n,r])),a=hO(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 hR(e=!0){let[n,t]=(0,uA.useState)(e),r=(0,uA.useRef)(!1),o=(0,uA.useCallback)(e=>{r.current=!0,t(!!e)},[]);return hy(()=>{r.current||t(!1)},[]),[o,n]}function hF(e){let n=/^(data-.*)$/,t={};for(let r in e)n.test(r)||(t[r]=e[r]);return t}let hL=(0,uA.createContext)(null),hW=null;function hV(e,n="assertive",t=7e3){hW?hW.announce(e,n,t):(hW=new hG,("boolean"==typeof IS_REACT_ACT_ENVIRONMENT?IS_REACT_ACT_ENVIRONMENT:"u">typeof jest)?hW.announce(e,n,t):setTimeout(()=>{(null==hW?void 0:hW.isAttached())&&(null==hW||hW.announce(e,n,t))},100))}class hG{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 hU=new Set(["id"]),hq=new Set(["aria-label","aria-labelledby","aria-describedby","aria-details"]),hH=new Set(["href","hrefLang","target","rel","download","ping","referrerPolicy"]),hK=new Set(["dir","lang","hidden","inert","translate"]),hY=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"]),hJ=/^(data-.*)$/;function hZ(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)&&(hU.has(n)||t&&hq.has(n)||r&&hH.has(n)||o&&hK.has(n)||i&&(hY.has(n)||n.endsWith("Capture")&&hY.has(n.slice(0,-7)))||a?.has(n)||hJ.test(n))&&(s[n]=e[n]);return s}function hX(e){if(function(){if(null==hQ){hQ=!1;try{document.createElement("div").focus({get preventScroll(){return hQ=!0,!0}})}catch{}}return hQ}())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 hQ=null,h0=e=>e?.ownerDocument??document,h1=e=>e&&"window"in e&&e.window===e?e:h0(e).defaultView||window;function h2(e,n){return!!n&&!!e&&e.contains(n)}function h3(e){return e.target}function h5(e){if(!e)return!1;let n=e.getRootNode(),t=h1(e);if(!(n instanceof t.Document||n instanceof t.ShadowRoot))return!1;let r=n.activeElement;return null!=r&&e.contains(r)}let h4="u">typeof Element&&"checkVisibility"in Element.prototype;function h6(e,n){return h4?e.checkVisibility({visibilityProperty:!0})&&!e.closest("[data-react-aria-prevent-focus]"):"#comment"!==e.nodeName&&function(e){let n=h1(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||h6(e.parentElement,e))}let h8=["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"],h7=h8.join(":not([hidden]),")+",[tabindex]:not([disabled]):not([hidden])";h8.push('[tabindex]:not([tabindex="-1"]):not([disabled])');let h9=h8.join(':not([hidden]):not([tabindex="-1"]),');function me(e,n){return e.matches(h7)&&!mt(e)&&(n?.skipVisibilityCheck||h6(e))}function mn(e){return e.matches(h9)&&h6(e)&&!mt(e)}function mt(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 mo(e,n){Object.defineProperty(e,"target",{value:n}),Object.defineProperty(e,"currentTarget",{value:n})}function mi(e){let n=(0,uA.useRef)({isFocused:!1,observer:null});return hy(()=>{let e=n.current;return()=>{e.observer&&(e.observer.disconnect(),e.observer=null)}},[]),(0,uA.useCallback)(t=>{let r=h3(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 ma=!1;function ms(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 ml(e){return"u">typeof window&&null!=window.navigator&&e.test(window.navigator.userAgentData?.platform||window.navigator.platform)}function mc(e){let n=null;return()=>(null==n&&(n=e()),n)}let mu=mc(function(){return ml(/^Mac/i)}),mp=mc(function(){return ml(/^iPhone/i)}),md=mc(function(){return ml(/^iPad/i)||mu()&&navigator.maxTouchPoints>1}),mf=mc(function(){return mp()||md()});mc(function(){return mu()||mf()});let mh=mc(function(){return ms(/AppleWebKit/i)&&!mm()}),mm=mc(function(){return ms(/Chrome/i)}),mg=mc(function(){return ms(/Android/i)}),mb=mc(function(){return ms(/Firefox/i)});function my(e){return""===e.pointerType&&!!e.isTrusted||(mg()&&e.pointerType?"click"===e.type&&1===e.buttons:0===e.detail&&!e.pointerType)}function m_(e,n,t=!0){let{metaKey:r,ctrlKey:o,altKey:i,shiftKey:a}=n;mb()&&window.event?.type?.startsWith("key")&&"_blank"===e.target&&(mu()?r=!0:o=!0);let s=mh()&&mu()&&!md()&&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});m_.isOpening=t,hX(e),e.dispatchEvent(s),m_.isOpening=!1}m_.isOpening=!1;let mv=null,m$=new Set,mA=new Map,mw=!1,mk=!1,mx={Tab:!0,Escape:!0};function mC(e,n){for(let t of m$)t(e,n)}function mE(e){mw=!0,m_.isOpening||e.metaKey||!mu()&&e.altKey||e.ctrlKey||"Control"===e.key||"Shift"===e.key||"Meta"===e.key||(mv="keyboard",mC("keyboard",e))}function mD(e){mv="pointer","pointerType"in e&&e.pointerType,("mousedown"===e.type||"pointerdown"===e.type)&&(mw=!0,mC("pointer",e))}function mS(e){!m_.isOpening&&my(e)&&(mw=!0,mv="virtual")}function mM(e){let n=h1(h3(e)),t=h0(h3(e));h3(e)!==n&&h3(e)!==t&&!ma&&e.isTrusted&&(mw||mk||(mv="virtual",mC("virtual",e)),mw=!1,mk=!1)}function mz(){ma||(mw=!1,mk=!0)}function mP(e){if("u"<typeof window||"u"<typeof document)return;let n=h1(e),t=h0(e);if(mA.get(n))return;let r=n.HTMLElement.prototype.focus;n.HTMLElement.prototype.focus=function(){mw=!0,r.apply(this,arguments)},t.addEventListener("keydown",mE,!0),t.addEventListener("keyup",mE,!0),t.addEventListener("click",mS,!0),n.addEventListener("focus",mM,!0),n.addEventListener("blur",mz,!1),"u">typeof PointerEvent&&(t.addEventListener("pointerdown",mD,!0),t.addEventListener("pointermove",mD,!0),t.addEventListener("pointerup",mD,!0)),n.addEventListener("beforeunload",()=>{mO(e)},{once:!0}),mA.set(n,{focus:r})}let mO=(e,n)=>{let t=h1(e),r=h0(e);n&&r.removeEventListener("DOMContentLoaded",n),mA.has(t)&&(t.HTMLElement.prototype.focus=mA.get(t).focus,r.removeEventListener("keydown",mE,!0),r.removeEventListener("keyup",mE,!0),r.removeEventListener("click",mS,!0),t.removeEventListener("focus",mM,!0),t.removeEventListener("blur",mz,!1),"u">typeof PointerEvent&&(r.removeEventListener("pointerdown",mD,!0),r.removeEventListener("pointermove",mD,!0),r.removeEventListener("pointerup",mD,!0)),mA.delete(t))};function mT(){return"pointer"!==mv}"u">typeof document&&("loading"!==(f=h0(void 0)).readyState?mP(void 0):f.addEventListener("DOMContentLoaded",()=>{mP(void 0)}));let mB=new Set(["checkbox","radio","range","color","file","image","button","submit","reset"]),mI=new Map,mN=new Set;function mj(){if("u"<typeof window)return;function e(e){return"propertyName"in e}let n=t=>{let r=h3(t);if(!e(t)||!r)return;let o=mI.get(r);if(o&&(o.delete(t.propertyName),0===o.size&&(r.removeEventListener("transitioncancel",n),mI.delete(r)),0===mI.size)){for(let e of mN)e();mN.clear()}};document.body.addEventListener("transitionrun",t=>{let r=h3(t);if(!e(t)||!r)return;let o=mI.get(r);o||(o=new Set,mI.set(r,o),r.addEventListener("transitioncancel",n,{once:!0})),o.add(t.propertyName)}),document.body.addEventListener("transitionend",n)}function mR(e){requestAnimationFrame(()=>{for(let[e]of mI)"isConnected"in e&&!e.isConnected&&mI.delete(e);0===mI.size?e():mN.add(e)})}function mF(e){if(!e.isConnected)return;let n=h0(e);if("virtual"===mv){let t=((e=document)=>e.activeElement)(n);mR(()=>{let r=((e=document)=>e.activeElement)(n);(r===t||r===n.body)&&e.isConnected&&hX(e)})}else hX(e)}function mL(e){let{isDisabled:n,onFocus:t,onBlur:r,onFocusChange:o}=e,i=(0,uA.useCallback)(e=>{if(h3(e)===e.currentTarget)return r&&r(e),o&&o(!1),!0},[r,o]),a=mi(i),s=(0,uA.useCallback)(e=>{let n=h3(e),r=h0(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 mW(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 mV(e,n){hy(()=>{if(e&&e.ref&&n)return e.ref.current=n.current,()=>{e.ref&&(e.ref.current=null)}})}"u">typeof document&&("loading"!==document.readyState?mj():document.addEventListener("DOMContentLoaded",mj));let mG=uw().createContext(null);function mU(e,n){let{focusProps:t}=mL(e),{keyboardProps:r}={keyboardProps:e.isDisabled?{}:{onKeyDown:mW(e.onKeyDown),onKeyUp:mW(e.onKeyUp)}},o=hO(t,r),i=function(e){let n=(0,uA.useContext)(mG)||{};mV(n,e);let{ref:t,...r}=n;return r}(n),a=e.isDisabled?{}:i,s=(0,uA.useRef)(e.autoFocus);(0,uA.useEffect)(()=>{s.current&&n.current&&mF(n.current),s.current=!1},[n]);let l=e.excludeFromTabOrder?-1:0;return e.isDisabled&&(l=void 0),{focusableProps:hO({...o,tabIndex:l},a)}}uw().forwardRef(function(e,n){let{children:t,...r}=e,o=hh(n),i={...r,ref:o};return uw().createElement(mG.Provider,{value:i},t)});let mq="default",mH="",mK=new WeakMap;function mY(e){if(mf())"disabled"===mq&&(mq="restoring",setTimeout(()=>{mR(()=>{if("restoring"===mq){let n=h0(e);"none"===n.documentElement.style.webkitUserSelect&&(n.documentElement.style.webkitUserSelect=mH||""),mH="",mq="default"}})},300));else if((e instanceof HTMLElement||e instanceof SVGElement)&&e&&mK.has(e)){let n=mK.get(e),t="userSelect"in e.style?"userSelect":"webkitUserSelect";"none"===e.style[t]&&(e.style[t]=n),""===e.getAttribute("style")&&e.removeAttribute("style"),mK.delete(e)}}function mJ(e){let n=e?.defaultView;return n?.__webpack_nonce__||globalThis.__webpack_nonce__||void 0}let mZ=new WeakMap;function mX(e){let n=e??("u">typeof document?document:void 0);if(!n)return mJ(n);if(mZ.has(n))return mZ.get(n);let t=n.querySelector('meta[property="csp-nonce"]'),r=t&&t instanceof h1(t).HTMLMetaElement&&(t.nonce||t.content)||mJ(n)||void 0;return void 0!==r&&mZ.set(n,r),r}let mQ=uw().createContext({register:()=>{}});mQ.displayName="PressResponderContext";let m0=uw().useInsertionEffect??hy;function m1(e){let n=(0,uA.useRef)(null);return m0(()=>{n.current=e},[e]),(0,uA.useCallback)((...e)=>{let t=n.current;return t?.(...e)},[])}function m2(){let e=(0,uA.useRef)(new Map),n=(0,uA.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,uA.useCallback)((n,t,r,o)=>{let i=e.current.get(r)?.fn||r;n.removeEventListener(t,i,o),e.current.delete(r)},[]),r=(0,uA.useCallback)(()=>{e.current.forEach((e,n)=>{t(e.eventTarget,e.type,n,e.options)})},[t]);return(0,uA.useEffect)(()=>r,[r]),{addGlobalListener:n,removeGlobalListener:t,removeAllGlobalListeners:r}}var m3=t(54575),m5=t.n(m3);class m4{#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 m6=Symbol("linkClicked"),m8="react-aria-pressable-style",m7="data-react-aria-pressable";function m9(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,uA.useContext)(mQ);if(n){let{register:t,ref:r,...o}=n;e=hO(o,e),t()}return mV(n,e.ref),e}(e),[h,m]=(0,uA.useState)(!1),g=(0,uA.useRef)({isPressed:!1,ignoreEmulatedMouseEvents:!1,didFirePressStart:!1,isTriggeringEvent:!1,activePointerId:null,target:null,isOverTarget:!1,pointerType:null,disposables:[]}),{addGlobalListener:b,removeAllGlobalListeners:y}=m2(),v=(0,uA.useCallback)((e,n)=>{let o=g.current;if(s||o.didFirePressStart)return!1;let i=!0;if(o.isTriggeringEvent=!0,r){let t=new m4("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,uA.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 m4("pressend",r,e);o(n),l=n.shouldStopPropagation}if(t&&t(!1),m(!1),n&&i&&!s){let t=new m4("press",r,e);n(t),l&&=t.shouldStopPropagation}return a.isTriggeringEvent=!1,l},[s,o,t,n]),A=m1($),w=m1((0,uA.useCallback)((e,n)=>{let t=g.current;if(s)return!1;if(i){t.isTriggeringEvent=!0;let r=new m4("pressup",n,e);return i(r),t.isTriggeringEvent=!1,r.shouldStopPropagation}return!0},[s,i])),k=(0,uA.useCallback)(e=>{let n=g.current;if(n.isPressed&&n.target){for(let t of(n.didFirePressStart&&null!=n.pointerType&&$(gt(n.target,e),n.pointerType,!1),n.isPressed=!1,n.isOverTarget=!1,n.activePointerId=null,n.pointerType=null,y(),p||mY(n.target),n.disposables))t();n.disposables=[]}},[p,y,$]),x=m1(k),C=(0,uA.useCallback)(e=>{u&&k(e)},[u,k]),E=(0,uA.useCallback)(e=>{s||a?.(e)},[s,a]),D=(0,uA.useCallback)((e,n)=>{if(!s&&a){let t=new MouseEvent("click",e);mo(t,n),a(mr(t))}},[s,a]),S=(0,uA.useMemo)(()=>{let e=g.current,n={onKeyDown(n){if(gn(n.nativeEvent,n.currentTarget)&&h2(n.currentTarget,h3(n))){gr(h3(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(h0(n.currentTarget),"keyup",hb(n=>{gn(n,o)&&!n.repeat&&h2(o,h3(n))&&e.target&&w(gt(e.target,n),"keyboard")},t),!0),r&&n.stopPropagation(),n.metaKey&&mu()&&e.metaKeyEvents?.set(n.key,n.nativeEvent)}else"Meta"===n.key&&(e.metaKeyEvents=new Map)},onClick(n){if((!n||h2(n.currentTarget,h3(n)))&&n&&0===n.button&&!e.isTriggeringEvent&&!m_.isOpening){let t=!0;if(s&&n.preventDefault(),!e.ignoreEmulatedMouseEvents&&!e.isPressed&&("virtual"===e.pointerType||my(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(gt(n.currentTarget,n),r),i=A(gt(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(h3(n),n.key)&&n.preventDefault();let t=h3(n),r=h2(e.target,t);A(gt(e.target,n),"keyboard",r),r&&D(n,e.target),y(),"Enter"!==n.key&&ge(e.target)&&h2(e.target,t)&&!n[m6]&&(n[m6]=!0,m_(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||!h2(n.currentTarget,h3(n)))return;if(o=n.nativeEvent,!mg()&&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(mf()){if("default"===mq){let n=h0(e);mH=n.documentElement.style.webkitUserSelect,n.documentElement.style.webkitUserSelect="none"}mq="disabled"}else if(e instanceof HTMLElement||e instanceof SVGElement){let n="userSelect"in e.style?"userSelect":"webkitUserSelect";mK.set(e,e.style[n]),e.style[n]="none"}}(e.target),i=v(n,e.pointerType);let o=h3(n);"releasePointerCapture"in o&&("hasPointerCapture"in o?o.hasPointerCapture(n.pointerId)&&o.releasePointerCapture(n.pointerId):o.releasePointerCapture(n.pointerId)),b(h0(n.currentTarget),"pointerup",t,!1),b(h0(n.currentTarget),"pointercancel",r,!1)}i&&n.stopPropagation()},n.onMouseDown=n=>{if(h2(n.currentTarget,h3(n))&&0===n.button){if(c){let t=function(e){for(;e&&!me(e,{skipVisibilityCheck:!0});)e=e.parentElement;let n=h1(e),t=n.document.activeElement;if(!t||t===e)return;ma=!0;let r=!1,o=e=>{(h3(e)===t||r)&&e.stopImmediatePropagation()},i=n=>{(h3(n)===t||r)&&(n.stopImmediatePropagation(),e||r||(r=!0,hX(t),l()))},a=n=>{(h3(n)===e||r)&&n.stopImmediatePropagation()},s=n=>{(h3(n)===e||r)&&(n.stopImmediatePropagation(),r||(r=!0,hX(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),ma=!1,r=!1},c=requestAnimationFrame(l);return l}(n.target);t&&e.disposables.push(t)}n.stopPropagation()}},n.onPointerUp=n=>{h2(n.currentTarget,h3(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(gt(e.target,n),e.pointerType))},n.onPointerLeave=n=>{n.pointerId===e.activePointerId&&e.target&&e.isOverTarget&&null!=e.pointerType&&(e.isOverTarget=!1,A(gt(e.target,n),e.pointerType,!1),C(n))};let t=n=>{if(n.pointerId===e.activePointerId&&e.isPressed&&0===n.button&&e.target){if(h2(e.target,h3(n))&&null!=e.pointerType){let t=!1,r=setTimeout(()=>{e.isPressed&&e.target instanceof HTMLElement&&(t?x(n):(hX(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=>{h2(e.currentTarget,h3(e))&&x(e)}}return n},[b,s,c,y,p,C,v,E,D]);return(0,uA.useEffect)(()=>{if(!d)return;let e=h0(d.current);if(!e||!e.head||e.getElementById(m8))return;let n=e.createElement("style");n.id=m8;let t=mX(e);t&&(n.nonce=t),n.textContent=`
17
17
  @layer {
18
18
  [${m7}] {
@@ -24,4 +24,4 @@ Usually this is already applied when using "getAsyncLifecycle" or "getSyncLifecy
24
24
  * {
25
25
  overscroll-behavior: contain;
26
26
  }
27
- }`.trim(),document.head.prepend(r),i=HTMLElement.prototype.focus,HTMLElement.prototype.focus=function(e){let n=((e=document)=>e.activeElement)(),t=null!=n&&v8(n);i.call(this,{...e,preventScroll:!0}),e&&e.preventScroll||$t(this,t)},a=hb($n(document,"touchstart",n=>{let r=h3(n);e=yt(r)?r:yr(r,!0),t=!1;let o=r.ownerDocument.defaultView.getSelection();o&&!o.isCollapsed&&o.containsNode(r,!0)&&(t=!0),n.composedPath().some(e=>e instanceof HTMLInputElement&&"range"===e.type)&&(t=!0),"selectionStart"in r&&"selectionEnd"in r&&r.selectionStart<r.selectionEnd&&r.ownerDocument.activeElement===r&&(t=!0)},{passive:!1,capture:!0}),$n(document,"touchmove",n=>{if(2!==n.touches.length&&!t){if(!e||e===document.documentElement||e===document.body)return void n.preventDefault();e.scrollHeight===e.clientHeight&&e.scrollWidth===e.clientWidth&&n.preventDefault()}},{passive:!1,capture:!0}),$n(document,"blur",e=>{let n=h3(e),t=e.relatedTarget;if(t&&v8(t))t.focus({preventScroll:!0}),$t(t,v8(n));else if(!t){let e=n.parentElement?.closest("[tabindex]");e?.focus({preventScroll:!0})}},!0)),()=>{n(),a(),r.remove(),HTMLElement.prototype.focus=i}):hb((s=window.innerWidth-document.documentElement.clientWidth)>0&&("scrollbarGutter"in document.documentElement.style?$e(document.documentElement,"scrollbarGutter","stable"):$e(document.documentElement,"paddingRight",`${s}px`)),$e(document.documentElement,"overflow","hidden"))),()=>{0==--v9&&u()}}},[n])}({isDisabled:i||!n.isOpen}),(0,uA.useEffect)(()=>{if(n.isOpen&&r.current)if(i){var e,t,a=o?.current??r.current;let n=vI[vI.length-1];return n&&!n.visibleNodes.has(a)?(n.visibleNodes.add(a),()=>{n.visibleNodes.delete(a)}):void 0}else{let n,i,a,s,l,c,u,p,d,f,h;return e=[o?.current??r.current],i=(t={shouldUseInert:!0})instanceof(n=h1(e?.[0])).Element?{root:t}:t,a=i?.root??document.body,s=i?.shouldUseInert&&vT,l=new Set(e),c=new Set,u=(e,t)=>{s&&e instanceof n.HTMLElement?e.inert=t:t?e.setAttribute("aria-hidden","true"):(e.removeAttribute("aria-hidden"),e instanceof n.HTMLElement&&(e.inert=!1))},p=e=>{for(let n of e.querySelectorAll("[data-live-announcer], [data-react-aria-top-layer]"))l.add(n);let n=e=>{if(c.has(e)||l.has(e)||e.parentElement&&c.has(e.parentElement)&&"row"!==e.parentElement.getAttribute("role"))return NodeFilter.FILTER_REJECT;for(let n of l)if(h2(e,n))return NodeFilter.FILTER_SKIP;return NodeFilter.FILTER_ACCEPT},t=_y(h0(e),e,NodeFilter.SHOW_ELEMENT,{acceptNode:n}),r=n(e);if(r===NodeFilter.FILTER_ACCEPT&&d(e),r!==NodeFilter.FILTER_REJECT){let e=t.nextNode();for(;null!=e;)d(e),e=t.nextNode()}},d=e=>{let t=vB.get(e)??0;(s&&e instanceof n.HTMLElement?e.inert:"true"===e.getAttribute("aria-hidden"))&&0===t||(0===t&&u(e,!0),c.add(e),vB.set(e,t+1))},vI.length&&vI[vI.length-1].disconnect(),p(a),(f=new MutationObserver(e=>{for(let t of e)if("childList"===t.type&&t.target.isConnected&&![...l,...c].some(e=>h2(e,t.target)))for(let e of t.addedNodes){var n;(e instanceof HTMLElement||e instanceof SVGElement)&&("true"===(n=e).dataset.liveAnnouncer||void 0!==n.dataset.reactAriaTopLayer)?l.add(e):e instanceof Element&&p(e)}})).observe(a,{childList:!0,subtree:!0}),h={visibleNodes:l,hiddenNodes:c,observe(){f.observe(a,{childList:!0,subtree:!0})},disconnect(){f.disconnect()}},vI.push(h),()=>{for(let e of(f.disconnect(),c)){let n=vB.get(e);null!=n&&(1===n?(u(e,!1),vB.delete(e)):vB.set(e,n-1))}h===vI[vI.length-1]?(vI.pop(),vI.length&&vI[vI.length-1].observe()):vI.splice(vI.indexOf(h),1)}}},[i,n.isOpen,r,o]),{popoverProps:hO(p,f),arrowProps:h,underlayProps:d,placement:m,triggerAnchorPoint:g}}({...r,offset:null!=(o=r.offset)?o:8,arrowSize:s,groupRef:d?p:c},e),b=r.popoverRef,y=function(e,n=!0){let[t,r]=(0,uA.useState)(!0),o=t&&n;return hy(()=>{if(o&&e.current&&"getAnimations"in e.current)for(let n of e.current.getAnimations())n instanceof CSSTransition&&n.cancel()},[e,o]),$a(e,o,(0,uA.useCallback)(()=>r(!1),[])),o}(b,!!g)||r.isEntering||!1,v=hI({...r,defaultClassName:"react-aria-Popover",values:{trigger:r.trigger||null,placement:g,isEntering:y,isExiting:n}}),$=!r.isNonModal||"SubmenuTrigger"===r.trigger,[A,w]=(0,uA.useState)(!1);hy(()=>{b.current&&w($&&!b.current.querySelector("[role=dialog]"))},[b,$]),(0,uA.useEffect)(()=>{var e;let n,t;A&&b.current&&!b.current.contains(document.activeElement)&&(t=((e=document)=>e.activeElement)(n=h0(e=b.current)),"virtual"===$s?mR(()=>{((e=document)=>e.activeElement)(n)===t&&e.isConnected&&hX(e)}):hX(e))},[A,b]);let k={...f.style,...v.style},x=uw().createElement("div",{...hO(hZ(r),f),...v,role:A?"dialog":void 0,tabIndex:A?-1:void 0,"aria-label":r["aria-label"],"aria-labelledby":r["aria-labelledby"],ref:b,slot:r.slot||void 0,style:k,dir:r.dir,"data-trigger":r.trigger,"data-placement":g,"data-entering":y||void 0,"data-exiting":n||void 0},!r.isNonModal&&uw().createElement($i,{onDismiss:e.close}),uw().createElement(vO.Provider,{value:{...m,placement:g,ref:a}},v.children),uw().createElement($i,{onDismiss:e.close}));return d?uw().createElement(vw,{...r,shouldContainFocus:A,isExiting:n,portalContainer:null!=(i=null!=t?t:null==p?void 0:p.current)?i:void 0},x):uw().createElement(vw,{...r,shouldContainFocus:A,isExiting:n,portalContainer:t},!r.isNonModal&&e.isOpen&&uw().createElement("div",{"data-testid":"underlay",...h,style:{position:"fixed",inset:0}}),uw().createElement("div",{ref:c,style:{display:"contents"}},uw().createElement($A.Provider,{value:c},x)))}function $x(e){return e?.start!=null&&null!=e.end}let $C=(0,uA.createContext)(null),$E=(0,uA.createContext)(null),$D=(0,uA.createContext)(null),$S=(0,uA.createContext)(null),$M=(0,uA.forwardRef)(function(e,n){var t,r;[e,n]=hj(e,n,$C);let{validationBehavior:o}=hN(vM)||{},i=null!=(r=null!=(t=e.validationBehavior)?t:o)?r:"native",a=function(e){let n=$v(e),[t,r]=y6(e.value,e.defaultValue||null,e.onChange),[o]=(0,uA.useState)(t),i=t||e.placeholderValue||null,[a,s]=vo(i,e.granularity),l=null!=t?t.toDate(s??"UTC"):null,c="hour"===a||"minute"===a||"second"===a,u=e.shouldCloseOnSelect??!0,[p,d]=(0,uA.useState)(null),[f,h]=(0,uA.useState)(null);if(t&&(p=t,"hour"in t&&(f=t)),i&&!(a in i))throw Error("Invalid granularity "+a+" for value "+i.toString());let m=t?.calendar.identifier==="gregory"&&"BC"===t.era,g=(0,uA.useMemo)(()=>({granularity:a,timeZone:s,hideTimeZone:e.hideTimeZone,hourCycle:e.hourCycle,shouldForceLeadingZeros:e.shouldForceLeadingZeros,showEra:m}),[a,e.hourCycle,e.shouldForceLeadingZeros,s,e.hideTimeZone,m]),{minValue:b,maxValue:y,isDateUnavailable:v}=e,$=(0,uA.useMemo)(()=>_7(t,b,y,v,g),[t,b,y,v,g]),A=_1({...e,value:t,builtinValidation:$}),w=A.displayValidation.isInvalid,k=e.validationState||(w?"invalid":null),x=(e,n)=>{r("timeZone"in n?n.set(bP(e)):bO(e,n)),d(null),h(null),A.commitValidation()};return{...A,value:t,defaultValue:e.defaultValue??o,setValue:r,dateValue:p,timeValue:f,setDateValue:t=>{let o="function"==typeof u?u():u;c?f||o?x(t,f||vt(e.defaultValue||e.placeholderValue)):d(t):(r(t),A.commitValidation()),o&&n.setOpen(!1)},setTimeValue:e=>{p&&e?x(p,e):h(e)},granularity:a,hasTime:c,...n,setOpen(r){!r&&!t&&p&&c&&x(p,f||vt(e.defaultValue||e.placeholderValue)),n.setOpen(r)},validationState:k,isInvalid:w,formatValue:(e,n)=>l?new gL(e,vn(n,g)).format(l):"",getDateFormatter:(e,n)=>new gL(e,vn({},{...g,...n}))}}({...e,validationBehavior:i}),s=(0,uA.useRef)(null),[l,c]=hR(!e["aria-label"]&&!e["aria-labelledby"]),{groupProps:u,labelProps:p,fieldProps:d,buttonProps:f,dialogProps:h,calendarProps:m,descriptionProps:g,errorMessageProps:b,...y}=function(e,n,t){var r;let o=hM(),i=hM(),a=hM(),s=g2((r=_R)&&r.__esModule?r.default:r,"@react-aria/datepicker"),{isInvalid:l,validationErrors:c,validationDetails:u}=n.displayValidation,{labelProps:p,fieldProps:d,descriptionProps:f,errorMessageProps:h}=_W({...e,labelElementType:"span",isInvalid:l,errorMessage:e.errorMessage||c}),m=_F(n,t),g=d["aria-labelledby"]||d.id,{locale:b}=gT(),y=n.formatValue(b,{month:"long"}),v=yc(y?s.format("selectedDateDescription",{date:y}):""),$=[v["aria-describedby"],d["aria-describedby"]].filter(Boolean).join(" ")||void 0,A=hZ(e),w=(0,uA.useMemo)(()=>_T(t),[t]),k=(0,uA.useRef)(!1),{focusWithinProps:x}=ga({...e,isDisabled:n.isOpen,onBlurWithin:n=>{h2(document.getElementById(i),n.relatedTarget)||(k.current=!1,e.onBlur?.(n),e.onFocusChange?.(!1))},onFocusWithin:n=>{k.current||(k.current=!0,e.onFocus?.(n),e.onFocusChange?.(!0))}});return{groupProps:hO(A,m,d,v,x,{role:"group","aria-disabled":e.isDisabled||null,"aria-labelledby":g,"aria-describedby":$,onKeyDown(t){!n.isOpen&&e.onKeyDown&&e.onKeyDown(t)},onKeyUp(t){!n.isOpen&&e.onKeyUp&&e.onKeyUp(t)}}),labelProps:{...p,onClick:()=>{w.focusFirst()}},fieldProps:{...d,id:a,[_q]:"presentation","aria-describedby":$,value:n.value,defaultValue:n.defaultValue,onChange:n.setValue,placeholderValue:e.placeholderValue,hideTimeZone:e.hideTimeZone,hourCycle:e.hourCycle,shouldForceLeadingZeros:e.shouldForceLeadingZeros,granularity:e.granularity,isDisabled:e.isDisabled,isReadOnly:e.isReadOnly,isRequired:e.isRequired,validationBehavior:e.validationBehavior,[_0]:n,autoFocus:e.autoFocus,name:e.name,form:e.form},descriptionProps:f,errorMessageProps:h,buttonProps:{...v,id:o,"aria-haspopup":"dialog","aria-label":s.format("calendar"),"aria-labelledby":`${o} ${g}`,"aria-describedby":$,"aria-expanded":n.isOpen,isDisabled:e.isDisabled||e.isReadOnly,onPress:()=>n.setOpen(!0)},dialogProps:{id:i,"aria-labelledby":`${o} ${g}`},calendarProps:{autoFocus:!0,value:n.dateValue,onChange:n.setDateValue,minValue:e.minValue,maxValue:e.maxValue,isDisabled:e.isDisabled,isReadOnly:e.isReadOnly,isDateUnavailable:e.isDateUnavailable,defaultFocusedValue:n.dateValue?void 0:e.placeholderValue,isInvalid:n.isInvalid,errorMessage:"function"==typeof e.errorMessage?e.errorMessage(n.displayValidation):e.errorMessage||n.displayValidation.validationErrors.join(" "),firstDayOfWeek:e.firstDayOfWeek,pageBehavior:e.pageBehavior},isInvalid:l,validationErrors:c,validationDetails:u}}({...hF(e),label:c,validationBehavior:i},a,s),[v,$]=(0,uA.useState)(null),A=(0,uA.useCallback)(()=>{s.current&&$(s.current.offsetWidth+"px")},[]);v2({ref:s,onResize:A});let{focusProps:w,isFocused:k,isFocusVisible:x}=gs({within:!0}),C=hI({...e,values:{state:a,isFocusWithin:k,isFocusVisible:x,isDisabled:e.isDisabled||!1,isInvalid:a.isInvalid,isOpen:a.isOpen},defaultClassName:"react-aria-DatePicker"}),E=hZ(e);return delete E.id,uw().createElement(hB,{values:[[$D,a],[_h,{...u,ref:s,isInvalid:a.isInvalid}],[vh,d],[gg,{...f,isPressed:a.isOpen}],[vz,{...p,ref:l,elementType:"span"}],[_t,m],[vx,a],[$$,{trigger:"DatePicker",triggerRef:s,placement:"bottom start",style:{"--trigger-width":v}}],[vk,h],[g_,{slots:{description:g,errorMessage:b}}],[vE,y]]},uw().createElement("div",{...w,...E,...C,ref:n,slot:e.slot||void 0,"data-focus-within":k||void 0,"data-invalid":a.isInvalid||void 0,"data-focus-visible":x||void 0,"data-disabled":e.isDisabled||void 0,"data-open":a.isOpen||void 0}))}),$z=(0,uA.forwardRef)(function(e,n){var t,r;[e,n]=hj(e,n,$E);let{validationBehavior:o}=hN(vM)||{},i=null!=(r=null!=(t=e.validationBehavior)?t:o)?r:"native",a=function(e){let n=$v(e),[t,r]=y6(e.value,e.defaultValue||null,e.onChange),[o]=(0,uA.useState)(t),[i,a]=(0,uA.useState)(()=>t||{start:null,end:null});null==t&&i.start&&i.end&&a(i={start:null,end:null});let s=t||i,l=e=>{a(s=e||{start:null,end:null}),$x(s)?r(s):r(null)},[c,u]=vo(s?.start||s?.end||e.placeholderValue||null,e.granularity),p="hour"===c||"minute"===c||"second"===c,d=e.shouldCloseOnSelect??!0,[f,h]=(0,uA.useState)(null),[m,g]=(0,uA.useState)(null);s&&$x(s)&&(f=s,"hour"in s.start&&(m=s));let b=(e,n)=>{l({start:"timeZone"in n.start?n.start.set(bP(e.start)):bO(e.start,n.start),end:"timeZone"in n.end?n.end.set(bP(e.end)):bO(e.end,n.end)}),h(null),g(null),E.commitValidation()},y=t=>{let r="function"==typeof d?d():d;p?$x(t)&&(r||m?.start&&m?.end)?b(t,{start:m?.start||vt(e.placeholderValue),end:m?.end||vt(e.placeholderValue)}):h(t):$x(t)?(l(t),E.commitValidation()):h(t),r&&n.setOpen(!1)},v=e=>{$x(f)&&$x(e)?b(f,e):g(e)},$=s?.start?.calendar.identifier==="gregory"&&"BC"===s.start.era||s?.end?.calendar.identifier==="gregory"&&"BC"===s.end.era,A=(0,uA.useMemo)(()=>({granularity:c,timeZone:u,hideTimeZone:e.hideTimeZone,hourCycle:e.hourCycle,shouldForceLeadingZeros:e.shouldForceLeadingZeros,showEra:$}),[c,e.hourCycle,e.shouldForceLeadingZeros,u,e.hideTimeZone,$]),{minValue:w,maxValue:k,isDateUnavailable:x}=e,C=(0,uA.useMemo)(()=>{var e;let n;return e=s,n=_4(_7(e?.start??null,w,k,x,A),_7(e?.end??null,w,k,x,A)),e?.end!=null&&null!=e.start&&0>e.end.compare(e.start)&&(n=_4(n,{isInvalid:!0,validationErrors:[(gJ.getGlobalDictionaryForPackage("@react-stately/datepicker")||_6).getStringForLocale("rangeReversed",_8())],validationDetails:{..._J,rangeUnderflow:!0,rangeOverflow:!0,valid:!1}})),n},[s,w,k,x,A]),E=_1({...e,value:t,name:(0,uA.useMemo)(()=>[e.startName,e.endName].filter(e=>null!=e),[e.startName,e.endName]),builtinValidation:C}),D=E.displayValidation.isInvalid,S=e.validationState||(D?"invalid":null);return{...E,value:s,defaultValue:e.defaultValue??o,setValue:l,dateRange:f,timeRange:m,granularity:c,hasTime:p,setDate(e,n){"start"===e?y({start:n,end:f?.end??null}):y({start:f?.start??null,end:n})},setTime(e,n){"start"===e?v({start:n,end:m?.end??null}):v({start:m?.start??null,end:n})},setDateTime(e,n){"start"===e?l({start:n,end:s?.end??null}):l({start:s?.start??null,end:n})},setDateRange:y,setTimeRange:v,...n,setOpen(t){!t&&!(s?.start&&s?.end)&&$x(f)&&p&&b(f,{start:m?.start||vt(e.placeholderValue),end:m?.end||vt(e.placeholderValue)}),n.setOpen(t)},validationState:S,isInvalid:D,formatValue(n,t){let r;if(!s||!s.start||!s.end)return null;let o="timeZone"in s.start?s.start.timeZone:void 0,i=e.granularity||(s.start&&"minute"in s.start?"minute":"day"),a="timeZone"in s.end?s.end.timeZone:void 0,l=e.granularity||(s.end&&"minute"in s.end?"minute":"day"),c=vn(t,{granularity:i,timeZone:o,hideTimeZone:e.hideTimeZone,hourCycle:e.hourCycle,showEra:"gregory"===s.start.calendar.identifier&&"BC"===s.start.era||"gregory"===s.end.calendar.identifier&&"BC"===s.end.era}),u=s.start.toDate(o||"UTC"),p=s.end.toDate(a||"UTC"),d=new gL(n,c);if(o===a&&i===l&&0!==s.start.compare(s.end)){try{let e=d.formatRangeToParts(u,p),n=-1;for(let t=0;t<e.length;t++){let r=e[t];if("shared"===r.source&&"literal"===r.type)n=t;else if("endRange"===r.source)break}let t="",r="";for(let o=0;o<e.length;o++)o<n?t+=e[o].value:o>n&&(r+=e[o].value);return{start:t,end:r}}catch{}r=d}else r=new gL(n,vn(t,{granularity:l,timeZone:a,hideTimeZone:e.hideTimeZone,hourCycle:e.hourCycle}));return{start:d.format(u),end:r.format(p)}},getDateFormatter:(e,n)=>new gL(e,vn({},{...A,...n}))}}({...e,validationBehavior:i}),s=(0,uA.useRef)(null),[l,c]=hR(!e["aria-label"]&&!e["aria-labelledby"]),{groupProps:u,labelProps:p,startFieldProps:d,endFieldProps:f,buttonProps:h,dialogProps:m,calendarProps:g,descriptionProps:b,errorMessageProps:y,...v}=function(e,n,t){var r;let o=g2((r=_R)&&r.__esModule?r.default:r,"@react-aria/datepicker"),{isInvalid:i,validationErrors:a,validationDetails:s}=n.displayValidation,{labelProps:l,fieldProps:c,descriptionProps:u,errorMessageProps:p}=_W({...e,labelElementType:"span",isInvalid:i,errorMessage:e.errorMessage||a}),d=c["aria-labelledby"]||c.id,{locale:f}=gT(),h=n.formatValue(f,{month:"long"}),m=yc(h?o.format("selectedRangeDescription",{startDate:h.start,endDate:h.end}):""),g={"aria-label":o.format("startDate"),"aria-labelledby":d},b={"aria-label":o.format("endDate"),"aria-labelledby":d},y=hM(),v=hM(),$=_F(n,t),A=[m["aria-describedby"],c["aria-describedby"]].filter(Boolean).join(" ")||void 0,w=(0,uA.useMemo)(()=>_T(t,{accept:e=>e.id!==y}),[t,y]),k={[_H]:w,[_q]:"presentation","aria-describedby":A,placeholderValue:e.placeholderValue,hideTimeZone:e.hideTimeZone,hourCycle:e.hourCycle,granularity:e.granularity,shouldForceLeadingZeros:e.shouldForceLeadingZeros,isDisabled:e.isDisabled,isReadOnly:e.isReadOnly,isRequired:e.isRequired,validationBehavior:e.validationBehavior},x=hZ(e),C=(0,uA.useRef)(!1),{focusWithinProps:E}=ga({...e,isDisabled:n.isOpen,onBlurWithin:n=>{h2(document.getElementById(v),n.relatedTarget)||(C.current=!1,e.onBlur?.(n),e.onFocusChange?.(!1))},onFocusWithin:n=>{C.current||(C.current=!0,e.onFocus?.(n),e.onFocusChange?.(!0))}}),D=(0,uA.useRef)(_X),S=(0,uA.useRef)(_X);return{groupProps:hO(x,$,c,m,E,{role:"group","aria-disabled":e.isDisabled||null,"aria-describedby":A,onKeyDown(t){!n.isOpen&&e.onKeyDown&&e.onKeyDown(t)},onKeyUp(t){!n.isOpen&&e.onKeyUp&&e.onKeyUp(t)}}),labelProps:{...l,onClick:()=>{w.focusFirst()}},buttonProps:{...m,id:y,"aria-haspopup":"dialog","aria-label":o.format("calendar"),"aria-labelledby":`${y} ${d}`,"aria-describedby":A,"aria-expanded":n.isOpen,isDisabled:e.isDisabled||e.isReadOnly,onPress:()=>n.setOpen(!0)},dialogProps:{id:v,"aria-labelledby":`${y} ${d}`},startFieldProps:{...g,...k,value:n.value?.start??null,defaultValue:n.defaultValue?.start,onChange:e=>n.setDateTime("start",e),autoFocus:e.autoFocus,name:e.startName,form:e.form,[_0]:{realtimeValidation:n.realtimeValidation,displayValidation:n.displayValidation,updateValidation(e){D.current=e,n.updateValidation(_4(e,S.current))},resetValidation:n.resetValidation,commitValidation:n.commitValidation}},endFieldProps:{...b,...k,value:n.value?.end??null,defaultValue:n.defaultValue?.end,onChange:e=>n.setDateTime("end",e),name:e.endName,form:e.form,[_0]:{realtimeValidation:n.realtimeValidation,displayValidation:n.displayValidation,updateValidation(e){S.current=e,n.updateValidation(_4(D.current,e))},resetValidation:n.resetValidation,commitValidation:n.commitValidation}},descriptionProps:u,errorMessageProps:p,calendarProps:{autoFocus:!0,value:n.dateRange?.start&&n.dateRange.end?n.dateRange:null,onChange:n.setDateRange,minValue:e.minValue,maxValue:e.maxValue,isDisabled:e.isDisabled,isReadOnly:e.isReadOnly,isDateUnavailable:e.isDateUnavailable,allowsNonContiguousRanges:e.allowsNonContiguousRanges,defaultFocusedValue:n.dateRange?void 0:e.placeholderValue,isInvalid:n.isInvalid,errorMessage:"function"==typeof e.errorMessage?e.errorMessage(n.displayValidation):e.errorMessage||n.displayValidation.validationErrors.join(" "),firstDayOfWeek:e.firstDayOfWeek,pageBehavior:e.pageBehavior},isInvalid:i,validationErrors:a,validationDetails:s}}({...hF(e),label:c,validationBehavior:i},a,s),[$,A]=(0,uA.useState)(null),w=(0,uA.useCallback)(()=>{s.current&&A(s.current.offsetWidth+"px")},[]);v2({ref:s,onResize:w});let{focusProps:k,isFocused:x,isFocusVisible:C}=gs({within:!0}),E=hI({...e,values:{state:a,isFocusWithin:x,isFocusVisible:C,isDisabled:e.isDisabled||!1,isInvalid:a.isInvalid,isOpen:a.isOpen},defaultClassName:"react-aria-DateRangePicker"}),D=hZ(e);return delete D.id,uw().createElement(hB,{values:[[$S,a],[_h,{...u,ref:s,isInvalid:a.isInvalid}],[gg,{...h,isPressed:a.isOpen}],[vz,{...p,ref:l,elementType:"span"}],[_r,g],[vx,a],[$$,{trigger:"DateRangePicker",triggerRef:s,placement:"bottom start",style:{"--trigger-width":$}}],[vk,m],[vh,{slots:{start:d,end:f}}],[g_,{slots:{description:b,errorMessage:y}}],[vE,v]]},uw().createElement("div",{...k,...D,...E,ref:n,slot:e.slot||void 0,"data-focus-within":x||void 0,"data-invalid":a.isInvalid||void 0,"data-focus-visible":C||void 0,"data-disabled":e.isDisabled||void 0,"data-open":a.isOpen||void 0}))});function $P(e){return uw().createElement(gO,e)}function $O(e,n,t=!1){if(null==e)return t?e:void 0;if("string"==typeof e&&!e)return t?null:void 0;if(e instanceof bv||e instanceof bA||e instanceof bw)return n?bT(e,n):e;{let t=p8()(e).toDate(),r=new bv(t.getFullYear(),t.getMonth()+1,t.getDate());return n?bT(r,n):r}}function $T(e){if(e)return e.toDate(bq())}function $B(){let e=window.i18next.language;return"ht"===(e=e.replaceAll("_","-"))&&(e="fr-HT"),e}if("u">typeof navigator){let e=navigator;et=Array.isArray(e.languages)?e.languages[0]:e.language}else if("u">typeof process){let e=process.env;et=e.LC_ALL||e.LC_MESSAGES||e.LANG||e.LANGUAGE}var $I=function(e){e=(e=e.replace(/_/g,"-")).replace(/[.:][\w-]*$/,"");try{return new Intl.Locale(e).baseName}catch{return"en-US"}}(et||"en-US"),$N=class extends Date{invalid=null;isValid(){return!Number.isNaN(this.valueOf())}},$j={};for(let e=1;e<100;e++)$j[(e<=9?"0":"")+e]=e+(e>51?1900:2e3);var $R={arab:1632,arabext:1776,bali:6992,beng:2534,deva:2406,fullwide:65296,gujr:2790,khmr:6112,knda:3302,laoo:3792,limb:6470,mlym:3430,mong:6160,mymr:4160,orya:2918,tamldec:3046,telu:3174,thai:3664,tibt:3872},$F="[1234567890一二三四五六七八九〇\\d]",$L={0:0,1:1,2:2,3:3,4:4,5:5,6:6,7:7,8:8,9:9,"0":0,"1":1,"2":2,"3":3,"4":4,"5":5,"6":6,"7":7,"8":8,"9":9,〇:0,一:1,二:2,三:3,四:4,五:5,六:6,七:7,八:8,九:9},$W={},$V={"Eastern Daylight Time":-240,"Eastern Standard Time":-300,"Central Daylight Time":-300,"Central Standard Time":-360,"Mountain Daylight Time":-360,"Mountain Standard Time":-420,"Pacific Daylight Time":-420,"Pacific Standard Time":-480,"Coordinated Universal Time":0,ACDT:630,ACST:570,ACT:480,ADT:-180,AEDT:660,AEST:600,AFT:270,AKDT:-480,AKST:-540,AMST:-180,AMT:-240,ART:-180,AST:180,AWDT:540,AWST:480,AZOST:-60,AZT:240,BDT:360,BIOT:360,BIT:-720,BOT:-240,BRST:-120,BRT:-180,BTT:360,CAT:120,CCT:390,CDT:-300,CEDT:120,CEST:120,CET:60,CHADT:825,CHAST:765,CHOT:480,ChST:600,CHUT:600,CIST:-480,CIT:480,CKT:-600,CLST:-180,CLT:-240,COST:-240,COT:-300,CST:-360,CT:480,CVT:-60,CXT:420,DAVT:420,DDUT:600,DFT:60,EASST:-300,EAST:-360,EAT:180,ECT:-300,EDT:-240,EEDT:180,EEST:180,EET:120,EGST:0,EGT:-60,EIT:540,EST:-300,FET:180,FJT:720,FKST:-180,FKT:-240,FNT:-120,GALT:-360,GAMT:-540,GET:240,GFT:-180,GILT:720,GIT:-540,GMT:0,GST:-120,GYT:-240,HADT:-540,HAEC:120,HAST:-600,HKT:480,HMT:300,HOVT:420,HST:-600,IBST:0,ICT:420,IDT:180,IOT:180,IRDT:270,IRKT:480,IRST:210,IST:120,JST:540,KGT:360,KOST:660,KRAT:420,KST:540,LHST:630,LINT:840,MAGT:720,MART:-510,MAWT:300,MDT:-360,MET:60,MEST:120,MHT:720,MIST:660,MIT:-510,MMT:390,MSK:180,MST:-420,MUT:240,MVT:300,MYT:480,NCT:660,NDT:-90,NFT:660,NPT:345,NST:-150,NT:-150,NUT:-660,NZDT:780,NZST:720,OMST:360,ORAT:300,PDT:-420,PET:-300,PETT:720,PGT:600,PHOT:780,PKT:300,PMDT:-120,PMST:-180,PONT:660,PST:-480,PYST:-180,PYT:-240,RET:240,ROTT:-180,SAKT:660,SAMT:240,SAST:120,SBT:660,SCT:240,SGT:480,SLST:330,SRET:660,SRT:-180,SST:480,SYOT:180,TAHT:-600,THA:420,TFT:300,TJT:300,TKT:780,TLT:540,TMT:300,TOT:780,TVT:720,UCT:0,ULAT:480,USZ1:120,UTC:0,UYST:-120,UYT:-180,UZT:300,VET:-240,VLAT:600,VOLT:240,VOST:360,VUT:660,WAKT:720,WAST:120,WAT:60,WEDT:60,WEST:60,WET:0,WIT:420,WST:480,YAKT:540,YEKT:300},$G={zone:$V,year:$j,meridiem:{am:0,pm:12,"a.m.":0,"p.m.":12},month:{january:1,jan:1,february:2,feb:2,march:3,mar:3,april:4,apr:4,may:5,june:6,jun:6,july:7,jul:7,august:8,aug:8,september:9,sep:9,october:10,oct:10,november:11,nov:11,december:12,dec:12},dayname:{sunday:0,sun:0,monday:1,mon:1,tuesday:2,tue:2,wednesday:3,wed:3,thursday:4,thu:4,friday:5,fri:5,saturday:6,sat:6},digit:{}},$U={MONTHNAME:"january|february|march|april|may|june|july|august|september|october|november|december|jan\\.?|feb\\.?|mar\\.?|apr\\.?|may\\.?|jun\\.?|jul\\.?|aug\\.?|sep\\.?|oct\\.?|nov\\.?|dec\\.?",DAYNAME:"sunday|monday|tuesday|wednesday|thursday|friday|saturday|sun\\.?|mon\\.?|tue\\.?|wed\\.?|thu\\.?|fri\\.?|sat\\.?",ZONE:"\\(?(?:"+Object.keys($V).join("|")+")\\)?",MERIDIEM:"am|pm|a.m.|p.m.",ORDINAL:"st|nd|rd|th|\\.",YEAR:"\\d{4}|\\d{2}",YEAR2:"\\d{2}",YEAR4:"\\d{4}",YEAR6:"-\\d{6}|\\+?\\d{5,6}",MONTH:"1[0-2]|0?[1-9]",MONTH2:"1[0-2]|0[1-9]",DAY:"3[01]|[12]\\d|0?[1-9]",DAY2:"3[01]|[12]\\d|0[1-9]",OFFSET:"(?:GMT)?[\xb1−+-](?:[01]\\d[0-5]\\d|[01]\\d:[0-5]\\d|[01]?\\d)",H24:"[01]\\d|2[0-3]",H12:"0?[1-9]|1[012]",MIN:"[0-5]\\d",SEC:"[0-5]\\d|60",MS:"\\d{9}|\\d{6}|\\d{1,3}",GAP:"[\\s/.,-]{1,}"},$q={...$U,YEAR:"*{4}|*{2}",YEAR4:"*{4}",YEAR6:"-*{6}|\\+?*{5,6}",MONTH:"*{1,2}",MONTH2:"*{2}",DAY:"*{1,2}",DAY2:"*{2}",OFFSET:"(?:GMT)?[\xb1−+-](?:*{4}|*{2}:*{2}|*{1,2})",H24:"*{2}",H12:"*{1,2}",MIN:"*{2}",SEC:"*{2}",MS:"*{9}|*{6}|*{3}"},$H={},$K=class e{locale;lookups;vars;numberingSystem;baseName;dateOptions;static factory(n=$I){return $H[n.toLowerCase()]||($H[n.toLowerCase()]=new e(n)),$H[n.toLowerCase()]}constructor(e=$I){this.locale=e,this.lookups={...$G},this.vars={...$U};let n=new Intl.NumberFormat(this.locale);this.numberingSystem=n.resolvedOptions().numberingSystem,this.dateOptions=new Intl.DateTimeFormat(this.locale).resolvedOptions(),this.baseName=new Intl.Locale(this.locale).baseName,this.build()}toInt(e){if("number"==typeof e)return e;if("string"!=typeof e)return;if("latn"===this.numberingSystem&&!this.baseName.startsWith("zh")){let n=parseInt(e,10);if(!isNaN(n))return n}let n="";for(let t=0;t<e.length;t++)n+=String(this.lookups.digit[e[t]]);return parseInt(n,10)}millisecondToInt(e){if("number"==typeof e)return e;if("string"!=typeof e)return;let n=e.slice(0,3);return 1===n.length?100*this.toInt(n):2===n.length?10*this.toInt(n):this.toInt(n)}monthNameToInt(e){if("string"!=typeof e)return;let n=e.toLocaleLowerCase(this.locale).replace(/\.$/,"");return this.lookups.month[n]||12}h12ToInt(e,n){if("string"!=typeof e)return;let t=this.lookups.meridiem[n?.toLowerCase()]||0,r=this.toInt(e);return r<12&&12===t&&(r+=12),12===r&&0===t&&(r=0),r}zoneToOffset(e){if("string"==typeof e)return e=e.replace(/[^a-z\s]/gi,""),this.lookups.zone[e]}offsetToMinutes(e){if("string"!=typeof e)return;let n=e.match(/^(?:GMT)?([±−+-])(..?):?(..)?$/);if(n){let[,e,t,r]=n;return("-"===e||"−"===e?-1:1)*(60*this.toInt(t)+this.toInt(r||0))}return 0}build(){"latn"===this.dateOptions.numberingSystem?this.lookups.digit=$L:this.buildNumbers(),/^en/i.test(this.locale)||(this.buildMonthNames(),this.buildDaynames(),/zh/i.test(this.locale)||this.buildMeridiems())}buildNumbers(){let{group:e,lookup:n}=function(e){if($W[e])return $W[e];if("fullwide"===e||"hanidec"===e)return{group:$F,lookup:{...$L}};let n=$R[e];if(!n)return{group:"\\d",lookup:{...$L}};let t=String.fromCharCode(n),r=String.fromCharCode(n+9),o={};for(let e=0;e<10;e++)o[String.fromCharCode(n+e)]=e;return $W[e]={group:`[${t}-${r}]`,lookup:o},$W[e]}(this.numberingSystem);for(let t in this.lookups.digit=n,$q)$q.hasOwnProperty(t)&&(this.vars[t]=$q[t].replace(/\*/g,e))}buildMonthNames(){let e={},n={};if(/^fi/i.test(this.locale))"tammi|helmi|maalis|huhti|touko|kes\xe4|hein\xe4|elo|syys|loka|marras|joulu".split("|").forEach((t,r)=>{["","k","kuu","kuuta"].forEach((o,i)=>{e[t+o+(i<2?"\\.?":"")]=!0,n[t+o]=r+1})});else{let t=[],r=e=>"month"===e.type;for(let e=0;e<12;e++)t.push(new Date(2017,e,1));for(let o of["full","long","medium"]){let i=Intl.DateTimeFormat(this.locale,{dateStyle:o});for(let a=0;a<12;a++){let s=i.formatToParts(t[a]).find(r).value.toLocaleLowerCase(this.locale);/^\d+$/.test(s)||(/^ko/i.test(this.locale)&&(s+="월"),"medium"===o?(s=s.replace(/\.$/,""),e[`${s}\\.?`]=!0):e[s]=!0,n[s]=a+1)}}let o=Intl.DateTimeFormat(this.locale,{month:"short"});for(let i=0;i<12;i++){let a=o.formatToParts(t[i]).find(r).value.toLocaleLowerCase(this.locale);a=a.replace(/\.$/,""),e[`${a}\\.?`]=!0,n[a]=i+1}}this.vars.MONTHNAME=Object.keys(e).join("|"),this.lookups.month=n}buildDaynames(){let e=[],n=e=>"weekday"===e.type;for(let n=0;n<7;n++)e.push(new Date(2017,0,n+1));let t=[],r={};for(let o of["long","short"]){let i=Intl.DateTimeFormat(this.locale,{weekday:o});for(let a=0;a<7;a++){let s=i.formatToParts(e[a]).find(n).value.toLocaleLowerCase(this.locale);"short"===o?(s=s.replace(/\.$/,""),t.push(`${s}\\.?`)):t.push(s),r[s]=a}}this.vars.DAYNAME=t.join("|"),this.lookups.dayname=r}buildMeridiems(){let e=[new Date(2017,0,1),new Date(2017,0,1,23,0,0)],n=e=>"dayPeriod"===e.type,t=[],r={},o=Intl.DateTimeFormat(this.locale,{timeStyle:"long"});for(let i=0;i<2;i++){let a=o.formatToParts(e[i]).find(n);if(!a)return;let s=a.value.toLocaleLowerCase(this.locale);t.push(s),r[s]=12*i}this.vars.MERIDIEM=t.join("|"),this.lookups.meridiem=r}compile(e){return RegExp(e.replace(/_([A-Z0-9]+)_/g,(e,n)=>{if(!this.vars[n])throw Error(`Template string contains invalid variable _${n}_`);return this.vars[n]}),"i")}},$Y=["ee-TG","en-AS","en-CA","en-FM","en-GH","en-GU","en-KE","en-KY","en-MH","en-MP","en-US","en-VI","en-WS","jp-JP","sm-AS","sm-SM"],$J={y:"year",M:"month",d:"day",w:"week",h:"hour",m:"minute",s:"second",ms:"millisecond"},$Z=()=>new Date;function $X(e){return function(n){let t={};for(let r=0,o=e.length;r<o;r++){let o=e[r];o&&(t[o]=n[r])}return t}}var $Q=class{doneChecker;fallback;patterns;formatter;constructor({doneChecker:e,fallback:n,patterns:t,formatter:r}){this.doneChecker=e,this.fallback=n,this.patterns=t,this.formatter=r}attempt(e){if("string"!=typeof e)return this.fallback(e);let n=e.trim(),t={},r=!1;for(let e of this.patterns){let o=n.match(e.regex);if(!o)continue;r=!0;let i=e.handler(o);if(i){for(let[e,n]of Object.entries(i))e in t||void 0===n||(t[e]=n);if(n=(n=n.slice(0,o.index)+n.slice(o.index+o[0].length+1)).trim(),this.doneChecker(t,n))break}}return r?this.formatter(t):this.fallback(e)}},$0=["year","month","day","hour","minute","second","millisecond","offset"],$1={};function $2(e,n){return""===n||/^\s+$/.test(n)||"year"in e&&("month"in e||"monthname"in e)&&"day"in e&&"hour"in e&&"minute"in e&&"second"in e&&"millisecond"in e&&("zone"in e||"offset"in e)}var $3=[[/([^\d.]+)(\d{1,2})\.(\d{2})\.(\d{2})(\D|$)/,"$1$2:$3:$4$5"],[/([^\d.]+)(\d{1,2})\.(\d{2})(\D|$)/,"$1$2:$3$4"]],$5={ar:[[/ /g," "]],bn:[[/,/g,""]],zh:[[/早上\s*([\d:]+)/,"$1am"],[/凌晨\s*([\d:]+)/,"$1am"],[/上午\s*([\d:]+)/,"$1am"],[/下午\s*([\d:]+)/,"$1pm"],[/晚上\s*([\d:]+)/,"$1pm"]],he:[[/ב/gi,""]],de:[[/ um /g," "]],pt:[[/\sde /gi," "]],es:[[/\sde /gi," "]],da:[[/\sden /gi," "],...$3],ru:[[/ г\./g,""]],th:[[/\s*นาฬิกา\s*/i,":"],[/\s*นาที\s*/i,":"],[/\s*วินาที\s*/i," "]],ko:[[/\s*시\s*/,":"],[/\s*분\s*/,":"],[/\s*초\s*/,""],[/(오전|오후)\s*([\d:]+)/,"$2$1"],[/(\d{4})\. (\d{1,2})\. (\d{1,2})\./,"$1-$2-$3"]],fi:$3,id:$3,fr:[[/(\d{2}) h /,"$1:"],[/(\d{2}) min /,"$1:"],[/(\d{2}) s /,"$1"]]};function $4(e,n=$I){let t=function(e){if(!$1[e]){var n,t;let r,o,i=$K.factory(e);$1[e]=new $Q({doneChecker:$2,fallback:(n=e,function(e){let t=String(e).slice(0,50);return""===t&&(t="(empty string)"),{invalid:`Unable to parse "${t}" with locale "${n}"`}}),patterns:(r=[{name:"timestampWithOffset",regex:i.compile("^(_YEAR4_)-(_MONTH_)-(_DAY_)[T ](_H24_):(_MIN_):(_SEC_)(?:.(_MS_))? ?(_OFFSET_|Z)?$"),handler:$X(["","year","month","day","hour","minute","second","millisecond","offset"])},{name:"timestampWithZone",regex:i.compile("^(_YEAR4_)-(_MONTH_)-(_DAY_)[T ](_H24_):(_MIN_):(_SEC_)(?:.(_MS_))?\\s*(_ZONE_)$"),handler:$X(["","year","month","day","hour","minute","second","millisecond","zone"])},{name:"timestampWithOffsetAndZone",regex:i.compile("^(_YEAR4_)-(_MONTH_)-(_DAY_)[T ](_H24_):(_MIN_):(_SEC_)(?:.(_MS_))? (_OFFSET_|Z)\\s*(_ZONE_)$"),handler:$X(["","year","month","day","hour","minute","second","millisecond","offset"])},{name:"chinese",regex:i.compile(`^(${$F}{2,4})\\s*\u5E74\\s*(${$F}{1,2})\\s*\u6708\\s*(${$F}{1,2})\\s*\u65E5$`),handler:$X(["","year","month","day"])},{name:"korean",regex:i.compile("^(_YEAR_)년\\s*(_MONTH_)월\\s*(_DAY_)일$"),handler:$X(["","year","month","day"])},{name:"twitter",regex:/^(?:sun|mon|tue|wed|thu|fri|sat) (jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec) (\d{2}) (\d{2}):(\d{2}):(\d{2}) ([+-]\d{4}) (\d{4})$/i,handler:$X(["","monthname","day","hour","minute","second","offset","year"])},{name:"today",regex:/^(now|today|tomorrow|yesterday)$/i,handler:function(e){let n=$Z(),t=e[1].toLowerCase();switch(t){case"tomorrow":n.setUTCDate(n.getUTCDate()+1);break;case"yesterday":n.setUTCDate(n.getUTCDate()-1)}let r={year:n.getUTCFullYear(),month:n.getUTCMonth()+1,day:n.getUTCDate()};return"now"===t&&(r.hour=n.getUTCHours(),r.minute=n.getUTCMinutes(),r.second=n.getUTCSeconds(),r.millisecond=n.getUTCMilliseconds()),console.log("today=>",t,r),r}},{name:"ago",regex:/^(\+|-|in|) ?([\d.]+) ?(years?|months?|weeks?|days?|hours?|minutes?|seconds?|milliseconds?|ms|s|m|h|w|d|M|y)( ago)?$/i,handler:function([,e,n,t,r]){n=parseFloat(n),"week"===(t=t.length<=2?$J[t]:(t=t.replace(/s$/,"")).toLowerCase())&&(t="day",n*=7),("-"===e||r)&&(n*=-1);let o=$Z();return"millisecond"===t?o.setUTCMilliseconds(o.getUTCMilliseconds()+n):"second"===t?o.setUTCSeconds(o.getUTCSeconds()+n):"minute"===t?o.setUTCMinutes(o.getUTCMinutes()+n):"hour"===t?o.setUTCHours(o.getUTCHours()+n):"day"===t?o.setUTCDate(o.getUTCDate()+n):"month"===t?o.setUTCMonth(o.getUTCMonth()+n):"year"===t&&o.setUTCFullYear(o.getUTCFullYear()+n),{year:o.getUTCFullYear(),month:o.getUTCMonth()+1,day:o.getUTCDate(),hour:o.getUTCHours(),minute:o.getUTCMinutes(),second:o.getUTCSeconds(),millisecond:o.getUTCMilliseconds()}}},{name:"atSeconds",regex:/^@(\d+)$/,handler:function(e){let n=new Date(1e3*parseInt(e[1],10));return{year:n.getUTCFullYear(),month:n.getUTCMonth()+1,day:n.getUTCDate(),hour:n.getUTCHours(),minute:n.getUTCMinutes(),second:n.getUTCSeconds()}}},{name:"microsoftJson",regex:/^\/Date\((\d+)([+-]\d{4})?\)\/$/,handler:function(e){let n=new Date(parseInt(e[1],10));return{year:n.getUTCFullYear(),month:n.getUTCMonth()+1,day:n.getUTCDate(),hour:n.getUTCHours(),minute:n.getUTCMinutes(),second:n.getUTCSeconds(),millisecond:n.getUTCMilliseconds(),offset:e[2]}}},{name:"full24",regex:i.compile("(?:^|[\\sT])(_H24_):(_MIN_):(_SEC_)(?:\\.(_MS_))?(Z)?$"),handler:$X(["","hour","minute","second","millisecond","zone"])},{name:"zone24",regex:i.compile("(_H24_):(_MIN_):(_SEC_)(?:\\.(_MS_))?[\\s\\[(]*(_ZONE_)?[\\s\\])]*$"),handler:$X(["","hour","minute","second","millisecond","zone"])},{name:"hms12",regex:i.compile("(_H12_):(_MIN_):(_SEC_)\\s*(_MERIDIEM_)"),handler:$X(["","hour","minute","second","meridiem"])},{name:"hms24",regex:i.compile("(_H24_):(_MIN_):(_SEC_)(?:\\.(_MS_))?"),handler:$X(["","hour","minute","second","millisecond"])},{name:"hm12",regex:i.compile("(_H12_):(_MIN_)\\s*(_MERIDIEM_)"),handler:$X(["","hour","minute","meridiem"])},{name:"hm24",regex:i.compile("(_H24_):(_MIN_)"),handler:$X(["","hour","minute"])},{name:"h12",regex:i.compile("(_H12_)\\s*(_MERIDIEM_)"),handler:$X(["","hour","meridiem"])},{name:"8digit",regex:/^((?:19|20)\d{2})(\d{2})(\d{2})$/,handler:$X(["","year","month","day"])},{name:"yearMonthnameDay",regex:i.compile("(_YEAR4_)[\\s.-]+(_MONTHNAME_)[\\s,.-]+(_DAY_)(_ORDINAL_)?"),handler:$X(["","year","monthname","day"])},{name:"dayMonthnameYear",regex:i.compile("(_DAY_)(_ORDINAL_)?[\\s.-]*(_MONTHNAME_)[\\s,.-]+(_YEAR_)"),handler:$X(["","day","","monthname","year"])},{name:"monthnameDayYear",regex:i.compile("(_MONTHNAME_)[\\s.-]*(_DAY_)(_ORDINAL_)?[\\s,.-]+(_YEAR_)"),handler:$X(["","monthname","day","","year"])},{name:"dayMonthname",regex:i.compile("\\b(_DAY_)(_ORDINAL_)?[\\s.-]*(_MONTHNAME_)\\b"),handler:$X(["","day","","monthname"])},{name:"monthnameDay",regex:i.compile("\\b(_MONTHNAME_)[\\s.-]*(_DAY_)(_ORDINAL_)?\\b"),handler:$X(["","monthname","day"])},{name:"hmsNoMeridiem",regex:i.compile("\\b(_H12_|_H24_):(_MIN_):(_SEC_)\\b"),handler:$X(["","hour","minute","second"])},{name:"hmNoMeridiem",regex:i.compile("\\b(_H12_|_H24_):(_MIN_)\\b"),handler:$X(["","hour","minute"])},{name:"ymd",regex:i.compile("(_YEAR4_)([.-])(_MONTH_)\\2+(_DAY_)"),handler:$X(["","year","","month","day"])},{name:"mdy",regex:i.compile("(_MONTH_)([/-])(_DAY_)\\2(_YEAR_)"),handler:$X(["","month","","day","year"])},{name:"dmy",regex:i.compile("(_DAY_)(?:_ORDINAL_)?[./\\s-]+(_MONTH_)[./\\s-]+(_YEAR_)"),handler:$X(["","day","month","year"])},{name:"yearLoose",regex:i.compile("_YEAR4_"),handler:$X(["year"])},{name:"dayMonthnameLoose",regex:i.compile("(_DAY_)[\\s.]*(_MONTHNAME_)"),handler:$X(["","day","monthname"])},{name:"monthnameDayLoose",regex:i.compile("(_MONTHNAME_)[\\s.]*(_DAY_)"),handler:$X(["","monthname","day"])},{name:"monthname",regex:i.compile("_MONTHNAME_"),handler:$X(["monthname"])},{name:"year4",regex:i.compile("_YEAR4_"),handler:$X(["year"])},{name:"md",regex:i.compile("(_MONTH_)[/-](_DAY_)"),handler:$X(["","month","day"])},{name:"dm",regex:i.compile("(_DAY_)(?:_ORDINAL_)?[./\\s-]+(_MONTH_)"),handler:$X(["","day","month"])},{name:"day",regex:i.compile("_DAY_"),handler:$X(["day"])},{name:"year2",regex:i.compile("_YEAR2_"),handler:$X(["year"])},{name:"onlyZone",regex:i.compile("_ZONE_"),handler:$X(["zone"])}],o=i.baseName.slice(0,5),$Y.includes(o)?r:r.filter(e=>!["mdy","md"].includes(e.name))),formatter:(t=i,function(e){let n={};for(let[r,o]of Object.entries(e))if("monthname"===r){if(o){let e=t.monthNameToInt(o);void 0!==e&&(n.month=e)}}else if("hour"===r&&e.meridiem){let r=t.h12ToInt(o,e.meridiem);void 0!==r&&(n.hour=r)}else if("zone"===r){if(o){let e=t.zoneToOffset(o);void 0!==e&&(n.offset=e)}}else if("offset"===r){let e=t.offsetToMinutes(o);void 0!==e&&(n.offset=e)}else if("millisecond"===r){let e=t.millisecondToInt(o);"number"==typeof e&&(n.millisecond=e)}else if($0.includes(r)){let e=t.toInt(o);"number"==typeof e&&(n[r]=e)}return n.year<100&&(n.year=$j[n.year]),n.year&&"buddhist"===t.dateOptions.calendar&&(n.year-=543),n})})}return $1[e]}(n),r=function(e,n){let t=$5[n.slice(0,2).toLowerCase()];if(!t)return e;for(let[n,r]of t)e=e.replace(n,r);return e}(e,n);return t.attempt(r)}function $6(e){e.month&&e.day&&void 0===e.year&&(e.year=new Date().getFullYear()),60===e.second&&(e.second=59);let n=new $N(e.year,e.month-1,e.day,e.hour||0,e.minute||0,e.second||0,e.millisecond||0);return"number"==typeof e.offset?new $N(n.valueOf()-60*e.offset*1e3):n}function $8(e,n=$I){let t=$4(e,n),r=t.invalid?new $N(NaN):$6(t);return r.isValid()||(r.invalid=`Unable to parse date "${e}"`),r}function $7(e,n=$I){return e instanceof Date?new $N(e.valueOf()):"number"==typeof e?new $N(e):$8(e,n)}Date.fromString=$N.fromString=$8,Date.fromAny=$N.fromAny=$7,"u">typeof window&&(window.anyDateParser={fromString:$8,fromAny:$7,fromObject:$6,attempt:$4});var $9=t(5238),Ae=t(83826);let An=function(e){return null==e};function At(e,n){var t=function(e,n){if(!n.has(e))throw TypeError("attempted to get private field on non-instance");return n.get(e)}(e,n);return t.get?t.get.call(e):t.value}p6.extend(p7),p6.extend(Ae),p6.extend($9);let Ar="YYYY-MM-DDTHH:mm:ss.SSSZZ";function Ao(e){return null!=e&&28===e.trim().length&&"T"===(e=e.trim())[10]&&":"===e[13]&&":"===e[16]&&"."===e[19]&&("+"===e[23]||"-"===e[23])&&p6(e,Ar).isValid()}function Ai(e){return p6(e).isToday()}function Aa(e){return Ao(e)?p6(e,Ar).toDate():null}function As(e,n=!1){let t=p6(e);return n&&(t=t.utc()),t.format(Ar)}function Al(e){return p6(e).toDate()}var Ac=new WeakMap;let Au=new class{register(e,n){At(this,Ac).set(e,n)}getCalendar(e){if(!e)return;if(e.calendar)return e.calendar;if(e.region){let n=`${e.language}-${e.region}`;if(At(this,Ac).has(n))return At(this,Ac).get(n)}if(e.language&&At(this,Ac).has(e.language))return At(this,Ac).get(e.language);let n=new Intl.DateTimeFormat(e.toString()).resolvedOptions().calendar;return At(this,Ac).set(`${e.language}${e.region?`-${e.region}`:""}`,n),n}constructor(){!function(e,n,t){if(n.has(e))throw TypeError("Cannot initialize the same private elements twice on an object");n.set(e,t)}(this,Ac,{writable:!0,value:new Map})}};function Ap(e,n){Au.register(e,n)}function Ad(e){let n=e??$B();return Au.getCalendar(n instanceof Intl.Locale?n:new Intl.Locale(n))}let Af={mode:"standard",time:"for today",day:!0,month:!0,year:!0,noToday:!1};function Ah(e,n={}){let t=$4(e,$B());if(t.invalid)return console.warn(`Could not parse invalid date '${e}'`),null;!An(t.day)&&An(t.month)&&(t=Object.assign({},nw(t,"day"),{month:t.day})),t.month&&(t.month-=1),t.day&&(t=Object.assign({},nw(t,"day"),{date:t.day}));let r=p6().set(t).toDate();return An(t.year)&&(n.year=!1),An(t.month)&&(n.month=!1),An(t.date)&&(n.day=!1),Am(r,n)}function Am(e,n){let t,r=n?.locale??$B(),o=new Intl.Locale(r),{calendar:i,mode:a,time:s,day:l,month:c,year:u,noToday:p,numberingSystem:d}={...Af,...{noToday:"am"===o.language},...n},f={calendar:i??Ad(o),year:u?"numeric":void 0,month:c?"short":void 0,day:l?"2-digit":void 0,numberingSystem:d},h=p6(e).isToday();if(h&&!p)t=(t=new Intl.RelativeTimeFormat(r,{numeric:"auto"}).format(0,"day"))[0].toLocaleUpperCase(r)+t.slice(1);else{"en"===o.language&&(r="en-GB");let n=new Intl.DateTimeFormat(r,f).formatToParts(e);("en"===o.language||"am"===o.language)&&"standard"==a&&u&&l&&(n=n.map(Ag("-"))),"wide"==a&&(n=n.map(Ag(" — "))),"ethiopic"===f.calendar&&(n=n.filter((e,n,t)=>"era"!==e.type&&("literal"!==e.type||!(n<t.length-1)||"era"!==t[n+1].type))),t=n.map(e=>e.value).join("")}return(!0===s||h&&"for today"===s)&&(t+=`, ${Ab(e)}`),t}let Ag=e=>(n,t,r)=>"literal"!==n.type||" "!==n.value||t<r.length-1&&"era"===r[t+1].type?n:{type:"literal",value:e};function Ab(e){return e.toLocaleTimeString($B(),{hour:"2-digit",minute:"2-digit"})}function Ay(e,n){return Am(e,{...n,time:!0})}function A_(e,n){let t=Ad("string"==typeof n?new Intl.Locale(n):n);return t?bT(e,yZ(t)):e}function Av(e,n){return new Intl.DurationFormat($B(),n).format(e)}function A$(e,n){if(null==e)return null;if("string"==typeof e){let t=$4(e,$B());return t.invalid?(console.warn(`Could not interpret '${e}' as a date`),null):(t.day&&!t.month&&(t={...nw(t,"day"),...{month:t.day}}),t.month&&(t.month-=1),t.day&&(t={...nw(t,"day"),...{date:t.day}}),p6(n).set(t))}return p6(e)}let AA=["years","months","days","hours","minutes","seconds"],Aw={second:"seconds",minute:"minutes",hour:"hours",day:"days",month:"months",year:"years"},Ak={seconds:45,minutes:45,hours:22,days:26,months:11,years:1/0};function Ax(e,n=p6(),t){let r,o=p6(n),i=A$(e,o);if(null==i)return null;if("string"==typeof t){let e=Aw[t]??t;return{[e]:o.diff(i,e)}}let{thresholds:a,largestUnit:s,smallestUnit:l}=t??{};if(void 0!==s||void 0!==l){let e,n=l?Aw[l]??l:void 0;return e="auto"===s||void 0===s?function(e,n,t){let r=AA.indexOf(t);for(let o=0;o<AA.length;o++){let i=AA[o];if(n.diff(e,i)>0)return o<=r?i:t}return t}(i,o,n??"seconds"):Aw[s]??s,function(e,n,t,r){let o=AA.indexOf(t),i=AA.indexOf(r),a=AA.slice(o,i+1),s={},l=e;for(let e of a){let t=n.diff(l,e);s[e]=t,l=l.add(t,e)}return s}(i,o,e,n??e)}let c=(r=function(e){let n={...Ak};if(e)for(let[t,r]of Object.entries(e))void 0!==r&&(n[Aw[t]??t]=r);return n}(a),o.diff(i,"seconds")<r.seconds?"seconds":o.diff(i,"minutes")<r.minutes?"minutes":o.diff(i,"hours")<r.hours?"hours":o.diff(i,"days")<r.days?"days":o.diff(i,"months")<r.months?"months":"years");return{[c]:o.diff(i,c)}}let AC={style:"short",localeMatcher:"lookup"};function AE(e,n=p6(),t){let r=Ax(e,n,t);return null==r?null:Av(r,"object"==typeof t&&t.formatOptions?{...AC,...t.formatOptions}:AC)}let AD=(0,uA.createContext)(null);function AS(){let e=pm({externalModuleName:"@openmrs/esm-styleguide"}).preferredDateLocale,n=(0,uA.useMemo)(()=>{let n=$B();return e[n]&&(n=e[n]),n},[window.i18next.language]),t=(0,uA.useMemo)(()=>{let e=Ad(n);return void 0!==e?yZ(e):void 0},[n]),r=(0,uA.useMemo)(()=>new Intl.Locale(n,{calendar:t?.identifier}),[n,t]),o=(0,uA.useMemo)(()=>t?bT(bW(bq()),t):bW(bq()),[t]);return{calendar:t,intlLocale:r,today_:o}}let AM=new bv(1793,1,1);var Az={};function AP(){return"u">typeof window&&window.InputEvent&&"function"==typeof InputEvent.prototype.getTargetRanges}function AO(e={}){let{locale:n}=gT();return(0,uA.useMemo)(()=>new(0,vc.K)(n,e),[n,e])}Az={"ar-AE":{decrease:e=>`\u{62E}\u{641}\u{636} ${e.fieldLabel}`,increase:e=>`\u{632}\u{64A}\u{627}\u{62F}\u{629} ${e.fieldLabel}`,numberField:"حقل رقمي"},"bg-BG":{decrease:e=>`\u{41D}\u{430}\u{43C}\u{430}\u{43B}\u{44F}\u{432}\u{430}\u{43D}\u{435} ${e.fieldLabel}`,increase:e=>`\u{423}\u{441}\u{438}\u{43B}\u{432}\u{430}\u{43D}\u{435} ${e.fieldLabel}`,numberField:"Номер на полето"},"cs-CZ":{decrease:e=>`Sn\xed\u{17E}it ${e.fieldLabel}`,increase:e=>`Zv\xfd\u{161}it ${e.fieldLabel}`,numberField:"Č\xedseln\xe9 pole"},"da-DK":{decrease:e=>`Reducer ${e.fieldLabel}`,increase:e=>`\xd8g ${e.fieldLabel}`,numberField:"Talfelt"},"de-DE":{decrease:e=>`${e.fieldLabel} verringern`,increase:e=>`${e.fieldLabel} erh\xf6hen`,numberField:"Nummernfeld"},"el-GR":{decrease:e=>`\u{39C}\u{3B5}\u{3AF}\u{3C9}\u{3C3}\u{3B7} ${e.fieldLabel}`,increase:e=>`\u{391}\u{3CD}\u{3BE}\u{3B7}\u{3C3}\u{3B7} ${e.fieldLabel}`,numberField:"Πεδίο αριθμού"},"en-US":{decrease:e=>`Decrease ${e.fieldLabel}`,increase:e=>`Increase ${e.fieldLabel}`,numberField:"Number field"},"es-ES":{decrease:e=>`Reducir ${e.fieldLabel}`,increase:e=>`Aumentar ${e.fieldLabel}`,numberField:"Campo de n\xfamero"},"et-EE":{decrease:e=>`V\xe4henda ${e.fieldLabel}`,increase:e=>`Suurenda ${e.fieldLabel}`,numberField:"Numbri v\xe4li"},"fi-FI":{decrease:e=>`V\xe4henn\xe4 ${e.fieldLabel}`,increase:e=>`Lis\xe4\xe4 ${e.fieldLabel}`,numberField:"Numerokentt\xe4"},"fr-FR":{decrease:e=>`Diminuer ${e.fieldLabel}`,increase:e=>`Augmenter ${e.fieldLabel}`,numberField:"Champ de nombre"},"he-IL":{decrease:e=>`\u{5D4}\u{5E7}\u{5D8}\u{5DF} ${e.fieldLabel}`,increase:e=>`\u{5D4}\u{5D2}\u{5D3}\u{5DC} ${e.fieldLabel}`,numberField:"שדה מספר"},"hr-HR":{decrease:e=>`Smanji ${e.fieldLabel}`,increase:e=>`Pove\u{107}aj ${e.fieldLabel}`,numberField:"Polje broja"},"hu-HU":{decrease:e=>`${e.fieldLabel} cs\xf6kkent\xe9se`,increase:e=>`${e.fieldLabel} n\xf6vel\xe9se`,numberField:"Sz\xe1mmező"},"it-IT":{decrease:e=>`Riduci ${e.fieldLabel}`,increase:e=>`Aumenta ${e.fieldLabel}`,numberField:"Campo numero"},"ja-JP":{decrease:e=>`${e.fieldLabel}\u{3092}\u{7E2E}\u{5C0F}`,increase:e=>`${e.fieldLabel}\u{3092}\u{62E1}\u{5927}`,numberField:"数値フィールド"},"ko-KR":{decrease:e=>`${e.fieldLabel} \u{AC10}\u{C18C}`,increase:e=>`${e.fieldLabel} \u{C99D}\u{AC00}`,numberField:"번호 필드"},"lt-LT":{decrease:e=>`Suma\u{17E}inti ${e.fieldLabel}`,increase:e=>`Padidinti ${e.fieldLabel}`,numberField:"Numerio laukas"},"lv-LV":{decrease:e=>`Samazin\u{101}\u{161}ana ${e.fieldLabel}`,increase:e=>`Palielin\u{101}\u{161}ana ${e.fieldLabel}`,numberField:"Skaitļu lauks"},"nb-NO":{decrease:e=>`Reduser ${e.fieldLabel}`,increase:e=>`\xd8k ${e.fieldLabel}`,numberField:"Tallfelt"},"nl-NL":{decrease:e=>`${e.fieldLabel} verlagen`,increase:e=>`${e.fieldLabel} verhogen`,numberField:"Getalveld"},"pl-PL":{decrease:e=>`Zmniejsz ${e.fieldLabel}`,increase:e=>`Zwi\u{119}ksz ${e.fieldLabel}`,numberField:"Pole numeru"},"pt-BR":{decrease:e=>`Diminuir ${e.fieldLabel}`,increase:e=>`Aumentar ${e.fieldLabel}`,numberField:"Campo de n\xfamero"},"pt-PT":{decrease:e=>`Diminuir ${e.fieldLabel}`,increase:e=>`Aumentar ${e.fieldLabel}`,numberField:"Campo num\xe9rico"},"ro-RO":{decrease:e=>`Sc\u{103}dere ${e.fieldLabel}`,increase:e=>`Cre\u{219}tere ${e.fieldLabel}`,numberField:"C\xe2mp numeric"},"ru-RU":{decrease:e=>`\u{423}\u{43C}\u{435}\u{43D}\u{44C}\u{448}\u{435}\u{43D}\u{438}\u{435} ${e.fieldLabel}`,increase:e=>`\u{423}\u{432}\u{435}\u{43B}\u{438}\u{447}\u{435}\u{43D}\u{438}\u{435} ${e.fieldLabel}`,numberField:"Числовое поле"},"sk-SK":{decrease:e=>`Zn\xed\u{17E}i\u{165} ${e.fieldLabel}`,increase:e=>`Zv\xfd\u{161}i\u{165} ${e.fieldLabel}`,numberField:"Č\xedseln\xe9 pole"},"sl-SI":{decrease:e=>`Upadati ${e.fieldLabel}`,increase:e=>`Pove\u{10D}ajte ${e.fieldLabel}`,numberField:"Številčno polje"},"sr-SP":{decrease:e=>`Smanji ${e.fieldLabel}`,increase:e=>`Pove\u{107}aj ${e.fieldLabel}`,numberField:"Polje broja"},"sv-SE":{decrease:e=>`Minska ${e.fieldLabel}`,increase:e=>`\xd6ka ${e.fieldLabel}`,numberField:"Nummerf\xe4lt"},"tr-TR":{decrease:e=>`${e.fieldLabel} azalt`,increase:e=>`${e.fieldLabel} artt\u{131}r`,numberField:"Sayı alanı"},"uk-UA":{decrease:e=>`\u{417}\u{43C}\u{435}\u{43D}\u{448}\u{438}\u{442}\u{438} ${e.fieldLabel}`,increase:e=>`\u{417}\u{431}\u{456}\u{43B}\u{44C}\u{448}\u{438}\u{442}\u{438} ${e.fieldLabel}`,numberField:"Поле номера"},"zh-CN":{decrease:e=>`\u{964D}\u{4F4E} ${e.fieldLabel}`,increase:e=>`\u{63D0}\u{9AD8} ${e.fieldLabel}`,numberField:"数字字段"},"zh-TW":{decrease:e=>`\u{7E2E}\u{5C0F} ${e.fieldLabel}`,increase:e=>`\u{653E}\u{5927} ${e.fieldLabel}`,numberField:"數字欄位"}};var AT={};AT={"ar-AE":{Empty:"فارغ"},"bg-BG":{Empty:"Изпразни"},"cs-CZ":{Empty:"Pr\xe1zdn\xe9"},"da-DK":{Empty:"Tom"},"de-DE":{Empty:"Leer"},"el-GR":{Empty:"Άδειο"},"en-US":{Empty:"Empty"},"es-ES":{Empty:"Vac\xedo"},"et-EE":{Empty:"T\xfchjenda"},"fi-FI":{Empty:"Tyhj\xe4"},"fr-FR":{Empty:"Vide"},"he-IL":{Empty:"ריק"},"hr-HR":{Empty:"Prazno"},"hu-HU":{Empty:"\xdcres"},"it-IT":{Empty:"Vuoto"},"ja-JP":{Empty:"空"},"ko-KR":{Empty:"비어 있음"},"lt-LT":{Empty:"Tuščias"},"lv-LV":{Empty:"Tukšs"},"nb-NO":{Empty:"Tom"},"nl-NL":{Empty:"Leeg"},"pl-PL":{Empty:"Pusty"},"pt-BR":{Empty:"Vazio"},"pt-PT":{Empty:"Vazio"},"ro-RO":{Empty:"Gol"},"ru-RU":{Empty:"Не заполнено"},"sk-SK":{Empty:"Pr\xe1zdne"},"sl-SI":{Empty:"Prazen"},"sr-SP":{Empty:"Prazno"},"sv-SE":{Empty:"Tomt"},"tr-TR":{Empty:"Boş"},"uk-UA":{Empty:"Пусто"},"zh-CN":{Empty:"空"},"zh-TW":{Empty:"空白"}};let AB=()=>{};function AI(e){var n;let t=(0,uA.useRef)(void 0),{value:r,textValue:o,minValue:i,maxValue:a,isDisabled:s,isReadOnly:l,isRequired:c,onIncrement:u,onIncrementPage:p,onDecrement:d,onDecrementPage:f,onDecrementToMin:h,onIncrementToMax:m}=e,g=g2((n=AT)&&n.__esModule?n.default:n,"@react-aria/spinbutton"),b=(0,uA.useRef)(!1),y=(0,uA.useCallback)(()=>{clearTimeout(t.current),b.current=!1},[]),v=m1(()=>{y()});(0,uA.useEffect)(()=>()=>v(),[]);let $=(0,uA.useRef)(!1),A=()=>{$.current=!0},w=()=>{$.current=!1},k=""===o?g.format("Empty"):(o||`${r}`).replace("-","−");(0,uA.useEffect)(()=>{$.current&&(gB&&gB.clear("assertive"),gI(k,"assertive"))},[k]);let x=(0,uA.useCallback)(()=>{y()},[y]),C=m1(u??AB),E=m1(d??AB),D=m1(()=>{(void 0===a||isNaN(a)||void 0===r||isNaN(r)||r<a)&&(C(),S(60))}),S=m1(e=>{v(),b.current=!0,t.current=window.setTimeout(D,e)}),M=m1(()=>{(void 0===i||isNaN(i)||void 0===r||isNaN(r)||r>i)&&(E(),z(60))}),z=m1(e=>{v(),b.current=!0,t.current=window.setTimeout(M,e)}),P=e=>{e.preventDefault()},{addGlobalListener:O,removeAllGlobalListeners:T}=m2(),B=(0,uA.useRef)(!1),[I,N]=(0,uA.useState)(null);(0,uA.useEffect)(()=>{"touch"===I?S(600):I&&S(400)},[I]);let[j,R]=(0,uA.useState)(null);return(0,uA.useEffect)(()=>{"touch"===j?z(600):j&&z(400)},[j]),{spinButtonProps:{role:"spinbutton","aria-valuenow":void 0===r||isNaN(r)?void 0:r,"aria-valuetext":k,"aria-valuemin":i,"aria-valuemax":a,"aria-disabled":s||void 0,"aria-readonly":l||void 0,"aria-required":c||void 0,onKeyDown:e=>{if(!e.ctrlKey&&!e.metaKey&&!e.shiftKey&&!e.altKey&&!l&&!e.nativeEvent.isComposing)switch(e.key){case"PageUp":if(p){e.preventDefault(),p?.();break}case"ArrowUp":case"Up":u&&(e.preventDefault(),u?.());break;case"PageDown":if(f){e.preventDefault(),f?.();break}case"ArrowDown":case"Down":d&&(e.preventDefault(),d?.());break;case"Home":h&&(e.preventDefault(),h?.());break;case"End":m&&(e.preventDefault(),m?.())}},onFocus:A,onBlur:w},incrementButtonProps:{onPressStart:e=>{y(),"touch"!==e.pointerType?(u?.(),N("mouse")):(O(window,"pointercancel",x,{capture:!0}),B.current=!1,N("touch")),O(window,"contextmenu",P)},onPressUp:e=>{y(),"touch"===e.pointerType&&(B.current=!0),T(),N(null)},onPressEnd:e=>{y(),"touch"===e.pointerType&&!b.current&&B.current&&u?.(),B.current=!1,N(null)},onFocus:A,onBlur:w},decrementButtonProps:{onPressStart:e=>{y(),"touch"!==e.pointerType?(d?.(),R("mouse")):(O(window,"pointercancel",x,{capture:!0}),B.current=!1,R("touch"))},onPressUp:e=>{y(),"touch"===e.pointerType&&(B.current=!0),T(),R(null)},onPressEnd:e=>{y(),"touch"===e.pointerType&&!b.current&&B.current&&d?.(),B.current=!1,R(null)},onFocus:A,onBlur:w}}}let AN=null;var Aj=t(66284);function AR(e,n,t){let r="+"===e?n+t:n-t;if(n%1!=0||t%1!=0){let o=n.toString().split("."),i=t.toString().split("."),a=Math.pow(10,Math.max(o[1]&&o[1].length||0,i[1]&&i[1].length||0));n=Math.round(n*a),t=Math.round(t*a),r=("+"===e?n+t:n-t)/a}return r}let AF=(0,uA.createContext)(null),AL=(0,uA.createContext)(null),AW=(0,uA.forwardRef)(function(e,n){var t,r;[e,n]=hj(e,n,AF);let{validationBehavior:o}=hN(vM)||{},i=null!=(r=null!=(t=e.validationBehavior)?t:o)?r:"native",{locale:a}=gT(),s=function(e){let{minValue:n,maxValue:t,step:r,formatOptions:o,value:i,defaultValue:a=NaN,onChange:s,locale:l,isDisabled:c,isReadOnly:u,commitBehavior:p="snap"}=e;null===i&&(i=NaN);let d=(0,uA.useCallback)(e=>void 0===r||isNaN(r)?vN(e,n,t):vR(e,n,t,r),[r,n,t]);void 0===i||isNaN(i)||"snap"!==p||(i=d(i)),isNaN(a)||"snap"!==p||(a=d(a));let[f,h]=y6(i,isNaN(a)?NaN:a,s),[m]=(0,uA.useState)(f),[g,b]=(0,uA.useState)(()=>isNaN(f)?"":new(0,vc.K)(l,o).format(f)),y=(0,uA.useMemo)(()=>new(0,Aj.d)(l,o),[l,o]),v=(0,uA.useMemo)(()=>y.getNumberingSystem(g),[y,g]),$=(0,uA.useMemo)(()=>new(0,vc.K)(l,{...o,numberingSystem:v}),[l,o,v]),A=(0,uA.useMemo)(()=>$.resolvedOptions(),[$]),w=(0,uA.useCallback)(e=>isNaN(e)||null===e?"":$.format(e),[$]),k=_1({...e,value:f}),x=void 0===r||isNaN(r)?1:r;"percent"===A.style&&(void 0===r||isNaN(r))&&(x=.01);let[C,E]=(0,uA.useState)(f),[D,S]=(0,uA.useState)(l),[M,z]=(0,uA.useState)(o);Object.is(f,C)&&l===D&&o===M||(b(w(f)),E(f),S(l),z(o));let P=(0,uA.useMemo)(()=>y.parse(g),[y,g]),O=(e,r=0)=>{if(isNaN(P))return vR(isNaN(r)?0:r,n,t,x);{let r=vR(P,n,t,x);return"+"===e&&r>P||"-"===e&&r<P?r:vR(AR(e,P,x),n,t,x)}},T=(0,uA.useMemo)(()=>!c&&!u&&(isNaN(P)||void 0===t||isNaN(t)||vR(P,n,t,x)>P||AR("+",P,x)<=t),[c,u,n,t,x,P]),B=(0,uA.useMemo)(()=>!c&&!u&&(isNaN(P)||void 0===n||isNaN(n)||vR(P,n,t,x)<P||AR("-",P,x)>=n),[c,u,n,t,x,P]);return{...k,validate:e=>y.isValidPartialNumber(e,n,t),increment:()=>{let e=O("+",n);e===f&&b(w(e)),h(e),k.commitValidation()},incrementToMax:()=>{null!=t&&(h(vR(t,n,t,x)),k.commitValidation())},decrement:()=>{let e=O("-",t);e===f&&b(w(e)),h(e),k.commitValidation()},decrementToMin:()=>{null!=n&&(h(n),k.commitValidation())},canIncrement:T,canDecrement:B,minValue:n,maxValue:t,numberValue:P,defaultNumberValue:isNaN(a)?m:a,setNumberValue:h,setInputValue:b,inputValue:g,commit:e=>{let n=void 0===e?g:e,t=P;if(void 0!==e&&(t=y.parse(n)),!n.length){h(NaN),b(void 0===i?"":w(f));return}if(isNaN(t))return void b(w(f));let r="snap"===p?d(t):t,o=(r=y.parse(w(r)))!==f;h(r),b(w(void 0===i?r:f)),o&&k.commitValidation()}}}({...e,locale:a,validationBehavior:i}),l=(0,uA.useRef)(null),[c,u]=hR(!e["aria-label"]&&!e["aria-labelledby"]),{labelProps:p,groupProps:d,inputProps:f,incrementButtonProps:h,decrementButtonProps:m,descriptionProps:g,errorMessageProps:b,...y}=function(e,n,t){var r,o,i,a,s,l,c,u,p;let d,{id:f,decrementAriaLabel:h,incrementAriaLabel:m,isDisabled:g,isReadOnly:b,isRequired:y,minValue:v,maxValue:$,autoFocus:A,label:w,formatOptions:k,onBlur:x=()=>{},onFocus:C,onFocusChange:E,onKeyDown:D,onKeyUp:S,description:M,errorMessage:z,isWheelDisabled:P,...O}=e,{increment:T,incrementToMax:B,decrement:I,decrementToMin:N,numberValue:j,inputValue:R,commit:F,commitValidation:L}=n,W=g2((r=Az)&&r.__esModule?r.default:r,"@react-aria/numberfield"),V=(0,uA.useCallback)(()=>{let e=t.current?.value??"";(0,m3.flushSync)(()=>{F()}),t.current?.value!==e&&gI(t.current?.value??"","assertive")},[F,t]),G=hM(f),{focusProps:U}=mL({onBlur(){V()}}),q=AO(k),H=(0,uA.useMemo)(()=>q.resolvedOptions(),[q]),K=AO({...k,currencySign:void 0}),Y=(0,uA.useMemo)(()=>isNaN(j)?"":K.format(j),[K,j]),{spinButtonProps:J,incrementButtonProps:Z,decrementButtonProps:X}=AI({isDisabled:g,isReadOnly:b,isRequired:y,maxValue:$,minValue:v,onIncrement:T,onIncrementToMax:B,onDecrement:I,onDecrementToMin:N,value:j,textValue:Y}),[Q,ee]=(0,uA.useState)(!1),{focusWithinProps:en}=ga({isDisabled:g,onFocusWithinChange:ee});!function(e,n){let{onScroll:t,isDisabled:r}=e,o=(0,uA.useCallback)(e=>{!e.ctrlKey&&(e.preventDefault(),e.stopPropagation(),t&&t({deltaX:e.deltaX,deltaY:e.deltaY}))},[t]);yn(n,"wheel",r?void 0:o)}({onScroll:(0,uA.useCallback)(e=>{!(Math.abs(e.deltaY)<=Math.abs(e.deltaX))&&(e.deltaY>0?T():e.deltaY<0&&I())},[I,T]),isDisabled:P||g||b||!Q},t);let et=(H.maximumFractionDigits??0)>0,er=void 0===n.minValue||isNaN(n.minValue)||n.minValue<0,eo="numeric";mp()?er?eo="text":et&&(eo="decimal"):mg()&&(er?eo="numeric":et&&(eo="decimal"));let ei=hZ(e),ea=(0,uA.useCallback)(e=>{e.nativeEvent.isComposing||("Enter"===e.key?((0,m3.flushSync)(()=>{F()}),L()):e.continuePropagation())},[F,L]),{isInvalid:es,validationErrors:el,validationDetails:ec}=n.displayValidation,{labelProps:eu,inputProps:ep,descriptionProps:ed,errorMessageProps:ef}=function(e,n,t){let r=m1(e=>{let r=t.current;if(!r)return;let o=null;switch(e.inputType){case"historyUndo":case"historyRedo":case"insertLineBreak":return;case"deleteContent":case"deleteByCut":case"deleteByDrag":o=r.value.slice(0,r.selectionStart)+r.value.slice(r.selectionEnd);break;case"deleteContentForward":o=r.selectionEnd===r.selectionStart?r.value.slice(0,r.selectionStart)+r.value.slice(r.selectionEnd+1):r.value.slice(0,r.selectionStart)+r.value.slice(r.selectionEnd);break;case"deleteContentBackward":o=r.selectionEnd===r.selectionStart?r.value.slice(0,r.selectionStart-1)+r.value.slice(r.selectionStart):r.value.slice(0,r.selectionStart)+r.value.slice(r.selectionEnd);break;case"deleteSoftLineBackward":case"deleteHardLineBackward":o=r.value.slice(r.selectionStart);break;default:null!=e.data&&(o=r.value.slice(0,r.selectionStart)+e.data+r.value.slice(r.selectionEnd))}null!=o&&n.validate(o)||e.preventDefault()});(0,uA.useEffect)(()=>{if(!AP()||!t.current)return;let e=t.current;return e.addEventListener("beforeinput",r,!1),()=>{e.removeEventListener("beforeinput",r,!1)}},[t]);let o=AP()?null:e=>{let t=h3(e).value.slice(0,h3(e).selectionStart)+e.data+h3(e).value.slice(h3(e).selectionEnd);n.validate(t)||e.preventDefault()},{labelProps:i,inputProps:a,descriptionProps:s,errorMessageProps:l,...c}=function(e,n){let{inputElementType:t="input",isDisabled:r=!1,isRequired:o=!1,isReadOnly:i=!1,type:a="text",validationBehavior:s="aria"}=e,[l,c]=y6(e.value,e.defaultValue||"",e.onChange),{focusableProps:u}=mU(e,n),p=_1({...e,value:l}),{isInvalid:d,validationErrors:f,validationDetails:h}=p.displayValidation,{labelProps:m,fieldProps:g,descriptionProps:b,errorMessageProps:y}=_W({...e,isInvalid:d,errorMessage:e.errorMessage||f}),v=hZ(e,{labelable:!0}),$={type:a,pattern:e.pattern},[A]=(0,uA.useState)(l);return _V(n,e.defaultValue??A,c),_G(e,p,n),{labelProps:m,inputProps:hO(v,"input"===t?$:void 0,{disabled:r,readOnly:i,required:o&&"native"===s,"aria-required":o&&"aria"===s||void 0,"aria-invalid":d||void 0,"aria-errormessage":e["aria-errormessage"],"aria-activedescendant":e["aria-activedescendant"],"aria-autocomplete":e["aria-autocomplete"],"aria-haspopup":e["aria-haspopup"],"aria-controls":e["aria-controls"],value:l,onChange:e=>c(h3(e).value),autoComplete:e.autoComplete,autoCapitalize:e.autoCapitalize,maxLength:e.maxLength,minLength:e.minLength,name:e.name,form:e.form,placeholder:e.placeholder,inputMode:e.inputMode,autoCorrect:e.autoCorrect,spellCheck:e.spellCheck,[parseInt(uw().version,10)>=17?"enterKeyHint":"enterkeyhint"]:e.enterKeyHint,onCopy:e.onCopy,onCut:e.onCut,onPaste:e.onPaste,onCompositionEnd:e.onCompositionEnd,onCompositionStart:e.onCompositionStart,onCompositionUpdate:e.onCompositionUpdate,onSelect:e.onSelect,onBeforeInput:e.onBeforeInput,onInput:e.onInput,...u,...g}),descriptionProps:b,errorMessageProps:y,isInvalid:d,validationErrors:f,validationDetails:h}}(e,t),u=(0,uA.useRef)(null);return{inputProps:hO(a,{onBeforeInput:o,onCompositionStart(){let{value:e,selectionStart:n,selectionEnd:r}=t.current;u.current={value:e,selectionStart:n,selectionEnd:r}},onCompositionEnd(){if(t.current&&!n.validate(t.current.value)){let{value:e,selectionStart:r,selectionEnd:o}=u.current;t.current.value=e,t.current.setSelectionRange(r,o),n.setInputValue(e)}}}),labelProps:i,descriptionProps:s,errorMessageProps:l,...c}}({...O,...ei,name:void 0,form:void 0,label:w,autoFocus:A,isDisabled:g,isReadOnly:b,isRequired:y,validate:void 0,[_0]:n,value:R,defaultValue:"!",autoComplete:"off","aria-label":e["aria-label"]||void 0,"aria-labelledby":e["aria-labelledby"]||void 0,id:G,type:"text",inputMode:eo,onChange:e=>{n.validate(e)&&n.setInputValue(e)},onBlur:x,onFocus:C,onFocusChange:E,onKeyDown:(0,uA.useMemo)(()=>hb(ea,D),[ea,D]),onKeyUp:S,onPaste:n=>{e.onPaste?.(n);let t=h3(n);t&&(t.selectionEnd??-1)-(t.selectionStart??0)===t.value.length&&(n.preventDefault(),F(n.clipboardData?.getData?.("text/plain")?.trim()??""))},description:M,errorMessage:z},n,t);_V(t,n.defaultNumberValue,n.setNumberValue),o=n,i=e.validationBehavior,a=e.commitBehavior,s=t,l=n.minValue,c=n.maxValue,u=e.step,p=n.numberValue,hy(()=>{let e=s.current;if("validate"!==a||o.realtimeValidation.isInvalid||!e||e.disabled||(!AN&&"u">typeof document&&((AN=document.createElement("input")).type="number"),!AN))return;AN.min=null==l||isNaN(l)?"":String(l),AN.max=null==c||isNaN(c)?"":String(c),AN.step=null==u||isNaN(u)?"":String(u),AN.value=null==p||isNaN(p)?"":String(p);let n=e.validity.valid&&AN.validity.valid,t=e.validationMessage||AN.validationMessage,r={isInvalid:!n,validationErrors:t?[t]:[],validationDetails:{badInput:e.validity.badInput,customError:e.validity.customError,patternMismatch:e.validity.patternMismatch,rangeOverflow:AN.validity.rangeOverflow,rangeUnderflow:AN.validity.rangeUnderflow,stepMismatch:AN.validity.stepMismatch,tooLong:e.validity.tooLong,tooShort:e.validity.tooShort,typeMismatch:e.validity.typeMismatch,valueMissing:e.validity.valueMissing,valid:n}};o.updateValidation(r),"native"!==i||AN.validity.valid||e.setCustomValidity(AN.validationMessage)});let eh=hO(J,U,ep,{role:null,"aria-roledescription":mf()?null:W.format("numberField"),"aria-valuemax":null,"aria-valuemin":null,"aria-valuenow":null,"aria-valuetext":null,autoCorrect:"off",spellCheck:"false"});"native"===e.validationBehavior&&(eh["aria-required"]=void 0);let em=e=>{((e=document)=>e.activeElement)()!==t.current&&("mouse"===e.pointerType?t.current?.focus():e.target.focus())},eg=e["aria-label"]||("string"==typeof e.label?e.label:"");eg||(d=null!=e.label?eu.id:e["aria-labelledby"]);let eb=hM(),ey=hM(),e_=hO(Z,{"aria-label":m||W.format("increase",{fieldLabel:eg}).trim(),id:d&&!m?eb:null,"aria-labelledby":d&&!m?`${eb} ${d}`:null,"aria-controls":G,excludeFromTabOrder:!0,preventFocusOnPress:!0,allowFocusWhenDisabled:!0,isDisabled:!n.canIncrement,onPressStart:em}),ev=hO(X,{"aria-label":h||W.format("decrease",{fieldLabel:eg}).trim(),id:d&&!h?ey:null,"aria-labelledby":d&&!h?`${ey} ${d}`:null,"aria-controls":G,excludeFromTabOrder:!0,preventFocusOnPress:!0,allowFocusWhenDisabled:!0,isDisabled:!n.canDecrement,onPressStart:em});return{groupProps:{...en,role:"group","aria-disabled":g,"aria-invalid":es?"true":void 0},labelProps:eu,inputProps:eh,incrementButtonProps:e_,decrementButtonProps:ev,errorMessageProps:ef,descriptionProps:ed,isInvalid:es,validationErrors:el,validationDetails:ec}}({...hF(e),label:u,validationBehavior:i},s,l),v=hI({...e,values:{state:s,isDisabled:e.isDisabled||!1,isInvalid:y.isInvalid||!1,isRequired:e.isRequired||!1},defaultClassName:"react-aria-NumberField"}),$=hZ(e);return delete $.id,uw().createElement(hB,{values:[[AL,s],[_h,d],[_g,{...f,ref:l}],[vz,{...p,ref:c}],[gg,{slots:{increment:h,decrement:m}}],[g_,{slots:{description:g,errorMessage:b}}],[vE,y]]},uw().createElement("div",{...$,...v,ref:n,slot:e.slot||void 0,"data-disabled":e.isDisabled||void 0,"data-required":e.isRequired||void 0,"data-invalid":y.isInvalid||void 0}),e.name&&uw().createElement("input",{type:"hidden",name:e.name,value:isNaN(s.numberValue)?"":s.numberValue}))});function AV(e,n){return Number.parseInt(Am(e,{calendar:n.calendar,locale:n.baseName,day:!1,month:!1,noToday:!0,numberingSystem:"latn"}))}let AG=(0,uA.forwardRef)(function(e,n){let{className:t}=e,r=(0,uA.useContext)(_o),o=(0,uA.useContext)(_i),i=r??o,a=(0,uA.useContext)(AD),s=bq(),l=Am(i.visibleRange.start.toDate(s),{calendar:a.calendar,locale:a.baseName,day:!1,year:!1,noToday:!0}),c=AV(i.visibleRange.start.toDate(s),a),u=i.maxValue?AV(i.maxValue.toDate(s),a):void 0,p=i.minValue?AV(i.minValue.toDate(s),a):void 0,d=(0,uA.useCallback)(e=>{i.setFocusedDate(i.focusedDate.cycle("year",e-i.focusedDate.year))},[]);return i&&(0,di.jsxs)("span",{ref:n,className:t,children:[(0,di.jsx)("span",{children:l}),(0,di.jsxs)(AW,{formatOptions:{useGrouping:!1},maxValue:u,minValue:p,onChange:d,value:c,children:[(0,di.jsx)(_b,{}),(0,di.jsxs)(_m,{children:[(0,di.jsx)(gb,{slot:"increment",children:(0,di.jsx)(dX,{size:8})}),(0,di.jsx)(gb,{slot:"decrement",children:(0,di.jsx)(dY,{size:8})})]})]})]})});var AU=t(74782),Aq={};Aq.styleTagTransform=d_(),Aq.setAttributes=dm(),Aq.insert=df().bind(null,"head"),Aq.domAPI=dp(),Aq.insertStyleElement=db(),dc()(AU.A,Aq);let AH=AU.A&&AU.A.locals?AU.A.locals:void 0;function AK({children:e}){let n=(0,uA.useContext)($D),t=(0,uA.useContext)($S),r=n??t,o=pY(()=>r?.close());return(0,di.jsx)(vC,{className:AH.dialog,ref:o,children:e})}let AY=(0,uA.forwardRef)(function({variant:e,today_:n,minDate:t,maxDate:r},o){let i="range"===e;return(0,di.jsx)($w,{ref:o,className:AH.popover,placement:"bottom start",offset:1,isNonModal:!0,children:(0,di.jsx)(AK,{children:(0,di.jsxs)(i?_s:_a,{...i?{minValue:t,maxValue:r,className:"cds--date-picker__calendar"}:{},children:[(0,di.jsxs)("header",{className:AH.header,children:[(0,di.jsx)(gb,{className:ds()(AH.flatButton,AH.flatButtonMd),slot:"previous",children:(0,di.jsx)(d4,{size:16})}),(0,di.jsx)(AG,{className:AH.monthYear}),(0,di.jsx)(gb,{className:ds()(AH.flatButton,AH.flatButtonMd),slot:"next",children:(0,di.jsx)(d6,{size:16})})]}),(0,di.jsx)(_c,{className:AH.calendarGrid,children:e=>(0,di.jsx)(_f,{className:ds()("cds--date-picker__day",{[AH.today]:0===n.compare(e)}),date:e},e.toString())})]})})})}),AJ=(0,uA.forwardRef)(function(e,n){let t=(0,uA.useContext)($D),[r,o]=hj({slot:e.slot},n,vh),{locale:i}=gT(),a=vf({...r,locale:i,createCalendar:yZ}),s=(0,uA.useRef)(null),{fieldProps:l,inputProps:c}=_K({...r,inputRef:s},a,o),u=(0,uA.useCallback)(()=>{a.isDisabled||t.toggle()},[]);return(0,di.jsxs)(hB,{values:[[vm,a],[_g,{...c,ref:s}],[_h,{...l,ref:o,isInvalid:a.isInvalid}]],children:[(0,di.jsx)(_m,{...e,id:e.id,ref:n,slot:e.slot||void 0,className:e.className,isDisabled:a.isDisabled,isInvalid:a.isInvalid,onClick:u,children:a.segments.map((n,t)=>(0,uA.cloneElement)(e.children(n),{key:t}))}),(0,di.jsx)(_b,{})]})}),AZ=(0,uA.forwardRef)(function(e,n){let t=(0,uA.useContext)($D),r=(0,uA.useContext)($S);return(t??r).isInvalid?(0,di.jsx)(hn,{ref:n,size:16,...e}):(0,di.jsx)(dK,{ref:n,size:16,...e})});class AX{constructor(e,n){this.locale=e,this.dictionary=n}of(e){return this.dictionary.getStringForLocale(e,this.locale)}}let AQ=new Map,A0=(0,uA.forwardRef)(function({segment:e,...n},t){let r=(0,uA.useContext)(vm),o=hh(t),{segmentProps:i}=function(e,n,t){let r,o,i,a,s=(0,uA.useRef)(""),{locale:l,direction:c}=gT(),u=function(){var e;let{locale:n}=gT(),t=g1((e=_R)&&e.__esModule?e.default:e,"@react-aria/datepicker");return(0,uA.useMemo)(()=>{try{return new Intl.DisplayNames(n,{type:"dateTimeField"})}catch{return new AX(n,t)}},[n,t])}(),{ariaLabel:p,ariaLabelledBy:d,ariaDescribedBy:f,focusManager:h}=_U.get(n),m=e.isPlaceholder?"":e.text,g=(0,uA.useMemo)(()=>n.dateFormatter.resolvedOptions(),[n.dateFormatter]),b=gq({month:"long",timeZone:g.timeZone}),y=gq({hour:"numeric",hour12:g.hour12,timeZone:g.timeZone});if("month"!==e.type||e.isPlaceholder)"hour"!==e.type||e.isPlaceholder||(m=y.format(n.dateValue));else{let e=b.format(n.dateValue);m=e!==m?`${m} \u{2013} ${e}`:e}let{spinButtonProps:v}=AI({value:e.value??void 0,textValue:m,minValue:e.minValue,maxValue:e.maxValue,isDisabled:n.isDisabled,isReadOnly:n.isReadOnly||!e.isEditable,isRequired:n.isRequired,onIncrement:()=>{s.current="",n.increment(e.type)},onDecrement:()=>{s.current="",n.decrement(e.type)},onIncrementPage:()=>{s.current="",n.incrementPage(e.type)},onDecrementPage:()=>{s.current="",n.decrementPage(e.type)},onIncrementToMax:()=>{s.current="",n.incrementToMax(e.type)},onDecrementToMin:()=>{s.current="",n.decrementToMin(e.type)}}),$=(0,uA.useMemo)(()=>new(0,Aj.d)(l,{maximumFractionDigits:0}),[l]),A=()=>{if(e.text===e.placeholder&&h.focusPrevious(),!$.isValidPartialNumber(e.text)||n.isReadOnly||e.isPlaceholder)("dayPeriod"===e.type||"era"===e.type)&&n.clearSegment(e.type);else{let t=e.text.slice(0,-1),r=$.parse(t);0===(t=0===r?"":t).length||0===r?n.clearSegment(e.type):n.setSegment(e.type,r),s.current=t}},{startsWith:w}=(r=function(e){let{locale:n}=gT(),t=n+(e?Object.entries(e).sort((e,n)=>e[0]<n[0]?-1:1).join():"");if(AQ.has(t))return AQ.get(t);let r=new Intl.Collator(n,e);return AQ.set(t,r),r}({usage:"search",sensitivity:"base"}),o=(0,uA.useCallback)((e,n)=>0===n.length||(e=e.normalize("NFC"),n=n.normalize("NFC"),0===r.compare(e.slice(0,n.length),n)),[r]),i=(0,uA.useCallback)((e,n)=>0===n.length||(e=e.normalize("NFC"),n=n.normalize("NFC"),0===r.compare(e.slice(-n.length),n)),[r]),a=(0,uA.useCallback)((e,n)=>{if(0===n.length)return!0;e=e.normalize("NFC");let t=0,o=(n=n.normalize("NFC")).length;for(;t+o<=e.length;t++){let i=e.slice(t,t+o);if(0===r.compare(n,i))return!0}return!1},[r]),(0,uA.useMemo)(()=>({startsWith:o,endsWith:i,contains:a}),[o,i,a])),k=gq({hour:"numeric",hour12:!0}),x=(0,uA.useMemo)(()=>{let e=new Date;return e.setHours(0),k.formatToParts(e).find(e=>"dayPeriod"===e.type).value},[k]),C=(0,uA.useMemo)(()=>{let e=new Date;return e.setHours(12),k.formatToParts(e).find(e=>"dayPeriod"===e.type).value},[k]),E=gq({year:"numeric",era:"narrow",timeZone:"UTC"}),D=(0,uA.useMemo)(()=>{if("era"!==e.type)return[];let t=bT(new bv(1,1,1),n.calendar),r=n.calendar.getEras().map(e=>{let n=t.set({year:1,month:1,day:1,era:e}).toDate("UTC");return{era:e,formatted:E.formatToParts(n).find(e=>"era"===e.type).value}}),o=function(e){e.sort();let n=e[0],t=e[e.length-1];for(let e=0;e<n.length;e++)if(n[e]!==t[e])return e;return 0}(r.map(e=>e.formatted));if(o)for(let e of r)e.formatted=e.formatted.slice(o);return r},[E,n.calendar,e.type]),S=t=>{if(n.isDisabled||n.isReadOnly)return;let r=s.current+t;switch(e.type){case"dayPeriod":if(w(x,t))n.setSegment("dayPeriod",0);else if(w(C,t))n.setSegment("dayPeriod",1);else break;h.focusNext();break;case"era":{let e=D.find(e=>w(e.formatted,t));e&&(n.setSegment("era",e.era),h.focusNext());break}case"day":case"hour":case"minute":case"second":case"month":case"year":{if(!$.isValidPartialNumber(r))return;let o=$.parse(r),i=o;if(void 0!==e.maxValue&&o>e.maxValue&&(i=$.parse(t)),isNaN(o))return;n.setSegment(e.type,i),void 0!==e.maxValue&&(Number(o+"0")>e.maxValue||r.length>=String(e.maxValue).length)?(s.current="",h.focusNext()):s.current=r}}};yn((0,uA.useRef)("u">typeof document?document:null),"selectionchange",()=>{let e=window.getSelection();e?.anchorNode&&h2(t.current,e?.anchorNode)&&e.collapse(t.current)});let M=(0,uA.useRef)("");yn(t,"beforeinput",r=>{if(t.current)switch(r.preventDefault(),r.inputType){case"deleteContentBackward":case"deleteContentForward":$.isValidPartialNumber(e.text)&&!n.isReadOnly&&A();break;case"insertCompositionText":M.current=t.current.textContent,t.current.textContent=t.current.textContent;break;default:null!=r.data&&S(r.data)}}),yn(t,"input",e=>{let{inputType:n,data:r}=e;"insertCompositionText"===n&&(t.current&&(t.current.textContent=M.current),null!=r&&(w(x,r)||w(C,r))&&S(r))}),hy(()=>{let e=t.current;return()=>{((e=document)=>e.activeElement)()===e&&(h.focusPrevious()||h.focusNext())}},[t,h]);let z=mf()||"timeZoneName"===e.type?{role:"textbox","aria-valuemax":null,"aria-valuemin":null,"aria-valuetext":null,"aria-valuenow":null}:{};e===(0,uA.useMemo)(()=>n.segments.find(e=>e.isEditable),[n.segments])||n.isInvalid||(f=void 0);let P=hM(),O=!n.isDisabled&&!n.isReadOnly&&e.isEditable,T="literal"===e.type?"":u.of(e.type),B=b6({"aria-label":`${T}${p?`, ${p}`:""}${d?", ":""}`,"aria-labelledby":d});if("literal"===e.type)return{segmentProps:{"aria-hidden":!0}};let I={caretColor:"transparent"};if("rtl"===c){I.unicodeBidi="embed";let n=g[e.type];("numeric"===n||"2-digit"===n)&&(I.direction="ltr")}return{segmentProps:hO(v,B,{id:P,...z,"aria-invalid":n.isInvalid?"true":void 0,"aria-describedby":f,"aria-readonly":n.isReadOnly||!e.isEditable?"true":void 0,"data-placeholder":e.isPlaceholder||void 0,contentEditable:O,suppressContentEditableWarning:O,spellCheck:O?"false":void 0,autoCorrect:O?"off":void 0,[parseInt(uw().version,10)>=17?"enterKeyHint":"enterkeyhint"]:O?"next":void 0,inputMode:n.isDisabled||"dayPeriod"===e.type||"era"===e.type||!O?void 0:"numeric",tabIndex:n.isDisabled?void 0:0,onKeyDown:e=>{if("a"===e.key&&(mu()?e.metaKey:e.ctrlKey)&&e.preventDefault(),!e.ctrlKey&&!e.metaKey&&!e.shiftKey&&!e.altKey)switch(e.key){case"Backspace":case"Delete":e.preventDefault(),e.stopPropagation(),A()}},onFocus:()=>{s.current="",t.current&&ya(t.current,{containingElement:yr(t.current)});let e=window.getSelection();e?.collapse(t.current)},style:I,onPointerDown(e){e.stopPropagation()},onMouseDown(e){e.stopPropagation()}})}}(e,r,o),{focusProps:a,isFocused:s,isFocusVisible:l}=gs(),{hoverProps:c,isHovered:u}=gd({...n,isDisabled:r.isDisabled||"literal"===e.type}),p=function(e){let{className:n,style:t,children:r,defaultClassName:o,defaultChildren:i,defaultStyle:a,values:s}=e;return(0,uA.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:e??o,style:l||a?{...a,...l}:void 0,children:c??i,"data-rac":""}},[n,t,r,o,i,a,s])}({...n,values:{...e,isReadOnly:!e.isEditable,isInvalid:r.isInvalid,isDisabled:r.isDisabled,isHovered:u,isFocused:s,isFocusVisible:l},defaultChildren:e.text}),d=(0,uA.useCallback)(e=>{e.stopPropagation()},[]);return(0,di.jsx)("span",{...hO(hZ(n),i,a,c),...p,ref:o,style:i.style,"data-placeholder":e.isPlaceholder||void 0,"data-invalid":r.isInvalid||void 0,"data-readonly":!e.isEditable||void 0,"data-disabled":r.isDisabled||void 0,"data-type":e.type,"data-hovered":u||void 0,"data-focused":s||void 0,"data-focus-visible":l||void 0,onClick:d})}),A1={short:!1,size:"md"},A2=(0,uA.forwardRef)(function(e,n){let{className:t,defaultValue:r,isDisabled:o,invalid:i,invalidText:a,isInvalid:s,label:l,labelText:c,light:u,maxDate:p,minDate:d,onChange:f,onChangeRaw:h,short:m,size:g,value:b,...y}={...A1,...e},{calendar:v,intlLocale:$,today_:A}=AS(),w=(0,uA.useId)(),k=!!(c??l),x=(0,uA.useMemo)(()=>$O(r,v),[r,v]),C=(0,uA.useMemo)(()=>$O(b,v,!0),[b,v]),E=(0,uA.useMemo)(()=>$O(p,v),[p,v]),D=(0,uA.useMemo)(()=>$O(d??AM,v),[d,v]),S=(0,uA.useMemo)(()=>i||s,[i,s]),M=(0,uA.useMemo)(()=>(h&&f&&console.error("An OpenmrsDatePicker component was created with both onChange and onChangeRaw handlers defined. Only onChangeRaw will be used."),h??(e=>f?.($T(e)))),[h,f]);return(0,di.jsx)($P,{locale:$.toString(),children:(0,di.jsx)("div",{className:ds()("cds--form-item",t),children:(0,di.jsx)(hB,{values:[[AD,$]],children:(0,di.jsxs)($M,{className:ds()("cds--date-picker","cds--date-picker--single",{"cds--date-picker--short":m,"cds--date-picker--light":u}),defaultValue:x,isDisabled:o,isInvalid:S,maxValue:E,minValue:D,value:C,shouldForceLeadingZeros:"en"===$.language||void 0,...y,onChange:M,children:[(0,di.jsxs)("div",{className:"cds--date-picker-container",children:[k&&(0,di.jsx)(vP,{className:ds()("cds--label",{"cds--label--disabled":o}),htmlFor:w,children:c??l}),(0,di.jsxs)(_m,{className:AH.inputGroup,children:[(0,di.jsx)(AJ,{id:k?w:void 0,ref:n,className:ds()("cds--date-picker-input__wrapper",AH.inputWrapper,{[AH.inputWrapperSm]:"sm"===g,[AH.inputWrapperMd]:"md"===g||!g||0===g.length,[AH.inputWrapperLg]:"lg"===g}),children:e=>"era"!==e.type?(0,di.jsx)(A0,{className:AH.inputSegment,segment:e}):(0,di.jsx)(uw().Fragment,{})}),(0,di.jsx)(gb,{className:ds()(AH.flatButton,{[AH.flatButtonSm]:"sm"===g,[AH.flatButtonMd]:"md"===g||!g||0===g.length,[AH.flatButtonLg]:"lg"===g}),children:(0,di.jsx)(AZ,{})})]}),(0,di.jsx)(vD,{className:AH.invalidText,children:a})]}),(0,di.jsx)(AY,{variant:"single",today_:A})]})})})})}),A3=(0,uA.forwardRef)(function({className:e,defaultValue:n,invalid:t,invalidText:r,isDisabled:o,isInvalid:i,label:a,labelText:s,light:l,maxDate:c,minDate:u,onChange:p,onChangeRaw:d,size:f="md",value:h,...m},g){let{calendar:b,intlLocale:y,today_:v}=AS(),$=(0,uA.useId)(),A=!!(s??a),w=(0,uA.useMemo)(()=>{if(h)return{start:$O(h[0],b,!1),end:$O(h[1],b,!1)}},[h,b]),k=(0,uA.useMemo)(()=>{if(n)return{start:$O(n[0],b,!1),end:$O(n[1],b,!1)}},[n,b]),x=(0,uA.useMemo)(()=>$O(u??AM,b,!0),[u,b]),C=(0,uA.useMemo)(()=>$O(c,b,!0),[c,b]),E=(0,uA.useMemo)(()=>t||i,[t,i]),D=(0,uA.useMemo)(()=>(d&&p&&console.error("An OpenmrsDateRangePicker component was created with both onChange and onChangeRaw handlers defined. Only onChangeRaw will be used."),d??(e=>p?.([$T(e.start),$T(e.end)]))),[d,p]);return(0,di.jsx)($P,{locale:y.toString(),children:(0,di.jsx)("div",{className:ds()("cds--form-item",e),children:(0,di.jsx)(hB,{values:[[AD,y]],children:(0,di.jsx)($z,{id:A?$:void 0,className:ds()("cds--date-picker",{"cds--date-picker--light":l,"cds--date-picker--disabled":o}),isInvalid:E,shouldForceLeadingZeros:"en"===y.language||void 0,maxValue:C,minValue:x,value:w,defaultValue:k,ref:g,isDisabled:o,...m,onChange:D,children:(0,di.jsxs)("div",{className:"cds--date-picker-container",children:[A&&(0,di.jsx)(vP,{className:ds()("cds--label",{"cds--label--disabled":o}),htmlFor:$,children:s??a}),(0,di.jsxs)(_m,{className:AH.inputGroup,children:[(0,di.jsxs)("div",{className:ds()(AH.inputsWrapper,{[AH.inputsWrapperSm]:"sm"===f,[AH.inputsWrapperMd]:"md"===f||!f||0===f.length,[AH.inputsWrapperLg]:"lg"===f}),children:[(0,di.jsx)(vb,{className:ds()("cds--date-picker-input__wrapper",AH.startInput,AH.dateInputWrapper),slot:"start",children:e=>(0,di.jsx)(A0,{className:AH.inputSegment,segment:e})}),(0,di.jsx)("div",{className:AH.separator,children:(0,di.jsx)("span",{"aria-hidden":"true","data-readonly":!0,children:"–"})}),(0,di.jsx)(vb,{className:ds()("cds--date-picker-input__wrapper",AH.endInput,AH.dateInputWrapper),slot:"end",children:e=>(0,di.jsx)(A0,{className:AH.inputSegment,segment:e})})]}),(0,di.jsx)(gb,{className:ds()(AH.flatButton,{[AH.flatButtonSm]:"sm"===f,[AH.flatButtonMd]:"md"===f||!f||0===f.length,[AH.flatButtonLg]:"lg"===f}),children:(0,di.jsx)(AZ,{})})]}),(0,di.jsx)(vD,{className:AH.invalidText,children:r}),(0,di.jsx)(AY,{variant:"range",today_:v,minDate:x,maxDate:C})]})})})})})});var A5=t(89124),A4={};A4.styleTagTransform=d_(),A4.setAttributes=dm(),A4.insert=df().bind(null,"head"),A4.domAPI=dp(),A4.insertStyleElement=db(),dc()(A5.A,A4);let A6=A5.A&&A5.A.locals?A5.A.locals:void 0,A8=({diagnoses:e})=>{let{diagnosisTags:n}=pm({externalModuleName:"@openmrs/esm-styleguide"});return(0,di.jsx)("div",{className:A6.container,children:e.map(e=>{let{rank:t,uuid:r,display:o}=e,i=n[1===t?"primaryColor":"secondaryColor"];return(0,di.jsx)(dk.vwO,{type:i,children:o},r)})})};var A7=t(87770),A9={};A9.styleTagTransform=d_(),A9.setAttributes=dm(),A9.insert=df().bind(null,"head"),A9.domAPI=dp(),A9.insertStyleElement=db(),dc()(A7.A,A9);let we=A7.A&&A7.A.locals?A7.A.locals:void 0,wn=({width:e="64",height:n="64"})=>(0,di.jsx)("svg",{width:e,height:n,viewBox:"0 0 64 64",children:(0,di.jsx)("use",{href:"#omrs-empty-data-illustration"})}),wt=e=>{let n="tablet"===pG(),t=e.launchForm;return(0,di.jsx)(dk.Wdr,{className:we.layer,children:(0,di.jsxs)(dk.FAs,{className:we.tile,children:[(0,di.jsx)("div",{className:n?we.tabletHeading:we.desktopHeading,children:(0,di.jsx)("h4",{children:e.headerTitle})}),(0,di.jsx)(wn,{}),(0,di.jsx)("p",{className:we.content,children:o2("emptyStateText","There are no {{displayText}} to display",{displayText:e.displayText})}),(0,di.jsx)("p",{className:we.action,children:t&&(0,di.jsx)(dk.$nd,{onClick:()=>t(),kind:"ghost",size:n?"lg":"sm",children:o2("recordNewEntry","Record {{ displayText }}",{displayText:e.displayText})})})]})})};var wr=t(88480),wo={};wo.styleTagTransform=d_(),wo.setAttributes=dm(),wo.insert=df().bind(null,"head"),wo.domAPI=dp(),wo.insertStyleElement=db(),dc()(wr.A,wo);let wi=wr.A&&wr.A.locals?wr.A.locals:void 0,wa=({error:e,headerTitle:n})=>{let t="tablet"===pG();return(0,di.jsx)(dk.Wdr,{children:(0,di.jsxs)(dk.FAs,{className:wi.tile,children:[(0,di.jsx)("div",{className:t?wi.tabletHeading:wi.desktopHeading,children:(0,di.jsx)("h4",{children:n})}),(0,di.jsxs)("p",{className:wi.errorMessage,children:[o2("error","Error")," ",`${e?.response?.status}: `,e?.response?.statusText]}),(0,di.jsx)("p",{className:wi.errorCopy,children:o2("errorCopy")})]})})},ws=wa;var wl=t(15764),wc={};wc.styleTagTransform=d_(),wc.setAttributes=dm(),wc.insert=df().bind(null,"head"),wc.domAPI=dp(),wc.insertStyleElement=db(),dc()(wl.A,wc);let wu=wl.A&&wl.A.locals?wl.A.locals:void 0,wp=uw().forwardRef((e,n)=>{let{slotName:t,basePath:r,componentContext:o,state:i}=pH(),a=window.location??{pathname:""},s=uR(t??"");return e.isChildOfHeader&&t&&s.length>0?(0,di.jsxs)(dk.f8J,{"aria-label":o2("leftNavigation","Left navigation"),className:wu.leftNav,expanded:!0,isFixedNav:!0,ref:n,...e,children:[(0,di.jsx)(uW,{name:"global-nav-menu-slot"}),t?(0,di.jsx)(pa,{value:o,fallback:(0,di.jsx)(uW,{name:t,state:{basePath:r,currentPath:a,...i}}),children:(0,di.jsx)(uP.Provider,{value:o,children:(0,di.jsx)(uW,{name:t,state:{basePath:r,currentPath:a,...i}})})}):null]}):null});var wd=t(48500),wf={};wf.styleTagTransform=d_(),wf.setAttributes=dm(),wf.insert=df().bind(null,"head"),wf.domAPI=dp(),wf.insertStyleElement=db(),dc()(wd.A,wf);let wh=wd.A&&wd.A.locals?wd.A.locals:void 0,wm=({selectedLocationUuid:e,defaultLocationUuid:n,locationTag:t,locationsPerRequest:r=50,onChange:o})=>{let[i,a]=(0,uA.useState)(""),s=(0,uA.useId)(),{location:l}=function(e){let n=e?`/ws/fhir2/R4/Location?_id=${e}`:null,{data:t,error:r,isLoading:o}=(0,p_.A)(n,rY,{shouldRetryOnError:e=>!!e?.response?.status&&e.response.status>=500});return(0,uA.useMemo)(()=>({location:t?.data?.entry?t.data.entry[0]:null,error:n?r:null,isLoading:!!n&&o}),[t,o,r,n])}(n),{locations:c,isLoading:u,hasMore:p,loadingNewData:d,error:f,setPage:h}=function(e,n=0,t=""){let r=py(t),{data:o,isLoading:i,isValidating:a,setSize:s,error:l}=pI(function(t,o){if(o){let e=o.data?.link?.find(e=>"next"===e.relation);if(!e)return null;let n=new URL(e.url);return n.origin===window.location.origin?e.url:new URL(`${n.pathname}${n.search?`?${n.search}`:""}`,window.location.origin).toString()}let i=`${rq}/Location?`,a=new URLSearchParams;return a.append("_summary","data"),n&&a.append("_count",""+n),t&&a.append("_getpagesoffset",""+t*n),e&&a.append("_tag",e),"string"==typeof r&&""!==r&&a.append("name:contains",r),i+a.toString()},rY);return(0,uA.useMemo)(()=>({locations:o?.length?o?.flatMap(e=>e?.data?.entry??[]):[],isLoading:i,totalResults:o?.[0]?.data?.total,hasMore:!!o?.length&&o?.[o.length-1]?.data?.link?.some(e=>"next"===e.relation),loadingNewData:a,error:l||null,setPage:s}),[i,o,a,s,l])}(t,r,i),m=(0,uA.useMemo)(()=>l&&!i&&n?[l,...c.filter(({resource:e})=>e.id!==n)]:c??[],[l,c,n,i]),g=(0,uA.useCallback)(e=>{o(),a(e.trim())},[o]),b=pJ((0,uA.useCallback)(()=>{!d&&p&&h(e=>e+1)},[d,p,h])),y=p?Math.max(0,Math.floor(m.length-r/2)):-1;return(0,di.jsxs)(di.Fragment,{children:[(0,di.jsx)(dk.vji,{"aria-describedby":f?`${s}-error`:void 0,labelText:o2("searchForLocation"),id:s,placeholder:o2("searchForLocation"),onChange:e=>g(e.target.value),size:"lg"}),f&&(0,di.jsx)("div",{className:wh.errorNotification,id:`${s}-error`,children:(0,di.jsx)(dk.jeF,{kind:"error",subtitle:o2("errorLoadingLoginLocations","Unable to load login locations. Please try again or contact support if the problem persists."),title:o2("error","Error")})}),(0,di.jsx)("div",{className:wh.searchResults,children:u?(0,di.jsx)("div",{className:wh.loadingContainer,children:Array.from({length:5}).map((e,n)=>(0,di.jsx)(dk.Psq,{className:wh.radioButtonSkeleton,role:"progressbar"},n))}):(0,di.jsxs)(di.Fragment,{children:[(0,di.jsx)("div",{className:wh.locationResultsContainer,children:m.length>0?(0,di.jsx)(dk.zWQ,{name:"loginLocations",onChange:e=>{o(e?.toString())},orientation:"vertical",valueSelected:e,children:m.map((e,n)=>(0,di.jsx)(dk.aaP,{className:wh.locationRadioButton,id:e.resource.id,labelText:(0,di.jsx)("span",{ref:n===y?b:null,children:e.resource.name}),name:e.resource.name,value:e.resource.id},e.resource.id))}):(0,di.jsx)("div",{className:wh.emptyState,children:(0,di.jsx)("p",{className:wh.locationNotFound,children:o2("noResultsToDisplay")})})}),d&&(0,di.jsx)("div",{className:wh.loadingIcon,children:(0,di.jsx)(dk.OuH,{description:o2("loading")})})]})})]})},wg=["NORMAL","HIGH","CRITICALLY_HIGH","OFF_SCALE_HIGH","LOW","CRITICALLY_LOW","OFF_SCALE_LOW"],wb=["critically_low","critically_high","high","low","normal","off_scale_low","off_scale_high"];function wy(e){if(e)return"--"===e?"normal":wg.includes(e)?e.toLowerCase():wb.includes(e)?e:"normal"}function w_(e,n){if(!n||null==e||""===e)return"normal";let t="string"==typeof e?Number.parseFloat(e):e;return Number.isNaN(t)?"normal":null!==n.hiAbsolute&&void 0!==n.hiAbsolute&&t>n.hiAbsolute?"off_scale_high":null!==n.hiCritical&&void 0!==n.hiCritical&&t>=n.hiCritical?"critically_high":null!==n.hiNormal&&void 0!==n.hiNormal&&t>n.hiNormal?"high":null!==n.lowAbsolute&&void 0!==n.lowAbsolute&&t<n.lowAbsolute?"off_scale_low":null!==n.lowCritical&&void 0!==n.lowCritical&&t<=n.lowCritical?"critically_low":null!==n.lowNormal&&void 0!==n.lowNormal&&t<n.lowNormal?"low":"normal"}function wv(e,n){let t=null;e&&(t=n?`${rU}/conceptreferencerange/?patient=${n}&concept=${e}&v=full`:`${rU}/conceptreferencerange/?concept=${e}&v=full`);let{data:r,error:o,isLoading:i}=(0,p_.A)(t,rY),a=r?.data?.results?.[0];return{referenceRange:a?{hiNormal:a.hiNormal??null,hiAbsolute:a.hiAbsolute??null,hiCritical:a.hiCritical??null,lowNormal:a.lowNormal??null,lowAbsolute:a.lowAbsolute??null,lowCritical:a.lowCritical??null}:void 0,error:o,isLoading:i}}var w$=t(4112),wA={};wA.styleTagTransform=d_(),wA.setAttributes=dm(),wA.insert=df().bind(null,"head"),wA.domAPI=dp(),wA.insertStyleElement=db(),dc()(w$.A,wA);let ww=w$.A&&w$.A.locals?w$.A.locals:void 0,wk=({value:e,unit:n,label:t,interpretation:r,referenceRange:o,conceptUuid:i,variant:a="card",patientUuid:s})=>{let l=(0,uA.useId)(),{referenceRange:c,isLoading:u}=wv(o||r?void 0:i,s),p=o??c,d=(0,uA.useMemo)(()=>r?wy(r):p&&!u?w_(e,p):"normal",[r,p,e,u])??"normal",f="critically_low"===d||"critically_high"===d||"off_scale_low"===d||"off_scale_high"===d,h="normal"!==d,m=t?`omrs-numeric-obs-label-${t.replaceAll(/\s+/g,"-").toLowerCase()}-${l}`:void 0,g=`omrs-numeric-obs-value-${l}`,b=`omrs-numeric-obs-unit-${l}`,y=null!=e&&""!==e,v=y?e:o2("notAvailable","Not available"),$=ds()({[ww["critically-low"]]:"critically_low"===d||"off_scale_low"===d,[ww["critically-high"]]:"critically_high"===d||"off_scale_high"===d,[ww.low]:"low"===d,[ww.high]:"high"===d,[ww["off-scale-low"]]:"off_scale_low"===d,[ww["off-scale-high"]]:"off_scale_high"===d}),A=ds()({[ww.container]:!0,[ww.card]:!0,[ww["critical-value"]]:f,[ww["abnormal-value"]]:h&&!f}),w=ds()({[ww.cell]:!0,[$]:!0});return"cell"===a?(0,di.jsxs)("div",{className:w,children:[v,y&&n?` ${n}`:""]}):(0,di.jsxs)("section",{className:A,"data-testid":"numeric-observation-card",children:[t&&(0,di.jsxs)("div",{className:ww["label-container"],children:[(0,di.jsx)("span",{id:m,className:ww.label,children:t}),h&&(0,di.jsx)("span",{className:ww[d.replace("_","-")],title:o2("abnormalValue","Abnormal value")})]}),(0,di.jsxs)("div",{className:ww["value-container"],children:[(0,di.jsx)("span",{id:g,"aria-labelledby":m&&b?`${m} ${b}`:m||b||void 0,className:ww.value,children:v}),y&&n&&(0,di.jsx)("span",{id:b,className:ww.units,children:n})]})]})},wx=L("modalState",{modalContainer:null,modalStack:[]});function wC(e,n={},t=()=>{}){let r=()=>{let e,n,r=wx.getState().modalStack.find(e=>e.onClose===t);r&&(n=(e=wx.getState()).modalStack.map(e=>e===r?{...e,state:"TO_BE_DELETED"}:e),wx.setState({...e,modalStack:n}))};if(function(e){let n=ux.getState().modals[e];if(!n){let r=c8(e);if(r){var t;n={name:e,load:r.load,moduleName:r.moduleName},console.warn(`Modal ${e} was registered as an extension. This is deprecated and will be removed in the future. Please register it in the "modals" section of routes.json instead of the "extensions" section.`),t=n,ux.setState(e=>(e.modals[t.name]=t,e))}}return n}(e)){var o;let i,a;o={state:"NEW",onClose:t,modalName:e,props:{close:r,...n}},a=[o,...(i=wx.getState()).modalStack],wx.setState({...i,modalStack:a})}else z(`Failed to launch modal. Please notify your administrator. Modal name: "${e}"`);return r}window.getComputedStyle(document.body).overflow;var wE=t(66401);let wD=new er.Subject,wS=0,wM=new er.Subject,wz=0;function wP(e){var n;e&&("string"==typeof(n=e.description)?n.trim().length>0:"object"==typeof n&&(n instanceof Error||!(0,wE.A)(n)))?(e.description instanceof Error&&(e.description=e.description.toLocaleString()),setTimeout(()=>{wD.next({...e,id:wS++})},0)):console.error("showNotification must be called with an object having a 'description' property that is a non-empty string or object")}function wO(e){var n;e&&("string"==typeof(n=e.actionButtonLabel)?n.trim().length>0:"object"==typeof n&&!(0,wE.A)(n))?setTimeout(()=>{wM.next({...e,id:wz++})},0):console.error("showActionableNotification must be called with an actionButtonLabel that is a non-empty string")}var wT=t(292),wB={};wB.styleTagTransform=d_(),wB.setAttributes=dm(),wB.insert=df().bind(null,"head"),wB.domAPI=dp(),wB.insertStyleElement=db(),dc()(wT.A,wB);let wI=wT.A&&wT.A.locals?wT.A.locals:void 0,wN=e=>{if("children"in e){let{children:n,className:t,...r}=e;return(0,di.jsx)("div",{className:ds()(wI.pageHeader,t),...r,children:n})}{let{title:n,illustration:t,className:r,...o}=e;return(0,di.jsx)("div",{className:ds()(wI.pageHeader,r),...o,children:(0,di.jsx)(wj,{title:n,illustration:t})})}},wj=({title:e,illustration:n,className:t})=>{let[r,o]=(0,uA.useState)(null);return(0,uA.useEffect)(()=>{nK("@openmrs/esm-styleguide").then(e=>{o(e)})},[]),(0,di.jsxs)("div",{className:ds()(wI.pageHeaderContent,t),children:[n,(0,di.jsxs)("div",{className:wI.pageLabels,children:[r?.implementationName&&(0,di.jsx)("p",{children:o2(r.implementationName)}),(0,di.jsx)("p",{className:wI.pageName,children:e})]})]})};var wR=t(72886),wF={};wF.styleTagTransform=d_(),wF.setAttributes=dm(),wF.insert=df().bind(null,"head"),wF.domAPI=dp(),wF.insertStyleElement=db(),dc()(wR.A,wF);let wL=wR.A&&wR.A.locals?wR.A.locals:void 0,wW=({totalItems:e,pageSize:n,onPageNumberChange:t,pageNumber:r,dashboardLinkUrl:o,currentItems:i,dashboardLinkLabel:a})=>{let{pageSizes:s,pageItemsCount:l}=pQ(n,e,r,i),c="tablet"===pG(),u=o2("paginationItemsCount","{{pageItemsCount}} / {{totalItems}} items",{totalItems:e,pageItemsCount:l});return(0,di.jsx)(di.Fragment,{children:e>0&&(0,di.jsxs)("div",{className:ds()({[wL.tablet]:c,[wL.desktop]:!c}),children:[(0,di.jsxs)("div",{children:[u,o&&(0,di.jsx)(uk,{to:o,className:wL.configurableLink,children:a??o2("seeAll","See all")})]}),(0,di.jsx)(dk.dKS,{className:wL.pagination,page:r,pageSize:n,pageSizes:s,totalItems:e,onChange:t,pageRangeText:(e,n)=>o2("paginationOfPages","of {{count}} pages",{count:n}),size:c?"lg":"sm"})]})})};function wV(e){return wU(wH(e,"usual","official"))}function wG(e){return wV(e)}function wU(e){var n;let t;return e?e.text??(t=(n=e).given??[],(n.family?t.concat(n.family):t).join(" ")):""}function wq(e){return wU(e)}function wH(e,...n){for(let t of(0==n.length&&(n=["usual"]),n)){let n=e.name?.find(e=>{var n,r;return n=e,r=t,n.use?n.use===r:"usual"===r});if(n)return n}}function wK(e,n=p6()){let t=p6(n),r=A$(e,t);if(null==r)return null;let o=t.diff(r,"hours"),i=t.diff(r,"days"),a=t.diff(r,"weeks"),s=t.diff(r,"months"),l=t.diff(r,"years"),c={};if(o<2)c.minutes=t.diff(r,"minutes");else if(i<2)c.hours=o;else if(a<4)c.days=i;else if(l<1){let e=t.subtract(a,"weeks").diff(r,"days");c.weeks=a,c.days=e}else if(l<2){let e=t.subtract(s,"months").diff(r,"days");c.months=s,c.days=e}else if(l<18){let e=t.subtract(l,"year").diff(r,"months");c.years=l,c.months=e}else c.years=l;return c}function wY(e,n=p6()){let t=wK(e,n);if(null==t)return null;let r={style:"short",localeMatcher:"lookup"};return"minutes"in t&&0===t.minutes&&(r.minutesDisplay="always"),Av(t,r)}var wJ=t(46010),wZ={};wZ.styleTagTransform=d_(),wZ.setAttributes=dm(),wZ.insert=df().bind(null,"head"),wZ.domAPI=dp(),wZ.insertStyleElement=db(),dc()(wJ.A,wZ);let wX=wJ.A&&wJ.A.locals?wJ.A.locals:void 0;function wQ({showIdentifierLabel:e,type:n,value:t}){return(0,di.jsx)("span",{className:wX.primaryIdentifier,children:(0,di.jsxs)(dk.vwO,{className:wX.tag,type:"gray",children:[e&&n?.text&&(0,di.jsxs)("span",{className:wX.label,children:[n.text,": "]}),(0,di.jsx)("span",{className:wX.value,children:t})]})})}function w0({showIdentifierLabel:e,type:n,value:t}){return(0,di.jsxs)(dk.lRv,{className:wX.secondaryIdentifier,id:`patient-banner-identifier-${t}`,children:[e&&(0,di.jsxs)("span",{className:wX.label,children:[n?.text,": "]}),(0,di.jsx)("span",{className:wX.value,children:t})]})}function w1({identifiers:e,showIdentifierLabel:n}){let{excludePatientIdentifierCodeTypes:t}=pm(),{primaryIdentifierCode:r}=p2(),o=e?.filter(e=>{let n=e.type?.coding?.[0]?.code;return n&&!t?.uuids.includes(n)})??[];return(0,di.jsx)(di.Fragment,{children:o?.length?o.map(({value:e,type:t},i)=>(0,di.jsxs)(uw().Fragment,{children:[(0,di.jsx)("span",{className:wX.identifier,children:t?.coding?.[0]?.code===r?(0,di.jsx)(wQ,{showIdentifierLabel:n,type:t,value:e}):(0,di.jsx)(w0,{showIdentifierLabel:n,type:t,value:e})}),i<o.length-1&&(0,di.jsx)("span",{className:wX.separator,children:"\xb7"})]},e)):""})}let w2={Female:fl,Male:fc,Other:fu,Unknown:fp},w3=({gender:e})=>{let n=w2[e];return n?(0,di.jsx)(n,{fill:"#525252"}):null},w5={male:"Male",female:"Female",other:"Other",unknown:"Unknown"};function w4({patient:e,renderedFrom:n}){var t;let r,o,i=wV(e),a=e?.gender&&(o=w5[r=(t=e.gender).toLowerCase()]??"Unknown",{displayText:o2(r,t),iconKey:o}),s=(0,uA.useMemo)(()=>({patientUuid:e.id,patient:e,renderedFrom:n}),[e.id,e,n]);return(0,di.jsxs)("div",{className:wX.patientInfo,children:[(0,di.jsx)("div",{className:ds()(wX.row,wX.patientNameRow),children:(0,di.jsxs)("div",{className:wX.flexRow,children:[(0,di.jsx)("span",{className:wX.patientName,children:i}),a&&(0,di.jsxs)("div",{className:wX.gender,children:[(0,di.jsx)(w3,{gender:a.iconKey}),(0,di.jsx)("span",{children:a.displayText})]}),(0,di.jsx)(uW,{className:wX.tagsSlot,name:"patient-banner-tags-slot",state:s})]})}),(0,di.jsxs)("div",{className:wX.demographics,children:[e.birthDate&&(0,di.jsxs)(di.Fragment,{children:[(0,di.jsx)("span",{children:wY(e.birthDate)}),(0,di.jsx)("span",{className:wX.separator,children:"\xb7"}),(0,di.jsx)("span",{children:Ah(e.birthDate,{time:!1})}),(0,di.jsx)("span",{className:wX.separator,children:"\xb7"})]}),(0,di.jsx)(w1,{identifiers:e.identifier,showIdentifierLabel:!0}),(0,di.jsx)(uW,{className:wX.extensionSlot,name:"patient-banner-bottom-slot",state:s})]})]})}var w6=t(81673),w8=t(9102),w7={};w7.styleTagTransform=d_(),w7.setAttributes=dm(),w7.insert=df().bind(null,"head"),w7.domAPI=dp(),w7.insertStyleElement=db(),dc()(w8.A,w7);let w9=w8.A&&w8.A.locals?w8.A.locals:void 0;function ke({patient:e,patientUuid:n,actionsSlotName:t,additionalActionsSlotState:r}){let[o,i]=(0,uA.useState)(!1),{extensions:a}=uF(t),s="tablet"===pG(),l=pY(()=>i(!1),o),c=(0,uA.useRef)(null),u=(0,uA.useRef)(null),p=(0,uA.useId)(),d=`patient-actions-menu-trigger-${p}`,f=`patient-actions-menu-${p}`,h=(0,uA.useCallback)(()=>i(e=>!e),[]),m=(0,uA.useCallback)(()=>{i(!1),c.current?.focus()},[]),g=(0,uA.useCallback)(e=>{if("Escape"===e.key&&o){e.stopPropagation(),m();return}if(("ArrowDown"===e.key||"ArrowUp"===e.key)&&o){e.preventDefault();let n=u.current?.querySelectorAll('[role="menuitem"]:not([disabled])');if(!n?.length)return;let t=document.activeElement?.closest?.('[role="menuitem"]')??document.activeElement,r=Array.from(n).indexOf(t);if(-1===r)return void n["ArrowDown"===e.key?0:n.length-1]?.focus();let o=r+("ArrowDown"===e.key?1:-1),i=o<0?n.length-1:o>=n.length?0:o;n[i]?.focus()}},[m,o]);(0,uA.useEffect)(()=>{if(o&&u.current){let e=u.current.querySelector('[role="menuitem"]:not([disabled])');e?.focus()}},[o]);let b=(0,uA.useMemo)(()=>({patientUuid:n,patient:e,closeMenu:m,...r}),[n,e,m,r]);return 0===a.length?null:(0,di.jsx)("div",{className:w9.overflowMenuContainer,children:(0,di.jsxs)("div",{"data-overflow-menu":!0,className:ds()("cds--overflow-menu",dE.container),ref:l,children:[(0,di.jsxs)("button",{className:ds()("cds--btn","cds--btn--ghost","cds--overflow-menu__trigger",{"cds--overflow-menu--open":o},dE.overflowMenuButton),"aria-controls":f,"aria-expanded":o,"aria-haspopup":"true",id:d,onClick:h,onKeyDown:g,ref:c,children:[(0,di.jsx)("span",{className:w9.actionsButtonText,children:o2("actions","Actions")})," ",(0,di.jsx)(w6.CH,{size:16,style:{marginLeft:"0.5rem",fill:"#78A9FF"}})]}),(0,di.jsxs)("div",{className:ds()("cds--overflow-menu-options","cds--overflow-menu--flip",dE.menu,{[dE.show]:o}),"aria-labelledby":d,"data-floating-menu-direction":"bottom",id:f,onKeyDown:g,ref:u,role:"menu",tabIndex:-1,children:[(0,di.jsx)("ul",{className:ds()("cds--overflow-menu-options__content",{"cds--overflow-menu-options--lg":s}),children:(0,di.jsx)(uW,{name:t,state:b},t)}),(0,di.jsx)("span",{})]})]})})}function kn({showContactDetails:e,toggleContactDetails:n,className:t}){return(0,di.jsx)(dk.$nd,{className:t,iconDescription:"Toggle contact details",kind:"ghost",onClick:n,renderIcon:e?d8:d5,children:e?o2("showLess","Show less"):o2("showMore","Show more")})}var kt=t(95804),kr={};kr.styleTagTransform=d_(),kr.setAttributes=dm(),kr.insert=df().bind(null,"head"),kr.domAPI=dp(),kr.insertStyleElement=db(),dc()(kt.A,kr);let ko=kt.A&&kt.A.locals?kt.A.locals:void 0,ki=({patientUuid:e})=>{let{cohorts:n=[],isLoading:t}=function(e){let n=e?`${rU}/cohortm/cohortmember?patient=${e}&v=custom:(uuid,patient:ref,cohort:(uuid,name,startDate,endDate))`:null,{data:t,isLoading:r}=(0,u5.Ay)(n,rY),o=t?.data?.results.map(e=>({uuid:e.cohort.uuid,name:e.cohort.name,startDate:e.cohort.startDate,endDate:e.cohort.endDate}));return(0,uA.useMemo)(()=>({cohorts:o,isLoading:r}),[r,o])}(e);return(0,di.jsxs)(di.Fragment,{children:[(0,di.jsxs)("p",{className:ko.heading,children:[o2("patientLists","Patient Lists")," (",n?.length??0,")"]}),t?(0,di.jsx)(dk.OuH,{description:`${o2("loading","Loading")} ...`,role:"progressbar"}):(0,di.jsxs)("ul",{children:[(()=>{if(n?.length>0){let e=n.sort((e,n)=>Al(e?.startDate).getTime()-Al(n?.startDate).getTime()).slice(0,3);return e?.map(e=>(0,di.jsx)("li",{children:(0,di.jsx)(uk,{to:`${window.spaBase}/home/patient-lists/${e.uuid}`,children:e.name},e.uuid)},e.uuid))}return(0,di.jsx)("li",{children:"--"})})(),n.length>3&&(0,di.jsx)("li",{className:ko.link,children:(0,di.jsx)(uk,{to:`${window.spaBase}/home/patient-lists`,children:o2("seeMoreLists","See {{count}} more lists",{count:n?.length-3})})})]})]})},ka=({patientId:e})=>{let{patient:n,isLoading:t}=p1(e),r=n?.address?.find(e=>"home"===e.use),o=e=>e.split("#")[1];return t?(0,di.jsx)(dk.OuH,{description:`${o2("loading","Loading")} ...`,role:"progressbar"}):(0,di.jsxs)(di.Fragment,{children:[(0,di.jsx)("p",{className:ko.heading,children:o2("address","Address")}),(0,di.jsx)("ul",{children:r?Object.entries(r).filter(([e])=>"id"!==e&&"use"!==e).map(([e,n])=>"extension"===e?r.extension?.[0]?.extension?.map((n,t)=>(0,di.jsxs)("li",{children:[o2(o(n.url),o(n.url)),": ",n.valueString]},`address-${e}-${t}`)):(0,di.jsxs)("li",{children:[o2(e,e),": ",n]},`address-${e}`)):(0,di.jsx)("li",{children:"--"})})]})},ks=({patientUuid:e})=>{let{isLoading:n,contactAttributes:t}=(e=>{let{contactAttributeTypes:n=[]}=pm({externalModuleName:"@openmrs/esm-patient-banner-app"}),{attributes:t,error:r,isLoading:o}=(e=>{let{data:n,error:t,isLoading:r}=(0,p_.A)(`${rU}/patient/${e}?v=custom:(uuid,display,identifiers:(identifier,uuid,preferred,location:(uuid,name),identifierType:(uuid,name,format,formatDescription,validator)),person:(uuid,display,gender,birthdate,dead,age,deathDate,birthdateEstimated,causeOfDeath,preferredName:(uuid,preferred,givenName,middleName,familyName),attributes,preferredAddress:(uuid,preferred,address1,address2,cityVillage,longitude,stateProvince,latitude,country,postalCode,countyDistrict,address3,address4,address5,address6,address7)))`,rY);return{isLoading:r,attributes:n?.data.person.attributes??[],error:t}})(e);return{contactAttributes:(0,uA.useMemo)(()=>t.filter(({attributeType:e})=>n?.some(n=>e.uuid===n)),[t,n]),isLoading:o,error:r}})(e),r=(0,uA.useMemo)(()=>t?[...t?.map(e=>[e.attributeType.display?o2(e.attributeType.display,e.attributeType.display):"",e.value])]:[],[t]);return(0,di.jsxs)(di.Fragment,{children:[(0,di.jsx)("p",{className:ko.heading,children:o2("contactDetails","Contact Details")}),n?(0,di.jsx)(dk.OuH,{description:`${o2("loading","Loading")} ...`,role:"progressbar"}):(0,di.jsx)("ul",{children:r.length?r.map(([e,n],t)=>(0,di.jsxs)("li",{children:[e,": ",n]},`${e}-${n}-${t}`)):(0,di.jsx)("li",{children:"--"})})]})},kl=({patientId:e})=>{let{data:n,isLoading:t}=function(e){let n=`${rU}/relationship?v=custom:(display,uuid,personA:(age,display,birthdate,uuid),personB:(age,display,birthdate,uuid),relationshipType:(uuid,display,description,aIsToB,bIsToA))&person=${e}`,{data:t,error:r,isLoading:o,isValidating:i}=(0,u5.Ay)(e?n:null,rY),a=t?.data?.results?.length?function(e,n){let t=[];for(let r of n)e===r.personA.uuid?t.push({uuid:`${r.uuid}`,display:r.personB.display,relativeAge:r.personB.age,relativeUuid:r.personB.uuid,relationshipType:r.relationshipType.bIsToA}):t.push({uuid:`${r.uuid}`,display:r.personA.display,relativeAge:r.personA.age,relativeUuid:r.personA.uuid,relationshipType:r.relationshipType.aIsToB});return t}(e,t.data.results):null;return{data:t?a:null,error:r,isLoading:o,isValidating:i}}(e);return(0,di.jsxs)(di.Fragment,{children:[(0,di.jsx)("p",{className:ko.heading,children:o2("relationships","Relationships")}),t?(0,di.jsx)(dk.OuH,{description:`${o2("loading","Loading")} ...`,role:"progressbar"}):(0,di.jsx)("ul",{children:n&&n.length>0?(0,di.jsx)(di.Fragment,{children:n.map(e=>(0,di.jsxs)("li",{className:ko.relationship,children:[(0,di.jsx)("div",{children:(0,di.jsx)(uk,{to:`${window.spaBase}/patient/${e.relativeUuid}/chart`,children:e.display})}),(0,di.jsx)("div",{children:e.relationshipType}),(0,di.jsx)("div",{children:`${e.relativeAge?e.relativeAge:"--"} ${e.relativeAge?1===e.relativeAge?o2("yearAbbreviation","yr"):o2("yearsAbbreviation","yrs"):""}`})]},e.uuid))}):(0,di.jsx)("li",{children:"--"})})]})};function kc({patientId:e,deceased:n}){return(0,di.jsxs)("div",{className:ds()(ko.contactDetails,{[ko.deceased]:n}),children:[(0,di.jsxs)("div",{className:ko.row,children:[(0,di.jsx)("div",{className:ko.col,children:(0,di.jsx)(ka,{patientId:e})}),(0,di.jsx)("div",{className:ko.col,children:(0,di.jsx)(ks,{patientUuid:e})})]}),(0,di.jsxs)("div",{className:ko.row,children:[(0,di.jsx)("div",{className:ko.col,children:(0,di.jsx)(kl,{patientId:e})}),(0,di.jsx)("div",{className:ko.col,children:(0,di.jsx)(ki,{patientUuid:e})})]})]})}var ku=t(16767),kp=t.n(ku);function kd(e){let{patientPhotoConceptUuid:n}=pm({externalModuleName:"@openmrs/esm-styleguide"}),t=n?`${rU}/obs?patient=${e}&concept=${n}&v=full`:null,{data:r,error:o,isLoading:i}=(0,u5.Ay)(e?t:null,rY),a=r?.data?.results[0];return{data:a?{dateTime:a?.obsDatetime,imageSrc:a?.value?.links?.uri}:null,error:o,isLoading:i}}let kf=({width:e=56,height:n=56,"aria-label":t})=>{let{t:r}=(0,u3.useTranslation)();return(0,di.jsxs)("svg",{"aria-label":t??r("patientPhotoPlaceholder","Patient photo placeholder"),width:e,height:n,fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[(0,di.jsx)("path",{fill:"#ffffff",d:"M0 0h56v56H0z"}),(0,di.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"m36.75 20.134-.884-.884L19.25 35.866l.884.884 1.25-1.25H34.25a1.252 1.252 0 0 0 1.25-1.25V21.384l1.25-1.25Zm-2.5 14.116H22.634l4.87-4.87 1.487 1.486a1.25 1.25 0 0 0 1.768 0l.991-.991 2.5 2.498v1.877Zm0-3.645-1.616-1.616a1.25 1.25 0 0 0-1.768 0l-.991.991-1.486-1.486 5.861-5.86v7.971Zm-12.5 1.145v-1.875l3.125-3.123.858.859.885-.885-.86-.86a1.25 1.25 0 0 0-1.767 0l-2.241 2.242V21.75h10V20.5h-10c-.69 0-1.25.56-1.25 1.25v10h1.25Z",fill:"#8D8D8D"})]})};var kh=t(27268),km={};km.styleTagTransform=d_(),km.setAttributes=dm(),km.insert=df().bind(null,"head"),km.domAPI=dp(),km.insertStyleElement=db(),dc()(kh.A,km);let kg=kh.A&&kh.A.locals?kh.A.locals:void 0;function kb({patientUuid:e,patientName:n,alt:t}){let{data:r,isLoading:o}=kd(e),[i,a]=(0,uA.useState)(null),[s,l]=(0,uA.useState)(!1),c=(0,uA.useMemo)(()=>kp().generate(e),[e]);(0,uA.useEffect)(()=>{if(r?.imageSrc){let e=new URL(r.imageSrc,window.location.origin).pathname;l(!0);let n=!1,t=new Image;return t.onload=()=>{n||(a(e),l(!1))},t.onerror=()=>{n||(a(null),l(!1))},t.src=e,()=>{n=!0}}a(null),l(!1)},[r?.imageSrc]);let u=(0,uA.useMemo)(()=>t||(i?o2("patientPhotoAlt","Profile photo of {{patientName}}",{patientName:n}):o2("patientAvatarAlt","Avatar for {{patientName}}",{patientName:n})),[t,i,n]);return o||s?(0,di.jsx)(dk.ryE,{className:kg.skeleton,"data-testid":"skeleton-icon"}):r?.imageSrc&&!i?(0,di.jsx)(kf,{"aria-label":o2("patientPhotoPlaceholder","Photo placeholder for {{patientName}}",{patientName:n})}):i?(0,di.jsx)("div",{"aria-label":u,children:(0,di.jsx)("img",{className:kg.avatar,src:i,alt:u,title:n})}):(0,di.jsx)("div",{"aria-label":u,children:(0,di.jsx)("div",{className:kg.avatar,title:n,style:{backgroundImage:c.toDataUrl(),backgroundRepeat:"no-repeat",backgroundSize:"cover"},children:(0,di.jsx)("span",{className:kg.initials,children:function(e,n=3){return e.split(/\s+/).filter(Boolean).slice(0,n).map(e=>e[0]).join("")}(n)})})})}var ky=t(1636),k_={};k_.styleTagTransform=d_(),k_.setAttributes=dm(),k_.insert=df().bind(null,"head"),k_.domAPI=dp(),k_.insertStyleElement=db(),dc()(ky.A,k_);let kv=ky.A&&ky.A.locals?ky.A.locals:void 0,k$=["omrs-pict-appointments","omrs-pict-assessment-1","omrs-pict-assessment-2","omrs-pict-blood-bank","omrs-pict-cardiology","omrs-pict-ct-scan","omrs-pict-dentistry","omrs-pict-emergency-department","omrs-pict-facility","omrs-pict-geriatrics","omrs-pict-gynaecology","omrs-pict-in-patient","omrs-pict-laboratory","omrs-pict-labs-2","omrs-pict-obstetrics","omrs-pict-patient-search","omrs-pict-patients","omrs-pict-payments-desk","omrs-pict-pharmacy","omrs-pict-pharmacy-2","omrs-pict-registration","omrs-pict-service-queues","omrs-pict-stock-management","omrs-pict-transfer","omrs-pict-triage","omrs-pict-x-ray"],kA=(0,uA.memo)((0,uA.forwardRef)(function(e,n){return(0,di.jsx)(kX,{ref:n,pictogram:"omrs-pict-appointments",pictogramProps:e})})),kw=kA,kk=(0,uA.memo)((0,uA.forwardRef)(function(e,n){return(0,di.jsx)(kX,{ref:n,pictogram:"omrs-pict-assessment-1",pictogramProps:e})})),kx=(0,uA.memo)((0,uA.forwardRef)(function(e,n){return(0,di.jsx)(kX,{ref:n,pictogram:"omrs-pict-assessment-2",pictogramProps:e})})),kC=(0,uA.memo)((0,uA.forwardRef)(function(e,n){return(0,di.jsx)(kX,{ref:n,pictogram:"omrs-pict-blood-bank",pictogramProps:e})})),kE=(0,uA.memo)((0,uA.forwardRef)(function(e,n){return(0,di.jsx)(kX,{ref:n,pictogram:"omrs-pict-cardiology",pictogramProps:e})})),kD=(0,uA.memo)((0,uA.forwardRef)(function(e,n){return(0,di.jsx)(kX,{ref:n,pictogram:"omrs-pict-ct-scan",pictogramProps:e})})),kS=(0,uA.memo)((0,uA.forwardRef)(function(e,n){return(0,di.jsx)(kX,{ref:n,pictogram:"omrs-pict-dentistry",pictogramProps:e})})),kM=(0,uA.memo)((0,uA.forwardRef)(function(e,n){return(0,di.jsx)(kX,{ref:n,pictogram:"omrs-pict-emergency-department",pictogramProps:e})})),kz=(0,uA.memo)((0,uA.forwardRef)(function(e,n){return(0,di.jsx)(kX,{ref:n,pictogram:"omrs-pict-facility",pictogramProps:e})})),kP=(0,uA.memo)((0,uA.forwardRef)(function(e,n){return(0,di.jsx)(kX,{ref:n,pictogram:"omrs-pict-geriatrics",pictogramProps:e})})),kO=(0,uA.memo)((0,uA.forwardRef)(function(e,n){return(0,di.jsx)(kX,{ref:n,pictogram:"omrs-pict-gynaecology",pictogramProps:e})})),kT=(0,uA.memo)((0,uA.forwardRef)(function(e,n){return(0,di.jsx)(kX,{ref:n,pictogram:"omrs-pict-in-patient",pictogramProps:e})})),kB=(0,uA.memo)((0,uA.forwardRef)(function(e,n){return(0,di.jsx)(kX,{ref:n,pictogram:"omrs-pict-laboratory",pictogramProps:e})})),kI=(0,uA.memo)((0,uA.forwardRef)(function(e,n){return(0,di.jsx)(kX,{ref:n,pictogram:"omrs-pict-labs-2",pictogramProps:e})})),kN=(0,uA.memo)((0,uA.forwardRef)(function(e,n){return(0,di.jsx)(kX,{ref:n,pictogram:"omrs-pict-obstetrics",pictogramProps:e})})),kj=(0,uA.memo)((0,uA.forwardRef)(function(e,n){return(0,di.jsx)(kX,{ref:n,pictogram:"omrs-pict-patient-search",pictogramProps:e})})),kR=(0,uA.memo)((0,uA.forwardRef)(function(e,n){return(0,di.jsx)(kX,{ref:n,pictogram:"omrs-pict-patients",pictogramProps:e})})),kF=(0,uA.memo)((0,uA.forwardRef)(function(e,n){return(0,di.jsx)(kX,{ref:n,pictogram:"omrs-pict-payments-desk",pictogramProps:e})})),kL=(0,uA.memo)((0,uA.forwardRef)(function(e,n){return(0,di.jsx)(kX,{ref:n,pictogram:"omrs-pict-pharmacy",pictogramProps:e})})),kW=(0,uA.memo)((0,uA.forwardRef)(function(e,n){return(0,di.jsx)(kX,{ref:n,pictogram:"omrs-pict-pharmacy-2",pictogramProps:e})})),kV=(0,uA.memo)((0,uA.forwardRef)(function(e,n){return(0,di.jsx)(kX,{ref:n,pictogram:"omrs-pict-registration",pictogramProps:e})})),kG=(0,uA.memo)((0,uA.forwardRef)(function(e,n){return(0,di.jsx)(kX,{ref:n,pictogram:"omrs-pict-service-queues",pictogramProps:e})})),kU=(0,uA.memo)((0,uA.forwardRef)(function(e,n){return(0,di.jsx)(kX,{ref:n,pictogram:"omrs-pict-stock-management",pictogramProps:e})})),kq=(0,uA.memo)((0,uA.forwardRef)(function(e,n){return(0,di.jsx)(kX,{ref:n,pictogram:"omrs-pict-transfer",pictogramProps:e})})),kH=(0,uA.memo)((0,uA.forwardRef)(function(e,n){return(0,di.jsx)(kX,{ref:n,pictogram:"omrs-pict-triage",pictogramProps:e})})),kK=(0,uA.memo)((0,uA.forwardRef)(function(e,n){return(0,di.jsx)(kX,{ref:n,pictogram:"omrs-pict-x-ray",pictogramProps:e})})),kY=kz,kJ=kR,kZ=(0,uA.memo)((0,uA.forwardRef)(function({pictogram:e,fallback:n,...t},r){let o=(0,uA.useRef)(document.getElementById(e));return(0,uA.useEffect)(()=>{let n=document.getElementById("omrs-svgs-container"),t=new MutationObserver(n=>{for(let t of n)"childList"===t.type&&(o.current=document.getElementById(e))});return n&&t.observe(n,{childList:!0}),()=>t.disconnect()},[e]),(0,di.jsx)(pa,{value:o.current,fallback:n,children:(0,di.jsx)(kX,{ref:r,pictogram:e,pictogramProps:t})})})),kX=(0,uA.memo)((0,uA.forwardRef)(function({pictogram:e,pictogramProps:n},t){let{className:r,size:o}=Object.assign({},{size:92},n);return(o<=26||o>144)&&(console.error(`Invalid size '${o}' specified for ${e}. Defaulting to 92.`),o=92),(0,di.jsx)("svg",{ref:t,className:ds()(kv.pictogram,r),height:o,width:o,children:(0,di.jsx)("use",{href:`#${e}`})})})),kQ=({children:e})=>"tablet"===pG()?(0,di.jsx)(dk.Wdr,{children:e}):(0,di.jsx)(di.Fragment,{children:e});var k0=t(85925),k1={};k1.styleTagTransform=d_(),k1.setAttributes=dm(),k1.insert=df().bind(null,"head"),k1.domAPI=dp(),k1.insertStyleElement=db(),dc()(k0.A,k1),k0.A&&k0.A.locals&&k0.A.locals;let k2=new er.Subject,k3=0;function k5(e){var n;e&&"string"==typeof(n=e.title)&&n.trim().length>0?setTimeout(()=>{k2.next({...e,id:k3++})},0):console.error("showSnackbar must be called with an object having a 'title' property that is a non-empty string")}let k4=new er.Subject,k6=0;function k8(e){var n;e&&("string"==typeof(n=e.description)?n.trim().length>0:"object"==typeof n&&!(0,wE.A)(n))?setTimeout(()=>{k4.next({...e,id:k6++})},0):console.error("showToast must be called with an object having a 'description' property that is a non-empty string or object")}function k7(e,n=!1){if(n)return!0;let t=xr[e];return!t||!t()}function k9(e,n){let t=xc.getState()?.workspaceGroup,r=t?.name;r&&e===r&&xd(()=>{let r=xb(e);r&&(r.setState({},!0),r.subscribe(()=>{})()),"function"==typeof t?.cleanup&&t.cleanup(),xc.setState(e=>({...e,workspaceGroup:void 0})),"function"==typeof n&&n()},r?e=>e.currentWorkspaceGroup===r:()=>!0)}function xe(e,n){let{name:t,additionalProps:r}=n;uS(t);let o=()=>{xa(e.name,{ignoreChanges:!0,onWorkspaceClose:()=>xn(t,r),closeWorkspaceGroup:!1})};k7(e.name)?o():xh("closing-workspace-launching-new-workspace",o,e.title??e.name)}function xn(e,n){let t=uS(e),r=xc.getState().workspaceGroup;if(r&&!r.members?.includes(e))return void k9(r.name,()=>{xn(e,n)});let o=xc.getState().workspaceGroup?.name,i={...t,title:xm(t,n),closeWorkspace:(n={})=>xa(e,n),closeWorkspaceWithSavedChanges:n=>xa(e,{ignoreChanges:!0,...n}),promptBeforeClosing:n=>{var t,r;return t=e,r=n,void(xr[t]=r)},setTitle:(n,t)=>{i.title=n,i.titleNode=t,xc.setState(n=>{let t=n.openWorkspaces.map(n=>n.name===e?i:n);return{...n,openWorkspaces:t}})},currentWorkspaceGroup:o,additionalProps:n??{}};function a(e,n){xc.setState(t=>{let r=[e,...n??t.openWorkspaces],o=xp(e);return{...t,openWorkspaces:r,workspaceWindowState:o}})}o&&xb(o,n);let s=xc.getState().openWorkspaces,l=s.findIndex(n=>n.name===e),c=s.find(e=>e.type==i.type);if(0===s.length)a(i);else if(s[0].canHide||0===l)if(l>=0){let n=s[l];a({...n,additionalProps:i.additionalProps,...n.title===xm(n,n.additionalProps)&&{title:xm(i,i.additionalProps)}},s.filter(n=>n.name!=e))}else c?(a(c,xc.getState().openWorkspaces.filter(e=>e.type!=i.type)),xe(c,{name:e,additionalProps:n})):a(i);else xe(s[0],{name:e,additionalProps:n})}function xt({targetUrl:e,contextKey:n,workspaceName:t,additionalProps:r}){xs(n),xn(t,r),rF({to:e})}let xr={};function xo(){let e=xc.getState();xc.setState({...e,prompt:null})}let xi={ignoreChanges:!1,onWorkspaceClose:()=>{},closeWorkspaceGroup:!0};function xa(e,n={}){n={...xi,...n};let t=()=>{let t=xc.getState();t.openWorkspaces.find(n=>n.name===e);let r=t.openWorkspaces.filter(n=>n.name!=e),o=xc.getState().workspaceGroup?.name;o&&n.closeWorkspaceGroup&&k9(o),xr[e]=()=>!1,xc.setState(e=>({...e,prompt:null,openWorkspaces:r,workspaceWindowState:xp(r?.[0])})),n?.onWorkspaceClose?.()};return k7(e,n?.ignoreChanges)?(t(),!0):(xh("closing-workspace",t,uS(e).title??e),!1)}function xs(e){xc.getState().context!=e&&xc.setState({context:e,openWorkspaces:[],prompt:null})}let xl={context:"",openWorkspaces:[],prompt:null,workspaceWindowState:"normal",workspaceGroup:void 0},xc=L("workspace",xl);function xu(e){let n=xc.getState();xc.setState({...n,workspaceWindowState:e})}function xp(e){return e?.preferredWindowSize??"normal"}function xd(e=()=>{},n=()=>!0){let t=xc.getState().openWorkspaces.filter(n).every(({name:e})=>k7(e)),r=()=>{xg(),e?.()};t?r():xh("closing-all-workspaces",r)}function xf(){let{workspaceWindowState:e,openWorkspaces:n,prompt:t,workspaceGroup:r}=uB(xc);return(0,uA.useMemo)(()=>({active:n.length>0,prompt:t,workspaceWindowState:e,workspaces:n,workspaceGroup:r}),[n,e,t,r])}function xh(e,n=()=>{},t=""){let r;switch(e){case"closing-workspace":r={title:o2("unsavedChangesTitleText","Unsaved changes"),body:o2("unsavedChangesInOpenedWorkspace","You may have unsaved changes in the opened workspace. Do you want to discard these changes?"),onConfirm:()=>{n?.()},confirmText:o2("discard","Discard")};break;case"closing-all-workspaces":{let e=xc.getState().openWorkspaces.filter(({name:e})=>!k7(e)).map(({title:e},n)=>`${n+1}. ${e}`);r={title:o2("closingAllWorkspacesPromptTitle","You have unsaved changes"),body:o2("closingAllWorkspacesPromptBody","There may be unsaved changes in the following workspaces. Do you want to discard changes in the following workspaces? {{workspaceNames}}",{workspaceNames:e.join(",")}),onConfirm:()=>{n?.()},confirmText:o2("closeAllOpenedWorkspaces","Discard changes in {{count}} workspaces",{count:e.length})};break}case"closing-workspace-launching-new-workspace":r={title:o2("unsavedChangesTitleText","Unsaved changes"),body:o2("unsavedChangesInWorkspace",'There may be unsaved changes in "{{workspaceName}}". Please save them before opening another workspace.',{workspaceName:t}),onConfirm:()=>{xc.setState(e=>({...e,prompt:null})),n?.()},confirmText:o2("openAnyway","Open anyway")};break;default:console.error(`Workspace system trying to open unknown prompt type "${e}" in function "showWorkspacePrompts"`),n?.();return}xc.setState(e=>({...e,prompt:r}))}function xm(e,n){return n?.workspaceTitle??e.title}function xg(){xc.setState(xl)}function xb(e,n={}){if(!e||"default"===e)return;let t=W(e,{});return n&&t.setState(e=>({...e,...n})),t}var xy=t(81341),x_={};x_.styleTagTransform=d_(),x_.setAttributes=dm(),x_.insert=df().bind(null,"head"),x_.domAPI=dp(),x_.insertStyleElement=db(),dc()(xy.A,x_);let xv=xy.A&&xy.A.locals?xy.A.locals:void 0;function x$({getIcon:e,formOpenInTheBackground:n,tagContent:t}){return(0,di.jsxs)(di.Fragment,{children:[e({size:16}),n?(0,di.jsx)("span",{className:xv.interruptedTag,children:"!"}):(0,di.jsx)("span",{className:xv.countTag,children:t})]})}let xA=({getIcon:e,label:n,iconDescription:t,handler:r,type:o,tagContent:i})=>{let a=pG(),{workspaces:s,workspaceWindowState:l}=xf(),c=s?.findIndex(({type:e})=>e===o)??-1,u="hidden"!==l&&0===c,p=c>0||0===c&&"hidden"===l;return"tablet"===a||"phone"===a?(0,di.jsxs)(dk.$nd,{className:ds()(xv.container,{[xv.active]:u}),iconDescription:t,kind:"ghost",onClick:r,role:"button",tabIndex:0,size:"md",children:[(0,di.jsx)("span",{className:xv.elementContainer,children:(0,di.jsx)(x$,{formOpenInTheBackground:p,getIcon:e,tagContent:i})}),(0,di.jsx)("span",{children:n})]}):(0,di.jsx)(dk.K0,{align:"left","aria-label":t,className:ds()(xv.container,{[xv.active]:u}),enterDelayMs:300,kind:"ghost",label:n,onClick:r,size:"md",children:(0,di.jsx)("div",{className:xv.elementContainer,children:(0,di.jsx)(x$,{formOpenInTheBackground:p,getIcon:e,tagContent:i})})})};var xw=t(54535),xk=t(40771),xx=/[\\^$.*+?()[\]{}|]/g,xC=RegExp(xx.source);let xE=function(e){return(e=(0,nd.A)(e))&&xC.test(e)?e.replace(xx,"\\$&"):e};var xD=t(37781),xS={};xS.styleTagTransform=d_(),xS.setAttributes=dm(),xS.insert=df().bind(null,"head"),xS.domAPI=dp(),xS.insertStyleElement=db(),dc()(xD.A,xS);let xM=xD.A&&xD.A.locals?xD.A.locals:void 0;function xz({contextKey:e}){let{prompt:n}=xf();return(0,uA.useEffect)(()=>{RegExp(`/${xE(e)}(/|$)`).test(window.location.pathname)||console.warn(`WorkspaceContainer has provided an invalid context key: "${e}". The context key must be part of the URL path, with no initial or trailing slash.`)},[]),(0,uA.useEffect)(()=>(xs(e),()=>{xs(null)}),[e]),(0,uA.useEffect)(()=>{let n=n=>{let{detail:{cancelNavigation:t,newUrl:r}}=n,o=RegExp(`/${xE(e)}(/|$)`),i=new URL(r),a=o.test(i.pathname),s=xc.getState().openWorkspaces.every(({name:e})=>k7(e));a||(s?xg():(t?.(),xd(()=>{rF({to:r})})))};return window.addEventListener("single-spa:before-routing-event",n),()=>{window.removeEventListener("single-spa:before-routing-event",n)}},[]),null!=n?(0,di.jsxs)(dk.KXP,{open:!0,onClose:xo,children:[(0,di.jsx)(dk.rQ0,{title:n.title}),(0,di.jsx)(dk.cwr,{children:(0,di.jsx)("p",{className:xM.messageBody,children:n.body})}),(0,di.jsxs)(dk.jlY,{children:[(0,di.jsx)(dk.$nd,{kind:"secondary",onClick:xo,children:n.cancelText??o2("cancel")}),(0,di.jsx)(dk.$nd,{kind:"danger",onClick:n.onConfirm,children:n.confirmText??o2("confirm")})]})]}):null}function xP(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 xO(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?xP(Object(t),!0).forEach(function(n){xB(e,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):xP(Object(t)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))})}return e}function xT(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 xB(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function xI(e){return(xI=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function xN(e,n){return(xN=Object.setPrototypeOf||function(e,n){return e.__proto__=n,e})(e,n)}function xj(e){if(void 0===e)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return e}var xR=function(e){var n=uA.Component;if("function"!=typeof n&&null!==n)throw TypeError("Super expression must either be null or a function");a.prototype=Object.create(n&&n.prototype,{constructor:{value:a,writable:!0,configurable:!0}}),n&&xN(a,n);var t,r,o,i=(t=function(){if("u"<typeof Reflect||!Reflect.construct||Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(e){return!1}}(),function(){var e,n=xI(a);e=t?Reflect.construct(n,arguments,xI(this).constructor):n.apply(this,arguments);if(e&&("object"==typeof e||"function"==typeof e))return e;if(void 0!==e)throw TypeError("Derived constructors may only return object or undefined");return xj(this)});function a(e){var n;if(function(e,n){if(!(e instanceof n))throw TypeError("Cannot call a class as a function")}(this,a),xB(xj(n=i.call(this,e)),"handleRef",function(e){n.el=e}),xB(xj(n),"addThingToDo",function(e,t){n.state.hasError&&"unmount"!==e||(n.nextThingToDo=(n.nextThingToDo||Promise.resolve()).then(function(){if(!n.unmounted||"unmount"===e)return t.apply(void 0,arguments)}).catch(function(t){throw n.nextThingToDo=Promise.resolve(),n.setState({hasError:!0}),t&&t.message&&(t.message="During '".concat(e,"', parcel threw an error: ").concat(t.message)),n.props.handleError?n.props.handleError(t):setTimeout(function(){throw t}),t}))}),xB(xj(n),"getParcelProps",function(){var e=xO(xO({},n.props),{},{domElement:n.el});return delete e.mountParcel,delete e.config,delete e.wrapWith,delete e.wrapStyle,delete e.appendTo,delete e.handleError,delete e.parcelDidMount,e}),n.state={hasError:!1},!e.config)throw Error("single-spa-react's Parcel component requires the 'config' prop to either be a parcel config or a loading function that returns a promise. See https://github.com/single-spa/single-spa-react");return n}return r=[{key:"componentDidMount",value:function(){var e=this;this.unmounted=!1,this.addThingToDo("mount",function(){var n,t=e.props.mountParcel||e.mountParcel;if(!t)throw Error("\n <Parcel /> was not passed a mountParcel prop, nor is it rendered where mountParcel is within the React context.\n If you are using <Parcel /> within a module that is not a single-spa application, you will need to import mountRootParcel from single-spa and pass it into <Parcel /> as a mountParcel prop \n ");return e.el?n=e.el:(e.createdDomElement=n=document.createElement(e.props.wrapWith),Object.keys(e.props.wrapStyle).forEach(function(t){n.style[t]=e.props.wrapStyle[t]}),e.props.appendTo.appendChild(n)),e.parcel=t(e.props.config,xO({domElement:n},e.getParcelProps())),e.parcel.mountPromise.then(e.props.parcelDidMount),e.parcel.mountPromise})}},{key:"componentDidUpdate",value:function(){var e=this;this.addThingToDo("update",function(){if(e.parcel&&e.parcel.update)return e.parcel.update(e.getParcelProps())})}},{key:"componentWillUnmount",value:function(){var e=this;this.addThingToDo("unmount",function(){if(e.parcel&&"MOUNTED"===e.parcel.getStatus())return e.parcel.unmount()}),this.createdDomElement&&this.createdDomElement.parentNode.removeChild(this.createdDomElement),this.unmounted=!0}},{key:"render",value:function(){var e=this;if(this.props.appendTo)return uY&&uY.Consumer?uA.createElement(uY.Consumer,null,function(n){return e.mountParcel=n?n.mountParcel:null,null}):null;var n=uY&&uY.Consumer?uA.createElement(uY.Consumer,null,function(n){return e.mountParcel=n?n.mountParcel:null,null}):void 0;return uA.createElement(this.props.wrapWith,{ref:this.handleRef,style:this.props.wrapStyle,className:this.props.wrapClassName},n)}}],xT(a.prototype,r),o&&xT(a,o),a}();xB(xR,"defaultProps",{wrapWith:"div",wrapStyle:{},parcelDidMount:function(){}});var xF=t(57515),xL={};xL.styleTagTransform=d_(),xL.setAttributes=dm(),xL.insert=df().bind(null,"head"),xL.domAPI=dp(),xL.insertStyleElement=db(),dc()(xF.A,xL);let xW=xF.A&&xF.A.locals?xF.A.locals:void 0;function xV({workspace:e,additionalPropsFromPage:n}){let[t,r]=(0,uA.useState)(),o=function(e){let[n,t]=(0,uA.useState)({}),[r,o]=(0,uA.useState)(e);return(0,uA.useEffect)(()=>{r!==e&&o(e)},[e]),(0,uA.useEffect)(()=>{let e,n=xb(r);return n&&(t(n.getState()),e=n.subscribe(t)),()=>{n&&e?.()}},[r]),n}(e.currentWorkspaceGroup);(0,uA.useEffect)(()=>{let n=!0;return e.load().then(e=>{n&&r(e)}),()=>{n=!1}},[e]);let i=(0,uA.useMemo)(()=>e&&{closeWorkspace:e.closeWorkspace,closeWorkspaceWithSavedChanges:e.closeWorkspaceWithSavedChanges,promptBeforeClosing:e.promptBeforeClosing,setTitle:e.setTitle,...n,...o,...e.additionalProps},[e,n,o]);return t?(0,di.jsx)(xR,{config:t,mountParcel:tX,...i},e.name):(0,di.jsx)(dk.OuH,{className:xW.loader,description:`${o2("loading","Loading")} ...`})}var xG=t(24646),xU={};xU.styleTagTransform=d_(),xU.setAttributes=dm(),xU.insert=df().bind(null,"head"),xU.domAPI=dp(),xU.insertStyleElement=db(),dc()(xG.A,xU);let xq=xG.A&&xG.A.locals?xG.A.locals:void 0,xH=function({isWithinWorkspace:e,name:n,actionMenuProps:t={}}){let[r,o]=(0,uA.useState)(!1),i=(0,uA.useRef)(window.innerHeight),{featureName:a}=(0,uA.useContext)(uP),s=pG();(0,uA.useEffect)(()=>{let e=()=>{o(!pU(s)&&i.current>window.innerHeight),i.current!=window.innerHeight&&(i.current=window.innerHeight)};return window.addEventListener("resize",e),()=>window.removeEventListener("resize",e)},[i]);let l=`action-menu-${n&&"default"!=n?n:a}-items-slot`;return(0,di.jsx)("aside",{className:ds()(xq.sideRail,{[xq.withinWorkspace]:e,[xq.sideRailHidden]:r,[xq.sideRailVisible]:!r}),children:(0,di.jsx)("div",{className:xq.container,children:(0,di.jsx)(uW,{className:xq.chartExtensions,name:l,state:t})})})};function xK({contextKey:e,overlay:n,showSiderailAndBottomNav:t,additionalWorkspaceProps:r,actionMenuProps:o}){let i=pG(),{workspaces:a,workspaceWindowState:s,workspaceGroup:l}=xf(),c=l?.name,u=a[0],p="hidden"===s||null==u,d=u?.width??(n?"wider":"narrow"),f=(0,uA.useMemo)(()=>t||c&&!p,[c,p,t]);return pd(!p&&!pU(i)),(0,di.jsxs)(di.Fragment,{children:[(0,di.jsxs)("div",{className:t?xW.workspaceContainerWithActionMenu:xW.workspaceContainerWithoutActionMenu,children:[(0,di.jsx)("aside",{className:ds()(n?xW.workspaceOverlayOuterContainer:xW.workspaceWindowSpacer,{[xW.hiddenRelative]:p,[xW.narrowWorkspace]:"narrow"===d,[xW.widerWorkspace]:"wider"===d,[xW.extraWideWorkspace]:"extra-wide"===d}),children:(0,di.jsx)("div",{className:ds()(xW.workspaceFixedContainer,{[xW.maximizedWindow]:"maximized"===s,[xW.hiddenFixed]:p}),children:a.map((e,n)=>(0,di.jsx)("div",{className:ds()(xW.workspaceInnerContainer,{[xW.hiddenExtraWorkspace]:0!==n}),children:(0,di.jsx)(uA.Suspense,{fallback:null,children:(0,di.jsx)(u3.I18nextProvider,{i18n:window.i18next,defaultNS:e.moduleName,children:(0,di.jsx)(xY,{workspaceInstance:e,additionalWorkspaceProps:r})})})},`workspace-container-${e?e.name:`empty-${n}`}`))})}),(0,di.jsx)(xz,{contextKey:e})]}),f&&(0,di.jsx)(xH,{name:c,isWithinWorkspace:!t,actionMenuProps:o})]})}function xY({workspaceInstance:e,additionalWorkspaceProps:n}){let{t}=(0,u3.useTranslation)(),r=pG(),{workspaceWindowState:o,workspaceGroup:i}=xf(),a=i?.name,s="maximized"===o;(0,uA.useEffect)(()=>{let n=t(e.title);n!==e.title&&e.setTitle(n)},[e.title,t,e.setTitle]);let{featureName:l}=(0,uA.useContext)(uP),c=(0,uA.useCallback)(()=>{xu(s?"normal":"maximized")},[s]),{canHide:u=!1,canMaximize:p=!1,currentWorkspaceGroup:d="",closeWorkspace:f}=(0,uA.useMemo)(()=>e??{},[e]),h=(0,uA.useMemo)(()=>({...n,...e?.additionalProps}),[n,e]);return e&&(0,di.jsxs)(di.Fragment,{children:[(0,di.jsxs)(dk.Y9Y,{"aria-label":o2("workspaceHeader","Workspace Header"),className:xW.header,children:[!pU(r)&&!u&&(0,di.jsx)(dk.dJ2,{"aria-label":o2("close","Close"),renderMenuIcon:(0,di.jsx)(dV,{}),onClick:()=>f()}),(0,di.jsx)(dk.bCw,{prefix:"",children:e.titleNode??t(e.title)}),(0,di.jsx)("div",{className:xW.overlayHeaderSpacer}),(0,di.jsxs)(dk.wdv,{className:xW.headerButtons,children:[(0,di.jsx)(uW,{name:`workspace-header-group-${e.currentWorkspaceGroup}-slot`,state:h}),(0,di.jsx)(uW,{name:`workspace-header-type-${e.type}-slot`,state:h}),(0,di.jsx)(uW,{name:`workspace-header-${l}-slot`,state:h}),pU(r)&&(0,di.jsxs)(di.Fragment,{children:[(p||s)&&(0,di.jsx)(dk.V8d,{"aria-label":s?o2("minimize","Minimize"):o2("maximize","Maximize"),onClick:c,children:s?(0,di.jsx)(xw.Xj,{}):(0,di.jsx)(xw.hz,{})}),u&&!a?(0,di.jsx)(dk.V8d,{"aria-label":o2("hide","Hide"),onClick:()=>xu("hidden"),children:(0,di.jsx)(dG,{})}):(0,di.jsx)(dk.V8d,{"aria-label":o2("close","Close"),onClick:()=>f?.(),children:(0,di.jsx)(d7,{})})]}),"tablet"===r&&u&&(0,di.jsx)(dk.V8d,{"aria-label":o2("close","Close"),onClick:()=>f?.(),children:(0,di.jsx)(xk.d3,{})})]})]}),(0,di.jsx)("div",{className:ds()(xW.workspaceContent,{[xW.marginWorkspaceContent]:!!d}),children:(0,di.jsx)(xV,{workspace:e,additionalPropsFromPage:n},e.name)})]})}async function xJ(e,n){let{openedGroup:t}=uM.getState();if(t){if(t.groupName===e&&xQ(t.props,n))return!0;else if(!await x0({reason:"CLOSE_WORKSPACE_GROUP",explicit:!1}))return!1}return uM.setState(t=>({...t,openedGroup:{groupName:e,props:n},openedWindows:[]})),!0}async function xZ(e){let{openedGroup:n,openedWindows:t}=uM.getState();if(n){if(t.length>0&&!(e||await x0({reason:"CLOSE_WORKSPACE_GROUP",explicit:!0})))return!1;uM.setState(e=>({...e,openedGroup:null,openedWindows:[]}))}return!0}async function xX(e,n=null,t=null,r=null){let o=uM.getState();if(!o.registeredWorkspacesByName[e])throw Error(`Unable to launch workspace ${e}. Workspace is not registered`);let i=function(e){let{registeredWorkspacesByName:n,registeredWindowsByName:t}=uM.getState(),r=n[e];if(r){let n=t[r.window];if(n)return n;throw Error(`No workspace window found with name: ${r.window} for workspace: ${e}`)}throw Error(`No workspace found with name: ${e}`)}(e);if(!i)throw Error(`Unable to launch workspace ${e}. Workspace is not registered to a workspace window`);let{openedGroup:a}=o,{name:s}=i,l=function(e){let{registeredGroupsByName:n,registeredWindowsByName:t}=uM.getState(),r=t[e];if(r){let t=n[r.group];if(t)return t;throw Error(`No workspace group found with name: ${r.group} for window: ${e}`)}throw Error(`No workspace window found with name: ${e}`)}(s);if(!l)throw Error(`Unable to launch workspace ${e}. Workspace window ${i.name} is not registered to a workspace group`);let c=uz(e);if(a&&(a.groupName!==l.name||!xQ(a.props,r)))return!!await x0({reason:"CLOSE_WORKSPACE_GROUP",explicit:!0})&&(uM.setState({...o,openedGroup:{groupName:l.name,props:r},openedWindows:[{windowName:s,openedWorkspaces:[x5(e,n)],props:t,maximized:!1}],isMostRecentlyOpenedWindowHidden:!1}),!0);if(c>=0){let r=o.openedWindows[c],i=o.openedGroup?.props??{},a=o.isMostRecentlyOpenedWindowHidden,{openedWorkspaces:u}=r;if(xQ(r.props,t)){let p=u.find(n=>n.workspaceName===e);return p&&xQ(p.props,n)?((a||c!==o.openedWindows.length-1)&&uM.setState(x1.restoreWindow(o,s)),!0):!!await x0({reason:"CLOSE_WORKSPACE",explicit:!1,windowName:s,workspaceName:e})&&(uM.setState({...o,openedGroup:{groupName:l.name,props:o?.openedGroup?.props??i},openedWindows:[...o.openedWindows.filter((e,n)=>n!==c),{windowName:s,openedWorkspaces:[x5(e,n)],props:r?.props??t,maximized:!1}],isMostRecentlyOpenedWindowHidden:!1}),!0)}return!!await x0({reason:"CLOSE_WINDOW",explicit:!1,windowName:s})&&(uM.setState({...o,openedGroup:{groupName:l.name,props:i??o?.openedGroup?.props},openedWindows:[...o.openedWindows.filter((e,n)=>n!==c),{windowName:s,openedWorkspaces:[x5(e,n)],props:t,maximized:!1}],isMostRecentlyOpenedWindowHidden:!1}),!0)}return"closable"!=l.persistence?(uM.setState({...o,openedGroup:{groupName:l.name,props:r??o?.openedGroup?.props??null},openedWindows:[...o.openedWindows,{windowName:s,openedWorkspaces:[x5(e,n)],props:t,maximized:!1}],isMostRecentlyOpenedWindowHidden:!1}),!0):!!await x0({reason:"CLOSE_OTHER_WINDOWS",explicit:!1,windowNameToSpare:i.name})&&(uM.setState({...o,openedGroup:{groupName:l.name,props:r??o?.openedGroup?.props??null},openedWindows:[{windowName:s,openedWorkspaces:[x5(e,n)],props:t,maximized:!1}],isMostRecentlyOpenedWindowHidden:!1}),!0)}function xQ(e,n){return null==e||null==n||T(e,n)}function x0(e){function n(e,n){let t=[];for(let r=e.openedWorkspaces.length-1;r>=0;r--){let o=e.openedWorkspaces[r];if(o.hasUnsavedChanges&&t.push(o),n&&o.workspaceName===n)break}return t}let{openedWindows:t,workspaceTitleByWorkspaceName:r}=uM.getState(),o=[];switch(e.reason){case"CLOSE_WORKSPACE_GROUP":o=t.flatMap(e=>n(e));break;case"CLOSE_WINDOW":{let r=t.find(n=>n.windowName===e.windowName);if(!r)throw Error(`Window ${e.windowName} not found in opened windows.`);o=n(r);break}case"CLOSE_WORKSPACE":{let r=t.find(n=>n.windowName===e.windowName);if(!r)throw Error(`Window ${e.windowName} not found in opened windows.`);o=n(r,e.workspaceName);break}case"CLOSE_OTHER_WINDOWS":o=t.filter(n=>n.windowName!==e.windowNameToSpare).flatMap(e=>n(e))}return 0===o.length?Promise.resolve(!0):new Promise(e=>{let n=wC("workspace2-close-prompt",{onConfirm:()=>{n(),e(!0)},onCancel:()=>{n(),e(!1)},affectedWorkspaceTitles:o.map(e=>r[e.workspaceName])})})}let x1={setWindowMaximized(e,n,t){let r=e.openedWindows.findIndex(e=>e.windowName===n),o=[...e.openedWindows],i={...o[r],maximized:t};return o[r]=i,{...e,openedWindows:o}},hideWindow:e=>({...e,isMostRecentlyOpenedWindowHidden:!0}),restoreWindow(e,n){let t=e.openedWindows.findIndex(e=>e.windowName===n),r=e.openedWindows[t],o=[...e.openedWindows.filter((e,n)=>n!==t),r];return{...e,openedWindows:o,isMostRecentlyOpenedWindowHidden:!1}},closeWorkspace(e,n){let t=uz(n);if(t<0)return e;let r={...e.openedWindows[t]},o=r.openedWorkspaces.findIndex(e=>e.workspaceName===n),i=[...e.openedWindows];r.openedWorkspaces=r.openedWorkspaces.slice(0,o);let a=e.isMostRecentlyOpenedWindowHidden;if(0===r.openedWorkspaces.length){let n=t===e.openedWindows.length-1;i.splice(t,1),n&&i.length>0&&(a=!1)}else i[t]=r;return{...e,openedWindows:i,isMostRecentlyOpenedWindowHidden:a}},openChildWorkspace(e,n,t,r){let o=e.registeredWorkspacesByName[t];if(!o)throw Error(`No workspace named "${t}" registered`);let i=e.registeredWorkspacesByName[n];if(!i)throw Error(`No workspace named "${n}" registered`);if(i.window!==o.window)throw Error(`Child workspace ${t} does not belong to the same workspace window as parent workspace ${n}`);let a=e.openedWindows.findIndex(e=>e.windowName===o.window);if(-1==a)throw Error(`Cannot open child workspace ${t} as window ${o.window} is not opened`);let{openedWorkspaces:s}=e.openedWindows[a],l=s.findIndex(e=>e.workspaceName===n);if(-1===l)throw Error(`Cannot open child workspace ${t} from parent workspace ${n} as the parent is not opened within the workspace window`);let c=s.slice(0,l+1);return{openedWindows:e.openedWindows.map((e,n)=>n==a?{...e,openedWorkspaces:[...c,x5(t,r)]}:e)}},setHasUnsavedChanges(e,n,t){let r=uz(n);if(r<0)return e;let o={...e.openedWindows[r]},i=o.openedWorkspaces.findIndex(e=>e.workspaceName===n);if(i<0)return e;o.openedWorkspaces[i]={...o.openedWorkspaces[i],hasUnsavedChanges:t};let a=[...e.openedWindows];return a[r]=o,{...e,openedWindows:a}},setWorkspaceTitle(e,n,t){let r={...e.workspaceTitleByWorkspaceName};return null===t?delete r[n]:r[n]=t,{...e,workspaceTitleByWorkspaceName:r}}},x2=()=>(0,uA.useContext)(uY),x3=()=>Object.keys(uM.getState().registeredWorkspacesByName);function x5(e,n){return{workspaceName:e,props:n??{},hasUnsavedChanges:!1,uuid:uy()}}var x4=t(81179),x6={};x6.styleTagTransform=d_(),x6.setAttributes=dm(),x6.insert=df().bind(null,"head"),x6.domAPI=dp(),x6.insertStyleElement=db(),dc()(x4.A,x6);let x8=x4.A&&x4.A.locals?x4.A.locals:void 0,x7=({title:e,children:n,hasUnsavedChanges:t=!1})=>{let r=pG(),{setWindowMaximized:o,hideWindow:i,setHasUnsavedChanges:a,openedWindows:s,openedGroup:l,registeredGroupsByName:c,registeredWindowsByName:u,registeredWorkspacesByName:p,workspaceTitleByWorkspaceName:d,setWorkspaceTitle:f,isMostRecentlyOpenedWindowHidden:h}=uI(uM,x1),{workspaceName:m,isRootWorkspace:g,closeWorkspace:b,showActionMenu:y}=x2(),v=uz(m),$=s[v],A=$?.openedWorkspaces.find(e=>e.workspaceName===m);if((0,uA.useEffect)(()=>{A?.hasUnsavedChanges!=t&&a(m,t??!1)},[A?.hasUnsavedChanges,t,m,a]),(0,uA.useEffect)(()=>{d[m]!==e&&f(m,e)},[d,m,e,f]),v<0||null==l||null==A)return null;let w=c[l.groupName];if(!w)throw Error(`Cannot find registered workspace group ${l.groupName}`);let k=p[m].window,x=u[k];if(!x)throw Error(`Cannot find registered workspace window ${k}`);let{icon:C,canMaximize:E}=x,D="closable"===w.persistence,S=!!C&&!D,{maximized:M}=$,z=x?.width??"narrow",P=Object.values(u).some(e=>e.group===l.groupName&&void 0!==e.icon),O=v<s.length-1||h;return(0,di.jsxs)("div",{className:ds()(x8.workspaceOuterContainer,{[x8.narrowWorkspace]:"narrow"===z,[x8.widerWorkspace]:"wider"===z,[x8.extraWideWorkspace]:"extra-wide"===z,[x8.isActionMenuOpened]:P}),children:[(0,di.jsx)("div",{className:ds()(x8.workspaceSpacer,{[x8.hidden]:O})}),(0,di.jsx)("div",{className:ds()(x8.workspaceMiddleContainer,{[x8.maximized]:M,[x8.hidden]:O,[x8.isRootWorkspace]:g,[x8.showActionMenu]:y}),children:(0,di.jsxs)("div",{className:ds()(x8.workspaceInnerContainer,{[x8.maximized]:M,[x8.hidden]:O,[x8.isRootWorkspace]:g}),children:[(0,di.jsxs)(dk.Y9Y,{"aria-label":o2("workspaceHeader"),className:x8.header,children:[(0,di.jsx)(dk.bCw,{prefix:"",children:e}),(0,di.jsx)("div",{className:x8.overlayHeaderSpacer}),(0,di.jsx)(dk.wdv,{className:x8.headerButtons,children:pU(r)?(0,di.jsxs)(di.Fragment,{children:[(E||M)&&(0,di.jsx)(dk.V8d,{"aria-label":M?o2("minimize"):o2("maximize"),onClick:()=>o(k,!M),children:M?(0,di.jsx)(xw.Xj,{}):(0,di.jsx)(xw.hz,{})}),S&&(0,di.jsx)(dk.V8d,{"aria-label":o2("hide"),onClick:()=>i(),children:(0,di.jsx)(dG,{})}),!D&&(0,di.jsx)(dk.V8d,{"aria-label":o2("close"),onClick:()=>b({closeWindow:!0}),children:(0,di.jsx)(d7,{})})]}):(0,di.jsxs)(di.Fragment,{children:[S&&(0,di.jsx)(dk.V8d,{"aria-label":o2("hide"),onClick:()=>i(),children:(0,di.jsx)(xk.d3,{})}),(0,di.jsx)(dk.V8d,{"aria-label":o2("close"),onClick:()=>{D?xZ():b({closeWindow:!0})},children:(0,di.jsx)(d7,{})})]})})]}),(0,di.jsx)("div",{className:ds()(x8.workspaceContent),children:n})]})})]})};var x9=t(97810),Ce={};Ce.styleTagTransform=d_(),Ce.setAttributes=dm(),Ce.insert=df().bind(null,"head"),Ce.domAPI=dp(),Ce.insertStyleElement=db(),dc()(x9.A,Ce);let Cn=x9.A&&x9.A.locals?x9.A.locals:void 0;function Ct({getIcon:e,hasUnsavedChanges:n,tagContent:t}){return(0,di.jsxs)(di.Fragment,{children:[e({size:16}),n?(0,di.jsx)("span",{className:Cn.interruptedTag,children:"!"}):(0,di.jsx)("span",{className:Cn.countTag,children:t})]})}let Cr=({icon:e,label:n,tagContent:t,workspaceToLaunch:r,onBeforeWorkspaceLaunch:o})=>{let i=pG(),{openedWindows:a,restoreWindow:s,hideWindow:l,isMostRecentlyOpenedWindowHidden:c}=uI(uM,x1),{extension:u}=(0,uA.useContext)(uP),p=a.findIndex(e=>e.windowName===u?.extensionId),d=a[p],f=null!=d,h=f&&(p<a.length-1||c),m=f&&!h,g=d?.openedWorkspaces.some(e=>e.hasUnsavedChanges)??!1,b=async()=>{if(f)h?s(d.windowName):l();else if(await (o?.()??!0)){let{workspaceName:e,workspaceProps:n,windowProps:t}=r;xX(e,n,t)}};return"tablet"===i||"phone"===i?(0,di.jsxs)(dk.$nd,{className:ds()(Cn.container,{[Cn.active]:f&&!m,[Cn.focused]:m}),iconDescription:n,kind:"ghost",onClick:b,role:"button",tabIndex:0,size:"md",children:[(0,di.jsx)("span",{className:Cn.elementContainer,children:(0,di.jsx)(Ct,{hasUnsavedChanges:g,getIcon:e,tagContent:t})}),(0,di.jsx)("span",{children:n})]}):(0,di.jsx)(dk.K0,{align:"left","aria-label":n,className:ds()(Cn.container,{[Cn.active]:f&&!m,[Cn.focused]:m}),enterDelayMs:300,kind:"ghost",label:n,onClick:b,size:"md",children:(0,di.jsx)("div",{className:Cn.elementContainer,children:(0,di.jsx)(Ct,{hasUnsavedChanges:g,getIcon:e,tagContent:t})})})};function Co(e){if("string"!=typeof e||0===e.trim().length)return;let n=e.replaceAll("_","-");try{return new Intl.Locale(n).toString()}catch{return}}function Ci(e,n,t){if(null==e)return t;let r=Co(e);if(!r)return console.warn(`matchLocale: invalid requested locale tag: ${JSON.stringify(e)}`),t;let o=[];for(let e of n){let n=Co(e);if(!n){console.warn(`matchLocale: skipping invalid available locale tag: ${JSON.stringify(e)}`);continue}o.push({canonical:n,original:e})}let i=r;for(;i;){let e=o.find(e=>e.canonical===i);if(e)return e.original;let n=i+"-",t=o.find(e=>e.canonical.startsWith(n));if(t)return t.original;if("ht"===i){i="fr-HT";continue}let r=i.lastIndexOf("-");if(-1===r)break;let a=(i=i.slice(0,r)).lastIndexOf("-");-1!==a&&i.length-a==2&&(i=i.slice(0,a))}return t}function Ca(e=window.localStorage){try{return e.getItem("test"),!0}catch{return!1}}function Cs(e){return!!e&&e.constructor===Object}var Cl=t(99589);function Cc(e){let[n,t,r]=e.split(".");return`${n}.${t}.${r}`}function Cu(e,n){let t=function(e){let n=e.indexOf("-");if(n>=0){let t=Cc(e.slice(0,n)),r=e.slice(n+1);return`${t}-${r}`}return Cc(e)}(n);return Cl.satisfies(t,e,{includePrerelease:!0})}async function Cp(e,n={}){let t,{shouldRetry:r,getDelay:o,onError:i}=n;r=r??(e=>e<=5),o=o??(e=>(function(e,n=!1){return 1e3*Math.pow(2,n?e+1:e)})(e));let a=0;do try{return await Cd(o(a)),await e()}catch(e){i?.(e,a),t=e}while(r(a++));throw t}async function Cd(e){if(!(e<=0))return new Promise(n=>setTimeout(n,e))}},241(e,n,t){"use strict";t.d(n,{A:()=>r});let r=t(41917).A.Symbol},76912(e,n,t){"use strict";t.d(n,{A:()=>r});let r=function(e,n){for(var t=-1,r=n.length,o=e.length;++t<r;)e[o+t]=n[t];return e}},76335(e,n,t){"use strict";t.d(n,{A:()=>c});var r=t(76912),o=t(241),i=t(20018),a=t(92049),s=o.A?o.A.isConcatSpreadable:void 0;let l=function(e){return(0,a.A)(e)||(0,i.A)(e)||!!(s&&e&&e[s])},c=function e(n,t,o,i,a){var s=-1,c=n.length;for(o||(o=l),a||(a=[]);++s<c;){var u=n[s];t>0&&o(u)?t>1?e(u,t-1,o,i,a):(0,r.A)(a,u):i||(a[a.length]=u)}return a}},18348(e,n,t){"use strict";t.d(n,{A:()=>p});var r=t(241),o=Object.prototype,i=o.hasOwnProperty,a=o.toString,s=r.A?r.A.toStringTag:void 0;let l=function(e){var n=i.call(e,s),t=e[s];try{e[s]=void 0;var r=!0}catch(e){}var o=a.call(e);return r&&(n?e[s]=t:delete e[s]),o};var c=Object.prototype.toString,u=r.A?r.A.toStringTag:void 0;let p=function(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":u&&u in Object(e)?l(e):c.call(e)}},72136(e,n,t){"use strict";t.d(n,{A:()=>r});let r="object"==typeof global&&global&&global.Object===Object&&global},41917(e,n,t){"use strict";t.d(n,{A:()=>i});var r=t(72136),o="object"==typeof self&&self&&self.Object===Object&&self;let i=r.A||o||Function("return this")()},20018(e,n,t){"use strict";t.d(n,{A:()=>c});var r=t(18348),o=t(53098);let i=function(e){return(0,o.A)(e)&&"[object Arguments]"==(0,r.A)(e)};var a=Object.prototype,s=a.hasOwnProperty,l=a.propertyIsEnumerable;let c=i(function(){return arguments}())?i:function(e){return(0,o.A)(e)&&s.call(e,"callee")&&!l.call(e,"callee")}},92049(e,n,t){"use strict";t.d(n,{A:()=>r});let r=Array.isArray},53098(e,n,t){"use strict";t.d(n,{A:()=>r});let r=function(e){return null!=e&&"object"==typeof e}}}]);
27
+ }`.trim(),document.head.prepend(r),i=HTMLElement.prototype.focus,HTMLElement.prototype.focus=function(e){let n=((e=document)=>e.activeElement)(),t=null!=n&&v8(n);i.call(this,{...e,preventScroll:!0}),e&&e.preventScroll||$t(this,t)},a=hb($n(document,"touchstart",n=>{let r=h3(n);e=yt(r)?r:yr(r,!0),t=!1;let o=r.ownerDocument.defaultView.getSelection();o&&!o.isCollapsed&&o.containsNode(r,!0)&&(t=!0),n.composedPath().some(e=>e instanceof HTMLInputElement&&"range"===e.type)&&(t=!0),"selectionStart"in r&&"selectionEnd"in r&&r.selectionStart<r.selectionEnd&&r.ownerDocument.activeElement===r&&(t=!0)},{passive:!1,capture:!0}),$n(document,"touchmove",n=>{if(2!==n.touches.length&&!t){if(!e||e===document.documentElement||e===document.body)return void n.preventDefault();e.scrollHeight===e.clientHeight&&e.scrollWidth===e.clientWidth&&n.preventDefault()}},{passive:!1,capture:!0}),$n(document,"blur",e=>{let n=h3(e),t=e.relatedTarget;if(t&&v8(t))t.focus({preventScroll:!0}),$t(t,v8(n));else if(!t){let e=n.parentElement?.closest("[tabindex]");e?.focus({preventScroll:!0})}},!0)),()=>{n(),a(),r.remove(),HTMLElement.prototype.focus=i}):hb((s=window.innerWidth-document.documentElement.clientWidth)>0&&("scrollbarGutter"in document.documentElement.style?$e(document.documentElement,"scrollbarGutter","stable"):$e(document.documentElement,"paddingRight",`${s}px`)),$e(document.documentElement,"overflow","hidden"))),()=>{0==--v9&&u()}}},[n])}({isDisabled:i||!n.isOpen}),(0,uA.useEffect)(()=>{if(n.isOpen&&r.current)if(i){var e,t,a=o?.current??r.current;let n=vI[vI.length-1];return n&&!n.visibleNodes.has(a)?(n.visibleNodes.add(a),()=>{n.visibleNodes.delete(a)}):void 0}else{let n,i,a,s,l,c,u,p,d,f,h;return e=[o?.current??r.current],i=(t={shouldUseInert:!0})instanceof(n=h1(e?.[0])).Element?{root:t}:t,a=i?.root??document.body,s=i?.shouldUseInert&&vT,l=new Set(e),c=new Set,u=(e,t)=>{s&&e instanceof n.HTMLElement?e.inert=t:t?e.setAttribute("aria-hidden","true"):(e.removeAttribute("aria-hidden"),e instanceof n.HTMLElement&&(e.inert=!1))},p=e=>{for(let n of e.querySelectorAll("[data-live-announcer], [data-react-aria-top-layer]"))l.add(n);let n=e=>{if(c.has(e)||l.has(e)||e.parentElement&&c.has(e.parentElement)&&"row"!==e.parentElement.getAttribute("role"))return NodeFilter.FILTER_REJECT;for(let n of l)if(h2(e,n))return NodeFilter.FILTER_SKIP;return NodeFilter.FILTER_ACCEPT},t=_y(h0(e),e,NodeFilter.SHOW_ELEMENT,{acceptNode:n}),r=n(e);if(r===NodeFilter.FILTER_ACCEPT&&d(e),r!==NodeFilter.FILTER_REJECT){let e=t.nextNode();for(;null!=e;)d(e),e=t.nextNode()}},d=e=>{let t=vB.get(e)??0;(s&&e instanceof n.HTMLElement?e.inert:"true"===e.getAttribute("aria-hidden"))&&0===t||(0===t&&u(e,!0),c.add(e),vB.set(e,t+1))},vI.length&&vI[vI.length-1].disconnect(),p(a),(f=new MutationObserver(e=>{for(let t of e)if("childList"===t.type&&t.target.isConnected&&![...l,...c].some(e=>h2(e,t.target)))for(let e of t.addedNodes){var n;(e instanceof HTMLElement||e instanceof SVGElement)&&("true"===(n=e).dataset.liveAnnouncer||void 0!==n.dataset.reactAriaTopLayer)?l.add(e):e instanceof Element&&p(e)}})).observe(a,{childList:!0,subtree:!0}),h={visibleNodes:l,hiddenNodes:c,observe(){f.observe(a,{childList:!0,subtree:!0})},disconnect(){f.disconnect()}},vI.push(h),()=>{for(let e of(f.disconnect(),c)){let n=vB.get(e);null!=n&&(1===n?(u(e,!1),vB.delete(e)):vB.set(e,n-1))}h===vI[vI.length-1]?(vI.pop(),vI.length&&vI[vI.length-1].observe()):vI.splice(vI.indexOf(h),1)}}},[i,n.isOpen,r,o]),{popoverProps:hO(p,f),arrowProps:h,underlayProps:d,placement:m,triggerAnchorPoint:g}}({...r,offset:null!=(o=r.offset)?o:8,arrowSize:s,groupRef:d?p:c},e),b=r.popoverRef,y=function(e,n=!0){let[t,r]=(0,uA.useState)(!0),o=t&&n;return hy(()=>{if(o&&e.current&&"getAnimations"in e.current)for(let n of e.current.getAnimations())n instanceof CSSTransition&&n.cancel()},[e,o]),$a(e,o,(0,uA.useCallback)(()=>r(!1),[])),o}(b,!!g)||r.isEntering||!1,v=hI({...r,defaultClassName:"react-aria-Popover",values:{trigger:r.trigger||null,placement:g,isEntering:y,isExiting:n}}),$=!r.isNonModal||"SubmenuTrigger"===r.trigger,[A,w]=(0,uA.useState)(!1);hy(()=>{b.current&&w($&&!b.current.querySelector("[role=dialog]"))},[b,$]),(0,uA.useEffect)(()=>{var e;let n,t;A&&b.current&&!b.current.contains(document.activeElement)&&(t=((e=document)=>e.activeElement)(n=h0(e=b.current)),"virtual"===$s?mR(()=>{((e=document)=>e.activeElement)(n)===t&&e.isConnected&&hX(e)}):hX(e))},[A,b]);let k={...f.style,...v.style},x=uw().createElement("div",{...hO(hZ(r),f),...v,role:A?"dialog":void 0,tabIndex:A?-1:void 0,"aria-label":r["aria-label"],"aria-labelledby":r["aria-labelledby"],ref:b,slot:r.slot||void 0,style:k,dir:r.dir,"data-trigger":r.trigger,"data-placement":g,"data-entering":y||void 0,"data-exiting":n||void 0},!r.isNonModal&&uw().createElement($i,{onDismiss:e.close}),uw().createElement(vO.Provider,{value:{...m,placement:g,ref:a}},v.children),uw().createElement($i,{onDismiss:e.close}));return d?uw().createElement(vw,{...r,shouldContainFocus:A,isExiting:n,portalContainer:null!=(i=null!=t?t:null==p?void 0:p.current)?i:void 0},x):uw().createElement(vw,{...r,shouldContainFocus:A,isExiting:n,portalContainer:t},!r.isNonModal&&e.isOpen&&uw().createElement("div",{"data-testid":"underlay",...h,style:{position:"fixed",inset:0}}),uw().createElement("div",{ref:c,style:{display:"contents"}},uw().createElement($A.Provider,{value:c},x)))}function $x(e){return e?.start!=null&&null!=e.end}let $C=(0,uA.createContext)(null),$E=(0,uA.createContext)(null),$D=(0,uA.createContext)(null),$S=(0,uA.createContext)(null),$M=(0,uA.forwardRef)(function(e,n){var t,r;[e,n]=hj(e,n,$C);let{validationBehavior:o}=hN(vM)||{},i=null!=(r=null!=(t=e.validationBehavior)?t:o)?r:"native",a=function(e){let n=$v(e),[t,r]=y6(e.value,e.defaultValue||null,e.onChange),[o]=(0,uA.useState)(t),i=t||e.placeholderValue||null,[a,s]=vo(i,e.granularity),l=null!=t?t.toDate(s??"UTC"):null,c="hour"===a||"minute"===a||"second"===a,u=e.shouldCloseOnSelect??!0,[p,d]=(0,uA.useState)(null),[f,h]=(0,uA.useState)(null);if(t&&(p=t,"hour"in t&&(f=t)),i&&!(a in i))throw Error("Invalid granularity "+a+" for value "+i.toString());let m=t?.calendar.identifier==="gregory"&&"BC"===t.era,g=(0,uA.useMemo)(()=>({granularity:a,timeZone:s,hideTimeZone:e.hideTimeZone,hourCycle:e.hourCycle,shouldForceLeadingZeros:e.shouldForceLeadingZeros,showEra:m}),[a,e.hourCycle,e.shouldForceLeadingZeros,s,e.hideTimeZone,m]),{minValue:b,maxValue:y,isDateUnavailable:v}=e,$=(0,uA.useMemo)(()=>_7(t,b,y,v,g),[t,b,y,v,g]),A=_1({...e,value:t,builtinValidation:$}),w=A.displayValidation.isInvalid,k=e.validationState||(w?"invalid":null),x=(e,n)=>{r("timeZone"in n?n.set(bP(e)):bO(e,n)),d(null),h(null),A.commitValidation()};return{...A,value:t,defaultValue:e.defaultValue??o,setValue:r,dateValue:p,timeValue:f,setDateValue:t=>{let o="function"==typeof u?u():u;c?f||o?x(t,f||vt(e.defaultValue||e.placeholderValue)):d(t):(r(t),A.commitValidation()),o&&n.setOpen(!1)},setTimeValue:e=>{p&&e?x(p,e):h(e)},granularity:a,hasTime:c,...n,setOpen(r){!r&&!t&&p&&c&&x(p,f||vt(e.defaultValue||e.placeholderValue)),n.setOpen(r)},validationState:k,isInvalid:w,formatValue:(e,n)=>l?new gL(e,vn(n,g)).format(l):"",getDateFormatter:(e,n)=>new gL(e,vn({},{...g,...n}))}}({...e,validationBehavior:i}),s=(0,uA.useRef)(null),[l,c]=hR(!e["aria-label"]&&!e["aria-labelledby"]),{groupProps:u,labelProps:p,fieldProps:d,buttonProps:f,dialogProps:h,calendarProps:m,descriptionProps:g,errorMessageProps:b,...y}=function(e,n,t){var r;let o=hM(),i=hM(),a=hM(),s=g2((r=_R)&&r.__esModule?r.default:r,"@react-aria/datepicker"),{isInvalid:l,validationErrors:c,validationDetails:u}=n.displayValidation,{labelProps:p,fieldProps:d,descriptionProps:f,errorMessageProps:h}=_W({...e,labelElementType:"span",isInvalid:l,errorMessage:e.errorMessage||c}),m=_F(n,t),g=d["aria-labelledby"]||d.id,{locale:b}=gT(),y=n.formatValue(b,{month:"long"}),v=yc(y?s.format("selectedDateDescription",{date:y}):""),$=[v["aria-describedby"],d["aria-describedby"]].filter(Boolean).join(" ")||void 0,A=hZ(e),w=(0,uA.useMemo)(()=>_T(t),[t]),k=(0,uA.useRef)(!1),{focusWithinProps:x}=ga({...e,isDisabled:n.isOpen,onBlurWithin:n=>{h2(document.getElementById(i),n.relatedTarget)||(k.current=!1,e.onBlur?.(n),e.onFocusChange?.(!1))},onFocusWithin:n=>{k.current||(k.current=!0,e.onFocus?.(n),e.onFocusChange?.(!0))}});return{groupProps:hO(A,m,d,v,x,{role:"group","aria-disabled":e.isDisabled||null,"aria-labelledby":g,"aria-describedby":$,onKeyDown(t){!n.isOpen&&e.onKeyDown&&e.onKeyDown(t)},onKeyUp(t){!n.isOpen&&e.onKeyUp&&e.onKeyUp(t)}}),labelProps:{...p,onClick:()=>{w.focusFirst()}},fieldProps:{...d,id:a,[_q]:"presentation","aria-describedby":$,value:n.value,defaultValue:n.defaultValue,onChange:n.setValue,placeholderValue:e.placeholderValue,hideTimeZone:e.hideTimeZone,hourCycle:e.hourCycle,shouldForceLeadingZeros:e.shouldForceLeadingZeros,granularity:e.granularity,isDisabled:e.isDisabled,isReadOnly:e.isReadOnly,isRequired:e.isRequired,validationBehavior:e.validationBehavior,[_0]:n,autoFocus:e.autoFocus,name:e.name,form:e.form},descriptionProps:f,errorMessageProps:h,buttonProps:{...v,id:o,"aria-haspopup":"dialog","aria-label":s.format("calendar"),"aria-labelledby":`${o} ${g}`,"aria-describedby":$,"aria-expanded":n.isOpen,isDisabled:e.isDisabled||e.isReadOnly,onPress:()=>n.setOpen(!0)},dialogProps:{id:i,"aria-labelledby":`${o} ${g}`},calendarProps:{autoFocus:!0,value:n.dateValue,onChange:n.setDateValue,minValue:e.minValue,maxValue:e.maxValue,isDisabled:e.isDisabled,isReadOnly:e.isReadOnly,isDateUnavailable:e.isDateUnavailable,defaultFocusedValue:n.dateValue?void 0:e.placeholderValue,isInvalid:n.isInvalid,errorMessage:"function"==typeof e.errorMessage?e.errorMessage(n.displayValidation):e.errorMessage||n.displayValidation.validationErrors.join(" "),firstDayOfWeek:e.firstDayOfWeek,pageBehavior:e.pageBehavior},isInvalid:l,validationErrors:c,validationDetails:u}}({...hF(e),label:c,validationBehavior:i},a,s),[v,$]=(0,uA.useState)(null),A=(0,uA.useCallback)(()=>{s.current&&$(s.current.offsetWidth+"px")},[]);v2({ref:s,onResize:A});let{focusProps:w,isFocused:k,isFocusVisible:x}=gs({within:!0}),C=hI({...e,values:{state:a,isFocusWithin:k,isFocusVisible:x,isDisabled:e.isDisabled||!1,isInvalid:a.isInvalid,isOpen:a.isOpen},defaultClassName:"react-aria-DatePicker"}),E=hZ(e);return delete E.id,uw().createElement(hB,{values:[[$D,a],[_h,{...u,ref:s,isInvalid:a.isInvalid}],[vh,d],[gg,{...f,isPressed:a.isOpen}],[vz,{...p,ref:l,elementType:"span"}],[_t,m],[vx,a],[$$,{trigger:"DatePicker",triggerRef:s,placement:"bottom start",style:{"--trigger-width":v}}],[vk,h],[g_,{slots:{description:g,errorMessage:b}}],[vE,y]]},uw().createElement("div",{...w,...E,...C,ref:n,slot:e.slot||void 0,"data-focus-within":k||void 0,"data-invalid":a.isInvalid||void 0,"data-focus-visible":x||void 0,"data-disabled":e.isDisabled||void 0,"data-open":a.isOpen||void 0}))}),$z=(0,uA.forwardRef)(function(e,n){var t,r;[e,n]=hj(e,n,$E);let{validationBehavior:o}=hN(vM)||{},i=null!=(r=null!=(t=e.validationBehavior)?t:o)?r:"native",a=function(e){let n=$v(e),[t,r]=y6(e.value,e.defaultValue||null,e.onChange),[o]=(0,uA.useState)(t),[i,a]=(0,uA.useState)(()=>t||{start:null,end:null});null==t&&i.start&&i.end&&a(i={start:null,end:null});let s=t||i,l=e=>{a(s=e||{start:null,end:null}),$x(s)?r(s):r(null)},[c,u]=vo(s?.start||s?.end||e.placeholderValue||null,e.granularity),p="hour"===c||"minute"===c||"second"===c,d=e.shouldCloseOnSelect??!0,[f,h]=(0,uA.useState)(null),[m,g]=(0,uA.useState)(null);s&&$x(s)&&(f=s,"hour"in s.start&&(m=s));let b=(e,n)=>{l({start:"timeZone"in n.start?n.start.set(bP(e.start)):bO(e.start,n.start),end:"timeZone"in n.end?n.end.set(bP(e.end)):bO(e.end,n.end)}),h(null),g(null),E.commitValidation()},y=t=>{let r="function"==typeof d?d():d;p?$x(t)&&(r||m?.start&&m?.end)?b(t,{start:m?.start||vt(e.placeholderValue),end:m?.end||vt(e.placeholderValue)}):h(t):$x(t)?(l(t),E.commitValidation()):h(t),r&&n.setOpen(!1)},v=e=>{$x(f)&&$x(e)?b(f,e):g(e)},$=s?.start?.calendar.identifier==="gregory"&&"BC"===s.start.era||s?.end?.calendar.identifier==="gregory"&&"BC"===s.end.era,A=(0,uA.useMemo)(()=>({granularity:c,timeZone:u,hideTimeZone:e.hideTimeZone,hourCycle:e.hourCycle,shouldForceLeadingZeros:e.shouldForceLeadingZeros,showEra:$}),[c,e.hourCycle,e.shouldForceLeadingZeros,u,e.hideTimeZone,$]),{minValue:w,maxValue:k,isDateUnavailable:x}=e,C=(0,uA.useMemo)(()=>{var e;let n;return e=s,n=_4(_7(e?.start??null,w,k,x,A),_7(e?.end??null,w,k,x,A)),e?.end!=null&&null!=e.start&&0>e.end.compare(e.start)&&(n=_4(n,{isInvalid:!0,validationErrors:[(gJ.getGlobalDictionaryForPackage("@react-stately/datepicker")||_6).getStringForLocale("rangeReversed",_8())],validationDetails:{..._J,rangeUnderflow:!0,rangeOverflow:!0,valid:!1}})),n},[s,w,k,x,A]),E=_1({...e,value:t,name:(0,uA.useMemo)(()=>[e.startName,e.endName].filter(e=>null!=e),[e.startName,e.endName]),builtinValidation:C}),D=E.displayValidation.isInvalid,S=e.validationState||(D?"invalid":null);return{...E,value:s,defaultValue:e.defaultValue??o,setValue:l,dateRange:f,timeRange:m,granularity:c,hasTime:p,setDate(e,n){"start"===e?y({start:n,end:f?.end??null}):y({start:f?.start??null,end:n})},setTime(e,n){"start"===e?v({start:n,end:m?.end??null}):v({start:m?.start??null,end:n})},setDateTime(e,n){"start"===e?l({start:n,end:s?.end??null}):l({start:s?.start??null,end:n})},setDateRange:y,setTimeRange:v,...n,setOpen(t){!t&&!(s?.start&&s?.end)&&$x(f)&&p&&b(f,{start:m?.start||vt(e.placeholderValue),end:m?.end||vt(e.placeholderValue)}),n.setOpen(t)},validationState:S,isInvalid:D,formatValue(n,t){let r;if(!s||!s.start||!s.end)return null;let o="timeZone"in s.start?s.start.timeZone:void 0,i=e.granularity||(s.start&&"minute"in s.start?"minute":"day"),a="timeZone"in s.end?s.end.timeZone:void 0,l=e.granularity||(s.end&&"minute"in s.end?"minute":"day"),c=vn(t,{granularity:i,timeZone:o,hideTimeZone:e.hideTimeZone,hourCycle:e.hourCycle,showEra:"gregory"===s.start.calendar.identifier&&"BC"===s.start.era||"gregory"===s.end.calendar.identifier&&"BC"===s.end.era}),u=s.start.toDate(o||"UTC"),p=s.end.toDate(a||"UTC"),d=new gL(n,c);if(o===a&&i===l&&0!==s.start.compare(s.end)){try{let e=d.formatRangeToParts(u,p),n=-1;for(let t=0;t<e.length;t++){let r=e[t];if("shared"===r.source&&"literal"===r.type)n=t;else if("endRange"===r.source)break}let t="",r="";for(let o=0;o<e.length;o++)o<n?t+=e[o].value:o>n&&(r+=e[o].value);return{start:t,end:r}}catch{}r=d}else r=new gL(n,vn(t,{granularity:l,timeZone:a,hideTimeZone:e.hideTimeZone,hourCycle:e.hourCycle}));return{start:d.format(u),end:r.format(p)}},getDateFormatter:(e,n)=>new gL(e,vn({},{...A,...n}))}}({...e,validationBehavior:i}),s=(0,uA.useRef)(null),[l,c]=hR(!e["aria-label"]&&!e["aria-labelledby"]),{groupProps:u,labelProps:p,startFieldProps:d,endFieldProps:f,buttonProps:h,dialogProps:m,calendarProps:g,descriptionProps:b,errorMessageProps:y,...v}=function(e,n,t){var r;let o=g2((r=_R)&&r.__esModule?r.default:r,"@react-aria/datepicker"),{isInvalid:i,validationErrors:a,validationDetails:s}=n.displayValidation,{labelProps:l,fieldProps:c,descriptionProps:u,errorMessageProps:p}=_W({...e,labelElementType:"span",isInvalid:i,errorMessage:e.errorMessage||a}),d=c["aria-labelledby"]||c.id,{locale:f}=gT(),h=n.formatValue(f,{month:"long"}),m=yc(h?o.format("selectedRangeDescription",{startDate:h.start,endDate:h.end}):""),g={"aria-label":o.format("startDate"),"aria-labelledby":d},b={"aria-label":o.format("endDate"),"aria-labelledby":d},y=hM(),v=hM(),$=_F(n,t),A=[m["aria-describedby"],c["aria-describedby"]].filter(Boolean).join(" ")||void 0,w=(0,uA.useMemo)(()=>_T(t,{accept:e=>e.id!==y}),[t,y]),k={[_H]:w,[_q]:"presentation","aria-describedby":A,placeholderValue:e.placeholderValue,hideTimeZone:e.hideTimeZone,hourCycle:e.hourCycle,granularity:e.granularity,shouldForceLeadingZeros:e.shouldForceLeadingZeros,isDisabled:e.isDisabled,isReadOnly:e.isReadOnly,isRequired:e.isRequired,validationBehavior:e.validationBehavior},x=hZ(e),C=(0,uA.useRef)(!1),{focusWithinProps:E}=ga({...e,isDisabled:n.isOpen,onBlurWithin:n=>{h2(document.getElementById(v),n.relatedTarget)||(C.current=!1,e.onBlur?.(n),e.onFocusChange?.(!1))},onFocusWithin:n=>{C.current||(C.current=!0,e.onFocus?.(n),e.onFocusChange?.(!0))}}),D=(0,uA.useRef)(_X),S=(0,uA.useRef)(_X);return{groupProps:hO(x,$,c,m,E,{role:"group","aria-disabled":e.isDisabled||null,"aria-describedby":A,onKeyDown(t){!n.isOpen&&e.onKeyDown&&e.onKeyDown(t)},onKeyUp(t){!n.isOpen&&e.onKeyUp&&e.onKeyUp(t)}}),labelProps:{...l,onClick:()=>{w.focusFirst()}},buttonProps:{...m,id:y,"aria-haspopup":"dialog","aria-label":o.format("calendar"),"aria-labelledby":`${y} ${d}`,"aria-describedby":A,"aria-expanded":n.isOpen,isDisabled:e.isDisabled||e.isReadOnly,onPress:()=>n.setOpen(!0)},dialogProps:{id:v,"aria-labelledby":`${y} ${d}`},startFieldProps:{...g,...k,value:n.value?.start??null,defaultValue:n.defaultValue?.start,onChange:e=>n.setDateTime("start",e),autoFocus:e.autoFocus,name:e.startName,form:e.form,[_0]:{realtimeValidation:n.realtimeValidation,displayValidation:n.displayValidation,updateValidation(e){D.current=e,n.updateValidation(_4(e,S.current))},resetValidation:n.resetValidation,commitValidation:n.commitValidation}},endFieldProps:{...b,...k,value:n.value?.end??null,defaultValue:n.defaultValue?.end,onChange:e=>n.setDateTime("end",e),name:e.endName,form:e.form,[_0]:{realtimeValidation:n.realtimeValidation,displayValidation:n.displayValidation,updateValidation(e){S.current=e,n.updateValidation(_4(D.current,e))},resetValidation:n.resetValidation,commitValidation:n.commitValidation}},descriptionProps:u,errorMessageProps:p,calendarProps:{autoFocus:!0,value:n.dateRange?.start&&n.dateRange.end?n.dateRange:null,onChange:n.setDateRange,minValue:e.minValue,maxValue:e.maxValue,isDisabled:e.isDisabled,isReadOnly:e.isReadOnly,isDateUnavailable:e.isDateUnavailable,allowsNonContiguousRanges:e.allowsNonContiguousRanges,defaultFocusedValue:n.dateRange?void 0:e.placeholderValue,isInvalid:n.isInvalid,errorMessage:"function"==typeof e.errorMessage?e.errorMessage(n.displayValidation):e.errorMessage||n.displayValidation.validationErrors.join(" "),firstDayOfWeek:e.firstDayOfWeek,pageBehavior:e.pageBehavior},isInvalid:i,validationErrors:a,validationDetails:s}}({...hF(e),label:c,validationBehavior:i},a,s),[$,A]=(0,uA.useState)(null),w=(0,uA.useCallback)(()=>{s.current&&A(s.current.offsetWidth+"px")},[]);v2({ref:s,onResize:w});let{focusProps:k,isFocused:x,isFocusVisible:C}=gs({within:!0}),E=hI({...e,values:{state:a,isFocusWithin:x,isFocusVisible:C,isDisabled:e.isDisabled||!1,isInvalid:a.isInvalid,isOpen:a.isOpen},defaultClassName:"react-aria-DateRangePicker"}),D=hZ(e);return delete D.id,uw().createElement(hB,{values:[[$S,a],[_h,{...u,ref:s,isInvalid:a.isInvalid}],[gg,{...h,isPressed:a.isOpen}],[vz,{...p,ref:l,elementType:"span"}],[_r,g],[vx,a],[$$,{trigger:"DateRangePicker",triggerRef:s,placement:"bottom start",style:{"--trigger-width":$}}],[vk,m],[vh,{slots:{start:d,end:f}}],[g_,{slots:{description:b,errorMessage:y}}],[vE,v]]},uw().createElement("div",{...k,...D,...E,ref:n,slot:e.slot||void 0,"data-focus-within":x||void 0,"data-invalid":a.isInvalid||void 0,"data-focus-visible":C||void 0,"data-disabled":e.isDisabled||void 0,"data-open":a.isOpen||void 0}))});function $P(e){return uw().createElement(gO,e)}function $O(e,n,t=!1){if(null==e)return t?e:void 0;if("string"==typeof e&&!e)return t?null:void 0;if(e instanceof bv||e instanceof bA||e instanceof bw)return n?bT(e,n):e;{let t=p8()(e).toDate(),r=new bv(t.getFullYear(),t.getMonth()+1,t.getDate());return n?bT(r,n):r}}function $T(e){if(e)return e.toDate(bq())}function $B(){let e=window.i18next.language;return"ht"===(e=e.replaceAll("_","-"))&&(e="fr-HT"),e}if("u">typeof navigator){let e=navigator;et=Array.isArray(e.languages)?e.languages[0]:e.language}else if("u">typeof process){let e=process.env;et=e.LC_ALL||e.LC_MESSAGES||e.LANG||e.LANGUAGE}var $I=function(e){e=(e=e.replace(/_/g,"-")).replace(/[.:][\w-]*$/,"");try{return new Intl.Locale(e).baseName}catch{return"en-US"}}(et||"en-US"),$N=class extends Date{invalid=null;isValid(){return!Number.isNaN(this.valueOf())}},$j={};for(let e=1;e<100;e++)$j[(e<=9?"0":"")+e]=e+(e>51?1900:2e3);var $R={arab:1632,arabext:1776,bali:6992,beng:2534,deva:2406,fullwide:65296,gujr:2790,khmr:6112,knda:3302,laoo:3792,limb:6470,mlym:3430,mong:6160,mymr:4160,orya:2918,tamldec:3046,telu:3174,thai:3664,tibt:3872},$F="[1234567890一二三四五六七八九〇\\d]",$L={0:0,1:1,2:2,3:3,4:4,5:5,6:6,7:7,8:8,9:9,"0":0,"1":1,"2":2,"3":3,"4":4,"5":5,"6":6,"7":7,"8":8,"9":9,〇:0,一:1,二:2,三:3,四:4,五:5,六:6,七:7,八:8,九:9},$W={},$V={"Eastern Daylight Time":-240,"Eastern Standard Time":-300,"Central Daylight Time":-300,"Central Standard Time":-360,"Mountain Daylight Time":-360,"Mountain Standard Time":-420,"Pacific Daylight Time":-420,"Pacific Standard Time":-480,"Coordinated Universal Time":0,ACDT:630,ACST:570,ACT:480,ADT:-180,AEDT:660,AEST:600,AFT:270,AKDT:-480,AKST:-540,AMST:-180,AMT:-240,ART:-180,AST:180,AWDT:540,AWST:480,AZOST:-60,AZT:240,BDT:360,BIOT:360,BIT:-720,BOT:-240,BRST:-120,BRT:-180,BTT:360,CAT:120,CCT:390,CDT:-300,CEDT:120,CEST:120,CET:60,CHADT:825,CHAST:765,CHOT:480,ChST:600,CHUT:600,CIST:-480,CIT:480,CKT:-600,CLST:-180,CLT:-240,COST:-240,COT:-300,CST:-360,CT:480,CVT:-60,CXT:420,DAVT:420,DDUT:600,DFT:60,EASST:-300,EAST:-360,EAT:180,ECT:-300,EDT:-240,EEDT:180,EEST:180,EET:120,EGST:0,EGT:-60,EIT:540,EST:-300,FET:180,FJT:720,FKST:-180,FKT:-240,FNT:-120,GALT:-360,GAMT:-540,GET:240,GFT:-180,GILT:720,GIT:-540,GMT:0,GST:-120,GYT:-240,HADT:-540,HAEC:120,HAST:-600,HKT:480,HMT:300,HOVT:420,HST:-600,IBST:0,ICT:420,IDT:180,IOT:180,IRDT:270,IRKT:480,IRST:210,IST:120,JST:540,KGT:360,KOST:660,KRAT:420,KST:540,LHST:630,LINT:840,MAGT:720,MART:-510,MAWT:300,MDT:-360,MET:60,MEST:120,MHT:720,MIST:660,MIT:-510,MMT:390,MSK:180,MST:-420,MUT:240,MVT:300,MYT:480,NCT:660,NDT:-90,NFT:660,NPT:345,NST:-150,NT:-150,NUT:-660,NZDT:780,NZST:720,OMST:360,ORAT:300,PDT:-420,PET:-300,PETT:720,PGT:600,PHOT:780,PKT:300,PMDT:-120,PMST:-180,PONT:660,PST:-480,PYST:-180,PYT:-240,RET:240,ROTT:-180,SAKT:660,SAMT:240,SAST:120,SBT:660,SCT:240,SGT:480,SLST:330,SRET:660,SRT:-180,SST:480,SYOT:180,TAHT:-600,THA:420,TFT:300,TJT:300,TKT:780,TLT:540,TMT:300,TOT:780,TVT:720,UCT:0,ULAT:480,USZ1:120,UTC:0,UYST:-120,UYT:-180,UZT:300,VET:-240,VLAT:600,VOLT:240,VOST:360,VUT:660,WAKT:720,WAST:120,WAT:60,WEDT:60,WEST:60,WET:0,WIT:420,WST:480,YAKT:540,YEKT:300},$G={zone:$V,year:$j,meridiem:{am:0,pm:12,"a.m.":0,"p.m.":12},month:{january:1,jan:1,february:2,feb:2,march:3,mar:3,april:4,apr:4,may:5,june:6,jun:6,july:7,jul:7,august:8,aug:8,september:9,sep:9,october:10,oct:10,november:11,nov:11,december:12,dec:12},dayname:{sunday:0,sun:0,monday:1,mon:1,tuesday:2,tue:2,wednesday:3,wed:3,thursday:4,thu:4,friday:5,fri:5,saturday:6,sat:6},digit:{}},$U={MONTHNAME:"january|february|march|april|may|june|july|august|september|october|november|december|jan\\.?|feb\\.?|mar\\.?|apr\\.?|may\\.?|jun\\.?|jul\\.?|aug\\.?|sep\\.?|oct\\.?|nov\\.?|dec\\.?",DAYNAME:"sunday|monday|tuesday|wednesday|thursday|friday|saturday|sun\\.?|mon\\.?|tue\\.?|wed\\.?|thu\\.?|fri\\.?|sat\\.?",ZONE:"\\(?(?:"+Object.keys($V).join("|")+")\\)?",MERIDIEM:"am|pm|a.m.|p.m.",ORDINAL:"st|nd|rd|th|\\.",YEAR:"\\d{4}|\\d{2}",YEAR2:"\\d{2}",YEAR4:"\\d{4}",YEAR6:"-\\d{6}|\\+?\\d{5,6}",MONTH:"1[0-2]|0?[1-9]",MONTH2:"1[0-2]|0[1-9]",DAY:"3[01]|[12]\\d|0?[1-9]",DAY2:"3[01]|[12]\\d|0[1-9]",OFFSET:"(?:GMT)?[\xb1−+-](?:[01]\\d[0-5]\\d|[01]\\d:[0-5]\\d|[01]?\\d)",H24:"[01]\\d|2[0-3]",H12:"0?[1-9]|1[012]",MIN:"[0-5]\\d",SEC:"[0-5]\\d|60",MS:"\\d{9}|\\d{6}|\\d{1,3}",GAP:"[\\s/.,-]{1,}"},$q={...$U,YEAR:"*{4}|*{2}",YEAR4:"*{4}",YEAR6:"-*{6}|\\+?*{5,6}",MONTH:"*{1,2}",MONTH2:"*{2}",DAY:"*{1,2}",DAY2:"*{2}",OFFSET:"(?:GMT)?[\xb1−+-](?:*{4}|*{2}:*{2}|*{1,2})",H24:"*{2}",H12:"*{1,2}",MIN:"*{2}",SEC:"*{2}",MS:"*{9}|*{6}|*{3}"},$H={},$K=class e{locale;lookups;vars;numberingSystem;baseName;dateOptions;static factory(n=$I){return $H[n.toLowerCase()]||($H[n.toLowerCase()]=new e(n)),$H[n.toLowerCase()]}constructor(e=$I){this.locale=e,this.lookups={...$G},this.vars={...$U};let n=new Intl.NumberFormat(this.locale);this.numberingSystem=n.resolvedOptions().numberingSystem,this.dateOptions=new Intl.DateTimeFormat(this.locale).resolvedOptions(),this.baseName=new Intl.Locale(this.locale).baseName,this.build()}toInt(e){if("number"==typeof e)return e;if("string"!=typeof e)return;if("latn"===this.numberingSystem&&!this.baseName.startsWith("zh")){let n=parseInt(e,10);if(!isNaN(n))return n}let n="";for(let t=0;t<e.length;t++)n+=String(this.lookups.digit[e[t]]);return parseInt(n,10)}millisecondToInt(e){if("number"==typeof e)return e;if("string"!=typeof e)return;let n=e.slice(0,3);return 1===n.length?100*this.toInt(n):2===n.length?10*this.toInt(n):this.toInt(n)}monthNameToInt(e){if("string"!=typeof e)return;let n=e.toLocaleLowerCase(this.locale).replace(/\.$/,"");return this.lookups.month[n]||12}h12ToInt(e,n){if("string"!=typeof e)return;let t=this.lookups.meridiem[n?.toLowerCase()]||0,r=this.toInt(e);return r<12&&12===t&&(r+=12),12===r&&0===t&&(r=0),r}zoneToOffset(e){if("string"==typeof e)return e=e.replace(/[^a-z\s]/gi,""),this.lookups.zone[e]}offsetToMinutes(e){if("string"!=typeof e)return;let n=e.match(/^(?:GMT)?([±−+-])(..?):?(..)?$/);if(n){let[,e,t,r]=n;return("-"===e||"−"===e?-1:1)*(60*this.toInt(t)+this.toInt(r||0))}return 0}build(){"latn"===this.dateOptions.numberingSystem?this.lookups.digit=$L:this.buildNumbers(),/^en/i.test(this.locale)||(this.buildMonthNames(),this.buildDaynames(),/zh/i.test(this.locale)||this.buildMeridiems())}buildNumbers(){let{group:e,lookup:n}=function(e){if($W[e])return $W[e];if("fullwide"===e||"hanidec"===e)return{group:$F,lookup:{...$L}};let n=$R[e];if(!n)return{group:"\\d",lookup:{...$L}};let t=String.fromCharCode(n),r=String.fromCharCode(n+9),o={};for(let e=0;e<10;e++)o[String.fromCharCode(n+e)]=e;return $W[e]={group:`[${t}-${r}]`,lookup:o},$W[e]}(this.numberingSystem);for(let t in this.lookups.digit=n,$q)$q.hasOwnProperty(t)&&(this.vars[t]=$q[t].replace(/\*/g,e))}buildMonthNames(){let e={},n={};if(/^fi/i.test(this.locale))"tammi|helmi|maalis|huhti|touko|kes\xe4|hein\xe4|elo|syys|loka|marras|joulu".split("|").forEach((t,r)=>{["","k","kuu","kuuta"].forEach((o,i)=>{e[t+o+(i<2?"\\.?":"")]=!0,n[t+o]=r+1})});else{let t=[],r=e=>"month"===e.type;for(let e=0;e<12;e++)t.push(new Date(2017,e,1));for(let o of["full","long","medium"]){let i=Intl.DateTimeFormat(this.locale,{dateStyle:o});for(let a=0;a<12;a++){let s=i.formatToParts(t[a]).find(r).value.toLocaleLowerCase(this.locale);/^\d+$/.test(s)||(/^ko/i.test(this.locale)&&(s+="월"),"medium"===o?(s=s.replace(/\.$/,""),e[`${s}\\.?`]=!0):e[s]=!0,n[s]=a+1)}}let o=Intl.DateTimeFormat(this.locale,{month:"short"});for(let i=0;i<12;i++){let a=o.formatToParts(t[i]).find(r).value.toLocaleLowerCase(this.locale);a=a.replace(/\.$/,""),e[`${a}\\.?`]=!0,n[a]=i+1}}this.vars.MONTHNAME=Object.keys(e).join("|"),this.lookups.month=n}buildDaynames(){let e=[],n=e=>"weekday"===e.type;for(let n=0;n<7;n++)e.push(new Date(2017,0,n+1));let t=[],r={};for(let o of["long","short"]){let i=Intl.DateTimeFormat(this.locale,{weekday:o});for(let a=0;a<7;a++){let s=i.formatToParts(e[a]).find(n).value.toLocaleLowerCase(this.locale);"short"===o?(s=s.replace(/\.$/,""),t.push(`${s}\\.?`)):t.push(s),r[s]=a}}this.vars.DAYNAME=t.join("|"),this.lookups.dayname=r}buildMeridiems(){let e=[new Date(2017,0,1),new Date(2017,0,1,23,0,0)],n=e=>"dayPeriod"===e.type,t=[],r={},o=Intl.DateTimeFormat(this.locale,{timeStyle:"long"});for(let i=0;i<2;i++){let a=o.formatToParts(e[i]).find(n);if(!a)return;let s=a.value.toLocaleLowerCase(this.locale);t.push(s),r[s]=12*i}this.vars.MERIDIEM=t.join("|"),this.lookups.meridiem=r}compile(e){return RegExp(e.replace(/_([A-Z0-9]+)_/g,(e,n)=>{if(!this.vars[n])throw Error(`Template string contains invalid variable _${n}_`);return this.vars[n]}),"i")}},$Y=["ee-TG","en-AS","en-CA","en-FM","en-GH","en-GU","en-KE","en-KY","en-MH","en-MP","en-US","en-VI","en-WS","jp-JP","sm-AS","sm-SM"],$J={y:"year",M:"month",d:"day",w:"week",h:"hour",m:"minute",s:"second",ms:"millisecond"},$Z=()=>new Date;function $X(e){return function(n){let t={};for(let r=0,o=e.length;r<o;r++){let o=e[r];o&&(t[o]=n[r])}return t}}var $Q=class{doneChecker;fallback;patterns;formatter;constructor({doneChecker:e,fallback:n,patterns:t,formatter:r}){this.doneChecker=e,this.fallback=n,this.patterns=t,this.formatter=r}attempt(e){if("string"!=typeof e)return this.fallback(e);let n=e.trim(),t={},r=!1;for(let e of this.patterns){let o=n.match(e.regex);if(!o)continue;r=!0;let i=e.handler(o);if(i){for(let[e,n]of Object.entries(i))e in t||void 0===n||(t[e]=n);if(n=(n=n.slice(0,o.index)+n.slice(o.index+o[0].length+1)).trim(),this.doneChecker(t,n))break}}return r?this.formatter(t):this.fallback(e)}},$0=["year","month","day","hour","minute","second","millisecond","offset"],$1={};function $2(e,n){return""===n||/^\s+$/.test(n)||"year"in e&&("month"in e||"monthname"in e)&&"day"in e&&"hour"in e&&"minute"in e&&"second"in e&&"millisecond"in e&&("zone"in e||"offset"in e)}var $3=[[/([^\d.]+)(\d{1,2})\.(\d{2})\.(\d{2})(\D|$)/,"$1$2:$3:$4$5"],[/([^\d.]+)(\d{1,2})\.(\d{2})(\D|$)/,"$1$2:$3$4"]],$5={ar:[[/ /g," "]],bn:[[/,/g,""]],zh:[[/早上\s*([\d:]+)/,"$1am"],[/凌晨\s*([\d:]+)/,"$1am"],[/上午\s*([\d:]+)/,"$1am"],[/下午\s*([\d:]+)/,"$1pm"],[/晚上\s*([\d:]+)/,"$1pm"]],he:[[/ב/gi,""]],de:[[/ um /g," "]],pt:[[/\sde /gi," "]],es:[[/\sde /gi," "]],da:[[/\sden /gi," "],...$3],ru:[[/ г\./g,""]],th:[[/\s*นาฬิกา\s*/i,":"],[/\s*นาที\s*/i,":"],[/\s*วินาที\s*/i," "]],ko:[[/\s*시\s*/,":"],[/\s*분\s*/,":"],[/\s*초\s*/,""],[/(오전|오후)\s*([\d:]+)/,"$2$1"],[/(\d{4})\. (\d{1,2})\. (\d{1,2})\./,"$1-$2-$3"]],fi:$3,id:$3,fr:[[/(\d{2}) h /,"$1:"],[/(\d{2}) min /,"$1:"],[/(\d{2}) s /,"$1"]]};function $4(e,n=$I){let t=function(e){if(!$1[e]){var n,t;let r,o,i=$K.factory(e);$1[e]=new $Q({doneChecker:$2,fallback:(n=e,function(e){let t=String(e).slice(0,50);return""===t&&(t="(empty string)"),{invalid:`Unable to parse "${t}" with locale "${n}"`}}),patterns:(r=[{name:"timestampWithOffset",regex:i.compile("^(_YEAR4_)-(_MONTH_)-(_DAY_)[T ](_H24_):(_MIN_):(_SEC_)(?:.(_MS_))? ?(_OFFSET_|Z)?$"),handler:$X(["","year","month","day","hour","minute","second","millisecond","offset"])},{name:"timestampWithZone",regex:i.compile("^(_YEAR4_)-(_MONTH_)-(_DAY_)[T ](_H24_):(_MIN_):(_SEC_)(?:.(_MS_))?\\s*(_ZONE_)$"),handler:$X(["","year","month","day","hour","minute","second","millisecond","zone"])},{name:"timestampWithOffsetAndZone",regex:i.compile("^(_YEAR4_)-(_MONTH_)-(_DAY_)[T ](_H24_):(_MIN_):(_SEC_)(?:.(_MS_))? (_OFFSET_|Z)\\s*(_ZONE_)$"),handler:$X(["","year","month","day","hour","minute","second","millisecond","offset"])},{name:"chinese",regex:i.compile(`^(${$F}{2,4})\\s*\u5E74\\s*(${$F}{1,2})\\s*\u6708\\s*(${$F}{1,2})\\s*\u65E5$`),handler:$X(["","year","month","day"])},{name:"korean",regex:i.compile("^(_YEAR_)년\\s*(_MONTH_)월\\s*(_DAY_)일$"),handler:$X(["","year","month","day"])},{name:"twitter",regex:/^(?:sun|mon|tue|wed|thu|fri|sat) (jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec) (\d{2}) (\d{2}):(\d{2}):(\d{2}) ([+-]\d{4}) (\d{4})$/i,handler:$X(["","monthname","day","hour","minute","second","offset","year"])},{name:"today",regex:/^(now|today|tomorrow|yesterday)$/i,handler:function(e){let n=$Z(),t=e[1].toLowerCase();switch(t){case"tomorrow":n.setUTCDate(n.getUTCDate()+1);break;case"yesterday":n.setUTCDate(n.getUTCDate()-1)}let r={year:n.getUTCFullYear(),month:n.getUTCMonth()+1,day:n.getUTCDate()};return"now"===t&&(r.hour=n.getUTCHours(),r.minute=n.getUTCMinutes(),r.second=n.getUTCSeconds(),r.millisecond=n.getUTCMilliseconds()),console.log("today=>",t,r),r}},{name:"ago",regex:/^(\+|-|in|) ?([\d.]+) ?(years?|months?|weeks?|days?|hours?|minutes?|seconds?|milliseconds?|ms|s|m|h|w|d|M|y)( ago)?$/i,handler:function([,e,n,t,r]){n=parseFloat(n),"week"===(t=t.length<=2?$J[t]:(t=t.replace(/s$/,"")).toLowerCase())&&(t="day",n*=7),("-"===e||r)&&(n*=-1);let o=$Z();return"millisecond"===t?o.setUTCMilliseconds(o.getUTCMilliseconds()+n):"second"===t?o.setUTCSeconds(o.getUTCSeconds()+n):"minute"===t?o.setUTCMinutes(o.getUTCMinutes()+n):"hour"===t?o.setUTCHours(o.getUTCHours()+n):"day"===t?o.setUTCDate(o.getUTCDate()+n):"month"===t?o.setUTCMonth(o.getUTCMonth()+n):"year"===t&&o.setUTCFullYear(o.getUTCFullYear()+n),{year:o.getUTCFullYear(),month:o.getUTCMonth()+1,day:o.getUTCDate(),hour:o.getUTCHours(),minute:o.getUTCMinutes(),second:o.getUTCSeconds(),millisecond:o.getUTCMilliseconds()}}},{name:"atSeconds",regex:/^@(\d+)$/,handler:function(e){let n=new Date(1e3*parseInt(e[1],10));return{year:n.getUTCFullYear(),month:n.getUTCMonth()+1,day:n.getUTCDate(),hour:n.getUTCHours(),minute:n.getUTCMinutes(),second:n.getUTCSeconds()}}},{name:"microsoftJson",regex:/^\/Date\((\d+)([+-]\d{4})?\)\/$/,handler:function(e){let n=new Date(parseInt(e[1],10));return{year:n.getUTCFullYear(),month:n.getUTCMonth()+1,day:n.getUTCDate(),hour:n.getUTCHours(),minute:n.getUTCMinutes(),second:n.getUTCSeconds(),millisecond:n.getUTCMilliseconds(),offset:e[2]}}},{name:"full24",regex:i.compile("(?:^|[\\sT])(_H24_):(_MIN_):(_SEC_)(?:\\.(_MS_))?(Z)?$"),handler:$X(["","hour","minute","second","millisecond","zone"])},{name:"zone24",regex:i.compile("(_H24_):(_MIN_):(_SEC_)(?:\\.(_MS_))?[\\s\\[(]*(_ZONE_)?[\\s\\])]*$"),handler:$X(["","hour","minute","second","millisecond","zone"])},{name:"hms12",regex:i.compile("(_H12_):(_MIN_):(_SEC_)\\s*(_MERIDIEM_)"),handler:$X(["","hour","minute","second","meridiem"])},{name:"hms24",regex:i.compile("(_H24_):(_MIN_):(_SEC_)(?:\\.(_MS_))?"),handler:$X(["","hour","minute","second","millisecond"])},{name:"hm12",regex:i.compile("(_H12_):(_MIN_)\\s*(_MERIDIEM_)"),handler:$X(["","hour","minute","meridiem"])},{name:"hm24",regex:i.compile("(_H24_):(_MIN_)"),handler:$X(["","hour","minute"])},{name:"h12",regex:i.compile("(_H12_)\\s*(_MERIDIEM_)"),handler:$X(["","hour","meridiem"])},{name:"8digit",regex:/^((?:19|20)\d{2})(\d{2})(\d{2})$/,handler:$X(["","year","month","day"])},{name:"yearMonthnameDay",regex:i.compile("(_YEAR4_)[\\s.-]+(_MONTHNAME_)[\\s,.-]+(_DAY_)(_ORDINAL_)?"),handler:$X(["","year","monthname","day"])},{name:"dayMonthnameYear",regex:i.compile("(_DAY_)(_ORDINAL_)?[\\s.-]*(_MONTHNAME_)[\\s,.-]+(_YEAR_)"),handler:$X(["","day","","monthname","year"])},{name:"monthnameDayYear",regex:i.compile("(_MONTHNAME_)[\\s.-]*(_DAY_)(_ORDINAL_)?[\\s,.-]+(_YEAR_)"),handler:$X(["","monthname","day","","year"])},{name:"dayMonthname",regex:i.compile("\\b(_DAY_)(_ORDINAL_)?[\\s.-]*(_MONTHNAME_)\\b"),handler:$X(["","day","","monthname"])},{name:"monthnameDay",regex:i.compile("\\b(_MONTHNAME_)[\\s.-]*(_DAY_)(_ORDINAL_)?\\b"),handler:$X(["","monthname","day"])},{name:"hmsNoMeridiem",regex:i.compile("\\b(_H12_|_H24_):(_MIN_):(_SEC_)\\b"),handler:$X(["","hour","minute","second"])},{name:"hmNoMeridiem",regex:i.compile("\\b(_H12_|_H24_):(_MIN_)\\b"),handler:$X(["","hour","minute"])},{name:"ymd",regex:i.compile("(_YEAR4_)([.-])(_MONTH_)\\2+(_DAY_)"),handler:$X(["","year","","month","day"])},{name:"mdy",regex:i.compile("(_MONTH_)([/-])(_DAY_)\\2(_YEAR_)"),handler:$X(["","month","","day","year"])},{name:"dmy",regex:i.compile("(_DAY_)(?:_ORDINAL_)?[./\\s-]+(_MONTH_)[./\\s-]+(_YEAR_)"),handler:$X(["","day","month","year"])},{name:"yearLoose",regex:i.compile("_YEAR4_"),handler:$X(["year"])},{name:"dayMonthnameLoose",regex:i.compile("(_DAY_)[\\s.]*(_MONTHNAME_)"),handler:$X(["","day","monthname"])},{name:"monthnameDayLoose",regex:i.compile("(_MONTHNAME_)[\\s.]*(_DAY_)"),handler:$X(["","monthname","day"])},{name:"monthname",regex:i.compile("_MONTHNAME_"),handler:$X(["monthname"])},{name:"year4",regex:i.compile("_YEAR4_"),handler:$X(["year"])},{name:"md",regex:i.compile("(_MONTH_)[/-](_DAY_)"),handler:$X(["","month","day"])},{name:"dm",regex:i.compile("(_DAY_)(?:_ORDINAL_)?[./\\s-]+(_MONTH_)"),handler:$X(["","day","month"])},{name:"day",regex:i.compile("_DAY_"),handler:$X(["day"])},{name:"year2",regex:i.compile("_YEAR2_"),handler:$X(["year"])},{name:"onlyZone",regex:i.compile("_ZONE_"),handler:$X(["zone"])}],o=i.baseName.slice(0,5),$Y.includes(o)?r:r.filter(e=>!["mdy","md"].includes(e.name))),formatter:(t=i,function(e){let n={};for(let[r,o]of Object.entries(e))if("monthname"===r){if(o){let e=t.monthNameToInt(o);void 0!==e&&(n.month=e)}}else if("hour"===r&&e.meridiem){let r=t.h12ToInt(o,e.meridiem);void 0!==r&&(n.hour=r)}else if("zone"===r){if(o){let e=t.zoneToOffset(o);void 0!==e&&(n.offset=e)}}else if("offset"===r){let e=t.offsetToMinutes(o);void 0!==e&&(n.offset=e)}else if("millisecond"===r){let e=t.millisecondToInt(o);"number"==typeof e&&(n.millisecond=e)}else if($0.includes(r)){let e=t.toInt(o);"number"==typeof e&&(n[r]=e)}return n.year<100&&(n.year=$j[n.year]),n.year&&"buddhist"===t.dateOptions.calendar&&(n.year-=543),n})})}return $1[e]}(n),r=function(e,n){let t=$5[n.slice(0,2).toLowerCase()];if(!t)return e;for(let[n,r]of t)e=e.replace(n,r);return e}(e,n);return t.attempt(r)}function $6(e){e.month&&e.day&&void 0===e.year&&(e.year=new Date().getFullYear()),60===e.second&&(e.second=59);let n=new $N(e.year,e.month-1,e.day,e.hour||0,e.minute||0,e.second||0,e.millisecond||0);return"number"==typeof e.offset?new $N(n.valueOf()-60*e.offset*1e3):n}function $8(e,n=$I){let t=$4(e,n),r=t.invalid?new $N(NaN):$6(t);return r.isValid()||(r.invalid=`Unable to parse date "${e}"`),r}function $7(e,n=$I){return e instanceof Date?new $N(e.valueOf()):"number"==typeof e?new $N(e):$8(e,n)}Date.fromString=$N.fromString=$8,Date.fromAny=$N.fromAny=$7,"u">typeof window&&(window.anyDateParser={fromString:$8,fromAny:$7,fromObject:$6,attempt:$4});var $9=t(5238),Ae=t(83826);let An=function(e){return null==e};function At(e,n){var t=function(e,n){if(!n.has(e))throw TypeError("attempted to get private field on non-instance");return n.get(e)}(e,n);return t.get?t.get.call(e):t.value}p6.extend(p7),p6.extend(Ae),p6.extend($9);let Ar="YYYY-MM-DDTHH:mm:ss.SSSZZ";function Ao(e){return null!=e&&28===e.trim().length&&"T"===(e=e.trim())[10]&&":"===e[13]&&":"===e[16]&&"."===e[19]&&("+"===e[23]||"-"===e[23])&&p6(e,Ar).isValid()}function Ai(e){return p6(e).isToday()}function Aa(e){return Ao(e)?p6(e,Ar).toDate():null}function As(e,n=!1){let t=p6(e);return n&&(t=t.utc()),t.format(Ar)}function Al(e){return p6(e).toDate()}var Ac=new WeakMap;let Au=new class{register(e,n){At(this,Ac).set(e,n)}getCalendar(e){if(!e)return;if(e.calendar)return e.calendar;if(e.region){let n=`${e.language}-${e.region}`;if(At(this,Ac).has(n))return At(this,Ac).get(n)}if(e.language&&At(this,Ac).has(e.language))return At(this,Ac).get(e.language);let n=new Intl.DateTimeFormat(e.toString()).resolvedOptions().calendar;return At(this,Ac).set(`${e.language}${e.region?`-${e.region}`:""}`,n),n}constructor(){!function(e,n,t){if(n.has(e))throw TypeError("Cannot initialize the same private elements twice on an object");n.set(e,t)}(this,Ac,{writable:!0,value:new Map})}};function Ap(e,n){Au.register(e,n)}function Ad(e){let n=e??$B();return Au.getCalendar(n instanceof Intl.Locale?n:new Intl.Locale(n))}let Af={mode:"standard",time:"for today",day:!0,month:!0,year:!0,noToday:!1};function Ah(e,n={}){let t=$4(e,$B());if(t.invalid)return console.warn(`Could not parse invalid date '${e}'`),null;!An(t.day)&&An(t.month)&&(t=Object.assign({},nw(t,"day"),{month:t.day})),t.month&&(t.month-=1),t.day&&(t=Object.assign({},nw(t,"day"),{date:t.day}));let r=p6().set(t).toDate();return An(t.year)&&(n.year=!1),An(t.month)&&(n.month=!1),An(t.date)&&(n.day=!1),Am(r,n)}function Am(e,n){let t,r=n?.locale??$B(),o=new Intl.Locale(r),{calendar:i,mode:a,time:s,day:l,month:c,year:u,noToday:p,numberingSystem:d}={...Af,...{noToday:"am"===o.language},...n},f={calendar:i??Ad(o),year:u?"numeric":void 0,month:c?"short":void 0,day:l?"2-digit":void 0,numberingSystem:d},h=p6(e).isToday();if(h&&!p)t=(t=new Intl.RelativeTimeFormat(r,{numeric:"auto"}).format(0,"day"))[0].toLocaleUpperCase(r)+t.slice(1);else{"en"===o.language&&(r="en-GB");let n=new Intl.DateTimeFormat(r,f).formatToParts(e);("en"===o.language||"am"===o.language)&&"standard"==a&&u&&l&&(n=n.map(Ag("-"))),"wide"==a&&(n=n.map(Ag(" — "))),"ethiopic"===f.calendar&&(n=n.filter((e,n,t)=>"era"!==e.type&&("literal"!==e.type||!(n<t.length-1)||"era"!==t[n+1].type))),t=n.map(e=>e.value).join("")}return(!0===s||h&&"for today"===s)&&(t+=`, ${Ab(e)}`),t}let Ag=e=>(n,t,r)=>"literal"!==n.type||" "!==n.value||t<r.length-1&&"era"===r[t+1].type?n:{type:"literal",value:e};function Ab(e){return e.toLocaleTimeString($B(),{hour:"2-digit",minute:"2-digit"})}function Ay(e,n){return Am(e,{...n,time:!0})}function A_(e,n){let t=Ad("string"==typeof n?new Intl.Locale(n):n);return t?bT(e,yZ(t)):e}function Av(e,n){return new Intl.DurationFormat($B(),n).format(e)}function A$(e,n){if(null==e)return null;if("string"==typeof e){let t=$4(e,$B());return t.invalid?(console.warn(`Could not interpret '${e}' as a date`),null):(t.day&&!t.month&&(t={...nw(t,"day"),...{month:t.day}}),t.month&&(t.month-=1),t.day&&(t={...nw(t,"day"),...{date:t.day}}),p6(n).set(t))}return p6(e)}let AA=["years","months","days","hours","minutes","seconds"],Aw={second:"seconds",minute:"minutes",hour:"hours",day:"days",month:"months",year:"years"},Ak={seconds:45,minutes:45,hours:22,days:26,months:11,years:1/0};function Ax(e,n=p6(),t){let r,o=p6(n),i=A$(e,o);if(null==i)return null;if("string"==typeof t){let e=Aw[t]??t;return{[e]:o.diff(i,e)}}let{thresholds:a,largestUnit:s,smallestUnit:l}=t??{};if(void 0!==s||void 0!==l){let e,n=l?Aw[l]??l:void 0;return e="auto"===s||void 0===s?function(e,n,t){let r=AA.indexOf(t);for(let o=0;o<AA.length;o++){let i=AA[o];if(n.diff(e,i)>0)return o<=r?i:t}return t}(i,o,n??"seconds"):Aw[s]??s,function(e,n,t,r){let o=AA.indexOf(t),i=AA.indexOf(r),a=AA.slice(o,i+1),s={},l=e;for(let e of a){let t=n.diff(l,e);s[e]=t,l=l.add(t,e)}return s}(i,o,e,n??e)}let c=(r=function(e){let n={...Ak};if(e)for(let[t,r]of Object.entries(e))void 0!==r&&(n[Aw[t]??t]=r);return n}(a),o.diff(i,"seconds")<r.seconds?"seconds":o.diff(i,"minutes")<r.minutes?"minutes":o.diff(i,"hours")<r.hours?"hours":o.diff(i,"days")<r.days?"days":o.diff(i,"months")<r.months?"months":"years");return{[c]:o.diff(i,c)}}let AC={style:"short",localeMatcher:"lookup"};function AE(e,n=p6(),t){let r=Ax(e,n,t);return null==r?null:Av(r,"object"==typeof t&&t.formatOptions?{...AC,...t.formatOptions}:AC)}let AD=(0,uA.createContext)(null);function AS(){let e=pm({externalModuleName:"@openmrs/esm-styleguide"}).preferredDateLocale,n=(0,uA.useMemo)(()=>{let n=$B();return e[n]&&(n=e[n]),n},[window.i18next.language]),t=(0,uA.useMemo)(()=>{let e=Ad(n);return void 0!==e?yZ(e):void 0},[n]),r=(0,uA.useMemo)(()=>new Intl.Locale(n,{calendar:t?.identifier}),[n,t]),o=(0,uA.useMemo)(()=>t?bT(bW(bq()),t):bW(bq()),[t]);return{calendar:t,intlLocale:r,today_:o}}let AM=new bv(1793,1,1);var Az={};function AP(){return"u">typeof window&&window.InputEvent&&"function"==typeof InputEvent.prototype.getTargetRanges}function AO(e={}){let{locale:n}=gT();return(0,uA.useMemo)(()=>new(0,vc.K)(n,e),[n,e])}Az={"ar-AE":{decrease:e=>`\u{62E}\u{641}\u{636} ${e.fieldLabel}`,increase:e=>`\u{632}\u{64A}\u{627}\u{62F}\u{629} ${e.fieldLabel}`,numberField:"حقل رقمي"},"bg-BG":{decrease:e=>`\u{41D}\u{430}\u{43C}\u{430}\u{43B}\u{44F}\u{432}\u{430}\u{43D}\u{435} ${e.fieldLabel}`,increase:e=>`\u{423}\u{441}\u{438}\u{43B}\u{432}\u{430}\u{43D}\u{435} ${e.fieldLabel}`,numberField:"Номер на полето"},"cs-CZ":{decrease:e=>`Sn\xed\u{17E}it ${e.fieldLabel}`,increase:e=>`Zv\xfd\u{161}it ${e.fieldLabel}`,numberField:"Č\xedseln\xe9 pole"},"da-DK":{decrease:e=>`Reducer ${e.fieldLabel}`,increase:e=>`\xd8g ${e.fieldLabel}`,numberField:"Talfelt"},"de-DE":{decrease:e=>`${e.fieldLabel} verringern`,increase:e=>`${e.fieldLabel} erh\xf6hen`,numberField:"Nummernfeld"},"el-GR":{decrease:e=>`\u{39C}\u{3B5}\u{3AF}\u{3C9}\u{3C3}\u{3B7} ${e.fieldLabel}`,increase:e=>`\u{391}\u{3CD}\u{3BE}\u{3B7}\u{3C3}\u{3B7} ${e.fieldLabel}`,numberField:"Πεδίο αριθμού"},"en-US":{decrease:e=>`Decrease ${e.fieldLabel}`,increase:e=>`Increase ${e.fieldLabel}`,numberField:"Number field"},"es-ES":{decrease:e=>`Reducir ${e.fieldLabel}`,increase:e=>`Aumentar ${e.fieldLabel}`,numberField:"Campo de n\xfamero"},"et-EE":{decrease:e=>`V\xe4henda ${e.fieldLabel}`,increase:e=>`Suurenda ${e.fieldLabel}`,numberField:"Numbri v\xe4li"},"fi-FI":{decrease:e=>`V\xe4henn\xe4 ${e.fieldLabel}`,increase:e=>`Lis\xe4\xe4 ${e.fieldLabel}`,numberField:"Numerokentt\xe4"},"fr-FR":{decrease:e=>`Diminuer ${e.fieldLabel}`,increase:e=>`Augmenter ${e.fieldLabel}`,numberField:"Champ de nombre"},"he-IL":{decrease:e=>`\u{5D4}\u{5E7}\u{5D8}\u{5DF} ${e.fieldLabel}`,increase:e=>`\u{5D4}\u{5D2}\u{5D3}\u{5DC} ${e.fieldLabel}`,numberField:"שדה מספר"},"hr-HR":{decrease:e=>`Smanji ${e.fieldLabel}`,increase:e=>`Pove\u{107}aj ${e.fieldLabel}`,numberField:"Polje broja"},"hu-HU":{decrease:e=>`${e.fieldLabel} cs\xf6kkent\xe9se`,increase:e=>`${e.fieldLabel} n\xf6vel\xe9se`,numberField:"Sz\xe1mmező"},"it-IT":{decrease:e=>`Riduci ${e.fieldLabel}`,increase:e=>`Aumenta ${e.fieldLabel}`,numberField:"Campo numero"},"ja-JP":{decrease:e=>`${e.fieldLabel}\u{3092}\u{7E2E}\u{5C0F}`,increase:e=>`${e.fieldLabel}\u{3092}\u{62E1}\u{5927}`,numberField:"数値フィールド"},"ko-KR":{decrease:e=>`${e.fieldLabel} \u{AC10}\u{C18C}`,increase:e=>`${e.fieldLabel} \u{C99D}\u{AC00}`,numberField:"번호 필드"},"lt-LT":{decrease:e=>`Suma\u{17E}inti ${e.fieldLabel}`,increase:e=>`Padidinti ${e.fieldLabel}`,numberField:"Numerio laukas"},"lv-LV":{decrease:e=>`Samazin\u{101}\u{161}ana ${e.fieldLabel}`,increase:e=>`Palielin\u{101}\u{161}ana ${e.fieldLabel}`,numberField:"Skaitļu lauks"},"nb-NO":{decrease:e=>`Reduser ${e.fieldLabel}`,increase:e=>`\xd8k ${e.fieldLabel}`,numberField:"Tallfelt"},"nl-NL":{decrease:e=>`${e.fieldLabel} verlagen`,increase:e=>`${e.fieldLabel} verhogen`,numberField:"Getalveld"},"pl-PL":{decrease:e=>`Zmniejsz ${e.fieldLabel}`,increase:e=>`Zwi\u{119}ksz ${e.fieldLabel}`,numberField:"Pole numeru"},"pt-BR":{decrease:e=>`Diminuir ${e.fieldLabel}`,increase:e=>`Aumentar ${e.fieldLabel}`,numberField:"Campo de n\xfamero"},"pt-PT":{decrease:e=>`Diminuir ${e.fieldLabel}`,increase:e=>`Aumentar ${e.fieldLabel}`,numberField:"Campo num\xe9rico"},"ro-RO":{decrease:e=>`Sc\u{103}dere ${e.fieldLabel}`,increase:e=>`Cre\u{219}tere ${e.fieldLabel}`,numberField:"C\xe2mp numeric"},"ru-RU":{decrease:e=>`\u{423}\u{43C}\u{435}\u{43D}\u{44C}\u{448}\u{435}\u{43D}\u{438}\u{435} ${e.fieldLabel}`,increase:e=>`\u{423}\u{432}\u{435}\u{43B}\u{438}\u{447}\u{435}\u{43D}\u{438}\u{435} ${e.fieldLabel}`,numberField:"Числовое поле"},"sk-SK":{decrease:e=>`Zn\xed\u{17E}i\u{165} ${e.fieldLabel}`,increase:e=>`Zv\xfd\u{161}i\u{165} ${e.fieldLabel}`,numberField:"Č\xedseln\xe9 pole"},"sl-SI":{decrease:e=>`Upadati ${e.fieldLabel}`,increase:e=>`Pove\u{10D}ajte ${e.fieldLabel}`,numberField:"Številčno polje"},"sr-SP":{decrease:e=>`Smanji ${e.fieldLabel}`,increase:e=>`Pove\u{107}aj ${e.fieldLabel}`,numberField:"Polje broja"},"sv-SE":{decrease:e=>`Minska ${e.fieldLabel}`,increase:e=>`\xd6ka ${e.fieldLabel}`,numberField:"Nummerf\xe4lt"},"tr-TR":{decrease:e=>`${e.fieldLabel} azalt`,increase:e=>`${e.fieldLabel} artt\u{131}r`,numberField:"Sayı alanı"},"uk-UA":{decrease:e=>`\u{417}\u{43C}\u{435}\u{43D}\u{448}\u{438}\u{442}\u{438} ${e.fieldLabel}`,increase:e=>`\u{417}\u{431}\u{456}\u{43B}\u{44C}\u{448}\u{438}\u{442}\u{438} ${e.fieldLabel}`,numberField:"Поле номера"},"zh-CN":{decrease:e=>`\u{964D}\u{4F4E} ${e.fieldLabel}`,increase:e=>`\u{63D0}\u{9AD8} ${e.fieldLabel}`,numberField:"数字字段"},"zh-TW":{decrease:e=>`\u{7E2E}\u{5C0F} ${e.fieldLabel}`,increase:e=>`\u{653E}\u{5927} ${e.fieldLabel}`,numberField:"數字欄位"}};var AT={};AT={"ar-AE":{Empty:"فارغ"},"bg-BG":{Empty:"Изпразни"},"cs-CZ":{Empty:"Pr\xe1zdn\xe9"},"da-DK":{Empty:"Tom"},"de-DE":{Empty:"Leer"},"el-GR":{Empty:"Άδειο"},"en-US":{Empty:"Empty"},"es-ES":{Empty:"Vac\xedo"},"et-EE":{Empty:"T\xfchjenda"},"fi-FI":{Empty:"Tyhj\xe4"},"fr-FR":{Empty:"Vide"},"he-IL":{Empty:"ריק"},"hr-HR":{Empty:"Prazno"},"hu-HU":{Empty:"\xdcres"},"it-IT":{Empty:"Vuoto"},"ja-JP":{Empty:"空"},"ko-KR":{Empty:"비어 있음"},"lt-LT":{Empty:"Tuščias"},"lv-LV":{Empty:"Tukšs"},"nb-NO":{Empty:"Tom"},"nl-NL":{Empty:"Leeg"},"pl-PL":{Empty:"Pusty"},"pt-BR":{Empty:"Vazio"},"pt-PT":{Empty:"Vazio"},"ro-RO":{Empty:"Gol"},"ru-RU":{Empty:"Не заполнено"},"sk-SK":{Empty:"Pr\xe1zdne"},"sl-SI":{Empty:"Prazen"},"sr-SP":{Empty:"Prazno"},"sv-SE":{Empty:"Tomt"},"tr-TR":{Empty:"Boş"},"uk-UA":{Empty:"Пусто"},"zh-CN":{Empty:"空"},"zh-TW":{Empty:"空白"}};let AB=()=>{};function AI(e){var n;let t=(0,uA.useRef)(void 0),{value:r,textValue:o,minValue:i,maxValue:a,isDisabled:s,isReadOnly:l,isRequired:c,onIncrement:u,onIncrementPage:p,onDecrement:d,onDecrementPage:f,onDecrementToMin:h,onIncrementToMax:m}=e,g=g2((n=AT)&&n.__esModule?n.default:n,"@react-aria/spinbutton"),b=(0,uA.useRef)(!1),y=(0,uA.useCallback)(()=>{clearTimeout(t.current),b.current=!1},[]),v=m1(()=>{y()});(0,uA.useEffect)(()=>()=>v(),[]);let $=(0,uA.useRef)(!1),A=()=>{$.current=!0},w=()=>{$.current=!1},k=""===o?g.format("Empty"):(o||`${r}`).replace("-","−");(0,uA.useEffect)(()=>{$.current&&(gB&&gB.clear("assertive"),gI(k,"assertive"))},[k]);let x=(0,uA.useCallback)(()=>{y()},[y]),C=m1(u??AB),E=m1(d??AB),D=m1(()=>{(void 0===a||isNaN(a)||void 0===r||isNaN(r)||r<a)&&(C(),S(60))}),S=m1(e=>{v(),b.current=!0,t.current=window.setTimeout(D,e)}),M=m1(()=>{(void 0===i||isNaN(i)||void 0===r||isNaN(r)||r>i)&&(E(),z(60))}),z=m1(e=>{v(),b.current=!0,t.current=window.setTimeout(M,e)}),P=e=>{e.preventDefault()},{addGlobalListener:O,removeAllGlobalListeners:T}=m2(),B=(0,uA.useRef)(!1),[I,N]=(0,uA.useState)(null);(0,uA.useEffect)(()=>{"touch"===I?S(600):I&&S(400)},[I]);let[j,R]=(0,uA.useState)(null);return(0,uA.useEffect)(()=>{"touch"===j?z(600):j&&z(400)},[j]),{spinButtonProps:{role:"spinbutton","aria-valuenow":void 0===r||isNaN(r)?void 0:r,"aria-valuetext":k,"aria-valuemin":i,"aria-valuemax":a,"aria-disabled":s||void 0,"aria-readonly":l||void 0,"aria-required":c||void 0,onKeyDown:e=>{if(!e.ctrlKey&&!e.metaKey&&!e.shiftKey&&!e.altKey&&!l&&!e.nativeEvent.isComposing)switch(e.key){case"PageUp":if(p){e.preventDefault(),p?.();break}case"ArrowUp":case"Up":u&&(e.preventDefault(),u?.());break;case"PageDown":if(f){e.preventDefault(),f?.();break}case"ArrowDown":case"Down":d&&(e.preventDefault(),d?.());break;case"Home":h&&(e.preventDefault(),h?.());break;case"End":m&&(e.preventDefault(),m?.())}},onFocus:A,onBlur:w},incrementButtonProps:{onPressStart:e=>{y(),"touch"!==e.pointerType?(u?.(),N("mouse")):(O(window,"pointercancel",x,{capture:!0}),B.current=!1,N("touch")),O(window,"contextmenu",P)},onPressUp:e=>{y(),"touch"===e.pointerType&&(B.current=!0),T(),N(null)},onPressEnd:e=>{y(),"touch"===e.pointerType&&!b.current&&B.current&&u?.(),B.current=!1,N(null)},onFocus:A,onBlur:w},decrementButtonProps:{onPressStart:e=>{y(),"touch"!==e.pointerType?(d?.(),R("mouse")):(O(window,"pointercancel",x,{capture:!0}),B.current=!1,R("touch"))},onPressUp:e=>{y(),"touch"===e.pointerType&&(B.current=!0),T(),R(null)},onPressEnd:e=>{y(),"touch"===e.pointerType&&!b.current&&B.current&&d?.(),B.current=!1,R(null)},onFocus:A,onBlur:w}}}let AN=null;var Aj=t(66284);function AR(e,n,t){let r="+"===e?n+t:n-t;if(n%1!=0||t%1!=0){let o=n.toString().split("."),i=t.toString().split("."),a=Math.pow(10,Math.max(o[1]&&o[1].length||0,i[1]&&i[1].length||0));n=Math.round(n*a),t=Math.round(t*a),r=("+"===e?n+t:n-t)/a}return r}let AF=(0,uA.createContext)(null),AL=(0,uA.createContext)(null),AW=(0,uA.forwardRef)(function(e,n){var t,r;[e,n]=hj(e,n,AF);let{validationBehavior:o}=hN(vM)||{},i=null!=(r=null!=(t=e.validationBehavior)?t:o)?r:"native",{locale:a}=gT(),s=function(e){let{minValue:n,maxValue:t,step:r,formatOptions:o,value:i,defaultValue:a=NaN,onChange:s,locale:l,isDisabled:c,isReadOnly:u,commitBehavior:p="snap"}=e;null===i&&(i=NaN);let d=(0,uA.useCallback)(e=>void 0===r||isNaN(r)?vN(e,n,t):vR(e,n,t,r),[r,n,t]);void 0===i||isNaN(i)||"snap"!==p||(i=d(i)),isNaN(a)||"snap"!==p||(a=d(a));let[f,h]=y6(i,isNaN(a)?NaN:a,s),[m]=(0,uA.useState)(f),[g,b]=(0,uA.useState)(()=>isNaN(f)?"":new(0,vc.K)(l,o).format(f)),y=(0,uA.useMemo)(()=>new(0,Aj.d)(l,o),[l,o]),v=(0,uA.useMemo)(()=>y.getNumberingSystem(g),[y,g]),$=(0,uA.useMemo)(()=>new(0,vc.K)(l,{...o,numberingSystem:v}),[l,o,v]),A=(0,uA.useMemo)(()=>$.resolvedOptions(),[$]),w=(0,uA.useCallback)(e=>isNaN(e)||null===e?"":$.format(e),[$]),k=_1({...e,value:f}),x=void 0===r||isNaN(r)?1:r;"percent"===A.style&&(void 0===r||isNaN(r))&&(x=.01);let[C,E]=(0,uA.useState)(f),[D,S]=(0,uA.useState)(l),[M,z]=(0,uA.useState)(o);Object.is(f,C)&&l===D&&o===M||(b(w(f)),E(f),S(l),z(o));let P=(0,uA.useMemo)(()=>y.parse(g),[y,g]),O=(e,r=0)=>{if(isNaN(P))return vR(isNaN(r)?0:r,n,t,x);{let r=vR(P,n,t,x);return"+"===e&&r>P||"-"===e&&r<P?r:vR(AR(e,P,x),n,t,x)}},T=(0,uA.useMemo)(()=>!c&&!u&&(isNaN(P)||void 0===t||isNaN(t)||vR(P,n,t,x)>P||AR("+",P,x)<=t),[c,u,n,t,x,P]),B=(0,uA.useMemo)(()=>!c&&!u&&(isNaN(P)||void 0===n||isNaN(n)||vR(P,n,t,x)<P||AR("-",P,x)>=n),[c,u,n,t,x,P]);return{...k,validate:e=>y.isValidPartialNumber(e,n,t),increment:()=>{let e=O("+",n);e===f&&b(w(e)),h(e),k.commitValidation()},incrementToMax:()=>{null!=t&&(h(vR(t,n,t,x)),k.commitValidation())},decrement:()=>{let e=O("-",t);e===f&&b(w(e)),h(e),k.commitValidation()},decrementToMin:()=>{null!=n&&(h(n),k.commitValidation())},canIncrement:T,canDecrement:B,minValue:n,maxValue:t,numberValue:P,defaultNumberValue:isNaN(a)?m:a,setNumberValue:h,setInputValue:b,inputValue:g,commit:e=>{let n=void 0===e?g:e,t=P;if(void 0!==e&&(t=y.parse(n)),!n.length){h(NaN),b(void 0===i?"":w(f));return}if(isNaN(t))return void b(w(f));let r="snap"===p?d(t):t,o=(r=y.parse(w(r)))!==f;h(r),b(w(void 0===i?r:f)),o&&k.commitValidation()}}}({...e,locale:a,validationBehavior:i}),l=(0,uA.useRef)(null),[c,u]=hR(!e["aria-label"]&&!e["aria-labelledby"]),{labelProps:p,groupProps:d,inputProps:f,incrementButtonProps:h,decrementButtonProps:m,descriptionProps:g,errorMessageProps:b,...y}=function(e,n,t){var r,o,i,a,s,l,c,u,p;let d,{id:f,decrementAriaLabel:h,incrementAriaLabel:m,isDisabled:g,isReadOnly:b,isRequired:y,minValue:v,maxValue:$,autoFocus:A,label:w,formatOptions:k,onBlur:x=()=>{},onFocus:C,onFocusChange:E,onKeyDown:D,onKeyUp:S,description:M,errorMessage:z,isWheelDisabled:P,...O}=e,{increment:T,incrementToMax:B,decrement:I,decrementToMin:N,numberValue:j,inputValue:R,commit:F,commitValidation:L}=n,W=g2((r=Az)&&r.__esModule?r.default:r,"@react-aria/numberfield"),V=(0,uA.useCallback)(()=>{let e=t.current?.value??"";(0,m3.flushSync)(()=>{F()}),t.current?.value!==e&&gI(t.current?.value??"","assertive")},[F,t]),G=hM(f),{focusProps:U}=mL({onBlur(){V()}}),q=AO(k),H=(0,uA.useMemo)(()=>q.resolvedOptions(),[q]),K=AO({...k,currencySign:void 0}),Y=(0,uA.useMemo)(()=>isNaN(j)?"":K.format(j),[K,j]),{spinButtonProps:J,incrementButtonProps:Z,decrementButtonProps:X}=AI({isDisabled:g,isReadOnly:b,isRequired:y,maxValue:$,minValue:v,onIncrement:T,onIncrementToMax:B,onDecrement:I,onDecrementToMin:N,value:j,textValue:Y}),[Q,ee]=(0,uA.useState)(!1),{focusWithinProps:en}=ga({isDisabled:g,onFocusWithinChange:ee});!function(e,n){let{onScroll:t,isDisabled:r}=e,o=(0,uA.useCallback)(e=>{!e.ctrlKey&&(e.preventDefault(),e.stopPropagation(),t&&t({deltaX:e.deltaX,deltaY:e.deltaY}))},[t]);yn(n,"wheel",r?void 0:o)}({onScroll:(0,uA.useCallback)(e=>{!(Math.abs(e.deltaY)<=Math.abs(e.deltaX))&&(e.deltaY>0?T():e.deltaY<0&&I())},[I,T]),isDisabled:P||g||b||!Q},t);let et=(H.maximumFractionDigits??0)>0,er=void 0===n.minValue||isNaN(n.minValue)||n.minValue<0,eo="numeric";mp()?er?eo="text":et&&(eo="decimal"):mg()&&(er?eo="numeric":et&&(eo="decimal"));let ei=hZ(e),ea=(0,uA.useCallback)(e=>{e.nativeEvent.isComposing||("Enter"===e.key?((0,m3.flushSync)(()=>{F()}),L()):e.continuePropagation())},[F,L]),{isInvalid:es,validationErrors:el,validationDetails:ec}=n.displayValidation,{labelProps:eu,inputProps:ep,descriptionProps:ed,errorMessageProps:ef}=function(e,n,t){let r=m1(e=>{let r=t.current;if(!r)return;let o=null;switch(e.inputType){case"historyUndo":case"historyRedo":case"insertLineBreak":return;case"deleteContent":case"deleteByCut":case"deleteByDrag":o=r.value.slice(0,r.selectionStart)+r.value.slice(r.selectionEnd);break;case"deleteContentForward":o=r.selectionEnd===r.selectionStart?r.value.slice(0,r.selectionStart)+r.value.slice(r.selectionEnd+1):r.value.slice(0,r.selectionStart)+r.value.slice(r.selectionEnd);break;case"deleteContentBackward":o=r.selectionEnd===r.selectionStart?r.value.slice(0,r.selectionStart-1)+r.value.slice(r.selectionStart):r.value.slice(0,r.selectionStart)+r.value.slice(r.selectionEnd);break;case"deleteSoftLineBackward":case"deleteHardLineBackward":o=r.value.slice(r.selectionStart);break;default:null!=e.data&&(o=r.value.slice(0,r.selectionStart)+e.data+r.value.slice(r.selectionEnd))}null!=o&&n.validate(o)||e.preventDefault()});(0,uA.useEffect)(()=>{if(!AP()||!t.current)return;let e=t.current;return e.addEventListener("beforeinput",r,!1),()=>{e.removeEventListener("beforeinput",r,!1)}},[t]);let o=AP()?null:e=>{let t=h3(e).value.slice(0,h3(e).selectionStart)+e.data+h3(e).value.slice(h3(e).selectionEnd);n.validate(t)||e.preventDefault()},{labelProps:i,inputProps:a,descriptionProps:s,errorMessageProps:l,...c}=function(e,n){let{inputElementType:t="input",isDisabled:r=!1,isRequired:o=!1,isReadOnly:i=!1,type:a="text",validationBehavior:s="aria"}=e,[l,c]=y6(e.value,e.defaultValue||"",e.onChange),{focusableProps:u}=mU(e,n),p=_1({...e,value:l}),{isInvalid:d,validationErrors:f,validationDetails:h}=p.displayValidation,{labelProps:m,fieldProps:g,descriptionProps:b,errorMessageProps:y}=_W({...e,isInvalid:d,errorMessage:e.errorMessage||f}),v=hZ(e,{labelable:!0}),$={type:a,pattern:e.pattern},[A]=(0,uA.useState)(l);return _V(n,e.defaultValue??A,c),_G(e,p,n),{labelProps:m,inputProps:hO(v,"input"===t?$:void 0,{disabled:r,readOnly:i,required:o&&"native"===s,"aria-required":o&&"aria"===s||void 0,"aria-invalid":d||void 0,"aria-errormessage":e["aria-errormessage"],"aria-activedescendant":e["aria-activedescendant"],"aria-autocomplete":e["aria-autocomplete"],"aria-haspopup":e["aria-haspopup"],"aria-controls":e["aria-controls"],value:l,onChange:e=>c(h3(e).value),autoComplete:e.autoComplete,autoCapitalize:e.autoCapitalize,maxLength:e.maxLength,minLength:e.minLength,name:e.name,form:e.form,placeholder:e.placeholder,inputMode:e.inputMode,autoCorrect:e.autoCorrect,spellCheck:e.spellCheck,[parseInt(uw().version,10)>=17?"enterKeyHint":"enterkeyhint"]:e.enterKeyHint,onCopy:e.onCopy,onCut:e.onCut,onPaste:e.onPaste,onCompositionEnd:e.onCompositionEnd,onCompositionStart:e.onCompositionStart,onCompositionUpdate:e.onCompositionUpdate,onSelect:e.onSelect,onBeforeInput:e.onBeforeInput,onInput:e.onInput,...u,...g}),descriptionProps:b,errorMessageProps:y,isInvalid:d,validationErrors:f,validationDetails:h}}(e,t),u=(0,uA.useRef)(null);return{inputProps:hO(a,{onBeforeInput:o,onCompositionStart(){let{value:e,selectionStart:n,selectionEnd:r}=t.current;u.current={value:e,selectionStart:n,selectionEnd:r}},onCompositionEnd(){if(t.current&&!n.validate(t.current.value)){let{value:e,selectionStart:r,selectionEnd:o}=u.current;t.current.value=e,t.current.setSelectionRange(r,o),n.setInputValue(e)}}}),labelProps:i,descriptionProps:s,errorMessageProps:l,...c}}({...O,...ei,name:void 0,form:void 0,label:w,autoFocus:A,isDisabled:g,isReadOnly:b,isRequired:y,validate:void 0,[_0]:n,value:R,defaultValue:"!",autoComplete:"off","aria-label":e["aria-label"]||void 0,"aria-labelledby":e["aria-labelledby"]||void 0,id:G,type:"text",inputMode:eo,onChange:e=>{n.validate(e)&&n.setInputValue(e)},onBlur:x,onFocus:C,onFocusChange:E,onKeyDown:(0,uA.useMemo)(()=>hb(ea,D),[ea,D]),onKeyUp:S,onPaste:n=>{e.onPaste?.(n);let t=h3(n);t&&(t.selectionEnd??-1)-(t.selectionStart??0)===t.value.length&&(n.preventDefault(),F(n.clipboardData?.getData?.("text/plain")?.trim()??""))},description:M,errorMessage:z},n,t);_V(t,n.defaultNumberValue,n.setNumberValue),o=n,i=e.validationBehavior,a=e.commitBehavior,s=t,l=n.minValue,c=n.maxValue,u=e.step,p=n.numberValue,hy(()=>{let e=s.current;if("validate"!==a||o.realtimeValidation.isInvalid||!e||e.disabled||(!AN&&"u">typeof document&&((AN=document.createElement("input")).type="number"),!AN))return;AN.min=null==l||isNaN(l)?"":String(l),AN.max=null==c||isNaN(c)?"":String(c),AN.step=null==u||isNaN(u)?"":String(u),AN.value=null==p||isNaN(p)?"":String(p);let n=e.validity.valid&&AN.validity.valid,t=e.validationMessage||AN.validationMessage,r={isInvalid:!n,validationErrors:t?[t]:[],validationDetails:{badInput:e.validity.badInput,customError:e.validity.customError,patternMismatch:e.validity.patternMismatch,rangeOverflow:AN.validity.rangeOverflow,rangeUnderflow:AN.validity.rangeUnderflow,stepMismatch:AN.validity.stepMismatch,tooLong:e.validity.tooLong,tooShort:e.validity.tooShort,typeMismatch:e.validity.typeMismatch,valueMissing:e.validity.valueMissing,valid:n}};o.updateValidation(r),"native"!==i||AN.validity.valid||e.setCustomValidity(AN.validationMessage)});let eh=hO(J,U,ep,{role:null,"aria-roledescription":mf()?null:W.format("numberField"),"aria-valuemax":null,"aria-valuemin":null,"aria-valuenow":null,"aria-valuetext":null,autoCorrect:"off",spellCheck:"false"});"native"===e.validationBehavior&&(eh["aria-required"]=void 0);let em=e=>{((e=document)=>e.activeElement)()!==t.current&&("mouse"===e.pointerType?t.current?.focus():e.target.focus())},eg=e["aria-label"]||("string"==typeof e.label?e.label:"");eg||(d=null!=e.label?eu.id:e["aria-labelledby"]);let eb=hM(),ey=hM(),e_=hO(Z,{"aria-label":m||W.format("increase",{fieldLabel:eg}).trim(),id:d&&!m?eb:null,"aria-labelledby":d&&!m?`${eb} ${d}`:null,"aria-controls":G,excludeFromTabOrder:!0,preventFocusOnPress:!0,allowFocusWhenDisabled:!0,isDisabled:!n.canIncrement,onPressStart:em}),ev=hO(X,{"aria-label":h||W.format("decrease",{fieldLabel:eg}).trim(),id:d&&!h?ey:null,"aria-labelledby":d&&!h?`${ey} ${d}`:null,"aria-controls":G,excludeFromTabOrder:!0,preventFocusOnPress:!0,allowFocusWhenDisabled:!0,isDisabled:!n.canDecrement,onPressStart:em});return{groupProps:{...en,role:"group","aria-disabled":g,"aria-invalid":es?"true":void 0},labelProps:eu,inputProps:eh,incrementButtonProps:e_,decrementButtonProps:ev,errorMessageProps:ef,descriptionProps:ed,isInvalid:es,validationErrors:el,validationDetails:ec}}({...hF(e),label:u,validationBehavior:i},s,l),v=hI({...e,values:{state:s,isDisabled:e.isDisabled||!1,isInvalid:y.isInvalid||!1,isRequired:e.isRequired||!1},defaultClassName:"react-aria-NumberField"}),$=hZ(e);return delete $.id,uw().createElement(hB,{values:[[AL,s],[_h,d],[_g,{...f,ref:l}],[vz,{...p,ref:c}],[gg,{slots:{increment:h,decrement:m}}],[g_,{slots:{description:g,errorMessage:b}}],[vE,y]]},uw().createElement("div",{...$,...v,ref:n,slot:e.slot||void 0,"data-disabled":e.isDisabled||void 0,"data-required":e.isRequired||void 0,"data-invalid":y.isInvalid||void 0}),e.name&&uw().createElement("input",{type:"hidden",name:e.name,value:isNaN(s.numberValue)?"":s.numberValue}))});function AV(e,n){return Number.parseInt(Am(e,{calendar:n.calendar,locale:n.baseName,day:!1,month:!1,noToday:!0,numberingSystem:"latn"}))}let AG=(0,uA.forwardRef)(function(e,n){let{className:t}=e,r=(0,uA.useContext)(_o),o=(0,uA.useContext)(_i),i=r??o,a=(0,uA.useContext)(AD),s=bq(),l=Am(i.visibleRange.start.toDate(s),{calendar:a.calendar,locale:a.baseName,day:!1,year:!1,noToday:!0}),c=AV(i.visibleRange.start.toDate(s),a),u=i.maxValue?AV(i.maxValue.toDate(s),a):void 0,p=i.minValue?AV(i.minValue.toDate(s),a):void 0,d=(0,uA.useCallback)(e=>{i.setFocusedDate(i.focusedDate.cycle("year",e-i.focusedDate.year))},[]);return i&&(0,di.jsxs)("span",{ref:n,className:t,children:[(0,di.jsx)("span",{children:l}),(0,di.jsxs)(AW,{formatOptions:{useGrouping:!1},maxValue:u,minValue:p,onChange:d,value:c,children:[(0,di.jsx)(_b,{}),(0,di.jsxs)(_m,{children:[(0,di.jsx)(gb,{slot:"increment",children:(0,di.jsx)(dX,{size:8})}),(0,di.jsx)(gb,{slot:"decrement",children:(0,di.jsx)(dY,{size:8})})]})]})]})});var AU=t(74782),Aq={};Aq.styleTagTransform=d_(),Aq.setAttributes=dm(),Aq.insert=df().bind(null,"head"),Aq.domAPI=dp(),Aq.insertStyleElement=db(),dc()(AU.A,Aq);let AH=AU.A&&AU.A.locals?AU.A.locals:void 0;function AK({children:e}){let n=(0,uA.useContext)($D),t=(0,uA.useContext)($S),r=n??t,o=pY(()=>r?.close());return(0,di.jsx)(vC,{className:AH.dialog,ref:o,children:e})}let AY=(0,uA.forwardRef)(function({variant:e,today_:n,minDate:t,maxDate:r},o){let i="range"===e;return(0,di.jsx)($w,{ref:o,className:AH.popover,placement:"bottom start",offset:1,isNonModal:!0,children:(0,di.jsx)(AK,{children:(0,di.jsxs)(i?_s:_a,{...i?{minValue:t,maxValue:r,className:"cds--date-picker__calendar"}:{},children:[(0,di.jsxs)("header",{className:AH.header,children:[(0,di.jsx)(gb,{className:ds()(AH.flatButton,AH.flatButtonMd),slot:"previous",children:(0,di.jsx)(d4,{size:16})}),(0,di.jsx)(AG,{className:AH.monthYear}),(0,di.jsx)(gb,{className:ds()(AH.flatButton,AH.flatButtonMd),slot:"next",children:(0,di.jsx)(d6,{size:16})})]}),(0,di.jsx)(_c,{className:AH.calendarGrid,children:e=>(0,di.jsx)(_f,{className:ds()("cds--date-picker__day",{[AH.today]:0===n.compare(e)}),date:e},e.toString())})]})})})}),AJ=(0,uA.forwardRef)(function(e,n){let t=(0,uA.useContext)($D),[r,o]=hj({slot:e.slot},n,vh),{locale:i}=gT(),a=vf({...r,locale:i,createCalendar:yZ}),s=(0,uA.useRef)(null),{fieldProps:l,inputProps:c}=_K({...r,inputRef:s},a,o),u=(0,uA.useCallback)(()=>{a.isDisabled||t.toggle()},[]);return(0,di.jsxs)(hB,{values:[[vm,a],[_g,{...c,ref:s}],[_h,{...l,ref:o,isInvalid:a.isInvalid}]],children:[(0,di.jsx)(_m,{...e,id:e.id,ref:n,slot:e.slot||void 0,className:e.className,isDisabled:a.isDisabled,isInvalid:a.isInvalid,onClick:u,children:a.segments.map((n,t)=>(0,uA.cloneElement)(e.children(n),{key:t}))}),(0,di.jsx)(_b,{})]})}),AZ=(0,uA.forwardRef)(function(e,n){let t=(0,uA.useContext)($D),r=(0,uA.useContext)($S);return(t??r).isInvalid?(0,di.jsx)(hn,{ref:n,size:16,...e}):(0,di.jsx)(dK,{ref:n,size:16,...e})});class AX{constructor(e,n){this.locale=e,this.dictionary=n}of(e){return this.dictionary.getStringForLocale(e,this.locale)}}let AQ=new Map,A0=(0,uA.forwardRef)(function({segment:e,...n},t){let r=(0,uA.useContext)(vm),o=hh(t),{segmentProps:i}=function(e,n,t){let r,o,i,a,s=(0,uA.useRef)(""),{locale:l,direction:c}=gT(),u=function(){var e;let{locale:n}=gT(),t=g1((e=_R)&&e.__esModule?e.default:e,"@react-aria/datepicker");return(0,uA.useMemo)(()=>{try{return new Intl.DisplayNames(n,{type:"dateTimeField"})}catch{return new AX(n,t)}},[n,t])}(),{ariaLabel:p,ariaLabelledBy:d,ariaDescribedBy:f,focusManager:h}=_U.get(n),m=e.isPlaceholder?"":e.text,g=(0,uA.useMemo)(()=>n.dateFormatter.resolvedOptions(),[n.dateFormatter]),b=gq({month:"long",timeZone:g.timeZone}),y=gq({hour:"numeric",hour12:g.hour12,timeZone:g.timeZone});if("month"!==e.type||e.isPlaceholder)"hour"!==e.type||e.isPlaceholder||(m=y.format(n.dateValue));else{let e=b.format(n.dateValue);m=e!==m?`${m} \u{2013} ${e}`:e}let{spinButtonProps:v}=AI({value:e.value??void 0,textValue:m,minValue:e.minValue,maxValue:e.maxValue,isDisabled:n.isDisabled,isReadOnly:n.isReadOnly||!e.isEditable,isRequired:n.isRequired,onIncrement:()=>{s.current="",n.increment(e.type)},onDecrement:()=>{s.current="",n.decrement(e.type)},onIncrementPage:()=>{s.current="",n.incrementPage(e.type)},onDecrementPage:()=>{s.current="",n.decrementPage(e.type)},onIncrementToMax:()=>{s.current="",n.incrementToMax(e.type)},onDecrementToMin:()=>{s.current="",n.decrementToMin(e.type)}}),$=(0,uA.useMemo)(()=>new(0,Aj.d)(l,{maximumFractionDigits:0}),[l]),A=()=>{if(e.text===e.placeholder&&h.focusPrevious(),!$.isValidPartialNumber(e.text)||n.isReadOnly||e.isPlaceholder)("dayPeriod"===e.type||"era"===e.type)&&n.clearSegment(e.type);else{let t=e.text.slice(0,-1),r=$.parse(t);0===(t=0===r?"":t).length||0===r?n.clearSegment(e.type):n.setSegment(e.type,r),s.current=t}},{startsWith:w}=(r=function(e){let{locale:n}=gT(),t=n+(e?Object.entries(e).sort((e,n)=>e[0]<n[0]?-1:1).join():"");if(AQ.has(t))return AQ.get(t);let r=new Intl.Collator(n,e);return AQ.set(t,r),r}({usage:"search",sensitivity:"base"}),o=(0,uA.useCallback)((e,n)=>0===n.length||(e=e.normalize("NFC"),n=n.normalize("NFC"),0===r.compare(e.slice(0,n.length),n)),[r]),i=(0,uA.useCallback)((e,n)=>0===n.length||(e=e.normalize("NFC"),n=n.normalize("NFC"),0===r.compare(e.slice(-n.length),n)),[r]),a=(0,uA.useCallback)((e,n)=>{if(0===n.length)return!0;e=e.normalize("NFC");let t=0,o=(n=n.normalize("NFC")).length;for(;t+o<=e.length;t++){let i=e.slice(t,t+o);if(0===r.compare(n,i))return!0}return!1},[r]),(0,uA.useMemo)(()=>({startsWith:o,endsWith:i,contains:a}),[o,i,a])),k=gq({hour:"numeric",hour12:!0}),x=(0,uA.useMemo)(()=>{let e=new Date;return e.setHours(0),k.formatToParts(e).find(e=>"dayPeriod"===e.type).value},[k]),C=(0,uA.useMemo)(()=>{let e=new Date;return e.setHours(12),k.formatToParts(e).find(e=>"dayPeriod"===e.type).value},[k]),E=gq({year:"numeric",era:"narrow",timeZone:"UTC"}),D=(0,uA.useMemo)(()=>{if("era"!==e.type)return[];let t=bT(new bv(1,1,1),n.calendar),r=n.calendar.getEras().map(e=>{let n=t.set({year:1,month:1,day:1,era:e}).toDate("UTC");return{era:e,formatted:E.formatToParts(n).find(e=>"era"===e.type).value}}),o=function(e){e.sort();let n=e[0],t=e[e.length-1];for(let e=0;e<n.length;e++)if(n[e]!==t[e])return e;return 0}(r.map(e=>e.formatted));if(o)for(let e of r)e.formatted=e.formatted.slice(o);return r},[E,n.calendar,e.type]),S=t=>{if(n.isDisabled||n.isReadOnly)return;let r=s.current+t;switch(e.type){case"dayPeriod":if(w(x,t))n.setSegment("dayPeriod",0);else if(w(C,t))n.setSegment("dayPeriod",1);else break;h.focusNext();break;case"era":{let e=D.find(e=>w(e.formatted,t));e&&(n.setSegment("era",e.era),h.focusNext());break}case"day":case"hour":case"minute":case"second":case"month":case"year":{if(!$.isValidPartialNumber(r))return;let o=$.parse(r),i=o;if(void 0!==e.maxValue&&o>e.maxValue&&(i=$.parse(t)),isNaN(o))return;n.setSegment(e.type,i),void 0!==e.maxValue&&(Number(o+"0")>e.maxValue||r.length>=String(e.maxValue).length)?(s.current="",h.focusNext()):s.current=r}}};yn((0,uA.useRef)("u">typeof document?document:null),"selectionchange",()=>{let e=window.getSelection();e?.anchorNode&&h2(t.current,e?.anchorNode)&&e.collapse(t.current)});let M=(0,uA.useRef)("");yn(t,"beforeinput",r=>{if(t.current)switch(r.preventDefault(),r.inputType){case"deleteContentBackward":case"deleteContentForward":$.isValidPartialNumber(e.text)&&!n.isReadOnly&&A();break;case"insertCompositionText":M.current=t.current.textContent,t.current.textContent=t.current.textContent;break;default:null!=r.data&&S(r.data)}}),yn(t,"input",e=>{let{inputType:n,data:r}=e;"insertCompositionText"===n&&(t.current&&(t.current.textContent=M.current),null!=r&&(w(x,r)||w(C,r))&&S(r))}),hy(()=>{let e=t.current;return()=>{((e=document)=>e.activeElement)()===e&&(h.focusPrevious()||h.focusNext())}},[t,h]);let z=mf()||"timeZoneName"===e.type?{role:"textbox","aria-valuemax":null,"aria-valuemin":null,"aria-valuetext":null,"aria-valuenow":null}:{};e===(0,uA.useMemo)(()=>n.segments.find(e=>e.isEditable),[n.segments])||n.isInvalid||(f=void 0);let P=hM(),O=!n.isDisabled&&!n.isReadOnly&&e.isEditable,T="literal"===e.type?"":u.of(e.type),B=b6({"aria-label":`${T}${p?`, ${p}`:""}${d?", ":""}`,"aria-labelledby":d});if("literal"===e.type)return{segmentProps:{"aria-hidden":!0}};let I={caretColor:"transparent"};if("rtl"===c){I.unicodeBidi="embed";let n=g[e.type];("numeric"===n||"2-digit"===n)&&(I.direction="ltr")}return{segmentProps:hO(v,B,{id:P,...z,"aria-invalid":n.isInvalid?"true":void 0,"aria-describedby":f,"aria-readonly":n.isReadOnly||!e.isEditable?"true":void 0,"data-placeholder":e.isPlaceholder||void 0,contentEditable:O,suppressContentEditableWarning:O,spellCheck:O?"false":void 0,autoCorrect:O?"off":void 0,[parseInt(uw().version,10)>=17?"enterKeyHint":"enterkeyhint"]:O?"next":void 0,inputMode:n.isDisabled||"dayPeriod"===e.type||"era"===e.type||!O?void 0:"numeric",tabIndex:n.isDisabled?void 0:0,onKeyDown:e=>{if("a"===e.key&&(mu()?e.metaKey:e.ctrlKey)&&e.preventDefault(),!e.ctrlKey&&!e.metaKey&&!e.shiftKey&&!e.altKey)switch(e.key){case"Backspace":case"Delete":e.preventDefault(),e.stopPropagation(),A()}},onFocus:()=>{s.current="",t.current&&ya(t.current,{containingElement:yr(t.current)});let e=window.getSelection();e?.collapse(t.current)},style:I,onPointerDown(e){e.stopPropagation()},onMouseDown(e){e.stopPropagation()}})}}(e,r,o),{focusProps:a,isFocused:s,isFocusVisible:l}=gs(),{hoverProps:c,isHovered:u}=gd({...n,isDisabled:r.isDisabled||"literal"===e.type}),p=function(e){let{className:n,style:t,children:r,defaultClassName:o,defaultChildren:i,defaultStyle:a,values:s}=e;return(0,uA.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:e??o,style:l||a?{...a,...l}:void 0,children:c??i,"data-rac":""}},[n,t,r,o,i,a,s])}({...n,values:{...e,isReadOnly:!e.isEditable,isInvalid:r.isInvalid,isDisabled:r.isDisabled,isHovered:u,isFocused:s,isFocusVisible:l},defaultChildren:e.text}),d=(0,uA.useCallback)(e=>{e.stopPropagation()},[]);return(0,di.jsx)("span",{...hO(hZ(n),i,a,c),...p,ref:o,style:i.style,"data-placeholder":e.isPlaceholder||void 0,"data-invalid":r.isInvalid||void 0,"data-readonly":!e.isEditable||void 0,"data-disabled":r.isDisabled||void 0,"data-type":e.type,"data-hovered":u||void 0,"data-focused":s||void 0,"data-focus-visible":l||void 0,onClick:d})}),A1={short:!1,size:"md"},A2=(0,uA.forwardRef)(function(e,n){let{className:t,defaultValue:r,isDisabled:o,invalid:i,invalidText:a,isInvalid:s,label:l,labelText:c,light:u,maxDate:p,minDate:d,onChange:f,onChangeRaw:h,short:m,size:g,value:b,...y}={...A1,...e},{calendar:v,intlLocale:$,today_:A}=AS(),w=(0,uA.useId)(),k=!!(c??l),x=(0,uA.useMemo)(()=>$O(r,v),[r,v]),C=(0,uA.useMemo)(()=>$O(b,v,!0),[b,v]),E=(0,uA.useMemo)(()=>$O(p,v),[p,v]),D=(0,uA.useMemo)(()=>$O(d??AM,v),[d,v]),S=(0,uA.useMemo)(()=>i||s,[i,s]),M=(0,uA.useMemo)(()=>(h&&f&&console.error("An OpenmrsDatePicker component was created with both onChange and onChangeRaw handlers defined. Only onChangeRaw will be used."),h??(e=>f?.($T(e)))),[h,f]);return(0,di.jsx)($P,{locale:$.toString(),children:(0,di.jsx)("div",{className:ds()("cds--form-item",t),children:(0,di.jsx)(hB,{values:[[AD,$]],children:(0,di.jsxs)($M,{className:ds()("cds--date-picker","cds--date-picker--single",{"cds--date-picker--short":m,"cds--date-picker--light":u}),defaultValue:x,isDisabled:o,isInvalid:S,maxValue:E,minValue:D,value:C,shouldForceLeadingZeros:"en"===$.language||void 0,...y,onChange:M,children:[(0,di.jsxs)("div",{className:"cds--date-picker-container",children:[k&&(0,di.jsx)(vP,{className:ds()("cds--label",{"cds--label--disabled":o}),htmlFor:w,children:c??l}),(0,di.jsxs)(_m,{className:AH.inputGroup,children:[(0,di.jsx)(AJ,{id:k?w:void 0,ref:n,className:ds()("cds--date-picker-input__wrapper",AH.inputWrapper,{[AH.inputWrapperSm]:"sm"===g,[AH.inputWrapperMd]:"md"===g||!g||0===g.length,[AH.inputWrapperLg]:"lg"===g}),children:e=>"era"!==e.type?(0,di.jsx)(A0,{className:AH.inputSegment,segment:e}):(0,di.jsx)(uw().Fragment,{})}),(0,di.jsx)(gb,{className:ds()(AH.flatButton,{[AH.flatButtonSm]:"sm"===g,[AH.flatButtonMd]:"md"===g||!g||0===g.length,[AH.flatButtonLg]:"lg"===g}),children:(0,di.jsx)(AZ,{})})]}),(0,di.jsx)(vD,{className:AH.invalidText,children:a})]}),(0,di.jsx)(AY,{variant:"single",today_:A})]})})})})}),A3=(0,uA.forwardRef)(function({className:e,defaultValue:n,invalid:t,invalidText:r,isDisabled:o,isInvalid:i,label:a,labelText:s,light:l,maxDate:c,minDate:u,onChange:p,onChangeRaw:d,size:f="md",value:h,...m},g){let{calendar:b,intlLocale:y,today_:v}=AS(),$=(0,uA.useId)(),A=!!(s??a),w=(0,uA.useMemo)(()=>{if(h)return{start:$O(h[0],b,!1),end:$O(h[1],b,!1)}},[h,b]),k=(0,uA.useMemo)(()=>{if(n)return{start:$O(n[0],b,!1),end:$O(n[1],b,!1)}},[n,b]),x=(0,uA.useMemo)(()=>$O(u??AM,b,!0),[u,b]),C=(0,uA.useMemo)(()=>$O(c,b,!0),[c,b]),E=(0,uA.useMemo)(()=>t||i,[t,i]),D=(0,uA.useMemo)(()=>(d&&p&&console.error("An OpenmrsDateRangePicker component was created with both onChange and onChangeRaw handlers defined. Only onChangeRaw will be used."),d??(e=>p?.([$T(e.start),$T(e.end)]))),[d,p]);return(0,di.jsx)($P,{locale:y.toString(),children:(0,di.jsx)("div",{className:ds()("cds--form-item",e),children:(0,di.jsx)(hB,{values:[[AD,y]],children:(0,di.jsx)($z,{id:A?$:void 0,className:ds()("cds--date-picker",{"cds--date-picker--light":l,"cds--date-picker--disabled":o}),isInvalid:E,shouldForceLeadingZeros:"en"===y.language||void 0,maxValue:C,minValue:x,value:w,defaultValue:k,ref:g,isDisabled:o,...m,onChange:D,children:(0,di.jsxs)("div",{className:"cds--date-picker-container",children:[A&&(0,di.jsx)(vP,{className:ds()("cds--label",{"cds--label--disabled":o}),htmlFor:$,children:s??a}),(0,di.jsxs)(_m,{className:AH.inputGroup,children:[(0,di.jsxs)("div",{className:ds()(AH.inputsWrapper,{[AH.inputsWrapperSm]:"sm"===f,[AH.inputsWrapperMd]:"md"===f||!f||0===f.length,[AH.inputsWrapperLg]:"lg"===f}),children:[(0,di.jsx)(vb,{className:ds()("cds--date-picker-input__wrapper",AH.startInput,AH.dateInputWrapper),slot:"start",children:e=>(0,di.jsx)(A0,{className:AH.inputSegment,segment:e})}),(0,di.jsx)("div",{className:AH.separator,children:(0,di.jsx)("span",{"aria-hidden":"true","data-readonly":!0,children:"–"})}),(0,di.jsx)(vb,{className:ds()("cds--date-picker-input__wrapper",AH.endInput,AH.dateInputWrapper),slot:"end",children:e=>(0,di.jsx)(A0,{className:AH.inputSegment,segment:e})})]}),(0,di.jsx)(gb,{className:ds()(AH.flatButton,{[AH.flatButtonSm]:"sm"===f,[AH.flatButtonMd]:"md"===f||!f||0===f.length,[AH.flatButtonLg]:"lg"===f}),children:(0,di.jsx)(AZ,{})})]}),(0,di.jsx)(vD,{className:AH.invalidText,children:r}),(0,di.jsx)(AY,{variant:"range",today_:v,minDate:x,maxDate:C})]})})})})})});var A5=t(89124),A4={};A4.styleTagTransform=d_(),A4.setAttributes=dm(),A4.insert=df().bind(null,"head"),A4.domAPI=dp(),A4.insertStyleElement=db(),dc()(A5.A,A4);let A6=A5.A&&A5.A.locals?A5.A.locals:void 0,A8=({diagnoses:e})=>{let{diagnosisTags:n}=pm({externalModuleName:"@openmrs/esm-styleguide"});return(0,di.jsx)("div",{className:A6.container,children:e.map(e=>{let{rank:t,uuid:r,display:o}=e,i=n[1===t?"primaryColor":"secondaryColor"];return(0,di.jsx)(dk.vwO,{type:i,children:o},r)})})};var A7=t(87770),A9={};A9.styleTagTransform=d_(),A9.setAttributes=dm(),A9.insert=df().bind(null,"head"),A9.domAPI=dp(),A9.insertStyleElement=db(),dc()(A7.A,A9);let we=A7.A&&A7.A.locals?A7.A.locals:void 0,wn=({width:e="64",height:n="64"})=>(0,di.jsx)("svg",{width:e,height:n,viewBox:"0 0 64 64",children:(0,di.jsx)("use",{href:"#omrs-empty-data-illustration"})}),wt=e=>{let n="tablet"===pG(),t=e.launchForm;return(0,di.jsx)(dk.Wdr,{className:we.layer,children:(0,di.jsxs)(dk.FAs,{className:we.tile,children:[(0,di.jsx)("div",{className:n?we.tabletHeading:we.desktopHeading,children:(0,di.jsx)("h4",{children:e.headerTitle})}),(0,di.jsx)(wn,{}),(0,di.jsx)("p",{className:we.content,children:o2("emptyStateText","There are no {{displayText}} to display",{displayText:e.displayText})}),(0,di.jsx)("p",{className:we.action,children:t&&(0,di.jsx)(dk.$nd,{onClick:()=>t(),kind:"ghost",size:n?"lg":"sm",children:o2("recordNewEntry","Record {{ displayText }}",{displayText:e.displayText})})})]})})};var wr=t(88480),wo={};wo.styleTagTransform=d_(),wo.setAttributes=dm(),wo.insert=df().bind(null,"head"),wo.domAPI=dp(),wo.insertStyleElement=db(),dc()(wr.A,wo);let wi=wr.A&&wr.A.locals?wr.A.locals:void 0,wa=({error:e,headerTitle:n})=>{let t="tablet"===pG();return(0,di.jsx)(dk.Wdr,{children:(0,di.jsxs)(dk.FAs,{className:wi.tile,children:[(0,di.jsx)("div",{className:t?wi.tabletHeading:wi.desktopHeading,children:(0,di.jsx)("h4",{children:n})}),(0,di.jsxs)("p",{className:wi.errorMessage,children:[o2("error","Error")," ",`${e?.response?.status}: `,e?.response?.statusText]}),(0,di.jsx)("p",{className:wi.errorCopy,children:o2("errorCopy")})]})})},ws=wa;var wl=t(15764),wc={};wc.styleTagTransform=d_(),wc.setAttributes=dm(),wc.insert=df().bind(null,"head"),wc.domAPI=dp(),wc.insertStyleElement=db(),dc()(wl.A,wc);let wu=wl.A&&wl.A.locals?wl.A.locals:void 0,wp=uw().forwardRef((e,n)=>{let{slotName:t,basePath:r,componentContext:o,state:i}=pH(),a=window.location??{pathname:""},s=uR(t??"");return e.isChildOfHeader&&t&&s.length>0?(0,di.jsxs)(dk.f8J,{"aria-label":o2("leftNavigation","Left navigation"),className:wu.leftNav,expanded:!0,isFixedNav:!0,ref:n,...e,children:[(0,di.jsx)(uW,{name:"global-nav-menu-slot"}),t?(0,di.jsx)(pa,{value:o,fallback:(0,di.jsx)(uW,{name:t,state:{basePath:r,currentPath:a,...i}}),children:(0,di.jsx)(uP.Provider,{value:o,children:(0,di.jsx)(uW,{name:t,state:{basePath:r,currentPath:a,...i}})})}):null]}):null});var wd=t(48500),wf={};wf.styleTagTransform=d_(),wf.setAttributes=dm(),wf.insert=df().bind(null,"head"),wf.domAPI=dp(),wf.insertStyleElement=db(),dc()(wd.A,wf);let wh=wd.A&&wd.A.locals?wd.A.locals:void 0,wm=({selectedLocationUuid:e,defaultLocationUuid:n,locationTag:t,locationsPerRequest:r=50,onChange:o})=>{let[i,a]=(0,uA.useState)(""),s=(0,uA.useId)(),{location:l}=function(e){let n=e?`/ws/fhir2/R4/Location?_id=${e}`:null,{data:t,error:r,isLoading:o}=(0,p_.A)(n,rY,{shouldRetryOnError:e=>!!e?.response?.status&&e.response.status>=500});return(0,uA.useMemo)(()=>({location:t?.data?.entry?t.data.entry[0]:null,error:n?r:null,isLoading:!!n&&o}),[t,o,r,n])}(n),{locations:c,isLoading:u,hasMore:p,loadingNewData:d,error:f,setPage:h}=function(e,n=0,t=""){let r=py(t),{data:o,isLoading:i,isValidating:a,setSize:s,error:l}=pI(function(t,o){if(o){let e=o.data?.link?.find(e=>"next"===e.relation);if(!e)return null;let n=new URL(e.url);return n.origin===window.location.origin?e.url:new URL(`${n.pathname}${n.search?`?${n.search}`:""}`,window.location.origin).toString()}let i=`${rq}/Location?`,a=new URLSearchParams;return a.append("_summary","data"),n&&a.append("_count",""+n),t&&a.append("_getpagesoffset",""+t*n),e&&a.append("_tag",e),"string"==typeof r&&""!==r&&a.append("name:contains",r),i+a.toString()},rY);return(0,uA.useMemo)(()=>({locations:o?.length?o?.flatMap(e=>e?.data?.entry??[]):[],isLoading:i,totalResults:o?.[0]?.data?.total,hasMore:!!o?.length&&o?.[o.length-1]?.data?.link?.some(e=>"next"===e.relation),loadingNewData:a,error:l||null,setPage:s}),[i,o,a,s,l])}(t,r,i),m=(0,uA.useMemo)(()=>l&&!i&&n?[l,...c.filter(({resource:e})=>e.id!==n)]:c??[],[l,c,n,i]),g=(0,uA.useCallback)(e=>{o(),a(e.trim())},[o]),b=pJ((0,uA.useCallback)(()=>{!d&&p&&h(e=>e+1)},[d,p,h])),y=p?Math.max(0,Math.floor(m.length-r/2)):-1;return(0,di.jsxs)(di.Fragment,{children:[(0,di.jsx)(dk.vji,{"aria-describedby":f?`${s}-error`:void 0,labelText:o2("searchForLocation"),id:s,placeholder:o2("searchForLocation"),onChange:e=>g(e.target.value),size:"lg"}),f&&(0,di.jsx)("div",{className:wh.errorNotification,id:`${s}-error`,children:(0,di.jsx)(dk.jeF,{kind:"error",subtitle:o2("errorLoadingLoginLocations","Unable to load login locations. Please try again or contact support if the problem persists."),title:o2("error","Error")})}),(0,di.jsx)("div",{className:wh.searchResults,children:u?(0,di.jsx)("div",{className:wh.loadingContainer,children:Array.from({length:5}).map((e,n)=>(0,di.jsx)(dk.Psq,{className:wh.radioButtonSkeleton,role:"progressbar"},n))}):(0,di.jsxs)(di.Fragment,{children:[(0,di.jsx)("div",{className:wh.locationResultsContainer,children:m.length>0?(0,di.jsx)(dk.zWQ,{name:"loginLocations",onChange:e=>{o(e?.toString())},orientation:"vertical",valueSelected:e,children:m.map((e,n)=>(0,di.jsx)(dk.aaP,{className:wh.locationRadioButton,id:e.resource.id,labelText:(0,di.jsx)("span",{ref:n===y?b:null,children:e.resource.name}),name:e.resource.name,value:e.resource.id},e.resource.id))}):(0,di.jsx)("div",{className:wh.emptyState,children:(0,di.jsx)("p",{className:wh.locationNotFound,children:o2("noResultsToDisplay")})})}),d&&(0,di.jsx)("div",{className:wh.loadingIcon,children:(0,di.jsx)(dk.OuH,{description:o2("loading")})})]})})]})},wg=["NORMAL","HIGH","CRITICALLY_HIGH","OFF_SCALE_HIGH","LOW","CRITICALLY_LOW","OFF_SCALE_LOW"],wb=["critically_low","critically_high","high","low","normal","off_scale_low","off_scale_high"];function wy(e){if(e)return"--"===e?"normal":wg.includes(e)?e.toLowerCase():wb.includes(e)?e:"normal"}function w_(e,n){if(!n||null==e||""===e)return"normal";let t="string"==typeof e?Number.parseFloat(e):e;return Number.isNaN(t)?"normal":null!==n.hiAbsolute&&void 0!==n.hiAbsolute&&t>n.hiAbsolute?"off_scale_high":null!==n.hiCritical&&void 0!==n.hiCritical&&t>=n.hiCritical?"critically_high":null!==n.hiNormal&&void 0!==n.hiNormal&&t>n.hiNormal?"high":null!==n.lowAbsolute&&void 0!==n.lowAbsolute&&t<n.lowAbsolute?"off_scale_low":null!==n.lowCritical&&void 0!==n.lowCritical&&t<=n.lowCritical?"critically_low":null!==n.lowNormal&&void 0!==n.lowNormal&&t<n.lowNormal?"low":"normal"}function wv(e,n){let t=null;e&&(t=n?`${rU}/conceptreferencerange/?patient=${n}&concept=${e}&v=full`:`${rU}/conceptreferencerange/?concept=${e}&v=full`);let{data:r,error:o,isLoading:i}=(0,p_.A)(t,rY),a=r?.data?.results?.[0];return{referenceRange:a?{hiNormal:a.hiNormal??null,hiAbsolute:a.hiAbsolute??null,hiCritical:a.hiCritical??null,lowNormal:a.lowNormal??null,lowAbsolute:a.lowAbsolute??null,lowCritical:a.lowCritical??null}:void 0,error:o,isLoading:i}}var w$=t(4112),wA={};wA.styleTagTransform=d_(),wA.setAttributes=dm(),wA.insert=df().bind(null,"head"),wA.domAPI=dp(),wA.insertStyleElement=db(),dc()(w$.A,wA);let ww=w$.A&&w$.A.locals?w$.A.locals:void 0,wk=({value:e,unit:n,label:t,interpretation:r,referenceRange:o,conceptUuid:i,variant:a="card",patientUuid:s})=>{let l=(0,uA.useId)(),{referenceRange:c,isLoading:u}=wv(o||r?void 0:i,s),p=o??c,d=(0,uA.useMemo)(()=>r?wy(r):p&&!u?w_(e,p):"normal",[r,p,e,u])??"normal",f="critically_low"===d||"critically_high"===d||"off_scale_low"===d||"off_scale_high"===d,h="normal"!==d,m=t?`omrs-numeric-obs-label-${t.replaceAll(/\s+/g,"-").toLowerCase()}-${l}`:void 0,g=`omrs-numeric-obs-value-${l}`,b=`omrs-numeric-obs-unit-${l}`,y=null!=e&&""!==e,v=y?e:o2("notAvailable","Not available"),$=ds()({[ww["critically-low"]]:"critically_low"===d||"off_scale_low"===d,[ww["critically-high"]]:"critically_high"===d||"off_scale_high"===d,[ww.low]:"low"===d,[ww.high]:"high"===d,[ww["off-scale-low"]]:"off_scale_low"===d,[ww["off-scale-high"]]:"off_scale_high"===d}),A=ds()({[ww.container]:!0,[ww.card]:!0,[ww["critical-value"]]:f,[ww["abnormal-value"]]:h&&!f}),w=ds()({[ww.cell]:!0,[$]:!0});return"cell"===a?(0,di.jsxs)("div",{className:w,children:[v,y&&n?` ${n}`:""]}):(0,di.jsxs)("section",{className:A,"data-testid":"numeric-observation-card",children:[t&&(0,di.jsxs)("div",{className:ww["label-container"],children:[(0,di.jsx)("span",{id:m,className:ww.label,children:t}),h&&(0,di.jsx)("span",{className:ww[d.replace("_","-")],title:o2("abnormalValue","Abnormal value")})]}),(0,di.jsxs)("div",{className:ww["value-container"],children:[(0,di.jsx)("span",{id:g,"aria-labelledby":m&&b?`${m} ${b}`:m||b||void 0,className:ww.value,children:v}),y&&n&&(0,di.jsx)("span",{id:b,className:ww.units,children:n})]})]})},wx=L("modalState",{modalContainer:null,modalStack:[]});function wC(e,n={},t=()=>{}){let r=()=>{let e,n,r=wx.getState().modalStack.find(e=>e.onClose===t);r&&(n=(e=wx.getState()).modalStack.map(e=>e===r?{...e,state:"TO_BE_DELETED"}:e),wx.setState({...e,modalStack:n}))};if(function(e){let n=ux.getState().modals[e];if(!n){let r=c8(e);if(r){var t;n={name:e,load:r.load,moduleName:r.moduleName},console.warn(`Modal ${e} was registered as an extension. This is deprecated and will be removed in the future. Please register it in the "modals" section of routes.json instead of the "extensions" section.`),t=n,ux.setState(e=>(e.modals[t.name]=t,e))}}return n}(e)){var o;let i,a;o={state:"NEW",onClose:t,modalName:e,props:{close:r,...n}},a=[o,...(i=wx.getState()).modalStack],wx.setState({...i,modalStack:a})}else z(`Failed to launch modal. Please notify your administrator. Modal name: "${e}"`);return r}window.getComputedStyle(document.body).overflow;var wE=t(66401);let wD=new er.Subject,wS=0,wM=new er.Subject,wz=0;function wP(e){var n;e&&("string"==typeof(n=e.description)?n.trim().length>0:"object"==typeof n&&(n instanceof Error||!(0,wE.A)(n)))?(e.description instanceof Error&&(e.description=e.description.toLocaleString()),setTimeout(()=>{wD.next({...e,id:wS++})},0)):console.error("showNotification must be called with an object having a 'description' property that is a non-empty string or object")}function wO(e){var n;e&&("string"==typeof(n=e.actionButtonLabel)?n.trim().length>0:"object"==typeof n&&!(0,wE.A)(n))?setTimeout(()=>{wM.next({...e,id:wz++})},0):console.error("showActionableNotification must be called with an actionButtonLabel that is a non-empty string")}var wT=t(292),wB={};wB.styleTagTransform=d_(),wB.setAttributes=dm(),wB.insert=df().bind(null,"head"),wB.domAPI=dp(),wB.insertStyleElement=db(),dc()(wT.A,wB);let wI=wT.A&&wT.A.locals?wT.A.locals:void 0,wN=e=>{if("children"in e){let{children:n,className:t,...r}=e;return(0,di.jsx)("div",{className:ds()(wI.pageHeader,t),...r,children:n})}{let{title:n,illustration:t,className:r,...o}=e;return(0,di.jsx)("div",{className:ds()(wI.pageHeader,r),...o,children:(0,di.jsx)(wj,{title:n,illustration:t})})}},wj=({title:e,illustration:n,className:t})=>{let[r,o]=(0,uA.useState)(null);return(0,uA.useEffect)(()=>{nK("@openmrs/esm-styleguide").then(e=>{o(e)})},[]),(0,di.jsxs)("div",{className:ds()(wI.pageHeaderContent,t),children:[n,(0,di.jsxs)("div",{className:wI.pageLabels,children:[r?.implementationName&&(0,di.jsx)("p",{children:o2(r.implementationName)}),(0,di.jsx)("p",{className:wI.pageName,children:e})]})]})};var wR=t(72886),wF={};wF.styleTagTransform=d_(),wF.setAttributes=dm(),wF.insert=df().bind(null,"head"),wF.domAPI=dp(),wF.insertStyleElement=db(),dc()(wR.A,wF);let wL=wR.A&&wR.A.locals?wR.A.locals:void 0,wW=({totalItems:e,pageSize:n,onPageNumberChange:t,pageNumber:r,dashboardLinkUrl:o,currentItems:i,dashboardLinkLabel:a})=>{let{pageSizes:s,pageItemsCount:l}=pQ(n,e,r,i),c="tablet"===pG(),u=o2("paginationItemsCount","{{pageItemsCount}} / {{totalItems}} items",{totalItems:e,pageItemsCount:l});return(0,di.jsx)(di.Fragment,{children:e>0&&(0,di.jsxs)("div",{className:ds()({[wL.tablet]:c,[wL.desktop]:!c}),children:[(0,di.jsxs)("div",{children:[u,o&&(0,di.jsx)(uk,{to:o,className:wL.configurableLink,children:a??o2("seeAll","See all")})]}),(0,di.jsx)(dk.dKS,{className:wL.pagination,page:r,pageSize:n,pageSizes:s,totalItems:e,onChange:t,pageRangeText:(e,n)=>o2("paginationOfPages","of {{count}} pages",{count:n}),size:c?"lg":"sm"})]})})};function wV(e){return wU(wH(e,"usual","official"))}function wG(e){return wV(e)}function wU(e){var n;let t;return e?e.text??(t=(n=e).given??[],(n.family?t.concat(n.family):t).join(" ")):""}function wq(e){return wU(e)}function wH(e,...n){for(let t of(0==n.length&&(n=["usual"]),n)){let n=e.name?.find(e=>{var n,r;return n=e,r=t,n.use?n.use===r:"usual"===r});if(n)return n}}function wK(e,n=p6()){let t=p6(n),r=A$(e,t);if(null==r)return null;let o=t.diff(r,"hours"),i=t.diff(r,"days"),a=t.diff(r,"weeks"),s=t.diff(r,"months"),l=t.diff(r,"years"),c={};if(o<2)c.minutes=t.diff(r,"minutes");else if(i<2)c.hours=o;else if(a<4)c.days=i;else if(l<1){let e=t.subtract(a,"weeks").diff(r,"days");c.weeks=a,c.days=e}else if(l<2){let e=t.subtract(s,"months").diff(r,"days");c.months=s,c.days=e}else if(l<18){let e=t.subtract(l,"year").diff(r,"months");c.years=l,c.months=e}else c.years=l;return c}function wY(e,n=p6()){let t=wK(e,n);if(null==t)return null;let r={style:"short",localeMatcher:"lookup"};return"minutes"in t&&0===t.minutes&&(r.minutesDisplay="always"),Av(t,r)}var wJ=t(46010),wZ={};wZ.styleTagTransform=d_(),wZ.setAttributes=dm(),wZ.insert=df().bind(null,"head"),wZ.domAPI=dp(),wZ.insertStyleElement=db(),dc()(wJ.A,wZ);let wX=wJ.A&&wJ.A.locals?wJ.A.locals:void 0;function wQ({showIdentifierLabel:e,type:n,value:t}){return(0,di.jsx)("span",{className:wX.primaryIdentifier,children:(0,di.jsxs)(dk.vwO,{className:wX.tag,type:"gray",children:[e&&n?.text&&(0,di.jsxs)("span",{className:wX.label,children:[n.text,": "]}),(0,di.jsx)("span",{className:wX.value,children:t})]})})}function w0({showIdentifierLabel:e,type:n,value:t}){return(0,di.jsxs)(dk.lRv,{className:wX.secondaryIdentifier,id:`patient-banner-identifier-${t}`,children:[e&&(0,di.jsxs)("span",{className:wX.label,children:[n?.text,": "]}),(0,di.jsx)("span",{className:wX.value,children:t})]})}function w1({identifiers:e,showIdentifierLabel:n}){let{excludePatientIdentifierCodeTypes:t}=pm(),{primaryIdentifierCode:r}=p2(),o=e?.filter(e=>{let n=e.type?.coding?.[0]?.code;return n&&!t?.uuids.includes(n)})??[];return(0,di.jsx)(di.Fragment,{children:o?.length?o.map(({value:e,type:t},i)=>(0,di.jsxs)(uw().Fragment,{children:[(0,di.jsx)("span",{className:wX.identifier,children:t?.coding?.[0]?.code===r?(0,di.jsx)(wQ,{showIdentifierLabel:n,type:t,value:e}):(0,di.jsx)(w0,{showIdentifierLabel:n,type:t,value:e})}),i<o.length-1&&(0,di.jsx)("span",{className:wX.separator,children:"\xb7"})]},e)):""})}let w2={Female:fl,Male:fc,Other:fu,Unknown:fp},w3=({gender:e})=>{let n=w2[e];return n?(0,di.jsx)(n,{fill:"#525252"}):null},w5={male:"Male",female:"Female",other:"Other",unknown:"Unknown"};function w4({patient:e,renderedFrom:n}){var t;let r,o,i=wV(e),a=e?.gender&&(o=w5[r=(t=e.gender).toLowerCase()]??"Unknown",{displayText:o2(r,t),iconKey:o}),s=(0,uA.useMemo)(()=>({patientUuid:e.id,patient:e,renderedFrom:n}),[e.id,e,n]);return(0,di.jsxs)("div",{className:wX.patientInfo,children:[(0,di.jsx)("div",{className:ds()(wX.row,wX.patientNameRow),children:(0,di.jsxs)("div",{className:wX.flexRow,children:[(0,di.jsx)("span",{className:wX.patientName,children:i}),a&&(0,di.jsxs)("div",{className:wX.gender,children:[(0,di.jsx)(w3,{gender:a.iconKey}),(0,di.jsx)("span",{children:a.displayText})]}),(0,di.jsx)(uW,{className:wX.tagsSlot,name:"patient-banner-tags-slot",state:s})]})}),(0,di.jsxs)("div",{className:wX.demographics,children:[e.birthDate&&(0,di.jsxs)(di.Fragment,{children:[(0,di.jsx)("span",{children:wY(e.birthDate)}),(0,di.jsx)("span",{className:wX.separator,children:"\xb7"}),(0,di.jsx)("span",{children:Ah(e.birthDate,{time:!1})}),(0,di.jsx)("span",{className:wX.separator,children:"\xb7"})]}),(0,di.jsx)(w1,{identifiers:e.identifier,showIdentifierLabel:!0}),(0,di.jsx)(uW,{className:wX.extensionSlot,name:"patient-banner-bottom-slot",state:s})]})]})}var w6=t(81673),w8=t(9102),w7={};w7.styleTagTransform=d_(),w7.setAttributes=dm(),w7.insert=df().bind(null,"head"),w7.domAPI=dp(),w7.insertStyleElement=db(),dc()(w8.A,w7);let w9=w8.A&&w8.A.locals?w8.A.locals:void 0;function ke({patient:e,patientUuid:n,actionsSlotName:t,additionalActionsSlotState:r}){let[o,i]=(0,uA.useState)(!1),{extensions:a}=uF(t),s="tablet"===pG(),l=pY(()=>i(!1),o),c=(0,uA.useRef)(null),u=(0,uA.useRef)(null),p=(0,uA.useId)(),d=`patient-actions-menu-trigger-${p}`,f=`patient-actions-menu-${p}`,h=(0,uA.useCallback)(()=>i(e=>!e),[]),m=(0,uA.useCallback)(()=>{i(!1),c.current?.focus()},[]),g=(0,uA.useCallback)(e=>{if("Escape"===e.key&&o){e.stopPropagation(),m();return}if(("ArrowDown"===e.key||"ArrowUp"===e.key)&&o){e.preventDefault();let n=u.current?.querySelectorAll('[role="menuitem"]:not([disabled])');if(!n?.length)return;let t=document.activeElement?.closest?.('[role="menuitem"]')??document.activeElement,r=Array.from(n).indexOf(t);if(-1===r)return void n["ArrowDown"===e.key?0:n.length-1]?.focus();let o=r+("ArrowDown"===e.key?1:-1),i=o<0?n.length-1:o>=n.length?0:o;n[i]?.focus()}},[m,o]);(0,uA.useEffect)(()=>{if(o&&u.current){let e=u.current.querySelector('[role="menuitem"]:not([disabled])');e?.focus()}},[o]);let b=(0,uA.useMemo)(()=>({patientUuid:n,patient:e,closeMenu:m,...r}),[n,e,m,r]);return 0===a.length?null:(0,di.jsx)("div",{className:w9.overflowMenuContainer,children:(0,di.jsxs)("div",{"data-overflow-menu":!0,className:ds()("cds--overflow-menu",dE.container),ref:l,children:[(0,di.jsxs)("button",{className:ds()("cds--btn","cds--btn--ghost","cds--overflow-menu__trigger",{"cds--overflow-menu--open":o},dE.overflowMenuButton),"aria-controls":f,"aria-expanded":o,"aria-haspopup":"true",id:d,onClick:h,onKeyDown:g,ref:c,children:[(0,di.jsx)("span",{className:w9.actionsButtonText,children:o2("actions","Actions")})," ",(0,di.jsx)(w6.CH,{size:16,style:{marginLeft:"0.5rem",fill:"#78A9FF"}})]}),(0,di.jsxs)("div",{className:ds()("cds--overflow-menu-options","cds--overflow-menu--flip",dE.menu,{[dE.show]:o}),"aria-labelledby":d,"data-floating-menu-direction":"bottom",id:f,onKeyDown:g,ref:u,role:"menu",tabIndex:-1,children:[(0,di.jsx)("ul",{className:ds()("cds--overflow-menu-options__content",{"cds--overflow-menu-options--lg":s}),children:(0,di.jsx)(uW,{name:t,state:b},t)}),(0,di.jsx)("span",{})]})]})})}function kn({showContactDetails:e,toggleContactDetails:n,className:t}){return(0,di.jsx)(dk.$nd,{className:t,iconDescription:"Toggle contact details",kind:"ghost",onClick:n,renderIcon:e?d8:d5,children:e?o2("showLess","Show less"):o2("showMore","Show more")})}var kt=t(95804),kr={};kr.styleTagTransform=d_(),kr.setAttributes=dm(),kr.insert=df().bind(null,"head"),kr.domAPI=dp(),kr.insertStyleElement=db(),dc()(kt.A,kr);let ko=kt.A&&kt.A.locals?kt.A.locals:void 0,ki=({patientUuid:e})=>{let{cohorts:n=[],isLoading:t}=function(e){let n=e?`${rU}/cohortm/cohortmember?patient=${e}&v=custom:(uuid,patient:ref,cohort:(uuid,name,startDate,endDate))`:null,{data:t,isLoading:r}=(0,u5.Ay)(n,rY),o=t?.data?.results.map(e=>({uuid:e.cohort.uuid,name:e.cohort.name,startDate:e.cohort.startDate,endDate:e.cohort.endDate}));return(0,uA.useMemo)(()=>({cohorts:o,isLoading:r}),[r,o])}(e);return(0,di.jsxs)(di.Fragment,{children:[(0,di.jsxs)("p",{className:ko.heading,children:[o2("patientLists","Patient Lists")," (",n?.length??0,")"]}),t?(0,di.jsx)(dk.OuH,{description:`${o2("loading","Loading")} ...`,role:"progressbar"}):(0,di.jsxs)("ul",{children:[(()=>{if(n?.length>0){let e=n.sort((e,n)=>Al(e?.startDate).getTime()-Al(n?.startDate).getTime()).slice(0,3);return e?.map(e=>(0,di.jsx)("li",{children:(0,di.jsx)(uk,{to:`${window.spaBase}/home/patient-lists/${e.uuid}`,children:e.name},e.uuid)},e.uuid))}return(0,di.jsx)("li",{children:"--"})})(),n.length>3&&(0,di.jsx)("li",{className:ko.link,children:(0,di.jsx)(uk,{to:`${window.spaBase}/home/patient-lists`,children:o2("seeMoreLists","See {{count}} more lists",{count:n?.length-3})})})]})]})},ka=({patientId:e})=>{let{patient:n,isLoading:t}=p1(e),r=n?.address?.find(e=>"home"===e.use),o=e=>e.split("#")[1];return t?(0,di.jsx)(dk.OuH,{description:`${o2("loading","Loading")} ...`,role:"progressbar"}):(0,di.jsxs)(di.Fragment,{children:[(0,di.jsx)("p",{className:ko.heading,children:o2("address","Address")}),(0,di.jsx)("ul",{children:r?Object.entries(r).filter(([e])=>"id"!==e&&"use"!==e).map(([e,n])=>"extension"===e?r.extension?.[0]?.extension?.map((n,t)=>(0,di.jsxs)("li",{children:[o2(o(n.url),o(n.url)),": ",n.valueString]},`address-${e}-${t}`)):(0,di.jsxs)("li",{children:[o2(e,e),": ",n]},`address-${e}`)):(0,di.jsx)("li",{children:"--"})})]})},ks=({patientUuid:e})=>{let{isLoading:n,contactAttributes:t}=(e=>{let{contactAttributeTypes:n=[]}=pm({externalModuleName:"@openmrs/esm-patient-banner-app"}),{attributes:t,error:r,isLoading:o}=(e=>{let{data:n,error:t,isLoading:r}=(0,p_.A)(`${rU}/patient/${e}?v=custom:(uuid,display,identifiers:(identifier,uuid,preferred,location:(uuid,name),identifierType:(uuid,name,format,formatDescription,validator)),person:(uuid,display,gender,birthdate,dead,age,deathDate,birthdateEstimated,causeOfDeath,preferredName:(uuid,preferred,givenName,middleName,familyName),attributes,preferredAddress:(uuid,preferred,address1,address2,cityVillage,longitude,stateProvince,latitude,country,postalCode,countyDistrict,address3,address4,address5,address6,address7)))`,rY);return{isLoading:r,attributes:n?.data.person.attributes??[],error:t}})(e);return{contactAttributes:(0,uA.useMemo)(()=>t.filter(({attributeType:e})=>n?.some(n=>e.uuid===n)),[t,n]),isLoading:o,error:r}})(e),r=(0,uA.useMemo)(()=>t?[...t?.map(e=>[e.attributeType.display?o2(e.attributeType.display,e.attributeType.display):"",e.value])]:[],[t]);return(0,di.jsxs)(di.Fragment,{children:[(0,di.jsx)("p",{className:ko.heading,children:o2("contactDetails","Contact Details")}),n?(0,di.jsx)(dk.OuH,{description:`${o2("loading","Loading")} ...`,role:"progressbar"}):(0,di.jsx)("ul",{children:r.length?r.map(([e,n],t)=>(0,di.jsxs)("li",{children:[e,": ",n]},`${e}-${n}-${t}`)):(0,di.jsx)("li",{children:"--"})})]})},kl=({patientId:e})=>{let{data:n,isLoading:t}=function(e){let n=`${rU}/relationship?v=custom:(display,uuid,personA:(age,display,birthdate,uuid),personB:(age,display,birthdate,uuid),relationshipType:(uuid,display,description,aIsToB,bIsToA))&person=${e}`,{data:t,error:r,isLoading:o,isValidating:i}=(0,u5.Ay)(e?n:null,rY),a=t?.data?.results?.length?function(e,n){let t=[];for(let r of n)e===r.personA.uuid?t.push({uuid:`${r.uuid}`,display:r.personB.display,relativeAge:r.personB.age,relativeUuid:r.personB.uuid,relationshipType:r.relationshipType.bIsToA}):t.push({uuid:`${r.uuid}`,display:r.personA.display,relativeAge:r.personA.age,relativeUuid:r.personA.uuid,relationshipType:r.relationshipType.aIsToB});return t}(e,t.data.results):null;return{data:t?a:null,error:r,isLoading:o,isValidating:i}}(e);return(0,di.jsxs)(di.Fragment,{children:[(0,di.jsx)("p",{className:ko.heading,children:o2("relationships","Relationships")}),t?(0,di.jsx)(dk.OuH,{description:`${o2("loading","Loading")} ...`,role:"progressbar"}):(0,di.jsx)("ul",{children:n&&n.length>0?(0,di.jsx)(di.Fragment,{children:n.map(e=>(0,di.jsxs)("li",{className:ko.relationship,children:[(0,di.jsx)("div",{children:(0,di.jsx)(uk,{to:`${window.spaBase}/patient/${e.relativeUuid}/chart`,children:e.display})}),(0,di.jsx)("div",{children:e.relationshipType}),(0,di.jsx)("div",{children:`${e.relativeAge?e.relativeAge:"--"} ${e.relativeAge?1===e.relativeAge?o2("yearAbbreviation","yr"):o2("yearsAbbreviation","yrs"):""}`})]},e.uuid))}):(0,di.jsx)("li",{children:"--"})})]})};function kc({patientId:e,deceased:n}){return(0,di.jsxs)("div",{className:ds()(ko.contactDetails,{[ko.deceased]:n}),children:[(0,di.jsxs)("div",{className:ko.row,children:[(0,di.jsx)("div",{className:ko.col,children:(0,di.jsx)(ka,{patientId:e})}),(0,di.jsx)("div",{className:ko.col,children:(0,di.jsx)(ks,{patientUuid:e})})]}),(0,di.jsxs)("div",{className:ko.row,children:[(0,di.jsx)("div",{className:ko.col,children:(0,di.jsx)(kl,{patientId:e})}),(0,di.jsx)("div",{className:ko.col,children:(0,di.jsx)(ki,{patientUuid:e})})]})]})}var ku=t(16767),kp=t.n(ku);function kd(e){let{patientPhotoConceptUuid:n}=pm({externalModuleName:"@openmrs/esm-styleguide"}),t=n?`${rU}/obs?patient=${e}&concept=${n}&v=full`:null,{data:r,error:o,isLoading:i}=(0,u5.Ay)(e?t:null,rY),a=r?.data?.results[0];return{data:a?{dateTime:a?.obsDatetime,imageSrc:a?.value?.links?.uri}:null,error:o,isLoading:i}}let kf=({width:e=56,height:n=56,"aria-label":t})=>{let{t:r}=(0,u3.useTranslation)();return(0,di.jsxs)("svg",{"aria-label":t??r("patientPhotoPlaceholder","Patient photo placeholder"),width:e,height:n,fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[(0,di.jsx)("path",{fill:"#ffffff",d:"M0 0h56v56H0z"}),(0,di.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"m36.75 20.134-.884-.884L19.25 35.866l.884.884 1.25-1.25H34.25a1.252 1.252 0 0 0 1.25-1.25V21.384l1.25-1.25Zm-2.5 14.116H22.634l4.87-4.87 1.487 1.486a1.25 1.25 0 0 0 1.768 0l.991-.991 2.5 2.498v1.877Zm0-3.645-1.616-1.616a1.25 1.25 0 0 0-1.768 0l-.991.991-1.486-1.486 5.861-5.86v7.971Zm-12.5 1.145v-1.875l3.125-3.123.858.859.885-.885-.86-.86a1.25 1.25 0 0 0-1.767 0l-2.241 2.242V21.75h10V20.5h-10c-.69 0-1.25.56-1.25 1.25v10h1.25Z",fill:"#8D8D8D"})]})};var kh=t(27268),km={};km.styleTagTransform=d_(),km.setAttributes=dm(),km.insert=df().bind(null,"head"),km.domAPI=dp(),km.insertStyleElement=db(),dc()(kh.A,km);let kg=kh.A&&kh.A.locals?kh.A.locals:void 0;function kb({patientUuid:e,patientName:n,alt:t}){let{data:r,isLoading:o}=kd(e),[i,a]=(0,uA.useState)(null),[s,l]=(0,uA.useState)(!1),c=(0,uA.useMemo)(()=>kp().generate(e),[e]);(0,uA.useEffect)(()=>{if(r?.imageSrc){let e=new URL(r.imageSrc,window.location.origin).pathname;l(!0);let n=!1,t=new Image;return t.onload=()=>{n||(a(e),l(!1))},t.onerror=()=>{n||(a(null),l(!1))},t.src=e,()=>{n=!0}}a(null),l(!1)},[r?.imageSrc]);let u=(0,uA.useMemo)(()=>t||(i?o2("patientPhotoAlt","Profile photo of {{patientName}}",{patientName:n}):o2("patientAvatarAlt","Avatar for {{patientName}}",{patientName:n})),[t,i,n]);return o||s?(0,di.jsx)(dk.ryE,{className:kg.skeleton,"data-testid":"skeleton-icon"}):r?.imageSrc&&!i?(0,di.jsx)(kf,{"aria-label":o2("patientPhotoPlaceholder","Photo placeholder for {{patientName}}",{patientName:n})}):i?(0,di.jsx)("div",{"aria-label":u,children:(0,di.jsx)("img",{className:kg.avatar,src:i,alt:u,title:n})}):(0,di.jsx)("div",{"aria-label":u,children:(0,di.jsx)("div",{className:kg.avatar,title:n,style:{backgroundImage:c.toDataUrl(),backgroundRepeat:"no-repeat",backgroundSize:"cover"},children:(0,di.jsx)("span",{className:kg.initials,children:function(e,n=3){return e.split(/\s+/).filter(Boolean).slice(0,n).map(e=>e[0]).join("")}(n)})})})}var ky=t(1636),k_={};k_.styleTagTransform=d_(),k_.setAttributes=dm(),k_.insert=df().bind(null,"head"),k_.domAPI=dp(),k_.insertStyleElement=db(),dc()(ky.A,k_);let kv=ky.A&&ky.A.locals?ky.A.locals:void 0,k$=["omrs-pict-appointments","omrs-pict-assessment-1","omrs-pict-assessment-2","omrs-pict-blood-bank","omrs-pict-cardiology","omrs-pict-ct-scan","omrs-pict-dentistry","omrs-pict-emergency-department","omrs-pict-facility","omrs-pict-geriatrics","omrs-pict-gynaecology","omrs-pict-in-patient","omrs-pict-laboratory","omrs-pict-labs-2","omrs-pict-obstetrics","omrs-pict-patient-search","omrs-pict-patients","omrs-pict-payments-desk","omrs-pict-pharmacy","omrs-pict-pharmacy-2","omrs-pict-registration","omrs-pict-service-queues","omrs-pict-stock-management","omrs-pict-transfer","omrs-pict-triage","omrs-pict-x-ray"],kA=(0,uA.memo)((0,uA.forwardRef)(function(e,n){return(0,di.jsx)(kX,{ref:n,pictogram:"omrs-pict-appointments",pictogramProps:e})})),kw=kA,kk=(0,uA.memo)((0,uA.forwardRef)(function(e,n){return(0,di.jsx)(kX,{ref:n,pictogram:"omrs-pict-assessment-1",pictogramProps:e})})),kx=(0,uA.memo)((0,uA.forwardRef)(function(e,n){return(0,di.jsx)(kX,{ref:n,pictogram:"omrs-pict-assessment-2",pictogramProps:e})})),kC=(0,uA.memo)((0,uA.forwardRef)(function(e,n){return(0,di.jsx)(kX,{ref:n,pictogram:"omrs-pict-blood-bank",pictogramProps:e})})),kE=(0,uA.memo)((0,uA.forwardRef)(function(e,n){return(0,di.jsx)(kX,{ref:n,pictogram:"omrs-pict-cardiology",pictogramProps:e})})),kD=(0,uA.memo)((0,uA.forwardRef)(function(e,n){return(0,di.jsx)(kX,{ref:n,pictogram:"omrs-pict-ct-scan",pictogramProps:e})})),kS=(0,uA.memo)((0,uA.forwardRef)(function(e,n){return(0,di.jsx)(kX,{ref:n,pictogram:"omrs-pict-dentistry",pictogramProps:e})})),kM=(0,uA.memo)((0,uA.forwardRef)(function(e,n){return(0,di.jsx)(kX,{ref:n,pictogram:"omrs-pict-emergency-department",pictogramProps:e})})),kz=(0,uA.memo)((0,uA.forwardRef)(function(e,n){return(0,di.jsx)(kX,{ref:n,pictogram:"omrs-pict-facility",pictogramProps:e})})),kP=(0,uA.memo)((0,uA.forwardRef)(function(e,n){return(0,di.jsx)(kX,{ref:n,pictogram:"omrs-pict-geriatrics",pictogramProps:e})})),kO=(0,uA.memo)((0,uA.forwardRef)(function(e,n){return(0,di.jsx)(kX,{ref:n,pictogram:"omrs-pict-gynaecology",pictogramProps:e})})),kT=(0,uA.memo)((0,uA.forwardRef)(function(e,n){return(0,di.jsx)(kX,{ref:n,pictogram:"omrs-pict-in-patient",pictogramProps:e})})),kB=(0,uA.memo)((0,uA.forwardRef)(function(e,n){return(0,di.jsx)(kX,{ref:n,pictogram:"omrs-pict-laboratory",pictogramProps:e})})),kI=(0,uA.memo)((0,uA.forwardRef)(function(e,n){return(0,di.jsx)(kX,{ref:n,pictogram:"omrs-pict-labs-2",pictogramProps:e})})),kN=(0,uA.memo)((0,uA.forwardRef)(function(e,n){return(0,di.jsx)(kX,{ref:n,pictogram:"omrs-pict-obstetrics",pictogramProps:e})})),kj=(0,uA.memo)((0,uA.forwardRef)(function(e,n){return(0,di.jsx)(kX,{ref:n,pictogram:"omrs-pict-patient-search",pictogramProps:e})})),kR=(0,uA.memo)((0,uA.forwardRef)(function(e,n){return(0,di.jsx)(kX,{ref:n,pictogram:"omrs-pict-patients",pictogramProps:e})})),kF=(0,uA.memo)((0,uA.forwardRef)(function(e,n){return(0,di.jsx)(kX,{ref:n,pictogram:"omrs-pict-payments-desk",pictogramProps:e})})),kL=(0,uA.memo)((0,uA.forwardRef)(function(e,n){return(0,di.jsx)(kX,{ref:n,pictogram:"omrs-pict-pharmacy",pictogramProps:e})})),kW=(0,uA.memo)((0,uA.forwardRef)(function(e,n){return(0,di.jsx)(kX,{ref:n,pictogram:"omrs-pict-pharmacy-2",pictogramProps:e})})),kV=(0,uA.memo)((0,uA.forwardRef)(function(e,n){return(0,di.jsx)(kX,{ref:n,pictogram:"omrs-pict-registration",pictogramProps:e})})),kG=(0,uA.memo)((0,uA.forwardRef)(function(e,n){return(0,di.jsx)(kX,{ref:n,pictogram:"omrs-pict-service-queues",pictogramProps:e})})),kU=(0,uA.memo)((0,uA.forwardRef)(function(e,n){return(0,di.jsx)(kX,{ref:n,pictogram:"omrs-pict-stock-management",pictogramProps:e})})),kq=(0,uA.memo)((0,uA.forwardRef)(function(e,n){return(0,di.jsx)(kX,{ref:n,pictogram:"omrs-pict-transfer",pictogramProps:e})})),kH=(0,uA.memo)((0,uA.forwardRef)(function(e,n){return(0,di.jsx)(kX,{ref:n,pictogram:"omrs-pict-triage",pictogramProps:e})})),kK=(0,uA.memo)((0,uA.forwardRef)(function(e,n){return(0,di.jsx)(kX,{ref:n,pictogram:"omrs-pict-x-ray",pictogramProps:e})})),kY=kz,kJ=kR,kZ=(0,uA.memo)((0,uA.forwardRef)(function({pictogram:e,fallback:n,...t},r){let o=(0,uA.useRef)(document.getElementById(e));return(0,uA.useEffect)(()=>{let n=document.getElementById("omrs-svgs-container"),t=new MutationObserver(n=>{for(let t of n)"childList"===t.type&&(o.current=document.getElementById(e))});return n&&t.observe(n,{childList:!0}),()=>t.disconnect()},[e]),(0,di.jsx)(pa,{value:o.current,fallback:n,children:(0,di.jsx)(kX,{ref:r,pictogram:e,pictogramProps:t})})})),kX=(0,uA.memo)((0,uA.forwardRef)(function({pictogram:e,pictogramProps:n},t){let{className:r,size:o}=Object.assign({},{size:92},n);return(o<=26||o>144)&&(console.error(`Invalid size '${o}' specified for ${e}. Defaulting to 92.`),o=92),(0,di.jsx)("svg",{ref:t,className:ds()(kv.pictogram,r),height:o,width:o,children:(0,di.jsx)("use",{href:`#${e}`})})})),kQ=({children:e})=>"tablet"===pG()?(0,di.jsx)(dk.Wdr,{children:e}):(0,di.jsx)(di.Fragment,{children:e});var k0=t(85925),k1={};k1.styleTagTransform=d_(),k1.setAttributes=dm(),k1.insert=df().bind(null,"head"),k1.domAPI=dp(),k1.insertStyleElement=db(),dc()(k0.A,k1),k0.A&&k0.A.locals&&k0.A.locals;let k2=new er.Subject,k3=0;function k5(e){var n;e&&"string"==typeof(n=e.title)&&n.trim().length>0?setTimeout(()=>{k2.next({...e,id:k3++})},0):console.error("showSnackbar must be called with an object having a 'title' property that is a non-empty string")}let k4=new er.Subject,k6=0;function k8(e){var n;e&&("string"==typeof(n=e.description)?n.trim().length>0:"object"==typeof n&&!(0,wE.A)(n))?setTimeout(()=>{k4.next({...e,id:k6++})},0):console.error("showToast must be called with an object having a 'description' property that is a non-empty string or object")}function k7(e,n=!1){if(n)return!0;let t=xr[e];return!t||!t()}function k9(e,n){let t=xc.getState()?.workspaceGroup,r=t?.name;r&&e===r&&xd(()=>{let r=xb(e);r&&(r.setState({},!0),r.subscribe(()=>{})()),"function"==typeof t?.cleanup&&t.cleanup(),xc.setState(e=>({...e,workspaceGroup:void 0})),"function"==typeof n&&n()},r?e=>e.currentWorkspaceGroup===r:()=>!0)}function xe(e,n){let{name:t,additionalProps:r}=n;uS(t);let o=()=>{xa(e.name,{ignoreChanges:!0,onWorkspaceClose:()=>xn(t,r),closeWorkspaceGroup:!1})};k7(e.name)?o():xh("closing-workspace-launching-new-workspace",o,e.title??e.name)}function xn(e,n){let t=uS(e),r=xc.getState().workspaceGroup;if(r&&!r.members?.includes(e))return void k9(r.name,()=>{xn(e,n)});let o=xc.getState().workspaceGroup?.name,i={...t,title:xm(t,n),closeWorkspace:(n={})=>xa(e,n),closeWorkspaceWithSavedChanges:n=>xa(e,{ignoreChanges:!0,...n}),promptBeforeClosing:n=>{var t,r;return t=e,r=n,void(xr[t]=r)},setTitle:(n,t)=>{i.title=n,i.titleNode=t,xc.setState(n=>{let t=n.openWorkspaces.map(n=>n.name===e?i:n);return{...n,openWorkspaces:t}})},currentWorkspaceGroup:o,additionalProps:n??{}};function a(e,n){xc.setState(t=>{let r=[e,...n??t.openWorkspaces],o=xp(e);return{...t,openWorkspaces:r,workspaceWindowState:o}})}o&&xb(o,n);let s=xc.getState().openWorkspaces,l=s.findIndex(n=>n.name===e),c=s.find(e=>e.type==i.type);if(0===s.length)a(i);else if(s[0].canHide||0===l)if(l>=0){let n=s[l];a({...n,additionalProps:i.additionalProps,...n.title===xm(n,n.additionalProps)&&{title:xm(i,i.additionalProps)}},s.filter(n=>n.name!=e))}else c?(a(c,xc.getState().openWorkspaces.filter(e=>e.type!=i.type)),xe(c,{name:e,additionalProps:n})):a(i);else xe(s[0],{name:e,additionalProps:n})}function xt({targetUrl:e,contextKey:n,workspaceName:t,additionalProps:r}){xs(n),xn(t,r),rF({to:e})}let xr={};function xo(){let e=xc.getState();xc.setState({...e,prompt:null})}let xi={ignoreChanges:!1,onWorkspaceClose:()=>{},closeWorkspaceGroup:!0};function xa(e,n={}){n={...xi,...n};let t=()=>{let t=xc.getState();t.openWorkspaces.find(n=>n.name===e);let r=t.openWorkspaces.filter(n=>n.name!=e),o=xc.getState().workspaceGroup?.name;o&&n.closeWorkspaceGroup&&k9(o),xr[e]=()=>!1,xc.setState(e=>({...e,prompt:null,openWorkspaces:r,workspaceWindowState:xp(r?.[0])})),n?.onWorkspaceClose?.()};return k7(e,n?.ignoreChanges)?(t(),!0):(xh("closing-workspace",t,uS(e).title??e),!1)}function xs(e){xc.getState().context!=e&&xc.setState({context:e,openWorkspaces:[],prompt:null})}let xl={context:"",openWorkspaces:[],prompt:null,workspaceWindowState:"normal",workspaceGroup:void 0},xc=L("workspace",xl);function xu(e){let n=xc.getState();xc.setState({...n,workspaceWindowState:e})}function xp(e){return e?.preferredWindowSize??"normal"}function xd(e=()=>{},n=()=>!0){let t=xc.getState().openWorkspaces.filter(n).every(({name:e})=>k7(e)),r=()=>{xg(),e?.()};t?r():xh("closing-all-workspaces",r)}function xf(){let{workspaceWindowState:e,openWorkspaces:n,prompt:t,workspaceGroup:r}=uB(xc);return(0,uA.useMemo)(()=>({active:n.length>0,prompt:t,workspaceWindowState:e,workspaces:n,workspaceGroup:r}),[n,e,t,r])}function xh(e,n=()=>{},t=""){let r;switch(e){case"closing-workspace":r={title:o2("unsavedChangesTitleText","Unsaved changes"),body:o2("unsavedChangesInOpenedWorkspace","You may have unsaved changes in the opened workspace. Do you want to discard these changes?"),onConfirm:()=>{n?.()},confirmText:o2("discard","Discard")};break;case"closing-all-workspaces":{let e=xc.getState().openWorkspaces.filter(({name:e})=>!k7(e)).map(({title:e},n)=>`${n+1}. ${e}`);r={title:o2("closingAllWorkspacesPromptTitle","You have unsaved changes"),body:o2("closingAllWorkspacesPromptBody","There may be unsaved changes in the following workspaces. Do you want to discard changes in the following workspaces? {{workspaceNames}}",{workspaceNames:e.join(",")}),onConfirm:()=>{n?.()},confirmText:o2("closeAllOpenedWorkspaces","Discard changes in {{count}} workspaces",{count:e.length})};break}case"closing-workspace-launching-new-workspace":r={title:o2("unsavedChangesTitleText","Unsaved changes"),body:o2("unsavedChangesInWorkspace",'There may be unsaved changes in "{{workspaceName}}". Please save them before opening another workspace.',{workspaceName:t}),onConfirm:()=>{xc.setState(e=>({...e,prompt:null})),n?.()},confirmText:o2("openAnyway","Open anyway")};break;default:console.error(`Workspace system trying to open unknown prompt type "${e}" in function "showWorkspacePrompts"`),n?.();return}xc.setState(e=>({...e,prompt:r}))}function xm(e,n){return n?.workspaceTitle??e.title}function xg(){xc.setState(xl)}function xb(e,n={}){if(!e||"default"===e)return;let t=W(e,{});return n&&t.setState(e=>({...e,...n})),t}var xy=t(81341),x_={};x_.styleTagTransform=d_(),x_.setAttributes=dm(),x_.insert=df().bind(null,"head"),x_.domAPI=dp(),x_.insertStyleElement=db(),dc()(xy.A,x_);let xv=xy.A&&xy.A.locals?xy.A.locals:void 0;function x$({getIcon:e,formOpenInTheBackground:n,tagContent:t}){return(0,di.jsxs)(di.Fragment,{children:[e({size:16}),n?(0,di.jsx)("span",{className:xv.interruptedTag,children:"!"}):(0,di.jsx)("span",{className:xv.countTag,children:t})]})}let xA=({getIcon:e,label:n,iconDescription:t,handler:r,type:o,tagContent:i})=>{let a=pG(),{workspaces:s,workspaceWindowState:l}=xf(),c=s?.findIndex(({type:e})=>e===o)??-1,u="hidden"!==l&&0===c,p=c>0||0===c&&"hidden"===l;return"tablet"===a||"phone"===a?(0,di.jsxs)(dk.$nd,{className:ds()(xv.container,{[xv.active]:u}),iconDescription:t,kind:"ghost",onClick:r,role:"button",tabIndex:0,size:"md",children:[(0,di.jsx)("span",{className:xv.elementContainer,children:(0,di.jsx)(x$,{formOpenInTheBackground:p,getIcon:e,tagContent:i})}),(0,di.jsx)("span",{children:n})]}):(0,di.jsx)(dk.K0,{align:"left","aria-label":t,className:ds()(xv.container,{[xv.active]:u}),enterDelayMs:300,kind:"ghost",label:n,onClick:r,size:"md",children:(0,di.jsx)("div",{className:xv.elementContainer,children:(0,di.jsx)(x$,{formOpenInTheBackground:p,getIcon:e,tagContent:i})})})};var xw=t(54535),xk=t(40771),xx=/[\\^$.*+?()[\]{}|]/g,xC=RegExp(xx.source);let xE=function(e){return(e=(0,nd.A)(e))&&xC.test(e)?e.replace(xx,"\\$&"):e};var xD=t(37781),xS={};xS.styleTagTransform=d_(),xS.setAttributes=dm(),xS.insert=df().bind(null,"head"),xS.domAPI=dp(),xS.insertStyleElement=db(),dc()(xD.A,xS);let xM=xD.A&&xD.A.locals?xD.A.locals:void 0;function xz({contextKey:e}){let{prompt:n}=xf();return(0,uA.useEffect)(()=>{RegExp(`/${xE(e)}(/|$)`).test(window.location.pathname)||console.warn(`WorkspaceContainer has provided an invalid context key: "${e}". The context key must be part of the URL path, with no initial or trailing slash.`)},[]),(0,uA.useEffect)(()=>(xs(e),()=>{xs(null)}),[e]),(0,uA.useEffect)(()=>{let n=n=>{let{detail:{cancelNavigation:t,newUrl:r}}=n,o=RegExp(`/${xE(e)}(/|$)`),i=new URL(r),a=o.test(i.pathname),s=xc.getState().openWorkspaces.every(({name:e})=>k7(e));a||(s?xg():(t?.(),xd(()=>{rF({to:r})})))};return window.addEventListener("single-spa:before-routing-event",n),()=>{window.removeEventListener("single-spa:before-routing-event",n)}},[]),null!=n?(0,di.jsxs)(dk.KXP,{open:!0,onClose:xo,children:[(0,di.jsx)(dk.rQ0,{title:n.title}),(0,di.jsx)(dk.cwr,{children:(0,di.jsx)("p",{className:xM.messageBody,children:n.body})}),(0,di.jsxs)(dk.jlY,{children:[(0,di.jsx)(dk.$nd,{kind:"secondary",onClick:xo,children:n.cancelText??o2("cancel")}),(0,di.jsx)(dk.$nd,{kind:"danger",onClick:n.onConfirm,children:n.confirmText??o2("confirm")})]})]}):null}function xP(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 xO(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?xP(Object(t),!0).forEach(function(n){xB(e,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):xP(Object(t)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))})}return e}function xT(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 xB(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function xI(e){return(xI=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function xN(e,n){return(xN=Object.setPrototypeOf||function(e,n){return e.__proto__=n,e})(e,n)}function xj(e){if(void 0===e)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return e}var xR=function(e){var n=uA.Component;if("function"!=typeof n&&null!==n)throw TypeError("Super expression must either be null or a function");a.prototype=Object.create(n&&n.prototype,{constructor:{value:a,writable:!0,configurable:!0}}),n&&xN(a,n);var t,r,o,i=(t=function(){if("u"<typeof Reflect||!Reflect.construct||Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(e){return!1}}(),function(){var e,n=xI(a);e=t?Reflect.construct(n,arguments,xI(this).constructor):n.apply(this,arguments);if(e&&("object"==typeof e||"function"==typeof e))return e;if(void 0!==e)throw TypeError("Derived constructors may only return object or undefined");return xj(this)});function a(e){var n;if(function(e,n){if(!(e instanceof n))throw TypeError("Cannot call a class as a function")}(this,a),xB(xj(n=i.call(this,e)),"handleRef",function(e){n.el=e}),xB(xj(n),"addThingToDo",function(e,t){n.state.hasError&&"unmount"!==e||(n.nextThingToDo=(n.nextThingToDo||Promise.resolve()).then(function(){if(!n.unmounted||"unmount"===e)return t.apply(void 0,arguments)}).catch(function(t){throw n.nextThingToDo=Promise.resolve(),n.setState({hasError:!0}),t&&t.message&&(t.message="During '".concat(e,"', parcel threw an error: ").concat(t.message)),n.props.handleError?n.props.handleError(t):setTimeout(function(){throw t}),t}))}),xB(xj(n),"getParcelProps",function(){var e=xO(xO({},n.props),{},{domElement:n.el});return delete e.mountParcel,delete e.config,delete e.wrapWith,delete e.wrapStyle,delete e.appendTo,delete e.handleError,delete e.parcelDidMount,e}),n.state={hasError:!1},!e.config)throw Error("single-spa-react's Parcel component requires the 'config' prop to either be a parcel config or a loading function that returns a promise. See https://github.com/single-spa/single-spa-react");return n}return r=[{key:"componentDidMount",value:function(){var e=this;this.unmounted=!1,this.addThingToDo("mount",function(){var n,t=e.props.mountParcel||e.mountParcel;if(!t)throw Error("\n <Parcel /> was not passed a mountParcel prop, nor is it rendered where mountParcel is within the React context.\n If you are using <Parcel /> within a module that is not a single-spa application, you will need to import mountRootParcel from single-spa and pass it into <Parcel /> as a mountParcel prop \n ");return e.el?n=e.el:(e.createdDomElement=n=document.createElement(e.props.wrapWith),Object.keys(e.props.wrapStyle).forEach(function(t){n.style[t]=e.props.wrapStyle[t]}),e.props.appendTo.appendChild(n)),e.parcel=t(e.props.config,xO({domElement:n},e.getParcelProps())),e.parcel.mountPromise.then(e.props.parcelDidMount),e.parcel.mountPromise})}},{key:"componentDidUpdate",value:function(){var e=this;this.addThingToDo("update",function(){if(e.parcel&&e.parcel.update)return e.parcel.update(e.getParcelProps())})}},{key:"componentWillUnmount",value:function(){var e=this;this.addThingToDo("unmount",function(){if(e.parcel&&"MOUNTED"===e.parcel.getStatus())return e.parcel.unmount()}),this.createdDomElement&&this.createdDomElement.parentNode.removeChild(this.createdDomElement),this.unmounted=!0}},{key:"render",value:function(){var e=this;if(this.props.appendTo)return uY&&uY.Consumer?uA.createElement(uY.Consumer,null,function(n){return e.mountParcel=n?n.mountParcel:null,null}):null;var n=uY&&uY.Consumer?uA.createElement(uY.Consumer,null,function(n){return e.mountParcel=n?n.mountParcel:null,null}):void 0;return uA.createElement(this.props.wrapWith,{ref:this.handleRef,style:this.props.wrapStyle,className:this.props.wrapClassName},n)}}],xT(a.prototype,r),o&&xT(a,o),a}();xB(xR,"defaultProps",{wrapWith:"div",wrapStyle:{},parcelDidMount:function(){}});var xF=t(57515),xL={};xL.styleTagTransform=d_(),xL.setAttributes=dm(),xL.insert=df().bind(null,"head"),xL.domAPI=dp(),xL.insertStyleElement=db(),dc()(xF.A,xL);let xW=xF.A&&xF.A.locals?xF.A.locals:void 0;function xV({workspace:e,additionalPropsFromPage:n}){let[t,r]=(0,uA.useState)(),o=function(e){let[n,t]=(0,uA.useState)({}),[r,o]=(0,uA.useState)(e);return(0,uA.useEffect)(()=>{r!==e&&o(e)},[e]),(0,uA.useEffect)(()=>{let e,n=xb(r);return n&&(t(n.getState()),e=n.subscribe(t)),()=>{n&&e?.()}},[r]),n}(e.currentWorkspaceGroup);(0,uA.useEffect)(()=>{let n=!0;return e.load().then(e=>{n&&r(e)}),()=>{n=!1}},[e]);let i=(0,uA.useMemo)(()=>e&&{closeWorkspace:e.closeWorkspace,closeWorkspaceWithSavedChanges:e.closeWorkspaceWithSavedChanges,promptBeforeClosing:e.promptBeforeClosing,setTitle:e.setTitle,...n,...o,...e.additionalProps},[e,n,o]);return t?(0,di.jsx)(xR,{config:t,mountParcel:tX,...i},e.name):(0,di.jsx)(dk.OuH,{className:xW.loader,description:`${o2("loading","Loading")} ...`})}var xG=t(24646),xU={};xU.styleTagTransform=d_(),xU.setAttributes=dm(),xU.insert=df().bind(null,"head"),xU.domAPI=dp(),xU.insertStyleElement=db(),dc()(xG.A,xU);let xq=xG.A&&xG.A.locals?xG.A.locals:void 0,xH=function({isWithinWorkspace:e,name:n,actionMenuProps:t={}}){let[r,o]=(0,uA.useState)(!1),i=(0,uA.useRef)(window.innerHeight),{featureName:a}=(0,uA.useContext)(uP),s=pG();(0,uA.useEffect)(()=>{let e=()=>{o(!pU(s)&&i.current>window.innerHeight),i.current!=window.innerHeight&&(i.current=window.innerHeight)};return window.addEventListener("resize",e),()=>window.removeEventListener("resize",e)},[i]);let l=`action-menu-${n&&"default"!=n?n:a}-items-slot`;return(0,di.jsx)("aside",{className:ds()(xq.sideRail,{[xq.withinWorkspace]:e,[xq.sideRailHidden]:r,[xq.sideRailVisible]:!r}),children:(0,di.jsx)("div",{className:xq.container,children:(0,di.jsx)(uW,{className:xq.chartExtensions,name:l,state:t})})})};function xK({contextKey:e,overlay:n,showSiderailAndBottomNav:t,additionalWorkspaceProps:r,actionMenuProps:o}){let i=pG(),{workspaces:a,workspaceWindowState:s,workspaceGroup:l}=xf(),c=l?.name,u=a[0],p="hidden"===s||null==u,d=u?.width??(n?"wider":"narrow"),f=(0,uA.useMemo)(()=>t||c&&!p,[c,p,t]);return pd(!p&&!pU(i)),(0,di.jsxs)(di.Fragment,{children:[(0,di.jsxs)("div",{className:t?xW.workspaceContainerWithActionMenu:xW.workspaceContainerWithoutActionMenu,children:[(0,di.jsx)("aside",{className:ds()(n?xW.workspaceOverlayOuterContainer:xW.workspaceWindowSpacer,{[xW.hiddenRelative]:p,[xW.narrowWorkspace]:"narrow"===d,[xW.widerWorkspace]:"wider"===d,[xW.extraWideWorkspace]:"extra-wide"===d}),children:(0,di.jsx)("div",{className:ds()(xW.workspaceFixedContainer,{[xW.maximizedWindow]:"maximized"===s,[xW.hiddenFixed]:p}),children:a.map((e,n)=>(0,di.jsx)("div",{className:ds()(xW.workspaceInnerContainer,{[xW.hiddenExtraWorkspace]:0!==n}),children:(0,di.jsx)(uA.Suspense,{fallback:null,children:(0,di.jsx)(u3.I18nextProvider,{i18n:window.i18next,defaultNS:e.moduleName,children:(0,di.jsx)(xY,{workspaceInstance:e,additionalWorkspaceProps:r})})})},`workspace-container-${e?e.name:`empty-${n}`}`))})}),(0,di.jsx)(xz,{contextKey:e})]}),f&&(0,di.jsx)(xH,{name:c,isWithinWorkspace:!t,actionMenuProps:o})]})}function xY({workspaceInstance:e,additionalWorkspaceProps:n}){let{t}=(0,u3.useTranslation)(),r=pG(),{workspaceWindowState:o,workspaceGroup:i}=xf(),a=i?.name,s="maximized"===o;(0,uA.useEffect)(()=>{let n=t(e.title);n!==e.title&&e.setTitle(n)},[e.title,t,e.setTitle]);let{featureName:l}=(0,uA.useContext)(uP),c=(0,uA.useCallback)(()=>{xu(s?"normal":"maximized")},[s]),{canHide:u=!1,canMaximize:p=!1,currentWorkspaceGroup:d="",closeWorkspace:f}=(0,uA.useMemo)(()=>e??{},[e]),h=(0,uA.useMemo)(()=>({...n,...e?.additionalProps}),[n,e]);return e&&(0,di.jsxs)(di.Fragment,{children:[(0,di.jsxs)(dk.Y9Y,{"aria-label":o2("workspaceHeader","Workspace Header"),className:xW.header,children:[!pU(r)&&!u&&(0,di.jsx)(dk.dJ2,{"aria-label":o2("close","Close"),renderMenuIcon:(0,di.jsx)(dV,{}),onClick:()=>f()}),(0,di.jsx)(dk.bCw,{prefix:"",children:e.titleNode??t(e.title)}),(0,di.jsx)("div",{className:xW.overlayHeaderSpacer}),(0,di.jsxs)(dk.wdv,{className:xW.headerButtons,children:[(0,di.jsx)(uW,{name:`workspace-header-group-${e.currentWorkspaceGroup}-slot`,state:h}),(0,di.jsx)(uW,{name:`workspace-header-type-${e.type}-slot`,state:h}),(0,di.jsx)(uW,{name:`workspace-header-${l}-slot`,state:h}),pU(r)&&(0,di.jsxs)(di.Fragment,{children:[(p||s)&&(0,di.jsx)(dk.V8d,{"aria-label":s?o2("minimize","Minimize"):o2("maximize","Maximize"),onClick:c,children:s?(0,di.jsx)(xw.Xj,{}):(0,di.jsx)(xw.hz,{})}),u&&!a?(0,di.jsx)(dk.V8d,{"aria-label":o2("hide","Hide"),onClick:()=>xu("hidden"),children:(0,di.jsx)(dG,{})}):(0,di.jsx)(dk.V8d,{"aria-label":o2("close","Close"),onClick:()=>f?.(),children:(0,di.jsx)(d7,{})})]}),"tablet"===r&&u&&(0,di.jsx)(dk.V8d,{"aria-label":o2("close","Close"),onClick:()=>f?.(),children:(0,di.jsx)(xk.d3,{})})]})]}),(0,di.jsx)("div",{className:ds()(xW.workspaceContent,{[xW.marginWorkspaceContent]:!!d}),children:(0,di.jsx)(xV,{workspace:e,additionalPropsFromPage:n},e.name)})]})}async function xJ(e,n){let{openedGroup:t}=uM.getState();if(t){if(t.groupName===e&&xQ(t.props,n))return!0;else if(!await x0({reason:"CLOSE_WORKSPACE_GROUP",explicit:!1}))return!1}return uM.setState(t=>({...t,openedGroup:{groupName:e,props:n},openedWindows:[]})),!0}async function xZ(e){let{openedGroup:n,openedWindows:t}=uM.getState();if(n){if(t.length>0&&!(e||await x0({reason:"CLOSE_WORKSPACE_GROUP",explicit:!0})))return!1;uM.setState(e=>({...e,openedGroup:null,openedWindows:[]}))}return!0}async function xX(e,n=null,t=null,r=null){let o=uM.getState();if(!o.registeredWorkspacesByName[e])throw Error(`Unable to launch workspace ${e}. Workspace is not registered`);let i=function(e){let{registeredWorkspacesByName:n,registeredWindowsByName:t}=uM.getState(),r=n[e];if(r){let n=t[r.window];if(n)return n;throw Error(`No workspace window found with name: ${r.window} for workspace: ${e}`)}throw Error(`No workspace found with name: ${e}`)}(e);if(!i)throw Error(`Unable to launch workspace ${e}. Workspace is not registered to a workspace window`);let{openedGroup:a}=o,{name:s}=i,l=function(e){let{registeredGroupsByName:n,registeredWindowsByName:t}=uM.getState(),r=t[e];if(r){let t=n[r.group];if(t)return t;throw Error(`No workspace group found with name: ${r.group} for window: ${e}`)}throw Error(`No workspace window found with name: ${e}`)}(s);if(!l)throw Error(`Unable to launch workspace ${e}. Workspace window ${i.name} is not registered to a workspace group`);let c=uz(e);if(a&&(a.groupName!==l.name||!xQ(a.props,r)))return!!await x0({reason:"CLOSE_WORKSPACE_GROUP",explicit:!0})&&(uM.setState({...o,openedGroup:{groupName:l.name,props:r},openedWindows:[{windowName:s,openedWorkspaces:[x5(e,n)],props:t,maximized:!1}],isMostRecentlyOpenedWindowHidden:!1}),!0);if(c>=0){let r=o.openedWindows[c],i=o.openedGroup?.props??{},a=o.isMostRecentlyOpenedWindowHidden,{openedWorkspaces:u}=r;if(xQ(r.props,t)){let p=u.find(n=>n.workspaceName===e);return p&&xQ(p.props,n)?((a||c!==o.openedWindows.length-1)&&uM.setState(x1.restoreWindow(o,s)),!0):!!await x0({reason:"CLOSE_WORKSPACE",explicit:!1,windowName:s,workspaceName:e})&&(uM.setState({...o,openedGroup:{groupName:l.name,props:o?.openedGroup?.props??i},openedWindows:[...o.openedWindows.filter((e,n)=>n!==c),{windowName:s,openedWorkspaces:[x5(e,n)],props:r?.props??t,maximized:!1}],isMostRecentlyOpenedWindowHidden:!1}),!0)}return!!await x0({reason:"CLOSE_WINDOW",explicit:!1,windowName:s})&&(uM.setState({...o,openedGroup:{groupName:l.name,props:i??o?.openedGroup?.props},openedWindows:[...o.openedWindows.filter((e,n)=>n!==c),{windowName:s,openedWorkspaces:[x5(e,n)],props:t,maximized:!1}],isMostRecentlyOpenedWindowHidden:!1}),!0)}return"closable"!=l.persistence?(uM.setState({...o,openedGroup:{groupName:l.name,props:r??o?.openedGroup?.props??null},openedWindows:[...o.openedWindows,{windowName:s,openedWorkspaces:[x5(e,n)],props:t,maximized:!1}],isMostRecentlyOpenedWindowHidden:!1}),!0):!!await x0({reason:"CLOSE_OTHER_WINDOWS",explicit:!1,windowNameToSpare:i.name})&&(uM.setState({...o,openedGroup:{groupName:l.name,props:r??o?.openedGroup?.props??null},openedWindows:[{windowName:s,openedWorkspaces:[x5(e,n)],props:t,maximized:!1}],isMostRecentlyOpenedWindowHidden:!1}),!0)}function xQ(e,n){return null==e||null==n||T(e,n)}function x0(e){function n(e,n){let t=[];for(let r=e.openedWorkspaces.length-1;r>=0;r--){let o=e.openedWorkspaces[r];if(o.hasUnsavedChanges&&t.push(o),n&&o.workspaceName===n)break}return t}let{openedWindows:t,workspaceTitleByWorkspaceName:r}=uM.getState(),o=[];switch(e.reason){case"CLOSE_WORKSPACE_GROUP":o=t.flatMap(e=>n(e));break;case"CLOSE_WINDOW":{let r=t.find(n=>n.windowName===e.windowName);if(!r)throw Error(`Window ${e.windowName} not found in opened windows.`);o=n(r);break}case"CLOSE_WORKSPACE":{let r=t.find(n=>n.windowName===e.windowName);if(!r)throw Error(`Window ${e.windowName} not found in opened windows.`);o=n(r,e.workspaceName);break}case"CLOSE_OTHER_WINDOWS":o=t.filter(n=>n.windowName!==e.windowNameToSpare).flatMap(e=>n(e))}return 0===o.length?Promise.resolve(!0):new Promise(e=>{let n=wC("workspace2-close-prompt",{size:"sm",onConfirm:()=>{n(),e(!0)},onCancel:()=>{n(),e(!1)},affectedWorkspaceTitles:o.map(e=>r[e.workspaceName])})})}let x1={setWindowMaximized(e,n,t){let r=e.openedWindows.findIndex(e=>e.windowName===n),o=[...e.openedWindows],i={...o[r],maximized:t};return o[r]=i,{...e,openedWindows:o}},hideWindow:e=>({...e,isMostRecentlyOpenedWindowHidden:!0}),restoreWindow(e,n){let t=e.openedWindows.findIndex(e=>e.windowName===n),r=e.openedWindows[t],o=[...e.openedWindows.filter((e,n)=>n!==t),r];return{...e,openedWindows:o,isMostRecentlyOpenedWindowHidden:!1}},closeWorkspace(e,n){let t=uz(n);if(t<0)return e;let r={...e.openedWindows[t]},o=r.openedWorkspaces.findIndex(e=>e.workspaceName===n),i=[...e.openedWindows];r.openedWorkspaces=r.openedWorkspaces.slice(0,o);let a=e.isMostRecentlyOpenedWindowHidden;if(0===r.openedWorkspaces.length){let n=t===e.openedWindows.length-1;i.splice(t,1),n&&i.length>0&&(a=!1)}else i[t]=r;return{...e,openedWindows:i,isMostRecentlyOpenedWindowHidden:a}},openChildWorkspace(e,n,t,r){let o=e.registeredWorkspacesByName[t];if(!o)throw Error(`No workspace named "${t}" registered`);let i=e.registeredWorkspacesByName[n];if(!i)throw Error(`No workspace named "${n}" registered`);if(i.window!==o.window)throw Error(`Child workspace ${t} does not belong to the same workspace window as parent workspace ${n}`);let a=e.openedWindows.findIndex(e=>e.windowName===o.window);if(-1==a)throw Error(`Cannot open child workspace ${t} as window ${o.window} is not opened`);let{openedWorkspaces:s}=e.openedWindows[a],l=s.findIndex(e=>e.workspaceName===n);if(-1===l)throw Error(`Cannot open child workspace ${t} from parent workspace ${n} as the parent is not opened within the workspace window`);let c=s.slice(0,l+1);return{openedWindows:e.openedWindows.map((e,n)=>n==a?{...e,openedWorkspaces:[...c,x5(t,r)]}:e)}},setHasUnsavedChanges(e,n,t){let r=uz(n);if(r<0)return e;let o={...e.openedWindows[r]},i=o.openedWorkspaces.findIndex(e=>e.workspaceName===n);if(i<0)return e;o.openedWorkspaces[i]={...o.openedWorkspaces[i],hasUnsavedChanges:t};let a=[...e.openedWindows];return a[r]=o,{...e,openedWindows:a}},setWorkspaceTitle(e,n,t){let r={...e.workspaceTitleByWorkspaceName};return null===t?delete r[n]:r[n]=t,{...e,workspaceTitleByWorkspaceName:r}}},x2=()=>(0,uA.useContext)(uY),x3=()=>Object.keys(uM.getState().registeredWorkspacesByName);function x5(e,n){return{workspaceName:e,props:n??{},hasUnsavedChanges:!1,uuid:uy()}}var x4=t(81179),x6={};x6.styleTagTransform=d_(),x6.setAttributes=dm(),x6.insert=df().bind(null,"head"),x6.domAPI=dp(),x6.insertStyleElement=db(),dc()(x4.A,x6);let x8=x4.A&&x4.A.locals?x4.A.locals:void 0,x7=({title:e,children:n,hasUnsavedChanges:t=!1})=>{let r=pG(),{setWindowMaximized:o,hideWindow:i,setHasUnsavedChanges:a,openedWindows:s,openedGroup:l,registeredGroupsByName:c,registeredWindowsByName:u,registeredWorkspacesByName:p,workspaceTitleByWorkspaceName:d,setWorkspaceTitle:f,isMostRecentlyOpenedWindowHidden:h}=uI(uM,x1),{workspaceName:m,isRootWorkspace:g,closeWorkspace:b,showActionMenu:y}=x2(),v=uz(m),$=s[v],A=$?.openedWorkspaces.find(e=>e.workspaceName===m);if((0,uA.useEffect)(()=>{A?.hasUnsavedChanges!=t&&a(m,t??!1)},[A?.hasUnsavedChanges,t,m,a]),(0,uA.useEffect)(()=>{d[m]!==e&&f(m,e)},[d,m,e,f]),v<0||null==l||null==A)return null;let w=c[l.groupName];if(!w)throw Error(`Cannot find registered workspace group ${l.groupName}`);let k=p[m].window,x=u[k];if(!x)throw Error(`Cannot find registered workspace window ${k}`);let{icon:C,canMaximize:E}=x,D="closable"===w.persistence,S=!!C&&!D,{maximized:M}=$,z=x?.width??"narrow",P=Object.values(u).some(e=>e.group===l.groupName&&void 0!==e.icon),O=v<s.length-1||h;return(0,di.jsxs)("div",{className:ds()(x8.workspaceOuterContainer,{[x8.narrowWorkspace]:"narrow"===z,[x8.widerWorkspace]:"wider"===z,[x8.extraWideWorkspace]:"extra-wide"===z,[x8.isActionMenuOpened]:P}),children:[(0,di.jsx)("div",{className:ds()(x8.workspaceSpacer,{[x8.hidden]:O})}),(0,di.jsx)("div",{className:ds()(x8.workspaceMiddleContainer,{[x8.maximized]:M,[x8.hidden]:O,[x8.isRootWorkspace]:g,[x8.showActionMenu]:y}),children:(0,di.jsxs)("div",{className:ds()(x8.workspaceInnerContainer,{[x8.maximized]:M,[x8.hidden]:O,[x8.isRootWorkspace]:g}),children:[(0,di.jsxs)(dk.Y9Y,{"aria-label":o2("workspaceHeader"),className:x8.header,children:[(0,di.jsx)(dk.bCw,{prefix:"",children:e}),(0,di.jsx)("div",{className:x8.overlayHeaderSpacer}),(0,di.jsx)(dk.wdv,{className:x8.headerButtons,children:pU(r)?(0,di.jsxs)(di.Fragment,{children:[(E||M)&&(0,di.jsx)(dk.V8d,{"aria-label":M?o2("minimize"):o2("maximize"),onClick:()=>o(k,!M),children:M?(0,di.jsx)(xw.Xj,{}):(0,di.jsx)(xw.hz,{})}),S&&(0,di.jsx)(dk.V8d,{"aria-label":o2("hide"),onClick:()=>i(),children:(0,di.jsx)(dG,{})}),!D&&(0,di.jsx)(dk.V8d,{"aria-label":o2("close"),onClick:()=>b({closeWindow:!0}),children:(0,di.jsx)(d7,{})})]}):(0,di.jsxs)(di.Fragment,{children:[S&&(0,di.jsx)(dk.V8d,{"aria-label":o2("hide"),onClick:()=>i(),children:(0,di.jsx)(xk.d3,{})}),(0,di.jsx)(dk.V8d,{"aria-label":o2("close"),onClick:()=>{D?xZ():b({closeWindow:!0})},children:(0,di.jsx)(d7,{})})]})})]}),(0,di.jsx)("div",{className:ds()(x8.workspaceContent),children:n})]})})]})};var x9=t(97810),Ce={};Ce.styleTagTransform=d_(),Ce.setAttributes=dm(),Ce.insert=df().bind(null,"head"),Ce.domAPI=dp(),Ce.insertStyleElement=db(),dc()(x9.A,Ce);let Cn=x9.A&&x9.A.locals?x9.A.locals:void 0;function Ct({getIcon:e,hasUnsavedChanges:n,tagContent:t}){return(0,di.jsxs)(di.Fragment,{children:[e({size:16}),n?(0,di.jsx)("span",{className:Cn.interruptedTag,children:"!"}):(0,di.jsx)("span",{className:Cn.countTag,children:t})]})}let Cr=({icon:e,label:n,tagContent:t,workspaceToLaunch:r,onBeforeWorkspaceLaunch:o})=>{let i=pG(),{openedWindows:a,restoreWindow:s,hideWindow:l,isMostRecentlyOpenedWindowHidden:c}=uI(uM,x1),{extension:u}=(0,uA.useContext)(uP),p=a.findIndex(e=>e.windowName===u?.extensionId),d=a[p],f=null!=d,h=f&&(p<a.length-1||c),m=f&&!h,g=d?.openedWorkspaces.some(e=>e.hasUnsavedChanges)??!1,b=async()=>{if(f)h?s(d.windowName):l();else if(await (o?.()??!0)){let{workspaceName:e,workspaceProps:n,windowProps:t}=r;xX(e,n,t)}};return"tablet"===i||"phone"===i?(0,di.jsxs)(dk.$nd,{className:ds()(Cn.container,{[Cn.active]:f&&!m,[Cn.focused]:m}),iconDescription:n,kind:"ghost",onClick:b,role:"button",tabIndex:0,size:"md",children:[(0,di.jsx)("span",{className:Cn.elementContainer,children:(0,di.jsx)(Ct,{hasUnsavedChanges:g,getIcon:e,tagContent:t})}),(0,di.jsx)("span",{children:n})]}):(0,di.jsx)(dk.K0,{align:"left","aria-label":n,className:ds()(Cn.container,{[Cn.active]:f&&!m,[Cn.focused]:m}),enterDelayMs:300,kind:"ghost",label:n,onClick:b,size:"md",children:(0,di.jsx)("div",{className:Cn.elementContainer,children:(0,di.jsx)(Ct,{hasUnsavedChanges:g,getIcon:e,tagContent:t})})})};function Co(e){if("string"!=typeof e||0===e.trim().length)return;let n=e.replaceAll("_","-");try{return new Intl.Locale(n).toString()}catch{return}}function Ci(e,n,t){if(null==e)return t;let r=Co(e);if(!r)return console.warn(`matchLocale: invalid requested locale tag: ${JSON.stringify(e)}`),t;let o=[];for(let e of n){let n=Co(e);if(!n){console.warn(`matchLocale: skipping invalid available locale tag: ${JSON.stringify(e)}`);continue}o.push({canonical:n,original:e})}let i=r;for(;i;){let e=o.find(e=>e.canonical===i);if(e)return e.original;let n=i+"-",t=o.find(e=>e.canonical.startsWith(n));if(t)return t.original;if("ht"===i){i="fr-HT";continue}let r=i.lastIndexOf("-");if(-1===r)break;let a=(i=i.slice(0,r)).lastIndexOf("-");-1!==a&&i.length-a==2&&(i=i.slice(0,a))}return t}function Ca(e=window.localStorage){try{return e.getItem("test"),!0}catch{return!1}}function Cs(e){return!!e&&e.constructor===Object}var Cl=t(99589);function Cc(e){let[n,t,r]=e.split(".");return`${n}.${t}.${r}`}function Cu(e,n){let t=function(e){let n=e.indexOf("-");if(n>=0){let t=Cc(e.slice(0,n)),r=e.slice(n+1);return`${t}-${r}`}return Cc(e)}(n);return Cl.satisfies(t,e,{includePrerelease:!0})}async function Cp(e,n={}){let t,{shouldRetry:r,getDelay:o,onError:i}=n;r=r??(e=>e<=5),o=o??(e=>(function(e,n=!1){return 1e3*Math.pow(2,n?e+1:e)})(e));let a=0;do try{return await Cd(o(a)),await e()}catch(e){i?.(e,a),t=e}while(r(a++));throw t}async function Cd(e){if(!(e<=0))return new Promise(n=>setTimeout(n,e))}},241(e,n,t){"use strict";t.d(n,{A:()=>r});let r=t(41917).A.Symbol},76912(e,n,t){"use strict";t.d(n,{A:()=>r});let r=function(e,n){for(var t=-1,r=n.length,o=e.length;++t<r;)e[o+t]=n[t];return e}},76335(e,n,t){"use strict";t.d(n,{A:()=>c});var r=t(76912),o=t(241),i=t(20018),a=t(92049),s=o.A?o.A.isConcatSpreadable:void 0;let l=function(e){return(0,a.A)(e)||(0,i.A)(e)||!!(s&&e&&e[s])},c=function e(n,t,o,i,a){var s=-1,c=n.length;for(o||(o=l),a||(a=[]);++s<c;){var u=n[s];t>0&&o(u)?t>1?e(u,t-1,o,i,a):(0,r.A)(a,u):i||(a[a.length]=u)}return a}},18348(e,n,t){"use strict";t.d(n,{A:()=>p});var r=t(241),o=Object.prototype,i=o.hasOwnProperty,a=o.toString,s=r.A?r.A.toStringTag:void 0;let l=function(e){var n=i.call(e,s),t=e[s];try{e[s]=void 0;var r=!0}catch(e){}var o=a.call(e);return r&&(n?e[s]=t:delete e[s]),o};var c=Object.prototype.toString,u=r.A?r.A.toStringTag:void 0;let p=function(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":u&&u in Object(e)?l(e):c.call(e)}},72136(e,n,t){"use strict";t.d(n,{A:()=>r});let r="object"==typeof global&&global&&global.Object===Object&&global},41917(e,n,t){"use strict";t.d(n,{A:()=>i});var r=t(72136),o="object"==typeof self&&self&&self.Object===Object&&self;let i=r.A||o||Function("return this")()},20018(e,n,t){"use strict";t.d(n,{A:()=>c});var r=t(18348),o=t(53098);let i=function(e){return(0,o.A)(e)&&"[object Arguments]"==(0,r.A)(e)};var a=Object.prototype,s=a.hasOwnProperty,l=a.propertyIsEnumerable;let c=i(function(){return arguments}())?i:function(e){return(0,o.A)(e)&&s.call(e,"callee")&&!l.call(e,"callee")}},92049(e,n,t){"use strict";t.d(n,{A:()=>r});let r=Array.isArray},53098(e,n,t){"use strict";t.d(n,{A:()=>r});let r=function(e){return null!=e&&"object"==typeof e}}}]);