@openmrs/esm-react-utils 5.3.3-pre.1376 → 5.3.3-pre.1379
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/.turbo/turbo-build.log
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
[33m@openmrs/esm-react-utils:build[0m: cache hit, replaying output [
|
|
1
|
+
[33m@openmrs/esm-react-utils:build[0m: cache hit, replaying output [2mc3f186d690a7fed6[0m
|
|
2
2
|
[33m@openmrs/esm-react-utils:build: [0mBrowserslist: caniuse-lite is outdated. Please run:
|
|
3
3
|
[33m@openmrs/esm-react-utils:build: [0m npx update-browserslist-db@latest
|
|
4
4
|
[33m@openmrs/esm-react-utils:build: [0m Why you should do it regularly: https://github.com/browserslist/update-db#readme
|
|
5
|
-
[33m@openmrs/esm-react-utils:build: [0masset [1m[32mopenmrs-esm-react-utils.js[39m[22m
|
|
5
|
+
[33m@openmrs/esm-react-utils:build: [0masset [1m[32mopenmrs-esm-react-utils.js[39m[22m 66.2 KiB [1m[32m[emitted][39m[22m [1m[32m[minimized][39m[22m (name: main) 1 related asset
|
|
6
6
|
[33m@openmrs/esm-react-utils:build: [0morphan modules 167 KiB [1m[33m[orphan][39m[22m 122 modules
|
|
7
7
|
[33m@openmrs/esm-react-utils:build: [0mruntime modules 937 bytes 4 modules
|
|
8
8
|
[33m@openmrs/esm-react-utils:build: [0mbuilt modules 184 KiB [1m[33m[built][39m[22m
|
|
9
|
-
[33m@openmrs/esm-react-utils:build: [0m cacheable modules
|
|
9
|
+
[33m@openmrs/esm-react-utils:build: [0m cacheable modules 184 KiB
|
|
10
10
|
[33m@openmrs/esm-react-utils:build: [0m modules by path [1m../../../node_modules/[39m[22m 984 bytes 2 modules
|
|
11
11
|
[33m@openmrs/esm-react-utils:build: [0m + 3 modules
|
|
12
12
|
[33m@openmrs/esm-react-utils:build: [0m modules by path [1mexternal "@openmrs/[39m[22m 210 bytes
|
|
@@ -14,4 +14,4 @@
|
|
|
14
14
|
[33m@openmrs/esm-react-utils:build: [0m [1mexternal "@openmrs/esm-extensions"[39m[22m 42 bytes [1m[33m[built][39m[22m [1m[33m[code generated][39m[22m
|
|
15
15
|
[33m@openmrs/esm-react-utils:build: [0m + 3 modules
|
|
16
16
|
[33m@openmrs/esm-react-utils:build: [0m + 5 modules
|
|
17
|
-
[33m@openmrs/esm-react-utils:build: [0mwebpack 5.88.0 compiled [1m[32msuccessfully[39m[22m in
|
|
17
|
+
[33m@openmrs/esm-react-utils:build: [0mwebpack 5.88.0 compiled [1m[32msuccessfully[39m[22m in 4503 ms
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
System.register(["react","@openmrs/esm-navigation","@openmrs/esm-extensions","@openmrs/esm-globals","@openmrs/esm-api","react-dom","react-i18next","swr","@openmrs/esm-config","dayjs"],(function(t,e){var n={},r={},o={},u={},i={},a={},c={},l={},s={},f={};return Object.defineProperty(a,"__esModule",{value:!0}),{setters:[function(t){n.Suspense=t.Suspense,n.default=t.default,n.useCallback=t.useCallback,n.useContext=t.useContext,n.useEffect=t.useEffect,n.useMemo=t.useMemo,n.useReducer=t.useReducer,n.useRef=t.useRef,n.useState=t.useState},function(t){r.interpolateUrl=t.interpolateUrl,r.navigate=t.navigate},function(t){o.getConnectedExtensions=t.getConnectedExtensions,o.getExtensionInternalStore=t.getExtensionInternalStore,o.getExtensionStore=t.getExtensionStore,o.registerExtensionSlot=t.registerExtensionSlot,o.renderExtension=t.renderExtension},function(t){u.subscribeConnectivityChanged=t.subscribeConnectivityChanged},function(t){i.attachmentUrl=t.attachmentUrl,i.defaultVisitCustomRepresentation=t.defaultVisitCustomRepresentation,i.fetchCurrentPatient=t.fetchCurrentPatient,i.getCurrentUser=t.getCurrentUser,i.getLocations=t.getLocations,i.getSessionStore=t.getSessionStore,i.getVisitStore=t.getVisitStore,i.getVisitTypes=t.getVisitTypes,i.openmrsFetch=t.openmrsFetch,i.userHasAccess=t.userHasAccess},function(t){Object.keys(t).forEach((function(e){a[e]=t[e]}))},function(t){c.I18nextProvider=t.I18nextProvider},function(t){l.default=t.default},function(t){s.getConfigStore=t.getConfigStore,s.getExtensionConfigFromStore=t.getExtensionConfigFromStore,s.getExtensionsConfigStore=t.getExtensionsConfigStore},function(t){f.default=t.default}],execute:function(){t((()=>{var t={332:function(t){t.exports=function(){"use strict";return function(t,e,n){e.prototype.isToday=function(){var t="YYYY-MM-DD",e=n();return this.format(t)===e.format(t)}}}()},645:(t,e,n)=>{"use strict";var r=n(493);e.createRoot=r.createRoot,e.hydrateRoot=r.hydrateRoot},570:()=>{System.register(["@openmrs/esm-state"],(function(t,e){var n={};return{setters:[function(t){n.getGlobalStore=t.getGlobalStore}],execute:function(){t(function(){"use strict";var t={685:function(t){t.exports=n}},e={};function r(n){var o=e[n];if(void 0!==o)return o.exports;var u=e[n]={exports:{}};return t[n](u,u.exports,r),u.exports}r.d=function(t,e){for(var n in e)r.o(e,n)&&!r.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:e[n]})},r.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},r.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})};var o={};return function(){var t=function(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r},e=function(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t},n=function(t){for(var n=1;n<arguments.length;n++){var r=null!=arguments[n]?arguments[n]:{},o=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(o=o.concat(Object.getOwnPropertySymbols(r).filter((function(t){return Object.getOwnPropertyDescriptor(r,t).enumerable})))),o.forEach((function(n){e(t,n,r[n])}))}return t},u=function(t,e){return e=null!=e?e:{},Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(e)):function(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);n.push.apply(n,r)}return n}(Object(e)).forEach((function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(e,n))})),t},i=function(t,r,o){var i;p.setState((function(a){var c;return{flags:u(n({},a.flags),e({},t,{enabled:null!==(i=null===(c=a.flags[t])||void 0===c?void 0:c.enabled)&&void 0!==i&&i,label:r,description:o}))}}))},a=function(t){return p.getState().flags[t].enabled},c=function(t,e){p.subscribe((function(n){e(n.flags[t].enabled)}))},l=function(t,r){p.setState((function(o){return{flags:u(n({},o.flags),e({},t,u(n({},o.flags[t]),{enabled:r})))}}))};r.r(o),r.d(o,{featureFlagsStore:function(){return p},getFeatureFlag:function(){return a},registerFeatureFlag:function(){return i},setFeatureFlag:function(){return l},subscribeToFeatureFlag:function(){return c}});var s=r(685),f={flags:function(){var t={},e=!0,r=!1,o=void 0;try{for(var u,i=Object.keys(localStorage)[Symbol.iterator]();!(e=(u=i.next()).done);e=!0){var a=u.value;if(a.startsWith("openmrs:feature-flag:")){var c=a.replace("openmrs:feature-flag:",""),l=JSON.parse(localStorage.getItem("openmrs:feature-flag-meta:".concat(c))||"{}");t[c]=n({enabled:"true"===localStorage.getItem(a)},l)}}}catch(t){r=!0,o=t}finally{try{e||null==i.return||i.return()}finally{if(r)throw o}}return t}()},p=(0,s.getGlobalStore)("feature-flags",f);p.subscribe((function(e){var n,r=!0,o=!1,u=void 0;try{for(var i,a=Object.entries(e.flags)[Symbol.iterator]();!(r=(i=a.next()).done);r=!0){var c=function(t){if(Array.isArray(t))return t}(n=i.value)||function(t,e){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=n){var r,o,u=[],i=!0,a=!1;try{for(n=n.call(t);!(i=(r=n.next()).done)&&(u.push(r.value),2!==u.length);i=!0);}catch(t){a=!0,o=t}finally{try{i||null==n.return||n.return()}finally{if(a)throw o}}return u}}(n)||function(e,n){if(e){if("string"==typeof e)return t(e,2);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(r):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?t(e,2):void 0}}(n)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}(),l=c[0],s=c[1];localStorage.setItem("openmrs:feature-flag:".concat(l),s.enabled.toString()),localStorage.setItem("openmrs:feature-flag-meta:".concat(l),JSON.stringify({label:s.label,description:s.description}))}}catch(e){o=!0,u=e}finally{try{r||null==a.return||a.return()}finally{if(o)throw u}}}))}(),o}())}}}))},385:()=>{System.register([],(function(t,e){return{execute:function(){t(function(){"use strict";var t=function(t,e){var n=a[t];if(n)return n.active?console.error("Cannot override an existing store. Make sure that stores are only created once."):n.value.setState(e,!0),n.active=!0,n.value;var r=i()((function(){return e}));return a[t]={value:r,active:!0},r},e=function(t,e){var n=a[t];if(!n){var r=i()((function(){return null!=e?e:{}}));return a[t]={value:r,active:!1},r}return n.value},n=function(t,e,n){var r=e(t.getState());return t.subscribe((function(t){var o=e(t);o!==r&&(r=o,n(o))}))},r={d:function(t,e){for(var n in e)r.o(e,n)&&!r.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:e[n]})},o:function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},r:function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})}},o={};r.r(o),r.d(o,{createGlobalStore:function(){return t},getGlobalStore:function(){return e},subscribeTo:function(){return n}});var u=function(t){var e,n=new Set,r=function(t,r){var o="function"==typeof t?t(e):t;if(!Object.is(o,e)){var u=e;e=(null!=r?r:"object"!=typeof o)?o:Object.assign({},e,o),n.forEach((function(t){return t(e,u)}))}},o=function(){return e},u={setState:r,getState:o,subscribe:function(t){return n.add(t),function(){return n.delete(t)}},destroy:function(){console.warn("[DEPRECATED] The `destroy` method will be unsupported in a future version. Instead use unsubscribe function returned by subscribe. Everything will be garbage-collected if store is garbage-collected."),n.clear()}};return e=t(r,o,u),u},i=function(t){return t?u(t):u},a={};return setTimeout((function(){"development"===window.spaEnv&&(window.stores=a)}),1e3),o}())}}}))},766:t=>{"use strict";t.exports=i},824:t=>{"use strict";t.exports=s},45:t=>{"use strict";t.exports=o},728:t=>{"use strict";t.exports=u},513:t=>{"use strict";t.exports=r},688:t=>{"use strict";t.exports=f},954:t=>{"use strict";t.exports=n},493:t=>{"use strict";t.exports=a},281:t=>{"use strict";t.exports=c},725:t=>{"use strict";t.exports=l}},e={};function p(n){var r=e[n];if(void 0!==r)return r.exports;var o=e[n]={exports:{}};return t[n].call(o.exports,o,o.exports,p),o.exports}p.n=t=>{var e=t&&t.__esModule?()=>t.default:()=>t;return p.d(e,{a:e}),e},p.d=(t,e)=>{for(var n in e)p.o(e,n)&&!p.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:e[n]})},p.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),p.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})};var d={};return(()=>{"use strict";p.r(d),p.d(d,{ComponentContext:()=>e,ConfigurableLink:()=>o,Extension:()=>l,ExtensionSlot:()=>N,UserHasAccess:()=>B,createUseStore:()=>P,getAsyncExtensionLifecycle:()=>yt,getAsyncLifecycle:()=>pt,getLifecycle:()=>ft,getSyncLifecycle:()=>dt,isDesktop:()=>Gn,openmrsComponentDecorator:()=>st,useAbortController:()=>mt,useAssignedExtensionIds:()=>Sn,useAssignedExtensions:()=>A,useAttachments:()=>wn,useBodyScrollLock:()=>jn,useConfig:()=>Rn,useConnectedExtensions:()=>R,useConnectivity:()=>y,useDebounce:()=>kn,useExtensionInternalStore:()=>Un,useExtensionSlot:()=>T,useExtensionSlotMeta:()=>Dn,useExtensionStore:()=>_,useFeatureFlag:()=>Nn,useForceUpdate:()=>Ln,useLayoutType:()=>Vn,useLocations:()=>Hn,useOnClickOutside:()=>qn,useOpenmrsSWR:()=>Kn,usePagination:()=>mr,usePatient:()=>or,useSession:()=>ir,useStore:()=>E,useStoreWithActions:()=>x,useVisit:()=>sr,useVisitTypes:()=>pr});var t=p(954),e=t.default.createContext({moduleName:""}),n=p(513);function r(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function o(e){var o=e.to,u=e.templateParams,i=e.onBeforeNavigate,a=e.children,c=function(t,e){if(null==t)return{};var n,r,o=function(t,e){if(null==t)return{};var n,r,o={},u=Object.keys(t);for(r=0;r<u.length;r++)n=u[r],e.indexOf(n)>=0||(o[n]=t[n]);return o}(t,e);if(Object.getOwnPropertySymbols){var u=Object.getOwnPropertySymbols(t);for(r=0;r<u.length;r++)n=u[r],e.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(t,n)&&(o[n]=t[n])}return o}(e,["to","templateParams","onBeforeNavigate","children"]);return t.default.createElement("a",function(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{},o=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(o=o.concat(Object.getOwnPropertySymbols(n).filter((function(t){return Object.getOwnPropertyDescriptor(n,t).enumerable})))),o.forEach((function(e){r(t,e,n[e])}))}return t}({onClick:function(t){return function(t,e,r,o){t.metaKey||t.ctrlKey||t.shiftKey||0!=t.button||(t.preventDefault(),null==o||o(),(0,n.navigate)({to:e,templateParams:r}))}(t,o,u,i)},href:(0,n.interpolateUrl)(o,u)},c),a)}var u=p(45);function i(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}function a(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function c(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter((function(t){return Object.getOwnPropertyDescriptor(n,t).enumerable})))),r.forEach((function(e){a(t,e,n[e])}))}return t}var l=function(n){var r=n.state,o=n.children,a=n.wrap,l=function(t,e){if(null==t)return{};var n,r,o=function(t,e){if(null==t)return{};var n,r,o={},u=Object.keys(t);for(r=0;r<u.length;r++)n=u[r],e.indexOf(n)>=0||(o[n]=t[n]);return o}(t,e);if(Object.getOwnPropertySymbols){var u=Object.getOwnPropertySymbols(t);for(r=0;r<u.length;r++)n=u[r],e.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(t,n)&&(o[n]=t[n])}return o}(n,["state","children","wrap"]),s=function(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=n){var r,o,u=[],i=!0,a=!1;try{for(n=n.call(t);!(i=(r=n.next()).done)&&(u.push(r.value),!e||u.length!==e);i=!0);}catch(t){a=!0,o=t}finally{try{i||null==n.return||n.return()}finally{if(a)throw o}}return u}}(t,e)||function(t,e){if(t){if("string"==typeof t)return i(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?i(t,e):void 0}}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}((0,t.useState)(),2),f=s[0],p=s[1],d=(0,t.useContext)(e).extension,y=(0,t.useRef)(null),m=(0,t.useRef)(Promise.resolve()),b=(0,t.useRef)(!1);(0,t.useEffect)((function(){a&&console.warn("'wrap' prop of Extension is being used ".concat((null==d?void 0:d.extensionId)?"by ".concat(d.extensionId," in ").concat(d.extensionSlotName):"",". This will be removed in a future release."))}),[]);var v=(0,t.useCallback)((function(t){p(t)}),[p]);(0,t.useEffect)((function(){if(null!=f&&(null==d?void 0:d.extensionSlotName)&&d.extensionSlotModuleName&&d.extensionSlotModuleName&&!y.current&&!b.current)return b.current=!0,(0,u.renderExtension)(f,d.extensionSlotName,d.extensionSlotModuleName,d.extensionId,void 0,r).then((function(t){y.current=t,b.current=!1})),function(){if(y&&y.current)switch(y.current.getStatus()){case"MOUNTING":y.current.mountPromise.then((function(){var t;"MOUNTED"===(null===(t=y.current)||void 0===t?void 0:t.getStatus())&&y.current.unmount()}));break;case"MOUNTED":y.current.unmount();break;case"UPDATING":m.current&&m.current.then((function(){var t;"MOUNTED"===(null===(t=y.current)||void 0===t?void 0:t.getStatus())&&y.current.unmount()}))}}}),[null==d?void 0:d.extensionSlotName,null==d?void 0:d.extensionId,null==d?void 0:d.extensionSlotModuleName,f]),(0,t.useEffect)((function(){y.current&&y.current.update&&"UNMOUNTING"!==y.current.getStatus()&&Promise.all([y.current.mountPromise,m.current]).then((function(){var t;"MOUNTED"===(null==y||null===(t=y.current)||void 0===t?void 0:t.getStatus())&&y.current.update&&(m.current=y.current.update(c({},r)).catch((function(t){var e,n,r;if(n=t,!(null!=(r=Error)&&"undefined"!=typeof Symbol&&r[Symbol.hasInstance]?r[Symbol.hasInstance](n):n instanceof r)||!t.message.includes("minified message #32")||"MOUNTED"===(null===(e=y.current)||void 0===e?void 0:e.getStatus()))throw t})))}))}),[r]);var g=t.default.createElement("div",c({ref:v,"data-extension-id":null==d?void 0:d.extensionId,style:{position:"relative"}},l));return"function"!=typeof o||t.default.isValidElement(o)?d&&a?a(g,d):g:t.default.createElement(t.default.Fragment,null,o(g,d))},s=p(728);function f(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}function y(){var e=function(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=n){var r,o,u=[],i=!0,a=!1;try{for(n=n.call(t);!(i=(r=n.next()).done)&&(u.push(r.value),!e||u.length!==e);i=!0);}catch(t){a=!0,o=t}finally{try{i||null==n.return||n.return()}finally{if(a)throw o}}return u}}(t,e)||function(t,e){if(t){if("string"==typeof t)return f(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?f(t,e):void 0}}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}((0,t.useState)(window.navigator.onLine),2),n=e[0],r=e[1];return(0,t.useEffect)((function(){return(0,s.subscribeConnectivityChanged)((function(t){var e=t.online;return r(e)}))}),[]),n}var m=p(385);function b(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}function v(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function g(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter((function(t){return Object.getOwnPropertyDescriptor(n,t).enumerable})))),r.forEach((function(e){v(t,e,n[e])}))}return t}function h(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=n){var r,o,u=[],i=!0,a=!1;try{for(n=n.call(t);!(i=(r=n.next()).done)&&(u.push(r.value),!e||u.length!==e);i=!0);}catch(t){a=!0,o=t}finally{try{i||null==n.return||n.return()}finally{if(a)throw o}}return u}}(t,e)||O(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function S(t){return function(t){if(Array.isArray(t))return b(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||O(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function O(t,e){if(t){if("string"==typeof t)return b(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?b(t,e):void 0}}function w(t,e){var n=function(n){r[n]=function(){for(var r=arguments.length,o=new Array(r),u=0;u<r;u++)o[u]=arguments[u];t.setState((function(t){var r,u=[t].concat(S(o));return(r=e)[n].apply(r,S(u))}))}};"function"==typeof e&&(e=e(t));var r={};for(var o in e)n(o);return r}var j=function(t){return t};function E(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:j,r=arguments.length>2?arguments[2]:void 0,o=h((0,t.useState)((function(){return n(e.getState())})),2),u=o[0],i=o[1];return(0,t.useEffect)((function(){return(0,m.subscribeTo)(e,n,i)}),[e,n]),g({},u,(0,t.useMemo)((function(){return r?w(e,r):{}}),[e,r]))}function x(t,e){return E(t,j,e)}function P(e){return function(n){var r=h((0,t.useState)(e.getState()),2),o=r[0],u=r[1];return(0,t.useEffect)((function(){return e.subscribe((function(t){return u(t)}))}),[]),g({},o,(0,t.useMemo)((function(){return n?w(e,n):{}}),[n]))}}var _=P((0,u.getExtensionStore)());function A(e){var n=_().slots;return(0,t.useMemo)((function(){var t,r;return null!==(r=null===(t=n[e])||void 0===t?void 0:t.assignedExtensions)&&void 0!==r?r:[]}),[n,e])}var C=p(570);function I(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}function M(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=n){var r,o,u=[],i=!0,a=!1;try{for(n=n.call(t);!(i=(r=n.next()).done)&&(u.push(r.value),!e||u.length!==e);i=!0);}catch(t){a=!0,o=t}finally{try{i||null==n.return||n.return()}finally{if(a)throw o}}return u}}(t,e)||function(t,e){if(t){if("string"==typeof t)return I(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?I(t,e):void 0}}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function R(e){var n=y(),r=A(e),o=E(C.featureFlagsStore),i=(0,t.useMemo)((function(){return Object.entries(o.flags).filter((function(t){return M(t,2)[1].enabled})).map((function(t){return M(t,1)[0]}))}),[o.flags]);return(0,t.useMemo)((function(){return(0,u.getConnectedExtensions)(r,n,i)}),[r,n,i])}function T(n){var r=(0,t.useContext)(e).moduleName;if(!r)throw Error("ComponentContext has not been provided. This should come from @openmrs/esm-react-utils.");return(0,t.useEffect)((function(){(0,u.registerExtensionSlot)(r,n)}),[]),{extensions:R(n),extensionSlotName:n,extensionSlotModuleName:r}}function k(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function U(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter((function(t){return Object.getOwnPropertyDescriptor(n,t).enumerable})))),r.forEach((function(e){k(t,e,n[e])}))}return t}function D(t){return t}function N(n){var r=n.name,o=n.extensionSlotName,u=n.select,i=void 0===u?D:u,a=n.children,c=n.state,s=n.style,f=function(t,e){if(null==t)return{};var n,r,o=function(t,e){if(null==t)return{};var n,r,o={},u=Object.keys(t);for(r=0;r<u.length;r++)n=u[r],e.indexOf(n)>=0||(o[n]=t[n]);return o}(t,e);if(Object.getOwnPropertySymbols){var u=Object.getOwnPropertySymbols(t);for(r=0;r<u.length;r++)n=u[r],e.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(t,n)&&(o[n]=t[n])}return o}(n,["name","extensionSlotName","select","children","state","style"]);if(a&&c)throw new Error("Both children and state have been provided. If children are provided, the state must be passed as a prop to the `Extension` component.");var p,d,y,m,b=null!=r?r:o,v=(0,t.useRef)(null),g=T(b),h=g.extensions,S=g.extensionSlotModuleName,O=(0,t.useMemo)((function(){return i(h)}),[i,h]),w=(0,t.useMemo)((function(){if("function"==typeof a&&!t.default.isValidElement(a))return O.map((function(t){return a(t)}))}),[a,O]);return t.default.createElement("div",U({ref:v,"data-extension-slot-name":b,"data-extension-slot-module-name":S,style:(y=U({},s),m={position:"relative"},m=null!=m?m:{},Object.getOwnPropertyDescriptors?Object.defineProperties(y,Object.getOwnPropertyDescriptors(m)):function(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);n.push.apply(n,r)}return n}(Object(m)).forEach((function(t){Object.defineProperty(y,t,Object.getOwnPropertyDescriptor(m,t))})),y)},f),b&&O.map((function(n,r){return t.default.createElement(e.Provider,{key:n.id,value:{moduleName:S,extension:{extensionId:n.id,extensionSlotName:b,extensionSlotModuleName:S}}},null!==(d=null!==(p=null==w?void 0:w[r])&&void 0!==p?p:"function"!=typeof a?a:null)&&void 0!==d?d:t.default.createElement(l,{state:c}))})))}var F=p(766);function L(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}var B=function(e){var n=e.privilege,r=e.fallback,o=e.children,u=function(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=n){var r,o,u=[],i=!0,a=!1;try{for(n=n.call(t);!(i=(r=n.next()).done)&&(u.push(r.value),!e||u.length!==e);i=!0);}catch(t){a=!0,o=t}finally{try{i||null==n.return||n.return()}finally{if(a)throw o}}return u}}(t,e)||function(t,e){if(t){if("string"==typeof t)return L(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?L(t,e):void 0}}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}((0,t.useState)(null),2),i=u[0],a=u[1];return(0,t.useEffect)((function(){var t=(0,F.getCurrentUser)({includeAuthStatus:!1}).subscribe(a);return function(){return t.unsubscribe()}}),[]),i&&(0,F.userHasAccess)(n,i)?t.default.createElement(t.default.Fragment,null,o):r?t.default.createElement(t.default.Fragment,null,r):null},z=p(645);function V(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function $(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?V(Object(n),!0).forEach((function(e){W(t,e,n[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):V(Object(n)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}))}return t}function G(t){return(G="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function W(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function H(t){return(H="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function q(t,e){var n;if("function"!=typeof(n=e.domElement?function(){return e.domElement}:e.domElementGetter?e.domElementGetter:t.domElementGetter?t.domElementGetter:function(t){var e=t.appName||t.name;if(!e)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(e);return function(){var t=document.getElementById(n);return t||((t=document.createElement("div")).id=n,document.body.appendChild(t)),t}}(e)))throw Error("single-spa's dom-element-getter-helpers was given an invalid domElementGetter for application or parcel '".concat(e.name,"'. Expected a function, received ").concat(H(n)));return function(){var t=n(e);if(!(t instanceof HTMLElement))throw Error("single-spa's dom-element-getter-helpers: domElementGetter returned an invalid dom element for application or parcel '".concat(e.name,"'. Expected HTMLElement, received ").concat(H(t)));return t}}var Y=null;try{Y=require("react").createContext()}catch(V){}var K={React:null,ReactDOM:null,ReactDOMClient:null,rootComponent:null,loadRootComponent:null,renderType:"createRoot",errorBoundary:null,errorBoundaryClass:null,domElementGetter:null,parcelCanUpdate:!0,suppressComponentDidCatchWarning:!1,domElements:{},renderResults:{},updateResolves:{},unmountResolves:{}};function J(t){if("object"!==G(t))throw new Error("single-spa-react requires a configuration object");var e=$($({},K),t);if(!e.React)throw new Error("single-spa-react must be passed opts.React");if(!e.ReactDOM&&!e.ReactDOMClient)throw new Error("single-spa-react must be passed opts.ReactDOM or opts.ReactDOMClient");if(!e.rootComponent&&!e.loadRootComponent)throw new Error("single-spa-react must be passed opts.rootComponent or opts.loadRootComponent");if(e.errorBoundary&&"function"!=typeof e.errorBoundary)throw Error("The errorBoundary opt for single-spa-react must either be omitted or be a function that returns React elements");!Y&&e.React.createContext&&(Y=e.React.createContext()),e.SingleSpaRoot=function(t){function e(t){e.displayName="SingleSpaRoot(".concat(t.name,")")}return e.prototype=Object.create(t.React.Component.prototype),e.prototype.componentDidMount=function(){setTimeout(this.props.mountFinished)},e.prototype.componentWillUnmount=function(){setTimeout(this.props.unmountFinished)},e.prototype.render=function(){return setTimeout(this.props.updateFinished),this.props.children},e}(e);var n={bootstrap:Z.bind(null,e),mount:Q.bind(null,e),unmount:X.bind(null,e)};return e.parcelCanUpdate&&(n.update=tt.bind(null,e)),n}function Z(t,e){return t.rootComponent?Promise.resolve():t.loadRootComponent(e).then((function(e){t.rootComponent=e}))}function Q(t,e){return new Promise((function(n,r){t.suppressComponentDidCatchWarning||!function(t){if(!(t&&"string"==typeof t.version&&t.version.indexOf(".")>=0))return!1;var e=t.version.slice(0,t.version.indexOf("."));try{return Number(e)>=16}catch(t){return!1}}(t.React)||t.errorBoundary||t.errorBoundaryClass||(t.rootComponent.prototype?t.rootComponent.prototype.componentDidCatch||console.warn("single-spa-react: ".concat(e.name||e.appName||e.childAppName,"'s rootComponent should implement componentDidCatch to avoid accidentally unmounting the entire single-spa application.")):console.warn("single-spa-react: ".concat(e.name||e.appName||e.childAppName,"'s rootComponent does not implement an error boundary. If using a functional component, consider providing an opts.errorBoundary to singleSpaReact(opts).")));var o=rt(t,e,(function(){n(this)})),u=q(t,e)(),i=function(t){var e=t.renderType,n=t.elementToRender,r=t.domElement,o=t.reactDom[e];if("function"!=typeof o)throw new Error('renderType "'.concat(e,'" did not return a function.'));switch(e){case"createRoot":case"unstable_createRoot":case"createBlockingRoot":case"unstable_createBlockingRoot":var u=o(r);return u.render(n),u;case"hydrateRoot":return o(r,n);default:return o(n,r),null}}({elementToRender:o,domElement:u,reactDom:et(t),renderType:nt(t)});t.domElements[e.name]=u,t.renderResults[e.name]=i}))}function X(t,e){return new Promise((function(n){t.unmountResolves[e.name]=n;var r=t.renderResults[e.name];r&&r.unmount?r.unmount():et(t).unmountComponentAtNode(t.domElements[e.name]),delete t.domElements[e.name],delete t.renderResults[e.name]}))}function tt(t,e){return new Promise((function(n){t.updateResolves[e.name]||(t.updateResolves[e.name]=[]),t.updateResolves[e.name].push(n);var r=rt(t,e,null),o=t.renderResults[e.name];if(o&&o.render)o.render(r);else{var u=q(t,e)();et(t).render(r,u)}}))}function et(t){return t.ReactDOMClient||t.ReactDOM}function nt(t){return"function"==typeof t.renderType?t.renderType():t.renderType}function rt(t,e,n){var r=t.React.createElement(t.rootComponent,e),o=Y?t.React.createElement(Y.Provider,{value:e},r):r;return(t.errorBoundary||e.errorBoundary||t.errorBoundaryClass||e.errorBoundaryClass)&&(t.errorBoundaryClass=t.errorBoundaryClass||e.errorBoundaryClass||function(t,e){function n(e){t.React.Component.apply(this,arguments),this.state={caughtError:null,caughtErrorInfo:null},n.displayName="SingleSpaReactErrorBoundary(".concat(e.name,")")}return n.prototype=Object.create(t.React.Component.prototype),n.prototype.render=function(){return this.state.caughtError?(t.errorBoundary||e.errorBoundary)(this.state.caughtError,this.state.caughtErrorInfo,this.props):this.props.children},n.prototype.componentDidCatch=function(t,e){this.setState({caughtError:t,caughtErrorInfo:e})},n}(t,e),o=t.React.createElement(t.errorBoundaryClass,e,o)),t.React.createElement(t.SingleSpaRoot,$($({},e),{},{mountFinished:n,updateFinished:function(){t.updateResolves[e.name]&&(t.updateResolves[e.name].forEach((function(t){return t()})),delete t.updateResolves[e.name])},unmountFinished:function(){t.unmountResolves[e.name]&&(t.unmountResolves[e.name](),delete t.unmountResolves[e.name])}}),o)}var ot=p(281);function ut(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function it(t){return it=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},it(t)}function at(t,e){return at=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},at(t,e)}function ct(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var n,r=it(t);if(e){var o=it(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return function(t,e){return!e||"object"!=((n=e)&&"undefined"!=typeof Symbol&&n.constructor===Symbol?"symbol":typeof n)&&"function"!=typeof e?function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t):e;var n}(this,n)}}var lt={strictMode:!0,throwErrorsToConsole:!0,disableTranslations:!1};function st(n){if("object"!=typeof n||"string"!=typeof n.featureName||"string"!=typeof n.moduleName)throw new Error("Invalid options");var r=Object.assign({},lt,n);return function(n){var o,u,i,a;return u=o=function(o){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&at(t,e)}(c,o);var u,i,a=ct(c);function c(t){var e;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,c),(e=a.call(this,t)).state={caughtError:null,caughtErrorInfo:null,config:{moduleName:r.moduleName,extension:t._extensionContext}},e}return u=c,(i=[{key:"componentDidCatch",value:function(t,e){e&&e.componentStack&&(t.extra=Object.assign(t.extra||{},{componentStack:e.componentStack})),r.throwErrorsToConsole&&setTimeout((function(){throw t})),this.setState({caughtError:t,caughtErrorInfo:e})}},{key:"render",value:function(){if(this.state.caughtError)return t.default.createElement("div",null,"An error has occurred. Please try reloading the page.");var o=t.default.createElement(t.Suspense,{fallback:null},t.default.createElement(e.Provider,{value:this.state.config},r.disableTranslations?t.default.createElement(n,this.props):t.default.createElement(ot.I18nextProvider,{i18n:window.i18next,defaultNS:r.moduleName},t.default.createElement(n,this.props))));return r.strictMode||!t.default.StrictMode?o:t.default.createElement(t.default.StrictMode,null,o)}}])&&ut(u.prototype,i),c}(t.default.Component),i="displayName",a="OpenmrsReactComponent(".concat(r.featureName,")"),i in u?Object.defineProperty(u,i,{value:a,enumerable:!0,configurable:!0,writable:!0}):u[i]=a,o}}function ft(e,n){return J({React:t.default,ReactDOMClient:z,rootComponent:st(n)(e)})}function pt(t,e){return function(){return t().then((function(t){return ft(t.default,e)}))}}function dt(t,e){return function(){return Promise.resolve(ft(t,e))}}var yt=pt;function mt(){var e=(0,t.useRef)();return e.current&&!e.current.signal.aborted||(e.current=new AbortController),(0,t.useEffect)((function(){var t=e.current;return function(){return null==t?void 0:t.abort()}}),[]),e.current}const bt=mt,vt=function(t,e){return t===e||t!=t&&e!=e},gt=function(t,e){for(var n=t.length;n--;)if(vt(t[n][0],e))return n;return-1};var ht=Array.prototype.splice;function St(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}St.prototype.clear=function(){this.__data__=[],this.size=0},St.prototype.delete=function(t){var e=this.__data__,n=gt(e,t);return!(n<0||(n==e.length-1?e.pop():ht.call(e,n,1),--this.size,0))},St.prototype.get=function(t){var e=this.__data__,n=gt(e,t);return n<0?void 0:e[n][1]},St.prototype.has=function(t){return gt(this.__data__,t)>-1},St.prototype.set=function(t,e){var n=this.__data__,r=gt(n,t);return r<0?(++this.size,n.push([t,e])):n[r][1]=e,this};const Ot=St,wt="object"==typeof global&&global&&global.Object===Object&&global;var jt="object"==typeof self&&self&&self.Object===Object&&self;const Et=wt||jt||Function("return this")(),xt=Et.Symbol;var Pt=Object.prototype,_t=Pt.hasOwnProperty,At=Pt.toString,Ct=xt?xt.toStringTag:void 0;var It=Object.prototype.toString;var Mt=xt?xt.toStringTag:void 0;const Rt=function(t){return null==t?void 0===t?"[object Undefined]":"[object Null]":Mt&&Mt in Object(t)?function(t){var e=_t.call(t,Ct),n=t[Ct];try{t[Ct]=void 0;var r=!0}catch(t){}var o=At.call(t);return r&&(e?t[Ct]=n:delete t[Ct]),o}(t):function(t){return It.call(t)}(t)},Tt=function(t){var e=typeof t;return null!=t&&("object"==e||"function"==e)},kt=function(t){if(!Tt(t))return!1;var e=Rt(t);return"[object Function]"==e||"[object GeneratorFunction]"==e||"[object AsyncFunction]"==e||"[object Proxy]"==e},Ut=Et["__core-js_shared__"];var Dt,Nt=(Dt=/[^.]+$/.exec(Ut&&Ut.keys&&Ut.keys.IE_PROTO||""))?"Symbol(src)_1."+Dt:"";var Ft=Function.prototype.toString;const Lt=function(t){if(null!=t){try{return Ft.call(t)}catch(t){}try{return t+""}catch(t){}}return""};var Bt=/^\[object .+?Constructor\]$/,zt=Function.prototype,Vt=Object.prototype,$t=zt.toString,Gt=Vt.hasOwnProperty,Wt=RegExp("^"+$t.call(Gt).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");const Ht=function(t){return!(!Tt(t)||(e=t,Nt&&Nt in e))&&(kt(t)?Wt:Bt).test(Lt(t));var e},qt=function(t,e){var n=function(t,e){return null==t?void 0:t[e]}(t,e);return Ht(n)?n:void 0},Yt=qt(Et,"Map"),Kt=qt(Object,"create");var Jt=Object.prototype.hasOwnProperty;var Zt=Object.prototype.hasOwnProperty;function Qt(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}Qt.prototype.clear=function(){this.__data__=Kt?Kt(null):{},this.size=0},Qt.prototype.delete=function(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e},Qt.prototype.get=function(t){var e=this.__data__;if(Kt){var n=e[t];return"__lodash_hash_undefined__"===n?void 0:n}return Jt.call(e,t)?e[t]:void 0},Qt.prototype.has=function(t){var e=this.__data__;return Kt?void 0!==e[t]:Zt.call(e,t)},Qt.prototype.set=function(t,e){var n=this.__data__;return this.size+=this.has(t)?0:1,n[t]=Kt&&void 0===e?"__lodash_hash_undefined__":e,this};const Xt=Qt,te=function(t,e){var n,r,o=t.__data__;return("string"==(r=typeof(n=e))||"number"==r||"symbol"==r||"boolean"==r?"__proto__"!==n:null===n)?o["string"==typeof e?"string":"hash"]:o.map};function ee(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}ee.prototype.clear=function(){this.size=0,this.__data__={hash:new Xt,map:new(Yt||Ot),string:new Xt}},ee.prototype.delete=function(t){var e=te(this,t).delete(t);return this.size-=e?1:0,e},ee.prototype.get=function(t){return te(this,t).get(t)},ee.prototype.has=function(t){return te(this,t).has(t)},ee.prototype.set=function(t,e){var n=te(this,t),r=n.size;return n.set(t,e),this.size+=n.size==r?0:1,this};const ne=ee;function re(t){var e=this.__data__=new Ot(t);this.size=e.size}re.prototype.clear=function(){this.__data__=new Ot,this.size=0},re.prototype.delete=function(t){var e=this.__data__,n=e.delete(t);return this.size=e.size,n},re.prototype.get=function(t){return this.__data__.get(t)},re.prototype.has=function(t){return this.__data__.has(t)},re.prototype.set=function(t,e){var n=this.__data__;if(n instanceof Ot){var r=n.__data__;if(!Yt||r.length<199)return r.push([t,e]),this.size=++n.size,this;n=this.__data__=new ne(r)}return n.set(t,e),this.size=n.size,this};const oe=re;function ue(t){var e=-1,n=null==t?0:t.length;for(this.__data__=new ne;++e<n;)this.add(t[e])}ue.prototype.add=ue.prototype.push=function(t){return this.__data__.set(t,"__lodash_hash_undefined__"),this},ue.prototype.has=function(t){return this.__data__.has(t)};const ie=ue,ae=function(t,e){for(var n=-1,r=null==t?0:t.length;++n<r;)if(e(t[n],n,t))return!0;return!1},ce=function(t,e,n,r,o,u){var i=1&n,a=t.length,c=e.length;if(a!=c&&!(i&&c>a))return!1;var l=u.get(t),s=u.get(e);if(l&&s)return l==e&&s==t;var f=-1,p=!0,d=2&n?new ie:void 0;for(u.set(t,e),u.set(e,t);++f<a;){var y=t[f],m=e[f];if(r)var b=i?r(m,y,f,e,t,u):r(y,m,f,t,e,u);if(void 0!==b){if(b)continue;p=!1;break}if(d){if(!ae(e,(function(t,e){if(i=e,!d.has(i)&&(y===t||o(y,t,n,r,u)))return d.push(e);var i}))){p=!1;break}}else if(y!==m&&!o(y,m,n,r,u)){p=!1;break}}return u.delete(t),u.delete(e),p},le=Et.Uint8Array,se=function(t){var e=-1,n=Array(t.size);return t.forEach((function(t,r){n[++e]=[r,t]})),n},fe=function(t){var e=-1,n=Array(t.size);return t.forEach((function(t){n[++e]=t})),n};var pe=xt?xt.prototype:void 0,de=pe?pe.valueOf:void 0;const ye=Array.isArray;var me=Object.prototype.propertyIsEnumerable,be=Object.getOwnPropertySymbols;const ve=be?function(t){return null==t?[]:(t=Object(t),function(t,e){for(var n=-1,r=null==t?0:t.length,o=0,u=[];++n<r;){var i=t[n];e(i,n,t)&&(u[o++]=i)}return u}(be(t),(function(e){return me.call(t,e)})))}:function(){return[]},ge=function(t){return null!=t&&"object"==typeof t},he=function(t){return ge(t)&&"[object Arguments]"==Rt(t)};var Se=Object.prototype,Oe=Se.hasOwnProperty,we=Se.propertyIsEnumerable,je=he(function(){return arguments}())?he:function(t){return ge(t)&&Oe.call(t,"callee")&&!we.call(t,"callee")};const Ee=je;var xe="object"==typeof exports&&exports&&!exports.nodeType&&exports,Pe=xe&&"object"==typeof module&&module&&!module.nodeType&&module,_e=Pe&&Pe.exports===xe?Et.Buffer:void 0;const Ae=(_e?_e.isBuffer:void 0)||function(){return!1};var Ce=/^(?:0|[1-9]\d*)$/;const Ie=function(t,e){var n=typeof t;return!!(e=null==e?9007199254740991:e)&&("number"==n||"symbol"!=n&&Ce.test(t))&&t>-1&&t%1==0&&t<e},Me=function(t){return"number"==typeof t&&t>-1&&t%1==0&&t<=9007199254740991};var Re={};Re["[object Float32Array]"]=Re["[object Float64Array]"]=Re["[object Int8Array]"]=Re["[object Int16Array]"]=Re["[object Int32Array]"]=Re["[object Uint8Array]"]=Re["[object Uint8ClampedArray]"]=Re["[object Uint16Array]"]=Re["[object Uint32Array]"]=!0,Re["[object Arguments]"]=Re["[object Array]"]=Re["[object ArrayBuffer]"]=Re["[object Boolean]"]=Re["[object DataView]"]=Re["[object Date]"]=Re["[object Error]"]=Re["[object Function]"]=Re["[object Map]"]=Re["[object Number]"]=Re["[object Object]"]=Re["[object RegExp]"]=Re["[object Set]"]=Re["[object String]"]=Re["[object WeakMap]"]=!1;var Te="object"==typeof exports&&exports&&!exports.nodeType&&exports,ke=Te&&"object"==typeof module&&module&&!module.nodeType&&module,Ue=ke&&ke.exports===Te&&wt.process,De=function(){try{return ke&&ke.require&&ke.require("util").types||Ue&&Ue.binding&&Ue.binding("util")}catch(t){}}(),Ne=De&&De.isTypedArray;const Fe=Ne?(Le=Ne,function(t){return Le(t)}):function(t){return ge(t)&&Me(t.length)&&!!Re[Rt(t)]};var Le,Be=Object.prototype.hasOwnProperty;const ze=function(t,e){var n=ye(t),r=!n&&Ee(t),o=!n&&!r&&Ae(t),u=!n&&!r&&!o&&Fe(t),i=n||r||o||u,a=i?function(t,e){for(var n=-1,r=Array(t);++n<t;)r[n]=e(n);return r}(t.length,String):[],c=a.length;for(var l in t)!e&&!Be.call(t,l)||i&&("length"==l||o&&("offset"==l||"parent"==l)||u&&("buffer"==l||"byteLength"==l||"byteOffset"==l)||Ie(l,c))||a.push(l);return a};var Ve=Object.prototype;const $e=function(t,e){return function(n){return t(e(n))}}(Object.keys,Object);var Ge=Object.prototype.hasOwnProperty;const We=function(t){if(n=(e=t)&&e.constructor,e!==("function"==typeof n&&n.prototype||Ve))return $e(t);var e,n,r=[];for(var o in Object(t))Ge.call(t,o)&&"constructor"!=o&&r.push(o);return r},He=function(t){return null!=(e=t)&&Me(e.length)&&!kt(e)?ze(t):We(t);var e},qe=function(t){return function(t,e,n){var r=e(t);return ye(t)?r:function(t,e){for(var n=-1,r=e.length,o=t.length;++n<r;)t[o+n]=e[n];return t}(r,n(t))}(t,He,ve)};var Ye=Object.prototype.hasOwnProperty;const Ke=qt(Et,"DataView"),Je=qt(Et,"Promise"),Ze=qt(Et,"Set"),Qe=qt(Et,"WeakMap");var Xe="[object Map]",tn="[object Promise]",en="[object Set]",nn="[object WeakMap]",rn="[object DataView]",on=Lt(Ke),un=Lt(Yt),an=Lt(Je),cn=Lt(Ze),ln=Lt(Qe),sn=Rt;(Ke&&sn(new Ke(new ArrayBuffer(1)))!=rn||Yt&&sn(new Yt)!=Xe||Je&&sn(Je.resolve())!=tn||Ze&&sn(new Ze)!=en||Qe&&sn(new Qe)!=nn)&&(sn=function(t){var e=Rt(t),n="[object Object]"==e?t.constructor:void 0,r=n?Lt(n):"";if(r)switch(r){case on:return rn;case un:return Xe;case an:return tn;case cn:return en;case ln:return nn}return e});const fn=sn;var pn="[object Arguments]",dn="[object Array]",yn="[object Object]",mn=Object.prototype.hasOwnProperty;const bn=function(t,e,n,r,o,u){var i=ye(t),a=ye(e),c=i?dn:fn(t),l=a?dn:fn(e),s=(c=c==pn?yn:c)==yn,f=(l=l==pn?yn:l)==yn,p=c==l;if(p&&Ae(t)){if(!Ae(e))return!1;i=!0,s=!1}if(p&&!s)return u||(u=new oe),i||Fe(t)?ce(t,e,n,r,o,u):function(t,e,n,r,o,u,i){switch(n){case"[object DataView]":if(t.byteLength!=e.byteLength||t.byteOffset!=e.byteOffset)return!1;t=t.buffer,e=e.buffer;case"[object ArrayBuffer]":return!(t.byteLength!=e.byteLength||!u(new le(t),new le(e)));case"[object Boolean]":case"[object Date]":case"[object Number]":return vt(+t,+e);case"[object Error]":return t.name==e.name&&t.message==e.message;case"[object RegExp]":case"[object String]":return t==e+"";case"[object Map]":var a=se;case"[object Set]":var c=1&r;if(a||(a=fe),t.size!=e.size&&!c)return!1;var l=i.get(t);if(l)return l==e;r|=2,i.set(t,e);var s=ce(a(t),a(e),r,o,u,i);return i.delete(t),s;case"[object Symbol]":if(de)return de.call(t)==de.call(e)}return!1}(t,e,c,n,r,o,u);if(!(1&n)){var d=s&&mn.call(t,"__wrapped__"),y=f&&mn.call(e,"__wrapped__");if(d||y){var m=d?t.value():t,b=y?e.value():e;return u||(u=new oe),o(m,b,n,r,u)}}return!!p&&(u||(u=new oe),function(t,e,n,r,o,u){var i=1&n,a=qe(t),c=a.length;if(c!=qe(e).length&&!i)return!1;for(var l=c;l--;){var s=a[l];if(!(i?s in e:Ye.call(e,s)))return!1}var f=u.get(t),p=u.get(e);if(f&&p)return f==e&&p==t;var d=!0;u.set(t,e),u.set(e,t);for(var y=i;++l<c;){var m=t[s=a[l]],b=e[s];if(r)var v=i?r(b,m,s,e,t,u):r(m,b,s,t,e,u);if(!(void 0===v?m===b||o(m,b,n,r,u):v)){d=!1;break}y||(y="constructor"==s)}if(d&&!y){var g=t.constructor,h=e.constructor;g==h||!("constructor"in t)||!("constructor"in e)||"function"==typeof g&&g instanceof g&&"function"==typeof h&&h instanceof h||(d=!1)}return u.delete(t),u.delete(e),d}(t,e,n,r,o,u))},vn=function t(e,n,r,o,u){return e===n||(null==e||null==n||!ge(e)&&!ge(n)?e!=e&&n!=n:bn(e,n,r,o,t,u))},gn=function(t,e){return vn(t,e)};function hn(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}function Sn(e){var n=function(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=n){var r,o,u=[],i=!0,a=!1;try{for(n=n.call(t);!(i=(r=n.next()).done)&&(u.push(r.value),!e||u.length!==e);i=!0);}catch(t){a=!0,o=t}finally{try{i||null==n.return||n.return()}finally{if(a)throw o}}return u}}(t,e)||function(t,e){if(t){if("string"==typeof t)return hn(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?hn(t,e):void 0}}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}((0,t.useState)([]),2),r=n[0],o=n[1];return(0,t.useEffect)((function(){return(0,u.getExtensionStore)().subscribe((function(t){var n,u,i=null!==(u=null===(n=t.slots[e])||void 0===n?void 0:n.assignedExtensions.map((function(t){return t.id})))&&void 0!==u?u:[];gn(i,r)||o(i)}))}),[]),r}var On=p(725);function wn(e,n){var r,o=(0,On.default)("".concat(F.attachmentUrl,"?patient=").concat(e,"&includeEncounterless=").concat(n),F.openmrsFetch),u=o.data,i=o.error,a=o.mutate,c=o.isLoading,l=o.isValidating;return(0,t.useMemo)((function(){return{isLoading:c,data:null!==(r=null==u?void 0:u.data.results)&&void 0!==r?r:[],error:i,mutate:a,isValidating:l}}),[u,i,c,l,a])}function jn(e){(0,t.useEffect)((function(){if(e){var t=window.getComputedStyle(document.body).overflow;return document.body.style.overflow="hidden",function(){document.body.style.overflow=t}}}),[e])}var En=p(824);function xn(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}function Pn(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function _n(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter((function(t){return Object.getOwnPropertyDescriptor(n,t).enumerable})))),r.forEach((function(e){Pn(t,e,n[e])}))}return t}function An(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=n){var r,o,u=[],i=!0,a=!1;try{for(n=n.call(t);!(i=(r=n.next()).done)&&(u.push(r.value),!e||u.length!==e);i=!0);}catch(t){a=!0,o=t}finally{try{i||null==n.return||n.return()}finally{if(a)throw o}}return u}}(t,e)||function(t,e){if(t){if("string"==typeof t)return xn(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?xn(t,e):void 0}}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}var Cn={},In='No ComponentContext has been provided. This should come from "openmrsComponentDecorator".\nUsually this is already applied when using "getAsyncLifecycle" or "getSyncLifecycle".';function Mn(e){var n=(0,t.useMemo)(En.getExtensionsConfigStore,[]),r=function(e,n){var r=An((0,t.useState)(function(t,e){return e?function(){var n=t.getState(),r=(0,En.getExtensionConfigFromStore)(n,e.extensionSlotName,e.extensionId);if(r.loaded&&r.config)return r.config}:null}(e,n)),2),o=r[0],u=r[1];return(0,t.useEffect)((function(){if(n)return e.subscribe((function(t){var e=(0,En.getExtensionConfigFromStore)(t,n.extensionSlotName,n.extensionId);e.loaded&&e.config&&!gn(e.config,o)&&u(e.config)}))}),[e,n,o]),o}(n,e);if(!r&&e){var o="".concat(e.extensionSlotName,"-").concat(e.extensionId);throw!Cn[o]&&n&&(Cn[o]=function(t,e){return new Promise((function(n){var r=t.subscribe((function(t){var o=(0,En.getExtensionConfigFromStore)(t,e.extensionSlotName,e.extensionId);o.loaded&&o.config&&(n(o.config),r())}))}))}(n,e)),Cn[o]}return r||{}}function Rn(n){var r,o=(0,t.useContext)(e),u=o.moduleName,i=o.extension,a=null!==(r=null==n?void 0:n.externalModuleName)&&void 0!==r?r:u;if(!a&&!i)throw Error(In);var c=function(e){var n=(0,t.useMemo)((function(){return(0,En.getConfigStore)(e)}),[e]),r=e,o=function(e){var n=An((0,t.useState)(function(t){return function(){var e=t.getState();return e.loaded&&e.config?e.config:null}}(e)),2),r=n[0],o=n[1];return(0,t.useEffect)((function(){return null==e?void 0:e.subscribe((function(t){t.loaded&&t.config&&o(t.config)}))}),[e]),r}(n);if(!o)throw Cn[r]||(Cn[r]=function(t){return new Promise((function(e){var n=t.subscribe((function(t){t.loaded&&t.config&&(e(t.config),n())}))}))}(n)),Cn[r];return o}(a),l=Mn(i);return(0,t.useMemo)((function(){return(null==n?void 0:n.externalModuleName)&&a===n.externalModuleName?_n({},c):_n({},c,l)}),[a,null==n?void 0:n.externalModuleName,c,l])}function Tn(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}function kn(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:300,r=function(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=n){var r,o,u=[],i=!0,a=!1;try{for(n=n.call(t);!(i=(r=n.next()).done)&&(u.push(r.value),!e||u.length!==e);i=!0);}catch(t){a=!0,o=t}finally{try{i||null==n.return||n.return()}finally{if(a)throw o}}return u}}(t,e)||function(t,e){if(t){if("string"==typeof t)return Tn(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Tn(t,e):void 0}}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}((0,t.useState)(e),2),o=r[0],u=r[1];return(0,t.useEffect)((function(){var t=setTimeout((function(){u(e)}),n);return function(){clearTimeout(t)}}),[e,n]),o}var Un=P((0,u.getExtensionInternalStore)());function Dn(e){var n=R(e);return(0,t.useMemo)((function(){return Object.fromEntries(n.map((function(t){return[t.name,t.meta]})))}),[n])}function Nn(e){var n,r=E(C.featureFlagsStore).flags;return(0,t.useEffect)((function(){r[e]||console.error('useFeatureFlag: Attempted to get value of non-existent flag "'.concat(e,'". Did you forget to call registerFeatureFlag?'))}),[r[e]]),null===(n=r[e])||void 0===n?void 0:n.enabled}function Fn(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}function Ln(){var e=function(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=n){var r,o,u=[],i=!0,a=!1;try{for(n=n.call(t);!(i=(r=n.next()).done)&&(u.push(r.value),!e||u.length!==e);i=!0);}catch(t){a=!0,o=t}finally{try{i||null==n.return||n.return()}finally{if(a)throw o}}return u}}(t,e)||function(t,e){if(t){if("string"==typeof t)return Fn(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Fn(t,e):void 0}}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}((0,t.useState)(0),2)[1];return(0,t.useCallback)((function(){e((function(t){return t+1}))}),[])}function Bn(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}function zn(){var t="tablet";return document.body.classList.forEach((function(e){switch(e){case"omrs-breakpoint-lt-tablet":t="phone";break;case"omrs-breakpoint-gt-small-desktop":t="large-desktop";break;case"omrs-breakpoint-gt-tablet":t="small-desktop"}})),t}function Vn(){var e=function(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=n){var r,o,u=[],i=!0,a=!1;try{for(n=n.call(t);!(i=(r=n.next()).done)&&(u.push(r.value),!e||u.length!==e);i=!0);}catch(t){a=!0,o=t}finally{try{i||null==n.return||n.return()}finally{if(a)throw o}}return u}}(t,e)||function(t,e){if(t){if("string"==typeof t)return Bn(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Bn(t,e):void 0}}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}((0,t.useState)(zn),2),n=e[0],r=e[1];return(0,t.useEffect)((function(){var t=function(){r(zn())};return window.addEventListener("resize",t),function(){return window.removeEventListener("resize",t)}}),[]),n}var $n,Gn=function(t){return"small-desktop"===t||"large-desktop"===t};function Wn(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}function Hn(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,n=function(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=n){var r,o,u=[],i=!0,a=!1;try{for(n=n.call(t);!(i=(r=n.next()).done)&&(u.push(r.value),!e||u.length!==e);i=!0);}catch(t){a=!0,o=t}finally{try{i||null==n.return||n.return()}finally{if(a)throw o}}return u}}(t,e)||function(t,e){if(t){if("string"==typeof t)return Wn(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Wn(t,e):void 0}}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}((0,t.useState)([]),2),r=n[0],o=n[1];return(0,t.useEffect)((function(){var t=(0,F.getLocations)(e).subscribe((function(t){o(t)}),(function(t){console.error(t)}));return function(){return t.unsubscribe()}}),[]),r}function qn(e){var n=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],r=(0,t.useRef)(null);return(0,t.useEffect)((function(){if(n){var t=function(t){var n;(null==r||null===(n=r.current)||void 0===n?void 0:n.contains(t.target))||e(t)};return window.addEventListener("click",t),function(){return window.removeEventListener("click",t)}}}),[e,n]),r}function Yn(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function Kn(e){var n,r,o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},u=o.abortController,i=o.fetchInit,a=o.url,c=o.swrConfig,l=bt(),s=(0,t.useMemo)((function(){return null!==(r=null!==(n=null==i?void 0:i.signal)&&void 0!==n?n:null==u?void 0:u.signal)&&void 0!==r?r:l.signal}),[null==u?void 0:u.signal,null==i?void 0:i.signal,l.signal]),f=(0,t.useCallback)((function(t){var e,n,r=function(t,e){if(e)return"function"==typeof e?e(t):e;if("string"==typeof t)return t;throw new 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 ".concat(t,"."))}(t,a);return(0,F.openmrsFetch)(r,(e=function(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter((function(t){return Object.getOwnPropertyDescriptor(n,t).enumerable})))),r.forEach((function(e){Yn(t,e,n[e])}))}return t}({},i),n=null!=(n={signal:s})?n:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):function(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);n.push.apply(n,r)}return n}(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})),e))}),[s,i,a]);return(0,On.default)(e,f,c)}function Jn(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}function Zn(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function Qn(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter((function(t){return Object.getOwnPropertyDescriptor(n,t).enumerable})))),r.forEach((function(e){Zn(t,e,n[e])}))}return t}function Xn(t,e){return e=null!=e?e:{},Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(e)):function(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);n.push.apply(n,r)}return n}(Object(e)).forEach((function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(e,n))})),t}!function(t){t.loadPatient="loadPatient",t.newPatient="newPatient",t.loadError="patientLoadError"}($n||($n={}));var tr,er={patientUuid:null,patient:null,isPendingUuid:!0,isLoadingPatient:!1,err:null};function nr(){var t=/\/patient\/([a-zA-Z0-9\-]+)\/?/.exec(location.pathname);return t&&t[1]}function rr(t,e){switch(e.type){case $n.loadPatient:return Xn(Qn({},t),{patientUuid:e.patientUuid,patient:null,isPendingUuid:!1,isLoadingPatient:!0,err:null});case $n.newPatient:return Xn(Qn({},t),{patient:e.patient,isPendingUuid:!1,isLoadingPatient:!1,err:null});case $n.loadError:return Xn(Qn({},t),{patient:null,isPendingUuid:!1,isLoadingPatient:!1,err:e.err});default:return t}}function or(e){var n=function(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=n){var r,o,u=[],i=!0,a=!1;try{for(n=n.call(t);!(i=(r=n.next()).done)&&(u.push(r.value),!e||u.length!==e);i=!0);}catch(t){a=!0,o=t}finally{try{i||null==n.return||n.return()}finally{if(a)throw o}}return u}}(t,e)||function(t,e){if(t){if("string"==typeof t)return Jn(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Jn(t,e):void 0}}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}((0,t.useReducer)(rr,Xn(Qn({},er),{patientUuid:null!=e?e:null,isPendingUuid:!e,isLoadingPatient:!!e})),2),r=n[0],o=n[1];return(0,t.useEffect)((function(){if(r.isPendingUuid){var t=nr();o(t?{type:$n.loadPatient,patientUuid:t}:{type:$n.newPatient,patient:null})}var e=!0;return r.isLoadingPatient&&r.patientUuid&&(0,F.fetchCurrentPatient)(r.patientUuid).then((function(t){return e&&o({patient:t,type:$n.newPatient})}),(function(t){return e&&o({err:t,type:$n.loadError})})),function(){e=!1}}),[r.isPendingUuid,r.isLoadingPatient,r.patientUuid]),(0,t.useEffect)((function(){var t=function(t){var e=nr();e!=r.patientUuid&&o({type:$n.loadPatient,patientUuid:e})};return window.addEventListener("single-spa:routing-event",t),function(){return window.removeEventListener("single-spa:routing-event",t)}}),[r.patientUuid]),{isLoading:r.isPendingUuid||r.isLoadingPatient,patient:r.patient,patientUuid:null!=e?e:r.patientUuid,error:r.err}}function ur(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}function ir(){var e=(0,t.useRef)(),n=function(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=n){var r,o,u=[],i=!0,a=!1;try{for(n=n.call(t);!(i=(r=n.next()).done)&&(u.push(r.value),!e||u.length!==e);i=!0);}catch(t){a=!0,o=t}finally{try{i||null==n.return||n.return()}finally{if(a)throw o}}return u}}(t,e)||function(t,e){if(t){if("string"==typeof t)return ur(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?ur(t,e):void 0}}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}((0,t.useState)(null),2),r=n[0],o=n[1],u=null;if(!r){if(tr){var i=(0,F.getSessionStore)().getState();i.loaded&&(u=i.session)}else tr=new Promise((function(t){var n=function(n){var r=n.loaded,o=n.session;r&&(t(o),u=o,e.current&&e.current(),e.current=void 0)};n((0,F.getSessionStore)().getState()),u||(e.current=(0,F.getSessionStore)().subscribe(n))}));if(!u)throw tr;o(u)}(0,t.useEffect)((function(){return e.current||(e.current=(0,F.getSessionStore)().subscribe((function(t){var e=t.loaded,n=t.session;e&&(u=n,o(n))}))),function(){e.current&&e.current(),e.current=void 0}}),[]);var a=r||u;if(!a)throw tr?(console.warn("useSession is in an unexpected state. Attempting to recover."),tr):Error("useSession is in an invalid state.");return a}var ar=p(688),cr=p(332),lr=p.n(cr);function sr(e){var n,r=E((0,F.getVisitStore)()),o=r.patientUuid,u=r.manuallySetVisitUuid,i=e&&o==e?u:null,a="?patient=".concat(e,"&v=").concat(F.defaultVisitCustomRepresentation,"&includeInactive=false"),c="/".concat(i),l=(0,On.default)(e?"/ws/rest/v1/visit".concat(a):null,F.openmrsFetch),s=l.data,f=l.error,p=l.mutate,d=l.isValidating,y=(0,On.default)(e&&i?"/ws/rest/v1/visit".concat(c):null,F.openmrsFetch),m=y.data,b=y.error,v=y.mutate,g=y.isValidating,h=(0,t.useMemo)((function(){return null!==(n=null==s?void 0:s.data.results.find((function(t){return null===t.stopDatetime})))&&void 0!==n?n:null}),[s]),S=(0,t.useMemo)((function(){return i?null==m?void 0:m.data:null!=h?h:null}),[m,h,i]);return{error:f||b,mutate:function(){p(),v()},isValidating:d||g,activeVisit:h,currentVisit:S,currentVisitIsRetrospective:Boolean(i),isLoading:Boolean((!s||i&&!m)&&(!f||!b))}}function fr(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}function pr(){var e=function(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=n){var r,o,u=[],i=!0,a=!1;try{for(n=n.call(t);!(i=(r=n.next()).done)&&(u.push(r.value),!e||u.length!==e);i=!0);}catch(t){a=!0,o=t}finally{try{i||null==n.return||n.return()}finally{if(a)throw o}}return u}}(t,e)||function(t,e){if(t){if("string"==typeof t)return fr(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?fr(t,e):void 0}}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}((0,t.useState)([]),2),n=e[0],r=e[1];return(0,t.useEffect)((function(){var t=(0,F.getVisitTypes)().subscribe((function(t){r(t)}),(function(t){return console.error(t)}));return function(){return t.unsubscribe()}}),[]),n}function dr(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}ar.default.extend(lr());var yr=10;function mr(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:yr,r=function(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=n){var r,o,u=[],i=!0,a=!1;try{for(n=n.call(t);!(i=(r=n.next()).done)&&(u.push(r.value),!e||u.length!==e);i=!0);}catch(t){a=!0,o=t}finally{try{i||null==n.return||n.return()}finally{if(a)throw o}}return u}}(t,e)||function(t,e){if(t){if("string"==typeof t)return dr(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?dr(t,e):void 0}}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}((0,t.useState)(1),2),o=r[0],u=r[1],i=(0,t.useMemo)((function(){return"number"==typeof n&&n>0?Math.max(1,Math.ceil(e.length/n)):1}),[e.length,n]),a=(0,t.useMemo)((function(){var t=(o-1)*n,r=(o+0)*n;return e.slice(t,r)}),[e,o,n]),c=(0,t.useCallback)((function(t){u(Math.max(1,Math.min(i,t)))}),[u,i]),l=(0,t.useCallback)((function(){o<i&&u(o+1)}),[o,i,u]),s=(0,t.useCallback)((function(){o>1&&u(o-1)}),[o,u]);return(0,t.useMemo)((function(){return{results:a,totalPages:i,currentPage:o,paginated:e.length>n,showNextButton:o<i,showPreviousButton:o>1,goTo:c,goToNext:l,goToPrevious:s}}),[a,i,e.length,n,o,c,l,s])}})(),d})())}}}));
|
|
1
|
+
System.register(["react","@openmrs/esm-navigation","@openmrs/esm-extensions","@openmrs/esm-globals","@openmrs/esm-api","react-dom","react-i18next","swr","@openmrs/esm-config","dayjs"],(function(e,t){var n={},r={},o={},i={},u={},a={},c={},l={},s={},f={};return Object.defineProperty(a,"__esModule",{value:!0}),{setters:[function(e){n.Suspense=e.Suspense,n.default=e.default,n.useCallback=e.useCallback,n.useContext=e.useContext,n.useEffect=e.useEffect,n.useMemo=e.useMemo,n.useReducer=e.useReducer,n.useRef=e.useRef,n.useState=e.useState},function(e){r.interpolateUrl=e.interpolateUrl,r.navigate=e.navigate},function(e){o.getConnectedExtensions=e.getConnectedExtensions,o.getExtensionInternalStore=e.getExtensionInternalStore,o.getExtensionStore=e.getExtensionStore,o.registerExtensionSlot=e.registerExtensionSlot,o.renderExtension=e.renderExtension},function(e){i.subscribeConnectivityChanged=e.subscribeConnectivityChanged},function(e){u.attachmentUrl=e.attachmentUrl,u.defaultVisitCustomRepresentation=e.defaultVisitCustomRepresentation,u.fetchCurrentPatient=e.fetchCurrentPatient,u.getCurrentUser=e.getCurrentUser,u.getLocations=e.getLocations,u.getSessionStore=e.getSessionStore,u.getVisitStore=e.getVisitStore,u.getVisitTypes=e.getVisitTypes,u.openmrsFetch=e.openmrsFetch,u.userHasAccess=e.userHasAccess},function(e){Object.keys(e).forEach((function(t){a[t]=e[t]}))},function(e){c.I18nextProvider=e.I18nextProvider},function(e){l.default=e.default},function(e){s.getConfigStore=e.getConfigStore,s.getExtensionConfigFromStore=e.getExtensionConfigFromStore,s.getExtensionsConfigStore=e.getExtensionsConfigStore},function(e){f.default=e.default}],execute:function(){e((()=>{var e={332:function(e){e.exports=function(){"use strict";return function(e,t,n){t.prototype.isToday=function(){var e="YYYY-MM-DD",t=n();return this.format(e)===t.format(e)}}}()},645:(e,t,n)=>{"use strict";var r=n(493);t.createRoot=r.createRoot,t.hydrateRoot=r.hydrateRoot},570:()=>{System.register(["@openmrs/esm-state"],(function(e,t){var n={};return{setters:[function(e){n.getGlobalStore=e.getGlobalStore}],execute:function(){e(function(){"use strict";var e={685:function(e){e.exports=n}},t={};function r(n){var o=t[n];if(void 0!==o)return o.exports;var i=t[n]={exports:{}};return e[n](i,i.exports,r),i.exports}r.d=function(e,t){for(var n in t)r.o(t,n)&&!r.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var o={};return function(){var e=function(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r},t=function(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e},n=function(e){for(var n=1;n<arguments.length;n++){var r=null!=arguments[n]?arguments[n]:{},o=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(o=o.concat(Object.getOwnPropertySymbols(r).filter((function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable})))),o.forEach((function(n){t(e,n,r[n])}))}return e},i=function(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):function(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n.push.apply(n,r)}return n}(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))})),e},u=function(e,r,o){var u;p.setState((function(a){var c;return{flags:i(n({},a.flags),t({},e,{enabled:null!==(u=null===(c=a.flags[e])||void 0===c?void 0:c.enabled)&&void 0!==u&&u,label:r,description:o}))}}))},a=function(e){return p.getState().flags[e].enabled},c=function(e,t){p.subscribe((function(n){t(n.flags[e].enabled)}))},l=function(e,r){p.setState((function(o){return{flags:i(n({},o.flags),t({},e,i(n({},o.flags[e]),{enabled:r})))}}))};r.r(o),r.d(o,{featureFlagsStore:function(){return p},getFeatureFlag:function(){return a},registerFeatureFlag:function(){return u},setFeatureFlag:function(){return l},subscribeToFeatureFlag:function(){return c}});var s=r(685),f={flags:function(){var e={},t=!0,r=!1,o=void 0;try{for(var i,u=Object.keys(localStorage)[Symbol.iterator]();!(t=(i=u.next()).done);t=!0){var a=i.value;if(a.startsWith("openmrs:feature-flag:")){var c=a.replace("openmrs:feature-flag:",""),l=JSON.parse(localStorage.getItem("openmrs:feature-flag-meta:".concat(c))||"{}");e[c]=n({enabled:"true"===localStorage.getItem(a)},l)}}}catch(e){r=!0,o=e}finally{try{t||null==u.return||u.return()}finally{if(r)throw o}}return e}()},p=(0,s.getGlobalStore)("feature-flags",f);p.subscribe((function(t){var n,r=!0,o=!1,i=void 0;try{for(var u,a=Object.entries(t.flags)[Symbol.iterator]();!(r=(u=a.next()).done);r=!0){var c=function(e){if(Array.isArray(e))return e}(n=u.value)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,i=[],u=!0,a=!1;try{for(n=n.call(e);!(u=(r=n.next()).done)&&(i.push(r.value),2!==i.length);u=!0);}catch(e){a=!0,o=e}finally{try{u||null==n.return||n.return()}finally{if(a)throw o}}return i}}(n)||function(t,n){if(t){if("string"==typeof t)return e(t,2);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(r):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?e(t,2):void 0}}(n)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}(),l=c[0],s=c[1];localStorage.setItem("openmrs:feature-flag:".concat(l),s.enabled.toString()),localStorage.setItem("openmrs:feature-flag-meta:".concat(l),JSON.stringify({label:s.label,description:s.description}))}}catch(t){o=!0,i=t}finally{try{r||null==a.return||a.return()}finally{if(o)throw i}}}))}(),o}())}}}))},385:()=>{System.register([],(function(e,t){return{execute:function(){e(function(){"use strict";var e=function(e,t){var n=a[e];if(n)return n.active?console.error("Cannot override an existing store. Make sure that stores are only created once."):n.value.setState(t,!0),n.active=!0,n.value;var r=u()((function(){return t}));return a[e]={value:r,active:!0},r},t=function(e,t){var n=a[e];if(!n){var r=u()((function(){return null!=t?t:{}}));return a[e]={value:r,active:!1},r}return n.value},n=function(e,t,n){var r=t(e.getState());return e.subscribe((function(e){var o=t(e);o!==r&&(r=o,n(o))}))},r={d:function(e,t){for(var n in t)r.o(t,n)&&!r.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},o:function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r:function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},o={};r.r(o),r.d(o,{createGlobalStore:function(){return e},getGlobalStore:function(){return t},subscribeTo:function(){return n}});var i=function(e){var t,n=new Set,r=function(e,r){var o="function"==typeof e?e(t):e;if(!Object.is(o,t)){var i=t;t=(null!=r?r:"object"!=typeof o)?o:Object.assign({},t,o),n.forEach((function(e){return e(t,i)}))}},o=function(){return t},i={setState:r,getState:o,subscribe:function(e){return n.add(e),function(){return n.delete(e)}},destroy:function(){console.warn("[DEPRECATED] The `destroy` method will be unsupported in a future version. Instead use unsubscribe function returned by subscribe. Everything will be garbage-collected if store is garbage-collected."),n.clear()}};return t=e(r,o,i),i},u=function(e){return e?i(e):i},a={};return setTimeout((function(){"development"===window.spaEnv&&(window.stores=a)}),1e3),o}())}}}))},766:e=>{"use strict";e.exports=u},824:e=>{"use strict";e.exports=s},45:e=>{"use strict";e.exports=o},728:e=>{"use strict";e.exports=i},513:e=>{"use strict";e.exports=r},688:e=>{"use strict";e.exports=f},954:e=>{"use strict";e.exports=n},493:e=>{"use strict";e.exports=a},281:e=>{"use strict";e.exports=c},725:e=>{"use strict";e.exports=l}},t={};function p(n){var r=t[n];if(void 0!==r)return r.exports;var o=t[n]={exports:{}};return e[n].call(o.exports,o,o.exports,p),o.exports}p.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return p.d(t,{a:t}),t},p.d=(e,t)=>{for(var n in t)p.o(t,n)&&!p.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},p.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),p.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var d={};return(()=>{"use strict";p.r(d),p.d(d,{ComponentContext:()=>t,ConfigurableLink:()=>o,Extension:()=>l,ExtensionSlot:()=>D,UserHasAccess:()=>B,createUseStore:()=>P,getAsyncExtensionLifecycle:()=>ye,getAsyncLifecycle:()=>pe,getLifecycle:()=>fe,getSyncLifecycle:()=>de,isDesktop:()=>Gn,openmrsComponentDecorator:()=>se,useAbortController:()=>me,useAssignedExtensionIds:()=>Sn,useAssignedExtensions:()=>A,useAttachments:()=>wn,useBodyScrollLock:()=>jn,useConfig:()=>Rn,useConnectedExtensions:()=>R,useConnectivity:()=>y,useDebounce:()=>kn,useExtensionInternalStore:()=>Un,useExtensionSlot:()=>T,useExtensionSlotMeta:()=>Nn,useExtensionStore:()=>_,useFeatureFlag:()=>Dn,useForceUpdate:()=>Ln,useLayoutType:()=>Vn,useLocations:()=>Hn,useOnClickOutside:()=>qn,useOpenmrsSWR:()=>Kn,usePagination:()=>mr,usePatient:()=>or,useSession:()=>ur,useStore:()=>E,useStoreWithActions:()=>x,useVisit:()=>sr,useVisitTypes:()=>pr});var e=p(954),t=e.default.createContext({moduleName:""}),n=p(513);function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(t){var o=t.to,i=t.templateParams,u=t.onBeforeNavigate,a=t.children,c=function(e,t){if(null==e)return{};var n,r,o=function(e,t){if(null==e)return{};var n,r,o={},i=Object.keys(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}(t,["to","templateParams","onBeforeNavigate","children"]);return(0,e.useEffect)((function(){c.href&&console.warn("ConfigurableLink does not support the href prop. Use the 'to' prop instead. The provided href value is '".concat(c.href,"'")),c.onClick&&console.warn("ConfigurableLink does not support the onClick prop. Use the 'onBeforeNavigate' prop instead. The 'to' prop of the offending link is ".concat(o))}),[]),e.default.createElement("a",function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},o=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(o=o.concat(Object.getOwnPropertySymbols(n).filter((function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable})))),o.forEach((function(t){r(e,t,n[t])}))}return e}({onClick:function(e){return function(e,t,r,o){e.metaKey||e.ctrlKey||e.shiftKey||0!=e.button||(e.preventDefault(),null==o||o(e),(0,n.navigate)({to:t,templateParams:r}))}(e,o,i,u)},href:(0,n.interpolateUrl)(o,i)},c),a)}var i=p(45);function u(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function c(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter((function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable})))),r.forEach((function(t){a(e,t,n[t])}))}return e}var l=function(n){var r=n.state,o=n.children,a=n.wrap,l=function(e,t){if(null==e)return{};var n,r,o=function(e,t){if(null==e)return{};var n,r,o={},i=Object.keys(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}(n,["state","children","wrap"]),s=function(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,i=[],u=!0,a=!1;try{for(n=n.call(e);!(u=(r=n.next()).done)&&(i.push(r.value),!t||i.length!==t);u=!0);}catch(e){a=!0,o=e}finally{try{u||null==n.return||n.return()}finally{if(a)throw o}}return i}}(e,t)||function(e,t){if(e){if("string"==typeof e)return u(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?u(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}((0,e.useState)(),2),f=s[0],p=s[1],d=(0,e.useContext)(t).extension,y=(0,e.useRef)(null),m=(0,e.useRef)(Promise.resolve()),b=(0,e.useRef)(!1);(0,e.useEffect)((function(){a&&console.warn("'wrap' prop of Extension is being used ".concat((null==d?void 0:d.extensionId)?"by ".concat(d.extensionId," in ").concat(d.extensionSlotName):"",". This will be removed in a future release."))}),[]);var v=(0,e.useCallback)((function(e){p(e)}),[p]);(0,e.useEffect)((function(){if(null!=f&&(null==d?void 0:d.extensionSlotName)&&d.extensionSlotModuleName&&d.extensionSlotModuleName&&!y.current&&!b.current)return b.current=!0,(0,i.renderExtension)(f,d.extensionSlotName,d.extensionSlotModuleName,d.extensionId,void 0,r).then((function(e){y.current=e,b.current=!1})),function(){if(y&&y.current)switch(y.current.getStatus()){case"MOUNTING":y.current.mountPromise.then((function(){var e;"MOUNTED"===(null===(e=y.current)||void 0===e?void 0:e.getStatus())&&y.current.unmount()}));break;case"MOUNTED":y.current.unmount();break;case"UPDATING":m.current&&m.current.then((function(){var e;"MOUNTED"===(null===(e=y.current)||void 0===e?void 0:e.getStatus())&&y.current.unmount()}))}}}),[null==d?void 0:d.extensionSlotName,null==d?void 0:d.extensionId,null==d?void 0:d.extensionSlotModuleName,f]),(0,e.useEffect)((function(){y.current&&y.current.update&&"UNMOUNTING"!==y.current.getStatus()&&Promise.all([y.current.mountPromise,m.current]).then((function(){var e;"MOUNTED"===(null==y||null===(e=y.current)||void 0===e?void 0:e.getStatus())&&y.current.update&&(m.current=y.current.update(c({},r)).catch((function(e){var t,n,r;if(n=e,!(null!=(r=Error)&&"undefined"!=typeof Symbol&&r[Symbol.hasInstance]?r[Symbol.hasInstance](n):n instanceof r)||!e.message.includes("minified message #32")||"MOUNTED"===(null===(t=y.current)||void 0===t?void 0:t.getStatus()))throw e})))}))}),[r]);var g=e.default.createElement("div",c({ref:v,"data-extension-id":null==d?void 0:d.extensionId,style:{position:"relative"}},l));return"function"!=typeof o||e.default.isValidElement(o)?d&&a?a(g,d):g:e.default.createElement(e.default.Fragment,null,o(g,d))},s=p(728);function f(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function y(){var t=function(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,i=[],u=!0,a=!1;try{for(n=n.call(e);!(u=(r=n.next()).done)&&(i.push(r.value),!t||i.length!==t);u=!0);}catch(e){a=!0,o=e}finally{try{u||null==n.return||n.return()}finally{if(a)throw o}}return i}}(e,t)||function(e,t){if(e){if("string"==typeof e)return f(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?f(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}((0,e.useState)(window.navigator.onLine),2),n=t[0],r=t[1];return(0,e.useEffect)((function(){return(0,s.subscribeConnectivityChanged)((function(e){var t=e.online;return r(t)}))}),[]),n}var m=p(385);function b(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function v(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function g(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter((function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable})))),r.forEach((function(t){v(e,t,n[t])}))}return e}function h(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,i=[],u=!0,a=!1;try{for(n=n.call(e);!(u=(r=n.next()).done)&&(i.push(r.value),!t||i.length!==t);u=!0);}catch(e){a=!0,o=e}finally{try{u||null==n.return||n.return()}finally{if(a)throw o}}return i}}(e,t)||O(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function S(e){return function(e){if(Array.isArray(e))return b(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||O(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function O(e,t){if(e){if("string"==typeof e)return b(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?b(e,t):void 0}}function w(e,t){var n=function(n){r[n]=function(){for(var r=arguments.length,o=new Array(r),i=0;i<r;i++)o[i]=arguments[i];e.setState((function(e){var r,i=[e].concat(S(o));return(r=t)[n].apply(r,S(i))}))}};"function"==typeof t&&(t=t(e));var r={};for(var o in t)n(o);return r}var j=function(e){return e};function E(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:j,r=arguments.length>2?arguments[2]:void 0,o=h((0,e.useState)((function(){return n(t.getState())})),2),i=o[0],u=o[1];return(0,e.useEffect)((function(){return(0,m.subscribeTo)(t,n,u)}),[t,n]),g({},i,(0,e.useMemo)((function(){return r?w(t,r):{}}),[t,r]))}function x(e,t){return E(e,j,t)}function P(t){return function(n){var r=h((0,e.useState)(t.getState()),2),o=r[0],i=r[1];return(0,e.useEffect)((function(){return t.subscribe((function(e){return i(e)}))}),[]),g({},o,(0,e.useMemo)((function(){return n?w(t,n):{}}),[n]))}}var _=P((0,i.getExtensionStore)());function A(t){var n=_().slots;return(0,e.useMemo)((function(){var e,r;return null!==(r=null===(e=n[t])||void 0===e?void 0:e.assignedExtensions)&&void 0!==r?r:[]}),[n,t])}var C=p(570);function I(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function M(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,i=[],u=!0,a=!1;try{for(n=n.call(e);!(u=(r=n.next()).done)&&(i.push(r.value),!t||i.length!==t);u=!0);}catch(e){a=!0,o=e}finally{try{u||null==n.return||n.return()}finally{if(a)throw o}}return i}}(e,t)||function(e,t){if(e){if("string"==typeof e)return I(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?I(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function R(t){var n=y(),r=A(t),o=E(C.featureFlagsStore),u=(0,e.useMemo)((function(){return Object.entries(o.flags).filter((function(e){return M(e,2)[1].enabled})).map((function(e){return M(e,1)[0]}))}),[o.flags]);return(0,e.useMemo)((function(){return(0,i.getConnectedExtensions)(r,n,u)}),[r,n,u])}function T(n){var r=(0,e.useContext)(t).moduleName;if(!r)throw Error("ComponentContext has not been provided. This should come from @openmrs/esm-react-utils.");return(0,e.useEffect)((function(){(0,i.registerExtensionSlot)(r,n)}),[]),{extensions:R(n),extensionSlotName:n,extensionSlotModuleName:r}}function k(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function U(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter((function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable})))),r.forEach((function(t){k(e,t,n[t])}))}return e}function N(e){return e}function D(n){var r=n.name,o=n.extensionSlotName,i=n.select,u=void 0===i?N:i,a=n.children,c=n.state,s=n.style,f=function(e,t){if(null==e)return{};var n,r,o=function(e,t){if(null==e)return{};var n,r,o={},i=Object.keys(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}(n,["name","extensionSlotName","select","children","state","style"]);if(a&&c)throw new Error("Both children and state have been provided. If children are provided, the state must be passed as a prop to the `Extension` component.");var p,d,y,m,b=null!=r?r:o,v=(0,e.useRef)(null),g=T(b),h=g.extensions,S=g.extensionSlotModuleName,O=(0,e.useMemo)((function(){return u(h)}),[u,h]),w=(0,e.useMemo)((function(){if("function"==typeof a&&!e.default.isValidElement(a))return O.map((function(e){return a(e)}))}),[a,O]);return e.default.createElement("div",U({ref:v,"data-extension-slot-name":b,"data-extension-slot-module-name":S,style:(y=U({},s),m={position:"relative"},m=null!=m?m:{},Object.getOwnPropertyDescriptors?Object.defineProperties(y,Object.getOwnPropertyDescriptors(m)):function(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n.push.apply(n,r)}return n}(Object(m)).forEach((function(e){Object.defineProperty(y,e,Object.getOwnPropertyDescriptor(m,e))})),y)},f),b&&O.map((function(n,r){return e.default.createElement(t.Provider,{key:n.id,value:{moduleName:S,extension:{extensionId:n.id,extensionSlotName:b,extensionSlotModuleName:S}}},null!==(d=null!==(p=null==w?void 0:w[r])&&void 0!==p?p:"function"!=typeof a?a:null)&&void 0!==d?d:e.default.createElement(l,{state:c}))})))}var F=p(766);function L(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var B=function(t){var n=t.privilege,r=t.fallback,o=t.children,i=function(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,i=[],u=!0,a=!1;try{for(n=n.call(e);!(u=(r=n.next()).done)&&(i.push(r.value),!t||i.length!==t);u=!0);}catch(e){a=!0,o=e}finally{try{u||null==n.return||n.return()}finally{if(a)throw o}}return i}}(e,t)||function(e,t){if(e){if("string"==typeof e)return L(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?L(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}((0,e.useState)(null),2),u=i[0],a=i[1];return(0,e.useEffect)((function(){var e=(0,F.getCurrentUser)({includeAuthStatus:!1}).subscribe(a);return function(){return e.unsubscribe()}}),[]),u&&(0,F.userHasAccess)(n,u)?e.default.createElement(e.default.Fragment,null,o):r?e.default.createElement(e.default.Fragment,null,r):null},z=p(645);function V(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 $(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?V(Object(n),!0).forEach((function(t){W(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):V(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function G(e){return(G="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 W(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function H(e){return(H="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 q(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(H(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(H(e)));return e}}var Y=null;try{Y=require("react").createContext()}catch(V){}var K={React:null,ReactDOM:null,ReactDOMClient:null,rootComponent:null,loadRootComponent:null,renderType:"createRoot",errorBoundary:null,errorBoundaryClass:null,domElementGetter:null,parcelCanUpdate:!0,suppressComponentDidCatchWarning:!1,domElements:{},renderResults:{},updateResolves:{},unmountResolves:{}};function J(e){if("object"!==G(e))throw new Error("single-spa-react requires a configuration object");var t=$($({},K),e);if(!t.React)throw new Error("single-spa-react must be passed opts.React");if(!t.ReactDOM&&!t.ReactDOMClient)throw new Error("single-spa-react must be passed opts.ReactDOM or opts.ReactDOMClient");if(!t.rootComponent&&!t.loadRootComponent)throw new Error("single-spa-react must be passed opts.rootComponent or opts.loadRootComponent");if(t.errorBoundary&&"function"!=typeof t.errorBoundary)throw Error("The errorBoundary opt for single-spa-react must either be omitted or be a function that returns React elements");!Y&&t.React.createContext&&(Y=t.React.createContext()),t.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}(t);var n={bootstrap:Z.bind(null,t),mount:Q.bind(null,t),unmount:X.bind(null,t)};return t.parcelCanUpdate&&(n.update=ee.bind(null,t)),n}function Z(e,t){return e.rootComponent?Promise.resolve():e.loadRootComponent(t).then((function(t){e.rootComponent=t}))}function Q(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 o=re(e,t,(function(){n(this)})),i=q(e,t)(),u=function(e){var t=e.renderType,n=e.elementToRender,r=e.domElement,o=e.reactDom[t];if("function"!=typeof o)throw new Error('renderType "'.concat(t,'" did not return a function.'));switch(t){case"createRoot":case"unstable_createRoot":case"createBlockingRoot":case"unstable_createBlockingRoot":var i=o(r);return i.render(n),i;case"hydrateRoot":return o(r,n);default:return o(n,r),null}}({elementToRender:o,domElement:i,reactDom:te(e),renderType:ne(e)});e.domElements[t.name]=i,e.renderResults[t.name]=u}))}function X(e,t){return new Promise((function(n){e.unmountResolves[t.name]=n;var r=e.renderResults[t.name];r&&r.unmount?r.unmount():te(e).unmountComponentAtNode(e.domElements[t.name]),delete e.domElements[t.name],delete e.renderResults[t.name]}))}function ee(e,t){return new Promise((function(n){e.updateResolves[t.name]||(e.updateResolves[t.name]=[]),e.updateResolves[t.name].push(n);var r=re(e,t,null),o=e.renderResults[t.name];if(o&&o.render)o.render(r);else{var i=q(e,t)();te(e).render(r,i)}}))}function te(e){return e.ReactDOMClient||e.ReactDOM}function ne(e){return"function"==typeof e.renderType?e.renderType():e.renderType}function re(e,t,n){var r=e.React.createElement(e.rootComponent,t),o=Y?e.React.createElement(Y.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),o=e.React.createElement(e.errorBoundaryClass,t,o)),e.React.createElement(e.SingleSpaRoot,$($({},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])}}),o)}var oe=p(281);function ie(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 ue(e){return ue=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},ue(e)}function ae(e,t){return ae=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},ae(e,t)}function ce(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=ue(e);if(t){var o=ue(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return function(e,t){return!t||"object"!=((n=t)&&"undefined"!=typeof Symbol&&n.constructor===Symbol?"symbol":typeof n)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t;var n}(this,n)}}var le={strictMode:!0,throwErrorsToConsole:!0,disableTranslations:!1};function se(n){if("object"!=typeof n||"string"!=typeof n.featureName||"string"!=typeof n.moduleName)throw new Error("Invalid options");var r=Object.assign({},le,n);return function(n){var o,i,u,a;return i=o=function(o){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&ae(e,t)}(c,o);var i,u,a=ce(c);function c(e){var t;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,c),(t=a.call(this,e)).state={caughtError:null,caughtErrorInfo:null,config:{moduleName:r.moduleName,extension:e._extensionContext}},t}return i=c,(u=[{key:"componentDidCatch",value:function(e,t){t&&t.componentStack&&(e.extra=Object.assign(e.extra||{},{componentStack:t.componentStack})),r.throwErrorsToConsole&&setTimeout((function(){throw e})),this.setState({caughtError:e,caughtErrorInfo:t})}},{key:"render",value:function(){if(this.state.caughtError)return e.default.createElement("div",null,"An error has occurred. Please try reloading the page.");var o=e.default.createElement(e.Suspense,{fallback:null},e.default.createElement(t.Provider,{value:this.state.config},r.disableTranslations?e.default.createElement(n,this.props):e.default.createElement(oe.I18nextProvider,{i18n:window.i18next,defaultNS:r.moduleName},e.default.createElement(n,this.props))));return r.strictMode||!e.default.StrictMode?o:e.default.createElement(e.default.StrictMode,null,o)}}])&&ie(i.prototype,u),c}(e.default.Component),u="displayName",a="OpenmrsReactComponent(".concat(r.featureName,")"),u in i?Object.defineProperty(i,u,{value:a,enumerable:!0,configurable:!0,writable:!0}):i[u]=a,o}}function fe(t,n){return J({React:e.default,ReactDOMClient:z,rootComponent:se(n)(t)})}function pe(e,t){return function(){return e().then((function(e){return fe(e.default,t)}))}}function de(e,t){return function(){return Promise.resolve(fe(e,t))}}var ye=pe;function me(){var t=(0,e.useRef)();return t.current&&!t.current.signal.aborted||(t.current=new AbortController),(0,e.useEffect)((function(){var e=t.current;return function(){return null==e?void 0:e.abort()}}),[]),t.current}const be=me,ve=function(e,t){return e===t||e!=e&&t!=t},ge=function(e,t){for(var n=e.length;n--;)if(ve(e[n][0],t))return n;return-1};var he=Array.prototype.splice;function Se(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}Se.prototype.clear=function(){this.__data__=[],this.size=0},Se.prototype.delete=function(e){var t=this.__data__,n=ge(t,e);return!(n<0||(n==t.length-1?t.pop():he.call(t,n,1),--this.size,0))},Se.prototype.get=function(e){var t=this.__data__,n=ge(t,e);return n<0?void 0:t[n][1]},Se.prototype.has=function(e){return ge(this.__data__,e)>-1},Se.prototype.set=function(e,t){var n=this.__data__,r=ge(n,e);return r<0?(++this.size,n.push([e,t])):n[r][1]=t,this};const Oe=Se,we="object"==typeof global&&global&&global.Object===Object&&global;var je="object"==typeof self&&self&&self.Object===Object&&self;const Ee=we||je||Function("return this")(),xe=Ee.Symbol;var Pe=Object.prototype,_e=Pe.hasOwnProperty,Ae=Pe.toString,Ce=xe?xe.toStringTag:void 0;var Ie=Object.prototype.toString;var Me=xe?xe.toStringTag:void 0;const Re=function(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":Me&&Me in Object(e)?function(e){var t=_e.call(e,Ce),n=e[Ce];try{e[Ce]=void 0;var r=!0}catch(e){}var o=Ae.call(e);return r&&(t?e[Ce]=n:delete e[Ce]),o}(e):function(e){return Ie.call(e)}(e)},Te=function(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)},ke=function(e){if(!Te(e))return!1;var t=Re(e);return"[object Function]"==t||"[object GeneratorFunction]"==t||"[object AsyncFunction]"==t||"[object Proxy]"==t},Ue=Ee["__core-js_shared__"];var Ne,De=(Ne=/[^.]+$/.exec(Ue&&Ue.keys&&Ue.keys.IE_PROTO||""))?"Symbol(src)_1."+Ne:"";var Fe=Function.prototype.toString;const Le=function(e){if(null!=e){try{return Fe.call(e)}catch(e){}try{return e+""}catch(e){}}return""};var Be=/^\[object .+?Constructor\]$/,ze=Function.prototype,Ve=Object.prototype,$e=ze.toString,Ge=Ve.hasOwnProperty,We=RegExp("^"+$e.call(Ge).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");const He=function(e){return!(!Te(e)||(t=e,De&&De in t))&&(ke(e)?We:Be).test(Le(e));var t},qe=function(e,t){var n=function(e,t){return null==e?void 0:e[t]}(e,t);return He(n)?n:void 0},Ye=qe(Ee,"Map"),Ke=qe(Object,"create");var Je=Object.prototype.hasOwnProperty;var Ze=Object.prototype.hasOwnProperty;function Qe(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}Qe.prototype.clear=function(){this.__data__=Ke?Ke(null):{},this.size=0},Qe.prototype.delete=function(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t},Qe.prototype.get=function(e){var t=this.__data__;if(Ke){var n=t[e];return"__lodash_hash_undefined__"===n?void 0:n}return Je.call(t,e)?t[e]:void 0},Qe.prototype.has=function(e){var t=this.__data__;return Ke?void 0!==t[e]:Ze.call(t,e)},Qe.prototype.set=function(e,t){var n=this.__data__;return this.size+=this.has(e)?0:1,n[e]=Ke&&void 0===t?"__lodash_hash_undefined__":t,this};const Xe=Qe,et=function(e,t){var n,r,o=e.__data__;return("string"==(r=typeof(n=t))||"number"==r||"symbol"==r||"boolean"==r?"__proto__"!==n:null===n)?o["string"==typeof t?"string":"hash"]:o.map};function tt(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}tt.prototype.clear=function(){this.size=0,this.__data__={hash:new Xe,map:new(Ye||Oe),string:new Xe}},tt.prototype.delete=function(e){var t=et(this,e).delete(e);return this.size-=t?1:0,t},tt.prototype.get=function(e){return et(this,e).get(e)},tt.prototype.has=function(e){return et(this,e).has(e)},tt.prototype.set=function(e,t){var n=et(this,e),r=n.size;return n.set(e,t),this.size+=n.size==r?0:1,this};const nt=tt;function rt(e){var t=this.__data__=new Oe(e);this.size=t.size}rt.prototype.clear=function(){this.__data__=new Oe,this.size=0},rt.prototype.delete=function(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n},rt.prototype.get=function(e){return this.__data__.get(e)},rt.prototype.has=function(e){return this.__data__.has(e)},rt.prototype.set=function(e,t){var n=this.__data__;if(n instanceof Oe){var r=n.__data__;if(!Ye||r.length<199)return r.push([e,t]),this.size=++n.size,this;n=this.__data__=new nt(r)}return n.set(e,t),this.size=n.size,this};const ot=rt;function it(e){var t=-1,n=null==e?0:e.length;for(this.__data__=new nt;++t<n;)this.add(e[t])}it.prototype.add=it.prototype.push=function(e){return this.__data__.set(e,"__lodash_hash_undefined__"),this},it.prototype.has=function(e){return this.__data__.has(e)};const ut=it,at=function(e,t){for(var n=-1,r=null==e?0:e.length;++n<r;)if(t(e[n],n,e))return!0;return!1},ct=function(e,t,n,r,o,i){var u=1&n,a=e.length,c=t.length;if(a!=c&&!(u&&c>a))return!1;var l=i.get(e),s=i.get(t);if(l&&s)return l==t&&s==e;var f=-1,p=!0,d=2&n?new ut:void 0;for(i.set(e,t),i.set(t,e);++f<a;){var y=e[f],m=t[f];if(r)var b=u?r(m,y,f,t,e,i):r(y,m,f,e,t,i);if(void 0!==b){if(b)continue;p=!1;break}if(d){if(!at(t,(function(e,t){if(u=t,!d.has(u)&&(y===e||o(y,e,n,r,i)))return d.push(t);var u}))){p=!1;break}}else if(y!==m&&!o(y,m,n,r,i)){p=!1;break}}return i.delete(e),i.delete(t),p},lt=Ee.Uint8Array,st=function(e){var t=-1,n=Array(e.size);return e.forEach((function(e,r){n[++t]=[r,e]})),n},ft=function(e){var t=-1,n=Array(e.size);return e.forEach((function(e){n[++t]=e})),n};var pt=xe?xe.prototype:void 0,dt=pt?pt.valueOf:void 0;const yt=Array.isArray;var mt=Object.prototype.propertyIsEnumerable,bt=Object.getOwnPropertySymbols;const vt=bt?function(e){return null==e?[]:(e=Object(e),function(e,t){for(var n=-1,r=null==e?0:e.length,o=0,i=[];++n<r;){var u=e[n];t(u,n,e)&&(i[o++]=u)}return i}(bt(e),(function(t){return mt.call(e,t)})))}:function(){return[]},gt=function(e){return null!=e&&"object"==typeof e},ht=function(e){return gt(e)&&"[object Arguments]"==Re(e)};var St=Object.prototype,Ot=St.hasOwnProperty,wt=St.propertyIsEnumerable,jt=ht(function(){return arguments}())?ht:function(e){return gt(e)&&Ot.call(e,"callee")&&!wt.call(e,"callee")};const Et=jt;var xt="object"==typeof exports&&exports&&!exports.nodeType&&exports,Pt=xt&&"object"==typeof module&&module&&!module.nodeType&&module,_t=Pt&&Pt.exports===xt?Ee.Buffer:void 0;const At=(_t?_t.isBuffer:void 0)||function(){return!1};var Ct=/^(?:0|[1-9]\d*)$/;const It=function(e,t){var n=typeof e;return!!(t=null==t?9007199254740991:t)&&("number"==n||"symbol"!=n&&Ct.test(e))&&e>-1&&e%1==0&&e<t},Mt=function(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=9007199254740991};var Rt={};Rt["[object Float32Array]"]=Rt["[object Float64Array]"]=Rt["[object Int8Array]"]=Rt["[object Int16Array]"]=Rt["[object Int32Array]"]=Rt["[object Uint8Array]"]=Rt["[object Uint8ClampedArray]"]=Rt["[object Uint16Array]"]=Rt["[object Uint32Array]"]=!0,Rt["[object Arguments]"]=Rt["[object Array]"]=Rt["[object ArrayBuffer]"]=Rt["[object Boolean]"]=Rt["[object DataView]"]=Rt["[object Date]"]=Rt["[object Error]"]=Rt["[object Function]"]=Rt["[object Map]"]=Rt["[object Number]"]=Rt["[object Object]"]=Rt["[object RegExp]"]=Rt["[object Set]"]=Rt["[object String]"]=Rt["[object WeakMap]"]=!1;var Tt="object"==typeof exports&&exports&&!exports.nodeType&&exports,kt=Tt&&"object"==typeof module&&module&&!module.nodeType&&module,Ut=kt&&kt.exports===Tt&&we.process,Nt=function(){try{return kt&&kt.require&&kt.require("util").types||Ut&&Ut.binding&&Ut.binding("util")}catch(e){}}(),Dt=Nt&&Nt.isTypedArray;const Ft=Dt?(Lt=Dt,function(e){return Lt(e)}):function(e){return gt(e)&&Mt(e.length)&&!!Rt[Re(e)]};var Lt,Bt=Object.prototype.hasOwnProperty;const zt=function(e,t){var n=yt(e),r=!n&&Et(e),o=!n&&!r&&At(e),i=!n&&!r&&!o&&Ft(e),u=n||r||o||i,a=u?function(e,t){for(var n=-1,r=Array(e);++n<e;)r[n]=t(n);return r}(e.length,String):[],c=a.length;for(var l in e)!t&&!Bt.call(e,l)||u&&("length"==l||o&&("offset"==l||"parent"==l)||i&&("buffer"==l||"byteLength"==l||"byteOffset"==l)||It(l,c))||a.push(l);return a};var Vt=Object.prototype;const $t=function(e,t){return function(n){return e(t(n))}}(Object.keys,Object);var Gt=Object.prototype.hasOwnProperty;const Wt=function(e){if(n=(t=e)&&t.constructor,t!==("function"==typeof n&&n.prototype||Vt))return $t(e);var t,n,r=[];for(var o in Object(e))Gt.call(e,o)&&"constructor"!=o&&r.push(o);return r},Ht=function(e){return null!=(t=e)&&Mt(t.length)&&!ke(t)?zt(e):Wt(e);var t},qt=function(e){return function(e,t,n){var r=t(e);return yt(e)?r:function(e,t){for(var n=-1,r=t.length,o=e.length;++n<r;)e[o+n]=t[n];return e}(r,n(e))}(e,Ht,vt)};var Yt=Object.prototype.hasOwnProperty;const Kt=qe(Ee,"DataView"),Jt=qe(Ee,"Promise"),Zt=qe(Ee,"Set"),Qt=qe(Ee,"WeakMap");var Xt="[object Map]",en="[object Promise]",tn="[object Set]",nn="[object WeakMap]",rn="[object DataView]",on=Le(Kt),un=Le(Ye),an=Le(Jt),cn=Le(Zt),ln=Le(Qt),sn=Re;(Kt&&sn(new Kt(new ArrayBuffer(1)))!=rn||Ye&&sn(new Ye)!=Xt||Jt&&sn(Jt.resolve())!=en||Zt&&sn(new Zt)!=tn||Qt&&sn(new Qt)!=nn)&&(sn=function(e){var t=Re(e),n="[object Object]"==t?e.constructor:void 0,r=n?Le(n):"";if(r)switch(r){case on:return rn;case un:return Xt;case an:return en;case cn:return tn;case ln:return nn}return t});const fn=sn;var pn="[object Arguments]",dn="[object Array]",yn="[object Object]",mn=Object.prototype.hasOwnProperty;const bn=function(e,t,n,r,o,i){var u=yt(e),a=yt(t),c=u?dn:fn(e),l=a?dn:fn(t),s=(c=c==pn?yn:c)==yn,f=(l=l==pn?yn:l)==yn,p=c==l;if(p&&At(e)){if(!At(t))return!1;u=!0,s=!1}if(p&&!s)return i||(i=new ot),u||Ft(e)?ct(e,t,n,r,o,i):function(e,t,n,r,o,i,u){switch(n){case"[object DataView]":if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case"[object ArrayBuffer]":return!(e.byteLength!=t.byteLength||!i(new lt(e),new lt(t)));case"[object Boolean]":case"[object Date]":case"[object Number]":return ve(+e,+t);case"[object Error]":return e.name==t.name&&e.message==t.message;case"[object RegExp]":case"[object String]":return e==t+"";case"[object Map]":var a=st;case"[object Set]":var c=1&r;if(a||(a=ft),e.size!=t.size&&!c)return!1;var l=u.get(e);if(l)return l==t;r|=2,u.set(e,t);var s=ct(a(e),a(t),r,o,i,u);return u.delete(e),s;case"[object Symbol]":if(dt)return dt.call(e)==dt.call(t)}return!1}(e,t,c,n,r,o,i);if(!(1&n)){var d=s&&mn.call(e,"__wrapped__"),y=f&&mn.call(t,"__wrapped__");if(d||y){var m=d?e.value():e,b=y?t.value():t;return i||(i=new ot),o(m,b,n,r,i)}}return!!p&&(i||(i=new ot),function(e,t,n,r,o,i){var u=1&n,a=qt(e),c=a.length;if(c!=qt(t).length&&!u)return!1;for(var l=c;l--;){var s=a[l];if(!(u?s in t:Yt.call(t,s)))return!1}var f=i.get(e),p=i.get(t);if(f&&p)return f==t&&p==e;var d=!0;i.set(e,t),i.set(t,e);for(var y=u;++l<c;){var m=e[s=a[l]],b=t[s];if(r)var v=u?r(b,m,s,t,e,i):r(m,b,s,e,t,i);if(!(void 0===v?m===b||o(m,b,n,r,i):v)){d=!1;break}y||(y="constructor"==s)}if(d&&!y){var g=e.constructor,h=t.constructor;g==h||!("constructor"in e)||!("constructor"in t)||"function"==typeof g&&g instanceof g&&"function"==typeof h&&h instanceof h||(d=!1)}return i.delete(e),i.delete(t),d}(e,t,n,r,o,i))},vn=function e(t,n,r,o,i){return t===n||(null==t||null==n||!gt(t)&&!gt(n)?t!=t&&n!=n:bn(t,n,r,o,e,i))},gn=function(e,t){return vn(e,t)};function hn(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function Sn(t){var n=function(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,i=[],u=!0,a=!1;try{for(n=n.call(e);!(u=(r=n.next()).done)&&(i.push(r.value),!t||i.length!==t);u=!0);}catch(e){a=!0,o=e}finally{try{u||null==n.return||n.return()}finally{if(a)throw o}}return i}}(e,t)||function(e,t){if(e){if("string"==typeof e)return hn(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?hn(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}((0,e.useState)([]),2),r=n[0],o=n[1];return(0,e.useEffect)((function(){return(0,i.getExtensionStore)().subscribe((function(e){var n,i,u=null!==(i=null===(n=e.slots[t])||void 0===n?void 0:n.assignedExtensions.map((function(e){return e.id})))&&void 0!==i?i:[];gn(u,r)||o(u)}))}),[]),r}var On=p(725);function wn(t,n){var r,o=(0,On.default)("".concat(F.attachmentUrl,"?patient=").concat(t,"&includeEncounterless=").concat(n),F.openmrsFetch),i=o.data,u=o.error,a=o.mutate,c=o.isLoading,l=o.isValidating;return(0,e.useMemo)((function(){return{isLoading:c,data:null!==(r=null==i?void 0:i.data.results)&&void 0!==r?r:[],error:u,mutate:a,isValidating:l}}),[i,u,c,l,a])}function jn(t){(0,e.useEffect)((function(){if(t){var e=window.getComputedStyle(document.body).overflow;return document.body.style.overflow="hidden",function(){document.body.style.overflow=e}}}),[t])}var En=p(824);function xn(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function Pn(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function _n(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter((function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable})))),r.forEach((function(t){Pn(e,t,n[t])}))}return e}function An(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,i=[],u=!0,a=!1;try{for(n=n.call(e);!(u=(r=n.next()).done)&&(i.push(r.value),!t||i.length!==t);u=!0);}catch(e){a=!0,o=e}finally{try{u||null==n.return||n.return()}finally{if(a)throw o}}return i}}(e,t)||function(e,t){if(e){if("string"==typeof e)return xn(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?xn(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}var Cn={},In='No ComponentContext has been provided. This should come from "openmrsComponentDecorator".\nUsually this is already applied when using "getAsyncLifecycle" or "getSyncLifecycle".';function Mn(t){var n=(0,e.useMemo)(En.getExtensionsConfigStore,[]),r=function(t,n){var r=An((0,e.useState)(function(e,t){return t?function(){var n=e.getState(),r=(0,En.getExtensionConfigFromStore)(n,t.extensionSlotName,t.extensionId);if(r.loaded&&r.config)return r.config}:null}(t,n)),2),o=r[0],i=r[1];return(0,e.useEffect)((function(){if(n)return t.subscribe((function(e){var t=(0,En.getExtensionConfigFromStore)(e,n.extensionSlotName,n.extensionId);t.loaded&&t.config&&!gn(t.config,o)&&i(t.config)}))}),[t,n,o]),o}(n,t);if(!r&&t){var o="".concat(t.extensionSlotName,"-").concat(t.extensionId);throw!Cn[o]&&n&&(Cn[o]=function(e,t){return new Promise((function(n){var r=e.subscribe((function(e){var o=(0,En.getExtensionConfigFromStore)(e,t.extensionSlotName,t.extensionId);o.loaded&&o.config&&(n(o.config),r())}))}))}(n,t)),Cn[o]}return r||{}}function Rn(n){var r,o=(0,e.useContext)(t),i=o.moduleName,u=o.extension,a=null!==(r=null==n?void 0:n.externalModuleName)&&void 0!==r?r:i;if(!a&&!u)throw Error(In);var c=function(t){var n=(0,e.useMemo)((function(){return(0,En.getConfigStore)(t)}),[t]),r=t,o=function(t){var n=An((0,e.useState)(function(e){return function(){var t=e.getState();return t.loaded&&t.config?t.config:null}}(t)),2),r=n[0],o=n[1];return(0,e.useEffect)((function(){return null==t?void 0:t.subscribe((function(e){e.loaded&&e.config&&o(e.config)}))}),[t]),r}(n);if(!o)throw Cn[r]||(Cn[r]=function(e){return new Promise((function(t){var n=e.subscribe((function(e){e.loaded&&e.config&&(t(e.config),n())}))}))}(n)),Cn[r];return o}(a),l=Mn(u);return(0,e.useMemo)((function(){return(null==n?void 0:n.externalModuleName)&&a===n.externalModuleName?_n({},c):_n({},c,l)}),[a,null==n?void 0:n.externalModuleName,c,l])}function Tn(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function kn(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:300,r=function(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,i=[],u=!0,a=!1;try{for(n=n.call(e);!(u=(r=n.next()).done)&&(i.push(r.value),!t||i.length!==t);u=!0);}catch(e){a=!0,o=e}finally{try{u||null==n.return||n.return()}finally{if(a)throw o}}return i}}(e,t)||function(e,t){if(e){if("string"==typeof e)return Tn(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Tn(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}((0,e.useState)(t),2),o=r[0],i=r[1];return(0,e.useEffect)((function(){var e=setTimeout((function(){i(t)}),n);return function(){clearTimeout(e)}}),[t,n]),o}var Un=P((0,i.getExtensionInternalStore)());function Nn(t){var n=R(t);return(0,e.useMemo)((function(){return Object.fromEntries(n.map((function(e){return[e.name,e.meta]})))}),[n])}function Dn(t){var n,r=E(C.featureFlagsStore).flags;return(0,e.useEffect)((function(){r[t]||console.error('useFeatureFlag: Attempted to get value of non-existent flag "'.concat(t,'". Did you forget to call registerFeatureFlag?'))}),[r[t]]),null===(n=r[t])||void 0===n?void 0:n.enabled}function Fn(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function Ln(){var t=function(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,i=[],u=!0,a=!1;try{for(n=n.call(e);!(u=(r=n.next()).done)&&(i.push(r.value),!t||i.length!==t);u=!0);}catch(e){a=!0,o=e}finally{try{u||null==n.return||n.return()}finally{if(a)throw o}}return i}}(e,t)||function(e,t){if(e){if("string"==typeof e)return Fn(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Fn(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}((0,e.useState)(0),2)[1];return(0,e.useCallback)((function(){t((function(e){return e+1}))}),[])}function Bn(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function zn(){var e="tablet";return document.body.classList.forEach((function(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 Vn(){var t=function(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,i=[],u=!0,a=!1;try{for(n=n.call(e);!(u=(r=n.next()).done)&&(i.push(r.value),!t||i.length!==t);u=!0);}catch(e){a=!0,o=e}finally{try{u||null==n.return||n.return()}finally{if(a)throw o}}return i}}(e,t)||function(e,t){if(e){if("string"==typeof e)return Bn(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Bn(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}((0,e.useState)(zn),2),n=t[0],r=t[1];return(0,e.useEffect)((function(){var e=function(){r(zn())};return window.addEventListener("resize",e),function(){return window.removeEventListener("resize",e)}}),[]),n}var $n,Gn=function(e){return"small-desktop"===e||"large-desktop"===e};function Wn(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function Hn(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,n=function(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,i=[],u=!0,a=!1;try{for(n=n.call(e);!(u=(r=n.next()).done)&&(i.push(r.value),!t||i.length!==t);u=!0);}catch(e){a=!0,o=e}finally{try{u||null==n.return||n.return()}finally{if(a)throw o}}return i}}(e,t)||function(e,t){if(e){if("string"==typeof e)return Wn(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Wn(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}((0,e.useState)([]),2),r=n[0],o=n[1];return(0,e.useEffect)((function(){var e=(0,F.getLocations)(t).subscribe((function(e){o(e)}),(function(e){console.error(e)}));return function(){return e.unsubscribe()}}),[]),r}function qn(t){var n=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],r=(0,e.useRef)(null);return(0,e.useEffect)((function(){if(n){var e=function(e){var n;(null==r||null===(n=r.current)||void 0===n?void 0:n.contains(e.target))||t(e)};return window.addEventListener("click",e),function(){return window.removeEventListener("click",e)}}}),[t,n]),r}function Yn(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Kn(t){var n,r,o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=o.abortController,u=o.fetchInit,a=o.url,c=o.swrConfig,l=be(),s=(0,e.useMemo)((function(){return null!==(r=null!==(n=null==u?void 0:u.signal)&&void 0!==n?n:null==i?void 0:i.signal)&&void 0!==r?r:l.signal}),[null==i?void 0:i.signal,null==u?void 0:u.signal,l.signal]),f=(0,e.useCallback)((function(e){var t,n,r=function(e,t){if(t)return"function"==typeof t?t(e):t;if("string"==typeof e)return e;throw new 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 ".concat(e,"."))}(e,a);return(0,F.openmrsFetch)(r,(t=function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter((function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable})))),r.forEach((function(t){Yn(e,t,n[t])}))}return e}({},u),n=null!=(n={signal:s})?n:{},Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):function(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n.push.apply(n,r)}return n}(Object(n)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))})),t))}),[s,u,a]);return(0,On.default)(t,f,c)}function Jn(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function Zn(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Qn(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter((function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable})))),r.forEach((function(t){Zn(e,t,n[t])}))}return e}function Xn(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):function(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n.push.apply(n,r)}return n}(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))})),e}!function(e){e.loadPatient="loadPatient",e.newPatient="newPatient",e.loadError="patientLoadError"}($n||($n={}));var er,tr={patientUuid:null,patient:null,isPendingUuid:!0,isLoadingPatient:!1,err:null};function nr(){var e=/\/patient\/([a-zA-Z0-9\-]+)\/?/.exec(location.pathname);return e&&e[1]}function rr(e,t){switch(t.type){case $n.loadPatient:return Xn(Qn({},e),{patientUuid:t.patientUuid,patient:null,isPendingUuid:!1,isLoadingPatient:!0,err:null});case $n.newPatient:return Xn(Qn({},e),{patient:t.patient,isPendingUuid:!1,isLoadingPatient:!1,err:null});case $n.loadError:return Xn(Qn({},e),{patient:null,isPendingUuid:!1,isLoadingPatient:!1,err:t.err});default:return e}}function or(t){var n=function(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,i=[],u=!0,a=!1;try{for(n=n.call(e);!(u=(r=n.next()).done)&&(i.push(r.value),!t||i.length!==t);u=!0);}catch(e){a=!0,o=e}finally{try{u||null==n.return||n.return()}finally{if(a)throw o}}return i}}(e,t)||function(e,t){if(e){if("string"==typeof e)return Jn(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Jn(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}((0,e.useReducer)(rr,Xn(Qn({},tr),{patientUuid:null!=t?t:null,isPendingUuid:!t,isLoadingPatient:!!t})),2),r=n[0],o=n[1];return(0,e.useEffect)((function(){if(r.isPendingUuid){var e=nr();o(e?{type:$n.loadPatient,patientUuid:e}:{type:$n.newPatient,patient:null})}var t=!0;return r.isLoadingPatient&&r.patientUuid&&(0,F.fetchCurrentPatient)(r.patientUuid).then((function(e){return t&&o({patient:e,type:$n.newPatient})}),(function(e){return t&&o({err:e,type:$n.loadError})})),function(){t=!1}}),[r.isPendingUuid,r.isLoadingPatient,r.patientUuid]),(0,e.useEffect)((function(){var e=function(e){var t=nr();t!=r.patientUuid&&o({type:$n.loadPatient,patientUuid:t})};return window.addEventListener("single-spa:routing-event",e),function(){return window.removeEventListener("single-spa:routing-event",e)}}),[r.patientUuid]),{isLoading:r.isPendingUuid||r.isLoadingPatient,patient:r.patient,patientUuid:null!=t?t:r.patientUuid,error:r.err}}function ir(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function ur(){var t=(0,e.useRef)(),n=function(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,i=[],u=!0,a=!1;try{for(n=n.call(e);!(u=(r=n.next()).done)&&(i.push(r.value),!t||i.length!==t);u=!0);}catch(e){a=!0,o=e}finally{try{u||null==n.return||n.return()}finally{if(a)throw o}}return i}}(e,t)||function(e,t){if(e){if("string"==typeof e)return ir(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?ir(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}((0,e.useState)(null),2),r=n[0],o=n[1],i=null;if(!r){if(er){var u=(0,F.getSessionStore)().getState();u.loaded&&(i=u.session)}else er=new Promise((function(e){var n=function(n){var r=n.loaded,o=n.session;r&&(e(o),i=o,t.current&&t.current(),t.current=void 0)};n((0,F.getSessionStore)().getState()),i||(t.current=(0,F.getSessionStore)().subscribe(n))}));if(!i)throw er;o(i)}(0,e.useEffect)((function(){return t.current||(t.current=(0,F.getSessionStore)().subscribe((function(e){var t=e.loaded,n=e.session;t&&(i=n,o(n))}))),function(){t.current&&t.current(),t.current=void 0}}),[]);var a=r||i;if(!a)throw er?(console.warn("useSession is in an unexpected state. Attempting to recover."),er):Error("useSession is in an invalid state.");return a}var ar=p(688),cr=p(332),lr=p.n(cr);function sr(t){var n,r=E((0,F.getVisitStore)()),o=r.patientUuid,i=r.manuallySetVisitUuid,u=t&&o==t?i:null,a="?patient=".concat(t,"&v=").concat(F.defaultVisitCustomRepresentation,"&includeInactive=false"),c="/".concat(u),l=(0,On.default)(t?"/ws/rest/v1/visit".concat(a):null,F.openmrsFetch),s=l.data,f=l.error,p=l.mutate,d=l.isValidating,y=(0,On.default)(t&&u?"/ws/rest/v1/visit".concat(c):null,F.openmrsFetch),m=y.data,b=y.error,v=y.mutate,g=y.isValidating,h=(0,e.useMemo)((function(){return null!==(n=null==s?void 0:s.data.results.find((function(e){return null===e.stopDatetime})))&&void 0!==n?n:null}),[s]),S=(0,e.useMemo)((function(){return u?null==m?void 0:m.data:null!=h?h:null}),[m,h,u]);return{error:f||b,mutate:function(){p(),v()},isValidating:d||g,activeVisit:h,currentVisit:S,currentVisitIsRetrospective:Boolean(u),isLoading:Boolean((!s||u&&!m)&&(!f||!b))}}function fr(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function pr(){var t=function(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,i=[],u=!0,a=!1;try{for(n=n.call(e);!(u=(r=n.next()).done)&&(i.push(r.value),!t||i.length!==t);u=!0);}catch(e){a=!0,o=e}finally{try{u||null==n.return||n.return()}finally{if(a)throw o}}return i}}(e,t)||function(e,t){if(e){if("string"==typeof e)return fr(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?fr(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}((0,e.useState)([]),2),n=t[0],r=t[1];return(0,e.useEffect)((function(){var e=(0,F.getVisitTypes)().subscribe((function(e){r(e)}),(function(e){return console.error(e)}));return function(){return e.unsubscribe()}}),[]),n}function dr(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}ar.default.extend(lr());var yr=10;function mr(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:yr,r=function(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,i=[],u=!0,a=!1;try{for(n=n.call(e);!(u=(r=n.next()).done)&&(i.push(r.value),!t||i.length!==t);u=!0);}catch(e){a=!0,o=e}finally{try{u||null==n.return||n.return()}finally{if(a)throw o}}return i}}(e,t)||function(e,t){if(e){if("string"==typeof e)return dr(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?dr(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}((0,e.useState)(1),2),o=r[0],i=r[1],u=(0,e.useMemo)((function(){return"number"==typeof n&&n>0?Math.max(1,Math.ceil(t.length/n)):1}),[t.length,n]),a=(0,e.useMemo)((function(){var e=(o-1)*n,r=(o+0)*n;return t.slice(e,r)}),[t,o,n]),c=(0,e.useCallback)((function(e){i(Math.max(1,Math.min(u,e)))}),[i,u]),l=(0,e.useCallback)((function(){o<u&&i(o+1)}),[o,u,i]),s=(0,e.useCallback)((function(){o>1&&i(o-1)}),[o,i]);return(0,e.useMemo)((function(){return{results:a,totalPages:u,currentPage:o,paginated:t.length>n,showNextButton:o<u,showPreviousButton:o>1,goTo:c,goToNext:l,goToPrevious:s}}),[a,u,t.length,n,o,c,l,s])}})(),d})())}}}));
|
|
2
2
|
//# sourceMappingURL=openmrs-esm-react-utils.js.map
|