@pih/esm-audit-app 2.1.0 → 2.1.1-pre.142

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/94.js CHANGED
@@ -12,8 +12,8 @@ If you're the maintainer: the 'elements' key only works with '_type' equal to 'A
12
12
  ${t}`)}return r}let aR=(e,t)=>{let n=structuredClone(t);if(!e)return n;for(let t of Object.keys(e)){let r=n[t],a=e[t];if(a&&(a.hasOwnProperty("_type")||a.hasOwnProperty("_default"))){n.hasOwnProperty(t)||(n[t]=a._default);let e=a._elements;if(r&&aj(e)){if(a._type===r7.Array&&Array.isArray(r)){let a=r.map(t=>aR(e,t));n[t]=a}else if(a._type===r7.Object)for(let t of Object.keys(r))r[t]=aR(e,r[t])}}else if(aF(a)){let e=r??{};aF(e)&&(n[t]=aR(a,e))}}return n};function aj(e){return!!e&&Object.keys(e).filter(e=>!["_default","_validators"].includes(e)).length>0}function aF(e){return"object"==typeof e&&!Array.isArray(e)&&null!==e}let aL=new Set;function aW(e,t){let n=`${e}:::${t}`;aL||(aL=new Set),aL.has(n)||(console.error(t),aL.add(n))}function aV(e){e?aL.forEach(t=>{t.startsWith(e)&&aL.delete(t)}):aL.clear()}function aG(){ay.forEach(e=>e()),ay.length=0,av()}let aU={"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:r7.Object,_default:{},_validators:[r8(e=>Object.keys(e).every(e=>/^[a-z]{2,3}(-[A-Z]{2,3})?$/.test(e)),e=>{let t=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: ${t.join(", ")}.`})]}},aH={"Display conditions":{privileges:{_description:"The privilege(s) the user must have to use this extension",_type:r7.Array,_default:[]},expression:{_description:"The expression that determines whether the extension is displayed",_type:r7.String,_default:void 0}},...aU},aq=(e,t)=>r8(n=>e<=n&&n<=t,`must be between ${e} and ${t}`),aK=e=>{let t=e.concat(["openmrsBase","openmrsSpaBase"]);return r8(e=>{if(!e||"string"!=typeof e)return!1;let n=/\${(.*?)}/g,r=n.exec(e);for(;r;){if(!t.includes(r[1]))return!1;r=n.exec(e)}return!0},"Should be a URL or path. The allowed template parameters are "+t.map(e=>"${"+e+"}").join(", "))},aZ=aK([]),aY=e=>r8(t=>e.includes(t),`Must be one of the following: '${e.join("', '")}'.`),aJ={inRange:aq,isUrl:aZ,isUrlWithTemplateParameters:aK,oneOf:aY};var aX=n(2034);let aQ=Y("breadcrumbs",[]);function a0(e){return a1([e])}function a1(e){let t=[...a2(),...e.map(e=>({matcher:e.matcher instanceof RegExp?e.matcher:"string"==typeof e.matcher?(0,aX.pathToRegexp)(e.matcher).regexp:(0,aX.pathToRegexp)(e.path).regexp,settings:e}))];aQ.setState(t,!0)}function a2(){return aQ.getState()}function a3(e,t){if(t)return function(e,t){let[n]=e.filter(e=>e.matcher.test(t));return n}(e,t)||function(e,t){let n=t.split("/");for(;n.length>1;){n.pop();let t=a3(e,n.join("/"));if(t)return t}}(e,t)}function a4(e,t){if(e.length>0){let n=a3(e,t);if(n){let t=[n],r=a3(e,n.settings.parent);for(;void 0!==r;)t.push(r),r=a3(e,r.settings.parent);return t.reverse()}}return[]}function a5(e){return a4(a2(),e)}var a6=Object.freeze({__proto__:null,get start(){return iA},get ensureJQuerySupport(){return o5},get setBootstrapMaxTime(){return oF},get setMountMaxTime(){return oL},get setUnmountMaxTime(){return oW},get setUnloadMaxTime(){return oV},get registerApplication(){return is},get unregisterApplication(){return ic},get getMountedApps(){return ir},get getAppStatus(){return io},get unloadApplication(){return iu},get checkActivityFunctions(){return il},get getAppNames(){return ia},get pathToActiveWhen(){return im},get navigateToUrl(){return oY},get patchHistoryApi(){return o2},get triggerAppChange(){return iy},get addErrorHandler(){return ot},get removeErrorHandler(){return on},get mountRootParcel(){return oO},get NOT_LOADED(){return oo},get LOADING_SOURCE_CODE(){return oi},get NOT_BOOTSTRAPPED(){return os},get BOOTSTRAPPING(){return ol},get NOT_MOUNTED(){return oc},get MOUNTING(){return ou},get UPDATING(){return op},get LOAD_ERROR(){return oh},get MOUNTED(){return od},get UNLOADING(){return om},get UNMOUNTING(){return of},get SKIP_BECAUSE_BROKEN(){return og}}),a7=("u">typeof globalThis?globalThis:"u">typeof window?window:"u">typeof global?global:"u">typeof self?self:{}).CustomEvent,a8=!function(){try{var e=new a7("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,t){var n=document.createEvent("CustomEvent");return t?n.initCustomEvent(e,t.bubbles,t.cancelable,t.detail):n.initCustomEvent(e,!1,!1,void 0),n}:function(e,t){var n=document.createEventObject();return n.type=e,t?(n.bubbles=!!t.bubbles,n.cancelable=!!t.cancelable,n.detail=t.detail):(n.bubbles=!1,n.cancelable=!1,n.detail=void 0),n}:a7;let a9=[];function oe(e,t,n){let r=oa(e,t,n);a9.length?a9.forEach(e=>e(r)):setTimeout(()=>{throw r})}function ot(e){if("function"!=typeof e)throw Error(or(28,!1));a9.push(e)}function on(e){if("function"!=typeof e)throw Error(or(29,!1));let t=!1;return a9=a9.filter(n=>{let r=n===e;return t=t||r,!r}),t}function or(e,t,...n){return`single-spa minified message #${e}: ${t?t+" ":""}See https://single-spa.js.org/error/?code=${e}${n.length?`&arg=${n.join("&arg=")}`:""}`}function oa(e,t,n){let r,a=`${o$(t)} '${ob(t)}' died in status ${t.status}: `;if(e instanceof Error){try{e.message=a+e.message}catch(e){}r=e}else{console.warn(or(30,!1,t.status,ob(t)));try{r=Error(a+JSON.stringify(e))}catch(t){r=e}}return r.appOrParcelName=ob(t),t.status=n,r}let oo="NOT_LOADED",oi="LOADING_SOURCE_CODE",os="NOT_BOOTSTRAPPED",ol="BOOTSTRAPPING",oc="NOT_MOUNTED",ou="MOUNTING",od="MOUNTED",op="UPDATING",of="UNMOUNTING",om="UNLOADING",oh="LOAD_ERROR",og="SKIP_BECAUSE_BROKEN";function o_(e){return e.status===od}function oy(e){try{return e.activeWhen(window.location)}catch(t){return oe(t,e,og),!1}}function ob(e){return e.name}function ov(e){return!!e.unmountThisParcel}function o$(e){return ov(e)?"parcel":"application"}function oA(){for(let e=arguments.length-1;e>0;e--)for(let t in arguments[e])"__proto__"!==t&&(arguments[e-1][t]=arguments[e][t]);return arguments[0]}function ow(e,t){for(let n=0;n<e.length;n++)if(t(e[n]))return e[n];return null}function ok(e){return e&&("function"==typeof e||Array.isArray(e)&&!ow(e,e=>"function"!=typeof e))}function ox(e,t){let n=e[t]||[];0===(n=Array.isArray(n)?n:[n]).length&&(n=[()=>Promise.resolve()]);let r=o$(e),a=ob(e);return function(e){return n.reduce((n,o,i)=>n.then(()=>{let n=o(e);return oC(n)?n:Promise.reject(or(15,!1,r,a,t,i))}),Promise.resolve())}}function oC(e){return e&&"function"==typeof e.then&&"function"==typeof e.catch}let oE=[];function oD(e,t){return Promise.resolve().then(()=>e.status!==os?e:(e.status=ol,e.bootstrap?oG(e,"bootstrap").then(n).catch(n=>{if(t)throw oa(n,e,og);return oe(n,e,og),e}):Promise.resolve().then(n)));function n(){return e.status=oc,e}}function oS(e,t){return Promise.resolve().then(()=>{if(e.status!==od)return e;return e.status=of,Promise.all(Object.keys(e.parcels).map(t=>e.parcels[t].unmountThisParcel())).then(n,r=>n().then(()=>{let n=Error(r.message);if(t)throw oa(n,e,og);oe(n,e,og)})).then(()=>e);function n(){return oG(e,"unmount").then(()=>{e.status=oc},n=>{if(t)throw oa(n,e,og);oe(n,e,og)})}})}let oz=!1,oP=!1;function oM(e,t){return Promise.resolve().then(()=>e.status!==oc?e:(oz||(window.dispatchEvent(new a8("single-spa:before-first-mount")),oz=!0),e.status=ou,oG(e,"mount").then(()=>(e.status=od,oP||(window.dispatchEvent(new a8("single-spa:first-mount")),oP=!0),e)).catch(n=>{return e.status=od,oS(e,!0).then(r,r);function r(){if(t)throw oa(n,e,og);return oe(n,e,og),e}})))}let oN=0,oT={parcels:{}};function oO(){return oI.apply(oT,arguments)}function oI(e,t){let n,r,a,o=this;if(!e||"object"!=typeof e&&"function"!=typeof e)throw Error(or(2,!1));if(e.name&&"string"!=typeof e.name)throw Error(or(3,!1,typeof e.name));let i=oN++,s=e.name||`parcel-${i}`;if("object"!=typeof t)throw Error(or(4,!1,s,typeof t));if(!t.domElement)throw Error(or(5,!1,s));let l="function"==typeof e,c=l?e:()=>Promise.resolve(e),u={id:i,parcels:{},status:l?oi:os,customProps:t,parentName:ob(o),unmountThisParcel:()=>f.then(()=>{if(u.status!==od)throw Error(or(6,!1,s,u.status));return oS(u,!0)}).then(e=>(u.parentName&&delete o.parcels[u.id],e)).then(e=>(r(e),e)).catch(e=>{throw u.status=og,a(e),e})};o.parcels[i]=u;let d=c();if(!d||"function"!=typeof d.then)throw Error(or(7,!1));let p=(d=d.then(e=>{if(!e)throw Error(or(8,!1));if(s=e.name||`parcel-${i}`,Object.prototype.hasOwnProperty.call(e,"bootstrap")&&!ok(e.bootstrap))throw Error(or(9,!1,s));if(!ok(e.mount))throw Error(or(10,!1,s));if(!ok(e.unmount))throw Error(or(11,!1,s));if(e.update&&!ok(e.update))throw Error(or(12,!1,s));let t=ox(e,"bootstrap"),r=ox(e,"mount"),a=ox(e,"unmount");u.status=os,u.name=s,u.bootstrap=t,u.mount=r,u.unmount=a,u.timeouts=oU(e.timeouts),e.update&&(u.update=ox(e,"update"),n.update=function(e){return u.customProps=e,oB(Promise.resolve().then(()=>{if(u.status!==od)throw Error(or(32,!1,ob(u)));return u.status=op,oG(u,"update").then(()=>(u.status=od,u)).catch(e=>{throw oa(e,u,og)})}))})})).then(()=>oD(u,!0)),f=p.then(()=>oM(u,!0)),m=new Promise((e,t)=>{r=e,a=t});return n={mount:()=>oB(Promise.resolve().then(()=>{if(u.status!==oc)throw Error(or(13,!1,s,u.status));return o.parcels[i]=u,oM(u)})),unmount:()=>oB(u.unmountThisParcel()),getStatus:()=>u.status,loadPromise:oB(d),bootstrapPromise:oB(p),mountPromise:oB(f),unmountPromise:oB(m)}}function oB(e){return e.then(()=>null)}function oR(e){let t=ob(e),n="function"==typeof e.customProps?e.customProps(t,window.location):e.customProps;("object"!=typeof n||null===n||Array.isArray(n))&&(n={},console.warn(or(40,!1),t,n));let r=oA({},n,{name:t,mountParcel:oI.bind(e),singleSpa:a6});return ov(e)&&(r.unmountSelf=e.unmountThisParcel),r}let oj={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 oF(e,t,n){if("number"!=typeof e||e<=0)throw Error(or(16,!1));oj.bootstrap={millis:e,dieOnTimeout:t,warningMillis:n||1e3}}function oL(e,t,n){if("number"!=typeof e||e<=0)throw Error(or(17,!1));oj.mount={millis:e,dieOnTimeout:t,warningMillis:n||1e3}}function oW(e,t,n){if("number"!=typeof e||e<=0)throw Error(or(18,!1));oj.unmount={millis:e,dieOnTimeout:t,warningMillis:n||1e3}}function oV(e,t,n){if("number"!=typeof e||e<=0)throw Error(or(19,!1));oj.unload={millis:e,dieOnTimeout:t,warningMillis:n||1e3}}function oG(e,t){let n=e.timeouts[t],r=n.warningMillis,a=o$(e);return new Promise((o,i)=>{let s=!1,l=!1;e[t](oR(e)).then(e=>{s=!0,o(e)}).catch(e=>{s=!0,i(e)}),setTimeout(()=>u(1),r),setTimeout(()=>u(!0),n.millis);let c=or(31,!1,t,a,ob(e),n.millis);function u(e){s||(!0===e?(l=!0,n.dieOnTimeout?i(Error(c)):console.error(c)):!l&&(console.warn(c),e*r+r<n.millis&&setTimeout(()=>u(e+1),r)))}})}function oU(e){let t={};for(let n in oj)t[n]=oA({},oj[n],e&&e[n]||{});return t}function oH(e){return Promise.resolve().then(()=>{let t,n;return e.loadPromise?e.loadPromise:e.status!==oo&&e.status!==oh?e:(e.status=oi,e.loadPromise=Promise.resolve().then(()=>{let r=e.loadApp(oR(e));if(!oC(r))throw n=!0,Error(or(33,!1,ob(e)));return r.then(n=>{let r;e.loadErrorTime=null,"object"!=typeof(t=n)&&(r=34),Object.prototype.hasOwnProperty.call(t,"bootstrap")&&!ok(t.bootstrap)&&(r=35),ok(t.mount)||(r=36),ok(t.unmount)||(r=37);let a=o$(t);if(r){let n;try{n=JSON.stringify(t)}catch(e){}return console.error(or(r,!1,a,ob(e),n),t),oe(void 0,e,og),e}return t.devtools&&t.devtools.overlays&&(e.devtools.overlays=oA({},e.devtools.overlays,t.devtools.overlays)),e.status=os,e.bootstrap=ox(t,"bootstrap"),e.mount=ox(t,"mount"),e.unmount=ox(t,"unmount"),e.unload=ox(t,"unload"),e.timeouts=oU(t.timeouts),delete e.loadPromise,e})}).catch(t=>{let r;return delete e.loadPromise,n?r=og:(r=oh,e.loadErrorTime=(new Date).getTime()),oe(t,e,r),e}))})}let oq="u">typeof window,oK={hashchange:[],popstate:[]},oZ=["hashchange","popstate"];function oY(e){let t;if("string"==typeof e)t=e;else if(this&&this.href)t=this.href;else{if(!(e&&e.currentTarget&&e.currentTarget.href&&e.preventDefault))throw Error(or(14,!1));t=e.currentTarget.href,e.preventDefault()}let n=o3(window.location.href),r=o3(t);0===t.indexOf("#")?window.location.hash=r.hash:n.host!==r.host&&r.host?window.location.href=t:r.pathname===n.pathname&&r.search===n.search?window.location.hash=r.hash:window.history.pushState(null,null,t)}function oJ(e){if(e){let t=e[0].type;oZ.indexOf(t)>=0&&oK[t].forEach(t=>{try{t.apply(this,e)}catch(e){setTimeout(()=>{throw e})}})}}function oX(){ib([],arguments)}function oQ(e,t){return function(){let n=window.location.href,a=e.apply(this,arguments),o=window.location.href;return r&&n===o||window.dispatchEvent(function(e,t){let n;try{n=new PopStateEvent("popstate",{state:e})}catch(t){(n=document.createEvent("PopStateEvent")).initPopStateEvent("popstate",!1,!1,e)}return n.singleSpa=!0,n.singleSpaTrigger=t,n}(window.history.state,t)),a}}let o0=null,o1=!1;function o2(e){if(o1)throw Error(or(43,!1));r=!e||!e.hasOwnProperty("urlRerouteOnly")||e.urlRerouteOnly,o1=!0,o0=window.history.replaceState,window.addEventListener("hashchange",oX),window.addEventListener("popstate",oX);let t=window.addEventListener,n=window.removeEventListener;window.addEventListener=function(e,n){if(!("function"==typeof n&&oZ.indexOf(e)>=0)||ow(oK[e],e=>e===n))return t.apply(this,arguments);oK[e].push(n)},window.removeEventListener=function(e,t){return"function"==typeof t&&oZ.indexOf(e)>=0&&(oK[e]=oK[e].filter(e=>e!==t)),n.apply(this,arguments)},window.history.pushState=oQ(window.history.pushState,"pushState"),window.history.replaceState=oQ(o0,"replaceState")}function o3(e){let t=document.createElement("a");return t.href=e,t}oq&&(window.singleSpaNavigate?console.warn(or(41,!1)):window.singleSpaNavigate=oY);let o4=!1;function o5(e=window.jQuery){if(e||window.$&&window.$.fn&&window.$.fn.jquery&&(e=window.$),e&&!o4){let t=e.fn.on,n=e.fn.off;e.fn.on=function(e,n){return o6.call(this,t,window.addEventListener,e,n,arguments)},e.fn.off=function(e,t){return o6.call(this,n,window.removeEventListener,e,t,arguments)},o4=!0}}function o6(e,t,n,r,a){return"string"!=typeof n?e.apply(this,a):(n.split(/\s+/).forEach(e=>{oZ.indexOf(e)>=0&&(t(e,r),n=n.replace(e,""))}),""===n.trim()?this:e.apply(this,a))}let o7={};function o8(e){return Promise.resolve().then(()=>{let t=o7[ob(e)];if(!t)return e;if(e.status===oo)return o9(e,t),e;if(e.status===om)return t.promise.then(()=>e);if(e.status!==oc&&e.status!==oh)return e;let n=e.status===oh?Promise.resolve():oG(e,"unload");return e.status=om,n.then(()=>(o9(e,t),e)).catch(n=>(delete o7[ob(e)],delete e.bootstrap,delete e.mount,delete e.unmount,delete e.unload,oe(n,e,og),t.reject(n),e))})}function o9(e,t){delete o7[ob(e)],delete e.bootstrap,delete e.mount,delete e.unmount,delete e.unload,e.status=oo,t.resolve()}function ie(e,t,n,r){o7[ob(e)]={app:e,resolve:n,reject:r},Object.defineProperty(o7[ob(e)],"promise",{get:t})}let it=[];function ir(){return it.filter(o_).map(ob)}function ia(){return it.map(ob)}function io(e){let t=ow(it,t=>ob(t)===e);return t?t.status:null}let ii=!1;function is(e,t,n,r){var a,o;let i,s,l=(i={name:null,loadApp:null,activeWhen:null,customProps:null},"object"==typeof e?(function(e){if(Array.isArray(e)||null===e)throw Error(or(39,!1));let t=["name","app","activeWhen","customProps"],n=Object.keys(e).reduce((e,n)=>t.indexOf(n)>=0?e:e.concat(n),[]);if(0!==n.length)throw Error(or(38,!1,t.join(", "),n.join(", ")));if("string"!=typeof e.name||0===e.name.length||"object"!=typeof e.app&&"function"!=typeof e.app)throw Error(or(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(or(24,!1));if(!ip(e.customProps))throw Error(or(22,!1))}(e),i.name=e.name,i.loadApp=e.app,i.activeWhen=e.activeWhen,i.customProps=e.customProps):(function(e,t,n,r){if("string"!=typeof e||0===e.length)throw Error(or(20,!1));if(!t)throw Error(or(23,!1));if("function"!=typeof n)throw Error(or(24,!1));if(!ip(r))throw Error(or(22,!1))}(e,t,n,r),i.name=e,i.loadApp=t,i.activeWhen=n,i.customProps=r),i.loadApp="function"!=typeof(a=i.loadApp)?()=>Promise.resolve(a):a,i.customProps=i.customProps||{},s=(s=Array.isArray(o=i.activeWhen)?o:[o]).map(e=>"function"==typeof e?e:im(e)),i.activeWhen=e=>s.some(t=>t(e)),i);if(i$||ii||(ii=!0,setTimeout(()=>{i$||console.warn(or(1,!1))},5e3)),-1!==ia().indexOf(l.name))throw Error(or(21,!1,l.name));it.push(oA({loadErrorTime:null,status:oo,parcels:{},devtools:{overlays:{options:{},selectors:[]}}},l)),oq&&(o5(),ib())}function il(e=window.location){return it.filter(t=>t.activeWhen(e)).map(ob)}function ic(e){if(0===it.filter(t=>ob(t)===e).length)throw Error(or(25,!1,e));return(oq?iu(e,{waitForUnmount:!1}):Promise.resolve()).then(()=>{let t=it.map(ob).indexOf(e);it.splice(t,1)})}function iu(e,t={waitForUnmount:!1}){if("string"!=typeof e)throw Error(or(26,!1));let n=ow(it,t=>ob(t)===e);if(!n)throw Error(or(27,!1,e));let r=o7[ob(n)];if(t&&t.waitForUnmount){if(r)return r.promise;{let e=new Promise((t,r)=>{ie(n,()=>e,t,r)});return e}}{let e;return r?(e=r.promise,id(n,r.resolve,r.reject)):e=new Promise((t,r)=>{ie(n,()=>e,t,r),id(n,t,r)}),e}}function id(e,t,n){Promise.resolve().then(()=>{if(ow(il(),t=>t===ob(e)))return iy()}).then(()=>oS(e).then(o8).then(()=>{t(),setTimeout(()=>{ib()})})).catch(n)}function ip(e){return!e||"function"==typeof e||"object"==typeof e&&null!==e&&!Array.isArray(e)}function im(e,t){let n=function(e,t){let n=0,r=!1,a="^";"/"!==e[0]&&(e="/"+e);for(let t=0;t<e.length;t++){let n=e[t],a=r&&"/"===n;(!r&&":"===n||a)&&o(t)}return o(e.length),RegExp(a,"i");function o(o){let i=e.slice(n,o).replace(/[|\\{}()[\]^$+*?.]/g,"\\$&");if(a+=r?"[^/]+/?":i,o===e.length)if(r)t&&(a+="$");else{let e=t?"":".*";a="/"===a.charAt(a.length-1)?`${a}${e}$`:`${a}(/${e})?(#.*)?$`}r=!r,n=o}}(e,t);return e=>{let t=e.origin;t||(t=`${e.protocol}//${e.host}`);let r=e.href.replace(t,"").replace(e.search,"").split("?")[0];return n.test(r)}}let ih=!1,ig=[],i_=oq&&window.location.href;function iy(){return ib()}function ib(e=[],t,n=!1){let r,a,o,i,s;if(ih)return new Promise((e,n)=>{ig.push({resolve:e,reject:n,eventArguments:t})});let{appsToUnload:l,appsToUnmount:c,appsToLoad:u,appsToMount:d}=(r=[],a=[],o=[],i=[],s=(new Date).getTime(),it.forEach(e=>{let t=e.status!==og&&oy(e);switch(e.status){case oh:t&&s-e.loadErrorTime>=200&&o.push(e);break;case oo:case oi:t&&o.push(e);break;case os:case oc:!t&&o7[ob(e)]?r.push(e):t&&i.push(e);break;case od:t||a.push(e)}}),{appsToUnload:r,appsToUnmount:a,appsToLoad:o,appsToMount:i}),p,f=[],m=i_,h=i_=window.location.href;return i$?(ih=!0,p=l.concat(u,c,d),Promise.resolve().then(()=>($(0===p.length?"before-no-app-change":"before-app-change",v(!0)),$("before-routing-event",v(!0,{cancelNavigation:g})),Promise.all(f).then(n=>{if(n.some(e=>e))return o0.call(window.history,history.state,"",m.substring(location.origin.length)),i_=location.href,ih=!1,ib(e,t,!0);let r=l.map(o8),a=Promise.all(c.map(oS).map(e=>e.then(o8)).concat(r));a.then(()=>{$("before-mount-routing-event",v(!0))},e=>{throw e});let o=u.map(e=>oH(e).then(e=>iv(e,a))),i=d.filter(e=>0>u.indexOf(e)).map(e=>iv(e,a));return a.catch(e=>{throw b(),e}).then(()=>(b(),Promise.all(o.concat(i)).catch(t=>{throw e.forEach(e=>e.reject(t)),t}).then(y).then(()=>{},e=>{throw e})))})))):(p=u,Promise.resolve().then(()=>Promise.all(u.map(oH)).then(b).then(()=>[]).catch(e=>{throw b(),e}).finally(()=>{})));function g(e=!0){let t="function"==typeof(null==e?void 0:e.then)?e:Promise.resolve(e);f.push(t.catch(e=>(console.warn(Error(or(42,!1))),console.warn(e),!1)))}function y(){let t=ir();e.forEach(e=>e.resolve(t));try{$(0===p.length?"no-app-change":"app-change",v()),$("routing-event",v())}catch(e){setTimeout(()=>{throw e})}if(ih=!1,ig.length>0){let e=ig;ig=[],ib(e)}return t}function b(){n||(e.forEach(e=>{oJ(e.eventArguments)}),oJ(t))}function v(e=!1,n){let r={},a={[od]:[],[oc]:[],[oo]:[],[og]:[]};e?(u.concat(d).forEach((e,t)=>{i(e,od)}),l.forEach(e=>{i(e,oo)}),c.forEach(e=>{i(e,oc)})):p.forEach(e=>{i(e)});let o={detail:{newAppStatuses:r,appsByNewStatus:a,totalAppChanges:p.length,originalEvent:null==t?void 0:t[0],oldUrl:m,newUrl:h}};return n&&oA(o.detail,n),o;function i(e,t){let n=ob(e);t=t||io(n),r[n]=t,(a[t]=a[t]||[]).push(n)}}function $(e,t){n||window.dispatchEvent(new a8(`single-spa:${e}`,t))}}function iv(e,t){return oy(e)?oD(e).then(e=>t.then(()=>oy(e)?oM(e):e)):t.then(()=>e)}let i$=!1;function iA(e){i$=!0,oq&&(o2(e),ib())}function iw(e,t){let n=window.getOpenmrsSpaBase().replace(/\/$/,"");return ik(e,{openmrsBase:window.openmrsBase,openmrsSpaBase:n,...t}).replace(/^\/\//,"/")}function ik(e,t){return Object.keys(t).reduce((e,n)=>e.split("${"+n+"}").join(t[n]),e)}function ix({to:e,templateParams:t}){let n=window.getOpenmrsSpaBase().replace(/\/$/,""),r=iw(e,t).replace(window.location.origin,"");r.startsWith(n)?oY(r):window.location.assign(r)}oq&&window.__SINGLE_SPA_DEVTOOLS__&&(window.__SINGLE_SPA_DEVTOOLS__.exposedMethods={getRawAppData:function(){return[...it]},reroute:ib,NOT_LOADED:oo,toLoadPromise:oH,toBootstrapPromise:oD,unregisterApplication:ic,getProfilerData:function(){return oE}});let iC="openmrs:history";function iE(e){let t=JSON.parse(sessionStorage.getItem(iC)??"[]")||[];t.push(e),t.length>50&&(t=t.slice(-50)),sessionStorage.setItem(iC,JSON.stringify(t))}function iD(){0===JSON.parse(sessionStorage.getItem(iC)??"[]").length&&document.referrer&&iE(document.referrer),window.addEventListener("single-spa:routing-event",e=>{let t=iS();e.detail.originalEvent?.singleSpaTrigger=="replaceState"?(t[t.length-1]=window.location.href,sessionStorage.setItem(iC,JSON.stringify(t))):!e.detail.originalEvent?.singleSpa&&t.includes(window.location.href)?iz({toUrl:window.location.href}):t[t.length-1]!==window.location.href&&iE(window.location.href)})}function iS(){return JSON.parse(sessionStorage.getItem(iC)??"[]")}function iz({toUrl:e}){let t=iS(),n=t.lastIndexOf(e);if(-1!=n){let e=t.slice(0,n+1);ix({to:t[n]}),sessionStorage.setItem(iC,JSON.stringify(e))}else throw Error(`URL ${e} not found in history; cannot go back to it.`)}function iP(){sessionStorage.removeItem(iC)}let iM="${openmrsSpaBase}/login",iN={redirectAuthFailure:{enabled:{_type:r7.Boolean,_default:!0,_description:"Whether to redirect logged-out users to `redirectAuthFailure.url`"},url:{_type:r7.String,_default:iM,_validators:[aJ.isUrl],_description:"The url to which users will be redirected when they are logged out. If set to blank, the `location` header from the response will be used."},errors:{_type:r7.Array,_default:[401],_elements:{_type:r7.Number,_validators:[aJ.inRange(100,600)]},_description:"The HTTP error codes for which users will be redirected"},resolvePromise:{_type:r7.Boolean,_default:!1,_description:"Changes how requests that fail authentication are handled. Try messing with this if redirects to the login page aren't working correctly."}},followRedirects:{_type:r7.Boolean,_default:!0,_description:"Whether openmrsFetch should support redirects returned from the backend"}};function iT(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}let iO="/ws/rest/v1",iI="/ws/fhir2/R4",iB=`${iO}/session`;function iR(e){return e&&e.startsWith("http")?e:("/"!==e[0]&&(e="/"+e),window.openmrsBase+e)}function ij(e,t={}){if("string"!=typeof e)throw Error("The first argument to @openmrs/api's openmrsFetch function must be a url string");if("object"!=typeof t)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 n=iR(e);if(t.headers||(t.headers={}),tu(t.body)&&(t.body=JSON.stringify(t.body)),void 0===t.headers.Accept&&(t.headers.Accept="application/json"),null===t.headers.Accept&&delete t.headers.Accept,e.startsWith(iO)&&void 0===t.headers["Disable-WWW-Authenticate"]&&(t.headers["Disable-WWW-Authenticate"]="true"),e.startsWith(iI)){let e=new URL(n,window.location.toString());e.searchParams.has("_summary")||(e.searchParams.set("_summary","data"),n=e.toString())}let r=Error();return window.fetch(n,t).then(async e=>{let{redirectAuthFailure:t,followRedirects:a}=await aE("@openmrs/esm-api");if(e.ok){let t=e.headers.get("location");return(a&&t&&(n===iR(iB)||204===e.status)&&ix({to:t}),204===e.status)?(e.data=null,e):e.clone().text().then(t=>{try{t&&(e.data=JSON.parse(t))}catch(e){}return e})}return n===iR(iB)&&403===e.status||t.enabled&&t.errors.includes(e.status)?(iP(),ix({to:t.url||e.headers.get("location")||iM}),t.resolvePromise?Promise.resolve():new Promise(()=>{})):e.clone().text().then(t=>{let a=t;try{a=JSON.parse(t)}catch(e){}throw new iL(n,e,a,r)},t=>{throw new iL(n,e,null,r)})})}function iF(e,t={}){if("object"!=typeof t)throw Error("The second argument to openmrsObservableFetch must be either omitted or an object");let n=new AbortController;return t.signal=n.signal,new eQ(r=>{let a=!1;return ij(e,t).then(e=>{a=!0,r.next(e),r.complete()},e=>{a=!0,r.error(e)}),()=>{a||n.abort()}})}class iL extends Error{constructor(e,t,n,r){super(),iT(this,"response",void 0),iT(this,"responseBody",void 0),this.message=`Server responded with ${t.status} (${t.statusText}) for url ${e}. Check err.responseBody or network tab in dev tools for more info`,r.message=this.message,this.responseBody=n,this.response=t,this.stack=`Stacktrace for outgoing request:
13
13
  ${r.stack}
14
14
  Stacktrace for incoming response:
15
- ${this.stack}`}}let iW=Y("session",{loaded:!1,session:null}),iV=0;function iG(e={includeAuthStatus:!0}){return(iV<Date.now()-6e4||!iW.getState().loaded)&&iq(),new eQ(t=>{let n=n=>{n.loaded&&(e.includeAuthStatus?t.next(n.session):t.next(n.session?.user))};return n(iW.getState()),iW.subscribe(n)})}function iU(){return(iV<Date.now()-6e4||!iW.getState().loaded)&&iq(),iW}function iH(e){let t=e.locale??e.user?.userProperties?.defaultLocale;t&&t.includes("_")&&(t=t.replaceAll("_","-")),function(e){if(void 0===e||"string"!=typeof e)return!1;try{new Intl.Locale(e)}catch(e){return!1}return!0}(t)&&t!==document.documentElement.getAttribute("lang")&&document.documentElement.setAttribute("lang",t)}function iq(e,t){iV=Date.now();let n={};return e&&t&&(n.Authorization=`Basic ${window.btoa(`${e}:${t}`)}`),i0(ij(iB,{headers:n}))}function iK(){iW.setState({loaded:!0,session:{authenticated:!1,sessionId:""}})}function iZ(e,t){var n,r;if(void 0===t)return!e;if(!e)return!0;return n=e,r=t,("string"==typeof n?!et(r.privileges.find(e=>n===e.display)):Array.isArray(n)?n.every(e=>!et(r.privileges.find(t=>e===t.display))):(et(n)||console.error(`Could not understand privileges "${n}"`),!0))||!et(t.roles.find(e=>"System Developer"===e.display))}function iY(){let e,t;return new Promise(n=>{let r=r=>{r.loaded&&r.session.user&&(e=r.session.user,n(r.session.user),t&&t())};r(iW.getState()),e||(t=iW.subscribe(r))})}function iJ(){return new Promise((e,t)=>{iG().subscribe(t=>{e(t.sessionLocation)},t).unsubscribe()})}async function iX(e,t){return i0(ij(iB,{method:"POST",body:{sessionLocation:e},headers:{"Content-Type":"application/json"},signal:t.signal}))}async function iQ(e,t,n){return n||(n=new AbortController),await ij(`${iO}/user/${e}`,{method:"POST",body:{userProperties:t},headers:{"Content-Type":"application/json"},signal:n.signal}),iq()}function i0(e){return new Promise((t,n)=>{e.then(e=>{let r;"object"==typeof e?.data?(r={loaded:!0,session:e.data},iW.setState(r),t(r)):(r={loaded:!1,session:null},iW.setState(r),n(r))}).catch(e=>{F(`Failed to fetch new session information: ${e}`);let t={loaded:!1,session:null};iW.setState(t),n(t)})})}function i1(){return"development"===window.spaEnv||"true"===localStorage.getItem("openmrs:devtools")}iW.subscribe(e=>{e.loaded&&e.session&&iH(e.session)});let i2={"webservices.rest":"2.24.0",fhir2:"1.0.0-SNAPSHOT"};function i3(){a$("@openmrs/esm-api",iN),iq()}let i4={address1:"Address line 1",address2:"Address line 2",address3:"Address line 3",address4:"Address line 4",address5:"Address line 5",address6:"Address line 6",city:"City",cityVillage:"City",country:"Country",countyDistrict:"District",district:"District",postalCode:"Postal code",state:"State",stateProvince:"State",closeAllOpenedWorkspaces:"Discard changes in {{count}} workspaces",closingAllWorkspacesPromptBody:"There may be unsaved changes in the following workspaces. Do you want to discard changes in the following workspaces? {{workspaceNames}}",closingAllWorkspacesPromptTitle:"You have unsaved changes",discard:"Discard",hide:"Hide",maximize:"Maximize",minimize:"Minimize",openAnyway:"Open anyway",unsavedChangesInOpenedWorkspace:"You may have unsaved changes in the opened workspace. Do you want to discard these changes?",unsavedChangesInWorkspace:'There may be unsaved changes in "{{workspaceName}}". Please save them before opening another workspace.',unsavedChangesTitleText:"Unsaved changes",workspaceHeader:"Workspace header",discardUnsavedChangesPromptBodyMultiple:"{{count}} workspaces have unsaved changes. Closing them will discard the changes:",discardUnsavedChangesPromptBodySingle:"<strong>{{workspaceTitle}}</strong> has unsaved changes. Closing it will discard them.",discardUnsavedChangesPromptTitle:"Discard unsaved changes?",keepEditing:"Keep editing",abnormalValue:"Abnormal value",actions:"Actions",actionableNotification:"Actionable notification",address:"Address",age:"Age",batchActionItemSelected:"{{totalSelected}} item selected",batchActionsItemsSelected:"{{totalSelected}} items selected",cancel:"Cancel",change:"Change",Clinic:"Clinic",close:"Close",closesActionableNotification:"Close actionable notification",closeSnackbar:"Close snackbar",confirm:"Confirm",contactAdministratorIfIssuePersists:"Contact your system administrator if the problem persists.",contactDetails:"Contact details",delete:"Delete",discardChanges:"Discard changes",edit:"Edit",emptyStateText:"There are no {{displayText}} to display",error:"Error",errorCopy:"Sorry, there was a problem displaying this information. You can try to reload this page, or contact the site administrator and quote the error code above.",errorLoadingLoginLocations:"Unable to load login locations. Please try again or contact support if the problem persists.",female:"Female",leftNavigation:"Left navigation",loading:"Loading",localVersion:"Local Build",male:"Male",noResultsToDisplay:"No results to display",notAvailable:"Not available",other:"Other",paginationItemsCount:"{{pageItemsCount}} / {{totalItems}} items",paginationOfPages:"of {{count}} pages",patientAvatarAlt:"Avatar for {{patientName}}",patientIdentifierSticker:"Patient identifier sticker",patientLists:"Patient lists",patientPhotoAlt:"Profile photo of {{patientName}}",patientPhotoPlaceholder:"Photo placeholder for {{patientName}}",prereleaseVersion:"Prerelease",print:"Print",printError:"Print error",printErrorExplainer:"An error occurred in {{errorLocation}}",printIdentifierSticker:"Print identifier sticker",printing:"Printing",recordNewEntry:"Record {{displayText}}",relationships:"Relationships",resetOverrides:"Reset overrides",save:"Save",scriptLoadingFailed:"Error: Script failed to load",scriptLoadingError:"Failed to load overridden script from {{url}}. Please check that the bundled script is available at the expected URL. Click the button below to reset all import map overrides.",searchForLocation:"Search for a location",seeAll:"See all",seeMoreLists:"See {{count}} more lists",selectAll:"Select all",sex:"Sex",showLess:"Show less",showMore:"Show more",snackbarNotification:"Snackbar notification",toggleDevTools:"Toggle dev tools",unknown:"Unknown",yearAbbreviation:"yr",yearsAbbreviation:"yrs"};var i5=n(2134),i6=n.n(i5);let i7=i6().default||i6();function i8(e,t,n,r){return i7.t(t,{ns:e,defaultValue:n,...r})}function i9(e,t,n){return i4[e]?i8("core",e,t??i4[e],n):(console.error(`O3 Core Translations does not provide key '${e}'. The key itself is being rendered as text.`),e)}i7.on("initialized",function(){window.i18next.loadNamespaces(["core"])});let se="import-map-override:",st="import-map-overrides-disabled",sn="import-map-overrides:change",sr=!1,sa=null,so=null;async function si(){return so??(so=ss().then(({map:e,complete:t})=>(t||(so=null),e))),so}async function ss(){let e=document.querySelectorAll('script[type="systemjs-importmap"]'),t=[],n=!0;for(let r=0;r<e.length;r++){let a=e[r];try{if(a.src){let e=await fetch(a.src);if(!e.ok)throw Error(`Request for ${a.src} returned ${e.status} ${e.statusText}`);t.push(await e.json())}else a.textContent&&t.push(JSON.parse(a.textContent))}catch(e){n=!1,console.warn(`[import-maps] Failed to parse import map from script tag at index ${r}`,e)}}return{map:sl(t),complete:n}}function sl(e){let t={imports:{}};for(let n of e)n?.imports&&Object.assign(t.imports,n.imports);return t}function sc(){let e={};try{let t=sm();for(let n=0;n<localStorage.length;n++){let r=localStorage.key(n);if(r?.startsWith(se)){let n=r.slice(se.length);if(!t.includes(n)){let t=localStorage.getItem(r);t&&(e[n]=t)}}}}catch(e){console.warn("[import-maps] Failed to read import-map overrides from localStorage",e)}return{imports:e}}async function su(){let e=await si();return sr?sl([e,sa??sc()]):e}async function sd(){return si()}async function sp(){return sr?sl([await si(),sc()]):si()}function sf(e){if(!sr)return{imports:{}};if(e){let e={};for(let t=0;t<localStorage.length;t++){let n=localStorage.key(t);if(n?.startsWith(se)){let t=localStorage.getItem(n);t&&(e[n.slice(se.length)]=t)}}return{imports:e}}return sc()}function sm(){if(!sr)return[];try{let e=localStorage.getItem(st);if(e){let t=JSON.parse(e);if(Array.isArray(t))return t}}catch{}return[]}function sh(e){return!!sr&&sm().includes(e)}function sg(e,t){if(!sr)return void console.warn("[Security] Import map overrides are disabled in production mode.");try{localStorage.setItem(se+e,t),window.dispatchEvent(new CustomEvent(sn))}catch(e){console.warn("[import-maps] Failed to write import-map override to localStorage",e)}}function s_(e){if(!sr)return void console.warn("[Security] Import map overrides are disabled in production mode.");try{localStorage.removeItem(se+e);let t=sm().filter(t=>t!==e);t.length>0?localStorage.setItem(st,JSON.stringify(t)):localStorage.removeItem(st),window.dispatchEvent(new CustomEvent(sn))}catch(e){console.warn("[import-maps] Failed to update import-map overrides in localStorage",e)}}function sy(){if(!sr)return void console.warn("[Security] Import map overrides are disabled in production mode.");try{let e=[];for(let t=0;t<localStorage.length;t++){let n=localStorage.key(t);n?.startsWith(se)&&e.push(n)}e.forEach(e=>localStorage.removeItem(e)),localStorage.removeItem(st),window.dispatchEvent(new CustomEvent(sn))}catch(e){console.warn("[import-maps] Failed to clear import-map overrides from localStorage",e)}}function sb(e){if(!sr)return void console.warn("[Security] Import map overrides are disabled in production mode.");try{let t=sm().filter(t=>t!==e);t.length>0?localStorage.setItem(st,JSON.stringify(t)):localStorage.removeItem(st),window.dispatchEvent(new CustomEvent(sn))}catch(e){console.warn("[import-maps] Failed to update import-map overrides in localStorage",e)}}let sv=!1;function s$(){!sv&&(sv=!0,(sr="development"===window.spaEnv)&&(sa=sc()))}function sA(e){return e.replace(/[\/\-@]/g,"_")}async function sw(e,t="./start",r){var a;let o,i=!r?.maxLoadingTime||r.maxLoadingTime<=0?6e5:r.maxLoadingTime;await Promise.race([sk(e,r?.importMap),new Promise((t,n)=>{o=setTimeout(()=>{var t;n(Error(`Could not resolve requested script, ${e}, within ${(t=i)<1e3?`${t} milliseconds`:t<6e4?`${Math.floor(t/1e3)} seconds`:t<36e5?`${Math.floor(t/6e4)} minutes`:t<864e5?`${Math.floor(t/36e5)} hours`:`${Math.floor(t/864e5)} days`}.`))},i)})]),o&&clearTimeout(o);let s=sA(e),l=window[s];if(!("object"==typeof(a=l)&&null!==a&&"init"in a&&"function"==typeof a.init&&"get"in a&&"function"==typeof a.get)){let e=`The global variable ${s} does not refer to a federated module`;throw console.error(e),Error(e)}l.init(n.S.default);let c=(await l.get(t))();if("object"!=typeof c||null===c){let t=`Container for ${e} did not return an ESM module as expected`;throw console.error(t),Error(t)}return c}async function sk(e,t){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 n=sA(e);if(!window[n]){let n=t??await sx();if(!n.imports.hasOwnProperty(e)){let t=`Could not find the package ${e} defined in the current importmap`;throw console.error(t),Error(t)}let r=n.imports[e];r.startsWith("./")&&(r=window.spaBase+r.substring(1));let a=e in sf().imports;try{return await new Promise((e,t)=>{!function(e,t,n){let r=document.head.querySelector(`script[src="${e}"]`),a=window[sC];if(a||(a=window[sC]=new Set([])),r)if(a.has(e)){let e,a,o;o=()=>{e&&r.removeEventListener("load",e),a&&r.removeEventListener("error",a)},e=()=>{o(),t(null)},a=e=>{o(),n(e.message)},r.addEventListener("load",e),r.addEventListener("error",a)}else console.warn(`Script at ${e} already loaded. Not loading it again.`),t(null);else{let r,o,i;a.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);i=()=>{clearTimeout(l),a.delete(e),r&&s.removeEventListener("load",r),o&&s.removeEventListener("error",o)},r=()=>{i(),t(null)},o=t=>{i();let r=`Failed to load script from ${e}`;console.error(r,t),n(t.message??r)},s.addEventListener("load",r),s.addEventListener("error",o),document.head.appendChild(s)}}(r,e,t)})}catch(e){return a&&O({kind:"error",title:i9("scriptLoadingFailed","Error: Script failed to load"),description:i9("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:i9("resetOverrides","Reset overrides"),onActionButtonClick(){sy(),window.location.reload()}}),Promise.reject(e)}}return Promise.resolve()}async function sx(){return su()}let sC=Symbol("__openmrs_script_loading");function sE(e){return!!e&&"object"==typeof e&&!(Object.hasOwn(e,"pages")&&(!e.pages||!Array.isArray(e.pages))||Object.hasOwn(e,"extensions")&&(!e.extensions||!Array.isArray(e.extensions))||Object.hasOwn(e,"workspaces")&&(!e.workspaces||!Array.isArray(e.workspaces))||Object.hasOwn(e,"modals")&&(!e.modals||!Array.isArray(e.modals)))}function sD(e){return!!e&&"object"==typeof e&&"routes"in e&&!!e.routes&&"object"==typeof e.routes&&Object.entries(e.routes).every(([e,t])=>"string"==typeof e&&sE(t))}let sS="openmrs-routes:",sz="openmrs-routes:change",sP=!1,sM=null,sN=null;async function sT(){return sN??(sN=sO().then(({map:e,complete:t})=>(t||(sN=null),e))),sN}async function sO(){let e=document.querySelectorAll("script[type='openmrs-routes']"),t=[],n=!0;for(let r=0;r<e.length;r++){let a=e[r];try{let e;if(a.src){let t=await fetch(a.src);if(!t.ok)throw Error(`Request for ${a.src} returned ${t.status} ${t.statusText}`);e=await t.json()}else a.textContent&&(e=JSON.parse(a.textContent));e&&sD(e)&&t.push(e)}catch(e){n=!1,console.warn(`[route-maps] Failed to parse routes from script tag at index ${r}`,e)}}return{map:sI(t),complete:n}}function sI(e){let t={routes:{}};for(let n of e)n&&"object"==typeof n&&!Array.isArray(n)&&(Object.assign(t.routes,n.routes),void 0===t.version&&void 0!==n.version&&(t.version=n.version));return t}async function sB(){let e={version:void 0,routes:{}};try{let t=[];for(let e=0;e<localStorage.length;e++){let n=localStorage.key(e);if(n?.startsWith(sS)){let e=localStorage.getItem(n);e&&t.push({moduleName:n.slice(sS.length),raw:e})}}for(let n of(await Promise.allSettled(t.map(async({moduleName:e,raw:t})=>{let n=JSON.parse(t);if(sE(n))return{moduleName:e,routes:n};if("string"==typeof n&&n.startsWith("http")){let t=await fetch(n),r=await t.json();if(sE(r))return{moduleName:e,routes:r};throw Error(`${n} did not resolve to a valid OpenmrsAppRoutes object`)}throw Error(`Override for ${e} is neither a valid routes object nor a URL`)}))))"fulfilled"===n.status?e.routes[n.value.moduleName]=n.value.routes:console.warn("[route-maps] Failed to load route override",n.reason)}catch(e){console.warn("[route-maps] Failed to read route overrides from localStorage",e)}return e}async function sR(){let e=await sT();return sP?sI([e,sM??await sB()]):e}async function sj(){return sT()}async function sF(){return sP?sI([await sT(),await sB()]):sT()}function sL(){if(!sP)return{};let e={};try{for(let t=0;t<localStorage.length;t++){let n=localStorage.key(t);if(n?.startsWith(sS)){let t=localStorage.getItem(n);t&&(e[n.slice(sS.length)]=t)}}}catch(e){console.warn("[route-maps] Failed to read route overrides from localStorage",e)}return e}function sW(e,t){if(!sP)return void console.warn("[Security] Route overrides are disabled outside development mode.");try{if("string"==typeof t)if(t.startsWith("http"))localStorage.setItem(sS+e,JSON.stringify(t));else{let n=JSON.parse(t);if(!sE(n))return void console.error(`The supplied routes for ${e} is not a valid OpenmrsAppRoutes object`,t);localStorage.setItem(sS+e,JSON.stringify(n))}else if(t instanceof URL)localStorage.setItem(sS+e,JSON.stringify(t.toString()));else{if(!sE(t))return void console.error(`Override for ${e} is not in a valid format. Expected either a Javascript Object, a JSON string of a Javascript object, or a URL`,t);localStorage.setItem(sS+e,JSON.stringify(t))}window.dispatchEvent(new CustomEvent(sz))}catch(e){console.warn("[route-maps] Failed to write route override to localStorage",e)}}function sV(e){if(!sP)return void console.warn("[Security] Route overrides are disabled outside development mode.");try{localStorage.removeItem(sS+e),window.dispatchEvent(new CustomEvent(sz))}catch(e){console.warn("[route-maps] Failed to remove route override from localStorage",e)}}function sG(){if(!sP)return void console.warn("[Security] Route overrides are disabled outside development mode.");try{let e=[];for(let t=0;t<localStorage.length;t++){let n=localStorage.key(t);n?.startsWith(sS)&&e.push(n)}e.forEach(e=>localStorage.removeItem(e)),window.dispatchEvent(new CustomEvent(sz))}catch(e){console.warn("[route-maps] Failed to clear route overrides from localStorage",e)}}let sU=null;function sH(){return sU||(sU=(sP="development"===window.spaEnv)?sB().then(e=>{sM=e}):Promise.resolve())}let sq=`${iO}/attachment`;function sK(e,t){return ij(`${sq}/${e}`,{signal:t.signal})}function sZ(e,t,n){return ij(`${sq}?patient=${e}&includeEncounterless=${t}`,{signal:n.signal})}async function sY(e,t){let n=new FormData;return n.append("fileCaption",t.fileDescription),n.append("patient",e),t.file?n.append("file",t.file,t.fileName):(n.append("file",new File([""],t.fileName),t.fileName),n.append("base64Content",t.base64Content)),ij(`${sq}`,{method:"POST",body:n})}function sJ(e,t){return ij(`${sq}/${e}`,{method:"DELETE",signal:t.signal})}try{self["workbox:window:6.5.4"]&&_()}catch(e){}function sX(e,t){return new Promise(function(n){var r=new MessageChannel;r.port1.onmessage=function(e){n(e.data)},e.postMessage(t,[r.port2])})}function sQ(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function s0(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}try{self["workbox:core:6.5.4"]&&_()}catch(e){}var s1=function(){var e=this;this.promise=new Promise(function(t,n){e.resolve=t,e.reject=n})};function s2(e,t){var n=location.href;return new URL(e,n).href===new URL(t,n).href}var s3=function(e,t){this.type=e,Object.assign(this,t)};function s4(e,t,n){return n?t?t(e):e:(e&&e.then||(e=Promise.resolve(e)),t?e.then(t):e)}function s5(){}var s6={type:"SKIP_WAITING"};function s7(e,t){if(!t)return e&&e.then?e.then(s5):Promise.resolve()}var s8=function(e){function t(t,n){var r,a;return void 0===n&&(n={}),(r=e.call(this)||this).nn={},r.tn=0,r.rn=new s1,r.en=new s1,r.on=new s1,r.un=0,r.an=new Set,r.cn=function(){var e=r.fn,t=e.installing;r.tn>0||!s2(t.scriptURL,r.sn.toString())||performance.now()>r.un+6e4?(r.vn=t,e.removeEventListener("updatefound",r.cn)):(r.hn=t,r.an.add(t),r.rn.resolve(t)),++r.tn,t.addEventListener("statechange",r.ln)},r.ln=function(e){var t=r.fn,n=e.target,a=n.state,o=n===r.vn,i={sw:n,isExternal:o,originalEvent:e};!o&&r.mn&&(i.isUpdate=!0),r.dispatchEvent(new s3(a,i)),"installed"===a?r.wn=self.setTimeout(function(){"installed"===a&&t.waiting===n&&r.dispatchEvent(new s3("waiting",i))},200):"activating"===a&&(clearTimeout(r.wn),o||r.en.resolve(n))},r.dn=function(e){var t=r.hn,n=t!==navigator.serviceWorker.controller;r.dispatchEvent(new s3("controlling",{isExternal:n,originalEvent:e,sw:t,isUpdate:r.mn})),n||r.on.resolve(t)},a=function(e){var t=e.data,n=e.ports,a=e.source;return s4(r.getSW(),function(){r.an.has(a)&&r.dispatchEvent(new s3("message",{data:t,originalEvent:e,ports:n,sw:a}))})},r.gn=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];try{return Promise.resolve(a.apply(this,e))}catch(e){return Promise.reject(e)}},r.sn=t,r.nn=n,navigator.serviceWorker.addEventListener("message",r.gn),r}t.prototype=Object.create(e.prototype),t.prototype.constructor=t,t.__proto__=e;var n,r,a=t.prototype;return a.register=function(e){var t=(void 0===e?{}:e).immediate,n=void 0!==t&&t;try{var r,a,o,i=this;return r=function(){if(!n&&"complete"!==document.readyState)return s7(new Promise(function(e){return window.addEventListener("load",e)}))},a=function(){return i.mn=!!navigator.serviceWorker.controller,i.yn=i.pn(),s4(i.bn(),function(e){i.fn=e,i.yn&&(i.hn=i.yn,i.en.resolve(i.yn),i.on.resolve(i.yn),i.yn.addEventListener("statechange",i.ln,{once:!0}));var t=i.fn.waiting;return t&&s2(t.scriptURL,i.sn.toString())&&(i.hn=t,Promise.resolve().then(function(){i.dispatchEvent(new s3("waiting",{sw:t,wasWaitingBeforeRegister:!0}))}).then(function(){})),i.hn&&(i.rn.resolve(i.hn),i.an.add(i.hn)),i.fn.addEventListener("updatefound",i.cn),navigator.serviceWorker.addEventListener("controllerchange",i.dn),i.fn})},(o=r())&&o.then?o.then(a):a(o)}catch(e){return Promise.reject(e)}},a.update=function(){try{return this.fn?s7(this.fn.update()):void 0}catch(e){return Promise.reject(e)}},a.getSW=function(){return void 0!==this.hn?Promise.resolve(this.hn):this.rn.promise},a.messageSW=function(e){try{return s4(this.getSW(),function(t){return sX(t,e)})}catch(e){return Promise.reject(e)}},a.messageSkipWaiting=function(){this.fn&&this.fn.waiting&&sX(this.fn.waiting,s6)},a.pn=function(){var e=navigator.serviceWorker.controller;return e&&s2(e.scriptURL,this.sn.toString())?e:void 0},a.bn=function(){try{var e=this;return function(e,t){try{var n=e()}catch(e){return t(e)}return n&&n.then?n.then(void 0,t):n}(function(){return s4(navigator.serviceWorker.register(e.sn,e.nn),function(t){return e.un=performance.now(),t})},function(e){throw e})}catch(e){return Promise.reject(e)}},n=[{key:"active",get:function(){return this.en.promise}},{key:"controlling",get:function(){return this.on.promise}}],sQ(t.prototype,n),r&&sQ(t,r),t}(function(){function e(){this.Pn=new Map}var t=e.prototype;return t.addEventListener=function(e,t){this.Sn(e).add(t)},t.removeEventListener=function(e,t){this.Sn(e).delete(t)},t.dispatchEvent=function(e){e.target=this;for(var t,n=function(e){var t;if("u"<typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(t=function(e){if(e){if("string"==typeof e)return s0(e,void 0);var t=Object.prototype.toString.call(e).slice(8,-1);return"Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t?Array.from(e):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?s0(e,void 0):void 0}}(e))){t&&(e=t);var n=0;return function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}}}throw TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}return(t=e[Symbol.iterator]()).next.bind(t)}(this.Sn(e.type));!(t=n()).done;)(0,t.value)(e)},t.Sn=function(e){return this.Pn.has(e)||this.Pn.set(e,new Set),this.Pn.get(e)},e}());function s9(e,t){if(void 0!==p)return console.warn(`The application's Service Worker has already been registered. The new service worker at ${e} will not be registered.`),p;if(!("serviceWorker"in navigator))throw Error("Registering the Service Worker is not possible due to missing browser capabilities.");let n=new s8(e,t);return p=n.register().then(()=>n.controlling.then(()=>n))}function le(){return p??Promise.resolve(void 0)}let lt="x-omrs-offline-response-body",ln="x-omrs-offline-response-status",lr="x-omrs-offline-caching-strategy";async function la(e){let t=await le();return t?await t.messageSW(e):{success:!1,result:void 0,error:"No service worker has been registered. This is typically the case when the application has been built without offline-related features."}}async function lo(){let e=window.sessionStorage;try{e.setItem("someKeyHere","test"),e.removeItem("someKeyHere")}catch(t){if(t.code===DOMException.QUOTA_EXCEEDED_ERR&&0===e.length)return!0}return!1}async function li(){return!window.indexedDB}async function ls(){return new Promise(e=>{let t=indexedDB.open("test");t.onerror=()=>e(!0),t.onsuccess=()=>e(!1)})}async function ll(){return await ls()||await li()||await lo()}let lc="openmrs3:offline-mode",lu="unavailable";function ld(){return{current:lu,notAvailable:"unavailable"===lu,active:"on"===lu}}function lp(e){"unavailable"!==lu&&"unavailable"!==e&&(localStorage.setItem(lc,"on"===e?"active":"disabled"),lu=e)}async function lf(){await ll()||(lu="active"===localStorage.getItem(lc)?"on":"off"),navigator.onLine}let lm="u">typeof globalThis?globalThis:"u">typeof self?self:"u">typeof window?window:global,lh=Object.keys,lg=Array.isArray;function l_(e,t){return"object"!=typeof t||lh(t).forEach(function(n){e[n]=t[n]}),e}"u"<typeof Promise||lm.Promise||(lm.Promise=Promise);let ly=Object.getPrototypeOf,lb={}.hasOwnProperty;function lv(e,t){return lb.call(e,t)}function l$(e,t){"function"==typeof t&&(t=t(ly(e))),("u"<typeof Reflect?lh:Reflect.ownKeys)(t).forEach(n=>{lw(e,n,t[n])})}let lA=Object.defineProperty;function lw(e,t,n,r){lA(e,t,l_(n&&lv(n,"get")&&"function"==typeof n.get?{get:n.get,set:n.set,configurable:!0}:{value:n,configurable:!0,writable:!0},r))}function lk(e){return{from:function(t){return e.prototype=Object.create(t.prototype),lw(e.prototype,"constructor",e),{extend:l$.bind(null,e.prototype)}}}}let lx=Object.getOwnPropertyDescriptor;function lC(e,t){let n;return lx(e,t)||(n=ly(e))&&lC(n,t)}let lE=[].slice;function lD(e,t,n){return lE.call(e,t,n)}function lS(e,t){return t(e)}function lz(e){if(!e)throw Error("Assertion Failed")}function lP(e){lm.setImmediate?setImmediate(e):setTimeout(e,0)}function lM(e,t){return e.reduce((e,n,r)=>{var a=t(n,r);return a&&(e[a[0]]=a[1]),e},{})}function lN(e,t){if("string"==typeof t&&lv(e,t))return e[t];if(!t)return e;if("string"!=typeof t){for(var n=[],r=0,a=t.length;r<a;++r){var o=lN(e,t[r]);n.push(o)}return n}var i=t.indexOf(".");if(-1!==i){var s=e[t.substr(0,i)];return null==s?void 0:lN(s,t.substr(i+1))}}function lT(e,t,n){if(e&&void 0!==t&&(!("isFrozen"in Object)||!Object.isFrozen(e)))if("string"!=typeof t&&"length"in t){lz("string"!=typeof n&&"length"in n);for(var r=0,a=t.length;r<a;++r)lT(e,t[r],n[r])}else{var o=t.indexOf(".");if(-1!==o){var i=t.substr(0,o),s=t.substr(o+1);if(""===s)void 0===n?lg(e)&&!isNaN(parseInt(i))?e.splice(i,1):delete e[i]:e[i]=n;else{var l=e[i];l&&lv(e,i)||(l=e[i]={}),lT(l,s,n)}}else void 0===n?lg(e)&&!isNaN(parseInt(t))?e.splice(t,1):delete e[t]:e[t]=n}}function lO(e){var t={};for(var n in e)lv(e,n)&&(t[n]=e[n]);return t}let lI=[].concat;function lB(e){return lI.apply([],e)}let lR="BigUint64Array,BigInt64Array,Array,Boolean,String,Date,RegExp,Blob,File,FileList,FileSystemFileHandle,FileSystemDirectoryHandle,ArrayBuffer,DataView,Uint8ClampedArray,ImageBitmap,ImageData,Map,Set,CryptoKey".split(",").concat(lB([8,16,32,64].map(e=>["Int","Uint","Float"].map(t=>t+e+"Array")))).filter(e=>lm[e]),lj=lR.map(e=>lm[e]);lM(lR,e=>[e,!0]);let lF=null;function lL(e){lF="u">typeof WeakMap&&new WeakMap;let t=function e(t){if(!t||"object"!=typeof t)return t;let n=lF&&lF.get(t);if(n)return n;if(lg(t)){n=[],lF&&lF.set(t,n);for(var r=0,a=t.length;r<a;++r)n.push(e(t[r]))}else if(lj.indexOf(t.constructor)>=0)n=t;else{let r=ly(t);for(var o in n=r===Object.prototype?{}:Object.create(r),lF&&lF.set(t,n),t)lv(t,o)&&(n[o]=e(t[o]))}return n}(e);return lF=null,t}let{toString:lW}={};function lV(e){return lW.call(e).slice(8,-1)}let lG="u">typeof Symbol?Symbol.iterator:"@@iterator",lU="symbol"==typeof lG?function(e){var t;return null!=e&&(t=e[lG])&&t.apply(e)}:function(){return null},lH={};function lq(e){var t,n,r,a;if(1==arguments.length){if(lg(e))return e.slice();if(this===lH&&"string"==typeof e)return[e];if(a=lU(e)){for(n=[];!(r=a.next()).done;)n.push(r.value);return n}if(null==e)return[e];if("number"==typeof(t=e.length)){for(n=Array(t);t--;)n[t]=e[t];return n}return[e]}for(t=arguments.length,n=Array(t);t--;)n[t]=arguments[t];return n}let lK="u">typeof Symbol?e=>"AsyncFunction"===e[Symbol.toStringTag]:()=>!1;var lZ="u">typeof location&&/^(http|https):\/\/(localhost|127\.0\.0\.1)/.test(location.href),lY=()=>!0;let lJ=!Error("").stack;function lX(){if(lJ)try{throw lX.arguments,Error()}catch(e){return e}return Error()}function lQ(e,t){var n=e.stack;return n?(t=t||0,0===n.indexOf(e.name)&&(t+=(e.name+e.message).split("\n").length),n.split("\n").slice(t).filter(lY).map(e=>"\n"+e).join("")):""}var l0=["Unknown","Constraint","Data","TransactionInactive","ReadOnly","Version","NotFound","InvalidState","InvalidAccess","Abort","Timeout","QuotaExceeded","Syntax","DataClone"],l1=["Modify","Bulk","OpenFailed","VersionChange","Schema","Upgrade","InvalidTable","MissingAPI","NoSuchDatabase","InvalidArgument","SubTransaction","Unsupported","Internal","DatabaseClosed","PrematureCommit","ForeignAwait"].concat(l0),l2={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 l3(e,t){this._e=lX(),this.name=e,this.message=t}function l4(e,t){return e+". Errors: "+Object.keys(t).map(e=>t[e].toString()).filter((e,t,n)=>n.indexOf(e)===t).join("\n")}function l5(e,t,n,r){this._e=lX(),this.failures=t,this.failedKeys=r,this.successCount=n,this.message=l4(e,t)}function l6(e,t){this._e=lX(),this.name="BulkError",this.failures=Object.keys(t).map(e=>t[e]),this.failuresByPos=t,this.message=l4(e,t)}lk(l3).from(Error).extend({stack:{get:function(){return this._stack||(this._stack=this.name+": "+this.message+lQ(this._e,2))}},toString:function(){return this.name+": "+this.message}}),lk(l5).from(l3),lk(l6).from(l3);var l7=l1.reduce((e,t)=>(e[t]=t+"Error",e),{}),l8=l1.reduce((e,t)=>{var n=t+"Error";function r(e,r){this._e=lX(),this.name=n,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=l2[t]||n,this.inner=null)}return lk(r).from(l3),e[t]=r,e},{});l8.Syntax=SyntaxError,l8.Type=TypeError,l8.Range=RangeError;var l9=l0.reduce((e,t)=>(e[t+"Error"]=l8[t],e),{}),ce=l1.reduce((e,t)=>(-1===["Syntax","Type","Range"].indexOf(t)&&(e[t+"Error"]=l8[t]),e),{});function ct(){}function cn(e){return e}function cr(e,t){return null==e||e===cn?t:function(n){return t(e(n))}}function ca(e,t){return function(){e.apply(this,arguments),t.apply(this,arguments)}}function co(e,t){return e===ct?t:function(){var n=e.apply(this,arguments);void 0!==n&&(arguments[0]=n);var r=this.onsuccess,a=this.onerror;this.onsuccess=null,this.onerror=null;var o=t.apply(this,arguments);return r&&(this.onsuccess=this.onsuccess?ca(r,this.onsuccess):r),a&&(this.onerror=this.onerror?ca(a,this.onerror):a),void 0!==o?o:n}}function ci(e,t){return e===ct?t:function(){e.apply(this,arguments);var n=this.onsuccess,r=this.onerror;this.onsuccess=this.onerror=null,t.apply(this,arguments),n&&(this.onsuccess=this.onsuccess?ca(n,this.onsuccess):n),r&&(this.onerror=this.onerror?ca(r,this.onerror):r)}}function cs(e,t){return e===ct?t:function(n){var r=e.apply(this,arguments);l_(n,r);var a=this.onsuccess,o=this.onerror;this.onsuccess=null,this.onerror=null;var i=t.apply(this,arguments);return a&&(this.onsuccess=this.onsuccess?ca(a,this.onsuccess):a),o&&(this.onerror=this.onerror?ca(o,this.onerror):o),void 0===r?void 0===i?void 0:i:l_(r,i)}}function cl(e,t){return e===ct?t:function(){return!1!==t.apply(this,arguments)&&e.apply(this,arguments)}}function cc(e,t){return e===ct?t:function(){var n=e.apply(this,arguments);if(n&&"function"==typeof n.then){for(var r=this,a=arguments.length,o=Array(a);a--;)o[a]=arguments[a];return n.then(function(){return t.apply(r,o)})}return t.apply(this,arguments)}}ce.ModifyError=l5,ce.DexieError=l3,ce.BulkError=l6;var cu={};let[cd,cp,cf]="u"<typeof Promise?[]:(()=>{let e=Promise.resolve();if("u"<typeof crypto||!crypto.subtle)return[e,ly(e),e];let t=crypto.subtle.digest("SHA-512",new Uint8Array([0]));return[t,ly(t),e]})(),cm=cp&&cp.then,ch=cd&&cd.constructor,cg=!!cf;var c_=!1,cy=cf?()=>{cf.then(cj)}:lm.setImmediate?setImmediate.bind(null,cj):lm.MutationObserver?()=>{var e=document.createElement("div");new MutationObserver(()=>{cj(),e=null}).observe(e,{attributes:!0}),e.setAttribute("i","1")}:()=>{setTimeout(cj,0)},cb=function(e,t){cD.push([e,t]),c$&&(cy(),c$=!1)},cv=!0,c$=!0,cA=[],cw=[],ck=null,cx=cn,cC={id:"global",global:!0,ref:0,unhandleds:[],onunhandled:c9,pgp:!1,env:{},finalize:function(){this.unhandleds.forEach(e=>{try{c9(e[0],e[1])}catch(e){}})}},cE=cC,cD=[],cS=0,cz=[];function cP(e){if("object"!=typeof this)throw TypeError("Promises must be constructed via new");this._listeners=[],this.onuncatched=ct,this._lib=!1;var t=this._PSD=cE;if(lZ&&(this._stackHolder=lX(),this._prev=null,this._numPrev=0),"function"!=typeof e){if(e!==cu)throw TypeError("Not a function");return this._state=arguments[1],this._value=arguments[2],void(!1===this._state&&cT(this,this._value))}this._state=null,this._value=null,++t.ref,function e(t,n){try{n(n=>{if(null===t._state){if(n===t)throw TypeError("A promise cannot be resolved with itself.");var r=t._lib&&cF();n&&"function"==typeof n.then?e(t,(e,t)=>{n instanceof cP?n._then(e,t):n.then(e,t)}):(t._state=!0,t._value=n,cO(t)),r&&cL()}},cT.bind(null,t))}catch(e){cT(t,e)}}(this,e)}let cM={get:function(){var e=cE,t=cZ;function n(n,r){var a=!e.global&&(e!==cE||t!==cZ);let o=a&&!cQ();var i=new cP((t,i)=>{cI(this,new cN(c6(n,e,a,o),c6(r,e,a,o),t,i,e))});return lZ&&cR(i,this),i}return n.prototype=cu,n},set:function(e){lw(this,"then",e&&e.prototype===cu?cM:{get:function(){return e},set:cM.set})}};function cN(e,t,n,r,a){this.onFulfilled="function"==typeof e?e:null,this.onRejected="function"==typeof t?t:null,this.resolve=n,this.reject=r,this.psd=a}function cT(e,t){if(cw.push(t),null===e._state){var n=e._lib&&cF();t=cx(t),e._state=!1,e._value=t,lZ&&null!==t&&"object"==typeof t&&!t._promise&&function(e){try{e.apply(null,void 0)}catch(e){}}(()=>{var n=lC(t,"stack");t._promise=e,lw(t,"stack",{get:()=>c_?n&&(n.get?n.get.apply(t):n.value):e.stack})}),cA.some(t=>t._value===e._value)||cA.push(e),cO(e),n&&cL()}}function cO(e){var t=e._listeners;e._listeners=[];for(var n=0,r=t.length;n<r;++n)cI(e,t[n]);var a=e._PSD;--a.ref||a.finalize(),0===cS&&(++cS,cb(()=>{0==--cS&&cW()},[]))}function cI(e,t){if(null!==e._state){var n=e._state?t.onFulfilled:t.onRejected;if(null===n)return(e._state?t.resolve:t.reject)(e._value);++t.psd.ref,++cS,cb(cB,[n,e,t])}else e._listeners.push(t)}function cB(e,t,n){try{ck=t;var r,a=t._value;t._state?r=e(a):(cw.length&&(cw=[]),r=e(a),-1===cw.indexOf(a)&&function(e){for(var t=cA.length;t;)if(cA[--t]._value===e._value)return void cA.splice(t,1)}(t)),n.resolve(r)}catch(e){n.reject(e)}finally{ck=null,0==--cS&&cW(),--n.psd.ref||n.psd.finalize()}}function cR(e,t){var n=t?t._numPrev+1:0;n<100&&(e._prev=t,e._numPrev=n)}function cj(){cF()&&cL()}function cF(){var e=cv;return cv=!1,c$=!1,e}function cL(){var e,t,n;do for(;cD.length>0;)for(e=cD,cD=[],n=e.length,t=0;t<n;++t){var r=e[t];r[0].apply(null,r[1])}while(cD.length>0);cv=!0,c$=!0}function cW(){var e=cA;cA=[],e.forEach(e=>{e._PSD.onunhandled.call(null,e._value,e)});for(var t=cz.slice(0),n=t.length;n;)t[--n]()}function cV(e){return new cP(cu,!1,e)}function cG(e,t){var n=cE;return function(){var r=cF(),a=cE;try{return c3(n,!0),e.apply(this,arguments)}catch(e){t&&t(e)}finally{c3(a,!1),r&&cL()}}}l$(cP.prototype,{then:cM,_then:function(e,t){cI(this,new cN(null,null,e,t,cE))},catch:function(e){if(1==arguments.length)return this.then(null,e);var t=arguments[0],n=arguments[1];return"function"==typeof t?this.then(null,e=>e instanceof t?n(e):cV(e)):this.then(null,e=>e&&e.name===t?n(e):cV(e))},finally:function(e){return this.then(t=>(e(),t),t=>(e(),cV(t)))},stack:{get:function(){if(this._stack)return this._stack;try{c_=!0;var e=(function e(t,n,r){if(n.length===r)return n;var a="";if(!1===t._state){var o,i,s=t._value;null!=s?(o=s.name||"Error",i=s.message||s,a=lQ(s,0)):(o=s,i=""),n.push(o+(i?": "+i:"")+a)}return lZ&&((a=lQ(t._stackHolder,2))&&-1===n.indexOf(a)&&n.push(a),t._prev&&e(t._prev,n,r)),n})(this,[],20).join("\nFrom previous: ");return null!==this._state&&(this._stack=e),e}finally{c_=!1}}},timeout:function(e,t){return e<1/0?new cP((n,r)=>{var a=setTimeout(()=>r(new l8.Timeout(t)),e);this.then(n,r).finally(clearTimeout.bind(null,a))}):this}}),"u">typeof Symbol&&Symbol.toStringTag&&lw(cP.prototype,Symbol.toStringTag,"Dexie.Promise"),cC.env=c4(),l$(cP,{all:function(){var e=lq.apply(null,arguments).map(c0);return new cP(function(t,n){0===e.length&&t([]);var r=e.length;e.forEach((a,o)=>cP.resolve(a).then(n=>{e[o]=n,--r||t(e)},n))})},resolve:e=>{if(e instanceof cP)return e;if(e&&"function"==typeof e.then)return new cP((t,n)=>{e.then(t,n)});var t=new cP(cu,!0,e);return cR(t,ck),t},reject:cV,race:function(){var e=lq.apply(null,arguments).map(c0);return new cP((t,n)=>{e.map(e=>cP.resolve(e).then(t,n))})},PSD:{get:()=>cE,set:e=>cE=e},totalEchoes:{get:()=>cZ},newPSD:cJ,usePSD:c5,scheduler:{get:()=>cb,set:e=>{cb=e}},rejectionMapper:{get:()=>cx,set:e=>{cx=e}},follow:(e,t)=>new cP((n,r)=>cJ((t,n)=>{var r=cE;r.unhandleds=[],r.onunhandled=n,r.finalize=ca(function(){var e;e=()=>{0===this.unhandleds.length?t():n(this.unhandleds[0])},cz.push(function t(){e(),cz.splice(cz.indexOf(t),1)}),++cS,cb(()=>{0==--cS&&cW()},[])},r.finalize),e()},t,n,r))}),ch&&(ch.allSettled&&lw(cP,"allSettled",function(){let e=lq.apply(null,arguments).map(c0);return new cP(t=>{0===e.length&&t([]);let n=e.length,r=Array(n);e.forEach((e,a)=>cP.resolve(e).then(e=>r[a]={status:"fulfilled",value:e},e=>r[a]={status:"rejected",reason:e}).then(()=>--n||t(r)))})}),ch.any&&"u">typeof AggregateError&&lw(cP,"any",function(){let e=lq.apply(null,arguments).map(c0);return new cP((t,n)=>{0===e.length&&n(AggregateError([]));let r=e.length,a=Array(r);e.forEach((e,o)=>cP.resolve(e).then(e=>t(e),e=>{a[o]=e,--r||n(AggregateError(a))}))})}));let cU={awaits:0,echoes:0,id:0};var cH=0,cq=[],cK=0,cZ=0,cY=0;function cJ(e,t,n,r){var a=cE,o=Object.create(a);o.parent=a,o.ref=0,o.global=!1,o.id=++cY;var i=cC.env;o.env=cg?{Promise:cP,PromiseProp:{value:cP,configurable:!0,writable:!0},all:cP.all,race:cP.race,allSettled:cP.allSettled,any:cP.any,resolve:cP.resolve,reject:cP.reject,nthen:c7(i.nthen,o),gthen:c7(i.gthen,o)}:{},t&&l_(o,t),++a.ref,o.finalize=function(){--this.parent.ref||this.parent.finalize()};var s=c5(o,e,n,r);return 0===o.ref&&o.finalize(),s}function cX(){return cU.id||(cU.id=++cH),++cU.awaits,cU.echoes+=100,cU.id}function cQ(){return!!cU.awaits&&(0==--cU.awaits&&(cU.id=0),cU.echoes=100*cU.awaits,!0)}function c0(e){return cU.echoes&&e&&e.constructor===ch?(cX(),e.then(e=>(cQ(),e),e=>(cQ(),ue(e)))):e}function c1(e){++cZ,cU.echoes&&0!=--cU.echoes||(cU.echoes=cU.id=0),cq.push(cE),c3(e,!0)}function c2(){var e=cq[cq.length-1];cq.pop(),c3(e,!1)}function c3(e,t){var n,r=cE;if((t?!cU.echoes||cK++&&e===cE:!cK||--cK&&e===cE)||(n=t?c1.bind(null,e):c2,cm.call(cd,n)),e!==cE&&(cE=e,r===cC&&(cC.env=c4()),cg)){var a=cC.env.Promise,o=e.env;cp.then=o.nthen,a.prototype.then=o.gthen,(r.global||e.global)&&(Object.defineProperty(lm,"Promise",o.PromiseProp),a.all=o.all,a.race=o.race,a.resolve=o.resolve,a.reject=o.reject,o.allSettled&&(a.allSettled=o.allSettled),o.any&&(a.any=o.any))}}function c4(){var e=lm.Promise;return cg?{Promise:e,PromiseProp:Object.getOwnPropertyDescriptor(lm,"Promise"),all:e.all,race:e.race,allSettled:e.allSettled,any:e.any,resolve:e.resolve,reject:e.reject,nthen:cp.then,gthen:e.prototype.then}:{}}function c5(e,t,n,r,a){var o=cE;try{return c3(e,!0),t(n,r,a)}finally{c3(o,!1)}}function c6(e,t,n,r){return"function"!=typeof e?e:function(){var a,o=cE;n&&cX(),c3(t,!0);try{return e.apply(this,arguments)}finally{c3(o,!1),r&&(a=cQ,cm.call(cd,a))}}}function c7(e,t){return function(n,r){return e.call(this,c6(n,t),c6(r,t))}}-1===(""+cm).indexOf("[native code]")&&(cX=cQ=ct);let c8="unhandledrejection";function c9(e,t){var n;try{n=t.onuncatched(e)}catch(e){}if(!1!==n)try{var r,a={promise:t,reason:e};if(lm.document&&document.createEvent?((r=document.createEvent("Event")).initEvent(c8,!0,!0),l_(r,a)):lm.CustomEvent&&l_(r=new CustomEvent(c8,{detail:a}),a),r&&lm.dispatchEvent&&(dispatchEvent(r),!lm.PromiseRejectionEvent&&lm.onunhandledrejection))try{lm.onunhandledrejection(r)}catch(e){}lZ&&r&&!r.defaultPrevented&&console.warn(`Unhandled rejection: ${e.stack||e}`)}catch(e){}}var ue=cP.reject;let ut="3.2.6",un=String.fromCharCode(65535),ur=-1/0,ua="Invalid key provided. Keys must be of type string, number, Date or Array<string | number | Date>.",uo="String expected.",ui=[],us="u">typeof navigator&&/(MSIE|Trident|Edge)/.test(navigator.userAgent),ul=e=>!/(dexie\.js|dexie\.min\.js)/.test(e),uc="__dbnames",uu="readonly",ud="readwrite";function up(e,t){return e?t?function(){return e.apply(this,arguments)&&t.apply(this,arguments)}:e:t}let uf={type:3,lower:-1/0,lowerOpen:!1,upper:[[]],upperOpen:!1};function um(e){return"string"!=typeof e||/\./.test(e)?e=>e:t=>(void 0===t[e]&&e in t&&delete(t=lL(t))[e],t)}class uh{_trans(e,t,n){let r=this._tx||cE.trans,a=this.name;function o(e,n,r){if(!r.schema[a])throw new l8.NotFound("Table "+a+" not part of transaction");return t(r.idbtrans,r)}let i=cF();try{return r&&r.db===this.db?r===cE.trans?r._promise(e,o,n):cJ(()=>r._promise(e,o,n),{trans:r,transless:cE.transless||cE}):function e(t,n,r,a){if(t.idbdb&&(t._state.openComplete||cE.letThrough||t._vip)){var o=t._createTransaction(n,r,t._dbSchema);try{o.create(),t._state.PR1398_maxLoop=3}catch(o){return o.name===l7.InvalidState&&t.isOpen()&&--t._state.PR1398_maxLoop>0?(console.warn("Dexie: Need to reopen db"),t._close(),t.open().then(()=>e(t,n,r,a))):ue(o)}return o._promise(n,(e,t)=>cJ(()=>(cE.trans=o,a(e,t,o)))).then(e=>o._completion.then(()=>e))}if(t._state.openComplete)return ue(new l8.DatabaseClosed(t._state.dbOpenError));if(!t._state.isBeingOpened){if(!t._options.autoOpen)return ue(new l8.DatabaseClosed);t.open().catch(ct)}return t._state.dbReadyPromise.then(()=>e(t,n,r,a))}(this.db,e,[this.name],o)}finally{i&&cL()}}get(e,t){return e&&e.constructor===Object?this.where(e).first(t):this._trans("readonly",t=>this.core.get({trans:t,key:e}).then(e=>this.hook.reading.fire(e))).then(t)}where(e){if("string"==typeof e)return new this.db.WhereClause(this,e);if(lg(e))return new this.db.WhereClause(this,`[${e.join("+")}]`);let t=lh(e);if(1===t.length)return this.where(t[0]).equals(e[t[0]]);let n=this.schema.indexes.concat(this.schema.primKey).filter(e=>{if(e.compound&&t.every(t=>e.keyPath.indexOf(t)>=0)){for(let n=0;n<t.length;++n)if(-1===t.indexOf(e.keyPath[n]))return!1;return!0}return!1}).sort((e,t)=>e.keyPath.length-t.keyPath.length)[0];if(n&&this.db._maxKey!==un){let r=n.keyPath.slice(0,t.length);return this.where(r).equals(r.map(t=>e[t]))}!n&&lZ&&console.warn(`The query ${JSON.stringify(e)} on ${this.name} would benefit of a compound index [${t.join("+")}]`);let{idxByName:r}=this.schema,a=this.db._deps.indexedDB;function o(e,t){try{return 0===a.cmp(e,t)}catch(e){return!1}}let[i,s]=t.reduce(([t,n],a)=>{let i=r[a],s=e[a];return[t||i,t||!i?up(n,i&&i.multi?e=>{let t=lN(e,a);return lg(t)&&t.some(e=>o(s,e))}:e=>o(s,lN(e,a))):n]},[null,null]);return i?this.where(i.name).equals(e[i.keyPath]).filter(s):n?this.filter(s):this.where(t).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,lg(e)?`[${e.join("+")}]`:e))}reverse(){return this.toCollection().reverse()}mapToClass(e){this.schema.mappedClass=e;let t=t=>{if(!t)return t;let n=Object.create(e.prototype);for(var r in t)if(lv(t,r))try{n[r]=t[r]}catch(e){}return n};return this.schema.readHook&&this.hook.reading.unsubscribe(this.schema.readHook),this.schema.readHook=t,this.hook("reading",t),e}defineClass(){return this.mapToClass(function(e){l_(this,e)})}add(e,t){let{auto:n,keyPath:r}=this.schema.primKey,a=e;return r&&n&&(a=um(r)(e)),this._trans("readwrite",e=>this.core.mutate({trans:e,type:"add",keys:null!=t?[t]:null,values:[a]})).then(e=>e.numFailures?cP.reject(e.failures[0]):e.lastResult).then(t=>{if(r)try{lT(e,r,t)}catch(e){}return t})}update(e,t){if("object"!=typeof e||lg(e))return this.where(":id").equals(e).modify(t);{let n=lN(e,this.schema.primKey.keyPath);if(void 0===n)return ue(new l8.InvalidArgument("Given object does not contain its primary key"));try{"function"!=typeof t?lh(t).forEach(n=>{lT(e,n,t[n])}):t(e,{value:e,primKey:n})}catch(e){}return this.where(":id").equals(n).modify(t)}}put(e,t){let{auto:n,keyPath:r}=this.schema.primKey,a=e;return r&&n&&(a=um(r)(e)),this._trans("readwrite",e=>this.core.mutate({trans:e,type:"put",values:[a],keys:null!=t?[t]:null})).then(e=>e.numFailures?cP.reject(e.failures[0]):e.lastResult).then(t=>{if(r)try{lT(e,r,t)}catch(e){}return t})}delete(e){return this._trans("readwrite",t=>this.core.mutate({trans:t,type:"delete",keys:[e]})).then(e=>e.numFailures?cP.reject(e.failures[0]):void 0)}clear(){return this._trans("readwrite",e=>this.core.mutate({trans:e,type:"deleteRange",range:uf})).then(e=>e.numFailures?cP.reject(e.failures[0]):void 0)}bulkGet(e){return this._trans("readonly",t=>this.core.getMany({keys:e,trans:t}).then(e=>e.map(e=>this.hook.reading.fire(e))))}bulkAdd(e,t,n){let r=Array.isArray(t)?t:void 0,a=(n=n||(r?void 0:t))?n.allKeys:void 0;return this._trans("readwrite",t=>{let{auto:n,keyPath:o}=this.schema.primKey;if(o&&r)throw new l8.InvalidArgument("bulkAdd(): keys argument invalid on tables with inbound keys");if(r&&r.length!==e.length)throw new l8.InvalidArgument("Arguments objects and keys must have the same length");let i=e.length,s=o&&n?e.map(um(o)):e;return this.core.mutate({trans:t,type:"add",keys:r,values:s,wantResults:a}).then(({numFailures:e,results:t,lastResult:n,failures:r})=>{if(0===e)return a?t:n;throw new l6(`${this.name}.bulkAdd(): ${e} of ${i} operations failed`,r)})})}bulkPut(e,t,n){let r=Array.isArray(t)?t:void 0,a=(n=n||(r?void 0:t))?n.allKeys:void 0;return this._trans("readwrite",t=>{let{auto:n,keyPath:o}=this.schema.primKey;if(o&&r)throw new l8.InvalidArgument("bulkPut(): keys argument invalid on tables with inbound keys");if(r&&r.length!==e.length)throw new l8.InvalidArgument("Arguments objects and keys must have the same length");let i=e.length,s=o&&n?e.map(um(o)):e;return this.core.mutate({trans:t,type:"put",keys:r,values:s,wantResults:a}).then(({numFailures:e,results:t,lastResult:n,failures:r})=>{if(0===e)return a?t:n;throw new l6(`${this.name}.bulkPut(): ${e} of ${i} operations failed`,r)})})}bulkDelete(e){let t=e.length;return this._trans("readwrite",t=>this.core.mutate({trans:t,type:"delete",keys:e})).then(({numFailures:e,lastResult:n,failures:r})=>{if(0===e)return n;throw new l6(`${this.name}.bulkDelete(): ${e} of ${t} operations failed`,r)})}}function ug(e){var t={},n=function(n,r){if(r){for(var a=arguments.length,o=Array(a-1);--a;)o[a-1]=arguments[a];return t[n].subscribe.apply(null,o),e}if("string"==typeof n)return t[n]};n.addEventType=o;for(var r=1,a=arguments.length;r<a;++r)o(arguments[r]);return n;function o(e,r,a){if("object"!=typeof e){r||(r=cl),a||(a=ct);var i={subscribers:[],fire:a,subscribe:function(e){-1===i.subscribers.indexOf(e)&&(i.subscribers.push(e),i.fire=r(i.fire,e))},unsubscribe:function(e){i.subscribers=i.subscribers.filter(function(t){return t!==e}),i.fire=i.subscribers.reduce(r,a)}};return t[e]=n[e]=i,i}lh(e).forEach(function(t){var n=e[t];if(lg(n))o(t,e[t][0],e[t][1]);else{if("asap"!==n)throw new l8.InvalidArgument("Invalid event config");var r=o(t,cn,function(){for(var e=arguments.length,t=Array(e);e--;)t[e]=arguments[e];r.subscribers.forEach(function(e){lP(function(){e.apply(null,t)})})})}})}}function u_(e,t){return lk(t).from({prototype:e}),t}function uy(e,t){return!(e.filter||e.algorithm||e.or)&&(t?e.justLimit:!e.replayFilter)}function ub(e,t){e.filter=up(e.filter,t)}function uv(e,t,n){var r=e.replayFilter;e.replayFilter=r?()=>up(r(),t()):t,e.justLimit=n&&!r}function u$(e,t){if(e.isPrimKey)return t.primaryKey;let n=t.getIndexByKeyPath(e.index);if(!n)throw new l8.Schema("KeyPath "+e.index+" on object store "+t.name+" is not indexed");return n}function uA(e,t,n){let r=u$(e,t.schema);return t.openCursor({trans:n,values:!e.keysOnly,reverse:"prev"===e.dir,unique:!!e.unique,query:{index:r,range:e.range}})}function uw(e,t,n,r){let a=e.replayFilter?up(e.filter,e.replayFilter()):e.filter;if(e.or){let o={},i=(e,n,r)=>{if(!a||a(n,r,e=>n.stop(e),e=>n.fail(e))){var i=n.primaryKey,s=""+i;"[object ArrayBuffer]"===s&&(s=""+new Uint8Array(i)),lv(o,s)||(o[s]=!0,t(e,n,r))}};return Promise.all([e.or._iterate(i,n),uk(uA(e,r,n),e.algorithm,i,!e.keysOnly&&e.valueMapper)])}return uk(uA(e,r,n),up(e.algorithm,a),t,!e.keysOnly&&e.valueMapper)}function uk(e,t,n,r){var a=cG(r?(e,t,a)=>n(r(e),t,a):n);return e.then(e=>{if(e)return e.start(()=>{var n=()=>e.continue();t&&!t(e,e=>n=e,t=>{e.stop(t),n=ct},t=>{e.fail(t),n=ct})||a(e.value,e,e=>n=e),n()})})}function ux(e,t){try{let n=uC(e),r=uC(t);if(n!==r)return"Array"===n?1:"Array"===r?-1:"binary"===n?1:"binary"===r?-1:"string"===n?1:"string"===r?-1:"Date"===n?1:"Date"!==r?NaN:-1;switch(n){case"number":case"Date":case"string":return e>t?1:e<t?-1:0;case"binary":return function(e,t){let n=e.length,r=t.length,a=n<r?n:r;for(let n=0;n<a;++n)if(e[n]!==t[n])return e[n]<t[n]?-1:1;return n===r?0:n<r?-1:1}(uE(e),uE(t));case"Array":return function(e,t){let n=e.length,r=t.length,a=n<r?n:r;for(let n=0;n<a;++n){let r=ux(e[n],t[n]);if(0!==r)return r}return n===r?0:n<r?-1:1}(e,t)}}catch(e){}return NaN}function uC(e){let t=typeof e;if("object"!==t)return t;if(ArrayBuffer.isView(e))return"binary";let n=lV(e);return"ArrayBuffer"===n?"binary":n}function uE(e){return e instanceof Uint8Array?e:ArrayBuffer.isView(e)?new Uint8Array(e.buffer,e.byteOffset,e.byteLength):new Uint8Array(e)}class uD{_read(e,t){var n=this._ctx;return n.error?n.table._trans(null,ue.bind(null,n.error)):n.table._trans("readonly",e).then(t)}_write(e){var t=this._ctx;return t.error?t.table._trans(null,ue.bind(null,t.error)):t.table._trans("readwrite",e,"locked")}_addAlgorithm(e){var t=this._ctx;t.algorithm=up(t.algorithm,e)}_iterate(e,t){return uw(this._ctx,e,t,this._ctx.table.core)}clone(e){var t=Object.create(this.constructor.prototype),n=Object.create(this._ctx);return e&&l_(n,e),t._ctx=n,t}raw(){return this._ctx.valueMapper=null,this}each(e){var t=this._ctx;return this._read(n=>uw(t,e,n,t.table.core))}count(e){return this._read(e=>{let t=this._ctx,n=t.table.core;if(uy(t,!0))return n.count({trans:e,query:{index:u$(t,n.schema),range:t.range}}).then(e=>Math.min(e,t.limit));var r=0;return uw(t,()=>(++r,!1),e,n).then(()=>r)}).then(e)}sortBy(e,t){let n=e.split(".").reverse(),r=n[0],a=n.length-1;function o(e,t){return t?o(e[n[t]],t-1):e[r]}var i="next"===this._ctx.dir?1:-1;function s(e,t){var n=o(e,a),r=o(t,a);return n<r?-i:n>r?i:0}return this.toArray(function(e){return e.sort(s)}).then(t)}toArray(e){return this._read(e=>{var t=this._ctx;if("next"===t.dir&&uy(t,!0)&&t.limit>0){let{valueMapper:n}=t,r=u$(t,t.table.core.schema);return t.table.core.query({trans:e,limit:t.limit,values:!0,query:{index:r,range:t.range}}).then(({result:e})=>n?e.map(n):e)}{let n=[];return uw(t,e=>n.push(e),e,t.table.core).then(()=>n)}},e)}offset(e){var t=this._ctx;return e<=0||(t.offset+=e,uy(t)?uv(t,()=>{var t=e;return(e,n)=>0===t||(1===t?--t:n(()=>{e.advance(t),t=0}),!1)}):uv(t,()=>{var t=e;return()=>--t<0})),this}limit(e){return this._ctx.limit=Math.min(this._ctx.limit,e),uv(this._ctx,()=>{var t=e;return function(e,n,r){return--t<=0&&n(r),t>=0}},!0),this}until(e,t){return ub(this._ctx,function(n,r,a){return!e(n.value)||(r(a),t)}),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 t;return ub(this._ctx,function(t){return e(t.value)}),(t=this._ctx).isMatch=up(t.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 t=this._ctx;return t.keysOnly=!t.isMatch,this.each(function(t,n){e(n.key,n)})}eachUniqueKey(e){return this._ctx.unique="unique",this.eachKey(e)}eachPrimaryKey(e){var t=this._ctx;return t.keysOnly=!t.isMatch,this.each(function(t,n){e(n.primaryKey,n)})}keys(e){var t=this._ctx;t.keysOnly=!t.isMatch;var n=[];return this.each(function(e,t){n.push(t.key)}).then(function(){return n}).then(e)}primaryKeys(e){var t=this._ctx;if("next"===t.dir&&uy(t,!0)&&t.limit>0)return this._read(e=>{var n=u$(t,t.table.core.schema);return t.table.core.query({trans:e,values:!1,limit:t.limit,query:{index:n,range:t.range}})}).then(({result:e})=>e).then(e);t.keysOnly=!t.isMatch;var n=[];return this.each(function(e,t){n.push(t.primaryKey)}).then(function(){return n}).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,t=e.index&&e.table.schema.idxByName[e.index];if(!t||!t.multi)return this;var n={};return ub(this._ctx,function(e){var t=e.primaryKey.toString(),r=lv(n,t);return n[t]=!0,!r}),this}modify(e){var t=this._ctx;return this._write(n=>{var r;if("function"==typeof e)r=e;else{var a=lh(e),o=a.length;r=function(t){for(var n=!1,r=0;r<o;++r){var i=a[r],s=e[i];lN(t,i)!==s&&(lT(t,i,s),n=!0)}return n}}let i=t.table.core,{outbound:s,extractKey:l}=i.schema.primaryKey,c=this.db._options.modifyChunkSize||200,u=[],d=0,p=[],f=(e,t)=>{let{failures:n,numFailures:r}=t;for(let t of(d+=e-r,lh(n)))u.push(n[t])};return this.clone().primaryKeys().then(a=>{let o=u=>{let d=Math.min(c,a.length-u);return i.getMany({trans:n,keys:a.slice(u,u+d),cache:"immutable"}).then(p=>{let m=[],h=[],g=s?[]:null,y=[];for(let e=0;e<d;++e){let t=p[e],n={value:lL(t),primKey:a[u+e]};!1!==r.call(n,n.value,n)&&(null==n.value?y.push(a[u+e]):s||0===ux(l(t),l(n.value))?(h.push(n.value),s&&g.push(a[u+e])):(y.push(a[u+e]),m.push(n.value)))}let b=uy(t)&&t.limit===1/0&&("function"!=typeof e||e===uS)&&{index:t.index,range:t.range};return Promise.resolve(m.length>0&&i.mutate({trans:n,type:"add",values:m}).then(e=>{for(let t in e.failures)y.splice(parseInt(t),1);f(m.length,e)})).then(()=>(h.length>0||b&&"object"==typeof e)&&i.mutate({trans:n,type:"put",keys:g,values:h,criteria:b,changeSpec:"function"!=typeof e&&e}).then(e=>f(h.length,e))).then(()=>(y.length>0||b&&e===uS)&&i.mutate({trans:n,type:"delete",keys:y,criteria:b}).then(e=>f(y.length,e))).then(()=>a.length>u+d&&o(u+c))})};return o(0).then(()=>{if(u.length>0)throw new l5("Error modifying one or more objects",u,d,p);return a.length})})})}delete(){var e=this._ctx,t=e.range;return uy(e)&&(e.isPrimKey&&!us||3===t.type)?this._write(n=>{let{primaryKey:r}=e.table.core.schema;return e.table.core.count({trans:n,query:{index:r,range:t}}).then(r=>e.table.core.mutate({trans:n,type:"deleteRange",range:t}).then(({failures:e,lastResult:t,results:n,numFailures:a})=>{if(a)throw new l5("Could not delete some values",Object.keys(e).map(t=>e[t]),r-a);return r-a}))}):this.modify(uS)}}let uS=(e,t)=>t.value=null;function uz(e,t){return e<t?-1:+(e!==t)}function uP(e,t){return e>t?-1:+(e!==t)}function uM(e,t,n){var r=e instanceof uB?new e.Collection(e):e;return r._ctx.error=n?new n(t):TypeError(t),r}function uN(e){return new e.Collection(e,()=>uI("")).limit(0)}function uT(e,t,n,r){var a,o,i,s,l,c,u,d=n.length;if(!n.every(e=>"string"==typeof e))return uM(e,uo);function p(e){a="next"===e?e=>e.toUpperCase():e=>e.toLowerCase(),o="next"===e?e=>e.toLowerCase():e=>e.toUpperCase(),i="next"===e?uz:uP;var t=n.map(function(e){return{lower:o(e),upper:a(e)}}).sort(function(e,t){return i(e.lower,t.lower)});s=t.map(function(e){return e.upper}),l=t.map(function(e){return e.lower}),c=e,u="next"===e?"":r}p("next");var f=new e.Collection(e,()=>uO(s[0],l[d-1]+r));f._ondirectionchange=function(e){p(e)};var m=0;return f._addAlgorithm(function(e,n,r){var a=e.key;if("string"!=typeof a)return!1;var p=o(a);if(t(p,l,m))return!0;for(var f=null,h=m;h<d;++h){var g=function(e,t,n,r,a,o){for(var i=Math.min(e.length,r.length),s=-1,l=0;l<i;++l){var c=t[l];if(c!==r[l])return 0>a(e[l],n[l])?e.substr(0,l)+n[l]+n.substr(l+1):0>a(e[l],r[l])?e.substr(0,l)+r[l]+n.substr(l+1):s>=0?e.substr(0,s)+t[s]+n.substr(s+1):null;0>a(e[l],c)&&(s=l)}return i<r.length&&"next"===o?e+n.substr(e.length):i<e.length&&"prev"===o?e.substr(0,n.length):s<0?null:e.substr(0,s)+r[s]+n.substr(s+1)}(a,p,s[h],l[h],i,c);null===g&&null===f?m=h+1:(null===f||i(f,g)>0)&&(f=g)}return n(null!==f?function(){e.continue(f+u)}:r),!1}),f}function uO(e,t,n,r){return{type:2,lower:e,upper:t,lowerOpen:n,upperOpen:r}}function uI(e){return{type:1,lower:e,upper:e}}class uB{get Collection(){return this._ctx.table.db.Collection}between(e,t,n,r){n=!1!==n,r=!0===r;try{return this._cmp(e,t)>0||0===this._cmp(e,t)&&(n||r)&&(!n||!r)?uN(this):new this.Collection(this,()=>uO(e,t,!n,!r))}catch(e){return uM(this,ua)}}equals(e){return null==e?uM(this,ua):new this.Collection(this,()=>uI(e))}above(e){return null==e?uM(this,ua):new this.Collection(this,()=>uO(e,void 0,!0))}aboveOrEqual(e){return null==e?uM(this,ua):new this.Collection(this,()=>uO(e,void 0,!1))}below(e){return null==e?uM(this,ua):new this.Collection(this,()=>uO(void 0,e,!1,!0))}belowOrEqual(e){return null==e?uM(this,ua):new this.Collection(this,()=>uO(void 0,e))}startsWith(e){return"string"!=typeof e?uM(this,uo):this.between(e,e+un,!0,!0)}startsWithIgnoreCase(e){return""===e?this.startsWith(e):uT(this,(e,t)=>0===e.indexOf(t[0]),[e],un)}equalsIgnoreCase(e){return uT(this,(e,t)=>e===t[0],[e],"")}anyOfIgnoreCase(){var e=lq.apply(lH,arguments);return 0===e.length?uN(this):uT(this,(e,t)=>-1!==t.indexOf(e),e,"")}startsWithAnyOfIgnoreCase(){var e=lq.apply(lH,arguments);return 0===e.length?uN(this):uT(this,(e,t)=>t.some(t=>0===e.indexOf(t)),e,un)}anyOf(){let e=lq.apply(lH,arguments),t=this._cmp;try{e.sort(t)}catch(e){return uM(this,ua)}if(0===e.length)return uN(this);let n=new this.Collection(this,()=>uO(e[0],e[e.length-1]));n._ondirectionchange=n=>{t="next"===n?this._ascending:this._descending,e.sort(t)};let r=0;return n._addAlgorithm((n,a,o)=>{let i=n.key;for(;t(i,e[r])>0;)if(++r===e.length)return a(o),!1;return 0===t(i,e[r])||(a(()=>{n.continue(e[r])}),!1)}),n}notEqual(e){return this.inAnyRange([[ur,e],[e,this.db._maxKey]],{includeLowers:!1,includeUppers:!1})}noneOf(){let e=lq.apply(lH,arguments);if(0===e.length)return new this.Collection(this);try{e.sort(this._ascending)}catch(e){return uM(this,ua)}let t=e.reduce((e,t)=>e?e.concat([[e[e.length-1][1],t]]):[[ur,t]],null);return t.push([e[e.length-1],this.db._maxKey]),this.inAnyRange(t,{includeLowers:!1,includeUppers:!1})}inAnyRange(e,t){let n=this._cmp,r=this._ascending,a=this._descending,o=this._min,i=this._max;if(0===e.length)return uN(this);if(!e.every(e=>void 0!==e[0]&&void 0!==e[1]&&0>=r(e[0],e[1])))return uM(this,"First argument to inAnyRange() must be an Array of two-value Arrays [lower,upper] where upper must not be lower than lower",l8.InvalidArgument);let s=!t||!1!==t.includeLowers,l=t&&!0===t.includeUppers,c,u=r;function d(e,t){return u(e[0],t[0])}try{(c=e.reduce(function(e,t){let r=0,a=e.length;for(;r<a;++r){let a=e[r];if(0>n(t[0],a[1])&&n(t[1],a[0])>0){a[0]=o(a[0],t[0]),a[1]=i(a[1],t[1]);break}}return r===a&&e.push(t),e},[])).sort(d)}catch(e){return uM(this,ua)}let p=0,f=l?e=>r(e,c[p][1])>0:e=>r(e,c[p][1])>=0,m=s?e=>a(e,c[p][0])>0:e=>a(e,c[p][0])>=0,h=f,g=new this.Collection(this,()=>uO(c[0][0],c[c.length-1][1],!s,!l));return g._ondirectionchange=e=>{"next"===e?(h=f,u=r):(h=m,u=a),c.sort(d)},g._addAlgorithm((e,t,n)=>{for(var a=e.key;h(a);)if(++p===c.length)return t(n),!1;return!!(!f(a)&&!m(a))||(0===this._cmp(a,c[p][1])||0===this._cmp(a,c[p][0])||t(()=>{u===r?e.continue(c[p][0]):e.continue(c[p][1])}),!1)}),g}startsWithAnyOf(){let e=lq.apply(lH,arguments);return e.every(e=>"string"==typeof e)?0===e.length?uN(this):this.inAnyRange(e.map(e=>[e,e+un])):uM(this,"startsWithAnyOf() only works with strings")}}function uR(e){return cG(function(t){return uj(t),e(t.target.error),!1})}function uj(e){e.stopPropagation&&e.stopPropagation(),e.preventDefault&&e.preventDefault()}let uF="storagemutated",uL="x-storagemutated-1",uW=ug(null,uF);class uV{_lock(){return lz(!cE.global),++this._reculock,1!==this._reculock||cE.global||(cE.lockOwnerFor=this),this}_unlock(){if(lz(!cE.global),0==--this._reculock)for(cE.global||(cE.lockOwnerFor=null);this._blockedFuncs.length>0&&!this._locked();){var e=this._blockedFuncs.shift();try{c5(e[1],e[0])}catch(e){}}return this}_locked(){return this._reculock&&cE.lockOwnerFor!==this}create(e){if(!this.mode)return this;let t=this.db.idbdb,n=this.db._state.dbOpenError;if(lz(!this.idbtrans),!e&&!t)switch(n&&n.name){case"DatabaseClosedError":throw new l8.DatabaseClosed(n);case"MissingAPIError":throw new l8.MissingAPI(n.message,n);default:throw new l8.OpenFailed(n)}if(!this.active)throw new l8.TransactionInactive;return lz(null===this._completion._state),(e=this.idbtrans=e||(this.db.core?this.db.core.transaction(this.storeNames,this.mode,{durability:this.chromeTransactionDurability}):t.transaction(this.storeNames,this.mode,{durability:this.chromeTransactionDurability}))).onerror=cG(t=>{uj(t),this._reject(e.error)}),e.onabort=cG(t=>{uj(t),this.active&&this._reject(new l8.Abort(e.error)),this.active=!1,this.on("abort").fire(t)}),e.oncomplete=cG(()=>{this.active=!1,this._resolve(),"mutatedParts"in e&&uW.storagemutated.fire(e.mutatedParts)}),this}_promise(e,t,n){if("readwrite"===e&&"readwrite"!==this.mode)return ue(new l8.ReadOnly("Transaction is readonly"));if(!this.active)return ue(new l8.TransactionInactive);if(this._locked())return new cP((r,a)=>{this._blockedFuncs.push([()=>{this._promise(e,t,n).then(r,a)},cE])});if(n)return cJ(()=>{var e=new cP((e,n)=>{this._lock();let r=t(e,n,this);r&&r.then&&r.then(e,n)});return e.finally(()=>this._unlock()),e._lib=!0,e});var r=new cP((e,n)=>{var r=t(e,n,this);r&&r.then&&r.then(e,n)});return r._lib=!0,r}_root(){return this.parent?this.parent._root():this}waitFor(e){var t=this._root();let n=cP.resolve(e);if(t._waitingFor)t._waitingFor=t._waitingFor.then(()=>n);else{t._waitingFor=n,t._waitingQueue=[];var r=t.idbtrans.objectStore(t.storeNames[0]);!function e(){for(++t._spinCount;t._waitingQueue.length;)t._waitingQueue.shift()();t._waitingFor&&(r.get(-1/0).onsuccess=e)}()}var a=t._waitingFor;return new cP((e,r)=>{n.then(n=>t._waitingQueue.push(cG(e.bind(null,n))),e=>t._waitingQueue.push(cG(r.bind(null,e)))).finally(()=>{t._waitingFor===a&&(t._waitingFor=null)})})}abort(){this.active&&(this.active=!1,this.idbtrans&&this.idbtrans.abort(),this._reject(new l8.Abort))}table(e){let t=this._memoizedTables||(this._memoizedTables={});if(lv(t,e))return t[e];let n=this.schema[e];if(!n)throw new l8.NotFound("Table "+e+" not part of transaction");let r=new this.db.Table(e,n,this);return r.core=this.db.core.table(e),t[e]=r,r}}function uG(e,t,n,r,a,o,i){return{name:e,keyPath:t,unique:n,multi:r,auto:a,compound:o,src:(n&&!i?"&":"")+(r?"*":"")+(a?"++":"")+uU(t)}}function uU(e){return"string"==typeof e?e:e?"["+[].join.call(e,"+")+"]":""}function uH(e,t,n){return{name:e,primKey:t,indexes:n,mappedClass:null,idxByName:lM(n,e=>[e.name,e])}}let uq=e=>{try{return e.only([[]]),uq=()=>[[]],[[]]}catch(e){return uq=()=>un,un}};function uK(e){return null==e?()=>{}:"string"==typeof e?1===e.split(".").length?t=>t[e]:t=>lN(t,e):t=>lN(t,e)}function uZ(e){return[].slice.call(e)}let uY=0;function uJ(e){return null==e?":id":"string"==typeof e?e:`[${e.join("+")}]`}function uX({_novip:e},t){let n=t.db,r=function(e,t,{IDBKeyRange:n,indexedDB:r},a){var o;return{dbcore:(o=function(e,t,n){let r;function a(e){if(3===e.type)return null;if(4===e.type)throw Error("Cannot convert never type to IDBKeyRange");let{lower:n,upper:r,lowerOpen:a,upperOpen:o}=e;return void 0===n?void 0===r?null:t.upperBound(r,!!o):void 0===r?t.lowerBound(n,!!a):t.bound(n,r,!!a,!!o)}let{schema:o,hasGetAll:i}=(r=uZ(e.objectStoreNames),{schema:{name:e.name,tables:r.map(e=>n.objectStore(e)).map(e=>{let{keyPath:t,autoIncrement:n}=e,r=lg(t),a=null==t,o={},i={name:e.name,primaryKey:{name:null,isPrimaryKey:!0,outbound:a,compound:r,keyPath:t,autoIncrement:n,unique:!0,extractKey:uK(t)},indexes:uZ(e.indexNames).map(t=>e.index(t)).map(e=>{let{name:t,unique:n,multiEntry:r,keyPath:a}=e,i={name:t,compound:lg(a),keyPath:a,unique:n,multiEntry:r,extractKey:uK(a)};return o[uJ(a)]=i,i}),getIndexByKeyPath:e=>o[uJ(e)]};return o[":id"]=i.primaryKey,null!=t&&(o[uJ(t)]=i.primaryKey),i})},hasGetAll:r.length>0&&"getAll"in n.objectStore(r[0])&&!("u">typeof navigator&&/Safari/.test(navigator.userAgent)&&!/(Chrome\/|Edge\/)/.test(navigator.userAgent)&&[].concat(navigator.userAgent.match(/Safari\/(\d*)/))[1]<604)}),s=o.tables.map(e=>{let t;return{name:t=e.name,schema:e,mutate:function({trans:e,type:n,keys:r,values:o,range:i}){return new Promise((s,l)=>{let c;s=cG(s);let u=e.objectStore(t),d=null==u.keyPath,p="put"===n||"add"===n;if(!p&&"delete"!==n&&"deleteRange"!==n)throw Error("Invalid operation type: "+n);let{length:f}=r||o||{length:1};if(r&&o&&r.length!==o.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 m=[],h=[],g=0,y=e=>{++g,uj(e)};if("deleteRange"===n){if(4===i.type)return s({numFailures:g,failures:h,results:[],lastResult:void 0});3===i.type?m.push(c=u.clear()):m.push(c=u.delete(a(i)))}else{let[e,t]=p?d?[o,r]:[o,null]:[r,null];if(p)for(let r=0;r<f;++r)m.push(c=t&&void 0!==t[r]?u[n](e[r],t[r]):u[n](e[r])),c.onerror=y;else for(let t=0;t<f;++t)m.push(c=u[n](e[t])),c.onerror=y}let b=e=>{let t=e.target.result;m.forEach((e,t)=>null!=e.error&&(h[t]=e.error)),s({numFailures:g,failures:h,results:"delete"===n?r:m.map(e=>e.result),lastResult:t})};c.onerror=e=>{y(e),b(e)},c.onsuccess=b})},getMany:({trans:e,keys:n})=>new Promise((r,a)=>{r=cG(r);let o=e.objectStore(t),i=n.length,s=Array(i),l,c=0,u=0,d=e=>{let t=e.target;s[t._pos]=t.result,++u===c&&r(s)},p=uR(a);for(let e=0;e<i;++e)null!=n[e]&&((l=o.get(n[e]))._pos=e,l.onsuccess=d,l.onerror=p,++c);0===c&&r(s)}),get:({trans:e,key:n})=>new Promise((r,a)=>{r=cG(r);let o=e.objectStore(t).get(n);o.onsuccess=e=>r(e.target.result),o.onerror=uR(a)}),query:e=>new Promise((n,r)=>{n=cG(n);let{trans:o,values:s,limit:l,query:c}=e,u=l===1/0?void 0:l,{index:d,range:p}=c,f=o.objectStore(t),m=d.isPrimaryKey?f:f.index(d.name),h=a(p);if(0===l)return n({result:[]});if(i){let e=s?m.getAll(h,u):m.getAllKeys(h,u);e.onsuccess=e=>n({result:e.target.result}),e.onerror=uR(r)}else{let e=0,t=!s&&"openKeyCursor"in m?m.openKeyCursor(h):m.openCursor(h),a=[];t.onsuccess=r=>{let o=t.result;return o?(a.push(s?o.value:o.primaryKey),++e===l?n({result:a}):void o.continue()):n({result:a})},t.onerror=uR(r)}}),openCursor:function({trans:e,values:n,query:r,reverse:o,unique:i}){return new Promise((s,l)=>{s=cG(s);let{index:c,range:u}=r,d=e.objectStore(t),p=c.isPrimaryKey?d:d.index(c.name),f=o?i?"prevunique":"prev":i?"nextunique":"next",m=!n&&"openKeyCursor"in p?p.openKeyCursor(a(u),f):p.openCursor(a(u),f);m.onerror=uR(l),m.onsuccess=cG(t=>{let n=m.result;if(!n)return void s(null);n.___id=++uY,n.done=!1;let r=n.continue.bind(n),a=n.continuePrimaryKey;a&&(a=a.bind(n));let o=n.advance.bind(n),i=()=>{throw Error("Cursor not stopped")};n.trans=e,n.stop=n.continue=n.continuePrimaryKey=n.advance=()=>{throw Error("Cursor not started")},n.fail=cG(l),n.next=function(){let e=1;return this.start(()=>e--?this.continue():this.stop()).then(()=>this)},n.start=e=>{let t=new Promise((e,t)=>{e=cG(e),m.onerror=uR(t),n.fail=t,n.stop=t=>{n.stop=n.continue=n.continuePrimaryKey=n.advance=i,e(t)}}),s=()=>{if(m.result)try{e()}catch(e){n.fail(e)}else n.done=!0,n.start=()=>{throw Error("Cursor behind last entry")},n.stop()};return m.onsuccess=cG(e=>{m.onsuccess=s,s()}),n.continue=r,n.continuePrimaryKey=a,n.advance=o,s(),t},s(n)},l)})},count({query:e,trans:n}){let{index:r,range:o}=e;return new Promise((e,i)=>{let s=n.objectStore(t),l=r.isPrimaryKey?s:s.index(r.name),c=a(o),u=c?l.count(c):l.count();u.onsuccess=cG(t=>e(t.target.result)),u.onerror=uR(i)})}}}),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:uq(t),schema:o}}(t,n,a),e.dbcore.reduce((e,{create:t})=>({...e,...t(e)}),o))}}(e._middlewares,n,e._deps,t);e.core=r.dbcore,e.tables.forEach(t=>{let n=t.name;e.core.schema.tables.some(e=>e.name===n)&&(t.core=e.core.table(n),e[n]instanceof e.Table&&(e[n].core=t.core))})}function uQ({_novip:e},t,n,r){n.forEach(n=>{let a=r[n];t.forEach(t=>{let r=lC(t,n);(!r||"value"in r&&void 0===r.value)&&(t===e.Transaction.prototype||t instanceof e.Transaction?lw(t,n,{get(){return this.table(n)},set(e){lA(this,n,{value:e,writable:!0,configurable:!0,enumerable:!0})}}):t[n]=new e.Table(n,a))})})}function u0({_novip:e},t){t.forEach(t=>{for(let n in t)t[n]instanceof e.Table&&delete t[n]})}function u1(e,t){return e._cfg.version-t._cfg.version}function u2(e,t){let n,r={del:[],add:[],change:[]};for(n in e)t[n]||r.del.push(n);for(n in t){let a=e[n],o=t[n];if(a){let e={name:n,def:o,recreate:!1,del:[],add:[],change:[]};if(""+(a.primKey.keyPath||"")==""+(o.primKey.keyPath||"")&&(a.primKey.auto===o.primKey.auto||us)){let t,n=a.idxByName,i=o.idxByName;for(t in n)i[t]||e.del.push(t);for(t in i){let r=n[t],a=i[t];r?r.src!==a.src&&e.change.push(a):e.add.push(a)}(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([n,o])}return r}function u3(e,t,n,r){let a=e.db.createObjectStore(t,n.keyPath?{keyPath:n.keyPath,autoIncrement:n.auto}:{autoIncrement:n.auto});return r.forEach(e=>u4(a,e)),a}function u4(e,t){e.createIndex(t.name,t.keyPath,{unique:t.unique,multiEntry:t.multi})}function u5(e,t,n){let r={};return lD(t.objectStoreNames,0).forEach(e=>{let t=n.objectStore(e),a=t.keyPath,o=uG(uU(a),a||"",!1,!1,!!t.autoIncrement,a&&"string"!=typeof a,!0),i=[];for(let e=0;e<t.indexNames.length;++e){let n=t.index(t.indexNames[e]);a=n.keyPath;var s=uG(n.name,a,!!n.unique,!!n.multiEntry,!1,a&&"string"!=typeof a,!1);i.push(s)}r[e]=uH(e,o,i)}),r}function u6({_novip:e},t,n){let r=n.db.objectStoreNames;for(let a=0;a<r.length;++a){let o=r[a],i=n.objectStore(o);e._hasGetAll="getAll"in i;for(let e=0;e<i.indexNames.length;++e){let n=i.indexNames[e],r=i.index(n).keyPath,a="string"==typeof r?r:"["+lD(r).join("+")+"]";if(t[o]){let e=t[o].idxByName[a];e&&(e.name=n,delete t[o].idxByName[a],t[o].idxByName[n]=e)}}}"u">typeof navigator&&/Safari/.test(navigator.userAgent)&&!/(Chrome\/|Edge\/)/.test(navigator.userAgent)&&lm.WorkerGlobalScope&&lm instanceof lm.WorkerGlobalScope&&[].concat(navigator.userAgent.match(/Safari\/(\d*)/))[1]<604&&(e._hasGetAll=!1)}class u7{_parseStoresSpec(e,t){lh(e).forEach(n=>{if(null!==e[n]){var r=e[n].split(",").map((e,t)=>{let n=(e=e.trim()).replace(/([&*]|\+\+)/g,""),r=/^\[/.test(n)?n.match(/^\[(.*)\]$/)[1].split("+"):n;return uG(n,r||null,/\&/.test(e),/\*/.test(e),/\+\+/.test(e),lg(r),0===t)}),a=r.shift();if(a.multi)throw new l8.Schema("Primary key cannot be multi-valued");r.forEach(e=>{if(e.auto)throw new l8.Schema("Only primary key can be marked as autoIncrement (++)");if(!e.keyPath)throw new l8.Schema("Index must have a name and cannot be an empty string")}),t[n]=uH(n,a,r)}})}stores(e){let t=this.db;this._cfg.storesSource=this._cfg.storesSource?l_(this._cfg.storesSource,e):e;let n=t._versions,r={},a={};return n.forEach(e=>{l_(r,e._cfg.storesSource),a=e._cfg.dbschema={},e._parseStoresSpec(r,a)}),t._dbSchema=a,u0(t,[t._allTables,t,t.Transaction.prototype]),uQ(t,[t._allTables,t,t.Transaction.prototype,this._cfg.tables],lh(a),a),t._storeNames=lh(a),this}upgrade(e){return this._cfg.contentUpgrade=cc(this._cfg.contentUpgrade||ct,e),this}}function u8(e,t){let n=e._dbNamesDB;return n||(n=e._dbNamesDB=new dy(uc,{addons:[],indexedDB:e,IDBKeyRange:t})).version(1).stores({dbnames:"name"}),n.table("dbnames")}function u9(e){return e&&"function"==typeof e.databases}function de(e){return cJ(function(){return cE.letThrough=!0,e()})}function dt(e){var t=t=>e.next(t),n=a(t),r=a(t=>e.throw(t));function a(e){return t=>{var a=e(t),o=a.value;return a.done?o:o&&"function"==typeof o.then?o.then(n,r):lg(o)?Promise.all(o).then(n,r):n(o)}}return a(t)()}function dn(e,t,n){var r=arguments.length;if(r<2)throw new l8.InvalidArgument("Too few arguments");for(var a=Array(r-1);--r;)a[r-1]=arguments[r];return n=a.pop(),[e,lB(a),n]}function dr(e,t,n){let r=lg(e)?e.slice():[e];for(let e=0;e<n;++e)r.push(t);return r}let da={stack:"dbcore",name:"VirtualIndexMiddleware",level:1,create:function(e){return{...e,table(t){let n=e.table(t),{schema:r}=n,a={},o=[];function i(e,t,n){let r=uJ(e),s=a[r]=a[r]||[],l=null==e?0:"string"==typeof e?1:e.length,c=t>0,u={...n,isVirtual:c,keyTail:t,keyLength:l,extractKey:uK(e),unique:!c&&n.unique};return s.push(u),u.isPrimaryKey||o.push(u),l>1&&i(2===l?e[0]:e.slice(0,l-1),t+1,n),s.sort((e,t)=>e.keyTail-t.keyTail),u}let s=i(r.primaryKey.keyPath,0,r.primaryKey);for(let e of(a[":id"]=[s],r.indexes))i(e.keyPath,0,e);function l(t){var n,r;let a=t.query.index;return a.isVirtual?{...t,query:{index:a,range:(n=t.query.range,r=a.keyTail,{type:1===n.type?2:n.type,lower:dr(n.lower,n.lowerOpen?e.MAX_KEY:e.MIN_KEY,r),lowerOpen:!0,upper:dr(n.upper,n.upperOpen?e.MIN_KEY:e.MAX_KEY,r),upperOpen:!0})}}:t}return{...n,schema:{...r,primaryKey:s,indexes:o,getIndexByKeyPath:function(e){let t=a[uJ(e)];return t&&t[0]}},count:e=>n.count(l(e)),query:e=>n.query(l(e)),openCursor(t){let{keyTail:r,isVirtual:a,keyLength:o}=t.query.index;return a?n.openCursor(l(t)).then(n=>n&&Object.create(n,{continue:{value:function(a){null!=a?n.continue(dr(a,t.reverse?e.MAX_KEY:e.MIN_KEY,r)):t.unique?n.continue(n.key.slice(0,o).concat(t.reverse?e.MIN_KEY:e.MAX_KEY,r)):n.continue()}},continuePrimaryKey:{value(t,a){n.continuePrimaryKey(dr(t,e.MAX_KEY,r),a)}},primaryKey:{get:()=>n.primaryKey},key:{get(){let e=n.key;return 1===o?e[0]:e.slice(0,o)}},value:{get:()=>n.value}})):n.openCursor(t)}}}}}};function di(e,t,n,r){return n=n||{},r=r||"",lh(e).forEach(a=>{if(lv(t,a)){var o=e[a],i=t[a];if("object"==typeof o&&"object"==typeof i&&o&&i){let e=lV(o);e!==lV(i)?n[r+a]=t[a]:"Object"===e?di(o,i,n,r+a+"."):o!==i&&(n[r+a]=t[a])}else o!==i&&(n[r+a]=t[a])}else n[r+a]=void 0}),lh(t).forEach(a=>{lv(e,a)||(n[r+a]=t[a])}),n}let ds={stack:"dbcore",name:"HooksMiddleware",level:2,create:e=>({...e,table(t){let n=e.table(t),{primaryKey:r}=n.schema;return{...n,mutate(e){let a=cE.trans,{deleting:o,creating:i,updating:s}=a.table(t).hook;switch(e.type){case"add":if(i.fire===ct)break;return a._promise("readwrite",()=>l(e),!0);case"put":if(i.fire===ct&&s.fire===ct)break;return a._promise("readwrite",()=>l(e),!0);case"delete":if(o.fire===ct)break;return a._promise("readwrite",()=>l(e),!0);case"deleteRange":if(o.fire===ct)break;return a._promise("readwrite",()=>(function e(t,a,o){return n.query({trans:t,values:!1,query:{index:r,range:a},limit:o}).then(({result:n})=>l({type:"delete",keys:n,trans:t}).then(r=>r.numFailures>0?Promise.reject(r.failures[0]):n.length<o?{failures:[],numFailures:0,lastResult:void 0}:e(t,{...a,lower:n[n.length-1],lowerOpen:!0},o)))})(e.trans,e.range,1e4),!0)}return n.mutate(e);function l(e){var t,a;let l=cE.trans,c=e.keys||("delete"===(t=e).type?t.keys:t.keys||t.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"===(a=e).type?Promise.resolve([]):n.getMany({trans:a.trans,keys:c,cache:"immutable"})).then(t=>{let a=c.map((n,a)=>{let c=t[a],u={onerror:null,onsuccess:null};if("delete"===e.type)o.fire.call(u,n,c,l);else if("add"===e.type||void 0===c){let t=i.fire.call(u,n,e.values[a],l);null==n&&null!=t&&(n=t,e.keys[a]=n,r.outbound||lT(e.values[a],r.keyPath,n))}else{let t=di(c,e.values[a]),r=s.fire.call(u,t,n,c,l);if(r){let t=e.values[a];Object.keys(r).forEach(e=>{lv(t,e)?t[e]=r[e]:lT(t,e,r[e])})}}return u});return n.mutate(e).then(({failures:n,results:r,numFailures:o,lastResult:i})=>{for(let o=0;o<c.length;++o){let i=r?r[o]:c[o],s=a[o];null==i?s.onerror&&s.onerror(n[o]):s.onsuccess&&s.onsuccess("put"===e.type&&t[o]?e.values[o]:i)}return{failures:n,results:r,numFailures:o,lastResult:i}}).catch(e=>(a.forEach(t=>t.onerror&&t.onerror(e)),Promise.reject(e)))})}}}}})};function dl(e,t,n){try{if(!t||t.keys.length<e.length)return null;let r=[];for(let a=0,o=0;a<t.keys.length&&o<e.length;++a)0===ux(t.keys[a],e[o])&&(r.push(n?lL(t.values[a]):t.values[a]),++o);return r.length===e.length?r:null}catch(e){return null}}let dc={stack:"dbcore",level:-1,create:e=>({table:t=>{let n=e.table(t);return{...n,getMany:e=>{if(!e.cache)return n.getMany(e);let t=dl(e.keys,e.trans._cache,"clone"===e.cache);return t?cP.resolve(t):n.getMany(e).then(t=>(e.trans._cache={keys:e.keys,values:"clone"===e.cache?lL(t):t},t))},mutate:e=>("add"!==e.type&&(e.trans._cache=null),n.mutate(e))}}})};function du(e){return!("from"in e)}let dd=function(e,t){if(!this){let t=new dd;return e&&"d"in e&&l_(t,e),t}l_(this,arguments.length?{d:1,from:e,to:arguments.length>1?t:e}:{d:0})};function dp(e,t,n){let r=ux(t,n);if(isNaN(r))return;if(r>0)throw RangeError();if(du(e))return l_(e,{from:t,to:n,d:1});let a=e.l,o=e.r;if(0>ux(n,e.from))return a?dp(a,t,n):e.l={from:t,to:n,d:1,l:null,r:null},dh(e);if(ux(t,e.to)>0)return o?dp(o,t,n):e.r={from:t,to:n,d:1,l:null,r:null},dh(e);0>ux(t,e.from)&&(e.from=t,e.l=null,e.d=o?o.d+1:1),ux(n,e.to)>0&&(e.to=n,e.r=null,e.d=e.l?e.l.d+1:1);let i=!e.r;a&&!e.l&&df(e,a),o&&i&&df(e,o)}function df(e,t){du(t)||function e(t,{from:n,to:r,l:a,r:o}){dp(t,n,r),a&&e(t,a),o&&e(t,o)}(e,t)}function dm(e){let t=du(e)?null:{s:0,n:e};return{next(e){let n=arguments.length>0;for(;t;)switch(t.s){case 0:if(t.s=1,n)for(;t.n.l&&0>ux(e,t.n.from);)t={up:t,n:t.n.l,s:1};else for(;t.n.l;)t={up:t,n:t.n.l,s:1};case 1:if(t.s=2,!n||0>=ux(e,t.n.to))return{value:t.n,done:!1};case 2:if(t.n.r){t.s=3,t={up:t,n:t.n.r,s:0};continue}case 3:t=t.up}return{done:!0}}}}function dh(e){var t,n;let r=((null==(t=e.r)?void 0:t.d)||0)-((null==(n=e.l)?void 0:n.d)||0),a=r>1?"r":r<-1?"l":"";if(a){let t="r"===a?"l":"r",n={...e},r=e[a];e.from=r.from,e.to=r.to,e[a]=r[a],n[a]=r[t],e[t]=n,n.d=dg(n)}e.d=dg(e)}function dg({r:e,l:t}){return(e?t?Math.max(e.d,t.d):e.d:t?t.d:0)+1}l$(dd.prototype,{add(e){return df(this,e),this},addKey(e){return dp(this,e,e),this},addKeys(e){return e.forEach(e=>dp(this,e,e)),this},[lG](){return dm(this)}});let d_={stack:"dbcore",level:0,create:e=>{let t=e.schema.name,n=new dd(e.MIN_KEY,e.MAX_KEY);return{...e,table:r=>{let a=e.table(r),{schema:o}=a,{primaryKey:i}=o,{extractKey:s,outbound:l}=i,c={...a,mutate:e=>{let i=e.trans,s=i.mutatedParts||(i.mutatedParts={}),l=e=>{let n=`idb://${t}/${r}/${e}`;return s[n]||(s[n]=new dd)},c=l(""),u=l(":dels"),{type:d}=e,[p,f]="deleteRange"===e.type?[e.range]:"delete"===e.type?[e.keys]:e.values.length<50?[[],e.values]:[],m=e.trans._cache;return a.mutate(e).then(e=>{if(lg(p)){"delete"!==d&&(p=e.results),c.addKeys(p);let t=dl(p,m);t||"add"===d||u.addKeys(p),(t||f)&&o.indexes.forEach(function(e){let n=l(e.name||"");function r(t){return null!=t?e.extractKey(t):null}let a=t=>e.multiEntry&&lg(t)?t.forEach(e=>n.addKey(e)):n.addKey(t);(t||f).forEach((e,n)=>{let o=t&&r(t[n]),i=f&&r(f[n]);0!==ux(o,i)&&(null!=o&&a(o),null!=i&&a(i))})})}else if(p){let e={from:p.lower,to:p.upper};u.add(e),c.add(e)}else c.add(n),u.add(n),o.indexes.forEach(e=>l(e.name).add(n));return e})}},u=({query:{index:t,range:n}})=>{var r,a;return[t,new dd(null!=(r=n.lower)?r:e.MIN_KEY,null!=(a=n.upper)?a:e.MAX_KEY)]},d={get:e=>[i,new dd(e.key)],getMany:e=>[i,(new dd).addKeys(e.keys)],count:u,query:u,openCursor:u};return lh(d).forEach(e=>{c[e]=function(o){let{subscr:i}=cE;if(i){let c=e=>{let n=`idb://${t}/${r}/${e}`;return i[n]||(i[n]=new dd)},u=c(""),p=c(":dels"),[f,m]=d[e](o);if(c(f.name||"").add(m),!f.isPrimaryKey){if("count"!==e){let t="query"===e&&l&&o.values&&a.query({...o,values:!1});return a[e].apply(this,arguments).then(n=>{if("query"===e){if(l&&o.values)return t.then(({result:e})=>(u.addKeys(e),n));let e=o.values?n.result.map(s):n.result;o.values?u.addKeys(e):p.addKeys(e)}else if("openCursor"===e){let e=o.values;return n&&Object.create(n,{key:{get:()=>(p.addKey(n.primaryKey),n.key)},primaryKey:{get(){let e=n.primaryKey;return p.addKey(e),e}},value:{get:()=>(e&&u.addKey(n.primaryKey),n.value)}})}return n})}p.add(n)}}return a[e].apply(this,arguments)}}),c}}}};class dy{constructor(e,t){var n;this._middlewares={},this.verno=0;const r=dy.dependencies;this._options=t={addons:dy.addons,autoOpen:!0,indexedDB:r.indexedDB,IDBKeyRange:r.IDBKeyRange,...t},this._deps={indexedDB:t.indexedDB,IDBKeyRange:t.IDBKeyRange};const{addons:a}=t;this._dbSchema={},this._versions=[],this._storeNames=[],this._allTables={},this.idbdb=null,this._novip=this;const o={dbOpenError:null,isBeingOpened:!1,onReadyBeingFired:null,openComplete:!1,dbReadyResolve:ct,dbReadyPromise:null,cancelOpen:ct,openCanceller:null,autoSchema:!0,PR1398_maxLoop:3};o.dbReadyPromise=new cP(e=>{o.dbReadyResolve=e}),o.openCanceller=new cP((e,t)=>{o.cancelOpen=t}),this._state=o,this.name=e,this.on=ug(this,"populate","blocked","versionchange","close",{ready:[cc,ct]}),this.on.ready.subscribe=lS(this.on.ready.subscribe,e=>(t,n)=>{dy.vip(()=>{let r=this._state;if(r.openComplete)r.dbOpenError||cP.resolve().then(t),n&&e(t);else if(r.onReadyBeingFired)r.onReadyBeingFired.push(t),n&&e(t);else{e(t);let r=this;n||e(function e(){r.on.ready.unsubscribe(t),r.on.ready.unsubscribe(e)})}})}),this.Collection=(n=this,u_(uD.prototype,function(e,t){this.db=n;let r=uf,a=null;if(t)try{r=t()}catch(e){a=e}let o=e._ctx,i=o.table,s=i.hook.reading.fire;this._ctx={table:i,index:o.index,isPrimKey:!o.index||i.schema.primKey.keyPath&&o.index===i.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:a,or:o.or,valueMapper:s!==cn?s:null}})),this.Table=function(e){return u_(uh.prototype,function(t,n,r){this.db=e,this._tx=r,this.name=t,this.schema=n,this.hook=e._allTables[t]?e._allTables[t].hook:ug(null,{creating:[co,ct],reading:[cr,cn],updating:[cs,ct],deleting:[ci,ct]})})}(this),this.Transaction=function(e){return u_(uV.prototype,function(t,n,r,a,o){this.db=e,this.mode=t,this.storeNames=n,this.schema=r,this.chromeTransactionDurability=a,this.idbtrans=null,this.on=ug(this,"complete","error","abort"),this.parent=o||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 cP((e,t)=>{this._resolve=e,this._reject=t}),this._completion.then(()=>{this.active=!1,this.on.complete.fire()},e=>{var t=this.active;return this.active=!1,this.on.error.fire(e),this.parent?this.parent._reject(e):t&&this.idbtrans&&this.idbtrans.abort(),ue(e)})})}(this),this.Version=function(e){return u_(u7.prototype,function(t){this.db=e,this._cfg={version:t,storesSource:null,dbschema:{},tables:{},contentUpgrade:null}})}(this),this.WhereClause=function(e){return u_(uB.prototype,function(t,n,r){this.db=e,this._ctx={table:t,index:":id"===n?null:n,or:r};let a=e._deps.indexedDB;if(!a)throw new l8.MissingAPI;this._cmp=this._ascending=a.cmp.bind(a),this._descending=(e,t)=>a.cmp(t,e),this._max=(e,t)=>a.cmp(e,t)>0?e:t,this._min=(e,t)=>0>a.cmp(e,t)?e:t,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=uq(t.IDBKeyRange),this._createTransaction=(e,t,n,r)=>new this.Transaction(e,t,n,this._options.chromeTransactionDurability,r),this._fireOnBlocked=e=>{this.on("blocked").fire(e),ui.filter(e=>e.name===this.name&&e!==this&&!e._state.vcFired).map(t=>t.on("versionchange").fire(e))},this.use(da),this.use(ds),this.use(d_),this.use(dc),this.vip=Object.create(this,{_vip:{value:!0}}),a.forEach(e=>e(this))}version(e){if(isNaN(e)||e<.1)throw new l8.Type("Given version is not a positive number");if(e=Math.round(10*e)/10,this.idbdb||this._state.isBeingOpened)throw new l8.Schema("Cannot add version when database is open");this.verno=Math.max(this.verno,e);let t=this._versions;var n=t.filter(t=>t._cfg.version===e)[0];return n||(n=new this.Version(e),t.push(n),t.sort(u1),n.stores({}),this._state.autoSchema=!1,n)}_whenReady(e){return this.idbdb&&(this._state.openComplete||cE.letThrough||this._vip)?e():new cP((e,t)=>{if(this._state.openComplete)return t(new l8.DatabaseClosed(this._state.dbOpenError));if(!this._state.isBeingOpened){if(!this._options.autoOpen)return void t(new l8.DatabaseClosed);this.open().catch(ct)}this._state.dbReadyPromise.then(e,t)}).then(e)}use({stack:e,create:t,level:n,name:r}){r&&this.unuse({stack:e,name:r});let a=this._middlewares[e]||(this._middlewares[e]=[]);return a.push({stack:e,create:t,level:null==n?10:n,name:r}),a.sort((e,t)=>e.level-t.level),this}unuse({stack:e,name:t,create:n}){return e&&this._middlewares[e]&&(this._middlewares[e]=this._middlewares[e].filter(e=>n?e.create!==n:!!t&&e.name!==t)),this}open(){return function(e){var t;let n=e._state,{indexedDB:r}=e._deps;if(n.isBeingOpened||e.idbdb)return n.dbReadyPromise.then(()=>n.dbOpenError?ue(n.dbOpenError):e);lZ&&(n.openCanceller._stackHolder=lX()),n.isBeingOpened=!0,n.dbOpenError=null,n.openComplete=!1;let a=n.openCanceller;function o(){if(n.openCanceller!==a)throw new l8.DatabaseClosed("db.open() was cancelled")}let i=n.dbReadyResolve,s=null,l=!1,c=()=>new cP((t,a)=>{if(o(),!r)throw new l8.MissingAPI;let i=e.name,c=n.autoSchema?r.open(i):r.open(i,Math.round(10*e.verno));if(!c)throw new l8.MissingAPI;c.onerror=uR(a),c.onblocked=cG(e._fireOnBlocked),c.onupgradeneeded=cG(t=>{if(s=c.transaction,n.autoSchema&&!e._options.allowEmptyDB){c.onerror=uj,s.abort(),c.result.close();let e=r.deleteDatabase(i);e.onsuccess=e.onerror=cG(()=>{a(new l8.NoSuchDatabase(`Database ${i} doesnt exist`))})}else{let n,r,i,p;s.onerror=uR(a);var o,u,d=t.oldVersion>0x4000000000000000?0:t.oldVersion;l=d<1,e._novip.idbdb=c.result,o=d/10,u=s,n=e._dbSchema,(r=e._createTransaction("readwrite",e._storeNames,n)).create(u),r._completion.catch(a),i=r._reject.bind(r),p=cE.transless||cE,cJ(()=>{cE.trans=r,cE.transless=p,0===o?(lh(n).forEach(e=>{u3(u,e,n[e].primKey,n[e].indexes)}),uX(e,u),cP.follow(()=>e.on.populate.fire(r)).catch(i)):(function({_novip:e},t,n,r){let a=[],o=e._versions,i=e._dbSchema=u5(e,e.idbdb,r),s=!1;return o.filter(e=>e._cfg.version>=t).forEach(o=>{a.push(()=>{let a=i,l=o._cfg.dbschema;u6(e,a,r),u6(e,l,r),i=e._dbSchema=l;let c=u2(a,l);c.add.forEach(e=>{u3(r,e[0],e[1].primKey,e[1].indexes)}),c.change.forEach(e=>{if(e.recreate)throw new l8.Upgrade("Not yet support for changing primary key");{let t=r.objectStore(e.name);e.add.forEach(e=>u4(t,e)),e.change.forEach(e=>{t.deleteIndex(e.name),u4(t,e)}),e.del.forEach(e=>t.deleteIndex(e))}});let u=o._cfg.contentUpgrade;if(u&&o._cfg.version>t){let t;uX(e,r),n._memoizedTables={},s=!0;let o=lO(l);c.del.forEach(e=>{o[e]=a[e]}),u0(e,[e.Transaction.prototype]),uQ(e,[e.Transaction.prototype],lh(o),o),n.schema=o;let i=lK(u);i&&cX();let d=cP.follow(()=>{if((t=u(n))&&i){var e=cQ.bind(null,null);t.then(e,e)}});return t&&"function"==typeof t.then?cP.resolve(t):d.then(()=>t)}}),a.push(t=>{var r;s&&us||(r=o._cfg.dbschema,[].slice.call(t.db.objectStoreNames).forEach(e=>null==r[e]&&t.db.deleteObjectStore(e))),u0(e,[e.Transaction.prototype]),uQ(e,[e.Transaction.prototype],e._storeNames,e._dbSchema),n.schema=e._dbSchema})}),(function e(){return a.length?cP.resolve(a.shift()(n.idbtrans)).then(e):cP.resolve()})().then(()=>{var e;lh(e=i).forEach(t=>{r.db.objectStoreNames.contains(t)||u3(r,t,e[t].primKey,e[t].indexes)})})})(e,o,r,u).catch(i)})}},a),c.onsuccess=cG(()=>{s=null;let r=e._novip.idbdb=c.result,a=lD(r.objectStoreNames);if(a.length>0)try{let t,o=r.transaction(1===a.length?a[0]:a,"readonly");n.autoSchema?function({_novip:e},t,n){e.verno=t.version/10;let r=e._dbSchema=u5(0,t,n);e._storeNames=lD(t.objectStoreNames,0),uQ(e,[e._allTables],lh(r),r)}(e,r,o):(u6(e,e._dbSchema,o),((t=u2(u5(0,e.idbdb,o),e._dbSchema)).add.length||t.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.")),uX(e,o)}catch(e){}ui.push(e),r.onversionchange=cG(t=>{n.vcFired=!0,e.on("versionchange").fire(t)}),r.onclose=cG(t=>{e.on("close").fire(t)}),l&&function({indexedDB:e,IDBKeyRange:t},n){u9(e)||n===uc||u8(e,t).put({name:n}).catch(ct)}(e._deps,i),t()},a)}).catch(e=>e&&"UnknownError"===e.name&&n.PR1398_maxLoop>0?(n.PR1398_maxLoop--,console.warn("Dexie: Workaround for Chrome UnknownError on open()"),c()):cP.reject(e));return cP.race([a,("u"<typeof navigator?cP.resolve():!navigator.userAgentData&&/Safari\//.test(navigator.userAgent)&&!/Chrom(e|ium)\//.test(navigator.userAgent)&&indexedDB.databases?new Promise(function(e){var n=function(){return indexedDB.databases().finally(e)};t=setInterval(n,100),n()}).finally(function(){return clearInterval(t)}):Promise.resolve()).then(c)]).then(()=>(o(),n.onReadyBeingFired=[],cP.resolve(de(()=>e.on.ready.fire(e.vip))).then(function t(){if(n.onReadyBeingFired.length>0){let r=n.onReadyBeingFired.reduce(cc,ct);return n.onReadyBeingFired=[],cP.resolve(de(()=>r(e.vip))).then(t)}}))).finally(()=>{n.onReadyBeingFired=null,n.isBeingOpened=!1}).then(()=>e).catch(t=>{n.dbOpenError=t;try{s&&s.abort()}catch(e){}return a===n.openCanceller&&e._close(),ue(t)}).finally(()=>{n.openComplete=!0,i()})}(this)}_close(){let e=this._state,t=ui.indexOf(this);if(t>=0&&ui.splice(t,1),this.idbdb){try{this.idbdb.close()}catch(e){}this._novip.idbdb=null}e.dbReadyPromise=new cP(t=>{e.dbReadyResolve=t}),e.openCanceller=new cP((t,n)=>{e.cancelOpen=n})}close(){this._close();let e=this._state;this._options.autoOpen=!1,e.dbOpenError=new l8.DatabaseClosed,e.isBeingOpened&&e.cancelOpen(e.dbOpenError)}delete(){let e=arguments.length>0,t=this._state;return new cP((n,r)=>{let a=()=>{this.close();var e=this._deps.indexedDB.deleteDatabase(this.name);e.onsuccess=cG(()=>{!function({indexedDB:e,IDBKeyRange:t},n){u9(e)||n===uc||u8(e,t).delete(n).catch(ct)}(this._deps,this.name),n()}),e.onerror=uR(r),e.onblocked=this._fireOnBlocked};if(e)throw new l8.InvalidArgument("Arguments not allowed in db.delete()");t.isBeingOpened?t.dbReadyPromise.then(a):a()})}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 lh(this._allTables).map(e=>this._allTables[e])}transaction(){let e=dn.apply(this,arguments);return this._transaction.apply(this,e)}_transaction(e,t,n){let r,a,o=cE.trans;o&&o.db===this&&-1===e.indexOf("!")||(o=null);let i=-1!==e.indexOf("?");e=e.replace("!","").replace("?","");try{if(a=t.map(e=>{var t=e instanceof this.Table?e.name:e;if("string"!=typeof t)throw TypeError("Invalid table argument to Dexie.transaction(). Only Table or String are allowed");return t}),"r"==e||e===uu)r=uu;else{if("rw"!=e&&e!=ud)throw new l8.InvalidArgument("Invalid transaction mode: "+e);r=ud}if(o){if(o.mode===uu&&r===ud){if(!i)throw new l8.SubTransaction("Cannot enter a sub-transaction with READWRITE mode when parent transaction is READONLY");o=null}o&&a.forEach(e=>{if(o&&-1===o.storeNames.indexOf(e)){if(!i)throw new l8.SubTransaction("Table "+e+" not included in parent transaction.");o=null}}),i&&o&&!o.active&&(o=null)}}catch(e){return o?o._promise(null,(t,n)=>{n(e)}):ue(e)}let s=(function e(t,n,r,a,o){return cP.resolve().then(()=>{let i,s=cE.transless||cE,l=t._createTransaction(n,r,t._dbSchema,a);if(a)l.idbtrans=a.idbtrans;else try{l.create(),t._state.PR1398_maxLoop=3}catch(a){return a.name===l7.InvalidState&&t.isOpen()&&--t._state.PR1398_maxLoop>0?(console.warn("Dexie: Need to reopen db"),t._close(),t.open().then(()=>e(t,n,r,null,o))):ue(a)}let c=lK(o);c&&cX();let u=cP.follow(()=>{if(i=o.call(l,l))if(c){var e=cQ.bind(null,null);i.then(e,e)}else"function"==typeof i.next&&"function"==typeof i.throw&&(i=dt(i))},{trans:l,transless:s});return(i&&"function"==typeof i.then?cP.resolve(i).then(e=>l.active?e:ue(new l8.PrematureCommit("Transaction committed too early. See http://bit.ly/2kdckMn"))):u.then(()=>i)).then(e=>(a&&l._resolve(),l._completion.then(()=>e))).catch(e=>(l._reject(e),ue(e)))})}).bind(null,this,r,a,o,n);return o?o._promise(r,s,"lock"):cE.trans?c5(cE.transless,()=>this._whenReady(s)):this._whenReady(s)}table(e){if(!lv(this._allTables,e))throw new l8.InvalidTable(`Table ${e} does not exist`);return this._allTables[e]}}let db="u">typeof Symbol&&"observable"in Symbol?Symbol.observable:"@@observable";class dv{constructor(e){this._subscribe=e}subscribe(e,t,n){return this._subscribe(e&&"function"!=typeof e?e:{next:e,error:t,complete:n})}[db](){return this}}function d$(e,t){return lh(t).forEach(n=>{df(e[n]||(e[n]=new dd),t[n])}),e}try{a={indexedDB:lm.indexedDB||lm.mozIndexedDB||lm.webkitIndexedDB||lm.msIndexedDB,IDBKeyRange:lm.IDBKeyRange||lm.webkitIDBKeyRange}}catch(e){a={indexedDB:null,IDBKeyRange:null}}function dA(e){let t=dw;try{dw=!0,uW.storagemutated.fire(e)}finally{dw=t}}l$(dy,{...ce,delete:e=>new dy(e,{addons:[]}).delete(),exists:e=>new dy(e,{addons:[]}).open().then(e=>(e.close(),!0)).catch("NoSuchDatabaseError",()=>!1),getDatabaseNames(e){try{return(function({indexedDB:e,IDBKeyRange:t}){return u9(e)?Promise.resolve(e.databases()).then(e=>e.map(e=>e.name).filter(e=>e!==uc)):u8(e,t).toCollection().primaryKeys()})(dy.dependencies).then(e)}catch(e){return ue(new l8.MissingAPI)}},defineClass:()=>function(e){l_(this,e)},ignoreTransaction:e=>cE.trans?c5(cE.transless,e):e(),vip:de,async:function(e){return function(){try{var t=dt(e.apply(this,arguments));return t&&"function"==typeof t.then?t:cP.resolve(t)}catch(e){return ue(e)}}},spawn:function(e,t,n){try{var r=dt(e.apply(n,t||[]));return r&&"function"==typeof r.then?r:cP.resolve(r)}catch(e){return ue(e)}},currentTransaction:{get:()=>cE.trans||null},waitFor:function(e,t){let n=cP.resolve("function"==typeof e?dy.ignoreTransaction(e):e).timeout(t||6e4);return cE.trans?cE.trans.waitFor(n):n},Promise:cP,debug:{get:()=>lZ,set:e=>{lZ=e,lY="dexie"===e?()=>!0:ul}},derive:lk,extend:l_,props:l$,override:lS,Events:ug,on:uW,liveQuery:function(e){let t,n=!1,r=new dv(r=>{let a=lK(e),o=!1,i={},s={},l={get closed(){return o},unsubscribe:()=>{o=!0,uW.storagemutated.unsubscribe(p)}};r.start&&r.start(l);let c=!1,u=!1;function d(){return lh(s).some(e=>i[e]&&function(e,t){let n=dm(t),r=n.next();if(r.done)return!1;let a=r.value,o=dm(e),i=o.next(a.from),s=i.value;for(;!r.done&&!i.done;){if(0>=ux(s.from,a.to)&&ux(s.to,a.from)>=0)return!0;0>ux(a.from,s.from)?a=(r=n.next(s.from)).value:s=(i=o.next(a.from)).value}return!1}(i[e],s[e]))}let p=e=>{d$(i,e),d()&&f()},f=()=>{let m,h;if(c||o)return;i={};let g={},y=(a&&cX(),m=()=>cJ(e,{subscr:g,trans:null}),h=cE.trans?c5(cE.transless,m):m(),a&&h.then(cQ,cQ),h);u||(uW(uF,p),u=!0),c=!0,Promise.resolve(y).then(e=>{n=!0,t=e,c=!1,o||(d()?f():(i={},s=g,r.next&&r.next(e)))},e=>{c=!1,n=!1,r.error&&r.error(e),l.unsubscribe()})};return f(),l});return r.hasValue=()=>n,r.getValue=()=>t,r},extendObservabilitySet:d$,getByKeyPath:lN,setByKeyPath:lT,delByKeyPath:function(e,t){"string"==typeof t?lT(e,t,void 0):"length"in t&&[].map.call(t,function(t){lT(e,t,void 0)})},shallowClone:lO,deepClone:lL,getObjectDiff:di,cmp:ux,asap:lP,minKey:ur,addons:[],connections:ui,errnames:l7,dependencies:a,semVer:ut,version:ut.split(".").map(e=>parseInt(e)).reduce((e,t,n)=>e+t/Math.pow(10,2*n))}),dy.maxKey=uq(dy.dependencies.IDBKeyRange),"u">typeof dispatchEvent&&"u">typeof addEventListener&&(uW(uF,e=>{if(!dw){let t;us?(t=document.createEvent("CustomEvent")).initCustomEvent(uL,!0,!0,e):t=new CustomEvent(uL,{detail:e}),dw=!0,dispatchEvent(t),dw=!1}}),addEventListener(uL,({detail:e})=>{dw||dA(e)}));let dw=!1;if("u">typeof BroadcastChannel){let e=new BroadcastChannel(uL);"function"==typeof e.unref&&e.unref(),uW(uF,t=>{dw||e.postMessage(t)}),e.onmessage=e=>{e.data&&dA(e.data)}}else if("u">typeof self&&"u">typeof navigator){uW(uF,e=>{try{dw||("u">typeof localStorage&&localStorage.setItem(uL,JSON.stringify({trig:Math.random(),changedParts:e})),"object"==typeof self.clients&&[...self.clients.matchAll({includeUncontrolled:!0})].forEach(t=>t.postMessage({type:uL,changedParts:e})))}catch(e){}}),"u">typeof addEventListener&&addEventListener("storage",e=>{if(e.key===uL){let t=JSON.parse(e.newValue);t&&dA(t.changedParts)}});let e=self.document&&navigator.serviceWorker;e&&e.addEventListener("message",function({data:e}){e&&e.type===uL&&dA(e.changedParts)})}function dk(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}cP.rejectionMapper=function(e,t){if(!e||e instanceof l3||e instanceof TypeError||e instanceof SyntaxError||!e.name||!l9[e.name])return e;var n=new l9[e.name](t||e.message,e);return"stack"in e&&lw(n,"stack",{get:function(){return this.inner.stack}}),n},lY=ul;class dx extends dy{constructor(){super("EsmOffline"),dk(this,"syncQueue",void 0),dk(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 dC(){return new dx}let dE=new dx,dD={},dS=Y("offline-synchronization",{});function dz(){return dS}async function dP(){if(dS.getState().synchronization)return;let e=await dE.syncQueue.count(),t={},n=Object.entries(dD),r=n.length,a={},o=new AbortController,i=()=>{let e=dS.getState().synchronization;dS.setState({synchronization:{...e,pendingCount:e.pendingCount-1}})};try{dS.setState({synchronization:{totalCount:e,pendingCount:e,abortController:o}});for(let e=0;e<r&&n.length>0;e++)for(let e=n.length;e--;){let[r,s]=n[e],l=s.dependsOn.map(e=>t[e]);l.every(Boolean)&&(a[r]={},await Promise.all(l),t[r]=dM(s,a,o,i),n.splice(e,1))}await Promise.allSettled(Object.values(t))}finally{dS.setState({synchronization:void 0})}}async function dM({type:e,dependsOn:t,process:n},r,a,o){let i=[],s=[],l=await dN();await dE.syncQueue.where({type:e,userId:l}).each((e,t)=>{i.push([t.primaryKey,e.content,e.descriptor]),s.push(e.content)});for(let c=0;c<i.length;c++){let[u,d,{id:p,dependencies:f=[]}]=i[c];try{let o=await n(d,{abort:a,index:c,items:s,userId:l,dependencies:f.map(({id:e,type:n})=>t.includes(n)?r[n][e]:void 0)});void 0!==p&&(r[e][p]=o),await dE.syncQueue.delete(u)}catch(e){await dE.syncQueue.update(u,{lastError:{name:e?.name,message:e?.message??e?.toString()}})}finally{o()}}}async function dN(){let e=await iY();return e?.uuid||"*"}async function dT(e,t,n,r){let a=r&&r.id;return void 0!==a&&await dE.syncQueue.where({type:t,userId:e}).filter(e=>e?.descriptor.id===a).delete().catch(dy.errnames.DatabaseClosed),await dE.syncQueue.add({type:t,content:n,userId:e,descriptor:r||{},createdOn:new Date}).catch(dy.errnames.DatabaseClosed,()=>-1)}async function dO(e,t,n){let r=await dN();return await dT(r,e,t,n)}async function dI(e,t){return(await dB(e,t)).map(e=>e.content)}async function dB(e,t){return await dE.syncQueue.where(t?{type:t,userId:e}:{userId:e}).toArray().catch(dy.errnames.DatabaseClosed,()=>[])}async function dR(e){let t=await dN();return await dI(t,e)}async function dj(e){let t=await dN();return await dB(t,e)}async function dF(e){return await dE.syncQueue.get(e).catch(dy.errnames.DatabaseClosed,()=>void 0)}function dL(e){return!!dD[e]?.options.onBeginEditSyncItem}async function dW(e){let t=await dF(e);if(!t)throw Error(`No sync item with the ID ${e} exists.`);let n=dD[t.type]?.options.onBeginEditSyncItem;if(!n)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 "${t.type}" supports editing items.`);n(t)}async function dV(e){await dE.syncQueue.delete(e).catch(dy.errnames.DatabaseClosed)}function dG(e,t,n,r={}){dD[e]={type:e,dependsOn:t,process:n,options:r}}let dU="u">typeof crypto&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),dH=new Uint8Array(16),dq=[];for(let e=0;e<256;++e)dq.push((e+256).toString(16).slice(1));let dK=function(e,t,n){if(dU&&!t&&!e)return dU();let r=(e=e||{}).random||(e.rng||function(){if(!o&&!(o="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 o(dH)})();if(r[6]=15&r[6]|64,r[8]=63&r[8]|128,t){n=n||0;for(let e=0;e<16;++e)t[n+e]=r[e];return t}return function(e,t=0){return dq[e[t+0]]+dq[e[t+1]]+dq[e[t+2]]+dq[e[t+3]]+"-"+dq[e[t+4]]+dq[e[t+5]]+"-"+dq[e[t+6]]+dq[e[t+7]]+"-"+dq[e[t+8]]+dq[e[t+9]]+"-"+dq[e[t+10]]+dq[e[t+11]]+dq[e[t+12]]+dq[e[t+13]]+dq[e[t+14]]+dq[e[t+15]]}(r)},dZ="OFFLINE+";function dY(){return dZ+dK()}function dJ(e){return e.startsWith(dZ)}let dX={};function dQ(){return Object.values(dX)}function d0(e){dX[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.`),dX[e.id]=e}async function d1(e){let t=await d9();return await d2(t,e)}async function d2(e,t){let n=new dx;return await n.dynamicOfflineData.where(t?{type:t,users:e}:{users:e}).toArray().catch(dy.errnames.DatabaseClosed,()=>[])}async function d3(e,t){let n=await d9();return await d4(n,e,t)}async function d4(e,t,n){let r=new dx,a=await r.dynamicOfflineData.get({type:t,identifier:n}).catch(dy.errnames.DatabaseClosed,()=>void 0);a?a.users.includes(e)||await r.dynamicOfflineData.update(a.id,{users:[...a.users,e]}).catch(dy.errnames.DatabaseClosed):await r.dynamicOfflineData.add({users:[e],type:t,identifier:n}).catch(dy.errnames.DatabaseClosed)}async function d5(e,t){let n=await d9();return await d6(n,e,t)}async function d6(e,t,n){let r=new dx,a=await r.dynamicOfflineData.get({type:t,identifier:n,users:e}).catch(dy.errnames.DatabaseClosed,()=>void 0);a&&(a.users.length>1?await r.dynamicOfflineData.update(a.id,{users:a.users.filter(t=>t!==e)}).catch(dy.errnames.DatabaseClosed):await r.dynamicOfflineData.delete(a.id).catch(dy.errnames.DatabaseClosed))}async function d7(e,t){let n=await d1(e);await Promise.all(n.map(async e=>d8(e.type,e.identifier,t)))}async function d8(e,t,n){await d3(e,t);let r=new dx,a=await d9(),o=await r.dynamicOfflineData.get({type:e,identifier:t}).catch(dy.errnames.DatabaseClosed,()=>void 0),i=dQ().filter(t=>t.type===e);if(!o)return;let s=await Promise.all(i.map(async e=>{try{return e.sync(t,n),{id:e.id,error:void 0}}catch(n){let t=n.message?.toString()??n.toString();return{id:e.id,error:t}}})),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})),d={syncedOn:new Date,syncedBy:a,succeededHandlers:l,erroredHandlers:c,errors:u};o.id&&await r.dynamicOfflineData.update(o.id,{syncState:d}).catch(dy.errnames.DatabaseClosed)}async function d9(){let e=(await iY()).uuid;if(!e)throw Error("Using the dynamic offline data API requires a logged in user.");return e}let pe=Y("offline-patients",{offlinePatientDataSyncState:{},handlers:{}});function pt(){return pa(),pe}function pn(e,t){pa(),d0({type:"patient",displayName:t.displayName,id:e,isSynced:()=>Promise.resolve(!0),sync:(e,n)=>t.onOfflinePatientAdded({patientUuid:e,signal:n??new AbortController().signal})})}async function pr(e){pa(),await d8("patient",e)}function pa(){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 po(e,t,n=!0){if(e){let r=null,[a,o]=await Promise.all([ij(`${iI}/Patient/${e}`,t).catch(e=>r=e),n?pi(e):Promise.resolve(null)]);if(a.ok)return a.data;if(o)return o;if(r)throw r}return null}async function pi(e){let t=(await dR("patient-registration")).find(t=>t.fhirPatient.id===e);return t?.fhirPatient??null}function ps(e,t){let n=new CustomEvent(`openmrs:${e}`,{detail:t??void 0,cancelable:!0,bubbles:!0});return window.dispatchEvent(n)}function pl(e,t){let n=e=>{t("detail"in e&&null!==e.detail?e.detail:void 0)};return window.addEventListener(`openmrs:${e}`,n),()=>{window.removeEventListener(`openmrs:${e}`,n)}}var pc=n(9549);function pu(e){return{uuid:e.uuid,display:e.display}}function pd(e=null,t=null){let n=new URLSearchParams;e&&n.set("tag",e),t&&n.set("q",t);let r=n.toString();return iF(`${iO}/location${r?"?"+r:""}`).pipe((0,pc.map)(e=>e.data.results.map(pu))).pipe((0,pc.take)(1))}function pp(e){return{uuid:e.uuid,display:e.display,name:e.name}}function pf(){return iF(`${iO}/visittype`).pipe((0,pc.map)(e=>e.data.results.map(pp))).pipe((0,pc.take)(1))}var pm=function(){function e(){return Error.call(this),this.message="object unsubscribed",this.name="ObjectUnsubscribedError",this}return e.prototype=Object.create(Error.prototype),e}(),ph=function(e){function t(t,n){var r=e.call(this)||this;return r.subject=t,r.subscriber=n,r.closed=!1,r}return ej(t,e),t.prototype.unsubscribe=function(){if(!this.closed){this.closed=!0;var e=this.subject,t=e.observers;if(this.subject=null,t&&0!==t.length&&!e.isStopped&&!e.closed){var n=t.indexOf(this.subscriber);-1!==n&&t.splice(n,1)}}},t}(eq),pg=function(e){function t(t){var n=e.call(this,t)||this;return n.destination=t,n}return ej(t,e),t}(eY),p_=function(e){function t(){var t=e.call(this)||this;return t.observers=[],t.closed=!1,t.isStopped=!1,t.hasError=!1,t.thrownError=null,t}return ej(t,e),t.prototype[eZ]=function(){return new pg(this)},t.prototype.lift=function(e){var t=new py(this,this);return t.operator=e,t},t.prototype.next=function(e){if(this.closed)throw new pm;if(!this.isStopped)for(var t=this.observers,n=t.length,r=t.slice(),a=0;a<n;a++)r[a].next(e)},t.prototype.error=function(e){if(this.closed)throw new pm;this.hasError=!0,this.thrownError=e,this.isStopped=!0;for(var t=this.observers,n=t.length,r=t.slice(),a=0;a<n;a++)r[a].error(e);this.observers.length=0},t.prototype.complete=function(){if(this.closed)throw new pm;this.isStopped=!0;for(var e=this.observers,t=e.length,n=e.slice(),r=0;r<t;r++)n[r].complete();this.observers.length=0},t.prototype.unsubscribe=function(){this.isStopped=!0,this.closed=!0,this.observers=null},t.prototype._trySubscribe=function(t){if(!this.closed)return e.prototype._trySubscribe.call(this,t);throw new pm},t.prototype._subscribe=function(e){if(this.closed)throw new pm;return this.hasError?(e.error(this.thrownError),eq.EMPTY):this.isStopped?(e.complete(),eq.EMPTY):(this.observers.push(e),new ph(this,e))},t.prototype.asObservable=function(){var e=new eQ;return e.source=this,e},t.create=function(e,t){return new py(e,t)},t}(eQ),py=function(e){function t(t,n){var r=e.call(this)||this;return r.destination=t,r.source=n,r}return ej(t,e),t.prototype.next=function(e){var t=this.destination;t&&t.next&&t.next(e)},t.prototype.error=function(e){var t=this.destination;t&&t.error&&this.destination.error(e)},t.prototype.complete=function(){var e=this.destination;e&&e.complete&&this.destination.complete()},t.prototype._subscribe=function(e){return this.source?this.source.subscribe(e):eq.EMPTY},t}(p_),pb=function(e){function t(t){var n=e.call(this)||this;return n._value=t,n}return ej(t,e),Object.defineProperty(t.prototype,"value",{get:function(){return this.getValue()},enumerable:!0,configurable:!0}),t.prototype._subscribe=function(t){var n=e.prototype._subscribe.call(this,t);return n&&!n.closed&&t.next(this._value),n},t.prototype.getValue=function(){if(this.hasError)throw this.thrownError;if(!this.closed)return this._value;throw new pm},t.prototype.next=function(t){e.prototype.next.call(this,this._value=t)},t}(p_),pv=((eu={}).NEWVISIT="startVisit",eu.EDITVISIT="editVisit",eu.LOADING="loadingVisit",eu),p$=((ed={}).NOTSTARTED="notStarted",ed.ONGOING="ongoing",ed);let pA="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))",pw=function(){try{return JSON.parse(sessionStorage.getItem("openmrs:visitStoreState")||"null")}catch(e){return null}}()||{patientUuid:null,manuallySetVisitUuid:null};function pk(){return X("visit",pw)}function px(e,t){pk().setState({patientUuid:e,manuallySetVisitUuid:t})}function pC(e,t){return ij(`${iO}/visit`,{signal:t.signal,method:"POST",headers:{"Content-type":"application/json"},body:e})}function pE(e,t,n){return ij(`${iO}/visit/${e}`,{signal:n.signal,method:"POST",headers:{"Content-type":"application/json"},body:t})}function pD(e,t,n){return ij(`${iO}/visit?patient=${e}&v=${n??pA}`,{signal:t.signal,method:"GET",headers:{"Content-type":"application/json"}})}pk().subscribe(e=>{var t;t=e,sessionStorage.setItem("openmrs:visitStoreState",JSON.stringify(t))});let pS=new pb(null);class pz{static get version(){return"1.4.0"}static toString(){return"JavaScript Expression Parser (JSEP) v"+pz.version}static addUnaryOp(e){return pz.max_unop_len=Math.max(e.length,pz.max_unop_len),pz.unary_ops[e]=1,pz}static addBinaryOp(e,t,n){return pz.max_binop_len=Math.max(e.length,pz.max_binop_len),pz.binary_ops[e]=t,n?pz.right_associative.add(e):pz.right_associative.delete(e),pz}static addIdentifierChar(e){return pz.additional_identifier_chars.add(e),pz}static addLiteral(e,t){return pz.literals[e]=t,pz}static removeUnaryOp(e){return delete pz.unary_ops[e],e.length===pz.max_unop_len&&(pz.max_unop_len=pz.getMaxKeyLen(pz.unary_ops)),pz}static removeAllUnaryOps(){return pz.unary_ops={},pz.max_unop_len=0,pz}static removeIdentifierChar(e){return pz.additional_identifier_chars.delete(e),pz}static removeBinaryOp(e){return delete pz.binary_ops[e],e.length===pz.max_binop_len&&(pz.max_binop_len=pz.getMaxKeyLen(pz.binary_ops)),pz.right_associative.delete(e),pz}static removeAllBinaryOps(){return pz.binary_ops={},pz.max_binop_len=0,pz}static removeLiteral(e){return delete pz.literals[e],pz}static removeAllLiterals(){return pz.literals={},pz}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 pz(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 pz.binary_ops[e]||0}static isIdentifierStart(e){return e>=65&&e<=90||e>=97&&e<=122||e>=128&&!pz.binary_ops[String.fromCharCode(e)]||pz.additional_identifier_chars.has(String.fromCharCode(e))}static isIdentifierPart(e){return pz.isIdentifierStart(e)||pz.isDecimalDigit(e)}throwError(e){let t=Error(e+" at character "+this.index);throw t.index=this.index,t.description=e,t}runHook(e,t){if(pz.hooks[e]){let n={context:this,node:t};return pz.hooks.run(e,n),n.node}return t}searchHook(e){if(pz.hooks[e]){let t={context:this};return pz.hooks[e].find(function(e){return e.call(t.context,t),t.node}),t.node}}gobbleSpaces(){let e=this.code;for(;e===pz.SPACE_CODE||e===pz.TAB_CODE||e===pz.LF_CODE||e===pz.CR_CODE;)e=this.expr.charCodeAt(++this.index);this.runHook("gobble-spaces")}parse(){this.runHook("before-all");let e=this.gobbleExpressions(),t=1===e.length?e[0]:{type:pz.COMPOUND,body:e};return this.runHook("after-all",t)}gobbleExpressions(e){let t=[],n,r;for(;this.index<this.expr.length;)if((n=this.code)===pz.SEMCOL_CODE||n===pz.COMMA_CODE)this.index++;else if(r=this.gobbleExpression())t.push(r);else if(this.index<this.expr.length){if(n===e)break;this.throwError('Unexpected "'+this.char+'"')}return t}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,pz.max_binop_len),t=e.length;for(;t>0;){if(pz.binary_ops.hasOwnProperty(e)&&(!pz.isIdentifierStart(this.code)||this.index+e.length<this.expr.length&&!pz.isIdentifierPart(this.expr.charCodeAt(this.index+e.length))))return this.index+=t,e;e=e.substr(0,--t)}return!1}gobbleBinaryExpression(){let e,t,n,r,a,o,i,s,l;if(!(o=this.gobbleToken())||!(t=this.gobbleBinaryOp()))return o;for(a={value:t,prec:pz.binaryPrecedence(t),right_a:pz.right_associative.has(t)},(i=this.gobbleToken())||this.throwError("Expected expression after "+t),r=[o,a,i];t=this.gobbleBinaryOp();){if(0===(n=pz.binaryPrecedence(t))){this.index-=t.length;break}a={value:t,prec:n,right_a:pz.right_associative.has(t)},l=t;let s=e=>a.right_a&&e.right_a?n>e.prec:n<=e.prec;for(;r.length>2&&s(r[r.length-2]);)i=r.pop(),t=r.pop().value,o=r.pop(),e={type:pz.BINARY_EXP,operator:t,left:o,right:i},r.push(e);(e=this.gobbleToken())||this.throwError("Expected expression after "+l),r.push(a,e)}for(s=r.length-1,e=r[s];s>1;)e={type:pz.BINARY_EXP,operator:r[s-1].value,left:r[s-2],right:e},s-=2;return e}gobbleToken(){let e,t,n,r;if(this.gobbleSpaces(),r=this.searchHook("gobble-token"))return this.runHook("after-token",r);if(e=this.code,pz.isDecimalDigit(e)||e===pz.PERIOD_CODE)return this.gobbleNumericLiteral();if(e===pz.SQUOTE_CODE||e===pz.DQUOTE_CODE)r=this.gobbleStringLiteral();else if(e===pz.OBRACK_CODE)r=this.gobbleArray();else{for(n=(t=this.expr.substr(this.index,pz.max_unop_len)).length;n>0;){if(pz.unary_ops.hasOwnProperty(t)&&(!pz.isIdentifierStart(this.code)||this.index+t.length<this.expr.length&&!pz.isIdentifierPart(this.expr.charCodeAt(this.index+t.length)))){this.index+=n;let e=this.gobbleToken();return e||this.throwError("missing unaryOp argument"),this.runHook("after-token",{type:pz.UNARY_EXP,operator:t,argument:e,prefix:!0})}t=t.substr(0,--n)}pz.isIdentifierStart(e)?(r=this.gobbleIdentifier(),pz.literals.hasOwnProperty(r.name)?r={type:pz.LITERAL,value:pz.literals[r.name],raw:r.name}:r.name===pz.this_str&&(r={type:pz.THIS_EXP})):e===pz.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 t=this.code;for(;t===pz.PERIOD_CODE||t===pz.OBRACK_CODE||t===pz.OPAREN_CODE||t===pz.QUMARK_CODE;){let n;if(t===pz.QUMARK_CODE){if(this.expr.charCodeAt(this.index+1)!==pz.PERIOD_CODE)break;n=!0,this.index+=2,this.gobbleSpaces(),t=this.code}this.index++,t===pz.OBRACK_CODE?((e={type:pz.MEMBER_EXP,computed:!0,object:e,property:this.gobbleExpression()}).property||this.throwError('Unexpected "'+this.char+'"'),this.gobbleSpaces(),(t=this.code)!==pz.CBRACK_CODE&&this.throwError("Unclosed ["),this.index++):t===pz.OPAREN_CODE?e={type:pz.CALL_EXP,arguments:this.gobbleArguments(pz.CPAREN_CODE),callee:e}:(t===pz.PERIOD_CODE||n)&&(n&&this.index--,this.gobbleSpaces(),e={type:pz.MEMBER_EXP,computed:!1,object:e,property:this.gobbleIdentifier()}),n&&(e.optional=!0),this.gobbleSpaces(),t=this.code}return e}gobbleNumericLiteral(){let e="",t,n;for(;pz.isDecimalDigit(this.code);)e+=this.expr.charAt(this.index++);if(this.code===pz.PERIOD_CODE)for(e+=this.expr.charAt(this.index++);pz.isDecimalDigit(this.code);)e+=this.expr.charAt(this.index++);if("e"===(t=this.char)||"E"===t){for(e+=this.expr.charAt(this.index++),("+"===(t=this.char)||"-"===t)&&(e+=this.expr.charAt(this.index++));pz.isDecimalDigit(this.code);)e+=this.expr.charAt(this.index++);pz.isDecimalDigit(this.expr.charCodeAt(this.index-1))||this.throwError("Expected exponent ("+e+this.char+")")}return n=this.code,pz.isIdentifierStart(n)?this.throwError("Variable names cannot start with a number ("+e+this.char+")"):(n===pz.PERIOD_CODE||1===e.length&&e.charCodeAt(0)===pz.PERIOD_CODE)&&this.throwError("Unexpected period"),{type:pz.LITERAL,value:parseFloat(e),raw:e}}gobbleStringLiteral(){let e="",t=this.index,n=this.expr.charAt(this.index++),r=!1;for(;this.index<this.expr.length;){let t=this.expr.charAt(this.index++);if(t===n){r=!0;break}if("\\"===t)switch(t=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+=t}else e+=t}return r||this.throwError('Unclosed quote after "'+e+'"'),{type:pz.LITERAL,value:e,raw:this.expr.substring(t,this.index)}}gobbleIdentifier(){let e=this.code,t=this.index;for(pz.isIdentifierStart(e)?this.index++:this.throwError("Unexpected "+this.char);this.index<this.expr.length;)if(e=this.code,pz.isIdentifierPart(e))this.index++;else break;return{type:pz.IDENTIFIER,name:this.expr.slice(t,this.index)}}gobbleArguments(e){let t=[],n=!1,r=0;for(;this.index<this.expr.length;){this.gobbleSpaces();let a=this.code;if(a===e){n=!0,this.index++,e===pz.CPAREN_CODE&&r&&r>=t.length&&this.throwError("Unexpected token "+String.fromCharCode(e));break}if(a===pz.COMMA_CODE){if(this.index++,++r!==t.length){if(e===pz.CPAREN_CODE)this.throwError("Unexpected token ,");else if(e===pz.CBRACK_CODE)for(let e=t.length;e<r;e++)t.push(null)}}else if(t.length!==r&&0!==r)this.throwError("Expected comma");else{let e=this.gobbleExpression();e&&e.type!==pz.COMPOUND||this.throwError("Expected comma"),t.push(e)}}return n||this.throwError("Expected "+String.fromCharCode(e)),t}gobbleGroup(){this.index++;let e=this.gobbleExpressions(pz.CPAREN_CODE);if(this.code===pz.CPAREN_CODE)return(this.index++,1===e.length)?e[0]:!!e.length&&{type:pz.SEQUENCE_EXP,expressions:e};this.throwError("Unclosed (")}gobbleArray(){return this.index++,{type:pz.ARRAY_EXP,elements:this.gobbleArguments(pz.CBRACK_CODE)}}}Object.assign(pz,{hooks:new class{add(e,t,n){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]||[],t&&this[e][n?"unshift":"push"](t)},this)}run(e,t){this[e]=this[e]||[],this[e].forEach(function(e){e.call(t&&t.context?t.context:t,t)})}},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)})}}(pz),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"}),pz.max_unop_len=pz.getMaxKeyLen(pz.unary_ops),pz.max_binop_len=pz.getMaxKeyLen(pz.binary_ops);let pP=e=>new pz(e).parse(),pM=Object.getOwnPropertyNames(class{});Object.getOwnPropertyNames(pz).filter(e=>!pM.includes(e)&&void 0===pP[e]).forEach(e=>{pP[e]=pz[e]}),pP.Jsep=pz,pP.plugins.register({name:"ternary",init(e){e.hooks.add("after-expression",function(t){if(t.node&&this.code===e.QUMARK_CODE){this.index++;let n=t.node,r=this.gobbleExpression();if(r||this.throwError("Expected expression"),this.gobbleSpaces(),this.code===e.COLON_CODE){this.index++;let a=this.gobbleExpression();if(a||this.throwError("Expected expression"),t.node={type:"ConditionalExpression",test:n,consequent:r,alternate:a},n.operator&&e.binary_ops[n.operator]<=.9){let r=n;for(;r.right.operator&&e.binary_ops[r.right.operator]<=.9;)r=r.right;t.node.test=r.right,r.right=t.node,t.node=n}}else this.throwError("Expected :")}})}});let pN="ArrowFunctionExpression",pT={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)}},pO={...pT,Promise};function pI(e,t={}){return pW(e,t,pU)}async function pB(e,t={}){return pV(e,t,pU)}function pR(e,t={}){return pW(e,t,pH)}function pj(e,t={}){return pV(e,t,pH)}function pF(e,t={}){return pW(e,t,pq)}function pL(e,t={}){return pV(e,t,pq)}function pW(e,t={},n){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==t&&(t={});let r=pY(t,pT),a=pK("string"==typeof e?pP(e):e,r);if(n(a))return a;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 pV(e,t={},n){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==t&&(t={});let r=pY(t,pO);return Promise.resolve(pK("string"==typeof e?pP(e):e,r)).then(t=>{if(n(t))return t;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 pG(e){return pP(e)}function pU(e){return"string"==typeof e||"number"==typeof e||"boolean"==typeof e||null==e||e instanceof Date}function pH(e){return"boolean"==typeof e}function pq(e){return"number"==typeof e}function pK(e,t){switch(e.type){case"UnaryExpression":var n,r,a,o,i,s,l,c,u,d,p,f,m=e,h=t;let g=pK(m.argument,h);switch(m.operator){case"+":return+g;case"-":return-g;case"~":return~g;case"!":return!g;default:throw`Expression evaluator does not support operator '${m.operator}''`}case"BinaryExpression":var y=e,b=t;let v=pK(y.left,b),$=pK(y.right,b);switch(y.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 '${y.operator}' operator`}case"ConditionalExpression":return n=e,r=t,pK(n.test,r)?pK(n.consequent,r):pK(n.alternate,r);case"CallExpression":var A=e,w=t;let k=A.arguments?.map(pJ(w)),x=pK(A.callee,w);if(x){if("function"!=typeof x)throw`${pQ(A.callee)} is not a function`}else throw`No function named ${pQ(A.callee)} is defined in this context`;return x(...k);case"ArrowFunctionExpression":let C;return a=e,o=t,C=a.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 t=Object.fromEntries(C.reduce((t,n,r)=>{let a=e[r];return function e(t){if("string"==typeof t||"number"==typeof t||"boolean"==typeof t||"function"==typeof t||null===t||t instanceof RegExp)return!0;if("object"==typeof t){for(let n of Object.keys(t))if(!e(t[n]))return!1;return!0}if(Array.isArray(t)){for(let n of t)if(!e(n))break}return!1}(a)&&t.push([n,a]),t},[]));return pK(a.body,o.addVariables(t))}).bind(o.thisObj??null);case"MemberExpression":return function(e,t){let n,r=pK(e.object,t);if(void 0===r)switch(e.object.type){case"Identifier":{let n=pZ(e.object,t);throw ReferenceError(`ReferenceError: ${n} is not defined`)}case"MemberExpression":{let n=pZ(e.property,t);throw TypeError(`TypeError: cannot read properties of undefined (reading '${n}')`)}default:throw`VisitMemberExpression does not support operator '${e.object.type}' type`}let a=r;if("string"==typeof r)a=String.prototype;else if("number"==typeof r)a=Number.prototype;else if("function"==typeof r);else if("object"!=typeof r)throw`VisitMemberExpression does not support member access on type ${typeof r}`;switch(t.thisObj=a,e.property.type){case"Identifier":case"MemberExpression":n=pK(e.property,t);break;default:{let a=pK(e.property,t);if(void 0===a)throw{type:"Illegal property access",message:"No property was supplied to the property access"};pX(a),n=r[a]}}return"function"==typeof n?n.bind(r):n}(e,t);case"ArrayExpression":return i=e,s=t,i.elements?.map(pJ(s));case"SequenceExpression":let E;return l=e,c=t,(E=l.expressions.map(pJ(c)))[E.length-1];case"NewExpression":var D=e,S=t;if(D.callee&&"Identifier"===D.callee.type){let e=D.arguments?.map(pJ(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 pX((u=e).value),u.value;case"Identifier":var z=e,P=t;pX(z.name);let M=P.thisObj;if(M&&("object"==typeof M||"function"==typeof M)&&z.name in M){let e=M[z.name];return pX(e),e}if(P.variables&&z.name in P.variables){let e=P.variables[z.name];return pX(e),e}return z.name in P.globals?P.globals[z.name]:void 0;case"TemplateLiteral":let N,T;return d=e,p=t,N=d.expressions?.map(pJ(p))??[],(T=d.quasis?.map(pJ(p))??[]).filter(e=>!e.tail).map(e=>e.value).join("")+N.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 pZ(e,t){switch(e.type){case"Literal":return e.value;case"Identifier":return e.name;case"MemberExpression":return pZ(e.property,t);default:throw`VisitExpressionName does not support expression of type '${e.type}'`}}function pY(e,t){let n={thisObj:void 0,variables:{...e},globals:{...t},addVariables(e){return this.variables={...this.variables,...e},this}};return n.addVariables.bind(n),n}function pJ(e){return function(t){return null===t?null:pK(t,e)}}function pX(e){if("__proto__"===e||"prototype"===e||"constructor"===e)throw{type:"Illegal property access",message:`Cannot access the ${e} property of objects`}}function pQ(e){return e?"MemberExpression"===e.type?e.property?.name:e.name:null}function p0(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 t={globals:{...pO},isLocalExpression:!1,variables:new Set};return p1("string"==typeof e?pP(e):e,t),[...t.variables]}function p1(e,t){switch(e.type){case"UnaryExpression":return r=e,a=t,p1(r.argument,a);case"BinaryExpression":return o=e,i=t,[p1(o.left,i),p1(o.right,i)].filter(Boolean);case"ConditionalExpression":return s=e,l=t,[p1(s.consequent,l),p1(s.test,l),p1(s.alternate,l)].filter(Boolean);case"CallExpression":let n;return c=e,u=t,n=p1(c.callee,u),c.arguments?.map(p2(u)),n;case"ArrowFunctionExpression":var r,a,o,i,s,l,c,u,d,p,f,m,h,g,y,b,v,$,A=e,w=t;let k={...w};k.isLocalExpression=!0;let x=A.params?.map(p2(k))??[],C=p1(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 d=e,p=t,p1(d.object,p),void((E={...p}).isLocalExpression=!0,p1(d.property,E));case"ArrayExpression":return f=e,m=t,void f.elements?.map(p2(m));case"SequenceExpression":return h=e,g=t,void h.expressions?.map(p2(g));case"NewExpression":return y=e,b=t,void y.arguments?.map(p2(b));case"Literal":case"TemplateElement":return;case"Identifier":var D=e,S=t;if(!(D.name in S.globals))if(S.isLocalExpression)return D.name;else S.variables.add(D.name);return;case"TemplateLiteral":return v=e,$=t,void(v.expressions?.map(p2($)),v.quasis?.map(p2($)));default:throw`Expression evaluator does not support expression of type '${e.type}'`}}function p2(e){return function(t){return null===t?null:p1(t,e)}}pP.plugins.register({name:"arrow",init(e){e.addBinaryOp("=>",.1,!0),e.hooks.add("gobble-expression",function(t){if(this.gobbleSpaces(),this.code===e.OPAREN_CODE){let n=this.index;if(this.index++,this.gobbleSpaces(),this.code===e.CPAREN_CODE){this.index++;let e=this.gobbleBinaryOp();if("=>"===e){let n=this.gobbleBinaryExpression();n||this.throwError("Expected expression after "+e),t.node={type:pN,params:null,body:n};return}}this.index=n}}),e.hooks.add("after-expression",function(t){!function t(n){n&&(Object.values(n).forEach(e=>{e&&"object"==typeof e&&t(e)}),"=>"===n.operator&&(n.type=pN,n.params=n.left?[n.left]:null,n.body=n.right,n.params&&n.params[0].type===e.SEQUENCE_EXP&&(n.params=n.params[0].expressions),delete n.left,delete n.right,delete n.operator))}(t.node)})}}),pP.plugins.register({name:"new",init(e){e.addUnaryOp("new"),e.hooks.add("after-token",function(t){let n=t.node;if(n&&"new"===n.operator){n.argument&&[e.CALL_EXP,e.MEMBER_EXP].includes(n.argument.type)||this.throwError("Expected new function()"),t.node=n.argument;let r=t.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"}})}}),pP.plugins.register({name:"numbers",init(e){function t(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 n(t){let n=this.index,r="",a=()=>{for(;e.isDecimalDigit(this.code)||95===this.code;)95===this.code?this.index++:r+=this.expr.charAt(this.index++)};a(),this.code===e.PERIOD_CODE&&(r+=this.expr.charAt(this.index++),a());let o=this.char;("e"===o||"E"===o)&&(r+=this.expr.charAt(this.index++),("+"===(o=this.char)||"-"===o)&&(r+=this.expr.charAt(this.index++)),a(),e.isDecimalDigit(this.expr.charCodeAt(this.index-1))||this.throwError("Expected exponent ("+r+this.char+")"));let i=this.code;if(e.isIdentifierStart(i))this.throwError("Variable names cannot start with a number ("+r+this.char+")");else if(i===e.PERIOD_CODE){r.length>1&&this.throwError(`Unexpected period ${JSON.stringify({chCode:i,number:r},null,2)}`),this.index=n;return}t.node={type:e.LITERAL,value:parseFloat(r),raw:this.expr.substring(n,this.index)}}e.hooks.add("gobble-token",function(r){if(48===this.code){var a,o,i;let s=this.index,l=this.expr.charAt(this.index+1),c=t.call(this,l);if(!c)return;let u="";for(;a=this.code,o=c,95===a||o.some(([e,t])=>a>=e&&a<=t);)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,n.call(this,r);return}this.throwError("unexpected char within number")}r.node={type:e.LITERAL,value:parseInt(u,"x"===(i=l)||"X"===i?16:"b"===i||"B"===i?2:8),raw:this.expr.substring(s,this.index)}}else(e.isDecimalDigit(this.code)||this.code===e.PERIOD_CODE)&&n.call(this,r)})}}),pP.plugins.register({name:"regex",init(e){e.hooks.add("gobble-token",function(t){if(47===this.code){let n=++this.index,r=!1;for(;this.index<this.expr.length;){if(47===this.code&&!r){let r,a=this.expr.slice(n,this.index),o="";for(;++this.index<this.expr.length;){let e=this.code;if(e>=97&&e<=122||e>=65&&e<=90||e>=48&&e<=57)o+=this.char;else break}try{r=new RegExp(a,o)}catch(e){this.throwError(e.message)}return t.node={type:e.LITERAL,value:r,raw:this.expr.slice(n-1,this.index)},t.node=this.gobbleTokenProperty(t.node),t.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")}})}}),pP.plugins.register({name:"ternary",init(e){e.hooks.add("after-expression",function(t){if(t.node&&this.code===e.QUMARK_CODE){this.index++;let n=t.node,r=this.gobbleExpression();if(r||this.throwError("Expected expression"),this.gobbleSpaces(),this.code===e.COLON_CODE){this.index++;let a=this.gobbleExpression();if(a||this.throwError("Expected expression"),t.node={type:"ConditionalExpression",test:n,consequent:r,alternate:a},n.operator&&e.binary_ops[n.operator]<=.9){let r=n;for(;r.right.operator&&e.binary_ops[r.right.operator]<=.9;)r=r.right;t.node.test=r.right,r.right=t.node,t.node=n}}else this.throwError("Expected :")}})}}),pP.plugins.register({name:"jsepTemplateLiteral",init(e){function t(e,n=!0){if(96===this.code){let t={type:"TemplateLiteral",quasis:[],expressions:[]},r="",a="",o=!1,i=this.expr.length,s=()=>t.quasis.push({type:"TemplateElement",value:{raw:a,cooked:r},tail:o});for(;this.index<i;){let i=this.expr.charAt(++this.index);if("`"===i)return this.index+=1,o=!0,s(),e.node=t,n&&(e.node=this.gobbleTokenProperty(e.node)),e.node;if("$"===i&&"{"===this.expr.charAt(this.index+1))this.index+=2,s(),a="",r="",t.expressions.push(...this.gobbleExpressions(125)),125!==this.code&&this.throwError("unclosed ${");else if("\\"===i)switch(a+=i,i=this.expr.charAt(++this.index),a+=i,i){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+=i}else r+=i,a+=i}this.throwError("Unclosed `")}}e.hooks.add("gobble-token",t),e.hooks.add("after-token",function(n){if((n.node.type===e.IDENTIFIER||n.node.type===e.MEMBER_EXP)&&96===this.code)return n.node={type:"TaggedTemplateExpression",tag:n.node,quasi:t.bind(this)(n,!1)},n.node=this.gobbleTokenProperty(n.node),n.node})}}),pP.addBinaryOp("in",7),pP.addBinaryOp("??",1);let p3=X("feature-flags",{flags:function(){let e={};for(let t of Object.keys(localStorage))if(t.startsWith("openmrs:feature-flag:")){let n=t.replace("openmrs:feature-flag:",""),r=JSON.parse(localStorage.getItem(`openmrs:feature-flag-meta:${n}`)||"{}");e[n]={enabled:"true"===localStorage.getItem(t),...r}}return e}()});function p4(e,t,n){p3.setState(r=>({flags:{...r.flags,[e]:{enabled:r.flags[e]?.enabled??!1,label:t,description:n}}}))}function p5(){let e=p3.getState().flags;Object.keys(localStorage).filter(e=>e.startsWith("openmrs:feature-flag:")).forEach(t=>{let n=t.replace("openmrs:feature-flag:","");e[n]||(localStorage.removeItem(t),localStorage.removeItem(`openmrs:feature-flag-meta:${n}`))})}function p6(e){return p3.getState().flags[e].enabled}function p7(e,t){p3.subscribe(n=>{t(n.flags[e].enabled)})}function p8(e,t){p3.setState(n=>({flags:{...n.flags,[e]:{...n.flags[e],enabled:t}}}))}function p9(e){return!window.offlineEnabled||(e??navigator.onLine)}p3.subscribe(e=>{for(let[t,n]of Object.entries(e.flags))localStorage.setItem(`openmrs:feature-flag:${t}`,n.enabled.toString()),localStorage.setItem(`openmrs:feature-flag-meta:${t}`,JSON.stringify({label:n.label,description:n.description}))});var fe=nN(function(e,t,n){nx(e,t,n)});function ft(e=!0,t=!1){return fn(p9(),e,t)}function fn(e,t=!0,n=!1){return!!(e?t:n)}let fr=Y("extensionsInternal",{slots:{},extensions:{}}),fa=()=>X("extensionsInternal",{slots:{},extensions:{}});function fo(e){let t=fr.getState(),n=e(t);n!==t&&fr.setState(n)}let fi=()=>X("extensions",{slots:{}});function fs(e){let t=[];for(let n of Object.values(e.extensions))for(let e of n.instances)t.push({slotModuleName:e.slotModuleName,extensionModuleName:n.moduleName,slotName:e.slotName,extensionId:e.id});rm(as.getState().mountedExtensions,t)||as.setState({mountedExtensions:t})}fs(fr.getState()),fr.subscribe(fs);let fl=fa(),fc=fi(),fu=ac(),fd=ap();function fp(e,t,n,r,a){let o={},i=p9(),s=Object.entries(r.flags).filter(([,{enabled:e}])=>e).map(([e])=>e);for(let[r,l]of Object.entries(e.slots)){let{config:c}=ad(t,l.name),u=fw(r,e,c,n,s,i,a.session);o[r]={moduleName:l.moduleName,assignedExtensions:u}}rm(fc.getState().slots,o)||fc.setState({slots:o})}function ff(){fp(fl.getState(),fu.getState(),fd.getState(),p3.getState(),iW.getState())}function fm(e,t,n){return{moduleName:t,name:e,attachedIds:[],config:null,state:n}}function fh(e){let[t]=e.split("#");return t}function fg(e,t){let n=fh(t);return e.extensions[n]}function f_(e){return fg(fl.getState(),e)}fl.subscribe(e=>{fp(e,fu.getState(),fd.getState(),p3.getState(),iW.getState())}),fu.subscribe(e=>{fp(fl.getState(),e,fd.getState(),p3.getState(),iW.getState())}),fd.subscribe(e=>{fp(fl.getState(),fu.getState(),e,p3.getState(),iW.getState())}),p3.subscribe(e=>{fp(fl.getState(),fu.getState(),fd.getState(),e,iW.getState())}),iW.subscribe(e=>{fp(fl.getState(),fu.getState(),fd.getState(),p3.getState(),e)}),ff(),w(ff);let fy=e=>fl.setState(t=>(t.extensions[e.name]={...e,instances:[]},t));function fb(e,t){fo(n=>{let r=n.slots[e];return r?{...n,slots:{...n.slots,[e]:{...r,attachedIds:[...r.attachedIds,t]}}}:{...n,slots:{...n.slots,[e]:{...fm(e),attachedIds:[t]}}}})}function fv(e,t){fo(n=>{let r=n.slots[e];return r&&r.attachedIds.includes(t)?{...n,slots:{...n.slots,[e]:{...r,attachedIds:r.attachedIds.filter(e=>e!==t)}}}:n})}function f$(e){fo(t=>{let n=t.slots[e];return n?{...t,slots:{...t.slots,[e]:{...n,attachedIds:[]}}}:t})}function fA(e,t,n,r){let a=t.indexOf(e);if(-1!==a)return a;{if(void 0!==n)return 1e3+n;let t=r.indexOf(e);return -1!==t?2e3+t:-1}}function fw(e,t,n,r,a,o,i){let s=function(e,t){let n=e.add||[],r=e.remove||[],a=e.order||[],{extensions:o}=fl.getState();return[...t,...n].filter(e=>!r.includes(e)).sort((e,n)=>{let r=fA(e,a,o[fh(e)]?.order,t),i=fA(n,a,o[fh(n)]?.order,t);return -1===i?-1:-1===r?1:r-i})}(n,t.slots[e].attachedIds),l=[],c=t.slots[e]?.state,u=c&&"object"==typeof c?{session:i,...c}:{session:i};for(let c of s){let{config:s}=am(r,e,c),d=fe(s,ah(n,e,c)),p=fh(c),f=t.extensions[p];if(f){let t=d?.["Display conditions"]?.privileges??f.privileges??[];if(t&&("string"==typeof t||Array.isArray(t)&&t.length>0)&&(!i?.user||!iZ(t,i.user)))continue;let n=d?.["Display conditions"]?.expression||f.displayExpression;if(void 0!==n&&"string"==typeof n&&n.trim().length>0)try{if(!pR(n,u))continue}catch(t){console.error(`Error while evaluating expression '${n}' for extension ${p} in slot ${e}`,t);continue}if(f.featureFlag&&!a.includes(f.featureFlag)||window.offlineEnabled&&!fn(o,f.online,f.offline))continue;l.push({id:c,name:p,moduleName:f.moduleName,config:d,featureFlag:f.featureFlag,meta:f.meta,online:d?.["Display conditions"]?.online??f.online??!0,offline:d?.["Display conditions"]?.offline??f.offline??!1})}}return l}function fk(e){let t=fl.getState(),{config:n}=au(e),r=fd.getState(),a=p3.getState(),o=iW.getState(),i=p9();return fw(e,t,n,r,Object.entries(a.flags).filter(([,{enabled:e}])=>e).map(([e])=>e),i,o.session)}let fx=(e,t,n)=>fl.setState(r=>{let a=r.slots[t]?.moduleName;if(a&&a!=e)return console.warn(`An extension slot with the name '${t}' already exists. Refusing to register the same slot name twice (in "registerExtensionSlot"). The existing one is from module ${a}.`),r;if(a&&a==e)return r;if(r.slots[t])return{...r,slots:{...r.slots,[t]:{...r.slots[t],moduleName:e,state:n}}};let o=fm(t,e,n);return{...r,slots:{...r.slots,[t]:{...o}}}});function fC(e,t,n=!1){fl.setState(r=>{let a=n?fe(r.slots[e].state,t):t;return{...r,slots:{...r.slots,[e]:{...r.slots[e],state:a}}}})}let fE=()=>fc.setState(()=>({slots:{},extensions:{}})),fD=Y("left-nav",{slotName:null,basePath:window.spaBase,mode:"normal"});function fS({name:e,basePath:t,mode:n,componentContext:r,state:a}){fD.setState({slotName:e,basePath:t,mode:n??"normal",componentContext:r,state:a})}function fz(e){fD.getState().slotName===e&&fD.setState(fD.getInitialState(),!0)}let fP=Y("modalRegistry",{modals:{}});function fM(e){fP.setState(t=>(t.modals[e.name]=e,t))}function fN(e){let t=fP.getState().modals[e];if(!t){let n=f_(e);n&&(t={name:e,load:n.load,moduleName:n.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.`),fM(t))}return t}let fT=Y("workspaceRegistrations",{workspaces:{}}),fO=Y("workspaceGroups",{workspaceGroups:{}});function fI(e){fT.setState(t=>({workspaces:{...t.workspaces,[e.name]:{...e,load:e.load,preferredWindowSize:e.preferredWindowSize??"normal",type:e.type??"form",canHide:e.canHide??!1,canMaximize:e.canMaximize??!1,width:e.width??"narrow",groups:e.groups??[]}}}))}function fB(e){fO.setState(t=>{let n=t.workspaceGroups[e.name];return n?{workspaceGroups:{...t.workspaceGroups,[e.name]:{...n,members:Array.from(new Set([...n.members,...e.members]))}}}:{workspaceGroups:{...t.workspaceGroups,[e.name]:{name:e.name,members:e.members}}}})}let fR=new Set;function fj(e){let t=fT.getState().workspaces;if(t[e])return t[e];{let t=f_(e);if(t){var n;let r;return fR.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.`),fR.add(e)),{name:t.name,title:(n=t,"string"==typeof(r=n?.meta?.title)?r:r&&"object"==typeof r?i8(n.moduleName,r.key,r.default):n.name),moduleName:t.moduleName,preferredWindowSize:t.meta?.screenSize??"normal",load:t.load,type:t.meta?.type??"form",canHide:t.meta?.canHide??!1,canMaximize:t.meta?.canMaximize??!1,width:t.meta?.width??"narrow",groups:t.meta?.groups??[]}}throw Error(`No workspace named '${e}' has been registered.`)}}function fF(e){let t=fO.getState().workspaceGroups;if(t[e])return t[e];throw Error(`No workspace group named '${e}' has been registered.`)}let fL=Y("workspace2",{registeredGroupsByName:{},registeredWindowsByName:{},registeredWorkspacesByName:{},openedGroup:null,openedWindows:[],workspaceTitleByWorkspaceName:{},isMostRecentlyOpenedWindowHidden:!1});function fW(e){let{registeredWorkspacesByName:t,registeredWindowsByName:n}=fL.getState(),r=t[e];if(r){let t=n[r.window];if(t)return t;throw Error(`No workspace window found with name: ${r.window} for workspace: ${e}`)}throw Error(`No workspace found with name: ${e}`)}function fV(e){let{registeredGroupsByName:t,registeredWindowsByName:n}=fL.getState(),r=n[e];if(r){let n=t[r.group];if(n)return n;throw Error(`No workspace group found with name: ${r.group} for window: ${e}`)}throw Error(`No workspace window found with name: ${e}`)}function fG(e){let{openedWindows:t}=fL.getState();return t.findIndex(t=>t.openedWorkspaces.find(t=>t.workspaceName===e))}function fU(e,t){if(0==t.length)return;let{registeredGroupsByName:n}=fL.getState(),r={...n};for(let n of t){if(r[n.name])throw Error(`Cannot register workspace group ${n.name} more than once`);r[n.name]={...n,moduleName:e}}fL.setState({registeredGroupsByName:r})}function fH(e,t){if(0==t.length)return;let{registeredWindowsByName:n}=fL.getState(),r={...n};for(let n of t){if(r[n.name])throw Error(`Cannot register workspace window ${n.name} more than once`);let t={...n,moduleName:e};r[n.name]=t}fL.setState({registeredWindowsByName:r})}function fq(e,t){if(0==t.length)return;let{registeredWorkspacesByName:n}=fL.getState(),r={...n};for(let n of t){if(r[n.name])throw Error(`Cannot register workspace ${n.name} more than once`);let t={...n,moduleName:e};r[n.name]=t}fL.setState({registeredWorkspacesByName:r})}let fK=0,fZ=null;async function fY(e,t){return(await (fZ??(fZ=new Promise((e,t)=>{oO({name:"openmrs-extension-host",bootstrap:()=>Promise.resolve(),mount:t=>(e(t.mountParcel),Promise.resolve()),unmount:()=>Promise.resolve()},{domElement:document.createElement("div")}).mountPromise.catch(t)}).catch(e=>(console.error("The host parcel used to mount extensions could not be mounted. Falling back to mounting extensions as root parcels, which leaks their DOM elements.",e),oO))),fZ))(e,t)}function fJ(){return fX}function fX(e,t){let n,r=fY(e,t).then(e=>n=e);return{mount:()=>r.then(e=>e.mount()),unmount:()=>r.then(e=>e.unmount()),update:e=>r.then(t=>t.update?.(e)),getStatus:()=>n?.getStatus()??"LOADING_SOURCE_CODE",get loadPromise(){return r.then(e=>e.loadPromise)},get bootstrapPromise(){return r.then(e=>e.bootstrapPromise)},get mountPromise(){return r.then(e=>e.mountPromise)},get unmountPromise(){return r.then(e=>e.unmountPromise)}}}async function fQ(e,t,n,r,a=e=>e,o={}){let i=fh(r),s=f_(r),l=null;if(e){if(!s)throw Error(`Couldn't find extension '${i}' to attach to '${t}'`);let{meta:c,moduleName:u,online:d,offline:p,load:f}=s;if(ft(d,p)){fo(a=>({...a,extensions:{...a.extensions,[i]:{...a.extensions[i],instances:[...a.extensions[i].instances,{domElement:e,id:r,slotName:t,slotModuleName:n}]}}}));let s=await f(),d=fK++;l=await fY(a({...s,name:`${t}/${i}-${d}`}),{...o,_meta:c,_extensionContext:{extensionId:r,extensionSlotName:t,extensionSlotModuleName:n,extensionModuleName:u},domElement:e})}}else console.warn(`Tried to render ${r} into ${t} but no DOM element was available.`);return l}var f0=n(8297),f1=n.n(f0);let f2=(0,f0.createContext)({moduleName:"",featureName:""});function f3({to:e,templateParams:t,onBeforeNavigate:n,children:r,...a}){return(0,f0.useEffect)(()=>{a.href&&console.warn(`ConfigurableLink does not support the href prop. Use the 'to' prop instead. The provided href value is '${a.href}'`),a.onClick&&console.warn(`ConfigurableLink does not support the onClick prop. Use the 'onBeforeNavigate' prop instead. The 'to' prop of the offending link is ${e}`)},[]),f1().createElement("a",{onClick:r=>{0===r.button&&!r.ctrlKey&&!r.shiftKey&&!r.altKey&&!r.metaKey&&(r.preventDefault(),n?.(r),ix({to:e,templateParams:t})),0===r.button&&(r.ctrlKey||r.metaKey)&&n?.(r),0===r.button&&r.shiftKey&&n?.(r),1===r.button&&n?.(r)},href:iw(e,t),...a},r)}let f4=({state:e,children:t,...n})=>{let{extension:r}=(0,f0.useContext)(f2),a=(0,f0.useRef)(null),o=(0,f0.useRef)(Promise.resolve()),i=(0,f0.useCallback)(t=>{r?.extensionSlotName&&r.extensionSlotModuleName&&r.extensionSlotModuleName&&!a.current&&fQ(t,r.extensionSlotName,r.extensionSlotModuleName,r.extensionId,void 0,e).then(e=>{a.current=e})},[]);return(0,f0.useEffect)(()=>()=>{if(a&&a.current)switch(a.current.getStatus()){case"MOUNTING":a.current.mountPromise.then(()=>{a.current?.getStatus()==="MOUNTED"&&a.current.unmount()});break;case"MOUNTED":a.current.unmount();break;case"UPDATING":o.current&&o.current.then(()=>{a.current?.getStatus()==="MOUNTED"&&a.current.unmount()})}},[]),(0,f0.useEffect)(()=>{a.current&&a.current.update&&"UNMOUNTING"!==a.current.getStatus()&&Promise.all([a.current.mountPromise,o.current]).then(()=>{a?.current?.getStatus()==="MOUNTED"&&a.current.update&&(o.current=a.current.update({...e}).catch(e=>{if(!(e instanceof Error)||!e.message.includes("minified message #32")||a.current?.getStatus()==="MOUNTED")throw e}))})},[e]),r?f1().createElement("div",{ref:i,"data-extension-id":r?.extensionId,style:{position:"relative"},...n}):null};function f5(e,t){"function"==typeof t&&(t=t(e));let n={};for(let[r,a]of Object.entries(t)){let t=function(...t){e.setState(e=>a(e,...t))};n[r]=t}return n}let f6=()=>e=>e;function f7(e,t=f6(),n){let r=(0,f0.useCallback)(t=>e.subscribe(t),[e]),a=(0,f0.useCallback)(()=>t(e.getState()),[e,t]),o=(0,f0.useSyncExternalStore)(r,a,a),i=(0,f0.useMemo)(()=>n?f5(e,n):{},[e,n]);return{...o,...i}}function f8(e,t){return f7(e,f6(),t)}function f9(e){return function(t){let n=(0,f0.useCallback)(t=>e.subscribe(t),[]),r=(0,f0.useCallback)(()=>e.getState(),[]),a=(0,f0.useSyncExternalStore)(n,r,r),o=(0,f0.useMemo)(()=>t?f5(e,t):{},[t]);return{...a,...o}}}let me=e=>f7(fi(),t=>t.slots?.[e]);function mt(e){let t=me(e);return t?.assignedExtensions??[]}function mn(e,t){let{moduleName:n}=(0,f0.useContext)(f2),r=(0,f0.useRef)(!0);if(!n)throw Error("ComponentContext has not been provided. This should come from @openmrs/esm-react-utils.");return(0,f0.useEffect)(()=>{fx(n,e,t),r.current=!1},[]),(0,f0.useEffect)(()=>{r.current||fC(e,t)},[e,t]),{extensions:mt(e),extensionSlotName:e,extensionSlotModuleName:n}}function mr(e){return e}function ma({name:e,extensionSlotName:t,select:n=mr,children:r,state:a,style:o,...i}){if(r&&a)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??t,l=(0,f0.useRef)(null),{extensions:c,extensionSlotModuleName:u}=mn(s,a),d=(0,f0.useMemo)(()=>n(c),[n,c]),p=(0,f0.useMemo)(()=>{if("function"==typeof r&&!f1().isValidElement(r))return d.map(e=>r(e,a))},[r,d]);return f1().createElement("div",{ref:l,"data-extension-slot-name":s,"data-extension-slot-module-name":u,style:{...o,position:"relative"},...i},s&&d?.map((e,t)=>f1().createElement(f2.Provider,{key:e.id,value:{moduleName:u,featureName:"",extension:{extensionId:e.id,extensionSlotName:s,extensionSlotModuleName:u}}},p?.[t]??("function"!=typeof r?r:null)??f1().createElement(f4,{state:a}))))}var mo=n(5873);function mi(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function ms(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?mi(Object(n),!0).forEach(function(t){var r,a,o;r=e,a=t,o=n[t],a in r?Object.defineProperty(r,a,{value:o,enumerable:!0,configurable:!0,writable:!0}):r[a]=o}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):mi(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function ml(e){return(ml="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 mc(e){return(mc="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 mu(e,t){var n;if("function"!=typeof(n=t.domElement?function(){return t.domElement}:t.domElementGetter?t.domElementGetter:e.domElementGetter?e.domElementGetter:function(e){var t=e.appName||e.name;if(!t)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 n="single-spa-application:".concat(t);return function(){var e=document.getElementById(n);return e||((e=document.createElement("div")).id=n,document.body.appendChild(e)),e}}(t)))throw Error("single-spa's dom-element-getter-helpers was given an invalid domElementGetter for application or parcel '".concat(t.name,"'. Expected a function, received ").concat(mc(n)));return function(){var e=n(t);if(!(e instanceof HTMLElement))throw Error("single-spa's dom-element-getter-helpers: domElementGetter returned an invalid dom element for application or parcel '".concat(t.name,"'. Expected HTMLElement, received ").concat(mc(e)));return e}}var md=null;try{md=require("react").createContext()}catch(e){}var mp={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 mf(e,t){return e.rootComponent?Promise.resolve():e.loadRootComponent(t).then(function(t){e.rootComponent=t})}function mm(e,t){return new Promise(function(n,r){e.suppressComponentDidCatchWarning||!function(e){if(!(e&&"string"==typeof e.version&&e.version.indexOf(".")>=0))return!1;var t=e.version.slice(0,e.version.indexOf("."));try{return Number(t)>=16}catch(e){return!1}}(e.React)||e.errorBoundary||e.errorBoundaryClass||(e.rootComponent.prototype?e.rootComponent.prototype.componentDidCatch||console.warn("single-spa-react: ".concat(t.name||t.appName||t.childAppName,"'s rootComponent should implement componentDidCatch to avoid accidentally unmounting the entire single-spa application.")):console.warn("single-spa-react: ".concat(t.name||t.appName||t.childAppName,"'s rootComponent does not implement an error boundary. If using a functional component, consider providing an opts.errorBoundary to singleSpaReact(opts).")));var a,o=my(e,t,function(){n(this)}),i=mu(e,t)(),s=function(e){var t=e.reactDom,n=e.renderType,r=e.elementToRender,a=e.domElement,o=t[n];if("function"!=typeof o)throw Error('renderType "'.concat(n,'" did not return a function.'));switch(n){case"createRoot":case"unstable_createRoot":case"createBlockingRoot":case"unstable_createBlockingRoot":var i=o(a);return i.render(r),i;case"hydrateRoot":return o(a,r);default:return o(r,a),null}}({elementToRender:o,domElement:i,reactDom:m_(e),renderType:"function"==typeof(a=e).renderType?a.renderType():a.renderType});e.domElements[t.name]=i,e.renderResults[t.name]=s})}function mh(e,t){return new Promise(function(n){e.unmountResolves[t.name]=n;var r=e.renderResults[t.name];r&&r.unmount?r.unmount():m_(e).unmountComponentAtNode(e.domElements[t.name]),delete e.domElements[t.name],delete e.renderResults[t.name]})}function mg(e,t){return new Promise(function(n){e.updateResolves[t.name]||(e.updateResolves[t.name]=[]),e.updateResolves[t.name].push(n);var r=my(e,t,null),a=e.renderResults[t.name];if(a&&a.render)a.render(r);else{var o=mu(e,t)();m_(e).render(r,o)}})}function m_(e){return e.ReactDOMClient||e.ReactDOM}function my(e,t,n){var r=e.React.createElement(e.rootComponent,t),a=md?e.React.createElement(md.Provider,{value:t},r):r;return(e.errorBoundary||t.errorBoundary||e.errorBoundaryClass||t.errorBoundaryClass)&&(e.errorBoundaryClass=e.errorBoundaryClass||t.errorBoundaryClass||function(e,t){function n(t){e.React.Component.apply(this,arguments),this.state={caughtError:null,caughtErrorInfo:null},n.displayName="SingleSpaReactErrorBoundary(".concat(t.name,")")}return n.prototype=Object.create(e.React.Component.prototype),n.prototype.render=function(){return this.state.caughtError?(e.errorBoundary||t.errorBoundary)(this.state.caughtError,this.state.caughtErrorInfo,this.props):this.props.children},n.prototype.componentDidCatch=function(e,t){this.setState({caughtError:e,caughtErrorInfo:t})},n}(e,t),a=e.React.createElement(e.errorBoundaryClass,t,a)),a=e.React.createElement(e.SingleSpaRoot,ms(ms({},t),{},{mountFinished:n,updateFinished:function(){e.updateResolves[t.name]&&(e.updateResolves[t.name].forEach(function(e){return e()}),delete e.updateResolves[t.name])},unmountFinished:function(){e.unmountResolves[t.name]&&(e.unmountResolves[t.name](),delete e.unmountResolves[t.name])}}),a)}var mb=n(717),mv=n(1123),m$=n(5884);let mA={strictMode:!0,throwErrorsToConsole:!0,disableTranslations:!1},mw=new Map;(0,m$.initCache)(mw);let mk={errorRetryCount:3,fetcher:ij,focusThrottleInterval:18e5,revalidateIfStale:!0,revalidateOnFocus:!1,revalidateOnReconnect:!1,refreshInterval:0,shouldRetryOnError:e=>{if(e instanceof iL){let t=e.response.status;return!!(t>=500)||401===t||403===t||429===t}return!0},provider:()=>mw};function mx(e){if("object"!=typeof e||"string"!=typeof e.featureName||"string"!=typeof e.moduleName)throw Error("Invalid options");let t=Object.assign({},mA,e),n={...mk,...t.swrConfig};return function(e){var r,a,o,i,s;return o=a=class extends(r=f1().Component){componentDidCatch(e,n){n&&n.componentStack&&(e.extra=Object.assign(e.extra||{},{componentStack:n.componentStack})),t.throwErrorsToConsole&&setTimeout(()=>{throw e}),this.setState({caughtError:e,caughtErrorInfo:n})}render(){if(this.state.caughtError)return f1().createElement("div",null,"An error has occurred. Please try reloading the page.");{let r=f1().createElement(f0.Suspense,{fallback:null},f1().createElement(mv.BE,{value:n},f1().createElement(f2.Provider,{value:this.state.config},t.disableTranslations?f1().createElement(e,this.props):f1().createElement(mb.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},f1().createElement(e,this.props)))));return t.strictMode&&f1().StrictMode?f1().createElement(f1().StrictMode,null,r):r}}constructor(e){super(e),this.state={caughtError:null,caughtErrorInfo:null,config:{moduleName:t.moduleName,featureName:t.featureName,extension:e._extensionContext}}}},i="displayName",s=`OpenmrsReactComponent(${t.featureName})`,i in o?Object.defineProperty(o,i,{value:s,enumerable:!0,configurable:!0,writable:!0}):o[i]=s,a}}function mC(e,t){return function(e){if("object"!==ml(e))throw Error("single-spa-react requires a configuration object");var t,n=ms(ms({},mp),e);if(!n.React)throw Error("single-spa-react must be passed opts.React");if(!n.ReactDOM&&!n.ReactDOMClient)throw Error("single-spa-react must be passed opts.ReactDOM or opts.ReactDOMClient");if(n.renderType||(null!=(t=n.ReactDOMClient)&&t.createRoot?n.renderType="createRoot":n.renderType="render"),!n.rootComponent&&!n.loadRootComponent)throw Error("single-spa-react must be passed opts.rootComponent or opts.loadRootComponent");if(n.errorBoundary&&"function"!=typeof n.errorBoundary)throw Error("The errorBoundary opt for single-spa-react must either be omitted or be a function that returns React elements");!md&&n.React.createContext&&(md=n.React.createContext()),n.SingleSpaRoot=function(e){function t(e){t.displayName="SingleSpaRoot(".concat(e.name,")")}return t.prototype=Object.create(e.React.Component.prototype),t.prototype.componentDidMount=function(){setTimeout(this.props.mountFinished)},t.prototype.componentWillUnmount=function(){setTimeout(this.props.unmountFinished)},t.prototype.render=function(){return setTimeout(this.props.updateFinished),this.props.children},t}(n);var r={bootstrap:mf.bind(null,n),mount:mm.bind(null,n),unmount:mh.bind(null,n)};return n.parcelCanUpdate&&(r.update=mg.bind(null,n)),r}({React:f1(),ReactDOMClient:mo,rootComponent:mx(t)(e)})}function mE(e,t){return()=>e().then(({default:e})=>mC(e,t))}function mD(e,t){return()=>Promise.resolve(mC(e,t))}let mS=mE,mz=q()(()=>({}));J("openmrs-app-context",mz);let mP={};function mM(e,t=e=>e){let n=mz.getState();return e in n?Object.freeze(Object.assign({},t?t(n[e]):n[e])):null}function mN(e,t){mz.setState(n=>(e in n||(n[e]={}),n[e]=t(n[e]),Object.assign({},n)))}function mT(e){return null===e?null:Object.freeze(Object.assign({},e))}let mO=new Map;function mI(e,t){let n=(0,f0.useRef)(t??{}),r=(0,f0.useRef)(t=>mN(e,t)),a=(0,f0.useRef)(Symbol());return(0,f0.useEffect)(()=>{let n=t??{},r=a.current;return null===mM(e)?!function(e,t=mP){mz.setState(n=>{if(e in n)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({},n,{[e]:t===mP?{}:t})})}(e,n):(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.`),mN(e,()=>n)),mO.set(e,r),()=>{mO.get(e)===r&&(mz.setState(t=>(e in t&&delete t[e],t)),mO.delete(e))}},[e]),(0,f0.useEffect)(()=>{let r=t??{};V(n.current,r)||(mN(e,()=>r),n.current=r)},[t]),r.current}function mB({namespace:e,value:t}){return mI(e,t),null}let mR=({children:e,value:t,fallback:n})=>t?f1().createElement(f1().Fragment,null,e):n?f1().createElement(f1().Fragment,null,n):null;function mj(){let e=(0,f0.useRef)();return(!e.current||e.current.signal.aborted)&&(e.current=new AbortController),(0,f0.useEffect)(()=>{let t=e.current;return()=>t?.abort()},[]),e.current}function mF(e,t=e=>e??{}){let[n,r]=(0,f0.useState)(()=>{if(mL(e))return;let n=mM(e);if(null!==n)return t?t(n):n});return(0,f0.useEffect)(()=>{if(mL(e))throw Error(`The namespace supplied to useAppContext must be a non-empty string, but was "${e}".`)},[e]),(0,f0.useEffect)(()=>{var n;let a;return(n=e=>{if(null==e)return void r(void 0);let n=t?t(e):e;r(e=>V(e,n)?e:n)})(mT(a=mM(e))),mz.subscribe(t=>{let r=e in t?t[e]:null;r!==a&&(a=r,n(mT(r)))})},[e,t]),n}function mL(e){return"string"!=typeof e||0===e.trim().length}function mW(e){let[t,n]=(0,f0.useState)([]);return(0,f0.useEffect)(()=>fi().subscribe(r=>{let a=r.slots[e]?.assignedExtensions.map(e=>e.id)??[];rm(a,t)||n(a)}),[]),t}function mV(e,t){let{data:n,error:r,mutate:a,isLoading:o,isValidating:i}=(0,mv.Ay)(`${sq}?patient=${e}&includeEncounterless=${t}`,ij);return(0,f0.useMemo)(()=>({isLoading:o,data:n?.data.results??[],error:r,mutate:a,isValidating:i}),[n,r,o,i,a])}function mG(e){(0,f0.useEffect)(()=>{if(e){let e=window.getComputedStyle(document.body).overflow;return document.body.style.overflow="hidden",()=>{document.body.style.overflow=e}}},[e])}let mU={},mH=`No ComponentContext has been provided. This should come from "openmrsComponentDecorator".
16
- Usually this is already applied when using "getAsyncLifecycle" or "getSyncLifecycle".`;function mq(e){let{moduleName:t,extension:n}=(0,f0.useContext)(f2),r=e?.externalModuleName??t;if(!r&&!n)throw Error(mH);let a=function(e){let t=(0,f0.useMemo)(()=>al(e),[e]),n=function(e){let[t,n]=(0,f0.useState)(()=>{let t=e.getState();return t.loaded&&t.config?t.config:null});return(0,f0.useEffect)(()=>e?.subscribe(e=>{e.loaded&&e.config&&n(e.config)}),[e]),t}(t);if(!n)throw mU[e]||(mU[e]=new Promise(e=>{let n=t.subscribe(t=>{t.loaded&&t.config&&(e(t.config),n())})})),mU[e];return n}(r),o=function(e){let t=(0,f0.useMemo)(ap,[]),n=function(e,t){let[n,r]=(0,f0.useState)(t?()=>{let n=am(e.getState(),t.extensionSlotName,t.extensionId);if(n.loaded&&n.config)return n.config}:null);return(0,f0.useEffect)(()=>{if(t)return e.subscribe(e=>{let a=am(e,t.extensionSlotName,t.extensionId);a.loaded&&a.config&&!rm(a.config,n)&&r(a.config)})},[e,t,n]),n}(t,e);if(!n&&e){let n=`${e.extensionSlotName}-${e.extensionId}`;throw!mU[n]&&t&&(mU[n]=new Promise(n=>{let r=t.subscribe(t=>{let a=am(t,e.extensionSlotName,e.extensionId);a.loaded&&a.config&&(n(a.config),r())})})),mU[n]}return n||{}}(n);return(0,f0.useMemo)(()=>e?.externalModuleName&&r===e.externalModuleName?{...a}:{...a,...o},[r,e?.externalModuleName,a,o])}let mK=mt;function mZ(){let[e,t]=(0,f0.useState)(p9());return(0,f0.useEffect)(()=>w(({online:e})=>t(e)),[]),e}function mY(e,t=300){let[n,r]=(0,f0.useState)(e);return(0,f0.useEffect)(()=>{let n=setTimeout(()=>{r(e)},t);return()=>{clearTimeout(n)}},[e,t]),n}var mJ=n(7744),mX=n.n(mJ);let mQ=`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,t])=>`${e}:${t}`).join(",")}`;function m0(){let e=`${iO}/emrapi/configuration?v=${mQ}`,t=mX()(e,ij);return(0,f0.useMemo)(()=>({emrConfiguration:t.data?.data,isLoadingEmrConfiguration:t.isLoading,mutateEmrConfiguration:t.mutate,errorFetchingEmrConfiguration:t.error}),[t])}let m1=f9(fa());function m2(e){let t=mt(e);return(0,f0.useMemo)(()=>Object.fromEntries(t.map(e=>[e.name,e.meta])),[t])}let m3=f9(fi());function m4(e){let{flags:t}=f7(p3);return t[e]?.enabled??!1}function m5(){let[,e]=(0,f0.useState)(0);return(0,f0.useCallback)(()=>{e(e=>e+1)},[])}function m6(e,t,n={}){return m8(e,t,m7,n)}let m7={getPaginatedUrl:(e,t,n)=>{if(!e)return null;{let r=new URL(iR(e.toString()),window.location.toString());return r.searchParams.set("limit",""+t),r.searchParams.set("startIndex",""+n),r.searchParams.set("totalCount","true"),r.toString()}},getNextUrl:e=>{let t=e?.links?.find(e=>"next"==e.rel)?.uri;if(!t)return null;{let e=new URL(t);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 m8(e,t,n,r={}){let{getPaginatedUrl:a,getTotalCount:o,getCurrentPageSize:i,getData:s}=n,{immutable:l,swrConfig:c}=r,u=r.fetcher??ij,[d,p]=(0,f0.useState)(1),f=(0,f0.useRef)(NaN),m=(0,f0.useRef)(NaN),h=(d-1)*t,g=(0,f0.useMemo)(()=>a(e,t,h),[e,t,h]),{data:y,...b}=(l?mX():mv.Ay)(g,u,c);y?.data&&(f.current=o(y?.data),m.current=i(y?.data));let v=Math.ceil(f.current/t),$=(0,f0.useCallback)(e=>{0<e&&e<=v?p(e):console.warn("Invalid attempt to go to out of bounds page: "+e)},[e,d,v]),A=(0,f0.useCallback)(()=>{$(d+1)},[e,d,v]),w=(0,f0.useCallback)(()=>{$(d-1)},[e,d,v]);return{data:s(y?.data),totalPages:v,totalCount:f.current,currentPage:d,currentPageSize:m,paginated:v>1,showNextButton:d<v,showPreviousButton:d>1,goTo:$,goToNext:A,goToPrevious:w,...b}}function m9(e,t,n={}){return m8(e,t,he(),n)}function he(){return{getPaginatedUrl:(e,t,n)=>{if(!e)return null;{let r=new URL(iR(e.toString()),window.location.toString());return r.searchParams.set("_count",""+t),r.searchParams.set("_getpagesoffset",""+n),r.toString()}},getNextUrl:e=>{let t=e?.link?.find(e=>"next"==e.relation)?.url;if(!t)return null;{let e=new URL(t);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 ht=n(2362),hn=n.n(ht);function hr(e,t={}){return ha(e,m7,t)}function ha(e,t,n={}){let{swrInfiniteConfig:r,immutable:a}=n,{getNextUrl:o,getTotalCount:i,getData:s}=t,l=n.fetcher??ij,c=(0,f0.useCallback)((n,r)=>0==n?e?.toString()??null:t.getNextUrl(r.data),[e]),{data:u,size:d,setSize:p,...f}=hn()(c,l,{...r,...a?{revalidateIfStale:!1,revalidateOnFocus:!1,revalidateOnReconnect:!1}:{}}),m=o(u?.[u.length-1].data),h=i(u?.[0]?.data);return{data:u?.flatMap(e=>s(e.data)),totalCount:h,hasMore:null!=m,loadMore:()=>{p((u?.length??0)+1)},nextUri:m,...f}}function ho(e,t={}){return hi(e,m7,t)}function hi(e,t,n={}){let r=ha(e,t,n),{hasMore:a,error:o,data:i,loadMore:s,isLoading:l,nextUri:c}=r;return((0,f0.useEffect)(()=>{a&&!o&&s()},[a,c]),n.partialData)?r:{...r,data:a||o?void 0:i,isLoading:l||a}}function hs(e,t={}){return hi(e,he(),t)}function hl(e,t={}){return ha(e,he(),t)}function hc(){let e="tablet";return document.body.classList.forEach(t=>{switch(t){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 hu(){let[e,t]=(0,f0.useState)(hc);return(0,f0.useEffect)(()=>{let e=()=>{t(hc())};return window.addEventListener("resize",e),()=>window.removeEventListener("resize",e)},[]),e}let hd=e=>"small-desktop"===e||"large-desktop"===e;function hp(e){let t=(0,f0.useContext)(f2);(0,f0.useEffect)(()=>(t&&t.moduleName&&(e.componentContext=t),fS(e),()=>{fz(e.name)}),[t,e])}function hf(){return f7(fD)}function hm(e=null,t=null){let[n,r]=(0,f0.useState)([]);return(0,f0.useEffect)(()=>{let n=pd(e,t).subscribe(e=>{r(e)},e=>{console.error(e)});return()=>n.unsubscribe()},[e,t]),n}function hh(e,t=!0){let n=(0,f0.useRef)(null);return(0,f0.useEffect)(()=>{let r=r=>{t&&n.current&&r.target&&r.target instanceof Node&&(n.current.contains(r.target)||e(r))};return window.addEventListener("mousedown",r),window.addEventListener("touchstart",r),()=>{window.removeEventListener("mousedown",r),window.removeEventListener("touchstart",r)}},[e,t]),n}function hg(e){let t=(0,f0.useRef)();return(0,f0.useEffect)(()=>{let n=new IntersectionObserver(t=>{for(let n of t)if(n.isIntersecting)return void e()},{threshold:1});return t.current&&n.observe(t.current),()=>{t.current&&n.unobserve(t.current)}},[t.current,e]),t}function h_(e,t={}){let{abortController:n,fetchInit:r,url:a,swrConfig:o}=t,i=mj(),s=(0,f0.useMemo)(()=>r?.signal??n?.signal??i.signal,[n?.signal,r?.signal,i.signal]),l=(0,f0.useCallback)(e=>ij(function(e,t){if(t)return"function"==typeof t?t(e):t;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,a),{...r,signal:s}),[s,r,a]);return(0,mv.Ay)(e,l,o)}function hy(e=[],t=10){let[n,r]=(0,f0.useState)(1),a=(0,f0.useMemo)(()=>"number"==typeof t&&t>0?Math.max(1,Math.ceil(e.length/t)):1,[e.length,t]),o=(0,f0.useMemo)(()=>{let r=(n-1)*t,a=(n+0)*t;return e.slice(r,a)},[e,n,t]),i=(0,f0.useCallback)(e=>{r(Math.max(1,Math.min(a,e)))},[r,a]),s=(0,f0.useCallback)(()=>{n<a&&r(n+1)},[n,a,r]),l=(0,f0.useCallback)(()=>{n>1&&r(n-1)},[n,r]);return(0,f0.useMemo)(()=>({results:o,totalPages:a,currentPage:n,paginated:e.length>t,showNextButton:n<a,showPreviousButton:n>1,goTo:i,goToNext:s,goToPrevious:l}),[o,a,e.length,t,n,i,s,l])}function hb(e,t,n,r){return{pageSizes:(0,f0.useMemo)(()=>{let n=Math.ceil(t/e);return isNaN(n)&&(n=0),[...Array(n).keys()].map(t=>(t+1)*e)},[e,t]),pageItemsCount:(0,f0.useMemo)(()=>e>t?t:e*n>t?e*(n-1)+r:e*n,[e,t,n,r])}}function hv(){let e=/\/patient\/([a-zA-Z0-9\-]+)\/?/.exec(location.pathname);return e&&e[1]}function h$(e){let[t,n]=(0,f0.useState)(e??hv()),{data:r,error:a,isValidating:o}=(0,mv.Ay)(t?["patient",t]:null,()=>po(t,{}));return(0,f0.useEffect)(()=>{let e=()=>{let e=hv();e!==t&&n(e)};return window.addEventListener("single-spa:routing-event",e),()=>window.removeEventListener("single-spa:routing-event",e)},[t]),(0,f0.useMemo)(()=>({isLoading:o&&!a&&!r,patient:r,patientUuid:t,error:a}),[o,a,r,t])}function hA(){let e=`${iO}/metadatamapping/termmapping?v=custom:(metadataUuid)&code=emr.primaryIdentifierType`,{data:t,error:n,isLoading:r}=(0,mv.Ay)(e,ij);return(0,f0.useMemo)(()=>({primaryIdentifierCode:t?.data?.results[0]?.metadataUuid,isLoading:r,error:n}),[t,n,r])}function hw(e){let{extensions:t,extensionSlotModuleName:n}=mn(e);return e?t.map(t=>({state:r})=>f1().createElement(f2.Provider,{value:{moduleName:n,featureName:"",extension:{extensionId:t.id,extensionSlotName:e,extensionSlotModuleName:n}}},f1().createElement(f4,{state:r}))):[]}function hk(){let e=(0,f0.useRef)(),[t,n]=(0,f0.useState)(null),r=null;if(!t){if(i){let e=iU().getState();e.loaded&&(r=e.session)}else i=new Promise(t=>{let n=({loaded:n,session:a})=>{n&&(t(a),r=a,e.current&&(e.current(),e.current=void 0))};n(iU().getState()),r||(e.current=iU().subscribe(n))});if(r)n(r);else throw i}(0,f0.useEffect)(()=>(e.current||(e.current=iU().subscribe(({loaded:e,session:t})=>{e&&(r=t,n(t))})),()=>{e.current&&(e.current(),e.current=void 0)}),[]);let a=t||r;if(!a)if(i)throw console.warn("useSession is in an unexpected state. Attempting to recover."),i;else throw Error("useSession is in an invalid state.");return a}let hx=({privilege:e,fallback:t,children:n})=>{let[r,a]=(0,f0.useState)(null);return((0,f0.useEffect)(()=>{let e=iG({includeAuthStatus:!1}).subscribe(a);return()=>e.unsubscribe()},[]),r&&iZ(e,r))?f1().createElement(f1().Fragment,null,n):t?f1().createElement(f1().Fragment,null,t):null};var hC=n(3464),hE=n.n(hC),hD=n(5602);let hS=new Map;function hz(){for(let e of Array.from(hS.values()))e()}let hP={setVisitContext:(e,t)=>null==t?{manuallySetVisitUuid:null}:{manuallySetVisitUuid:t.uuid,patientUuid:t.patient?.uuid}};function hM(e){let t=(0,f0.useId)();return(0,f0.useEffect)(()=>{if(e)return hS.set(t,e),()=>{hS.delete(t)}},[t,e]),{...f8(pk(),hP),mutateVisit:hz}}function hN(e,t=pA){let n=(0,f0.useRef)(void 0),{patientUuid:r,manuallySetVisitUuid:a,setVisitContext:o}=hM((0,f0.useCallback)(()=>n.current?.(),[])),i=e&&r==e?a:null,s=`?patient=${e}&v=${t}&includeInactive=false`,l=`/${i}?v=${t}`,{data:c,error:u,mutate:d,isValidating:p}=(0,mv.Ay)(e?`${iO}/visit${s}`:null,ij),{data:f,error:m,mutate:h,isValidating:g}=(0,mv.Ay)(e&&i?`${iO}/visit${l}`:null,ij),y=(0,f0.useMemo)(()=>c?.data.results.find(e=>null===e.stopDatetime)??null,[c]),b=(0,f0.useMemo)(()=>i&&f?f.data:null,[f,i]),v=(0,f0.useRef)(null);(0,f0.useEffect)(()=>{!p&&y&&r===e&&null===a&&o(y),g||(v.current&&b&&v.current.uuid===b.uuid&&!v.current.stopDatetime&&b.stopDatetime&&o(null),v.current=b)},[b,a,y,p,g,r]);let $=(0,f0.useCallback)(()=>{d(),h()},[d,h]);(0,f0.useEffect)(()=>{n.current=$},[$]);let A=!!(!c||i&&!f),w=!!(i?m:u);return{error:u||m,mutate:$,isValidating:p||g,activeVisit:y,currentVisit:b,currentVisitIsRetrospective:!!i,isLoading:A&&!w}}function hT(){let[e,t]=(0,f0.useState)([]);return(0,f0.useEffect)(()=>{let e=pf().subscribe(e=>{t(e)},e=>console.error(e));return()=>e.unsubscribe()},[]),e}hC.extend(hD);let hO=new Map;async function hI(e,t){let n=t.indexOf("#"),r=n>=0,a=r?t.substring(0,n):e,o=r?t.substring(n+1):t,i=await sw(a);return i&&Object.hasOwn(i,o)&&"function"==typeof i[o]?hR(a,i).then(()=>i[o]()):(i?i&&Object.hasOwn(i,o)?console.warn(`The export ${t}, defined in ${e}'s routes.json, is not a function`):console.warn(`${a} does not define a component called "${o}", referenced in ${e}'s routes.json. This cannot be loaded.`):console.warn(`Unknown app ${a} for ${t} defined in ${e}'s routes.json`),hB)}let hB={bootstrap:()=>Promise.resolve(),mount:()=>Promise.resolve(),unmount:()=>Promise.resolve()};async function hR(e,t){if(e in hO)await hO[e];else{let n=t??await sw(e);await (hO[e]=new Promise((t,r)=>{if(Object.hasOwn(n,"startupApp")){let a=n.startupApp;if("function"==typeof a)return Promise.resolve(a()).then(()=>{aw(e),t(null)}).catch(r)}aw(e),t(null)}))}}function hj(e,t){let n=t.name;if(!n)return void console.error(`An extension definition in ${e} is missing an name and thus cannot be
15
+ ${this.stack}`}}let iW=Y("session",{loaded:!1,session:null}),iV=0;function iG(e={includeAuthStatus:!0}){return(iV<Date.now()-6e4||!iW.getState().loaded)&&iq(),new eQ(t=>{let n=n=>{n.loaded&&(e.includeAuthStatus?t.next(n.session):t.next(n.session?.user))};return n(iW.getState()),iW.subscribe(n)})}function iU(){return(iV<Date.now()-6e4||!iW.getState().loaded)&&iq(),iW}function iH(e){let t=e.locale??e.user?.userProperties?.defaultLocale;t&&t.includes("_")&&(t=t.replaceAll("_","-")),function(e){if(void 0===e||"string"!=typeof e)return!1;try{new Intl.Locale(e)}catch(e){return!1}return!0}(t)&&t!==document.documentElement.getAttribute("lang")&&document.documentElement.setAttribute("lang",t)}function iq(e,t){iV=Date.now();let n={};return e&&t&&(n.Authorization=`Basic ${window.btoa(`${e}:${t}`)}`),i0(ij(iB,{headers:n}))}function iK(){iW.setState({loaded:!0,session:{authenticated:!1,sessionId:""}})}function iZ(e,t){var n,r;if(void 0===t)return!e;if(!e)return!0;return n=e,r=t,("string"==typeof n?!et(r.privileges.find(e=>n===e.display)):Array.isArray(n)?n.every(e=>!et(r.privileges.find(t=>e===t.display))):(et(n)||console.error(`Could not understand privileges "${n}"`),!0))||!et(t.roles.find(e=>"System Developer"===e.display))}function iY(){let e,t;return new Promise(n=>{let r=r=>{r.loaded&&r.session.user&&(e=r.session.user,n(r.session.user),t&&t())};r(iW.getState()),e||(t=iW.subscribe(r))})}function iJ(){return new Promise((e,t)=>{iG().subscribe(t=>{e(t.sessionLocation)},t).unsubscribe()})}async function iX(e,t){return i0(ij(iB,{method:"POST",body:{sessionLocation:e},headers:{"Content-Type":"application/json"},signal:t.signal}))}async function iQ(e,t,n){return n||(n=new AbortController),await ij(`${iO}/user/${e}`,{method:"POST",body:{userProperties:t},headers:{"Content-Type":"application/json"},signal:n.signal}),iq()}function i0(e){return new Promise((t,n)=>{e.then(e=>{let r;"object"==typeof e?.data?(r={loaded:!0,session:e.data},iW.setState(r),t(r)):(r={loaded:!1,session:null},iW.setState(r),n(r))}).catch(e=>{F(`Failed to fetch new session information: ${e}`);let t={loaded:!1,session:null};iW.setState(t),n(t)})})}function i1(){return"development"===window.spaEnv||"true"===localStorage.getItem("openmrs:devtools")}iW.subscribe(e=>{e.loaded&&e.session&&iH(e.session)});let i2={"webservices.rest":"2.24.0",fhir2:"1.0.0-SNAPSHOT"};function i3(){a$("@openmrs/esm-api",iN),iq()}let i4={address1:"Address line 1",address2:"Address line 2",address3:"Address line 3",address4:"Address line 4",address5:"Address line 5",address6:"Address line 6",city:"City",cityVillage:"City",country:"Country",countyDistrict:"District",district:"District",postalCode:"Postal code",state:"State",stateProvince:"State",closeAllOpenedWorkspaces:"Discard changes in {{count}} workspaces",closingAllWorkspacesPromptBody:"There may be unsaved changes in the following workspaces. Do you want to discard changes in the following workspaces? {{workspaceNames}}",closingAllWorkspacesPromptTitle:"You have unsaved changes",discard:"Discard",hide:"Hide",maximize:"Maximize",minimize:"Minimize",openAnyway:"Open anyway",unsavedChangesInOpenedWorkspace:"You may have unsaved changes in the opened workspace. Do you want to discard these changes?",unsavedChangesInWorkspace:'There may be unsaved changes in "{{workspaceName}}". Please save them before opening another workspace.',unsavedChangesTitleText:"Unsaved changes",workspaceHeader:"Workspace header",discardUnsavedChangesPromptBodyMultiple:"{{count}} workspaces have unsaved changes. Closing them will discard the changes:",discardUnsavedChangesPromptBodySingle:"<strong>{{workspaceTitle}}</strong> has unsaved changes. Closing it will discard them.",discardUnsavedChangesPromptTitle:"Discard unsaved changes?",keepEditing:"Keep editing",abnormalValue:"Abnormal value",actions:"Actions",actionableNotification:"Actionable notification",address:"Address",age:"Age",batchActionItemSelected:"{{totalSelected}} item selected",batchActionsItemsSelected:"{{totalSelected}} items selected",cancel:"Cancel",change:"Change",Clinic:"Clinic",close:"Close",closesActionableNotification:"Close actionable notification",closeSnackbar:"Close snackbar",confirm:"Confirm",contactAdministratorIfIssuePersists:"Contact your system administrator if the problem persists.",contactDetails:"Contact details",delete:"Delete",discardChanges:"Discard changes",edit:"Edit",emptyStateText:"There are no {{displayText}} to display",error:"Error",errorCopy:"Sorry, there was a problem displaying this information. You can try to reload this page, or contact the site administrator and quote the error code above.",errorLoadingLoginLocations:"Unable to load login locations. Please try again or contact support if the problem persists.",female:"Female",leftNavigation:"Left navigation",loading:"Loading",localVersion:"Local Build",male:"Male",noResultsToDisplay:"No results to display",notAvailable:"Not available",other:"Other",paginationItemsCount:"{{pageItemsCount}} / {{totalItems}} items",paginationOfPages:"of {{count}} pages",patientAvatarAlt:"Avatar for {{patientName}}",patientIdentifierSticker:"Patient identifier sticker",patientLists:"Patient lists",patientPhotoAlt:"Profile photo of {{patientName}}",patientPhotoPlaceholder:"Photo placeholder for {{patientName}}",prereleaseVersion:"Prerelease",print:"Print",printError:"Print error",printErrorExplainer:"An error occurred in {{errorLocation}}",printIdentifierSticker:"Print identifier sticker",printing:"Printing",recordNewEntry:"Record {{displayText}}",relationships:"Relationships",resetOverrides:"Reset overrides",save:"Save",scriptLoadingFailed:"Error: Script failed to load",scriptLoadingError:"Failed to load overridden script from {{url}}. Please check that the bundled script is available at the expected URL. Click the button below to reset all import map overrides.",searchForLocation:"Search for a location",seeAll:"See all",seeMoreLists:"See {{count}} more lists",selectAll:"Select all",sex:"Sex",showLess:"Show less",showMore:"Show more",snackbarNotification:"Snackbar notification",toggleDevTools:"Toggle dev tools",unknown:"Unknown",yearAbbreviation:"yr",yearsAbbreviation:"yrs"};var i5=n(1480),i6=n.n(i5);let i7=i6().default||i6();function i8(e,t,n,r){return i7.t(t,{ns:e,defaultValue:n,...r})}function i9(e,t,n){return i4[e]?i8("core",e,t??i4[e],n):(console.error(`O3 Core Translations does not provide key '${e}'. The key itself is being rendered as text.`),e)}i7.on("initialized",function(){window.i18next.loadNamespaces(["core"])});let se="import-map-override:",st="import-map-overrides-disabled",sn="import-map-overrides:change",sr=!1,sa=null,so=null;async function si(){return so??(so=ss().then(({map:e,complete:t})=>(t||(so=null),e))),so}async function ss(){let e=document.querySelectorAll('script[type="systemjs-importmap"]'),t=[],n=!0;for(let r=0;r<e.length;r++){let a=e[r];try{if(a.src){let e=await fetch(a.src);if(!e.ok)throw Error(`Request for ${a.src} returned ${e.status} ${e.statusText}`);t.push(await e.json())}else a.textContent&&t.push(JSON.parse(a.textContent))}catch(e){n=!1,console.warn(`[import-maps] Failed to parse import map from script tag at index ${r}`,e)}}return{map:sl(t),complete:n}}function sl(e){let t={imports:{}};for(let n of e)n?.imports&&Object.assign(t.imports,n.imports);return t}function sc(){let e={};try{let t=sm();for(let n=0;n<localStorage.length;n++){let r=localStorage.key(n);if(r?.startsWith(se)){let n=r.slice(se.length);if(!t.includes(n)){let t=localStorage.getItem(r);t&&(e[n]=t)}}}}catch(e){console.warn("[import-maps] Failed to read import-map overrides from localStorage",e)}return{imports:e}}async function su(){let e=await si();return sr?sl([e,sa??sc()]):e}async function sd(){return si()}async function sp(){return sr?sl([await si(),sc()]):si()}function sf(e){if(!sr)return{imports:{}};if(e){let e={};for(let t=0;t<localStorage.length;t++){let n=localStorage.key(t);if(n?.startsWith(se)){let t=localStorage.getItem(n);t&&(e[n.slice(se.length)]=t)}}return{imports:e}}return sc()}function sm(){if(!sr)return[];try{let e=localStorage.getItem(st);if(e){let t=JSON.parse(e);if(Array.isArray(t))return t}}catch{}return[]}function sh(e){return!!sr&&sm().includes(e)}function sg(e,t){if(!sr)return void console.warn("[Security] Import map overrides are disabled in production mode.");try{localStorage.setItem(se+e,t),window.dispatchEvent(new CustomEvent(sn))}catch(e){console.warn("[import-maps] Failed to write import-map override to localStorage",e)}}function s_(e){if(!sr)return void console.warn("[Security] Import map overrides are disabled in production mode.");try{localStorage.removeItem(se+e);let t=sm().filter(t=>t!==e);t.length>0?localStorage.setItem(st,JSON.stringify(t)):localStorage.removeItem(st),window.dispatchEvent(new CustomEvent(sn))}catch(e){console.warn("[import-maps] Failed to update import-map overrides in localStorage",e)}}function sy(){if(!sr)return void console.warn("[Security] Import map overrides are disabled in production mode.");try{let e=[];for(let t=0;t<localStorage.length;t++){let n=localStorage.key(t);n?.startsWith(se)&&e.push(n)}e.forEach(e=>localStorage.removeItem(e)),localStorage.removeItem(st),window.dispatchEvent(new CustomEvent(sn))}catch(e){console.warn("[import-maps] Failed to clear import-map overrides from localStorage",e)}}function sb(e){if(!sr)return void console.warn("[Security] Import map overrides are disabled in production mode.");try{let t=sm().filter(t=>t!==e);t.length>0?localStorage.setItem(st,JSON.stringify(t)):localStorage.removeItem(st),window.dispatchEvent(new CustomEvent(sn))}catch(e){console.warn("[import-maps] Failed to update import-map overrides in localStorage",e)}}let sv=!1;function s$(){!sv&&(sv=!0,(sr="development"===window.spaEnv)&&(sa=sc()))}function sA(e){return e.replace(/[\/\-@]/g,"_")}async function sw(e,t="./start",r){var a;let o,i=!r?.maxLoadingTime||r.maxLoadingTime<=0?6e5:r.maxLoadingTime;await Promise.race([sk(e,r?.importMap),new Promise((t,n)=>{o=setTimeout(()=>{var t;n(Error(`Could not resolve requested script, ${e}, within ${(t=i)<1e3?`${t} milliseconds`:t<6e4?`${Math.floor(t/1e3)} seconds`:t<36e5?`${Math.floor(t/6e4)} minutes`:t<864e5?`${Math.floor(t/36e5)} hours`:`${Math.floor(t/864e5)} days`}.`))},i)})]),o&&clearTimeout(o);let s=sA(e),l=window[s];if(!("object"==typeof(a=l)&&null!==a&&"init"in a&&"function"==typeof a.init&&"get"in a&&"function"==typeof a.get)){let e=`The global variable ${s} does not refer to a federated module`;throw console.error(e),Error(e)}l.init(n.S.default);let c=(await l.get(t))();if("object"!=typeof c||null===c){let t=`Container for ${e} did not return an ESM module as expected`;throw console.error(t),Error(t)}return c}async function sk(e,t){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 n=sA(e);if(!window[n]){let n=t??await sx();if(!n.imports.hasOwnProperty(e)){let t=`Could not find the package ${e} defined in the current importmap`;throw console.error(t),Error(t)}let r=n.imports[e];r.startsWith("./")&&(r=window.spaBase+r.substring(1));let a=e in sf().imports;try{return await new Promise((e,t)=>{!function(e,t,n){let r=document.head.querySelector(`script[src="${e}"]`),a=window[sC];if(a||(a=window[sC]=new Set([])),r)if(a.has(e)){let e,a,o;o=()=>{e&&r.removeEventListener("load",e),a&&r.removeEventListener("error",a)},e=()=>{o(),t(null)},a=e=>{o(),n(e.message)},r.addEventListener("load",e),r.addEventListener("error",a)}else console.warn(`Script at ${e} already loaded. Not loading it again.`),t(null);else{let r,o,i;a.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);i=()=>{clearTimeout(l),a.delete(e),r&&s.removeEventListener("load",r),o&&s.removeEventListener("error",o)},r=()=>{i(),t(null)},o=t=>{i();let r=`Failed to load script from ${e}`;console.error(r,t),n(t.message??r)},s.addEventListener("load",r),s.addEventListener("error",o),document.head.appendChild(s)}}(r,e,t)})}catch(e){return a&&O({kind:"error",title:i9("scriptLoadingFailed","Error: Script failed to load"),description:i9("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:i9("resetOverrides","Reset overrides"),onActionButtonClick(){sy(),window.location.reload()}}),Promise.reject(e)}}return Promise.resolve()}async function sx(){return su()}let sC=Symbol("__openmrs_script_loading");function sE(e){return!!e&&"object"==typeof e&&!(Object.hasOwn(e,"pages")&&(!e.pages||!Array.isArray(e.pages))||Object.hasOwn(e,"extensions")&&(!e.extensions||!Array.isArray(e.extensions))||Object.hasOwn(e,"workspaces")&&(!e.workspaces||!Array.isArray(e.workspaces))||Object.hasOwn(e,"modals")&&(!e.modals||!Array.isArray(e.modals)))}function sD(e){return!!e&&"object"==typeof e&&"routes"in e&&!!e.routes&&"object"==typeof e.routes&&Object.entries(e.routes).every(([e,t])=>"string"==typeof e&&sE(t))}let sS="openmrs-routes:",sz="openmrs-routes:change",sP=!1,sM=null,sN=null;async function sT(){return sN??(sN=sO().then(({map:e,complete:t})=>(t||(sN=null),e))),sN}async function sO(){let e=document.querySelectorAll("script[type='openmrs-routes']"),t=[],n=!0;for(let r=0;r<e.length;r++){let a=e[r];try{let e;if(a.src){let t=await fetch(a.src);if(!t.ok)throw Error(`Request for ${a.src} returned ${t.status} ${t.statusText}`);e=await t.json()}else a.textContent&&(e=JSON.parse(a.textContent));e&&sD(e)&&t.push(e)}catch(e){n=!1,console.warn(`[route-maps] Failed to parse routes from script tag at index ${r}`,e)}}return{map:sI(t),complete:n}}function sI(e){let t={routes:{}};for(let n of e)n&&"object"==typeof n&&!Array.isArray(n)&&(Object.assign(t.routes,n.routes),void 0===t.version&&void 0!==n.version&&(t.version=n.version));return t}async function sB(){let e={version:void 0,routes:{}};try{let t=[];for(let e=0;e<localStorage.length;e++){let n=localStorage.key(e);if(n?.startsWith(sS)){let e=localStorage.getItem(n);e&&t.push({moduleName:n.slice(sS.length),raw:e})}}for(let n of(await Promise.allSettled(t.map(async({moduleName:e,raw:t})=>{let n=JSON.parse(t);if(sE(n))return{moduleName:e,routes:n};if("string"==typeof n&&n.startsWith("http")){let t=await fetch(n),r=await t.json();if(sE(r))return{moduleName:e,routes:r};throw Error(`${n} did not resolve to a valid OpenmrsAppRoutes object`)}throw Error(`Override for ${e} is neither a valid routes object nor a URL`)}))))"fulfilled"===n.status?e.routes[n.value.moduleName]=n.value.routes:console.warn("[route-maps] Failed to load route override",n.reason)}catch(e){console.warn("[route-maps] Failed to read route overrides from localStorage",e)}return e}async function sR(){let e=await sT();return sP?sI([e,sM??await sB()]):e}async function sj(){return sT()}async function sF(){return sP?sI([await sT(),await sB()]):sT()}function sL(){if(!sP)return{};let e={};try{for(let t=0;t<localStorage.length;t++){let n=localStorage.key(t);if(n?.startsWith(sS)){let t=localStorage.getItem(n);t&&(e[n.slice(sS.length)]=t)}}}catch(e){console.warn("[route-maps] Failed to read route overrides from localStorage",e)}return e}function sW(e,t){if(!sP)return void console.warn("[Security] Route overrides are disabled outside development mode.");try{if("string"==typeof t)if(t.startsWith("http"))localStorage.setItem(sS+e,JSON.stringify(t));else{let n=JSON.parse(t);if(!sE(n))return void console.error(`The supplied routes for ${e} is not a valid OpenmrsAppRoutes object`,t);localStorage.setItem(sS+e,JSON.stringify(n))}else if(t instanceof URL)localStorage.setItem(sS+e,JSON.stringify(t.toString()));else{if(!sE(t))return void console.error(`Override for ${e} is not in a valid format. Expected either a Javascript Object, a JSON string of a Javascript object, or a URL`,t);localStorage.setItem(sS+e,JSON.stringify(t))}window.dispatchEvent(new CustomEvent(sz))}catch(e){console.warn("[route-maps] Failed to write route override to localStorage",e)}}function sV(e){if(!sP)return void console.warn("[Security] Route overrides are disabled outside development mode.");try{localStorage.removeItem(sS+e),window.dispatchEvent(new CustomEvent(sz))}catch(e){console.warn("[route-maps] Failed to remove route override from localStorage",e)}}function sG(){if(!sP)return void console.warn("[Security] Route overrides are disabled outside development mode.");try{let e=[];for(let t=0;t<localStorage.length;t++){let n=localStorage.key(t);n?.startsWith(sS)&&e.push(n)}e.forEach(e=>localStorage.removeItem(e)),window.dispatchEvent(new CustomEvent(sz))}catch(e){console.warn("[route-maps] Failed to clear route overrides from localStorage",e)}}let sU=null;function sH(){return sU||(sU=(sP="development"===window.spaEnv)?sB().then(e=>{sM=e}):Promise.resolve())}let sq=`${iO}/attachment`;function sK(e,t){return ij(`${sq}/${e}`,{signal:t.signal})}function sZ(e,t,n){return ij(`${sq}?patient=${e}&includeEncounterless=${t}`,{signal:n.signal})}async function sY(e,t){let n=new FormData;return n.append("fileCaption",t.fileDescription),n.append("patient",e),t.file?n.append("file",t.file,t.fileName):(n.append("file",new File([""],t.fileName),t.fileName),n.append("base64Content",t.base64Content)),ij(`${sq}`,{method:"POST",body:n})}function sJ(e,t){return ij(`${sq}/${e}`,{method:"DELETE",signal:t.signal})}try{self["workbox:window:6.5.4"]&&_()}catch(e){}function sX(e,t){return new Promise(function(n){var r=new MessageChannel;r.port1.onmessage=function(e){n(e.data)},e.postMessage(t,[r.port2])})}function sQ(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function s0(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}try{self["workbox:core:6.5.4"]&&_()}catch(e){}var s1=function(){var e=this;this.promise=new Promise(function(t,n){e.resolve=t,e.reject=n})};function s2(e,t){var n=location.href;return new URL(e,n).href===new URL(t,n).href}var s3=function(e,t){this.type=e,Object.assign(this,t)};function s4(e,t,n){return n?t?t(e):e:(e&&e.then||(e=Promise.resolve(e)),t?e.then(t):e)}function s5(){}var s6={type:"SKIP_WAITING"};function s7(e,t){if(!t)return e&&e.then?e.then(s5):Promise.resolve()}var s8=function(e){function t(t,n){var r,a;return void 0===n&&(n={}),(r=e.call(this)||this).nn={},r.tn=0,r.rn=new s1,r.en=new s1,r.on=new s1,r.un=0,r.an=new Set,r.cn=function(){var e=r.fn,t=e.installing;r.tn>0||!s2(t.scriptURL,r.sn.toString())||performance.now()>r.un+6e4?(r.vn=t,e.removeEventListener("updatefound",r.cn)):(r.hn=t,r.an.add(t),r.rn.resolve(t)),++r.tn,t.addEventListener("statechange",r.ln)},r.ln=function(e){var t=r.fn,n=e.target,a=n.state,o=n===r.vn,i={sw:n,isExternal:o,originalEvent:e};!o&&r.mn&&(i.isUpdate=!0),r.dispatchEvent(new s3(a,i)),"installed"===a?r.wn=self.setTimeout(function(){"installed"===a&&t.waiting===n&&r.dispatchEvent(new s3("waiting",i))},200):"activating"===a&&(clearTimeout(r.wn),o||r.en.resolve(n))},r.dn=function(e){var t=r.hn,n=t!==navigator.serviceWorker.controller;r.dispatchEvent(new s3("controlling",{isExternal:n,originalEvent:e,sw:t,isUpdate:r.mn})),n||r.on.resolve(t)},a=function(e){var t=e.data,n=e.ports,a=e.source;return s4(r.getSW(),function(){r.an.has(a)&&r.dispatchEvent(new s3("message",{data:t,originalEvent:e,ports:n,sw:a}))})},r.gn=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];try{return Promise.resolve(a.apply(this,e))}catch(e){return Promise.reject(e)}},r.sn=t,r.nn=n,navigator.serviceWorker.addEventListener("message",r.gn),r}t.prototype=Object.create(e.prototype),t.prototype.constructor=t,t.__proto__=e;var n,r,a=t.prototype;return a.register=function(e){var t=(void 0===e?{}:e).immediate,n=void 0!==t&&t;try{var r,a,o,i=this;return r=function(){if(!n&&"complete"!==document.readyState)return s7(new Promise(function(e){return window.addEventListener("load",e)}))},a=function(){return i.mn=!!navigator.serviceWorker.controller,i.yn=i.pn(),s4(i.bn(),function(e){i.fn=e,i.yn&&(i.hn=i.yn,i.en.resolve(i.yn),i.on.resolve(i.yn),i.yn.addEventListener("statechange",i.ln,{once:!0}));var t=i.fn.waiting;return t&&s2(t.scriptURL,i.sn.toString())&&(i.hn=t,Promise.resolve().then(function(){i.dispatchEvent(new s3("waiting",{sw:t,wasWaitingBeforeRegister:!0}))}).then(function(){})),i.hn&&(i.rn.resolve(i.hn),i.an.add(i.hn)),i.fn.addEventListener("updatefound",i.cn),navigator.serviceWorker.addEventListener("controllerchange",i.dn),i.fn})},(o=r())&&o.then?o.then(a):a(o)}catch(e){return Promise.reject(e)}},a.update=function(){try{return this.fn?s7(this.fn.update()):void 0}catch(e){return Promise.reject(e)}},a.getSW=function(){return void 0!==this.hn?Promise.resolve(this.hn):this.rn.promise},a.messageSW=function(e){try{return s4(this.getSW(),function(t){return sX(t,e)})}catch(e){return Promise.reject(e)}},a.messageSkipWaiting=function(){this.fn&&this.fn.waiting&&sX(this.fn.waiting,s6)},a.pn=function(){var e=navigator.serviceWorker.controller;return e&&s2(e.scriptURL,this.sn.toString())?e:void 0},a.bn=function(){try{var e=this;return function(e,t){try{var n=e()}catch(e){return t(e)}return n&&n.then?n.then(void 0,t):n}(function(){return s4(navigator.serviceWorker.register(e.sn,e.nn),function(t){return e.un=performance.now(),t})},function(e){throw e})}catch(e){return Promise.reject(e)}},n=[{key:"active",get:function(){return this.en.promise}},{key:"controlling",get:function(){return this.on.promise}}],sQ(t.prototype,n),r&&sQ(t,r),t}(function(){function e(){this.Pn=new Map}var t=e.prototype;return t.addEventListener=function(e,t){this.Sn(e).add(t)},t.removeEventListener=function(e,t){this.Sn(e).delete(t)},t.dispatchEvent=function(e){e.target=this;for(var t,n=function(e){var t;if("u"<typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(t=function(e){if(e){if("string"==typeof e)return s0(e,void 0);var t=Object.prototype.toString.call(e).slice(8,-1);return"Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t?Array.from(e):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?s0(e,void 0):void 0}}(e))){t&&(e=t);var n=0;return function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}}}throw TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}return(t=e[Symbol.iterator]()).next.bind(t)}(this.Sn(e.type));!(t=n()).done;)(0,t.value)(e)},t.Sn=function(e){return this.Pn.has(e)||this.Pn.set(e,new Set),this.Pn.get(e)},e}());function s9(e,t){if(void 0!==p)return console.warn(`The application's Service Worker has already been registered. The new service worker at ${e} will not be registered.`),p;if(!("serviceWorker"in navigator))throw Error("Registering the Service Worker is not possible due to missing browser capabilities.");let n=new s8(e,t);return p=n.register().then(()=>n.controlling.then(()=>n))}function le(){return p??Promise.resolve(void 0)}let lt="x-omrs-offline-response-body",ln="x-omrs-offline-response-status",lr="x-omrs-offline-caching-strategy";async function la(e){let t=await le();return t?await t.messageSW(e):{success:!1,result:void 0,error:"No service worker has been registered. This is typically the case when the application has been built without offline-related features."}}async function lo(){let e=window.sessionStorage;try{e.setItem("someKeyHere","test"),e.removeItem("someKeyHere")}catch(t){if(t.code===DOMException.QUOTA_EXCEEDED_ERR&&0===e.length)return!0}return!1}async function li(){return!window.indexedDB}async function ls(){return new Promise(e=>{let t=indexedDB.open("test");t.onerror=()=>e(!0),t.onsuccess=()=>e(!1)})}async function ll(){return await ls()||await li()||await lo()}let lc="openmrs3:offline-mode",lu="unavailable";function ld(){return{current:lu,notAvailable:"unavailable"===lu,active:"on"===lu}}function lp(e){"unavailable"!==lu&&"unavailable"!==e&&(localStorage.setItem(lc,"on"===e?"active":"disabled"),lu=e)}async function lf(){await ll()||(lu="active"===localStorage.getItem(lc)?"on":"off"),navigator.onLine}let lm="u">typeof globalThis?globalThis:"u">typeof self?self:"u">typeof window?window:global,lh=Object.keys,lg=Array.isArray;function l_(e,t){return"object"!=typeof t||lh(t).forEach(function(n){e[n]=t[n]}),e}"u"<typeof Promise||lm.Promise||(lm.Promise=Promise);let ly=Object.getPrototypeOf,lb={}.hasOwnProperty;function lv(e,t){return lb.call(e,t)}function l$(e,t){"function"==typeof t&&(t=t(ly(e))),("u"<typeof Reflect?lh:Reflect.ownKeys)(t).forEach(n=>{lw(e,n,t[n])})}let lA=Object.defineProperty;function lw(e,t,n,r){lA(e,t,l_(n&&lv(n,"get")&&"function"==typeof n.get?{get:n.get,set:n.set,configurable:!0}:{value:n,configurable:!0,writable:!0},r))}function lk(e){return{from:function(t){return e.prototype=Object.create(t.prototype),lw(e.prototype,"constructor",e),{extend:l$.bind(null,e.prototype)}}}}let lx=Object.getOwnPropertyDescriptor;function lC(e,t){let n;return lx(e,t)||(n=ly(e))&&lC(n,t)}let lE=[].slice;function lD(e,t,n){return lE.call(e,t,n)}function lS(e,t){return t(e)}function lz(e){if(!e)throw Error("Assertion Failed")}function lP(e){lm.setImmediate?setImmediate(e):setTimeout(e,0)}function lM(e,t){return e.reduce((e,n,r)=>{var a=t(n,r);return a&&(e[a[0]]=a[1]),e},{})}function lN(e,t){if("string"==typeof t&&lv(e,t))return e[t];if(!t)return e;if("string"!=typeof t){for(var n=[],r=0,a=t.length;r<a;++r){var o=lN(e,t[r]);n.push(o)}return n}var i=t.indexOf(".");if(-1!==i){var s=e[t.substr(0,i)];return null==s?void 0:lN(s,t.substr(i+1))}}function lT(e,t,n){if(e&&void 0!==t&&(!("isFrozen"in Object)||!Object.isFrozen(e)))if("string"!=typeof t&&"length"in t){lz("string"!=typeof n&&"length"in n);for(var r=0,a=t.length;r<a;++r)lT(e,t[r],n[r])}else{var o=t.indexOf(".");if(-1!==o){var i=t.substr(0,o),s=t.substr(o+1);if(""===s)void 0===n?lg(e)&&!isNaN(parseInt(i))?e.splice(i,1):delete e[i]:e[i]=n;else{var l=e[i];l&&lv(e,i)||(l=e[i]={}),lT(l,s,n)}}else void 0===n?lg(e)&&!isNaN(parseInt(t))?e.splice(t,1):delete e[t]:e[t]=n}}function lO(e){var t={};for(var n in e)lv(e,n)&&(t[n]=e[n]);return t}let lI=[].concat;function lB(e){return lI.apply([],e)}let lR="BigUint64Array,BigInt64Array,Array,Boolean,String,Date,RegExp,Blob,File,FileList,FileSystemFileHandle,FileSystemDirectoryHandle,ArrayBuffer,DataView,Uint8ClampedArray,ImageBitmap,ImageData,Map,Set,CryptoKey".split(",").concat(lB([8,16,32,64].map(e=>["Int","Uint","Float"].map(t=>t+e+"Array")))).filter(e=>lm[e]),lj=lR.map(e=>lm[e]);lM(lR,e=>[e,!0]);let lF=null;function lL(e){lF="u">typeof WeakMap&&new WeakMap;let t=function e(t){if(!t||"object"!=typeof t)return t;let n=lF&&lF.get(t);if(n)return n;if(lg(t)){n=[],lF&&lF.set(t,n);for(var r=0,a=t.length;r<a;++r)n.push(e(t[r]))}else if(lj.indexOf(t.constructor)>=0)n=t;else{let r=ly(t);for(var o in n=r===Object.prototype?{}:Object.create(r),lF&&lF.set(t,n),t)lv(t,o)&&(n[o]=e(t[o]))}return n}(e);return lF=null,t}let{toString:lW}={};function lV(e){return lW.call(e).slice(8,-1)}let lG="u">typeof Symbol?Symbol.iterator:"@@iterator",lU="symbol"==typeof lG?function(e){var t;return null!=e&&(t=e[lG])&&t.apply(e)}:function(){return null},lH={};function lq(e){var t,n,r,a;if(1==arguments.length){if(lg(e))return e.slice();if(this===lH&&"string"==typeof e)return[e];if(a=lU(e)){for(n=[];!(r=a.next()).done;)n.push(r.value);return n}if(null==e)return[e];if("number"==typeof(t=e.length)){for(n=Array(t);t--;)n[t]=e[t];return n}return[e]}for(t=arguments.length,n=Array(t);t--;)n[t]=arguments[t];return n}let lK="u">typeof Symbol?e=>"AsyncFunction"===e[Symbol.toStringTag]:()=>!1;var lZ="u">typeof location&&/^(http|https):\/\/(localhost|127\.0\.0\.1)/.test(location.href),lY=()=>!0;let lJ=!Error("").stack;function lX(){if(lJ)try{throw lX.arguments,Error()}catch(e){return e}return Error()}function lQ(e,t){var n=e.stack;return n?(t=t||0,0===n.indexOf(e.name)&&(t+=(e.name+e.message).split("\n").length),n.split("\n").slice(t).filter(lY).map(e=>"\n"+e).join("")):""}var l0=["Unknown","Constraint","Data","TransactionInactive","ReadOnly","Version","NotFound","InvalidState","InvalidAccess","Abort","Timeout","QuotaExceeded","Syntax","DataClone"],l1=["Modify","Bulk","OpenFailed","VersionChange","Schema","Upgrade","InvalidTable","MissingAPI","NoSuchDatabase","InvalidArgument","SubTransaction","Unsupported","Internal","DatabaseClosed","PrematureCommit","ForeignAwait"].concat(l0),l2={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 l3(e,t){this._e=lX(),this.name=e,this.message=t}function l4(e,t){return e+". Errors: "+Object.keys(t).map(e=>t[e].toString()).filter((e,t,n)=>n.indexOf(e)===t).join("\n")}function l5(e,t,n,r){this._e=lX(),this.failures=t,this.failedKeys=r,this.successCount=n,this.message=l4(e,t)}function l6(e,t){this._e=lX(),this.name="BulkError",this.failures=Object.keys(t).map(e=>t[e]),this.failuresByPos=t,this.message=l4(e,t)}lk(l3).from(Error).extend({stack:{get:function(){return this._stack||(this._stack=this.name+": "+this.message+lQ(this._e,2))}},toString:function(){return this.name+": "+this.message}}),lk(l5).from(l3),lk(l6).from(l3);var l7=l1.reduce((e,t)=>(e[t]=t+"Error",e),{}),l8=l1.reduce((e,t)=>{var n=t+"Error";function r(e,r){this._e=lX(),this.name=n,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=l2[t]||n,this.inner=null)}return lk(r).from(l3),e[t]=r,e},{});l8.Syntax=SyntaxError,l8.Type=TypeError,l8.Range=RangeError;var l9=l0.reduce((e,t)=>(e[t+"Error"]=l8[t],e),{}),ce=l1.reduce((e,t)=>(-1===["Syntax","Type","Range"].indexOf(t)&&(e[t+"Error"]=l8[t]),e),{});function ct(){}function cn(e){return e}function cr(e,t){return null==e||e===cn?t:function(n){return t(e(n))}}function ca(e,t){return function(){e.apply(this,arguments),t.apply(this,arguments)}}function co(e,t){return e===ct?t:function(){var n=e.apply(this,arguments);void 0!==n&&(arguments[0]=n);var r=this.onsuccess,a=this.onerror;this.onsuccess=null,this.onerror=null;var o=t.apply(this,arguments);return r&&(this.onsuccess=this.onsuccess?ca(r,this.onsuccess):r),a&&(this.onerror=this.onerror?ca(a,this.onerror):a),void 0!==o?o:n}}function ci(e,t){return e===ct?t:function(){e.apply(this,arguments);var n=this.onsuccess,r=this.onerror;this.onsuccess=this.onerror=null,t.apply(this,arguments),n&&(this.onsuccess=this.onsuccess?ca(n,this.onsuccess):n),r&&(this.onerror=this.onerror?ca(r,this.onerror):r)}}function cs(e,t){return e===ct?t:function(n){var r=e.apply(this,arguments);l_(n,r);var a=this.onsuccess,o=this.onerror;this.onsuccess=null,this.onerror=null;var i=t.apply(this,arguments);return a&&(this.onsuccess=this.onsuccess?ca(a,this.onsuccess):a),o&&(this.onerror=this.onerror?ca(o,this.onerror):o),void 0===r?void 0===i?void 0:i:l_(r,i)}}function cl(e,t){return e===ct?t:function(){return!1!==t.apply(this,arguments)&&e.apply(this,arguments)}}function cc(e,t){return e===ct?t:function(){var n=e.apply(this,arguments);if(n&&"function"==typeof n.then){for(var r=this,a=arguments.length,o=Array(a);a--;)o[a]=arguments[a];return n.then(function(){return t.apply(r,o)})}return t.apply(this,arguments)}}ce.ModifyError=l5,ce.DexieError=l3,ce.BulkError=l6;var cu={};let[cd,cp,cf]="u"<typeof Promise?[]:(()=>{let e=Promise.resolve();if("u"<typeof crypto||!crypto.subtle)return[e,ly(e),e];let t=crypto.subtle.digest("SHA-512",new Uint8Array([0]));return[t,ly(t),e]})(),cm=cp&&cp.then,ch=cd&&cd.constructor,cg=!!cf;var c_=!1,cy=cf?()=>{cf.then(cj)}:lm.setImmediate?setImmediate.bind(null,cj):lm.MutationObserver?()=>{var e=document.createElement("div");new MutationObserver(()=>{cj(),e=null}).observe(e,{attributes:!0}),e.setAttribute("i","1")}:()=>{setTimeout(cj,0)},cb=function(e,t){cD.push([e,t]),c$&&(cy(),c$=!1)},cv=!0,c$=!0,cA=[],cw=[],ck=null,cx=cn,cC={id:"global",global:!0,ref:0,unhandleds:[],onunhandled:c9,pgp:!1,env:{},finalize:function(){this.unhandleds.forEach(e=>{try{c9(e[0],e[1])}catch(e){}})}},cE=cC,cD=[],cS=0,cz=[];function cP(e){if("object"!=typeof this)throw TypeError("Promises must be constructed via new");this._listeners=[],this.onuncatched=ct,this._lib=!1;var t=this._PSD=cE;if(lZ&&(this._stackHolder=lX(),this._prev=null,this._numPrev=0),"function"!=typeof e){if(e!==cu)throw TypeError("Not a function");return this._state=arguments[1],this._value=arguments[2],void(!1===this._state&&cT(this,this._value))}this._state=null,this._value=null,++t.ref,function e(t,n){try{n(n=>{if(null===t._state){if(n===t)throw TypeError("A promise cannot be resolved with itself.");var r=t._lib&&cF();n&&"function"==typeof n.then?e(t,(e,t)=>{n instanceof cP?n._then(e,t):n.then(e,t)}):(t._state=!0,t._value=n,cO(t)),r&&cL()}},cT.bind(null,t))}catch(e){cT(t,e)}}(this,e)}let cM={get:function(){var e=cE,t=cZ;function n(n,r){var a=!e.global&&(e!==cE||t!==cZ);let o=a&&!cQ();var i=new cP((t,i)=>{cI(this,new cN(c6(n,e,a,o),c6(r,e,a,o),t,i,e))});return lZ&&cR(i,this),i}return n.prototype=cu,n},set:function(e){lw(this,"then",e&&e.prototype===cu?cM:{get:function(){return e},set:cM.set})}};function cN(e,t,n,r,a){this.onFulfilled="function"==typeof e?e:null,this.onRejected="function"==typeof t?t:null,this.resolve=n,this.reject=r,this.psd=a}function cT(e,t){if(cw.push(t),null===e._state){var n=e._lib&&cF();t=cx(t),e._state=!1,e._value=t,lZ&&null!==t&&"object"==typeof t&&!t._promise&&function(e){try{e.apply(null,void 0)}catch(e){}}(()=>{var n=lC(t,"stack");t._promise=e,lw(t,"stack",{get:()=>c_?n&&(n.get?n.get.apply(t):n.value):e.stack})}),cA.some(t=>t._value===e._value)||cA.push(e),cO(e),n&&cL()}}function cO(e){var t=e._listeners;e._listeners=[];for(var n=0,r=t.length;n<r;++n)cI(e,t[n]);var a=e._PSD;--a.ref||a.finalize(),0===cS&&(++cS,cb(()=>{0==--cS&&cW()},[]))}function cI(e,t){if(null!==e._state){var n=e._state?t.onFulfilled:t.onRejected;if(null===n)return(e._state?t.resolve:t.reject)(e._value);++t.psd.ref,++cS,cb(cB,[n,e,t])}else e._listeners.push(t)}function cB(e,t,n){try{ck=t;var r,a=t._value;t._state?r=e(a):(cw.length&&(cw=[]),r=e(a),-1===cw.indexOf(a)&&function(e){for(var t=cA.length;t;)if(cA[--t]._value===e._value)return void cA.splice(t,1)}(t)),n.resolve(r)}catch(e){n.reject(e)}finally{ck=null,0==--cS&&cW(),--n.psd.ref||n.psd.finalize()}}function cR(e,t){var n=t?t._numPrev+1:0;n<100&&(e._prev=t,e._numPrev=n)}function cj(){cF()&&cL()}function cF(){var e=cv;return cv=!1,c$=!1,e}function cL(){var e,t,n;do for(;cD.length>0;)for(e=cD,cD=[],n=e.length,t=0;t<n;++t){var r=e[t];r[0].apply(null,r[1])}while(cD.length>0);cv=!0,c$=!0}function cW(){var e=cA;cA=[],e.forEach(e=>{e._PSD.onunhandled.call(null,e._value,e)});for(var t=cz.slice(0),n=t.length;n;)t[--n]()}function cV(e){return new cP(cu,!1,e)}function cG(e,t){var n=cE;return function(){var r=cF(),a=cE;try{return c3(n,!0),e.apply(this,arguments)}catch(e){t&&t(e)}finally{c3(a,!1),r&&cL()}}}l$(cP.prototype,{then:cM,_then:function(e,t){cI(this,new cN(null,null,e,t,cE))},catch:function(e){if(1==arguments.length)return this.then(null,e);var t=arguments[0],n=arguments[1];return"function"==typeof t?this.then(null,e=>e instanceof t?n(e):cV(e)):this.then(null,e=>e&&e.name===t?n(e):cV(e))},finally:function(e){return this.then(t=>(e(),t),t=>(e(),cV(t)))},stack:{get:function(){if(this._stack)return this._stack;try{c_=!0;var e=(function e(t,n,r){if(n.length===r)return n;var a="";if(!1===t._state){var o,i,s=t._value;null!=s?(o=s.name||"Error",i=s.message||s,a=lQ(s,0)):(o=s,i=""),n.push(o+(i?": "+i:"")+a)}return lZ&&((a=lQ(t._stackHolder,2))&&-1===n.indexOf(a)&&n.push(a),t._prev&&e(t._prev,n,r)),n})(this,[],20).join("\nFrom previous: ");return null!==this._state&&(this._stack=e),e}finally{c_=!1}}},timeout:function(e,t){return e<1/0?new cP((n,r)=>{var a=setTimeout(()=>r(new l8.Timeout(t)),e);this.then(n,r).finally(clearTimeout.bind(null,a))}):this}}),"u">typeof Symbol&&Symbol.toStringTag&&lw(cP.prototype,Symbol.toStringTag,"Dexie.Promise"),cC.env=c4(),l$(cP,{all:function(){var e=lq.apply(null,arguments).map(c0);return new cP(function(t,n){0===e.length&&t([]);var r=e.length;e.forEach((a,o)=>cP.resolve(a).then(n=>{e[o]=n,--r||t(e)},n))})},resolve:e=>{if(e instanceof cP)return e;if(e&&"function"==typeof e.then)return new cP((t,n)=>{e.then(t,n)});var t=new cP(cu,!0,e);return cR(t,ck),t},reject:cV,race:function(){var e=lq.apply(null,arguments).map(c0);return new cP((t,n)=>{e.map(e=>cP.resolve(e).then(t,n))})},PSD:{get:()=>cE,set:e=>cE=e},totalEchoes:{get:()=>cZ},newPSD:cJ,usePSD:c5,scheduler:{get:()=>cb,set:e=>{cb=e}},rejectionMapper:{get:()=>cx,set:e=>{cx=e}},follow:(e,t)=>new cP((n,r)=>cJ((t,n)=>{var r=cE;r.unhandleds=[],r.onunhandled=n,r.finalize=ca(function(){var e;e=()=>{0===this.unhandleds.length?t():n(this.unhandleds[0])},cz.push(function t(){e(),cz.splice(cz.indexOf(t),1)}),++cS,cb(()=>{0==--cS&&cW()},[])},r.finalize),e()},t,n,r))}),ch&&(ch.allSettled&&lw(cP,"allSettled",function(){let e=lq.apply(null,arguments).map(c0);return new cP(t=>{0===e.length&&t([]);let n=e.length,r=Array(n);e.forEach((e,a)=>cP.resolve(e).then(e=>r[a]={status:"fulfilled",value:e},e=>r[a]={status:"rejected",reason:e}).then(()=>--n||t(r)))})}),ch.any&&"u">typeof AggregateError&&lw(cP,"any",function(){let e=lq.apply(null,arguments).map(c0);return new cP((t,n)=>{0===e.length&&n(AggregateError([]));let r=e.length,a=Array(r);e.forEach((e,o)=>cP.resolve(e).then(e=>t(e),e=>{a[o]=e,--r||n(AggregateError(a))}))})}));let cU={awaits:0,echoes:0,id:0};var cH=0,cq=[],cK=0,cZ=0,cY=0;function cJ(e,t,n,r){var a=cE,o=Object.create(a);o.parent=a,o.ref=0,o.global=!1,o.id=++cY;var i=cC.env;o.env=cg?{Promise:cP,PromiseProp:{value:cP,configurable:!0,writable:!0},all:cP.all,race:cP.race,allSettled:cP.allSettled,any:cP.any,resolve:cP.resolve,reject:cP.reject,nthen:c7(i.nthen,o),gthen:c7(i.gthen,o)}:{},t&&l_(o,t),++a.ref,o.finalize=function(){--this.parent.ref||this.parent.finalize()};var s=c5(o,e,n,r);return 0===o.ref&&o.finalize(),s}function cX(){return cU.id||(cU.id=++cH),++cU.awaits,cU.echoes+=100,cU.id}function cQ(){return!!cU.awaits&&(0==--cU.awaits&&(cU.id=0),cU.echoes=100*cU.awaits,!0)}function c0(e){return cU.echoes&&e&&e.constructor===ch?(cX(),e.then(e=>(cQ(),e),e=>(cQ(),ue(e)))):e}function c1(e){++cZ,cU.echoes&&0!=--cU.echoes||(cU.echoes=cU.id=0),cq.push(cE),c3(e,!0)}function c2(){var e=cq[cq.length-1];cq.pop(),c3(e,!1)}function c3(e,t){var n,r=cE;if((t?!cU.echoes||cK++&&e===cE:!cK||--cK&&e===cE)||(n=t?c1.bind(null,e):c2,cm.call(cd,n)),e!==cE&&(cE=e,r===cC&&(cC.env=c4()),cg)){var a=cC.env.Promise,o=e.env;cp.then=o.nthen,a.prototype.then=o.gthen,(r.global||e.global)&&(Object.defineProperty(lm,"Promise",o.PromiseProp),a.all=o.all,a.race=o.race,a.resolve=o.resolve,a.reject=o.reject,o.allSettled&&(a.allSettled=o.allSettled),o.any&&(a.any=o.any))}}function c4(){var e=lm.Promise;return cg?{Promise:e,PromiseProp:Object.getOwnPropertyDescriptor(lm,"Promise"),all:e.all,race:e.race,allSettled:e.allSettled,any:e.any,resolve:e.resolve,reject:e.reject,nthen:cp.then,gthen:e.prototype.then}:{}}function c5(e,t,n,r,a){var o=cE;try{return c3(e,!0),t(n,r,a)}finally{c3(o,!1)}}function c6(e,t,n,r){return"function"!=typeof e?e:function(){var a,o=cE;n&&cX(),c3(t,!0);try{return e.apply(this,arguments)}finally{c3(o,!1),r&&(a=cQ,cm.call(cd,a))}}}function c7(e,t){return function(n,r){return e.call(this,c6(n,t),c6(r,t))}}-1===(""+cm).indexOf("[native code]")&&(cX=cQ=ct);let c8="unhandledrejection";function c9(e,t){var n;try{n=t.onuncatched(e)}catch(e){}if(!1!==n)try{var r,a={promise:t,reason:e};if(lm.document&&document.createEvent?((r=document.createEvent("Event")).initEvent(c8,!0,!0),l_(r,a)):lm.CustomEvent&&l_(r=new CustomEvent(c8,{detail:a}),a),r&&lm.dispatchEvent&&(dispatchEvent(r),!lm.PromiseRejectionEvent&&lm.onunhandledrejection))try{lm.onunhandledrejection(r)}catch(e){}lZ&&r&&!r.defaultPrevented&&console.warn(`Unhandled rejection: ${e.stack||e}`)}catch(e){}}var ue=cP.reject;let ut="3.2.6",un=String.fromCharCode(65535),ur=-1/0,ua="Invalid key provided. Keys must be of type string, number, Date or Array<string | number | Date>.",uo="String expected.",ui=[],us="u">typeof navigator&&/(MSIE|Trident|Edge)/.test(navigator.userAgent),ul=e=>!/(dexie\.js|dexie\.min\.js)/.test(e),uc="__dbnames",uu="readonly",ud="readwrite";function up(e,t){return e?t?function(){return e.apply(this,arguments)&&t.apply(this,arguments)}:e:t}let uf={type:3,lower:-1/0,lowerOpen:!1,upper:[[]],upperOpen:!1};function um(e){return"string"!=typeof e||/\./.test(e)?e=>e:t=>(void 0===t[e]&&e in t&&delete(t=lL(t))[e],t)}class uh{_trans(e,t,n){let r=this._tx||cE.trans,a=this.name;function o(e,n,r){if(!r.schema[a])throw new l8.NotFound("Table "+a+" not part of transaction");return t(r.idbtrans,r)}let i=cF();try{return r&&r.db===this.db?r===cE.trans?r._promise(e,o,n):cJ(()=>r._promise(e,o,n),{trans:r,transless:cE.transless||cE}):function e(t,n,r,a){if(t.idbdb&&(t._state.openComplete||cE.letThrough||t._vip)){var o=t._createTransaction(n,r,t._dbSchema);try{o.create(),t._state.PR1398_maxLoop=3}catch(o){return o.name===l7.InvalidState&&t.isOpen()&&--t._state.PR1398_maxLoop>0?(console.warn("Dexie: Need to reopen db"),t._close(),t.open().then(()=>e(t,n,r,a))):ue(o)}return o._promise(n,(e,t)=>cJ(()=>(cE.trans=o,a(e,t,o)))).then(e=>o._completion.then(()=>e))}if(t._state.openComplete)return ue(new l8.DatabaseClosed(t._state.dbOpenError));if(!t._state.isBeingOpened){if(!t._options.autoOpen)return ue(new l8.DatabaseClosed);t.open().catch(ct)}return t._state.dbReadyPromise.then(()=>e(t,n,r,a))}(this.db,e,[this.name],o)}finally{i&&cL()}}get(e,t){return e&&e.constructor===Object?this.where(e).first(t):this._trans("readonly",t=>this.core.get({trans:t,key:e}).then(e=>this.hook.reading.fire(e))).then(t)}where(e){if("string"==typeof e)return new this.db.WhereClause(this,e);if(lg(e))return new this.db.WhereClause(this,`[${e.join("+")}]`);let t=lh(e);if(1===t.length)return this.where(t[0]).equals(e[t[0]]);let n=this.schema.indexes.concat(this.schema.primKey).filter(e=>{if(e.compound&&t.every(t=>e.keyPath.indexOf(t)>=0)){for(let n=0;n<t.length;++n)if(-1===t.indexOf(e.keyPath[n]))return!1;return!0}return!1}).sort((e,t)=>e.keyPath.length-t.keyPath.length)[0];if(n&&this.db._maxKey!==un){let r=n.keyPath.slice(0,t.length);return this.where(r).equals(r.map(t=>e[t]))}!n&&lZ&&console.warn(`The query ${JSON.stringify(e)} on ${this.name} would benefit of a compound index [${t.join("+")}]`);let{idxByName:r}=this.schema,a=this.db._deps.indexedDB;function o(e,t){try{return 0===a.cmp(e,t)}catch(e){return!1}}let[i,s]=t.reduce(([t,n],a)=>{let i=r[a],s=e[a];return[t||i,t||!i?up(n,i&&i.multi?e=>{let t=lN(e,a);return lg(t)&&t.some(e=>o(s,e))}:e=>o(s,lN(e,a))):n]},[null,null]);return i?this.where(i.name).equals(e[i.keyPath]).filter(s):n?this.filter(s):this.where(t).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,lg(e)?`[${e.join("+")}]`:e))}reverse(){return this.toCollection().reverse()}mapToClass(e){this.schema.mappedClass=e;let t=t=>{if(!t)return t;let n=Object.create(e.prototype);for(var r in t)if(lv(t,r))try{n[r]=t[r]}catch(e){}return n};return this.schema.readHook&&this.hook.reading.unsubscribe(this.schema.readHook),this.schema.readHook=t,this.hook("reading",t),e}defineClass(){return this.mapToClass(function(e){l_(this,e)})}add(e,t){let{auto:n,keyPath:r}=this.schema.primKey,a=e;return r&&n&&(a=um(r)(e)),this._trans("readwrite",e=>this.core.mutate({trans:e,type:"add",keys:null!=t?[t]:null,values:[a]})).then(e=>e.numFailures?cP.reject(e.failures[0]):e.lastResult).then(t=>{if(r)try{lT(e,r,t)}catch(e){}return t})}update(e,t){if("object"!=typeof e||lg(e))return this.where(":id").equals(e).modify(t);{let n=lN(e,this.schema.primKey.keyPath);if(void 0===n)return ue(new l8.InvalidArgument("Given object does not contain its primary key"));try{"function"!=typeof t?lh(t).forEach(n=>{lT(e,n,t[n])}):t(e,{value:e,primKey:n})}catch(e){}return this.where(":id").equals(n).modify(t)}}put(e,t){let{auto:n,keyPath:r}=this.schema.primKey,a=e;return r&&n&&(a=um(r)(e)),this._trans("readwrite",e=>this.core.mutate({trans:e,type:"put",values:[a],keys:null!=t?[t]:null})).then(e=>e.numFailures?cP.reject(e.failures[0]):e.lastResult).then(t=>{if(r)try{lT(e,r,t)}catch(e){}return t})}delete(e){return this._trans("readwrite",t=>this.core.mutate({trans:t,type:"delete",keys:[e]})).then(e=>e.numFailures?cP.reject(e.failures[0]):void 0)}clear(){return this._trans("readwrite",e=>this.core.mutate({trans:e,type:"deleteRange",range:uf})).then(e=>e.numFailures?cP.reject(e.failures[0]):void 0)}bulkGet(e){return this._trans("readonly",t=>this.core.getMany({keys:e,trans:t}).then(e=>e.map(e=>this.hook.reading.fire(e))))}bulkAdd(e,t,n){let r=Array.isArray(t)?t:void 0,a=(n=n||(r?void 0:t))?n.allKeys:void 0;return this._trans("readwrite",t=>{let{auto:n,keyPath:o}=this.schema.primKey;if(o&&r)throw new l8.InvalidArgument("bulkAdd(): keys argument invalid on tables with inbound keys");if(r&&r.length!==e.length)throw new l8.InvalidArgument("Arguments objects and keys must have the same length");let i=e.length,s=o&&n?e.map(um(o)):e;return this.core.mutate({trans:t,type:"add",keys:r,values:s,wantResults:a}).then(({numFailures:e,results:t,lastResult:n,failures:r})=>{if(0===e)return a?t:n;throw new l6(`${this.name}.bulkAdd(): ${e} of ${i} operations failed`,r)})})}bulkPut(e,t,n){let r=Array.isArray(t)?t:void 0,a=(n=n||(r?void 0:t))?n.allKeys:void 0;return this._trans("readwrite",t=>{let{auto:n,keyPath:o}=this.schema.primKey;if(o&&r)throw new l8.InvalidArgument("bulkPut(): keys argument invalid on tables with inbound keys");if(r&&r.length!==e.length)throw new l8.InvalidArgument("Arguments objects and keys must have the same length");let i=e.length,s=o&&n?e.map(um(o)):e;return this.core.mutate({trans:t,type:"put",keys:r,values:s,wantResults:a}).then(({numFailures:e,results:t,lastResult:n,failures:r})=>{if(0===e)return a?t:n;throw new l6(`${this.name}.bulkPut(): ${e} of ${i} operations failed`,r)})})}bulkDelete(e){let t=e.length;return this._trans("readwrite",t=>this.core.mutate({trans:t,type:"delete",keys:e})).then(({numFailures:e,lastResult:n,failures:r})=>{if(0===e)return n;throw new l6(`${this.name}.bulkDelete(): ${e} of ${t} operations failed`,r)})}}function ug(e){var t={},n=function(n,r){if(r){for(var a=arguments.length,o=Array(a-1);--a;)o[a-1]=arguments[a];return t[n].subscribe.apply(null,o),e}if("string"==typeof n)return t[n]};n.addEventType=o;for(var r=1,a=arguments.length;r<a;++r)o(arguments[r]);return n;function o(e,r,a){if("object"!=typeof e){r||(r=cl),a||(a=ct);var i={subscribers:[],fire:a,subscribe:function(e){-1===i.subscribers.indexOf(e)&&(i.subscribers.push(e),i.fire=r(i.fire,e))},unsubscribe:function(e){i.subscribers=i.subscribers.filter(function(t){return t!==e}),i.fire=i.subscribers.reduce(r,a)}};return t[e]=n[e]=i,i}lh(e).forEach(function(t){var n=e[t];if(lg(n))o(t,e[t][0],e[t][1]);else{if("asap"!==n)throw new l8.InvalidArgument("Invalid event config");var r=o(t,cn,function(){for(var e=arguments.length,t=Array(e);e--;)t[e]=arguments[e];r.subscribers.forEach(function(e){lP(function(){e.apply(null,t)})})})}})}}function u_(e,t){return lk(t).from({prototype:e}),t}function uy(e,t){return!(e.filter||e.algorithm||e.or)&&(t?e.justLimit:!e.replayFilter)}function ub(e,t){e.filter=up(e.filter,t)}function uv(e,t,n){var r=e.replayFilter;e.replayFilter=r?()=>up(r(),t()):t,e.justLimit=n&&!r}function u$(e,t){if(e.isPrimKey)return t.primaryKey;let n=t.getIndexByKeyPath(e.index);if(!n)throw new l8.Schema("KeyPath "+e.index+" on object store "+t.name+" is not indexed");return n}function uA(e,t,n){let r=u$(e,t.schema);return t.openCursor({trans:n,values:!e.keysOnly,reverse:"prev"===e.dir,unique:!!e.unique,query:{index:r,range:e.range}})}function uw(e,t,n,r){let a=e.replayFilter?up(e.filter,e.replayFilter()):e.filter;if(e.or){let o={},i=(e,n,r)=>{if(!a||a(n,r,e=>n.stop(e),e=>n.fail(e))){var i=n.primaryKey,s=""+i;"[object ArrayBuffer]"===s&&(s=""+new Uint8Array(i)),lv(o,s)||(o[s]=!0,t(e,n,r))}};return Promise.all([e.or._iterate(i,n),uk(uA(e,r,n),e.algorithm,i,!e.keysOnly&&e.valueMapper)])}return uk(uA(e,r,n),up(e.algorithm,a),t,!e.keysOnly&&e.valueMapper)}function uk(e,t,n,r){var a=cG(r?(e,t,a)=>n(r(e),t,a):n);return e.then(e=>{if(e)return e.start(()=>{var n=()=>e.continue();t&&!t(e,e=>n=e,t=>{e.stop(t),n=ct},t=>{e.fail(t),n=ct})||a(e.value,e,e=>n=e),n()})})}function ux(e,t){try{let n=uC(e),r=uC(t);if(n!==r)return"Array"===n?1:"Array"===r?-1:"binary"===n?1:"binary"===r?-1:"string"===n?1:"string"===r?-1:"Date"===n?1:"Date"!==r?NaN:-1;switch(n){case"number":case"Date":case"string":return e>t?1:e<t?-1:0;case"binary":return function(e,t){let n=e.length,r=t.length,a=n<r?n:r;for(let n=0;n<a;++n)if(e[n]!==t[n])return e[n]<t[n]?-1:1;return n===r?0:n<r?-1:1}(uE(e),uE(t));case"Array":return function(e,t){let n=e.length,r=t.length,a=n<r?n:r;for(let n=0;n<a;++n){let r=ux(e[n],t[n]);if(0!==r)return r}return n===r?0:n<r?-1:1}(e,t)}}catch(e){}return NaN}function uC(e){let t=typeof e;if("object"!==t)return t;if(ArrayBuffer.isView(e))return"binary";let n=lV(e);return"ArrayBuffer"===n?"binary":n}function uE(e){return e instanceof Uint8Array?e:ArrayBuffer.isView(e)?new Uint8Array(e.buffer,e.byteOffset,e.byteLength):new Uint8Array(e)}class uD{_read(e,t){var n=this._ctx;return n.error?n.table._trans(null,ue.bind(null,n.error)):n.table._trans("readonly",e).then(t)}_write(e){var t=this._ctx;return t.error?t.table._trans(null,ue.bind(null,t.error)):t.table._trans("readwrite",e,"locked")}_addAlgorithm(e){var t=this._ctx;t.algorithm=up(t.algorithm,e)}_iterate(e,t){return uw(this._ctx,e,t,this._ctx.table.core)}clone(e){var t=Object.create(this.constructor.prototype),n=Object.create(this._ctx);return e&&l_(n,e),t._ctx=n,t}raw(){return this._ctx.valueMapper=null,this}each(e){var t=this._ctx;return this._read(n=>uw(t,e,n,t.table.core))}count(e){return this._read(e=>{let t=this._ctx,n=t.table.core;if(uy(t,!0))return n.count({trans:e,query:{index:u$(t,n.schema),range:t.range}}).then(e=>Math.min(e,t.limit));var r=0;return uw(t,()=>(++r,!1),e,n).then(()=>r)}).then(e)}sortBy(e,t){let n=e.split(".").reverse(),r=n[0],a=n.length-1;function o(e,t){return t?o(e[n[t]],t-1):e[r]}var i="next"===this._ctx.dir?1:-1;function s(e,t){var n=o(e,a),r=o(t,a);return n<r?-i:n>r?i:0}return this.toArray(function(e){return e.sort(s)}).then(t)}toArray(e){return this._read(e=>{var t=this._ctx;if("next"===t.dir&&uy(t,!0)&&t.limit>0){let{valueMapper:n}=t,r=u$(t,t.table.core.schema);return t.table.core.query({trans:e,limit:t.limit,values:!0,query:{index:r,range:t.range}}).then(({result:e})=>n?e.map(n):e)}{let n=[];return uw(t,e=>n.push(e),e,t.table.core).then(()=>n)}},e)}offset(e){var t=this._ctx;return e<=0||(t.offset+=e,uy(t)?uv(t,()=>{var t=e;return(e,n)=>0===t||(1===t?--t:n(()=>{e.advance(t),t=0}),!1)}):uv(t,()=>{var t=e;return()=>--t<0})),this}limit(e){return this._ctx.limit=Math.min(this._ctx.limit,e),uv(this._ctx,()=>{var t=e;return function(e,n,r){return--t<=0&&n(r),t>=0}},!0),this}until(e,t){return ub(this._ctx,function(n,r,a){return!e(n.value)||(r(a),t)}),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 t;return ub(this._ctx,function(t){return e(t.value)}),(t=this._ctx).isMatch=up(t.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 t=this._ctx;return t.keysOnly=!t.isMatch,this.each(function(t,n){e(n.key,n)})}eachUniqueKey(e){return this._ctx.unique="unique",this.eachKey(e)}eachPrimaryKey(e){var t=this._ctx;return t.keysOnly=!t.isMatch,this.each(function(t,n){e(n.primaryKey,n)})}keys(e){var t=this._ctx;t.keysOnly=!t.isMatch;var n=[];return this.each(function(e,t){n.push(t.key)}).then(function(){return n}).then(e)}primaryKeys(e){var t=this._ctx;if("next"===t.dir&&uy(t,!0)&&t.limit>0)return this._read(e=>{var n=u$(t,t.table.core.schema);return t.table.core.query({trans:e,values:!1,limit:t.limit,query:{index:n,range:t.range}})}).then(({result:e})=>e).then(e);t.keysOnly=!t.isMatch;var n=[];return this.each(function(e,t){n.push(t.primaryKey)}).then(function(){return n}).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,t=e.index&&e.table.schema.idxByName[e.index];if(!t||!t.multi)return this;var n={};return ub(this._ctx,function(e){var t=e.primaryKey.toString(),r=lv(n,t);return n[t]=!0,!r}),this}modify(e){var t=this._ctx;return this._write(n=>{var r;if("function"==typeof e)r=e;else{var a=lh(e),o=a.length;r=function(t){for(var n=!1,r=0;r<o;++r){var i=a[r],s=e[i];lN(t,i)!==s&&(lT(t,i,s),n=!0)}return n}}let i=t.table.core,{outbound:s,extractKey:l}=i.schema.primaryKey,c=this.db._options.modifyChunkSize||200,u=[],d=0,p=[],f=(e,t)=>{let{failures:n,numFailures:r}=t;for(let t of(d+=e-r,lh(n)))u.push(n[t])};return this.clone().primaryKeys().then(a=>{let o=u=>{let d=Math.min(c,a.length-u);return i.getMany({trans:n,keys:a.slice(u,u+d),cache:"immutable"}).then(p=>{let m=[],h=[],g=s?[]:null,y=[];for(let e=0;e<d;++e){let t=p[e],n={value:lL(t),primKey:a[u+e]};!1!==r.call(n,n.value,n)&&(null==n.value?y.push(a[u+e]):s||0===ux(l(t),l(n.value))?(h.push(n.value),s&&g.push(a[u+e])):(y.push(a[u+e]),m.push(n.value)))}let b=uy(t)&&t.limit===1/0&&("function"!=typeof e||e===uS)&&{index:t.index,range:t.range};return Promise.resolve(m.length>0&&i.mutate({trans:n,type:"add",values:m}).then(e=>{for(let t in e.failures)y.splice(parseInt(t),1);f(m.length,e)})).then(()=>(h.length>0||b&&"object"==typeof e)&&i.mutate({trans:n,type:"put",keys:g,values:h,criteria:b,changeSpec:"function"!=typeof e&&e}).then(e=>f(h.length,e))).then(()=>(y.length>0||b&&e===uS)&&i.mutate({trans:n,type:"delete",keys:y,criteria:b}).then(e=>f(y.length,e))).then(()=>a.length>u+d&&o(u+c))})};return o(0).then(()=>{if(u.length>0)throw new l5("Error modifying one or more objects",u,d,p);return a.length})})})}delete(){var e=this._ctx,t=e.range;return uy(e)&&(e.isPrimKey&&!us||3===t.type)?this._write(n=>{let{primaryKey:r}=e.table.core.schema;return e.table.core.count({trans:n,query:{index:r,range:t}}).then(r=>e.table.core.mutate({trans:n,type:"deleteRange",range:t}).then(({failures:e,lastResult:t,results:n,numFailures:a})=>{if(a)throw new l5("Could not delete some values",Object.keys(e).map(t=>e[t]),r-a);return r-a}))}):this.modify(uS)}}let uS=(e,t)=>t.value=null;function uz(e,t){return e<t?-1:+(e!==t)}function uP(e,t){return e>t?-1:+(e!==t)}function uM(e,t,n){var r=e instanceof uB?new e.Collection(e):e;return r._ctx.error=n?new n(t):TypeError(t),r}function uN(e){return new e.Collection(e,()=>uI("")).limit(0)}function uT(e,t,n,r){var a,o,i,s,l,c,u,d=n.length;if(!n.every(e=>"string"==typeof e))return uM(e,uo);function p(e){a="next"===e?e=>e.toUpperCase():e=>e.toLowerCase(),o="next"===e?e=>e.toLowerCase():e=>e.toUpperCase(),i="next"===e?uz:uP;var t=n.map(function(e){return{lower:o(e),upper:a(e)}}).sort(function(e,t){return i(e.lower,t.lower)});s=t.map(function(e){return e.upper}),l=t.map(function(e){return e.lower}),c=e,u="next"===e?"":r}p("next");var f=new e.Collection(e,()=>uO(s[0],l[d-1]+r));f._ondirectionchange=function(e){p(e)};var m=0;return f._addAlgorithm(function(e,n,r){var a=e.key;if("string"!=typeof a)return!1;var p=o(a);if(t(p,l,m))return!0;for(var f=null,h=m;h<d;++h){var g=function(e,t,n,r,a,o){for(var i=Math.min(e.length,r.length),s=-1,l=0;l<i;++l){var c=t[l];if(c!==r[l])return 0>a(e[l],n[l])?e.substr(0,l)+n[l]+n.substr(l+1):0>a(e[l],r[l])?e.substr(0,l)+r[l]+n.substr(l+1):s>=0?e.substr(0,s)+t[s]+n.substr(s+1):null;0>a(e[l],c)&&(s=l)}return i<r.length&&"next"===o?e+n.substr(e.length):i<e.length&&"prev"===o?e.substr(0,n.length):s<0?null:e.substr(0,s)+r[s]+n.substr(s+1)}(a,p,s[h],l[h],i,c);null===g&&null===f?m=h+1:(null===f||i(f,g)>0)&&(f=g)}return n(null!==f?function(){e.continue(f+u)}:r),!1}),f}function uO(e,t,n,r){return{type:2,lower:e,upper:t,lowerOpen:n,upperOpen:r}}function uI(e){return{type:1,lower:e,upper:e}}class uB{get Collection(){return this._ctx.table.db.Collection}between(e,t,n,r){n=!1!==n,r=!0===r;try{return this._cmp(e,t)>0||0===this._cmp(e,t)&&(n||r)&&(!n||!r)?uN(this):new this.Collection(this,()=>uO(e,t,!n,!r))}catch(e){return uM(this,ua)}}equals(e){return null==e?uM(this,ua):new this.Collection(this,()=>uI(e))}above(e){return null==e?uM(this,ua):new this.Collection(this,()=>uO(e,void 0,!0))}aboveOrEqual(e){return null==e?uM(this,ua):new this.Collection(this,()=>uO(e,void 0,!1))}below(e){return null==e?uM(this,ua):new this.Collection(this,()=>uO(void 0,e,!1,!0))}belowOrEqual(e){return null==e?uM(this,ua):new this.Collection(this,()=>uO(void 0,e))}startsWith(e){return"string"!=typeof e?uM(this,uo):this.between(e,e+un,!0,!0)}startsWithIgnoreCase(e){return""===e?this.startsWith(e):uT(this,(e,t)=>0===e.indexOf(t[0]),[e],un)}equalsIgnoreCase(e){return uT(this,(e,t)=>e===t[0],[e],"")}anyOfIgnoreCase(){var e=lq.apply(lH,arguments);return 0===e.length?uN(this):uT(this,(e,t)=>-1!==t.indexOf(e),e,"")}startsWithAnyOfIgnoreCase(){var e=lq.apply(lH,arguments);return 0===e.length?uN(this):uT(this,(e,t)=>t.some(t=>0===e.indexOf(t)),e,un)}anyOf(){let e=lq.apply(lH,arguments),t=this._cmp;try{e.sort(t)}catch(e){return uM(this,ua)}if(0===e.length)return uN(this);let n=new this.Collection(this,()=>uO(e[0],e[e.length-1]));n._ondirectionchange=n=>{t="next"===n?this._ascending:this._descending,e.sort(t)};let r=0;return n._addAlgorithm((n,a,o)=>{let i=n.key;for(;t(i,e[r])>0;)if(++r===e.length)return a(o),!1;return 0===t(i,e[r])||(a(()=>{n.continue(e[r])}),!1)}),n}notEqual(e){return this.inAnyRange([[ur,e],[e,this.db._maxKey]],{includeLowers:!1,includeUppers:!1})}noneOf(){let e=lq.apply(lH,arguments);if(0===e.length)return new this.Collection(this);try{e.sort(this._ascending)}catch(e){return uM(this,ua)}let t=e.reduce((e,t)=>e?e.concat([[e[e.length-1][1],t]]):[[ur,t]],null);return t.push([e[e.length-1],this.db._maxKey]),this.inAnyRange(t,{includeLowers:!1,includeUppers:!1})}inAnyRange(e,t){let n=this._cmp,r=this._ascending,a=this._descending,o=this._min,i=this._max;if(0===e.length)return uN(this);if(!e.every(e=>void 0!==e[0]&&void 0!==e[1]&&0>=r(e[0],e[1])))return uM(this,"First argument to inAnyRange() must be an Array of two-value Arrays [lower,upper] where upper must not be lower than lower",l8.InvalidArgument);let s=!t||!1!==t.includeLowers,l=t&&!0===t.includeUppers,c,u=r;function d(e,t){return u(e[0],t[0])}try{(c=e.reduce(function(e,t){let r=0,a=e.length;for(;r<a;++r){let a=e[r];if(0>n(t[0],a[1])&&n(t[1],a[0])>0){a[0]=o(a[0],t[0]),a[1]=i(a[1],t[1]);break}}return r===a&&e.push(t),e},[])).sort(d)}catch(e){return uM(this,ua)}let p=0,f=l?e=>r(e,c[p][1])>0:e=>r(e,c[p][1])>=0,m=s?e=>a(e,c[p][0])>0:e=>a(e,c[p][0])>=0,h=f,g=new this.Collection(this,()=>uO(c[0][0],c[c.length-1][1],!s,!l));return g._ondirectionchange=e=>{"next"===e?(h=f,u=r):(h=m,u=a),c.sort(d)},g._addAlgorithm((e,t,n)=>{for(var a=e.key;h(a);)if(++p===c.length)return t(n),!1;return!!(!f(a)&&!m(a))||(0===this._cmp(a,c[p][1])||0===this._cmp(a,c[p][0])||t(()=>{u===r?e.continue(c[p][0]):e.continue(c[p][1])}),!1)}),g}startsWithAnyOf(){let e=lq.apply(lH,arguments);return e.every(e=>"string"==typeof e)?0===e.length?uN(this):this.inAnyRange(e.map(e=>[e,e+un])):uM(this,"startsWithAnyOf() only works with strings")}}function uR(e){return cG(function(t){return uj(t),e(t.target.error),!1})}function uj(e){e.stopPropagation&&e.stopPropagation(),e.preventDefault&&e.preventDefault()}let uF="storagemutated",uL="x-storagemutated-1",uW=ug(null,uF);class uV{_lock(){return lz(!cE.global),++this._reculock,1!==this._reculock||cE.global||(cE.lockOwnerFor=this),this}_unlock(){if(lz(!cE.global),0==--this._reculock)for(cE.global||(cE.lockOwnerFor=null);this._blockedFuncs.length>0&&!this._locked();){var e=this._blockedFuncs.shift();try{c5(e[1],e[0])}catch(e){}}return this}_locked(){return this._reculock&&cE.lockOwnerFor!==this}create(e){if(!this.mode)return this;let t=this.db.idbdb,n=this.db._state.dbOpenError;if(lz(!this.idbtrans),!e&&!t)switch(n&&n.name){case"DatabaseClosedError":throw new l8.DatabaseClosed(n);case"MissingAPIError":throw new l8.MissingAPI(n.message,n);default:throw new l8.OpenFailed(n)}if(!this.active)throw new l8.TransactionInactive;return lz(null===this._completion._state),(e=this.idbtrans=e||(this.db.core?this.db.core.transaction(this.storeNames,this.mode,{durability:this.chromeTransactionDurability}):t.transaction(this.storeNames,this.mode,{durability:this.chromeTransactionDurability}))).onerror=cG(t=>{uj(t),this._reject(e.error)}),e.onabort=cG(t=>{uj(t),this.active&&this._reject(new l8.Abort(e.error)),this.active=!1,this.on("abort").fire(t)}),e.oncomplete=cG(()=>{this.active=!1,this._resolve(),"mutatedParts"in e&&uW.storagemutated.fire(e.mutatedParts)}),this}_promise(e,t,n){if("readwrite"===e&&"readwrite"!==this.mode)return ue(new l8.ReadOnly("Transaction is readonly"));if(!this.active)return ue(new l8.TransactionInactive);if(this._locked())return new cP((r,a)=>{this._blockedFuncs.push([()=>{this._promise(e,t,n).then(r,a)},cE])});if(n)return cJ(()=>{var e=new cP((e,n)=>{this._lock();let r=t(e,n,this);r&&r.then&&r.then(e,n)});return e.finally(()=>this._unlock()),e._lib=!0,e});var r=new cP((e,n)=>{var r=t(e,n,this);r&&r.then&&r.then(e,n)});return r._lib=!0,r}_root(){return this.parent?this.parent._root():this}waitFor(e){var t=this._root();let n=cP.resolve(e);if(t._waitingFor)t._waitingFor=t._waitingFor.then(()=>n);else{t._waitingFor=n,t._waitingQueue=[];var r=t.idbtrans.objectStore(t.storeNames[0]);!function e(){for(++t._spinCount;t._waitingQueue.length;)t._waitingQueue.shift()();t._waitingFor&&(r.get(-1/0).onsuccess=e)}()}var a=t._waitingFor;return new cP((e,r)=>{n.then(n=>t._waitingQueue.push(cG(e.bind(null,n))),e=>t._waitingQueue.push(cG(r.bind(null,e)))).finally(()=>{t._waitingFor===a&&(t._waitingFor=null)})})}abort(){this.active&&(this.active=!1,this.idbtrans&&this.idbtrans.abort(),this._reject(new l8.Abort))}table(e){let t=this._memoizedTables||(this._memoizedTables={});if(lv(t,e))return t[e];let n=this.schema[e];if(!n)throw new l8.NotFound("Table "+e+" not part of transaction");let r=new this.db.Table(e,n,this);return r.core=this.db.core.table(e),t[e]=r,r}}function uG(e,t,n,r,a,o,i){return{name:e,keyPath:t,unique:n,multi:r,auto:a,compound:o,src:(n&&!i?"&":"")+(r?"*":"")+(a?"++":"")+uU(t)}}function uU(e){return"string"==typeof e?e:e?"["+[].join.call(e,"+")+"]":""}function uH(e,t,n){return{name:e,primKey:t,indexes:n,mappedClass:null,idxByName:lM(n,e=>[e.name,e])}}let uq=e=>{try{return e.only([[]]),uq=()=>[[]],[[]]}catch(e){return uq=()=>un,un}};function uK(e){return null==e?()=>{}:"string"==typeof e?1===e.split(".").length?t=>t[e]:t=>lN(t,e):t=>lN(t,e)}function uZ(e){return[].slice.call(e)}let uY=0;function uJ(e){return null==e?":id":"string"==typeof e?e:`[${e.join("+")}]`}function uX({_novip:e},t){let n=t.db,r=function(e,t,{IDBKeyRange:n,indexedDB:r},a){var o;return{dbcore:(o=function(e,t,n){let r;function a(e){if(3===e.type)return null;if(4===e.type)throw Error("Cannot convert never type to IDBKeyRange");let{lower:n,upper:r,lowerOpen:a,upperOpen:o}=e;return void 0===n?void 0===r?null:t.upperBound(r,!!o):void 0===r?t.lowerBound(n,!!a):t.bound(n,r,!!a,!!o)}let{schema:o,hasGetAll:i}=(r=uZ(e.objectStoreNames),{schema:{name:e.name,tables:r.map(e=>n.objectStore(e)).map(e=>{let{keyPath:t,autoIncrement:n}=e,r=lg(t),a=null==t,o={},i={name:e.name,primaryKey:{name:null,isPrimaryKey:!0,outbound:a,compound:r,keyPath:t,autoIncrement:n,unique:!0,extractKey:uK(t)},indexes:uZ(e.indexNames).map(t=>e.index(t)).map(e=>{let{name:t,unique:n,multiEntry:r,keyPath:a}=e,i={name:t,compound:lg(a),keyPath:a,unique:n,multiEntry:r,extractKey:uK(a)};return o[uJ(a)]=i,i}),getIndexByKeyPath:e=>o[uJ(e)]};return o[":id"]=i.primaryKey,null!=t&&(o[uJ(t)]=i.primaryKey),i})},hasGetAll:r.length>0&&"getAll"in n.objectStore(r[0])&&!("u">typeof navigator&&/Safari/.test(navigator.userAgent)&&!/(Chrome\/|Edge\/)/.test(navigator.userAgent)&&[].concat(navigator.userAgent.match(/Safari\/(\d*)/))[1]<604)}),s=o.tables.map(e=>{let t;return{name:t=e.name,schema:e,mutate:function({trans:e,type:n,keys:r,values:o,range:i}){return new Promise((s,l)=>{let c;s=cG(s);let u=e.objectStore(t),d=null==u.keyPath,p="put"===n||"add"===n;if(!p&&"delete"!==n&&"deleteRange"!==n)throw Error("Invalid operation type: "+n);let{length:f}=r||o||{length:1};if(r&&o&&r.length!==o.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 m=[],h=[],g=0,y=e=>{++g,uj(e)};if("deleteRange"===n){if(4===i.type)return s({numFailures:g,failures:h,results:[],lastResult:void 0});3===i.type?m.push(c=u.clear()):m.push(c=u.delete(a(i)))}else{let[e,t]=p?d?[o,r]:[o,null]:[r,null];if(p)for(let r=0;r<f;++r)m.push(c=t&&void 0!==t[r]?u[n](e[r],t[r]):u[n](e[r])),c.onerror=y;else for(let t=0;t<f;++t)m.push(c=u[n](e[t])),c.onerror=y}let b=e=>{let t=e.target.result;m.forEach((e,t)=>null!=e.error&&(h[t]=e.error)),s({numFailures:g,failures:h,results:"delete"===n?r:m.map(e=>e.result),lastResult:t})};c.onerror=e=>{y(e),b(e)},c.onsuccess=b})},getMany:({trans:e,keys:n})=>new Promise((r,a)=>{r=cG(r);let o=e.objectStore(t),i=n.length,s=Array(i),l,c=0,u=0,d=e=>{let t=e.target;s[t._pos]=t.result,++u===c&&r(s)},p=uR(a);for(let e=0;e<i;++e)null!=n[e]&&((l=o.get(n[e]))._pos=e,l.onsuccess=d,l.onerror=p,++c);0===c&&r(s)}),get:({trans:e,key:n})=>new Promise((r,a)=>{r=cG(r);let o=e.objectStore(t).get(n);o.onsuccess=e=>r(e.target.result),o.onerror=uR(a)}),query:e=>new Promise((n,r)=>{n=cG(n);let{trans:o,values:s,limit:l,query:c}=e,u=l===1/0?void 0:l,{index:d,range:p}=c,f=o.objectStore(t),m=d.isPrimaryKey?f:f.index(d.name),h=a(p);if(0===l)return n({result:[]});if(i){let e=s?m.getAll(h,u):m.getAllKeys(h,u);e.onsuccess=e=>n({result:e.target.result}),e.onerror=uR(r)}else{let e=0,t=!s&&"openKeyCursor"in m?m.openKeyCursor(h):m.openCursor(h),a=[];t.onsuccess=r=>{let o=t.result;return o?(a.push(s?o.value:o.primaryKey),++e===l?n({result:a}):void o.continue()):n({result:a})},t.onerror=uR(r)}}),openCursor:function({trans:e,values:n,query:r,reverse:o,unique:i}){return new Promise((s,l)=>{s=cG(s);let{index:c,range:u}=r,d=e.objectStore(t),p=c.isPrimaryKey?d:d.index(c.name),f=o?i?"prevunique":"prev":i?"nextunique":"next",m=!n&&"openKeyCursor"in p?p.openKeyCursor(a(u),f):p.openCursor(a(u),f);m.onerror=uR(l),m.onsuccess=cG(t=>{let n=m.result;if(!n)return void s(null);n.___id=++uY,n.done=!1;let r=n.continue.bind(n),a=n.continuePrimaryKey;a&&(a=a.bind(n));let o=n.advance.bind(n),i=()=>{throw Error("Cursor not stopped")};n.trans=e,n.stop=n.continue=n.continuePrimaryKey=n.advance=()=>{throw Error("Cursor not started")},n.fail=cG(l),n.next=function(){let e=1;return this.start(()=>e--?this.continue():this.stop()).then(()=>this)},n.start=e=>{let t=new Promise((e,t)=>{e=cG(e),m.onerror=uR(t),n.fail=t,n.stop=t=>{n.stop=n.continue=n.continuePrimaryKey=n.advance=i,e(t)}}),s=()=>{if(m.result)try{e()}catch(e){n.fail(e)}else n.done=!0,n.start=()=>{throw Error("Cursor behind last entry")},n.stop()};return m.onsuccess=cG(e=>{m.onsuccess=s,s()}),n.continue=r,n.continuePrimaryKey=a,n.advance=o,s(),t},s(n)},l)})},count({query:e,trans:n}){let{index:r,range:o}=e;return new Promise((e,i)=>{let s=n.objectStore(t),l=r.isPrimaryKey?s:s.index(r.name),c=a(o),u=c?l.count(c):l.count();u.onsuccess=cG(t=>e(t.target.result)),u.onerror=uR(i)})}}}),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:uq(t),schema:o}}(t,n,a),e.dbcore.reduce((e,{create:t})=>({...e,...t(e)}),o))}}(e._middlewares,n,e._deps,t);e.core=r.dbcore,e.tables.forEach(t=>{let n=t.name;e.core.schema.tables.some(e=>e.name===n)&&(t.core=e.core.table(n),e[n]instanceof e.Table&&(e[n].core=t.core))})}function uQ({_novip:e},t,n,r){n.forEach(n=>{let a=r[n];t.forEach(t=>{let r=lC(t,n);(!r||"value"in r&&void 0===r.value)&&(t===e.Transaction.prototype||t instanceof e.Transaction?lw(t,n,{get(){return this.table(n)},set(e){lA(this,n,{value:e,writable:!0,configurable:!0,enumerable:!0})}}):t[n]=new e.Table(n,a))})})}function u0({_novip:e},t){t.forEach(t=>{for(let n in t)t[n]instanceof e.Table&&delete t[n]})}function u1(e,t){return e._cfg.version-t._cfg.version}function u2(e,t){let n,r={del:[],add:[],change:[]};for(n in e)t[n]||r.del.push(n);for(n in t){let a=e[n],o=t[n];if(a){let e={name:n,def:o,recreate:!1,del:[],add:[],change:[]};if(""+(a.primKey.keyPath||"")==""+(o.primKey.keyPath||"")&&(a.primKey.auto===o.primKey.auto||us)){let t,n=a.idxByName,i=o.idxByName;for(t in n)i[t]||e.del.push(t);for(t in i){let r=n[t],a=i[t];r?r.src!==a.src&&e.change.push(a):e.add.push(a)}(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([n,o])}return r}function u3(e,t,n,r){let a=e.db.createObjectStore(t,n.keyPath?{keyPath:n.keyPath,autoIncrement:n.auto}:{autoIncrement:n.auto});return r.forEach(e=>u4(a,e)),a}function u4(e,t){e.createIndex(t.name,t.keyPath,{unique:t.unique,multiEntry:t.multi})}function u5(e,t,n){let r={};return lD(t.objectStoreNames,0).forEach(e=>{let t=n.objectStore(e),a=t.keyPath,o=uG(uU(a),a||"",!1,!1,!!t.autoIncrement,a&&"string"!=typeof a,!0),i=[];for(let e=0;e<t.indexNames.length;++e){let n=t.index(t.indexNames[e]);a=n.keyPath;var s=uG(n.name,a,!!n.unique,!!n.multiEntry,!1,a&&"string"!=typeof a,!1);i.push(s)}r[e]=uH(e,o,i)}),r}function u6({_novip:e},t,n){let r=n.db.objectStoreNames;for(let a=0;a<r.length;++a){let o=r[a],i=n.objectStore(o);e._hasGetAll="getAll"in i;for(let e=0;e<i.indexNames.length;++e){let n=i.indexNames[e],r=i.index(n).keyPath,a="string"==typeof r?r:"["+lD(r).join("+")+"]";if(t[o]){let e=t[o].idxByName[a];e&&(e.name=n,delete t[o].idxByName[a],t[o].idxByName[n]=e)}}}"u">typeof navigator&&/Safari/.test(navigator.userAgent)&&!/(Chrome\/|Edge\/)/.test(navigator.userAgent)&&lm.WorkerGlobalScope&&lm instanceof lm.WorkerGlobalScope&&[].concat(navigator.userAgent.match(/Safari\/(\d*)/))[1]<604&&(e._hasGetAll=!1)}class u7{_parseStoresSpec(e,t){lh(e).forEach(n=>{if(null!==e[n]){var r=e[n].split(",").map((e,t)=>{let n=(e=e.trim()).replace(/([&*]|\+\+)/g,""),r=/^\[/.test(n)?n.match(/^\[(.*)\]$/)[1].split("+"):n;return uG(n,r||null,/\&/.test(e),/\*/.test(e),/\+\+/.test(e),lg(r),0===t)}),a=r.shift();if(a.multi)throw new l8.Schema("Primary key cannot be multi-valued");r.forEach(e=>{if(e.auto)throw new l8.Schema("Only primary key can be marked as autoIncrement (++)");if(!e.keyPath)throw new l8.Schema("Index must have a name and cannot be an empty string")}),t[n]=uH(n,a,r)}})}stores(e){let t=this.db;this._cfg.storesSource=this._cfg.storesSource?l_(this._cfg.storesSource,e):e;let n=t._versions,r={},a={};return n.forEach(e=>{l_(r,e._cfg.storesSource),a=e._cfg.dbschema={},e._parseStoresSpec(r,a)}),t._dbSchema=a,u0(t,[t._allTables,t,t.Transaction.prototype]),uQ(t,[t._allTables,t,t.Transaction.prototype,this._cfg.tables],lh(a),a),t._storeNames=lh(a),this}upgrade(e){return this._cfg.contentUpgrade=cc(this._cfg.contentUpgrade||ct,e),this}}function u8(e,t){let n=e._dbNamesDB;return n||(n=e._dbNamesDB=new dy(uc,{addons:[],indexedDB:e,IDBKeyRange:t})).version(1).stores({dbnames:"name"}),n.table("dbnames")}function u9(e){return e&&"function"==typeof e.databases}function de(e){return cJ(function(){return cE.letThrough=!0,e()})}function dt(e){var t=t=>e.next(t),n=a(t),r=a(t=>e.throw(t));function a(e){return t=>{var a=e(t),o=a.value;return a.done?o:o&&"function"==typeof o.then?o.then(n,r):lg(o)?Promise.all(o).then(n,r):n(o)}}return a(t)()}function dn(e,t,n){var r=arguments.length;if(r<2)throw new l8.InvalidArgument("Too few arguments");for(var a=Array(r-1);--r;)a[r-1]=arguments[r];return n=a.pop(),[e,lB(a),n]}function dr(e,t,n){let r=lg(e)?e.slice():[e];for(let e=0;e<n;++e)r.push(t);return r}let da={stack:"dbcore",name:"VirtualIndexMiddleware",level:1,create:function(e){return{...e,table(t){let n=e.table(t),{schema:r}=n,a={},o=[];function i(e,t,n){let r=uJ(e),s=a[r]=a[r]||[],l=null==e?0:"string"==typeof e?1:e.length,c=t>0,u={...n,isVirtual:c,keyTail:t,keyLength:l,extractKey:uK(e),unique:!c&&n.unique};return s.push(u),u.isPrimaryKey||o.push(u),l>1&&i(2===l?e[0]:e.slice(0,l-1),t+1,n),s.sort((e,t)=>e.keyTail-t.keyTail),u}let s=i(r.primaryKey.keyPath,0,r.primaryKey);for(let e of(a[":id"]=[s],r.indexes))i(e.keyPath,0,e);function l(t){var n,r;let a=t.query.index;return a.isVirtual?{...t,query:{index:a,range:(n=t.query.range,r=a.keyTail,{type:1===n.type?2:n.type,lower:dr(n.lower,n.lowerOpen?e.MAX_KEY:e.MIN_KEY,r),lowerOpen:!0,upper:dr(n.upper,n.upperOpen?e.MIN_KEY:e.MAX_KEY,r),upperOpen:!0})}}:t}return{...n,schema:{...r,primaryKey:s,indexes:o,getIndexByKeyPath:function(e){let t=a[uJ(e)];return t&&t[0]}},count:e=>n.count(l(e)),query:e=>n.query(l(e)),openCursor(t){let{keyTail:r,isVirtual:a,keyLength:o}=t.query.index;return a?n.openCursor(l(t)).then(n=>n&&Object.create(n,{continue:{value:function(a){null!=a?n.continue(dr(a,t.reverse?e.MAX_KEY:e.MIN_KEY,r)):t.unique?n.continue(n.key.slice(0,o).concat(t.reverse?e.MIN_KEY:e.MAX_KEY,r)):n.continue()}},continuePrimaryKey:{value(t,a){n.continuePrimaryKey(dr(t,e.MAX_KEY,r),a)}},primaryKey:{get:()=>n.primaryKey},key:{get(){let e=n.key;return 1===o?e[0]:e.slice(0,o)}},value:{get:()=>n.value}})):n.openCursor(t)}}}}}};function di(e,t,n,r){return n=n||{},r=r||"",lh(e).forEach(a=>{if(lv(t,a)){var o=e[a],i=t[a];if("object"==typeof o&&"object"==typeof i&&o&&i){let e=lV(o);e!==lV(i)?n[r+a]=t[a]:"Object"===e?di(o,i,n,r+a+"."):o!==i&&(n[r+a]=t[a])}else o!==i&&(n[r+a]=t[a])}else n[r+a]=void 0}),lh(t).forEach(a=>{lv(e,a)||(n[r+a]=t[a])}),n}let ds={stack:"dbcore",name:"HooksMiddleware",level:2,create:e=>({...e,table(t){let n=e.table(t),{primaryKey:r}=n.schema;return{...n,mutate(e){let a=cE.trans,{deleting:o,creating:i,updating:s}=a.table(t).hook;switch(e.type){case"add":if(i.fire===ct)break;return a._promise("readwrite",()=>l(e),!0);case"put":if(i.fire===ct&&s.fire===ct)break;return a._promise("readwrite",()=>l(e),!0);case"delete":if(o.fire===ct)break;return a._promise("readwrite",()=>l(e),!0);case"deleteRange":if(o.fire===ct)break;return a._promise("readwrite",()=>(function e(t,a,o){return n.query({trans:t,values:!1,query:{index:r,range:a},limit:o}).then(({result:n})=>l({type:"delete",keys:n,trans:t}).then(r=>r.numFailures>0?Promise.reject(r.failures[0]):n.length<o?{failures:[],numFailures:0,lastResult:void 0}:e(t,{...a,lower:n[n.length-1],lowerOpen:!0},o)))})(e.trans,e.range,1e4),!0)}return n.mutate(e);function l(e){var t,a;let l=cE.trans,c=e.keys||("delete"===(t=e).type?t.keys:t.keys||t.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"===(a=e).type?Promise.resolve([]):n.getMany({trans:a.trans,keys:c,cache:"immutable"})).then(t=>{let a=c.map((n,a)=>{let c=t[a],u={onerror:null,onsuccess:null};if("delete"===e.type)o.fire.call(u,n,c,l);else if("add"===e.type||void 0===c){let t=i.fire.call(u,n,e.values[a],l);null==n&&null!=t&&(n=t,e.keys[a]=n,r.outbound||lT(e.values[a],r.keyPath,n))}else{let t=di(c,e.values[a]),r=s.fire.call(u,t,n,c,l);if(r){let t=e.values[a];Object.keys(r).forEach(e=>{lv(t,e)?t[e]=r[e]:lT(t,e,r[e])})}}return u});return n.mutate(e).then(({failures:n,results:r,numFailures:o,lastResult:i})=>{for(let o=0;o<c.length;++o){let i=r?r[o]:c[o],s=a[o];null==i?s.onerror&&s.onerror(n[o]):s.onsuccess&&s.onsuccess("put"===e.type&&t[o]?e.values[o]:i)}return{failures:n,results:r,numFailures:o,lastResult:i}}).catch(e=>(a.forEach(t=>t.onerror&&t.onerror(e)),Promise.reject(e)))})}}}}})};function dl(e,t,n){try{if(!t||t.keys.length<e.length)return null;let r=[];for(let a=0,o=0;a<t.keys.length&&o<e.length;++a)0===ux(t.keys[a],e[o])&&(r.push(n?lL(t.values[a]):t.values[a]),++o);return r.length===e.length?r:null}catch(e){return null}}let dc={stack:"dbcore",level:-1,create:e=>({table:t=>{let n=e.table(t);return{...n,getMany:e=>{if(!e.cache)return n.getMany(e);let t=dl(e.keys,e.trans._cache,"clone"===e.cache);return t?cP.resolve(t):n.getMany(e).then(t=>(e.trans._cache={keys:e.keys,values:"clone"===e.cache?lL(t):t},t))},mutate:e=>("add"!==e.type&&(e.trans._cache=null),n.mutate(e))}}})};function du(e){return!("from"in e)}let dd=function(e,t){if(!this){let t=new dd;return e&&"d"in e&&l_(t,e),t}l_(this,arguments.length?{d:1,from:e,to:arguments.length>1?t:e}:{d:0})};function dp(e,t,n){let r=ux(t,n);if(isNaN(r))return;if(r>0)throw RangeError();if(du(e))return l_(e,{from:t,to:n,d:1});let a=e.l,o=e.r;if(0>ux(n,e.from))return a?dp(a,t,n):e.l={from:t,to:n,d:1,l:null,r:null},dh(e);if(ux(t,e.to)>0)return o?dp(o,t,n):e.r={from:t,to:n,d:1,l:null,r:null},dh(e);0>ux(t,e.from)&&(e.from=t,e.l=null,e.d=o?o.d+1:1),ux(n,e.to)>0&&(e.to=n,e.r=null,e.d=e.l?e.l.d+1:1);let i=!e.r;a&&!e.l&&df(e,a),o&&i&&df(e,o)}function df(e,t){du(t)||function e(t,{from:n,to:r,l:a,r:o}){dp(t,n,r),a&&e(t,a),o&&e(t,o)}(e,t)}function dm(e){let t=du(e)?null:{s:0,n:e};return{next(e){let n=arguments.length>0;for(;t;)switch(t.s){case 0:if(t.s=1,n)for(;t.n.l&&0>ux(e,t.n.from);)t={up:t,n:t.n.l,s:1};else for(;t.n.l;)t={up:t,n:t.n.l,s:1};case 1:if(t.s=2,!n||0>=ux(e,t.n.to))return{value:t.n,done:!1};case 2:if(t.n.r){t.s=3,t={up:t,n:t.n.r,s:0};continue}case 3:t=t.up}return{done:!0}}}}function dh(e){var t,n;let r=((null==(t=e.r)?void 0:t.d)||0)-((null==(n=e.l)?void 0:n.d)||0),a=r>1?"r":r<-1?"l":"";if(a){let t="r"===a?"l":"r",n={...e},r=e[a];e.from=r.from,e.to=r.to,e[a]=r[a],n[a]=r[t],e[t]=n,n.d=dg(n)}e.d=dg(e)}function dg({r:e,l:t}){return(e?t?Math.max(e.d,t.d):e.d:t?t.d:0)+1}l$(dd.prototype,{add(e){return df(this,e),this},addKey(e){return dp(this,e,e),this},addKeys(e){return e.forEach(e=>dp(this,e,e)),this},[lG](){return dm(this)}});let d_={stack:"dbcore",level:0,create:e=>{let t=e.schema.name,n=new dd(e.MIN_KEY,e.MAX_KEY);return{...e,table:r=>{let a=e.table(r),{schema:o}=a,{primaryKey:i}=o,{extractKey:s,outbound:l}=i,c={...a,mutate:e=>{let i=e.trans,s=i.mutatedParts||(i.mutatedParts={}),l=e=>{let n=`idb://${t}/${r}/${e}`;return s[n]||(s[n]=new dd)},c=l(""),u=l(":dels"),{type:d}=e,[p,f]="deleteRange"===e.type?[e.range]:"delete"===e.type?[e.keys]:e.values.length<50?[[],e.values]:[],m=e.trans._cache;return a.mutate(e).then(e=>{if(lg(p)){"delete"!==d&&(p=e.results),c.addKeys(p);let t=dl(p,m);t||"add"===d||u.addKeys(p),(t||f)&&o.indexes.forEach(function(e){let n=l(e.name||"");function r(t){return null!=t?e.extractKey(t):null}let a=t=>e.multiEntry&&lg(t)?t.forEach(e=>n.addKey(e)):n.addKey(t);(t||f).forEach((e,n)=>{let o=t&&r(t[n]),i=f&&r(f[n]);0!==ux(o,i)&&(null!=o&&a(o),null!=i&&a(i))})})}else if(p){let e={from:p.lower,to:p.upper};u.add(e),c.add(e)}else c.add(n),u.add(n),o.indexes.forEach(e=>l(e.name).add(n));return e})}},u=({query:{index:t,range:n}})=>{var r,a;return[t,new dd(null!=(r=n.lower)?r:e.MIN_KEY,null!=(a=n.upper)?a:e.MAX_KEY)]},d={get:e=>[i,new dd(e.key)],getMany:e=>[i,(new dd).addKeys(e.keys)],count:u,query:u,openCursor:u};return lh(d).forEach(e=>{c[e]=function(o){let{subscr:i}=cE;if(i){let c=e=>{let n=`idb://${t}/${r}/${e}`;return i[n]||(i[n]=new dd)},u=c(""),p=c(":dels"),[f,m]=d[e](o);if(c(f.name||"").add(m),!f.isPrimaryKey){if("count"!==e){let t="query"===e&&l&&o.values&&a.query({...o,values:!1});return a[e].apply(this,arguments).then(n=>{if("query"===e){if(l&&o.values)return t.then(({result:e})=>(u.addKeys(e),n));let e=o.values?n.result.map(s):n.result;o.values?u.addKeys(e):p.addKeys(e)}else if("openCursor"===e){let e=o.values;return n&&Object.create(n,{key:{get:()=>(p.addKey(n.primaryKey),n.key)},primaryKey:{get(){let e=n.primaryKey;return p.addKey(e),e}},value:{get:()=>(e&&u.addKey(n.primaryKey),n.value)}})}return n})}p.add(n)}}return a[e].apply(this,arguments)}}),c}}}};class dy{constructor(e,t){var n;this._middlewares={},this.verno=0;const r=dy.dependencies;this._options=t={addons:dy.addons,autoOpen:!0,indexedDB:r.indexedDB,IDBKeyRange:r.IDBKeyRange,...t},this._deps={indexedDB:t.indexedDB,IDBKeyRange:t.IDBKeyRange};const{addons:a}=t;this._dbSchema={},this._versions=[],this._storeNames=[],this._allTables={},this.idbdb=null,this._novip=this;const o={dbOpenError:null,isBeingOpened:!1,onReadyBeingFired:null,openComplete:!1,dbReadyResolve:ct,dbReadyPromise:null,cancelOpen:ct,openCanceller:null,autoSchema:!0,PR1398_maxLoop:3};o.dbReadyPromise=new cP(e=>{o.dbReadyResolve=e}),o.openCanceller=new cP((e,t)=>{o.cancelOpen=t}),this._state=o,this.name=e,this.on=ug(this,"populate","blocked","versionchange","close",{ready:[cc,ct]}),this.on.ready.subscribe=lS(this.on.ready.subscribe,e=>(t,n)=>{dy.vip(()=>{let r=this._state;if(r.openComplete)r.dbOpenError||cP.resolve().then(t),n&&e(t);else if(r.onReadyBeingFired)r.onReadyBeingFired.push(t),n&&e(t);else{e(t);let r=this;n||e(function e(){r.on.ready.unsubscribe(t),r.on.ready.unsubscribe(e)})}})}),this.Collection=(n=this,u_(uD.prototype,function(e,t){this.db=n;let r=uf,a=null;if(t)try{r=t()}catch(e){a=e}let o=e._ctx,i=o.table,s=i.hook.reading.fire;this._ctx={table:i,index:o.index,isPrimKey:!o.index||i.schema.primKey.keyPath&&o.index===i.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:a,or:o.or,valueMapper:s!==cn?s:null}})),this.Table=function(e){return u_(uh.prototype,function(t,n,r){this.db=e,this._tx=r,this.name=t,this.schema=n,this.hook=e._allTables[t]?e._allTables[t].hook:ug(null,{creating:[co,ct],reading:[cr,cn],updating:[cs,ct],deleting:[ci,ct]})})}(this),this.Transaction=function(e){return u_(uV.prototype,function(t,n,r,a,o){this.db=e,this.mode=t,this.storeNames=n,this.schema=r,this.chromeTransactionDurability=a,this.idbtrans=null,this.on=ug(this,"complete","error","abort"),this.parent=o||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 cP((e,t)=>{this._resolve=e,this._reject=t}),this._completion.then(()=>{this.active=!1,this.on.complete.fire()},e=>{var t=this.active;return this.active=!1,this.on.error.fire(e),this.parent?this.parent._reject(e):t&&this.idbtrans&&this.idbtrans.abort(),ue(e)})})}(this),this.Version=function(e){return u_(u7.prototype,function(t){this.db=e,this._cfg={version:t,storesSource:null,dbschema:{},tables:{},contentUpgrade:null}})}(this),this.WhereClause=function(e){return u_(uB.prototype,function(t,n,r){this.db=e,this._ctx={table:t,index:":id"===n?null:n,or:r};let a=e._deps.indexedDB;if(!a)throw new l8.MissingAPI;this._cmp=this._ascending=a.cmp.bind(a),this._descending=(e,t)=>a.cmp(t,e),this._max=(e,t)=>a.cmp(e,t)>0?e:t,this._min=(e,t)=>0>a.cmp(e,t)?e:t,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=uq(t.IDBKeyRange),this._createTransaction=(e,t,n,r)=>new this.Transaction(e,t,n,this._options.chromeTransactionDurability,r),this._fireOnBlocked=e=>{this.on("blocked").fire(e),ui.filter(e=>e.name===this.name&&e!==this&&!e._state.vcFired).map(t=>t.on("versionchange").fire(e))},this.use(da),this.use(ds),this.use(d_),this.use(dc),this.vip=Object.create(this,{_vip:{value:!0}}),a.forEach(e=>e(this))}version(e){if(isNaN(e)||e<.1)throw new l8.Type("Given version is not a positive number");if(e=Math.round(10*e)/10,this.idbdb||this._state.isBeingOpened)throw new l8.Schema("Cannot add version when database is open");this.verno=Math.max(this.verno,e);let t=this._versions;var n=t.filter(t=>t._cfg.version===e)[0];return n||(n=new this.Version(e),t.push(n),t.sort(u1),n.stores({}),this._state.autoSchema=!1,n)}_whenReady(e){return this.idbdb&&(this._state.openComplete||cE.letThrough||this._vip)?e():new cP((e,t)=>{if(this._state.openComplete)return t(new l8.DatabaseClosed(this._state.dbOpenError));if(!this._state.isBeingOpened){if(!this._options.autoOpen)return void t(new l8.DatabaseClosed);this.open().catch(ct)}this._state.dbReadyPromise.then(e,t)}).then(e)}use({stack:e,create:t,level:n,name:r}){r&&this.unuse({stack:e,name:r});let a=this._middlewares[e]||(this._middlewares[e]=[]);return a.push({stack:e,create:t,level:null==n?10:n,name:r}),a.sort((e,t)=>e.level-t.level),this}unuse({stack:e,name:t,create:n}){return e&&this._middlewares[e]&&(this._middlewares[e]=this._middlewares[e].filter(e=>n?e.create!==n:!!t&&e.name!==t)),this}open(){return function(e){var t;let n=e._state,{indexedDB:r}=e._deps;if(n.isBeingOpened||e.idbdb)return n.dbReadyPromise.then(()=>n.dbOpenError?ue(n.dbOpenError):e);lZ&&(n.openCanceller._stackHolder=lX()),n.isBeingOpened=!0,n.dbOpenError=null,n.openComplete=!1;let a=n.openCanceller;function o(){if(n.openCanceller!==a)throw new l8.DatabaseClosed("db.open() was cancelled")}let i=n.dbReadyResolve,s=null,l=!1,c=()=>new cP((t,a)=>{if(o(),!r)throw new l8.MissingAPI;let i=e.name,c=n.autoSchema?r.open(i):r.open(i,Math.round(10*e.verno));if(!c)throw new l8.MissingAPI;c.onerror=uR(a),c.onblocked=cG(e._fireOnBlocked),c.onupgradeneeded=cG(t=>{if(s=c.transaction,n.autoSchema&&!e._options.allowEmptyDB){c.onerror=uj,s.abort(),c.result.close();let e=r.deleteDatabase(i);e.onsuccess=e.onerror=cG(()=>{a(new l8.NoSuchDatabase(`Database ${i} doesnt exist`))})}else{let n,r,i,p;s.onerror=uR(a);var o,u,d=t.oldVersion>0x4000000000000000?0:t.oldVersion;l=d<1,e._novip.idbdb=c.result,o=d/10,u=s,n=e._dbSchema,(r=e._createTransaction("readwrite",e._storeNames,n)).create(u),r._completion.catch(a),i=r._reject.bind(r),p=cE.transless||cE,cJ(()=>{cE.trans=r,cE.transless=p,0===o?(lh(n).forEach(e=>{u3(u,e,n[e].primKey,n[e].indexes)}),uX(e,u),cP.follow(()=>e.on.populate.fire(r)).catch(i)):(function({_novip:e},t,n,r){let a=[],o=e._versions,i=e._dbSchema=u5(e,e.idbdb,r),s=!1;return o.filter(e=>e._cfg.version>=t).forEach(o=>{a.push(()=>{let a=i,l=o._cfg.dbschema;u6(e,a,r),u6(e,l,r),i=e._dbSchema=l;let c=u2(a,l);c.add.forEach(e=>{u3(r,e[0],e[1].primKey,e[1].indexes)}),c.change.forEach(e=>{if(e.recreate)throw new l8.Upgrade("Not yet support for changing primary key");{let t=r.objectStore(e.name);e.add.forEach(e=>u4(t,e)),e.change.forEach(e=>{t.deleteIndex(e.name),u4(t,e)}),e.del.forEach(e=>t.deleteIndex(e))}});let u=o._cfg.contentUpgrade;if(u&&o._cfg.version>t){let t;uX(e,r),n._memoizedTables={},s=!0;let o=lO(l);c.del.forEach(e=>{o[e]=a[e]}),u0(e,[e.Transaction.prototype]),uQ(e,[e.Transaction.prototype],lh(o),o),n.schema=o;let i=lK(u);i&&cX();let d=cP.follow(()=>{if((t=u(n))&&i){var e=cQ.bind(null,null);t.then(e,e)}});return t&&"function"==typeof t.then?cP.resolve(t):d.then(()=>t)}}),a.push(t=>{var r;s&&us||(r=o._cfg.dbschema,[].slice.call(t.db.objectStoreNames).forEach(e=>null==r[e]&&t.db.deleteObjectStore(e))),u0(e,[e.Transaction.prototype]),uQ(e,[e.Transaction.prototype],e._storeNames,e._dbSchema),n.schema=e._dbSchema})}),(function e(){return a.length?cP.resolve(a.shift()(n.idbtrans)).then(e):cP.resolve()})().then(()=>{var e;lh(e=i).forEach(t=>{r.db.objectStoreNames.contains(t)||u3(r,t,e[t].primKey,e[t].indexes)})})})(e,o,r,u).catch(i)})}},a),c.onsuccess=cG(()=>{s=null;let r=e._novip.idbdb=c.result,a=lD(r.objectStoreNames);if(a.length>0)try{let t,o=r.transaction(1===a.length?a[0]:a,"readonly");n.autoSchema?function({_novip:e},t,n){e.verno=t.version/10;let r=e._dbSchema=u5(0,t,n);e._storeNames=lD(t.objectStoreNames,0),uQ(e,[e._allTables],lh(r),r)}(e,r,o):(u6(e,e._dbSchema,o),((t=u2(u5(0,e.idbdb,o),e._dbSchema)).add.length||t.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.")),uX(e,o)}catch(e){}ui.push(e),r.onversionchange=cG(t=>{n.vcFired=!0,e.on("versionchange").fire(t)}),r.onclose=cG(t=>{e.on("close").fire(t)}),l&&function({indexedDB:e,IDBKeyRange:t},n){u9(e)||n===uc||u8(e,t).put({name:n}).catch(ct)}(e._deps,i),t()},a)}).catch(e=>e&&"UnknownError"===e.name&&n.PR1398_maxLoop>0?(n.PR1398_maxLoop--,console.warn("Dexie: Workaround for Chrome UnknownError on open()"),c()):cP.reject(e));return cP.race([a,("u"<typeof navigator?cP.resolve():!navigator.userAgentData&&/Safari\//.test(navigator.userAgent)&&!/Chrom(e|ium)\//.test(navigator.userAgent)&&indexedDB.databases?new Promise(function(e){var n=function(){return indexedDB.databases().finally(e)};t=setInterval(n,100),n()}).finally(function(){return clearInterval(t)}):Promise.resolve()).then(c)]).then(()=>(o(),n.onReadyBeingFired=[],cP.resolve(de(()=>e.on.ready.fire(e.vip))).then(function t(){if(n.onReadyBeingFired.length>0){let r=n.onReadyBeingFired.reduce(cc,ct);return n.onReadyBeingFired=[],cP.resolve(de(()=>r(e.vip))).then(t)}}))).finally(()=>{n.onReadyBeingFired=null,n.isBeingOpened=!1}).then(()=>e).catch(t=>{n.dbOpenError=t;try{s&&s.abort()}catch(e){}return a===n.openCanceller&&e._close(),ue(t)}).finally(()=>{n.openComplete=!0,i()})}(this)}_close(){let e=this._state,t=ui.indexOf(this);if(t>=0&&ui.splice(t,1),this.idbdb){try{this.idbdb.close()}catch(e){}this._novip.idbdb=null}e.dbReadyPromise=new cP(t=>{e.dbReadyResolve=t}),e.openCanceller=new cP((t,n)=>{e.cancelOpen=n})}close(){this._close();let e=this._state;this._options.autoOpen=!1,e.dbOpenError=new l8.DatabaseClosed,e.isBeingOpened&&e.cancelOpen(e.dbOpenError)}delete(){let e=arguments.length>0,t=this._state;return new cP((n,r)=>{let a=()=>{this.close();var e=this._deps.indexedDB.deleteDatabase(this.name);e.onsuccess=cG(()=>{!function({indexedDB:e,IDBKeyRange:t},n){u9(e)||n===uc||u8(e,t).delete(n).catch(ct)}(this._deps,this.name),n()}),e.onerror=uR(r),e.onblocked=this._fireOnBlocked};if(e)throw new l8.InvalidArgument("Arguments not allowed in db.delete()");t.isBeingOpened?t.dbReadyPromise.then(a):a()})}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 lh(this._allTables).map(e=>this._allTables[e])}transaction(){let e=dn.apply(this,arguments);return this._transaction.apply(this,e)}_transaction(e,t,n){let r,a,o=cE.trans;o&&o.db===this&&-1===e.indexOf("!")||(o=null);let i=-1!==e.indexOf("?");e=e.replace("!","").replace("?","");try{if(a=t.map(e=>{var t=e instanceof this.Table?e.name:e;if("string"!=typeof t)throw TypeError("Invalid table argument to Dexie.transaction(). Only Table or String are allowed");return t}),"r"==e||e===uu)r=uu;else{if("rw"!=e&&e!=ud)throw new l8.InvalidArgument("Invalid transaction mode: "+e);r=ud}if(o){if(o.mode===uu&&r===ud){if(!i)throw new l8.SubTransaction("Cannot enter a sub-transaction with READWRITE mode when parent transaction is READONLY");o=null}o&&a.forEach(e=>{if(o&&-1===o.storeNames.indexOf(e)){if(!i)throw new l8.SubTransaction("Table "+e+" not included in parent transaction.");o=null}}),i&&o&&!o.active&&(o=null)}}catch(e){return o?o._promise(null,(t,n)=>{n(e)}):ue(e)}let s=(function e(t,n,r,a,o){return cP.resolve().then(()=>{let i,s=cE.transless||cE,l=t._createTransaction(n,r,t._dbSchema,a);if(a)l.idbtrans=a.idbtrans;else try{l.create(),t._state.PR1398_maxLoop=3}catch(a){return a.name===l7.InvalidState&&t.isOpen()&&--t._state.PR1398_maxLoop>0?(console.warn("Dexie: Need to reopen db"),t._close(),t.open().then(()=>e(t,n,r,null,o))):ue(a)}let c=lK(o);c&&cX();let u=cP.follow(()=>{if(i=o.call(l,l))if(c){var e=cQ.bind(null,null);i.then(e,e)}else"function"==typeof i.next&&"function"==typeof i.throw&&(i=dt(i))},{trans:l,transless:s});return(i&&"function"==typeof i.then?cP.resolve(i).then(e=>l.active?e:ue(new l8.PrematureCommit("Transaction committed too early. See http://bit.ly/2kdckMn"))):u.then(()=>i)).then(e=>(a&&l._resolve(),l._completion.then(()=>e))).catch(e=>(l._reject(e),ue(e)))})}).bind(null,this,r,a,o,n);return o?o._promise(r,s,"lock"):cE.trans?c5(cE.transless,()=>this._whenReady(s)):this._whenReady(s)}table(e){if(!lv(this._allTables,e))throw new l8.InvalidTable(`Table ${e} does not exist`);return this._allTables[e]}}let db="u">typeof Symbol&&"observable"in Symbol?Symbol.observable:"@@observable";class dv{constructor(e){this._subscribe=e}subscribe(e,t,n){return this._subscribe(e&&"function"!=typeof e?e:{next:e,error:t,complete:n})}[db](){return this}}function d$(e,t){return lh(t).forEach(n=>{df(e[n]||(e[n]=new dd),t[n])}),e}try{a={indexedDB:lm.indexedDB||lm.mozIndexedDB||lm.webkitIndexedDB||lm.msIndexedDB,IDBKeyRange:lm.IDBKeyRange||lm.webkitIDBKeyRange}}catch(e){a={indexedDB:null,IDBKeyRange:null}}function dA(e){let t=dw;try{dw=!0,uW.storagemutated.fire(e)}finally{dw=t}}l$(dy,{...ce,delete:e=>new dy(e,{addons:[]}).delete(),exists:e=>new dy(e,{addons:[]}).open().then(e=>(e.close(),!0)).catch("NoSuchDatabaseError",()=>!1),getDatabaseNames(e){try{return(function({indexedDB:e,IDBKeyRange:t}){return u9(e)?Promise.resolve(e.databases()).then(e=>e.map(e=>e.name).filter(e=>e!==uc)):u8(e,t).toCollection().primaryKeys()})(dy.dependencies).then(e)}catch(e){return ue(new l8.MissingAPI)}},defineClass:()=>function(e){l_(this,e)},ignoreTransaction:e=>cE.trans?c5(cE.transless,e):e(),vip:de,async:function(e){return function(){try{var t=dt(e.apply(this,arguments));return t&&"function"==typeof t.then?t:cP.resolve(t)}catch(e){return ue(e)}}},spawn:function(e,t,n){try{var r=dt(e.apply(n,t||[]));return r&&"function"==typeof r.then?r:cP.resolve(r)}catch(e){return ue(e)}},currentTransaction:{get:()=>cE.trans||null},waitFor:function(e,t){let n=cP.resolve("function"==typeof e?dy.ignoreTransaction(e):e).timeout(t||6e4);return cE.trans?cE.trans.waitFor(n):n},Promise:cP,debug:{get:()=>lZ,set:e=>{lZ=e,lY="dexie"===e?()=>!0:ul}},derive:lk,extend:l_,props:l$,override:lS,Events:ug,on:uW,liveQuery:function(e){let t,n=!1,r=new dv(r=>{let a=lK(e),o=!1,i={},s={},l={get closed(){return o},unsubscribe:()=>{o=!0,uW.storagemutated.unsubscribe(p)}};r.start&&r.start(l);let c=!1,u=!1;function d(){return lh(s).some(e=>i[e]&&function(e,t){let n=dm(t),r=n.next();if(r.done)return!1;let a=r.value,o=dm(e),i=o.next(a.from),s=i.value;for(;!r.done&&!i.done;){if(0>=ux(s.from,a.to)&&ux(s.to,a.from)>=0)return!0;0>ux(a.from,s.from)?a=(r=n.next(s.from)).value:s=(i=o.next(a.from)).value}return!1}(i[e],s[e]))}let p=e=>{d$(i,e),d()&&f()},f=()=>{let m,h;if(c||o)return;i={};let g={},y=(a&&cX(),m=()=>cJ(e,{subscr:g,trans:null}),h=cE.trans?c5(cE.transless,m):m(),a&&h.then(cQ,cQ),h);u||(uW(uF,p),u=!0),c=!0,Promise.resolve(y).then(e=>{n=!0,t=e,c=!1,o||(d()?f():(i={},s=g,r.next&&r.next(e)))},e=>{c=!1,n=!1,r.error&&r.error(e),l.unsubscribe()})};return f(),l});return r.hasValue=()=>n,r.getValue=()=>t,r},extendObservabilitySet:d$,getByKeyPath:lN,setByKeyPath:lT,delByKeyPath:function(e,t){"string"==typeof t?lT(e,t,void 0):"length"in t&&[].map.call(t,function(t){lT(e,t,void 0)})},shallowClone:lO,deepClone:lL,getObjectDiff:di,cmp:ux,asap:lP,minKey:ur,addons:[],connections:ui,errnames:l7,dependencies:a,semVer:ut,version:ut.split(".").map(e=>parseInt(e)).reduce((e,t,n)=>e+t/Math.pow(10,2*n))}),dy.maxKey=uq(dy.dependencies.IDBKeyRange),"u">typeof dispatchEvent&&"u">typeof addEventListener&&(uW(uF,e=>{if(!dw){let t;us?(t=document.createEvent("CustomEvent")).initCustomEvent(uL,!0,!0,e):t=new CustomEvent(uL,{detail:e}),dw=!0,dispatchEvent(t),dw=!1}}),addEventListener(uL,({detail:e})=>{dw||dA(e)}));let dw=!1;if("u">typeof BroadcastChannel){let e=new BroadcastChannel(uL);"function"==typeof e.unref&&e.unref(),uW(uF,t=>{dw||e.postMessage(t)}),e.onmessage=e=>{e.data&&dA(e.data)}}else if("u">typeof self&&"u">typeof navigator){uW(uF,e=>{try{dw||("u">typeof localStorage&&localStorage.setItem(uL,JSON.stringify({trig:Math.random(),changedParts:e})),"object"==typeof self.clients&&[...self.clients.matchAll({includeUncontrolled:!0})].forEach(t=>t.postMessage({type:uL,changedParts:e})))}catch(e){}}),"u">typeof addEventListener&&addEventListener("storage",e=>{if(e.key===uL){let t=JSON.parse(e.newValue);t&&dA(t.changedParts)}});let e=self.document&&navigator.serviceWorker;e&&e.addEventListener("message",function({data:e}){e&&e.type===uL&&dA(e.changedParts)})}function dk(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}cP.rejectionMapper=function(e,t){if(!e||e instanceof l3||e instanceof TypeError||e instanceof SyntaxError||!e.name||!l9[e.name])return e;var n=new l9[e.name](t||e.message,e);return"stack"in e&&lw(n,"stack",{get:function(){return this.inner.stack}}),n},lY=ul;class dx extends dy{constructor(){super("EsmOffline"),dk(this,"syncQueue",void 0),dk(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 dC(){return new dx}let dE=new dx,dD={},dS=Y("offline-synchronization",{});function dz(){return dS}async function dP(){if(dS.getState().synchronization)return;let e=await dE.syncQueue.count(),t={},n=Object.entries(dD),r=n.length,a={},o=new AbortController,i=()=>{let e=dS.getState().synchronization;dS.setState({synchronization:{...e,pendingCount:e.pendingCount-1}})};try{dS.setState({synchronization:{totalCount:e,pendingCount:e,abortController:o}});for(let e=0;e<r&&n.length>0;e++)for(let e=n.length;e--;){let[r,s]=n[e],l=s.dependsOn.map(e=>t[e]);l.every(Boolean)&&(a[r]={},await Promise.all(l),t[r]=dM(s,a,o,i),n.splice(e,1))}await Promise.allSettled(Object.values(t))}finally{dS.setState({synchronization:void 0})}}async function dM({type:e,dependsOn:t,process:n},r,a,o){let i=[],s=[],l=await dN();await dE.syncQueue.where({type:e,userId:l}).each((e,t)=>{i.push([t.primaryKey,e.content,e.descriptor]),s.push(e.content)});for(let c=0;c<i.length;c++){let[u,d,{id:p,dependencies:f=[]}]=i[c];try{let o=await n(d,{abort:a,index:c,items:s,userId:l,dependencies:f.map(({id:e,type:n})=>t.includes(n)?r[n][e]:void 0)});void 0!==p&&(r[e][p]=o),await dE.syncQueue.delete(u)}catch(e){await dE.syncQueue.update(u,{lastError:{name:e?.name,message:e?.message??e?.toString()}})}finally{o()}}}async function dN(){let e=await iY();return e?.uuid||"*"}async function dT(e,t,n,r){let a=r&&r.id;return void 0!==a&&await dE.syncQueue.where({type:t,userId:e}).filter(e=>e?.descriptor.id===a).delete().catch(dy.errnames.DatabaseClosed),await dE.syncQueue.add({type:t,content:n,userId:e,descriptor:r||{},createdOn:new Date}).catch(dy.errnames.DatabaseClosed,()=>-1)}async function dO(e,t,n){let r=await dN();return await dT(r,e,t,n)}async function dI(e,t){return(await dB(e,t)).map(e=>e.content)}async function dB(e,t){return await dE.syncQueue.where(t?{type:t,userId:e}:{userId:e}).toArray().catch(dy.errnames.DatabaseClosed,()=>[])}async function dR(e){let t=await dN();return await dI(t,e)}async function dj(e){let t=await dN();return await dB(t,e)}async function dF(e){return await dE.syncQueue.get(e).catch(dy.errnames.DatabaseClosed,()=>void 0)}function dL(e){return!!dD[e]?.options.onBeginEditSyncItem}async function dW(e){let t=await dF(e);if(!t)throw Error(`No sync item with the ID ${e} exists.`);let n=dD[t.type]?.options.onBeginEditSyncItem;if(!n)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 "${t.type}" supports editing items.`);n(t)}async function dV(e){await dE.syncQueue.delete(e).catch(dy.errnames.DatabaseClosed)}function dG(e,t,n,r={}){dD[e]={type:e,dependsOn:t,process:n,options:r}}let dU="u">typeof crypto&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),dH=new Uint8Array(16),dq=[];for(let e=0;e<256;++e)dq.push((e+256).toString(16).slice(1));let dK=function(e,t,n){if(dU&&!t&&!e)return dU();let r=(e=e||{}).random||(e.rng||function(){if(!o&&!(o="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 o(dH)})();if(r[6]=15&r[6]|64,r[8]=63&r[8]|128,t){n=n||0;for(let e=0;e<16;++e)t[n+e]=r[e];return t}return function(e,t=0){return dq[e[t+0]]+dq[e[t+1]]+dq[e[t+2]]+dq[e[t+3]]+"-"+dq[e[t+4]]+dq[e[t+5]]+"-"+dq[e[t+6]]+dq[e[t+7]]+"-"+dq[e[t+8]]+dq[e[t+9]]+"-"+dq[e[t+10]]+dq[e[t+11]]+dq[e[t+12]]+dq[e[t+13]]+dq[e[t+14]]+dq[e[t+15]]}(r)},dZ="OFFLINE+";function dY(){return dZ+dK()}function dJ(e){return e.startsWith(dZ)}let dX={};function dQ(){return Object.values(dX)}function d0(e){dX[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.`),dX[e.id]=e}async function d1(e){let t=await d9();return await d2(t,e)}async function d2(e,t){let n=new dx;return await n.dynamicOfflineData.where(t?{type:t,users:e}:{users:e}).toArray().catch(dy.errnames.DatabaseClosed,()=>[])}async function d3(e,t){let n=await d9();return await d4(n,e,t)}async function d4(e,t,n){let r=new dx,a=await r.dynamicOfflineData.get({type:t,identifier:n}).catch(dy.errnames.DatabaseClosed,()=>void 0);a?a.users.includes(e)||await r.dynamicOfflineData.update(a.id,{users:[...a.users,e]}).catch(dy.errnames.DatabaseClosed):await r.dynamicOfflineData.add({users:[e],type:t,identifier:n}).catch(dy.errnames.DatabaseClosed)}async function d5(e,t){let n=await d9();return await d6(n,e,t)}async function d6(e,t,n){let r=new dx,a=await r.dynamicOfflineData.get({type:t,identifier:n,users:e}).catch(dy.errnames.DatabaseClosed,()=>void 0);a&&(a.users.length>1?await r.dynamicOfflineData.update(a.id,{users:a.users.filter(t=>t!==e)}).catch(dy.errnames.DatabaseClosed):await r.dynamicOfflineData.delete(a.id).catch(dy.errnames.DatabaseClosed))}async function d7(e,t){let n=await d1(e);await Promise.all(n.map(async e=>d8(e.type,e.identifier,t)))}async function d8(e,t,n){await d3(e,t);let r=new dx,a=await d9(),o=await r.dynamicOfflineData.get({type:e,identifier:t}).catch(dy.errnames.DatabaseClosed,()=>void 0),i=dQ().filter(t=>t.type===e);if(!o)return;let s=await Promise.all(i.map(async e=>{try{return e.sync(t,n),{id:e.id,error:void 0}}catch(n){let t=n.message?.toString()??n.toString();return{id:e.id,error:t}}})),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})),d={syncedOn:new Date,syncedBy:a,succeededHandlers:l,erroredHandlers:c,errors:u};o.id&&await r.dynamicOfflineData.update(o.id,{syncState:d}).catch(dy.errnames.DatabaseClosed)}async function d9(){let e=(await iY()).uuid;if(!e)throw Error("Using the dynamic offline data API requires a logged in user.");return e}let pe=Y("offline-patients",{offlinePatientDataSyncState:{},handlers:{}});function pt(){return pa(),pe}function pn(e,t){pa(),d0({type:"patient",displayName:t.displayName,id:e,isSynced:()=>Promise.resolve(!0),sync:(e,n)=>t.onOfflinePatientAdded({patientUuid:e,signal:n??new AbortController().signal})})}async function pr(e){pa(),await d8("patient",e)}function pa(){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 po(e,t,n=!0){if(e){let r=null,[a,o]=await Promise.all([ij(`${iI}/Patient/${e}`,t).catch(e=>r=e),n?pi(e):Promise.resolve(null)]);if(a.ok)return a.data;if(o)return o;if(r)throw r}return null}async function pi(e){let t=(await dR("patient-registration")).find(t=>t.fhirPatient.id===e);return t?.fhirPatient??null}function ps(e,t){let n=new CustomEvent(`openmrs:${e}`,{detail:t??void 0,cancelable:!0,bubbles:!0});return window.dispatchEvent(n)}function pl(e,t){let n=e=>{t("detail"in e&&null!==e.detail?e.detail:void 0)};return window.addEventListener(`openmrs:${e}`,n),()=>{window.removeEventListener(`openmrs:${e}`,n)}}var pc=n(9549);function pu(e){return{uuid:e.uuid,display:e.display}}function pd(e=null,t=null){let n=new URLSearchParams;e&&n.set("tag",e),t&&n.set("q",t);let r=n.toString();return iF(`${iO}/location${r?"?"+r:""}`).pipe((0,pc.map)(e=>e.data.results.map(pu))).pipe((0,pc.take)(1))}function pp(e){return{uuid:e.uuid,display:e.display,name:e.name}}function pf(){return iF(`${iO}/visittype`).pipe((0,pc.map)(e=>e.data.results.map(pp))).pipe((0,pc.take)(1))}var pm=function(){function e(){return Error.call(this),this.message="object unsubscribed",this.name="ObjectUnsubscribedError",this}return e.prototype=Object.create(Error.prototype),e}(),ph=function(e){function t(t,n){var r=e.call(this)||this;return r.subject=t,r.subscriber=n,r.closed=!1,r}return ej(t,e),t.prototype.unsubscribe=function(){if(!this.closed){this.closed=!0;var e=this.subject,t=e.observers;if(this.subject=null,t&&0!==t.length&&!e.isStopped&&!e.closed){var n=t.indexOf(this.subscriber);-1!==n&&t.splice(n,1)}}},t}(eq),pg=function(e){function t(t){var n=e.call(this,t)||this;return n.destination=t,n}return ej(t,e),t}(eY),p_=function(e){function t(){var t=e.call(this)||this;return t.observers=[],t.closed=!1,t.isStopped=!1,t.hasError=!1,t.thrownError=null,t}return ej(t,e),t.prototype[eZ]=function(){return new pg(this)},t.prototype.lift=function(e){var t=new py(this,this);return t.operator=e,t},t.prototype.next=function(e){if(this.closed)throw new pm;if(!this.isStopped)for(var t=this.observers,n=t.length,r=t.slice(),a=0;a<n;a++)r[a].next(e)},t.prototype.error=function(e){if(this.closed)throw new pm;this.hasError=!0,this.thrownError=e,this.isStopped=!0;for(var t=this.observers,n=t.length,r=t.slice(),a=0;a<n;a++)r[a].error(e);this.observers.length=0},t.prototype.complete=function(){if(this.closed)throw new pm;this.isStopped=!0;for(var e=this.observers,t=e.length,n=e.slice(),r=0;r<t;r++)n[r].complete();this.observers.length=0},t.prototype.unsubscribe=function(){this.isStopped=!0,this.closed=!0,this.observers=null},t.prototype._trySubscribe=function(t){if(!this.closed)return e.prototype._trySubscribe.call(this,t);throw new pm},t.prototype._subscribe=function(e){if(this.closed)throw new pm;return this.hasError?(e.error(this.thrownError),eq.EMPTY):this.isStopped?(e.complete(),eq.EMPTY):(this.observers.push(e),new ph(this,e))},t.prototype.asObservable=function(){var e=new eQ;return e.source=this,e},t.create=function(e,t){return new py(e,t)},t}(eQ),py=function(e){function t(t,n){var r=e.call(this)||this;return r.destination=t,r.source=n,r}return ej(t,e),t.prototype.next=function(e){var t=this.destination;t&&t.next&&t.next(e)},t.prototype.error=function(e){var t=this.destination;t&&t.error&&this.destination.error(e)},t.prototype.complete=function(){var e=this.destination;e&&e.complete&&this.destination.complete()},t.prototype._subscribe=function(e){return this.source?this.source.subscribe(e):eq.EMPTY},t}(p_),pb=function(e){function t(t){var n=e.call(this)||this;return n._value=t,n}return ej(t,e),Object.defineProperty(t.prototype,"value",{get:function(){return this.getValue()},enumerable:!0,configurable:!0}),t.prototype._subscribe=function(t){var n=e.prototype._subscribe.call(this,t);return n&&!n.closed&&t.next(this._value),n},t.prototype.getValue=function(){if(this.hasError)throw this.thrownError;if(!this.closed)return this._value;throw new pm},t.prototype.next=function(t){e.prototype.next.call(this,this._value=t)},t}(p_),pv=((eu={}).NEWVISIT="startVisit",eu.EDITVISIT="editVisit",eu.LOADING="loadingVisit",eu),p$=((ed={}).NOTSTARTED="notStarted",ed.ONGOING="ongoing",ed);let pA="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))",pw=function(){try{return JSON.parse(sessionStorage.getItem("openmrs:visitStoreState")||"null")}catch(e){return null}}()||{patientUuid:null,manuallySetVisitUuid:null};function pk(){return X("visit",pw)}function px(e,t){pk().setState({patientUuid:e,manuallySetVisitUuid:t})}function pC(e,t){return ij(`${iO}/visit`,{signal:t.signal,method:"POST",headers:{"Content-type":"application/json"},body:e})}function pE(e,t,n){return ij(`${iO}/visit/${e}`,{signal:n.signal,method:"POST",headers:{"Content-type":"application/json"},body:t})}function pD(e,t,n){return ij(`${iO}/visit?patient=${e}&v=${n??pA}`,{signal:t.signal,method:"GET",headers:{"Content-type":"application/json"}})}pk().subscribe(e=>{var t;t=e,sessionStorage.setItem("openmrs:visitStoreState",JSON.stringify(t))});let pS=new pb(null);class pz{static get version(){return"1.4.0"}static toString(){return"JavaScript Expression Parser (JSEP) v"+pz.version}static addUnaryOp(e){return pz.max_unop_len=Math.max(e.length,pz.max_unop_len),pz.unary_ops[e]=1,pz}static addBinaryOp(e,t,n){return pz.max_binop_len=Math.max(e.length,pz.max_binop_len),pz.binary_ops[e]=t,n?pz.right_associative.add(e):pz.right_associative.delete(e),pz}static addIdentifierChar(e){return pz.additional_identifier_chars.add(e),pz}static addLiteral(e,t){return pz.literals[e]=t,pz}static removeUnaryOp(e){return delete pz.unary_ops[e],e.length===pz.max_unop_len&&(pz.max_unop_len=pz.getMaxKeyLen(pz.unary_ops)),pz}static removeAllUnaryOps(){return pz.unary_ops={},pz.max_unop_len=0,pz}static removeIdentifierChar(e){return pz.additional_identifier_chars.delete(e),pz}static removeBinaryOp(e){return delete pz.binary_ops[e],e.length===pz.max_binop_len&&(pz.max_binop_len=pz.getMaxKeyLen(pz.binary_ops)),pz.right_associative.delete(e),pz}static removeAllBinaryOps(){return pz.binary_ops={},pz.max_binop_len=0,pz}static removeLiteral(e){return delete pz.literals[e],pz}static removeAllLiterals(){return pz.literals={},pz}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 pz(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 pz.binary_ops[e]||0}static isIdentifierStart(e){return e>=65&&e<=90||e>=97&&e<=122||e>=128&&!pz.binary_ops[String.fromCharCode(e)]||pz.additional_identifier_chars.has(String.fromCharCode(e))}static isIdentifierPart(e){return pz.isIdentifierStart(e)||pz.isDecimalDigit(e)}throwError(e){let t=Error(e+" at character "+this.index);throw t.index=this.index,t.description=e,t}runHook(e,t){if(pz.hooks[e]){let n={context:this,node:t};return pz.hooks.run(e,n),n.node}return t}searchHook(e){if(pz.hooks[e]){let t={context:this};return pz.hooks[e].find(function(e){return e.call(t.context,t),t.node}),t.node}}gobbleSpaces(){let e=this.code;for(;e===pz.SPACE_CODE||e===pz.TAB_CODE||e===pz.LF_CODE||e===pz.CR_CODE;)e=this.expr.charCodeAt(++this.index);this.runHook("gobble-spaces")}parse(){this.runHook("before-all");let e=this.gobbleExpressions(),t=1===e.length?e[0]:{type:pz.COMPOUND,body:e};return this.runHook("after-all",t)}gobbleExpressions(e){let t=[],n,r;for(;this.index<this.expr.length;)if((n=this.code)===pz.SEMCOL_CODE||n===pz.COMMA_CODE)this.index++;else if(r=this.gobbleExpression())t.push(r);else if(this.index<this.expr.length){if(n===e)break;this.throwError('Unexpected "'+this.char+'"')}return t}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,pz.max_binop_len),t=e.length;for(;t>0;){if(pz.binary_ops.hasOwnProperty(e)&&(!pz.isIdentifierStart(this.code)||this.index+e.length<this.expr.length&&!pz.isIdentifierPart(this.expr.charCodeAt(this.index+e.length))))return this.index+=t,e;e=e.substr(0,--t)}return!1}gobbleBinaryExpression(){let e,t,n,r,a,o,i,s,l;if(!(o=this.gobbleToken())||!(t=this.gobbleBinaryOp()))return o;for(a={value:t,prec:pz.binaryPrecedence(t),right_a:pz.right_associative.has(t)},(i=this.gobbleToken())||this.throwError("Expected expression after "+t),r=[o,a,i];t=this.gobbleBinaryOp();){if(0===(n=pz.binaryPrecedence(t))){this.index-=t.length;break}a={value:t,prec:n,right_a:pz.right_associative.has(t)},l=t;let s=e=>a.right_a&&e.right_a?n>e.prec:n<=e.prec;for(;r.length>2&&s(r[r.length-2]);)i=r.pop(),t=r.pop().value,o=r.pop(),e={type:pz.BINARY_EXP,operator:t,left:o,right:i},r.push(e);(e=this.gobbleToken())||this.throwError("Expected expression after "+l),r.push(a,e)}for(s=r.length-1,e=r[s];s>1;)e={type:pz.BINARY_EXP,operator:r[s-1].value,left:r[s-2],right:e},s-=2;return e}gobbleToken(){let e,t,n,r;if(this.gobbleSpaces(),r=this.searchHook("gobble-token"))return this.runHook("after-token",r);if(e=this.code,pz.isDecimalDigit(e)||e===pz.PERIOD_CODE)return this.gobbleNumericLiteral();if(e===pz.SQUOTE_CODE||e===pz.DQUOTE_CODE)r=this.gobbleStringLiteral();else if(e===pz.OBRACK_CODE)r=this.gobbleArray();else{for(n=(t=this.expr.substr(this.index,pz.max_unop_len)).length;n>0;){if(pz.unary_ops.hasOwnProperty(t)&&(!pz.isIdentifierStart(this.code)||this.index+t.length<this.expr.length&&!pz.isIdentifierPart(this.expr.charCodeAt(this.index+t.length)))){this.index+=n;let e=this.gobbleToken();return e||this.throwError("missing unaryOp argument"),this.runHook("after-token",{type:pz.UNARY_EXP,operator:t,argument:e,prefix:!0})}t=t.substr(0,--n)}pz.isIdentifierStart(e)?(r=this.gobbleIdentifier(),pz.literals.hasOwnProperty(r.name)?r={type:pz.LITERAL,value:pz.literals[r.name],raw:r.name}:r.name===pz.this_str&&(r={type:pz.THIS_EXP})):e===pz.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 t=this.code;for(;t===pz.PERIOD_CODE||t===pz.OBRACK_CODE||t===pz.OPAREN_CODE||t===pz.QUMARK_CODE;){let n;if(t===pz.QUMARK_CODE){if(this.expr.charCodeAt(this.index+1)!==pz.PERIOD_CODE)break;n=!0,this.index+=2,this.gobbleSpaces(),t=this.code}this.index++,t===pz.OBRACK_CODE?((e={type:pz.MEMBER_EXP,computed:!0,object:e,property:this.gobbleExpression()}).property||this.throwError('Unexpected "'+this.char+'"'),this.gobbleSpaces(),(t=this.code)!==pz.CBRACK_CODE&&this.throwError("Unclosed ["),this.index++):t===pz.OPAREN_CODE?e={type:pz.CALL_EXP,arguments:this.gobbleArguments(pz.CPAREN_CODE),callee:e}:(t===pz.PERIOD_CODE||n)&&(n&&this.index--,this.gobbleSpaces(),e={type:pz.MEMBER_EXP,computed:!1,object:e,property:this.gobbleIdentifier()}),n&&(e.optional=!0),this.gobbleSpaces(),t=this.code}return e}gobbleNumericLiteral(){let e="",t,n;for(;pz.isDecimalDigit(this.code);)e+=this.expr.charAt(this.index++);if(this.code===pz.PERIOD_CODE)for(e+=this.expr.charAt(this.index++);pz.isDecimalDigit(this.code);)e+=this.expr.charAt(this.index++);if("e"===(t=this.char)||"E"===t){for(e+=this.expr.charAt(this.index++),("+"===(t=this.char)||"-"===t)&&(e+=this.expr.charAt(this.index++));pz.isDecimalDigit(this.code);)e+=this.expr.charAt(this.index++);pz.isDecimalDigit(this.expr.charCodeAt(this.index-1))||this.throwError("Expected exponent ("+e+this.char+")")}return n=this.code,pz.isIdentifierStart(n)?this.throwError("Variable names cannot start with a number ("+e+this.char+")"):(n===pz.PERIOD_CODE||1===e.length&&e.charCodeAt(0)===pz.PERIOD_CODE)&&this.throwError("Unexpected period"),{type:pz.LITERAL,value:parseFloat(e),raw:e}}gobbleStringLiteral(){let e="",t=this.index,n=this.expr.charAt(this.index++),r=!1;for(;this.index<this.expr.length;){let t=this.expr.charAt(this.index++);if(t===n){r=!0;break}if("\\"===t)switch(t=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+=t}else e+=t}return r||this.throwError('Unclosed quote after "'+e+'"'),{type:pz.LITERAL,value:e,raw:this.expr.substring(t,this.index)}}gobbleIdentifier(){let e=this.code,t=this.index;for(pz.isIdentifierStart(e)?this.index++:this.throwError("Unexpected "+this.char);this.index<this.expr.length;)if(e=this.code,pz.isIdentifierPart(e))this.index++;else break;return{type:pz.IDENTIFIER,name:this.expr.slice(t,this.index)}}gobbleArguments(e){let t=[],n=!1,r=0;for(;this.index<this.expr.length;){this.gobbleSpaces();let a=this.code;if(a===e){n=!0,this.index++,e===pz.CPAREN_CODE&&r&&r>=t.length&&this.throwError("Unexpected token "+String.fromCharCode(e));break}if(a===pz.COMMA_CODE){if(this.index++,++r!==t.length){if(e===pz.CPAREN_CODE)this.throwError("Unexpected token ,");else if(e===pz.CBRACK_CODE)for(let e=t.length;e<r;e++)t.push(null)}}else if(t.length!==r&&0!==r)this.throwError("Expected comma");else{let e=this.gobbleExpression();e&&e.type!==pz.COMPOUND||this.throwError("Expected comma"),t.push(e)}}return n||this.throwError("Expected "+String.fromCharCode(e)),t}gobbleGroup(){this.index++;let e=this.gobbleExpressions(pz.CPAREN_CODE);if(this.code===pz.CPAREN_CODE)return(this.index++,1===e.length)?e[0]:!!e.length&&{type:pz.SEQUENCE_EXP,expressions:e};this.throwError("Unclosed (")}gobbleArray(){return this.index++,{type:pz.ARRAY_EXP,elements:this.gobbleArguments(pz.CBRACK_CODE)}}}Object.assign(pz,{hooks:new class{add(e,t,n){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]||[],t&&this[e][n?"unshift":"push"](t)},this)}run(e,t){this[e]=this[e]||[],this[e].forEach(function(e){e.call(t&&t.context?t.context:t,t)})}},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)})}}(pz),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"}),pz.max_unop_len=pz.getMaxKeyLen(pz.unary_ops),pz.max_binop_len=pz.getMaxKeyLen(pz.binary_ops);let pP=e=>new pz(e).parse(),pM=Object.getOwnPropertyNames(class{});Object.getOwnPropertyNames(pz).filter(e=>!pM.includes(e)&&void 0===pP[e]).forEach(e=>{pP[e]=pz[e]}),pP.Jsep=pz,pP.plugins.register({name:"ternary",init(e){e.hooks.add("after-expression",function(t){if(t.node&&this.code===e.QUMARK_CODE){this.index++;let n=t.node,r=this.gobbleExpression();if(r||this.throwError("Expected expression"),this.gobbleSpaces(),this.code===e.COLON_CODE){this.index++;let a=this.gobbleExpression();if(a||this.throwError("Expected expression"),t.node={type:"ConditionalExpression",test:n,consequent:r,alternate:a},n.operator&&e.binary_ops[n.operator]<=.9){let r=n;for(;r.right.operator&&e.binary_ops[r.right.operator]<=.9;)r=r.right;t.node.test=r.right,r.right=t.node,t.node=n}}else this.throwError("Expected :")}})}});let pN="ArrowFunctionExpression",pT={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)}},pO={...pT,Promise};function pI(e,t={}){return pW(e,t,pU)}async function pB(e,t={}){return pV(e,t,pU)}function pR(e,t={}){return pW(e,t,pH)}function pj(e,t={}){return pV(e,t,pH)}function pF(e,t={}){return pW(e,t,pq)}function pL(e,t={}){return pV(e,t,pq)}function pW(e,t={},n){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==t&&(t={});let r=pY(t,pT),a=pK("string"==typeof e?pP(e):e,r);if(n(a))return a;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 pV(e,t={},n){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==t&&(t={});let r=pY(t,pO);return Promise.resolve(pK("string"==typeof e?pP(e):e,r)).then(t=>{if(n(t))return t;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 pG(e){return pP(e)}function pU(e){return"string"==typeof e||"number"==typeof e||"boolean"==typeof e||null==e||e instanceof Date}function pH(e){return"boolean"==typeof e}function pq(e){return"number"==typeof e}function pK(e,t){switch(e.type){case"UnaryExpression":var n,r,a,o,i,s,l,c,u,d,p,f,m=e,h=t;let g=pK(m.argument,h);switch(m.operator){case"+":return+g;case"-":return-g;case"~":return~g;case"!":return!g;default:throw`Expression evaluator does not support operator '${m.operator}''`}case"BinaryExpression":var y=e,b=t;let v=pK(y.left,b),$=pK(y.right,b);switch(y.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 '${y.operator}' operator`}case"ConditionalExpression":return n=e,r=t,pK(n.test,r)?pK(n.consequent,r):pK(n.alternate,r);case"CallExpression":var A=e,w=t;let k=A.arguments?.map(pJ(w)),x=pK(A.callee,w);if(x){if("function"!=typeof x)throw`${pQ(A.callee)} is not a function`}else throw`No function named ${pQ(A.callee)} is defined in this context`;return x(...k);case"ArrowFunctionExpression":let C;return a=e,o=t,C=a.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 t=Object.fromEntries(C.reduce((t,n,r)=>{let a=e[r];return function e(t){if("string"==typeof t||"number"==typeof t||"boolean"==typeof t||"function"==typeof t||null===t||t instanceof RegExp)return!0;if("object"==typeof t){for(let n of Object.keys(t))if(!e(t[n]))return!1;return!0}if(Array.isArray(t)){for(let n of t)if(!e(n))break}return!1}(a)&&t.push([n,a]),t},[]));return pK(a.body,o.addVariables(t))}).bind(o.thisObj??null);case"MemberExpression":return function(e,t){let n,r=pK(e.object,t);if(void 0===r)switch(e.object.type){case"Identifier":{let n=pZ(e.object,t);throw ReferenceError(`ReferenceError: ${n} is not defined`)}case"MemberExpression":{let n=pZ(e.property,t);throw TypeError(`TypeError: cannot read properties of undefined (reading '${n}')`)}default:throw`VisitMemberExpression does not support operator '${e.object.type}' type`}let a=r;if("string"==typeof r)a=String.prototype;else if("number"==typeof r)a=Number.prototype;else if("function"==typeof r);else if("object"!=typeof r)throw`VisitMemberExpression does not support member access on type ${typeof r}`;switch(t.thisObj=a,e.property.type){case"Identifier":case"MemberExpression":n=pK(e.property,t);break;default:{let a=pK(e.property,t);if(void 0===a)throw{type:"Illegal property access",message:"No property was supplied to the property access"};pX(a),n=r[a]}}return"function"==typeof n?n.bind(r):n}(e,t);case"ArrayExpression":return i=e,s=t,i.elements?.map(pJ(s));case"SequenceExpression":let E;return l=e,c=t,(E=l.expressions.map(pJ(c)))[E.length-1];case"NewExpression":var D=e,S=t;if(D.callee&&"Identifier"===D.callee.type){let e=D.arguments?.map(pJ(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 pX((u=e).value),u.value;case"Identifier":var z=e,P=t;pX(z.name);let M=P.thisObj;if(M&&("object"==typeof M||"function"==typeof M)&&z.name in M){let e=M[z.name];return pX(e),e}if(P.variables&&z.name in P.variables){let e=P.variables[z.name];return pX(e),e}return z.name in P.globals?P.globals[z.name]:void 0;case"TemplateLiteral":let N,T;return d=e,p=t,N=d.expressions?.map(pJ(p))??[],(T=d.quasis?.map(pJ(p))??[]).filter(e=>!e.tail).map(e=>e.value).join("")+N.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 pZ(e,t){switch(e.type){case"Literal":return e.value;case"Identifier":return e.name;case"MemberExpression":return pZ(e.property,t);default:throw`VisitExpressionName does not support expression of type '${e.type}'`}}function pY(e,t){let n={thisObj:void 0,variables:{...e},globals:{...t},addVariables(e){return this.variables={...this.variables,...e},this}};return n.addVariables.bind(n),n}function pJ(e){return function(t){return null===t?null:pK(t,e)}}function pX(e){if("__proto__"===e||"prototype"===e||"constructor"===e)throw{type:"Illegal property access",message:`Cannot access the ${e} property of objects`}}function pQ(e){return e?"MemberExpression"===e.type?e.property?.name:e.name:null}function p0(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 t={globals:{...pO},isLocalExpression:!1,variables:new Set};return p1("string"==typeof e?pP(e):e,t),[...t.variables]}function p1(e,t){switch(e.type){case"UnaryExpression":return r=e,a=t,p1(r.argument,a);case"BinaryExpression":return o=e,i=t,[p1(o.left,i),p1(o.right,i)].filter(Boolean);case"ConditionalExpression":return s=e,l=t,[p1(s.consequent,l),p1(s.test,l),p1(s.alternate,l)].filter(Boolean);case"CallExpression":let n;return c=e,u=t,n=p1(c.callee,u),c.arguments?.map(p2(u)),n;case"ArrowFunctionExpression":var r,a,o,i,s,l,c,u,d,p,f,m,h,g,y,b,v,$,A=e,w=t;let k={...w};k.isLocalExpression=!0;let x=A.params?.map(p2(k))??[],C=p1(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 d=e,p=t,p1(d.object,p),void((E={...p}).isLocalExpression=!0,p1(d.property,E));case"ArrayExpression":return f=e,m=t,void f.elements?.map(p2(m));case"SequenceExpression":return h=e,g=t,void h.expressions?.map(p2(g));case"NewExpression":return y=e,b=t,void y.arguments?.map(p2(b));case"Literal":case"TemplateElement":return;case"Identifier":var D=e,S=t;if(!(D.name in S.globals))if(S.isLocalExpression)return D.name;else S.variables.add(D.name);return;case"TemplateLiteral":return v=e,$=t,void(v.expressions?.map(p2($)),v.quasis?.map(p2($)));default:throw`Expression evaluator does not support expression of type '${e.type}'`}}function p2(e){return function(t){return null===t?null:p1(t,e)}}pP.plugins.register({name:"arrow",init(e){e.addBinaryOp("=>",.1,!0),e.hooks.add("gobble-expression",function(t){if(this.gobbleSpaces(),this.code===e.OPAREN_CODE){let n=this.index;if(this.index++,this.gobbleSpaces(),this.code===e.CPAREN_CODE){this.index++;let e=this.gobbleBinaryOp();if("=>"===e){let n=this.gobbleBinaryExpression();n||this.throwError("Expected expression after "+e),t.node={type:pN,params:null,body:n};return}}this.index=n}}),e.hooks.add("after-expression",function(t){!function t(n){n&&(Object.values(n).forEach(e=>{e&&"object"==typeof e&&t(e)}),"=>"===n.operator&&(n.type=pN,n.params=n.left?[n.left]:null,n.body=n.right,n.params&&n.params[0].type===e.SEQUENCE_EXP&&(n.params=n.params[0].expressions),delete n.left,delete n.right,delete n.operator))}(t.node)})}}),pP.plugins.register({name:"new",init(e){e.addUnaryOp("new"),e.hooks.add("after-token",function(t){let n=t.node;if(n&&"new"===n.operator){n.argument&&[e.CALL_EXP,e.MEMBER_EXP].includes(n.argument.type)||this.throwError("Expected new function()"),t.node=n.argument;let r=t.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"}})}}),pP.plugins.register({name:"numbers",init(e){function t(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 n(t){let n=this.index,r="",a=()=>{for(;e.isDecimalDigit(this.code)||95===this.code;)95===this.code?this.index++:r+=this.expr.charAt(this.index++)};a(),this.code===e.PERIOD_CODE&&(r+=this.expr.charAt(this.index++),a());let o=this.char;("e"===o||"E"===o)&&(r+=this.expr.charAt(this.index++),("+"===(o=this.char)||"-"===o)&&(r+=this.expr.charAt(this.index++)),a(),e.isDecimalDigit(this.expr.charCodeAt(this.index-1))||this.throwError("Expected exponent ("+r+this.char+")"));let i=this.code;if(e.isIdentifierStart(i))this.throwError("Variable names cannot start with a number ("+r+this.char+")");else if(i===e.PERIOD_CODE){r.length>1&&this.throwError(`Unexpected period ${JSON.stringify({chCode:i,number:r},null,2)}`),this.index=n;return}t.node={type:e.LITERAL,value:parseFloat(r),raw:this.expr.substring(n,this.index)}}e.hooks.add("gobble-token",function(r){if(48===this.code){var a,o,i;let s=this.index,l=this.expr.charAt(this.index+1),c=t.call(this,l);if(!c)return;let u="";for(;a=this.code,o=c,95===a||o.some(([e,t])=>a>=e&&a<=t);)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,n.call(this,r);return}this.throwError("unexpected char within number")}r.node={type:e.LITERAL,value:parseInt(u,"x"===(i=l)||"X"===i?16:"b"===i||"B"===i?2:8),raw:this.expr.substring(s,this.index)}}else(e.isDecimalDigit(this.code)||this.code===e.PERIOD_CODE)&&n.call(this,r)})}}),pP.plugins.register({name:"regex",init(e){e.hooks.add("gobble-token",function(t){if(47===this.code){let n=++this.index,r=!1;for(;this.index<this.expr.length;){if(47===this.code&&!r){let r,a=this.expr.slice(n,this.index),o="";for(;++this.index<this.expr.length;){let e=this.code;if(e>=97&&e<=122||e>=65&&e<=90||e>=48&&e<=57)o+=this.char;else break}try{r=new RegExp(a,o)}catch(e){this.throwError(e.message)}return t.node={type:e.LITERAL,value:r,raw:this.expr.slice(n-1,this.index)},t.node=this.gobbleTokenProperty(t.node),t.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")}})}}),pP.plugins.register({name:"ternary",init(e){e.hooks.add("after-expression",function(t){if(t.node&&this.code===e.QUMARK_CODE){this.index++;let n=t.node,r=this.gobbleExpression();if(r||this.throwError("Expected expression"),this.gobbleSpaces(),this.code===e.COLON_CODE){this.index++;let a=this.gobbleExpression();if(a||this.throwError("Expected expression"),t.node={type:"ConditionalExpression",test:n,consequent:r,alternate:a},n.operator&&e.binary_ops[n.operator]<=.9){let r=n;for(;r.right.operator&&e.binary_ops[r.right.operator]<=.9;)r=r.right;t.node.test=r.right,r.right=t.node,t.node=n}}else this.throwError("Expected :")}})}}),pP.plugins.register({name:"jsepTemplateLiteral",init(e){function t(e,n=!0){if(96===this.code){let t={type:"TemplateLiteral",quasis:[],expressions:[]},r="",a="",o=!1,i=this.expr.length,s=()=>t.quasis.push({type:"TemplateElement",value:{raw:a,cooked:r},tail:o});for(;this.index<i;){let i=this.expr.charAt(++this.index);if("`"===i)return this.index+=1,o=!0,s(),e.node=t,n&&(e.node=this.gobbleTokenProperty(e.node)),e.node;if("$"===i&&"{"===this.expr.charAt(this.index+1))this.index+=2,s(),a="",r="",t.expressions.push(...this.gobbleExpressions(125)),125!==this.code&&this.throwError("unclosed ${");else if("\\"===i)switch(a+=i,i=this.expr.charAt(++this.index),a+=i,i){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+=i}else r+=i,a+=i}this.throwError("Unclosed `")}}e.hooks.add("gobble-token",t),e.hooks.add("after-token",function(n){if((n.node.type===e.IDENTIFIER||n.node.type===e.MEMBER_EXP)&&96===this.code)return n.node={type:"TaggedTemplateExpression",tag:n.node,quasi:t.bind(this)(n,!1)},n.node=this.gobbleTokenProperty(n.node),n.node})}}),pP.addBinaryOp("in",7),pP.addBinaryOp("??",1);let p3=X("feature-flags",{flags:function(){let e={};for(let t of Object.keys(localStorage))if(t.startsWith("openmrs:feature-flag:")){let n=t.replace("openmrs:feature-flag:",""),r=JSON.parse(localStorage.getItem(`openmrs:feature-flag-meta:${n}`)||"{}");e[n]={enabled:"true"===localStorage.getItem(t),...r}}return e}()});function p4(e,t,n){p3.setState(r=>({flags:{...r.flags,[e]:{enabled:r.flags[e]?.enabled??!1,label:t,description:n}}}))}function p5(){let e=p3.getState().flags;Object.keys(localStorage).filter(e=>e.startsWith("openmrs:feature-flag:")).forEach(t=>{let n=t.replace("openmrs:feature-flag:","");e[n]||(localStorage.removeItem(t),localStorage.removeItem(`openmrs:feature-flag-meta:${n}`))})}function p6(e){return p3.getState().flags[e].enabled}function p7(e,t){p3.subscribe(n=>{t(n.flags[e].enabled)})}function p8(e,t){p3.setState(n=>({flags:{...n.flags,[e]:{...n.flags[e],enabled:t}}}))}function p9(e){return!window.offlineEnabled||(e??navigator.onLine)}p3.subscribe(e=>{for(let[t,n]of Object.entries(e.flags))localStorage.setItem(`openmrs:feature-flag:${t}`,n.enabled.toString()),localStorage.setItem(`openmrs:feature-flag-meta:${t}`,JSON.stringify({label:n.label,description:n.description}))});var fe=nN(function(e,t,n){nx(e,t,n)});function ft(e=!0,t=!1){return fn(p9(),e,t)}function fn(e,t=!0,n=!1){return!!(e?t:n)}let fr=Y("extensionsInternal",{slots:{},extensions:{}}),fa=()=>X("extensionsInternal",{slots:{},extensions:{}});function fo(e){let t=fr.getState(),n=e(t);n!==t&&fr.setState(n)}let fi=()=>X("extensions",{slots:{}});function fs(e){let t=[];for(let n of Object.values(e.extensions))for(let e of n.instances)t.push({slotModuleName:e.slotModuleName,extensionModuleName:n.moduleName,slotName:e.slotName,extensionId:e.id});rm(as.getState().mountedExtensions,t)||as.setState({mountedExtensions:t})}fs(fr.getState()),fr.subscribe(fs);let fl=fa(),fc=fi(),fu=ac(),fd=ap();function fp(e,t,n,r,a){let o={},i=p9(),s=Object.entries(r.flags).filter(([,{enabled:e}])=>e).map(([e])=>e);for(let[r,l]of Object.entries(e.slots)){let{config:c}=ad(t,l.name),u=fw(r,e,c,n,s,i,a.session);o[r]={moduleName:l.moduleName,assignedExtensions:u}}rm(fc.getState().slots,o)||fc.setState({slots:o})}function ff(){fp(fl.getState(),fu.getState(),fd.getState(),p3.getState(),iW.getState())}function fm(e,t,n){return{moduleName:t,name:e,attachedIds:[],config:null,state:n}}function fh(e){let[t]=e.split("#");return t}function fg(e,t){let n=fh(t);return e.extensions[n]}function f_(e){return fg(fl.getState(),e)}fl.subscribe(e=>{fp(e,fu.getState(),fd.getState(),p3.getState(),iW.getState())}),fu.subscribe(e=>{fp(fl.getState(),e,fd.getState(),p3.getState(),iW.getState())}),fd.subscribe(e=>{fp(fl.getState(),fu.getState(),e,p3.getState(),iW.getState())}),p3.subscribe(e=>{fp(fl.getState(),fu.getState(),fd.getState(),e,iW.getState())}),iW.subscribe(e=>{fp(fl.getState(),fu.getState(),fd.getState(),p3.getState(),e)}),ff(),w(ff);let fy=e=>fl.setState(t=>(t.extensions[e.name]={...e,instances:[]},t));function fb(e,t){fo(n=>{let r=n.slots[e];return r?{...n,slots:{...n.slots,[e]:{...r,attachedIds:[...r.attachedIds,t]}}}:{...n,slots:{...n.slots,[e]:{...fm(e),attachedIds:[t]}}}})}function fv(e,t){fo(n=>{let r=n.slots[e];return r&&r.attachedIds.includes(t)?{...n,slots:{...n.slots,[e]:{...r,attachedIds:r.attachedIds.filter(e=>e!==t)}}}:n})}function f$(e){fo(t=>{let n=t.slots[e];return n?{...t,slots:{...t.slots,[e]:{...n,attachedIds:[]}}}:t})}function fA(e,t,n,r){let a=t.indexOf(e);if(-1!==a)return a;{if(void 0!==n)return 1e3+n;let t=r.indexOf(e);return -1!==t?2e3+t:-1}}function fw(e,t,n,r,a,o,i){let s=function(e,t){let n=e.add||[],r=e.remove||[],a=e.order||[],{extensions:o}=fl.getState();return[...t,...n].filter(e=>!r.includes(e)).sort((e,n)=>{let r=fA(e,a,o[fh(e)]?.order,t),i=fA(n,a,o[fh(n)]?.order,t);return -1===i?-1:-1===r?1:r-i})}(n,t.slots[e].attachedIds),l=[],c=t.slots[e]?.state,u=c&&"object"==typeof c?{session:i,...c}:{session:i};for(let c of s){let{config:s}=am(r,e,c),d=fe(s,ah(n,e,c)),p=fh(c),f=t.extensions[p];if(f){let t=d?.["Display conditions"]?.privileges??f.privileges??[];if(t&&("string"==typeof t||Array.isArray(t)&&t.length>0)&&(!i?.user||!iZ(t,i.user)))continue;let n=d?.["Display conditions"]?.expression||f.displayExpression;if(void 0!==n&&"string"==typeof n&&n.trim().length>0)try{if(!pR(n,u))continue}catch(t){console.error(`Error while evaluating expression '${n}' for extension ${p} in slot ${e}`,t);continue}if(f.featureFlag&&!a.includes(f.featureFlag)||window.offlineEnabled&&!fn(o,f.online,f.offline))continue;l.push({id:c,name:p,moduleName:f.moduleName,config:d,featureFlag:f.featureFlag,meta:f.meta,online:d?.["Display conditions"]?.online??f.online??!0,offline:d?.["Display conditions"]?.offline??f.offline??!1})}}return l}function fk(e){let t=fl.getState(),{config:n}=au(e),r=fd.getState(),a=p3.getState(),o=iW.getState(),i=p9();return fw(e,t,n,r,Object.entries(a.flags).filter(([,{enabled:e}])=>e).map(([e])=>e),i,o.session)}let fx=(e,t,n)=>fl.setState(r=>{let a=r.slots[t]?.moduleName;if(a&&a!=e)return console.warn(`An extension slot with the name '${t}' already exists. Refusing to register the same slot name twice (in "registerExtensionSlot"). The existing one is from module ${a}.`),r;if(a&&a==e)return r;if(r.slots[t])return{...r,slots:{...r.slots,[t]:{...r.slots[t],moduleName:e,state:n}}};let o=fm(t,e,n);return{...r,slots:{...r.slots,[t]:{...o}}}});function fC(e,t,n=!1){fl.setState(r=>{let a=n?fe(r.slots[e].state,t):t;return{...r,slots:{...r.slots,[e]:{...r.slots[e],state:a}}}})}let fE=()=>fc.setState(()=>({slots:{},extensions:{}})),fD=Y("left-nav",{slotName:null,basePath:window.spaBase,mode:"normal"});function fS({name:e,basePath:t,mode:n,componentContext:r,state:a}){fD.setState({slotName:e,basePath:t,mode:n??"normal",componentContext:r,state:a})}function fz(e){fD.getState().slotName===e&&fD.setState(fD.getInitialState(),!0)}let fP=Y("modalRegistry",{modals:{}});function fM(e){fP.setState(t=>(t.modals[e.name]=e,t))}function fN(e){let t=fP.getState().modals[e];if(!t){let n=f_(e);n&&(t={name:e,load:n.load,moduleName:n.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.`),fM(t))}return t}let fT=Y("workspaceRegistrations",{workspaces:{}}),fO=Y("workspaceGroups",{workspaceGroups:{}});function fI(e){fT.setState(t=>({workspaces:{...t.workspaces,[e.name]:{...e,load:e.load,preferredWindowSize:e.preferredWindowSize??"normal",type:e.type??"form",canHide:e.canHide??!1,canMaximize:e.canMaximize??!1,width:e.width??"narrow",groups:e.groups??[]}}}))}function fB(e){fO.setState(t=>{let n=t.workspaceGroups[e.name];return n?{workspaceGroups:{...t.workspaceGroups,[e.name]:{...n,members:Array.from(new Set([...n.members,...e.members]))}}}:{workspaceGroups:{...t.workspaceGroups,[e.name]:{name:e.name,members:e.members}}}})}let fR=new Set;function fj(e){let t=fT.getState().workspaces;if(t[e])return t[e];{let t=f_(e);if(t){var n;let r;return fR.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.`),fR.add(e)),{name:t.name,title:(n=t,"string"==typeof(r=n?.meta?.title)?r:r&&"object"==typeof r?i8(n.moduleName,r.key,r.default):n.name),moduleName:t.moduleName,preferredWindowSize:t.meta?.screenSize??"normal",load:t.load,type:t.meta?.type??"form",canHide:t.meta?.canHide??!1,canMaximize:t.meta?.canMaximize??!1,width:t.meta?.width??"narrow",groups:t.meta?.groups??[]}}throw Error(`No workspace named '${e}' has been registered.`)}}function fF(e){let t=fO.getState().workspaceGroups;if(t[e])return t[e];throw Error(`No workspace group named '${e}' has been registered.`)}let fL=Y("workspace2",{registeredGroupsByName:{},registeredWindowsByName:{},registeredWorkspacesByName:{},openedGroup:null,openedWindows:[],workspaceTitleByWorkspaceName:{},isMostRecentlyOpenedWindowHidden:!1});function fW(e){let{registeredWorkspacesByName:t,registeredWindowsByName:n}=fL.getState(),r=t[e];if(r){let t=n[r.window];if(t)return t;throw Error(`No workspace window found with name: ${r.window} for workspace: ${e}`)}throw Error(`No workspace found with name: ${e}`)}function fV(e){let{registeredGroupsByName:t,registeredWindowsByName:n}=fL.getState(),r=n[e];if(r){let n=t[r.group];if(n)return n;throw Error(`No workspace group found with name: ${r.group} for window: ${e}`)}throw Error(`No workspace window found with name: ${e}`)}function fG(e){let{openedWindows:t}=fL.getState();return t.findIndex(t=>t.openedWorkspaces.find(t=>t.workspaceName===e))}function fU(e,t){if(0==t.length)return;let{registeredGroupsByName:n}=fL.getState(),r={...n};for(let n of t){if(r[n.name])throw Error(`Cannot register workspace group ${n.name} more than once`);r[n.name]={...n,moduleName:e}}fL.setState({registeredGroupsByName:r})}function fH(e,t){if(0==t.length)return;let{registeredWindowsByName:n}=fL.getState(),r={...n};for(let n of t){if(r[n.name])throw Error(`Cannot register workspace window ${n.name} more than once`);let t={...n,moduleName:e};r[n.name]=t}fL.setState({registeredWindowsByName:r})}function fq(e,t){if(0==t.length)return;let{registeredWorkspacesByName:n}=fL.getState(),r={...n};for(let n of t){if(r[n.name])throw Error(`Cannot register workspace ${n.name} more than once`);let t={...n,moduleName:e};r[n.name]=t}fL.setState({registeredWorkspacesByName:r})}let fK=0,fZ=null;async function fY(e,t){return(await (fZ??(fZ=new Promise((e,t)=>{oO({name:"openmrs-extension-host",bootstrap:()=>Promise.resolve(),mount:t=>(e(t.mountParcel),Promise.resolve()),unmount:()=>Promise.resolve()},{domElement:document.createElement("div")}).mountPromise.catch(t)}).catch(e=>(console.error("The host parcel used to mount extensions could not be mounted. Falling back to mounting extensions as root parcels, which leaks their DOM elements.",e),oO))),fZ))(e,t)}function fJ(){return fX}function fX(e,t){let n,r=fY(e,t).then(e=>n=e);return{mount:()=>r.then(e=>e.mount()),unmount:()=>r.then(e=>e.unmount()),update:e=>r.then(t=>t.update?.(e)),getStatus:()=>n?.getStatus()??"LOADING_SOURCE_CODE",get loadPromise(){return r.then(e=>e.loadPromise)},get bootstrapPromise(){return r.then(e=>e.bootstrapPromise)},get mountPromise(){return r.then(e=>e.mountPromise)},get unmountPromise(){return r.then(e=>e.unmountPromise)}}}async function fQ(e,t,n,r,a=e=>e,o={}){let i=fh(r),s=f_(r),l=null;if(e){if(!s)throw Error(`Couldn't find extension '${i}' to attach to '${t}'`);let{meta:c,moduleName:u,online:d,offline:p,load:f}=s;if(ft(d,p)){fo(a=>({...a,extensions:{...a.extensions,[i]:{...a.extensions[i],instances:[...a.extensions[i].instances,{domElement:e,id:r,slotName:t,slotModuleName:n}]}}}));let s=await f(),d=fK++;l=await fY(a({...s,name:`${t}/${i}-${d}`}),{...o,_meta:c,_extensionContext:{extensionId:r,extensionSlotName:t,extensionSlotModuleName:n,extensionModuleName:u},domElement:e})}}else console.warn(`Tried to render ${r} into ${t} but no DOM element was available.`);return l}var f0=n(9485),f1=n.n(f0);let f2=(0,f0.createContext)({moduleName:"",featureName:""});function f3({to:e,templateParams:t,onBeforeNavigate:n,children:r,...a}){return(0,f0.useEffect)(()=>{a.href&&console.warn(`ConfigurableLink does not support the href prop. Use the 'to' prop instead. The provided href value is '${a.href}'`),a.onClick&&console.warn(`ConfigurableLink does not support the onClick prop. Use the 'onBeforeNavigate' prop instead. The 'to' prop of the offending link is ${e}`)},[]),f1().createElement("a",{onClick:r=>{0===r.button&&!r.ctrlKey&&!r.shiftKey&&!r.altKey&&!r.metaKey&&(r.preventDefault(),n?.(r),ix({to:e,templateParams:t})),0===r.button&&(r.ctrlKey||r.metaKey)&&n?.(r),0===r.button&&r.shiftKey&&n?.(r),1===r.button&&n?.(r)},href:iw(e,t),...a},r)}let f4=({state:e,children:t,...n})=>{let{extension:r}=(0,f0.useContext)(f2),a=(0,f0.useRef)(null),o=(0,f0.useRef)(Promise.resolve()),i=(0,f0.useCallback)(t=>{r?.extensionSlotName&&r.extensionSlotModuleName&&r.extensionSlotModuleName&&!a.current&&fQ(t,r.extensionSlotName,r.extensionSlotModuleName,r.extensionId,void 0,e).then(e=>{a.current=e})},[]);return(0,f0.useEffect)(()=>()=>{if(a&&a.current)switch(a.current.getStatus()){case"MOUNTING":a.current.mountPromise.then(()=>{a.current?.getStatus()==="MOUNTED"&&a.current.unmount()});break;case"MOUNTED":a.current.unmount();break;case"UPDATING":o.current&&o.current.then(()=>{a.current?.getStatus()==="MOUNTED"&&a.current.unmount()})}},[]),(0,f0.useEffect)(()=>{a.current&&a.current.update&&"UNMOUNTING"!==a.current.getStatus()&&Promise.all([a.current.mountPromise,o.current]).then(()=>{a?.current?.getStatus()==="MOUNTED"&&a.current.update&&(o.current=a.current.update({...e}).catch(e=>{if(!(e instanceof Error)||!e.message.includes("minified message #32")||a.current?.getStatus()==="MOUNTED")throw e}))})},[e]),r?f1().createElement("div",{ref:i,"data-extension-id":r?.extensionId,style:{position:"relative"},...n}):null};function f5(e,t){"function"==typeof t&&(t=t(e));let n={};for(let[r,a]of Object.entries(t)){let t=function(...t){e.setState(e=>a(e,...t))};n[r]=t}return n}let f6=()=>e=>e;function f7(e,t=f6(),n){let r=(0,f0.useCallback)(t=>e.subscribe(t),[e]),a=(0,f0.useCallback)(()=>t(e.getState()),[e,t]),o=(0,f0.useSyncExternalStore)(r,a,a),i=(0,f0.useMemo)(()=>n?f5(e,n):{},[e,n]);return{...o,...i}}function f8(e,t){return f7(e,f6(),t)}function f9(e){return function(t){let n=(0,f0.useCallback)(t=>e.subscribe(t),[]),r=(0,f0.useCallback)(()=>e.getState(),[]),a=(0,f0.useSyncExternalStore)(n,r,r),o=(0,f0.useMemo)(()=>t?f5(e,t):{},[t]);return{...a,...o}}}let me=e=>f7(fi(),t=>t.slots?.[e]);function mt(e){let t=me(e);return t?.assignedExtensions??[]}function mn(e,t){let{moduleName:n}=(0,f0.useContext)(f2),r=(0,f0.useRef)(!0);if(!n)throw Error("ComponentContext has not been provided. This should come from @openmrs/esm-react-utils.");return(0,f0.useEffect)(()=>{fx(n,e,t),r.current=!1},[]),(0,f0.useEffect)(()=>{r.current||fC(e,t)},[e,t]),{extensions:mt(e),extensionSlotName:e,extensionSlotModuleName:n}}function mr(e){return e}function ma({name:e,extensionSlotName:t,select:n=mr,children:r,state:a,style:o,...i}){if(r&&a)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??t,l=(0,f0.useRef)(null),{extensions:c,extensionSlotModuleName:u}=mn(s,a),d=(0,f0.useMemo)(()=>n(c),[n,c]),p=(0,f0.useMemo)(()=>{if("function"==typeof r&&!f1().isValidElement(r))return d.map(e=>r(e,a))},[r,d]);return f1().createElement("div",{ref:l,"data-extension-slot-name":s,"data-extension-slot-module-name":u,style:{...o,position:"relative"},...i},s&&d?.map((e,t)=>f1().createElement(f2.Provider,{key:e.id,value:{moduleName:u,featureName:"",extension:{extensionId:e.id,extensionSlotName:s,extensionSlotModuleName:u}}},p?.[t]??("function"!=typeof r?r:null)??f1().createElement(f4,{state:a}))))}var mo=n(5873);function mi(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function ms(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?mi(Object(n),!0).forEach(function(t){var r,a,o;r=e,a=t,o=n[t],a in r?Object.defineProperty(r,a,{value:o,enumerable:!0,configurable:!0,writable:!0}):r[a]=o}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):mi(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function ml(e){return(ml="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 mc(e){return(mc="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 mu(e,t){var n;if("function"!=typeof(n=t.domElement?function(){return t.domElement}:t.domElementGetter?t.domElementGetter:e.domElementGetter?e.domElementGetter:function(e){var t=e.appName||e.name;if(!t)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 n="single-spa-application:".concat(t);return function(){var e=document.getElementById(n);return e||((e=document.createElement("div")).id=n,document.body.appendChild(e)),e}}(t)))throw Error("single-spa's dom-element-getter-helpers was given an invalid domElementGetter for application or parcel '".concat(t.name,"'. Expected a function, received ").concat(mc(n)));return function(){var e=n(t);if(!(e instanceof HTMLElement))throw Error("single-spa's dom-element-getter-helpers: domElementGetter returned an invalid dom element for application or parcel '".concat(t.name,"'. Expected HTMLElement, received ").concat(mc(e)));return e}}var md=null;try{md=require("react").createContext()}catch(e){}var mp={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 mf(e,t){return e.rootComponent?Promise.resolve():e.loadRootComponent(t).then(function(t){e.rootComponent=t})}function mm(e,t){return new Promise(function(n,r){e.suppressComponentDidCatchWarning||!function(e){if(!(e&&"string"==typeof e.version&&e.version.indexOf(".")>=0))return!1;var t=e.version.slice(0,e.version.indexOf("."));try{return Number(t)>=16}catch(e){return!1}}(e.React)||e.errorBoundary||e.errorBoundaryClass||(e.rootComponent.prototype?e.rootComponent.prototype.componentDidCatch||console.warn("single-spa-react: ".concat(t.name||t.appName||t.childAppName,"'s rootComponent should implement componentDidCatch to avoid accidentally unmounting the entire single-spa application.")):console.warn("single-spa-react: ".concat(t.name||t.appName||t.childAppName,"'s rootComponent does not implement an error boundary. If using a functional component, consider providing an opts.errorBoundary to singleSpaReact(opts).")));var a,o=my(e,t,function(){n(this)}),i=mu(e,t)(),s=function(e){var t=e.reactDom,n=e.renderType,r=e.elementToRender,a=e.domElement,o=t[n];if("function"!=typeof o)throw Error('renderType "'.concat(n,'" did not return a function.'));switch(n){case"createRoot":case"unstable_createRoot":case"createBlockingRoot":case"unstable_createBlockingRoot":var i=o(a);return i.render(r),i;case"hydrateRoot":return o(a,r);default:return o(r,a),null}}({elementToRender:o,domElement:i,reactDom:m_(e),renderType:"function"==typeof(a=e).renderType?a.renderType():a.renderType});e.domElements[t.name]=i,e.renderResults[t.name]=s})}function mh(e,t){return new Promise(function(n){e.unmountResolves[t.name]=n;var r=e.renderResults[t.name];r&&r.unmount?r.unmount():m_(e).unmountComponentAtNode(e.domElements[t.name]),delete e.domElements[t.name],delete e.renderResults[t.name]})}function mg(e,t){return new Promise(function(n){e.updateResolves[t.name]||(e.updateResolves[t.name]=[]),e.updateResolves[t.name].push(n);var r=my(e,t,null),a=e.renderResults[t.name];if(a&&a.render)a.render(r);else{var o=mu(e,t)();m_(e).render(r,o)}})}function m_(e){return e.ReactDOMClient||e.ReactDOM}function my(e,t,n){var r=e.React.createElement(e.rootComponent,t),a=md?e.React.createElement(md.Provider,{value:t},r):r;return(e.errorBoundary||t.errorBoundary||e.errorBoundaryClass||t.errorBoundaryClass)&&(e.errorBoundaryClass=e.errorBoundaryClass||t.errorBoundaryClass||function(e,t){function n(t){e.React.Component.apply(this,arguments),this.state={caughtError:null,caughtErrorInfo:null},n.displayName="SingleSpaReactErrorBoundary(".concat(t.name,")")}return n.prototype=Object.create(e.React.Component.prototype),n.prototype.render=function(){return this.state.caughtError?(e.errorBoundary||t.errorBoundary)(this.state.caughtError,this.state.caughtErrorInfo,this.props):this.props.children},n.prototype.componentDidCatch=function(e,t){this.setState({caughtError:e,caughtErrorInfo:t})},n}(e,t),a=e.React.createElement(e.errorBoundaryClass,t,a)),a=e.React.createElement(e.SingleSpaRoot,ms(ms({},t),{},{mountFinished:n,updateFinished:function(){e.updateResolves[t.name]&&(e.updateResolves[t.name].forEach(function(e){return e()}),delete e.updateResolves[t.name])},unmountFinished:function(){e.unmountResolves[t.name]&&(e.unmountResolves[t.name](),delete e.unmountResolves[t.name])}}),a)}var mb=n(761),mv=n(1123),m$=n(9966);let mA={strictMode:!0,throwErrorsToConsole:!0,disableTranslations:!1},mw=new Map;(0,m$.initCache)(mw);let mk={errorRetryCount:3,fetcher:ij,focusThrottleInterval:18e5,revalidateIfStale:!0,revalidateOnFocus:!1,revalidateOnReconnect:!1,refreshInterval:0,shouldRetryOnError:e=>{if(e instanceof iL){let t=e.response.status;return!!(t>=500)||401===t||403===t||429===t}return!0},provider:()=>mw};function mx(e){if("object"!=typeof e||"string"!=typeof e.featureName||"string"!=typeof e.moduleName)throw Error("Invalid options");let t=Object.assign({},mA,e),n={...mk,...t.swrConfig};return function(e){var r,a,o,i,s;return o=a=class extends(r=f1().Component){componentDidCatch(e,n){n&&n.componentStack&&(e.extra=Object.assign(e.extra||{},{componentStack:n.componentStack})),t.throwErrorsToConsole&&setTimeout(()=>{throw e}),this.setState({caughtError:e,caughtErrorInfo:n})}render(){if(this.state.caughtError)return f1().createElement("div",null,"An error has occurred. Please try reloading the page.");{let r=f1().createElement(f0.Suspense,{fallback:null},f1().createElement(mv.BE,{value:n},f1().createElement(f2.Provider,{value:this.state.config},t.disableTranslations?f1().createElement(e,this.props):f1().createElement(mb.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},f1().createElement(e,this.props)))));return t.strictMode&&f1().StrictMode?f1().createElement(f1().StrictMode,null,r):r}}constructor(e){super(e),this.state={caughtError:null,caughtErrorInfo:null,config:{moduleName:t.moduleName,featureName:t.featureName,extension:e._extensionContext}}}},i="displayName",s=`OpenmrsReactComponent(${t.featureName})`,i in o?Object.defineProperty(o,i,{value:s,enumerable:!0,configurable:!0,writable:!0}):o[i]=s,a}}function mC(e,t){return function(e){if("object"!==ml(e))throw Error("single-spa-react requires a configuration object");var t,n=ms(ms({},mp),e);if(!n.React)throw Error("single-spa-react must be passed opts.React");if(!n.ReactDOM&&!n.ReactDOMClient)throw Error("single-spa-react must be passed opts.ReactDOM or opts.ReactDOMClient");if(n.renderType||(null!=(t=n.ReactDOMClient)&&t.createRoot?n.renderType="createRoot":n.renderType="render"),!n.rootComponent&&!n.loadRootComponent)throw Error("single-spa-react must be passed opts.rootComponent or opts.loadRootComponent");if(n.errorBoundary&&"function"!=typeof n.errorBoundary)throw Error("The errorBoundary opt for single-spa-react must either be omitted or be a function that returns React elements");!md&&n.React.createContext&&(md=n.React.createContext()),n.SingleSpaRoot=function(e){function t(e){t.displayName="SingleSpaRoot(".concat(e.name,")")}return t.prototype=Object.create(e.React.Component.prototype),t.prototype.componentDidMount=function(){setTimeout(this.props.mountFinished)},t.prototype.componentWillUnmount=function(){setTimeout(this.props.unmountFinished)},t.prototype.render=function(){return setTimeout(this.props.updateFinished),this.props.children},t}(n);var r={bootstrap:mf.bind(null,n),mount:mm.bind(null,n),unmount:mh.bind(null,n)};return n.parcelCanUpdate&&(r.update=mg.bind(null,n)),r}({React:f1(),ReactDOMClient:mo,rootComponent:mx(t)(e)})}function mE(e,t){return()=>e().then(({default:e})=>mC(e,t))}function mD(e,t){return()=>Promise.resolve(mC(e,t))}let mS=mE,mz=q()(()=>({}));J("openmrs-app-context",mz);let mP={};function mM(e,t=e=>e){let n=mz.getState();return e in n?Object.freeze(Object.assign({},t?t(n[e]):n[e])):null}function mN(e,t){mz.setState(n=>(e in n||(n[e]={}),n[e]=t(n[e]),Object.assign({},n)))}function mT(e){return null===e?null:Object.freeze(Object.assign({},e))}let mO=new Map;function mI(e,t){let n=(0,f0.useRef)(t??{}),r=(0,f0.useRef)(t=>mN(e,t)),a=(0,f0.useRef)(Symbol());return(0,f0.useEffect)(()=>{let n=t??{},r=a.current;return null===mM(e)?!function(e,t=mP){mz.setState(n=>{if(e in n)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({},n,{[e]:t===mP?{}:t})})}(e,n):(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.`),mN(e,()=>n)),mO.set(e,r),()=>{mO.get(e)===r&&(mz.setState(t=>(e in t&&delete t[e],t)),mO.delete(e))}},[e]),(0,f0.useEffect)(()=>{let r=t??{};V(n.current,r)||(mN(e,()=>r),n.current=r)},[t]),r.current}function mB({namespace:e,value:t}){return mI(e,t),null}let mR=({children:e,value:t,fallback:n})=>t?f1().createElement(f1().Fragment,null,e):n?f1().createElement(f1().Fragment,null,n):null;function mj(){let e=(0,f0.useRef)();return(!e.current||e.current.signal.aborted)&&(e.current=new AbortController),(0,f0.useEffect)(()=>{let t=e.current;return()=>t?.abort()},[]),e.current}function mF(e,t=e=>e??{}){let[n,r]=(0,f0.useState)(()=>{if(mL(e))return;let n=mM(e);if(null!==n)return t?t(n):n});return(0,f0.useEffect)(()=>{if(mL(e))throw Error(`The namespace supplied to useAppContext must be a non-empty string, but was "${e}".`)},[e]),(0,f0.useEffect)(()=>{var n;let a;return(n=e=>{if(null==e)return void r(void 0);let n=t?t(e):e;r(e=>V(e,n)?e:n)})(mT(a=mM(e))),mz.subscribe(t=>{let r=e in t?t[e]:null;r!==a&&(a=r,n(mT(r)))})},[e,t]),n}function mL(e){return"string"!=typeof e||0===e.trim().length}function mW(e){let[t,n]=(0,f0.useState)([]);return(0,f0.useEffect)(()=>fi().subscribe(r=>{let a=r.slots[e]?.assignedExtensions.map(e=>e.id)??[];rm(a,t)||n(a)}),[]),t}function mV(e,t){let{data:n,error:r,mutate:a,isLoading:o,isValidating:i}=(0,mv.Ay)(`${sq}?patient=${e}&includeEncounterless=${t}`,ij);return(0,f0.useMemo)(()=>({isLoading:o,data:n?.data.results??[],error:r,mutate:a,isValidating:i}),[n,r,o,i,a])}function mG(e){(0,f0.useEffect)(()=>{if(e){let e=window.getComputedStyle(document.body).overflow;return document.body.style.overflow="hidden",()=>{document.body.style.overflow=e}}},[e])}let mU={},mH=`No ComponentContext has been provided. This should come from "openmrsComponentDecorator".
16
+ Usually this is already applied when using "getAsyncLifecycle" or "getSyncLifecycle".`;function mq(e){let{moduleName:t,extension:n}=(0,f0.useContext)(f2),r=e?.externalModuleName??t;if(!r&&!n)throw Error(mH);let a=function(e){let t=(0,f0.useMemo)(()=>al(e),[e]),n=function(e){let[t,n]=(0,f0.useState)(()=>{let t=e.getState();return t.loaded&&t.config?t.config:null});return(0,f0.useEffect)(()=>e?.subscribe(e=>{e.loaded&&e.config&&n(e.config)}),[e]),t}(t);if(!n)throw mU[e]||(mU[e]=new Promise(e=>{let n=t.subscribe(t=>{t.loaded&&t.config&&(e(t.config),n())})})),mU[e];return n}(r),o=function(e){let t=(0,f0.useMemo)(ap,[]),n=function(e,t){let[n,r]=(0,f0.useState)(t?()=>{let n=am(e.getState(),t.extensionSlotName,t.extensionId);if(n.loaded&&n.config)return n.config}:null);return(0,f0.useEffect)(()=>{if(t)return e.subscribe(e=>{let a=am(e,t.extensionSlotName,t.extensionId);a.loaded&&a.config&&!rm(a.config,n)&&r(a.config)})},[e,t,n]),n}(t,e);if(!n&&e){let n=`${e.extensionSlotName}-${e.extensionId}`;throw!mU[n]&&t&&(mU[n]=new Promise(n=>{let r=t.subscribe(t=>{let a=am(t,e.extensionSlotName,e.extensionId);a.loaded&&a.config&&(n(a.config),r())})})),mU[n]}return n||{}}(n);return(0,f0.useMemo)(()=>e?.externalModuleName&&r===e.externalModuleName?{...a}:{...a,...o},[r,e?.externalModuleName,a,o])}let mK=mt;function mZ(){let[e,t]=(0,f0.useState)(p9());return(0,f0.useEffect)(()=>w(({online:e})=>t(e)),[]),e}function mY(e,t=300){let[n,r]=(0,f0.useState)(e);return(0,f0.useEffect)(()=>{let n=setTimeout(()=>{r(e)},t);return()=>{clearTimeout(n)}},[e,t]),n}var mJ=n(8254),mX=n.n(mJ);let mQ=`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,t])=>`${e}:${t}`).join(",")}`;function m0(){let e=`${iO}/emrapi/configuration?v=${mQ}`,t=mX()(e,ij);return(0,f0.useMemo)(()=>({emrConfiguration:t.data?.data,isLoadingEmrConfiguration:t.isLoading,mutateEmrConfiguration:t.mutate,errorFetchingEmrConfiguration:t.error}),[t])}let m1=f9(fa());function m2(e){let t=mt(e);return(0,f0.useMemo)(()=>Object.fromEntries(t.map(e=>[e.name,e.meta])),[t])}let m3=f9(fi());function m4(e){let{flags:t}=f7(p3);return t[e]?.enabled??!1}function m5(){let[,e]=(0,f0.useState)(0);return(0,f0.useCallback)(()=>{e(e=>e+1)},[])}function m6(e,t,n={}){return m8(e,t,m7,n)}let m7={getPaginatedUrl:(e,t,n)=>{if(!e)return null;{let r=new URL(iR(e.toString()),window.location.toString());return r.searchParams.set("limit",""+t),r.searchParams.set("startIndex",""+n),r.searchParams.set("totalCount","true"),r.toString()}},getNextUrl:e=>{let t=e?.links?.find(e=>"next"==e.rel)?.uri;if(!t)return null;{let e=new URL(t);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 m8(e,t,n,r={}){let{getPaginatedUrl:a,getTotalCount:o,getCurrentPageSize:i,getData:s}=n,{immutable:l,swrConfig:c}=r,u=r.fetcher??ij,[d,p]=(0,f0.useState)(1),f=(0,f0.useRef)(NaN),m=(0,f0.useRef)(NaN),h=(d-1)*t,g=(0,f0.useMemo)(()=>a(e,t,h),[e,t,h]),{data:y,...b}=(l?mX():mv.Ay)(g,u,c);y?.data&&(f.current=o(y?.data),m.current=i(y?.data));let v=Math.ceil(f.current/t),$=(0,f0.useCallback)(e=>{0<e&&e<=v?p(e):console.warn("Invalid attempt to go to out of bounds page: "+e)},[e,d,v]),A=(0,f0.useCallback)(()=>{$(d+1)},[e,d,v]),w=(0,f0.useCallback)(()=>{$(d-1)},[e,d,v]);return{data:s(y?.data),totalPages:v,totalCount:f.current,currentPage:d,currentPageSize:m,paginated:v>1,showNextButton:d<v,showPreviousButton:d>1,goTo:$,goToNext:A,goToPrevious:w,...b}}function m9(e,t,n={}){return m8(e,t,he(),n)}function he(){return{getPaginatedUrl:(e,t,n)=>{if(!e)return null;{let r=new URL(iR(e.toString()),window.location.toString());return r.searchParams.set("_count",""+t),r.searchParams.set("_getpagesoffset",""+n),r.toString()}},getNextUrl:e=>{let t=e?.link?.find(e=>"next"==e.relation)?.url;if(!t)return null;{let e=new URL(t);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 ht=n(9896),hn=n.n(ht);function hr(e,t={}){return ha(e,m7,t)}function ha(e,t,n={}){let{swrInfiniteConfig:r,immutable:a}=n,{getNextUrl:o,getTotalCount:i,getData:s}=t,l=n.fetcher??ij,c=(0,f0.useCallback)((n,r)=>0==n?e?.toString()??null:t.getNextUrl(r.data),[e]),{data:u,size:d,setSize:p,...f}=hn()(c,l,{...r,...a?{revalidateIfStale:!1,revalidateOnFocus:!1,revalidateOnReconnect:!1}:{}}),m=o(u?.[u.length-1].data),h=i(u?.[0]?.data);return{data:u?.flatMap(e=>s(e.data)),totalCount:h,hasMore:null!=m,loadMore:()=>{p((u?.length??0)+1)},nextUri:m,...f}}function ho(e,t={}){return hi(e,m7,t)}function hi(e,t,n={}){let r=ha(e,t,n),{hasMore:a,error:o,data:i,loadMore:s,isLoading:l,nextUri:c}=r;return((0,f0.useEffect)(()=>{a&&!o&&s()},[a,c]),n.partialData)?r:{...r,data:a||o?void 0:i,isLoading:l||a}}function hs(e,t={}){return hi(e,he(),t)}function hl(e,t={}){return ha(e,he(),t)}function hc(){let e="tablet";return document.body.classList.forEach(t=>{switch(t){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 hu(){let[e,t]=(0,f0.useState)(hc);return(0,f0.useEffect)(()=>{let e=()=>{t(hc())};return window.addEventListener("resize",e),()=>window.removeEventListener("resize",e)},[]),e}let hd=e=>"small-desktop"===e||"large-desktop"===e;function hp(e){let t=(0,f0.useContext)(f2);(0,f0.useEffect)(()=>(t&&t.moduleName&&(e.componentContext=t),fS(e),()=>{fz(e.name)}),[t,e])}function hf(){return f7(fD)}function hm(e=null,t=null){let[n,r]=(0,f0.useState)([]);return(0,f0.useEffect)(()=>{let n=pd(e,t).subscribe(e=>{r(e)},e=>{console.error(e)});return()=>n.unsubscribe()},[e,t]),n}function hh(e,t=!0){let n=(0,f0.useRef)(null);return(0,f0.useEffect)(()=>{let r=r=>{t&&n.current&&r.target&&r.target instanceof Node&&(n.current.contains(r.target)||e(r))};return window.addEventListener("mousedown",r),window.addEventListener("touchstart",r),()=>{window.removeEventListener("mousedown",r),window.removeEventListener("touchstart",r)}},[e,t]),n}function hg(e){let t=(0,f0.useRef)();return(0,f0.useEffect)(()=>{let n=new IntersectionObserver(t=>{for(let n of t)if(n.isIntersecting)return void e()},{threshold:1});return t.current&&n.observe(t.current),()=>{t.current&&n.unobserve(t.current)}},[t.current,e]),t}function h_(e,t={}){let{abortController:n,fetchInit:r,url:a,swrConfig:o}=t,i=mj(),s=(0,f0.useMemo)(()=>r?.signal??n?.signal??i.signal,[n?.signal,r?.signal,i.signal]),l=(0,f0.useCallback)(e=>ij(function(e,t){if(t)return"function"==typeof t?t(e):t;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,a),{...r,signal:s}),[s,r,a]);return(0,mv.Ay)(e,l,o)}function hy(e=[],t=10){let[n,r]=(0,f0.useState)(1),a=(0,f0.useMemo)(()=>"number"==typeof t&&t>0?Math.max(1,Math.ceil(e.length/t)):1,[e.length,t]),o=(0,f0.useMemo)(()=>{let r=(n-1)*t,a=(n+0)*t;return e.slice(r,a)},[e,n,t]),i=(0,f0.useCallback)(e=>{r(Math.max(1,Math.min(a,e)))},[r,a]),s=(0,f0.useCallback)(()=>{n<a&&r(n+1)},[n,a,r]),l=(0,f0.useCallback)(()=>{n>1&&r(n-1)},[n,r]);return(0,f0.useMemo)(()=>({results:o,totalPages:a,currentPage:n,paginated:e.length>t,showNextButton:n<a,showPreviousButton:n>1,goTo:i,goToNext:s,goToPrevious:l}),[o,a,e.length,t,n,i,s,l])}function hb(e,t,n,r){return{pageSizes:(0,f0.useMemo)(()=>{let n=Math.ceil(t/e);return isNaN(n)&&(n=0),[...Array(n).keys()].map(t=>(t+1)*e)},[e,t]),pageItemsCount:(0,f0.useMemo)(()=>e>t?t:e*n>t?e*(n-1)+r:e*n,[e,t,n,r])}}function hv(){let e=/\/patient\/([a-zA-Z0-9\-]+)\/?/.exec(location.pathname);return e&&e[1]}function h$(e){let[t,n]=(0,f0.useState)(e??hv()),{data:r,error:a,isValidating:o}=(0,mv.Ay)(t?["patient",t]:null,()=>po(t,{}));return(0,f0.useEffect)(()=>{let e=()=>{let e=hv();e!==t&&n(e)};return window.addEventListener("single-spa:routing-event",e),()=>window.removeEventListener("single-spa:routing-event",e)},[t]),(0,f0.useMemo)(()=>({isLoading:o&&!a&&!r,patient:r,patientUuid:t,error:a}),[o,a,r,t])}function hA(){let e=`${iO}/metadatamapping/termmapping?v=custom:(metadataUuid)&code=emr.primaryIdentifierType`,{data:t,error:n,isLoading:r}=(0,mv.Ay)(e,ij);return(0,f0.useMemo)(()=>({primaryIdentifierCode:t?.data?.results[0]?.metadataUuid,isLoading:r,error:n}),[t,n,r])}function hw(e){let{extensions:t,extensionSlotModuleName:n}=mn(e);return e?t.map(t=>({state:r})=>f1().createElement(f2.Provider,{value:{moduleName:n,featureName:"",extension:{extensionId:t.id,extensionSlotName:e,extensionSlotModuleName:n}}},f1().createElement(f4,{state:r}))):[]}function hk(){let e=(0,f0.useRef)(),[t,n]=(0,f0.useState)(null),r=null;if(!t){if(i){let e=iU().getState();e.loaded&&(r=e.session)}else i=new Promise(t=>{let n=({loaded:n,session:a})=>{n&&(t(a),r=a,e.current&&(e.current(),e.current=void 0))};n(iU().getState()),r||(e.current=iU().subscribe(n))});if(r)n(r);else throw i}(0,f0.useEffect)(()=>(e.current||(e.current=iU().subscribe(({loaded:e,session:t})=>{e&&(r=t,n(t))})),()=>{e.current&&(e.current(),e.current=void 0)}),[]);let a=t||r;if(!a)if(i)throw console.warn("useSession is in an unexpected state. Attempting to recover."),i;else throw Error("useSession is in an invalid state.");return a}let hx=({privilege:e,fallback:t,children:n})=>{let[r,a]=(0,f0.useState)(null);return((0,f0.useEffect)(()=>{let e=iG({includeAuthStatus:!1}).subscribe(a);return()=>e.unsubscribe()},[]),r&&iZ(e,r))?f1().createElement(f1().Fragment,null,n):t?f1().createElement(f1().Fragment,null,t):null};var hC=n(3464),hE=n.n(hC),hD=n(5602);let hS=new Map;function hz(){for(let e of Array.from(hS.values()))e()}let hP={setVisitContext:(e,t)=>null==t?{manuallySetVisitUuid:null}:{manuallySetVisitUuid:t.uuid,patientUuid:t.patient?.uuid}};function hM(e){let t=(0,f0.useId)();return(0,f0.useEffect)(()=>{if(e)return hS.set(t,e),()=>{hS.delete(t)}},[t,e]),{...f8(pk(),hP),mutateVisit:hz}}function hN(e,t=pA){let n=(0,f0.useRef)(void 0),{patientUuid:r,manuallySetVisitUuid:a,setVisitContext:o}=hM((0,f0.useCallback)(()=>n.current?.(),[])),i=e&&r==e?a:null,s=`?patient=${e}&v=${t}&includeInactive=false`,l=`/${i}?v=${t}`,{data:c,error:u,mutate:d,isValidating:p}=(0,mv.Ay)(e?`${iO}/visit${s}`:null,ij),{data:f,error:m,mutate:h,isValidating:g}=(0,mv.Ay)(e&&i?`${iO}/visit${l}`:null,ij),y=(0,f0.useMemo)(()=>c?.data.results.find(e=>null===e.stopDatetime)??null,[c]),b=(0,f0.useMemo)(()=>i&&f?f.data:null,[f,i]),v=(0,f0.useRef)(null);(0,f0.useEffect)(()=>{!p&&y&&r===e&&null===a&&o(y),g||(v.current&&b&&v.current.uuid===b.uuid&&!v.current.stopDatetime&&b.stopDatetime&&o(null),v.current=b)},[b,a,y,p,g,r]);let $=(0,f0.useCallback)(()=>{d(),h()},[d,h]);(0,f0.useEffect)(()=>{n.current=$},[$]);let A=!!(!c||i&&!f),w=!!(i?m:u);return{error:u||m,mutate:$,isValidating:p||g,activeVisit:y,currentVisit:b,currentVisitIsRetrospective:!!i,isLoading:A&&!w}}function hT(){let[e,t]=(0,f0.useState)([]);return(0,f0.useEffect)(()=>{let e=pf().subscribe(e=>{t(e)},e=>console.error(e));return()=>e.unsubscribe()},[]),e}hC.extend(hD);let hO=new Map;async function hI(e,t){let n=t.indexOf("#"),r=n>=0,a=r?t.substring(0,n):e,o=r?t.substring(n+1):t,i=await sw(a);return i&&Object.hasOwn(i,o)&&"function"==typeof i[o]?hR(a,i).then(()=>i[o]()):(i?i&&Object.hasOwn(i,o)?console.warn(`The export ${t}, defined in ${e}'s routes.json, is not a function`):console.warn(`${a} does not define a component called "${o}", referenced in ${e}'s routes.json. This cannot be loaded.`):console.warn(`Unknown app ${a} for ${t} defined in ${e}'s routes.json`),hB)}let hB={bootstrap:()=>Promise.resolve(),mount:()=>Promise.resolve(),unmount:()=>Promise.resolve()};async function hR(e,t){if(e in hO)await hO[e];else{let n=t??await sw(e);await (hO[e]=new Promise((t,r)=>{if(Object.hasOwn(n,"startupApp")){let a=n.startupApp;if("function"==typeof a)return Promise.resolve(a()).then(()=>{aw(e),t(null)}).catch(r)}aw(e),t(null)}))}}function hj(e,t){let n=t.name;if(!n)return void console.error(`An extension definition in ${e} is missing an name and thus cannot be
17
17
  registered. To fix this, ensure that you define the "name" field inside the
18
18
  extension definition.`,t);t.slots&&t.slot&&console.warn(`The extension ${n} from ${e} declares both a 'slots' property and
19
19
  a 'slot' property. Only the 'slots' property will be honored.`);let r=t.slots?t.slots:t.slot?[t.slot]:[];if(!t.component)return void console.error(`The extension ${n} from ${e} is missing a 'component' entry and thus cannot be registered.
@@ -34,7 +34,7 @@ To fix this, ensure that you define the "component" field inside the page defini
34
34
  button:not([disabled]):not([tabindex='-1']),select:not([disabled]):not([tabindex='-1']),
35
35
  textarea:not([disabled]):not([tabindex='-1']),
36
36
  iframe, object, embed, *[tabindex]:not([tabindex='-1']):not([disabled]), *[contenteditable=true]
37
- `,_m="u">typeof Node?Node.DOCUMENT_POSITION_PRECEDING|Node.DOCUMENT_POSITION_CONTAINS:0,_h="u">typeof Node?Node.DOCUMENT_POSITION_FOLLOWING|Node.DOCUMENT_POSITION_CONTAINED_BY:0,_g=(e,t=[])=>e instanceof Element&&"function"==typeof e.closest&&[".cds--overflow-menu-options",".cds--tooltip",".flatpickr-calendar",...t].some(t=>!!e.closest(t)),__=({bodyNode:e,startTrapNode:t,endTrapNode:n,currentActiveNode:r,oldActiveNode:a,selectorsFloatingMenus:o})=>{if(e&&r&&a&&!e.contains(r)&&!_g(r,o)){let o=a.compareDocumentPosition(r);if(r===t||o&_m){let t=Array.from(e.querySelectorAll(_f)).reverse().find(({offsetParent:e})=>!!e);t?t.focus():e!==a&&e.focus()}else if(r===n||o&_h){let t=Array.from(e.querySelectorAll(_f)).find(({offsetParent:e})=>!!e);t?t.focus():e!==a&&e.focus()}}},_y=({containerNode:e,currentActiveNode:t,event:n})=>{if(!e)return;["blur","focusout","focusin","focus"].includes(n.type);let r=(0,_p.Kr)(e),a=r[0],o=r[r.length-1];t!==o||n.shiftKey||(n.preventDefault(),a.focus()),t===a&&n.shiftKey&&(n.preventDefault(),o.focus())},_b=e=>(t,...n)=>{for(let r of e){if(t.defaultPrevented)break;"function"==typeof r&&r(t,...n)}},_v=(0,f0.createContext)({direction:"auto",getTextDirection:{current:void 0}}),_$=f1().forwardRef(({as:e,children:t,dir:n="auto",...r},a)=>{let o=(0,f0.useContext)(_v),i={},s={...o};if(o){let{direction:e,getTextDirection:r}=o;if(r&&r.current){let n=_A(t),a=r.current(n);e!==a?(i.dir=a,s.direction=a):"auto"===e&&(i.dir=a)}else e!==n?(i.dir=n,s.direction=n):"auto"===e&&(i.dir=n)}else i.dir=n,s.direction=n;return f1().createElement(_v.Provider,{value:s},f1().createElement(e??"span",gi({ref:a},r,i),t))});_$.propTypes={as:gl().oneOfType([gl().func,gl().string,gl().elementType]),children:gl().node,dir:gl().oneOf(["ltr","rtl","auto"])};let _A=e=>{if("string"==typeof e)return e;let t=f0.Children.map(e,e=>"string"==typeof e?e:null)?.filter(e=>null!==e);return t?.length===1?t[0]:t},_w=(0,f0.createContext)({}),_k=f1().forwardRef(({children:e,className:t,focusAfterCloseRef:n,modal:r,onCancel:a=_a,onClick:o=_a,onClose:i=_a,onRequestClose:s=_a,open:l=!1,role:c,ariaLabel:u,ariaLabelledBy:d,ariaDescribedBy:p,...f},m)=>{let h=gm(),g=gG(),y=`${h}--dialog-header__heading--${g}`,b=`${h}--dialog-header__label--${g}`,v=(0,f0.useRef)(null),$=m??v;(0,f0.useEffect)(()=>{$.current&&(l?r?$.current.showModal():$.current.show():$.current.close())},[r,l]),(0,f0.useEffect)(()=>{if(!l&&n){let e=setTimeout(()=>{n.current?.focus()});return()=>{clearTimeout(e)}}},[l,n]);let A=hZ()(`${h}--dialog-container`);return(0,f0.useEffect)(()=>{if($.current&&l&&!u&&!d){let e=$.current.querySelector(`.${h}--dialog-header__heading`);e&&e.id&&$.current.setAttribute("aria-labelledby",e.id)}},[l,u,d,h]),f1().createElement(_w.Provider,{value:{dialogId:g,titleId:y,subtitleId:b,isOpen:l}},f1().createElement("dialog",gi({},f,{className:hZ()(`${h}--dialog`,{[`${h}--dialog--modal`]:r},t),ref:$,onCancel:a,onClick:function(e){l&&r&&e.target===$.current&&s(e),o(e)},onClose:i,role:c,"aria-label":u,"aria-labelledby":u?void 0:d||y,"aria-describedby":p}),f1().createElement("div",{className:A},e)))});_k.displayName="Dialog",_k.propTypes={children:gl().node,className:gl().string,focusAfterCloseRef:gl().oneOfType([gl().func,gl().shape({current:gl().any})]),modal:gl().bool,onRequestClose:gl().func,open:gl().bool,role:gl().oneOf(["dialog","alertdialog"]),"aria-label":gl().string,"aria-labelledby":gl().string,ariaDescribedBy:gl().string};let _x=f1().forwardRef(({children:e,...t},n)=>{let r=gm();return f1().createElement("div",gi({className:`${r}--dialog__header`,ref:n},t),e)});_x.displayName="DialogHeader",_x.propTypes={children:gl().node};let _C=f1().forwardRef(({children:e,...t},n)=>{let r=gm();return f1().createElement("div",gi({className:`${r}--dialog__header-controls`,ref:n},t),e)});_C.displayName="DialogControls",_C.propTypes={children:gl().node};let _E=f1().forwardRef(({onClick:e,...t},n)=>{let r=gm();return f1().createElement(g1,gi({kind:"ghost",className:`${r}--dialog__close`,label:"Close",title:"Close","aria-label":"Close",align:"left",onClick:e,ref:n},t),f1().createElement(_t.bm,{size:20,"aria-hidden":"true",tabIndex:-1,className:`${r}--icon__close`}))});_E.displayName="DialogCloseButton",_E.propTypes={onClick:gl().func};let _D=f1().forwardRef(({children:e,className:t,id:n,...r},a)=>{let o=gm(),{titleId:i}=(0,f0.useContext)(_w);return f1().createElement(_$,gi({as:"h2",id:n||i,className:hZ()(`${o}--dialog-header__heading`,t),ref:a},r),e)});_D.displayName="DialogTitle",_D.propTypes={children:gl().node,className:gl().string,id:gl().string};let _S=f1().forwardRef(({children:e,className:t,id:n,...r},a)=>{let o=gm(),{subtitleId:i}=(0,f0.useContext)(_w);return f1().createElement(_$,gi({as:"h2",id:n||i,className:hZ()(`${o}--dialog-header__label`,t),ref:a},r),e)});_S.displayName="DialogSubtitle",_S.propTypes={children:gl().node,className:gl().string,id:gl().string};let _z=f1().forwardRef(({children:e,className:t,hasScrollingContent:n,...r},a)=>{let o=gm(),i=(0,f0.useRef)(null),[s,l]=(0,f0.useState)(!1),c=gG(),u=`${o}--dialog-body--${c}`;gd(()=>{i.current&&l(i.current.scrollHeight>i.current.clientHeight);let e=function(e,t=0,n={}){let r;"object"!=typeof n&&(n={});let{signal:a,leading:o=!1,trailing:i=!0,maxWait:s}=n,l=[,,];o&&(l[0]="leading"),i&&(l[1]="trailing");let c=null,u=function(e,t,{signal:n,edges:r}={}){let a,o=null,i=null!=r&&r.includes("leading"),s=null==r||r.includes("trailing"),l=()=>{null!==o&&(e.apply(a,o),a=void 0,o=null)},c=null,u=()=>{null!=c&&clearTimeout(c),c=setTimeout(()=>{c=null,s&&l(),p()},t)},d=()=>{null!==c&&(clearTimeout(c),c=null)},p=()=>{d(),a=void 0,o=null},f=function(...e){if(n?.aborted)return;a=this,o=e;let t=null==c;u(),i&&t&&l()};return f.schedule=u,f.cancel=p,f.flush=()=>{d(),l()},n?.addEventListener("abort",p,{once:!0}),f}(function(...t){r=e.apply(this,t),c=null},t,{signal:a,edges:l}),d=function(...t){if(null!=s){if(null===c)c=Date.now();else if(Date.now()-c>=s)return r=e.apply(this,t),c=Date.now(),u.cancel(),u.schedule(),r}return u.apply(this,t),r};return d.cancel=u.cancel,d.flush=()=>(u.flush(),r),d}(function(){i.current&&l(i.current.scrollHeight>i.current.clientHeight)},200);return window.addEventListener("resize",e),()=>{e.cancel(),window.removeEventListener("resize",e)}},[]);let d=hZ()(`${o}--dialog-content`,{[`${o}--dialog-scroll-content`]:n||s},t),p=n||s?{tabIndex:0,role:"region"}:{};return f1().createElement(_e,gi({ref:e=>{"function"==typeof a?a(e):a&&(a.current=e),i.current=e},id:u,className:d},p,r),e)});_z.displayName="DialogBody",_z.propTypes={children:gl().node,className:gl().string,hasScrollingContent:gl().bool};let _P=f1().forwardRef(({children:e,className:t,onRequestClose:n=_a,onSecondarySubmit:r,onRequestSubmit:a=_a,primaryButtonText:o="Save",primaryButtonDisabled:i=!1,secondaryButtonText:s="Cancel",secondaryButtons:l,loadingStatus:c="inactive",loadingDescription:u,loadingIconDescription:d,onLoadingSuccess:p=_a,danger:f=!1,...m},h)=>{let g=gm(),y=(0,f0.useRef)(null),{isOpen:b}=(0,f0.useContext)(_w),[v,$]=(0,f0.useState)(null);(0,f0.useEffect)(()=>{if(f&&v){let e=requestAnimationFrame(()=>{v.focus()});return()=>cancelAnimationFrame(e)}},[f,v,b]);let A=hZ()(`${g}--dialog-footer`,t,{[`${g}--dialog-footer--three-button`]:Array.isArray(l)&&2===l.length}),w="inactive"!==c,k=hZ()({[`${g}--btn--loading`]:"inactive"!==c});return e?f1().createElement(_r,gi({className:A,ref:h},m),e):f1().createElement(_r,gi({className:A,"aria-busy":w,ref:h},m),Array.isArray(l)&&l.length<=2?l.map(({buttonText:e,onClick:t},n)=>f1().createElement(g3,{key:`${e}-${n}`,autoFocus:f,kind:"secondary",ref:0===n&&f?$:void 0,onClick:t},e)):s&&f1().createElement(g3,{ref:f?$:void 0,disabled:w,kind:"secondary",autoFocus:f,onClick:r||n},s),f1().createElement(g3,{className:k,kind:f?"danger":"primary",disabled:w||i,onClick:a,ref:y},"inactive"===c?o:f1().createElement(_s,{status:c,description:u,iconDescription:d,className:`${g}--inline-loading--btn`,onSuccess:p})))});_P.displayName="DialogFooter",_P.propTypes={children:gl().node,className:gl().string,onRequestClose:gl().func,onSecondarySubmit:gl().func,onRequestSubmit:gl().func,primaryButtonText:gl().node,primaryButtonDisabled:gl().bool,secondaryButtonText:gl().node,secondaryButtons:(e,t,n)=>{if(e.secondaryButtons){if(!Array.isArray(e.secondaryButtons)||2!==e.secondaryButtons.length)return Error(`${t} needs to be an array of two button config objects`);let r={buttonText:gl().node,onClick:gl().func};e[t].forEach(e=>{gl().checkPropTypes(r,e,t,n)})}return null},danger:gl().bool,loadingStatus:gl().oneOf(["inactive","active","finished","error"]),loadingDescription:gl().string,loadingIconDescription:gl().string,onLoadingSuccess:gl().func},gl().elementType,gl().node,gl().string;let _M=f1().createContext(void 0);function _N(){return(0,f0.useContext)(_M)}function _T({align:e,as:t,autoAlign:n,className:r,children:a,defaultOpen:o=!1,...i}){let s=(0,f0.useRef)(null),[l,c]=(0,f0.useState)(o),u=gm(),d=gG(),p=hZ()(`${u}--toggletip`,r,{[`${u}--toggletip--open`]:l,[`${u}--autoalign`]:n}),f=()=>{c(!l)},m=()=>{c(!1)};return gh("blur",()=>{l&&m()}),(0,f0.useEffect)(()=>{if(!s.current)return;let e=s.current.ownerDocument||document,t="PointerEvent"in window?"pointerdown":"mousedown",n=e=>{let t=e.target;l&&t&&!s.current.contains(t)&&c(!1)},r={capture:!0};return e.addEventListener(t,n,r),()=>{e.removeEventListener(t,n,r)}},[l]),f1().createElement(_M.Provider,{value:{buttonProps:{"aria-expanded":l,"aria-controls":d,"aria-describedby":l?d:void 0,onClick:f},contentProps:{id:d},onClick:{onClick:f}}},f1().createElement(gC,gi({align:e,as:t,caret:!0,className:p,dropShadow:!1,highContrast:!0,open:l,onKeyDown:e=>{if(l&&gO(e,gz)){e.stopPropagation(),m();let t=s.current?.children[0];t instanceof HTMLButtonElement&&t.focus()}},onBlur:e=>{(!l||null!==e.relatedTarget)&&(e.currentTarget.contains(e.relatedTarget)||m())},ref:s,autoAlign:n},i),a))}let{open:_O,..._I}=gC.propTypes??{};_T.propTypes={..._I,defaultOpen:gl().bool};let _B=f1().forwardRef(function({children:e,className:t,label:n="Show information",as:r,...a},o){let i=_N(),s=gm(),l=hZ()(`${s}--toggletip-button`,t),c=r??"button";return"button"!==c?f1().createElement(c,gi({},i?.onClick,{className:l},a),e):f1().createElement("button",gi({},i?.buttonProps,{"aria-label":n,type:"button",className:l,ref:o},a),e)});_B.propTypes={children:gl().node,className:gl().string,label:gl().string},_B.displayName="ToggletipButton";let _R=f1().forwardRef(function({children:e,className:t},n){let r=_N(),a=gm();return f1().createElement(gE,gi({className:t},r?.contentProps,{ref:n}),f1().createElement("div",{className:`${a}--toggletip-content`},e))});function _j({children:e,className:t}){let n=gm(),r=hZ()(`${n}--toggletip-actions`,t);return f1().createElement("div",{className:r},e)}_R.propTypes={children:gl().node,className:gl().string},_R.displayName="ToggletipContent",_j.propTypes={children:gl().node,className:gl().string};var _F=n(5951);let _L=f1().forwardRef(function({className:e,children:t},n){let r=gm(),a=f1().Children.toArray(t).some(e=>{e.type}),o=hZ()(e,{[`${r}--ai-label-content`]:!0,[`${r}--ai-label-content--with-actions`]:a});return f1().createElement(_R,{className:o},t)});_L.displayName="AILabelContent",_L.propTypes={children:gl().node,className:gl().string};let _W=f1().forwardRef(function({className:e,children:t},n){let r=gm(),a=hZ()(e,{[`${r}--ai-label-actions`]:!0});return f1().createElement(_j,{className:a},t)});_W.displayName="AILabelActions",_W.propTypes={children:gl().node,className:gl().string};let _V=f1().forwardRef(function({aiText:e="AI",aiTextLabel:t,textLabel:n,align:r,autoAlign:a=!0,children:o,className:i,kind:s="default",onRevertClick:l,revertActive:c,revertLabel:u="Revert to AI input",slugLabel:d="Show information","aria-label":p="Show information",size:f="xs",...m},h){let g=gm(),y=gG("AILabel"),b=hZ()(i,{[`${g}--ai-label`]:!0,[`${g}--ai-label--revert`]:c}),v=hZ()({[`${g}--ai-label__button`]:!0,[`${g}--ai-label__button--${f}`]:f,[`${g}--ai-label__button--${s}`]:s,[`${g}--ai-label__button--inline-with-content`]:"inline"===s&&(t||n)}),$=t||n?`${e} ${t||n}`:`${e} ${d||p}`,A=["xs","2xs","mini"].includes(f);return f1().createElement("div",{className:b,ref:h,id:y},c?f1().createElement(g1,gi({onClick:e=>{l&&l(e)},kind:"ghost",size:"sm",label:u},m),eh||(eh=f1().createElement(_F.Vn,null))):f1().createElement(_T,gi({align:r,autoAlign:a,alignmentAxisOffset:A?-24:0},m),f1().createElement(_B,{className:v,label:"inline"===s?"":$},f1().createElement("span",{className:`${g}--ai-label__text`},e),"inline"===s&&(t||n)&&f1().createElement("span",{className:`${g}--ai-label__additional-text`},t||n)),o))});_V.displayName="AILabel",_V.propTypes={..._T.propTypes,AILabelContent:gl().node,aiText:gl().string,aiTextLabel:gA(gl().string,"`aiTextLabel` on `AILabel` has been deprecated - Please use the `textLabel` prop instead"),"aria-label":gl().string,kind:gl().oneOf(["default","inline"]),onRevertClick:gl().func,revertActive:gl().bool,revertLabel:gl().string,size:gl().oneOf(["mini","2xs","xs","sm","md","lg","xl"]),slugLabel:gA(gl().string,"`slugLabel` on `AILabel` has been deprecated - Please use the `ariaLabel` prop instead"),textLabel:gl().string};let _G=(e,t)=>(0,f0.isValidElement)(e)&&e.type===t,_U=e=>{let[t,n]=(0,f0.useState)(!!e),[r,a]=(0,f0.useState)(!!e);return(0,f0.useEffect)(()=>{e!==r&&(n(!!e),a(!!e))},[e,r]),(0,f0.useMemo)(()=>[t,n],[t])},_H=({open:e,_presenceId:t,_autoEnablePresence:n=!0,children:r})=>{let a=_U(e),[o]=a,[i,s]=((e,t)=>{let n=(0,f0.useRef)(t),r=(0,f0.useRef)(null),a=(0,f0.useRef)(null);t||!a.current||r.current||(n.current=null),a.current=r.current;let{isPresent:o,isExiting:i}=((e,t)=>{let n=gm(),[r,a]=(0,f0.useState)(t?"idle":"finished"),o="active"===r;t||"idle"!==r||a("active"),t&&"idle"!==r&&a("idle");let i=(0,f0.useCallback)(()=>{a("finished")},[]);return(0,f0.useLayoutEffect)(()=>{if(!e.current||!o)return;if(!("getAnimations"in e.current))return void i();let t=e.current.getAnimations({subtree:!0}).filter(e=>e instanceof CSSAnimation&&e.animationName.startsWith(`${n}--presence`));if(!t.length)return void i();let r=!1;return Promise.all(t.map(e=>e.finished)).finally(()=>{r||i()}),()=>{r=!0}},[e,o,n,i]),{isPresent:t||"finished"!==r,isExiting:o}})(r,e),s=(0,f0.useCallback)(e=>!!e&&(!n.current||n.current===e)&&(n.current=e,!0),[]);return[o,(0,f0.useMemo)(()=>({presenceRef:r,isPresenceExclusive:s,isExiting:i}),[r,s,i])]})(o,t),l=(0,f0.useMemo)(()=>({modalState:a,autoEnablePresence:n,...s}),[a,n,s]);return i?f1().createElement(_q,{value:l},r):null},_q=(0,f0.createContext)(void 0),_K=f1().forwardRef(function({className:e,children:t,hasForm:n,hasScrollingContent:r,...a},o){let i=gm(),s=(0,f0.useRef)(null),{height:l}=(({ref:e,onResize:t})=>{let[n,r]=(0,f0.useState)(-1),[a,o]=(0,f0.useState)(-1),i=(0,f0.useRef)(null),s=(0,f0.useRef)(t);return(0,f0.useEffect)(()=>{s.current=t},[t]),(0,f0.useEffect)(()=>{if(e?.current&&(!(n>=0)||!(a>=0))&&e.current){let t=window.getComputedStyle(e.current),n=(e.current?.offsetWidth??0)-("string"==typeof t?.paddingLeft&&t?.paddingLeft.length?parseFloat(t?.paddingLeft):0)-("string"==typeof t?.paddingRight&&t?.paddingRight.length?parseFloat(t?.paddingRight):0),a=(e.current?.offsetHeight??0)-("string"==typeof t?.paddingTop&&t?.paddingTop.length?parseFloat(t?.paddingTop):0)-("string"==typeof t?.paddingBottom&&t?.paddingBottom.length?parseFloat(t?.paddingBottom):0);r(n),o(a)}},[n,a]),(0,f0.useLayoutEffect)(()=>{if(!e?.current)return;let t=new ResizeObserver(t=>{i.current=t,window.requestAnimationFrame(()=>{(()=>{if(!e?.current||!Array.isArray(i?.current))return;let t=i.current[0];r(t.contentRect.width),o(t.contentRect.height),s.current&&s.current(t.contentRect)})()})});return t.observe(e.current),()=>{t.disconnect()}},[]),{width:n,height:a}})({ref:s}),c=!!s.current&&s?.current?.scrollHeight>s?.current?.clientHeight,u=hZ()({[`${i}--modal-content`]:!0,[`${i}--modal-content--with-form`]:n,[`${i}--modal-scroll-content`]:r||c,[`${i}--modal-scroll-content--no-fade`]:l<=300},e),d=r||c?{tabIndex:0,role:"region"}:{};return f1().createElement(_e,gi({className:u},d,a,{ref:_u(s,o)}),t)});_K.propTypes={"aria-label":(m=gl().string,(e,t,n,...r)=>m(e,t,n,...r)),children:gl().node,className:gl().string,hasForm:gl().bool,hasScrollingContent:gl().bool};let _Z=f1().forwardRef(function({open:e,...t},n){let r,a=gG(),o=gk("enable-presence"),i=!!(0,f0.useContext)(_q),s=o||i,l=(r=(0,f0.useContext)(_q),r?.isPresenceExclusive(a)?r:void 0);return s&&!l?f1().createElement(_H,{open:e??!1,_presenceId:a,_autoEnablePresence:i},f1().createElement(_Y,gi({open:!0,ref:n},t))):f1().createElement(_Y,gi({ref:n,open:e},t))}),_Y=f1().forwardRef(function({"aria-labelledby":e,"aria-label":t,children:n,className:r,containerClassName:a,danger:o,decorator:i,isFullWidth:s,onClose:l,onKeyDown:c,open:u,preventCloseOnClickOutside:d,selectorPrimaryFocus:p="[data-modal-primary-focus]",selectorsFloatingMenus:f,size:m,launcherButtonRef:h,slug:g,...y},b){let v,$=gm(),A=(0,f0.useRef)(null),w=(0,f0.useRef)(null),k=(0,f0.useRef)(null),x=(0,f0.useRef)(null),C=(0,f0.useRef)(null),E=(0,f0.useContext)(_q),D=(0,gy.SV)([b,E?.presenceRef]),S=gk("enable-presence")||E?.autoEnablePresence,z=u||S,P=_U(z),[M,N]=E?.modalState??P,T=gk("enable-dialog-element"),O=gk("enable-experimental-focus-wrap-without-sentinels"),I=gk("enable-focus-wrap-without-sentinels"),B=O||I;function R(e){l&&!1===l(e)||N(!1)}(0,f0.useEffect)(()=>{T||_d(document.body,`${$}--body--with-modal-open`,!!z)},[z,$]),(0,f0.useEffect)(()=>{if(!T)return()=>{_d(document.body,`${$}--body--with-modal-open`,!1)}},[]);let j=hZ()(`${$}--modal`,{"is-visible":S||M,[`${$}--modal--enable-presence`]:E?.autoEnablePresence,[`${$}--modal--danger`]:o,[`${$}--modal--slug`]:g,[`${$}--modal--decorator`]:i},r),F=hZ()(`${$}--modal-container`,m&&`${$}--modal-container--${m}`,s&&`${$}--modal-container--full-width`,a),L=f1().Children.toArray(n).map(e=>{switch(!0){case(0,g4.isElement)(e)&&e.type===f1().createElement(_n).type:return v=e.props.label,f1().cloneElement(e,{closeModal:R});case(0,g4.isElement)(e)&&e.type===f1().createElement(_c).type:return f1().cloneElement(e,{closeModal:R,inputref:w,danger:o});default:return e}}),W=!f0.Children.toArray(L).some(e=>_G(e,_c));(0,f0.useEffect)(()=>{if(!z)return;let e=e=>{gO(e,gz)&&(e.preventDefault(),e.stopPropagation(),R(e))};return document.addEventListener("keydown",e,!0),()=>{document.removeEventListener("keydown",e,!0)}},[z]),(0,f0.useEffect)(()=>{T||S||z||!h||setTimeout(()=>{h.current?.focus()})},[T,S,z,h]),(0,f0.useEffect)(()=>{let e=h?.current;return()=>{S&&e&&setTimeout(()=>{e.focus()})}},[S,h]),(0,f0.useEffect)(()=>{var e;let t,n,r,a;!T&&z&&M&&(r=(n=(t=(e=A.current)||A.current)?t.querySelector(o?`.${$}--btn--secondary`:p):null)||w&&w.current,a=e.querySelector(`.${$}--modal-close`),r?r.focus():!r&&a&&a?.focus())},[z,p,M]);let V=g??i,G=_G(V,_V)?(0,f0.cloneElement)(V,{size:"sm"}):V,U=T?f1().createElement(_k,{open:z,focusAfterCloseRef:h,modal:!0,className:F,"aria-label":t||v,"aria-labelledby":e,"data-exiting":E?.isExiting||void 0},f1().createElement("div",{ref:A,className:`${$}--modal-container-body`},g?G:i?f1().createElement("div",{className:`${$}--modal--inner__decorator`},G):"",L)):f1().createElement("div",{className:F,role:"dialog","aria-modal":"true","aria-label":t||v,"aria-labelledby":e},!B&&f1().createElement("button",{type:"button",ref:k,className:`${$}--visually-hidden`},"Focus sentinel"),f1().createElement("div",{ref:A,className:`${$}--modal-container-body`},g?G:i?f1().createElement("div",{className:`${$}--modal--inner__decorator`},G):"",L),!B&&f1().createElement("button",{type:"button",ref:x,className:`${$}--visually-hidden`},"Focus sentinel"));return f1().createElement(_e,gi({},y,{level:0,role:"presentation",ref:D,"aria-hidden":!z,onBlur:function({target:e,relatedTarget:t}){if(!T&&!B&&z&&t&&e&&A.current){let{current:n}=A,{current:r}=k,{current:a}=x;__({bodyNode:n,startTrapNode:r,endTrapNode:a,currentActiveNode:t,oldActiveNode:e,selectorsFloatingMenus:f?.filter(Boolean)})}let n=document.querySelector(`.${$}--modal-content`);n&&n.classList.contains(`${$}--modal-scroll-content`)&&t&&n.contains(t)&&t.scrollIntoView({block:"center"})},onClick:_b([y?.onClick,function(e){let{target:t}=e,n=C.current;e.stopPropagation(),(W&&!d||!W&&!1===d)&&t instanceof Node&&!_g(t,f)&&A.current&&!A.current.contains(t)&&!A.current.contains(n)&&R(e)}]),onMouseDown:_b([y?.onMouseDown,function(e){C.current=e.target}]),onKeyDown:function(e){!T&&B&&z&&gO(e,gD)&&A.current&&_y({containerNode:A.current,currentActiveNode:e.target,event:e}),c?.(e)},className:j,"data-exiting":E?.isExiting||void 0}),U)});_Z.propTypes={"aria-label":gl().string,"aria-labelledby":gl().string,children:gl().node,className:gl().string,containerClassName:gl().string,danger:gl().bool,decorator:gl().node,isFullWidth:gl().bool,launcherButtonRef:gl().oneOfType([gl().func,gl().shape({current:gl().any})]),onClose:gl().func,onKeyDown:gl().func,open:gl().bool,preventCloseOnClickOutside:gl().bool,selectorPrimaryFocus:gl().string,selectorsFloatingMenus:gl().arrayOf(gl().string.isRequired),size:gl().oneOf(["xs","sm","md","lg"]),slug:gA(gl().node,"The `slug` prop for `ComposedModal` has been deprecated in favor of the new `decorator` prop. It will be removed in the next major release.")};let _J=({name:e,className:t,type:n})=>{function r({className:e,...a}){let o=gm(),i=hZ()("function"==typeof t?t(o):t,e);return f1().createElement(n,{...a,className:i||void 0})}return r.displayName=e,r.propTypes={className:gl().string},r},_X=_J({name:"TableActionList",type:"div",className:e=>`${e}--action-list`}),_Q="carbon.table.batch.cancel",_0="carbon.table.batch.items.selected",_1="carbon.table.batch.item.selected",_2="carbon.table.batch.selectAll",_3={[_Q]:"Cancel",[_0]:"items selected",[_1]:"item selected",[_2]:"Select all"},_4=(e,t={totalSelected:0,totalCount:0})=>{let{totalSelected:n,totalCount:r}=t;switch(e){case _Q:return _3[e];case _2:return`${_3[e]} (${r})`;case _0:case _1:return`${n} ${_3[e]}`}},_5=({className:e,children:t,shouldShowBatchActions:n,totalSelected:r,totalCount:a,onCancel:o,onSelectAll:i,translateWithId:s=_4,...l})=>{let[c,u]=f1().useState(!1),d=gm(),p=hZ()({[`${d}--batch-actions`]:!0,[`${d}--batch-actions--active`]:n},e),f=hZ()(`${d}--batch-summary`,{[`${d}--batch-summary__scroll`]:c});return f1().createElement("div",gi({onScroll:()=>{u(!c)},"aria-hidden":!n,className:p},l),f1().createElement("div",{className:f},f1().createElement("p",{className:`${d}--batch-summary__para`},f1().createElement(_$,null,s(r>1||0===r?"carbon.table.batch.items.selected":"carbon.table.batch.item.selected",{totalSelected:r}))),i&&f1().createElement(f1().Fragment,null,f1().createElement("span",{className:`${d}--batch-summary__divider`},"|"),f1().createElement(g3,{onClick:i,tabIndex:n?0:-1},s("carbon.table.batch.selectAll",{totalCount:a})))),f1().createElement(_X,null,t,f1().createElement(g3,{className:`${d}--batch-summary__cancel`,tabIndex:n?0:-1,onClick:o},s("carbon.table.batch.cancel"))))};function _6({className:e,children:t,id:n,...r}){let a=gm(),o=hZ()(`${a}--label`,`${a}--label--no-margin`,e);return f1().createElement(_$,gi({as:"label",htmlFor:n,className:o},r),t)}_5.propTypes={children:gl().node,className:gl().string,onCancel:gl().func.isRequired,onSelectAll:gl().func,shouldShowBatchActions:gl().bool,totalCount:gl().number,totalSelected:gl().number.isRequired,translateWithId:gl().func},_6.propTypes={children:gl().node,className:gl().string,id:gl().string};var _7=n(4632),_8=n(1895);function _9({children:e,className:t,onClick:n,inline:r,...a}){let o=gm(),i=hZ()(t,{[`${o}--actionable-notification__action-button`]:!0});return f1().createElement(g3,gi({className:i,kind:r?"ghost":"tertiary",onClick:n,size:"sm"},a),e)}function ye({"aria-label":e="close notification",ariaLabel:t,className:n,type:r="button",renderIcon:a=_t.bm,name:o,notificationType:i="toast",...s}){let l=gm(),c=hZ()(n,{[`${l}--${i}-notification__close-button`]:i}),u=hZ()({[`${l}--${i}-notification__close-icon`]:i});return f1().createElement("button",gi({},s,{type:r,"aria-label":t||e,title:t||e,className:c}),a&&f1().createElement(a,{className:u,name:o}))}_9.propTypes={children:gl().node,className:gl().string,inline:gl().bool,onClick:gl().func},ye.propTypes={"aria-label":gl().string,ariaLabel:gA(gl().string,"This prop syntax has been deprecated. Please use the new `aria-label`."),className:gl().string,name:gl().string,notificationType:gl().oneOf(["toast","inline","actionable"]),renderIcon:gl().oneOfType([gl().func,gl().object]),type:gl().string};let yt={error:_o.x,success:_t._j,warning:_7.BF,"warning-alt":_7.OR,info:_8.NM,"info-square":_8.mR};function yn({iconDescription:e,kind:t,notificationType:n}){let r=gm(),a=yt[t];return a?f1().createElement(a,{className:`${r}--${n}-notification__icon`,size:20},f1().createElement("title",null,e)):null}function yr({"aria-label":e,children:t,title:n,subtitle:r,role:a="status",onClose:o,onCloseButtonClick:i=_a,statusIconDescription:s,className:l,kind:c="error",lowContrast:u,hideCloseButton:d=!1,...p}){let[f,m]=(0,f0.useState)(!0),h=gm(),g=hZ()(l,{[`${h}--inline-notification`]:!0,[`${h}--inline-notification--low-contrast`]:u,[`${h}--inline-notification--${c}`]:c,[`${h}--inline-notification--hide-close-button`]:d}),y=(0,f0.useRef)(null);gH(y);let b=(0,f0.useRef)(null);return f?f1().createElement("div",gi({ref:b},p,{role:a,className:g}),f1().createElement("div",{className:`${h}--inline-notification__details`},f1().createElement(yn,{notificationType:"inline",kind:c,iconDescription:s||`${c} icon`}),f1().createElement("div",{ref:y,className:`${h}--inline-notification__text-wrapper`},n&&f1().createElement(_$,{as:"div",className:`${h}--inline-notification__title`},n),r&&f1().createElement(_$,{as:"div",className:`${h}--inline-notification__subtitle`},r),t)),!d&&f1().createElement(ye,{notificationType:"inline",onClick:function(e){i(e),o&&!1===o(e)||m(!1)},"aria-label":e})):null}function ya({actionButtonLabel:e,"aria-label":t,ariaLabel:n,caption:r,children:a,role:o="alertdialog",onActionButtonClick:i,onClose:s,onCloseButtonClick:l=_a,statusIconDescription:c,className:u,inline:d=!1,kind:p="error",lowContrast:f,hideCloseButton:m=!1,hasFocus:h=!0,closeOnEscape:g=!0,title:y,subtitle:b,...v}){let[$,A]=(0,f0.useState)(!0),w=gm(),k=gG("actionable-notification"),x=gG("actionable-notification-subtitle"),C=hZ()(u,{[`${w}--actionable-notification`]:!0,[`${w}--actionable-notification--toast`]:!d,[`${w}--actionable-notification--low-contrast`]:f,[`${w}--actionable-notification--${p}`]:p,[`${w}--actionable-notification--hide-close-button`]:m}),E=(0,f0.useRef)(null),D=(0,f0.useRef)(null),S=(0,f0.useRef)(null),z=(0,f0.useRef)(null),P=gk("enable-experimental-focus-wrap-without-sentinels"),M=gk("enable-focus-wrap-without-sentinels")||P;function N(e){l(e),s&&!1===s(e)||A(!1)}return gd(()=>{if(h&&"alertdialog"===o){let e=document.querySelector("button.cds--actionable-notification__action-button");e?.focus()}}),(!function(e,t,n=!0){let r=r=>{let a=e.current&&document.activeElement===e.current||e.current?.contains(document.activeElement);gT(r,[gz])&&n&&a&&t(r)};gd(()=>(null!==e.current&&document.addEventListener("keydown",r,!1),()=>document.removeEventListener("keydown",r,!1)))}(z,N,g),$)?f1().createElement("div",gi({},v,{ref:z,role:o,className:C,"aria-labelledby":y?k:x,onBlur:M?()=>{}:function({target:e,relatedTarget:t}){if($&&t&&e&&"alertdialog"===o){let{current:n}=E,{current:r}=D,{current:a}=S;__({bodyNode:n,startTrapNode:r,endTrapNode:a,currentActiveNode:t,oldActiveNode:e})}},onKeyDown:M?function(e){$&&gO(e,gD)&&z.current&&"alertdialog"===o&&_y({containerNode:z.current,currentActiveNode:e.target,event:e})}:()=>{}}),!M&&f1().createElement("span",{ref:D,tabIndex:0,role:"link",className:`${w}--visually-hidden`},"Focus sentinel"),f1().createElement("div",{className:`${w}--actionable-notification__details`},f1().createElement(yn,{notificationType:d?"inline":"toast",kind:p,iconDescription:c||`${p} icon`}),f1().createElement("div",{className:`${w}--actionable-notification__text-wrapper`},f1().createElement("div",{className:`${w}--actionable-notification__content`},y&&f1().createElement(_$,{as:"div",className:`${w}--actionable-notification__title`,id:k},y),b&&f1().createElement(_$,{as:"div",className:`${w}--actionable-notification__subtitle`,id:x},b),r&&f1().createElement(_$,{as:"div",className:`${w}--actionable-notification__caption`},r),a))),f1().createElement("div",{className:`${w}--actionable-notification__button-wrapper`,ref:E},e&&f1().createElement(_9,{onClick:i,inline:d},e),!m&&f1().createElement(ye,{"aria-label":n||t,notificationType:"actionable",onClick:N})),!M&&f1().createElement("span",{ref:S,tabIndex:0,role:"link",className:`${w}--visually-hidden`},"Focus sentinel")):null}yn.propTypes={iconDescription:gl().string.isRequired,kind:gl().oneOf(["error","success","warning","warning-alt","info","info-square"]).isRequired,notificationType:gl().oneOf(["inline","toast"]).isRequired},gl().string,gA(gl().string,"This prop syntax has been deprecated. Please use the new `aria-label`."),gl().string,gl().node,gl().string,gl().bool,gl().oneOf(["error","info","info-square","success","warning","warning-alt"]),gl().bool,gl().func,gl().func,gl().oneOf(["alert","log","status"]),gl().string,gl().string,gl().number,gl().string,yr.propTypes={"aria-label":gl().string,children:gl().node,className:gl().string,hideCloseButton:gl().bool,kind:gl().oneOf(["error","info","info-square","success","warning","warning-alt"]),lowContrast:gl().bool,onClose:gl().func,onCloseButtonClick:gl().func,role:gl().oneOf(["alert","log","status"]),statusIconDescription:gl().string,subtitle:gl().string,title:gl().string},ya.propTypes={actionButtonLabel:gl().string,"aria-label":gl().string,ariaLabel:gA(gl().string,"This prop syntax has been deprecated. Please use the new `aria-label`."),caption:gl().string,children:gl().node,className:gl().string,closeOnEscape:gl().bool,hasFocus:gA(gl().bool,"hasFocus is deprecated. To conform to accessibility requirements hasFocus should always be `true` for ActionableNotification. If you were setting this prop to `false`, consider using the Callout component instead."),hideCloseButton:gl().bool,inline:gl().bool,kind:gl().oneOf(["error","info","info-square","success","warning","warning-alt"]),lowContrast:gl().bool,onActionButtonClick:gl().func,onClose:gl().func,onCloseButtonClick:gl().func,role:gl().string,statusIconDescription:gl().string,subtitle:gl().node,title:gl().string};let yo={error:"warning",success:"info"};gl().string,gl().node,gl().string,gu(gl().oneOf(["error","info","info-square","success","warning","warning-alt"]),["warning","info"],e=>yo[e]),gl().bool,gl().func,gl().string,gl().node,gl().string,gl().string;let yi=(0,f0.forwardRef)((e,t)=>{let{className:n,closeMenu:r,disabled:a=!1,handleOverflowMenuItemFocus:o,hasDivider:i=!1,href:s,isDelete:l=!1,index:c,itemText:u="Provide itemText",onClick:d=()=>{},onKeyDown:p=()=>{},requireTitle:f,title:m,wrapperClassName:h,...g}=e,y=gm(),b=hZ()(`${y}--overflow-menu-options__btn`,n),v=hZ()(`${y}--overflow-menu-options__option`,{[`${y}--overflow-menu--divider`]:i,[`${y}--overflow-menu-options__option--danger`]:l,[`${y}--overflow-menu-options__option--disabled`]:a},h),$="string"!=typeof u?u:f1().createElement("div",{className:`${y}--overflow-menu-options__option-content`},u);return f1().createElement(_$,{as:"li",className:v,role:"none"},f1().createElement(s?"a":"button",gi({className:b,disabled:a,href:s,onClick:function(e){d(e),r&&r()},onKeyDown:e=>{gO(e,gN)&&o?.({currentIndex:c,direction:1}),gO(e,gM)&&o?.({currentIndex:c,direction:-1}),p(e)},role:"menuitem",ref:t,tabIndex:-1,title:f?m||u:void 0},g),$))});yi.propTypes={className:gl().string,closeMenu:gl().func,disabled:gl().bool,handleOverflowMenuItemFocus:gl().func,hasDivider:gl().bool,href:gl().string,index:gl().number,isDelete:gl().bool,itemText:gl().node.isRequired,onBlur:gl().func,onClick:gl().func,onFocus:gl().func,onKeyDown:gl().func,onKeyUp:gl().func,onMouseDown:gl().func,onMouseEnter:gl().func,onMouseLeave:gl().func,onMouseUp:gl().func,requireTitle:gl().bool,title:gl().string,wrapperClassName:gl().string};var ys=n(8466);let yl=(0,f0.createContext)({isFluid:!1}),yc=f1().forwardRef(({className:e,decorator:t,id:n,inline:r=!1,labelText:a="Select",disabled:o=!1,children:i,noLabel:s=!1,hideLabel:l=!1,invalid:c=!1,invalidText:u="",helperText:d="",light:p=!1,readOnly:f,size:m,warn:h=!1,warnText:g,onChange:y,slug:b,...v},$)=>{let A=gm(),{isFluid:w}=(0,f0.useContext)(yl),[k,x]=(0,f0.useState)(!1),C=gG(),E=f1().Children.toArray(i).filter(e=>f1().isValidElement(e)),D=v?.value||v?.defaultValue,S=E.find(e=>e.props?.value===D),z=v?.title||S?.props?.text||E[0]?.props?.text||"",[P,M]=(0,f0.useState)(z),N=hZ()({[`${A}--select`]:!0,[`${A}--select--inline`]:r,[`${A}--select--light`]:p,[`${A}--select--invalid`]:c,[`${A}--select--disabled`]:o,[`${A}--select--readonly`]:f,[`${A}--select--warning`]:h,[`${A}--select--fluid--invalid`]:w&&c,[`${A}--select--fluid--focus`]:w&&k,[`${A}--select--slug`]:b,[`${A}--select--decorator`]:t}),T=hZ()(`${A}--label`,{[`${A}--visually-hidden`]:l,[`${A}--label--disabled`]:o}),O=hZ()({[`${A}--select-input`]:!0,[`${A}--select-input--${m}`]:m}),I=`${n}-error-msg`,B=c?u:h?g:void 0,R=c||h?f1().createElement(_$,{as:"div",className:`${A}--form-requirement`,id:I},B):null,j=hZ()(`${A}--form__helper-text`,{[`${A}--form__helper-text--disabled`]:o}),F=d?`select-helper-text-${C}`:void 0,L=d?f1().createElement(_$,{as:"div",id:F,className:j},d):null,W={};c?W["aria-describedby"]=I:r||w||(W["aria-describedby"]=L?F:void 0);let V=e=>{x("focus"===e.type)},G=b??t,U=_G(G,_V)?(0,f0.cloneElement)(G,{size:"mini"}):G,H=f1().createElement(f1().Fragment,null,f1().createElement("select",gi({},v,W,{id:n,className:O,disabled:o||void 0,"aria-invalid":c||void 0,"aria-readonly":f||void 0,title:P,onChange:_b([y,e=>{let t=e?.target?.options[e.target.selectedIndex];M(t?.text)}])},{onMouseDown:e=>{f&&(e.preventDefault(),e.target.focus())},onKeyDown:e=>{f&&["ArrowDown","ArrowUp"," "].includes(e.key)&&e.preventDefault()}},{ref:$}),i),f1().createElement(_t.yQ,{className:`${A}--select__arrow`}),c&&f1().createElement(_7.BF,{className:`${A}--select__invalid-icon`}),!c&&h&&f1().createElement(_7.OR,{className:`${A}--select__invalid-icon ${A}--select__invalid-icon--warning`}));return f1().createElement("div",{className:hZ()(`${A}--form-item`,e)},f1().createElement("div",{className:N},!s&&f1().createElement(_$,{as:"label",htmlFor:n,className:T},a),r&&f1().createElement("div",{className:`${A}--select-input--inline__wrapper`},f1().createElement("div",{className:`${A}--select-input__wrapper`,"data-invalid":c||null},H),R),!r&&f1().createElement("div",{className:`${A}--select-input__wrapper`,"data-invalid":c||null,onFocus:V,onBlur:V},H,b?U:t?f1().createElement("div",{className:`${A}--select__inner-wrapper--decorator`},U):"",w&&f1().createElement("hr",{className:`${A}--select__divider`}),w&&R?R:null),r||w||!R?L:R))});yc.displayName="Select",yc.propTypes={children:gl().node,className:gl().string,decorator:gl().node,defaultValue:gl().any,disabled:gl().bool,helperText:gl().node,hideLabel:gl().bool,id:gl().string.isRequired,inline:gl().bool,invalid:gl().bool,invalidText:gl().node,labelText:gl().node,light:gA(gl().bool,"The `light` prop for `Select` is no longer needed and has been deprecated in v11 in favor of the new `Layer` component. It will be moved in the next major release."),noLabel:gl().bool,onChange:gl().func,readOnly:gl().bool,size:gl().oneOf(["sm","md","lg"]),slug:gA(gl().node,"The `slug` prop has been deprecated and will be removed in the next major version. Use the decorator prop instead."),warn:gl().bool,warnText:gl().node};let yu=({className:e,value:t="",disabled:n=!1,hidden:r=!1,text:a="",...o})=>{let i=gm(),s=hZ()({[`${i}--select-option`]:!0,...e&&{[e]:e}});return f1().createElement("option",gi({},o,{className:s,value:t,disabled:n,hidden:r}),a)};yu.propTypes={className:gl().string,disabled:gl().bool,hidden:gl().bool,text:gl().string.isRequired,value:gl().any.isRequired};var yd=n(9772),yp=n.n(yd);function yf(e){return"object"==typeof e[0]&&null!==e[0]?e:e.map(e=>({text:e,value:e}))}function ym(e,t){return t&&e.find(e=>t===e.value)?t:e[0].value}let yh=f1().forwardRef(({backwardText:e="Previous page",className:t="",disabled:n=!1,forwardText:r="Next page",id:a,isLastPage:o=!1,itemText:i=(e,t)=>`${e}–${t} items`,itemRangeText:s=(e,t,n)=>`${e}–${t} of ${n} items`,itemsPerPageText:l="Items per page:",onChange:c,pageNumberText:u="Page Number",pageRangeText:d=(e,t)=>`of ${t} ${1===t?"page":"pages"}`,page:p=1,pageInputDisabled:f,pageSize:m,pageSizeInputDisabled:h,pageSizes:g,pageText:y=e=>`page ${e}`,pagesUnknown:b=!1,size:v="md",totalItems:$,...A},w)=>{let k=gm(),x=gU(a?.toString()),C=(0,f0.useRef)(null),E=(0,f0.useRef)(null),[D,S]=(0,f0.useState)(()=>yf(g)),[z,P]=(0,f0.useState)(g),[M,N]=(0,f0.useState)(p),[T,O]=(0,f0.useState)(p),[I,B]=(0,f0.useState)(null),[R,j]=(0,f0.useState)(()=>ym(D,m)),[F,L]=(0,f0.useState)(m),W=hZ()({[`${k}--pagination`]:!0,[`${k}--pagination--${v}`]:v,[t]:!!t}),V=$?Math.max(Math.ceil($/R),1):1,G=n||1===M,U=hZ()({[`${k}--pagination__button`]:!0,[`${k}--pagination__button--backward`]:!0,[`${k}--pagination__button--no-index`]:G}),H=n||M===V&&!b,q=hZ()({[`${k}--pagination__button`]:!0,[`${k}--pagination__button--forward`]:!0,[`${k}--pagination__button--no-index`]:H}),K=function(e){let t=1,n=[];for(;t<=e;)n.push(f1().createElement(yu,{key:t,value:t,text:String(t)})),t++;return n}(V),Z={backward:C,forward:E};if((0,f0.useEffect)(()=>{if(I){let e;e=Z[I],e?.current&&!e.current.disabled&&e.current.focus(),B(null)}},[I]),p!==T&&(N(p),O(p)),m!==F&&(j(ym(D,m)),L(m)),!yp()(g,z)){let e=yf(g);e.find(e=>e.value===R)||N(1),S(e),P(g)}return f1().createElement("div",gi({className:W,ref:w},A),f1().createElement("div",{className:`${k}--pagination__left`},f1().createElement("label",{id:`${k}-pagination-select-${x}-count-label`,className:`${k}--pagination__text`,htmlFor:`${k}-pagination-select-${x}`},l),f1().createElement(yc,{id:`${k}-pagination-select-${x}`,className:`${k}--select__item-count`,labelText:"",hideLabel:!0,noLabel:!0,inline:!0,onChange:function(e){let t={pageSize:Number(e.target.value),page:1};N(t.page),j(t.pageSize),c&&c(t)},disabled:h||n,value:R},D.map(e=>f1().createElement(yu,{key:e.value,value:e.value,text:String(e.text)}))),f1().createElement("span",{className:`${k}--pagination__text ${k}--pagination__items-count`},b||!$?0===$?s(0,0,0):i(R*(M-1)+1,M*R):s(Math.min(R*(M-1)+1,$),Math.min(M*R,$),$))),f1().createElement("div",{className:`${k}--pagination__right`},b?f1().createElement("span",{className:`${k}--pagination__text ${k}--pagination__page-text ${k}--pagination__unknown-pages-text`},y(M)):f1().createElement(f1().Fragment,null,f1().createElement(yc,{id:`${k}-pagination-select-${x}-right`,className:`${k}--select__page-number`,labelText:`Page of ${V} pages`,inline:!0,hideLabel:!0,onChange:function(e){let t=Number(e.target.value);t>0&&$&&t<=Math.max(Math.ceil($/R),1)&&(N(t),c&&c({page:t,pageSize:R}))},value:M,disabled:f||n},K),f1().createElement("span",{className:`${k}--pagination__text`},d(M,V))),f1().createElement("div",{className:`${k}--pagination__control-buttons`},f1().createElement(g1,{align:"top",disabled:G,kind:"ghost",className:U,label:e,"aria-label":e,onClick:function(){let e=M-1;N(e),1===e&&B("forward"),c&&c({page:e,pageSize:R,ref:E})},ref:C},eg||(eg=f1().createElement(ys.ZK,null))),f1().createElement(g1,{align:"top-end",disabled:H||o,kind:"ghost",className:q,label:r,"aria-label":r,onClick:function(){let e=M+1;N(e),e===V&&B("backward"),c&&c({page:e,pageSize:R,ref:C})},ref:E},e_||(e_=f1().createElement(ys.K3,null))))))});yh.propTypes={backwardText:gl().string,className:gl().string,disabled:gl().bool,forwardText:gl().string,id:gl().oneOfType([gl().string,gl().number]),isLastPage:gl().bool,itemRangeText:gl().func,itemText:gl().func,itemsPerPageText:gl().string,onChange:gl().func,page:gl().number,pageInputDisabled:gl().bool,pageNumberText:gl().string,pageRangeText:gl().func,pageSize:gl().number,pageSizeInputDisabled:gl().bool,pageSizes:gl().oneOfType([gl().arrayOf(gl().number.isRequired),gl().arrayOf(gl().shape({text:gl().string.isRequired,value:gl().number.isRequired}).isRequired)]).isRequired,pageText:gl().func,pagesUnknown:gl().bool,size:gl().oneOf(["sm","md","lg"]),totalItems:gl().number};let yg=f1().forwardRef((e,t)=>{let{className:n,decorator:r,disabled:a,hideLabel:o,id:i,labelPosition:s="right",labelText:l="",name:c,onChange:u=()=>{},value:d="",slug:p,required:f,...m}=e,h=gm(),g=gG("radio-button"),y=i||g,b=hZ()(`${h}--radio-button__label-text`,{[`${h}--visually-hidden`]:o}),v=hZ()(n,`${h}--radio-button-wrapper`,{[`${h}--radio-button-wrapper--label-${s}`]:"right"!==s,[`${h}--radio-button-wrapper--slug`]:p,[`${h}--radio-button-wrapper--decorator`]:r}),$=(0,f0.useRef)(null),A=p??r,w=_G(A,_V)?(0,f0.cloneElement)(A,{size:A.props?.kind==="inline"?"md":"mini"}):A;return f1().createElement("div",{className:v},f1().createElement("input",gi({},m,{type:"radio",className:`${h}--radio-button`,onChange:function(e){u(d,c,e)},id:y,ref:_u($,t),disabled:a,value:d,name:c,required:f})),f1().createElement("label",{htmlFor:y,className:`${h}--radio-button__label`},f1().createElement("span",{className:`${h}--radio-button__appearance`}),l&&f1().createElement(_$,{className:b},l,p?w:r?f1().createElement("div",{className:`${h}--radio-button-wrapper-inner--decorator`},w):"")))});function y_(e){let{className:t,...n}=e,r=gm();return f1().createElement("div",gi({className:hZ()(`${r}--radio-button-wrapper`,t)},n),f1().createElement("div",{className:`${r}--radio-button ${r}--skeleton`}),f1().createElement("span",{className:`${r}--radio-button__label ${r}--skeleton`}))}yg.displayName="RadioButton",yg.propTypes={checked:gl().bool,className:gl().string,decorator:gl().node,defaultChecked:gl().bool,disabled:gl().bool,hideLabel:gl().bool,id:gl().string,labelPosition:gl().oneOf(["right","left"]),labelText:gl().node.isRequired,name:gl().string,onChange:gl().func,onClick:gl().func,required:gl().bool,slug:gA(gl().node,"The `slug` prop has been deprecated and will be removed in the next major version. Use the decorator prop instead."),value:gl().oneOfType([gl().string,gl().number])},y_.propTypes={className:gl().string};let yy=e=>f1().createElement(_$,gi({as:"legend"},e)),yb=f1().forwardRef((e,t)=>{let{children:n,className:r,decorator:a,defaultSelected:o,disabled:i,helperText:s,invalid:l=!1,invalidText:c,labelPosition:u="right",legendText:d,name:p,onChange:f=()=>{},orientation:m="horizontal",readOnly:h,valueSelected:g,warn:y=!1,warnText:b,slug:v,required:$,...A}=e,w=gm(),[k,x]=(0,f0.useState)(g??o),[C,E]=(0,f0.useState)(g),D=gG();function S(e,t,n){h||e===k||(x(e),f(e,p,n))}g!==C&&(x(g),E(g));let z=!h&&!l&&y,P=!l&&!i&&!y,M=hZ()(`${w}--form-item`,r),N=hZ()(`${w}--radio-button-group`,{[`${w}--radio-button-group--${m}`]:"vertical"===m,[`${w}--radio-button-group--label-${u}`]:u,[`${w}--radio-button-group--readonly`]:h,[`${w}--radio-button-group--invalid`]:!h&&l,[`${w}--radio-button-group--warning`]:z,[`${w}--radio-button-group--slug`]:v,[`${w}--radio-button-group--decorator`]:a}),T=hZ()(`${w}--form__helper-text`,{[`${w}--form__helper-text--disabled`]:i}),O=s?`radio-button-group-helper-text-${D}`:void 0,I=s?f1().createElement("div",{id:O,className:T},s):null,B=(0,f0.useRef)(null),R=v??a,j=_G(R,_V)?(0,f0.cloneElement)(R,{size:"mini",kind:"default"}):R;return f1().createElement("div",{className:M,ref:_u(B,t)},f1().createElement("fieldset",gi({className:N,disabled:i,"data-invalid":!!l||void 0,"aria-describedby":P&&s?O:void 0},A),d&&f1().createElement(yy,{className:`${w}--label`},d,v?j:a?f1().createElement("div",{className:`${w}--radio-button-group-inner--decorator`},j):""),f1().Children.map(n,e=>{if(!e)return;let t={name:p,key:e.props.value,value:e.props.value,onChange:S,checked:e.props.value===k,required:$};return!k&&e.props.checked&&(t.checked=!0),f1().cloneElement(e,t)})),f1().createElement("div",{className:`${w}--radio-button__validation-msg`},!h&&l&&f1().createElement(f1().Fragment,null,f1().createElement(_7.BF,{className:`${w}--radio-button__invalid-icon`}),f1().createElement("div",{className:`${w}--form-requirement`},c)),z&&f1().createElement(f1().Fragment,null,f1().createElement(_7.OR,{className:`${w}--radio-button__invalid-icon ${w}--radio-button__invalid-icon--warning`}),f1().createElement("div",{className:`${w}--form-requirement`},b))),P&&I)});yb.propTypes={children:gl().node,className:gl().string,decorator:gl().node,defaultSelected:gl().oneOfType([gl().string,gl().number]),disabled:gl().bool,helperText:gl().node,invalid:gl().bool,invalidText:gl().node,labelPosition:gl().oneOf(["left","right"]),legendText:gl().node,name:gl().string.isRequired,onChange:gl().func,orientation:gl().oneOf(["horizontal","vertical"]),readOnly:gl().bool,required:gl().bool,slug:gA(gl().node,"The `slug` prop has been deprecated and will be removed in the next major version. Use the decorator prop instead."),valueSelected:gl().oneOfType([gl().string,gl().number]),warn:gl().bool,warnText:gl().node},yb.displayName="RadioButtonGroup";var yv=n(6924);let y$=f1().forwardRef(({autoComplete:e="off",className:t,closeButtonLabelText:n="Clear search input",defaultValue:r,disabled:a,isExpanded:o=!0,id:i,labelText:s,light:l,onChange:c=()=>{},onClear:u=()=>{},onKeyDown:d,onExpand:p,placeholder:f="Search",renderIcon:m,role:h,size:g="md",type:y="search",value:b,...v},$)=>{let A=!!b||!!r,w=gm(),{isFluid:k}=(0,f0.useContext)(yl),x=(0,f0.useRef)(null),C=gp([$,x]),E=(0,f0.useRef)(null),D=gG("search-input"),S=i||D,z=`${S}-search`,[P,M]=(0,f0.useState)(A||!1),[N,T]=(0,f0.useState)(b),O=hZ()({[`${w}--search`]:!0,[`${w}--search--sm`]:"sm"===g,[`${w}--search--md`]:"md"===g,[`${w}--search--lg`]:"lg"===g,[`${w}--search--light`]:l,[`${w}--search--disabled`]:a,[`${w}--search--fluid`]:k},t),I=hZ()({[`${w}--search-close`]:!0,[`${w}--search-close--hidden`]:!P||!o});function B(){if(!b&&x.current&&(x.current.value=""),x.current){let e=Object.assign({},x.current,{value:""});c({bubbles:!1,cancelable:!1,currentTarget:x.current,defaultPrevented:!1,eventPhase:0,isDefaultPrevented:()=>!1,isPropagationStopped:()=>!1,isTrusted:!1,nativeEvent:new Event("change"),persist:_a,preventDefault:_a,stopPropagation:_a,target:e,timeStamp:0,type:"change"})}u(),M(!1),x.current?.focus()}return b!==N&&(M(!!b),T(b)),f1().createElement("div",{role:"search","aria-label":f,className:O},f1().createElement("div",{"aria-labelledby":p?z:void 0,role:p?"button":void 0,className:`${w}--search-magnifier`,onClick:p,onKeyDown:function(e){(gO(e,gS)||gO(e,gP))&&(e.stopPropagation(),p&&p(e))},tabIndex:p&&!o?0:-1,ref:E,"aria-expanded":!!p&&!!o||(!p||!!o)&&void 0,"aria-controls":p?S:void 0},f1().createElement(yA,{icon:m})),f1().createElement("label",{id:z,htmlFor:S,className:`${w}--label`},s),f1().createElement("input",gi({autoComplete:e,className:`${w}--search-input`,defaultValue:r,disabled:a,role:h,ref:C,id:S,onChange:_b([c,function(e){M(""!==e.target.value)}]),onKeyDown:_b([d,function(e){gO(e,gz)&&(e.stopPropagation(),x.current?.value?B():p&&o&&E.current?.focus())}]),placeholder:f,type:y,value:b,tabIndex:p&&!o?-1:void 0},v)),f1().createElement("button",{"aria-label":n,className:I,disabled:a,onClick:B,title:n,type:"button"},ey||(ey=f1().createElement(_t.bm,null))))});function yA({icon:e}){let t=gm();return e?f1().createElement(e,{className:`${t}--search-magnifier-icon`}):f1().createElement(yv.vj,{className:`${t}--search-magnifier-icon`})}y$.displayName="Search",y$.propTypes={autoComplete:gl().string,className:gl().string,closeButtonLabelText:gl().string,defaultValue:gl().oneOfType([gl().string,gl().number]),disabled:gl().bool,id:gl().string,isExpanded:gl().bool,labelText:gl().node.isRequired,light:gA(gl().bool,"The `light` prop for `Search` is no longer needed and has been deprecated in v11 in favor of the new `Layer` component. It will be moved in the next major release."),onChange:gl().func,onClear:gl().func,onExpand:gl().func,onKeyDown:gl().func,placeholder:gl().string,renderIcon:gl().oneOfType([gl().func,gl().object]),role:gA(gl().string,'The `role` prop has been deprecated since <input type="search"> already provides correct semantics. It will be removed in the next major release of Carbon.'),size:gl().oneOf(["sm","md","lg"]),type:gl().string,value:gl().oneOfType([gl().string,gl().number])},yA.propTypes={icon:gl().oneOfType([gl().func,gl().object])};let yw=({className:e,...t})=>{let n=gm(),r=hZ()(e,{[`${n}--icon--skeleton`]:!0});return f1().createElement("div",gi({className:r},t))};yw.propTypes={className:gl().string};let yk=({align:e="bottom",autoAlign:t,className:n,children:r,definition:a,defaultOpen:o=!1,id:i,openOnHover:s,tooltipText:l,triggerClassName:c,...u})=>{let[d,p]=(0,f0.useState)(o),f=gm(),m=gU(i);return f1().createElement(gC,{align:e,className:n,autoAlign:t,dropShadow:!1,highContrast:!0,onMouseLeave:()=>{p(!1)},onMouseEnter:()=>{s&&p(!0)},onFocus:()=>{p(!0)},open:d},f1().createElement("button",gi({},u,{className:hZ()(`${f}--definition-term`,c),"aria-controls":m,"aria-describedby":m,"aria-expanded":d,onBlur:()=>{p(!1)},onMouseDown:e=>{0===e.button&&p(!d)},onKeyDown:function(e){d&&gO(e,gz)&&(e.stopPropagation(),p(!1))},type:"button"}),r),f1().createElement(gE,{className:`${f}--definition-tooltip`,id:m},l??a))};yk.propTypes={align:gl().oneOf(["top","top-left","top-right","bottom","bottom-left","bottom-right","left","left-bottom","left-top","right","right-bottom","right-top","top-start","top-end","bottom-start","bottom-end","left-end","left-start","right-end","right-start"]),autoAlign:gl().bool,children:gl().node.isRequired,className:gl().string,defaultOpen:gl().bool,definition:gl().node.isRequired,id:gl().string,openOnHover:gl().bool,tooltipText:gA(gl().node,"The tooltipText prop has been deprecated. Please use the `definition` prop instead."),triggerClassName:gl().string};let yx={red:"Red",magenta:"Magenta",purple:"Purple",blue:"Blue",cyan:"Cyan",teal:"Teal",green:"Green",gray:"Gray","cool-gray":"Cool-Gray","warm-gray":"Warm-Gray","high-contrast":"High-Contrast",outline:"Outline"},yC=f1().forwardRef(({children:e,className:t,decorator:n,id:r,type:a,filter:o,renderIcon:i,title:s="Clear filter",disabled:l,onClose:c,size:u,as:d,slug:p,...f},m)=>{let h=gm(),g=(0,f0.useRef)(null);o&&console.warn("The `filter` prop for Tag has been deprecated and will be removed in the next major version. Use DismissibleTag instead."),c&&console.warn("The `onClose` prop for Tag has been deprecated and will be removed in the next major version. Use DismissibleTag instead.");let y=gp([m,g]),b=r||`tag-${gG()}`,[v,$]=(0,f0.useState)(!1);(0,f0.useLayoutEffect)(()=>{var e;$(!!(e=g.current?.getElementsByClassName(`${h}--tag__label`)[0])&&e?.offsetWidth<e?.scrollWidth)},[h,g]);let A=[`${h}--tag--selectable`,`${h}--tag--filter`,`${h}--tag--operational`].some(e=>t?.includes(e)),w=hZ()(`${h}--tag`,t,{[`${h}--tag--disabled`]:l,[`${h}--tag--filter`]:o,[`${h}--tag--${u}`]:u,[`${h}--layout--size-${u}`]:u,[`${h}--tag--${a}`]:a,[`${h}--tag--interactive`]:f.onClick&&!A&&v}),k=void 0!==a&&a in Object.keys(yx)?yx[a]:"",x=p??n,C=_G(x,_V)&&!A?(0,f0.cloneElement)(x,{size:"sm",kind:"inline"}):null;if(o){let t=d??"div";return f1().createElement(t,gi({className:w,id:b},f),i&&"sm"!==u?f1().createElement("div",{className:`${h}--tag__custom-icon`},f1().createElement(i,null)):"",f1().createElement(_$,{title:"string"==typeof e?e:void 0,className:`${h}--tag__label`},null!=e?e:k),C,f1().createElement("button",{type:"button",className:`${h}--tag__close-icon`,onClick:e=>{c&&(e.stopPropagation(),c(e))},disabled:l,"aria-label":s,title:s},eb||(eb=f1().createElement(_t.bm,null))))}let E=d??(f.onClick||t?.includes(`${h}--tag--operational`)?"button":"div"),D=hZ()({[`${h}--tag__label`]:!A});return f1().createElement(E,gi({ref:y,disabled:l,className:w,id:b,type:"button"===E?"button":void 0},f),i&&"sm"!==u?f1().createElement("div",{className:`${h}--tag__custom-icon`},f1().createElement(i,null)):"",v&&!A?f1().createElement(yk,{openOnHover:!1,definition:null!=e?e:k,className:`${h}--definition--tooltip--tag`},f1().createElement(_$,{title:null!=e&&"string"==typeof e?e:k,className:D},null!=e?e:k)):f1().createElement(_$,{title:null!=e&&"string"==typeof e?e:k,className:D},null!=e?e:k),p?C:n?f1().createElement("div",{className:`${h}--tag__decorator`},C):"")});yC.propTypes={as:gl().elementType,children:gl().node,className:gl().string,decorator:gl().node,disabled:gl().bool,filter:gA(gl().bool,"The `filter` prop has been deprecated and will be removed in the next major version. Use DismissibleTag instead."),id:gl().string,onClose:gA(gl().func,"The `onClose` prop has been deprecated and will be removed in the next major version. Use DismissibleTag instead."),renderIcon:gl().oneOfType([gl().func,gl().object]),size:gl().oneOf(["sm","md","lg"]),slug:gA(gl().node,"The `slug` prop has been deprecated and will be removed in the next major version. Use the decorator prop instead."),title:gA(gl().string,"The `title` prop has been deprecated and will be removed in the next major version. Use DismissibleTag instead."),type:gl().oneOf(Object.keys(yx))};var yE=n(5848);let yD=f1().forwardRef(({as:e,children:t,className:n,href:r,disabled:a=!1,inline:o=!1,visited:i=!1,renderIcon:s,size:l,target:c,...u},d)=>{let p=gm(),f={className:hZ()(`${p}--link`,n,{[`${p}--link--disabled`]:a,[`${p}--link--inline`]:o,[`${p}--link--visited`]:i,[`${p}--link--${l}`]:l}),rel:"_blank"===c?"noopener":void 0,target:c};return a?(f.role="link",f["aria-disabled"]=!0):f.href=r,f1().createElement(e??"a",gi({ref:d},f,u,{onClick:e=>{a?(e.preventDefault(),e.stopPropagation()):u.onClick&&u.onClick(e)}}),t,!o&&s&&f1().createElement("div",{className:`${p}--link__icon`},f1().createElement(s,null)))});yD.displayName="Link",yD.propTypes={as:gl().elementType,children:gl().node,className:gl().string,disabled:gl().bool,href:gl().string,inline:gl().bool,renderIcon:gl().oneOfType([gl().func,gl().object]),size:gl().oneOf(["sm","md","lg"]),visited:gl().bool};let yS=f1().forwardRef(({children:e,className:t,decorator:n,light:r=!1,slug:a,hasRoundedCorners:o=!1,...i},s)=>{let l=gm(),c=hZ()(`${l}--tile`,{[`${l}--tile--light`]:r,[`${l}--tile--slug`]:a,[`${l}--tile--slug-rounded`]:a&&o,[`${l}--tile--decorator`]:n,[`${l}--tile--decorator-rounded`]:n&&o},t);return f1().createElement("div",gi({className:c,ref:s},i),e,a,n&&f1().createElement("div",{className:`${l}--tile--inner-decorator`},n))});yS.displayName="Tile",yS.propTypes={children:gl().node,className:gl().string,decorator:gl().node,hasRoundedCorners:gl().bool,light:gA(gl().bool,"The `light` prop for `Tile` is no longer needed and has been deprecated. It will be removed in the next major release. Use the Layer component instead."),slug:gA(gl().node,"The `slug` prop for `Tile` has been deprecated in favor of the new `decorator` prop. It will be removed in the next major release.")};let yz=f1().forwardRef(({children:e,className:t,clicked:n=!1,decorator:r,disabled:a,href:o,light:i,onClick:s=()=>{},onKeyDown:l=()=>{},renderIcon:c,hasRoundedCorners:u,slug:d,...p},f)=>{let m=gm(),h=hZ()(`${m}--tile`,`${m}--tile--clickable`,{[`${m}--tile--is-clicked`]:n,[`${m}--tile--light`]:i,[`${m}--tile--slug`]:d,[`${m}--tile--slug-rounded`]:d&&u,[`${m}--tile--decorator`]:r,[`${m}--tile--decorator-rounded`]:r&&u},t),[g,y]=(0,f0.useState)(n),b=gk("enable-v12-tile-default-icons");b&&(c||(c=yE.Qp),a&&(c=_o.$D));let v=hZ()({[`${m}--tile--icon`]:!b||b&&!a,[`${m}--tile--disabled-icon`]:b&&a});return f1().createElement(yD,gi({className:h,href:o,tabIndex:o||a?void 0:0,onClick:a?void 0:function(e){e?.persist?.(),y(!g),s(e)},onKeyDown:function(e){e?.persist?.(),gT(e,[gS,gP])&&y(!g),l(e)},ref:f,disabled:a},p),d||r?f1().createElement("div",{className:`${m}--tile-content`},e):e,(!0===d||!0===r)&&f1().createElement(yE.bE,{size:"24",className:`${m}--tile--ai-label-icon`}),f1().isValidElement(r)&&f1().createElement("div",{className:`${m}--tile--inner-decorator`},r),c&&f1().createElement(c,{className:v,"aria-hidden":"true"}))});yz.displayName="ClickableTile",yz.propTypes={children:gl().node,className:gl().string,clicked:gl().bool,decorator:gl().oneOfType([gl().bool,gl().node]),disabled:gl().bool,hasRoundedCorners:gl().bool,href:gl().string,light:gA(gl().bool,"The `light` prop for `ClickableTile` is no longer needed and has been deprecated. It will be removed in the next major release. Use the Layer component instead."),onClick:gl().func,onKeyDown:gl().func,rel:gl().string,renderIcon:gl().oneOfType([gl().func,gl().object])},f1().forwardRef(({children:e,className:t,decorator:n,disabled:r,id:a,light:o,onClick:i=()=>{},onChange:s=()=>{},onKeyDown:l=()=>{},selected:c=!1,tabIndex:u=0,title:d="title",slug:p,hasRoundedCorners:f,...m},h)=>{let g=gm(),[y,b]=(0,f0.useState)(c);(0,f0.useEffect)(()=>{b(c)},[c]);let v=hZ()(`${g}--tile`,`${g}--tile--selectable`,{[`${g}--tile--is-selected`]:y,[`${g}--tile--light`]:o,[`${g}--tile--disabled`]:r,[`${g}--tile--slug`]:p,[`${g}--tile--slug-rounded`]:p&&f,[`${g}--tile--decorator`]:n,[`${g}--tile--decorator-rounded`]:n&&f},t),$=(0,f0.useCallback)((e,t)=>{b(t),s(e,t,a)},[s,a]),A=(0,f0.useRef)(null),w=p??n,k=_G(w,_V)?(0,f0.cloneElement)(w,{size:"xs",ref:A}):w;return f1().createElement("div",gi({className:v,onClick:r?void 0:function(e){e.preventDefault(),e?.persist?.(),k&&A.current&&e.target instanceof Node&&A.current.contains(e.target)||($(e,!y),i(e))},role:"checkbox","aria-checked":y,onKeyDown:r?void 0:function(e){e?.persist?.(),gT(e,[gS,gP])&&(e.preventDefault(),$(e,!y)),l(e)},tabIndex:r?void 0:u,ref:h,id:a,title:d},m),f1().createElement("span",{className:`${g}--tile__checkmark ${g}--tile__checkmark--persistent`},y?ev||(ev=f1().createElement(_t.NW,null)):e$||(e$=f1().createElement(_t.Sc,null))),f1().createElement(_$,{as:"label",htmlFor:a,className:`${g}--tile-content`},e),p?k:n?f1().createElement("div",{className:`${g}--tile--inner-decorator`},k):"")}).propTypes={children:gl().node,className:gl().string,decorator:gl().node,disabled:gl().bool,hasRoundedCorners:gl().bool,id:gl().string,light:gA(gl().bool,"The `light` prop for `SelectableTile` is no longer needed and has been deprecated. It will be removed in the next major release. Use the Layer component instead."),name:gA(gl().string,"The `name` property is no longer used. It will be removed in the next major release."),onChange:gl().func,onClick:gl().func,onKeyDown:gl().func,selected:gl().bool,slug:gA(gl().node,"The `slug` prop for `SelectableTile` has been deprecated in favor of the new `decorator` prop. It will be removed in the next major release."),tabIndex:gl().number,title:gl().string,value:gA(gl().oneOfType([gl().string,gl().number]),"The `value` property is no longer used. It will be removed in the next major release.`")};let yP=f1().forwardRef(({tabIndex:e=0,className:t,children:n,decorator:r,expanded:a=!1,tileMaxHeight:o=0,tilePadding:i=0,onClick:s,onKeyUp:l,tileCollapsedIconText:c="Interact to expand Tile",tileExpandedIconText:u="Interact to collapse Tile",tileCollapsedLabel:d,tileExpandedLabel:p,light:f,slug:m,hasRoundedCorners:h,...g},y)=>{let[b,v]=(0,f0.useState)(o),[$,A]=(0,f0.useState)(i),[w,k]=(0,f0.useState)(a),[x,C]=(0,f0.useState)(o),[E,D]=(0,f0.useState)(i),[S,z]=(0,f0.useState)(a),[P,M]=(0,f0.useState)(!0),N=(0,f0.useRef)(null),T=(0,f0.useRef)(null),O=(0,f0.useRef)(null),I=(0,f0.useRef)(null),B=(0,f0.useRef)(null),R=gp([y,B]),j=gm();function F(){S&&I.current&&v(I.current.getBoundingClientRect()?.height),N.current&&v(N.current.getBoundingClientRect().height)}function L(e){e?.persist?.(),z(!S),F()}function W(e){e.target!==B.current&&e.target!==O.current&&gT(e,[gS,gP])&&e.preventDefault()}a!==w&&(z(a),k(a),F()),o!==x&&(v(o),C(o)),i!==E&&(A(i),D(i));let V=hZ()(`${j}--tile`,`${j}--tile--expandable`,{[`${j}--tile--is-expanded`]:S,[`${j}--tile--light`]:f},t),G=hZ()(`${j}--tile`,`${j}--tile--expandable`,`${j}--tile--expandable--interactive`,{[`${j}--tile--is-expanded`]:S,[`${j}--tile--light`]:f,[`${j}--tile--slug`]:m,[`${j}--tile--slug-rounded`]:m&&h,[`${j}--tile--decorator`]:r,[`${j}--tile--decorator-rounded`]:r&&h},t),U=hZ()(`${j}--tile__chevron`,`${j}--tile__chevron--interactive`),H=f1().Children.toArray(n);gd(()=>{if(!B.current||!N.current)return;let e=window.getComputedStyle(B.current,null),{current:t}=N,{height:n}=t.getBoundingClientRect(),r=parseInt(e.getPropertyValue("padding-top"),10),a=parseInt(e.getPropertyValue("padding-bottom"),10);v(n),A(r+a)},[b]),gd(()=>{N.current&&T.current&&(gq(T.current)||gK(T.current)||gq(N.current)||gK(N.current)||m||r||M(!1))},[m,r]),gd(()=>{B.current&&(S?B.current.style.maxHeight="":B.current.style.maxHeight=b+$+"px")},[S,b,$]),(0,f0.useEffect)(()=>{if(!N.current)return;let e=new ResizeObserver(e=>{let[t]=e;v(t.contentRect.height)});return e.observe(N.current),()=>e.disconnect()},[b,$]);let q=gG("expandable-tile-interactive"),K=m??r,Z=_G(K,_V)?(0,f0.cloneElement)(K,{size:"xs"}):K;return P?f1().createElement("div",gi({ref:R,className:G},g),f1().createElement("div",{ref:I},m?Z:r?f1().createElement("div",{className:`${j}--tile--inner-decorator`},Z):"",f1().createElement("div",{ref:N,className:`${j}--tile-content`},H[0]),f1().createElement("button",{type:"button","aria-expanded":S,"aria-controls":q,onKeyUp:_b([l,W]),onClick:_b([s,L]),"aria-label":S?u:c,ref:O,className:U},eA||(eA=f1().createElement(_t.yQ,null))),f1().createElement("div",{ref:T,className:`${j}--tile-content`,id:q},H[1]))):f1().createElement("button",gi({type:"button",ref:R,className:V,"aria-expanded":S,title:S?u:c},g,{onKeyUp:_b([l,W]),onClick:_b([s,L]),tabIndex:e}),f1().createElement("div",{ref:I},f1().createElement("div",{ref:N,className:`${j}--tile-content`},H[0]),f1().createElement("div",{className:`${j}--tile__chevron`},f1().createElement("span",null,S?p:d),ew||(ew=f1().createElement(_t.yQ,null))),f1().createElement("div",{ref:T,className:`${j}--tile-content`},H[1])))});yP.propTypes={children:gl().node,className:gl().string,decorator:gl().node,expanded:gl().bool,hasRoundedCorners:gl().bool,id:gl().string,light:gA(gl().bool,"The `light` prop for `ExpandableTile` is no longer needed and has been deprecated. It will be removed in the next major release. Use the Layer component instead."),onClick:gl().func,onKeyUp:gl().func,slug:gA(gl().node,"The `slug` prop for `ExpandableTile` has been deprecated in favor of the new `decorator` prop. It will be removed in the next major release."),tabIndex:gl().number,tileCollapsedIconText:gl().string,tileCollapsedLabel:gl().string,tileExpandedIconText:gl().string,tileExpandedLabel:gl().string},yP.displayName="ExpandableTile";let yM=f1().forwardRef(({children:e},t)=>{let n=gm();return f1().createElement("div",{ref:t,className:`${n}--tile-content__above-the-fold`},e)});yM.propTypes={children:gl().node},yM.displayName="TileAboveTheFoldContent";let yN=f1().forwardRef(({children:e},t)=>{let n=gm();return f1().createElement("div",{ref:t,className:`${n}--tile-content__below-the-fold`},e)});yN.propTypes={children:gl().node},yN.displayName="TileBelowTheFoldContent";let yT=({className:e,children:t,...n})=>{let r=gm(),a=hZ()(`${r}--header`,e);return f1().createElement("header",gi({},n,{className:a}),t)};yT.propTypes={"aria-label":gl().string,"aria-labelledby":gl().string,className:gl().string};let yO=Object.keys(ep={"aria-label":gl().string,"aria-labelledby":gl().string}).reduce((e,t)=>{let n;return{...e,[t]:(n=ep[t],(e,t,r,...a)=>n(e,t,r,...a))}},{}),yI=f1().forwardRef(({"aria-label":e,"aria-labelledby":t,children:n,className:r,onClick:a,tooltipHighContrast:o=!0,tooltipDropShadow:i,isActive:s,tooltipAlignment:l,...c},u)=>{let d=gm(),p=hZ()({[r]:!!r,[`${d}--header__action`]:!0,[`${d}--header__action--active`]:s});return f1().createElement(g3,gi({},c,{"aria-label":e,"aria-labelledby":t},{className:p,onClick:a,type:"button",hasIconOnly:!0,size:"lg",kind:"ghost",iconDescription:e,tooltipPosition:"bottom",tooltipAlignment:l,tooltipDropShadow:i,tooltipHighContrast:o,ref:u}),n)});yI.propTypes={...yO,children:gl().node.isRequired,className:gl().string,isActive:gl().bool,onClick:gl().func,tooltipAlignment:gl().oneOf(["start","center","end"]),tooltipDropShadow:gl().bool,tooltipHighContrast:gl().bool},yI.displayName="HeaderGlobalAction";let yB=_J({name:"HeaderGlobalBar",className:e=>`${e}--header__global`,type:"div"});var yR=n(8742);let yj=f1().forwardRef(function({children:e,size:t=16,...n},r){return 16===t||"16"===t||"16px"===t?f1().createElement(yR.A,{width:t,height:t,ref:r,xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 16 16",fill:"currentColor",...n},ek||(ek=f1().createElement("path",{d:"M6 15L6 14 2.7 14 7 9.7 6.3 9 2 13.3 2 10 1 10 1 15zM10 1L10 2 13.3 2 9 6.3 9.7 7 14 2.7 14 6 15 6 15 1z"})),e):f1().createElement(yR.A,{width:t,height:t,ref:r,xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 32",fill:"currentColor",...n},ex||(ex=f1().createElement("path",{d:"M20 2L20 4 26.586 4 18 12.582 19.414 14 28 5.414 28 12 30 12 30 2 20 2zM14 19.416L12.592 18 4 26.586 4 20 2 20 2 30 12 30 12 28 5.414 28 14 19.416z"})),e)}),yF=f1().forwardRef(function({children:e,size:t=16,...n},r){return 16===t||"16"===t||"16px"===t?f1().createElement(yR.A,{width:t,height:t,ref:r,xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 16 16",fill:"currentColor",...n},eC||(eC=f1().createElement("path",{d:"M2 12H14V13H2zM2 9H14V10H2zM2 6H14V7H2zM2 3H14V4H2z"})),e):20===t||"20"===t||"20px"===t?f1().createElement(yR.A,{width:t,height:t,ref:r,xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",...n},eE||(eE=f1().createElement("path",{d:"M2 14.8H18V16H2zM2 11.2H18V12.399999999999999H2zM2 7.6H18V8.799999999999999H2zM2 4H18V5.2H2z"})),e):24===t||"24"===t||"24px"===t?f1().createElement(yR.A,{width:t,height:t,ref:r,xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",...n},eD||(eD=f1().createElement("path",{d:"M3 18H21V19.5H3zM3 13.5H21V15H3zM3 9H21V10.5H3zM3 4.5H21V6H3z"})),e):f1().createElement(yR.A,{width:t,height:t,ref:r,xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 32",fill:"currentColor",...n},eS||(eS=f1().createElement("path",{d:"M4 6H28V8H4zM4 24H28V26H4zM4 12H28V14H4zM4 18H28V20H4z"})),e)});function yL({"aria-label":e,"aria-labelledby":t,className:n,renderMenuIcon:r,renderCloseIcon:a,isActive:o,isCollapsible:i,...s}){let l=gm(),c=hZ()({..."string"==typeof n&&{[n]:!!n},[`${l}--header__action`]:!0,[`${l}--header__menu-trigger`]:!0,[`${l}--header__action--active`]:o,[`${l}--header__menu-toggle`]:!0,[`${l}--header__menu-toggle__hidden`]:!i}),u=r||ez||(ez=f1().createElement(yF,{size:20})),d=a||eP||(eP=f1().createElement(_t.bm,{size:20}));return f1().createElement("button",gi({},s,{"aria-label":e,"aria-labelledby":t,className:c,title:e,type:"button"}),o?d:u)}yL.propTypes={...yO,className:gl().string,isActive:gl().bool,isCollapsible:gl().bool,onClick:gl().func};let yW=f1().forwardRef(({element:e,as:t,isSideNavExpanded:n,...r},a)=>f1().createElement(t??e??"a",gi({ref:a},r))),yV={as:gl().elementType,element:gA(gl().elementType,"The `element` prop for `Link` has been deprecated. Please use `as` instead. This will be removed in the next major release."),isSideNavExpanded:gl().bool};function yG({children:e,className:t,prefix:n="IBM",...r}){let a=gm(),o=hZ()(`${a}--header__name`,t);return f1().createElement(yW,gi({},r,{className:o}),n&&f1().createElement(f1().Fragment,null,f1().createElement("span",{className:`${a}--header__name--prefix`},n),"\xa0"),e)}yW.displayName="Link",yW.propTypes=yV,yG.propTypes={...yV,children:gl().node.isRequired,className:gl().string,href:gl().string,prefix:gl().string};let yU=["SideNavFooter","SideNavHeader","SideNavItems","SideNavMenu","SideNavLink"];var yH=n(4011);let yq=(0,f0.createContext)({}),yK=f1().forwardRef(function({expanded:e,defaultExpanded:t=!1,isChildOfHeader:n=!0,"aria-label":r,"aria-labelledby":a,children:o,onToggle:i,className:s,href:l,isFixedNav:c=!1,isRail:u,isPersistent:d=!0,addFocusListeners:p=!0,addMouseListeners:f=!0,onOverlayClick:m,onSideNavBlur:h,enterDelayMs:g=100,...y},b){let v=gm(),{current:$}=(0,f0.useRef)(void 0!==e),[A,w]=gI(t),[k,x]=gI(t),C=$?e:A,E=(0,f0.useRef)(null),D=gp([E,b]),S=(e,t=!C)=>{$||w(t,g),i&&i(e,t),($||u)&&x(t,g)},z=hZ()(s,{[`${v}--side-nav`]:!0,[`${v}--side-nav--expanded`]:C||k,[`${v}--side-nav--collapsed`]:!C&&c,[`${v}--side-nav--rail`]:u,[`${v}--side-nav--ux`]:n,[`${v}--side-nav--hidden`]:!d}),P=hZ()({[`${v}--side-nav__overlay`]:!0,[`${v}--side-nav__overlay-active`]:C||k}),M=o;M=f1().Children.map(o,e=>{let t=$&&k||C;return(0,f0.isValidElement)(e)?f1().cloneElement(e,{...yU.includes(e.type?.displayName??e.type?.name)?{isSideNavExpanded:t}:{}}):e});let N={};p&&(N.onFocus=e=>{!e.currentTarget.contains(e.relatedTarget)&&u&&S(e,!0)},N.onBlur=e=>{e.currentTarget.contains(e.relatedTarget)||S(e,!1),!e.currentTarget.contains(e.relatedTarget)&&C&&!c&&h&&h()},N.onKeyDown=e=>{gO(e,gz)&&(S(e,!1),l&&(window.location.href=l))}),f&&u&&(N.onMouseEnter=()=>{S(!0,!0)},N.onMouseLeave=()=>{w(!1),x(!1),S(!1,!1)},N.onClick=()=>{w(!0),x(!0),S(!0,!0)}),gh("keydown",e=>{let t=document.activeElement;gO(e,gD)&&C&&!c&&E.current&&t?.classList.contains(`${v}--header__menu-toggle`)&&!t.closest("nav")&&E.current.focus()});let T=((e,t=!1)=>{let[n,r]=(0,f0.useState)(t);return(0,f0.useEffect)(()=>{let t=e=>{r(e.matches)},n=window.matchMedia(e);return n.addEventListener("change",t),r(n.matches),()=>{n.removeEventListener("change",t)}},[e]),n})(`(min-width: ${yH.fi.lg.width})`);return f1().createElement(yq.Provider,{value:{isRail:u}},c?null:f1().createElement("div",{className:P,onClick:m}),f1().createElement("nav",gi({tabIndex:-1,ref:D,className:`${v}--side-nav__navigation ${z}`,inert:u?void 0:!(C||T)},{"aria-label":r,"aria-labelledby":a},N,y),M))});yK.displayName="SideNav",yK.propTypes={...yO,addFocusListeners:gl().bool,addMouseListeners:gl().bool,className:gl().string,defaultExpanded:gl().bool,enterDelayMs:gl().number,expanded:gl().bool,href:gl().string,isChildOfHeader:gl().bool,isFixedNav:gl().bool,isPersistent:gl().bool,isRail:gl().bool,onOverlayClick:gl().func,onSideNavBlur:gl().func,onToggle:gl().func};let yZ={"carbon.table.batch.cancel":"cancel","carbon.table.batch.items.selected":"batchActionsItemsSelected","carbon.table.batch.item.selected":"batchActionItemSelected","carbon.table.batch.selectAll":"selectAll"},yY=e=>(0,hq.jsx)(_5,{translateWithId:(e,t)=>{let n=yZ[e];return n?i9(n,e,t):e},...e});var yJ=n(6419),yX={};yX.styleTagTransform=h7(),yX.setAttributes=h3(),yX.insert=h1().bind(null,"head"),yX.domAPI=hQ(),yX.insertStyleElement=h5(),hJ()(yJ.A,yX);let yQ=yJ.A&&yJ.A.locals?yJ.A.locals:void 0,y0=(0,f0.createContext)(null);function y1(){let e=(0,f0.useContext)(y0);if(!e)throw Error("useCustomOverflowMenu must be used within a CustomOverflowMenu");return e}function y2({menuTitle:e,children:t}){let[n,r]=f1().useState(!1),a=hh(()=>r(!1),n),o="tablet"===hu(),i=(0,f0.useCallback)(()=>r(e=>!e),[]),s=(0,f0.useRef)(null),l=(0,f0.useRef)(null),c=(0,f0.useId)(),u=`custom-overflow-menu-trigger-${c}`,d=`custom-overflow-menu-${c}`,p=(0,f0.useCallback)(()=>{r(!1),s.current?.focus()},[]),f=(0,f0.useMemo)(()=>({closeMenu:p}),[p]),m=(0,f0.useCallback)(e=>{"Escape"===e.key&&n&&(e.stopPropagation(),p())},[p,n]),h=f0.Children.toArray(t);(0,f0.useEffect)(()=>{if(n&&l.current){let e=l.current.querySelector('[role="menuitem"]:not([disabled])');e?.focus()}},[n]);let g=(0,f0.useCallback)(({currentIndex:e,direction:t})=>{let n=l.current?.querySelectorAll('[role="menuitem"]:not([disabled])');if(!n?.length)return;let r=document.activeElement?.closest?.('[role="menuitem"]')??document.activeElement,a=Array.from(n).indexOf(r);if(-1===a)return void n[t>0?0:n.length-1]?.focus();let o=a+t,i=o<0?n.length-1:o>=n.length?0:o;n[i]?.focus()},[]),y=h.map((e,t)=>(0,f0.isValidElement)(e)?(0,f0.cloneElement)(e,{closeMenu:p,handleOverflowMenuItemFocus:g,index:t}):e);return(0,hq.jsxs)("div",{"data-overflow-menu":!0,className:hZ()("cds--overflow-menu",yQ.container),ref:a,children:[(0,hq.jsx)("button",{className:hZ()("cds--btn","cds--btn--ghost","cds--overflow-menu__trigger",{"cds--overflow-menu--open":n},yQ.overflowMenuButton),"aria-controls":d,"aria-expanded":n,"aria-haspopup":"true",id:u,onClick:i,onKeyDown:m,ref:s,children:e}),(0,hq.jsxs)("div",{className:hZ()("cds--overflow-menu-options","cds--overflow-menu--flip",yQ.menu,{[yQ.show]:n}),"aria-labelledby":u,"data-floating-menu-direction":"bottom",id:d,onKeyDown:m,ref:l,role:"menu",tabIndex:-1,children:[(0,hq.jsx)("ul",{className:hZ()("cds--overflow-menu-options__content",{"cds--overflow-menu-options--lg":o}),children:(0,hq.jsx)(y0.Provider,{value:f,children:y})}),(0,hq.jsx)("span",{})]})]})}function y3(e){let t=(0,f0.useContext)(y0);return(0,hq.jsx)(yi,{...e,closeMenu:t?.closeMenu})}var y4=n(31),y5=n(3941),y6={};y6.styleTagTransform=h7(),y6.setAttributes=h3(),y6.insert=h1().bind(null,"head"),y6.domAPI=hQ(),y6.insertStyleElement=h5(),hJ()(y5.A,y6);let y7=y5.A&&y5.A.locals?y5.A.locals:void 0,y8=["omrs-icon-activity","omrs-icon-add","omrs-icon-arrow-down","omrs-icon-arrow-left","omrs-icon-arrow-right","omrs-icon-arrow-up","omrs-icon-baby","omrs-icon-calendar-heat-map","omrs-icon-calendar","omrs-icon-caret-down","omrs-icon-caret-left","omrs-icon-caret-right","omrs-icon-caret-up","omrs-icon-chart-average","omrs-icon-chart-line","omrs-icon-checkmark-filled","omrs-icon-checkmark-outline","omrs-icon-chemistry","omrs-icon-chevron-down","omrs-icon-chevron-left","omrs-icon-chevron-right","omrs-icon-chevron-up","omrs-icon-close","omrs-icon-close-filled","omrs-icon-close-outline","omrs-icon-document","omrs-icon-document-attachment","omrs-icon-download","omrs-icon-drug-order","omrs-icon-edit","omrs-icon-event-schedule","omrs-icon-events","omrs-icon-gender-female","omrs-icon-gender-male","omrs-icon-gender-other","omrs-icon-gender-unknown","omrs-icon-generic-order-type","omrs-icon-group","omrs-icon-group-access","omrs-icon-hospital-bed","omrs-icon-image-medical","omrs-icon-information","omrs-icon-information-filled","omrs-icon-information-square","omrs-icon-inventory-management","omrs-icon-lab-order","omrs-icon-list-checked","omrs-icon-location","omrs-icon-material-order","omrs-icon-maximize","omrs-icon-medication","omrs-icon-message-queue","omrs-icon-microscope","omrs-icon-mobile-check","omrs-icon-money","omrs-icon-mother","omrs-icon-movement","omrs-icon-overflow-menu--horizontal","omrs-icon-overflow-menu--vertical","omrs-icon-password","omrs-icon-pedestrian-family","omrs-icon-pen","omrs-icon-printer","omrs-icon-procedure-order","omrs-icon-programs","omrs-icon-renew","omrs-icon-referral-order","omrs-icon-report","omrs-icon-reset","omrs-icon-save","omrs-icon-search","omrs-icon-settings","omrs-icon-shopping-cart","omrs-icon-shopping-cart--arrow-down","omrs-icon-sticky-note-add","omrs-icon-switcher","omrs-icon-syringe","omrs-icon-table-of-contents","omrs-icon-table","omrs-icon-time","omrs-icon-tools","omrs-icon-translate","omrs-icon-trash-can","omrs-icon-tree-view--alt","omrs-icon-two-factor-authentication","omrs-icon-user-avatar","omrs-icon-user-follow","omrs-icon-user-xray","omrs-icon-user","omrs-icon-view-off","omrs-icon-view","omrs-icon-warning"],y9=(0,f0.memo)((0,f0.forwardRef)(function(e,t){return(0,hq.jsx)(vN,{ref:t,icon:"omrs-icon-activity",iconProps:e})})),be=(0,f0.memo)((0,f0.forwardRef)(function(e,t){return(0,hq.jsx)(vN,{ref:t,icon:"omrs-icon-add",iconProps:e})})),bt=(0,f0.memo)((0,f0.forwardRef)(function(e,t){return(0,hq.jsx)(vN,{ref:t,icon:"omrs-icon-arrow-down",iconProps:e})})),bn=(0,f0.memo)((0,f0.forwardRef)(function(e,t){return(0,hq.jsx)(vN,{ref:t,icon:"omrs-icon-arrow-left",iconProps:e})})),br=(0,f0.memo)((0,f0.forwardRef)(function(e,t){return(0,hq.jsx)(vN,{ref:t,icon:"omrs-icon-arrow-right",iconProps:e})})),ba=(0,f0.memo)((0,f0.forwardRef)(function(e,t){return(0,hq.jsx)(vN,{ref:t,icon:"omrs-icon-arrow-up",iconProps:e})})),bo=(0,f0.memo)((0,f0.forwardRef)(function(e,t){return(0,hq.jsx)(vN,{ref:t,icon:"omrs-icon-baby",iconProps:e})})),bi=(0,f0.memo)((0,f0.forwardRef)(function(e,t){return(0,hq.jsx)(vN,{ref:t,icon:"omrs-icon-calendar-heat-map",iconProps:e})})),bs=(0,f0.memo)((0,f0.forwardRef)(function(e,t){return(0,hq.jsx)(vN,{ref:t,icon:"omrs-icon-calendar",iconProps:e})})),bl=(0,f0.memo)((0,f0.forwardRef)(function(e,t){return(0,hq.jsx)(vN,{ref:t,icon:"omrs-icon-caret-down",iconProps:e})})),bc=(0,f0.memo)((0,f0.forwardRef)(function(e,t){return(0,hq.jsx)(vN,{ref:t,icon:"omrs-icon-caret-left",iconProps:e})})),bu=(0,f0.memo)((0,f0.forwardRef)(function(e,t){return(0,hq.jsx)(vN,{ref:t,icon:"omrs-icon-caret-right",iconProps:e})})),bd=(0,f0.memo)((0,f0.forwardRef)(function(e,t){return(0,hq.jsx)(vN,{ref:t,icon:"omrs-icon-caret-up",iconProps:e})})),bp=(0,f0.memo)((0,f0.forwardRef)(function(e,t){return(0,hq.jsx)(vN,{ref:t,icon:"omrs-icon-chart-average",iconProps:e})})),bf=(0,f0.memo)((0,f0.forwardRef)(function(e,t){return(0,hq.jsx)(vN,{ref:t,icon:"omrs-icon-chart-line",iconProps:e})})),bm=(0,f0.memo)((0,f0.forwardRef)(function(e,t){return(0,hq.jsx)(vN,{ref:t,icon:"omrs-icon-checkmark-filled",iconProps:e})})),bh=(0,f0.memo)((0,f0.forwardRef)(function(e,t){return(0,hq.jsx)(vN,{ref:t,icon:"omrs-icon-checkmark-outline",iconProps:e})})),bg=(0,f0.memo)((0,f0.forwardRef)(function(e,t){return(0,hq.jsx)(vN,{ref:t,icon:"omrs-icon-chemistry",iconProps:e})})),b_=(0,f0.memo)((0,f0.forwardRef)(function(e,t){return(0,hq.jsx)(vN,{ref:t,icon:"omrs-icon-chevron-down",iconProps:e})})),by=(0,f0.memo)((0,f0.forwardRef)(function(e,t){return(0,hq.jsx)(vN,{ref:t,icon:"omrs-icon-chevron-left",iconProps:e})})),bb=(0,f0.memo)((0,f0.forwardRef)(function(e,t){return(0,hq.jsx)(vN,{ref:t,icon:"omrs-icon-chevron-right",iconProps:e})})),bv=(0,f0.memo)((0,f0.forwardRef)(function(e,t){return(0,hq.jsx)(vN,{ref:t,icon:"omrs-icon-chevron-up",iconProps:e})})),b$=(0,f0.memo)((0,f0.forwardRef)(function(e,t){return(0,hq.jsx)(vN,{ref:t,icon:"omrs-icon-close",iconProps:e})})),bA=(0,f0.memo)((0,f0.forwardRef)(function(e,t){return(0,hq.jsx)(vN,{ref:t,icon:"omrs-icon-close-filled",iconProps:e})})),bw=(0,f0.memo)((0,f0.forwardRef)(function(e,t){return(0,hq.jsx)(vN,{ref:t,icon:"omrs-icon-close-outline",iconProps:e})})),bk=(0,f0.memo)((0,f0.forwardRef)(function(e,t){return(0,hq.jsx)(vN,{ref:t,icon:"omrs-icon-document",iconProps:e})})),bx=(0,f0.memo)((0,f0.forwardRef)(function(e,t){return(0,hq.jsx)(vN,{ref:t,icon:"omrs-icon-document-attachment",iconProps:e})})),bC=(0,f0.memo)((0,f0.forwardRef)(function(e,t){return(0,hq.jsx)(vN,{ref:t,icon:"omrs-icon-download",iconProps:e})})),bE=(0,f0.memo)((0,f0.forwardRef)(function(e,t){return(0,hq.jsx)(vN,{ref:t,icon:"omrs-icon-drug-order",iconProps:e})})),bD=(0,f0.memo)((0,f0.forwardRef)(function(e,t){return(0,hq.jsx)(vN,{ref:t,icon:"omrs-icon-edit",iconProps:e})})),bS=(0,f0.memo)((0,f0.forwardRef)(function(e,t){return(0,hq.jsx)(vN,{ref:t,icon:"omrs-icon-event-schedule",iconProps:e})})),bz=(0,f0.memo)((0,f0.forwardRef)(function(e,t){return(0,hq.jsx)(vN,{ref:t,icon:"omrs-icon-events",iconProps:e})})),bP=(0,f0.memo)((0,f0.forwardRef)(function(e,t){return(0,hq.jsx)(vN,{ref:t,icon:"omrs-icon-gender-female",iconProps:e})})),bM=(0,f0.memo)((0,f0.forwardRef)(function(e,t){return(0,hq.jsx)(vN,{ref:t,icon:"omrs-icon-gender-male",iconProps:e})})),bN=(0,f0.memo)((0,f0.forwardRef)(function(e,t){return(0,hq.jsx)(vN,{ref:t,icon:"omrs-icon-gender-other",iconProps:e})})),bT=(0,f0.memo)((0,f0.forwardRef)(function(e,t){return(0,hq.jsx)(vN,{ref:t,icon:"omrs-icon-gender-unknown",iconProps:e})})),bO=(0,f0.memo)((0,f0.forwardRef)(function(e,t){return(0,hq.jsx)(vN,{ref:t,icon:"omrs-icon-generic-order-type",iconProps:e})})),bI=(0,f0.memo)((0,f0.forwardRef)(function(e,t){return(0,hq.jsx)(vN,{ref:t,icon:"omrs-icon-group",iconProps:e})})),bB=(0,f0.memo)((0,f0.forwardRef)(function(e,t){return(0,hq.jsx)(vN,{ref:t,icon:"omrs-icon-group-access",iconProps:e})})),bR=(0,f0.memo)((0,f0.forwardRef)(function(e,t){return(0,hq.jsx)(vN,{ref:t,icon:"omrs-icon-hospital-bed",iconProps:e})})),bj=(0,f0.memo)((0,f0.forwardRef)(function(e,t){return(0,hq.jsx)(vN,{ref:t,icon:"omrs-icon-image-medical",iconProps:e})})),bF=(0,f0.memo)((0,f0.forwardRef)(function(e,t){return(0,hq.jsx)(vN,{ref:t,icon:"omrs-icon-information",iconProps:e})})),bL=(0,f0.memo)((0,f0.forwardRef)(function(e,t){return(0,hq.jsx)(vN,{ref:t,icon:"omrs-icon-information-filled",iconProps:e})})),bW=(0,f0.memo)((0,f0.forwardRef)(function(e,t){return(0,hq.jsx)(vN,{ref:t,icon:"omrs-icon-information-square",iconProps:e})})),bV=(0,f0.memo)((0,f0.forwardRef)(function(e,t){return(0,hq.jsx)(vN,{ref:t,icon:"omrs-icon-inventory-management",iconProps:e})})),bG=(0,f0.memo)((0,f0.forwardRef)(function(e,t){return(0,hq.jsx)(vN,{ref:t,icon:"omrs-icon-lab-order",iconProps:e})})),bU=(0,f0.memo)((0,f0.forwardRef)(function(e,t){return(0,hq.jsx)(vN,{ref:t,icon:"omrs-icon-list-checked",iconProps:e})})),bH=(0,f0.memo)((0,f0.forwardRef)(function(e,t){return(0,hq.jsx)(vN,{ref:t,icon:"omrs-icon-location",iconProps:e})})),bq=(0,f0.memo)((0,f0.forwardRef)(function(e,t){return(0,hq.jsx)(vN,{ref:t,icon:"omrs-icon-material-order",iconProps:e})})),bK=(0,f0.memo)((0,f0.forwardRef)(function(e,t){return(0,hq.jsx)(vN,{ref:t,icon:"omrs-icon-maximize",iconProps:e})})),bZ=(0,f0.memo)((0,f0.forwardRef)(function(e,t){return(0,hq.jsx)(vN,{ref:t,icon:"omrs-icon-medication",iconProps:e})})),bY=(0,f0.memo)((0,f0.forwardRef)(function(e,t){return(0,hq.jsx)(vN,{ref:t,icon:"omrs-icon-message-queue",iconProps:e})})),bJ=(0,f0.memo)((0,f0.forwardRef)(function(e,t){return(0,hq.jsx)(vN,{ref:t,icon:"omrs-icon-microscope",iconProps:e})})),bX=(0,f0.memo)((0,f0.forwardRef)(function(e,t){return(0,hq.jsx)(vN,{ref:t,icon:"omrs-icon-mobile-check",iconProps:e})})),bQ=(0,f0.memo)((0,f0.forwardRef)(function(e,t){return(0,hq.jsx)(vN,{ref:t,icon:"omrs-icon-money",iconProps:e})})),b0=(0,f0.memo)((0,f0.forwardRef)(function(e,t){return(0,hq.jsx)(vN,{ref:t,icon:"omrs-icon-mother",iconProps:e})})),b1=(0,f0.memo)((0,f0.forwardRef)(function(e,t){return(0,hq.jsx)(vN,{ref:t,icon:"omrs-icon-movement",iconProps:e})})),b2=(0,f0.memo)((0,f0.forwardRef)(function(e,t){return(0,hq.jsx)(vN,{ref:t,icon:"omrs-icon-overflow-menu--horizontal",iconProps:e})})),b3=(0,f0.memo)((0,f0.forwardRef)(function(e,t){return(0,hq.jsx)(vN,{ref:t,icon:"omrs-icon-overflow-menu--horizontal",iconProps:e})})),b4=(0,f0.memo)((0,f0.forwardRef)(function(e,t){return(0,hq.jsx)(vN,{ref:t,icon:"omrs-icon-password",iconProps:e})})),b5=(0,f0.memo)((0,f0.forwardRef)(function(e,t){return(0,hq.jsx)(vN,{ref:t,icon:"omrs-icon-pedestrian-family",iconProps:e})})),b6=(0,f0.memo)((0,f0.forwardRef)(function(e,t){return(0,hq.jsx)(vN,{ref:t,icon:"omrs-icon-pen",iconProps:e})})),b7=(0,f0.memo)((0,f0.forwardRef)(function(e,t){return(0,hq.jsx)(vN,{ref:t,icon:"omrs-icon-printer",iconProps:e})})),b8=(0,f0.memo)((0,f0.forwardRef)(function(e,t){return(0,hq.jsx)(vN,{ref:t,icon:"omrs-icon-procedure-order",iconProps:e})})),b9=(0,f0.memo)((0,f0.forwardRef)(function(e,t){return(0,hq.jsx)(vN,{ref:t,icon:"omrs-icon-programs",iconProps:e})})),ve=(0,f0.memo)((0,f0.forwardRef)(function(e,t){return(0,hq.jsx)(vN,{ref:t,icon:"omrs-icon-referral-order",iconProps:e})})),vt=(0,f0.memo)((0,f0.forwardRef)(function(e,t){return(0,hq.jsx)(vN,{ref:t,icon:"omrs-icon-renew",iconProps:e})})),vn=(0,f0.memo)((0,f0.forwardRef)(function(e,t){return(0,hq.jsx)(vN,{ref:t,icon:"omrs-icon-report",iconProps:e})})),vr=(0,f0.memo)((0,f0.forwardRef)(function(e,t){return(0,hq.jsx)(vN,{ref:t,icon:"omrs-icon-reset",iconProps:e})})),va=(0,f0.memo)((0,f0.forwardRef)(function(e,t){return(0,hq.jsx)(vN,{ref:t,icon:"omrs-icon-save",iconProps:e})})),vo=(0,f0.memo)((0,f0.forwardRef)(function(e,t){return(0,hq.jsx)(vN,{ref:t,icon:"omrs-icon-search",iconProps:e})})),vi=(0,f0.memo)((0,f0.forwardRef)(function(e,t){return(0,hq.jsx)(vN,{ref:t,icon:"omrs-icon-settings",iconProps:e})})),vs=(0,f0.memo)((0,f0.forwardRef)(function(e,t){return(0,hq.jsx)(vN,{ref:t,icon:"omrs-icon-switcher",iconProps:e})})),vl=(0,f0.memo)((0,f0.forwardRef)(function(e,t){return(0,hq.jsx)(vN,{ref:t,icon:"omrs-icon-shopping-cart",iconProps:e})})),vc=(0,f0.memo)((0,f0.forwardRef)(function(e,t){return(0,hq.jsx)(vN,{ref:t,icon:"omrs-icon-shopping-cart--arrow-down",iconProps:e})})),vu=(0,f0.memo)((0,f0.forwardRef)(function(e,t){return(0,hq.jsx)(vN,{ref:t,icon:"omrs-icon-sticky-note-add",iconProps:e})})),vd=(0,f0.memo)((0,f0.forwardRef)(function(e,t){return(0,hq.jsx)(vN,{ref:t,icon:"omrs-icon-syringe",iconProps:e})})),vp=(0,f0.memo)((0,f0.forwardRef)(function(e,t){return(0,hq.jsx)(vN,{ref:t,icon:"omrs-icon-table-of-contents",iconProps:e})})),vf=(0,f0.memo)((0,f0.forwardRef)(function(e,t){return(0,hq.jsx)(vN,{ref:t,icon:"omrs-icon-table",iconProps:e})})),vm=(0,f0.memo)((0,f0.forwardRef)(function(e,t){return(0,hq.jsx)(vN,{ref:t,icon:"omrs-icon-time",iconProps:e})})),vh=(0,f0.memo)((0,f0.forwardRef)(function(e,t){return(0,hq.jsx)(vN,{ref:t,icon:"omrs-icon-tools",iconProps:e})})),vg=(0,f0.memo)((0,f0.forwardRef)(function(e,t){return(0,hq.jsx)(vN,{ref:t,icon:"omrs-icon-translate",iconProps:e})})),v_=(0,f0.memo)((0,f0.forwardRef)(function(e,t){return(0,hq.jsx)(vN,{ref:t,icon:"omrs-icon-trash-can",iconProps:e})})),vy=(0,f0.memo)((0,f0.forwardRef)(function(e,t){return(0,hq.jsx)(vN,{ref:t,icon:"omrs-icon-tree-view--alt",iconProps:e})})),vb=(0,f0.memo)((0,f0.forwardRef)(function(e,t){return(0,hq.jsx)(vN,{ref:t,icon:"omrs-icon-two-factor-authentication",iconProps:e})})),vv=(0,f0.memo)((0,f0.forwardRef)(function(e,t){return(0,hq.jsx)(vN,{ref:t,icon:"omrs-icon-user-avatar",iconProps:e})})),v$=(0,f0.memo)((0,f0.forwardRef)(function(e,t){return(0,hq.jsx)(vN,{ref:t,icon:"omrs-icon-user-follow",iconProps:e})})),vA=(0,f0.memo)((0,f0.forwardRef)(function(e,t){return(0,hq.jsx)(vN,{ref:t,icon:"omrs-icon-user-xray",iconProps:e})})),vw=(0,f0.memo)((0,f0.forwardRef)(function(e,t){return(0,hq.jsx)(vN,{ref:t,icon:"omrs-icon-user",iconProps:e})})),vk=(0,f0.memo)((0,f0.forwardRef)(function(e,t){return(0,hq.jsx)(vN,{ref:t,icon:"omrs-icon-view-off",iconProps:e})})),vx=(0,f0.memo)((0,f0.forwardRef)(function(e,t){return(0,hq.jsx)(vN,{ref:t,icon:"omrs-icon-view",iconProps:e})})),vC=(0,f0.memo)((0,f0.forwardRef)(function(e,t){return(0,hq.jsx)(vN,{ref:t,icon:"omrs-icon-warning",iconProps:e})})),vE=vC,vD=bx,vS=bU,vz=bj,vP=vc,vM=(0,f0.memo)((0,f0.forwardRef)(function({icon:e,fallback:t,...n},r){let a=(0,f0.useRef)(e?document.getElementById(e):void 0);return(0,f0.useEffect)(()=>{let t=document.getElementById("omrs-svgs-container"),n=new MutationObserver(t=>{for(let n of t)"childList"===n.type&&(a.current=e?document.getElementById(e):void 0)});return t&&n.observe(t,{childList:!0}),()=>n.disconnect()},[e]),(0,hq.jsx)(mR,{value:a.current,fallback:t,children:(0,hq.jsx)(vN,{ref:r,icon:e,iconProps:n})})})),vN=(0,f0.memo)((0,f0.forwardRef)(function({icon:e,iconProps:t},n){let{className:r,fill:a,size:o}=Object.assign({},{fill:"currentColor",size:20},t);(o<=0||o>72)&&(console.error(`Invalid size '${o}' specified for ${e}. Defaulting to 20.`),o=20);let i=(0,f0.useRef)(null);return(0,f0.useImperativeHandle)(n,()=>i.current),(0,f0.useEffect)(()=>{i.current&&"currentColor"!==a&&i.current.style.setProperty("--omrs-icon-fill",a)},[]),(0,hq.jsx)("svg",{ref:i,className:hZ()("omrs-icon",y7.icon,r),height:o,width:o,viewBox:"0 0 16 16",children:(0,hq.jsx)("use",{href:`#${e}`})})}));var vT=n(7241),vO={};vO.styleTagTransform=h7(),vO.setAttributes=h3(),vO.insert=h1().bind(null,"head"),vO.domAPI=hQ(),vO.insertStyleElement=h5(),hJ()(vT.A,vO);let vI=vT.A&&vT.A.locals?vT.A.locals:void 0,vB=({path:e,title:t,basePath:n,icon:r})=>{let{t:a}=(0,mb.useTranslation)(),o=(0,y4.useLocation)(),i=(0,f0.useMemo)(()=>{if(!e)return!1;let t=e.startsWith("/")?e.slice(1):e;if(t.startsWith("http"))return t===window.location.href;let n=t.split("/").map(e=>decodeURIComponent(e)),r=(o.pathname??"").split("/").slice(1).map(e=>decodeURIComponent(e));return r.some((e,t)=>n.every((e,n)=>r[t+n]===e))},[o.pathname,e]);return(0,hq.jsx)("div",{children:(0,hq.jsx)(f3,{className:hZ()("cds--side-nav__link",{"active-left-nav-link":i}),to:`${n}/${encodeURIComponent(e)}`,children:(0,hq.jsxs)("span",{className:vI.menu,children:[(0,hq.jsx)(vM,{icon:r,className:vI.icon,size:16}),(0,hq.jsx)("span",{children:a(t)})]})})},e)};function vR(e){return function({basePath:t}){return(0,hq.jsx)(y4.BrowserRouter,{children:(0,hq.jsx)(vB,{basePath:t,...e})})}}function vj(e){let t=(0,f0.useRef)(null),n=(0,f0.useRef)(void 0),r=(0,f0.useCallback)(t=>{if("function"==typeof e){let n=e(t);return()=>{"function"==typeof n?n():e(null)}}if(e)return e.current=t,()=>{e.current=null}},[e]);return(0,f0.useMemo)(()=>({get current(){return t.current},set current(value){t.current=value,n.current&&(n.current(),n.current=void 0),null!=value&&(n.current=r(value))}}),[r])}function vF(e,t){if("function"==typeof e)return e(t);null!=e&&(e.current=t)}function vL(...e){return(...t)=>{for(let n of e)"function"==typeof n&&n(...t)}}let vW="u">typeof document?f1().useLayoutEffect:()=>{};function vV(e){let t=(0,f0.useRef)(null);return vW(()=>{t.current=e},[e]),(0,f0.useCallback)((...e)=>{let n=t.current;return null==n?void 0:n(...e)},[])}let vG={prefix:String(Math.round(1e10*Math.random())),current:0},vU=f1().createContext(vG),vH=f1().createContext(!1),vq=("u">typeof window&&window.document&&window.document.createElement,new WeakMap),vK="function"==typeof f1().useId?function(e){let t=f1().useId(),[n]=(0,f0.useState)(vX()),r=n?"react-aria":`react-aria${vG.prefix}`;return e||`${r}-${t}`}:function(e){let t=(0,f0.useContext)(vU),n=function(e=!1){let t=(0,f0.useContext)(vU),n=(0,f0.useRef)(null);if(null===n.current&&!e){var r,a;let e=null==(a=f1().__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED)||null==(r=a.ReactCurrentOwner)?void 0:r.current;if(e){let n=vq.get(e);null==n?vq.set(e,{id:t.current,state:e.memoizedState}):e.memoizedState!==n.state&&(t.current=n.id,vq.delete(e))}n.current=++t.current}return n.current}(!!e),r=`react-aria${t.prefix}`;return e||`${r}-${n}`};function vZ(){return!1}function vY(){return!0}function vJ(e){return()=>{}}function vX(){return"function"==typeof f1().useSyncExternalStore?f1().useSyncExternalStore(vJ,vZ,vY):(0,f0.useContext)(vH)}let vQ=!!("u">typeof window&&window.document&&window.document.createElement),v0=new Map;function v1(e){let[t,n]=(0,f0.useState)(e),r=(0,f0.useRef)(null),a=vK(t),o=(0,f0.useRef)(null);if(s&&s.register(o,a),vQ){let e=v0.get(a);e&&!e.includes(r)?e.push(r):v0.set(a,[r])}return vW(()=>()=>{s&&s.unregister(o),v0.delete(a)},[a]),(0,f0.useEffect)(()=>{let e=r.current;return e&&n(e),()=>{e&&(r.current=null)}}),a}function v2(e=[]){let t=v1(),[n,r]=function(e){let[t,n]=(0,f0.useState)(e),r=(0,f0.useRef)(null),a=vV(()=>{if(!r.current)return;let e=r.current.next();if(e.done){r.current=null;return}t===e.value?a():n(e.value)});vW(()=>{r.current&&a()});let o=vV(e=>{r.current=e(t),a()});return[t,o]}(t),a=(0,f0.useCallback)(()=>{r(function*(){yield t,yield document.getElementById(t)?t:void 0})},[t,r]);return vW(a,[t,a,...e]),n}"u">typeof FinalizationRegistry&&(s=new FinalizationRegistry(e=>{v0.delete(e)}));let v3=function(){for(var e,t,n=0,r="",a=arguments.length;n<a;n++)(e=arguments[n])&&(t=function e(t){var n,r,a="";if("string"==typeof t||"number"==typeof t)a+=t;else if("object"==typeof t)if(Array.isArray(t)){var o=t.length;for(n=0;n<o;n++)t[n]&&(r=e(t[n]))&&(a&&(a+=" "),a+=r)}else for(r in t)t[r]&&(a&&(a+=" "),a+=r);return a}(e))&&(r&&(r+=" "),r+=t);return r};function v4(...e){let t={...e[0]};for(let n=1;n<e.length;n++){let r=e[n];for(let e in r){let n=t[e],a=r[e];"function"==typeof n&&"function"==typeof a&&"o"===e[0]&&"n"===e[1]&&e.charCodeAt(2)>=65&&90>=e.charCodeAt(2)?t[e]=vL(n,a):("className"===e||"UNSAFE_className"===e)&&"string"==typeof n&&"string"==typeof a?t[e]=v3(n,a):"id"===e&&n&&a?t.id=function(e,t){if(e===t)return e;let n=v0.get(e);if(n)return n.forEach(e=>e.current=t),t;let r=v0.get(t);return r?(r.forEach(t=>t.current=e),e):t}(n,a):t[e]=void 0!==a?a:n}}return t}let v5=Symbol("default");function v6({values:e,children:t}){for(let[n,r]of e)t=f1().createElement(n.Provider,{value:r},t);return t}function v7(e){let{className:t,style:n,children:r,defaultClassName:a,defaultChildren:o,defaultStyle:i,values:s}=e;return(0,f0.useMemo)(()=>{let e,l,c;return e="function"==typeof t?t({...s,defaultClassName:a}):t,l="function"==typeof n?n({...s,defaultStyle:i||{}}):n,c="function"==typeof r?r({...s,defaultChildren:o}):null==r?o:r,{className:null!=e?e:a,style:l||i?{...i,...l}:void 0,children:null!=c?c:o,"data-rac":""}},[t,n,r,a,o,i,s])}function v8(e,t){let n=(0,f0.useContext)(e);if(null===t)return null;if(n&&"object"==typeof n&&"slots"in n&&n.slots){let e=t||v5;if(!n.slots[e]){let e=new Intl.ListFormat().format(Object.keys(n.slots).map(e=>`"${e}"`)),r=t?`Invalid slot "${t}".`:"A slot prop is required.";throw Error(`${r} Valid slot names are ${e}.`)}return n.slots[e]}return n}function v9(e,t,n){let{ref:r,...a}=v8(n,e.slot)||{},o=vj((0,f0.useMemo)(()=>(function(...e){return 1===e.length&&e[0]?e[0]:t=>{let n=!1,r=e.map(e=>{let r=vF(e,t);return n||(n="function"==typeof r),r});if(n)return()=>{r.forEach((t,n)=>{"function"==typeof t?t():vF(e[n],null)})}}})(t,r),[t,r])),i=v4(a,e);return"style"in a&&a.style&&"style"in e&&e.style&&("function"==typeof a.style||"function"==typeof e.style?i.style=t=>{let n="function"==typeof a.style?a.style(t):a.style,r={...t.defaultStyle,...n},o="function"==typeof e.style?e.style({...t,defaultStyle:r}):e.style;return{...r,...o}}:i.style={...a.style,...e.style}),[i,o]}function $e(e=!0){let[t,n]=(0,f0.useState)(e),r=(0,f0.useRef)(!1),a=(0,f0.useCallback)(e=>{r.current=!0,n(!!e)},[]);return vW(()=>{r.current||n(!1)},[]),[a,t]}function $t(e){let t=/^(data-.*)$/,n={};for(let r in e)t.test(r)||(n[r]=e[r]);return n}let $n=(0,f0.createContext)(null),$r=null;function $a(e,t="assertive",n=7e3){$r?$r.announce(e,t,n):($r=new $o,("boolean"==typeof IS_REACT_ACT_ENVIRONMENT?IS_REACT_ACT_ENVIRONMENT:"u">typeof jest)?$r.announce(e,t,n):setTimeout(()=>{(null==$r?void 0:$r.isAttached())&&(null==$r||$r.announce(e,t,n))},100))}class $o{isAttached(){var e;return null==(e=this.node)?void 0:e.isConnected}createLog(e){let t=document.createElement("div");return t.setAttribute("role","log"),t.setAttribute("aria-live",e),t.setAttribute("aria-relevant","additions"),t}destroy(){this.node&&(document.body.removeChild(this.node),this.node=null)}announce(e,t="assertive",n=7e3){var r,a;if(!this.node)return;let o=document.createElement("div");"object"==typeof e?(o.setAttribute("role","img"),o.setAttribute("aria-labelledby",e["aria-labelledby"])):o.textContent=e,"assertive"===t?null==(r=this.assertiveLog)||r.appendChild(o):null==(a=this.politeLog)||a.appendChild(o),""!==e&&setTimeout(()=>{o.remove()},n)}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 $i=new Set(["id"]),$s=new Set(["aria-label","aria-labelledby","aria-describedby","aria-details"]),$l=new Set(["href","hrefLang","target","rel","download","ping","referrerPolicy"]),$c=/^(data-.*)$/;function $u(e,t={}){let{labelable:n,isLink:r,propNames:a}=t,o={};for(let t in e)Object.prototype.hasOwnProperty.call(e,t)&&($i.has(t)||n&&$s.has(t)||r&&$l.has(t)||(null==a?void 0:a.has(t))||$c.test(t))&&(o[t]=e[t]);return o}let $d=["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"])'],$p=$d.join(":not([hidden]),")+",[tabindex]:not([disabled]):not([hidden])";$d.push('[tabindex]:not([tabindex="-1"]):not([disabled])');let $f=$d.join(':not([hidden]):not([tabindex="-1"]),');function $m(e){return e.matches($p)}function $h(e){return e.matches($f)}let $g=e=>{var t;return null!=(t=null==e?void 0:e.ownerDocument)?t:document},$_=e=>e&&"window"in e&&e.window===e?e:$g(e).defaultView||window;function $y(e){if(function(){if(null==$b){$b=!1;try{document.createElement("div").focus({get preventScroll(){return $b=!0,!0}})}catch{}}return $b}())e.focus({preventScroll:!0});else{let t=function(e){let t=e.parentNode,n=[],r=document.scrollingElement||document.documentElement;for(;t instanceof HTMLElement&&t!==r;)(t.offsetHeight<t.scrollHeight||t.offsetWidth<t.scrollWidth)&&n.push({element:t,scrollTop:t.scrollTop,scrollLeft:t.scrollLeft}),t=t.parentNode;return r instanceof HTMLElement&&n.push({element:r,scrollTop:r.scrollTop,scrollLeft:r.scrollLeft}),n}(e);e.focus(),function(e){for(let{element:t,scrollTop:n,scrollLeft:r}of e)t.scrollTop=n,t.scrollLeft=r}(t)}}let $b=null;function $v(e){return e.nativeEvent=e,e.isDefaultPrevented=()=>e.defaultPrevented,e.isPropagationStopped=()=>e.cancelBubble,e.persist=()=>{},e}function $$(e,t){Object.defineProperty(e,"target",{value:t}),Object.defineProperty(e,"currentTarget",{value:t})}function $A(e){let t=(0,f0.useRef)({isFocused:!1,observer:null});vW(()=>{let e=t.current;return()=>{e.observer&&(e.observer.disconnect(),e.observer=null)}},[]);let n=vV(t=>{null==e||e(t)});return(0,f0.useCallback)(e=>{if(e.target instanceof HTMLButtonElement||e.target instanceof HTMLInputElement||e.target instanceof HTMLTextAreaElement||e.target instanceof HTMLSelectElement){t.current.isFocused=!0;let r=e.target;r.addEventListener("focusout",e=>{t.current.isFocused=!1,r.disabled&&n($v(e)),t.current.observer&&(t.current.observer.disconnect(),t.current.observer=null)},{once:!0}),t.current.observer=new MutationObserver(()=>{if(t.current.isFocused&&r.disabled){var e;null==(e=t.current.observer)||e.disconnect();let n=r===document.activeElement?null:document.activeElement;r.dispatchEvent(new FocusEvent("blur",{relatedTarget:n})),r.dispatchEvent(new FocusEvent("focusout",{bubbles:!0,relatedTarget:n}))}}),t.current.observer.observe(r,{attributes:!0,attributeFilter:["disabled"]})}},[n])}let $w=!1;function $k(e){var t;return!("u"<typeof window)&&null!=window.navigator&&((null==(t=window.navigator.userAgentData)?void 0:t.brands.some(t=>e.test(t.brand)))||e.test(window.navigator.userAgent))}function $x(e){var t;return"u">typeof window&&null!=window.navigator&&e.test((null==(t=window.navigator.userAgentData)?void 0:t.platform)||window.navigator.platform)}function $C(e){let t=null;return()=>(null==t&&(t=e()),t)}let $E=$C(function(){return $x(/^Mac/i)}),$D=$C(function(){return $x(/^iPhone/i)}),$S=$C(function(){return $x(/^iPad/i)||$E()&&navigator.maxTouchPoints>1}),$z=$C(function(){return $D()||$S()});$C(function(){return $E()||$z()});let $P=$C(function(){return $k(/AppleWebKit/i)&&!$M()}),$M=$C(function(){return $k(/Chrome/i)}),$N=$C(function(){return $k(/Android/i)}),$T=$C(function(){return $k(/Firefox/i)}),$O=new Map,$I=new Set;function $B(){if("u"<typeof window)return;function e(e){return"propertyName"in e}let t=n=>{if(!e(n)||!n.target)return;let r=$O.get(n.target);if(r&&(r.delete(n.propertyName),0===r.size&&(n.target.removeEventListener("transitioncancel",t),$O.delete(n.target)),0===$O.size)){for(let e of $I)e();$I.clear()}};document.body.addEventListener("transitionrun",n=>{if(!e(n)||!n.target)return;let r=$O.get(n.target);r||(r=new Set,$O.set(n.target,r),n.target.addEventListener("transitioncancel",t,{once:!0})),r.add(n.propertyName)}),document.body.addEventListener("transitionend",t)}function $R(e){requestAnimationFrame(()=>{for(let[e]of $O)"isConnected"in e&&!e.isConnected&&$O.delete(e);0===$O.size?e():$I.add(e)})}"u">typeof document&&("loading"!==document.readyState?$B():document.addEventListener("DOMContentLoaded",$B));let $j="default",$F="",$L=new WeakMap;function $W(e){if($z())"disabled"===$j&&($j="restoring",setTimeout(()=>{$R(()=>{if("restoring"===$j){let t=$g(e);"none"===t.documentElement.style.webkitUserSelect&&(t.documentElement.style.webkitUserSelect=$F||""),$F="",$j="default"}})},300));else if((e instanceof HTMLElement||e instanceof SVGElement)&&e&&$L.has(e)){let t=$L.get(e),n="userSelect"in e.style?"userSelect":"webkitUserSelect";"none"===e.style[n]&&(e.style[n]=t),""===e.getAttribute("style")&&e.removeAttribute("style"),$L.delete(e)}}let $V=f1().createContext({register:()=>{}});function $G(e,t,n){if(!t.has(e))throw TypeError("attempted to "+n+" private field on non-instance");return t.get(e)}function $U(e,t,n){var r=$G(e,t,"set");if(r.set)r.set.call(e,n);else{if(!r.writable)throw TypeError("attempted to set read only private field");r.value=n}return n}function $H(e,t){vW(()=>{if(e&&e.ref&&t)return e.ref.current=t.current,()=>{e.ref&&(e.ref.current=null)}})}function $q(){let e=(0,f0.useRef)(new Map),t=(0,f0.useCallback)((t,n,r,a)=>{let o=(null==a?void 0:a.once)?(...t)=>{e.current.delete(r),r(...t)}:r;e.current.set(r,{type:n,eventTarget:t,fn:o,options:a}),t.addEventListener(n,o,a)},[]),n=(0,f0.useCallback)((t,n,r,a)=>{var o;let i=(null==(o=e.current.get(r))?void 0:o.fn)||r;t.removeEventListener(n,i,a),e.current.delete(r)},[]),r=(0,f0.useCallback)(()=>{e.current.forEach((e,t)=>{n(e.eventTarget,e.type,t,e.options)})},[n]);return(0,f0.useEffect)(()=>r,[r]),{addGlobalListener:t,removeGlobalListener:n,removeAllGlobalListeners:r}}$V.displayName="PressResponderContext";function $K(e,t){return!!t&&!!e&&e.contains(t)}function $Z(e){return e.target}function $Y(e,t,n=!0){var r,a;let{metaKey:o,ctrlKey:i,altKey:s,shiftKey:l}=t;$T()&&(null==(a=window.event)||null==(r=a.type)?void 0:r.startsWith("key"))&&"_blank"===e.target&&($E()?o=!0:i=!0);let c=$P()&&$E()&&!$S()&&1?new KeyboardEvent("keydown",{keyIdentifier:"Enter",metaKey:o,ctrlKey:i,altKey:s,shiftKey:l}):new MouseEvent("click",{metaKey:o,ctrlKey:i,altKey:s,shiftKey:l,bubbles:!0,cancelable:!0});$Y.isOpening=n,$y(e),e.dispatchEvent(c),$Y.isOpening=!1}function $J(e){return 0===e.mozInputSource&&!!e.isTrusted||($N()&&e.pointerType?"click"===e.type&&1===e.buttons:0===e.detail&&!e.pointerType)}$Y.isOpening=!1;var $X=n(3144),$Q=new WeakMap;class $0{continuePropagation(){$U(this,$Q,!1)}get shouldStopPropagation(){var e;return e=$G(this,$Q,"get"),e.get?e.get.call(this):e.value}constructor(e,t,n,r){var a;!function(e,t,n){if(t.has(e))throw TypeError("Cannot initialize the same private elements twice on an object");t.set(e,n)}(this,$Q,{writable:!0,value:void 0}),$U(this,$Q,!0);let o=null!=(a=null==r?void 0:r.target)?a:n.currentTarget;const i=null==o?void 0:o.getBoundingClientRect();let s,l=0,c,u=null;null!=n.clientX&&null!=n.clientY&&(c=n.clientX,u=n.clientY),i&&(null!=c&&null!=u?(s=c-i.left,l=u-i.top):(s=i.width/2,l=i.height/2)),this.type=e,this.pointerType=t,this.target=n.currentTarget,this.shiftKey=n.shiftKey,this.metaKey=n.metaKey,this.ctrlKey=n.ctrlKey,this.altKey=n.altKey,this.x=s,this.y=l}}let $1=Symbol("linkClicked"),$2="react-aria-pressable-style",$3="data-react-aria-pressable";function $4(e){let{onPress:t,onPressChange:n,onPressStart:r,onPressEnd:a,onPressUp:o,onClick:i,isDisabled:s,isPressed:l,preventFocusOnPress:c,shouldCancelOnPointerExit:u,allowTextSelectionOnPress:d,ref:p,...f}=function(e){let t=(0,f0.useContext)($V);if(t){let{register:n,...r}=t;e=v4(r,e),n()}return $H(t,e.ref),e}(e),[m,h]=(0,f0.useState)(!1),g=(0,f0.useRef)({isPressed:!1,ignoreEmulatedMouseEvents:!1,didFirePressStart:!1,isTriggeringEvent:!1,activePointerId:null,target:null,isOverTarget:!1,pointerType:null,disposables:[]}),{addGlobalListener:y,removeAllGlobalListeners:b}=$q(),v=vV((e,t)=>{let a=g.current;if(s||a.didFirePressStart)return!1;let o=!0;if(a.isTriggeringEvent=!0,r){let n=new $0("pressstart",t,e);r(n),o=n.shouldStopPropagation}return n&&n(!0),a.isTriggeringEvent=!1,a.didFirePressStart=!0,h(!0),o}),$=vV((e,r,o=!0)=>{let i=g.current;if(!i.didFirePressStart)return!1;i.didFirePressStart=!1,i.isTriggeringEvent=!0;let l=!0;if(a){let t=new $0("pressend",r,e);a(t),l=t.shouldStopPropagation}if(n&&n(!1),h(!1),t&&o&&!s){let n=new $0("press",r,e);t(n),l&&(l=n.shouldStopPropagation)}return i.isTriggeringEvent=!1,l}),A=vV((e,t)=>{let n=g.current;if(s)return!1;if(o){n.isTriggeringEvent=!0;let r=new $0("pressup",t,e);return o(r),n.isTriggeringEvent=!1,r.shouldStopPropagation}return!0}),w=vV(e=>{let t=g.current;if(t.isPressed&&t.target){for(let n of(t.didFirePressStart&&null!=t.pointerType&&$($7(t.target,e),t.pointerType,!1),t.isPressed=!1,t.isOverTarget=!1,t.activePointerId=null,t.pointerType=null,b(),d||$W(t.target),t.disposables))n();t.disposables=[]}}),k=vV(e=>{u&&w(e)}),x=vV(e=>{null==i||i(e)}),C=vV((e,t)=>{if(i){let n=new MouseEvent("click",e);$$(n,t),i($v(n))}}),E=(0,f0.useMemo)(()=>{let e=g.current,t={onKeyDown(t){if($6(t.nativeEvent,t.currentTarget)&&$K(t.currentTarget,$Z(t.nativeEvent))){var r;$8($Z(t.nativeEvent),t.key)&&t.preventDefault();let a=!0;if(!e.isPressed&&!t.repeat){e.target=t.currentTarget,e.isPressed=!0,e.pointerType="keyboard",a=v(t,"keyboard");let r=t.currentTarget;y($g(t.currentTarget),"keyup",vL(t=>{$6(t,r)&&!t.repeat&&$K(r,$Z(t))&&e.target&&A($7(e.target,t),"keyboard")},n),!0)}a&&t.stopPropagation(),t.metaKey&&$E()&&(null==(r=e.metaKeyEvents)||r.set(t.key,t.nativeEvent))}else"Meta"===t.key&&(e.metaKeyEvents=new Map)},onClick(t){if((!t||$K(t.currentTarget,$Z(t.nativeEvent)))&&t&&0===t.button&&!e.isTriggeringEvent&&!$Y.isOpening){let n=!0;if(s&&t.preventDefault(),!e.ignoreEmulatedMouseEvents&&!e.isPressed&&("virtual"===e.pointerType||$J(t.nativeEvent))){let e=v(t,"virtual"),r=A(t,"virtual"),a=$(t,"virtual");x(t),n=e&&r&&a}else if(e.isPressed&&"keyboard"!==e.pointerType){let r=e.pointerType||t.nativeEvent.pointerType||"virtual";n=$($7(t.currentTarget,t),r,!0),e.isOverTarget=!1,x(t),w(t)}e.ignoreEmulatedMouseEvents=!1,n&&t.stopPropagation()}}},n=t=>{var n,r,a;if(e.isPressed&&e.target&&$6(t,e.target)){$8($Z(t),t.key)&&t.preventDefault();let n=$Z(t),a=$K(e.target,$Z(t));$($7(e.target,t),"keyboard",a),a&&C(t,e.target),b(),"Enter"!==t.key&&$5(e.target)&&$K(e.target,n)&&!t[$1]&&(t[$1]=!0,$Y(e.target,t,!1)),e.isPressed=!1,null==(r=e.metaKeyEvents)||r.delete(t.key)}else if("Meta"===t.key&&(null==(n=e.metaKeyEvents)?void 0:n.size)){let t=e.metaKeyEvents;for(let n of(e.metaKeyEvents=void 0,t.values()))null==(a=e.target)||a.dispatchEvent(new KeyboardEvent("keyup",n))}};if("u">typeof PointerEvent){t.onPointerDown=t=>{var a;if(0!==t.button||!$K(t.currentTarget,$Z(t.nativeEvent)))return;if(a=t.nativeEvent,!$N()&&0===a.width&&0===a.height||1===a.width&&1===a.height&&0===a.pressure&&0===a.detail&&"mouse"===a.pointerType){e.pointerType="virtual";return}e.pointerType=t.pointerType;let o=!0;if(!e.isPressed){e.isPressed=!0,e.isOverTarget=!0,e.activePointerId=t.pointerId,e.target=t.currentTarget,d||function(e){if($z()){if("default"===$j){let t=$g(e);$F=t.documentElement.style.webkitUserSelect,t.documentElement.style.webkitUserSelect="none"}$j="disabled"}else if(e instanceof HTMLElement||e instanceof SVGElement){let t="userSelect"in e.style?"userSelect":"webkitUserSelect";$L.set(e,e.style[t]),e.style[t]="none"}}(e.target),o=v(t,e.pointerType);let a=$Z(t.nativeEvent);"releasePointerCapture"in a&&a.releasePointerCapture(t.pointerId),y($g(t.currentTarget),"pointerup",n,!1),y($g(t.currentTarget),"pointercancel",r,!1)}o&&t.stopPropagation()},t.onMouseDown=t=>{if($K(t.currentTarget,$Z(t.nativeEvent))&&0===t.button){if(c){let n=function(e){for(;e&&!$m(e);)e=e.parentElement;let t=$_(e),n=t.document.activeElement;if(!n||n===e)return;$w=!0;let r=!1,a=e=>{(e.target===n||r)&&e.stopImmediatePropagation()},o=t=>{(t.target===n||r)&&(t.stopImmediatePropagation(),e||r||(r=!0,$y(n),l()))},i=t=>{(t.target===e||r)&&t.stopImmediatePropagation()},s=t=>{(t.target===e||r)&&(t.stopImmediatePropagation(),r||(r=!0,$y(n),l()))};t.addEventListener("blur",a,!0),t.addEventListener("focusout",o,!0),t.addEventListener("focusin",s,!0),t.addEventListener("focus",i,!0);let l=()=>{cancelAnimationFrame(c),t.removeEventListener("blur",a,!0),t.removeEventListener("focusout",o,!0),t.removeEventListener("focusin",s,!0),t.removeEventListener("focus",i,!0),$w=!1,r=!1},c=requestAnimationFrame(l);return l}(t.target);n&&e.disposables.push(n)}t.stopPropagation()}},t.onPointerUp=t=>{$K(t.currentTarget,$Z(t.nativeEvent))&&"virtual"!==e.pointerType&&0===t.button&&A(t,e.pointerType||t.pointerType)},t.onPointerEnter=t=>{t.pointerId===e.activePointerId&&e.target&&!e.isOverTarget&&null!=e.pointerType&&(e.isOverTarget=!0,v($7(e.target,t),e.pointerType))},t.onPointerLeave=t=>{t.pointerId===e.activePointerId&&e.target&&e.isOverTarget&&null!=e.pointerType&&(e.isOverTarget=!1,$($7(e.target,t),e.pointerType,!1),k(t))};let n=t=>{if(t.pointerId===e.activePointerId&&e.isPressed&&0===t.button&&e.target){if($K(e.target,$Z(t))&&null!=e.pointerType){let n=!1,r=setTimeout(()=>{e.isPressed&&e.target instanceof HTMLElement&&(n?w(t):($y(e.target),e.target.click()))},80);y(t.currentTarget,"click",()=>n=!0,!0),e.disposables.push(()=>clearTimeout(r))}else w(t);e.isOverTarget=!1}},r=e=>{w(e)};t.onDragStart=e=>{$K(e.currentTarget,$Z(e.nativeEvent))&&w(e)}}return t},[y,s,c,b,d,w,k,$,v,A,x,C]);return(0,f0.useEffect)(()=>{if(!p)return;let e=$g(p.current);if(!e||!e.head||e.getElementById($2))return;let t=e.createElement("style");t.id=$2,t.textContent=`
37
+ `,_m="u">typeof Node?Node.DOCUMENT_POSITION_PRECEDING|Node.DOCUMENT_POSITION_CONTAINS:0,_h="u">typeof Node?Node.DOCUMENT_POSITION_FOLLOWING|Node.DOCUMENT_POSITION_CONTAINED_BY:0,_g=(e,t=[])=>e instanceof Element&&"function"==typeof e.closest&&[".cds--overflow-menu-options",".cds--tooltip",".flatpickr-calendar",...t].some(t=>!!e.closest(t)),__=({bodyNode:e,startTrapNode:t,endTrapNode:n,currentActiveNode:r,oldActiveNode:a,selectorsFloatingMenus:o})=>{if(e&&r&&a&&!e.contains(r)&&!_g(r,o)){let o=a.compareDocumentPosition(r);if(r===t||o&_m){let t=Array.from(e.querySelectorAll(_f)).reverse().find(({offsetParent:e})=>!!e);t?t.focus():e!==a&&e.focus()}else if(r===n||o&_h){let t=Array.from(e.querySelectorAll(_f)).find(({offsetParent:e})=>!!e);t?t.focus():e!==a&&e.focus()}}},_y=({containerNode:e,currentActiveNode:t,event:n})=>{if(!e)return;["blur","focusout","focusin","focus"].includes(n.type);let r=(0,_p.Kr)(e),a=r[0],o=r[r.length-1];t!==o||n.shiftKey||(n.preventDefault(),a.focus()),t===a&&n.shiftKey&&(n.preventDefault(),o.focus())},_b=e=>(t,...n)=>{for(let r of e){if(t.defaultPrevented)break;"function"==typeof r&&r(t,...n)}},_v=(0,f0.createContext)({direction:"auto",getTextDirection:{current:void 0}}),_$=f1().forwardRef(({as:e,children:t,dir:n="auto",...r},a)=>{let o=(0,f0.useContext)(_v),i={},s={...o};if(o){let{direction:e,getTextDirection:r}=o;if(r&&r.current){let n=_A(t),a=r.current(n);e!==a?(i.dir=a,s.direction=a):"auto"===e&&(i.dir=a)}else e!==n?(i.dir=n,s.direction=n):"auto"===e&&(i.dir=n)}else i.dir=n,s.direction=n;return f1().createElement(_v.Provider,{value:s},f1().createElement(e??"span",gi({ref:a},r,i),t))});_$.propTypes={as:gl().oneOfType([gl().func,gl().string,gl().elementType]),children:gl().node,dir:gl().oneOf(["ltr","rtl","auto"])};let _A=e=>{if("string"==typeof e)return e;let t=f0.Children.map(e,e=>"string"==typeof e?e:null)?.filter(e=>null!==e);return t?.length===1?t[0]:t},_w=(0,f0.createContext)({}),_k=f1().forwardRef(({children:e,className:t,focusAfterCloseRef:n,modal:r,onCancel:a=_a,onClick:o=_a,onClose:i=_a,onRequestClose:s=_a,open:l=!1,role:c,ariaLabel:u,ariaLabelledBy:d,ariaDescribedBy:p,...f},m)=>{let h=gm(),g=gG(),y=`${h}--dialog-header__heading--${g}`,b=`${h}--dialog-header__label--${g}`,v=(0,f0.useRef)(null),$=m??v;(0,f0.useEffect)(()=>{$.current&&(l?r?$.current.showModal():$.current.show():$.current.close())},[r,l]),(0,f0.useEffect)(()=>{if(!l&&n){let e=setTimeout(()=>{n.current?.focus()});return()=>{clearTimeout(e)}}},[l,n]);let A=hZ()(`${h}--dialog-container`);return(0,f0.useEffect)(()=>{if($.current&&l&&!u&&!d){let e=$.current.querySelector(`.${h}--dialog-header__heading`);e&&e.id&&$.current.setAttribute("aria-labelledby",e.id)}},[l,u,d,h]),f1().createElement(_w.Provider,{value:{dialogId:g,titleId:y,subtitleId:b,isOpen:l}},f1().createElement("dialog",gi({},f,{className:hZ()(`${h}--dialog`,{[`${h}--dialog--modal`]:r},t),ref:$,onCancel:a,onClick:function(e){l&&r&&e.target===$.current&&s(e),o(e)},onClose:i,role:c,"aria-label":u,"aria-labelledby":u?void 0:d||y,"aria-describedby":p}),f1().createElement("div",{className:A},e)))});_k.displayName="Dialog",_k.propTypes={children:gl().node,className:gl().string,focusAfterCloseRef:gl().oneOfType([gl().func,gl().shape({current:gl().any})]),modal:gl().bool,onRequestClose:gl().func,open:gl().bool,role:gl().oneOf(["dialog","alertdialog"]),"aria-label":gl().string,"aria-labelledby":gl().string,ariaDescribedBy:gl().string};let _x=f1().forwardRef(({children:e,...t},n)=>{let r=gm();return f1().createElement("div",gi({className:`${r}--dialog__header`,ref:n},t),e)});_x.displayName="DialogHeader",_x.propTypes={children:gl().node};let _C=f1().forwardRef(({children:e,...t},n)=>{let r=gm();return f1().createElement("div",gi({className:`${r}--dialog__header-controls`,ref:n},t),e)});_C.displayName="DialogControls",_C.propTypes={children:gl().node};let _E=f1().forwardRef(({onClick:e,...t},n)=>{let r=gm();return f1().createElement(g1,gi({kind:"ghost",className:`${r}--dialog__close`,label:"Close",title:"Close","aria-label":"Close",align:"left",onClick:e,ref:n},t),f1().createElement(_t.bm,{size:20,"aria-hidden":"true",tabIndex:-1,className:`${r}--icon__close`}))});_E.displayName="DialogCloseButton",_E.propTypes={onClick:gl().func};let _D=f1().forwardRef(({children:e,className:t,id:n,...r},a)=>{let o=gm(),{titleId:i}=(0,f0.useContext)(_w);return f1().createElement(_$,gi({as:"h2",id:n||i,className:hZ()(`${o}--dialog-header__heading`,t),ref:a},r),e)});_D.displayName="DialogTitle",_D.propTypes={children:gl().node,className:gl().string,id:gl().string};let _S=f1().forwardRef(({children:e,className:t,id:n,...r},a)=>{let o=gm(),{subtitleId:i}=(0,f0.useContext)(_w);return f1().createElement(_$,gi({as:"h2",id:n||i,className:hZ()(`${o}--dialog-header__label`,t),ref:a},r),e)});_S.displayName="DialogSubtitle",_S.propTypes={children:gl().node,className:gl().string,id:gl().string};let _z=f1().forwardRef(({children:e,className:t,hasScrollingContent:n,...r},a)=>{let o=gm(),i=(0,f0.useRef)(null),[s,l]=(0,f0.useState)(!1),c=gG(),u=`${o}--dialog-body--${c}`;gd(()=>{i.current&&l(i.current.scrollHeight>i.current.clientHeight);let e=function(e,t=0,n={}){let r;"object"!=typeof n&&(n={});let{signal:a,leading:o=!1,trailing:i=!0,maxWait:s}=n,l=[,,];o&&(l[0]="leading"),i&&(l[1]="trailing");let c=null,u=function(e,t,{signal:n,edges:r}={}){let a,o=null,i=null!=r&&r.includes("leading"),s=null==r||r.includes("trailing"),l=()=>{null!==o&&(e.apply(a,o),a=void 0,o=null)},c=null,u=()=>{null!=c&&clearTimeout(c),c=setTimeout(()=>{c=null,s&&l(),p()},t)},d=()=>{null!==c&&(clearTimeout(c),c=null)},p=()=>{d(),a=void 0,o=null},f=function(...e){if(n?.aborted)return;a=this,o=e;let t=null==c;u(),i&&t&&l()};return f.schedule=u,f.cancel=p,f.flush=()=>{d(),l()},n?.addEventListener("abort",p,{once:!0}),f}(function(...t){r=e.apply(this,t),c=null},t,{signal:a,edges:l}),d=function(...t){if(null!=s){if(null===c)c=Date.now();else if(Date.now()-c>=s)return r=e.apply(this,t),c=Date.now(),u.cancel(),u.schedule(),r}return u.apply(this,t),r};return d.cancel=u.cancel,d.flush=()=>(u.flush(),r),d}(function(){i.current&&l(i.current.scrollHeight>i.current.clientHeight)},200);return window.addEventListener("resize",e),()=>{e.cancel(),window.removeEventListener("resize",e)}},[]);let d=hZ()(`${o}--dialog-content`,{[`${o}--dialog-scroll-content`]:n||s},t),p=n||s?{tabIndex:0,role:"region"}:{};return f1().createElement(_e,gi({ref:e=>{"function"==typeof a?a(e):a&&(a.current=e),i.current=e},id:u,className:d},p,r),e)});_z.displayName="DialogBody",_z.propTypes={children:gl().node,className:gl().string,hasScrollingContent:gl().bool};let _P=f1().forwardRef(({children:e,className:t,onRequestClose:n=_a,onSecondarySubmit:r,onRequestSubmit:a=_a,primaryButtonText:o="Save",primaryButtonDisabled:i=!1,secondaryButtonText:s="Cancel",secondaryButtons:l,loadingStatus:c="inactive",loadingDescription:u,loadingIconDescription:d,onLoadingSuccess:p=_a,danger:f=!1,...m},h)=>{let g=gm(),y=(0,f0.useRef)(null),{isOpen:b}=(0,f0.useContext)(_w),[v,$]=(0,f0.useState)(null);(0,f0.useEffect)(()=>{if(f&&v){let e=requestAnimationFrame(()=>{v.focus()});return()=>cancelAnimationFrame(e)}},[f,v,b]);let A=hZ()(`${g}--dialog-footer`,t,{[`${g}--dialog-footer--three-button`]:Array.isArray(l)&&2===l.length}),w="inactive"!==c,k=hZ()({[`${g}--btn--loading`]:"inactive"!==c});return e?f1().createElement(_r,gi({className:A,ref:h},m),e):f1().createElement(_r,gi({className:A,"aria-busy":w,ref:h},m),Array.isArray(l)&&l.length<=2?l.map(({buttonText:e,onClick:t},n)=>f1().createElement(g3,{key:`${e}-${n}`,autoFocus:f,kind:"secondary",ref:0===n&&f?$:void 0,onClick:t},e)):s&&f1().createElement(g3,{ref:f?$:void 0,disabled:w,kind:"secondary",autoFocus:f,onClick:r||n},s),f1().createElement(g3,{className:k,kind:f?"danger":"primary",disabled:w||i,onClick:a,ref:y},"inactive"===c?o:f1().createElement(_s,{status:c,description:u,iconDescription:d,className:`${g}--inline-loading--btn`,onSuccess:p})))});_P.displayName="DialogFooter",_P.propTypes={children:gl().node,className:gl().string,onRequestClose:gl().func,onSecondarySubmit:gl().func,onRequestSubmit:gl().func,primaryButtonText:gl().node,primaryButtonDisabled:gl().bool,secondaryButtonText:gl().node,secondaryButtons:(e,t,n)=>{if(e.secondaryButtons){if(!Array.isArray(e.secondaryButtons)||2!==e.secondaryButtons.length)return Error(`${t} needs to be an array of two button config objects`);let r={buttonText:gl().node,onClick:gl().func};e[t].forEach(e=>{gl().checkPropTypes(r,e,t,n)})}return null},danger:gl().bool,loadingStatus:gl().oneOf(["inactive","active","finished","error"]),loadingDescription:gl().string,loadingIconDescription:gl().string,onLoadingSuccess:gl().func},gl().elementType,gl().node,gl().string;let _M=f1().createContext(void 0);function _N(){return(0,f0.useContext)(_M)}function _T({align:e,as:t,autoAlign:n,className:r,children:a,defaultOpen:o=!1,...i}){let s=(0,f0.useRef)(null),[l,c]=(0,f0.useState)(o),u=gm(),d=gG(),p=hZ()(`${u}--toggletip`,r,{[`${u}--toggletip--open`]:l,[`${u}--autoalign`]:n}),f=()=>{c(!l)},m=()=>{c(!1)};return gh("blur",()=>{l&&m()}),(0,f0.useEffect)(()=>{if(!s.current)return;let e=s.current.ownerDocument||document,t="PointerEvent"in window?"pointerdown":"mousedown",n=e=>{let t=e.target;l&&t&&!s.current.contains(t)&&c(!1)},r={capture:!0};return e.addEventListener(t,n,r),()=>{e.removeEventListener(t,n,r)}},[l]),f1().createElement(_M.Provider,{value:{buttonProps:{"aria-expanded":l,"aria-controls":d,"aria-describedby":l?d:void 0,onClick:f},contentProps:{id:d},onClick:{onClick:f}}},f1().createElement(gC,gi({align:e,as:t,caret:!0,className:p,dropShadow:!1,highContrast:!0,open:l,onKeyDown:e=>{if(l&&gO(e,gz)){e.stopPropagation(),m();let t=s.current?.children[0];t instanceof HTMLButtonElement&&t.focus()}},onBlur:e=>{(!l||null!==e.relatedTarget)&&(e.currentTarget.contains(e.relatedTarget)||m())},ref:s,autoAlign:n},i),a))}let{open:_O,..._I}=gC.propTypes??{};_T.propTypes={..._I,defaultOpen:gl().bool};let _B=f1().forwardRef(function({children:e,className:t,label:n="Show information",as:r,...a},o){let i=_N(),s=gm(),l=hZ()(`${s}--toggletip-button`,t),c=r??"button";return"button"!==c?f1().createElement(c,gi({},i?.onClick,{className:l},a),e):f1().createElement("button",gi({},i?.buttonProps,{"aria-label":n,type:"button",className:l,ref:o},a),e)});_B.propTypes={children:gl().node,className:gl().string,label:gl().string},_B.displayName="ToggletipButton";let _R=f1().forwardRef(function({children:e,className:t},n){let r=_N(),a=gm();return f1().createElement(gE,gi({className:t},r?.contentProps,{ref:n}),f1().createElement("div",{className:`${a}--toggletip-content`},e))});function _j({children:e,className:t}){let n=gm(),r=hZ()(`${n}--toggletip-actions`,t);return f1().createElement("div",{className:r},e)}_R.propTypes={children:gl().node,className:gl().string},_R.displayName="ToggletipContent",_j.propTypes={children:gl().node,className:gl().string};var _F=n(5951);let _L=f1().forwardRef(function({className:e,children:t},n){let r=gm(),a=f1().Children.toArray(t).some(e=>{e.type}),o=hZ()(e,{[`${r}--ai-label-content`]:!0,[`${r}--ai-label-content--with-actions`]:a});return f1().createElement(_R,{className:o},t)});_L.displayName="AILabelContent",_L.propTypes={children:gl().node,className:gl().string};let _W=f1().forwardRef(function({className:e,children:t},n){let r=gm(),a=hZ()(e,{[`${r}--ai-label-actions`]:!0});return f1().createElement(_j,{className:a},t)});_W.displayName="AILabelActions",_W.propTypes={children:gl().node,className:gl().string};let _V=f1().forwardRef(function({aiText:e="AI",aiTextLabel:t,textLabel:n,align:r,autoAlign:a=!0,children:o,className:i,kind:s="default",onRevertClick:l,revertActive:c,revertLabel:u="Revert to AI input",slugLabel:d="Show information","aria-label":p="Show information",size:f="xs",...m},h){let g=gm(),y=gG("AILabel"),b=hZ()(i,{[`${g}--ai-label`]:!0,[`${g}--ai-label--revert`]:c}),v=hZ()({[`${g}--ai-label__button`]:!0,[`${g}--ai-label__button--${f}`]:f,[`${g}--ai-label__button--${s}`]:s,[`${g}--ai-label__button--inline-with-content`]:"inline"===s&&(t||n)}),$=t||n?`${e} ${t||n}`:`${e} ${d||p}`,A=["xs","2xs","mini"].includes(f);return f1().createElement("div",{className:b,ref:h,id:y},c?f1().createElement(g1,gi({onClick:e=>{l&&l(e)},kind:"ghost",size:"sm",label:u},m),eh||(eh=f1().createElement(_F.Vn,null))):f1().createElement(_T,gi({align:r,autoAlign:a,alignmentAxisOffset:A?-24:0},m),f1().createElement(_B,{className:v,label:"inline"===s?"":$},f1().createElement("span",{className:`${g}--ai-label__text`},e),"inline"===s&&(t||n)&&f1().createElement("span",{className:`${g}--ai-label__additional-text`},t||n)),o))});_V.displayName="AILabel",_V.propTypes={..._T.propTypes,AILabelContent:gl().node,aiText:gl().string,aiTextLabel:gA(gl().string,"`aiTextLabel` on `AILabel` has been deprecated - Please use the `textLabel` prop instead"),"aria-label":gl().string,kind:gl().oneOf(["default","inline"]),onRevertClick:gl().func,revertActive:gl().bool,revertLabel:gl().string,size:gl().oneOf(["mini","2xs","xs","sm","md","lg","xl"]),slugLabel:gA(gl().string,"`slugLabel` on `AILabel` has been deprecated - Please use the `ariaLabel` prop instead"),textLabel:gl().string};let _G=(e,t)=>(0,f0.isValidElement)(e)&&e.type===t,_U=e=>{let[t,n]=(0,f0.useState)(!!e),[r,a]=(0,f0.useState)(!!e);return(0,f0.useEffect)(()=>{e!==r&&(n(!!e),a(!!e))},[e,r]),(0,f0.useMemo)(()=>[t,n],[t])},_H=({open:e,_presenceId:t,_autoEnablePresence:n=!0,children:r})=>{let a=_U(e),[o]=a,[i,s]=((e,t)=>{let n=(0,f0.useRef)(t),r=(0,f0.useRef)(null),a=(0,f0.useRef)(null);t||!a.current||r.current||(n.current=null),a.current=r.current;let{isPresent:o,isExiting:i}=((e,t)=>{let n=gm(),[r,a]=(0,f0.useState)(t?"idle":"finished"),o="active"===r;t||"idle"!==r||a("active"),t&&"idle"!==r&&a("idle");let i=(0,f0.useCallback)(()=>{a("finished")},[]);return(0,f0.useLayoutEffect)(()=>{if(!e.current||!o)return;if(!("getAnimations"in e.current))return void i();let t=e.current.getAnimations({subtree:!0}).filter(e=>e instanceof CSSAnimation&&e.animationName.startsWith(`${n}--presence`));if(!t.length)return void i();let r=!1;return Promise.all(t.map(e=>e.finished)).finally(()=>{r||i()}),()=>{r=!0}},[e,o,n,i]),{isPresent:t||"finished"!==r,isExiting:o}})(r,e),s=(0,f0.useCallback)(e=>!!e&&(!n.current||n.current===e)&&(n.current=e,!0),[]);return[o,(0,f0.useMemo)(()=>({presenceRef:r,isPresenceExclusive:s,isExiting:i}),[r,s,i])]})(o,t),l=(0,f0.useMemo)(()=>({modalState:a,autoEnablePresence:n,...s}),[a,n,s]);return i?f1().createElement(_q,{value:l},r):null},_q=(0,f0.createContext)(void 0),_K=f1().forwardRef(function({className:e,children:t,hasForm:n,hasScrollingContent:r,...a},o){let i=gm(),s=(0,f0.useRef)(null),{height:l}=(({ref:e,onResize:t})=>{let[n,r]=(0,f0.useState)(-1),[a,o]=(0,f0.useState)(-1),i=(0,f0.useRef)(null),s=(0,f0.useRef)(t);return(0,f0.useEffect)(()=>{s.current=t},[t]),(0,f0.useEffect)(()=>{if(e?.current&&(!(n>=0)||!(a>=0))&&e.current){let t=window.getComputedStyle(e.current),n=(e.current?.offsetWidth??0)-("string"==typeof t?.paddingLeft&&t?.paddingLeft.length?parseFloat(t?.paddingLeft):0)-("string"==typeof t?.paddingRight&&t?.paddingRight.length?parseFloat(t?.paddingRight):0),a=(e.current?.offsetHeight??0)-("string"==typeof t?.paddingTop&&t?.paddingTop.length?parseFloat(t?.paddingTop):0)-("string"==typeof t?.paddingBottom&&t?.paddingBottom.length?parseFloat(t?.paddingBottom):0);r(n),o(a)}},[n,a]),(0,f0.useLayoutEffect)(()=>{if(!e?.current)return;let t=new ResizeObserver(t=>{i.current=t,window.requestAnimationFrame(()=>{(()=>{if(!e?.current||!Array.isArray(i?.current))return;let t=i.current[0];r(t.contentRect.width),o(t.contentRect.height),s.current&&s.current(t.contentRect)})()})});return t.observe(e.current),()=>{t.disconnect()}},[]),{width:n,height:a}})({ref:s}),c=!!s.current&&s?.current?.scrollHeight>s?.current?.clientHeight,u=hZ()({[`${i}--modal-content`]:!0,[`${i}--modal-content--with-form`]:n,[`${i}--modal-scroll-content`]:r||c,[`${i}--modal-scroll-content--no-fade`]:l<=300},e),d=r||c?{tabIndex:0,role:"region"}:{};return f1().createElement(_e,gi({className:u},d,a,{ref:_u(s,o)}),t)});_K.propTypes={"aria-label":(m=gl().string,(e,t,n,...r)=>m(e,t,n,...r)),children:gl().node,className:gl().string,hasForm:gl().bool,hasScrollingContent:gl().bool};let _Z=f1().forwardRef(function({open:e,...t},n){let r,a=gG(),o=gk("enable-presence"),i=!!(0,f0.useContext)(_q),s=o||i,l=(r=(0,f0.useContext)(_q),r?.isPresenceExclusive(a)?r:void 0);return s&&!l?f1().createElement(_H,{open:e??!1,_presenceId:a,_autoEnablePresence:i},f1().createElement(_Y,gi({open:!0,ref:n},t))):f1().createElement(_Y,gi({ref:n,open:e},t))}),_Y=f1().forwardRef(function({"aria-labelledby":e,"aria-label":t,children:n,className:r,containerClassName:a,danger:o,decorator:i,isFullWidth:s,onClose:l,onKeyDown:c,open:u,preventCloseOnClickOutside:d,selectorPrimaryFocus:p="[data-modal-primary-focus]",selectorsFloatingMenus:f,size:m,launcherButtonRef:h,slug:g,...y},b){let v,$=gm(),A=(0,f0.useRef)(null),w=(0,f0.useRef)(null),k=(0,f0.useRef)(null),x=(0,f0.useRef)(null),C=(0,f0.useRef)(null),E=(0,f0.useContext)(_q),D=(0,gy.SV)([b,E?.presenceRef]),S=gk("enable-presence")||E?.autoEnablePresence,z=u||S,P=_U(z),[M,N]=E?.modalState??P,T=gk("enable-dialog-element"),O=gk("enable-experimental-focus-wrap-without-sentinels"),I=gk("enable-focus-wrap-without-sentinels"),B=O||I;function R(e){l&&!1===l(e)||N(!1)}(0,f0.useEffect)(()=>{T||_d(document.body,`${$}--body--with-modal-open`,!!z)},[z,$]),(0,f0.useEffect)(()=>{if(!T)return()=>{_d(document.body,`${$}--body--with-modal-open`,!1)}},[]);let j=hZ()(`${$}--modal`,{"is-visible":S||M,[`${$}--modal--enable-presence`]:E?.autoEnablePresence,[`${$}--modal--danger`]:o,[`${$}--modal--slug`]:g,[`${$}--modal--decorator`]:i},r),F=hZ()(`${$}--modal-container`,m&&`${$}--modal-container--${m}`,s&&`${$}--modal-container--full-width`,a),L=f1().Children.toArray(n).map(e=>{switch(!0){case(0,g4.isElement)(e)&&e.type===f1().createElement(_n).type:return v=e.props.label,f1().cloneElement(e,{closeModal:R});case(0,g4.isElement)(e)&&e.type===f1().createElement(_c).type:return f1().cloneElement(e,{closeModal:R,inputref:w,danger:o});default:return e}}),W=!f0.Children.toArray(L).some(e=>_G(e,_c));(0,f0.useEffect)(()=>{if(!z)return;let e=e=>{gO(e,gz)&&(e.preventDefault(),e.stopPropagation(),R(e))};return document.addEventListener("keydown",e,!0),()=>{document.removeEventListener("keydown",e,!0)}},[z]),(0,f0.useEffect)(()=>{T||S||z||!h||setTimeout(()=>{h.current?.focus()})},[T,S,z,h]),(0,f0.useEffect)(()=>{let e=h?.current;return()=>{S&&e&&setTimeout(()=>{e.focus()})}},[S,h]),(0,f0.useEffect)(()=>{var e;let t,n,r,a;!T&&z&&M&&(r=(n=(t=(e=A.current)||A.current)?t.querySelector(o?`.${$}--btn--secondary`:p):null)||w&&w.current,a=e.querySelector(`.${$}--modal-close`),r?r.focus():!r&&a&&a?.focus())},[z,p,M]);let V=g??i,G=_G(V,_V)?(0,f0.cloneElement)(V,{size:"sm"}):V,U=T?f1().createElement(_k,{open:z,focusAfterCloseRef:h,modal:!0,className:F,"aria-label":t||v,"aria-labelledby":e,"data-exiting":E?.isExiting||void 0},f1().createElement("div",{ref:A,className:`${$}--modal-container-body`},g?G:i?f1().createElement("div",{className:`${$}--modal--inner__decorator`},G):"",L)):f1().createElement("div",{className:F,role:"dialog","aria-modal":"true","aria-label":t||v,"aria-labelledby":e},!B&&f1().createElement("button",{type:"button",ref:k,className:`${$}--visually-hidden`},"Focus sentinel"),f1().createElement("div",{ref:A,className:`${$}--modal-container-body`},g?G:i?f1().createElement("div",{className:`${$}--modal--inner__decorator`},G):"",L),!B&&f1().createElement("button",{type:"button",ref:x,className:`${$}--visually-hidden`},"Focus sentinel"));return f1().createElement(_e,gi({},y,{level:0,role:"presentation",ref:D,"aria-hidden":!z,onBlur:function({target:e,relatedTarget:t}){if(!T&&!B&&z&&t&&e&&A.current){let{current:n}=A,{current:r}=k,{current:a}=x;__({bodyNode:n,startTrapNode:r,endTrapNode:a,currentActiveNode:t,oldActiveNode:e,selectorsFloatingMenus:f?.filter(Boolean)})}let n=document.querySelector(`.${$}--modal-content`);n&&n.classList.contains(`${$}--modal-scroll-content`)&&t&&n.contains(t)&&t.scrollIntoView({block:"center"})},onClick:_b([y?.onClick,function(e){let{target:t}=e,n=C.current;e.stopPropagation(),(W&&!d||!W&&!1===d)&&t instanceof Node&&!_g(t,f)&&A.current&&!A.current.contains(t)&&!A.current.contains(n)&&R(e)}]),onMouseDown:_b([y?.onMouseDown,function(e){C.current=e.target}]),onKeyDown:function(e){!T&&B&&z&&gO(e,gD)&&A.current&&_y({containerNode:A.current,currentActiveNode:e.target,event:e}),c?.(e)},className:j,"data-exiting":E?.isExiting||void 0}),U)});_Z.propTypes={"aria-label":gl().string,"aria-labelledby":gl().string,children:gl().node,className:gl().string,containerClassName:gl().string,danger:gl().bool,decorator:gl().node,isFullWidth:gl().bool,launcherButtonRef:gl().oneOfType([gl().func,gl().shape({current:gl().any})]),onClose:gl().func,onKeyDown:gl().func,open:gl().bool,preventCloseOnClickOutside:gl().bool,selectorPrimaryFocus:gl().string,selectorsFloatingMenus:gl().arrayOf(gl().string.isRequired),size:gl().oneOf(["xs","sm","md","lg"]),slug:gA(gl().node,"The `slug` prop for `ComposedModal` has been deprecated in favor of the new `decorator` prop. It will be removed in the next major release.")};let _J=({name:e,className:t,type:n})=>{function r({className:e,...a}){let o=gm(),i=hZ()("function"==typeof t?t(o):t,e);return f1().createElement(n,{...a,className:i||void 0})}return r.displayName=e,r.propTypes={className:gl().string},r},_X=_J({name:"TableActionList",type:"div",className:e=>`${e}--action-list`}),_Q="carbon.table.batch.cancel",_0="carbon.table.batch.items.selected",_1="carbon.table.batch.item.selected",_2="carbon.table.batch.selectAll",_3={[_Q]:"Cancel",[_0]:"items selected",[_1]:"item selected",[_2]:"Select all"},_4=(e,t={totalSelected:0,totalCount:0})=>{let{totalSelected:n,totalCount:r}=t;switch(e){case _Q:return _3[e];case _2:return`${_3[e]} (${r})`;case _0:case _1:return`${n} ${_3[e]}`}},_5=({className:e,children:t,shouldShowBatchActions:n,totalSelected:r,totalCount:a,onCancel:o,onSelectAll:i,translateWithId:s=_4,...l})=>{let[c,u]=f1().useState(!1),d=gm(),p=hZ()({[`${d}--batch-actions`]:!0,[`${d}--batch-actions--active`]:n},e),f=hZ()(`${d}--batch-summary`,{[`${d}--batch-summary__scroll`]:c});return f1().createElement("div",gi({onScroll:()=>{u(!c)},"aria-hidden":!n,className:p},l),f1().createElement("div",{className:f},f1().createElement("p",{className:`${d}--batch-summary__para`},f1().createElement(_$,null,s(r>1||0===r?"carbon.table.batch.items.selected":"carbon.table.batch.item.selected",{totalSelected:r}))),i&&f1().createElement(f1().Fragment,null,f1().createElement("span",{className:`${d}--batch-summary__divider`},"|"),f1().createElement(g3,{onClick:i,tabIndex:n?0:-1},s("carbon.table.batch.selectAll",{totalCount:a})))),f1().createElement(_X,null,t,f1().createElement(g3,{className:`${d}--batch-summary__cancel`,tabIndex:n?0:-1,onClick:o},s("carbon.table.batch.cancel"))))};function _6({className:e,children:t,id:n,...r}){let a=gm(),o=hZ()(`${a}--label`,`${a}--label--no-margin`,e);return f1().createElement(_$,gi({as:"label",htmlFor:n,className:o},r),t)}_5.propTypes={children:gl().node,className:gl().string,onCancel:gl().func.isRequired,onSelectAll:gl().func,shouldShowBatchActions:gl().bool,totalCount:gl().number,totalSelected:gl().number.isRequired,translateWithId:gl().func},_6.propTypes={children:gl().node,className:gl().string,id:gl().string};var _7=n(4632),_8=n(1895);function _9({children:e,className:t,onClick:n,inline:r,...a}){let o=gm(),i=hZ()(t,{[`${o}--actionable-notification__action-button`]:!0});return f1().createElement(g3,gi({className:i,kind:r?"ghost":"tertiary",onClick:n,size:"sm"},a),e)}function ye({"aria-label":e="close notification",ariaLabel:t,className:n,type:r="button",renderIcon:a=_t.bm,name:o,notificationType:i="toast",...s}){let l=gm(),c=hZ()(n,{[`${l}--${i}-notification__close-button`]:i}),u=hZ()({[`${l}--${i}-notification__close-icon`]:i});return f1().createElement("button",gi({},s,{type:r,"aria-label":t||e,title:t||e,className:c}),a&&f1().createElement(a,{className:u,name:o}))}_9.propTypes={children:gl().node,className:gl().string,inline:gl().bool,onClick:gl().func},ye.propTypes={"aria-label":gl().string,ariaLabel:gA(gl().string,"This prop syntax has been deprecated. Please use the new `aria-label`."),className:gl().string,name:gl().string,notificationType:gl().oneOf(["toast","inline","actionable"]),renderIcon:gl().oneOfType([gl().func,gl().object]),type:gl().string};let yt={error:_o.x,success:_t._j,warning:_7.BF,"warning-alt":_7.OR,info:_8.NM,"info-square":_8.mR};function yn({iconDescription:e,kind:t,notificationType:n}){let r=gm(),a=yt[t];return a?f1().createElement(a,{className:`${r}--${n}-notification__icon`,size:20},f1().createElement("title",null,e)):null}function yr({"aria-label":e,children:t,title:n,subtitle:r,role:a="status",onClose:o,onCloseButtonClick:i=_a,statusIconDescription:s,className:l,kind:c="error",lowContrast:u,hideCloseButton:d=!1,...p}){let[f,m]=(0,f0.useState)(!0),h=gm(),g=hZ()(l,{[`${h}--inline-notification`]:!0,[`${h}--inline-notification--low-contrast`]:u,[`${h}--inline-notification--${c}`]:c,[`${h}--inline-notification--hide-close-button`]:d}),y=(0,f0.useRef)(null);gH(y);let b=(0,f0.useRef)(null);return f?f1().createElement("div",gi({ref:b},p,{role:a,className:g}),f1().createElement("div",{className:`${h}--inline-notification__details`},f1().createElement(yn,{notificationType:"inline",kind:c,iconDescription:s||`${c} icon`}),f1().createElement("div",{ref:y,className:`${h}--inline-notification__text-wrapper`},n&&f1().createElement(_$,{as:"div",className:`${h}--inline-notification__title`},n),r&&f1().createElement(_$,{as:"div",className:`${h}--inline-notification__subtitle`},r),t)),!d&&f1().createElement(ye,{notificationType:"inline",onClick:function(e){i(e),o&&!1===o(e)||m(!1)},"aria-label":e})):null}function ya({actionButtonLabel:e,"aria-label":t,ariaLabel:n,caption:r,children:a,role:o="alertdialog",onActionButtonClick:i,onClose:s,onCloseButtonClick:l=_a,statusIconDescription:c,className:u,inline:d=!1,kind:p="error",lowContrast:f,hideCloseButton:m=!1,hasFocus:h=!0,closeOnEscape:g=!0,title:y,subtitle:b,...v}){let[$,A]=(0,f0.useState)(!0),w=gm(),k=gG("actionable-notification"),x=gG("actionable-notification-subtitle"),C=hZ()(u,{[`${w}--actionable-notification`]:!0,[`${w}--actionable-notification--toast`]:!d,[`${w}--actionable-notification--low-contrast`]:f,[`${w}--actionable-notification--${p}`]:p,[`${w}--actionable-notification--hide-close-button`]:m}),E=(0,f0.useRef)(null),D=(0,f0.useRef)(null),S=(0,f0.useRef)(null),z=(0,f0.useRef)(null),P=gk("enable-experimental-focus-wrap-without-sentinels"),M=gk("enable-focus-wrap-without-sentinels")||P;function N(e){l(e),s&&!1===s(e)||A(!1)}return gd(()=>{if(h&&"alertdialog"===o){let e=document.querySelector("button.cds--actionable-notification__action-button");e?.focus()}}),(!function(e,t,n=!0){let r=r=>{let a=e.current&&document.activeElement===e.current||e.current?.contains(document.activeElement);gT(r,[gz])&&n&&a&&t(r)};gd(()=>(null!==e.current&&document.addEventListener("keydown",r,!1),()=>document.removeEventListener("keydown",r,!1)))}(z,N,g),$)?f1().createElement("div",gi({},v,{ref:z,role:o,className:C,"aria-labelledby":y?k:x,onBlur:M?()=>{}:function({target:e,relatedTarget:t}){if($&&t&&e&&"alertdialog"===o){let{current:n}=E,{current:r}=D,{current:a}=S;__({bodyNode:n,startTrapNode:r,endTrapNode:a,currentActiveNode:t,oldActiveNode:e})}},onKeyDown:M?function(e){$&&gO(e,gD)&&z.current&&"alertdialog"===o&&_y({containerNode:z.current,currentActiveNode:e.target,event:e})}:()=>{}}),!M&&f1().createElement("span",{ref:D,tabIndex:0,role:"link",className:`${w}--visually-hidden`},"Focus sentinel"),f1().createElement("div",{className:`${w}--actionable-notification__details`},f1().createElement(yn,{notificationType:d?"inline":"toast",kind:p,iconDescription:c||`${p} icon`}),f1().createElement("div",{className:`${w}--actionable-notification__text-wrapper`},f1().createElement("div",{className:`${w}--actionable-notification__content`},y&&f1().createElement(_$,{as:"div",className:`${w}--actionable-notification__title`,id:k},y),b&&f1().createElement(_$,{as:"div",className:`${w}--actionable-notification__subtitle`,id:x},b),r&&f1().createElement(_$,{as:"div",className:`${w}--actionable-notification__caption`},r),a))),f1().createElement("div",{className:`${w}--actionable-notification__button-wrapper`,ref:E},e&&f1().createElement(_9,{onClick:i,inline:d},e),!m&&f1().createElement(ye,{"aria-label":n||t,notificationType:"actionable",onClick:N})),!M&&f1().createElement("span",{ref:S,tabIndex:0,role:"link",className:`${w}--visually-hidden`},"Focus sentinel")):null}yn.propTypes={iconDescription:gl().string.isRequired,kind:gl().oneOf(["error","success","warning","warning-alt","info","info-square"]).isRequired,notificationType:gl().oneOf(["inline","toast"]).isRequired},gl().string,gA(gl().string,"This prop syntax has been deprecated. Please use the new `aria-label`."),gl().string,gl().node,gl().string,gl().bool,gl().oneOf(["error","info","info-square","success","warning","warning-alt"]),gl().bool,gl().func,gl().func,gl().oneOf(["alert","log","status"]),gl().string,gl().string,gl().number,gl().string,yr.propTypes={"aria-label":gl().string,children:gl().node,className:gl().string,hideCloseButton:gl().bool,kind:gl().oneOf(["error","info","info-square","success","warning","warning-alt"]),lowContrast:gl().bool,onClose:gl().func,onCloseButtonClick:gl().func,role:gl().oneOf(["alert","log","status"]),statusIconDescription:gl().string,subtitle:gl().string,title:gl().string},ya.propTypes={actionButtonLabel:gl().string,"aria-label":gl().string,ariaLabel:gA(gl().string,"This prop syntax has been deprecated. Please use the new `aria-label`."),caption:gl().string,children:gl().node,className:gl().string,closeOnEscape:gl().bool,hasFocus:gA(gl().bool,"hasFocus is deprecated. To conform to accessibility requirements hasFocus should always be `true` for ActionableNotification. If you were setting this prop to `false`, consider using the Callout component instead."),hideCloseButton:gl().bool,inline:gl().bool,kind:gl().oneOf(["error","info","info-square","success","warning","warning-alt"]),lowContrast:gl().bool,onActionButtonClick:gl().func,onClose:gl().func,onCloseButtonClick:gl().func,role:gl().string,statusIconDescription:gl().string,subtitle:gl().node,title:gl().string};let yo={error:"warning",success:"info"};gl().string,gl().node,gl().string,gu(gl().oneOf(["error","info","info-square","success","warning","warning-alt"]),["warning","info"],e=>yo[e]),gl().bool,gl().func,gl().string,gl().node,gl().string,gl().string;let yi=(0,f0.forwardRef)((e,t)=>{let{className:n,closeMenu:r,disabled:a=!1,handleOverflowMenuItemFocus:o,hasDivider:i=!1,href:s,isDelete:l=!1,index:c,itemText:u="Provide itemText",onClick:d=()=>{},onKeyDown:p=()=>{},requireTitle:f,title:m,wrapperClassName:h,...g}=e,y=gm(),b=hZ()(`${y}--overflow-menu-options__btn`,n),v=hZ()(`${y}--overflow-menu-options__option`,{[`${y}--overflow-menu--divider`]:i,[`${y}--overflow-menu-options__option--danger`]:l,[`${y}--overflow-menu-options__option--disabled`]:a},h),$="string"!=typeof u?u:f1().createElement("div",{className:`${y}--overflow-menu-options__option-content`},u);return f1().createElement(_$,{as:"li",className:v,role:"none"},f1().createElement(s?"a":"button",gi({className:b,disabled:a,href:s,onClick:function(e){d(e),r&&r()},onKeyDown:e=>{gO(e,gN)&&o?.({currentIndex:c,direction:1}),gO(e,gM)&&o?.({currentIndex:c,direction:-1}),p(e)},role:"menuitem",ref:t,tabIndex:-1,title:f?m||u:void 0},g),$))});yi.propTypes={className:gl().string,closeMenu:gl().func,disabled:gl().bool,handleOverflowMenuItemFocus:gl().func,hasDivider:gl().bool,href:gl().string,index:gl().number,isDelete:gl().bool,itemText:gl().node.isRequired,onBlur:gl().func,onClick:gl().func,onFocus:gl().func,onKeyDown:gl().func,onKeyUp:gl().func,onMouseDown:gl().func,onMouseEnter:gl().func,onMouseLeave:gl().func,onMouseUp:gl().func,requireTitle:gl().bool,title:gl().string,wrapperClassName:gl().string};var ys=n(8466);let yl=(0,f0.createContext)({isFluid:!1}),yc=f1().forwardRef(({className:e,decorator:t,id:n,inline:r=!1,labelText:a="Select",disabled:o=!1,children:i,noLabel:s=!1,hideLabel:l=!1,invalid:c=!1,invalidText:u="",helperText:d="",light:p=!1,readOnly:f,size:m,warn:h=!1,warnText:g,onChange:y,slug:b,...v},$)=>{let A=gm(),{isFluid:w}=(0,f0.useContext)(yl),[k,x]=(0,f0.useState)(!1),C=gG(),E=f1().Children.toArray(i).filter(e=>f1().isValidElement(e)),D=v?.value||v?.defaultValue,S=E.find(e=>e.props?.value===D),z=v?.title||S?.props?.text||E[0]?.props?.text||"",[P,M]=(0,f0.useState)(z),N=hZ()({[`${A}--select`]:!0,[`${A}--select--inline`]:r,[`${A}--select--light`]:p,[`${A}--select--invalid`]:c,[`${A}--select--disabled`]:o,[`${A}--select--readonly`]:f,[`${A}--select--warning`]:h,[`${A}--select--fluid--invalid`]:w&&c,[`${A}--select--fluid--focus`]:w&&k,[`${A}--select--slug`]:b,[`${A}--select--decorator`]:t}),T=hZ()(`${A}--label`,{[`${A}--visually-hidden`]:l,[`${A}--label--disabled`]:o}),O=hZ()({[`${A}--select-input`]:!0,[`${A}--select-input--${m}`]:m}),I=`${n}-error-msg`,B=c?u:h?g:void 0,R=c||h?f1().createElement(_$,{as:"div",className:`${A}--form-requirement`,id:I},B):null,j=hZ()(`${A}--form__helper-text`,{[`${A}--form__helper-text--disabled`]:o}),F=d?`select-helper-text-${C}`:void 0,L=d?f1().createElement(_$,{as:"div",id:F,className:j},d):null,W={};c?W["aria-describedby"]=I:r||w||(W["aria-describedby"]=L?F:void 0);let V=e=>{x("focus"===e.type)},G=b??t,U=_G(G,_V)?(0,f0.cloneElement)(G,{size:"mini"}):G,H=f1().createElement(f1().Fragment,null,f1().createElement("select",gi({},v,W,{id:n,className:O,disabled:o||void 0,"aria-invalid":c||void 0,"aria-readonly":f||void 0,title:P,onChange:_b([y,e=>{let t=e?.target?.options[e.target.selectedIndex];M(t?.text)}])},{onMouseDown:e=>{f&&(e.preventDefault(),e.target.focus())},onKeyDown:e=>{f&&["ArrowDown","ArrowUp"," "].includes(e.key)&&e.preventDefault()}},{ref:$}),i),f1().createElement(_t.yQ,{className:`${A}--select__arrow`}),c&&f1().createElement(_7.BF,{className:`${A}--select__invalid-icon`}),!c&&h&&f1().createElement(_7.OR,{className:`${A}--select__invalid-icon ${A}--select__invalid-icon--warning`}));return f1().createElement("div",{className:hZ()(`${A}--form-item`,e)},f1().createElement("div",{className:N},!s&&f1().createElement(_$,{as:"label",htmlFor:n,className:T},a),r&&f1().createElement("div",{className:`${A}--select-input--inline__wrapper`},f1().createElement("div",{className:`${A}--select-input__wrapper`,"data-invalid":c||null},H),R),!r&&f1().createElement("div",{className:`${A}--select-input__wrapper`,"data-invalid":c||null,onFocus:V,onBlur:V},H,b?U:t?f1().createElement("div",{className:`${A}--select__inner-wrapper--decorator`},U):"",w&&f1().createElement("hr",{className:`${A}--select__divider`}),w&&R?R:null),r||w||!R?L:R))});yc.displayName="Select",yc.propTypes={children:gl().node,className:gl().string,decorator:gl().node,defaultValue:gl().any,disabled:gl().bool,helperText:gl().node,hideLabel:gl().bool,id:gl().string.isRequired,inline:gl().bool,invalid:gl().bool,invalidText:gl().node,labelText:gl().node,light:gA(gl().bool,"The `light` prop for `Select` is no longer needed and has been deprecated in v11 in favor of the new `Layer` component. It will be moved in the next major release."),noLabel:gl().bool,onChange:gl().func,readOnly:gl().bool,size:gl().oneOf(["sm","md","lg"]),slug:gA(gl().node,"The `slug` prop has been deprecated and will be removed in the next major version. Use the decorator prop instead."),warn:gl().bool,warnText:gl().node};let yu=({className:e,value:t="",disabled:n=!1,hidden:r=!1,text:a="",...o})=>{let i=gm(),s=hZ()({[`${i}--select-option`]:!0,...e&&{[e]:e}});return f1().createElement("option",gi({},o,{className:s,value:t,disabled:n,hidden:r}),a)};yu.propTypes={className:gl().string,disabled:gl().bool,hidden:gl().bool,text:gl().string.isRequired,value:gl().any.isRequired};var yd=n(9772),yp=n.n(yd);function yf(e){return"object"==typeof e[0]&&null!==e[0]?e:e.map(e=>({text:e,value:e}))}function ym(e,t){return t&&e.find(e=>t===e.value)?t:e[0].value}let yh=f1().forwardRef(({backwardText:e="Previous page",className:t="",disabled:n=!1,forwardText:r="Next page",id:a,isLastPage:o=!1,itemText:i=(e,t)=>`${e}–${t} items`,itemRangeText:s=(e,t,n)=>`${e}–${t} of ${n} items`,itemsPerPageText:l="Items per page:",onChange:c,pageNumberText:u="Page Number",pageRangeText:d=(e,t)=>`of ${t} ${1===t?"page":"pages"}`,page:p=1,pageInputDisabled:f,pageSize:m,pageSizeInputDisabled:h,pageSizes:g,pageText:y=e=>`page ${e}`,pagesUnknown:b=!1,size:v="md",totalItems:$,...A},w)=>{let k=gm(),x=gU(a?.toString()),C=(0,f0.useRef)(null),E=(0,f0.useRef)(null),[D,S]=(0,f0.useState)(()=>yf(g)),[z,P]=(0,f0.useState)(g),[M,N]=(0,f0.useState)(p),[T,O]=(0,f0.useState)(p),[I,B]=(0,f0.useState)(null),[R,j]=(0,f0.useState)(()=>ym(D,m)),[F,L]=(0,f0.useState)(m),W=hZ()({[`${k}--pagination`]:!0,[`${k}--pagination--${v}`]:v,[t]:!!t}),V=$?Math.max(Math.ceil($/R),1):1,G=n||1===M,U=hZ()({[`${k}--pagination__button`]:!0,[`${k}--pagination__button--backward`]:!0,[`${k}--pagination__button--no-index`]:G}),H=n||M===V&&!b,q=hZ()({[`${k}--pagination__button`]:!0,[`${k}--pagination__button--forward`]:!0,[`${k}--pagination__button--no-index`]:H}),K=function(e){let t=1,n=[];for(;t<=e;)n.push(f1().createElement(yu,{key:t,value:t,text:String(t)})),t++;return n}(V),Z={backward:C,forward:E};if((0,f0.useEffect)(()=>{if(I){let e;e=Z[I],e?.current&&!e.current.disabled&&e.current.focus(),B(null)}},[I]),p!==T&&(N(p),O(p)),m!==F&&(j(ym(D,m)),L(m)),!yp()(g,z)){let e=yf(g);e.find(e=>e.value===R)||N(1),S(e),P(g)}return f1().createElement("div",gi({className:W,ref:w},A),f1().createElement("div",{className:`${k}--pagination__left`},f1().createElement("label",{id:`${k}-pagination-select-${x}-count-label`,className:`${k}--pagination__text`,htmlFor:`${k}-pagination-select-${x}`},l),f1().createElement(yc,{id:`${k}-pagination-select-${x}`,className:`${k}--select__item-count`,labelText:"",hideLabel:!0,noLabel:!0,inline:!0,onChange:function(e){let t={pageSize:Number(e.target.value),page:1};N(t.page),j(t.pageSize),c&&c(t)},disabled:h||n,value:R},D.map(e=>f1().createElement(yu,{key:e.value,value:e.value,text:String(e.text)}))),f1().createElement("span",{className:`${k}--pagination__text ${k}--pagination__items-count`},b||!$?0===$?s(0,0,0):i(R*(M-1)+1,M*R):s(Math.min(R*(M-1)+1,$),Math.min(M*R,$),$))),f1().createElement("div",{className:`${k}--pagination__right`},b?f1().createElement("span",{className:`${k}--pagination__text ${k}--pagination__page-text ${k}--pagination__unknown-pages-text`},y(M)):f1().createElement(f1().Fragment,null,f1().createElement(yc,{id:`${k}-pagination-select-${x}-right`,className:`${k}--select__page-number`,labelText:`Page of ${V} pages`,inline:!0,hideLabel:!0,onChange:function(e){let t=Number(e.target.value);t>0&&$&&t<=Math.max(Math.ceil($/R),1)&&(N(t),c&&c({page:t,pageSize:R}))},value:M,disabled:f||n},K),f1().createElement("span",{className:`${k}--pagination__text`},d(M,V))),f1().createElement("div",{className:`${k}--pagination__control-buttons`},f1().createElement(g1,{align:"top",disabled:G,kind:"ghost",className:U,label:e,"aria-label":e,onClick:function(){let e=M-1;N(e),1===e&&B("forward"),c&&c({page:e,pageSize:R,ref:E})},ref:C},eg||(eg=f1().createElement(ys.ZK,null))),f1().createElement(g1,{align:"top-end",disabled:H||o,kind:"ghost",className:q,label:r,"aria-label":r,onClick:function(){let e=M+1;N(e),e===V&&B("backward"),c&&c({page:e,pageSize:R,ref:C})},ref:E},e_||(e_=f1().createElement(ys.K3,null))))))});yh.propTypes={backwardText:gl().string,className:gl().string,disabled:gl().bool,forwardText:gl().string,id:gl().oneOfType([gl().string,gl().number]),isLastPage:gl().bool,itemRangeText:gl().func,itemText:gl().func,itemsPerPageText:gl().string,onChange:gl().func,page:gl().number,pageInputDisabled:gl().bool,pageNumberText:gl().string,pageRangeText:gl().func,pageSize:gl().number,pageSizeInputDisabled:gl().bool,pageSizes:gl().oneOfType([gl().arrayOf(gl().number.isRequired),gl().arrayOf(gl().shape({text:gl().string.isRequired,value:gl().number.isRequired}).isRequired)]).isRequired,pageText:gl().func,pagesUnknown:gl().bool,size:gl().oneOf(["sm","md","lg"]),totalItems:gl().number};let yg=f1().forwardRef((e,t)=>{let{className:n,decorator:r,disabled:a,hideLabel:o,id:i,labelPosition:s="right",labelText:l="",name:c,onChange:u=()=>{},value:d="",slug:p,required:f,...m}=e,h=gm(),g=gG("radio-button"),y=i||g,b=hZ()(`${h}--radio-button__label-text`,{[`${h}--visually-hidden`]:o}),v=hZ()(n,`${h}--radio-button-wrapper`,{[`${h}--radio-button-wrapper--label-${s}`]:"right"!==s,[`${h}--radio-button-wrapper--slug`]:p,[`${h}--radio-button-wrapper--decorator`]:r}),$=(0,f0.useRef)(null),A=p??r,w=_G(A,_V)?(0,f0.cloneElement)(A,{size:A.props?.kind==="inline"?"md":"mini"}):A;return f1().createElement("div",{className:v},f1().createElement("input",gi({},m,{type:"radio",className:`${h}--radio-button`,onChange:function(e){u(d,c,e)},id:y,ref:_u($,t),disabled:a,value:d,name:c,required:f})),f1().createElement("label",{htmlFor:y,className:`${h}--radio-button__label`},f1().createElement("span",{className:`${h}--radio-button__appearance`}),l&&f1().createElement(_$,{className:b},l,p?w:r?f1().createElement("div",{className:`${h}--radio-button-wrapper-inner--decorator`},w):"")))});function y_(e){let{className:t,...n}=e,r=gm();return f1().createElement("div",gi({className:hZ()(`${r}--radio-button-wrapper`,t)},n),f1().createElement("div",{className:`${r}--radio-button ${r}--skeleton`}),f1().createElement("span",{className:`${r}--radio-button__label ${r}--skeleton`}))}yg.displayName="RadioButton",yg.propTypes={checked:gl().bool,className:gl().string,decorator:gl().node,defaultChecked:gl().bool,disabled:gl().bool,hideLabel:gl().bool,id:gl().string,labelPosition:gl().oneOf(["right","left"]),labelText:gl().node.isRequired,name:gl().string,onChange:gl().func,onClick:gl().func,required:gl().bool,slug:gA(gl().node,"The `slug` prop has been deprecated and will be removed in the next major version. Use the decorator prop instead."),value:gl().oneOfType([gl().string,gl().number])},y_.propTypes={className:gl().string};let yy=e=>f1().createElement(_$,gi({as:"legend"},e)),yb=f1().forwardRef((e,t)=>{let{children:n,className:r,decorator:a,defaultSelected:o,disabled:i,helperText:s,invalid:l=!1,invalidText:c,labelPosition:u="right",legendText:d,name:p,onChange:f=()=>{},orientation:m="horizontal",readOnly:h,valueSelected:g,warn:y=!1,warnText:b,slug:v,required:$,...A}=e,w=gm(),[k,x]=(0,f0.useState)(g??o),[C,E]=(0,f0.useState)(g),D=gG();function S(e,t,n){h||e===k||(x(e),f(e,p,n))}g!==C&&(x(g),E(g));let z=!h&&!l&&y,P=!l&&!i&&!y,M=hZ()(`${w}--form-item`,r),N=hZ()(`${w}--radio-button-group`,{[`${w}--radio-button-group--${m}`]:"vertical"===m,[`${w}--radio-button-group--label-${u}`]:u,[`${w}--radio-button-group--readonly`]:h,[`${w}--radio-button-group--invalid`]:!h&&l,[`${w}--radio-button-group--warning`]:z,[`${w}--radio-button-group--slug`]:v,[`${w}--radio-button-group--decorator`]:a}),T=hZ()(`${w}--form__helper-text`,{[`${w}--form__helper-text--disabled`]:i}),O=s?`radio-button-group-helper-text-${D}`:void 0,I=s?f1().createElement("div",{id:O,className:T},s):null,B=(0,f0.useRef)(null),R=v??a,j=_G(R,_V)?(0,f0.cloneElement)(R,{size:"mini",kind:"default"}):R;return f1().createElement("div",{className:M,ref:_u(B,t)},f1().createElement("fieldset",gi({className:N,disabled:i,"data-invalid":!!l||void 0,"aria-describedby":P&&s?O:void 0},A),d&&f1().createElement(yy,{className:`${w}--label`},d,v?j:a?f1().createElement("div",{className:`${w}--radio-button-group-inner--decorator`},j):""),f1().Children.map(n,e=>{if(!e)return;let t={name:p,key:e.props.value,value:e.props.value,onChange:S,checked:e.props.value===k,required:$};return!k&&e.props.checked&&(t.checked=!0),f1().cloneElement(e,t)})),f1().createElement("div",{className:`${w}--radio-button__validation-msg`},!h&&l&&f1().createElement(f1().Fragment,null,f1().createElement(_7.BF,{className:`${w}--radio-button__invalid-icon`}),f1().createElement("div",{className:`${w}--form-requirement`},c)),z&&f1().createElement(f1().Fragment,null,f1().createElement(_7.OR,{className:`${w}--radio-button__invalid-icon ${w}--radio-button__invalid-icon--warning`}),f1().createElement("div",{className:`${w}--form-requirement`},b))),P&&I)});yb.propTypes={children:gl().node,className:gl().string,decorator:gl().node,defaultSelected:gl().oneOfType([gl().string,gl().number]),disabled:gl().bool,helperText:gl().node,invalid:gl().bool,invalidText:gl().node,labelPosition:gl().oneOf(["left","right"]),legendText:gl().node,name:gl().string.isRequired,onChange:gl().func,orientation:gl().oneOf(["horizontal","vertical"]),readOnly:gl().bool,required:gl().bool,slug:gA(gl().node,"The `slug` prop has been deprecated and will be removed in the next major version. Use the decorator prop instead."),valueSelected:gl().oneOfType([gl().string,gl().number]),warn:gl().bool,warnText:gl().node},yb.displayName="RadioButtonGroup";var yv=n(6924);let y$=f1().forwardRef(({autoComplete:e="off",className:t,closeButtonLabelText:n="Clear search input",defaultValue:r,disabled:a,isExpanded:o=!0,id:i,labelText:s,light:l,onChange:c=()=>{},onClear:u=()=>{},onKeyDown:d,onExpand:p,placeholder:f="Search",renderIcon:m,role:h,size:g="md",type:y="search",value:b,...v},$)=>{let A=!!b||!!r,w=gm(),{isFluid:k}=(0,f0.useContext)(yl),x=(0,f0.useRef)(null),C=gp([$,x]),E=(0,f0.useRef)(null),D=gG("search-input"),S=i||D,z=`${S}-search`,[P,M]=(0,f0.useState)(A||!1),[N,T]=(0,f0.useState)(b),O=hZ()({[`${w}--search`]:!0,[`${w}--search--sm`]:"sm"===g,[`${w}--search--md`]:"md"===g,[`${w}--search--lg`]:"lg"===g,[`${w}--search--light`]:l,[`${w}--search--disabled`]:a,[`${w}--search--fluid`]:k},t),I=hZ()({[`${w}--search-close`]:!0,[`${w}--search-close--hidden`]:!P||!o});function B(){if(!b&&x.current&&(x.current.value=""),x.current){let e=Object.assign({},x.current,{value:""});c({bubbles:!1,cancelable:!1,currentTarget:x.current,defaultPrevented:!1,eventPhase:0,isDefaultPrevented:()=>!1,isPropagationStopped:()=>!1,isTrusted:!1,nativeEvent:new Event("change"),persist:_a,preventDefault:_a,stopPropagation:_a,target:e,timeStamp:0,type:"change"})}u(),M(!1),x.current?.focus()}return b!==N&&(M(!!b),T(b)),f1().createElement("div",{role:"search","aria-label":f,className:O},f1().createElement("div",{"aria-labelledby":p?z:void 0,role:p?"button":void 0,className:`${w}--search-magnifier`,onClick:p,onKeyDown:function(e){(gO(e,gS)||gO(e,gP))&&(e.stopPropagation(),p&&p(e))},tabIndex:p&&!o?0:-1,ref:E,"aria-expanded":!!p&&!!o||(!p||!!o)&&void 0,"aria-controls":p?S:void 0},f1().createElement(yA,{icon:m})),f1().createElement("label",{id:z,htmlFor:S,className:`${w}--label`},s),f1().createElement("input",gi({autoComplete:e,className:`${w}--search-input`,defaultValue:r,disabled:a,role:h,ref:C,id:S,onChange:_b([c,function(e){M(""!==e.target.value)}]),onKeyDown:_b([d,function(e){gO(e,gz)&&(e.stopPropagation(),x.current?.value?B():p&&o&&E.current?.focus())}]),placeholder:f,type:y,value:b,tabIndex:p&&!o?-1:void 0},v)),f1().createElement("button",{"aria-label":n,className:I,disabled:a,onClick:B,title:n,type:"button"},ey||(ey=f1().createElement(_t.bm,null))))});function yA({icon:e}){let t=gm();return e?f1().createElement(e,{className:`${t}--search-magnifier-icon`}):f1().createElement(yv.vj,{className:`${t}--search-magnifier-icon`})}y$.displayName="Search",y$.propTypes={autoComplete:gl().string,className:gl().string,closeButtonLabelText:gl().string,defaultValue:gl().oneOfType([gl().string,gl().number]),disabled:gl().bool,id:gl().string,isExpanded:gl().bool,labelText:gl().node.isRequired,light:gA(gl().bool,"The `light` prop for `Search` is no longer needed and has been deprecated in v11 in favor of the new `Layer` component. It will be moved in the next major release."),onChange:gl().func,onClear:gl().func,onExpand:gl().func,onKeyDown:gl().func,placeholder:gl().string,renderIcon:gl().oneOfType([gl().func,gl().object]),role:gA(gl().string,'The `role` prop has been deprecated since <input type="search"> already provides correct semantics. It will be removed in the next major release of Carbon.'),size:gl().oneOf(["sm","md","lg"]),type:gl().string,value:gl().oneOfType([gl().string,gl().number])},yA.propTypes={icon:gl().oneOfType([gl().func,gl().object])};let yw=({className:e,...t})=>{let n=gm(),r=hZ()(e,{[`${n}--icon--skeleton`]:!0});return f1().createElement("div",gi({className:r},t))};yw.propTypes={className:gl().string};let yk=({align:e="bottom",autoAlign:t,className:n,children:r,definition:a,defaultOpen:o=!1,id:i,openOnHover:s,tooltipText:l,triggerClassName:c,...u})=>{let[d,p]=(0,f0.useState)(o),f=gm(),m=gU(i);return f1().createElement(gC,{align:e,className:n,autoAlign:t,dropShadow:!1,highContrast:!0,onMouseLeave:()=>{p(!1)},onMouseEnter:()=>{s&&p(!0)},onFocus:()=>{p(!0)},open:d},f1().createElement("button",gi({},u,{className:hZ()(`${f}--definition-term`,c),"aria-controls":m,"aria-describedby":m,"aria-expanded":d,onBlur:()=>{p(!1)},onMouseDown:e=>{0===e.button&&p(!d)},onKeyDown:function(e){d&&gO(e,gz)&&(e.stopPropagation(),p(!1))},type:"button"}),r),f1().createElement(gE,{className:`${f}--definition-tooltip`,id:m},l??a))};yk.propTypes={align:gl().oneOf(["top","top-left","top-right","bottom","bottom-left","bottom-right","left","left-bottom","left-top","right","right-bottom","right-top","top-start","top-end","bottom-start","bottom-end","left-end","left-start","right-end","right-start"]),autoAlign:gl().bool,children:gl().node.isRequired,className:gl().string,defaultOpen:gl().bool,definition:gl().node.isRequired,id:gl().string,openOnHover:gl().bool,tooltipText:gA(gl().node,"The tooltipText prop has been deprecated. Please use the `definition` prop instead."),triggerClassName:gl().string};let yx={red:"Red",magenta:"Magenta",purple:"Purple",blue:"Blue",cyan:"Cyan",teal:"Teal",green:"Green",gray:"Gray","cool-gray":"Cool-Gray","warm-gray":"Warm-Gray","high-contrast":"High-Contrast",outline:"Outline"},yC=f1().forwardRef(({children:e,className:t,decorator:n,id:r,type:a,filter:o,renderIcon:i,title:s="Clear filter",disabled:l,onClose:c,size:u,as:d,slug:p,...f},m)=>{let h=gm(),g=(0,f0.useRef)(null);o&&console.warn("The `filter` prop for Tag has been deprecated and will be removed in the next major version. Use DismissibleTag instead."),c&&console.warn("The `onClose` prop for Tag has been deprecated and will be removed in the next major version. Use DismissibleTag instead.");let y=gp([m,g]),b=r||`tag-${gG()}`,[v,$]=(0,f0.useState)(!1);(0,f0.useLayoutEffect)(()=>{var e;$(!!(e=g.current?.getElementsByClassName(`${h}--tag__label`)[0])&&e?.offsetWidth<e?.scrollWidth)},[h,g]);let A=[`${h}--tag--selectable`,`${h}--tag--filter`,`${h}--tag--operational`].some(e=>t?.includes(e)),w=hZ()(`${h}--tag`,t,{[`${h}--tag--disabled`]:l,[`${h}--tag--filter`]:o,[`${h}--tag--${u}`]:u,[`${h}--layout--size-${u}`]:u,[`${h}--tag--${a}`]:a,[`${h}--tag--interactive`]:f.onClick&&!A&&v}),k=void 0!==a&&a in Object.keys(yx)?yx[a]:"",x=p??n,C=_G(x,_V)&&!A?(0,f0.cloneElement)(x,{size:"sm",kind:"inline"}):null;if(o){let t=d??"div";return f1().createElement(t,gi({className:w,id:b},f),i&&"sm"!==u?f1().createElement("div",{className:`${h}--tag__custom-icon`},f1().createElement(i,null)):"",f1().createElement(_$,{title:"string"==typeof e?e:void 0,className:`${h}--tag__label`},null!=e?e:k),C,f1().createElement("button",{type:"button",className:`${h}--tag__close-icon`,onClick:e=>{c&&(e.stopPropagation(),c(e))},disabled:l,"aria-label":s,title:s},eb||(eb=f1().createElement(_t.bm,null))))}let E=d??(f.onClick||t?.includes(`${h}--tag--operational`)?"button":"div"),D=hZ()({[`${h}--tag__label`]:!A});return f1().createElement(E,gi({ref:y,disabled:l,className:w,id:b,type:"button"===E?"button":void 0},f),i&&"sm"!==u?f1().createElement("div",{className:`${h}--tag__custom-icon`},f1().createElement(i,null)):"",v&&!A?f1().createElement(yk,{openOnHover:!1,definition:null!=e?e:k,className:`${h}--definition--tooltip--tag`},f1().createElement(_$,{title:null!=e&&"string"==typeof e?e:k,className:D},null!=e?e:k)):f1().createElement(_$,{title:null!=e&&"string"==typeof e?e:k,className:D},null!=e?e:k),p?C:n?f1().createElement("div",{className:`${h}--tag__decorator`},C):"")});yC.propTypes={as:gl().elementType,children:gl().node,className:gl().string,decorator:gl().node,disabled:gl().bool,filter:gA(gl().bool,"The `filter` prop has been deprecated and will be removed in the next major version. Use DismissibleTag instead."),id:gl().string,onClose:gA(gl().func,"The `onClose` prop has been deprecated and will be removed in the next major version. Use DismissibleTag instead."),renderIcon:gl().oneOfType([gl().func,gl().object]),size:gl().oneOf(["sm","md","lg"]),slug:gA(gl().node,"The `slug` prop has been deprecated and will be removed in the next major version. Use the decorator prop instead."),title:gA(gl().string,"The `title` prop has been deprecated and will be removed in the next major version. Use DismissibleTag instead."),type:gl().oneOf(Object.keys(yx))};var yE=n(5848);let yD=f1().forwardRef(({as:e,children:t,className:n,href:r,disabled:a=!1,inline:o=!1,visited:i=!1,renderIcon:s,size:l,target:c,...u},d)=>{let p=gm(),f={className:hZ()(`${p}--link`,n,{[`${p}--link--disabled`]:a,[`${p}--link--inline`]:o,[`${p}--link--visited`]:i,[`${p}--link--${l}`]:l}),rel:"_blank"===c?"noopener":void 0,target:c};return a?(f.role="link",f["aria-disabled"]=!0):f.href=r,f1().createElement(e??"a",gi({ref:d},f,u,{onClick:e=>{a?(e.preventDefault(),e.stopPropagation()):u.onClick&&u.onClick(e)}}),t,!o&&s&&f1().createElement("div",{className:`${p}--link__icon`},f1().createElement(s,null)))});yD.displayName="Link",yD.propTypes={as:gl().elementType,children:gl().node,className:gl().string,disabled:gl().bool,href:gl().string,inline:gl().bool,renderIcon:gl().oneOfType([gl().func,gl().object]),size:gl().oneOf(["sm","md","lg"]),visited:gl().bool};let yS=f1().forwardRef(({children:e,className:t,decorator:n,light:r=!1,slug:a,hasRoundedCorners:o=!1,...i},s)=>{let l=gm(),c=hZ()(`${l}--tile`,{[`${l}--tile--light`]:r,[`${l}--tile--slug`]:a,[`${l}--tile--slug-rounded`]:a&&o,[`${l}--tile--decorator`]:n,[`${l}--tile--decorator-rounded`]:n&&o},t);return f1().createElement("div",gi({className:c,ref:s},i),e,a,n&&f1().createElement("div",{className:`${l}--tile--inner-decorator`},n))});yS.displayName="Tile",yS.propTypes={children:gl().node,className:gl().string,decorator:gl().node,hasRoundedCorners:gl().bool,light:gA(gl().bool,"The `light` prop for `Tile` is no longer needed and has been deprecated. It will be removed in the next major release. Use the Layer component instead."),slug:gA(gl().node,"The `slug` prop for `Tile` has been deprecated in favor of the new `decorator` prop. It will be removed in the next major release.")};let yz=f1().forwardRef(({children:e,className:t,clicked:n=!1,decorator:r,disabled:a,href:o,light:i,onClick:s=()=>{},onKeyDown:l=()=>{},renderIcon:c,hasRoundedCorners:u,slug:d,...p},f)=>{let m=gm(),h=hZ()(`${m}--tile`,`${m}--tile--clickable`,{[`${m}--tile--is-clicked`]:n,[`${m}--tile--light`]:i,[`${m}--tile--slug`]:d,[`${m}--tile--slug-rounded`]:d&&u,[`${m}--tile--decorator`]:r,[`${m}--tile--decorator-rounded`]:r&&u},t),[g,y]=(0,f0.useState)(n),b=gk("enable-v12-tile-default-icons");b&&(c||(c=yE.Qp),a&&(c=_o.$D));let v=hZ()({[`${m}--tile--icon`]:!b||b&&!a,[`${m}--tile--disabled-icon`]:b&&a});return f1().createElement(yD,gi({className:h,href:o,tabIndex:o||a?void 0:0,onClick:a?void 0:function(e){e?.persist?.(),y(!g),s(e)},onKeyDown:function(e){e?.persist?.(),gT(e,[gS,gP])&&y(!g),l(e)},ref:f,disabled:a},p),d||r?f1().createElement("div",{className:`${m}--tile-content`},e):e,(!0===d||!0===r)&&f1().createElement(yE.bE,{size:"24",className:`${m}--tile--ai-label-icon`}),f1().isValidElement(r)&&f1().createElement("div",{className:`${m}--tile--inner-decorator`},r),c&&f1().createElement(c,{className:v,"aria-hidden":"true"}))});yz.displayName="ClickableTile",yz.propTypes={children:gl().node,className:gl().string,clicked:gl().bool,decorator:gl().oneOfType([gl().bool,gl().node]),disabled:gl().bool,hasRoundedCorners:gl().bool,href:gl().string,light:gA(gl().bool,"The `light` prop for `ClickableTile` is no longer needed and has been deprecated. It will be removed in the next major release. Use the Layer component instead."),onClick:gl().func,onKeyDown:gl().func,rel:gl().string,renderIcon:gl().oneOfType([gl().func,gl().object])},f1().forwardRef(({children:e,className:t,decorator:n,disabled:r,id:a,light:o,onClick:i=()=>{},onChange:s=()=>{},onKeyDown:l=()=>{},selected:c=!1,tabIndex:u=0,title:d="title",slug:p,hasRoundedCorners:f,...m},h)=>{let g=gm(),[y,b]=(0,f0.useState)(c);(0,f0.useEffect)(()=>{b(c)},[c]);let v=hZ()(`${g}--tile`,`${g}--tile--selectable`,{[`${g}--tile--is-selected`]:y,[`${g}--tile--light`]:o,[`${g}--tile--disabled`]:r,[`${g}--tile--slug`]:p,[`${g}--tile--slug-rounded`]:p&&f,[`${g}--tile--decorator`]:n,[`${g}--tile--decorator-rounded`]:n&&f},t),$=(0,f0.useCallback)((e,t)=>{b(t),s(e,t,a)},[s,a]),A=(0,f0.useRef)(null),w=p??n,k=_G(w,_V)?(0,f0.cloneElement)(w,{size:"xs",ref:A}):w;return f1().createElement("div",gi({className:v,onClick:r?void 0:function(e){e.preventDefault(),e?.persist?.(),k&&A.current&&e.target instanceof Node&&A.current.contains(e.target)||($(e,!y),i(e))},role:"checkbox","aria-checked":y,onKeyDown:r?void 0:function(e){e?.persist?.(),gT(e,[gS,gP])&&(e.preventDefault(),$(e,!y)),l(e)},tabIndex:r?void 0:u,ref:h,id:a,title:d},m),f1().createElement("span",{className:`${g}--tile__checkmark ${g}--tile__checkmark--persistent`},y?ev||(ev=f1().createElement(_t.NW,null)):e$||(e$=f1().createElement(_t.Sc,null))),f1().createElement(_$,{as:"label",htmlFor:a,className:`${g}--tile-content`},e),p?k:n?f1().createElement("div",{className:`${g}--tile--inner-decorator`},k):"")}).propTypes={children:gl().node,className:gl().string,decorator:gl().node,disabled:gl().bool,hasRoundedCorners:gl().bool,id:gl().string,light:gA(gl().bool,"The `light` prop for `SelectableTile` is no longer needed and has been deprecated. It will be removed in the next major release. Use the Layer component instead."),name:gA(gl().string,"The `name` property is no longer used. It will be removed in the next major release."),onChange:gl().func,onClick:gl().func,onKeyDown:gl().func,selected:gl().bool,slug:gA(gl().node,"The `slug` prop for `SelectableTile` has been deprecated in favor of the new `decorator` prop. It will be removed in the next major release."),tabIndex:gl().number,title:gl().string,value:gA(gl().oneOfType([gl().string,gl().number]),"The `value` property is no longer used. It will be removed in the next major release.`")};let yP=f1().forwardRef(({tabIndex:e=0,className:t,children:n,decorator:r,expanded:a=!1,tileMaxHeight:o=0,tilePadding:i=0,onClick:s,onKeyUp:l,tileCollapsedIconText:c="Interact to expand Tile",tileExpandedIconText:u="Interact to collapse Tile",tileCollapsedLabel:d,tileExpandedLabel:p,light:f,slug:m,hasRoundedCorners:h,...g},y)=>{let[b,v]=(0,f0.useState)(o),[$,A]=(0,f0.useState)(i),[w,k]=(0,f0.useState)(a),[x,C]=(0,f0.useState)(o),[E,D]=(0,f0.useState)(i),[S,z]=(0,f0.useState)(a),[P,M]=(0,f0.useState)(!0),N=(0,f0.useRef)(null),T=(0,f0.useRef)(null),O=(0,f0.useRef)(null),I=(0,f0.useRef)(null),B=(0,f0.useRef)(null),R=gp([y,B]),j=gm();function F(){S&&I.current&&v(I.current.getBoundingClientRect()?.height),N.current&&v(N.current.getBoundingClientRect().height)}function L(e){e?.persist?.(),z(!S),F()}function W(e){e.target!==B.current&&e.target!==O.current&&gT(e,[gS,gP])&&e.preventDefault()}a!==w&&(z(a),k(a),F()),o!==x&&(v(o),C(o)),i!==E&&(A(i),D(i));let V=hZ()(`${j}--tile`,`${j}--tile--expandable`,{[`${j}--tile--is-expanded`]:S,[`${j}--tile--light`]:f},t),G=hZ()(`${j}--tile`,`${j}--tile--expandable`,`${j}--tile--expandable--interactive`,{[`${j}--tile--is-expanded`]:S,[`${j}--tile--light`]:f,[`${j}--tile--slug`]:m,[`${j}--tile--slug-rounded`]:m&&h,[`${j}--tile--decorator`]:r,[`${j}--tile--decorator-rounded`]:r&&h},t),U=hZ()(`${j}--tile__chevron`,`${j}--tile__chevron--interactive`),H=f1().Children.toArray(n);gd(()=>{if(!B.current||!N.current)return;let e=window.getComputedStyle(B.current,null),{current:t}=N,{height:n}=t.getBoundingClientRect(),r=parseInt(e.getPropertyValue("padding-top"),10),a=parseInt(e.getPropertyValue("padding-bottom"),10);v(n),A(r+a)},[b]),gd(()=>{N.current&&T.current&&(gq(T.current)||gK(T.current)||gq(N.current)||gK(N.current)||m||r||M(!1))},[m,r]),gd(()=>{B.current&&(S?B.current.style.maxHeight="":B.current.style.maxHeight=b+$+"px")},[S,b,$]),(0,f0.useEffect)(()=>{if(!N.current)return;let e=new ResizeObserver(e=>{let[t]=e;v(t.contentRect.height)});return e.observe(N.current),()=>e.disconnect()},[b,$]);let q=gG("expandable-tile-interactive"),K=m??r,Z=_G(K,_V)?(0,f0.cloneElement)(K,{size:"xs"}):K;return P?f1().createElement("div",gi({ref:R,className:G},g),f1().createElement("div",{ref:I},m?Z:r?f1().createElement("div",{className:`${j}--tile--inner-decorator`},Z):"",f1().createElement("div",{ref:N,className:`${j}--tile-content`},H[0]),f1().createElement("button",{type:"button","aria-expanded":S,"aria-controls":q,onKeyUp:_b([l,W]),onClick:_b([s,L]),"aria-label":S?u:c,ref:O,className:U},eA||(eA=f1().createElement(_t.yQ,null))),f1().createElement("div",{ref:T,className:`${j}--tile-content`,id:q},H[1]))):f1().createElement("button",gi({type:"button",ref:R,className:V,"aria-expanded":S,title:S?u:c},g,{onKeyUp:_b([l,W]),onClick:_b([s,L]),tabIndex:e}),f1().createElement("div",{ref:I},f1().createElement("div",{ref:N,className:`${j}--tile-content`},H[0]),f1().createElement("div",{className:`${j}--tile__chevron`},f1().createElement("span",null,S?p:d),ew||(ew=f1().createElement(_t.yQ,null))),f1().createElement("div",{ref:T,className:`${j}--tile-content`},H[1])))});yP.propTypes={children:gl().node,className:gl().string,decorator:gl().node,expanded:gl().bool,hasRoundedCorners:gl().bool,id:gl().string,light:gA(gl().bool,"The `light` prop for `ExpandableTile` is no longer needed and has been deprecated. It will be removed in the next major release. Use the Layer component instead."),onClick:gl().func,onKeyUp:gl().func,slug:gA(gl().node,"The `slug` prop for `ExpandableTile` has been deprecated in favor of the new `decorator` prop. It will be removed in the next major release."),tabIndex:gl().number,tileCollapsedIconText:gl().string,tileCollapsedLabel:gl().string,tileExpandedIconText:gl().string,tileExpandedLabel:gl().string},yP.displayName="ExpandableTile";let yM=f1().forwardRef(({children:e},t)=>{let n=gm();return f1().createElement("div",{ref:t,className:`${n}--tile-content__above-the-fold`},e)});yM.propTypes={children:gl().node},yM.displayName="TileAboveTheFoldContent";let yN=f1().forwardRef(({children:e},t)=>{let n=gm();return f1().createElement("div",{ref:t,className:`${n}--tile-content__below-the-fold`},e)});yN.propTypes={children:gl().node},yN.displayName="TileBelowTheFoldContent";let yT=({className:e,children:t,...n})=>{let r=gm(),a=hZ()(`${r}--header`,e);return f1().createElement("header",gi({},n,{className:a}),t)};yT.propTypes={"aria-label":gl().string,"aria-labelledby":gl().string,className:gl().string};let yO=Object.keys(ep={"aria-label":gl().string,"aria-labelledby":gl().string}).reduce((e,t)=>{let n;return{...e,[t]:(n=ep[t],(e,t,r,...a)=>n(e,t,r,...a))}},{}),yI=f1().forwardRef(({"aria-label":e,"aria-labelledby":t,children:n,className:r,onClick:a,tooltipHighContrast:o=!0,tooltipDropShadow:i,isActive:s,tooltipAlignment:l,...c},u)=>{let d=gm(),p=hZ()({[r]:!!r,[`${d}--header__action`]:!0,[`${d}--header__action--active`]:s});return f1().createElement(g3,gi({},c,{"aria-label":e,"aria-labelledby":t},{className:p,onClick:a,type:"button",hasIconOnly:!0,size:"lg",kind:"ghost",iconDescription:e,tooltipPosition:"bottom",tooltipAlignment:l,tooltipDropShadow:i,tooltipHighContrast:o,ref:u}),n)});yI.propTypes={...yO,children:gl().node.isRequired,className:gl().string,isActive:gl().bool,onClick:gl().func,tooltipAlignment:gl().oneOf(["start","center","end"]),tooltipDropShadow:gl().bool,tooltipHighContrast:gl().bool},yI.displayName="HeaderGlobalAction";let yB=_J({name:"HeaderGlobalBar",className:e=>`${e}--header__global`,type:"div"});var yR=n(8742);let yj=f1().forwardRef(function({children:e,size:t=16,...n},r){return 16===t||"16"===t||"16px"===t?f1().createElement(yR.A,{width:t,height:t,ref:r,xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 16 16",fill:"currentColor",...n},ek||(ek=f1().createElement("path",{d:"M6 15L6 14 2.7 14 7 9.7 6.3 9 2 13.3 2 10 1 10 1 15zM10 1L10 2 13.3 2 9 6.3 9.7 7 14 2.7 14 6 15 6 15 1z"})),e):f1().createElement(yR.A,{width:t,height:t,ref:r,xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 32",fill:"currentColor",...n},ex||(ex=f1().createElement("path",{d:"M20 2L20 4 26.586 4 18 12.582 19.414 14 28 5.414 28 12 30 12 30 2 20 2zM14 19.416L12.592 18 4 26.586 4 20 2 20 2 30 12 30 12 28 5.414 28 14 19.416z"})),e)}),yF=f1().forwardRef(function({children:e,size:t=16,...n},r){return 16===t||"16"===t||"16px"===t?f1().createElement(yR.A,{width:t,height:t,ref:r,xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 16 16",fill:"currentColor",...n},eC||(eC=f1().createElement("path",{d:"M2 12H14V13H2zM2 9H14V10H2zM2 6H14V7H2zM2 3H14V4H2z"})),e):20===t||"20"===t||"20px"===t?f1().createElement(yR.A,{width:t,height:t,ref:r,xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",...n},eE||(eE=f1().createElement("path",{d:"M2 14.8H18V16H2zM2 11.2H18V12.399999999999999H2zM2 7.6H18V8.799999999999999H2zM2 4H18V5.2H2z"})),e):24===t||"24"===t||"24px"===t?f1().createElement(yR.A,{width:t,height:t,ref:r,xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",...n},eD||(eD=f1().createElement("path",{d:"M3 18H21V19.5H3zM3 13.5H21V15H3zM3 9H21V10.5H3zM3 4.5H21V6H3z"})),e):f1().createElement(yR.A,{width:t,height:t,ref:r,xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 32",fill:"currentColor",...n},eS||(eS=f1().createElement("path",{d:"M4 6H28V8H4zM4 24H28V26H4zM4 12H28V14H4zM4 18H28V20H4z"})),e)});function yL({"aria-label":e,"aria-labelledby":t,className:n,renderMenuIcon:r,renderCloseIcon:a,isActive:o,isCollapsible:i,...s}){let l=gm(),c=hZ()({..."string"==typeof n&&{[n]:!!n},[`${l}--header__action`]:!0,[`${l}--header__menu-trigger`]:!0,[`${l}--header__action--active`]:o,[`${l}--header__menu-toggle`]:!0,[`${l}--header__menu-toggle__hidden`]:!i}),u=r||ez||(ez=f1().createElement(yF,{size:20})),d=a||eP||(eP=f1().createElement(_t.bm,{size:20}));return f1().createElement("button",gi({},s,{"aria-label":e,"aria-labelledby":t,className:c,title:e,type:"button"}),o?d:u)}yL.propTypes={...yO,className:gl().string,isActive:gl().bool,isCollapsible:gl().bool,onClick:gl().func};let yW=f1().forwardRef(({element:e,as:t,isSideNavExpanded:n,...r},a)=>f1().createElement(t??e??"a",gi({ref:a},r))),yV={as:gl().elementType,element:gA(gl().elementType,"The `element` prop for `Link` has been deprecated. Please use `as` instead. This will be removed in the next major release."),isSideNavExpanded:gl().bool};function yG({children:e,className:t,prefix:n="IBM",...r}){let a=gm(),o=hZ()(`${a}--header__name`,t);return f1().createElement(yW,gi({},r,{className:o}),n&&f1().createElement(f1().Fragment,null,f1().createElement("span",{className:`${a}--header__name--prefix`},n),"\xa0"),e)}yW.displayName="Link",yW.propTypes=yV,yG.propTypes={...yV,children:gl().node.isRequired,className:gl().string,href:gl().string,prefix:gl().string};let yU=["SideNavFooter","SideNavHeader","SideNavItems","SideNavMenu","SideNavLink"];var yH=n(4011);let yq=(0,f0.createContext)({}),yK=f1().forwardRef(function({expanded:e,defaultExpanded:t=!1,isChildOfHeader:n=!0,"aria-label":r,"aria-labelledby":a,children:o,onToggle:i,className:s,href:l,isFixedNav:c=!1,isRail:u,isPersistent:d=!0,addFocusListeners:p=!0,addMouseListeners:f=!0,onOverlayClick:m,onSideNavBlur:h,enterDelayMs:g=100,...y},b){let v=gm(),{current:$}=(0,f0.useRef)(void 0!==e),[A,w]=gI(t),[k,x]=gI(t),C=$?e:A,E=(0,f0.useRef)(null),D=gp([E,b]),S=(e,t=!C)=>{$||w(t,g),i&&i(e,t),($||u)&&x(t,g)},z=hZ()(s,{[`${v}--side-nav`]:!0,[`${v}--side-nav--expanded`]:C||k,[`${v}--side-nav--collapsed`]:!C&&c,[`${v}--side-nav--rail`]:u,[`${v}--side-nav--ux`]:n,[`${v}--side-nav--hidden`]:!d}),P=hZ()({[`${v}--side-nav__overlay`]:!0,[`${v}--side-nav__overlay-active`]:C||k}),M=o;M=f1().Children.map(o,e=>{let t=$&&k||C;return(0,f0.isValidElement)(e)?f1().cloneElement(e,{...yU.includes(e.type?.displayName??e.type?.name)?{isSideNavExpanded:t}:{}}):e});let N={};p&&(N.onFocus=e=>{!e.currentTarget.contains(e.relatedTarget)&&u&&S(e,!0)},N.onBlur=e=>{e.currentTarget.contains(e.relatedTarget)||S(e,!1),!e.currentTarget.contains(e.relatedTarget)&&C&&!c&&h&&h()},N.onKeyDown=e=>{gO(e,gz)&&(S(e,!1),l&&(window.location.href=l))}),f&&u&&(N.onMouseEnter=()=>{S(!0,!0)},N.onMouseLeave=()=>{w(!1),x(!1),S(!1,!1)},N.onClick=()=>{w(!0),x(!0),S(!0,!0)}),gh("keydown",e=>{let t=document.activeElement;gO(e,gD)&&C&&!c&&E.current&&t?.classList.contains(`${v}--header__menu-toggle`)&&!t.closest("nav")&&E.current.focus()});let T=((e,t=!1)=>{let[n,r]=(0,f0.useState)(t);return(0,f0.useEffect)(()=>{let t=e=>{r(e.matches)},n=window.matchMedia(e);return n.addEventListener("change",t),r(n.matches),()=>{n.removeEventListener("change",t)}},[e]),n})(`(min-width: ${yH.fi.lg.width})`);return f1().createElement(yq.Provider,{value:{isRail:u}},c?null:f1().createElement("div",{className:P,onClick:m}),f1().createElement("nav",gi({tabIndex:-1,ref:D,className:`${v}--side-nav__navigation ${z}`,inert:u?void 0:!(C||T)},{"aria-label":r,"aria-labelledby":a},N,y),M))});yK.displayName="SideNav",yK.propTypes={...yO,addFocusListeners:gl().bool,addMouseListeners:gl().bool,className:gl().string,defaultExpanded:gl().bool,enterDelayMs:gl().number,expanded:gl().bool,href:gl().string,isChildOfHeader:gl().bool,isFixedNav:gl().bool,isPersistent:gl().bool,isRail:gl().bool,onOverlayClick:gl().func,onSideNavBlur:gl().func,onToggle:gl().func};let yZ={"carbon.table.batch.cancel":"cancel","carbon.table.batch.items.selected":"batchActionsItemsSelected","carbon.table.batch.item.selected":"batchActionItemSelected","carbon.table.batch.selectAll":"selectAll"},yY=e=>(0,hq.jsx)(_5,{translateWithId:(e,t)=>{let n=yZ[e];return n?i9(n,e,t):e},...e});var yJ=n(6419),yX={};yX.styleTagTransform=h7(),yX.setAttributes=h3(),yX.insert=h1().bind(null,"head"),yX.domAPI=hQ(),yX.insertStyleElement=h5(),hJ()(yJ.A,yX);let yQ=yJ.A&&yJ.A.locals?yJ.A.locals:void 0,y0=(0,f0.createContext)(null);function y1(){let e=(0,f0.useContext)(y0);if(!e)throw Error("useCustomOverflowMenu must be used within a CustomOverflowMenu");return e}function y2({menuTitle:e,children:t}){let[n,r]=f1().useState(!1),a=hh(()=>r(!1),n),o="tablet"===hu(),i=(0,f0.useCallback)(()=>r(e=>!e),[]),s=(0,f0.useRef)(null),l=(0,f0.useRef)(null),c=(0,f0.useId)(),u=`custom-overflow-menu-trigger-${c}`,d=`custom-overflow-menu-${c}`,p=(0,f0.useCallback)(()=>{r(!1),s.current?.focus()},[]),f=(0,f0.useMemo)(()=>({closeMenu:p}),[p]),m=(0,f0.useCallback)(e=>{"Escape"===e.key&&n&&(e.stopPropagation(),p())},[p,n]),h=f0.Children.toArray(t);(0,f0.useEffect)(()=>{if(n&&l.current){let e=l.current.querySelector('[role="menuitem"]:not([disabled])');e?.focus()}},[n]);let g=(0,f0.useCallback)(({currentIndex:e,direction:t})=>{let n=l.current?.querySelectorAll('[role="menuitem"]:not([disabled])');if(!n?.length)return;let r=document.activeElement?.closest?.('[role="menuitem"]')??document.activeElement,a=Array.from(n).indexOf(r);if(-1===a)return void n[t>0?0:n.length-1]?.focus();let o=a+t,i=o<0?n.length-1:o>=n.length?0:o;n[i]?.focus()},[]),y=h.map((e,t)=>(0,f0.isValidElement)(e)?(0,f0.cloneElement)(e,{closeMenu:p,handleOverflowMenuItemFocus:g,index:t}):e);return(0,hq.jsxs)("div",{"data-overflow-menu":!0,className:hZ()("cds--overflow-menu",yQ.container),ref:a,children:[(0,hq.jsx)("button",{className:hZ()("cds--btn","cds--btn--ghost","cds--overflow-menu__trigger",{"cds--overflow-menu--open":n},yQ.overflowMenuButton),"aria-controls":d,"aria-expanded":n,"aria-haspopup":"true",id:u,onClick:i,onKeyDown:m,ref:s,children:e}),(0,hq.jsxs)("div",{className:hZ()("cds--overflow-menu-options","cds--overflow-menu--flip",yQ.menu,{[yQ.show]:n}),"aria-labelledby":u,"data-floating-menu-direction":"bottom",id:d,onKeyDown:m,ref:l,role:"menu",tabIndex:-1,children:[(0,hq.jsx)("ul",{className:hZ()("cds--overflow-menu-options__content",{"cds--overflow-menu-options--lg":o}),children:(0,hq.jsx)(y0.Provider,{value:f,children:y})}),(0,hq.jsx)("span",{})]})]})}function y3(e){let t=(0,f0.useContext)(y0);return(0,hq.jsx)(yi,{...e,closeMenu:t?.closeMenu})}var y4=n(7703),y5=n(3941),y6={};y6.styleTagTransform=h7(),y6.setAttributes=h3(),y6.insert=h1().bind(null,"head"),y6.domAPI=hQ(),y6.insertStyleElement=h5(),hJ()(y5.A,y6);let y7=y5.A&&y5.A.locals?y5.A.locals:void 0,y8=["omrs-icon-activity","omrs-icon-add","omrs-icon-arrow-down","omrs-icon-arrow-left","omrs-icon-arrow-right","omrs-icon-arrow-up","omrs-icon-baby","omrs-icon-calendar-heat-map","omrs-icon-calendar","omrs-icon-caret-down","omrs-icon-caret-left","omrs-icon-caret-right","omrs-icon-caret-up","omrs-icon-chart-average","omrs-icon-chart-line","omrs-icon-checkmark-filled","omrs-icon-checkmark-outline","omrs-icon-chemistry","omrs-icon-chevron-down","omrs-icon-chevron-left","omrs-icon-chevron-right","omrs-icon-chevron-up","omrs-icon-close","omrs-icon-close-filled","omrs-icon-close-outline","omrs-icon-document","omrs-icon-document-attachment","omrs-icon-download","omrs-icon-drug-order","omrs-icon-edit","omrs-icon-event-schedule","omrs-icon-events","omrs-icon-gender-female","omrs-icon-gender-male","omrs-icon-gender-other","omrs-icon-gender-unknown","omrs-icon-generic-order-type","omrs-icon-group","omrs-icon-group-access","omrs-icon-hospital-bed","omrs-icon-image-medical","omrs-icon-information","omrs-icon-information-filled","omrs-icon-information-square","omrs-icon-inventory-management","omrs-icon-lab-order","omrs-icon-list-checked","omrs-icon-location","omrs-icon-material-order","omrs-icon-maximize","omrs-icon-medication","omrs-icon-message-queue","omrs-icon-microscope","omrs-icon-mobile-check","omrs-icon-money","omrs-icon-mother","omrs-icon-movement","omrs-icon-overflow-menu--horizontal","omrs-icon-overflow-menu--vertical","omrs-icon-password","omrs-icon-pedestrian-family","omrs-icon-pen","omrs-icon-printer","omrs-icon-procedure-order","omrs-icon-programs","omrs-icon-renew","omrs-icon-referral-order","omrs-icon-report","omrs-icon-reset","omrs-icon-save","omrs-icon-search","omrs-icon-settings","omrs-icon-shopping-cart","omrs-icon-shopping-cart--arrow-down","omrs-icon-sticky-note-add","omrs-icon-switcher","omrs-icon-syringe","omrs-icon-table-of-contents","omrs-icon-table","omrs-icon-time","omrs-icon-tools","omrs-icon-translate","omrs-icon-trash-can","omrs-icon-tree-view--alt","omrs-icon-two-factor-authentication","omrs-icon-user-avatar","omrs-icon-user-follow","omrs-icon-user-xray","omrs-icon-user","omrs-icon-view-off","omrs-icon-view","omrs-icon-warning"],y9=(0,f0.memo)((0,f0.forwardRef)(function(e,t){return(0,hq.jsx)(vN,{ref:t,icon:"omrs-icon-activity",iconProps:e})})),be=(0,f0.memo)((0,f0.forwardRef)(function(e,t){return(0,hq.jsx)(vN,{ref:t,icon:"omrs-icon-add",iconProps:e})})),bt=(0,f0.memo)((0,f0.forwardRef)(function(e,t){return(0,hq.jsx)(vN,{ref:t,icon:"omrs-icon-arrow-down",iconProps:e})})),bn=(0,f0.memo)((0,f0.forwardRef)(function(e,t){return(0,hq.jsx)(vN,{ref:t,icon:"omrs-icon-arrow-left",iconProps:e})})),br=(0,f0.memo)((0,f0.forwardRef)(function(e,t){return(0,hq.jsx)(vN,{ref:t,icon:"omrs-icon-arrow-right",iconProps:e})})),ba=(0,f0.memo)((0,f0.forwardRef)(function(e,t){return(0,hq.jsx)(vN,{ref:t,icon:"omrs-icon-arrow-up",iconProps:e})})),bo=(0,f0.memo)((0,f0.forwardRef)(function(e,t){return(0,hq.jsx)(vN,{ref:t,icon:"omrs-icon-baby",iconProps:e})})),bi=(0,f0.memo)((0,f0.forwardRef)(function(e,t){return(0,hq.jsx)(vN,{ref:t,icon:"omrs-icon-calendar-heat-map",iconProps:e})})),bs=(0,f0.memo)((0,f0.forwardRef)(function(e,t){return(0,hq.jsx)(vN,{ref:t,icon:"omrs-icon-calendar",iconProps:e})})),bl=(0,f0.memo)((0,f0.forwardRef)(function(e,t){return(0,hq.jsx)(vN,{ref:t,icon:"omrs-icon-caret-down",iconProps:e})})),bc=(0,f0.memo)((0,f0.forwardRef)(function(e,t){return(0,hq.jsx)(vN,{ref:t,icon:"omrs-icon-caret-left",iconProps:e})})),bu=(0,f0.memo)((0,f0.forwardRef)(function(e,t){return(0,hq.jsx)(vN,{ref:t,icon:"omrs-icon-caret-right",iconProps:e})})),bd=(0,f0.memo)((0,f0.forwardRef)(function(e,t){return(0,hq.jsx)(vN,{ref:t,icon:"omrs-icon-caret-up",iconProps:e})})),bp=(0,f0.memo)((0,f0.forwardRef)(function(e,t){return(0,hq.jsx)(vN,{ref:t,icon:"omrs-icon-chart-average",iconProps:e})})),bf=(0,f0.memo)((0,f0.forwardRef)(function(e,t){return(0,hq.jsx)(vN,{ref:t,icon:"omrs-icon-chart-line",iconProps:e})})),bm=(0,f0.memo)((0,f0.forwardRef)(function(e,t){return(0,hq.jsx)(vN,{ref:t,icon:"omrs-icon-checkmark-filled",iconProps:e})})),bh=(0,f0.memo)((0,f0.forwardRef)(function(e,t){return(0,hq.jsx)(vN,{ref:t,icon:"omrs-icon-checkmark-outline",iconProps:e})})),bg=(0,f0.memo)((0,f0.forwardRef)(function(e,t){return(0,hq.jsx)(vN,{ref:t,icon:"omrs-icon-chemistry",iconProps:e})})),b_=(0,f0.memo)((0,f0.forwardRef)(function(e,t){return(0,hq.jsx)(vN,{ref:t,icon:"omrs-icon-chevron-down",iconProps:e})})),by=(0,f0.memo)((0,f0.forwardRef)(function(e,t){return(0,hq.jsx)(vN,{ref:t,icon:"omrs-icon-chevron-left",iconProps:e})})),bb=(0,f0.memo)((0,f0.forwardRef)(function(e,t){return(0,hq.jsx)(vN,{ref:t,icon:"omrs-icon-chevron-right",iconProps:e})})),bv=(0,f0.memo)((0,f0.forwardRef)(function(e,t){return(0,hq.jsx)(vN,{ref:t,icon:"omrs-icon-chevron-up",iconProps:e})})),b$=(0,f0.memo)((0,f0.forwardRef)(function(e,t){return(0,hq.jsx)(vN,{ref:t,icon:"omrs-icon-close",iconProps:e})})),bA=(0,f0.memo)((0,f0.forwardRef)(function(e,t){return(0,hq.jsx)(vN,{ref:t,icon:"omrs-icon-close-filled",iconProps:e})})),bw=(0,f0.memo)((0,f0.forwardRef)(function(e,t){return(0,hq.jsx)(vN,{ref:t,icon:"omrs-icon-close-outline",iconProps:e})})),bk=(0,f0.memo)((0,f0.forwardRef)(function(e,t){return(0,hq.jsx)(vN,{ref:t,icon:"omrs-icon-document",iconProps:e})})),bx=(0,f0.memo)((0,f0.forwardRef)(function(e,t){return(0,hq.jsx)(vN,{ref:t,icon:"omrs-icon-document-attachment",iconProps:e})})),bC=(0,f0.memo)((0,f0.forwardRef)(function(e,t){return(0,hq.jsx)(vN,{ref:t,icon:"omrs-icon-download",iconProps:e})})),bE=(0,f0.memo)((0,f0.forwardRef)(function(e,t){return(0,hq.jsx)(vN,{ref:t,icon:"omrs-icon-drug-order",iconProps:e})})),bD=(0,f0.memo)((0,f0.forwardRef)(function(e,t){return(0,hq.jsx)(vN,{ref:t,icon:"omrs-icon-edit",iconProps:e})})),bS=(0,f0.memo)((0,f0.forwardRef)(function(e,t){return(0,hq.jsx)(vN,{ref:t,icon:"omrs-icon-event-schedule",iconProps:e})})),bz=(0,f0.memo)((0,f0.forwardRef)(function(e,t){return(0,hq.jsx)(vN,{ref:t,icon:"omrs-icon-events",iconProps:e})})),bP=(0,f0.memo)((0,f0.forwardRef)(function(e,t){return(0,hq.jsx)(vN,{ref:t,icon:"omrs-icon-gender-female",iconProps:e})})),bM=(0,f0.memo)((0,f0.forwardRef)(function(e,t){return(0,hq.jsx)(vN,{ref:t,icon:"omrs-icon-gender-male",iconProps:e})})),bN=(0,f0.memo)((0,f0.forwardRef)(function(e,t){return(0,hq.jsx)(vN,{ref:t,icon:"omrs-icon-gender-other",iconProps:e})})),bT=(0,f0.memo)((0,f0.forwardRef)(function(e,t){return(0,hq.jsx)(vN,{ref:t,icon:"omrs-icon-gender-unknown",iconProps:e})})),bO=(0,f0.memo)((0,f0.forwardRef)(function(e,t){return(0,hq.jsx)(vN,{ref:t,icon:"omrs-icon-generic-order-type",iconProps:e})})),bI=(0,f0.memo)((0,f0.forwardRef)(function(e,t){return(0,hq.jsx)(vN,{ref:t,icon:"omrs-icon-group",iconProps:e})})),bB=(0,f0.memo)((0,f0.forwardRef)(function(e,t){return(0,hq.jsx)(vN,{ref:t,icon:"omrs-icon-group-access",iconProps:e})})),bR=(0,f0.memo)((0,f0.forwardRef)(function(e,t){return(0,hq.jsx)(vN,{ref:t,icon:"omrs-icon-hospital-bed",iconProps:e})})),bj=(0,f0.memo)((0,f0.forwardRef)(function(e,t){return(0,hq.jsx)(vN,{ref:t,icon:"omrs-icon-image-medical",iconProps:e})})),bF=(0,f0.memo)((0,f0.forwardRef)(function(e,t){return(0,hq.jsx)(vN,{ref:t,icon:"omrs-icon-information",iconProps:e})})),bL=(0,f0.memo)((0,f0.forwardRef)(function(e,t){return(0,hq.jsx)(vN,{ref:t,icon:"omrs-icon-information-filled",iconProps:e})})),bW=(0,f0.memo)((0,f0.forwardRef)(function(e,t){return(0,hq.jsx)(vN,{ref:t,icon:"omrs-icon-information-square",iconProps:e})})),bV=(0,f0.memo)((0,f0.forwardRef)(function(e,t){return(0,hq.jsx)(vN,{ref:t,icon:"omrs-icon-inventory-management",iconProps:e})})),bG=(0,f0.memo)((0,f0.forwardRef)(function(e,t){return(0,hq.jsx)(vN,{ref:t,icon:"omrs-icon-lab-order",iconProps:e})})),bU=(0,f0.memo)((0,f0.forwardRef)(function(e,t){return(0,hq.jsx)(vN,{ref:t,icon:"omrs-icon-list-checked",iconProps:e})})),bH=(0,f0.memo)((0,f0.forwardRef)(function(e,t){return(0,hq.jsx)(vN,{ref:t,icon:"omrs-icon-location",iconProps:e})})),bq=(0,f0.memo)((0,f0.forwardRef)(function(e,t){return(0,hq.jsx)(vN,{ref:t,icon:"omrs-icon-material-order",iconProps:e})})),bK=(0,f0.memo)((0,f0.forwardRef)(function(e,t){return(0,hq.jsx)(vN,{ref:t,icon:"omrs-icon-maximize",iconProps:e})})),bZ=(0,f0.memo)((0,f0.forwardRef)(function(e,t){return(0,hq.jsx)(vN,{ref:t,icon:"omrs-icon-medication",iconProps:e})})),bY=(0,f0.memo)((0,f0.forwardRef)(function(e,t){return(0,hq.jsx)(vN,{ref:t,icon:"omrs-icon-message-queue",iconProps:e})})),bJ=(0,f0.memo)((0,f0.forwardRef)(function(e,t){return(0,hq.jsx)(vN,{ref:t,icon:"omrs-icon-microscope",iconProps:e})})),bX=(0,f0.memo)((0,f0.forwardRef)(function(e,t){return(0,hq.jsx)(vN,{ref:t,icon:"omrs-icon-mobile-check",iconProps:e})})),bQ=(0,f0.memo)((0,f0.forwardRef)(function(e,t){return(0,hq.jsx)(vN,{ref:t,icon:"omrs-icon-money",iconProps:e})})),b0=(0,f0.memo)((0,f0.forwardRef)(function(e,t){return(0,hq.jsx)(vN,{ref:t,icon:"omrs-icon-mother",iconProps:e})})),b1=(0,f0.memo)((0,f0.forwardRef)(function(e,t){return(0,hq.jsx)(vN,{ref:t,icon:"omrs-icon-movement",iconProps:e})})),b2=(0,f0.memo)((0,f0.forwardRef)(function(e,t){return(0,hq.jsx)(vN,{ref:t,icon:"omrs-icon-overflow-menu--horizontal",iconProps:e})})),b3=(0,f0.memo)((0,f0.forwardRef)(function(e,t){return(0,hq.jsx)(vN,{ref:t,icon:"omrs-icon-overflow-menu--horizontal",iconProps:e})})),b4=(0,f0.memo)((0,f0.forwardRef)(function(e,t){return(0,hq.jsx)(vN,{ref:t,icon:"omrs-icon-password",iconProps:e})})),b5=(0,f0.memo)((0,f0.forwardRef)(function(e,t){return(0,hq.jsx)(vN,{ref:t,icon:"omrs-icon-pedestrian-family",iconProps:e})})),b6=(0,f0.memo)((0,f0.forwardRef)(function(e,t){return(0,hq.jsx)(vN,{ref:t,icon:"omrs-icon-pen",iconProps:e})})),b7=(0,f0.memo)((0,f0.forwardRef)(function(e,t){return(0,hq.jsx)(vN,{ref:t,icon:"omrs-icon-printer",iconProps:e})})),b8=(0,f0.memo)((0,f0.forwardRef)(function(e,t){return(0,hq.jsx)(vN,{ref:t,icon:"omrs-icon-procedure-order",iconProps:e})})),b9=(0,f0.memo)((0,f0.forwardRef)(function(e,t){return(0,hq.jsx)(vN,{ref:t,icon:"omrs-icon-programs",iconProps:e})})),ve=(0,f0.memo)((0,f0.forwardRef)(function(e,t){return(0,hq.jsx)(vN,{ref:t,icon:"omrs-icon-referral-order",iconProps:e})})),vt=(0,f0.memo)((0,f0.forwardRef)(function(e,t){return(0,hq.jsx)(vN,{ref:t,icon:"omrs-icon-renew",iconProps:e})})),vn=(0,f0.memo)((0,f0.forwardRef)(function(e,t){return(0,hq.jsx)(vN,{ref:t,icon:"omrs-icon-report",iconProps:e})})),vr=(0,f0.memo)((0,f0.forwardRef)(function(e,t){return(0,hq.jsx)(vN,{ref:t,icon:"omrs-icon-reset",iconProps:e})})),va=(0,f0.memo)((0,f0.forwardRef)(function(e,t){return(0,hq.jsx)(vN,{ref:t,icon:"omrs-icon-save",iconProps:e})})),vo=(0,f0.memo)((0,f0.forwardRef)(function(e,t){return(0,hq.jsx)(vN,{ref:t,icon:"omrs-icon-search",iconProps:e})})),vi=(0,f0.memo)((0,f0.forwardRef)(function(e,t){return(0,hq.jsx)(vN,{ref:t,icon:"omrs-icon-settings",iconProps:e})})),vs=(0,f0.memo)((0,f0.forwardRef)(function(e,t){return(0,hq.jsx)(vN,{ref:t,icon:"omrs-icon-switcher",iconProps:e})})),vl=(0,f0.memo)((0,f0.forwardRef)(function(e,t){return(0,hq.jsx)(vN,{ref:t,icon:"omrs-icon-shopping-cart",iconProps:e})})),vc=(0,f0.memo)((0,f0.forwardRef)(function(e,t){return(0,hq.jsx)(vN,{ref:t,icon:"omrs-icon-shopping-cart--arrow-down",iconProps:e})})),vu=(0,f0.memo)((0,f0.forwardRef)(function(e,t){return(0,hq.jsx)(vN,{ref:t,icon:"omrs-icon-sticky-note-add",iconProps:e})})),vd=(0,f0.memo)((0,f0.forwardRef)(function(e,t){return(0,hq.jsx)(vN,{ref:t,icon:"omrs-icon-syringe",iconProps:e})})),vp=(0,f0.memo)((0,f0.forwardRef)(function(e,t){return(0,hq.jsx)(vN,{ref:t,icon:"omrs-icon-table-of-contents",iconProps:e})})),vf=(0,f0.memo)((0,f0.forwardRef)(function(e,t){return(0,hq.jsx)(vN,{ref:t,icon:"omrs-icon-table",iconProps:e})})),vm=(0,f0.memo)((0,f0.forwardRef)(function(e,t){return(0,hq.jsx)(vN,{ref:t,icon:"omrs-icon-time",iconProps:e})})),vh=(0,f0.memo)((0,f0.forwardRef)(function(e,t){return(0,hq.jsx)(vN,{ref:t,icon:"omrs-icon-tools",iconProps:e})})),vg=(0,f0.memo)((0,f0.forwardRef)(function(e,t){return(0,hq.jsx)(vN,{ref:t,icon:"omrs-icon-translate",iconProps:e})})),v_=(0,f0.memo)((0,f0.forwardRef)(function(e,t){return(0,hq.jsx)(vN,{ref:t,icon:"omrs-icon-trash-can",iconProps:e})})),vy=(0,f0.memo)((0,f0.forwardRef)(function(e,t){return(0,hq.jsx)(vN,{ref:t,icon:"omrs-icon-tree-view--alt",iconProps:e})})),vb=(0,f0.memo)((0,f0.forwardRef)(function(e,t){return(0,hq.jsx)(vN,{ref:t,icon:"omrs-icon-two-factor-authentication",iconProps:e})})),vv=(0,f0.memo)((0,f0.forwardRef)(function(e,t){return(0,hq.jsx)(vN,{ref:t,icon:"omrs-icon-user-avatar",iconProps:e})})),v$=(0,f0.memo)((0,f0.forwardRef)(function(e,t){return(0,hq.jsx)(vN,{ref:t,icon:"omrs-icon-user-follow",iconProps:e})})),vA=(0,f0.memo)((0,f0.forwardRef)(function(e,t){return(0,hq.jsx)(vN,{ref:t,icon:"omrs-icon-user-xray",iconProps:e})})),vw=(0,f0.memo)((0,f0.forwardRef)(function(e,t){return(0,hq.jsx)(vN,{ref:t,icon:"omrs-icon-user",iconProps:e})})),vk=(0,f0.memo)((0,f0.forwardRef)(function(e,t){return(0,hq.jsx)(vN,{ref:t,icon:"omrs-icon-view-off",iconProps:e})})),vx=(0,f0.memo)((0,f0.forwardRef)(function(e,t){return(0,hq.jsx)(vN,{ref:t,icon:"omrs-icon-view",iconProps:e})})),vC=(0,f0.memo)((0,f0.forwardRef)(function(e,t){return(0,hq.jsx)(vN,{ref:t,icon:"omrs-icon-warning",iconProps:e})})),vE=vC,vD=bx,vS=bU,vz=bj,vP=vc,vM=(0,f0.memo)((0,f0.forwardRef)(function({icon:e,fallback:t,...n},r){let a=(0,f0.useRef)(e?document.getElementById(e):void 0);return(0,f0.useEffect)(()=>{let t=document.getElementById("omrs-svgs-container"),n=new MutationObserver(t=>{for(let n of t)"childList"===n.type&&(a.current=e?document.getElementById(e):void 0)});return t&&n.observe(t,{childList:!0}),()=>n.disconnect()},[e]),(0,hq.jsx)(mR,{value:a.current,fallback:t,children:(0,hq.jsx)(vN,{ref:r,icon:e,iconProps:n})})})),vN=(0,f0.memo)((0,f0.forwardRef)(function({icon:e,iconProps:t},n){let{className:r,fill:a,size:o}=Object.assign({},{fill:"currentColor",size:20},t);(o<=0||o>72)&&(console.error(`Invalid size '${o}' specified for ${e}. Defaulting to 20.`),o=20);let i=(0,f0.useRef)(null);return(0,f0.useImperativeHandle)(n,()=>i.current),(0,f0.useEffect)(()=>{i.current&&"currentColor"!==a&&i.current.style.setProperty("--omrs-icon-fill",a)},[]),(0,hq.jsx)("svg",{ref:i,className:hZ()("omrs-icon",y7.icon,r),height:o,width:o,viewBox:"0 0 16 16",children:(0,hq.jsx)("use",{href:`#${e}`})})}));var vT=n(7241),vO={};vO.styleTagTransform=h7(),vO.setAttributes=h3(),vO.insert=h1().bind(null,"head"),vO.domAPI=hQ(),vO.insertStyleElement=h5(),hJ()(vT.A,vO);let vI=vT.A&&vT.A.locals?vT.A.locals:void 0,vB=({path:e,title:t,basePath:n,icon:r})=>{let{t:a}=(0,mb.useTranslation)(),o=(0,y4.useLocation)(),i=(0,f0.useMemo)(()=>{if(!e)return!1;let t=e.startsWith("/")?e.slice(1):e;if(t.startsWith("http"))return t===window.location.href;let n=t.split("/").map(e=>decodeURIComponent(e)),r=(o.pathname??"").split("/").slice(1).map(e=>decodeURIComponent(e));return r.some((e,t)=>n.every((e,n)=>r[t+n]===e))},[o.pathname,e]);return(0,hq.jsx)("div",{children:(0,hq.jsx)(f3,{className:hZ()("cds--side-nav__link",{"active-left-nav-link":i}),to:`${n}/${encodeURIComponent(e)}`,children:(0,hq.jsxs)("span",{className:vI.menu,children:[(0,hq.jsx)(vM,{icon:r,className:vI.icon,size:16}),(0,hq.jsx)("span",{children:a(t)})]})})},e)};function vR(e){return function({basePath:t}){return(0,hq.jsx)(y4.BrowserRouter,{children:(0,hq.jsx)(vB,{basePath:t,...e})})}}function vj(e){let t=(0,f0.useRef)(null),n=(0,f0.useRef)(void 0),r=(0,f0.useCallback)(t=>{if("function"==typeof e){let n=e(t);return()=>{"function"==typeof n?n():e(null)}}if(e)return e.current=t,()=>{e.current=null}},[e]);return(0,f0.useMemo)(()=>({get current(){return t.current},set current(value){t.current=value,n.current&&(n.current(),n.current=void 0),null!=value&&(n.current=r(value))}}),[r])}function vF(e,t){if("function"==typeof e)return e(t);null!=e&&(e.current=t)}function vL(...e){return(...t)=>{for(let n of e)"function"==typeof n&&n(...t)}}let vW="u">typeof document?f1().useLayoutEffect:()=>{};function vV(e){let t=(0,f0.useRef)(null);return vW(()=>{t.current=e},[e]),(0,f0.useCallback)((...e)=>{let n=t.current;return null==n?void 0:n(...e)},[])}let vG={prefix:String(Math.round(1e10*Math.random())),current:0},vU=f1().createContext(vG),vH=f1().createContext(!1),vq=("u">typeof window&&window.document&&window.document.createElement,new WeakMap),vK="function"==typeof f1().useId?function(e){let t=f1().useId(),[n]=(0,f0.useState)(vX()),r=n?"react-aria":`react-aria${vG.prefix}`;return e||`${r}-${t}`}:function(e){let t=(0,f0.useContext)(vU),n=function(e=!1){let t=(0,f0.useContext)(vU),n=(0,f0.useRef)(null);if(null===n.current&&!e){var r,a;let e=null==(a=f1().__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED)||null==(r=a.ReactCurrentOwner)?void 0:r.current;if(e){let n=vq.get(e);null==n?vq.set(e,{id:t.current,state:e.memoizedState}):e.memoizedState!==n.state&&(t.current=n.id,vq.delete(e))}n.current=++t.current}return n.current}(!!e),r=`react-aria${t.prefix}`;return e||`${r}-${n}`};function vZ(){return!1}function vY(){return!0}function vJ(e){return()=>{}}function vX(){return"function"==typeof f1().useSyncExternalStore?f1().useSyncExternalStore(vJ,vZ,vY):(0,f0.useContext)(vH)}let vQ=!!("u">typeof window&&window.document&&window.document.createElement),v0=new Map;function v1(e){let[t,n]=(0,f0.useState)(e),r=(0,f0.useRef)(null),a=vK(t),o=(0,f0.useRef)(null);if(s&&s.register(o,a),vQ){let e=v0.get(a);e&&!e.includes(r)?e.push(r):v0.set(a,[r])}return vW(()=>()=>{s&&s.unregister(o),v0.delete(a)},[a]),(0,f0.useEffect)(()=>{let e=r.current;return e&&n(e),()=>{e&&(r.current=null)}}),a}function v2(e=[]){let t=v1(),[n,r]=function(e){let[t,n]=(0,f0.useState)(e),r=(0,f0.useRef)(null),a=vV(()=>{if(!r.current)return;let e=r.current.next();if(e.done){r.current=null;return}t===e.value?a():n(e.value)});vW(()=>{r.current&&a()});let o=vV(e=>{r.current=e(t),a()});return[t,o]}(t),a=(0,f0.useCallback)(()=>{r(function*(){yield t,yield document.getElementById(t)?t:void 0})},[t,r]);return vW(a,[t,a,...e]),n}"u">typeof FinalizationRegistry&&(s=new FinalizationRegistry(e=>{v0.delete(e)}));let v3=function(){for(var e,t,n=0,r="",a=arguments.length;n<a;n++)(e=arguments[n])&&(t=function e(t){var n,r,a="";if("string"==typeof t||"number"==typeof t)a+=t;else if("object"==typeof t)if(Array.isArray(t)){var o=t.length;for(n=0;n<o;n++)t[n]&&(r=e(t[n]))&&(a&&(a+=" "),a+=r)}else for(r in t)t[r]&&(a&&(a+=" "),a+=r);return a}(e))&&(r&&(r+=" "),r+=t);return r};function v4(...e){let t={...e[0]};for(let n=1;n<e.length;n++){let r=e[n];for(let e in r){let n=t[e],a=r[e];"function"==typeof n&&"function"==typeof a&&"o"===e[0]&&"n"===e[1]&&e.charCodeAt(2)>=65&&90>=e.charCodeAt(2)?t[e]=vL(n,a):("className"===e||"UNSAFE_className"===e)&&"string"==typeof n&&"string"==typeof a?t[e]=v3(n,a):"id"===e&&n&&a?t.id=function(e,t){if(e===t)return e;let n=v0.get(e);if(n)return n.forEach(e=>e.current=t),t;let r=v0.get(t);return r?(r.forEach(t=>t.current=e),e):t}(n,a):t[e]=void 0!==a?a:n}}return t}let v5=Symbol("default");function v6({values:e,children:t}){for(let[n,r]of e)t=f1().createElement(n.Provider,{value:r},t);return t}function v7(e){let{className:t,style:n,children:r,defaultClassName:a,defaultChildren:o,defaultStyle:i,values:s}=e;return(0,f0.useMemo)(()=>{let e,l,c;return e="function"==typeof t?t({...s,defaultClassName:a}):t,l="function"==typeof n?n({...s,defaultStyle:i||{}}):n,c="function"==typeof r?r({...s,defaultChildren:o}):null==r?o:r,{className:null!=e?e:a,style:l||i?{...i,...l}:void 0,children:null!=c?c:o,"data-rac":""}},[t,n,r,a,o,i,s])}function v8(e,t){let n=(0,f0.useContext)(e);if(null===t)return null;if(n&&"object"==typeof n&&"slots"in n&&n.slots){let e=t||v5;if(!n.slots[e]){let e=new Intl.ListFormat().format(Object.keys(n.slots).map(e=>`"${e}"`)),r=t?`Invalid slot "${t}".`:"A slot prop is required.";throw Error(`${r} Valid slot names are ${e}.`)}return n.slots[e]}return n}function v9(e,t,n){let{ref:r,...a}=v8(n,e.slot)||{},o=vj((0,f0.useMemo)(()=>(function(...e){return 1===e.length&&e[0]?e[0]:t=>{let n=!1,r=e.map(e=>{let r=vF(e,t);return n||(n="function"==typeof r),r});if(n)return()=>{r.forEach((t,n)=>{"function"==typeof t?t():vF(e[n],null)})}}})(t,r),[t,r])),i=v4(a,e);return"style"in a&&a.style&&"style"in e&&e.style&&("function"==typeof a.style||"function"==typeof e.style?i.style=t=>{let n="function"==typeof a.style?a.style(t):a.style,r={...t.defaultStyle,...n},o="function"==typeof e.style?e.style({...t,defaultStyle:r}):e.style;return{...r,...o}}:i.style={...a.style,...e.style}),[i,o]}function $e(e=!0){let[t,n]=(0,f0.useState)(e),r=(0,f0.useRef)(!1),a=(0,f0.useCallback)(e=>{r.current=!0,n(!!e)},[]);return vW(()=>{r.current||n(!1)},[]),[a,t]}function $t(e){let t=/^(data-.*)$/,n={};for(let r in e)t.test(r)||(n[r]=e[r]);return n}let $n=(0,f0.createContext)(null),$r=null;function $a(e,t="assertive",n=7e3){$r?$r.announce(e,t,n):($r=new $o,("boolean"==typeof IS_REACT_ACT_ENVIRONMENT?IS_REACT_ACT_ENVIRONMENT:"u">typeof jest)?$r.announce(e,t,n):setTimeout(()=>{(null==$r?void 0:$r.isAttached())&&(null==$r||$r.announce(e,t,n))},100))}class $o{isAttached(){var e;return null==(e=this.node)?void 0:e.isConnected}createLog(e){let t=document.createElement("div");return t.setAttribute("role","log"),t.setAttribute("aria-live",e),t.setAttribute("aria-relevant","additions"),t}destroy(){this.node&&(document.body.removeChild(this.node),this.node=null)}announce(e,t="assertive",n=7e3){var r,a;if(!this.node)return;let o=document.createElement("div");"object"==typeof e?(o.setAttribute("role","img"),o.setAttribute("aria-labelledby",e["aria-labelledby"])):o.textContent=e,"assertive"===t?null==(r=this.assertiveLog)||r.appendChild(o):null==(a=this.politeLog)||a.appendChild(o),""!==e&&setTimeout(()=>{o.remove()},n)}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 $i=new Set(["id"]),$s=new Set(["aria-label","aria-labelledby","aria-describedby","aria-details"]),$l=new Set(["href","hrefLang","target","rel","download","ping","referrerPolicy"]),$c=/^(data-.*)$/;function $u(e,t={}){let{labelable:n,isLink:r,propNames:a}=t,o={};for(let t in e)Object.prototype.hasOwnProperty.call(e,t)&&($i.has(t)||n&&$s.has(t)||r&&$l.has(t)||(null==a?void 0:a.has(t))||$c.test(t))&&(o[t]=e[t]);return o}let $d=["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"])'],$p=$d.join(":not([hidden]),")+",[tabindex]:not([disabled]):not([hidden])";$d.push('[tabindex]:not([tabindex="-1"]):not([disabled])');let $f=$d.join(':not([hidden]):not([tabindex="-1"]),');function $m(e){return e.matches($p)}function $h(e){return e.matches($f)}let $g=e=>{var t;return null!=(t=null==e?void 0:e.ownerDocument)?t:document},$_=e=>e&&"window"in e&&e.window===e?e:$g(e).defaultView||window;function $y(e){if(function(){if(null==$b){$b=!1;try{document.createElement("div").focus({get preventScroll(){return $b=!0,!0}})}catch{}}return $b}())e.focus({preventScroll:!0});else{let t=function(e){let t=e.parentNode,n=[],r=document.scrollingElement||document.documentElement;for(;t instanceof HTMLElement&&t!==r;)(t.offsetHeight<t.scrollHeight||t.offsetWidth<t.scrollWidth)&&n.push({element:t,scrollTop:t.scrollTop,scrollLeft:t.scrollLeft}),t=t.parentNode;return r instanceof HTMLElement&&n.push({element:r,scrollTop:r.scrollTop,scrollLeft:r.scrollLeft}),n}(e);e.focus(),function(e){for(let{element:t,scrollTop:n,scrollLeft:r}of e)t.scrollTop=n,t.scrollLeft=r}(t)}}let $b=null;function $v(e){return e.nativeEvent=e,e.isDefaultPrevented=()=>e.defaultPrevented,e.isPropagationStopped=()=>e.cancelBubble,e.persist=()=>{},e}function $$(e,t){Object.defineProperty(e,"target",{value:t}),Object.defineProperty(e,"currentTarget",{value:t})}function $A(e){let t=(0,f0.useRef)({isFocused:!1,observer:null});vW(()=>{let e=t.current;return()=>{e.observer&&(e.observer.disconnect(),e.observer=null)}},[]);let n=vV(t=>{null==e||e(t)});return(0,f0.useCallback)(e=>{if(e.target instanceof HTMLButtonElement||e.target instanceof HTMLInputElement||e.target instanceof HTMLTextAreaElement||e.target instanceof HTMLSelectElement){t.current.isFocused=!0;let r=e.target;r.addEventListener("focusout",e=>{t.current.isFocused=!1,r.disabled&&n($v(e)),t.current.observer&&(t.current.observer.disconnect(),t.current.observer=null)},{once:!0}),t.current.observer=new MutationObserver(()=>{if(t.current.isFocused&&r.disabled){var e;null==(e=t.current.observer)||e.disconnect();let n=r===document.activeElement?null:document.activeElement;r.dispatchEvent(new FocusEvent("blur",{relatedTarget:n})),r.dispatchEvent(new FocusEvent("focusout",{bubbles:!0,relatedTarget:n}))}}),t.current.observer.observe(r,{attributes:!0,attributeFilter:["disabled"]})}},[n])}let $w=!1;function $k(e){var t;return!("u"<typeof window)&&null!=window.navigator&&((null==(t=window.navigator.userAgentData)?void 0:t.brands.some(t=>e.test(t.brand)))||e.test(window.navigator.userAgent))}function $x(e){var t;return"u">typeof window&&null!=window.navigator&&e.test((null==(t=window.navigator.userAgentData)?void 0:t.platform)||window.navigator.platform)}function $C(e){let t=null;return()=>(null==t&&(t=e()),t)}let $E=$C(function(){return $x(/^Mac/i)}),$D=$C(function(){return $x(/^iPhone/i)}),$S=$C(function(){return $x(/^iPad/i)||$E()&&navigator.maxTouchPoints>1}),$z=$C(function(){return $D()||$S()});$C(function(){return $E()||$z()});let $P=$C(function(){return $k(/AppleWebKit/i)&&!$M()}),$M=$C(function(){return $k(/Chrome/i)}),$N=$C(function(){return $k(/Android/i)}),$T=$C(function(){return $k(/Firefox/i)}),$O=new Map,$I=new Set;function $B(){if("u"<typeof window)return;function e(e){return"propertyName"in e}let t=n=>{if(!e(n)||!n.target)return;let r=$O.get(n.target);if(r&&(r.delete(n.propertyName),0===r.size&&(n.target.removeEventListener("transitioncancel",t),$O.delete(n.target)),0===$O.size)){for(let e of $I)e();$I.clear()}};document.body.addEventListener("transitionrun",n=>{if(!e(n)||!n.target)return;let r=$O.get(n.target);r||(r=new Set,$O.set(n.target,r),n.target.addEventListener("transitioncancel",t,{once:!0})),r.add(n.propertyName)}),document.body.addEventListener("transitionend",t)}function $R(e){requestAnimationFrame(()=>{for(let[e]of $O)"isConnected"in e&&!e.isConnected&&$O.delete(e);0===$O.size?e():$I.add(e)})}"u">typeof document&&("loading"!==document.readyState?$B():document.addEventListener("DOMContentLoaded",$B));let $j="default",$F="",$L=new WeakMap;function $W(e){if($z())"disabled"===$j&&($j="restoring",setTimeout(()=>{$R(()=>{if("restoring"===$j){let t=$g(e);"none"===t.documentElement.style.webkitUserSelect&&(t.documentElement.style.webkitUserSelect=$F||""),$F="",$j="default"}})},300));else if((e instanceof HTMLElement||e instanceof SVGElement)&&e&&$L.has(e)){let t=$L.get(e),n="userSelect"in e.style?"userSelect":"webkitUserSelect";"none"===e.style[n]&&(e.style[n]=t),""===e.getAttribute("style")&&e.removeAttribute("style"),$L.delete(e)}}let $V=f1().createContext({register:()=>{}});function $G(e,t,n){if(!t.has(e))throw TypeError("attempted to "+n+" private field on non-instance");return t.get(e)}function $U(e,t,n){var r=$G(e,t,"set");if(r.set)r.set.call(e,n);else{if(!r.writable)throw TypeError("attempted to set read only private field");r.value=n}return n}function $H(e,t){vW(()=>{if(e&&e.ref&&t)return e.ref.current=t.current,()=>{e.ref&&(e.ref.current=null)}})}function $q(){let e=(0,f0.useRef)(new Map),t=(0,f0.useCallback)((t,n,r,a)=>{let o=(null==a?void 0:a.once)?(...t)=>{e.current.delete(r),r(...t)}:r;e.current.set(r,{type:n,eventTarget:t,fn:o,options:a}),t.addEventListener(n,o,a)},[]),n=(0,f0.useCallback)((t,n,r,a)=>{var o;let i=(null==(o=e.current.get(r))?void 0:o.fn)||r;t.removeEventListener(n,i,a),e.current.delete(r)},[]),r=(0,f0.useCallback)(()=>{e.current.forEach((e,t)=>{n(e.eventTarget,e.type,t,e.options)})},[n]);return(0,f0.useEffect)(()=>r,[r]),{addGlobalListener:t,removeGlobalListener:n,removeAllGlobalListeners:r}}$V.displayName="PressResponderContext";function $K(e,t){return!!t&&!!e&&e.contains(t)}function $Z(e){return e.target}function $Y(e,t,n=!0){var r,a;let{metaKey:o,ctrlKey:i,altKey:s,shiftKey:l}=t;$T()&&(null==(a=window.event)||null==(r=a.type)?void 0:r.startsWith("key"))&&"_blank"===e.target&&($E()?o=!0:i=!0);let c=$P()&&$E()&&!$S()&&1?new KeyboardEvent("keydown",{keyIdentifier:"Enter",metaKey:o,ctrlKey:i,altKey:s,shiftKey:l}):new MouseEvent("click",{metaKey:o,ctrlKey:i,altKey:s,shiftKey:l,bubbles:!0,cancelable:!0});$Y.isOpening=n,$y(e),e.dispatchEvent(c),$Y.isOpening=!1}function $J(e){return 0===e.mozInputSource&&!!e.isTrusted||($N()&&e.pointerType?"click"===e.type&&1===e.buttons:0===e.detail&&!e.pointerType)}$Y.isOpening=!1;var $X=n(3144),$Q=new WeakMap;class $0{continuePropagation(){$U(this,$Q,!1)}get shouldStopPropagation(){var e;return e=$G(this,$Q,"get"),e.get?e.get.call(this):e.value}constructor(e,t,n,r){var a;!function(e,t,n){if(t.has(e))throw TypeError("Cannot initialize the same private elements twice on an object");t.set(e,n)}(this,$Q,{writable:!0,value:void 0}),$U(this,$Q,!0);let o=null!=(a=null==r?void 0:r.target)?a:n.currentTarget;const i=null==o?void 0:o.getBoundingClientRect();let s,l=0,c,u=null;null!=n.clientX&&null!=n.clientY&&(c=n.clientX,u=n.clientY),i&&(null!=c&&null!=u?(s=c-i.left,l=u-i.top):(s=i.width/2,l=i.height/2)),this.type=e,this.pointerType=t,this.target=n.currentTarget,this.shiftKey=n.shiftKey,this.metaKey=n.metaKey,this.ctrlKey=n.ctrlKey,this.altKey=n.altKey,this.x=s,this.y=l}}let $1=Symbol("linkClicked"),$2="react-aria-pressable-style",$3="data-react-aria-pressable";function $4(e){let{onPress:t,onPressChange:n,onPressStart:r,onPressEnd:a,onPressUp:o,onClick:i,isDisabled:s,isPressed:l,preventFocusOnPress:c,shouldCancelOnPointerExit:u,allowTextSelectionOnPress:d,ref:p,...f}=function(e){let t=(0,f0.useContext)($V);if(t){let{register:n,...r}=t;e=v4(r,e),n()}return $H(t,e.ref),e}(e),[m,h]=(0,f0.useState)(!1),g=(0,f0.useRef)({isPressed:!1,ignoreEmulatedMouseEvents:!1,didFirePressStart:!1,isTriggeringEvent:!1,activePointerId:null,target:null,isOverTarget:!1,pointerType:null,disposables:[]}),{addGlobalListener:y,removeAllGlobalListeners:b}=$q(),v=vV((e,t)=>{let a=g.current;if(s||a.didFirePressStart)return!1;let o=!0;if(a.isTriggeringEvent=!0,r){let n=new $0("pressstart",t,e);r(n),o=n.shouldStopPropagation}return n&&n(!0),a.isTriggeringEvent=!1,a.didFirePressStart=!0,h(!0),o}),$=vV((e,r,o=!0)=>{let i=g.current;if(!i.didFirePressStart)return!1;i.didFirePressStart=!1,i.isTriggeringEvent=!0;let l=!0;if(a){let t=new $0("pressend",r,e);a(t),l=t.shouldStopPropagation}if(n&&n(!1),h(!1),t&&o&&!s){let n=new $0("press",r,e);t(n),l&&(l=n.shouldStopPropagation)}return i.isTriggeringEvent=!1,l}),A=vV((e,t)=>{let n=g.current;if(s)return!1;if(o){n.isTriggeringEvent=!0;let r=new $0("pressup",t,e);return o(r),n.isTriggeringEvent=!1,r.shouldStopPropagation}return!0}),w=vV(e=>{let t=g.current;if(t.isPressed&&t.target){for(let n of(t.didFirePressStart&&null!=t.pointerType&&$($7(t.target,e),t.pointerType,!1),t.isPressed=!1,t.isOverTarget=!1,t.activePointerId=null,t.pointerType=null,b(),d||$W(t.target),t.disposables))n();t.disposables=[]}}),k=vV(e=>{u&&w(e)}),x=vV(e=>{null==i||i(e)}),C=vV((e,t)=>{if(i){let n=new MouseEvent("click",e);$$(n,t),i($v(n))}}),E=(0,f0.useMemo)(()=>{let e=g.current,t={onKeyDown(t){if($6(t.nativeEvent,t.currentTarget)&&$K(t.currentTarget,$Z(t.nativeEvent))){var r;$8($Z(t.nativeEvent),t.key)&&t.preventDefault();let a=!0;if(!e.isPressed&&!t.repeat){e.target=t.currentTarget,e.isPressed=!0,e.pointerType="keyboard",a=v(t,"keyboard");let r=t.currentTarget;y($g(t.currentTarget),"keyup",vL(t=>{$6(t,r)&&!t.repeat&&$K(r,$Z(t))&&e.target&&A($7(e.target,t),"keyboard")},n),!0)}a&&t.stopPropagation(),t.metaKey&&$E()&&(null==(r=e.metaKeyEvents)||r.set(t.key,t.nativeEvent))}else"Meta"===t.key&&(e.metaKeyEvents=new Map)},onClick(t){if((!t||$K(t.currentTarget,$Z(t.nativeEvent)))&&t&&0===t.button&&!e.isTriggeringEvent&&!$Y.isOpening){let n=!0;if(s&&t.preventDefault(),!e.ignoreEmulatedMouseEvents&&!e.isPressed&&("virtual"===e.pointerType||$J(t.nativeEvent))){let e=v(t,"virtual"),r=A(t,"virtual"),a=$(t,"virtual");x(t),n=e&&r&&a}else if(e.isPressed&&"keyboard"!==e.pointerType){let r=e.pointerType||t.nativeEvent.pointerType||"virtual";n=$($7(t.currentTarget,t),r,!0),e.isOverTarget=!1,x(t),w(t)}e.ignoreEmulatedMouseEvents=!1,n&&t.stopPropagation()}}},n=t=>{var n,r,a;if(e.isPressed&&e.target&&$6(t,e.target)){$8($Z(t),t.key)&&t.preventDefault();let n=$Z(t),a=$K(e.target,$Z(t));$($7(e.target,t),"keyboard",a),a&&C(t,e.target),b(),"Enter"!==t.key&&$5(e.target)&&$K(e.target,n)&&!t[$1]&&(t[$1]=!0,$Y(e.target,t,!1)),e.isPressed=!1,null==(r=e.metaKeyEvents)||r.delete(t.key)}else if("Meta"===t.key&&(null==(n=e.metaKeyEvents)?void 0:n.size)){let t=e.metaKeyEvents;for(let n of(e.metaKeyEvents=void 0,t.values()))null==(a=e.target)||a.dispatchEvent(new KeyboardEvent("keyup",n))}};if("u">typeof PointerEvent){t.onPointerDown=t=>{var a;if(0!==t.button||!$K(t.currentTarget,$Z(t.nativeEvent)))return;if(a=t.nativeEvent,!$N()&&0===a.width&&0===a.height||1===a.width&&1===a.height&&0===a.pressure&&0===a.detail&&"mouse"===a.pointerType){e.pointerType="virtual";return}e.pointerType=t.pointerType;let o=!0;if(!e.isPressed){e.isPressed=!0,e.isOverTarget=!0,e.activePointerId=t.pointerId,e.target=t.currentTarget,d||function(e){if($z()){if("default"===$j){let t=$g(e);$F=t.documentElement.style.webkitUserSelect,t.documentElement.style.webkitUserSelect="none"}$j="disabled"}else if(e instanceof HTMLElement||e instanceof SVGElement){let t="userSelect"in e.style?"userSelect":"webkitUserSelect";$L.set(e,e.style[t]),e.style[t]="none"}}(e.target),o=v(t,e.pointerType);let a=$Z(t.nativeEvent);"releasePointerCapture"in a&&a.releasePointerCapture(t.pointerId),y($g(t.currentTarget),"pointerup",n,!1),y($g(t.currentTarget),"pointercancel",r,!1)}o&&t.stopPropagation()},t.onMouseDown=t=>{if($K(t.currentTarget,$Z(t.nativeEvent))&&0===t.button){if(c){let n=function(e){for(;e&&!$m(e);)e=e.parentElement;let t=$_(e),n=t.document.activeElement;if(!n||n===e)return;$w=!0;let r=!1,a=e=>{(e.target===n||r)&&e.stopImmediatePropagation()},o=t=>{(t.target===n||r)&&(t.stopImmediatePropagation(),e||r||(r=!0,$y(n),l()))},i=t=>{(t.target===e||r)&&t.stopImmediatePropagation()},s=t=>{(t.target===e||r)&&(t.stopImmediatePropagation(),r||(r=!0,$y(n),l()))};t.addEventListener("blur",a,!0),t.addEventListener("focusout",o,!0),t.addEventListener("focusin",s,!0),t.addEventListener("focus",i,!0);let l=()=>{cancelAnimationFrame(c),t.removeEventListener("blur",a,!0),t.removeEventListener("focusout",o,!0),t.removeEventListener("focusin",s,!0),t.removeEventListener("focus",i,!0),$w=!1,r=!1},c=requestAnimationFrame(l);return l}(t.target);n&&e.disposables.push(n)}t.stopPropagation()}},t.onPointerUp=t=>{$K(t.currentTarget,$Z(t.nativeEvent))&&"virtual"!==e.pointerType&&0===t.button&&A(t,e.pointerType||t.pointerType)},t.onPointerEnter=t=>{t.pointerId===e.activePointerId&&e.target&&!e.isOverTarget&&null!=e.pointerType&&(e.isOverTarget=!0,v($7(e.target,t),e.pointerType))},t.onPointerLeave=t=>{t.pointerId===e.activePointerId&&e.target&&e.isOverTarget&&null!=e.pointerType&&(e.isOverTarget=!1,$($7(e.target,t),e.pointerType,!1),k(t))};let n=t=>{if(t.pointerId===e.activePointerId&&e.isPressed&&0===t.button&&e.target){if($K(e.target,$Z(t))&&null!=e.pointerType){let n=!1,r=setTimeout(()=>{e.isPressed&&e.target instanceof HTMLElement&&(n?w(t):($y(e.target),e.target.click()))},80);y(t.currentTarget,"click",()=>n=!0,!0),e.disposables.push(()=>clearTimeout(r))}else w(t);e.isOverTarget=!1}},r=e=>{w(e)};t.onDragStart=e=>{$K(e.currentTarget,$Z(e.nativeEvent))&&w(e)}}return t},[y,s,c,b,d,w,k,$,v,A,x,C]);return(0,f0.useEffect)(()=>{if(!p)return;let e=$g(p.current);if(!e||!e.head||e.getElementById($2))return;let t=e.createElement("style");t.id=$2,t.textContent=`
38
38
  @layer {
39
39
  [${$3}] {
40
40
  touch-action: pan-x pan-y pinch-zoom;