@icap-ethiopia/esm-ethiohri-phrh
Version:
An OpenMRS seed application for building microfrontends
2 lines • 14.9 kB
JavaScript
/*! For license information please see 666.js.LICENSE.txt */
;(globalThis.webpackChunk_icap_ethiopia_esm_ethiohri_phrh=globalThis.webpackChunk_icap_ethiopia_esm_ethiohri_phrh||[]).push([[666],{1063:(e,t,n)=>{var r=n(6072),o="function"==typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e==1/t)||e!=e&&t!=t},a=r.useState,i=r.useEffect,s=r.useLayoutEffect,u=r.useDebugValue;function c(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!o(e,n)}catch(e){return!0}}var l="undefined"==typeof window||void 0===window.document||void 0===window.document.createElement?function(e,t){return t()}:function(e,t){var n=t(),r=a({inst:{value:n,getSnapshot:t}}),o=r[0].inst,l=r[1];return s((function(){o.value=n,o.getSnapshot=t,c(o)&&l({inst:o})}),[e,n,t]),i((function(){return c(o)&&l({inst:o}),e((function(){c(o)&&l({inst:o})}))}),[e]),u(n),n};t.useSyncExternalStore=void 0!==r.useSyncExternalStore?r.useSyncExternalStore:l},3930:e=>{e.exports=function(e){var t=document.createElement("style");return e.setAttributes(t,e.attributes),e.insert(t,e.options),t}},4079:e=>{e.exports=function(e,t){if(t.styleSheet)t.styleSheet.cssText=e;else{for(;t.firstChild;)t.removeChild(t.firstChild);t.appendChild(document.createTextNode(e))}}},4583:e=>{e.exports=function(e){var t=e.insertStyleElement(e);return{update:function(n){!function(e,t,n){var r="";n.supports&&(r+="@supports (".concat(n.supports,") {")),n.media&&(r+="@media ".concat(n.media," {"));var o=void 0!==n.layer;o&&(r+="@layer".concat(n.layer.length>0?" ".concat(n.layer):""," {")),r+=n.css,o&&(r+="}"),n.media&&(r+="}"),n.supports&&(r+="}");var a=n.sourceMap;a&&"undefined"!=typeof btoa&&(r+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(a))))," */")),t.styleTagTransform(r,e,t.options)}(t,e,n)},remove:function(){!function(e){if(null===e.parentNode)return!1;e.parentNode.removeChild(e)}(t)}}}},4993:(e,t,n)=>{n.d(t,{BE:()=>Z,Es:()=>V,Ht:()=>Y,Tk:()=>q,Tn:()=>u,X3:()=>C,ZH:()=>a,aw:()=>Q,b0:()=>s,bZ:()=>h,bu:()=>M,dO:()=>O,iX:()=>K,lK:()=>x,lg:()=>N,mF:()=>F,mf:()=>L,qm:()=>G,qv:()=>i,r9:()=>E,rL:()=>c,sb:()=>W});var r=n(6072);const o=()=>{},a=o(),i=Object,s=e=>e===a,u=e=>"function"==typeof e,c=(e,t)=>({...e,...t}),l=e=>u(e.then),f=new WeakMap;let d=0;const p=e=>{const t=typeof e,n=e&&e.constructor,r=n==Date;let o,a;if(i(e)!==e||r||n==RegExp)o=r?e.toJSON():"symbol"==t?e.toString():"string"==t?JSON.stringify(e):""+e;else{if(o=f.get(e),o)return o;if(o=++d+"~",f.set(e,o),n==Array){for(o="@",a=0;a<e.length;a++)o+=p(e[a])+",";f.set(e,o)}if(n==i){o="#";const t=i.keys(e).sort();for(;!s(a=t.pop());)s(e[a])||(o+=a+":"+p(e[a])+",");f.set(e,o)}}return o},h=new WeakMap,v={},b={},g="undefined",m=typeof window!=g,y=typeof document!=g,E=(e,t)=>{const n=h.get(e);return[()=>!s(t)&&e.get(t)||v,r=>{if(!s(t)){const o=e.get(t);t in b||(b[t]=o),n[5](t,c(o,r),o||v)}},n[6],()=>!s(t)&&t in b?b[t]:!s(t)&&e.get(t)||v]};let w=!0;const[_,T]=m&&window.addEventListener?[window.addEventListener.bind(window),window.removeEventListener.bind(window)]:[o,o],R={isOnline:()=>w,isVisible:()=>{const e=y&&document.visibilityState;return s(e)||"hidden"!==e}},S={initFocus:e=>(y&&document.addEventListener("visibilitychange",e),_("focus",e),()=>{y&&document.removeEventListener("visibilitychange",e),T("focus",e)}),initReconnect:e=>{const t=()=>{w=!0,e()},n=()=>{w=!1};return _("online",t),_("offline",n),()=>{T("online",t),T("offline",n)}}},O=!r.useId,C=!m||"Deno"in window,L=e=>m&&typeof window.requestAnimationFrame!=g?window.requestAnimationFrame(e):setTimeout(e,1),V=C?r.useEffect:r.useLayoutEffect,k="undefined"!=typeof navigator&&navigator.connection,A=!C&&k&&(["slow-2g","2g"].includes(k.effectiveType)||k.saveData),x=e=>{if(u(e))try{e=e()}catch(t){e=""}const t=e;return[e="string"==typeof e?e:(Array.isArray(e)?e.length:e)?p(e):"",t]};let I=0;const N=()=>++I,D=2;var M={__proto__:null,ERROR_REVALIDATE_EVENT:3,FOCUS_EVENT:0,MUTATE_EVENT:D,RECONNECT_EVENT:1};async function F(...e){const[t,n,r,o]=e,i=c({populateCache:!0,throwOnError:!0},"boolean"==typeof o?{revalidate:o}:o||{});let f=i.populateCache;const d=i.rollbackOnError;let p=i.optimisticData;const v=i.throwOnError;if(u(n)){const e=n,r=[],o=t.keys();for(const n of o)!/^\$(inf|sub)\$/.test(n)&&e(t.get(n)._k)&&r.push(n);return Promise.all(r.map(b))}return b(n);async function b(n){const[o]=x(n);if(!o)return;const[c,b]=E(t,o),[g,m,y,w]=h.get(t),_=()=>{const e=g[o];return(u(i.revalidate)?i.revalidate(c().data,n):!1!==i.revalidate)&&(delete y[o],delete w[o],e&&e[0])?e[0](D).then((()=>c().data)):c().data};if(e.length<3)return _();let T,R=r;const S=N();m[o]=[S,0];const O=!s(p),C=c(),L=C.data,V=C._c,k=s(V)?L:V;if(O&&(p=u(p)?p(k,L):p,b({data:p,_c:k})),u(R))try{R=R(k)}catch(e){T=e}if(R&&l(R)){if(R=await R.catch((e=>{T=e})),S!==m[o][0]){if(T)throw T;return R}T&&O&&(e=>"function"==typeof d?d(e):!1!==d)(T)&&(f=!0,b({data:k,_c:a}))}if(f&&!T)if(u(f)){const e=f(R,k);b({data:e,error:a,_c:a})}else b({data:R,error:a,_c:a});if(m[o][1]=N(),Promise.resolve(_()).then((()=>{b({_c:a})})),!T)return R;if(v)throw T}}const j=(e,t)=>{for(const n in e)e[n][0]&&e[n][0](t)},U=(e,t)=>{if(!h.has(e)){const n=c(S,t),r={},i=F.bind(a,e);let s=o;const u={},l=(e,t)=>{const n=u[e]||[];return u[e]=n,n.push(t),()=>n.splice(n.indexOf(t),1)},f=(t,n,r)=>{e.set(t,n);const o=u[t];if(o)for(const e of o)e(n,r)},d=()=>{if(!h.has(e)&&(h.set(e,[r,{},{},{},i,f,l]),!C)){const t=n.initFocus(setTimeout.bind(a,j.bind(a,r,0))),o=n.initReconnect(setTimeout.bind(a,j.bind(a,r,1)));s=()=>{t&&t(),o&&o(),h.delete(e)}}};return d(),[e,i,d,s]}return[e,h.get(e)[4]]},[P,q]=U(new Map),W=c({onLoadingSlow:o,onSuccess:o,onError:o,onErrorRetry:(e,t,n,r,o)=>{const a=n.errorRetryCount,i=o.retryCount,u=~~((Math.random()+.5)*(1<<(i<8?i:8)))*n.errorRetryInterval;!s(a)&&i>a||setTimeout(r,u,o)},onDiscarded:o,revalidateOnFocus:!0,revalidateOnReconnect:!0,revalidateIfStale:!0,shouldRetryOnError:!0,errorRetryInterval:A?1e4:5e3,focusThrottleInterval:5e3,dedupingInterval:2e3,loadingTimeout:A?5e3:3e3,compare:(e,t)=>p(e)==p(t),isPaused:()=>!1,cache:P,mutate:q,fallback:{}},R),H=(e,t)=>{const n=c(e,t);if(t){const{use:r,fallback:o}=e,{use:a,fallback:i}=t;r&&a&&(n.use=r.concat(a)),o&&i&&(n.fallback=c(o,i))}return n},X=(0,r.createContext)({}),Z=e=>{const{value:t}=e,n=(0,r.useContext)(X),o=u(t),i=(0,r.useMemo)((()=>o?t(n):t),[o,n,t]),s=(0,r.useMemo)((()=>o?i:H(n,i)),[o,n,i]),l=i&&i.provider,f=(0,r.useRef)(a);l&&!f.current&&(f.current=U(l(s.cache||P),i));const d=f.current;return d&&(s.cache=d[0],s.mutate=d[1]),V((()=>{if(d)return d[2]&&d[2](),d[3]}),[]),(0,r.createElement)(X.Provider,c(e,{value:s}))},$=m&&window.__SWR_DEVTOOLS_USE__,J=$?window.__SWR_DEVTOOLS_USE__:[],B=e=>u(e[1])?[e[0],e[1],e[2]||{}]:[e[0],null,(null===e[1]?e[2]:e[1])||{}],K=()=>c(W,(0,r.useContext)(X)),z=J.concat((e=>(t,n,r)=>e(t,n&&((...e)=>{const[r]=x(t),[,,,o]=h.get(P);if(r.startsWith("$inf$"))return n(...e);const a=o[r];return s(a)?n(...e):(delete o[r],a)}),r))),G=e=>function(...t){const n=K(),[r,o,a]=B(t),i=H(n,a);let s=e;const{use:u}=i,c=(u||[]).concat(z);for(let e=c.length;e--;)s=c[e](s);return s(r,o||i.fetcher||null,i)},Q=(e,t,n)=>{const r=t[e]||(t[e]=[]);return r.push(n),()=>{const e=r.indexOf(n);e>=0&&(r[e]=r[r.length-1],r.pop())}},Y=(e,t)=>(...n)=>{const[r,o,a]=B(n),i=(a.use||[]).concat(t);return e(r,o,{...a,use:i})};$&&(window.__SWR_DEVTOOLS_REACT__=r)},5037:e=>{function t(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}e.exports=function(e){var n,r,o=(r=4,function(e){if(Array.isArray(e))return e}(n=e)||function(e,t){var n=e&&("undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"]);if(null!=n){var r,o,a=[],i=!0,s=!1;try{for(n=n.call(e);!(i=(r=n.next()).done)&&(a.push(r.value),!t||a.length!==t);i=!0);}catch(e){s=!0,o=e}finally{try{i||null==n.return||n.return()}finally{if(s)throw o}}return a}}(n,r)||function(e,n){if(e){if("string"==typeof e)return t(e,n);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?t(e,n):void 0}}(n,r)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),a=o[1],i=o[3];if(!i)return a;if("function"==typeof btoa){var s=btoa(unescape(encodeURIComponent(JSON.stringify(i)))),u="sourceMappingURL=data:application/json;charset=utf-8;base64,".concat(s),c="/*# ".concat(u," */"),l=i.sources.map((function(e){return"/*# sourceURL=".concat(i.sourceRoot||"").concat(e," */")}));return[a].concat(l).concat([c]).join("\n")}return[a].join("\n")}},5720:e=>{e.exports=function(e){var t=[];return t.toString=function(){return this.map((function(t){var n=e(t);return t[2]?"@media ".concat(t[2]," {").concat(n,"}"):n})).join("")},t.i=function(e,n,r){"string"==typeof e&&(e=[[null,e,""]]);var o={};if(r)for(var a=0;a<this.length;a++){var i=this[a][0];null!=i&&(o[i]=!0)}for(var s=0;s<e.length;s++){var u=[].concat(e[s]);r&&o[u[0]]||(n&&(u[2]?u[2]="".concat(n," and ").concat(u[2]):u[2]=n),t.push(u))}},t}},6765:e=>{var t={};e.exports=function(e,n){var r=function(e){if(void 0===t[e]){var n=document.querySelector(e);if(window.HTMLIFrameElement&&n instanceof window.HTMLIFrameElement)try{n=n.contentDocument.head}catch(e){n=null}t[e]=n}return t[e]}(e);if(!r)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");r.appendChild(n)}},7710:e=>{var t=[];function n(e){for(var n=-1,r=0;r<t.length;r++)if(t[r].identifier===e){n=r;break}return n}function r(e,r){for(var a={},i=[],s=0;s<e.length;s++){var u=e[s],c=r.base?u[0]+r.base:u[0],l=a[c]||0,f="".concat(c," ").concat(l);a[c]=l+1;var d=n(f),p={css:u[1],media:u[2],sourceMap:u[3],supports:u[4],layer:u[5]};if(-1!==d)t[d].references++,t[d].updater(p);else{var h=o(p,r);r.byIndex=s,t.splice(s,0,{identifier:f,updater:h,references:1})}i.push(f)}return i}function o(e,t){var n=t.domAPI(t);return n.update(e),function(t){if(t){if(t.css===e.css&&t.media===e.media&&t.sourceMap===e.sourceMap&&t.supports===e.supports&&t.layer===e.layer)return;n.update(e=t)}else n.remove()}}e.exports=function(e,o){var a=r(e=e||[],o=o||{});return function(e){e=e||[];for(var i=0;i<a.length;i++){var s=n(a[i]);t[s].references--}for(var u=r(e,o),c=0;c<a.length;c++){var l=n(a[c]);0===t[l].references&&(t[l].updater(),t.splice(l,1))}a=u}}},8206:(e,t,n)=>{e.exports=function(e){var t=n.nc;t&&e.setAttribute("nonce",t)}},9324:(e,t,n)=>{n.d(t,{Ay:()=>u,Tk:()=>a.Tk,iX:()=>a.iX});var r=n(6072),o=n(9888),a=n(4993);const i=r.use||(e=>{if("pending"===e.status)throw e;if("fulfilled"===e.status)return e.value;throw"rejected"===e.status?e.reason:(e.status="pending",e.then((t=>{e.status="fulfilled",e.value=t}),(t=>{e.status="rejected",e.reason=t})),e)}),s={dedupe:!0},u=(a.qv.defineProperty(a.BE,"defaultValue",{value:a.sb}),(0,a.qm)(((e,t,n)=>{const{cache:u,compare:c,suspense:l,fallbackData:f,revalidateOnMount:d,revalidateIfStale:p,refreshInterval:h,refreshWhenHidden:v,refreshWhenOffline:b,keepPreviousData:g}=n,[m,y,E,w]=a.bZ.get(u),[_,T]=(0,a.lK)(e),R=(0,r.useRef)(!1),S=(0,r.useRef)(!1),O=(0,r.useRef)(_),C=(0,r.useRef)(t),L=(0,r.useRef)(n),V=()=>L.current,k=()=>V().isVisible()&&V().isOnline(),[A,x,I,N]=(0,a.r9)(u,_),D=(0,r.useRef)({}).current,M=(0,a.b0)(f)?n.fallback[_]:f,F=(e,t)=>{for(const n in D){const r=n;if("data"===r){if(!c(e[r],t[r])){if(!(0,a.b0)(e[r]))return!1;if(!c($,t[r]))return!1}}else if(t[r]!==e[r])return!1}return!0},j=(0,r.useMemo)((()=>{const e=!!_&&!!t&&((0,a.b0)(d)?!V().isPaused()&&!l&&(!!(0,a.b0)(p)||p):d),n=t=>{const n=(0,a.rL)(t);return delete n._k,e?{isValidating:!0,isLoading:!0,...n}:n},r=A(),o=N(),i=n(r),s=r===o?i:n(o);let u=i;return[()=>{const e=n(A());return F(e,u)?(u.data=e.data,u.isLoading=e.isLoading,u.isValidating=e.isValidating,u.error=e.error,u):(u=e,e)},()=>s]}),[u,_]),U=(0,o.useSyncExternalStore)((0,r.useCallback)((e=>I(_,((t,n)=>{F(n,t)||e()}))),[u,_]),j[0],j[1]),P=!R.current,q=m[_]&&m[_].length>0,W=U.data,H=(0,a.b0)(W)?M:W,X=U.error,Z=(0,r.useRef)(H),$=g?(0,a.b0)(W)?Z.current:W:H,J=!(q&&!(0,a.b0)(X))&&(P&&!(0,a.b0)(d)?d:!V().isPaused()&&(l?!(0,a.b0)(H)&&p:(0,a.b0)(H)||p)),B=!!(_&&t&&P&&J),K=(0,a.b0)(U.isValidating)?B:U.isValidating,z=(0,a.b0)(U.isLoading)?B:U.isLoading,G=(0,r.useCallback)((async e=>{const t=C.current;if(!_||!t||S.current||V().isPaused())return!1;let r,o,i=!0;const s=e||{},u=!E[_]||!s.dedupe,l=()=>a.dO?!S.current&&_===O.current&&R.current:_===O.current,f={isValidating:!1,isLoading:!1},d=()=>{x(f)},p=()=>{const e=E[_];e&&e[1]===o&&delete E[_]},h={isValidating:!0};(0,a.b0)(A().data)&&(h.isLoading=!0);try{if(u&&(x(h),n.loadingTimeout&&(0,a.b0)(A().data)&&setTimeout((()=>{i&&l()&&V().onLoadingSlow(_,n)}),n.loadingTimeout),E[_]=[t(T),(0,a.lg)()]),[r,o]=E[_],r=await r,u&&setTimeout(p,n.dedupingInterval),!E[_]||E[_][1]!==o)return u&&l()&&V().onDiscarded(_),!1;f.error=a.ZH;const e=y[_];if(!(0,a.b0)(e)&&(o<=e[0]||o<=e[1]||0===e[1]))return d(),u&&l()&&V().onDiscarded(_),!1;const s=A().data;f.data=c(s,r)?s:r,u&&l()&&V().onSuccess(r,_,n)}catch(e){p();const t=V(),{shouldRetryOnError:n}=t;t.isPaused()||(f.error=e,u&&l()&&(t.onError(e,_,t),(!0===n||(0,a.Tn)(n)&&n(e))&&(V().revalidateOnFocus&&V().revalidateOnReconnect&&!k()||t.onErrorRetry(e,_,t,(e=>{const t=m[_];t&&t[0]&&t[0](a.bu.ERROR_REVALIDATE_EVENT,e)}),{retryCount:(s.retryCount||0)+1,dedupe:!0}))))}return i=!1,d(),!0}),[_,u]),Q=(0,r.useCallback)(((...e)=>(0,a.mF)(u,O.current,...e)),[]);if((0,a.Es)((()=>{C.current=t,L.current=n,(0,a.b0)(W)||(Z.current=W)})),(0,a.Es)((()=>{if(!_)return;const e=G.bind(a.ZH,s);let t=0;const n=(0,a.aw)(_,m,((n,r={})=>{if(n==a.bu.FOCUS_EVENT){const n=Date.now();V().revalidateOnFocus&&n>t&&k()&&(t=n+V().focusThrottleInterval,e())}else if(n==a.bu.RECONNECT_EVENT)V().revalidateOnReconnect&&k()&&e();else{if(n==a.bu.MUTATE_EVENT)return G();if(n==a.bu.ERROR_REVALIDATE_EVENT)return G(r)}}));return S.current=!1,O.current=_,R.current=!0,x({_k:T}),J&&((0,a.b0)(H)||a.X3?e():(0,a.mf)(e)),()=>{S.current=!0,n()}}),[_]),(0,a.Es)((()=>{let e;function t(){const t=(0,a.Tn)(h)?h(A().data):h;t&&-1!==e&&(e=setTimeout(n,t))}function n(){A().error||!v&&!V().isVisible()||!b&&!V().isOnline()?t():G(s).then(t)}return t(),()=>{e&&(clearTimeout(e),e=-1)}}),[h,v,b,_]),(0,r.useDebugValue)($),l&&(0,a.b0)(H)&&_){if(!a.dO&&a.X3)throw new Error("Fallback data is required when using suspense in SSR.");C.current=t,L.current=n,S.current=!1;const e=w[_];if(!(0,a.b0)(e)){const t=Q(e);i(t)}if(!(0,a.b0)(X))throw X;{const e=G(s);(0,a.b0)($)||(e.status="fulfilled",e.value=!0),i(e)}}return{mutate:Q,get data(){return D.data=!0,$},get error(){return D.error=!0,X},get isValidating(){return D.isValidating=!0,K},get isLoading(){return D.isLoading=!0,z}}})))},9888:(e,t,n)=>{e.exports=n(1063)}}]);