@openmrs/esm-react-utils 5.1.1-pre.939 → 5.1.1-pre.944
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 +6 -6
- package/dist/openmrs-esm-react-utils.js +1 -1
- package/dist/openmrs-esm-react-utils.js.map +1 -1
- package/package.json +8 -8
- package/src/index.ts +0 -1
- package/src/public.ts +0 -1
- package/src/useExtensionInternalStore.ts +1 -1
- package/src/useExtensionStore.ts +1 -1
- package/src/useStore.test.ts +50 -0
- package/src/useStore.ts +41 -8
- package/src/createUseStore.ts +0 -49
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
[32m@openmrs/esm-react-utils:build[0m: cache hit, replaying output [
|
|
2
|
-
[32m@openmrs/esm-react-utils:build: [0masset [1m[32mopenmrs-esm-react-utils.js[39m[22m
|
|
3
|
-
[32m@openmrs/esm-react-utils:build: [0morphan modules
|
|
1
|
+
[32m@openmrs/esm-react-utils:build[0m: cache hit, replaying output [2m018b9c3fc6032cd6[0m
|
|
2
|
+
[32m@openmrs/esm-react-utils:build: [0masset [1m[32mopenmrs-esm-react-utils.js[39m[22m 71.6 KiB [1m[32m[emitted][39m[22m [1m[32m[minimized][39m[22m (name: main) 2 related assets
|
|
3
|
+
[32m@openmrs/esm-react-utils:build: [0morphan modules 203 KiB [1m[33m[orphan][39m[22m 120 modules
|
|
4
4
|
[32m@openmrs/esm-react-utils:build: [0mruntime modules 937 bytes 4 modules
|
|
5
|
-
[32m@openmrs/esm-react-utils:build: [0mbuilt modules
|
|
6
|
-
[32m@openmrs/esm-react-utils:build: [0m cacheable modules
|
|
5
|
+
[32m@openmrs/esm-react-utils:build: [0mbuilt modules 221 KiB [1m[33m[built][39m[22m
|
|
6
|
+
[32m@openmrs/esm-react-utils:build: [0m cacheable modules 221 KiB
|
|
7
7
|
[32m@openmrs/esm-react-utils:build: [0m modules by path [1m../../../node_modules/[39m[22m 2.21 KiB 4 modules
|
|
8
8
|
[32m@openmrs/esm-react-utils:build: [0m + 3 modules
|
|
9
9
|
[32m@openmrs/esm-react-utils:build: [0m modules by path [1mexternal "@openmrs/[39m[22m 168 bytes
|
|
@@ -15,4 +15,4 @@
|
|
|
15
15
|
[32m@openmrs/esm-react-utils:build: [0m [1mexternal "react-i18next"[39m[22m 42 bytes [1m[33m[built][39m[22m [1m[33m[code generated][39m[22m
|
|
16
16
|
[32m@openmrs/esm-react-utils:build: [0m [1mexternal "dayjs"[39m[22m 42 bytes [1m[33m[built][39m[22m [1m[33m[code generated][39m[22m
|
|
17
17
|
[32m@openmrs/esm-react-utils:build: [0m [1mexternal "react-dom"[39m[22m 42 bytes [1m[33m[built][39m[22m [1m[33m[code generated][39m[22m
|
|
18
|
-
[32m@openmrs/esm-react-utils:build: [0mwebpack 5.88.0 compiled [1m[32msuccessfully[39m[22m in
|
|
18
|
+
[32m@openmrs/esm-react-utils:build: [0mwebpack 5.88.0 compiled [1m[32msuccessfully[39m[22m in 8080 ms
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
/*! For license information please see openmrs-esm-react-utils.js.LICENSE.txt */
|
|
2
|
-
System.register(["react","@openmrs/esm-config","@openmrs/esm-extensions","@openmrs/esm-globals","react-dom","react-i18next","@openmrs/esm-api","dayjs"],(function(t,e){var n={},r={},o={},i={},a={},u={},c={},l={};return Object.defineProperty(n,"__esModule",{value:!0}),Object.defineProperty(a,"__esModule",{value:!0}),{setters:[function(t){Object.keys(t).forEach((function(e){n[e]=t[e]}))},function(t){r.getConfigStore=t.getConfigStore,r.getExtensionConfigFromStore=t.getExtensionConfigFromStore,r.getExtensionsConfigStore=t.getExtensionsConfigStore,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){i.subscribeConnectivityChanged=t.subscribeConnectivityChanged},function(t){Object.keys(t).forEach((function(e){a[e]=t[e]}))},function(t){u.I18nextProvider=t.I18nextProvider},function(t){c.defaultVisitCustomRepresentation=t.defaultVisitCustomRepresentation,c.fetchCurrentPatient=t.fetchCurrentPatient,c.getCurrentUser=t.getCurrentUser,c.getLocations=t.getLocations,c.getSessionStore=t.getSessionStore,c.getVisitStore=t.getVisitStore,c.getVisitTypes=t.getVisitTypes,c.openmrsFetch=t.openmrsFetch,c.userHasAccess=t.userHasAccess},function(t){l.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 i=e[n]={exports:{}};return t[n](i,i.exports,r),i.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},i=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},a=function(t,r,o){var a;d.setState((function(u){var c;return{flags:i(n({},u.flags),e({},t,{enabled:null!==(a=null===(c=u.flags[t])||void 0===c?void 0:c.enabled)&&void 0!==a&&a,label:r,description:o}))}}))},u=function(t){return d.getState().flags[t].enabled},c=function(t,e){d.subscribe((function(n){e(n.flags[t].enabled)}))},l=function(t,r){d.setState((function(o){return{flags:i(n({},o.flags),e({},t,i(n({},o.flags[t]),{enabled:r})))}}))};r.r(o),r.d(o,{featureFlagsStore:function(){return d},getFeatureFlag:function(){return u},registerFeatureFlag:function(){return a},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 i,a=Object.keys(localStorage)[Symbol.iterator]();!(e=(i=a.next()).done);e=!0){var u=i.value;if(u.startsWith("openmrs:feature-flag:")){var c=u.replace("openmrs:feature-flag:",""),l=JSON.parse(localStorage.getItem("openmrs:feature-flag-meta:".concat(c))||"{}");t[c]=n({enabled:"true"===localStorage.getItem(u)},l)}}}catch(t){r=!0,o=t}finally{try{e||null==a.return||a.return()}finally{if(r)throw o}}return t}()},d=(0,s.getGlobalStore)("feature-flags",f);d.subscribe((function(e){var n,r=!0,o=!1,i=void 0;try{for(var a,u=Object.entries(e.flags)[Symbol.iterator]();!(r=(a=u.next()).done);r=!0){var c=function(t){if(Array.isArray(t))return t}(n=a.value)||function(t,e){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=n){var r,o,i=[],a=!0,u=!1;try{for(n=n.call(t);!(a=(r=n.next()).done)&&(i.push(r.value),2!==i.length);a=!0);}catch(t){u=!0,o=t}finally{try{a||null==n.return||n.return()}finally{if(u)throw o}}return i}}(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,i=e}finally{try{r||null==u.return||u.return()}finally{if(o)throw i}}}))}(),o}())}}}))},385:()=>{System.register([],(function(t,e){return{execute:function(){t(function(){"use strict";var t=function(t,e){var n=l[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=c()((function(){return e}));return l[t]={value:r,active:!0},r},e=function(t,e){var n=l[t];if(!n){var r=c()((function(){return null!=e?e:{}}));return l[t]={value:r,active:!1},r}return n.value},n=function(e){return t("app",e)},r=function(){return e("app",{})},o=function(t,e,n){var r=e(t.getState());return t.subscribe((function(t){var o=e(t);o!==r&&(r=o,n(o))}))},i={d:function(t,e){for(var n in e)i.o(e,n)&&!i.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})}},a={};i.r(a),i.d(a,{createAppState:function(){return n},createGlobalStore:function(){return t},getAppState:function(){return r},getGlobalStore:function(){return e},subscribeTo:function(){return o}});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 i=e;e=(null!=r?r:"object"!=typeof o)?o:Object.assign({},e,o),n.forEach((function(t){return t(e,i)}))}},o=function(){return e},i={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,i),i},c=function(t){return t?u(t):u},l={};return a}())}}}))},173:(t,e,n)=>{"use strict";var r=n(123),o="function"==typeof Object.is?Object.is:function(t,e){return t===e&&(0!==t||1/t==1/e)||t!=t&&e!=e},i=r.useState,a=r.useEffect,u=r.useLayoutEffect,c=r.useDebugValue;function l(t){var e=t.getSnapshot;t=t.value;try{var n=e();return!o(t,n)}catch(t){return!0}}var s="undefined"==typeof window||void 0===window.document||void 0===window.document.createElement?function(t,e){return e()}:function(t,e){var n=e(),r=i({inst:{value:n,getSnapshot:e}}),o=r[0].inst,s=r[1];return u((function(){o.value=n,o.getSnapshot=e,l(o)&&s({inst:o})}),[t,n,e]),a((function(){return l(o)&&s({inst:o}),t((function(){l(o)&&s({inst:o})}))}),[t]),c(n),n};e.useSyncExternalStore=void 0!==r.useSyncExternalStore?r.useSyncExternalStore:s},374:(t,e,n)=>{"use strict";t.exports=n(173)},766:t=>{"use strict";t.exports=c},824:t=>{"use strict";t.exports=r},45:t=>{"use strict";t.exports=o},728:t=>{"use strict";t.exports=i},688:t=>{"use strict";t.exports=l},123:t=>{"use strict";t.exports=n},493:t=>{"use strict";t.exports=a},281:t=>{"use strict";t.exports=u}},e={};function s(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,s),o.exports}s.n=t=>{var e=t&&t.__esModule?()=>t.default:()=>t;return s.d(e,{a:e}),e},s.d=(t,e)=>{for(var n in e)s.o(e,n)&&!s.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:e[n]})},s.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),s.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})};var f={};return(()=>{"use strict";s.r(f),s.d(f,{ComponentContext:()=>e,ConfigurableLink:()=>o,Extension:()=>y,ExtensionSlot:()=>Ne,UserHasAccess:()=>Yn,createUseStore:()=>u,getAsyncExtensionLifecycle:()=>dn,getAsyncLifecycle:()=>sn,getLifecycle:()=>ln,getSyncLifecycle:()=>fn,isDesktop:()=>zn,openmrsComponentDecorator:()=>cn,useAssignedExtensionIds:()=>yn,useAssignedExtensions:()=>Oe,useBodyScrollLock:()=>mn,useConfig:()=>wn,useConnectedExtensions:()=>Te,useConnectivity:()=>v,useExtensionInternalStore:()=>Mn,useExtensionSlot:()=>Me,useExtensionSlotMeta:()=>kn,useExtensionStore:()=>Dn,useFeatureFlag:()=>Un,useForceUpdate:()=>Ln,useLayoutType:()=>Bn,useLocations:()=>Gn,useOnClickOutside:()=>Wn,usePagination:()=>Yr,usePatient:()=>Tn,useSession:()=>Zn,useStore:()=>Pe,useStoreWithActions:()=>Ae,useVisit:()=>Gr,useVisitTypes:()=>qr});var t=s(123),e=t.default.createContext({moduleName:""}),n=s(824);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,i=e.templateParams,a=e.children,u=function(t,e){if(null==t)return{};var n,r,o=function(t,e){if(null==t)return{};var n,r,o={},i=Object.keys(t);for(r=0;r<i.length;r++)n=i[r],e.indexOf(n)>=0||(o[n]=t[n]);return o}(t,e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(r=0;r<i.length;r++)n=i[r],e.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(t,n)&&(o[n]=t[n])}return o}(e,["to","templateParams","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){t.metaKey||t.ctrlKey||t.shiftKey||0!=t.button||(t.preventDefault(),(0,n.navigate)({to:e,templateParams:r}))}(t,o,i)},href:(0,n.interpolateUrl)(o,i)},u),a)}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 u(e){return function(n){var 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,i=[],a=!0,u=!1;try{for(n=n.call(t);!(a=(r=n.next()).done)&&(i.push(r.value),!e||i.length!==e);a=!0);}catch(t){u=!0,o=t}finally{try{a||null==n.return||n.return()}finally{if(u)throw o}}return i}}(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)(e.getState()),2),o=r[0],u=r[1];(0,t.useEffect)((function(){return e.subscribe((function(t){return u(t)}))}),[]);var c=(0,t.useMemo)((function(){return n?function(t,e){var n=function(n){o[n]=function(){var o=r;t.setState((function(t){for(var r=[t],i=0;i<o.length;i++)r.push(o[i]);return e[n](r)}))}},r=arguments;"function"==typeof e&&(e=e(t));var o={};for(var i in e)n(i);return o}(e,n):{}}),[n]);return 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){a(t,e,n[e])}))}return t}({},o,c)}}var c=s(45);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}function d(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function p(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){d(t,e,n[e])}))}return t}var y=function(n){var r=n.state,o=n.children,i=n.wrap,a=function(t,e){if(null==t)return{};var n,r,o=function(t,e){if(null==t)return{};var n,r,o={},i=Object.keys(t);for(r=0;r<i.length;r++)n=i[r],e.indexOf(n)>=0||(o[n]=t[n]);return o}(t,e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(r=0;r<i.length;r++)n=i[r],e.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(t,n)&&(o[n]=t[n])}return o}(n,["state","children","wrap"]),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,i=[],a=!0,u=!1;try{for(n=n.call(t);!(a=(r=n.next()).done)&&(i.push(r.value),!e||i.length!==e);a=!0);}catch(t){u=!0,o=t}finally{try{a||null==n.return||n.return()}finally{if(u)throw o}}return i}}(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)(),2),s=u[0],f=u[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(){i&&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){f(t)}),[f]);(0,t.useEffect)((function(){if(null!=s&&(null==d?void 0:d.extensionSlotName)&&d.extensionSlotModuleName&&d.extensionSlotModuleName&&!y.current&&!b.current)return b.current=!0,(0,c.renderExtension)(s,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,s]),(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(p({},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",p({ref:v,"data-extension-id":null==d?void 0:d.extensionId,style:{position:"relative"}},a));return"function"!=typeof o||t.default.isValidElement(o)?d&&i?i(g,d):g:t.default.createElement(t.default.Fragment,null,o(g,d))},m=s(728);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(){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,i=[],a=!0,u=!1;try{for(n=n.call(t);!(a=(r=n.next()).done)&&(i.push(r.value),!e||i.length!==e);a=!0);}catch(t){u=!0,o=t}finally{try{a||null==n.return||n.return()}finally{if(u)throw o}}return i}}(t,e)||function(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}}(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,m.subscribeConnectivityChanged)((function(t){var e=t.online;return r(e)}))}),[]),n}const g=function(t,e){return t===e||t!=t&&e!=e},h=function(t,e){for(var n=t.length;n--;)if(g(t[n][0],e))return n;return-1};var S=Array.prototype.splice;function O(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])}}O.prototype.clear=function(){this.__data__=[],this.size=0},O.prototype.delete=function(t){var e=this.__data__,n=h(e,t);return!(n<0||(n==e.length-1?e.pop():S.call(e,n,1),--this.size,0))},O.prototype.get=function(t){var e=this.__data__,n=h(e,t);return n<0?void 0:e[n][1]},O.prototype.has=function(t){return h(this.__data__,t)>-1},O.prototype.set=function(t,e){var n=this.__data__,r=h(n,t);return r<0?(++this.size,n.push([t,e])):n[r][1]=e,this};const w=O,j="object"==typeof global&&global&&global.Object===Object&&global;var E="object"==typeof self&&self&&self.Object===Object&&self;const x=j||E||Function("return this")(),_=x.Symbol;var P=Object.prototype,A=P.hasOwnProperty,C=P.toString,I=_?_.toStringTag:void 0;var R=Object.prototype.toString;var T=_?_.toStringTag:void 0;const M=function(t){return null==t?void 0===t?"[object Undefined]":"[object Null]":T&&T in Object(t)?function(t){var e=A.call(t,I),n=t[I];try{t[I]=void 0;var r=!0}catch(t){}var o=C.call(t);return r&&(e?t[I]=n:delete t[I]),o}(t):function(t){return R.call(t)}(t)},k=function(t){var e=typeof t;return null!=t&&("object"==e||"function"==e)},D=function(t){if(!k(t))return!1;var e=M(t);return"[object Function]"==e||"[object GeneratorFunction]"==e||"[object AsyncFunction]"==e||"[object Proxy]"==e},U=x["__core-js_shared__"];var N,L=(N=/[^.]+$/.exec(U&&U.keys&&U.keys.IE_PROTO||""))?"Symbol(src)_1."+N:"";var F=Function.prototype.toString;const V=function(t){if(null!=t){try{return F.call(t)}catch(t){}try{return t+""}catch(t){}}return""};var B=/^\[object .+?Constructor\]$/,z=Function.prototype,$=Object.prototype,G=z.toString,W=$.hasOwnProperty,q=RegExp("^"+G.call(W).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");const H=function(t){return!(!k(t)||(e=t,L&&L in e))&&(D(t)?q:B).test(V(t));var e},J=function(t,e){var n=function(t,e){return null==t?void 0:t[e]}(t,e);return H(n)?n:void 0},Y=J(x,"Map"),K=J(Object,"create");var Z=Object.prototype.hasOwnProperty;var Q=Object.prototype.hasOwnProperty;function X(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])}}X.prototype.clear=function(){this.__data__=K?K(null):{},this.size=0},X.prototype.delete=function(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e},X.prototype.get=function(t){var e=this.__data__;if(K){var n=e[t];return"__lodash_hash_undefined__"===n?void 0:n}return Z.call(e,t)?e[t]:void 0},X.prototype.has=function(t){var e=this.__data__;return K?void 0!==e[t]:Q.call(e,t)},X.prototype.set=function(t,e){var n=this.__data__;return this.size+=this.has(t)?0:1,n[t]=K&&void 0===e?"__lodash_hash_undefined__":e,this};const tt=X,et=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 nt(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])}}nt.prototype.clear=function(){this.size=0,this.__data__={hash:new tt,map:new(Y||w),string:new tt}},nt.prototype.delete=function(t){var e=et(this,t).delete(t);return this.size-=e?1:0,e},nt.prototype.get=function(t){return et(this,t).get(t)},nt.prototype.has=function(t){return et(this,t).has(t)},nt.prototype.set=function(t,e){var n=et(this,t),r=n.size;return n.set(t,e),this.size+=n.size==r?0:1,this};const rt=nt;function ot(t){var e=this.__data__=new w(t);this.size=e.size}ot.prototype.clear=function(){this.__data__=new w,this.size=0},ot.prototype.delete=function(t){var e=this.__data__,n=e.delete(t);return this.size=e.size,n},ot.prototype.get=function(t){return this.__data__.get(t)},ot.prototype.has=function(t){return this.__data__.has(t)},ot.prototype.set=function(t,e){var n=this.__data__;if(n instanceof w){var r=n.__data__;if(!Y||r.length<199)return r.push([t,e]),this.size=++n.size,this;n=this.__data__=new rt(r)}return n.set(t,e),this.size=n.size,this};const it=ot;function at(t){var e=-1,n=null==t?0:t.length;for(this.__data__=new rt;++e<n;)this.add(t[e])}at.prototype.add=at.prototype.push=function(t){return this.__data__.set(t,"__lodash_hash_undefined__"),this},at.prototype.has=function(t){return this.__data__.has(t)};const ut=at,ct=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},lt=function(t,e){return t.has(e)},st=function(t,e,n,r,o,i){var a=1&n,u=t.length,c=e.length;if(u!=c&&!(a&&c>u))return!1;var l=i.get(t),s=i.get(e);if(l&&s)return l==e&&s==t;var f=-1,d=!0,p=2&n?new ut:void 0;for(i.set(t,e),i.set(e,t);++f<u;){var y=t[f],m=e[f];if(r)var b=a?r(m,y,f,e,t,i):r(y,m,f,t,e,i);if(void 0!==b){if(b)continue;d=!1;break}if(p){if(!ct(e,(function(t,e){if(!lt(p,e)&&(y===t||o(y,t,n,r,i)))return p.push(e)}))){d=!1;break}}else if(y!==m&&!o(y,m,n,r,i)){d=!1;break}}return i.delete(t),i.delete(e),d},ft=x.Uint8Array,dt=function(t){var e=-1,n=Array(t.size);return t.forEach((function(t,r){n[++e]=[r,t]})),n},pt=function(t){var e=-1,n=Array(t.size);return t.forEach((function(t){n[++e]=t})),n};var yt=_?_.prototype:void 0,mt=yt?yt.valueOf:void 0;const bt=Array.isArray;var vt=Object.prototype.propertyIsEnumerable,gt=Object.getOwnPropertySymbols;const ht=gt?function(t){return null==t?[]:(t=Object(t),function(t,e){for(var n=-1,r=null==t?0:t.length,o=0,i=[];++n<r;){var a=t[n];e(a,n,t)&&(i[o++]=a)}return i}(gt(t),(function(e){return vt.call(t,e)})))}:function(){return[]},St=function(t){return null!=t&&"object"==typeof t},Ot=function(t){return St(t)&&"[object Arguments]"==M(t)};var wt=Object.prototype,jt=wt.hasOwnProperty,Et=wt.propertyIsEnumerable,xt=Ot(function(){return arguments}())?Ot:function(t){return St(t)&&jt.call(t,"callee")&&!Et.call(t,"callee")};const _t=xt;var Pt="object"==typeof exports&&exports&&!exports.nodeType&&exports,At=Pt&&"object"==typeof module&&module&&!module.nodeType&&module,Ct=At&&At.exports===Pt?x.Buffer:void 0;const It=(Ct?Ct.isBuffer:void 0)||function(){return!1};var Rt=/^(?:0|[1-9]\d*)$/;const Tt=function(t,e){var n=typeof t;return!!(e=null==e?9007199254740991:e)&&("number"==n||"symbol"!=n&&Rt.test(t))&&t>-1&&t%1==0&&t<e},Mt=function(t){return"number"==typeof t&&t>-1&&t%1==0&&t<=9007199254740991};var kt={};kt["[object Float32Array]"]=kt["[object Float64Array]"]=kt["[object Int8Array]"]=kt["[object Int16Array]"]=kt["[object Int32Array]"]=kt["[object Uint8Array]"]=kt["[object Uint8ClampedArray]"]=kt["[object Uint16Array]"]=kt["[object Uint32Array]"]=!0,kt["[object Arguments]"]=kt["[object Array]"]=kt["[object ArrayBuffer]"]=kt["[object Boolean]"]=kt["[object DataView]"]=kt["[object Date]"]=kt["[object Error]"]=kt["[object Function]"]=kt["[object Map]"]=kt["[object Number]"]=kt["[object Object]"]=kt["[object RegExp]"]=kt["[object Set]"]=kt["[object String]"]=kt["[object WeakMap]"]=!1;var Dt="object"==typeof exports&&exports&&!exports.nodeType&&exports,Ut=Dt&&"object"==typeof module&&module&&!module.nodeType&&module,Nt=Ut&&Ut.exports===Dt&&j.process,Lt=function(){try{return Ut&&Ut.require&&Ut.require("util").types||Nt&&Nt.binding&&Nt.binding("util")}catch(t){}}(),Ft=Lt&&Lt.isTypedArray;const Vt=Ft?(Bt=Ft,function(t){return Bt(t)}):function(t){return St(t)&&Mt(t.length)&&!!kt[M(t)]};var Bt,zt=Object.prototype.hasOwnProperty;const $t=function(t,e){var n=bt(t),r=!n&&_t(t),o=!n&&!r&&It(t),i=!n&&!r&&!o&&Vt(t),a=n||r||o||i,u=a?function(t,e){for(var n=-1,r=Array(t);++n<t;)r[n]=e(n);return r}(t.length,String):[],c=u.length;for(var l in t)!e&&!zt.call(t,l)||a&&("length"==l||o&&("offset"==l||"parent"==l)||i&&("buffer"==l||"byteLength"==l||"byteOffset"==l)||Tt(l,c))||u.push(l);return u};var Gt=Object.prototype;const Wt=function(t,e){return function(n){return t(e(n))}}(Object.keys,Object);var qt=Object.prototype.hasOwnProperty;const Ht=function(t){if(n=(e=t)&&e.constructor,e!==("function"==typeof n&&n.prototype||Gt))return Wt(t);var e,n,r=[];for(var o in Object(t))qt.call(t,o)&&"constructor"!=o&&r.push(o);return r},Jt=function(t){return null!=(e=t)&&Mt(e.length)&&!D(e)?$t(t):Ht(t);var e},Yt=function(t){return function(t,e,n){var r=e(t);return bt(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,Jt,ht)};var Kt=Object.prototype.hasOwnProperty;const Zt=J(x,"DataView"),Qt=J(x,"Promise"),Xt=J(x,"Set"),te=J(x,"WeakMap");var ee="[object Map]",ne="[object Promise]",re="[object Set]",oe="[object WeakMap]",ie="[object DataView]",ae=V(Zt),ue=V(Y),ce=V(Qt),le=V(Xt),se=V(te),fe=M;(Zt&&fe(new Zt(new ArrayBuffer(1)))!=ie||Y&&fe(new Y)!=ee||Qt&&fe(Qt.resolve())!=ne||Xt&&fe(new Xt)!=re||te&&fe(new te)!=oe)&&(fe=function(t){var e=M(t),n="[object Object]"==e?t.constructor:void 0,r=n?V(n):"";if(r)switch(r){case ae:return ie;case ue:return ee;case ce:return ne;case le:return re;case se:return oe}return e});const de=fe;var pe="[object Arguments]",ye="[object Array]",me="[object Object]",be=Object.prototype.hasOwnProperty;const ve=function(t,e,n,r,o,i){var a=bt(t),u=bt(e),c=a?ye:de(t),l=u?ye:de(e),s=(c=c==pe?me:c)==me,f=(l=l==pe?me:l)==me,d=c==l;if(d&&It(t)){if(!It(e))return!1;a=!0,s=!1}if(d&&!s)return i||(i=new it),a||Vt(t)?st(t,e,n,r,o,i):function(t,e,n,r,o,i,a){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||!i(new ft(t),new ft(e)));case"[object Boolean]":case"[object Date]":case"[object Number]":return g(+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 u=dt;case"[object Set]":var c=1&r;if(u||(u=pt),t.size!=e.size&&!c)return!1;var l=a.get(t);if(l)return l==e;r|=2,a.set(t,e);var s=st(u(t),u(e),r,o,i,a);return a.delete(t),s;case"[object Symbol]":if(mt)return mt.call(t)==mt.call(e)}return!1}(t,e,c,n,r,o,i);if(!(1&n)){var p=s&&be.call(t,"__wrapped__"),y=f&&be.call(e,"__wrapped__");if(p||y){var m=p?t.value():t,b=y?e.value():e;return i||(i=new it),o(m,b,n,r,i)}}return!!d&&(i||(i=new it),function(t,e,n,r,o,i){var a=1&n,u=Yt(t),c=u.length;if(c!=Yt(e).length&&!a)return!1;for(var l=c;l--;){var s=u[l];if(!(a?s in e:Kt.call(e,s)))return!1}var f=i.get(t),d=i.get(e);if(f&&d)return f==e&&d==t;var p=!0;i.set(t,e),i.set(e,t);for(var y=a;++l<c;){var m=t[s=u[l]],b=e[s];if(r)var v=a?r(b,m,s,e,t,i):r(m,b,s,t,e,i);if(!(void 0===v?m===b||o(m,b,n,r,i):v)){p=!1;break}y||(y="constructor"==s)}if(p&&!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||(p=!1)}return i.delete(t),i.delete(e),p}(t,e,n,r,o,i))},ge=function t(e,n,r,o,i){return e===n||(null==e||null==n||!St(e)&&!St(n)?e!=e&&n!=n:ve(e,n,r,o,t,i))},he=function(t,e){return ge(t,e)};function Se(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 Oe(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,i=[],a=!0,u=!1;try{for(n=n.call(t);!(a=(r=n.next()).done)&&(i.push(r.value),!e||i.length!==e);a=!0);}catch(t){u=!0,o=t}finally{try{a||null==n.return||n.return()}finally{if(u)throw o}}return i}}(t,e)||function(t,e){if(t){if("string"==typeof t)return Se(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)?Se(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=function(t){var n,i,a=null!==(i=null===(n=t.slots[e])||void 0===n?void 0:n.assignedExtensions)&&void 0!==i?i:[];he(a,r)||o(a)};return t((0,c.getExtensionStore)().getState()),(0,c.getExtensionStore)().subscribe(t)}),[e,r]),r}var we=s(385);function je(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 Ee(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function xe(t,e){if(t){if("string"==typeof t)return je(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)?je(t,e):void 0}}var _e=function(t){return t};function Pe(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:_e,r=arguments.length>2?arguments[2]:void 0,o=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,i=[],a=!0,u=!1;try{for(n=n.call(t);!(a=(r=n.next()).done)&&(i.push(r.value),!e||i.length!==e);a=!0);}catch(t){u=!0,o=t}finally{try{a||null==n.return||n.return()}finally{if(u)throw o}}return i}}(t,e)||xe(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)((function(){return n(e.getState())})),2),i=o[0],a=o[1];(0,t.useEffect)((function(){return(0,we.subscribeTo)(e,n,a)}),[e,n]);var u=(0,t.useMemo)((function(){return r?function(t,e){var n=function(n){o[n]=function(){var o=r;t.setState((function(t){for(var r,i=[t],a=0;a<o.length;a++)i.push(o[a]);return(r=e)[n].apply(r,function(t){if(Array.isArray(t))return je(t)}(u=i)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(u)||xe(u)||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.")}());var u}))}},r=arguments;"function"==typeof e&&(e=e(t));var o={};for(var i in e)n(i);return o}(e,r):{}}),[e,r]);return 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){Ee(t,e,n[e])}))}return t}({},i,u)}function Ae(t,e){return Pe(t,_e,e)}var Ce=s(570);function Ie(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 Re(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,i=[],a=!0,u=!1;try{for(n=n.call(t);!(a=(r=n.next()).done)&&(i.push(r.value),!e||i.length!==e);a=!0);}catch(t){u=!0,o=t}finally{try{a||null==n.return||n.return()}finally{if(u)throw o}}return i}}(t,e)||function(t,e){if(t){if("string"==typeof t)return Ie(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)?Ie(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 Te(e){var n=v(),r=Oe(e),o=Pe(Ce.featureFlagsStore),i=(0,t.useMemo)((function(){return Object.entries(o.flags).filter((function(t){return Re(t,2)[1].enabled})).map((function(t){return Re(t,1)[0]}))}),[o.flags]);return(0,t.useMemo)((function(){return(0,c.getConnectedExtensions)(r,n,i)}),[r,n,i])}function Me(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,c.registerExtensionSlot)(r,n)}),[]),{extensions:Te(n),extensionSlotName:n,extensionSlotModuleName:r}}function ke(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function De(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){ke(t,e,n[e])}))}return t}function Ue(t){return t}function Ne(n){var r=n.name,o=n.extensionSlotName,i=n.select,a=void 0===i?Ue:i,u=n.children,c=n.state,l=n.style,s=function(t,e){if(null==t)return{};var n,r,o=function(t,e){if(null==t)return{};var n,r,o={},i=Object.keys(t);for(r=0;r<i.length;r++)n=i[r],e.indexOf(n)>=0||(o[n]=t[n]);return o}(t,e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(r=0;r<i.length;r++)n=i[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(u&&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 f,d,p,m,b=null!=r?r:o,v=(0,t.useRef)(null),g=Me(b),h=g.extensions,S=g.extensionSlotModuleName,O=(0,t.useMemo)((function(){return a(h)}),[a,h]),w=(0,t.useMemo)((function(){if("function"==typeof u&&!t.default.isValidElement(u))return O.map((function(t){return u(t)}))}),[u,O]);return t.default.createElement("div",De({ref:v,"data-extension-slot-name":b,"data-extension-slot-module-name":S,style:(p=De({},l),m={position:"relative"},m=null!=m?m:{},Object.getOwnPropertyDescriptors?Object.defineProperties(p,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(p,t,Object.getOwnPropertyDescriptor(m,t))})),p)},s),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!==(f=null==w?void 0:w[r])&&void 0!==f?f:"function"!=typeof u?u:null)&&void 0!==d?d:t.default.createElement(y,{state:c}))})))}var Le=s(645);function Fe(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 Ve(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?Fe(Object(n),!0).forEach((function(e){ze(t,e,n[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):Fe(Object(n)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}))}return t}function Be(t){return(Be="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 ze(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function $e(t){return($e="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 Ge(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($e(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($e(t)));return t}}var We=null;try{We=require("react").createContext()}catch(Fe){}var qe={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 He(t){if("object"!==Be(t))throw new Error("single-spa-react requires a configuration object");var e=Ve(Ve({},qe),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");!We&&e.React.createContext&&(We=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:Je.bind(null,e),mount:Ye.bind(null,e),unmount:Ke.bind(null,e)};return e.parcelCanUpdate&&(n.update=Ze.bind(null,e)),n}function Je(t,e){return t.rootComponent?Promise.resolve():t.loadRootComponent(e).then((function(e){t.rootComponent=e}))}function Ye(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=tn(t,e,(function(){n(this)})),i=Ge(t,e)(),a=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 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:Qe(t),renderType:Xe(t)});t.domElements[e.name]=i,t.renderResults[e.name]=a}))}function Ke(t,e){return new Promise((function(n){t.unmountResolves[e.name]=n;var r=t.renderResults[e.name];r&&r.unmount?r.unmount():Qe(t).unmountComponentAtNode(t.domElements[e.name]),delete t.domElements[e.name],delete t.renderResults[e.name]}))}function Ze(t,e){return new Promise((function(n){t.updateResolves[e.name]||(t.updateResolves[e.name]=[]),t.updateResolves[e.name].push(n);var r=tn(t,e,null),o=t.renderResults[e.name];if(o&&o.render)o.render(r);else{var i=Ge(t,e)();Qe(t).render(r,i)}}))}function Qe(t){return t.ReactDOMClient||t.ReactDOM}function Xe(t){return"function"==typeof t.renderType?t.renderType():t.renderType}function tn(t,e,n){var r=t.React.createElement(t.rootComponent,e),o=We?t.React.createElement(We.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,Ve(Ve({},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 en=s(281);function nn(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 rn(t){return rn=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},rn(t)}function on(t,e){return on=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},on(t,e)}function an(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=rn(t);if(e){var o=rn(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 un={strictMode:!0,throwErrorsToConsole:!0,disableTranslations:!1};function cn(n){if("object"!=typeof n||"string"!=typeof n.featureName||"string"!=typeof n.moduleName)throw new Error("Invalid options");var r=Object.assign({},un,n);return function(n){var o,i,a,u;return i=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&&on(t,e)}(c,o);var i,a,u=an(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=u.call(this,t)).state={caughtError:null,caughtErrorInfo:null,config:{moduleName:r.moduleName,extension:t._extensionContext}},e}return i=c,(a=[{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(en.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)}}])&&nn(i.prototype,a),c}(t.default.Component),a="displayName",u="OpenmrsReactComponent(".concat(r.featureName,")"),a in i?Object.defineProperty(i,a,{value:u,enumerable:!0,configurable:!0,writable:!0}):i[a]=u,o}}function ln(e,n){return He({React:t.default,ReactDOMClient:Le,rootComponent:cn(n)(e)})}function sn(t,e){return function(){return t().then((function(t){return ln(t.default,e)}))}}function fn(t,e){return function(){return Promise.resolve(ln(t,e))}}var dn=sn;function pn(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 yn(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,i=[],a=!0,u=!1;try{for(n=n.call(t);!(a=(r=n.next()).done)&&(i.push(r.value),!e||i.length!==e);a=!0);}catch(t){u=!0,o=t}finally{try{a||null==n.return||n.return()}finally{if(u)throw o}}return i}}(t,e)||function(t,e){if(t){if("string"==typeof t)return pn(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)?pn(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,c.getExtensionStore)().subscribe((function(t){var n,i,a=null!==(i=null===(n=t.slots[e])||void 0===n?void 0:n.assignedExtensions.map((function(t){return t.id})))&&void 0!==i?i:[];he(a,r)||o(a)}))}),[]),r}function mn(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])}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 vn(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function gn(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,i=[],a=!0,u=!1;try{for(n=n.call(t);!(a=(r=n.next()).done)&&(i.push(r.value),!e||i.length!==e);a=!0);}catch(t){u=!0,o=t}finally{try{a||null==n.return||n.return()}finally{if(u)throw o}}return i}}(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.")}()}var hn={},Sn='No ComponentContext has been provided. This should come from "openmrsComponentDecorator".\nUsually this is already applied when using "getAsyncLifecycle" or "getSyncLifecycle".';function On(e){var r=(0,t.useMemo)(n.getExtensionsConfigStore,[]),o=function(e,r){var o=gn((0,t.useState)(function(t,e){return e?function(){var r=t.getState(),o=(0,n.getExtensionConfigFromStore)(r,e.extensionSlotName,e.extensionId);if(o.loaded&&o.config)return o.config}:null}(e,r)),2),i=o[0],a=o[1];return(0,t.useEffect)((function(){if(r)return e.subscribe((function(t){var e=(0,n.getExtensionConfigFromStore)(t,r.extensionSlotName,r.extensionId);e.loaded&&e.config&&!he(e.config,i)&&a(e.config)}))}),[e,r,i]),i}(r,e);if(!o&&e){var i="".concat(e.extensionSlotName,"-").concat(e.extensionId);throw!hn[i]&&r&&(hn[i]=function(t,e){return new Promise((function(r){var o=t.subscribe((function(t){var i=(0,n.getExtensionConfigFromStore)(t,e.extensionSlotName,e.extensionId);i.loaded&&i.config&&(r(i.config),o())}))}))}(r,e)),hn[i]}return o||{}}function wn(){var r=(0,t.useContext)(e),o=r.moduleName,i=r.extension;if(!o&&!i)throw Error(Sn);var a=function(e){var r=(0,t.useMemo)((function(){return(0,n.getConfigStore)(e)}),[e]),o=e,i=function(e){var n=gn((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}(r);if(!i)throw hn[o]||(hn[o]=function(t){return new Promise((function(e){var n=t.subscribe((function(t){t.loaded&&t.config&&(e(t.config),n())}))}))}(r)),hn[o];return i}(o),u=On(i),c=(0,t.useMemo)((function(){return 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){vn(t,e,n[e])}))}return t}({},a,u)}),[a,u]);return c}var jn,En=s(766);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 _n(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function Pn(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){_n(t,e,n[e])}))}return t}function An(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"}(jn||(jn={}));var Cn={patientUuid:null,patient:null,isPendingUuid:!0,isLoadingPatient:!1,err:null};function In(){var t=/\/patient\/([a-zA-Z0-9\-]+)\/?/.exec(location.pathname);return t&&t[1]}function Rn(t,e){switch(e.type){case jn.loadPatient:return An(Pn({},t),{patientUuid:e.patientUuid,patient:null,isPendingUuid:!1,isLoadingPatient:!0,err:null});case jn.newPatient:return An(Pn({},t),{patient:e.patient,isPendingUuid:!1,isLoadingPatient:!1,err:null});case jn.loadError:return An(Pn({},t),{patient:null,isPendingUuid:!1,isLoadingPatient:!1,err:e.err});default:return t}}function Tn(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,i=[],a=!0,u=!1;try{for(n=n.call(t);!(a=(r=n.next()).done)&&(i.push(r.value),!e||i.length!==e);a=!0);}catch(t){u=!0,o=t}finally{try{a||null==n.return||n.return()}finally{if(u)throw o}}return i}}(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.")}()}((0,t.useReducer)(Rn,An(Pn({},Cn),{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=In();o(t?{type:jn.loadPatient,patientUuid:t}:{type:jn.newPatient,patient:null})}var e=!0;return r.isLoadingPatient&&r.patientUuid&&(0,En.fetchCurrentPatient)(r.patientUuid).then((function(t){return e&&o({patient:t,type:jn.newPatient})}),(function(t){return e&&o({err:t,type:jn.loadError})})),function(){e=!1}}),[r.isPendingUuid,r.isLoadingPatient,r.patientUuid]),(0,t.useEffect)((function(){var t=function(t){var e=In();e!=r.patientUuid&&o({type:jn.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}}var Mn=u((0,c.getExtensionInternalStore)());function kn(e){var n=Te(e);return(0,t.useMemo)((function(){return Object.fromEntries(n.map((function(t){return[t.name,t.meta]})))}),[n])}var Dn=u((0,c.getExtensionStore)());function Un(e){var n,r=Pe(Ce.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 Nn(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,i=[],a=!0,u=!1;try{for(n=n.call(t);!(a=(r=n.next()).done)&&(i.push(r.value),!e||i.length!==e);a=!0);}catch(t){u=!0,o=t}finally{try{a||null==n.return||n.return()}finally{if(u)throw o}}return i}}(t,e)||function(t,e){if(t){if("string"==typeof t)return Nn(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)?Nn(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 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 Vn(){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 Bn(){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,i=[],a=!0,u=!1;try{for(n=n.call(t);!(a=(r=n.next()).done)&&(i.push(r.value),!e||i.length!==e);a=!0);}catch(t){u=!0,o=t}finally{try{a||null==n.return||n.return()}finally{if(u)throw o}}return i}}(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)(Vn),2),n=e[0],r=e[1];return(0,t.useEffect)((function(){var t=function(){r(Vn())};return window.addEventListener("resize",t),function(){return window.removeEventListener("resize",t)}}),[]),n}var zn=function(t){return"small-desktop"===t||"large-desktop"===t};function $n(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 Gn(){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,i=[],a=!0,u=!1;try{for(n=n.call(t);!(a=(r=n.next()).done)&&(i.push(r.value),!e||i.length!==e);a=!0);}catch(t){u=!0,o=t}finally{try{a||null==n.return||n.return()}finally{if(u)throw o}}return i}}(t,e)||function(t,e){if(t){if("string"==typeof t)return $n(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)?$n(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,En.getLocations)().subscribe((function(t){r(t)}),(function(t){console.error(t)}));return function(){return t.unsubscribe()}}),[]),n}function Wn(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 qn(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 Hn,Jn,Yn=function(e){var n=e.privilege,r=e.fallback,o=e.children,i=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,i=[],a=!0,u=!1;try{for(n=n.call(t);!(a=(r=n.next()).done)&&(i.push(r.value),!e||i.length!==e);a=!0);}catch(t){u=!0,o=t}finally{try{a||null==n.return||n.return()}finally{if(u)throw o}}return i}}(t,e)||function(t,e){if(t){if("string"==typeof t)return qn(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)?qn(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),a=i[0],u=i[1];return(0,t.useEffect)((function(){var t=(0,En.getCurrentUser)({includeAuthStatus:!1}).subscribe(u);return function(){return t.unsubscribe()}}),[]),a&&(0,En.userHasAccess)(n,a)?t.default.createElement(t.default.Fragment,null,o):r?t.default.createElement(t.default.Fragment,null,r):null};function Kn(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 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,i=[],a=!0,u=!1;try{for(n=n.call(t);!(a=(r=n.next()).done)&&(i.push(r.value),!e||i.length!==e);a=!0);}catch(t){u=!0,o=t}finally{try{a||null==n.return||n.return()}finally{if(u)throw o}}return i}}(t,e)||function(t,e){if(t){if("string"==typeof t)return Kn(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)?Kn(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),n=e[0],r=e[1],o=null;if(!n){if(Hn){var i=(0,En.getSessionStore)().getState();i.loaded&&(o=i.session)}else Hn=new Promise((function(t){var e=function(e){var n=e.loaded,r=e.session;n&&(t(r),o=r,Jn&&Jn(),Jn=void 0)};e((0,En.getSessionStore)().getState()),o||(Jn=(0,En.getSessionStore)().subscribe(e))}));if(!o)throw Hn;r(o)}(0,t.useEffect)((function(){return Jn||(Jn=(0,En.getSessionStore)().subscribe((function(t){var e=t.loaded,n=t.session;e&&(o=n,r(n))}))),function(){Jn&&Jn(),Jn=void 0}}),[]);var a=n||o;if(!a)throw Hn?(console.warn("useSession is in an unexpected state. Attempting to recover."),Hn):Error("useSession is in an invalid state.");return a}var Qn=s(374);const Xn=new WeakMap,tr={},er=()=>{},nr=er(),rr=Object,or=t=>t===nr,ir=t=>"function"==typeof t,ar=(t,e)=>({...t,...e}),ur="undefined",cr=typeof window!=ur,lr=typeof document!=ur,sr=(t,e)=>{const n=Xn.get(t);return[()=>t.get(e)||tr,r=>{const o=t.get(e);n[5](e,ar(o,r),o||tr)},n[6]]},fr=new WeakMap;let dr=0;const pr=t=>{const e=typeof t,n=t&&t.constructor,r=n==Date;let o,i;if(rr(t)!==t||r||n==RegExp)o=r?t.toJSON():"symbol"==e?t.toString():"string"==e?JSON.stringify(t):""+t;else{if(o=fr.get(t),o)return o;if(o=++dr+"~",fr.set(t,o),n==Array){for(o="@",i=0;i<t.length;i++)o+=pr(t[i])+",";fr.set(t,o)}if(n==rr){o="#";const e=rr.keys(t).sort();for(;!or(i=e.pop());)or(t[i])||(o+=i+":"+pr(t[i])+",");fr.set(t,o)}}return o};let yr=!0;const[mr,br]=cr&&window.addEventListener?[window.addEventListener.bind(window),window.removeEventListener.bind(window)]:[er,er],vr={isOnline:()=>yr,isVisible:()=>{const t=lr&&document.visibilityState;return or(t)||"hidden"!==t}},gr={initFocus:t=>(lr&&document.addEventListener("visibilitychange",t),mr("focus",t),()=>{lr&&document.removeEventListener("visibilitychange",t),br("focus",t)}),initReconnect:t=>{const e=()=>{yr=!0,t()},n=()=>{yr=!1};return mr("online",e),mr("offline",n),()=>{br("online",e),br("offline",n)}}},hr=!t.default.useId,Sr=!cr||"Deno"in window,Or=Sr?t.useEffect:t.useLayoutEffect,wr="undefined"!=typeof navigator&&navigator.connection,jr=!Sr&&wr&&(["slow-2g","2g"].includes(wr.effectiveType)||wr.saveData),Er=t=>{if(ir(t))try{t=t()}catch(e){t=""}const e=t;return[t="string"==typeof t?t:(Array.isArray(t)?t.length:t)?pr(t):"",e]};let xr=0;const _r=()=>++xr;async function Pr(...t){const[e,n,r,o]=t,i=ar({populateCache:!0,throwOnError:!0},"boolean"==typeof o?{revalidate:o}:o||{});let a=i.populateCache;const u=i.rollbackOnError;let c=i.optimisticData;const l=!1!==i.revalidate,s=i.throwOnError;if(ir(n)){const t=n,r=[],o=e.keys();for(let n=o.next();!n.done;n=o.next()){const o=n.value;!o.startsWith("$inf$")&&t(e.get(o)._k)&&r.push(o)}return Promise.all(r.map(f))}return f(n);async function f(n){const[o]=Er(n);if(!o)return;const[i,f]=sr(e,o),[d,p,y]=Xn.get(e),m=d[o],b=()=>l&&(delete y[o],m&&m[0])?m[0](2).then((()=>i().data)):i().data;if(t.length<3)return b();let v,g=r;const h=_r();p[o]=[h,0];const S=!or(c),O=i(),w=O.data,j=O._c,E=or(j)?w:j;if(S&&(c=ir(c)?c(E):c,f({data:c,_c:E})),ir(g))try{g=g(E)}catch(t){v=t}if(g&&ir(g.then)){if(g=await g.catch((t=>{v=t})),h!==p[o][0]){if(v)throw v;return g}v&&S&&(t=>"function"==typeof u?u(t):!1!==u)(v)&&(a=!0,g=E,f({data:g,_c:nr}))}a&&(v||(ir(a)&&(g=a(g,E)),f({data:g,_c:nr}))),p[o][1]=_r();const x=await b();if(f({_c:nr}),!v)return a?x:g;if(s)throw v}}const Ar=(t,e)=>{for(const n in t)t[n][0]&&t[n][0](e)},Cr=(t,e)=>{if(!Xn.has(t)){const n=ar(gr,e),r={},o=Pr.bind(nr,t);let i=er;const a={},u=(t,e)=>{const n=a[t]||[];return a[t]=n,n.push(e),()=>n.splice(n.indexOf(e),1)},c=(e,n,r)=>{t.set(e,n);const o=a[e];if(o)for(let t=o.length;t--;)o[t](r,n)},l=()=>{if(!Xn.has(t)&&(Xn.set(t,[r,{},{},{},o,c,u]),!Sr)){const e=n.initFocus(setTimeout.bind(nr,Ar.bind(nr,r,0))),o=n.initReconnect(setTimeout.bind(nr,Ar.bind(nr,r,1)));i=()=>{e&&e(),o&&o(),Xn.delete(t)}}};return l(),[t,o,l,i]}return[t,Xn.get(t)[4]]},[Ir,Rr]=Cr(new Map),Tr=ar({onLoadingSlow:er,onSuccess:er,onError:er,onErrorRetry:(t,e,n,r,o)=>{const i=n.errorRetryCount,a=o.retryCount,u=~~((Math.random()+.5)*(1<<(a<8?a:8)))*n.errorRetryInterval;!or(i)&&a>i||setTimeout(r,u,o)},onDiscarded:er,revalidateOnFocus:!0,revalidateOnReconnect:!0,revalidateIfStale:!0,shouldRetryOnError:!0,errorRetryInterval:jr?1e4:5e3,focusThrottleInterval:5e3,dedupingInterval:2e3,loadingTimeout:jr?5e3:3e3,compare:(t,e)=>pr(t)==pr(e),isPaused:()=>!1,cache:Ir,mutate:Rr,fallback:{}},vr),Mr=(t,e)=>{const n=ar(t,e);if(e){const{use:r,fallback:o}=t,{use:i,fallback:a}=e;r&&i&&(n.use=r.concat(i)),o&&a&&(n.fallback=ar(o,a))}return n},kr=(0,t.createContext)({}),Dr=cr&&window.__SWR_DEVTOOLS_USE__,Ur=Dr?window.__SWR_DEVTOOLS_USE__:[],Nr=Ur.concat((t=>(e,n,r)=>t(e,n&&((...t)=>{const r=Er(e)[0],[,,,o]=Xn.get(Ir),i=o[r];return i?(delete o[r],i):n(...t)}),r)));Dr&&(window.__SWR_DEVTOOLS_REACT__=t.default);const Lr={dedupe:!0};rr.defineProperty((e=>{const{value:n}=e,r=(0,t.useContext)(kr),o=ir(n),i=(0,t.useMemo)((()=>o?n(r):n),[o,r,n]),a=(0,t.useMemo)((()=>o?i:Mr(r,i)),[o,r,i]),u=i&&i.provider,[c]=(0,t.useState)((()=>u?Cr(u(a.cache||Ir),i):nr));return c&&(a.cache=c[0],a.mutate=c[1]),Or((()=>{if(c)return c[2]&&c[2](),c[3]}),[]),(0,t.createElement)(kr.Provider,ar(e,{value:a}))}),"defaultValue",{value:Tr});var Fr,Vr=(Fr=(e,n,r)=>{const{cache:o,compare:i,suspense:a,fallbackData:u,revalidateOnMount:c,refreshInterval:l,refreshWhenHidden:s,refreshWhenOffline:f,keepPreviousData:d}=r,[p,y,m]=Xn.get(o),[b,v]=Er(e),g=(0,t.useRef)(!1),h=(0,t.useRef)(!1),S=(0,t.useRef)(b),O=(0,t.useRef)(n),w=(0,t.useRef)(r),j=()=>w.current,E=()=>j().isVisible()&&j().isOnline(),[x,_,P]=sr(o,b),A=(0,t.useRef)({}).current,C=or(u)?r.fallback[b]:u,I=(t,e)=>{let n=!0;for(const r in A){const o=r;i(e[o],t[o])||"data"===o&&or(t[o])&&i(e[o],L)||(n=!1)}return n},R=(0,t.useMemo)((()=>{const t=!!b&&!!n&&(or(c)?!j().isPaused()&&!a:c),e=()=>{const e=x(),n=ar(e);return delete n._k,t?{isValidating:!0,isLoading:!0,...n}:n};let r=e();return()=>{const t=e();return I(t,r)?r:r=t}}),[o,b]),T=(0,Qn.useSyncExternalStore)((0,t.useCallback)((t=>P(b,((e,n)=>{I(e,n)||t()}))),[o,b]),R,R),M=!g.current,k=T.data,D=or(k)?C:k,U=T.error,N=(0,t.useRef)(D),L=d?or(k)?N.current:k:D,F=M&&!or(c)?c:!j().isPaused()&&(a?!or(D)&&r.revalidateIfStale:or(D)||r.revalidateIfStale),V=!!(b&&n&&M&&F),B=or(T.isValidating)?V:T.isValidating,z=or(T.isLoading)?V:T.isLoading,$=(0,t.useCallback)((async t=>{const e=O.current;if(!b||!e||h.current||j().isPaused())return!1;let n,o,a=!0;const u=t||{},c=!m[b]||!u.dedupe,l=()=>hr?!h.current&&b===S.current&&g.current:b===S.current,s={isValidating:!1,isLoading:!1},f=()=>{_(s)},d=()=>{const t=m[b];t&&t[1]===o&&delete m[b]},p={isValidating:!0};or(x().data)&&(p.isLoading=!0);try{if(c&&(_(p),r.loadingTimeout&&or(x().data)&&setTimeout((()=>{a&&l()&&j().onLoadingSlow(b,r)}),r.loadingTimeout),m[b]=[e(v),_r()]),[n,o]=m[b],n=await n,c&&setTimeout(d,r.dedupingInterval),!m[b]||m[b][1]!==o)return c&&l()&&j().onDiscarded(b),!1;s.error=nr;const t=y[b];if(!or(t)&&(o<=t[0]||o<=t[1]||0===t[1]))return f(),c&&l()&&j().onDiscarded(b),!1;const u=x().data;s.data=i(u,n)?u:n,c&&l()&&j().onSuccess(n,b,r)}catch(t){d();const e=j(),{shouldRetryOnError:n}=e;e.isPaused()||(s.error=t,c&&l()&&(e.onError(t,b,e),(!0===n||ir(n)&&n(t))&&E()&&e.onErrorRetry(t,b,e,$,{retryCount:(u.retryCount||0)+1,dedupe:!0})))}return a=!1,f(),!0}),[b,o]),G=(0,t.useCallback)(((...t)=>Pr(o,S.current,...t)),[]);if(Or((()=>{O.current=n,w.current=r,or(k)||(N.current=k)})),Or((()=>{if(!b)return;const t=$.bind(nr,Lr);let e=0;const n=((t,e,n)=>{const r=e[t]||(e[t]=[]);return r.push(n),()=>{const t=r.indexOf(n);t>=0&&(r[t]=r[r.length-1],r.pop())}})(b,p,(n=>{if(0==n){const n=Date.now();j().revalidateOnFocus&&n>e&&E()&&(e=n+j().focusThrottleInterval,t())}else if(1==n)j().revalidateOnReconnect&&E()&&t();else if(2==n)return $()}));return h.current=!1,S.current=b,g.current=!0,_({_k:v}),F&&(or(D)||Sr?t():(t=>{cr&&typeof window.requestAnimationFrame!=ur?window.requestAnimationFrame(t):setTimeout(t,1)})(t)),()=>{h.current=!0,n()}}),[b]),Or((()=>{let t;function e(){const e=ir(l)?l(D):l;e&&-1!==t&&(t=setTimeout(n,e))}function n(){x().error||!s&&!j().isVisible()||!f&&!j().isOnline()?e():$(Lr).then(e)}return e(),()=>{t&&(clearTimeout(t),t=-1)}}),[l,s,f,b]),(0,t.useDebugValue)(L),a&&or(D)&&b){if(!hr&&Sr)throw new Error("Fallback data is required when using suspense in SSR.");throw O.current=n,w.current=r,h.current=!1,or(U)?$(Lr):U}return{mutate:G,get data(){return A.data=!0,L},get error(){return A.error=!0,U},get isValidating(){return A.isValidating=!0,B},get isLoading(){return A.isLoading=!0,z}}},function(...e){const n=ar(Tr,(0,t.useContext)(kr)),[r,o,i]=(t=>ir(t[1])?[t[0],t[1],t[2]||{}]:[t[0],null,(null===t[1]?t[2]:t[1])||{}])(e),a=Mr(n,i);let u=Fr;const{use:c}=a,l=(c||[]).concat(Nr);for(let t=l.length;t--;)u=l[t](u);return u(r,o||a.fetcher||null,a)}),Br=s(688),zr=s(332),$r=s.n(zr);function Gr(e){var n,r=Pe((0,En.getVisitStore)()),o=r.patientUuid,i=r.manuallySetVisitUuid,a=e&&o==e?i:null,u="?patient=".concat(e,"&v=").concat(En.defaultVisitCustomRepresentation,"&includeInactive=false"),c="/".concat(a),l=Vr(e?"/ws/rest/v1/visit".concat(u):null,En.openmrsFetch),s=l.data,f=l.error,d=l.mutate,p=l.isValidating,y=Vr(e&&a?"/ws/rest/v1/visit".concat(c):null,En.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 a?null==m?void 0:m.data:null!=h?h:null}),[m,h,a]);return{error:f||b,mutate:function(){d(),v()},isValidating:p||g,activeVisit:h,currentVisit:S,currentVisitIsRetrospective:Boolean(a),isLoading:Boolean((!s||a&&!m)&&(!f||!b))}}function Wr(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 qr(){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,i=[],a=!0,u=!1;try{for(n=n.call(t);!(a=(r=n.next()).done)&&(i.push(r.value),!e||i.length!==e);a=!0);}catch(t){u=!0,o=t}finally{try{a||null==n.return||n.return()}finally{if(u)throw o}}return i}}(t,e)||function(t,e){if(t){if("string"==typeof t)return Wr(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)?Wr(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,En.getVisitTypes)().subscribe((function(t){r(t)}),(function(t){return console.error(t)}));return function(){return t.unsubscribe()}}),[]),n}function Hr(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}Br.default.extend($r());var Jr=10;function Yr(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Jr,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,i=[],a=!0,u=!1;try{for(n=n.call(t);!(a=(r=n.next()).done)&&(i.push(r.value),!e||i.length!==e);a=!0);}catch(t){u=!0,o=t}finally{try{a||null==n.return||n.return()}finally{if(u)throw o}}return i}}(t,e)||function(t,e){if(t){if("string"==typeof t)return Hr(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)?Hr(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],i=r[1],a=(0,t.useMemo)((function(){return"number"==typeof n&&n>0?Math.max(1,Math.ceil(e.length/n)):1}),[e.length,n]),u=(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){i(Math.max(1,Math.min(a,t)))}),[i,a]),l=(0,t.useCallback)((function(){o<a&&i(o+1)}),[o,a,i]),s=(0,t.useCallback)((function(){o>1&&i(o-1)}),[o,i]);return(0,t.useMemo)((function(){return{results:u,totalPages:a,currentPage:o,paginated:e.length>n,showNextButton:o<a,showPreviousButton:o>1,goTo:c,goToNext:l,goToPrevious:s}}),[u,a,e.length,n,o,c,l,s])}})(),f})())}}}));
|
|
2
|
+
System.register(["react","@openmrs/esm-config","@openmrs/esm-extensions","@openmrs/esm-globals","react-dom","react-i18next","@openmrs/esm-api","dayjs"],(function(e,t){var n={},r={},o={},i={},a={},u={},c={},l={};return Object.defineProperty(n,"__esModule",{value:!0}),Object.defineProperty(a,"__esModule",{value:!0}),{setters:[function(e){Object.keys(e).forEach((function(t){n[t]=e[t]}))},function(e){r.getConfigStore=e.getConfigStore,r.getExtensionConfigFromStore=e.getExtensionConfigFromStore,r.getExtensionsConfigStore=e.getExtensionsConfigStore,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){Object.keys(e).forEach((function(t){a[t]=e[t]}))},function(e){u.I18nextProvider=e.I18nextProvider},function(e){c.defaultVisitCustomRepresentation=e.defaultVisitCustomRepresentation,c.fetchCurrentPatient=e.fetchCurrentPatient,c.getCurrentUser=e.getCurrentUser,c.getLocations=e.getLocations,c.getSessionStore=e.getSessionStore,c.getVisitStore=e.getVisitStore,c.getVisitTypes=e.getVisitTypes,c.openmrsFetch=e.openmrsFetch,c.userHasAccess=e.userHasAccess},function(e){l.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},a=function(e,r,o){var a;d.setState((function(u){var c;return{flags:i(n({},u.flags),t({},e,{enabled:null!==(a=null===(c=u.flags[e])||void 0===c?void 0:c.enabled)&&void 0!==a&&a,label:r,description:o}))}}))},u=function(e){return d.getState().flags[e].enabled},c=function(e,t){d.subscribe((function(n){t(n.flags[e].enabled)}))},l=function(e,r){d.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 d},getFeatureFlag:function(){return u},registerFeatureFlag:function(){return a},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,a=Object.keys(localStorage)[Symbol.iterator]();!(t=(i=a.next()).done);t=!0){var u=i.value;if(u.startsWith("openmrs:feature-flag:")){var c=u.replace("openmrs:feature-flag:",""),l=JSON.parse(localStorage.getItem("openmrs:feature-flag-meta:".concat(c))||"{}");e[c]=n({enabled:"true"===localStorage.getItem(u)},l)}}}catch(e){r=!0,o=e}finally{try{t||null==a.return||a.return()}finally{if(r)throw o}}return e}()},d=(0,s.getGlobalStore)("feature-flags",f);d.subscribe((function(t){var n,r=!0,o=!1,i=void 0;try{for(var a,u=Object.entries(t.flags)[Symbol.iterator]();!(r=(a=u.next()).done);r=!0){var c=function(e){if(Array.isArray(e))return e}(n=a.value)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,i=[],a=!0,u=!1;try{for(n=n.call(e);!(a=(r=n.next()).done)&&(i.push(r.value),2!==i.length);a=!0);}catch(e){u=!0,o=e}finally{try{a||null==n.return||n.return()}finally{if(u)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==u.return||u.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=u[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=a()((function(){return t}));return u[e]={value:r,active:!0},r},t=function(e,t){var n=u[e];if(!n){var r=a()((function(){return null!=t?t:{}}));return u[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},a=function(e){return e?i(e):i},u={};return setTimeout((function(){"development"===window.spaEnv&&(window.stores=u)}),1e3),o}())}}}))},173:(e,t,n)=>{"use strict";var r=n(954),o="function"==typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e==1/t)||e!=e&&t!=t},i=r.useState,a=r.useEffect,u=r.useLayoutEffect,c=r.useDebugValue;function l(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!o(e,n)}catch(e){return!0}}var s="undefined"==typeof window||void 0===window.document||void 0===window.document.createElement?function(e,t){return t()}:function(e,t){var n=t(),r=i({inst:{value:n,getSnapshot:t}}),o=r[0].inst,s=r[1];return u((function(){o.value=n,o.getSnapshot=t,l(o)&&s({inst:o})}),[e,n,t]),a((function(){return l(o)&&s({inst:o}),e((function(){l(o)&&s({inst:o})}))}),[e]),c(n),n};t.useSyncExternalStore=void 0!==r.useSyncExternalStore?r.useSyncExternalStore:s},374:(e,t,n)=>{"use strict";e.exports=n(173)},766:e=>{"use strict";e.exports=c},824:e=>{"use strict";e.exports=r},45:e=>{"use strict";e.exports=o},728:e=>{"use strict";e.exports=i},688:e=>{"use strict";e.exports=l},954:e=>{"use strict";e.exports=n},493:e=>{"use strict";e.exports=a},281:e=>{"use strict";e.exports=u}},t={};function s(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,s),o.exports}s.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return s.d(t,{a:t}),t},s.d=(e,t)=>{for(var n in t)s.o(t,n)&&!s.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},s.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),s.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var f={};return(()=>{"use strict";s.r(f),s.d(f,{ComponentContext:()=>t,ConfigurableLink:()=>o,Extension:()=>l,ExtensionSlot:()=>Lt,UserHasAccess:()=>Kn,createUseStore:()=>Ct,getAsyncExtensionLifecycle:()=>pn,getAsyncLifecycle:()=>fn,getLifecycle:()=>sn,getSyncLifecycle:()=>dn,isDesktop:()=>$n,openmrsComponentDecorator:()=>ln,useAssignedExtensionIds:()=>mn,useAssignedExtensions:()=>gt,useBodyScrollLock:()=>bn,useConfig:()=>jn,useConnectedExtensions:()=>Mt,useConnectivity:()=>y,useExtensionInternalStore:()=>kn,useExtensionSlot:()=>kt,useExtensionSlotMeta:()=>Dn,useExtensionStore:()=>Un,useFeatureFlag:()=>Nn,useForceUpdate:()=>Fn,useLayoutType:()=>zn,useLocations:()=>Wn,useOnClickOutside:()=>qn,usePagination:()=>Kr,usePatient:()=>Mn,useSession:()=>Qn,useStore:()=>Pt,useStoreWithActions:()=>At,useVisit:()=>Wr,useVisitTypes:()=>Hr});var e=s(954),t=e.default.createContext({moduleName:""}),n=s(824);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,a=t.children,u=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","children"]);return 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){e.metaKey||e.ctrlKey||e.shiftKey||0!=e.button||(e.preventDefault(),(0,n.navigate)({to:t,templateParams:r}))}(e,o,i)},href:(0,n.interpolateUrl)(o,i)},u),a)}var i=s(45);function a(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 u(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){u(e,t,n[t])}))}return e}var l=function(n){var r=n.state,o=n.children,u=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=[],a=!0,u=!1;try{for(n=n.call(e);!(a=(r=n.next()).done)&&(i.push(r.value),!t||i.length!==t);a=!0);}catch(e){u=!0,o=e}finally{try{a||null==n.return||n.return()}finally{if(u)throw o}}return i}}(e,t)||function(e,t){if(e){if("string"==typeof e)return a(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)?a(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],d=s[1],p=(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(){u&&console.warn("'wrap' prop of Extension is being used ".concat((null==p?void 0:p.extensionId)?"by ".concat(p.extensionId," in ").concat(p.extensionSlotName):"",". This will be removed in a future release."))}),[]);var v=(0,e.useCallback)((function(e){d(e)}),[d]);(0,e.useEffect)((function(){if(null!=f&&(null==p?void 0:p.extensionSlotName)&&p.extensionSlotModuleName&&p.extensionSlotModuleName&&!y.current&&!b.current)return b.current=!0,(0,i.renderExtension)(f,p.extensionSlotName,p.extensionSlotModuleName,p.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==p?void 0:p.extensionSlotName,null==p?void 0:p.extensionId,null==p?void 0:p.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==p?void 0:p.extensionId,style:{position:"relative"}},l));return"function"!=typeof o||e.default.isValidElement(o)?p&&u?u(g,p):g:e.default.createElement(e.default.Fragment,null,o(g,p))},d=s(728);function p(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=[],a=!0,u=!1;try{for(n=n.call(e);!(a=(r=n.next()).done)&&(i.push(r.value),!t||i.length!==t);a=!0);}catch(e){u=!0,o=e}finally{try{a||null==n.return||n.return()}finally{if(u)throw o}}return i}}(e,t)||function(e,t){if(e){if("string"==typeof e)return p(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)?p(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,d.subscribeConnectivityChanged)((function(e){var t=e.online;return r(t)}))}),[]),n}const m=function(e,t){return e===t||e!=e&&t!=t},b=function(e,t){for(var n=e.length;n--;)if(m(e[n][0],t))return n;return-1};var v=Array.prototype.splice;function g(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])}}g.prototype.clear=function(){this.__data__=[],this.size=0},g.prototype.delete=function(e){var t=this.__data__,n=b(t,e);return!(n<0||(n==t.length-1?t.pop():v.call(t,n,1),--this.size,0))},g.prototype.get=function(e){var t=this.__data__,n=b(t,e);return n<0?void 0:t[n][1]},g.prototype.has=function(e){return b(this.__data__,e)>-1},g.prototype.set=function(e,t){var n=this.__data__,r=b(n,e);return r<0?(++this.size,n.push([e,t])):n[r][1]=t,this};const h=g,S="object"==typeof global&&global&&global.Object===Object&&global;var w="object"==typeof self&&self&&self.Object===Object&&self;const O=S||w||Function("return this")(),j=O.Symbol;var E=Object.prototype,x=E.hasOwnProperty,_=E.toString,P=j?j.toStringTag:void 0;var A=Object.prototype.toString;var C=j?j.toStringTag:void 0;const I=function(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":C&&C in Object(e)?function(e){var t=x.call(e,P),n=e[P];try{e[P]=void 0;var r=!0}catch(e){}var o=_.call(e);return r&&(t?e[P]=n:delete e[P]),o}(e):function(e){return A.call(e)}(e)},R=function(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)},T=function(e){if(!R(e))return!1;var t=I(e);return"[object Function]"==t||"[object GeneratorFunction]"==t||"[object AsyncFunction]"==t||"[object Proxy]"==t},M=O["__core-js_shared__"];var k,D=(k=/[^.]+$/.exec(M&&M.keys&&M.keys.IE_PROTO||""))?"Symbol(src)_1."+k:"";var U=Function.prototype.toString;const N=function(e){if(null!=e){try{return U.call(e)}catch(e){}try{return e+""}catch(e){}}return""};var L=/^\[object .+?Constructor\]$/,F=Function.prototype,V=Object.prototype,B=F.toString,z=V.hasOwnProperty,$=RegExp("^"+B.call(z).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");const G=function(e){return!(!R(e)||(t=e,D&&D in t))&&(T(e)?$:L).test(N(e));var t},W=function(e,t){var n=function(e,t){return null==e?void 0:e[t]}(e,t);return G(n)?n:void 0},q=W(O,"Map"),H=W(Object,"create");var J=Object.prototype.hasOwnProperty;var Y=Object.prototype.hasOwnProperty;function K(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])}}K.prototype.clear=function(){this.__data__=H?H(null):{},this.size=0},K.prototype.delete=function(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t},K.prototype.get=function(e){var t=this.__data__;if(H){var n=t[e];return"__lodash_hash_undefined__"===n?void 0:n}return J.call(t,e)?t[e]:void 0},K.prototype.has=function(e){var t=this.__data__;return H?void 0!==t[e]:Y.call(t,e)},K.prototype.set=function(e,t){var n=this.__data__;return this.size+=this.has(e)?0:1,n[e]=H&&void 0===t?"__lodash_hash_undefined__":t,this};const Z=K,Q=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 X(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])}}X.prototype.clear=function(){this.size=0,this.__data__={hash:new Z,map:new(q||h),string:new Z}},X.prototype.delete=function(e){var t=Q(this,e).delete(e);return this.size-=t?1:0,t},X.prototype.get=function(e){return Q(this,e).get(e)},X.prototype.has=function(e){return Q(this,e).has(e)},X.prototype.set=function(e,t){var n=Q(this,e),r=n.size;return n.set(e,t),this.size+=n.size==r?0:1,this};const ee=X;function te(e){var t=this.__data__=new h(e);this.size=t.size}te.prototype.clear=function(){this.__data__=new h,this.size=0},te.prototype.delete=function(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n},te.prototype.get=function(e){return this.__data__.get(e)},te.prototype.has=function(e){return this.__data__.has(e)},te.prototype.set=function(e,t){var n=this.__data__;if(n instanceof h){var r=n.__data__;if(!q||r.length<199)return r.push([e,t]),this.size=++n.size,this;n=this.__data__=new ee(r)}return n.set(e,t),this.size=n.size,this};const ne=te;function re(e){var t=-1,n=null==e?0:e.length;for(this.__data__=new ee;++t<n;)this.add(e[t])}re.prototype.add=re.prototype.push=function(e){return this.__data__.set(e,"__lodash_hash_undefined__"),this},re.prototype.has=function(e){return this.__data__.has(e)};const oe=re,ie=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},ae=function(e,t){return e.has(t)},ue=function(e,t,n,r,o,i){var a=1&n,u=e.length,c=t.length;if(u!=c&&!(a&&c>u))return!1;var l=i.get(e),s=i.get(t);if(l&&s)return l==t&&s==e;var f=-1,d=!0,p=2&n?new oe:void 0;for(i.set(e,t),i.set(t,e);++f<u;){var y=e[f],m=t[f];if(r)var b=a?r(m,y,f,t,e,i):r(y,m,f,e,t,i);if(void 0!==b){if(b)continue;d=!1;break}if(p){if(!ie(t,(function(e,t){if(!ae(p,t)&&(y===e||o(y,e,n,r,i)))return p.push(t)}))){d=!1;break}}else if(y!==m&&!o(y,m,n,r,i)){d=!1;break}}return i.delete(e),i.delete(t),d},ce=O.Uint8Array,le=function(e){var t=-1,n=Array(e.size);return e.forEach((function(e,r){n[++t]=[r,e]})),n},se=function(e){var t=-1,n=Array(e.size);return e.forEach((function(e){n[++t]=e})),n};var fe=j?j.prototype:void 0,de=fe?fe.valueOf:void 0;const pe=Array.isArray;var ye=Object.prototype.propertyIsEnumerable,me=Object.getOwnPropertySymbols;const be=me?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 a=e[n];t(a,n,e)&&(i[o++]=a)}return i}(me(e),(function(t){return ye.call(e,t)})))}:function(){return[]},ve=function(e){return null!=e&&"object"==typeof e},ge=function(e){return ve(e)&&"[object Arguments]"==I(e)};var he=Object.prototype,Se=he.hasOwnProperty,we=he.propertyIsEnumerable,Oe=ge(function(){return arguments}())?ge:function(e){return ve(e)&&Se.call(e,"callee")&&!we.call(e,"callee")};const je=Oe;var Ee="object"==typeof exports&&exports&&!exports.nodeType&&exports,xe=Ee&&"object"==typeof module&&module&&!module.nodeType&&module,_e=xe&&xe.exports===Ee?O.Buffer:void 0;const Pe=(_e?_e.isBuffer:void 0)||function(){return!1};var Ae=/^(?:0|[1-9]\d*)$/;const Ce=function(e,t){var n=typeof e;return!!(t=null==t?9007199254740991:t)&&("number"==n||"symbol"!=n&&Ae.test(e))&&e>-1&&e%1==0&&e<t},Ie=function(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=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,Me=Te&&"object"==typeof module&&module&&!module.nodeType&&module,ke=Me&&Me.exports===Te&&S.process,De=function(){try{return Me&&Me.require&&Me.require("util").types||ke&&ke.binding&&ke.binding("util")}catch(e){}}(),Ue=De&&De.isTypedArray;const Ne=Ue?(Le=Ue,function(e){return Le(e)}):function(e){return ve(e)&&Ie(e.length)&&!!Re[I(e)]};var Le,Fe=Object.prototype.hasOwnProperty;const Ve=function(e,t){var n=pe(e),r=!n&&je(e),o=!n&&!r&&Pe(e),i=!n&&!r&&!o&&Ne(e),a=n||r||o||i,u=a?function(e,t){for(var n=-1,r=Array(e);++n<e;)r[n]=t(n);return r}(e.length,String):[],c=u.length;for(var l in e)!t&&!Fe.call(e,l)||a&&("length"==l||o&&("offset"==l||"parent"==l)||i&&("buffer"==l||"byteLength"==l||"byteOffset"==l)||Ce(l,c))||u.push(l);return u};var Be=Object.prototype;const ze=function(e,t){return function(n){return e(t(n))}}(Object.keys,Object);var $e=Object.prototype.hasOwnProperty;const Ge=function(e){if(n=(t=e)&&t.constructor,t!==("function"==typeof n&&n.prototype||Be))return ze(e);var t,n,r=[];for(var o in Object(e))$e.call(e,o)&&"constructor"!=o&&r.push(o);return r},We=function(e){return null!=(t=e)&&Ie(t.length)&&!T(t)?Ve(e):Ge(e);var t},qe=function(e){return function(e,t,n){var r=t(e);return pe(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,We,be)};var He=Object.prototype.hasOwnProperty;const Je=W(O,"DataView"),Ye=W(O,"Promise"),Ke=W(O,"Set"),Ze=W(O,"WeakMap");var Qe="[object Map]",Xe="[object Promise]",et="[object Set]",tt="[object WeakMap]",nt="[object DataView]",rt=N(Je),ot=N(q),it=N(Ye),at=N(Ke),ut=N(Ze),ct=I;(Je&&ct(new Je(new ArrayBuffer(1)))!=nt||q&&ct(new q)!=Qe||Ye&&ct(Ye.resolve())!=Xe||Ke&&ct(new Ke)!=et||Ze&&ct(new Ze)!=tt)&&(ct=function(e){var t=I(e),n="[object Object]"==t?e.constructor:void 0,r=n?N(n):"";if(r)switch(r){case rt:return nt;case ot:return Qe;case it:return Xe;case at:return et;case ut:return tt}return t});const lt=ct;var st="[object Arguments]",ft="[object Array]",dt="[object Object]",pt=Object.prototype.hasOwnProperty;const yt=function(e,t,n,r,o,i){var a=pe(e),u=pe(t),c=a?ft:lt(e),l=u?ft:lt(t),s=(c=c==st?dt:c)==dt,f=(l=l==st?dt:l)==dt,d=c==l;if(d&&Pe(e)){if(!Pe(t))return!1;a=!0,s=!1}if(d&&!s)return i||(i=new ne),a||Ne(e)?ue(e,t,n,r,o,i):function(e,t,n,r,o,i,a){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 ce(e),new ce(t)));case"[object Boolean]":case"[object Date]":case"[object Number]":return m(+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 u=le;case"[object Set]":var c=1&r;if(u||(u=se),e.size!=t.size&&!c)return!1;var l=a.get(e);if(l)return l==t;r|=2,a.set(e,t);var s=ue(u(e),u(t),r,o,i,a);return a.delete(e),s;case"[object Symbol]":if(de)return de.call(e)==de.call(t)}return!1}(e,t,c,n,r,o,i);if(!(1&n)){var p=s&&pt.call(e,"__wrapped__"),y=f&&pt.call(t,"__wrapped__");if(p||y){var b=p?e.value():e,v=y?t.value():t;return i||(i=new ne),o(b,v,n,r,i)}}return!!d&&(i||(i=new ne),function(e,t,n,r,o,i){var a=1&n,u=qe(e),c=u.length;if(c!=qe(t).length&&!a)return!1;for(var l=c;l--;){var s=u[l];if(!(a?s in t:He.call(t,s)))return!1}var f=i.get(e),d=i.get(t);if(f&&d)return f==t&&d==e;var p=!0;i.set(e,t),i.set(t,e);for(var y=a;++l<c;){var m=e[s=u[l]],b=t[s];if(r)var v=a?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)){p=!1;break}y||(y="constructor"==s)}if(p&&!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||(p=!1)}return i.delete(e),i.delete(t),p}(e,t,n,r,o,i))},mt=function e(t,n,r,o,i){return t===n||(null==t||null==n||!ve(t)&&!ve(n)?t!=t&&n!=n:yt(t,n,r,o,e,i))},bt=function(e,t){return mt(e,t)};function vt(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 gt(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=[],a=!0,u=!1;try{for(n=n.call(e);!(a=(r=n.next()).done)&&(i.push(r.value),!t||i.length!==t);a=!0);}catch(e){u=!0,o=e}finally{try{a||null==n.return||n.return()}finally{if(u)throw o}}return i}}(e,t)||function(e,t){if(e){if("string"==typeof e)return vt(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)?vt(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=function(e){var n,i,a=null!==(i=null===(n=e.slots[t])||void 0===n?void 0:n.assignedExtensions)&&void 0!==i?i:[];bt(a,r)||o(a)};return e((0,i.getExtensionStore)().getState()),(0,i.getExtensionStore)().subscribe(e)}),[t,r]),r}var ht=s(385);function St(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 wt(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Ot(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){wt(e,t,n[t])}))}return e}function jt(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=[],a=!0,u=!1;try{for(n=n.call(e);!(a=(r=n.next()).done)&&(i.push(r.value),!t||i.length!==t);a=!0);}catch(e){u=!0,o=e}finally{try{a||null==n.return||n.return()}finally{if(u)throw o}}return i}}(e,t)||Et(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 Et(e,t){if(e){if("string"==typeof e)return St(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)?St(e,t):void 0}}function xt(e,t){var n=function(n){r[n]=function(){var r=arguments;e.setState((function(e){for(var o,i=[e],a=0;a<r.length;a++)i.push(r[a]);return(o=t)[n].apply(o,function(e){if(Array.isArray(e))return St(e)}(u=i)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(u)||Et(u)||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.")}());var u}))}};"function"==typeof t&&(t=t(e));var r={};for(var o in t)n(o);return r}var _t=function(e){return e};function Pt(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:_t,r=arguments.length>2?arguments[2]:void 0,o=jt((0,e.useState)((function(){return n(t.getState())})),2),i=o[0],a=o[1];return(0,e.useEffect)((function(){return(0,ht.subscribeTo)(t,n,a)}),[t,n]),Ot({},i,(0,e.useMemo)((function(){return r?xt(t,r):{}}),[t,r]))}function At(e,t){return Pt(e,_t,t)}function Ct(t){return function(n){var r=jt((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)}))}),[]),Ot({},o,(0,e.useMemo)((function(){return n?xt(t,n):{}}),[n]))}}var It=s(570);function Rt(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 Tt(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=[],a=!0,u=!1;try{for(n=n.call(e);!(a=(r=n.next()).done)&&(i.push(r.value),!t||i.length!==t);a=!0);}catch(e){u=!0,o=e}finally{try{a||null==n.return||n.return()}finally{if(u)throw o}}return i}}(e,t)||function(e,t){if(e){if("string"==typeof e)return Rt(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)?Rt(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 Mt(t){var n=y(),r=gt(t),o=Pt(It.featureFlagsStore),a=(0,e.useMemo)((function(){return Object.entries(o.flags).filter((function(e){return Tt(e,2)[1].enabled})).map((function(e){return Tt(e,1)[0]}))}),[o.flags]);return(0,e.useMemo)((function(){return(0,i.getConnectedExtensions)(r,n,a)}),[r,n,a])}function kt(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:Mt(n),extensionSlotName:n,extensionSlotModuleName:r}}function Dt(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Ut(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){Dt(e,t,n[t])}))}return e}function Nt(e){return e}function Lt(n){var r=n.name,o=n.extensionSlotName,i=n.select,a=void 0===i?Nt:i,u=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(u&&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 d,p,y,m,b=null!=r?r:o,v=(0,e.useRef)(null),g=kt(b),h=g.extensions,S=g.extensionSlotModuleName,w=(0,e.useMemo)((function(){return a(h)}),[a,h]),O=(0,e.useMemo)((function(){if("function"==typeof u&&!e.default.isValidElement(u))return w.map((function(e){return u(e)}))}),[u,w]);return e.default.createElement("div",Ut({ref:v,"data-extension-slot-name":b,"data-extension-slot-module-name":S,style:(y=Ut({},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&&w.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!==(p=null!==(d=null==O?void 0:O[r])&&void 0!==d?d:"function"!=typeof u?u:null)&&void 0!==p?p:e.default.createElement(l,{state:c}))})))}var Ft=s(645);function Vt(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 Bt(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Vt(Object(n),!0).forEach((function(t){$t(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Vt(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function zt(e){return(zt="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 $t(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Gt(e){return(Gt="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 Wt(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(Gt(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(Gt(e)));return e}}var qt=null;try{qt=require("react").createContext()}catch(Vt){}var Ht={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 Jt(e){if("object"!==zt(e))throw new Error("single-spa-react requires a configuration object");var t=Bt(Bt({},Ht),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");!qt&&t.React.createContext&&(qt=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:Yt.bind(null,t),mount:Kt.bind(null,t),unmount:Zt.bind(null,t)};return t.parcelCanUpdate&&(n.update=Qt.bind(null,t)),n}function Yt(e,t){return e.rootComponent?Promise.resolve():e.loadRootComponent(t).then((function(t){e.rootComponent=t}))}function Kt(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=tn(e,t,(function(){n(this)})),i=Wt(e,t)(),a=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:Xt(e),renderType:en(e)});e.domElements[t.name]=i,e.renderResults[t.name]=a}))}function Zt(e,t){return new Promise((function(n){e.unmountResolves[t.name]=n;var r=e.renderResults[t.name];r&&r.unmount?r.unmount():Xt(e).unmountComponentAtNode(e.domElements[t.name]),delete e.domElements[t.name],delete e.renderResults[t.name]}))}function Qt(e,t){return new Promise((function(n){e.updateResolves[t.name]||(e.updateResolves[t.name]=[]),e.updateResolves[t.name].push(n);var r=tn(e,t,null),o=e.renderResults[t.name];if(o&&o.render)o.render(r);else{var i=Wt(e,t)();Xt(e).render(r,i)}}))}function Xt(e){return e.ReactDOMClient||e.ReactDOM}function en(e){return"function"==typeof e.renderType?e.renderType():e.renderType}function tn(e,t,n){var r=e.React.createElement(e.rootComponent,t),o=qt?e.React.createElement(qt.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,Bt(Bt({},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 nn=s(281);function rn(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 on(e){return on=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},on(e)}function an(e,t){return an=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},an(e,t)}function un(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=on(e);if(t){var o=on(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 cn={strictMode:!0,throwErrorsToConsole:!0,disableTranslations:!1};function ln(n){if("object"!=typeof n||"string"!=typeof n.featureName||"string"!=typeof n.moduleName)throw new Error("Invalid options");var r=Object.assign({},cn,n);return function(n){var o,i,a,u;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&&an(e,t)}(c,o);var i,a,u=un(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=u.call(this,e)).state={caughtError:null,caughtErrorInfo:null,config:{moduleName:r.moduleName,extension:e._extensionContext}},t}return i=c,(a=[{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(nn.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)}}])&&rn(i.prototype,a),c}(e.default.Component),a="displayName",u="OpenmrsReactComponent(".concat(r.featureName,")"),a in i?Object.defineProperty(i,a,{value:u,enumerable:!0,configurable:!0,writable:!0}):i[a]=u,o}}function sn(t,n){return Jt({React:e.default,ReactDOMClient:Ft,rootComponent:ln(n)(t)})}function fn(e,t){return function(){return e().then((function(e){return sn(e.default,t)}))}}function dn(e,t){return function(){return Promise.resolve(sn(e,t))}}var pn=fn;function yn(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 mn(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=[],a=!0,u=!1;try{for(n=n.call(e);!(a=(r=n.next()).done)&&(i.push(r.value),!t||i.length!==t);a=!0);}catch(e){u=!0,o=e}finally{try{a||null==n.return||n.return()}finally{if(u)throw o}}return i}}(e,t)||function(e,t){if(e){if("string"==typeof e)return yn(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)?yn(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,a=null!==(i=null===(n=e.slots[t])||void 0===n?void 0:n.assignedExtensions.map((function(e){return e.id})))&&void 0!==i?i:[];bt(a,r)||o(a)}))}),[]),r}function bn(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])}function vn(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 gn(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function hn(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=[],a=!0,u=!1;try{for(n=n.call(e);!(a=(r=n.next()).done)&&(i.push(r.value),!t||i.length!==t);a=!0);}catch(e){u=!0,o=e}finally{try{a||null==n.return||n.return()}finally{if(u)throw o}}return i}}(e,t)||function(e,t){if(e){if("string"==typeof e)return vn(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)?vn(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 Sn={},wn='No ComponentContext has been provided. This should come from "openmrsComponentDecorator".\nUsually this is already applied when using "getAsyncLifecycle" or "getSyncLifecycle".';function On(t){var r=(0,e.useMemo)(n.getExtensionsConfigStore,[]),o=function(t,r){var o=hn((0,e.useState)(function(e,t){return t?function(){var r=e.getState(),o=(0,n.getExtensionConfigFromStore)(r,t.extensionSlotName,t.extensionId);if(o.loaded&&o.config)return o.config}:null}(t,r)),2),i=o[0],a=o[1];return(0,e.useEffect)((function(){if(r)return t.subscribe((function(e){var t=(0,n.getExtensionConfigFromStore)(e,r.extensionSlotName,r.extensionId);t.loaded&&t.config&&!bt(t.config,i)&&a(t.config)}))}),[t,r,i]),i}(r,t);if(!o&&t){var i="".concat(t.extensionSlotName,"-").concat(t.extensionId);throw!Sn[i]&&r&&(Sn[i]=function(e,t){return new Promise((function(r){var o=e.subscribe((function(e){var i=(0,n.getExtensionConfigFromStore)(e,t.extensionSlotName,t.extensionId);i.loaded&&i.config&&(r(i.config),o())}))}))}(r,t)),Sn[i]}return o||{}}function jn(){var r=(0,e.useContext)(t),o=r.moduleName,i=r.extension;if(!o&&!i)throw Error(wn);var a=function(t){var r=(0,e.useMemo)((function(){return(0,n.getConfigStore)(t)}),[t]),o=t,i=function(t){var n=hn((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}(r);if(!i)throw Sn[o]||(Sn[o]=function(e){return new Promise((function(t){var n=e.subscribe((function(e){e.loaded&&e.config&&(t(e.config),n())}))}))}(r)),Sn[o];return i}(o),u=On(i),c=(0,e.useMemo)((function(){return 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){gn(e,t,n[t])}))}return e}({},a,u)}),[a,u]);return c}var En,xn=s(766);function _n(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 An(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 Cn(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"}(En||(En={}));var In={patientUuid:null,patient:null,isPendingUuid:!0,isLoadingPatient:!1,err:null};function Rn(){var e=/\/patient\/([a-zA-Z0-9\-]+)\/?/.exec(location.pathname);return e&&e[1]}function Tn(e,t){switch(t.type){case En.loadPatient:return Cn(An({},e),{patientUuid:t.patientUuid,patient:null,isPendingUuid:!1,isLoadingPatient:!0,err:null});case En.newPatient:return Cn(An({},e),{patient:t.patient,isPendingUuid:!1,isLoadingPatient:!1,err:null});case En.loadError:return Cn(An({},e),{patient:null,isPendingUuid:!1,isLoadingPatient:!1,err:t.err});default:return e}}function Mn(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=[],a=!0,u=!1;try{for(n=n.call(e);!(a=(r=n.next()).done)&&(i.push(r.value),!t||i.length!==t);a=!0);}catch(e){u=!0,o=e}finally{try{a||null==n.return||n.return()}finally{if(u)throw o}}return i}}(e,t)||function(e,t){if(e){if("string"==typeof e)return _n(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)?_n(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)(Tn,Cn(An({},In),{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=Rn();o(e?{type:En.loadPatient,patientUuid:e}:{type:En.newPatient,patient:null})}var t=!0;return r.isLoadingPatient&&r.patientUuid&&(0,xn.fetchCurrentPatient)(r.patientUuid).then((function(e){return t&&o({patient:e,type:En.newPatient})}),(function(e){return t&&o({err:e,type:En.loadError})})),function(){t=!1}}),[r.isPendingUuid,r.isLoadingPatient,r.patientUuid]),(0,e.useEffect)((function(){var e=function(e){var t=Rn();t!=r.patientUuid&&o({type:En.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}}var kn=Ct((0,i.getExtensionInternalStore)());function Dn(t){var n=Mt(t);return(0,e.useMemo)((function(){return Object.fromEntries(n.map((function(e){return[e.name,e.meta]})))}),[n])}var Un=Ct((0,i.getExtensionStore)());function Nn(t){var n,r=Pt(It.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 Ln(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 Fn(){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=[],a=!0,u=!1;try{for(n=n.call(e);!(a=(r=n.next()).done)&&(i.push(r.value),!t||i.length!==t);a=!0);}catch(e){u=!0,o=e}finally{try{a||null==n.return||n.return()}finally{if(u)throw o}}return i}}(e,t)||function(e,t){if(e){if("string"==typeof e)return Ln(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)?Ln(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 Vn(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 Bn(){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 zn(){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=[],a=!0,u=!1;try{for(n=n.call(e);!(a=(r=n.next()).done)&&(i.push(r.value),!t||i.length!==t);a=!0);}catch(e){u=!0,o=e}finally{try{a||null==n.return||n.return()}finally{if(u)throw o}}return i}}(e,t)||function(e,t){if(e){if("string"==typeof e)return Vn(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)?Vn(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)(Bn),2),n=t[0],r=t[1];return(0,e.useEffect)((function(){var e=function(){r(Bn())};return window.addEventListener("resize",e),function(){return window.removeEventListener("resize",e)}}),[]),n}var $n=function(e){return"small-desktop"===e||"large-desktop"===e};function Gn(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 Wn(){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=[],a=!0,u=!1;try{for(n=n.call(e);!(a=(r=n.next()).done)&&(i.push(r.value),!t||i.length!==t);a=!0);}catch(e){u=!0,o=e}finally{try{a||null==n.return||n.return()}finally{if(u)throw o}}return i}}(e,t)||function(e,t){if(e){if("string"==typeof e)return Gn(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)?Gn(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,xn.getLocations)().subscribe((function(e){r(e)}),(function(e){console.error(e)}));return function(){return e.unsubscribe()}}),[]),n}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 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}var Jn,Yn,Kn=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=[],a=!0,u=!1;try{for(n=n.call(e);!(a=(r=n.next()).done)&&(i.push(r.value),!t||i.length!==t);a=!0);}catch(e){u=!0,o=e}finally{try{a||null==n.return||n.return()}finally{if(u)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)(null),2),a=i[0],u=i[1];return(0,e.useEffect)((function(){var e=(0,xn.getCurrentUser)({includeAuthStatus:!1}).subscribe(u);return function(){return e.unsubscribe()}}),[]),a&&(0,xn.userHasAccess)(n,a)?e.default.createElement(e.default.Fragment,null,o):r?e.default.createElement(e.default.Fragment,null,r):null};function Zn(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 Qn(){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=[],a=!0,u=!1;try{for(n=n.call(e);!(a=(r=n.next()).done)&&(i.push(r.value),!t||i.length!==t);a=!0);}catch(e){u=!0,o=e}finally{try{a||null==n.return||n.return()}finally{if(u)throw o}}return i}}(e,t)||function(e,t){if(e){if("string"==typeof e)return Zn(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)?Zn(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),n=t[0],r=t[1],o=null;if(!n){if(Jn){var i=(0,xn.getSessionStore)().getState();i.loaded&&(o=i.session)}else Jn=new Promise((function(e){var t=function(t){var n=t.loaded,r=t.session;n&&(e(r),o=r,Yn&&Yn(),Yn=void 0)};t((0,xn.getSessionStore)().getState()),o||(Yn=(0,xn.getSessionStore)().subscribe(t))}));if(!o)throw Jn;r(o)}(0,e.useEffect)((function(){return Yn||(Yn=(0,xn.getSessionStore)().subscribe((function(e){var t=e.loaded,n=e.session;t&&(o=n,r(n))}))),function(){Yn&&Yn(),Yn=void 0}}),[]);var a=n||o;if(!a)throw Jn?(console.warn("useSession is in an unexpected state. Attempting to recover."),Jn):Error("useSession is in an invalid state.");return a}var Xn=s(374);const er=new WeakMap,tr={},nr=()=>{},rr=nr(),or=Object,ir=e=>e===rr,ar=e=>"function"==typeof e,ur=(e,t)=>({...e,...t}),cr="undefined",lr=typeof window!=cr,sr=typeof document!=cr,fr=(e,t)=>{const n=er.get(e);return[()=>e.get(t)||tr,r=>{const o=e.get(t);n[5](t,ur(o,r),o||tr)},n[6]]},dr=new WeakMap;let pr=0;const yr=e=>{const t=typeof e,n=e&&e.constructor,r=n==Date;let o,i;if(or(e)!==e||r||n==RegExp)o=r?e.toJSON():"symbol"==t?e.toString():"string"==t?JSON.stringify(e):""+e;else{if(o=dr.get(e),o)return o;if(o=++pr+"~",dr.set(e,o),n==Array){for(o="@",i=0;i<e.length;i++)o+=yr(e[i])+",";dr.set(e,o)}if(n==or){o="#";const t=or.keys(e).sort();for(;!ir(i=t.pop());)ir(e[i])||(o+=i+":"+yr(e[i])+",");dr.set(e,o)}}return o};let mr=!0;const[br,vr]=lr&&window.addEventListener?[window.addEventListener.bind(window),window.removeEventListener.bind(window)]:[nr,nr],gr={isOnline:()=>mr,isVisible:()=>{const e=sr&&document.visibilityState;return ir(e)||"hidden"!==e}},hr={initFocus:e=>(sr&&document.addEventListener("visibilitychange",e),br("focus",e),()=>{sr&&document.removeEventListener("visibilitychange",e),vr("focus",e)}),initReconnect:e=>{const t=()=>{mr=!0,e()},n=()=>{mr=!1};return br("online",t),br("offline",n),()=>{vr("online",t),vr("offline",n)}}},Sr=!e.default.useId,wr=!lr||"Deno"in window,Or=wr?e.useEffect:e.useLayoutEffect,jr="undefined"!=typeof navigator&&navigator.connection,Er=!wr&&jr&&(["slow-2g","2g"].includes(jr.effectiveType)||jr.saveData),xr=e=>{if(ar(e))try{e=e()}catch(t){e=""}const t=e;return[e="string"==typeof e?e:(Array.isArray(e)?e.length:e)?yr(e):"",t]};let _r=0;const Pr=()=>++_r;async function Ar(...e){const[t,n,r,o]=e,i=ur({populateCache:!0,throwOnError:!0},"boolean"==typeof o?{revalidate:o}:o||{});let a=i.populateCache;const u=i.rollbackOnError;let c=i.optimisticData;const l=!1!==i.revalidate,s=i.throwOnError;if(ar(n)){const e=n,r=[],o=t.keys();for(let n=o.next();!n.done;n=o.next()){const o=n.value;!o.startsWith("$inf$")&&e(t.get(o)._k)&&r.push(o)}return Promise.all(r.map(f))}return f(n);async function f(n){const[o]=xr(n);if(!o)return;const[i,f]=fr(t,o),[d,p,y]=er.get(t),m=d[o],b=()=>l&&(delete y[o],m&&m[0])?m[0](2).then((()=>i().data)):i().data;if(e.length<3)return b();let v,g=r;const h=Pr();p[o]=[h,0];const S=!ir(c),w=i(),O=w.data,j=w._c,E=ir(j)?O:j;if(S&&(c=ar(c)?c(E):c,f({data:c,_c:E})),ar(g))try{g=g(E)}catch(e){v=e}if(g&&ar(g.then)){if(g=await g.catch((e=>{v=e})),h!==p[o][0]){if(v)throw v;return g}v&&S&&(e=>"function"==typeof u?u(e):!1!==u)(v)&&(a=!0,g=E,f({data:g,_c:rr}))}a&&(v||(ar(a)&&(g=a(g,E)),f({data:g,_c:rr}))),p[o][1]=Pr();const x=await b();if(f({_c:rr}),!v)return a?x:g;if(s)throw v}}const Cr=(e,t)=>{for(const n in e)e[n][0]&&e[n][0](t)},Ir=(e,t)=>{if(!er.has(e)){const n=ur(hr,t),r={},o=Ar.bind(rr,e);let i=nr;const a={},u=(e,t)=>{const n=a[e]||[];return a[e]=n,n.push(t),()=>n.splice(n.indexOf(t),1)},c=(t,n,r)=>{e.set(t,n);const o=a[t];if(o)for(let e=o.length;e--;)o[e](r,n)},l=()=>{if(!er.has(e)&&(er.set(e,[r,{},{},{},o,c,u]),!wr)){const t=n.initFocus(setTimeout.bind(rr,Cr.bind(rr,r,0))),o=n.initReconnect(setTimeout.bind(rr,Cr.bind(rr,r,1)));i=()=>{t&&t(),o&&o(),er.delete(e)}}};return l(),[e,o,l,i]}return[e,er.get(e)[4]]},[Rr,Tr]=Ir(new Map),Mr=ur({onLoadingSlow:nr,onSuccess:nr,onError:nr,onErrorRetry:(e,t,n,r,o)=>{const i=n.errorRetryCount,a=o.retryCount,u=~~((Math.random()+.5)*(1<<(a<8?a:8)))*n.errorRetryInterval;!ir(i)&&a>i||setTimeout(r,u,o)},onDiscarded:nr,revalidateOnFocus:!0,revalidateOnReconnect:!0,revalidateIfStale:!0,shouldRetryOnError:!0,errorRetryInterval:Er?1e4:5e3,focusThrottleInterval:5e3,dedupingInterval:2e3,loadingTimeout:Er?5e3:3e3,compare:(e,t)=>yr(e)==yr(t),isPaused:()=>!1,cache:Rr,mutate:Tr,fallback:{}},gr),kr=(e,t)=>{const n=ur(e,t);if(t){const{use:r,fallback:o}=e,{use:i,fallback:a}=t;r&&i&&(n.use=r.concat(i)),o&&a&&(n.fallback=ur(o,a))}return n},Dr=(0,e.createContext)({}),Ur=lr&&window.__SWR_DEVTOOLS_USE__,Nr=Ur?window.__SWR_DEVTOOLS_USE__:[],Lr=Nr.concat((e=>(t,n,r)=>e(t,n&&((...e)=>{const r=xr(t)[0],[,,,o]=er.get(Rr),i=o[r];return i?(delete o[r],i):n(...e)}),r)));Ur&&(window.__SWR_DEVTOOLS_REACT__=e.default);const Fr={dedupe:!0};or.defineProperty((t=>{const{value:n}=t,r=(0,e.useContext)(Dr),o=ar(n),i=(0,e.useMemo)((()=>o?n(r):n),[o,r,n]),a=(0,e.useMemo)((()=>o?i:kr(r,i)),[o,r,i]),u=i&&i.provider,[c]=(0,e.useState)((()=>u?Ir(u(a.cache||Rr),i):rr));return c&&(a.cache=c[0],a.mutate=c[1]),Or((()=>{if(c)return c[2]&&c[2](),c[3]}),[]),(0,e.createElement)(Dr.Provider,ur(t,{value:a}))}),"defaultValue",{value:Mr});var Vr,Br=(Vr=(t,n,r)=>{const{cache:o,compare:i,suspense:a,fallbackData:u,revalidateOnMount:c,refreshInterval:l,refreshWhenHidden:s,refreshWhenOffline:f,keepPreviousData:d}=r,[p,y,m]=er.get(o),[b,v]=xr(t),g=(0,e.useRef)(!1),h=(0,e.useRef)(!1),S=(0,e.useRef)(b),w=(0,e.useRef)(n),O=(0,e.useRef)(r),j=()=>O.current,E=()=>j().isVisible()&&j().isOnline(),[x,_,P]=fr(o,b),A=(0,e.useRef)({}).current,C=ir(u)?r.fallback[b]:u,I=(e,t)=>{let n=!0;for(const r in A){const o=r;i(t[o],e[o])||"data"===o&&ir(e[o])&&i(t[o],L)||(n=!1)}return n},R=(0,e.useMemo)((()=>{const e=!!b&&!!n&&(ir(c)?!j().isPaused()&&!a:c),t=()=>{const t=x(),n=ur(t);return delete n._k,e?{isValidating:!0,isLoading:!0,...n}:n};let r=t();return()=>{const e=t();return I(e,r)?r:r=e}}),[o,b]),T=(0,Xn.useSyncExternalStore)((0,e.useCallback)((e=>P(b,((t,n)=>{I(t,n)||e()}))),[o,b]),R,R),M=!g.current,k=T.data,D=ir(k)?C:k,U=T.error,N=(0,e.useRef)(D),L=d?ir(k)?N.current:k:D,F=M&&!ir(c)?c:!j().isPaused()&&(a?!ir(D)&&r.revalidateIfStale:ir(D)||r.revalidateIfStale),V=!!(b&&n&&M&&F),B=ir(T.isValidating)?V:T.isValidating,z=ir(T.isLoading)?V:T.isLoading,$=(0,e.useCallback)((async e=>{const t=w.current;if(!b||!t||h.current||j().isPaused())return!1;let n,o,a=!0;const u=e||{},c=!m[b]||!u.dedupe,l=()=>Sr?!h.current&&b===S.current&&g.current:b===S.current,s={isValidating:!1,isLoading:!1},f=()=>{_(s)},d=()=>{const e=m[b];e&&e[1]===o&&delete m[b]},p={isValidating:!0};ir(x().data)&&(p.isLoading=!0);try{if(c&&(_(p),r.loadingTimeout&&ir(x().data)&&setTimeout((()=>{a&&l()&&j().onLoadingSlow(b,r)}),r.loadingTimeout),m[b]=[t(v),Pr()]),[n,o]=m[b],n=await n,c&&setTimeout(d,r.dedupingInterval),!m[b]||m[b][1]!==o)return c&&l()&&j().onDiscarded(b),!1;s.error=rr;const e=y[b];if(!ir(e)&&(o<=e[0]||o<=e[1]||0===e[1]))return f(),c&&l()&&j().onDiscarded(b),!1;const u=x().data;s.data=i(u,n)?u:n,c&&l()&&j().onSuccess(n,b,r)}catch(e){d();const t=j(),{shouldRetryOnError:n}=t;t.isPaused()||(s.error=e,c&&l()&&(t.onError(e,b,t),(!0===n||ar(n)&&n(e))&&E()&&t.onErrorRetry(e,b,t,$,{retryCount:(u.retryCount||0)+1,dedupe:!0})))}return a=!1,f(),!0}),[b,o]),G=(0,e.useCallback)(((...e)=>Ar(o,S.current,...e)),[]);if(Or((()=>{w.current=n,O.current=r,ir(k)||(N.current=k)})),Or((()=>{if(!b)return;const e=$.bind(rr,Fr);let t=0;const n=((e,t,n)=>{const r=t[e]||(t[e]=[]);return r.push(n),()=>{const e=r.indexOf(n);e>=0&&(r[e]=r[r.length-1],r.pop())}})(b,p,(n=>{if(0==n){const n=Date.now();j().revalidateOnFocus&&n>t&&E()&&(t=n+j().focusThrottleInterval,e())}else if(1==n)j().revalidateOnReconnect&&E()&&e();else if(2==n)return $()}));return h.current=!1,S.current=b,g.current=!0,_({_k:v}),F&&(ir(D)||wr?e():(e=>{lr&&typeof window.requestAnimationFrame!=cr?window.requestAnimationFrame(e):setTimeout(e,1)})(e)),()=>{h.current=!0,n()}}),[b]),Or((()=>{let e;function t(){const t=ar(l)?l(D):l;t&&-1!==e&&(e=setTimeout(n,t))}function n(){x().error||!s&&!j().isVisible()||!f&&!j().isOnline()?t():$(Fr).then(t)}return t(),()=>{e&&(clearTimeout(e),e=-1)}}),[l,s,f,b]),(0,e.useDebugValue)(L),a&&ir(D)&&b){if(!Sr&&wr)throw new Error("Fallback data is required when using suspense in SSR.");throw w.current=n,O.current=r,h.current=!1,ir(U)?$(Fr):U}return{mutate:G,get data(){return A.data=!0,L},get error(){return A.error=!0,U},get isValidating(){return A.isValidating=!0,B},get isLoading(){return A.isLoading=!0,z}}},function(...t){const n=ur(Mr,(0,e.useContext)(Dr)),[r,o,i]=(e=>ar(e[1])?[e[0],e[1],e[2]||{}]:[e[0],null,(null===e[1]?e[2]:e[1])||{}])(t),a=kr(n,i);let u=Vr;const{use:c}=a,l=(c||[]).concat(Lr);for(let e=l.length;e--;)u=l[e](u);return u(r,o||a.fetcher||null,a)}),zr=s(688),$r=s(332),Gr=s.n($r);function Wr(t){var n,r=Pt((0,xn.getVisitStore)()),o=r.patientUuid,i=r.manuallySetVisitUuid,a=t&&o==t?i:null,u="?patient=".concat(t,"&v=").concat(xn.defaultVisitCustomRepresentation,"&includeInactive=false"),c="/".concat(a),l=Br(t?"/ws/rest/v1/visit".concat(u):null,xn.openmrsFetch),s=l.data,f=l.error,d=l.mutate,p=l.isValidating,y=Br(t&&a?"/ws/rest/v1/visit".concat(c):null,xn.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 a?null==m?void 0:m.data:null!=h?h:null}),[m,h,a]);return{error:f||b,mutate:function(){d(),v()},isValidating:p||g,activeVisit:h,currentVisit:S,currentVisitIsRetrospective:Boolean(a),isLoading:Boolean((!s||a&&!m)&&(!f||!b))}}function qr(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 Hr(){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=[],a=!0,u=!1;try{for(n=n.call(e);!(a=(r=n.next()).done)&&(i.push(r.value),!t||i.length!==t);a=!0);}catch(e){u=!0,o=e}finally{try{a||null==n.return||n.return()}finally{if(u)throw o}}return i}}(e,t)||function(e,t){if(e){if("string"==typeof e)return qr(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)?qr(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,xn.getVisitTypes)().subscribe((function(e){r(e)}),(function(e){return console.error(e)}));return function(){return e.unsubscribe()}}),[]),n}function Jr(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}zr.default.extend(Gr());var Yr=10;function Kr(){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=[],a=!0,u=!1;try{for(n=n.call(e);!(a=(r=n.next()).done)&&(i.push(r.value),!t||i.length!==t);a=!0);}catch(e){u=!0,o=e}finally{try{a||null==n.return||n.return()}finally{if(u)throw o}}return i}}(e,t)||function(e,t){if(e){if("string"==typeof e)return Jr(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)?Jr(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],a=(0,e.useMemo)((function(){return"number"==typeof n&&n>0?Math.max(1,Math.ceil(t.length/n)):1}),[t.length,n]),u=(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(a,e)))}),[i,a]),l=(0,e.useCallback)((function(){o<a&&i(o+1)}),[o,a,i]),s=(0,e.useCallback)((function(){o>1&&i(o-1)}),[o,i]);return(0,e.useMemo)((function(){return{results:u,totalPages:a,currentPage:o,paginated:t.length>n,showNextButton:o<a,showPreviousButton:o>1,goTo:c,goToNext:l,goToPrevious:s}}),[u,a,t.length,n,o,c,l,s])}})(),f})())}}}));
|
|
3
3
|
//# sourceMappingURL=openmrs-esm-react-utils.js.map
|