@openmrs/esm-react-utils 3.2.1-pre.946 → 3.2.1-pre.947

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.
@@ -1,2 +1,2 @@
1
- System.register(["react","@openmrs/esm-config","@openmrs/esm-extensions","@openmrs/esm-globals","react-dom","i18next","react-i18next","@openmrs/esm-api"],(function(e,t){var n={},r={},o={},i={},s={},a={},u={},c={};return{setters:[function(e){n.default=e.default,n.useCallback=e.useCallback,n.useContext=e.useContext,n.useEffect=e.useEffect,n.useMemo=e.useMemo,n.useReducer=e.useReducer,n.useRef=e.useRef,n.useState=e.useState},function(e){r.getConfigStore=e.getConfigStore,r.getExtensionConfigStore=e.getExtensionConfigStore,r.getExtensionSlotsConfigStore=e.getExtensionSlotsConfigStore,r.interpolateUrl=e.interpolateUrl,r.navigate=e.navigate},function(e){o.checkStatusFor=e.checkStatusFor,o.extensionStore=e.extensionStore,o.getAssignedIds=e.getAssignedIds,o.getExtensionRegistrationFrom=e.getExtensionRegistrationFrom,o.pushNavigationContext=e.pushNavigationContext,o.registerExtensionSlot=e.registerExtensionSlot,o.renderExtension=e.renderExtension,o.unregisterExtensionSlot=e.unregisterExtensionSlot},function(e){i.subscribeConnectivityChanged=e.subscribeConnectivityChanged},function(e){s.default=e.default},function(e){a.default=e.default},function(e){u.I18nextProvider=e.I18nextProvider},function(e){c.VisitMode=e.VisitMode,c.VisitStatus=e.VisitStatus,c.fetchCurrentPatient=e.fetchCurrentPatient,c.getCurrentUser=e.getCurrentUser,c.getLocations=e.getLocations,c.getStartedVisit=e.getStartedVisit,c.getVisitTypes=e.getVisitTypes,c.getVisitsForPatient=e.getVisitsForPatient,c.openmrsObservableFetch=e.openmrsObservableFetch,c.userHasAccess=e.userHasAccess}],execute:function(){e((()=>{var e={748:()=>{System.register([],(function(e,t){return{execute:function(){e((()=>{var e={968:(e,t,n)=>{const r=n(577).R;t.s=function(e){if(e||(e=1),!n.y.meta||!n.y.meta.url)throw console.error("__system_context__",n.y),Error("systemjs-webpack-interop was provided an unknown SystemJS context. Expected context.meta.url, but none was provided");n.p=r(n.y.meta.url,e)}},577:(e,t,n)=>{t.R=function(e,t){var n=document.createElement("a");n.href=e;for(var r="/"===n.pathname[0]?n.pathname:"/"+n.pathname,o=0,i=r.length;o!==t&&i>=0;)"/"===r[--i]&&o++;if(o!==t)throw Error("systemjs-webpack-interop: rootDirectoryLevel ("+t+") is greater than the number of directories ("+o+") in the URL path "+e);var s=r.slice(0,i+1);return n.protocol+"//"+n.host+s},Number.isInteger}},n={};function r(t){var o=n[t];if(void 0!==o)return o.exports;var i=n[t]={exports:{}};return e[t](i,i.exports,r),i.exports}r.y=t,r.d=(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.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},(()=>{var e;r.g.importScripts&&(e=r.g.location+"");var t=r.g.document;if(!e&&t&&(t.currentScript&&(e=t.currentScript.src),!e)){var n=t.getElementsByTagName("script");n.length&&(e=n[n.length-1].src)}if(!e)throw new Error("Automatic publicPath is not supported in this browser");e=e.replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),r.p=e})();var o={};return(0,r(968).s)(1),(()=>{"use strict";function e(e,t){for(var n in t)e[n]=t[n];return e}function t(t){var n=[];function r(e){for(var t=[],r=0;r<n.length;r++)n[r]===e?e=null:t.push(n[r]);n=t}function o(r,o,i){t=o?r:e(e({},t),r);for(var s=n,a=0;a<s.length;a++)s[a](t,i)}return t=t||{},{action:function(e){function n(t){o(t,!1,e)}return function(){for(var r=arguments,o=[t],i=0;i<arguments.length;i++)o.push(r[i]);var s=e.apply(this,o);if(null!=s)return s.then?s.then(n):n(s)}},setState:o,subscribe:function(e){return n.push(e),function(){r(e)}},unsubscribe:r,getState:function(){return t}}}r.r(o),r.d(o,{createAppState:()=>a,createGlobalStore:()=>i,getAppState:()=>u,getGlobalStore:()=>s,subscribeTo:()=>c,update:()=>l});const n={};function i(e,r){const o=n[e];if(o)return o.active?console.error("Cannot override an existing store. Make sure that stores are only created once."):o.value.setState(r,!0),o.active=!0,o.value;{const o=t(r);return n[e]={value:o,active:!0},o}}function s(e,r){const o=n[e];if(!o){const o=t(r);return n[e]={value:o,active:!1},o}return o.value}function a(e){return i("app",e)}function u(){return s("app",{})}function c(e,t,n){let r=t(e.getState());return e.subscribe((e=>{const o=t(e);o!==r&&(r=o,n(o))}))}function l(e,t,n){let[r,...o]=t;return r?0===o.length?{...e,[r]:n}:{...e,[r]:l(e[r]||{},o,n)}:e}})(),o})())}}}))},968:(e,t,n)=>{const r=n(577).R;t.s=function(e){if(e||(e=1),!n.y.meta||!n.y.meta.url)throw console.error("__system_context__",n.y),Error("systemjs-webpack-interop was provided an unknown SystemJS context. Expected context.meta.url, but none was provided");n.p=r(n.y.meta.url,e)}},577:(e,t,n)=>{t.R=function(e,t){var n=document.createElement("a");n.href=e;for(var r="/"===n.pathname[0]?n.pathname:"/"+n.pathname,o=0,i=r.length;o!==t&&i>=0;)"/"===r[--i]&&o++;if(o!==t)throw Error("systemjs-webpack-interop: rootDirectoryLevel ("+t+") is greater than the number of directories ("+o+") in the URL path "+e);var s=r.slice(0,i+1);return n.protocol+"//"+n.host+s};Number.isInteger},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},64:e=>{"use strict";e.exports=a},954:e=>{"use strict";e.exports=n},493:e=>{"use strict";e.exports=s},281:e=>{"use strict";e.exports=u}},l={};function p(t){var n=l[t];if(void 0!==n)return n.exports;var r=l[t]={exports:{}};return e[t](r,r.exports,p),r.exports}p.y=t,p.d=(e,t)=>{for(var n in t)p.o(t,n)&&!p.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},p.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),p.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),p.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},(()=>{var e;p.g.importScripts&&(e=p.g.location+"");var t=p.g.document;if(!e&&t&&(t.currentScript&&(e=t.currentScript.src),!e)){var n=t.getElementsByTagName("script");n.length&&(e=n[n.length-1].src)}if(!e)throw new Error("Automatic publicPath is not supported in this browser");e=e.replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),p.p=e})();var d={};return(0,p(968).s)(1),(()=>{"use strict";p.r(d),p.d(d,{ComponentContext:()=>t,ConfigurableLink:()=>o,Extension:()=>u,ExtensionSlot:()=>P,UserHasAccess:()=>Se,createUseStore:()=>i,getAsyncExtensionLifecycle:()=>Z,getAsyncLifecycle:()=>W,getLifecycle:()=>K,getSyncLifecycle:()=>J,openmrsComponentDecorator:()=>q,useAssignedExtensionIds:()=>y,useAttachedExtensionIds:()=>h,useBodyScrollLock:()=>Q,useConfig:()=>te,useConnectedExtensions:()=>S,useConnectivity:()=>v,useCurrentPatient:()=>de,useExtension:()=>a,useExtensionSlot:()=>x,useExtensionSlotConfig:()=>m,useExtensionSlotMeta:()=>fe,useExtensionStore:()=>me,useForceUpdate:()=>ge,useLayoutType:()=>ye,useLocations:()=>be,useNavigationContext:()=>ve,useOnClickOutside:()=>Ee,usePagination:()=>Re,usePatient:()=>ae,useSessionUser:()=>xe,useStore:()=>we,useStoreState:()=>l,useVisit:()=>Ce,useVisitTypes:()=>Pe});var e=p(954);const t=e.default.createContext({moduleName:""});var n=p(824);function r(){return r=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},r.apply(this,arguments)}const o=t=>{let{to:o,children:i,...s}=t;return e.default.createElement("a",r({onClick:e=>function(e,t){e.metaKey||e.ctrlKey||e.shiftKey||0!=e.button||(e.preventDefault(),(0,n.navigate)({to:t}))}(e,o),href:(0,n.interpolateUrl)(o)},s),i)};function i(t){return function(n){const[r,o]=(0,e.useState)(t.getState());(0,e.useEffect)((()=>t.subscribe((e=>o(e)))),[]);let i={};return n&&(i=(0,e.useMemo)((()=>function(e,t){"function"==typeof t&&(t=t(e));const n={};for(let r in t)n[r]=e.action(t[r]);return n}(t,n)),[t,n])),{...r,...i}}}var s=p(45);function a(n){const r=(0,e.useRef)(null),{extension:o}=(0,e.useContext)(t);return(0,e.useEffect)((()=>{if(r.current&&o)return(0,s.renderExtension)(r.current,o.extensionSlotName,o.extensionSlotModuleName,o.extensionId,void 0,n)}),[o?.extensionSlotName,o?.extensionId,o?.extensionSlotModuleName,r.current,n]),[r,o]}const u=t=>{let{state:n,wrap:r}=t;const[o,i]=a(n),s=e.default.createElement("div",{ref:o,"data-extension-id":i?.extensionId,style:{position:"relative"}});return i&&r?r(s,i):s};var c=p(748);function l(t,n){const[r,o]=(0,e.useState)((()=>n(t.getState())));return(0,e.useEffect)((()=>(0,c.subscribeTo)(t,n,o)),[t,n]),r}const f={add:[],order:[],remove:[]};function m(r){const{moduleName:o}=(0,e.useContext)(t),i=(0,n.getExtensionSlotsConfigStore)(o),s=(0,e.useCallback)((e=>e.extensionSlotConfigs[r]),[r]);return l(i,s)||f}const g=[];function h(t){const n=(0,e.useCallback)((e=>e.slots[t]?.attachedIds),[t]);return l(s.extensionStore,n)||g}function y(t){const n=m(t),r=h(t),[o,i]=(0,e.useState)([]);return(0,e.useEffect)((()=>{const e=(0,s.getAssignedIds)(t,n,r);e.join(",")!==o.join(",")&&i(e)}),[r,n]),o}var b=p(728);function v(){let[t,n]=(0,e.useState)(window.navigator.onLine);return(0,e.useEffect)((()=>(0,b.subscribeConnectivityChanged)((e=>{let{online:t}=e;return n(t)}))),[]),t}function E(e){return e.hasOwnProperty("name")}function S(t){const n=v(),r=y(t),o=(0,e.useMemo)((()=>{const e=s.extensionStore.getState();return r.map((t=>({id:t,...(0,s.getExtensionRegistrationFrom)(e,t)}))).filter(E).filter((e=>(0,s.checkStatusFor)(n,e.online,e.offline)))}),[r,n]);return o}function x(n){const{moduleName:r}=(0,e.useContext)(t);if(!r)throw Error("ComponentContext has not been provided. This should come from @openmrs/esm-react-utils.");return(0,e.useEffect)((()=>((0,s.registerExtensionSlot)(r,n),()=>(0,s.unregisterExtensionSlot)(r,n))),[]),{extensions:S(n),extensionSlotName:n,extensionSlotModuleName:r}}function w(){return w=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},w.apply(this,arguments)}function C(e){return e}const P=n=>{let{extensionSlotName:r,select:o=C,children:i,state:s,style:a,...c}=n;const l=(0,e.useRef)(null),{extensions:p,extensionSlotModuleName:d}=x(r),f=(0,e.useRef)(s);(function(e,t){if(e===t)return!0;if(!e&&t)return!1;if(e&&!t)return!1;if("object"!=typeof e||"object"!=typeof t)return!1;const n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(let r=0;r<n.length;r++){const o=n[r];if(!(o in t)||t[o]!==e[o])return!1}return!0})(f.current,s)||(f.current=s);const m=(0,e.useMemo)((()=>r&&o(p).map((n=>e.default.createElement(t.Provider,{key:n.id,value:{moduleName:n.moduleName,extension:{extensionId:n.id,extensionSlotName:r,extensionSlotModuleName:d}}},i??e.default.createElement(u,{state:f.current}))))),[o,p,r,f.current]);return e.default.createElement("div",w({ref:l,"data-extension-slot-name":r,"data-extension-slot-module-name":d,style:{...a,position:"relative"}},c),m)};var R=p(493);function O(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 N(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?O(Object(n),!0).forEach((function(t){M(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):O(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function j(e){return(j="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 M(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function L(e){return(L="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){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(L(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(L(e)));return e}}var k=null;try{k=require("react").createContext()}catch(O){}var U={React:null,ReactDOM:null,rootComponent:null,loadRootComponent:null,renderType:null,errorBoundary:null,errorBoundaryClass:null,domElementGetter:null,parcelCanUpdate:!0,suppressComponentDidCatchWarning:!1,domElements:{},renderResults:{},updateResolves:{}};function D(e){if("object"!==j(e))throw new Error("single-spa-react requires a configuration object");var t=N(N({},U),e);if(!t.React)throw new Error("single-spa-react must be passed opts.React");if(!t.ReactDOM)throw new Error("single-spa-react must be passed opts.ReactDOM");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");!k&&t.React.createContext&&(k=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:I.bind(null,t),mount:B.bind(null,t),unmount:A.bind(null,t)};return t.parcelCanUpdate&&(n.update=F.bind(null,t)),n}function I(e,t){return e.rootComponent?Promise.resolve():e.loadRootComponent(t).then((function(t){e.rootComponent=t}))}function B(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.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=V(e,t,(function(){n(this)})),i=T(e,t)(),s=function(e){var t=e.opts,n=e.elementToRender,r=e.domElement,o="function"==typeof t.renderType?t.renderType():t.renderType;if(["createRoot","unstable_createRoot","createBlockingRoot","unstable_createBlockingRoot"].indexOf(o)>=0){var i=t.ReactDOM[o](r);return i.render(n),i}return"hydrate"===o?t.ReactDOM.hydrate(n,r):t.ReactDOM.render(n,r),null}({elementToRender:o,domElement:i,opts:e});e.domElements[t.name]=i,e.renderResults[t.name]=s}))}function A(e,t){return new Promise((function(n){e.unmountFinished=n;var r=e.renderResults[t.name];r&&r.unmount?r.unmount():e.ReactDOM.unmountComponentAtNode(e.domElements[t.name]),delete e.domElements[t.name],delete e.renderResults[t.name]}))}function F(e,t){return new Promise((function(n){e.updateResolves[t.name]||(e.updateResolves[t.name]=[]),e.updateResolves[t.name].push(n);var r=V(e,t,null),o=e.renderResults[t.name];if(o&&o.render)o.render(r);else{var i=T(e,t)();e.ReactDOM.render(r,i)}}))}function V(e,t,n){var r=e.React.createElement(e.rootComponent,t),o=k?e.React.createElement(k.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,N(N({},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(){setTimeout(e.unmountFinished)}}),o)}var _=p(64),G=p(281);const $=_.default.default||_.default,H={strictMode:!0,throwErrorsToConsole:!0,disableTranslations:!1},z=t=>{(0,e.useEffect)((()=>($.on("languageChanged",t.forceUpdate),()=>$.off("languageChanged",t.forceUpdate))),[t.forceUpdate]);const n=(0,e.useRef)(null);if(n.current)throw n.current;if(!$.hasLoadedNamespace(t.ns)){const e=setTimeout((()=>{console.warn(`openmrsComponentDecorator: the React suspense promise for i18next.loadNamespaces(['${t.ns}']) did not resolve nor reject after three seconds. This could mean you have multiple versions of i18next and haven't made i18next a webpack external in all projects.`)}),3e3);throw $.loadNamespaces([t.ns]).then((()=>clearTimeout(e))).catch((t=>{clearTimeout(e),n.current=t}))}return e.default.createElement(e.default.Fragment,null,t.children)};function q(n){if("object"!=typeof n||"string"!=typeof n.featureName||"string"!=typeof n.moduleName)throw new Error("Invalid options");const r=Object.assign({},H,n);return function(n){var o,i,s,a,u;return i=o=class extends e.default.Component{constructor(e){super(e),this.state={caughtError:null,caughtErrorInfo:null,config:{moduleName:r.moduleName,extension:e._extensionContext}}}componentDidCatch(e,t){t&&t.componentStack&&(e.extra=Object.assign(e.extra||{},{componentStack:t.componentStack})),r.throwErrorsToConsole&&setTimeout((()=>{throw e})),this.setState({caughtError:e,caughtErrorInfo:t})}render(){if(this.state.caughtError)return e.default.createElement("div",null,"An error has occurred. Please try reloading the page.");{const o=e.default.createElement(t.Provider,{value:this.state.config},e.default.createElement(e.default.Suspense,{fallback:null},r.disableTranslations?e.default.createElement(n,this.props):e.default.createElement(z,{ns:r.moduleName,forceUpdate:()=>this.forceUpdate()},e.default.createElement(G.I18nextProvider,{i18n:$,defaultNS:r.moduleName},e.default.createElement(n,this.props)))));return r.strictMode||!e.default.StrictMode?o:e.default.createElement(e.default.StrictMode,null,o)}}},s=o,a="displayName",u=`OpenmrsReactComponent(${r.featureName})`,a in s?Object.defineProperty(s,a,{value:u,enumerable:!0,configurable:!0,writable:!0}):s[a]=u,i}}function K(t,n){return D({React:e.default,ReactDOM:R.default,rootComponent:q(n)(t)})}function W(e,t){return()=>e().then((e=>{let{default:n}=e;return K(n,t)}))}function J(e,t){return()=>Promise.resolve(K(e,t))}const Z=W;function Q(t){(0,e.useEffect)((()=>{if(t){const e=window.getComputedStyle(document.body).overflow;return document.body.style.overflow="hidden",()=>{document.body.style.overflow=e}}}),[t])}const X={};function Y(e){return new Promise((t=>{const n=e.subscribe((e=>{e.loaded&&e.config&&(t(e.config),n())}))}))}function ee(t){const[n,r]=(0,e.useState)(function(e){return e?()=>{const t=e.getState();if(t.loaded&&t.config)return t.config}:void 0}(t));return(0,e.useEffect)((()=>t?.subscribe((e=>{e.loaded&&e.config&&r(e.config)}))),[t]),n}function te(){const{moduleName:r,extension:o}=(0,e.useContext)(t);if(!r&&!o)throw Error('No ComponentContext has been provided. This should come from "openmrsComponentDecorator".\nUsually this is already applied when using "getAsyncLifecycle" or "getSyncLifecycle".');const i=function(t){const r=(0,e.useMemo)((()=>(0,n.getConfigStore)(t)),[t]),o=t,i=ee(r);if(!i)throw X[o]||(X[o]=Y(r)),X[o];return i}(r),s=function(t){const r=(0,e.useMemo)((()=>t&&(0,n.getExtensionConfigStore)(t.extensionSlotModuleName,t.extensionSlotName,t.extensionId)),[t]),o=ee(r);if(!o&&t){const e=`${t.extensionSlotModuleName}-${t.extensionSlotName}-${t.extensionId}`;throw!X[e]&&r&&(X[e]=Y(r)),X[e]}return o||{}}(o),a=(0,e.useMemo)((()=>({...i,...s})),[i,s]);return o?.extensionSlotModuleName,o?.extensionSlotName,o&&o?.extensionId,a}var ne,re=p(766);!function(e){e.loadPatient="loadPatient",e.newPatient="newPatient",e.loadError="patientLoadError"}(ne||(ne={}));const oe={patientUuid:null,patient:null,isLoadingPatient:!0,err:null};function ie(){const e=/\/patient\/([a-zA-Z0-9\-]+)\/?/.exec(location.pathname);return e&&e[1]}function se(e,t){switch(t.type){case ne.loadPatient:return{...e,patientUuid:t.patientUuid,patient:null,isLoadingPatient:!0,err:null};case ne.newPatient:return{...e,patient:t.patient,isLoadingPatient:!1,err:null};case ne.loadError:return{...e,patient:null,isLoadingPatient:!1,err:t.err};default:return e}}function ae(t){const[n,r]=(0,e.useReducer)(se,{...oe,patientUuid:t??null});return(0,e.useEffect)((()=>{if(n.patientUuid)r({type:ne.loadPatient,patientUuid:n.patientUuid});else{const e=ie();r(e?{type:ne.loadPatient,patientUuid:e}:{type:ne.newPatient,patient:null})}}),[n.patientUuid]),(0,e.useEffect)((()=>{let e=!0;return n.isLoadingPatient&&n.patientUuid&&(0,re.fetchCurrentPatient)(n.patientUuid).then((t=>e&&r({patient:t.data,type:ne.newPatient})),(t=>e&&r({err:t,type:ne.loadError}))),()=>{e=!1}}),[n.isLoadingPatient,n.patientUuid]),(0,e.useEffect)((()=>{const e=e=>{const t=ie();t!=n.patientUuid&&r({type:ne.loadPatient,patientUuid:t})};return window.addEventListener("single-spa:routing-event",e),()=>window.removeEventListener("single-spa:routing-event",e)}),[]),{isLoading:n.isLoadingPatient,patient:n.patient,patientUuid:t??n.patientUuid,error:n.err}}var ue;!function(e){e.loadPatient="loadPatient",e.newPatient="newPatient",e.loadError="patientLloadErroroadError"}(ue||(ue={}));const ce={patient:null,isLoadingPatient:!0,err:null};function le(){const e=/\/patient\/([a-zA-Z0-9\-]+)\/?/.exec(location.pathname);return e&&e[1]}function pe(e,t){switch(t.type){case ue.loadPatient:return{...e,patient:null,isLoadingPatient:!0,err:null};case ue.newPatient:return{...e,patient:t.patient,isLoadingPatient:!1,err:null};case ue.loadError:return{...e,patient:null,isLoadingPatient:!1,err:t.err};default:return e}}function de(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:le();const[n,r]=(0,e.useReducer)(pe,ce);return(0,e.useEffect)((()=>{let e=!0;return t?((0,re.fetchCurrentPatient)(t).then((t=>e&&r({patient:t.data,type:ue.newPatient})),(t=>e&&r({err:t,type:ue.loadError}))),r({type:ue.loadPatient})):r({type:ue.newPatient,patient:null}),()=>{e=!1}}),[t]),[n.isLoadingPatient,n.patient,t,n.err]}function fe(t){const n=S(t);return(0,e.useMemo)((()=>Object.fromEntries(n.map((e=>[e.name,e.meta])))),[n])}const me=i(s.extensionStore);function ge(){const[,t]=(0,e.useState)(0);return(0,e.useCallback)((()=>{t((e=>e+1))}),[])}function he(){let e="tablet";return document.body.classList.forEach((t=>{switch(t){case"omrs-breakpoint-lt-tablet":e="phone";break;case"omrs-breakpoint-gt-tablet":e="desktop"}})),e}function ye(){const[t,n]=(0,e.useState)(he);return(0,e.useEffect)((()=>{const e=()=>{n(he())};return window.addEventListener("resize",e),()=>window.removeEventListener("resize",e)}),[]),t}function be(){const[t,n]=(0,e.useState)([]);return(0,e.useEffect)((()=>{const e=(0,re.getLocations)().subscribe((e=>{n(e)}),(e=>{console.error(e)}));return()=>e.unsubscribe()}),[]),t}function ve(t){(0,e.useEffect)((()=>(0,s.pushNavigationContext)(t)),[])}function Ee(t){let n=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];const r=(0,e.useRef)(null);return(0,e.useEffect)((()=>{if(n){const e=e=>{const n=r?.current;n?.contains(e.target)&&t(e)};return window.addEventListener("click",e),()=>window.removeEventListener("click",e)}}),[t,n]),r}const Se=t=>{let{privilege:n,children:r}=t;const[o,i]=(0,e.useState)(null);return(0,e.useEffect)((()=>{const e=(0,re.getCurrentUser)({includeAuthStatus:!1}).subscribe(i);return()=>e.unsubscribe()}),[]),o&&(0,re.userHasAccess)(n,o)?e.default.createElement(e.default.Fragment,null,r):null};function xe(){const[t,n]=(0,e.useState)(null);return(0,e.useEffect)((()=>{if(null===t){const e=(0,re.openmrsObservableFetch)("/ws/rest/v1/session").subscribe((e=>{n(e.data)}));return()=>e.unsubscribe()}}),[t]),t}function we(e,t){return i(e)(t)}function Ce(t){const[n,r]=(0,e.useState)(null),[o,i]=(0,e.useState)(null);return(0,e.useEffect)((()=>{const e=re.getStartedVisit.subscribe((e=>{r(e?e?.visitData??null:null)}));return()=>e.unsubscribe()}),[t]),(0,e.useEffect)((()=>{const e=new AbortController,n=(0,re.getVisitsForPatient)(t,e).subscribe((e=>{let{data:t}=e;const n=t.results.find((e=>null===e.stopDatetime));n&&re.getStartedVisit.next({mode:re.VisitMode.LOADING,visitData:n,status:re.VisitStatus.ONGOING})}),i);return()=>n&&n.unsubscribe()}),[t]),{currentVisit:n,error:o}}function Pe(){const[t,n]=(0,e.useState)([]);return(0,e.useEffect)((()=>{const e=(0,re.getVisitTypes)().subscribe((e=>{n(e)}),(e=>console.error(e)));return()=>e.unsubscribe()}),[]),t}function Re(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:10;const[r,o]=(0,e.useState)(1),i=(0,e.useMemo)((()=>Math.max(1,Math.ceil(t.length/n))),[t.length,n]),s=(0,e.useMemo)((()=>{const e=(r-1)*n,o=(r+0)*n;return t.slice(e,o)}),[t,r,n]);return{results:s,totalPages:i,currentPage:r,paginated:t.length>n,showNextButton:r<i,showPreviousButton:r>1,goTo(e){o(Math.max(1,Math.min(i,e)))},goToNext(){r<i&&o(r+1)},goToPrevious(){r>1&&o(r-1)}}}})(),d})())}}}));
1
+ System.register(["react","@openmrs/esm-config","@openmrs/esm-extensions","@openmrs/esm-globals","react-dom","i18next","react-i18next","@openmrs/esm-api"],(function(e,t){var n={},r={},o={},i={},s={},a={},u={},c={};return{setters:[function(e){n.default=e.default,n.useCallback=e.useCallback,n.useContext=e.useContext,n.useEffect=e.useEffect,n.useMemo=e.useMemo,n.useReducer=e.useReducer,n.useRef=e.useRef,n.useState=e.useState},function(e){r.getConfigStore=e.getConfigStore,r.getExtensionConfigStore=e.getExtensionConfigStore,r.getExtensionSlotsConfigStore=e.getExtensionSlotsConfigStore,r.interpolateUrl=e.interpolateUrl,r.navigate=e.navigate},function(e){o.checkStatusFor=e.checkStatusFor,o.extensionStore=e.extensionStore,o.getAssignedIds=e.getAssignedIds,o.getExtensionRegistrationFrom=e.getExtensionRegistrationFrom,o.pushNavigationContext=e.pushNavigationContext,o.registerExtensionSlot=e.registerExtensionSlot,o.renderExtension=e.renderExtension,o.unregisterExtensionSlot=e.unregisterExtensionSlot},function(e){i.subscribeConnectivityChanged=e.subscribeConnectivityChanged},function(e){s.default=e.default},function(e){a.default=e.default},function(e){u.I18nextProvider=e.I18nextProvider},function(e){c.VisitMode=e.VisitMode,c.VisitStatus=e.VisitStatus,c.fetchCurrentPatient=e.fetchCurrentPatient,c.getCurrentUser=e.getCurrentUser,c.getLocations=e.getLocations,c.getStartedVisit=e.getStartedVisit,c.getVisitTypes=e.getVisitTypes,c.getVisitsForPatient=e.getVisitsForPatient,c.openmrsObservableFetch=e.openmrsObservableFetch,c.userHasAccess=e.userHasAccess}],execute:function(){e((()=>{var e={748:()=>{System.register([],(function(e,t){return{execute:function(){e((()=>{var e={968:(e,t,n)=>{const r=n(577).R;t.s=function(e){if(e||(e=1),!n.y.meta||!n.y.meta.url)throw console.error("__system_context__",n.y),Error("systemjs-webpack-interop was provided an unknown SystemJS context. Expected context.meta.url, but none was provided");n.p=r(n.y.meta.url,e)}},577:(e,t,n)=>{t.R=function(e,t){var n=document.createElement("a");n.href=e;for(var r="/"===n.pathname[0]?n.pathname:"/"+n.pathname,o=0,i=r.length;o!==t&&i>=0;)"/"===r[--i]&&o++;if(o!==t)throw Error("systemjs-webpack-interop: rootDirectoryLevel ("+t+") is greater than the number of directories ("+o+") in the URL path "+e);var s=r.slice(0,i+1);return n.protocol+"//"+n.host+s},Number.isInteger}},n={};function r(t){var o=n[t];if(void 0!==o)return o.exports;var i=n[t]={exports:{}};return e[t](i,i.exports,r),i.exports}r.y=t,r.d=(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.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},(()=>{var e;r.g.importScripts&&(e=r.g.location+"");var t=r.g.document;if(!e&&t&&(t.currentScript&&(e=t.currentScript.src),!e)){var n=t.getElementsByTagName("script");n.length&&(e=n[n.length-1].src)}if(!e)throw new Error("Automatic publicPath is not supported in this browser");e=e.replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),r.p=e})();var o={};return(0,r(968).s)(1),(()=>{"use strict";function e(e,t){for(var n in t)e[n]=t[n];return e}function t(t){var n=[];function r(e){for(var t=[],r=0;r<n.length;r++)n[r]===e?e=null:t.push(n[r]);n=t}function o(r,o,i){t=o?r:e(e({},t),r);for(var s=n,a=0;a<s.length;a++)s[a](t,i)}return t=t||{},{action:function(e){function n(t){o(t,!1,e)}return function(){for(var r=arguments,o=[t],i=0;i<arguments.length;i++)o.push(r[i]);var s=e.apply(this,o);if(null!=s)return s.then?s.then(n):n(s)}},setState:o,subscribe:function(e){return n.push(e),function(){r(e)}},unsubscribe:r,getState:function(){return t}}}r.r(o),r.d(o,{createAppState:()=>a,createGlobalStore:()=>i,getAppState:()=>u,getGlobalStore:()=>s,subscribeTo:()=>c,update:()=>l});const n={};function i(e,r){const o=n[e];if(o)return o.active?console.error("Cannot override an existing store. Make sure that stores are only created once."):o.value.setState(r,!0),o.active=!0,o.value;{const o=t(r);return n[e]={value:o,active:!0},o}}function s(e,r){const o=n[e];if(!o){const o=t(r);return n[e]={value:o,active:!1},o}return o.value}function a(e){return i("app",e)}function u(){return s("app",{})}function c(e,t,n){let r=t(e.getState());return e.subscribe((e=>{const o=t(e);o!==r&&(r=o,n(o))}))}function l(e,t,n){let[r,...o]=t;return r?0===o.length?{...e,[r]:n}:{...e,[r]:l(e[r]||{},o,n)}:e}})(),o})())}}}))},968:(e,t,n)=>{const r=n(577).R;t.s=function(e){if(e||(e=1),!n.y.meta||!n.y.meta.url)throw console.error("__system_context__",n.y),Error("systemjs-webpack-interop was provided an unknown SystemJS context. Expected context.meta.url, but none was provided");n.p=r(n.y.meta.url,e)}},577:(e,t,n)=>{t.R=function(e,t){var n=document.createElement("a");n.href=e;for(var r="/"===n.pathname[0]?n.pathname:"/"+n.pathname,o=0,i=r.length;o!==t&&i>=0;)"/"===r[--i]&&o++;if(o!==t)throw Error("systemjs-webpack-interop: rootDirectoryLevel ("+t+") is greater than the number of directories ("+o+") in the URL path "+e);var s=r.slice(0,i+1);return n.protocol+"//"+n.host+s};Number.isInteger},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},64:e=>{"use strict";e.exports=a},954:e=>{"use strict";e.exports=n},493:e=>{"use strict";e.exports=s},281:e=>{"use strict";e.exports=u}},l={};function d(t){var n=l[t];if(void 0!==n)return n.exports;var r=l[t]={exports:{}};return e[t](r,r.exports,d),r.exports}d.y=t,d.d=(e,t)=>{for(var n in t)d.o(t,n)&&!d.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},d.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),d.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),d.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},(()=>{var e;d.g.importScripts&&(e=d.g.location+"");var t=d.g.document;if(!e&&t&&(t.currentScript&&(e=t.currentScript.src),!e)){var n=t.getElementsByTagName("script");n.length&&(e=n[n.length-1].src)}if(!e)throw new Error("Automatic publicPath is not supported in this browser");e=e.replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),d.p=e})();var p={};return(0,d(968).s)(1),(()=>{"use strict";d.r(p),d.d(p,{ComponentContext:()=>t,ConfigurableLink:()=>o,Extension:()=>u,ExtensionSlot:()=>P,UserHasAccess:()=>Se,createUseStore:()=>i,getAsyncExtensionLifecycle:()=>Z,getAsyncLifecycle:()=>W,getLifecycle:()=>K,getSyncLifecycle:()=>J,openmrsComponentDecorator:()=>q,useAssignedExtensionIds:()=>y,useAttachedExtensionIds:()=>h,useBodyScrollLock:()=>Q,useConfig:()=>te,useConnectedExtensions:()=>S,useConnectivity:()=>v,useCurrentPatient:()=>pe,useExtension:()=>a,useExtensionSlot:()=>x,useExtensionSlotConfig:()=>m,useExtensionSlotMeta:()=>fe,useExtensionStore:()=>me,useForceUpdate:()=>ge,useLayoutType:()=>ye,useLocations:()=>be,useNavigationContext:()=>ve,useOnClickOutside:()=>Ee,usePagination:()=>Re,usePatient:()=>ae,useSessionUser:()=>xe,useStore:()=>we,useStoreState:()=>l,useVisit:()=>Ce,useVisitTypes:()=>Pe});var e=d(954);const t=e.default.createContext({moduleName:""});var n=d(824);function r(){return r=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},r.apply(this,arguments)}const o=t=>{let{to:o,children:i,...s}=t;return e.default.createElement("a",r({onClick:e=>function(e,t){e.metaKey||e.ctrlKey||e.shiftKey||0!=e.button||(e.preventDefault(),(0,n.navigate)({to:t}))}(e,o),href:(0,n.interpolateUrl)(o)},s),i)};function i(t){return function(n){const[r,o]=(0,e.useState)(t.getState());(0,e.useEffect)((()=>t.subscribe((e=>o(e)))),[]);let i={};return n&&(i=(0,e.useMemo)((()=>function(e,t){"function"==typeof t&&(t=t(e));const n={};for(let r in t)n[r]=e.action(t[r]);return n}(t,n)),[t,n])),{...r,...i}}}var s=d(45);function a(n){const r=(0,e.useRef)(null),{extension:o}=(0,e.useContext)(t);return(0,e.useEffect)((()=>{if(r.current&&o)return(0,s.renderExtension)(r.current,o.extensionSlotName,o.extensionSlotModuleName,o.extensionId,void 0,n)}),[o?.extensionSlotName,o?.extensionId,o?.extensionSlotModuleName,r.current,n]),[r,o]}const u=t=>{let{state:n,wrap:r}=t;const[o,i]=a(n),s=e.default.createElement("div",{ref:o,"data-extension-id":i?.extensionId,style:{position:"relative"}});return i&&r?r(s,i):s};var c=d(748);function l(t,n){const[r,o]=(0,e.useState)((()=>n(t.getState())));return(0,e.useEffect)((()=>(0,c.subscribeTo)(t,n,o)),[t,n]),r}const f={add:[],order:[],remove:[]};function m(r){const{moduleName:o}=(0,e.useContext)(t),i=(0,n.getExtensionSlotsConfigStore)(o),s=(0,e.useCallback)((e=>e.extensionSlotConfigs[r]),[r]);return l(i,s)||f}const g=[];function h(t){const n=(0,e.useCallback)((e=>e.slots[t]?.attachedIds),[t]);return l(s.extensionStore,n)||g}function y(t){const n=m(t),r=h(t),[o,i]=(0,e.useState)([]);return(0,e.useEffect)((()=>{const e=(0,s.getAssignedIds)(t,n,r);e.join(",")!==o.join(",")&&i(e)}),[r,n]),o}var b=d(728);function v(){let[t,n]=(0,e.useState)(window.navigator.onLine);return(0,e.useEffect)((()=>(0,b.subscribeConnectivityChanged)((e=>{let{online:t}=e;return n(t)}))),[]),t}function E(e){return e.hasOwnProperty("name")}function S(t){const n=v(),r=y(t),o=(0,e.useMemo)((()=>{const e=s.extensionStore.getState();return r.map((t=>({id:t,...(0,s.getExtensionRegistrationFrom)(e,t)}))).filter(E).filter((e=>(0,s.checkStatusFor)(n,e.online,e.offline)))}),[r,n]);return o}function x(n){const{moduleName:r}=(0,e.useContext)(t);if(!r)throw Error("ComponentContext has not been provided. This should come from @openmrs/esm-react-utils.");return(0,e.useEffect)((()=>((0,s.registerExtensionSlot)(r,n),()=>(0,s.unregisterExtensionSlot)(r,n))),[]),{extensions:S(n),extensionSlotName:n,extensionSlotModuleName:r}}function w(){return w=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},w.apply(this,arguments)}function C(e){return e}const P=n=>{let{extensionSlotName:r,select:o=C,children:i,state:s,style:a,...c}=n;const l=(0,e.useRef)(null),{extensions:d,extensionSlotModuleName:p}=x(r),f=(0,e.useRef)(s);(function(e,t){if(e===t)return!0;if(!e&&t)return!1;if(e&&!t)return!1;if("object"!=typeof e||"object"!=typeof t)return!1;const n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(let r=0;r<n.length;r++){const o=n[r];if(!(o in t)||t[o]!==e[o])return!1}return!0})(f.current,s)||(f.current=s);const m=(0,e.useMemo)((()=>r&&o(d).map((n=>e.default.createElement(t.Provider,{key:n.id,value:{moduleName:n.moduleName,extension:{extensionId:n.id,extensionSlotName:r,extensionSlotModuleName:p}}},i??e.default.createElement(u,{state:f.current}))))),[o,d,r,f.current]);return e.default.createElement("div",w({ref:l,"data-extension-slot-name":r,"data-extension-slot-module-name":p,style:{...a,position:"relative"}},c),m)};var R=d(493);function O(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 N(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?O(Object(n),!0).forEach((function(t){M(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):O(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function j(e){return(j="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 M(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function L(e){return(L="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){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(L(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(L(e)));return e}}var U=null;try{U=require("react").createContext()}catch(O){}var k={React:null,ReactDOM:null,rootComponent:null,loadRootComponent:null,renderType:null,errorBoundary:null,errorBoundaryClass:null,domElementGetter:null,parcelCanUpdate:!0,suppressComponentDidCatchWarning:!1,domElements:{},renderResults:{},updateResolves:{}};function D(e){if("object"!==j(e))throw new Error("single-spa-react requires a configuration object");var t=N(N({},k),e);if(!t.React)throw new Error("single-spa-react must be passed opts.React");if(!t.ReactDOM)throw new Error("single-spa-react must be passed opts.ReactDOM");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");!U&&t.React.createContext&&(U=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:I.bind(null,t),mount:B.bind(null,t),unmount:A.bind(null,t)};return t.parcelCanUpdate&&(n.update=F.bind(null,t)),n}function I(e,t){return e.rootComponent?Promise.resolve():e.loadRootComponent(t).then((function(t){e.rootComponent=t}))}function B(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.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=V(e,t,(function(){n(this)})),i=T(e,t)(),s=function(e){var t=e.opts,n=e.elementToRender,r=e.domElement,o="function"==typeof t.renderType?t.renderType():t.renderType;if(["createRoot","unstable_createRoot","createBlockingRoot","unstable_createBlockingRoot"].indexOf(o)>=0){var i=t.ReactDOM[o](r);return i.render(n),i}return"hydrate"===o?t.ReactDOM.hydrate(n,r):t.ReactDOM.render(n,r),null}({elementToRender:o,domElement:i,opts:e});e.domElements[t.name]=i,e.renderResults[t.name]=s}))}function A(e,t){return new Promise((function(n){e.unmountFinished=n;var r=e.renderResults[t.name];r&&r.unmount?r.unmount():e.ReactDOM.unmountComponentAtNode(e.domElements[t.name]),delete e.domElements[t.name],delete e.renderResults[t.name]}))}function F(e,t){return new Promise((function(n){e.updateResolves[t.name]||(e.updateResolves[t.name]=[]),e.updateResolves[t.name].push(n);var r=V(e,t,null),o=e.renderResults[t.name];if(o&&o.render)o.render(r);else{var i=T(e,t)();e.ReactDOM.render(r,i)}}))}function V(e,t,n){var r=e.React.createElement(e.rootComponent,t),o=U?e.React.createElement(U.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,N(N({},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(){setTimeout(e.unmountFinished)}}),o)}var _=d(64),G=d(281);const $=_.default.default||_.default,H={strictMode:!0,throwErrorsToConsole:!0,disableTranslations:!1},z=t=>{(0,e.useEffect)((()=>($.on("languageChanged",t.forceUpdate),()=>$.off("languageChanged",t.forceUpdate))),[t.forceUpdate]);const n=(0,e.useRef)(null);if(n.current)throw n.current;if(!$.hasLoadedNamespace(t.ns)){const e=setTimeout((()=>{console.warn(`openmrsComponentDecorator: the React suspense promise for i18next.loadNamespaces(['${t.ns}']) did not resolve nor reject after three seconds. This could mean you have multiple versions of i18next and haven't made i18next a webpack external in all projects.`)}),3e3);throw $.loadNamespaces([t.ns]).then((()=>clearTimeout(e))).catch((t=>{clearTimeout(e),n.current=t}))}return e.default.createElement(e.default.Fragment,null,t.children)};function q(n){if("object"!=typeof n||"string"!=typeof n.featureName||"string"!=typeof n.moduleName)throw new Error("Invalid options");const r=Object.assign({},H,n);return function(n){var o,i,s,a,u;return i=o=class extends e.default.Component{constructor(e){super(e),this.state={caughtError:null,caughtErrorInfo:null,config:{moduleName:r.moduleName,extension:e._extensionContext}}}componentDidCatch(e,t){t&&t.componentStack&&(e.extra=Object.assign(e.extra||{},{componentStack:t.componentStack})),r.throwErrorsToConsole&&setTimeout((()=>{throw e})),this.setState({caughtError:e,caughtErrorInfo:t})}render(){if(this.state.caughtError)return e.default.createElement("div",null,"An error has occurred. Please try reloading the page.");{const o=e.default.createElement(t.Provider,{value:this.state.config},e.default.createElement(e.default.Suspense,{fallback:null},r.disableTranslations?e.default.createElement(n,this.props):e.default.createElement(z,{ns:r.moduleName,forceUpdate:()=>this.forceUpdate()},e.default.createElement(G.I18nextProvider,{i18n:$,defaultNS:r.moduleName},e.default.createElement(n,this.props)))));return r.strictMode||!e.default.StrictMode?o:e.default.createElement(e.default.StrictMode,null,o)}}},s=o,a="displayName",u=`OpenmrsReactComponent(${r.featureName})`,a in s?Object.defineProperty(s,a,{value:u,enumerable:!0,configurable:!0,writable:!0}):s[a]=u,i}}function K(t,n){return D({React:e.default,ReactDOM:R.default,rootComponent:q(n)(t)})}function W(e,t){return()=>e().then((e=>{let{default:n}=e;return K(n,t)}))}function J(e,t){return()=>Promise.resolve(K(e,t))}const Z=W;function Q(t){(0,e.useEffect)((()=>{if(t){const e=window.getComputedStyle(document.body).overflow;return document.body.style.overflow="hidden",()=>{document.body.style.overflow=e}}}),[t])}const X={};function Y(e){return new Promise((t=>{const n=e.subscribe((e=>{e.loaded&&e.config&&(t(e.config),n())}))}))}function ee(t){const[n,r]=(0,e.useState)(function(e){return e?()=>{const t=e.getState();if(t.loaded&&t.config)return t.config}:void 0}(t));return(0,e.useEffect)((()=>t?.subscribe((e=>{e.loaded&&e.config&&r(e.config)}))),[t]),n}function te(){const{moduleName:r,extension:o}=(0,e.useContext)(t);if(!r&&!o)throw Error('No ComponentContext has been provided. This should come from "openmrsComponentDecorator".\nUsually this is already applied when using "getAsyncLifecycle" or "getSyncLifecycle".');const i=function(t){const r=(0,e.useMemo)((()=>(0,n.getConfigStore)(t)),[t]),o=t,i=ee(r);if(!i)throw X[o]||(X[o]=Y(r)),X[o];return i}(r),s=function(t){const r=(0,e.useMemo)((()=>t&&(0,n.getExtensionConfigStore)(t.extensionSlotModuleName,t.extensionSlotName,t.extensionId)),[t]),o=ee(r);if(!o&&t){const e=`${t.extensionSlotModuleName}-${t.extensionSlotName}-${t.extensionId}`;throw!X[e]&&r&&(X[e]=Y(r)),X[e]}return o||{}}(o),a=(0,e.useMemo)((()=>({...i,...s})),[i,s]);return o?.extensionSlotModuleName,o?.extensionSlotName,o&&o?.extensionId,a}var ne,re=d(766);!function(e){e.loadPatient="loadPatient",e.newPatient="newPatient",e.loadError="patientLoadError"}(ne||(ne={}));const oe={patientUuid:null,patient:null,isPendingUuid:!0,isLoadingPatient:!1,err:null};function ie(){const e=/\/patient\/([a-zA-Z0-9\-]+)\/?/.exec(location.pathname);return e&&e[1]}function se(e,t){switch(t.type){case ne.loadPatient:return{...e,patientUuid:t.patientUuid,patient:null,isPendingUuid:!1,isLoadingPatient:!0,err:null};case ne.newPatient:return{...e,patient:t.patient,isPendingUuid:!1,isLoadingPatient:!1,err:null};case ne.loadError:return{...e,patient:null,isPendingUuid:!1,isLoadingPatient:!1,err:t.err};default:return e}}function ae(t){const[n,r]=(0,e.useReducer)(se,{...oe,patientUuid:t??null,isPendingUuid:!t,isLoadingPatient:!!t});return(0,e.useEffect)((()=>{if(n.isPendingUuid){const e=ie();r(e?{type:ne.loadPatient,patientUuid:e}:{type:ne.newPatient,patient:null})}let e=!0;return n.isLoadingPatient&&n.patientUuid&&(0,re.fetchCurrentPatient)(n.patientUuid).then((t=>e&&r({patient:t.data,type:ne.newPatient})),(t=>e&&r({err:t,type:ne.loadError}))),()=>{e=!1}}),[n.isPendingUuid,n.isLoadingPatient,n.patientUuid]),(0,e.useEffect)((()=>{const e=e=>{const t=ie();t!=n.patientUuid&&r({type:ne.loadPatient,patientUuid:t})};return window.addEventListener("single-spa:routing-event",e),()=>window.removeEventListener("single-spa:routing-event",e)}),[n.patientUuid]),{isLoading:n.isPendingUuid||n.isLoadingPatient,patient:n.patient,patientUuid:t??n.patientUuid,error:n.err}}var ue;!function(e){e.loadPatient="loadPatient",e.newPatient="newPatient",e.loadError="patientLloadErroroadError"}(ue||(ue={}));const ce={patient:null,isLoadingPatient:!0,err:null};function le(){const e=/\/patient\/([a-zA-Z0-9\-]+)\/?/.exec(location.pathname);return e&&e[1]}function de(e,t){switch(t.type){case ue.loadPatient:return{...e,patient:null,isLoadingPatient:!0,err:null};case ue.newPatient:return{...e,patient:t.patient,isLoadingPatient:!1,err:null};case ue.loadError:return{...e,patient:null,isLoadingPatient:!1,err:t.err};default:return e}}function pe(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:le();const[n,r]=(0,e.useReducer)(de,ce);return(0,e.useEffect)((()=>{let e=!0;return t?((0,re.fetchCurrentPatient)(t).then((t=>e&&r({patient:t.data,type:ue.newPatient})),(t=>e&&r({err:t,type:ue.loadError}))),r({type:ue.loadPatient})):r({type:ue.newPatient,patient:null}),()=>{e=!1}}),[t]),[n.isLoadingPatient,n.patient,t,n.err]}function fe(t){const n=S(t);return(0,e.useMemo)((()=>Object.fromEntries(n.map((e=>[e.name,e.meta])))),[n])}const me=i(s.extensionStore);function ge(){const[,t]=(0,e.useState)(0);return(0,e.useCallback)((()=>{t((e=>e+1))}),[])}function he(){let e="tablet";return document.body.classList.forEach((t=>{switch(t){case"omrs-breakpoint-lt-tablet":e="phone";break;case"omrs-breakpoint-gt-tablet":e="desktop"}})),e}function ye(){const[t,n]=(0,e.useState)(he);return(0,e.useEffect)((()=>{const e=()=>{n(he())};return window.addEventListener("resize",e),()=>window.removeEventListener("resize",e)}),[]),t}function be(){const[t,n]=(0,e.useState)([]);return(0,e.useEffect)((()=>{const e=(0,re.getLocations)().subscribe((e=>{n(e)}),(e=>{console.error(e)}));return()=>e.unsubscribe()}),[]),t}function ve(t){(0,e.useEffect)((()=>(0,s.pushNavigationContext)(t)),[])}function Ee(t){let n=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];const r=(0,e.useRef)(null);return(0,e.useEffect)((()=>{if(n){const e=e=>{const n=r?.current;n?.contains(e.target)&&t(e)};return window.addEventListener("click",e),()=>window.removeEventListener("click",e)}}),[t,n]),r}const Se=t=>{let{privilege:n,children:r}=t;const[o,i]=(0,e.useState)(null);return(0,e.useEffect)((()=>{const e=(0,re.getCurrentUser)({includeAuthStatus:!1}).subscribe(i);return()=>e.unsubscribe()}),[]),o&&(0,re.userHasAccess)(n,o)?e.default.createElement(e.default.Fragment,null,r):null};function xe(){const[t,n]=(0,e.useState)(null);return(0,e.useEffect)((()=>{if(null===t){const e=(0,re.openmrsObservableFetch)("/ws/rest/v1/session").subscribe((e=>{n(e.data)}));return()=>e.unsubscribe()}}),[t]),t}function we(e,t){return i(e)(t)}function Ce(t){const[n,r]=(0,e.useState)(null),[o,i]=(0,e.useState)(null);return(0,e.useEffect)((()=>{const e=re.getStartedVisit.subscribe((e=>{r(e?e?.visitData??null:null)}));return()=>e.unsubscribe()}),[t]),(0,e.useEffect)((()=>{const e=new AbortController,n=(0,re.getVisitsForPatient)(t,e).subscribe((e=>{let{data:t}=e;const n=t.results.find((e=>null===e.stopDatetime));n&&re.getStartedVisit.next({mode:re.VisitMode.LOADING,visitData:n,status:re.VisitStatus.ONGOING})}),i);return()=>n&&n.unsubscribe()}),[t]),{currentVisit:n,error:o}}function Pe(){const[t,n]=(0,e.useState)([]);return(0,e.useEffect)((()=>{const e=(0,re.getVisitTypes)().subscribe((e=>{n(e)}),(e=>console.error(e)));return()=>e.unsubscribe()}),[]),t}function Re(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:10;const[r,o]=(0,e.useState)(1),i=(0,e.useMemo)((()=>Math.max(1,Math.ceil(t.length/n))),[t.length,n]),s=(0,e.useMemo)((()=>{const e=(r-1)*n,o=(r+0)*n;return t.slice(e,o)}),[t,r,n]);return{results:s,totalPages:i,currentPage:r,paginated:t.length>n,showNextButton:r<i,showPreviousButton:r>1,goTo(e){o(Math.max(1,Math.min(i,e)))},goToNext(){r<i&&o(r+1)},goToPrevious(){r>1&&o(r-1)}}}})(),p})())}}}));
2
2
  //# sourceMapping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,WACMd,EAAOE,GACTD,EAAQD,EAAO,IAGnBe,eACMf,EAAO,GACTC,EAAQD,EAAO,O","sources":["webpack://@openmrs/esm-react-utils/@openmrs/esm-state/../../../node_modules/systemjs-webpack-interop/auto-public-path/auto-public-path.js","webpack://@openmrs/esm-react-utils/@openmrs/esm-state/../../../node_modules/systemjs-webpack-interop/public-path.js","webpack://@openmrs/esm-react-utils/@openmrs/esm-state/webpack/bootstrap","webpack://@openmrs/esm-react-utils/@openmrs/esm-state/webpack/runtime/__system_context__","webpack://@openmrs/esm-react-utils/@openmrs/esm-state/webpack/runtime/define property getters","webpack://@openmrs/esm-react-utils/@openmrs/esm-state/webpack/runtime/global","webpack://@openmrs/esm-react-utils/@openmrs/esm-state/webpack/runtime/hasOwnProperty shorthand","webpack://@openmrs/esm-react-utils/@openmrs/esm-state/webpack/runtime/make namespace object","webpack://@openmrs/esm-react-utils/@openmrs/esm-state/webpack/runtime/publicPath","webpack://@openmrs/esm-react-utils/@openmrs/esm-state/../../../node_modules/systemjs-webpack-interop/auto-public-path/1.js","webpack://@openmrs/esm-react-utils/@openmrs/esm-state/../../../node_modules/unistore/dist/unistore.es.js","webpack://@openmrs/esm-react-utils/@openmrs/esm-state/./src/state.ts","webpack://@openmrs/esm-react-utils/@openmrs/esm-state/./src/update.ts","webpack://@openmrs/esm-react-utils/../../../node_modules/systemjs-webpack-interop/auto-public-path/auto-public-path.js","webpack://@openmrs/esm-react-utils/../../../node_modules/systemjs-webpack-interop/public-path.js","webpack://@openmrs/esm-react-utils/external system \"@openmrs/esm-api\"","webpack://@openmrs/esm-react-utils/external system \"@openmrs/esm-config\"","webpack://@openmrs/esm-react-utils/external system \"@openmrs/esm-extensions\"","webpack://@openmrs/esm-react-utils/external system \"@openmrs/esm-globals\"","webpack://@openmrs/esm-react-utils/external system \"i18next\"","webpack://@openmrs/esm-react-utils/external system \"react\"","webpack://@openmrs/esm-react-utils/external system \"react-dom\"","webpack://@openmrs/esm-react-utils/external system \"react-i18next\"","webpack://@openmrs/esm-react-utils/webpack/bootstrap","webpack://@openmrs/esm-react-utils/webpack/runtime/__system_context__","webpack://@openmrs/esm-react-utils/webpack/runtime/define property getters","webpack://@openmrs/esm-react-utils/webpack/runtime/global","webpack://@openmrs/esm-react-utils/webpack/runtime/hasOwnProperty shorthand","webpack://@openmrs/esm-react-utils/webpack/runtime/make namespace object","webpack://@openmrs/esm-react-utils/webpack/runtime/publicPath","webpack://@openmrs/esm-react-utils/../../../node_modules/systemjs-webpack-interop/auto-public-path/1.js","webpack://@openmrs/esm-react-utils/./src/ComponentContext.ts","webpack://@openmrs/esm-react-utils/./src/ConfigurableLink.tsx","webpack://@openmrs/esm-react-utils/./src/createUseStore.ts","webpack://@openmrs/esm-react-utils/./src/useExtension.ts","webpack://@openmrs/esm-react-utils/./src/Extension.tsx","webpack://@openmrs/esm-react-utils/./src/useStoreState.ts","webpack://@openmrs/esm-react-utils/./src/useExtensionSlotConfig.ts","webpack://@openmrs/esm-react-utils/./src/useAttachedExtensionIds.ts","webpack://@openmrs/esm-react-utils/./src/useAssignedExtensionIds.ts","webpack://@openmrs/esm-react-utils/./src/useConnectivity.ts","webpack://@openmrs/esm-react-utils/./src/useConnectedExtensions.ts","webpack://@openmrs/esm-react-utils/./src/useExtensionSlot.ts","webpack://@openmrs/esm-react-utils/./src/ExtensionSlot.tsx","webpack://@openmrs/esm-react-utils/../../../node_modules/single-spa-react/lib/esm/single-spa-react.js","webpack://@openmrs/esm-react-utils/./src/openmrsComponentDecorator.tsx","webpack://@openmrs/esm-react-utils/./src/getLifecycle.ts","webpack://@openmrs/esm-react-utils/./src/useBodyScrollLock.ts","webpack://@openmrs/esm-react-utils/./src/useConfig.ts","webpack://@openmrs/esm-react-utils/./src/usePatient.ts","webpack://@openmrs/esm-react-utils/./src/useCurrentPatient.ts","webpack://@openmrs/esm-react-utils/./src/useExtensionSlotMeta.ts","webpack://@openmrs/esm-react-utils/./src/useExtensionStore.ts","webpack://@openmrs/esm-react-utils/./src/useForceUpdate.ts","webpack://@openmrs/esm-react-utils/./src/useLayoutType.ts","webpack://@openmrs/esm-react-utils/./src/useLocations.tsx","webpack://@openmrs/esm-react-utils/./src/useNavigationContext.ts","webpack://@openmrs/esm-react-utils/./src/useOnClickOutside.tsx","webpack://@openmrs/esm-react-utils/./src/UserHasAccess.tsx","webpack://@openmrs/esm-react-utils/./src/useSessionUser.tsx","webpack://@openmrs/esm-react-utils/./src/useStore.ts","webpack://@openmrs/esm-react-utils/./src/useVisit.ts","webpack://@openmrs/esm-react-utils/./src/useVisitTypes.ts","webpack://@openmrs/esm-react-utils/./src/usePagination.ts"],"sourcesContent":["const resolveDirectory = require(\"../public-path\").resolveDirectory;\n\nexports.autoPublicPath = function autoPublicPath(rootDirLevel) {\n if (!rootDirLevel) {\n rootDirLevel = 1;\n }\n\n if (typeof __webpack_public_path__ !== \"undefined\") {\n if (typeof __system_context__ === \"undefined\") {\n throw Error(\n \"systemjs-webpack-interop requires webpack@>=5.0.0-beta.15 and output.libraryTarget set to 'system'\"\n );\n }\n\n if (!__system_context__.meta || !__system_context__.meta.url) {\n console.error(\"__system_context__\", __system_context__);\n throw Error(\n \"systemjs-webpack-interop was provided an unknown SystemJS context. Expected context.meta.url, but none was provided\"\n );\n }\n\n __webpack_public_path__ = resolveDirectory(\n __system_context__.meta.url,\n rootDirLevel\n );\n }\n};\n","exports.setPublicPath = function setPublicPath(\n systemjsModuleName,\n rootDirectoryLevel\n) {\n if (!rootDirectoryLevel) {\n rootDirectoryLevel = 1;\n }\n if (\n typeof systemjsModuleName !== \"string\" ||\n systemjsModuleName.trim().length === 0\n ) {\n throw Error(\n \"systemjs-webpack-interop: setPublicPath(systemjsModuleName) must be called with a non-empty string 'systemjsModuleName'\"\n );\n }\n\n if (\n typeof rootDirectoryLevel !== \"number\" ||\n rootDirectoryLevel <= 0 ||\n isNaN(rootDirectoryLevel) ||\n !isInteger(rootDirectoryLevel)\n ) {\n throw Error(\n \"systemjs-webpack-interop: setPublicPath(systemjsModuleName, rootDirectoryLevel) must be called with a positive integer 'rootDirectoryLevel'\"\n );\n }\n\n var moduleUrl;\n try {\n moduleUrl = window.System.resolve(systemjsModuleName);\n if (!moduleUrl) {\n throw Error();\n }\n } catch (err) {\n throw Error(\n \"systemjs-webpack-interop: There is no such module '\" +\n systemjsModuleName +\n \"' in the SystemJS registry. Did you misspell the name of your module?\"\n );\n }\n\n __webpack_public_path__ = resolveDirectory(moduleUrl, rootDirectoryLevel);\n};\n\nfunction resolveDirectory(urlString, rootDirectoryLevel) {\n // Our friend IE11 doesn't support new URL()\n // https://github.com/single-spa/single-spa/issues/612\n // https://gist.github.com/jlong/2428561\n\n var a = document.createElement(\"a\");\n a.href = urlString;\n\n var pathname = a.pathname[0] === \"/\" ? a.pathname : \"/\" + a.pathname;\n var numDirsProcessed = 0,\n index = pathname.length;\n while (numDirsProcessed !== rootDirectoryLevel && index >= 0) {\n var char = pathname[--index];\n if (char === \"/\") {\n numDirsProcessed++;\n }\n }\n\n if (numDirsProcessed !== rootDirectoryLevel) {\n throw Error(\n \"systemjs-webpack-interop: rootDirectoryLevel (\" +\n rootDirectoryLevel +\n \") is greater than the number of directories (\" +\n numDirsProcessed +\n \") in the URL path \" +\n urlString\n );\n }\n\n var finalPath = pathname.slice(0, index + 1);\n\n return a.protocol + \"//\" + a.host + finalPath;\n}\n\nexports.resolveDirectory = resolveDirectory;\n\n// borrowed from https://github.com/parshap/js-is-integer/blob/master/index.js\nvar isInteger =\n Number.isInteger ||\n function isInteger(val) {\n return typeof val === \"number\" && isFinite(val) && Math.floor(val) === val;\n };\n","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","__webpack_require__.y = __system_context__;","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.g = (function() {\n\tif (typeof globalThis === 'object') return globalThis;\n\ttry {\n\t\treturn this || new Function('return this')();\n\t} catch (e) {\n\t\tif (typeof window === 'object') return window;\n\t}\n})();","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","var scriptUrl;\nif (__webpack_require__.g.importScripts) scriptUrl = __webpack_require__.g.location + \"\";\nvar document = __webpack_require__.g.document;\nif (!scriptUrl && document) {\n\tif (document.currentScript)\n\t\tscriptUrl = document.currentScript.src\n\tif (!scriptUrl) {\n\t\tvar scripts = document.getElementsByTagName(\"script\");\n\t\tif(scripts.length) scriptUrl = scripts[scripts.length - 1].src\n\t}\n}\n// When supporting browsers where an automatic publicPath is not supported you must specify an output.publicPath manually via configuration\n// or pass an empty string (\"\") and set the __webpack_public_path__ variable from your code to use your own logic.\nif (!scriptUrl) throw new Error(\"Automatic publicPath is not supported in this browser\");\nscriptUrl = scriptUrl.replace(/#.*$/, \"\").replace(/\\?.*$/, \"\").replace(/\\/[^\\/]+$/, \"/\");\n__webpack_require__.p = scriptUrl;","const autoPublicPath = require(\"./auto-public-path\").autoPublicPath;\n\nautoPublicPath(1);\n","function n(n,t){for(var r in t)n[r]=t[r];return n}export default function(t){var r=[];function u(n){for(var t=[],u=0;u<r.length;u++)r[u]===n?n=null:t.push(r[u]);r=t}function e(u,e,f){t=e?u:n(n({},t),u);for(var i=r,o=0;o<i.length;o++)i[o](t,f)}return t=t||{},{action:function(n){function r(t){e(t,!1,n)}return function(){for(var u=arguments,e=[t],f=0;f<arguments.length;f++)e.push(u[f]);var i=n.apply(this,e);if(null!=i)return i.then?i.then(r):r(i)}},setState:e,subscribe:function(n){return r.push(n),function(){u(n)}},unsubscribe:u,getState:function(){return t}}}\n//# sourceMappingURL=unistore.es.js.map\n","import createStore, { Store } from \"unistore\";\n\ninterface StoreEntity {\n value: Store<any>;\n active: boolean;\n}\n\nconst availableStores: Record<string, StoreEntity> = {};\n\n/**\n * Creates a Unistore [store](https://github.com/developit/unistore#store).\n *\n * @param name A name by which the store can be looked up later.\n * Must be unique across the entire application.\n * @param initialState An object which will be the initial state of the store.\n * @returns The newly created store.\n */\nexport function createGlobalStore<TState>(\n name: string,\n initialState: TState\n): Store<TState> {\n const available = availableStores[name];\n\n if (available) {\n if (available.active) {\n console.error(\n \"Cannot override an existing store. Make sure that stores are only created once.\"\n );\n } else {\n available.value.setState(initialState, true);\n }\n\n available.active = true;\n return available.value;\n } else {\n const store = createStore(initialState);\n\n availableStores[name] = {\n value: store,\n active: true,\n };\n\n return store;\n }\n}\n\n/**\n * Returns the existing [store](https://github.com/developit/unistore#store) named `name`,\n * or creates a new store named `name` if none exists.\n *\n * @param name The name of the store to look up.\n * @param fallbackState The initial value of the new store if no store named `name` exists.\n * @returns The found or newly created store.\n */\nexport function getGlobalStore<TState = any>(\n name: string,\n fallbackState?: TState\n): Store<TState> {\n const available = availableStores[name];\n\n if (!available) {\n const store = createStore(fallbackState);\n availableStores[name] = {\n value: store,\n active: false,\n };\n return store;\n }\n\n return available.value;\n}\n\nexport interface AppState {}\n\n/**\n * @internal\n */\nexport function createAppState(initialState: AppState) {\n return createGlobalStore(\"app\", initialState);\n}\n\n/**\n * @returns The [store](https://github.com/developit/unistore#store) named `app`.\n */\nexport function getAppState() {\n return getGlobalStore<AppState>(\"app\", {});\n}\n\nexport function subscribeTo<T, U>(\n store: Store<T>,\n select: (state: T) => U,\n handle: (subState: U) => void\n) {\n let previous = select(store.getState());\n\n return store.subscribe((state) => {\n const current = select(state);\n\n if (current !== previous) {\n previous = current;\n handle(current);\n }\n });\n}\n","export function update<T extends Record<string, any>>(\n obj: T,\n [property, ...restPropertyPath]: Array<string>,\n value: any\n): T {\n if (!property) {\n return obj;\n } else if (restPropertyPath.length === 0) {\n return { ...obj, [property]: value };\n } else {\n return {\n ...obj,\n [property]: update(obj[property] || {}, restPropertyPath, value),\n };\n }\n}\n","const resolveDirectory = require(\"../public-path\").resolveDirectory;\n\nexports.autoPublicPath = function autoPublicPath(rootDirLevel) {\n if (!rootDirLevel) {\n rootDirLevel = 1;\n }\n\n if (typeof __webpack_public_path__ !== \"undefined\") {\n if (typeof __system_context__ === \"undefined\") {\n throw Error(\n \"systemjs-webpack-interop requires webpack@>=5.0.0-beta.15 and output.libraryTarget set to 'system'\"\n );\n }\n\n if (!__system_context__.meta || !__system_context__.meta.url) {\n console.error(\"__system_context__\", __system_context__);\n throw Error(\n \"systemjs-webpack-interop was provided an unknown SystemJS context. Expected context.meta.url, but none was provided\"\n );\n }\n\n __webpack_public_path__ = resolveDirectory(\n __system_context__.meta.url,\n rootDirLevel\n );\n }\n};\n","exports.setPublicPath = function setPublicPath(\n systemjsModuleName,\n rootDirectoryLevel\n) {\n if (!rootDirectoryLevel) {\n rootDirectoryLevel = 1;\n }\n if (\n typeof systemjsModuleName !== \"string\" ||\n systemjsModuleName.trim().length === 0\n ) {\n throw Error(\n \"systemjs-webpack-interop: setPublicPath(systemjsModuleName) must be called with a non-empty string 'systemjsModuleName'\"\n );\n }\n\n if (\n typeof rootDirectoryLevel !== \"number\" ||\n rootDirectoryLevel <= 0 ||\n isNaN(rootDirectoryLevel) ||\n !isInteger(rootDirectoryLevel)\n ) {\n throw Error(\n \"systemjs-webpack-interop: setPublicPath(systemjsModuleName, rootDirectoryLevel) must be called with a positive integer 'rootDirectoryLevel'\"\n );\n }\n\n var moduleUrl;\n try {\n moduleUrl = window.System.resolve(systemjsModuleName);\n if (!moduleUrl) {\n throw Error();\n }\n } catch (err) {\n throw Error(\n \"systemjs-webpack-interop: There is no such module '\" +\n systemjsModuleName +\n \"' in the SystemJS registry. Did you misspell the name of your module?\"\n );\n }\n\n __webpack_public_path__ = resolveDirectory(moduleUrl, rootDirectoryLevel);\n};\n\nfunction resolveDirectory(urlString, rootDirectoryLevel) {\n // Our friend IE11 doesn't support new URL()\n // https://github.com/single-spa/single-spa/issues/612\n // https://gist.github.com/jlong/2428561\n\n var a = document.createElement(\"a\");\n a.href = urlString;\n\n var pathname = a.pathname[0] === \"/\" ? a.pathname : \"/\" + a.pathname;\n var numDirsProcessed = 0,\n index = pathname.length;\n while (numDirsProcessed !== rootDirectoryLevel && index >= 0) {\n var char = pathname[--index];\n if (char === \"/\") {\n numDirsProcessed++;\n }\n }\n\n if (numDirsProcessed !== rootDirectoryLevel) {\n throw Error(\n \"systemjs-webpack-interop: rootDirectoryLevel (\" +\n rootDirectoryLevel +\n \") is greater than the number of directories (\" +\n numDirsProcessed +\n \") in the URL path \" +\n urlString\n );\n }\n\n var finalPath = pathname.slice(0, index + 1);\n\n return a.protocol + \"//\" + a.host + finalPath;\n}\n\nexports.resolveDirectory = resolveDirectory;\n\n// borrowed from https://github.com/parshap/js-is-integer/blob/master/index.js\nvar isInteger =\n Number.isInteger ||\n function isInteger(val) {\n return typeof val === \"number\" && isFinite(val) && Math.floor(val) === val;\n };\n","module.exports = __WEBPACK_EXTERNAL_MODULE__766__;","module.exports = __WEBPACK_EXTERNAL_MODULE__824__;","module.exports = __WEBPACK_EXTERNAL_MODULE__45__;","module.exports = __WEBPACK_EXTERNAL_MODULE__728__;","module.exports = __WEBPACK_EXTERNAL_MODULE__64__;","module.exports = __WEBPACK_EXTERNAL_MODULE__954__;","module.exports = __WEBPACK_EXTERNAL_MODULE__493__;","module.exports = __WEBPACK_EXTERNAL_MODULE__281__;","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","__webpack_require__.y = __system_context__;","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.g = (function() {\n\tif (typeof globalThis === 'object') return globalThis;\n\ttry {\n\t\treturn this || new Function('return this')();\n\t} catch (e) {\n\t\tif (typeof window === 'object') return window;\n\t}\n})();","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","var scriptUrl;\nif (__webpack_require__.g.importScripts) scriptUrl = __webpack_require__.g.location + \"\";\nvar document = __webpack_require__.g.document;\nif (!scriptUrl && document) {\n\tif (document.currentScript)\n\t\tscriptUrl = document.currentScript.src\n\tif (!scriptUrl) {\n\t\tvar scripts = document.getElementsByTagName(\"script\");\n\t\tif(scripts.length) scriptUrl = scripts[scripts.length - 1].src\n\t}\n}\n// When supporting browsers where an automatic publicPath is not supported you must specify an output.publicPath manually via configuration\n// or pass an empty string (\"\") and set the __webpack_public_path__ variable from your code to use your own logic.\nif (!scriptUrl) throw new Error(\"Automatic publicPath is not supported in this browser\");\nscriptUrl = scriptUrl.replace(/#.*$/, \"\").replace(/\\?.*$/, \"\").replace(/\\/[^\\/]+$/, \"/\");\n__webpack_require__.p = scriptUrl;","const autoPublicPath = require(\"./auto-public-path\").autoPublicPath;\n\nautoPublicPath(1);\n","import React from \"react\";\n\nexport interface ExtensionData {\n extensionSlotName: string;\n extensionSlotModuleName: string;\n extensionId: string;\n}\n\nexport interface ComponentConfig {\n moduleName: string;\n extension?: ExtensionData;\n}\n\n/**\n * Available to all components. Provided by `openmrsComponentDecorator`.\n */\nexport const ComponentContext = React.createContext<ComponentConfig>({\n moduleName: \"\",\n});\n","import React, { MouseEvent, AnchorHTMLAttributes } from \"react\";\nimport { navigate, interpolateUrl } from \"@openmrs/esm-config\";\n\nfunction handleClick(event: MouseEvent, to: string) {\n if (\n !event.metaKey &&\n !event.ctrlKey &&\n !event.shiftKey &&\n event.button == 0\n ) {\n event.preventDefault();\n navigate({ to });\n }\n}\n\n/**\n * @noInheritDoc\n */\nexport interface ConfigurableLinkProps\n extends AnchorHTMLAttributes<HTMLAnchorElement> {\n to: string;\n}\n\n/**\n * A React link component which calls [[navigate]] when clicked\n *\n * @param to The target path or URL. Supports interpolation. See [[navigate]]\n * @param children Inline elements within the link\n * @param otherProps Any other valid props for an <a> tag except `href` and `onClick`\n * @category Navigation\n */\nexport const ConfigurableLink: React.FC<ConfigurableLinkProps> = ({\n to,\n children,\n ...otherProps\n}) => (\n <a\n onClick={(event) => handleClick(event, to)}\n href={interpolateUrl(to)}\n {...otherProps}\n >\n {children}\n </a>\n);\n","import { useEffect, useMemo, useState } from \"react\";\nimport { Store, BoundAction } from \"unistore\";\n\nexport type Actions = Function | { [key: string]: Function };\nexport type BoundActions = { [key: string]: BoundAction };\n\nfunction bindActions<T>(store: Store<T>, actions: Actions) {\n if (typeof actions == \"function\") {\n actions = actions(store);\n }\n\n const bound = {};\n\n for (let i in actions) {\n bound[i] = store.action(actions[i]);\n }\n\n return bound;\n}\n\nexport function createUseStore<T>(store: Store<T>) {\n function useStore(): T;\n function useStore(actions: Actions): T & BoundActions;\n function useStore(actions?: Actions): T & BoundActions;\n function useStore(actions?: Actions) {\n const [state, set] = useState(store.getState());\n useEffect(() => store.subscribe((state) => set(state)), []);\n let boundActions: BoundActions = {};\n\n if (actions) {\n boundActions = useMemo(\n () => bindActions(store, actions),\n [store, actions]\n );\n }\n\n return { ...state, ...boundActions };\n }\n\n return useStore;\n}\n","import { RefObject, useContext, useRef, useEffect } from \"react\";\nimport { renderExtension } from \"@openmrs/esm-extensions\";\nimport { ComponentContext, ExtensionData } from \"./ComponentContext\";\n\nexport function useExtension<TRef extends HTMLElement>(\n state?: Record<string, any>\n): [RefObject<TRef>, ExtensionData | undefined] {\n const ref = useRef<TRef>(null);\n const { extension } = useContext(ComponentContext);\n\n useEffect(() => {\n if (ref.current && extension) {\n return renderExtension(\n ref.current,\n extension.extensionSlotName,\n extension.extensionSlotModuleName,\n extension.extensionId,\n undefined,\n state\n );\n }\n }, [\n extension?.extensionSlotName,\n extension?.extensionId,\n extension?.extensionSlotModuleName,\n ref.current,\n state,\n ]);\n\n return [ref, extension];\n}\n","import React from \"react\";\nimport { ExtensionData } from \"./ComponentContext\";\nimport { useExtension } from \"./useExtension\";\n\nexport interface ExtensionProps {\n state?: Record<string, any>;\n wrap?(\n slot: React.ReactNode,\n extension: ExtensionData\n ): React.ReactElement<any, any> | null;\n}\n\n/**\n * Represents the position in the DOM where each extension within\n * an extension slot is rendered.\n *\n * Renders once for each extension attached to that extension slot.\n *\n * Usage of this component *must* have an ancestor `<ExtensionSlot>`,\n * and *must* only be used once within that `<ExtensionSlot>`.\n */\nexport const Extension: React.FC<ExtensionProps> = ({ state, wrap }) => {\n const [ref, extension] = useExtension<HTMLDivElement>(state);\n\n // The extension is rendered into the `<slot>`. It is surrounded by a\n // `<div>` with relative positioning in order to allow the UI Editor\n // to absolutely position elements within it.\n const slot = (\n <div\n ref={ref}\n data-extension-id={extension?.extensionId}\n style={{ position: \"relative\" }}\n />\n );\n\n return extension && wrap ? wrap(slot, extension) : slot;\n};\n","import { subscribeTo } from \"@openmrs/esm-state\";\nimport { useEffect, useState } from \"react\";\nimport { Store } from \"unistore\";\n\nexport function useStoreState<T, U>(store: Store<T>, select: (state: T) => U) {\n const [state, setState] = useState<U>(() => select(store.getState()));\n\n useEffect(() => subscribeTo(store, select, setState), [store, select]);\n\n return state;\n}\n","import { useContext, useCallback } from \"react\";\nimport {\n ExtensionSlotConfigObject,\n ExtensionSlotConfigsStore,\n getExtensionSlotsConfigStore,\n} from \"@openmrs/esm-config\";\nimport { ComponentContext } from \"./ComponentContext\";\nimport { useStoreState } from \"./useStoreState\";\n\nconst defaultConfig: ExtensionSlotConfigObject = {\n add: [],\n order: [],\n remove: [],\n};\n\nexport function useExtensionSlotConfig(extensionSlotName: string) {\n const { moduleName } = useContext(ComponentContext);\n const store = getExtensionSlotsConfigStore(moduleName);\n const select = useCallback(\n (s: ExtensionSlotConfigsStore) => s.extensionSlotConfigs[extensionSlotName],\n [extensionSlotName]\n );\n const config = useStoreState(store, select);\n return config || defaultConfig;\n}\n","import { useCallback } from \"react\";\nimport { extensionStore, ExtensionStore } from \"@openmrs/esm-extensions\";\nimport { useStoreState } from \"./useStoreState\";\n\nconst defaultArray: Array<string> = [];\n\n/**\n * Gets the assigned extension ids for the given slot.\n * @param extensionSlotName\n */\nexport function useAttachedExtensionIds(extensionSlotName: string) {\n const select = useCallback(\n (s: ExtensionStore) => s.slots[extensionSlotName]?.attachedIds,\n [extensionSlotName]\n );\n const extensions = useStoreState(extensionStore, select);\n return extensions || defaultArray;\n}\n","import { useEffect, useState } from \"react\";\nimport { getAssignedIds } from \"@openmrs/esm-extensions\";\nimport { useExtensionSlotConfig } from \"./useExtensionSlotConfig\";\nimport { useAttachedExtensionIds } from \"./useAttachedExtensionIds\";\n\n/**\n * Gets the assigned extension ids for a given extension slot name.\n * Does not consider if offline or online.\n * @param extensionSlotName The name of the slot to get the assigned IDs for.\n */\nexport function useAssignedExtensionIds(extensionSlotName: string) {\n const config = useExtensionSlotConfig(extensionSlotName);\n const attachedIds = useAttachedExtensionIds(extensionSlotName);\n const [assignedIds, setAssignedIds] = useState<Array<string>>([]);\n\n useEffect(() => {\n const newAssignedIds = getAssignedIds(\n extensionSlotName,\n config,\n attachedIds\n );\n\n if (newAssignedIds.join(\",\") !== assignedIds.join(\",\")) {\n setAssignedIds(newAssignedIds);\n }\n }, [attachedIds, config]);\n\n return assignedIds;\n}\n","import { subscribeConnectivityChanged } from \"@openmrs/esm-globals\";\nimport { useEffect, useState } from \"react\";\n\nexport function useConnectivity() {\n let [isOnline, setIsOnline] = useState(window.navigator.onLine);\n\n useEffect(\n () => subscribeConnectivityChanged(({ online }) => setIsOnline(online)),\n []\n );\n\n return isOnline;\n}\n","import { useMemo } from \"react\";\nimport {\n checkStatusFor,\n ExtensionMeta,\n ExtensionRegistration,\n extensionStore,\n getExtensionRegistrationFrom,\n} from \"@openmrs/esm-extensions\";\nimport { useAssignedExtensionIds } from \"./useAssignedExtensionIds\";\nimport { useConnectivity } from \"./useConnectivity\";\n\nfunction isValidExtension(\n extension: ConnectedExtension | { id: string }\n): extension is ConnectedExtension {\n return extension.hasOwnProperty(\"name\");\n}\n\n/**\n * We have the following extension modes:\n *\n * - attached (set via code in form of: attach, detach, ...)\n * - configured (set via configuration in form of: added, removed, ...)\n * - assigned (computed from attached and configured)\n * - connected (computed from assigned using connectivity and online / offline)\n */\n\nexport interface ConnectedExtension extends ExtensionRegistration {\n id: string;\n}\n\n/**\n * Gets the assigned extension for a given extension slot name.\n * Considers if offline or online.\n * @param extensionSlotName The name of the slot to get the assigned extensions for.\n */\nexport function useConnectedExtensions(\n extensionSlotName: string\n): Array<ConnectedExtension> {\n const online = useConnectivity();\n const extensionIdsToRender = useAssignedExtensionIds(extensionSlotName);\n\n const extensions = useMemo(() => {\n const state = extensionStore.getState();\n return extensionIdsToRender\n .map((id) => ({ id, ...getExtensionRegistrationFrom(state, id) }))\n .filter(isValidExtension)\n .filter((m) => checkStatusFor(online, m.online, m.offline));\n }, [extensionIdsToRender, online]);\n\n return extensions;\n}\n","import { useContext, useEffect } from \"react\";\nimport {\n registerExtensionSlot,\n unregisterExtensionSlot,\n} from \"@openmrs/esm-extensions\";\nimport { ComponentContext } from \"./ComponentContext\";\nimport { useConnectedExtensions } from \"./useConnectedExtensions\";\n\nexport function useExtensionSlot(extensionSlotName: string) {\n const { moduleName } = useContext(ComponentContext);\n\n if (!moduleName) {\n throw Error(\n \"ComponentContext has not been provided. This should come from @openmrs/esm-react-utils.\"\n );\n }\n\n useEffect(() => {\n registerExtensionSlot(moduleName, extensionSlotName);\n return () => unregisterExtensionSlot(moduleName, extensionSlotName);\n }, []);\n\n const extensions = useConnectedExtensions(extensionSlotName);\n\n return {\n extensions,\n extensionSlotName,\n extensionSlotModuleName: moduleName,\n };\n}\n","import React, { useRef, useMemo } from \"react\";\nimport { ConnectedExtension } from \"./useConnectedExtensions\";\nimport { ComponentContext } from \"./ComponentContext\";\nimport { Extension } from \"./Extension\";\nimport { useExtensionSlot } from \"./useExtensionSlot\";\n\nfunction isShallowEqual(prevDeps: any, nextDeps: any) {\n if (prevDeps === nextDeps) {\n return true;\n }\n\n if (!prevDeps && nextDeps) {\n return false;\n }\n\n if (prevDeps && !nextDeps) {\n return false;\n }\n\n if (typeof prevDeps !== \"object\" || typeof nextDeps !== \"object\") {\n return false;\n }\n\n const prev = Object.keys(prevDeps);\n const next = Object.keys(nextDeps);\n\n if (prev.length !== next.length) {\n return false;\n }\n\n for (let i = 0; i < prev.length; i++) {\n const key = prev[i];\n\n if (!(key in nextDeps) || nextDeps[key] !== prevDeps[key]) {\n return false;\n }\n }\n\n return true;\n}\n\nexport interface ExtensionSlotBaseProps {\n extensionSlotName: string;\n select?: (extensions: Array<ConnectedExtension>) => Array<ConnectedExtension>;\n state?: Record<string, any>;\n}\n\nexport type ExtensionSlotProps = ExtensionSlotBaseProps &\n React.HTMLAttributes<HTMLDivElement>;\n\nfunction defaultSelect(extensions: Array<ConnectedExtension>) {\n return extensions;\n}\n\nexport const ExtensionSlot: React.FC<ExtensionSlotProps> = ({\n extensionSlotName,\n select = defaultSelect,\n children,\n state,\n style,\n ...divProps\n}: ExtensionSlotProps) => {\n const slotRef = useRef(null);\n const { extensions, extensionSlotModuleName } =\n useExtensionSlot(extensionSlotName);\n const stateRef = useRef(state);\n\n if (!isShallowEqual(stateRef.current, state)) {\n stateRef.current = state;\n }\n\n const content = useMemo(\n () =>\n extensionSlotName &&\n select(extensions).map((extension) => (\n <ComponentContext.Provider\n key={extension.id}\n value={{\n moduleName: extension.moduleName,\n extension: {\n extensionId: extension.id,\n extensionSlotName,\n extensionSlotModuleName,\n },\n }}\n >\n {children ?? <Extension state={stateRef.current} />}\n </ComponentContext.Provider>\n )),\n [select, extensions, extensionSlotName, stateRef.current]\n );\n\n return (\n <div\n ref={slotRef}\n data-extension-slot-name={extensionSlotName}\n data-extension-slot-module-name={extensionSlotModuleName}\n style={{ ...style, position: \"relative\" }}\n {...divProps}\n >\n {content}\n </div>\n );\n};\n","function e(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function t(t){for(var n=1;n<arguments.length;n++){var r=null!=arguments[n]?arguments[n]:{};n%2?e(Object(r),!0).forEach((function(e){o(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):e(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}function n(e){return(n=\"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 o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function r(e){return(r=\"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 a(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(r(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(r(e)));return e}}var i=null;try{i=require(\"react\").createContext()}catch(e){}var c={React:null,ReactDOM:null,rootComponent:null,loadRootComponent:null,renderType:null,errorBoundary:null,errorBoundaryClass:null,domElementGetter:null,parcelCanUpdate:!0,suppressComponentDidCatchWarning:!1,domElements:{},renderResults:{},updateResolves:{}};function u(e){if(\"object\"!==n(e))throw new Error(\"single-spa-react requires a configuration object\");var o=t(t({},c),e);if(!o.React)throw new Error(\"single-spa-react must be passed opts.React\");if(!o.ReactDOM)throw new Error(\"single-spa-react must be passed opts.ReactDOM\");if(!o.rootComponent&&!o.loadRootComponent)throw new Error(\"single-spa-react must be passed opts.rootComponent or opts.loadRootComponent\");if(o.errorBoundary&&\"function\"!=typeof o.errorBoundary)throw Error(\"The errorBoundary opt for single-spa-react must either be omitted or be a function that returns React elements\");!i&&o.React.createContext&&(i=o.React.createContext()),o.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}(o);var r={bootstrap:p.bind(null,o),mount:s.bind(null,o),unmount:l.bind(null,o)};return o.parcelCanUpdate&&(r.update=m.bind(null,o)),r}function p(e,t){return e.rootComponent?Promise.resolve():e.loadRootComponent(t).then((function(t){e.rootComponent=t}))}function s(e,t){return new Promise((function(n,o){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.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 r=d(e,t,(function(){n(this)})),i=a(e,t)(),c=function(e){var t=e.opts,n=e.elementToRender,o=e.domElement,r=\"function\"==typeof t.renderType?t.renderType():t.renderType;if([\"createRoot\",\"unstable_createRoot\",\"createBlockingRoot\",\"unstable_createBlockingRoot\"].indexOf(r)>=0){var a=t.ReactDOM[r](o);return a.render(n),a}\"hydrate\"===r?t.ReactDOM.hydrate(n,o):t.ReactDOM.render(n,o);return null}({elementToRender:r,domElement:i,opts:e});e.domElements[t.name]=i,e.renderResults[t.name]=c}))}function l(e,t){return new Promise((function(n){e.unmountFinished=n;var o=e.renderResults[t.name];o&&o.unmount?o.unmount():e.ReactDOM.unmountComponentAtNode(e.domElements[t.name]),delete e.domElements[t.name],delete e.renderResults[t.name]}))}function m(e,t){return new Promise((function(n){e.updateResolves[t.name]||(e.updateResolves[t.name]=[]),e.updateResolves[t.name].push(n);var o=d(e,t,null),r=e.renderResults[t.name];if(r&&r.render)r.render(o);else{var i=a(e,t)();e.ReactDOM.render(o,i)}}))}function d(e,n,o){var r=e.React.createElement(e.rootComponent,n),a=i?e.React.createElement(i.Provider,{value:n},r):r;return(e.errorBoundary||n.errorBoundary||e.errorBoundaryClass||n.errorBoundaryClass)&&(e.errorBoundaryClass=e.errorBoundaryClass||n.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,n),a=e.React.createElement(e.errorBoundaryClass,n,a)),a=e.React.createElement(e.SingleSpaRoot,t(t({},n),{},{mountFinished:o,updateFinished:function(){e.updateResolves[n.name]&&(e.updateResolves[n.name].forEach((function(e){return e()})),delete e.updateResolves[n.name])},unmountFinished:function(){setTimeout(e.unmountFinished)}}),a)}export{i as SingleSpaContext,u as default};\n//# sourceMappingURL=single-spa-react.js.map\n","import React, { useEffect, useRef } from \"react\";\nimport _i18n from \"i18next\";\nimport { I18nextProvider } from \"react-i18next\";\nimport {\n ComponentConfig,\n ComponentContext,\n ExtensionData,\n} from \"./ComponentContext\";\n\nconst i18n = (_i18n as any).default || _i18n;\n\nconst defaultOpts = {\n strictMode: true,\n throwErrorsToConsole: true,\n disableTranslations: false,\n};\n\ninterface I18nextLoadNamespaceProps {\n forceUpdate(): void;\n ns: string;\n}\n\nconst I18nextLoadNamespace: React.FC<I18nextLoadNamespaceProps> = (props) => {\n useEffect(() => {\n i18n.on(\"languageChanged\", props.forceUpdate);\n return () => i18n.off(\"languageChanged\", props.forceUpdate);\n }, [props.forceUpdate]);\n\n const loadNamespaceErrRef = useRef(null);\n\n if (loadNamespaceErrRef.current) {\n throw loadNamespaceErrRef.current;\n }\n\n if (!i18n.hasLoadedNamespace(props.ns)) {\n const timeoutId = setTimeout(() => {\n console.warn(\n `openmrsComponentDecorator: the React suspense promise for i18next.loadNamespaces(['${props.ns}']) did not resolve nor reject after three seconds. This could mean you have multiple versions of i18next and haven't made i18next a webpack external in all projects.`\n );\n }, 3000);\n\n throw i18n\n .loadNamespaces([props.ns])\n .then(() => clearTimeout(timeoutId))\n .catch((err) => {\n clearTimeout(timeoutId);\n loadNamespaceErrRef.current = err;\n });\n }\n\n return <>{props.children}</>;\n};\n\nexport interface ComponentDecoratorOptions {\n moduleName: string;\n featureName: string;\n disableTranslations?: boolean;\n strictMode?: boolean;\n}\n\nexport interface OpenmrsReactComponentProps {\n _extensionContext?: ExtensionData;\n}\n\nexport interface OpenmrsReactComponentState {\n caughtError: any;\n caughtErrorInfo: any;\n config: ComponentConfig;\n}\n\nexport function openmrsComponentDecorator(userOpts: ComponentDecoratorOptions) {\n if (\n typeof userOpts !== \"object\" ||\n typeof userOpts.featureName !== \"string\" ||\n typeof userOpts.moduleName !== \"string\"\n ) {\n throw new Error(\"Invalid options\");\n }\n\n const opts = Object.assign({}, defaultOpts, userOpts);\n\n return function decorateComponent(\n Comp: React.ComponentType\n ): React.ComponentType<any> {\n return class OpenmrsReactComponent extends React.Component<\n OpenmrsReactComponentProps,\n OpenmrsReactComponentState\n > {\n static displayName = `OpenmrsReactComponent(${opts.featureName})`;\n\n constructor(props: OpenmrsReactComponentProps) {\n super(props);\n this.state = {\n caughtError: null,\n caughtErrorInfo: null,\n config: {\n moduleName: opts.moduleName,\n extension: props._extensionContext,\n },\n };\n }\n\n componentDidCatch(err: any, info: any) {\n if (info && info.componentStack) {\n err.extra = Object.assign(err.extra || {}, {\n componentStack: info.componentStack,\n });\n }\n\n if (opts.throwErrorsToConsole) {\n setTimeout(() => {\n throw err;\n });\n }\n\n this.setState({\n caughtError: err,\n caughtErrorInfo: info,\n });\n }\n\n render() {\n if (this.state.caughtError) {\n // TO-DO have a UX designed for when a catastrophic error occurs\n return (\n <div>An error has occurred. Please try reloading the page.</div>\n );\n } else {\n const content = (\n <ComponentContext.Provider value={this.state.config}>\n <React.Suspense fallback={null}>\n {opts.disableTranslations ? (\n <Comp {...this.props} />\n ) : (\n <I18nextLoadNamespace\n ns={opts.moduleName}\n forceUpdate={() => this.forceUpdate()}\n >\n <I18nextProvider i18n={i18n} defaultNS={opts.moduleName}>\n <Comp {...this.props} />\n </I18nextProvider>\n </I18nextLoadNamespace>\n )}\n </React.Suspense>\n </ComponentContext.Provider>\n );\n\n if (opts.strictMode || !React.StrictMode) {\n return content;\n } else {\n return <React.StrictMode>{content}</React.StrictMode>;\n }\n }\n }\n };\n };\n}\n","import React from \"react\";\nimport ReactDOM from \"react-dom\";\nimport singleSpaReact from \"single-spa-react\";\nimport {\n openmrsComponentDecorator,\n ComponentDecoratorOptions,\n} from \"./openmrsComponentDecorator\";\n\nexport function getLifecycle<T>(\n Component: React.ComponentType<T>,\n options: ComponentDecoratorOptions\n) {\n return singleSpaReact({\n React,\n ReactDOM,\n rootComponent: openmrsComponentDecorator(options)(Component),\n });\n}\n\nexport function getAsyncLifecycle<T>(\n lazy: () => Promise<{ default: React.ComponentType<T> }>,\n options: ComponentDecoratorOptions\n) {\n return () =>\n lazy().then(({ default: Component }) => getLifecycle(Component, options));\n}\n\nexport function getSyncLifecycle<T>(\n Component: React.ComponentType<T>,\n options: ComponentDecoratorOptions\n) {\n return () => Promise.resolve(getLifecycle(Component, options));\n}\n\n/**\n * @deprecated Use getAsyncLifecycle instead.\n */\nexport const getAsyncExtensionLifecycle = getAsyncLifecycle;\n","import { useEffect } from \"react\";\n\nexport function useBodyScrollLock(active: boolean) {\n useEffect(() => {\n if (active) {\n const original = window.getComputedStyle(document.body).overflow;\n document.body.style.overflow = \"hidden\";\n return () => {\n document.body.style.overflow = original;\n };\n }\n }, [active]);\n}\n","import { useContext, useEffect, useMemo, useState } from \"react\";\nimport {\n getConfigStore,\n getExtensionConfigStore,\n ConfigStore,\n} from \"@openmrs/esm-config\";\nimport { ComponentContext, ExtensionData } from \"./ComponentContext\";\nimport { ConfigObject } from \"@openmrs/esm-config\";\nimport { Store } from \"unistore\";\n\nconst promises: Record<string, Promise<ConfigObject>> = {};\nconst errorMessage = `No ComponentContext has been provided. This should come from \"openmrsComponentDecorator\".\nUsually this is already applied when using \"getAsyncLifecycle\" or \"getSyncLifecycle\".`;\n\nfunction readInitialConfig(store: Store<ConfigStore> | undefined) {\n if (!store) {\n return undefined;\n } else {\n return () => {\n const state = store.getState();\n\n if (state.loaded && state.config) {\n return state.config;\n }\n\n return undefined;\n };\n }\n}\n\nfunction createConfigPromise(store: Store<ConfigStore>) {\n return new Promise<ConfigObject>((resolve) => {\n const unsubscribe = store.subscribe((state) => {\n if (state.loaded && state.config) {\n resolve(state.config);\n unsubscribe();\n }\n });\n });\n}\n\nfunction useConfigStore(store: Store<ConfigStore> | undefined) {\n const [state, setState] = useState(readInitialConfig(store));\n\n useEffect(() => {\n return store?.subscribe((state) => {\n if (state.loaded && state.config) {\n setState(state.config);\n }\n });\n }, [store]);\n\n return state;\n}\n\nfunction useExtensionConfig(extension: ExtensionData | undefined) {\n const store = useMemo(\n () =>\n extension &&\n getExtensionConfigStore(\n extension.extensionSlotModuleName,\n extension.extensionSlotName,\n extension.extensionId\n ),\n [extension]\n );\n const state = useConfigStore(store);\n\n if (!state && extension) {\n const cacheId = `${extension.extensionSlotModuleName}-${extension.extensionSlotName}-${extension.extensionId}`;\n\n if (!promises[cacheId] && store) {\n promises[cacheId] = createConfigPromise(store);\n }\n\n // React will prevent the client component from rendering until the promise resolves\n throw promises[cacheId];\n }\n\n return state || {};\n}\n\nfunction useNormalConfig(moduleName: string) {\n const store = useMemo(() => getConfigStore(moduleName), [moduleName]);\n const cacheId = moduleName;\n const state = useConfigStore(store);\n\n if (!state) {\n if (!promises[cacheId]) {\n promises[cacheId] = createConfigPromise(store);\n }\n\n // React will prevent the client component from rendering until the promise resolves\n throw promises[cacheId];\n }\n\n return state;\n}\n\n/**\n * Use this React Hook to obtain your module's configuration.\n */\nexport function useConfig() {\n // This hook uses the config of the MF defining the component.\n // If the component is used in an extension slot then the slot\n // may override (part of) its configuration.\n const { moduleName, extension } = useContext(ComponentContext);\n\n if (!moduleName && !extension) {\n throw Error(errorMessage);\n }\n\n const normalConfig = useNormalConfig(moduleName);\n const extensionConfig = useExtensionConfig(extension);\n const config = useMemo(\n () => ({\n ...normalConfig,\n ...extensionConfig,\n }),\n [normalConfig, extensionConfig]\n );\n\n const configNameForDebugMessage = extension\n ? `${extension?.extensionSlotModuleName}-${extension?.extensionSlotName}-${extension?.extensionId}`\n : moduleName;\n return config;\n}\n","import { useEffect, useMemo, useReducer } from \"react\";\nimport { fetchCurrentPatient, PatientUuid } from \"@openmrs/esm-api\";\n\ntype NullablePatient = fhir.Patient | null;\n\ninterface CurrentPatientState {\n patientUuid: string | null;\n patient: NullablePatient;\n isLoadingPatient: boolean;\n err: Error | null;\n}\n\ninterface LoadPatient {\n type: ActionTypes.loadPatient;\n patientUuid: string | null;\n}\n\ninterface NewPatient {\n type: ActionTypes.newPatient;\n patient: NullablePatient;\n}\n\ninterface PatientLoadError {\n type: ActionTypes.loadError;\n err: Error | null;\n}\n\ntype Action = LoadPatient | NewPatient | PatientLoadError;\n\nenum ActionTypes {\n loadPatient = \"loadPatient\",\n newPatient = \"newPatient\",\n loadError = \"patientLoadError\",\n}\n\nconst initialState: CurrentPatientState = {\n patientUuid: null,\n patient: null,\n isLoadingPatient: true,\n err: null,\n};\n\nfunction getPatientUuidFromUrl(): PatientUuid {\n const match = /\\/patient\\/([a-zA-Z0-9\\-]+)\\/?/.exec(location.pathname);\n return match && match[1];\n}\n\nfunction reducer(\n state: CurrentPatientState,\n action: Action\n): CurrentPatientState {\n switch (action.type) {\n case ActionTypes.loadPatient:\n return {\n ...state,\n patientUuid: action.patientUuid,\n patient: null,\n isLoadingPatient: true,\n err: null,\n };\n case ActionTypes.newPatient:\n return {\n ...state,\n patient: action.patient,\n isLoadingPatient: false,\n err: null,\n };\n case ActionTypes.loadError:\n return {\n ...state,\n patient: null,\n isLoadingPatient: false,\n err: action.err,\n };\n default:\n return state;\n }\n}\n\n/**\n * This React hook returns a patient object. If the `patientUuid` is provided\n * as a parameter, then the patient for that UUID is returned. If the parameter\n * is not provided, the patient UUID is obtained from the current route, and\n * a route listener is set up to update the patient whenever the route changes.\n */\nexport function usePatient(patientUuid?: string) {\n const [state, dispatch] = useReducer(reducer, {\n ...initialState,\n patientUuid: patientUuid ?? null,\n });\n\n useEffect(() => {\n if (state.patientUuid) {\n dispatch({\n type: ActionTypes.loadPatient,\n patientUuid: state.patientUuid,\n });\n } else {\n const patientUuidFromUrl = getPatientUuidFromUrl();\n if (patientUuidFromUrl) {\n dispatch({\n type: ActionTypes.loadPatient,\n patientUuid: patientUuidFromUrl,\n });\n } else {\n dispatch({ type: ActionTypes.newPatient, patient: null });\n }\n }\n }, [state.patientUuid]);\n\n useEffect(() => {\n let active = true;\n if (state.isLoadingPatient && state.patientUuid) {\n fetchCurrentPatient(state.patientUuid).then(\n (patient) =>\n active &&\n dispatch({\n patient: patient.data,\n type: ActionTypes.newPatient,\n }),\n (err) =>\n active &&\n dispatch({\n err,\n type: ActionTypes.loadError,\n })\n );\n }\n return () => {\n active = false;\n };\n }, [state.isLoadingPatient, state.patientUuid]);\n\n useEffect(() => {\n const handleRouteUpdate = (evt) => {\n const newPatientUuid = getPatientUuidFromUrl();\n if (newPatientUuid != state.patientUuid) {\n dispatch({\n type: ActionTypes.loadPatient,\n patientUuid: newPatientUuid,\n });\n }\n };\n window.addEventListener(\"single-spa:routing-event\", handleRouteUpdate);\n return () =>\n window.removeEventListener(\"single-spa:routing-event\", handleRouteUpdate);\n }, []);\n\n return {\n isLoading: state.isLoadingPatient,\n patient: state.patient,\n patientUuid: patientUuid ?? state.patientUuid,\n error: state.err,\n };\n}\n","import { useEffect, useReducer } from \"react\";\nimport { fetchCurrentPatient, PatientUuid } from \"@openmrs/esm-api\";\n\ntype NullablePatient = fhir.Patient | null;\n\ninterface CurrentPatientState {\n patient: NullablePatient;\n isLoadingPatient: boolean;\n err: Error | null;\n}\n\ninterface LoadPatient {\n type: ActionTypes.loadPatient;\n}\n\ninterface NewPatient {\n type: ActionTypes.newPatient;\n patient: NullablePatient;\n}\n\ninterface PatientLoadError {\n type: ActionTypes.loadError;\n err: Error | null;\n}\n\ntype Action = LoadPatient | NewPatient | PatientLoadError;\n\nenum ActionTypes {\n loadPatient = \"loadPatient\",\n newPatient = \"newPatient\",\n loadError = \"patientLloadErroroadError\",\n}\n\nconst initialState: CurrentPatientState = {\n patient: null,\n isLoadingPatient: true,\n err: null,\n};\n\nfunction getPatientUuidFromUrl(): PatientUuid {\n const match = /\\/patient\\/([a-zA-Z0-9\\-]+)\\/?/.exec(location.pathname);\n return match && match[1];\n}\n\nfunction reducer(\n state: CurrentPatientState,\n action: Action\n): CurrentPatientState {\n switch (action.type) {\n case ActionTypes.loadPatient:\n return {\n ...state,\n patient: null,\n isLoadingPatient: true,\n err: null,\n };\n case ActionTypes.newPatient:\n return {\n ...state,\n patient: action.patient,\n isLoadingPatient: false,\n err: null,\n };\n case ActionTypes.loadError:\n return {\n ...state,\n patient: null,\n isLoadingPatient: false,\n err: action.err,\n };\n default:\n return state;\n }\n}\n\n/**\n * This React hook returns the current patient, as specified by the current route. It returns\n * all the information needed to render a loading state, error state, and normal/success state.\n *\n * @deprecated Use {@link usePatient} instead.\n */\nexport function useCurrentPatient(\n patientUuid = getPatientUuidFromUrl()\n): [boolean, NullablePatient, PatientUuid, Error | null] {\n const [state, dispatch] = useReducer(reducer, initialState);\n\n useEffect(() => {\n let active = true;\n\n if (patientUuid) {\n fetchCurrentPatient(patientUuid).then(\n (patient) =>\n active &&\n dispatch({\n patient: patient.data,\n type: ActionTypes.newPatient,\n }),\n (err) =>\n active &&\n dispatch({\n err,\n type: ActionTypes.loadError,\n })\n );\n dispatch({ type: ActionTypes.loadPatient });\n } else {\n dispatch({ type: ActionTypes.newPatient, patient: null });\n }\n\n return () => {\n active = false;\n };\n }, [patientUuid]);\n\n return [state.isLoadingPatient, state.patient, patientUuid, state.err];\n}\n","import { ExtensionMeta } from \"@openmrs/esm-extensions\";\nimport { useMemo } from \"react\";\nimport { useConnectedExtensions } from \"./useConnectedExtensions\";\n\n/**\n * Extract meta data from all extension for a given extension slot.\n * @param extensionSlotName\n */\nexport function useExtensionSlotMeta<T = ExtensionMeta>(\n extensionSlotName: string\n) {\n const extensions = useConnectedExtensions(extensionSlotName);\n\n return useMemo(\n () =>\n Object.fromEntries(extensions.map((ext) => [ext.name, ext.meta as T])),\n [extensions]\n );\n}\n","import { ExtensionStore, extensionStore } from \"@openmrs/esm-extensions\";\nimport { createUseStore } from \"./createUseStore\";\n\nexport const useExtensionStore = createUseStore<ExtensionStore>(extensionStore);\n","import { useState, useCallback } from \"react\";\n\nexport function useForceUpdate() {\n const [, setTick] = useState(0);\n const update = useCallback(() => {\n setTick((tick) => tick + 1);\n }, []);\n return update;\n}\n","import { useEffect, useState } from \"react\";\n\nexport type LayoutType = \"tablet\" | \"phone\" | \"desktop\";\n\nfunction getLayout() {\n let layout: LayoutType = \"tablet\";\n\n document.body.classList.forEach((cls) => {\n switch (cls) {\n case \"omrs-breakpoint-lt-tablet\":\n layout = \"phone\";\n break;\n case \"omrs-breakpoint-gt-tablet\":\n layout = \"desktop\";\n break;\n }\n });\n\n return layout;\n}\n\nexport function useLayoutType() {\n const [type, setType] = useState<LayoutType>(getLayout);\n\n useEffect(() => {\n const handler = () => {\n setType(getLayout());\n };\n window.addEventListener(\"resize\", handler);\n return () => window.removeEventListener(\"resize\", handler);\n }, []);\n\n return type;\n}\n","import { getLocations, Location } from \"@openmrs/esm-api\";\nimport { useState, useEffect } from \"react\";\n\nexport function useLocations() {\n const [locations, setLocations] = useState<Array<Location>>([]);\n\n useEffect(() => {\n const locationSub = getLocations().subscribe(\n (locations) => {\n setLocations(locations);\n },\n (error) => {\n console.error(error);\n }\n );\n return () => locationSub.unsubscribe();\n }, []);\n\n return locations;\n}\n","import { useEffect } from \"react\";\nimport {\n NavigationContext,\n pushNavigationContext,\n} from \"@openmrs/esm-extensions\";\n\n/**\n * @deprecated Don't use this anymore.\n */\nexport function useNavigationContext(context: NavigationContext) {\n useEffect(() => pushNavigationContext(context), []);\n}\n","import { useRef, useEffect } from \"react\";\n\nexport function useOnClickOutside<T extends HTMLElement = HTMLElement>(\n handler: (event: Event) => void,\n active = true\n) {\n const ref = useRef<T>(null);\n\n useEffect(() => {\n if (active) {\n const listener = (event: Event) => {\n const el = ref?.current;\n\n if (el?.contains(event.target as Node)) {\n handler(event);\n }\n };\n\n window.addEventListener(`click`, listener);\n return () => window.removeEventListener(`click`, listener);\n }\n }, [handler, active]);\n\n return ref;\n}\n","import React, { useEffect, useState } from \"react\";\nimport { getCurrentUser, userHasAccess, LoggedInUser } from \"@openmrs/esm-api\";\n\nexport interface UserHasAccessProps {\n privilege: string;\n}\n\nexport const UserHasAccess: React.FC<UserHasAccessProps> = ({\n privilege,\n children,\n}) => {\n const [user, setUser] = useState<LoggedInUser | null>(null);\n\n useEffect(() => {\n const subscription = getCurrentUser({\n includeAuthStatus: false,\n }).subscribe(setUser);\n return () => subscription.unsubscribe();\n }, []);\n\n if (user && userHasAccess(privilege, user)) {\n return <>{children}</>;\n }\n\n return null;\n};\n","import { openmrsObservableFetch, SessionUser } from \"@openmrs/esm-api\";\nimport { useState, useEffect } from \"react\";\n\nexport function useSessionUser() {\n const [sessionUser, setSessionUser] = useState<SessionUser | null>(null);\n\n useEffect(() => {\n if (sessionUser === null) {\n const sub = openmrsObservableFetch(\"/ws/rest/v1/session\").subscribe(\n (user: any) => {\n setSessionUser(user.data);\n }\n );\n\n return () => sub.unsubscribe();\n }\n }, [sessionUser]);\n\n return sessionUser;\n}\n","import { Store } from \"unistore\";\nimport { Actions, BoundActions, createUseStore } from \"./createUseStore\";\n\nexport function useStore<T>(store: Store<T>): T;\nexport function useStore<T>(\n store: Store<T>,\n actions: Actions\n): T & BoundActions;\nexport function useStore<T>(store: Store<T>, actions?: Actions) {\n return createUseStore<T>(store)(actions);\n}\n","import { useState, useEffect } from \"react\";\nimport dayjs from \"dayjs\";\nimport {\n getVisitsForPatient,\n getStartedVisit,\n VisitMode,\n VisitStatus,\n Visit,\n} from \"@openmrs/esm-api\";\n\nexport function useVisit(patientUuid: string) {\n const [currentVisit, setCurrentVisit] = useState<Visit | null>(null);\n const [error, setError] = useState(null);\n\n useEffect(() => {\n const sub = getStartedVisit.subscribe((visit) => {\n if (visit) {\n setCurrentVisit(visit?.visitData ?? null);\n } else {\n setCurrentVisit(null);\n }\n });\n\n return () => sub.unsubscribe();\n }, [patientUuid]);\n\n useEffect(() => {\n const abortController = new AbortController();\n const sub = getVisitsForPatient(patientUuid, abortController).subscribe(\n ({ data }) => {\n const currentVisit = data.results.find(\n (visit) => visit.stopDatetime === null\n );\n\n if (currentVisit) {\n getStartedVisit.next({\n mode: VisitMode.LOADING,\n visitData: currentVisit,\n status: VisitStatus.ONGOING,\n });\n }\n },\n setError\n );\n return () => sub && sub.unsubscribe();\n }, [patientUuid]);\n\n return { currentVisit, error };\n}\n","import { getVisitTypes, VisitType } from \"@openmrs/esm-api\";\nimport { useEffect, useState } from \"react\";\n\nexport function useVisitTypes() {\n const [visitTypes, setVisitTypes] = useState<Array<VisitType>>([]);\n\n useEffect(() => {\n const visitTypesSub = getVisitTypes().subscribe(\n (visitTypes) => {\n setVisitTypes(visitTypes);\n },\n (error) => console.error(error)\n );\n\n return () => visitTypesSub.unsubscribe();\n }, []);\n\n return visitTypes;\n}\n","import { useMemo, useState } from \"react\";\n\nconst defaultResultsPerPage = 10;\n\nexport function usePagination<T>(\n data: Array<T> = [],\n resultsPerPage = defaultResultsPerPage\n) {\n const [page, setPage] = useState(1);\n const totalPages = useMemo(\n () => Math.max(1, Math.ceil(data.length / resultsPerPage)),\n [data.length, resultsPerPage]\n );\n const results = useMemo(() => {\n const lowerBound = (page - 1) * resultsPerPage;\n const upperBound = (page + 0) * resultsPerPage;\n return data.slice(lowerBound, upperBound);\n }, [data, page, resultsPerPage]);\n\n return {\n results,\n totalPages,\n currentPage: page,\n paginated: data.length > resultsPerPage,\n showNextButton: page < totalPages,\n showPreviousButton: page > 1,\n goTo(page: number) {\n setPage(Math.max(1, Math.min(totalPages, page)));\n },\n goToNext() {\n if (page < totalPages) {\n setPage(page + 1);\n }\n },\n goToPrevious() {\n if (page > 1) {\n setPage(page - 1);\n }\n },\n };\n}\n"],"names":["resolveDirectory","r","exports","s","rootDirLevel","meta","url","console","error","Error","R","urlString","rootDirectoryLevel","a","document","createElement","href","pathname","numDirsProcessed","index","length","finalPath","slice","protocol","host","Number","isInteger","__webpack_module_cache__","__webpack_require__","moduleId","cachedModule","module","__webpack_modules__","y","__system_context__","d","definition","key","o","Object","defineProperty","enumerable","get","g","globalThis","this","Function","e","window","obj","prop","prototype","hasOwnProperty","call","Symbol","toStringTag","value","scriptUrl","importScripts","location","currentScript","src","scripts","getElementsByTagName","replace","p","n","t","u","push","f","i","action","arguments","apply","then","setState","subscribe","unsubscribe","getState","availableStores","createGlobalStore","name","initialState","available","active","store","createStore","getGlobalStore","fallbackState","createAppState","getAppState","subscribeTo","select","handle","previous","state","current","update","property","restPropertyPath","__WEBPACK_EXTERNAL_MODULE__766__","__WEBPACK_EXTERNAL_MODULE__824__","__WEBPACK_EXTERNAL_MODULE__45__","__WEBPACK_EXTERNAL_MODULE__728__","__WEBPACK_EXTERNAL_MODULE__64__","__WEBPACK_EXTERNAL_MODULE__954__","__WEBPACK_EXTERNAL_MODULE__493__","__WEBPACK_EXTERNAL_MODULE__281__","undefined","autoPublicPath","ComponentContext","React","moduleName","ConfigurableLink","to","children","otherProps","onClick","event","metaKey","ctrlKey","shiftKey","button","preventDefault","navigate","handleClick","interpolateUrl","createUseStore","actions","set","useState","useEffect","boundActions","useMemo","bound","bindActions","useExtension","ref","useRef","extension","useContext","renderExtension","extensionSlotName","extensionSlotModuleName","extensionId","Extension","wrap","slot","style","position","useStoreState","defaultConfig","add","order","remove","useExtensionSlotConfig","getExtensionSlotsConfigStore","useCallback","extensionSlotConfigs","defaultArray","useAttachedExtensionIds","slots","attachedIds","extensionStore","useAssignedExtensionIds","config","assignedIds","setAssignedIds","newAssignedIds","getAssignedIds","join","useConnectivity","isOnline","setIsOnline","navigator","onLine","subscribeConnectivityChanged","online","isValidExtension","useConnectedExtensions","extensionIdsToRender","extensions","map","id","getExtensionRegistrationFrom","filter","m","checkStatusFor","offline","useExtensionSlot","registerExtensionSlot","unregisterExtensionSlot","defaultSelect","ExtensionSlot","divProps","slotRef","stateRef","prevDeps","nextDeps","prev","keys","next","isShallowEqual","content","Provider","getOwnPropertySymbols","getOwnPropertyDescriptor","forEach","getOwnPropertyDescriptors","defineProperties","iterator","constructor","configurable","writable","domElement","domElementGetter","appName","concat","getElementById","body","appendChild","HTMLElement","require","createContext","c","ReactDOM","rootComponent","loadRootComponent","renderType","errorBoundary","errorBoundaryClass","parcelCanUpdate","suppressComponentDidCatchWarning","domElements","renderResults","updateResolves","SingleSpaRoot","displayName","create","Component","componentDidMount","setTimeout","props","mountFinished","componentWillUnmount","unmountFinished","render","updateFinished","bootstrap","bind","mount","unmount","l","Promise","resolve","version","indexOf","componentDidCatch","warn","childAppName","opts","elementToRender","hydrate","unmountComponentAtNode","caughtError","caughtErrorInfo","i18n","_i18n","defaultOpts","strictMode","throwErrorsToConsole","disableTranslations","I18nextLoadNamespace","on","forceUpdate","off","loadNamespaceErrRef","hasLoadedNamespace","ns","timeoutId","loadNamespaces","clearTimeout","catch","err","openmrsComponentDecorator","userOpts","featureName","assign","Comp","super","_extensionContext","info","componentStack","extra","fallback","I18nextProvider","defaultNS","getLifecycle","options","singleSpaReact","getAsyncLifecycle","lazy","default","getSyncLifecycle","getAsyncExtensionLifecycle","useBodyScrollLock","original","getComputedStyle","overflow","promises","createConfigPromise","loaded","useConfigStore","readInitialConfig","useConfig","normalConfig","getConfigStore","cacheId","useNormalConfig","extensionConfig","getExtensionConfigStore","useExtensionConfig","ActionTypes","patientUuid","patient","isLoadingPatient","getPatientUuidFromUrl","match","exec","reducer","type","loadPatient","newPatient","loadError","usePatient","dispatch","useReducer","patientUuidFromUrl","fetchCurrentPatient","data","handleRouteUpdate","evt","newPatientUuid","addEventListener","removeEventListener","isLoading","useCurrentPatient","useExtensionSlotMeta","fromEntries","ext","useExtensionStore","useForceUpdate","setTick","tick","getLayout","layout","classList","cls","useLayoutType","setType","handler","useLocations","locations","setLocations","locationSub","getLocations","useNavigationContext","context","pushNavigationContext","useOnClickOutside","listener","el","contains","target","UserHasAccess","privilege","user","setUser","subscription","getCurrentUser","includeAuthStatus","userHasAccess","useSessionUser","sessionUser","setSessionUser","sub","openmrsObservableFetch","useStore","useVisit","currentVisit","setCurrentVisit","setError","getStartedVisit","visit","visitData","abortController","AbortController","getVisitsForPatient","results","find","stopDatetime","mode","VisitMode","status","VisitStatus","useVisitTypes","visitTypes","setVisitTypes","visitTypesSub","getVisitTypes","usePagination","resultsPerPage","page","setPage","totalPages","Math","max","ceil","lowerBound","upperBound","currentPage","paginated","showNextButton","showPreviousButton","goTo","min","goToNext","goToPrevious"],"sourceRoot":""}
1
+ {"version":3,"file":"openmrs-esm-react-utils.js","mappings":"8pDAAA,MAAMA,EAAmBC,EAAAA,KAAAA,EAEzBC,EAAQC,EAAiB,SAAwBC,GAY7C,GAXGA,IACHA,EAAe,IAUVH,EAAAA,EAAmBI,OAASJ,EAAAA,EAAmBI,KAAKC,IAEvD,MADAC,QAAQC,MAAM,qBAAsBP,EAAAA,GAC9BQ,MACJ,uHAIJR,EAAAA,EAA0BD,EACxBC,EAAAA,EAAmBI,K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EAAIrT,gBACvB,CAACsP,IAEG,CAAEmE,aAAAA,EAAc/X,MAAAA,GC5ClB,SAAS+Y,KACd,MAAOC,EAAYC,IAAiBtR,EAAAA,EAAAA,UAA2B,IAa/D,OAXAC,EAAAA,EAAAA,YAAU,KACR,MAAMsR,GAAgBC,EAAAA,GAAAA,iBAAgB9U,WACnC2U,IACCC,EAAcD,MAEfhZ,GAAUD,QAAQC,MAAMA,KAG3B,MAAO,IAAMkZ,EAAc5U,gBAC1B,IAEI0U,ECbF,SAASI,KAGd,IAFAvE,EAEA,uDAFiB,GACjBwE,EACA,uDAL4B,GAM5B,MAAOC,EAAMC,IAAW5R,EAAAA,EAAAA,UAAS,GAC3B6R,GAAa1R,EAAAA,EAAAA,UACjB,IAAM2R,KAAKC,IAAI,EAAGD,KAAKE,KAAK9E,EAAKjU,OAASyY,KAC1C,CAACxE,EAAKjU,OAAQyY,IAEVb,GAAU1Q,EAAAA,EAAAA,UAAQ,KACtB,MAAM8R,GAAcN,EAAO,GAAKD,EAC1BQ,GAAcP,EAAO,GAAKD,EAChC,OAAOxE,EAAK/T,MAAM8Y,EAAYC,KAC7B,CAAChF,EAAMyE,EAAMD,IAEhB,MAAO,CACLb,QAAAA,EACAgB,WAAAA,EACAM,YAAaR,EACbS,UAAWlF,EAAKjU,OAASyY,EACzBW,eAAgBV,EAAOE,EACvBS,mBAAoBX,EAAO,EAC3BY,KAAKZ,GACHC,EAAQE,KAAKC,IAAI,EAAGD,KAAKU,IAAIX,EAAYF,MAE3Cc,WACMd,EAAOE,GACTD,EAAQD,EAAO,IAGnBe,eACMf,EAAO,GACTC,EAAQD,EAAO,O","sources":["webpack://@openmrs/esm-react-utils/@openmrs/esm-state/../../../node_modules/systemjs-webpack-interop/auto-public-path/auto-public-path.js","webpack://@openmrs/esm-react-utils/@openmrs/esm-state/../../../node_modules/systemjs-webpack-interop/public-path.js","webpack://@openmrs/esm-react-utils/@openmrs/esm-state/webpack/bootstrap","webpack://@openmrs/esm-react-utils/@openmrs/esm-state/webpack/runtime/__system_context__","webpack://@openmrs/esm-react-utils/@openmrs/esm-state/webpack/runtime/define property getters","webpack://@openmrs/esm-react-utils/@openmrs/esm-state/webpack/runtime/global","webpack://@openmrs/esm-react-utils/@openmrs/esm-state/webpack/runtime/hasOwnProperty shorthand","webpack://@openmrs/esm-react-utils/@openmrs/esm-state/webpack/runtime/make namespace object","webpack://@openmrs/esm-react-utils/@openmrs/esm-state/webpack/runtime/publicPath","webpack://@openmrs/esm-react-utils/@openmrs/esm-state/../../../node_modules/systemjs-webpack-interop/auto-public-path/1.js","webpack://@openmrs/esm-react-utils/@openmrs/esm-state/../../../node_modules/unistore/dist/unistore.es.js","webpack://@openmrs/esm-react-utils/@openmrs/esm-state/./src/state.ts","webpack://@openmrs/esm-react-utils/@openmrs/esm-state/./src/update.ts","webpack://@openmrs/esm-react-utils/../../../node_modules/systemjs-webpack-interop/auto-public-path/auto-public-path.js","webpack://@openmrs/esm-react-utils/../../../node_modules/systemjs-webpack-interop/public-path.js","webpack://@openmrs/esm-react-utils/external system \"@openmrs/esm-api\"","webpack://@openmrs/esm-react-utils/external system \"@openmrs/esm-config\"","webpack://@openmrs/esm-react-utils/external system \"@openmrs/esm-extensions\"","webpack://@openmrs/esm-react-utils/external system \"@openmrs/esm-globals\"","webpack://@openmrs/esm-react-utils/external system \"i18next\"","webpack://@openmrs/esm-react-utils/external system \"react\"","webpack://@openmrs/esm-react-utils/external system \"react-dom\"","webpack://@openmrs/esm-react-utils/external system \"react-i18next\"","webpack://@openmrs/esm-react-utils/webpack/bootstrap","webpack://@openmrs/esm-react-utils/webpack/runtime/__system_context__","webpack://@openmrs/esm-react-utils/webpack/runtime/define property getters","webpack://@openmrs/esm-react-utils/webpack/runtime/global","webpack://@openmrs/esm-react-utils/webpack/runtime/hasOwnProperty shorthand","webpack://@openmrs/esm-react-utils/webpack/runtime/make namespace object","webpack://@openmrs/esm-react-utils/webpack/runtime/publicPath","webpack://@openmrs/esm-react-utils/../../../node_modules/systemjs-webpack-interop/auto-public-path/1.js","webpack://@openmrs/esm-react-utils/./src/ComponentContext.ts","webpack://@openmrs/esm-react-utils/./src/ConfigurableLink.tsx","webpack://@openmrs/esm-react-utils/./src/createUseStore.ts","webpack://@openmrs/esm-react-utils/./src/useExtension.ts","webpack://@openmrs/esm-react-utils/./src/Extension.tsx","webpack://@openmrs/esm-react-utils/./src/useStoreState.ts","webpack://@openmrs/esm-react-utils/./src/useExtensionSlotConfig.ts","webpack://@openmrs/esm-react-utils/./src/useAttachedExtensionIds.ts","webpack://@openmrs/esm-react-utils/./src/useAssignedExtensionIds.ts","webpack://@openmrs/esm-react-utils/./src/useConnectivity.ts","webpack://@openmrs/esm-react-utils/./src/useConnectedExtensions.ts","webpack://@openmrs/esm-react-utils/./src/useExtensionSlot.ts","webpack://@openmrs/esm-react-utils/./src/ExtensionSlot.tsx","webpack://@openmrs/esm-react-utils/../../../node_modules/single-spa-react/lib/esm/single-spa-react.js","webpack://@openmrs/esm-react-utils/./src/openmrsComponentDecorator.tsx","webpack://@openmrs/esm-react-utils/./src/getLifecycle.ts","webpack://@openmrs/esm-react-utils/./src/useBodyScrollLock.ts","webpack://@openmrs/esm-react-utils/./src/useConfig.ts","webpack://@openmrs/esm-react-utils/./src/usePatient.ts","webpack://@openmrs/esm-react-utils/./src/useCurrentPatient.ts","webpack://@openmrs/esm-react-utils/./src/useExtensionSlotMeta.ts","webpack://@openmrs/esm-react-utils/./src/useExtensionStore.ts","webpack://@openmrs/esm-react-utils/./src/useForceUpdate.ts","webpack://@openmrs/esm-react-utils/./src/useLayoutType.ts","webpack://@openmrs/esm-react-utils/./src/useLocations.tsx","webpack://@openmrs/esm-react-utils/./src/useNavigationContext.ts","webpack://@openmrs/esm-react-utils/./src/useOnClickOutside.tsx","webpack://@openmrs/esm-react-utils/./src/UserHasAccess.tsx","webpack://@openmrs/esm-react-utils/./src/useSessionUser.tsx","webpack://@openmrs/esm-react-utils/./src/useStore.ts","webpack://@openmrs/esm-react-utils/./src/useVisit.ts","webpack://@openmrs/esm-react-utils/./src/useVisitTypes.ts","webpack://@openmrs/esm-react-utils/./src/usePagination.ts"],"sourcesContent":["const resolveDirectory = require(\"../public-path\").resolveDirectory;\n\nexports.autoPublicPath = function autoPublicPath(rootDirLevel) {\n if (!rootDirLevel) {\n rootDirLevel = 1;\n }\n\n if (typeof __webpack_public_path__ !== \"undefined\") {\n if (typeof __system_context__ === \"undefined\") {\n throw Error(\n \"systemjs-webpack-interop requires webpack@>=5.0.0-beta.15 and output.libraryTarget set to 'system'\"\n );\n }\n\n if (!__system_context__.meta || !__system_context__.meta.url) {\n console.error(\"__system_context__\", __system_context__);\n throw Error(\n \"systemjs-webpack-interop was provided an unknown SystemJS context. Expected context.meta.url, but none was provided\"\n );\n }\n\n __webpack_public_path__ = resolveDirectory(\n __system_context__.meta.url,\n rootDirLevel\n );\n }\n};\n","exports.setPublicPath = function setPublicPath(\n systemjsModuleName,\n rootDirectoryLevel\n) {\n if (!rootDirectoryLevel) {\n rootDirectoryLevel = 1;\n }\n if (\n typeof systemjsModuleName !== \"string\" ||\n systemjsModuleName.trim().length === 0\n ) {\n throw Error(\n \"systemjs-webpack-interop: setPublicPath(systemjsModuleName) must be called with a non-empty string 'systemjsModuleName'\"\n );\n }\n\n if (\n typeof rootDirectoryLevel !== \"number\" ||\n rootDirectoryLevel <= 0 ||\n isNaN(rootDirectoryLevel) ||\n !isInteger(rootDirectoryLevel)\n ) {\n throw Error(\n \"systemjs-webpack-interop: setPublicPath(systemjsModuleName, rootDirectoryLevel) must be called with a positive integer 'rootDirectoryLevel'\"\n );\n }\n\n var moduleUrl;\n try {\n moduleUrl = window.System.resolve(systemjsModuleName);\n if (!moduleUrl) {\n throw Error();\n }\n } catch (err) {\n throw Error(\n \"systemjs-webpack-interop: There is no such module '\" +\n systemjsModuleName +\n \"' in the SystemJS registry. Did you misspell the name of your module?\"\n );\n }\n\n __webpack_public_path__ = resolveDirectory(moduleUrl, rootDirectoryLevel);\n};\n\nfunction resolveDirectory(urlString, rootDirectoryLevel) {\n // Our friend IE11 doesn't support new URL()\n // https://github.com/single-spa/single-spa/issues/612\n // https://gist.github.com/jlong/2428561\n\n var a = document.createElement(\"a\");\n a.href = urlString;\n\n var pathname = a.pathname[0] === \"/\" ? a.pathname : \"/\" + a.pathname;\n var numDirsProcessed = 0,\n index = pathname.length;\n while (numDirsProcessed !== rootDirectoryLevel && index >= 0) {\n var char = pathname[--index];\n if (char === \"/\") {\n numDirsProcessed++;\n }\n }\n\n if (numDirsProcessed !== rootDirectoryLevel) {\n throw Error(\n \"systemjs-webpack-interop: rootDirectoryLevel (\" +\n rootDirectoryLevel +\n \") is greater than the number of directories (\" +\n numDirsProcessed +\n \") in the URL path \" +\n urlString\n );\n }\n\n var finalPath = pathname.slice(0, index + 1);\n\n return a.protocol + \"//\" + a.host + finalPath;\n}\n\nexports.resolveDirectory = resolveDirectory;\n\n// borrowed from https://github.com/parshap/js-is-integer/blob/master/index.js\nvar isInteger =\n Number.isInteger ||\n function isInteger(val) {\n return typeof val === \"number\" && isFinite(val) && Math.floor(val) === val;\n };\n","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","__webpack_require__.y = __system_context__;","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.g = (function() {\n\tif (typeof globalThis === 'object') return globalThis;\n\ttry {\n\t\treturn this || new Function('return this')();\n\t} catch (e) {\n\t\tif (typeof window === 'object') return window;\n\t}\n})();","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","var scriptUrl;\nif (__webpack_require__.g.importScripts) scriptUrl = __webpack_require__.g.location + \"\";\nvar document = __webpack_require__.g.document;\nif (!scriptUrl && document) {\n\tif (document.currentScript)\n\t\tscriptUrl = document.currentScript.src\n\tif (!scriptUrl) {\n\t\tvar scripts = document.getElementsByTagName(\"script\");\n\t\tif(scripts.length) scriptUrl = scripts[scripts.length - 1].src\n\t}\n}\n// When supporting browsers where an automatic publicPath is not supported you must specify an output.publicPath manually via configuration\n// or pass an empty string (\"\") and set the __webpack_public_path__ variable from your code to use your own logic.\nif (!scriptUrl) throw new Error(\"Automatic publicPath is not supported in this browser\");\nscriptUrl = scriptUrl.replace(/#.*$/, \"\").replace(/\\?.*$/, \"\").replace(/\\/[^\\/]+$/, \"/\");\n__webpack_require__.p = scriptUrl;","const autoPublicPath = require(\"./auto-public-path\").autoPublicPath;\n\nautoPublicPath(1);\n","function n(n,t){for(var r in t)n[r]=t[r];return n}export default function(t){var r=[];function u(n){for(var t=[],u=0;u<r.length;u++)r[u]===n?n=null:t.push(r[u]);r=t}function e(u,e,f){t=e?u:n(n({},t),u);for(var i=r,o=0;o<i.length;o++)i[o](t,f)}return t=t||{},{action:function(n){function r(t){e(t,!1,n)}return function(){for(var u=arguments,e=[t],f=0;f<arguments.length;f++)e.push(u[f]);var i=n.apply(this,e);if(null!=i)return i.then?i.then(r):r(i)}},setState:e,subscribe:function(n){return r.push(n),function(){u(n)}},unsubscribe:u,getState:function(){return t}}}\n//# sourceMappingURL=unistore.es.js.map\n","import createStore, { Store } from \"unistore\";\n\ninterface StoreEntity {\n value: Store<any>;\n active: boolean;\n}\n\nconst availableStores: Record<string, StoreEntity> = {};\n\n/**\n * Creates a Unistore [store](https://github.com/developit/unistore#store).\n *\n * @param name A name by which the store can be looked up later.\n * Must be unique across the entire application.\n * @param initialState An object which will be the initial state of the store.\n * @returns The newly created store.\n */\nexport function createGlobalStore<TState>(\n name: string,\n initialState: TState\n): Store<TState> {\n const available = availableStores[name];\n\n if (available) {\n if (available.active) {\n console.error(\n \"Cannot override an existing store. Make sure that stores are only created once.\"\n );\n } else {\n available.value.setState(initialState, true);\n }\n\n available.active = true;\n return available.value;\n } else {\n const store = createStore(initialState);\n\n availableStores[name] = {\n value: store,\n active: true,\n };\n\n return store;\n }\n}\n\n/**\n * Returns the existing [store](https://github.com/developit/unistore#store) named `name`,\n * or creates a new store named `name` if none exists.\n *\n * @param name The name of the store to look up.\n * @param fallbackState The initial value of the new store if no store named `name` exists.\n * @returns The found or newly created store.\n */\nexport function getGlobalStore<TState = any>(\n name: string,\n fallbackState?: TState\n): Store<TState> {\n const available = availableStores[name];\n\n if (!available) {\n const store = createStore(fallbackState);\n availableStores[name] = {\n value: store,\n active: false,\n };\n return store;\n }\n\n return available.value;\n}\n\nexport interface AppState {}\n\n/**\n * @internal\n */\nexport function createAppState(initialState: AppState) {\n return createGlobalStore(\"app\", initialState);\n}\n\n/**\n * @returns The [store](https://github.com/developit/unistore#store) named `app`.\n */\nexport function getAppState() {\n return getGlobalStore<AppState>(\"app\", {});\n}\n\nexport function subscribeTo<T, U>(\n store: Store<T>,\n select: (state: T) => U,\n handle: (subState: U) => void\n) {\n let previous = select(store.getState());\n\n return store.subscribe((state) => {\n const current = select(state);\n\n if (current !== previous) {\n previous = current;\n handle(current);\n }\n });\n}\n","export function update<T extends Record<string, any>>(\n obj: T,\n [property, ...restPropertyPath]: Array<string>,\n value: any\n): T {\n if (!property) {\n return obj;\n } else if (restPropertyPath.length === 0) {\n return { ...obj, [property]: value };\n } else {\n return {\n ...obj,\n [property]: update(obj[property] || {}, restPropertyPath, value),\n };\n }\n}\n","const resolveDirectory = require(\"../public-path\").resolveDirectory;\n\nexports.autoPublicPath = function autoPublicPath(rootDirLevel) {\n if (!rootDirLevel) {\n rootDirLevel = 1;\n }\n\n if (typeof __webpack_public_path__ !== \"undefined\") {\n if (typeof __system_context__ === \"undefined\") {\n throw Error(\n \"systemjs-webpack-interop requires webpack@>=5.0.0-beta.15 and output.libraryTarget set to 'system'\"\n );\n }\n\n if (!__system_context__.meta || !__system_context__.meta.url) {\n console.error(\"__system_context__\", __system_context__);\n throw Error(\n \"systemjs-webpack-interop was provided an unknown SystemJS context. Expected context.meta.url, but none was provided\"\n );\n }\n\n __webpack_public_path__ = resolveDirectory(\n __system_context__.meta.url,\n rootDirLevel\n );\n }\n};\n","exports.setPublicPath = function setPublicPath(\n systemjsModuleName,\n rootDirectoryLevel\n) {\n if (!rootDirectoryLevel) {\n rootDirectoryLevel = 1;\n }\n if (\n typeof systemjsModuleName !== \"string\" ||\n systemjsModuleName.trim().length === 0\n ) {\n throw Error(\n \"systemjs-webpack-interop: setPublicPath(systemjsModuleName) must be called with a non-empty string 'systemjsModuleName'\"\n );\n }\n\n if (\n typeof rootDirectoryLevel !== \"number\" ||\n rootDirectoryLevel <= 0 ||\n isNaN(rootDirectoryLevel) ||\n !isInteger(rootDirectoryLevel)\n ) {\n throw Error(\n \"systemjs-webpack-interop: setPublicPath(systemjsModuleName, rootDirectoryLevel) must be called with a positive integer 'rootDirectoryLevel'\"\n );\n }\n\n var moduleUrl;\n try {\n moduleUrl = window.System.resolve(systemjsModuleName);\n if (!moduleUrl) {\n throw Error();\n }\n } catch (err) {\n throw Error(\n \"systemjs-webpack-interop: There is no such module '\" +\n systemjsModuleName +\n \"' in the SystemJS registry. Did you misspell the name of your module?\"\n );\n }\n\n __webpack_public_path__ = resolveDirectory(moduleUrl, rootDirectoryLevel);\n};\n\nfunction resolveDirectory(urlString, rootDirectoryLevel) {\n // Our friend IE11 doesn't support new URL()\n // https://github.com/single-spa/single-spa/issues/612\n // https://gist.github.com/jlong/2428561\n\n var a = document.createElement(\"a\");\n a.href = urlString;\n\n var pathname = a.pathname[0] === \"/\" ? a.pathname : \"/\" + a.pathname;\n var numDirsProcessed = 0,\n index = pathname.length;\n while (numDirsProcessed !== rootDirectoryLevel && index >= 0) {\n var char = pathname[--index];\n if (char === \"/\") {\n numDirsProcessed++;\n }\n }\n\n if (numDirsProcessed !== rootDirectoryLevel) {\n throw Error(\n \"systemjs-webpack-interop: rootDirectoryLevel (\" +\n rootDirectoryLevel +\n \") is greater than the number of directories (\" +\n numDirsProcessed +\n \") in the URL path \" +\n urlString\n );\n }\n\n var finalPath = pathname.slice(0, index + 1);\n\n return a.protocol + \"//\" + a.host + finalPath;\n}\n\nexports.resolveDirectory = resolveDirectory;\n\n// borrowed from https://github.com/parshap/js-is-integer/blob/master/index.js\nvar isInteger =\n Number.isInteger ||\n function isInteger(val) {\n return typeof val === \"number\" && isFinite(val) && Math.floor(val) === val;\n };\n","module.exports = __WEBPACK_EXTERNAL_MODULE__766__;","module.exports = __WEBPACK_EXTERNAL_MODULE__824__;","module.exports = __WEBPACK_EXTERNAL_MODULE__45__;","module.exports = __WEBPACK_EXTERNAL_MODULE__728__;","module.exports = __WEBPACK_EXTERNAL_MODULE__64__;","module.exports = __WEBPACK_EXTERNAL_MODULE__954__;","module.exports = __WEBPACK_EXTERNAL_MODULE__493__;","module.exports = __WEBPACK_EXTERNAL_MODULE__281__;","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","__webpack_require__.y = __system_context__;","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.g = (function() {\n\tif (typeof globalThis === 'object') return globalThis;\n\ttry {\n\t\treturn this || new Function('return this')();\n\t} catch (e) {\n\t\tif (typeof window === 'object') return window;\n\t}\n})();","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","var scriptUrl;\nif (__webpack_require__.g.importScripts) scriptUrl = __webpack_require__.g.location + \"\";\nvar document = __webpack_require__.g.document;\nif (!scriptUrl && document) {\n\tif (document.currentScript)\n\t\tscriptUrl = document.currentScript.src\n\tif (!scriptUrl) {\n\t\tvar scripts = document.getElementsByTagName(\"script\");\n\t\tif(scripts.length) scriptUrl = scripts[scripts.length - 1].src\n\t}\n}\n// When supporting browsers where an automatic publicPath is not supported you must specify an output.publicPath manually via configuration\n// or pass an empty string (\"\") and set the __webpack_public_path__ variable from your code to use your own logic.\nif (!scriptUrl) throw new Error(\"Automatic publicPath is not supported in this browser\");\nscriptUrl = scriptUrl.replace(/#.*$/, \"\").replace(/\\?.*$/, \"\").replace(/\\/[^\\/]+$/, \"/\");\n__webpack_require__.p = scriptUrl;","const autoPublicPath = require(\"./auto-public-path\").autoPublicPath;\n\nautoPublicPath(1);\n","import React from \"react\";\n\nexport interface ExtensionData {\n extensionSlotName: string;\n extensionSlotModuleName: string;\n extensionId: string;\n}\n\nexport interface ComponentConfig {\n moduleName: string;\n extension?: ExtensionData;\n}\n\n/**\n * Available to all components. Provided by `openmrsComponentDecorator`.\n */\nexport const ComponentContext = React.createContext<ComponentConfig>({\n moduleName: \"\",\n});\n","import React, { MouseEvent, AnchorHTMLAttributes } from \"react\";\nimport { navigate, interpolateUrl } from \"@openmrs/esm-config\";\n\nfunction handleClick(event: MouseEvent, to: string) {\n if (\n !event.metaKey &&\n !event.ctrlKey &&\n !event.shiftKey &&\n event.button == 0\n ) {\n event.preventDefault();\n navigate({ to });\n }\n}\n\n/**\n * @noInheritDoc\n */\nexport interface ConfigurableLinkProps\n extends AnchorHTMLAttributes<HTMLAnchorElement> {\n to: string;\n}\n\n/**\n * A React link component which calls [[navigate]] when clicked\n *\n * @param to The target path or URL. Supports interpolation. See [[navigate]]\n * @param children Inline elements within the link\n * @param otherProps Any other valid props for an <a> tag except `href` and `onClick`\n * @category Navigation\n */\nexport const ConfigurableLink: React.FC<ConfigurableLinkProps> = ({\n to,\n children,\n ...otherProps\n}) => (\n <a\n onClick={(event) => handleClick(event, to)}\n href={interpolateUrl(to)}\n {...otherProps}\n >\n {children}\n </a>\n);\n","import { useEffect, useMemo, useState } from \"react\";\nimport { Store, BoundAction } from \"unistore\";\n\nexport type Actions = Function | { [key: string]: Function };\nexport type BoundActions = { [key: string]: BoundAction };\n\nfunction bindActions<T>(store: Store<T>, actions: Actions) {\n if (typeof actions == \"function\") {\n actions = actions(store);\n }\n\n const bound = {};\n\n for (let i in actions) {\n bound[i] = store.action(actions[i]);\n }\n\n return bound;\n}\n\nexport function createUseStore<T>(store: Store<T>) {\n function useStore(): T;\n function useStore(actions: Actions): T & BoundActions;\n function useStore(actions?: Actions): T & BoundActions;\n function useStore(actions?: Actions) {\n const [state, set] = useState(store.getState());\n useEffect(() => store.subscribe((state) => set(state)), []);\n let boundActions: BoundActions = {};\n\n if (actions) {\n boundActions = useMemo(\n () => bindActions(store, actions),\n [store, actions]\n );\n }\n\n return { ...state, ...boundActions };\n }\n\n return useStore;\n}\n","import { RefObject, useContext, useRef, useEffect } from \"react\";\nimport { renderExtension } from \"@openmrs/esm-extensions\";\nimport { ComponentContext, ExtensionData } from \"./ComponentContext\";\n\nexport function useExtension<TRef extends HTMLElement>(\n state?: Record<string, any>\n): [RefObject<TRef>, ExtensionData | undefined] {\n const ref = useRef<TRef>(null);\n const { extension } = useContext(ComponentContext);\n\n useEffect(() => {\n if (ref.current && extension) {\n return renderExtension(\n ref.current,\n extension.extensionSlotName,\n extension.extensionSlotModuleName,\n extension.extensionId,\n undefined,\n state\n );\n }\n }, [\n extension?.extensionSlotName,\n extension?.extensionId,\n extension?.extensionSlotModuleName,\n ref.current,\n state,\n ]);\n\n return [ref, extension];\n}\n","import React from \"react\";\nimport { ExtensionData } from \"./ComponentContext\";\nimport { useExtension } from \"./useExtension\";\n\nexport interface ExtensionProps {\n state?: Record<string, any>;\n wrap?(\n slot: React.ReactNode,\n extension: ExtensionData\n ): React.ReactElement<any, any> | null;\n}\n\n/**\n * Represents the position in the DOM where each extension within\n * an extension slot is rendered.\n *\n * Renders once for each extension attached to that extension slot.\n *\n * Usage of this component *must* have an ancestor `<ExtensionSlot>`,\n * and *must* only be used once within that `<ExtensionSlot>`.\n */\nexport const Extension: React.FC<ExtensionProps> = ({ state, wrap }) => {\n const [ref, extension] = useExtension<HTMLDivElement>(state);\n\n // The extension is rendered into the `<slot>`. It is surrounded by a\n // `<div>` with relative positioning in order to allow the UI Editor\n // to absolutely position elements within it.\n const slot = (\n <div\n ref={ref}\n data-extension-id={extension?.extensionId}\n style={{ position: \"relative\" }}\n />\n );\n\n return extension && wrap ? wrap(slot, extension) : slot;\n};\n","import { subscribeTo } from \"@openmrs/esm-state\";\nimport { useEffect, useState } from \"react\";\nimport { Store } from \"unistore\";\n\nexport function useStoreState<T, U>(store: Store<T>, select: (state: T) => U) {\n const [state, setState] = useState<U>(() => select(store.getState()));\n\n useEffect(() => subscribeTo(store, select, setState), [store, select]);\n\n return state;\n}\n","import { useContext, useCallback } from \"react\";\nimport {\n ExtensionSlotConfigObject,\n ExtensionSlotConfigsStore,\n getExtensionSlotsConfigStore,\n} from \"@openmrs/esm-config\";\nimport { ComponentContext } from \"./ComponentContext\";\nimport { useStoreState } from \"./useStoreState\";\n\nconst defaultConfig: ExtensionSlotConfigObject = {\n add: [],\n order: [],\n remove: [],\n};\n\nexport function useExtensionSlotConfig(extensionSlotName: string) {\n const { moduleName } = useContext(ComponentContext);\n const store = getExtensionSlotsConfigStore(moduleName);\n const select = useCallback(\n (s: ExtensionSlotConfigsStore) => s.extensionSlotConfigs[extensionSlotName],\n [extensionSlotName]\n );\n const config = useStoreState(store, select);\n return config || defaultConfig;\n}\n","import { useCallback } from \"react\";\nimport { extensionStore, ExtensionStore } from \"@openmrs/esm-extensions\";\nimport { useStoreState } from \"./useStoreState\";\n\nconst defaultArray: Array<string> = [];\n\n/**\n * Gets the assigned extension ids for the given slot.\n * @param extensionSlotName\n */\nexport function useAttachedExtensionIds(extensionSlotName: string) {\n const select = useCallback(\n (s: ExtensionStore) => s.slots[extensionSlotName]?.attachedIds,\n [extensionSlotName]\n );\n const extensions = useStoreState(extensionStore, select);\n return extensions || defaultArray;\n}\n","import { useEffect, useState } from \"react\";\nimport { getAssignedIds } from \"@openmrs/esm-extensions\";\nimport { useExtensionSlotConfig } from \"./useExtensionSlotConfig\";\nimport { useAttachedExtensionIds } from \"./useAttachedExtensionIds\";\n\n/**\n * Gets the assigned extension ids for a given extension slot name.\n * Does not consider if offline or online.\n * @param extensionSlotName The name of the slot to get the assigned IDs for.\n */\nexport function useAssignedExtensionIds(extensionSlotName: string) {\n const config = useExtensionSlotConfig(extensionSlotName);\n const attachedIds = useAttachedExtensionIds(extensionSlotName);\n const [assignedIds, setAssignedIds] = useState<Array<string>>([]);\n\n useEffect(() => {\n const newAssignedIds = getAssignedIds(\n extensionSlotName,\n config,\n attachedIds\n );\n\n if (newAssignedIds.join(\",\") !== assignedIds.join(\",\")) {\n setAssignedIds(newAssignedIds);\n }\n }, [attachedIds, config]);\n\n return assignedIds;\n}\n","import { subscribeConnectivityChanged } from \"@openmrs/esm-globals\";\nimport { useEffect, useState } from \"react\";\n\nexport function useConnectivity() {\n let [isOnline, setIsOnline] = useState(window.navigator.onLine);\n\n useEffect(\n () => subscribeConnectivityChanged(({ online }) => setIsOnline(online)),\n []\n );\n\n return isOnline;\n}\n","import { useMemo } from \"react\";\nimport {\n checkStatusFor,\n ExtensionMeta,\n ExtensionRegistration,\n extensionStore,\n getExtensionRegistrationFrom,\n} from \"@openmrs/esm-extensions\";\nimport { useAssignedExtensionIds } from \"./useAssignedExtensionIds\";\nimport { useConnectivity } from \"./useConnectivity\";\n\nfunction isValidExtension(\n extension: ConnectedExtension | { id: string }\n): extension is ConnectedExtension {\n return extension.hasOwnProperty(\"name\");\n}\n\n/**\n * We have the following extension modes:\n *\n * - attached (set via code in form of: attach, detach, ...)\n * - configured (set via configuration in form of: added, removed, ...)\n * - assigned (computed from attached and configured)\n * - connected (computed from assigned using connectivity and online / offline)\n */\n\nexport interface ConnectedExtension extends ExtensionRegistration {\n id: string;\n}\n\n/**\n * Gets the assigned extension for a given extension slot name.\n * Considers if offline or online.\n * @param extensionSlotName The name of the slot to get the assigned extensions for.\n */\nexport function useConnectedExtensions(\n extensionSlotName: string\n): Array<ConnectedExtension> {\n const online = useConnectivity();\n const extensionIdsToRender = useAssignedExtensionIds(extensionSlotName);\n\n const extensions = useMemo(() => {\n const state = extensionStore.getState();\n return extensionIdsToRender\n .map((id) => ({ id, ...getExtensionRegistrationFrom(state, id) }))\n .filter(isValidExtension)\n .filter((m) => checkStatusFor(online, m.online, m.offline));\n }, [extensionIdsToRender, online]);\n\n return extensions;\n}\n","import { useContext, useEffect } from \"react\";\nimport {\n registerExtensionSlot,\n unregisterExtensionSlot,\n} from \"@openmrs/esm-extensions\";\nimport { ComponentContext } from \"./ComponentContext\";\nimport { useConnectedExtensions } from \"./useConnectedExtensions\";\n\nexport function useExtensionSlot(extensionSlotName: string) {\n const { moduleName } = useContext(ComponentContext);\n\n if (!moduleName) {\n throw Error(\n \"ComponentContext has not been provided. This should come from @openmrs/esm-react-utils.\"\n );\n }\n\n useEffect(() => {\n registerExtensionSlot(moduleName, extensionSlotName);\n return () => unregisterExtensionSlot(moduleName, extensionSlotName);\n }, []);\n\n const extensions = useConnectedExtensions(extensionSlotName);\n\n return {\n extensions,\n extensionSlotName,\n extensionSlotModuleName: moduleName,\n };\n}\n","import React, { useRef, useMemo } from \"react\";\nimport { ConnectedExtension } from \"./useConnectedExtensions\";\nimport { ComponentContext } from \"./ComponentContext\";\nimport { Extension } from \"./Extension\";\nimport { useExtensionSlot } from \"./useExtensionSlot\";\n\nfunction isShallowEqual(prevDeps: any, nextDeps: any) {\n if (prevDeps === nextDeps) {\n return true;\n }\n\n if (!prevDeps && nextDeps) {\n return false;\n }\n\n if (prevDeps && !nextDeps) {\n return false;\n }\n\n if (typeof prevDeps !== \"object\" || typeof nextDeps !== \"object\") {\n return false;\n }\n\n const prev = Object.keys(prevDeps);\n const next = Object.keys(nextDeps);\n\n if (prev.length !== next.length) {\n return false;\n }\n\n for (let i = 0; i < prev.length; i++) {\n const key = prev[i];\n\n if (!(key in nextDeps) || nextDeps[key] !== prevDeps[key]) {\n return false;\n }\n }\n\n return true;\n}\n\nexport interface ExtensionSlotBaseProps {\n extensionSlotName: string;\n select?: (extensions: Array<ConnectedExtension>) => Array<ConnectedExtension>;\n state?: Record<string, any>;\n}\n\nexport type ExtensionSlotProps = ExtensionSlotBaseProps &\n React.HTMLAttributes<HTMLDivElement>;\n\nfunction defaultSelect(extensions: Array<ConnectedExtension>) {\n return extensions;\n}\n\nexport const ExtensionSlot: React.FC<ExtensionSlotProps> = ({\n extensionSlotName,\n select = defaultSelect,\n children,\n state,\n style,\n ...divProps\n}: ExtensionSlotProps) => {\n const slotRef = useRef(null);\n const { extensions, extensionSlotModuleName } =\n useExtensionSlot(extensionSlotName);\n const stateRef = useRef(state);\n\n if (!isShallowEqual(stateRef.current, state)) {\n stateRef.current = state;\n }\n\n const content = useMemo(\n () =>\n extensionSlotName &&\n select(extensions).map((extension) => (\n <ComponentContext.Provider\n key={extension.id}\n value={{\n moduleName: extension.moduleName,\n extension: {\n extensionId: extension.id,\n extensionSlotName,\n extensionSlotModuleName,\n },\n }}\n >\n {children ?? <Extension state={stateRef.current} />}\n </ComponentContext.Provider>\n )),\n [select, extensions, extensionSlotName, stateRef.current]\n );\n\n return (\n <div\n ref={slotRef}\n data-extension-slot-name={extensionSlotName}\n data-extension-slot-module-name={extensionSlotModuleName}\n style={{ ...style, position: \"relative\" }}\n {...divProps}\n >\n {content}\n </div>\n );\n};\n","function e(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function t(t){for(var n=1;n<arguments.length;n++){var r=null!=arguments[n]?arguments[n]:{};n%2?e(Object(r),!0).forEach((function(e){o(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):e(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}function n(e){return(n=\"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 o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function r(e){return(r=\"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 a(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(r(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(r(e)));return e}}var i=null;try{i=require(\"react\").createContext()}catch(e){}var c={React:null,ReactDOM:null,rootComponent:null,loadRootComponent:null,renderType:null,errorBoundary:null,errorBoundaryClass:null,domElementGetter:null,parcelCanUpdate:!0,suppressComponentDidCatchWarning:!1,domElements:{},renderResults:{},updateResolves:{}};function u(e){if(\"object\"!==n(e))throw new Error(\"single-spa-react requires a configuration object\");var o=t(t({},c),e);if(!o.React)throw new Error(\"single-spa-react must be passed opts.React\");if(!o.ReactDOM)throw new Error(\"single-spa-react must be passed opts.ReactDOM\");if(!o.rootComponent&&!o.loadRootComponent)throw new Error(\"single-spa-react must be passed opts.rootComponent or opts.loadRootComponent\");if(o.errorBoundary&&\"function\"!=typeof o.errorBoundary)throw Error(\"The errorBoundary opt for single-spa-react must either be omitted or be a function that returns React elements\");!i&&o.React.createContext&&(i=o.React.createContext()),o.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}(o);var r={bootstrap:p.bind(null,o),mount:s.bind(null,o),unmount:l.bind(null,o)};return o.parcelCanUpdate&&(r.update=m.bind(null,o)),r}function p(e,t){return e.rootComponent?Promise.resolve():e.loadRootComponent(t).then((function(t){e.rootComponent=t}))}function s(e,t){return new Promise((function(n,o){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.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 r=d(e,t,(function(){n(this)})),i=a(e,t)(),c=function(e){var t=e.opts,n=e.elementToRender,o=e.domElement,r=\"function\"==typeof t.renderType?t.renderType():t.renderType;if([\"createRoot\",\"unstable_createRoot\",\"createBlockingRoot\",\"unstable_createBlockingRoot\"].indexOf(r)>=0){var a=t.ReactDOM[r](o);return a.render(n),a}\"hydrate\"===r?t.ReactDOM.hydrate(n,o):t.ReactDOM.render(n,o);return null}({elementToRender:r,domElement:i,opts:e});e.domElements[t.name]=i,e.renderResults[t.name]=c}))}function l(e,t){return new Promise((function(n){e.unmountFinished=n;var o=e.renderResults[t.name];o&&o.unmount?o.unmount():e.ReactDOM.unmountComponentAtNode(e.domElements[t.name]),delete e.domElements[t.name],delete e.renderResults[t.name]}))}function m(e,t){return new Promise((function(n){e.updateResolves[t.name]||(e.updateResolves[t.name]=[]),e.updateResolves[t.name].push(n);var o=d(e,t,null),r=e.renderResults[t.name];if(r&&r.render)r.render(o);else{var i=a(e,t)();e.ReactDOM.render(o,i)}}))}function d(e,n,o){var r=e.React.createElement(e.rootComponent,n),a=i?e.React.createElement(i.Provider,{value:n},r):r;return(e.errorBoundary||n.errorBoundary||e.errorBoundaryClass||n.errorBoundaryClass)&&(e.errorBoundaryClass=e.errorBoundaryClass||n.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,n),a=e.React.createElement(e.errorBoundaryClass,n,a)),a=e.React.createElement(e.SingleSpaRoot,t(t({},n),{},{mountFinished:o,updateFinished:function(){e.updateResolves[n.name]&&(e.updateResolves[n.name].forEach((function(e){return e()})),delete e.updateResolves[n.name])},unmountFinished:function(){setTimeout(e.unmountFinished)}}),a)}export{i as SingleSpaContext,u as default};\n//# sourceMappingURL=single-spa-react.js.map\n","import React, { useEffect, useRef } from \"react\";\nimport _i18n from \"i18next\";\nimport { I18nextProvider } from \"react-i18next\";\nimport {\n ComponentConfig,\n ComponentContext,\n ExtensionData,\n} from \"./ComponentContext\";\n\nconst i18n = (_i18n as any).default || _i18n;\n\nconst defaultOpts = {\n strictMode: true,\n throwErrorsToConsole: true,\n disableTranslations: false,\n};\n\ninterface I18nextLoadNamespaceProps {\n forceUpdate(): void;\n ns: string;\n}\n\nconst I18nextLoadNamespace: React.FC<I18nextLoadNamespaceProps> = (props) => {\n useEffect(() => {\n i18n.on(\"languageChanged\", props.forceUpdate);\n return () => i18n.off(\"languageChanged\", props.forceUpdate);\n }, [props.forceUpdate]);\n\n const loadNamespaceErrRef = useRef(null);\n\n if (loadNamespaceErrRef.current) {\n throw loadNamespaceErrRef.current;\n }\n\n if (!i18n.hasLoadedNamespace(props.ns)) {\n const timeoutId = setTimeout(() => {\n console.warn(\n `openmrsComponentDecorator: the React suspense promise for i18next.loadNamespaces(['${props.ns}']) did not resolve nor reject after three seconds. This could mean you have multiple versions of i18next and haven't made i18next a webpack external in all projects.`\n );\n }, 3000);\n\n throw i18n\n .loadNamespaces([props.ns])\n .then(() => clearTimeout(timeoutId))\n .catch((err) => {\n clearTimeout(timeoutId);\n loadNamespaceErrRef.current = err;\n });\n }\n\n return <>{props.children}</>;\n};\n\nexport interface ComponentDecoratorOptions {\n moduleName: string;\n featureName: string;\n disableTranslations?: boolean;\n strictMode?: boolean;\n}\n\nexport interface OpenmrsReactComponentProps {\n _extensionContext?: ExtensionData;\n}\n\nexport interface OpenmrsReactComponentState {\n caughtError: any;\n caughtErrorInfo: any;\n config: ComponentConfig;\n}\n\nexport function openmrsComponentDecorator(userOpts: ComponentDecoratorOptions) {\n if (\n typeof userOpts !== \"object\" ||\n typeof userOpts.featureName !== \"string\" ||\n typeof userOpts.moduleName !== \"string\"\n ) {\n throw new Error(\"Invalid options\");\n }\n\n const opts = Object.assign({}, defaultOpts, userOpts);\n\n return function decorateComponent(\n Comp: React.ComponentType\n ): React.ComponentType<any> {\n return class OpenmrsReactComponent extends React.Component<\n OpenmrsReactComponentProps,\n OpenmrsReactComponentState\n > {\n static displayName = `OpenmrsReactComponent(${opts.featureName})`;\n\n constructor(props: OpenmrsReactComponentProps) {\n super(props);\n this.state = {\n caughtError: null,\n caughtErrorInfo: null,\n config: {\n moduleName: opts.moduleName,\n extension: props._extensionContext,\n },\n };\n }\n\n componentDidCatch(err: any, info: any) {\n if (info && info.componentStack) {\n err.extra = Object.assign(err.extra || {}, {\n componentStack: info.componentStack,\n });\n }\n\n if (opts.throwErrorsToConsole) {\n setTimeout(() => {\n throw err;\n });\n }\n\n this.setState({\n caughtError: err,\n caughtErrorInfo: info,\n });\n }\n\n render() {\n if (this.state.caughtError) {\n // TO-DO have a UX designed for when a catastrophic error occurs\n return (\n <div>An error has occurred. Please try reloading the page.</div>\n );\n } else {\n const content = (\n <ComponentContext.Provider value={this.state.config}>\n <React.Suspense fallback={null}>\n {opts.disableTranslations ? (\n <Comp {...this.props} />\n ) : (\n <I18nextLoadNamespace\n ns={opts.moduleName}\n forceUpdate={() => this.forceUpdate()}\n >\n <I18nextProvider i18n={i18n} defaultNS={opts.moduleName}>\n <Comp {...this.props} />\n </I18nextProvider>\n </I18nextLoadNamespace>\n )}\n </React.Suspense>\n </ComponentContext.Provider>\n );\n\n if (opts.strictMode || !React.StrictMode) {\n return content;\n } else {\n return <React.StrictMode>{content}</React.StrictMode>;\n }\n }\n }\n };\n };\n}\n","import React from \"react\";\nimport ReactDOM from \"react-dom\";\nimport singleSpaReact from \"single-spa-react\";\nimport {\n openmrsComponentDecorator,\n ComponentDecoratorOptions,\n} from \"./openmrsComponentDecorator\";\n\nexport function getLifecycle<T>(\n Component: React.ComponentType<T>,\n options: ComponentDecoratorOptions\n) {\n return singleSpaReact({\n React,\n ReactDOM,\n rootComponent: openmrsComponentDecorator(options)(Component),\n });\n}\n\nexport function getAsyncLifecycle<T>(\n lazy: () => Promise<{ default: React.ComponentType<T> }>,\n options: ComponentDecoratorOptions\n) {\n return () =>\n lazy().then(({ default: Component }) => getLifecycle(Component, options));\n}\n\nexport function getSyncLifecycle<T>(\n Component: React.ComponentType<T>,\n options: ComponentDecoratorOptions\n) {\n return () => Promise.resolve(getLifecycle(Component, options));\n}\n\n/**\n * @deprecated Use getAsyncLifecycle instead.\n */\nexport const getAsyncExtensionLifecycle = getAsyncLifecycle;\n","import { useEffect } from \"react\";\n\nexport function useBodyScrollLock(active: boolean) {\n useEffect(() => {\n if (active) {\n const original = window.getComputedStyle(document.body).overflow;\n document.body.style.overflow = \"hidden\";\n return () => {\n document.body.style.overflow = original;\n };\n }\n }, [active]);\n}\n","import { useContext, useEffect, useMemo, useState } from \"react\";\nimport {\n getConfigStore,\n getExtensionConfigStore,\n ConfigStore,\n} from \"@openmrs/esm-config\";\nimport { ComponentContext, ExtensionData } from \"./ComponentContext\";\nimport { ConfigObject } from \"@openmrs/esm-config\";\nimport { Store } from \"unistore\";\n\nconst promises: Record<string, Promise<ConfigObject>> = {};\nconst errorMessage = `No ComponentContext has been provided. This should come from \"openmrsComponentDecorator\".\nUsually this is already applied when using \"getAsyncLifecycle\" or \"getSyncLifecycle\".`;\n\nfunction readInitialConfig(store: Store<ConfigStore> | undefined) {\n if (!store) {\n return undefined;\n } else {\n return () => {\n const state = store.getState();\n\n if (state.loaded && state.config) {\n return state.config;\n }\n\n return undefined;\n };\n }\n}\n\nfunction createConfigPromise(store: Store<ConfigStore>) {\n return new Promise<ConfigObject>((resolve) => {\n const unsubscribe = store.subscribe((state) => {\n if (state.loaded && state.config) {\n resolve(state.config);\n unsubscribe();\n }\n });\n });\n}\n\nfunction useConfigStore(store: Store<ConfigStore> | undefined) {\n const [state, setState] = useState(readInitialConfig(store));\n\n useEffect(() => {\n return store?.subscribe((state) => {\n if (state.loaded && state.config) {\n setState(state.config);\n }\n });\n }, [store]);\n\n return state;\n}\n\nfunction useExtensionConfig(extension: ExtensionData | undefined) {\n const store = useMemo(\n () =>\n extension &&\n getExtensionConfigStore(\n extension.extensionSlotModuleName,\n extension.extensionSlotName,\n extension.extensionId\n ),\n [extension]\n );\n const state = useConfigStore(store);\n\n if (!state && extension) {\n const cacheId = `${extension.extensionSlotModuleName}-${extension.extensionSlotName}-${extension.extensionId}`;\n\n if (!promises[cacheId] && store) {\n promises[cacheId] = createConfigPromise(store);\n }\n\n // React will prevent the client component from rendering until the promise resolves\n throw promises[cacheId];\n }\n\n return state || {};\n}\n\nfunction useNormalConfig(moduleName: string) {\n const store = useMemo(() => getConfigStore(moduleName), [moduleName]);\n const cacheId = moduleName;\n const state = useConfigStore(store);\n\n if (!state) {\n if (!promises[cacheId]) {\n promises[cacheId] = createConfigPromise(store);\n }\n\n // React will prevent the client component from rendering until the promise resolves\n throw promises[cacheId];\n }\n\n return state;\n}\n\n/**\n * Use this React Hook to obtain your module's configuration.\n */\nexport function useConfig() {\n // This hook uses the config of the MF defining the component.\n // If the component is used in an extension slot then the slot\n // may override (part of) its configuration.\n const { moduleName, extension } = useContext(ComponentContext);\n\n if (!moduleName && !extension) {\n throw Error(errorMessage);\n }\n\n const normalConfig = useNormalConfig(moduleName);\n const extensionConfig = useExtensionConfig(extension);\n const config = useMemo(\n () => ({\n ...normalConfig,\n ...extensionConfig,\n }),\n [normalConfig, extensionConfig]\n );\n\n const configNameForDebugMessage = extension\n ? `${extension?.extensionSlotModuleName}-${extension?.extensionSlotName}-${extension?.extensionId}`\n : moduleName;\n return config;\n}\n","import { useEffect, useReducer } from \"react\";\nimport { fetchCurrentPatient, PatientUuid } from \"@openmrs/esm-api\";\n\ntype NullablePatient = fhir.Patient | null;\n\ninterface CurrentPatientState {\n patientUuid: string | null;\n patient: NullablePatient;\n isPendingUuid: boolean;\n isLoadingPatient: boolean;\n err: Error | null;\n}\n\ninterface LoadPatient {\n type: ActionTypes.loadPatient;\n patientUuid: string | null;\n}\n\ninterface NewPatient {\n type: ActionTypes.newPatient;\n patient: NullablePatient;\n}\n\ninterface PatientLoadError {\n type: ActionTypes.loadError;\n err: Error | null;\n}\n\ntype Action = LoadPatient | NewPatient | PatientLoadError;\n\nenum ActionTypes {\n loadPatient = \"loadPatient\",\n newPatient = \"newPatient\",\n loadError = \"patientLoadError\",\n}\n\nconst initialState: CurrentPatientState = {\n patientUuid: null,\n patient: null,\n isPendingUuid: true,\n isLoadingPatient: false,\n err: null,\n};\n\nfunction getPatientUuidFromUrl(): PatientUuid {\n const match = /\\/patient\\/([a-zA-Z0-9\\-]+)\\/?/.exec(location.pathname);\n return match && match[1];\n}\n\nfunction reducer(\n state: CurrentPatientState,\n action: Action\n): CurrentPatientState {\n switch (action.type) {\n case ActionTypes.loadPatient:\n return {\n ...state,\n patientUuid: action.patientUuid,\n patient: null,\n isPendingUuid: false,\n isLoadingPatient: true,\n err: null,\n };\n case ActionTypes.newPatient:\n return {\n ...state,\n patient: action.patient,\n isPendingUuid: false,\n isLoadingPatient: false,\n err: null,\n };\n case ActionTypes.loadError:\n return {\n ...state,\n patient: null,\n isPendingUuid: false,\n isLoadingPatient: false,\n err: action.err,\n };\n default:\n return state;\n }\n}\n\n/**\n * This React hook returns a patient object. If the `patientUuid` is provided\n * as a parameter, then the patient for that UUID is returned. If the parameter\n * is not provided, the patient UUID is obtained from the current route, and\n * a route listener is set up to update the patient whenever the route changes.\n */\nexport function usePatient(patientUuid?: string) {\n const [state, dispatch] = useReducer(reducer, {\n ...initialState,\n patientUuid: patientUuid ?? null,\n isPendingUuid: !patientUuid,\n isLoadingPatient: !!patientUuid,\n });\n\n useEffect(() => {\n if (state.isPendingUuid) {\n const patientUuidFromUrl = getPatientUuidFromUrl();\n if (patientUuidFromUrl) {\n dispatch({\n type: ActionTypes.loadPatient,\n patientUuid: patientUuidFromUrl,\n });\n } else {\n dispatch({ type: ActionTypes.newPatient, patient: null });\n }\n }\n\n let active = true;\n if (state.isLoadingPatient && state.patientUuid) {\n fetchCurrentPatient(state.patientUuid).then(\n (patient) =>\n active &&\n dispatch({\n patient: patient.data,\n type: ActionTypes.newPatient,\n }),\n (err) =>\n active &&\n dispatch({\n err,\n type: ActionTypes.loadError,\n })\n );\n }\n return () => {\n active = false;\n };\n }, [state.isPendingUuid, state.isLoadingPatient, state.patientUuid]);\n\n useEffect(() => {\n const handleRouteUpdate = (evt) => {\n const newPatientUuid = getPatientUuidFromUrl();\n if (newPatientUuid != state.patientUuid) {\n dispatch({\n type: ActionTypes.loadPatient,\n patientUuid: newPatientUuid,\n });\n }\n };\n window.addEventListener(\"single-spa:routing-event\", handleRouteUpdate);\n return () =>\n window.removeEventListener(\"single-spa:routing-event\", handleRouteUpdate);\n }, [state.patientUuid]);\n\n return {\n isLoading: state.isPendingUuid || state.isLoadingPatient,\n patient: state.patient,\n patientUuid: patientUuid ?? state.patientUuid,\n error: state.err,\n };\n}\n","import { useEffect, useReducer } from \"react\";\nimport { fetchCurrentPatient, PatientUuid } from \"@openmrs/esm-api\";\n\ntype NullablePatient = fhir.Patient | null;\n\ninterface CurrentPatientState {\n patient: NullablePatient;\n isLoadingPatient: boolean;\n err: Error | null;\n}\n\ninterface LoadPatient {\n type: ActionTypes.loadPatient;\n}\n\ninterface NewPatient {\n type: ActionTypes.newPatient;\n patient: NullablePatient;\n}\n\ninterface PatientLoadError {\n type: ActionTypes.loadError;\n err: Error | null;\n}\n\ntype Action = LoadPatient | NewPatient | PatientLoadError;\n\nenum ActionTypes {\n loadPatient = \"loadPatient\",\n newPatient = \"newPatient\",\n loadError = \"patientLloadErroroadError\",\n}\n\nconst initialState: CurrentPatientState = {\n patient: null,\n isLoadingPatient: true,\n err: null,\n};\n\nfunction getPatientUuidFromUrl(): PatientUuid {\n const match = /\\/patient\\/([a-zA-Z0-9\\-]+)\\/?/.exec(location.pathname);\n return match && match[1];\n}\n\nfunction reducer(\n state: CurrentPatientState,\n action: Action\n): CurrentPatientState {\n switch (action.type) {\n case ActionTypes.loadPatient:\n return {\n ...state,\n patient: null,\n isLoadingPatient: true,\n err: null,\n };\n case ActionTypes.newPatient:\n return {\n ...state,\n patient: action.patient,\n isLoadingPatient: false,\n err: null,\n };\n case ActionTypes.loadError:\n return {\n ...state,\n patient: null,\n isLoadingPatient: false,\n err: action.err,\n };\n default:\n return state;\n }\n}\n\n/**\n * This React hook returns the current patient, as specified by the current route. It returns\n * all the information needed to render a loading state, error state, and normal/success state.\n *\n * @deprecated Use {@link usePatient} instead.\n */\nexport function useCurrentPatient(\n patientUuid = getPatientUuidFromUrl()\n): [boolean, NullablePatient, PatientUuid, Error | null] {\n const [state, dispatch] = useReducer(reducer, initialState);\n\n useEffect(() => {\n let active = true;\n\n if (patientUuid) {\n fetchCurrentPatient(patientUuid).then(\n (patient) =>\n active &&\n dispatch({\n patient: patient.data,\n type: ActionTypes.newPatient,\n }),\n (err) =>\n active &&\n dispatch({\n err,\n type: ActionTypes.loadError,\n })\n );\n dispatch({ type: ActionTypes.loadPatient });\n } else {\n dispatch({ type: ActionTypes.newPatient, patient: null });\n }\n\n return () => {\n active = false;\n };\n }, [patientUuid]);\n\n return [state.isLoadingPatient, state.patient, patientUuid, state.err];\n}\n","import { ExtensionMeta } from \"@openmrs/esm-extensions\";\nimport { useMemo } from \"react\";\nimport { useConnectedExtensions } from \"./useConnectedExtensions\";\n\n/**\n * Extract meta data from all extension for a given extension slot.\n * @param extensionSlotName\n */\nexport function useExtensionSlotMeta<T = ExtensionMeta>(\n extensionSlotName: string\n) {\n const extensions = useConnectedExtensions(extensionSlotName);\n\n return useMemo(\n () =>\n Object.fromEntries(extensions.map((ext) => [ext.name, ext.meta as T])),\n [extensions]\n );\n}\n","import { ExtensionStore, extensionStore } from \"@openmrs/esm-extensions\";\nimport { createUseStore } from \"./createUseStore\";\n\nexport const useExtensionStore = createUseStore<ExtensionStore>(extensionStore);\n","import { useState, useCallback } from \"react\";\n\nexport function useForceUpdate() {\n const [, setTick] = useState(0);\n const update = useCallback(() => {\n setTick((tick) => tick + 1);\n }, []);\n return update;\n}\n","import { useEffect, useState } from \"react\";\n\nexport type LayoutType = \"tablet\" | \"phone\" | \"desktop\";\n\nfunction getLayout() {\n let layout: LayoutType = \"tablet\";\n\n document.body.classList.forEach((cls) => {\n switch (cls) {\n case \"omrs-breakpoint-lt-tablet\":\n layout = \"phone\";\n break;\n case \"omrs-breakpoint-gt-tablet\":\n layout = \"desktop\";\n break;\n }\n });\n\n return layout;\n}\n\nexport function useLayoutType() {\n const [type, setType] = useState<LayoutType>(getLayout);\n\n useEffect(() => {\n const handler = () => {\n setType(getLayout());\n };\n window.addEventListener(\"resize\", handler);\n return () => window.removeEventListener(\"resize\", handler);\n }, []);\n\n return type;\n}\n","import { getLocations, Location } from \"@openmrs/esm-api\";\nimport { useState, useEffect } from \"react\";\n\nexport function useLocations() {\n const [locations, setLocations] = useState<Array<Location>>([]);\n\n useEffect(() => {\n const locationSub = getLocations().subscribe(\n (locations) => {\n setLocations(locations);\n },\n (error) => {\n console.error(error);\n }\n );\n return () => locationSub.unsubscribe();\n }, []);\n\n return locations;\n}\n","import { useEffect } from \"react\";\nimport {\n NavigationContext,\n pushNavigationContext,\n} from \"@openmrs/esm-extensions\";\n\n/**\n * @deprecated Don't use this anymore.\n */\nexport function useNavigationContext(context: NavigationContext) {\n useEffect(() => pushNavigationContext(context), []);\n}\n","import { useRef, useEffect } from \"react\";\n\nexport function useOnClickOutside<T extends HTMLElement = HTMLElement>(\n handler: (event: Event) => void,\n active = true\n) {\n const ref = useRef<T>(null);\n\n useEffect(() => {\n if (active) {\n const listener = (event: Event) => {\n const el = ref?.current;\n\n if (el?.contains(event.target as Node)) {\n handler(event);\n }\n };\n\n window.addEventListener(`click`, listener);\n return () => window.removeEventListener(`click`, listener);\n }\n }, [handler, active]);\n\n return ref;\n}\n","import React, { useEffect, useState } from \"react\";\nimport { getCurrentUser, userHasAccess, LoggedInUser } from \"@openmrs/esm-api\";\n\nexport interface UserHasAccessProps {\n privilege: string;\n}\n\nexport const UserHasAccess: React.FC<UserHasAccessProps> = ({\n privilege,\n children,\n}) => {\n const [user, setUser] = useState<LoggedInUser | null>(null);\n\n useEffect(() => {\n const subscription = getCurrentUser({\n includeAuthStatus: false,\n }).subscribe(setUser);\n return () => subscription.unsubscribe();\n }, []);\n\n if (user && userHasAccess(privilege, user)) {\n return <>{children}</>;\n }\n\n return null;\n};\n","import { openmrsObservableFetch, SessionUser } from \"@openmrs/esm-api\";\nimport { useState, useEffect } from \"react\";\n\nexport function useSessionUser() {\n const [sessionUser, setSessionUser] = useState<SessionUser | null>(null);\n\n useEffect(() => {\n if (sessionUser === null) {\n const sub = openmrsObservableFetch(\"/ws/rest/v1/session\").subscribe(\n (user: any) => {\n setSessionUser(user.data);\n }\n );\n\n return () => sub.unsubscribe();\n }\n }, [sessionUser]);\n\n return sessionUser;\n}\n","import { Store } from \"unistore\";\nimport { Actions, BoundActions, createUseStore } from \"./createUseStore\";\n\nexport function useStore<T>(store: Store<T>): T;\nexport function useStore<T>(\n store: Store<T>,\n actions: Actions\n): T & BoundActions;\nexport function useStore<T>(store: Store<T>, actions?: Actions) {\n return createUseStore<T>(store)(actions);\n}\n","import { useState, useEffect } from \"react\";\nimport dayjs from \"dayjs\";\nimport {\n getVisitsForPatient,\n getStartedVisit,\n VisitMode,\n VisitStatus,\n Visit,\n} from \"@openmrs/esm-api\";\n\nexport function useVisit(patientUuid: string) {\n const [currentVisit, setCurrentVisit] = useState<Visit | null>(null);\n const [error, setError] = useState(null);\n\n useEffect(() => {\n const sub = getStartedVisit.subscribe((visit) => {\n if (visit) {\n setCurrentVisit(visit?.visitData ?? null);\n } else {\n setCurrentVisit(null);\n }\n });\n\n return () => sub.unsubscribe();\n }, [patientUuid]);\n\n useEffect(() => {\n const abortController = new AbortController();\n const sub = getVisitsForPatient(patientUuid, abortController).subscribe(\n ({ data }) => {\n const currentVisit = data.results.find(\n (visit) => visit.stopDatetime === null\n );\n\n if (currentVisit) {\n getStartedVisit.next({\n mode: VisitMode.LOADING,\n visitData: currentVisit,\n status: VisitStatus.ONGOING,\n });\n }\n },\n setError\n );\n return () => sub && sub.unsubscribe();\n }, [patientUuid]);\n\n return { currentVisit, error };\n}\n","import { getVisitTypes, VisitType } from \"@openmrs/esm-api\";\nimport { useEffect, useState } from \"react\";\n\nexport function useVisitTypes() {\n const [visitTypes, setVisitTypes] = useState<Array<VisitType>>([]);\n\n useEffect(() => {\n const visitTypesSub = getVisitTypes().subscribe(\n (visitTypes) => {\n setVisitTypes(visitTypes);\n },\n (error) => console.error(error)\n );\n\n return () => visitTypesSub.unsubscribe();\n }, []);\n\n return visitTypes;\n}\n","import { useMemo, useState } from \"react\";\n\nconst defaultResultsPerPage = 10;\n\nexport function usePagination<T>(\n data: Array<T> = [],\n resultsPerPage = defaultResultsPerPage\n) {\n const [page, setPage] = useState(1);\n const totalPages = useMemo(\n () => Math.max(1, Math.ceil(data.length / resultsPerPage)),\n [data.length, resultsPerPage]\n );\n const results = useMemo(() => {\n const lowerBound = (page - 1) * resultsPerPage;\n const upperBound = (page + 0) * resultsPerPage;\n return data.slice(lowerBound, upperBound);\n }, [data, page, resultsPerPage]);\n\n return {\n results,\n totalPages,\n currentPage: page,\n paginated: data.length > resultsPerPage,\n showNextButton: page < totalPages,\n showPreviousButton: page > 1,\n goTo(page: number) {\n setPage(Math.max(1, Math.min(totalPages, page)));\n },\n goToNext() {\n if (page < totalPages) {\n setPage(page + 1);\n }\n },\n goToPrevious() {\n if (page > 1) {\n setPage(page - 1);\n }\n },\n };\n}\n"],"names":["resolveDirectory","r","exports","s","rootDirLevel","meta","url","console","error","Error","R","urlString","rootDirectoryLevel","a","document","createElement","href","pathname","numDirsProcessed","index","length","finalPath","slice","protocol","host","Number","isInteger","__webpack_module_cache__","__webpack_require__","moduleId","cachedModule","module","__webpack_modules__","y","__system_context__","d","definition","key","o","Object","defineProperty","enumerable","get","g","globalThis","this","Function","e","window","obj","prop","prototype","hasOwnProperty","call","Symbol","toStringTag","value","scriptUrl","importScripts","location","currentScript","src","scripts","getElementsByTagName","replace","p","n","t","u","push","f","i","action","arguments","apply","then","setState","subscribe","unsubscribe","getState","availableStores","createGlobalStore","name","initialState","available","active","store","createStore","getGlobalStore","fallbackState","createAppState","getAppState","subscribeTo","select","handle","previous","state","current","update","property","restPropertyPath","__WEBPACK_EXTERNAL_MODULE__766__","__WEBPACK_EXTERNAL_MODULE__824__","__WEBPACK_EXTERNAL_MODULE__45__","__WEBPACK_EXTERNAL_MODULE__728__","__WEBPACK_EXTERNAL_MODULE__64__","__WEBPACK_EXTERNAL_MODULE__954__","__WEBPACK_EXTERNAL_MODULE__493__","__WEBPACK_EXTERNAL_MODULE__281__","undefined","autoPublicPath","ComponentContext","React","moduleName","ConfigurableLink","to","children","otherProps","onClick","event","metaKey","ctrlKey","shiftKey","button","preventDefault","navigate","handleClick","interpolateUrl","createUseStore","actions","set","useState","useEffect","boundActions","useMemo","bound","bindActions","useExtension","ref","useRef","extension","useContext","renderExtension","extensionSlotName","extensionSlotModuleName","extensionId","Extension","wrap","slot","style","position","useStoreState","defaultConfig","add","order","remove","useExtensionSlotConfig","getExtensionSlotsConfigStore","useCallback","extensionSlotConfigs","defaultArray","useAttachedExtensionIds","slots","attachedIds","extensionStore","useAssignedExtensionIds","config","assignedIds","setAssignedIds","newAssignedIds","getAssignedIds","join","useConnectivity","isOnline","setIsOnline","navigator","onLine","subscribeConnectivityChanged","online","isValidExtension","useConnectedExtensions","extensionIdsToRender","extensions","map","id","getExtensionRegistrationFrom","filter","m","checkStatusFor","offline","useExtensionSlot","registerExtensionSlot","unregisterExtensionSlot","defaultSelect","ExtensionSlot","divProps","slotRef","stateRef","prevDeps","nextDeps","prev","keys","next","isShallowEqual","content","Provider","getOwnPropertySymbols","getOwnPropertyDescriptor","forEach","getOwnPropertyDescriptors","defineProperties","iterator","constructor","configurable","writable","domElement","domElementGetter","appName","concat","getElementById","body","appendChild","HTMLElement","require","createContext","c","ReactDOM","rootComponent","loadRootComponent","renderType","errorBoundary","errorBoundaryClass","parcelCanUpdate","suppressComponentDidCatchWarning","domElements","renderResults","updateResolves","SingleSpaRoot","displayName","create","Component","componentDidMount","setTimeout","props","mountFinished","componentWillUnmount","unmountFinished","render","updateFinished","bootstrap","bind","mount","unmount","l","Promise","resolve","version","indexOf","componentDidCatch","warn","childAppName","opts","elementToRender","hydrate","unmountComponentAtNode","caughtError","caughtErrorInfo","i18n","_i18n","defaultOpts","strictMode","throwErrorsToConsole","disableTranslations","I18nextLoadNamespace","on","forceUpdate","off","loadNamespaceErrRef","hasLoadedNamespace","ns","timeoutId","loadNamespaces","clearTimeout","catch","err","openmrsComponentDecorator","userOpts","featureName","assign","Comp","super","_extensionContext","info","componentStack","extra","fallback","I18nextProvider","defaultNS","getLifecycle","options","singleSpaReact","getAsyncLifecycle","lazy","default","getSyncLifecycle","getAsyncExtensionLifecycle","useBodyScrollLock","original","getComputedStyle","overflow","promises","createConfigPromise","loaded","useConfigStore","readInitialConfig","useConfig","normalConfig","getConfigStore","cacheId","useNormalConfig","extensionConfig","getExtensionConfigStore","useExtensionConfig","ActionTypes","patientUuid","patient","isPendingUuid","isLoadingPatient","getPatientUuidFromUrl","match","exec","reducer","type","loadPatient","newPatient","loadError","usePatient","dispatch","useReducer","patientUuidFromUrl","fetchCurrentPatient","data","handleRouteUpdate","evt","newPatientUuid","addEventListener","removeEventListener","isLoading","useCurrentPatient","useExtensionSlotMeta","fromEntries","ext","useExtensionStore","useForceUpdate","setTick","tick","getLayout","layout","classList","cls","useLayoutType","setType","handler","useLocations","locations","setLocations","locationSub","getLocations","useNavigationContext","context","pushNavigationContext","useOnClickOutside","listener","el","contains","target","UserHasAccess","privilege","user","setUser","subscription","getCurrentUser","includeAuthStatus","userHasAccess","useSessionUser","sessionUser","setSessionUser","sub","openmrsObservableFetch","useStore","useVisit","currentVisit","setCurrentVisit","setError","getStartedVisit","visit","visitData","abortController","AbortController","getVisitsForPatient","results","find","stopDatetime","mode","VisitMode","status","VisitStatus","useVisitTypes","visitTypes","setVisitTypes","visitTypesSub","getVisitTypes","usePagination","resultsPerPage","page","setPage","totalPages","Math","max","ceil","lowerBound","upperBound","currentPage","paginated","showNextButton","showPreviousButton","goTo","min","goToNext","goToPrevious"],"sourceRoot":""}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openmrs/esm-react-utils",
3
- "version": "3.2.1-pre.946",
3
+ "version": "3.2.1-pre.947",
4
4
  "license": "MPL-2.0",
5
5
  "description": "React utilities for OpenMRS.",
6
6
  "browser": "dist/openmrs-esm-react-utils.js",
@@ -53,11 +53,11 @@
53
53
  "react-i18next": "11.x"
54
54
  },
55
55
  "devDependencies": {
56
- "@openmrs/esm-api": "^3.2.1-pre.946",
57
- "@openmrs/esm-config": "^3.2.1-pre.946",
58
- "@openmrs/esm-error-handling": "^3.2.1-pre.946",
59
- "@openmrs/esm-extensions": "^3.2.1-pre.946",
60
- "@openmrs/esm-globals": "^3.2.1-pre.946",
56
+ "@openmrs/esm-api": "^3.2.1-pre.947",
57
+ "@openmrs/esm-config": "^3.2.1-pre.947",
58
+ "@openmrs/esm-error-handling": "^3.2.1-pre.947",
59
+ "@openmrs/esm-extensions": "^3.2.1-pre.947",
60
+ "@openmrs/esm-globals": "^3.2.1-pre.947",
61
61
  "i18next": "^19.6.0",
62
62
  "react": "^16.13.1",
63
63
  "react-dom": "^16.13.1",
@@ -65,5 +65,5 @@
65
65
  "rxjs": "^6.5.3",
66
66
  "unistore": "^3.5.2"
67
67
  },
68
- "gitHead": "4f6d1ec5a68fbed4a0b902462b76281a5c35bcc6"
68
+ "gitHead": "e5c5960b2ee64d1e3820c3bd9421809253b8f7a5"
69
69
  }
package/src/usePatient.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { useEffect, useMemo, useReducer } from "react";
1
+ import { useEffect, useReducer } from "react";
2
2
  import { fetchCurrentPatient, PatientUuid } from "@openmrs/esm-api";
3
3
 
4
4
  type NullablePatient = fhir.Patient | null;
@@ -6,6 +6,7 @@ type NullablePatient = fhir.Patient | null;
6
6
  interface CurrentPatientState {
7
7
  patientUuid: string | null;
8
8
  patient: NullablePatient;
9
+ isPendingUuid: boolean;
9
10
  isLoadingPatient: boolean;
10
11
  err: Error | null;
11
12
  }
@@ -36,7 +37,8 @@ enum ActionTypes {
36
37
  const initialState: CurrentPatientState = {
37
38
  patientUuid: null,
38
39
  patient: null,
39
- isLoadingPatient: true,
40
+ isPendingUuid: true,
41
+ isLoadingPatient: false,
40
42
  err: null,
41
43
  };
42
44
 
@@ -55,6 +57,7 @@ function reducer(
55
57
  ...state,
56
58
  patientUuid: action.patientUuid,
57
59
  patient: null,
60
+ isPendingUuid: false,
58
61
  isLoadingPatient: true,
59
62
  err: null,
60
63
  };
@@ -62,6 +65,7 @@ function reducer(
62
65
  return {
63
66
  ...state,
64
67
  patient: action.patient,
68
+ isPendingUuid: false,
65
69
  isLoadingPatient: false,
66
70
  err: null,
67
71
  };
@@ -69,6 +73,7 @@ function reducer(
69
73
  return {
70
74
  ...state,
71
75
  patient: null,
76
+ isPendingUuid: false,
72
77
  isLoadingPatient: false,
73
78
  err: action.err,
74
79
  };
@@ -87,15 +92,12 @@ export function usePatient(patientUuid?: string) {
87
92
  const [state, dispatch] = useReducer(reducer, {
88
93
  ...initialState,
89
94
  patientUuid: patientUuid ?? null,
95
+ isPendingUuid: !patientUuid,
96
+ isLoadingPatient: !!patientUuid,
90
97
  });
91
98
 
92
99
  useEffect(() => {
93
- if (state.patientUuid) {
94
- dispatch({
95
- type: ActionTypes.loadPatient,
96
- patientUuid: state.patientUuid,
97
- });
98
- } else {
100
+ if (state.isPendingUuid) {
99
101
  const patientUuidFromUrl = getPatientUuidFromUrl();
100
102
  if (patientUuidFromUrl) {
101
103
  dispatch({
@@ -106,9 +108,7 @@ export function usePatient(patientUuid?: string) {
106
108
  dispatch({ type: ActionTypes.newPatient, patient: null });
107
109
  }
108
110
  }
109
- }, [state.patientUuid]);
110
111
 
111
- useEffect(() => {
112
112
  let active = true;
113
113
  if (state.isLoadingPatient && state.patientUuid) {
114
114
  fetchCurrentPatient(state.patientUuid).then(
@@ -129,7 +129,7 @@ export function usePatient(patientUuid?: string) {
129
129
  return () => {
130
130
  active = false;
131
131
  };
132
- }, [state.isLoadingPatient, state.patientUuid]);
132
+ }, [state.isPendingUuid, state.isLoadingPatient, state.patientUuid]);
133
133
 
134
134
  useEffect(() => {
135
135
  const handleRouteUpdate = (evt) => {
@@ -144,10 +144,10 @@ export function usePatient(patientUuid?: string) {
144
144
  window.addEventListener("single-spa:routing-event", handleRouteUpdate);
145
145
  return () =>
146
146
  window.removeEventListener("single-spa:routing-event", handleRouteUpdate);
147
- }, []);
147
+ }, [state.patientUuid]);
148
148
 
149
149
  return {
150
- isLoading: state.isLoadingPatient,
150
+ isLoading: state.isPendingUuid || state.isLoadingPatient,
151
151
  patient: state.patient,
152
152
  patientUuid: patientUuid ?? state.patientUuid,
153
153
  error: state.err,