@ampath/esm-dha-workflow-app 4.0.0-next.14 → 4.0.0-next.15

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.
Files changed (62) hide show
  1. package/dist/104.js +2 -0
  2. package/dist/104.js.LICENSE.txt +9 -0
  3. package/dist/104.js.map +1 -0
  4. package/dist/306.js +1 -1
  5. package/dist/306.js.map +1 -1
  6. package/dist/388.js +2 -0
  7. package/dist/388.js.map +1 -0
  8. package/dist/460.js +1 -0
  9. package/dist/460.js.map +1 -0
  10. package/dist/560.js +1 -0
  11. package/dist/560.js.map +1 -0
  12. package/dist/635.js +1 -0
  13. package/dist/635.js.map +1 -0
  14. package/dist/695.js +1 -0
  15. package/dist/695.js.map +1 -0
  16. package/dist/709.js +1 -0
  17. package/dist/709.js.map +1 -0
  18. package/dist/710.js +2 -0
  19. package/dist/{198.js.LICENSE.txt → 710.js.LICENSE.txt} +0 -10
  20. package/dist/710.js.map +1 -0
  21. package/dist/91.js +1 -1
  22. package/dist/91.js.map +1 -1
  23. package/dist/93.js +1 -1
  24. package/dist/978.js +1 -0
  25. package/dist/978.js.map +1 -0
  26. package/dist/esm-dha-workflow-app.js +1 -0
  27. package/dist/{openmrs-esm-home-app.js.buildmanifest.json → esm-dha-workflow-app.js.buildmanifest.json} +252 -83
  28. package/dist/esm-dha-workflow-app.js.map +1 -0
  29. package/dist/main.js +1 -1
  30. package/dist/main.js.map +1 -1
  31. package/dist/routes.json +1 -1
  32. package/package.json +2 -2
  33. package/src/config-schema.ts +115 -33
  34. package/src/consultation/action-button.component.tsx +34 -0
  35. package/src/consultation/action-overflow-menu-item.component.tsx +34 -0
  36. package/src/consultation/consultation-room.component.tsx +60 -0
  37. package/src/consultation/consultation.scss +5 -0
  38. package/src/consultation/consultation.tsx +9 -2
  39. package/src/hooks/useActions.ts +148 -0
  40. package/src/hooks/useQueueEntries.ts +35 -0
  41. package/src/index.ts +11 -1
  42. package/src/metrics/metrics-cards/attended-patients.extension.tsx +18 -0
  43. package/src/metrics/metrics-cards/metrics-card.component.tsx +86 -0
  44. package/src/metrics/metrics-cards/metrics-card.scss +106 -0
  45. package/src/metrics/metrics-cards/waiting-patients.extension.tsx +18 -0
  46. package/src/metrics/metrics-container.component.tsx +16 -0
  47. package/src/metrics/metrics-container.scss +36 -0
  48. package/src/metrics/metrics.resource.ts +101 -0
  49. package/src/modals/sign-off-modal.scss +7 -0
  50. package/src/modals/sign-off-modal.tsx +52 -0
  51. package/src/routes.json +18 -0
  52. package/src/service-queues/service-queues.resource.ts +62 -0
  53. package/src/types/types.ts +100 -0
  54. package/dist/198.js +0 -2
  55. package/dist/198.js.map +0 -1
  56. package/dist/200.js +0 -2
  57. package/dist/200.js.map +0 -1
  58. package/dist/860.js +0 -1
  59. package/dist/860.js.map +0 -1
  60. package/dist/openmrs-esm-home-app.js +0 -1
  61. package/dist/openmrs-esm-home-app.js.map +0 -1
  62. /package/dist/{200.js.LICENSE.txt → 388.js.LICENSE.txt} +0 -0
package/dist/104.js ADDED
@@ -0,0 +1,2 @@
1
+ /*! For license information please see 104.js.LICENSE.txt */
2
+ "use strict";(globalThis.webpackChunk_ampath_esm_dha_workflow_app=globalThis.webpackChunk_ampath_esm_dha_workflow_app||[]).push([[104,709],{10540:e=>{e.exports=function(e){var t=document.createElement("style");return e.setAttributes(t,e.attributes),e.insert(t,e.options),t}},14993:(e,t,n)=>{n.d(t,{BE:()=>$,Es:()=>V,Ht:()=>ee,PP:()=>U,Tn:()=>u,X3:()=>C,ZH:()=>a,aw:()=>Y,b0:()=>s,bZ:()=>v,bu:()=>M,dO:()=>O,iX:()=>z,lK:()=>x,lg:()=>N,mF:()=>F,mf:()=>L,q9:()=>J,qm:()=>Q,qv:()=>i,r9:()=>E,rL:()=>c,sb:()=>W});var r=n(16072);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},v=new WeakMap,h={},b={},m="undefined",g=typeof window!=m,y=typeof document!=m,E=(e,t)=>{const n=v.get(e);return[()=>!s(t)&&e.get(t)||h,r=>{if(!s(t)){const o=e.get(t);t in b||(b[t]=o),n[5](t,c(o,r),o||h)}},n[6],()=>!s(t)&&t in b?b[t]:!s(t)&&e.get(t)||h]};let w=!0;const[_,T]=g&&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=!g||"Deno"in window,L=e=>g&&typeof window.requestAnimationFrame!=m?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 h=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),[m,g,y,w]=v.get(t),_=()=>{const e=m[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();g[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!==g[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(g[o][1]=N(),Promise.resolve(_()).then((()=>{b({_c:a})})),!T)return R;if(h)throw T}}const j=(e,t)=>{for(const n in e)e[n][0]&&e[n][0](t)},P=(e,t)=>{if(!v.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(!v.has(e)&&(v.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(),v.delete(e)}}};return d(),[e,i,d,s]}return[e,v.get(e)[4]]},[U,q]=P(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:U,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},Z=(0,r.createContext)({}),$=e=>{const{value:t}=e,n=(0,r.useContext)(Z),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=P(l(s.cache||U),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)(Z.Provider,c(e,{value:s}))},J="$inf$",X=g&&window.__SWR_DEVTOOLS_USE__,B=X?window.__SWR_DEVTOOLS_USE__:[],K=e=>u(e[1])?[e[0],e[1],e[2]||{}]:[e[0],null,(null===e[1]?e[2]:e[1])||{}],z=()=>c(W,(0,r.useContext)(Z)),G=B.concat((e=>(t,n,r)=>e(t,n&&((...e)=>{const[r]=x(t),[,,,o]=v.get(U);if(r.startsWith(J))return n(...e);const a=o[r];return s(a)?n(...e):(delete o[r],a)}),r))),Q=e=>function(...t){const n=z(),[r,o,a]=K(t),i=H(n,a);let s=e;const{use:u}=i,c=(u||[]).concat(G);for(let e=c.length;e--;)s=c[e](s);return s(r,o||i.fetcher||null,i)},Y=(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())}},ee=(e,t)=>(...n)=>{const[r,o,a]=K(n),i=(a.use||[]).concat(t);return e(r,o,{...a,use:i})};X&&(window.__SWR_DEVTOOLS_REACT__=r)},19888:(e,t,n)=>{e.exports=n(58493)},41113: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))}}},55056:(e,t,n)=>{e.exports=function(e){var t=n.nc;t&&e.setAttribute("nonce",t)}},58493:(e,t,n)=>{var r=n(16072),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},59324:(e,t,n)=>{n.d(t,{Ay:()=>c,BE:()=>u});var r=n(16072),o=n(19888),a=n(14993);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}),c=(0,a.qm)(((e,t,n)=>{const{cache:u,compare:c,suspense:l,fallbackData:f,revalidateOnMount:d,revalidateIfStale:p,refreshInterval:v,refreshWhenHidden:h,refreshWhenOffline:b,keepPreviousData:m}=n,[g,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(J,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,_]),P=(0,o.useSyncExternalStore)((0,r.useCallback)((e=>I(_,((t,n)=>{F(n,t)||e()}))),[u,_]),j[0],j[1]),U=!R.current,q=g[_]&&g[_].length>0,W=P.data,H=(0,a.b0)(W)?M:W,Z=P.error,$=(0,r.useRef)(H),J=m?(0,a.b0)(W)?$.current:W:H,X=!(q&&!(0,a.b0)(Z))&&(U&&!(0,a.b0)(d)?d:!V().isPaused()&&(l?!(0,a.b0)(H)&&p:(0,a.b0)(H)||p)),B=!!(_&&t&&U&&X),K=(0,a.b0)(P.isValidating)?B:P.isValidating,z=(0,a.b0)(P.isLoading)?B:P.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[_]},v={isValidating:!0};(0,a.b0)(A().data)&&(v.isLoading=!0);try{if(u&&(x(v),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=g[_];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)||($.current=W)})),(0,a.Es)((()=>{if(!_)return;const e=G.bind(a.ZH,s);let t=0;const n=(0,a.aw)(_,g,((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}),X&&((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)(v)?v(A().data):v;t&&-1!==e&&(e=setTimeout(n,t))}function n(){A().error||!h&&!V().isVisible()||!b&&!V().isOnline()?t():G(s).then(t)}return t(),()=>{e&&(clearTimeout(e),e=-1)}}),[v,h,b,_]),(0,r.useDebugValue)(J),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)(Z))throw Z;{const e=G(s);(0,a.b0)(J)||(e.status="fulfilled",e.value=!0),i(e)}}return{mutate:Q,get data(){return D.data=!0,J},get error(){return D.error=!0,Z},get isValidating(){return D.isValidating=!0,K},get isLoading(){return D.isLoading=!0,z}}}))},70159: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}},72996: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")}},77659: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)}},85072: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 v=o(p,r);r.byIndex=s,t.splice(s,0,{identifier:f,updater:v,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}}},97825:e=>{e.exports=function(e){if("undefined"==typeof document)return{update:function(){},remove:function(){}};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)}}}}}]);
@@ -0,0 +1,9 @@
1
+ /**
2
+ * @license React
3
+ * use-sync-external-store-shim.production.js
4
+ *
5
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
6
+ *
7
+ * This source code is licensed under the MIT license found in the
8
+ * LICENSE file in the root directory of this source tree.
9
+ */
@@ -0,0 +1 @@
1
+ {"version":3,"file":"104.js","mappings":";sJASAA,EAAOC,QANP,SAA4BC,GAC1B,IAAIC,EAAUC,SAASC,cAAc,SAGrC,OAFAH,EAAQI,cAAcH,EAASD,EAAQK,YACvCL,EAAQM,OAAOL,EAASD,EAAQA,SACzBC,CACT,2PCLA,MAAMM,EAAO,OAKPC,EAA8BD,IAC9BE,EAASC,OACTC,EAAeC,GAAIA,IAAMJ,EACzBK,EAAcD,GAAgB,mBAALA,EACzBE,EAAe,CAACC,EAAGC,KAAI,IAClBD,KACAC,IAELC,EAAiBC,GAAIL,EAAWK,EAAEC,MAMlCC,EAAQ,IAAIC,QAElB,IAAIC,EAAU,EASd,MAAMC,EAAcC,IAChB,MAAMC,SAAcD,EACdE,EAAcF,GAAOA,EAAIE,YACzBC,E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Z,kBAAkBtL,EAAKC,EAAczO,EAAQA,QACvD,CAoBM+Z,CAAMtL,EAAczO,EAAS0Y,EAC/B,EACAa,OAAQ,YArBZ,SAA4B9K,GAE1B,GAAgC,OAA5BA,EAAauL,WACf,OAAO,EAETvL,EAAauL,WAAWnL,YAAYJ,EACtC,CAgBMwL,CAAmBxL,EACrB,EAEJ","sources":["webpack://@ampath/esm-dha-workflow-app/./node_modules/style-loader/dist/runtime/insertStyleElement.js","webpack://@ampath/esm-dha-workflow-app/./node_modules/swr/dist/_internal/index.mjs","webpack://@ampath/esm-dha-workflow-app/./node_modules/use-sync-external-store/shim/index.js","webpack://@ampath/esm-dha-workflow-app/./node_modules/style-loader/dist/runtime/styleTagTransform.js","webpack://@ampath/esm-dha-workflow-app/./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js","webpack://@ampath/esm-dha-workflow-app/./node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.production.js","webpack://@ampath/esm-dha-workflow-app/./node_modules/swr/dist/core/index.mjs","webpack://@ampath/esm-dha-workflow-app/./node_modules/@openmrs/webpack-config/node_modules/css-loader/dist/runtime/api.js","webpack://@ampath/esm-dha-workflow-app/./node_modules/@openmrs/webpack-config/node_modules/css-loader/dist/runtime/cssWithMappingToString.js","webpack://@ampath/esm-dha-workflow-app/./node_modules/style-loader/dist/runtime/insertBySelector.js","webpack://@ampath/esm-dha-workflow-app/./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js","webpack://@ampath/esm-dha-workflow-app/./node_modules/style-loader/dist/runtime/styleDomAPI.js"],"names":["module","exports","options","element","document","createElement","setAttributes","attributes","insert","noop","UNDEFINED","OBJECT","Object","isUndefined","v","isFunction","mergeObjects","a","b","isPromiseLike","x","then","table","WeakMap","counter","stableHash","arg","type","constructor","isDate","Date","result","index","RegExp","toJSON","toString","JSON","stringify","get","set","Array","length","keys","sort","pop","SWRGlobalState","EMPTY_CACHE","INITIAL_CACHE","STR_UNDEFINED","isWindowDefined","window","isDocumentDefined","createCacheHelper","cache","key","state","info","prev","online","onWindowEvent","offWindowEvent","addEventListener","bind","removeEventListener","preset","isOnline","isVisible","visibilityState","defaultConfigOptions","initFocus","callback","initReconnect","onOnline","onOffline","IS_REACT_LEGACY","IS_SERVER","rAF","f","setTimeout","useIsomorphicLayoutEffect","useEffect","useLayoutEffect","navigatorConnection","navigator","connection","slowConnection","includes","effectiveType","saveData","serialize","err","args","isArray","__timestamp","getTimestamp","MUTATE_EVENT","events","__proto__","ERROR_REVALIDATE_EVENT","FOCUS_EVENT","RECONNECT_EVENT","async","internalMutate","_key","_data","_opts","populateCache","throwOnError","revalidate","rollbackOnErrorOption","rollbackOnError","optimisticData","keyFilter","matchedKeys","it","test","_k","push","Promise","all","map","mutateByKey","EVENT_REVALIDATORS","MUTATION","FETCH","PRELOAD","startRevalidate","revalidators","data","error","beforeMutationTs","hasOptimisticData","displayedData","currentData","_c","committedData","catch","populateCachedData","resolve","revalidateAllKeys","initCache","provider","has","opts","mutate","unmount","subscriptions","subscribe","subs","splice","indexOf","setter","value","fn","initProvider","releaseFocus","releaseReconnect","delete","Map","defaultConfig","onLoadingSlow","onSuccess","onError","onErrorRetry","_","__","config","maxRetryCount","errorRetryCount","currentRetryCount","retryCount","timeout","Math","random","errorRetryInterval","onDiscarded","revalidateOnFocus","revalidateOnReconnect","revalidateIfStale","shouldRetryOnError","focusThrottleInterval","dedupingInterval","loadingTimeout","compare","newData","isPaused","fallback","mergeConfigs","use","u1","f1","u2","f2","concat","SWRConfigContext","createContext","SWRConfig","props","parentConfig","useContext","isFunctionalConfig","useMemo","extendedConfig","cacheContextRef","useRef","current","cacheContext","Provider","INFINITE_PREFIX","enableDevtools","__SWR_DEVTOOLS_USE__","normalize","useSWRConfig","BUILT_IN_MIDDLEWARE","useSWRNext","key_","fetcher_","startsWith","req","withArgs","hook","fallbackConfig","_config","next","middleware","i","fetcher","subscribeCallback","callbacks","keyedRevalidators","withMiddleware","useSWR","uses","__SWR_DEVTOOLS_REACT__","css","styleElement","styleSheet","cssText","firstChild","removeChild","appendChild","createTextNode","nonce","setAttribute","React","objectIs","is","y","useState","useDebugValue","checkIfSnapshotChanged","inst","latestGetSnapshot","getSnapshot","nextValue","shim","_useState","forceUpdate","useSyncExternalStore","promise","status","reason","e","WITH_DEDUPE","dedupe","defineProperty","suspense","fallbackData","revalidateOnMount","refreshInterval","refreshWhenHidden","refreshWhenOffline","keepPreviousData","fnArg","initialMountedRef","unmountedRef","keyRef","fetcherRef","configRef","getConfig","isActive","getCache","setCache","subscribeCache","getInitialCache","stateDependencies","isEqual","t","returnedData","shouldStartRequest","getSelectedCache","snapshot","isValidating","isLoading","cachedData","initialData","clientSnapshot","serverSnapshot","memorizedSnapshot","newSnapshot","cached","useCallback","isInitialMount","hasRevalidator","laggyDataRef","shouldDoInitialRevalidation","defaultValidatingState","revalidateOpts","currentFetcher","startAt","loading","shouldStartNewRequest","callbackSafeguard","finalState","finishRequestAndUpdateState","cleanupState","requestInfo","initialState","mutationInfo","cacheData","currentConfig","boundMutate","softRevalidate","nextFocusRevalidatedAt","unsubEvents","now","timer","interval","execute","clearTimeout","Error","cssWithMappingToString","list","this","item","content","join","modules","mediaQuery","alreadyImportedModules","id","_i","_arrayLikeToArray","arr","len","arr2","_item","_arrayWithHoles","Symbol","iterator","_s","_e","_arr","_n","_d","call","done","_iterableToArrayLimit","o","minLen","n","prototype","slice","name","from","_unsupportedIterableToArray","TypeError","_nonIterableRest","cssMapping","btoa","base64","unescape","encodeURIComponent","sourceMapping","sourceURLs","sources","source","sourceRoot","memo","style","target","styleTarget","querySelector","HTMLIFrameElement","contentDocument","head","getTarget","stylesInDOM","getIndexByIdentifier","identifier","modulesToDom","idCountMap","identifiers","base","count","indexByIdentifier","obj","media","sourceMap","supports","layer","references","updater","addElementStyle","byIndex","api","domAPI","update","newObj","remove","lastIdentifiers","newList","newLastIdentifiers","_index","insertStyleElement","needLayer","styleTagTransform","apply","parentNode","removeStyleElement"],"sourceRoot":""}
package/dist/306.js CHANGED
@@ -1 +1 @@
1
- "use strict";(globalThis.webpackChunk_ampath_esm_dha_workflow_app=globalThis.webpackChunk_ampath_esm_dha_workflow_app||[]).push([[306],{3754:(e,t,n)=>{n.d(t,{A:()=>l});var r=n(72996),a=n.n(r),o=n(70159),i=n.n(o)()(a());i.push([e.id,".-esm-dha-workflow__send-to-triage-modal__formSection___8euyX{display:flex;flex-direction:column;width:100%;row-gap:5px;margin-top:15px}.-esm-dha-workflow__send-to-triage-modal__formRow___Hf27O{display:flex;flex-direction:row;width:100%;column-gap:5px}.-esm-dha-workflow__send-to-triage-modal__formControl___Gmnpd{display:flex;flex-direction:column;width:40%;row-gap:5px}.-esm-dha-workflow__send-to-triage-modal__actionSection___Dlgbe{display:flex;flex-direction:row;column-gap:5px;margin-top:15px}.-esm-dha-workflow__send-to-triage-modal__patientAction___ECxUB{display:flex;flex-direction:row;column-gap:5px;margin-top:15px}","",{version:3,sources:["webpack://./src/registry/modal/send-to-triage/send-to-triage.modal.scss"],names:[],mappings:"AAAA,8DACI,YAAA,CACA,qBAAA,CACA,UAAA,CACA,WAAA,CACA,eAAA,CAEJ,0DACG,YAAA,CACA,kBAAA,CACA,UAAA,CACA,cAAA,CAEH,8DACG,YAAA,CACA,qBAAA,CACA,SAAA,CACA,WAAA,CAEH,gEACI,YAAA,CACA,kBAAA,CACA,cAAA,CACA,eAAA,CAEJ,gEACI,YAAA,CACA,kBAAA,CACA,cAAA,CACA,eAAA",sourcesContent:[".formSection{\n display: flex;\n flex-direction: column;\n width: 100%;\n row-gap: 5px;\n margin-top: 15px;\n}\n.formRow{\n display: flex;\n flex-direction: row;\n width: 100%;\n column-gap: 5px;\n}\n.formControl{\n display: flex;\n flex-direction: column;\n width: 40%;\n row-gap: 5px;\n}\n.actionSection{\n display: flex;\n flex-direction: row;\n column-gap: 5px;\n margin-top: 15px;\n}\n.patientAction{\n display: flex;\n flex-direction: row;\n column-gap: 5px;\n margin-top: 15px;\n}"],sourceRoot:""}]),i.locals={formSection:"-esm-dha-workflow__send-to-triage-modal__formSection___8euyX",formRow:"-esm-dha-workflow__send-to-triage-modal__formRow___Hf27O",formControl:"-esm-dha-workflow__send-to-triage-modal__formControl___Gmnpd",actionSection:"-esm-dha-workflow__send-to-triage-modal__actionSection___Dlgbe",patientAction:"-esm-dha-workflow__send-to-triage-modal__patientAction___ECxUB"};const l=i},6842:(e,t,n)=>{n.d(t,{A:()=>l});var r=n(72996),a=n.n(r),o=n(70159),i=n.n(o)()(a());i.push([e.id,".-esm-dha-workflow__registry-component__registryLayout___PF4WP{display:flex;flex-direction:row;width:100%;row-gap:10px;padding:2% 2%}.-esm-dha-workflow__registry-component__mainContent___qOmrp{display:flex;flex-direction:column;width:100%}.-esm-dha-workflow__registry-component__registryHeader___YIQ62{display:flex;flex-direction:column;row-gap:10px;width:100%}.-esm-dha-workflow__registry-component__registryContent___W1b-9{display:flex;flex-direction:column;width:100%}.-esm-dha-workflow__registry-component__formRow___qlwjG{display:flex;flex-direction:row;width:100%;column-gap:5px;margin-top:10px}.-esm-dha-workflow__registry-component__formControl___R5c2A{width:30%}.-esm-dha-workflow__registry-component__hieData___jx5gt{margin-top:15px;display:flex;flex-direction:column;width:80%;row-gap:10px}.-esm-dha-workflow__registry-component__btnContainer___aXZfC{padding:5px 5px}.-esm-dha-workflow__registry-component__selectionHeader___-zRam{display:flex;flex-direction:column;width:100%;row-gap:5px}.-esm-dha-workflow__registry-component__patientSelect___wgPYw{display:flex;flex-direction:row;width:100%;column-gap:5px}.-esm-dha-workflow__registry-component__patientSelectRadio___3aGYW{width:70%}.-esm-dha-workflow__registry-component__patientConfirmSelection___Py9-y{display:flex;flex-direction:row;width:30%;column-gap:5px}.-esm-dha-workflow__registry-component__formBtn___ok0W6{display:flex;flex-direction:row;column-gap:5px}.-esm-dha-workflow__registry-component__registrySearchBtn___jHA2M{height:30px}.-esm-dha-workflow__registry-component__principalDependantSection___y\\+Uv2{display:flex;flex-direction:row;width:100%;margin-top:15px}.-esm-dha-workflow__registry-component__dependantCard___BUkYp{display:flex;flex-direction:row;width:30%}","",{version:3,sources:["webpack://./src/registry/registry.component.scss"],names:[],mappings:"AAAA,+DACI,YAAA,CACA,kBAAA,CACA,UAAA,CACA,YAAA,CACA,aAAA,CAEJ,4DACE,YAAA,CACA,qBAAA,CACA,UAAA,CAEF,+DACI,YAAA,CACA,qBAAA,CACA,YAAA,CACA,UAAA,CAEJ,gEACI,YAAA,CACA,qBAAA,CACA,UAAA,CAEJ,wDACI,YAAA,CACA,kBAAA,CACA,UAAA,CACA,cAAA,CACA,eAAA,CAEJ,4DACI,SAAA,CAEJ,wDACI,eAAA,CACA,YAAA,CACA,qBAAA,CACA,SAAA,CACA,YAAA,CAEJ,6DACI,eAAA,CAEJ,gEACI,YAAA,CACA,qBAAA,CACA,UAAA,CACA,WAAA,CAEJ,8DACI,YAAA,CACA,kBAAA,CACA,UAAA,CACA,cAAA,CAEJ,mEACI,SAAA,CAEJ,wEACI,YAAA,CACA,kBAAA,CACA,SAAA,CACA,cAAA,CAEJ,wDACI,YAAA,CACA,kBAAA,CACA,cAAA,CAEJ,kEACI,WAAA,CAEJ,2EACI,YAAA,CACA,kBAAA,CACA,UAAA,CACA,eAAA,CAEJ,8DACI,YAAA,CACA,kBAAA,CACA,SAAA",sourcesContent:[".registryLayout{\n display: flex;\n flex-direction: row;\n width: 100%;\n row-gap: 10px;\n padding: 2% 2%;\n}\n.mainContent{\n display: flex;\n flex-direction: column;\n width: 100%;\n}\n.registryHeader{\n display: flex;\n flex-direction: column;\n row-gap: 10px;\n width: 100%;\n}\n.registryContent{\n display: flex;\n flex-direction: column;\n width: 100%;\n}\n.formRow{\n display: flex;\n flex-direction: row;\n width: 100%;\n column-gap: 5px;\n margin-top: 10px;\n}\n.formControl{\n width: 30%;\n}\n.hieData{\n margin-top: 15px;\n display: flex;\n flex-direction: column;\n width: 80%;\n row-gap: 10px;\n}\n.btnContainer{\n padding: 5px 5px;\n}\n.selectionHeader{\n display: flex;\n flex-direction: column;\n width: 100%;\n row-gap: 5px;\n}\n.patientSelect{\n display: flex;\n flex-direction: row;\n width: 100%;\n column-gap: 5px;\n}\n.patientSelectRadio{\n width: 70%;\n}\n.patientConfirmSelection{\n display: flex;\n flex-direction: row;\n width: 30%;\n column-gap: 5px;\n}\n.formBtn{\n display: flex;\n flex-direction: row;\n column-gap: 5px;\n}\n.registrySearchBtn{\n height: 30px;\n}\n.principalDependantSection{\n display: flex;\n flex-direction: row;\n width: 100%;\n margin-top: 15px;\n}\n.dependantCard{\n display: flex;\n flex-direction: row;\n width: 30%;\n}"],sourceRoot:""}]),i.locals={registryLayout:"-esm-dha-workflow__registry-component__registryLayout___PF4WP",mainContent:"-esm-dha-workflow__registry-component__mainContent___qOmrp",registryHeader:"-esm-dha-workflow__registry-component__registryHeader___YIQ62",registryContent:"-esm-dha-workflow__registry-component__registryContent___W1b-9",formRow:"-esm-dha-workflow__registry-component__formRow___qlwjG",formControl:"-esm-dha-workflow__registry-component__formControl___R5c2A",hieData:"-esm-dha-workflow__registry-component__hieData___jx5gt",btnContainer:"-esm-dha-workflow__registry-component__btnContainer___aXZfC",selectionHeader:"-esm-dha-workflow__registry-component__selectionHeader___-zRam",patientSelect:"-esm-dha-workflow__registry-component__patientSelect___wgPYw",patientSelectRadio:"-esm-dha-workflow__registry-component__patientSelectRadio___3aGYW",patientConfirmSelection:"-esm-dha-workflow__registry-component__patientConfirmSelection___Py9-y",formBtn:"-esm-dha-workflow__registry-component__formBtn___ok0W6",registrySearchBtn:"-esm-dha-workflow__registry-component__registrySearchBtn___jHA2M",principalDependantSection:"-esm-dha-workflow__registry-component__principalDependantSection___y+Uv2",dependantCard:"-esm-dha-workflow__registry-component__dependantCard___BUkYp"};const l=i},10540:e=>{e.exports=function(e){var t=document.createElement("style");return e.setAttributes(t,e.attributes),e.insert(t,e.options),t}},41113: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))}}},55056:(e,t,n)=>{e.exports=function(e){var t=n.nc;t&&e.setAttribute("nonce",t)}},70159: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 a={};if(r)for(var o=0;o<this.length;o++){var i=this[o][0];null!=i&&(a[i]=!0)}for(var l=0;l<e.length;l++){var c=[].concat(e[l]);r&&a[c[0]]||(n&&(c[2]?c[2]="".concat(n," and ").concat(c[2]):c[2]=n),t.push(c))}},t}},72996: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,a=(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,a,o=[],i=!0,l=!1;try{for(n=n.call(e);!(i=(r=n.next()).done)&&(o.push(r.value),!t||o.length!==t);i=!0);}catch(e){l=!0,a=e}finally{try{i||null==n.return||n.return()}finally{if(l)throw a}}return o}}(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.")}()),o=a[1],i=a[3];if(!i)return o;if("function"==typeof btoa){var l=btoa(unescape(encodeURIComponent(JSON.stringify(i)))),c="sourceMappingURL=data:application/json;charset=utf-8;base64,".concat(l),s="/*# ".concat(c," */"),u=i.sources.map((function(e){return"/*# sourceURL=".concat(i.sourceRoot||"").concat(e," */")}));return[o].concat(u).concat([s]).join("\n")}return[o].join("\n")}},77659: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)}},84497:(e,t,n)=>{n.d(t,{A:()=>l});var r=n(72996),a=n.n(r),o=n(70159),i=n.n(o)()(a());i.push([e.id,".-esm-dha-workflow__otp-verification-modal__modalVerificationLayout___MST8n{display:flex;flex-direction:column;row-gap:10px;width:100%}.-esm-dha-workflow__otp-verification-modal__sectionHeader___g62oo{display:flex;flex-direction:column;column-gap:5px;margin-top:5px;margin-bottom:5px}","",{version:3,sources:["webpack://./src/registry/modal/otp-verification-modal/otp-verification-modal.scss"],names:[],mappings:"AAAA,4EACE,YAAA,CACA,qBAAA,CACA,YAAA,CACA,UAAA,CAEF,kEACE,YAAA,CACA,qBAAA,CACA,cAAA,CACA,cAAA,CACA,iBAAA",sourcesContent:[".modalVerificationLayout {\n display: flex;\n flex-direction: column;\n row-gap: 10px;\n width: 100%;\n}\n.sectionHeader{\n display: flex;\n flex-direction: column;\n column-gap: 5px;\n margin-top: 5px;\n margin-bottom: 5px;\n}"],sourceRoot:""}]),i.locals={modalVerificationLayout:"-esm-dha-workflow__otp-verification-modal__modalVerificationLayout___MST8n",sectionHeader:"-esm-dha-workflow__otp-verification-modal__sectionHeader___g62oo"};const l=i},85072: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 o={},i=[],l=0;l<e.length;l++){var c=e[l],s=r.base?c[0]+r.base:c[0],u=o[s]||0,d="".concat(s," ").concat(u);o[s]=u+1;var f=n(d),m={css:c[1],media:c[2],sourceMap:c[3],supports:c[4],layer:c[5]};if(-1!==f)t[f].references++,t[f].updater(m);else{var p=a(m,r);r.byIndex=l,t.splice(l,0,{identifier:d,updater:p,references:1})}i.push(d)}return i}function a(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,a){var o=r(e=e||[],a=a||{});return function(e){e=e||[];for(var i=0;i<o.length;i++){var l=n(o[i]);t[l].references--}for(var c=r(e,a),s=0;s<o.length;s++){var u=n(o[s]);0===t[u].references&&(t[u].updater(),t.splice(u,1))}o=c}}},86575:(e,t,n)=>{n.d(t,{A:()=>l});var r=n(72996),a=n.n(r),o=n(70159),i=n.n(o)()(a());i.push([e.id,".-esm-dha-workflow__client-details-modal__clientDetailsLayout___r5WF\\+{display:flex;flex-direction:column;width:100%;row-gap:5px}.-esm-dha-workflow__client-details-modal__sectionHeader___lH-gL{display:flex;flex-direction:column;row-gap:5px;margin-top:5px;margin-bottom:10px}.-esm-dha-workflow__client-details-modal__sectionContent___QDFT7{display:flex;flex-direction:column;row-gap:5px}.-esm-dha-workflow__client-details-modal__actionSection___okVDp{display:flex;flex-direction:row;width:100%;column-gap:5px}.-esm-dha-workflow__client-details-modal__btnContainer___ETNEk{margin-top:2px;margin-bottom:2px}","",{version:3,sources:["webpack://./src/registry/modal/client-details-modal/client-details-modal.scss"],names:[],mappings:"AAAA,uEACI,YAAA,CACA,qBAAA,CACA,UAAA,CACA,WAAA,CAEJ,gEACI,YAAA,CACA,qBAAA,CACA,WAAA,CACA,cAAA,CACA,kBAAA,CAEJ,iEACI,YAAA,CACA,qBAAA,CACA,WAAA,CAEJ,gEACI,YAAA,CACA,kBAAA,CACA,UAAA,CACA,cAAA,CAEJ,+DACI,cAAA,CACA,iBAAA",sourcesContent:[".clientDetailsLayout{\n display: flex;\n flex-direction: column;\n width: 100%;\n row-gap: 5px;\n}\n.sectionHeader{\n display: flex;\n flex-direction: column;\n row-gap: 5px;\n margin-top: 5px;\n margin-bottom: 10px;\n}\n.sectionContent{\n display: flex;\n flex-direction: column;\n row-gap: 5px;\n}\n.actionSection{\n display: flex;\n flex-direction: row;\n width: 100%;\n column-gap: 5px;\n}\n.btnContainer{\n margin-top: 2px;\n margin-bottom: 2px;\n}"],sourceRoot:""}]),i.locals={clientDetailsLayout:"-esm-dha-workflow__client-details-modal__clientDetailsLayout___r5WF+",sectionHeader:"-esm-dha-workflow__client-details-modal__sectionHeader___lH-gL",sectionContent:"-esm-dha-workflow__client-details-modal__sectionContent___QDFT7",actionSection:"-esm-dha-workflow__client-details-modal__actionSection___okVDp",btnContainer:"-esm-dha-workflow__client-details-modal__btnContainer___ETNEk"};const l=i},97825:e=>{e.exports=function(e){if("undefined"==typeof document)return{update:function(){},remove:function(){}};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 a=void 0!==n.layer;a&&(r+="@layer".concat(n.layer.length>0?" ".concat(n.layer):""," {")),r+=n.css,a&&(r+="}"),n.media&&(r+="}"),n.supports&&(r+="}");var o=n.sourceMap;o&&"undefined"!=typeof btoa&&(r+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(o))))," */")),t.styleTagTransform(r,e,t.options)}(t,e,n)},remove:function(){!function(e){if(null===e.parentNode)return!1;e.parentNode.removeChild(e)}(t)}}}},99306:(e,t,n)=>{n.r(t),n.d(t,{default:()=>Pe});var r=n(69200),a=n(16072),o=n.n(a),i=n(85072),l=n.n(i),c=n(97825),s=n.n(c),u=n(77659),d=n.n(u),f=n(55056),m=n.n(f),p=n(10540),A=n.n(p),h=n(41113),y=n.n(h),_=n(6842),b={};b.styleTagTransform=y(),b.setAttributes=m(),b.insert=d().bind(null,"head"),b.domAPI=s(),b.insertStyleElement=A(),l()(_.A,b);const g=_.A&&_.A.locals?_.A.locals:void 0;var v=["National ID","Alien ID","Passport","Mandate Number","Refugee ID"],w=function(e){return e.Draft="DRAFT",e.Sent="SENT",e.Verified="VERIFIED",e}({}),C=function(e){return e.NationalID="National ID",e.SHANumber="SHA Number",e.HouseholdNumber="Household Number",e.RefugeeID="Refugee ID",e.AlienID="Alien ID",e.MandateNumber="Mandate Number",e.Cr="id",e.TemporaryDependantID="Temporary Dependant ID",e.BirthCertificate="Birth Certificate",e}({}),E="https://staging.ampath.or.ke/hie";function x(e,t,n,r,a,o,i){try{var l=e[o](i),c=l.value}catch(e){return void n(e)}l.done?t(c):Promise.resolve(c).then(r,a)}function S(e){return function(){var t=this,n=arguments;return new Promise((function(r,a){var o=e.apply(t,n);function i(e){x(o,r,a,i,l,"next",e)}function l(e){x(o,r,a,i,l,"throw",e)}i(void 0)}))}}function k(e,t){var n,r,a,o={label:0,sent:function(){if(1&a[0])throw a[1];return a[1]},trys:[],ops:[]},i=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return i.next=l(0),i.throw=l(1),i.return=l(2),"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function l(l){return function(c){return function(l){if(n)throw new TypeError("Generator is already executing.");for(;i&&(i=0,l[0]&&(o=0)),o;)try{if(n=1,r&&(a=2&l[0]?r.return:l[0]?r.throw||((a=r.return)&&a.call(r),0):r.next)&&!(a=a.call(r,l[1])).done)return a;switch(r=0,a&&(l=[2&l[0],a.value]),l[0]){case 0:case 1:a=l;break;case 4:return o.label++,{value:l[1],done:!1};case 5:o.label++,r=l[1],l=[0];continue;case 7:l=o.ops.pop(),o.trys.pop();continue;default:if(!((a=(a=o.trys).length>0&&a[a.length-1])||6!==l[0]&&2!==l[0])){o=0;continue}if(3===l[0]&&(!a||l[1]>a[0]&&l[1]<a[3])){o.label=l[1];break}if(6===l[0]&&o.label<a[1]){o.label=a[1],a=l;break}if(a&&o.label<a[2]){o.label=a[2],o.ops.push(l);break}a[2]&&o.ops.pop(),o.trys.pop();continue}l=t.call(e,o)}catch(e){l=[6,e],r=0}finally{n=a=0}if(5&l[0])throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}([l,c])}}}function T(e,t){return S((function(){var n,r;return k(this,(function(a){switch(a.label){case 0:return[4,fetch(e,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)})];case 1:return(n=a.sent()).ok?[3,3]:[4,n.text()];case 2:throw r=a.sent(),new Error("Request failed with ".concat(n.status,": ").concat(r));case 3:return[2,n.json()]}}))}))()}function N(e){return S((function(){var t,n;return k(this,(function(r){return t="".concat(E,"/client/search"),n={identificationNumber:e.identificationNumber,identificationType:e.identificationType,locationUuid:e.locationUuid},[2,T(t,n)]}))}))()}var I=n(25987),P=n(84497),D={};D.styleTagTransform=y(),D.setAttributes=m(),D.insert=d().bind(null,"head"),D.domAPI=s(),D.insertStyleElement=A(),l()(P.A,D);const O=P.A&&P.A.locals?P.A.locals:void 0;var j=function(e){for(var t=e.split(""),n=0;n<e.length;n++)n%2==0&&(t[n]="*");return t.join("")},R=function(e){for(var t=e.split(""),n=0;n<e.length;n++)0!=n&&n!==e.length-1&&(t[n]="*");return t.join("")};function F(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function B(e,t,n,r,a,o,i){try{var l=e[o](i),c=l.value}catch(e){return void n(e)}l.done?t(c):Promise.resolve(c).then(r,a)}function H(e){return function(){var t=this,n=arguments;return new Promise((function(r,a){var o=e.apply(t,n);function i(e){B(o,r,a,i,l,"next",e)}function l(e){B(o,r,a,i,l,"throw",e)}i(void 0)}))}}function U(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,a,o=[],i=!0,l=!1;try{for(n=n.call(e);!(i=(r=n.next()).done)&&(o.push(r.value),!t||o.length!==t);i=!0);}catch(e){l=!0,a=e}finally{try{i||null==n.return||n.return()}finally{if(l)throw a}}return o}}(e,t)||function(e,t){if(e){if("string"==typeof e)return F(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?F(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Y(e,t){var n,r,a,o={label:0,sent:function(){if(1&a[0])throw a[1];return a[1]},trys:[],ops:[]},i=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return i.next=l(0),i.throw=l(1),i.return=l(2),"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function l(l){return function(c){return function(l){if(n)throw new TypeError("Generator is already executing.");for(;i&&(i=0,l[0]&&(o=0)),o;)try{if(n=1,r&&(a=2&l[0]?r.return:l[0]?r.throw||((a=r.return)&&a.call(r),0):r.next)&&!(a=a.call(r,l[1])).done)return a;switch(r=0,a&&(l=[2&l[0],a.value]),l[0]){case 0:case 1:a=l;break;case 4:return o.label++,{value:l[1],done:!1};case 5:o.label++,r=l[1],l=[0];continue;case 7:l=o.ops.pop(),o.trys.pop();continue;default:if(!((a=(a=o.trys).length>0&&a[a.length-1])||6!==l[0]&&2!==l[0])){o=0;continue}if(3===l[0]&&(!a||l[1]>a[0]&&l[1]<a[3])){o.label=l[1];break}if(6===l[0]&&o.label<a[1]){o.label=a[1],a=l;break}if(a&&o.label<a[2]){o.label=a[2],o.ops.push(l);break}a[2]&&o.ops.pop(),o.trys.pop();continue}l=t.call(e,o)}catch(e){l=[6,e],r=0}finally{n=a=0}if(5&l[0])throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}([l,c])}}}const M=function(e){var t=e.requestCustomOtpDto,n=e.phoneNumber,i=e.open,l=e.onModalClose,c=e.onOtpSuccessfullVerification,s=U((0,a.useState)(""),2),u=s[0],d=s[1],f=U((0,a.useState)(w.Draft),2),m=f[0],p=f[1],A=U((0,a.useState)(!1),2),h=A[0],y=A[1],_=U((0,a.useState)(""),2),b=_[0],g=_[1],v=function(e,t,n){(0,I.showSnackbar)({kind:e,title:t,subtitle:n})};return o().createElement(o().Fragment,null,o().createElement(r.aFV,{open:i,size:"md",onSecondarySubmit:l,onRequestClose:l,onRequestSubmit:function(){window.open("https://afyayangu.go.ke/","_blank")},primaryButtonText:"Register on Afya Yangu",secondaryButtonText:"Cancel"},o().createElement(r.cwr,null,o().createElement("div",{className:O.modalVerificationLayout},o().createElement("div",{className:O.sectionHeader},o().createElement("h4",{className:O.sectionTitle},"One Time Password (OTP)"),o().createElement("h6",null,"Enter one time password to proceed")),o().createElement("div",{className:O.sectionContent},o().createElement("div",{className:O.contentHeader},m===w.Draft?o().createElement(o().Fragment,null,o().createElement("h6",null,"Send Code to Phone ",j(n))):o().createElement(o().Fragment,null),m===w.Sent?o().createElement(o().Fragment,null,o().createElement(r.ksK,{id:"otp-input",labelText:"Enter OTP",value:u,onChange:function(e){return d(e.target.value)},placeholder:"Enter the code sent to your phone"})):o().createElement(o().Fragment,null),m===w.Verified?o().createElement(o().Fragment,null,o().createElement("h6",null,"OTP Verification Successfull!")):o().createElement(o().Fragment,null))),o().createElement("div",{className:O.sectionAction},m===w.Draft?o().createElement(o().Fragment,null,o().createElement(r.$nd,{kind:"primary",onClick:function(){return H((function(){var e,n,r;return Y(this,(function(a){switch(a.label){case 0:if(!t.identificationNumber)return v("error","Invalid Identification Value","Please enter a valid ID value"),[2];y(!0),a.label=1;case 1:return a.trys.push([1,3,4,5]),[4,(o=t,S((function(){var e,t;return k(this,(function(n){return e="".concat(E,"/client/send-custom-otp"),t={identificationNumber:o.identificationNumber,identificationType:o.identificationType,locationUuid:o.locationUuid},[2,T(e,t)]}))}))())];case 2:return e=a.sent(),g(e.sessionId),p(w.Sent),v("success","OTP sent successfully","A code was sent to ".concat(e.maskedPhone)),[3,5];case 3:return n=a.sent(),r=n.message||"Failed to send OTP",v("error","Error sending OTP",r),[3,5];case 4:return y(!1),[7];case 5:return[2]}var o}))}))()}},h?o().createElement(r.OuH,{description:"Sending OTP..."}):"Send OTP")):o().createElement(o().Fragment,null),m===w.Sent?o().createElement(o().Fragment,null,o().createElement(r.$nd,{kind:"primary",onClick:function(){return H((function(){var e,n;return Y(this,(function(r){switch(r.label){case 0:if(!u.trim())return v("error","Please enter the OTP code",""),[2];y(!0),r.label=1;case 1:return r.trys.push([1,3,4,5]),[4,(a={sessionId:b,otp:u,locationUuid:t.locationUuid},S((function(){var e,t;return k(this,(function(n){return e="".concat(E,"/client/validate-custom-otp"),t={sessionId:a.sessionId,otp:a.otp,locationUuid:a.locationUuid},[2,T(e,t)]}))}))())];case 2:return r.sent(),p(w.Verified),(0,I.showSnackbar)({kind:"success",title:"OTP Verified",subtitle:"You can now fetch data from Client Registry."}),[3,5];case 3:return e=r.sent(),n=e.message||"OTP verification failed",(0,I.showSnackbar)({kind:"error",title:"OTP Verification Failed",subtitle:n}),[3,5];case 4:return y(!1),[7];case 5:return[2]}var a}))}))()}},h?o().createElement(r.OuH,{description:"Verifying OTP..."}):"Verify")):o().createElement(o().Fragment,null),m===w.Verified?o().createElement(o().Fragment,null,o().createElement(r.$nd,{kind:"primary",onClick:c},"Continue")):o().createElement(o().Fragment,null))))))};var q=n(86575),L={};L.styleTagTransform=y(),L.setAttributes=m(),L.insert=d().bind(null,"head"),L.domAPI=s(),L.insertStyleElement=A(),l()(q.A,L);const V=q.A&&q.A.locals?q.A.locals:void 0;function J(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var W=["id","other_identifications","first_name","middle_name","last_name","gender","date_of_birth","is_alive","deceased_datetime","phone","email","civil_status","place_of_birth","citizenship","country","county","sub_county","ward","village_estate","longitude","latitude","identification_type"];const G=function(e){var t=e.client,n=(0,a.useMemo)((function(){return e=t,n={},Object.keys(e).filter((function(e){return W.includes(e)})).forEach((function(t){if("other_identifications"===t){var r=(o=e[t],i={},o.forEach((function(e){i[e.identification_type]=e.identification_number})),i);n=function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter((function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable})))),r.forEach((function(t){J(e,t,n[t])}))}return e}({},n,r)}else if("identification_type"===t)n[e.identification_type]=e.identification_number;else{var a=e[t];n[t]=a}var o,i})),n;var e,n}),[t]);return t&&n?o().createElement(o().Fragment,null,o().createElement(r.XIK,null,o().createElement(r.ndF,null,o().createElement(r.Hjg,null,o().createElement(r.A0N,null,"Field"),o().createElement(r.A0N,null,"Value"))),o().createElement(r.BFY,null,Object.keys(n).map((function(e){return o().createElement(r.Hjg,null,o().createElement(r.nA6,null,e),o().createElement(r.nA6,null,n[e]))}))))):o().createElement(o().Fragment,null,o().createElement("h4",null,"No patient Data to Display"))},$=function(){return o().createElement(o().Fragment,null,o().createElement(r.zWQ,{defaultSelected:"sha",legendText:"Patient",onChange:function(e){},name:"payment-options-radio-group"},o().createElement(r.aaP,{id:"sha",labelText:"Social Health Authority",value:"sha"}),o().createElement(r.aaP,{id:"insurance",labelText:"Other Insurance",value:"other"}),o().createElement(r.aaP,{id:"cash",labelText:"Cash",value:"cash"})))},z=function(e){var t=e.client,n=e.open,a=e.onModalClose,i=(e.onSubmit,e.onSendClientToTriage);return t?o().createElement(o().Fragment,null,o().createElement(r.aFV,{open:n,size:"md",onSecondarySubmit:a,onRequestClose:a,onRequestSubmit:function(){window.open("https://afyayangu.go.ke/","_blank")},primaryButtonText:"Register on Afya Yangu",secondaryButtonText:"Cancel"},o().createElement(r.cwr,null,o().createElement("div",{className:V.clientDetailsLayout},o().createElement("div",{className:V.sectionHeader},o().createElement("h4",{className:V.sectionTitle},"Patient/Payment Details")),o().createElement("div",{className:V.sectionContent},o().createElement(r.tUM,null,o().createElement(r.wbY,{contained:!0},o().createElement(r.ozo,null,"Patient Details"),o().createElement(r.ozo,null,"Payment Details")),o().createElement(r.T2N,null,o().createElement(r.KpK,null,o().createElement(G,{client:t})),o().createElement(r.KpK,null,o().createElement($,null))))),o().createElement("div",{className:V.actionSection},o().createElement("div",{className:V.btnContainer},o().createElement(r.$nd,{kind:"primary"},"Book Appointment")),o().createElement("div",{className:V.btnContainer},o().createElement(r.$nd,{kind:"secondary"},"Walk In Orders")),o().createElement("div",{className:V.btnContainer},o().createElement(r.$nd,{kind:"tertiary",onClick:function(){return i(t.id)}},"Send To Triage"))))))):o().createElement(o().Fragment,null,"No Client data")};function K(e,t,n,r,a,o,i){try{var l=e[o](i),c=l.value}catch(e){return void n(e)}l.done?t(c):Promise.resolve(c).then(r,a)}function Q(e){return(t=function(){var t,n,r,a;return function(e,t){var n,r,a,o={label:0,sent:function(){if(1&a[0])throw a[1];return a[1]},trys:[],ops:[]},i=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return i.next=l(0),i.throw=l(1),i.return=l(2),"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function l(l){return function(c){return function(l){if(n)throw new TypeError("Generator is already executing.");for(;i&&(i=0,l[0]&&(o=0)),o;)try{if(n=1,r&&(a=2&l[0]?r.return:l[0]?r.throw||((a=r.return)&&a.call(r),0):r.next)&&!(a=a.call(r,l[1])).done)return a;switch(r=0,a&&(l=[2&l[0],a.value]),l[0]){case 0:case 1:a=l;break;case 4:return o.label++,{value:l[1],done:!1};case 5:o.label++,r=l[1],l=[0];continue;case 7:l=o.ops.pop(),o.trys.pop();continue;default:if(!((a=(a=o.trys).length>0&&a[a.length-1])||6!==l[0]&&2!==l[0])){o=0;continue}if(3===l[0]&&(!a||l[1]>a[0]&&l[1]<a[3])){o.label=l[1];break}if(6===l[0]&&o.label<a[1]){o.label=a[1],a=l;break}if(a&&o.label<a[2]){o.label=a[2],o.ops.push(l);break}a[2]&&o.ops.pop(),o.trys.pop();continue}l=t.call(e,o)}catch(e){l=[6,e],r=0}finally{n=a=0}if(5&l[0])throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}([l,c])}}}(this,(function(o){switch(o.label){case 0:return t="".concat(I.restBaseUrl,"/patient"),n=new URLSearchParams({q:e,v:"full",includeDead:"true",limit:"10",totalCount:"true"}).toString(),[4,(0,I.openmrsFetch)("".concat(t,"?").concat(n))];case 1:return(r=o.sent()).ok?[3,3]:[4,r.text()];case 2:throw a=o.sent(),new Error("Request failed with ".concat(r.status,": ").concat(a));case 3:return[2,r.json()]}}))},function(){var e=this,n=arguments;return new Promise((function(r,a){var o=t.apply(e,n);function i(e){K(o,r,a,i,l,"next",e)}function l(e){K(o,r,a,i,l,"throw",e)}i(void 0)}))})();var t}var X=n(3754),Z={};Z.styleTagTransform=y(),Z.setAttributes=m(),Z.insert=d().bind(null,"head"),Z.domAPI=s(),Z.insertStyleElement=A(),l()(X.A,Z);const ee=X.A&&X.A.locals?X.A.locals:void 0;function te(e,t,n,r,a,o,i){try{var l=e[o](i),c=l.value}catch(e){return void n(e)}l.done?t(c):Promise.resolve(c).then(r,a)}function ne(e){return function(){var t=this,n=arguments;return new Promise((function(r,a){var o=e.apply(t,n);function i(e){te(o,r,a,i,l,"next",e)}function l(e){te(o,r,a,i,l,"throw",e)}i(void 0)}))}}function re(e,t){var n,r,a,o={label:0,sent:function(){if(1&a[0])throw a[1];return a[1]},trys:[],ops:[]},i=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return i.next=l(0),i.throw=l(1),i.return=l(2),"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function l(l){return function(c){return function(l){if(n)throw new TypeError("Generator is already executing.");for(;i&&(i=0,l[0]&&(o=0)),o;)try{if(n=1,r&&(a=2&l[0]?r.return:l[0]?r.throw||((a=r.return)&&a.call(r),0):r.next)&&!(a=a.call(r,l[1])).done)return a;switch(r=0,a&&(l=[2&l[0],a.value]),l[0]){case 0:case 1:a=l;break;case 4:return o.label++,{value:l[1],done:!1};case 5:o.label++,r=l[1],l=[0];continue;case 7:l=o.ops.pop(),o.trys.pop();continue;default:if(!((a=(a=o.trys).length>0&&a[a.length-1])||6!==l[0]&&2!==l[0])){o=0;continue}if(3===l[0]&&(!a||l[1]>a[0]&&l[1]<a[3])){o.label=l[1];break}if(6===l[0]&&o.label<a[1]){o.label=a[1],a=l;break}if(a&&o.label<a[2]){o.label=a[2],o.ops.push(l);break}a[2]&&o.ops.pop(),o.trys.pop();continue}l=t.call(e,o)}catch(e){l=[6,e],r=0}finally{n=a=0}if(5&l[0])throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}([l,c])}}}function ae(e){return ne((function(){var t,n,r,a;return re(this,(function(o){switch(o.label){case 0:return t="".concat(I.restBaseUrl,"/queue"),n=new URLSearchParams({v:"custom:(uuid,display,name,description,service:(uuid,display),allowedPriorities:(uuid,display),allowedStatuses:(uuid,display),location:(uuid,display))",location:e}).toString(),[4,(0,I.openmrsFetch)("".concat(t,"?").concat(n))];case 1:return(r=o.sent()).ok?[3,3]:[4,r.text()];case 2:throw a=o.sent(),new Error("Request failed with ".concat(r.status,": ").concat(a));case 3:return[2,r.json()]}}))}))()}function oe(e,t,n,r,a,o,i){try{var l=e[o](i),c=l.value}catch(e){return void n(e)}l.done?t(c):Promise.resolve(c).then(r,a)}function ie(e){return(t=function(){var t,n,r;return function(e,t){var n,r,a,o={label:0,sent:function(){if(1&a[0])throw a[1];return a[1]},trys:[],ops:[]},i=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return i.next=l(0),i.throw=l(1),i.return=l(2),"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function l(l){return function(c){return function(l){if(n)throw new TypeError("Generator is already executing.");for(;i&&(i=0,l[0]&&(o=0)),o;)try{if(n=1,r&&(a=2&l[0]?r.return:l[0]?r.throw||((a=r.return)&&a.call(r),0):r.next)&&!(a=a.call(r,l[1])).done)return a;switch(r=0,a&&(l=[2&l[0],a.value]),l[0]){case 0:case 1:a=l;break;case 4:return o.label++,{value:l[1],done:!1};case 5:o.label++,r=l[1],l=[0];continue;case 7:l=o.ops.pop(),o.trys.pop();continue;default:if(!((a=(a=o.trys).length>0&&a[a.length-1])||6!==l[0]&&2!==l[0])){o=0;continue}if(3===l[0]&&(!a||l[1]>a[0]&&l[1]<a[3])){o.label=l[1];break}if(6===l[0]&&o.label<a[1]){o.label=a[1],a=l;break}if(a&&o.label<a[2]){o.label=a[2],o.ops.push(l);break}a[2]&&o.ops.pop(),o.trys.pop();continue}l=t.call(e,o)}catch(e){l=[6,e],r=0}finally{n=a=0}if(5&l[0])throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}([l,c])}}}(this,(function(a){switch(a.label){case 0:return t="".concat(I.restBaseUrl,"/visit"),[4,(0,I.openmrsFetch)(t,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(e)})];case 1:return(n=a.sent()).ok?[3,3]:[4,n.text()];case 2:throw r=a.sent(),new Error("Request failed with ".concat(n.status,": ").concat(r));case 3:return[2,n.json()]}}))},function(){var e=this,n=arguments;return new Promise((function(r,a){var o=t.apply(e,n);function i(e){oe(o,r,a,i,l,"next",e)}function l(e){oe(o,r,a,i,l,"throw",e)}i(void 0)}))})();var t}function le(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function ce(e,t,n,r,a,o,i){try{var l=e[o](i),c=l.value}catch(e){return void n(e)}l.done?t(c):Promise.resolve(c).then(r,a)}function se(e){return function(){var t=this,n=arguments;return new Promise((function(r,a){var o=e.apply(t,n);function i(e){ce(o,r,a,i,l,"next",e)}function l(e){ce(o,r,a,i,l,"throw",e)}i(void 0)}))}}function ue(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,a,o=[],i=!0,l=!1;try{for(n=n.call(e);!(i=(r=n.next()).done)&&(o.push(r.value),!t||o.length!==t);i=!0);}catch(e){l=!0,a=e}finally{try{i||null==n.return||n.return()}finally{if(l)throw a}}return o}}(e,t)||function(e,t){if(e){if("string"==typeof e)return le(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?le(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function de(e,t){var n,r,a,o={label:0,sent:function(){if(1&a[0])throw a[1];return a[1]},trys:[],ops:[]},i=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return i.next=l(0),i.throw=l(1),i.return=l(2),"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function l(l){return function(c){return function(l){if(n)throw new TypeError("Generator is already executing.");for(;i&&(i=0,l[0]&&(o=0)),o;)try{if(n=1,r&&(a=2&l[0]?r.return:l[0]?r.throw||((a=r.return)&&a.call(r),0):r.next)&&!(a=a.call(r,l[1])).done)return a;switch(r=0,a&&(l=[2&l[0],a.value]),l[0]){case 0:case 1:a=l;break;case 4:return o.label++,{value:l[1],done:!1};case 5:o.label++,r=l[1],l=[0];continue;case 7:l=o.ops.pop(),o.trys.pop();continue;default:if(!((a=(a=o.trys).length>0&&a[a.length-1])||6!==l[0]&&2!==l[0])){o=0;continue}if(3===l[0]&&(!a||l[1]>a[0]&&l[1]<a[3])){o.label=l[1];break}if(6===l[0]&&o.label<a[1]){o.label=a[1],a=l;break}if(a&&o.label<a[2]){o.label=a[2],o.ops.push(l);break}a[2]&&o.ops.pop(),o.trys.pop();continue}l=t.call(e,o)}catch(e){l=[6,e],r=0}finally{n=a=0}if(5&l[0])throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}([l,c])}}}const fe=function(e){var t=e.patients,n=e.open,i=e.onModalClose,l=(e.onSubmit,e.client),c=e.onCreateAmrsPatient,s=e.onManualRegistration,u=ue((0,a.useState)(),2),d=u[0],f=u[1],m=ue((0,a.useState)(),2),p=m[0],A=m[1],h=ue((0,a.useState)(),2),y=h[0],_=h[1],b=ue((0,a.useState)(),2),g=b[0],v=b[1],w=ue((0,a.useState)(""),2),C=w[0],E=w[1],x=ue((0,a.useState)(!1),2),S=x[0],k=x[1],T=(0,I.useVisitTypes)(),N=(0,I.useSession)().sessionLocation.uuid;if((0,a.useEffect)((function(){P()}),[t]),!t)return o().createElement(o().Fragment,null,"No Client data");var P=function(){return se((function(){var e;return de(this,(function(t){switch(t.label){case 0:return[4,ae(N)];case 1:return(e=t.sent())&&e.results&&_(e.results),[2]}}))}))()},D=function(e){return e.location?e.patient?!!e.visitType||(j("error","Please select a visit",""),!1):(j("error","Please select a patient",""),!1):(j("error","Missing location in create visits",""),!1)},O=function(){var e;return{visitType:p,location:N,startDatetime:null,stopDatetime:null,patient:null!==(e=null==d?void 0:d.uuid)&&void 0!==e?e:""}},j=function(e,t,n){(0,I.showSnackbar)({kind:e,title:t,subtitle:n})};return o().createElement(o().Fragment,null,o().createElement(r.aFV,{open:n,size:"md",onSecondarySubmit:function(){return i({success:!1})},onRequestClose:function(){return i({success:!1})},onRequestSubmit:function(){window.open("https://afyayangu.go.ke/","_blank")},primaryButtonText:"Register on Afya Yangu",secondaryButtonText:"Cancel"},o().createElement(r.cwr,null,o().createElement("div",{className:ee.clientDetailsLayout},o().createElement("div",{className:ee.sectionHeader},o().createElement("h4",{className:ee.sectionTitle},"Send To Triage")),t.length>0?o().createElement("div",{className:ee.sectionContent},o().createElement("div",{className:ee.patientSelect},o().createElement(r.XIK,null,o().createElement(r.ndF,null,o().createElement(r.Hjg,null,o().createElement(r.A0N,null,"No"),o().createElement(r.A0N,null,"Name"),o().createElement(r.A0N,null,"Gender"),o().createElement(r.A0N,null,"Select Patient"))),o().createElement(r.BFY,null,t.map((function(e,t){return o().createElement(r.Hjg,{key:e.uuid},o().createElement(r.nA6,null,t+1),o().createElement(r.nA6,null,e.person.preferredName.display),o().createElement(r.nA6,null,e.person.gender),o().createElement(r.nA6,null,o().createElement(r.Sc0,{id:e.uuid,labelText:"",onChange:function(){f(e)}})))}))))),o().createElement("div",{className:ee.formSection},o().createElement("div",{className:ee.formRow},o().createElement("div",{className:ee.formControl},o().createElement(r.l6P,{id:"visit-type",labelText:"Select a Visit Type",onChange:function(e){var t=e.target.value;A(t)}},o().createElement(r.ebT,{value:"",text:"Select"}),";",T&&T.map((function(e){return o().createElement(r.ebT,{value:e.uuid,text:e.display})})))),o().createElement("div",{className:ee.formControl},o().createElement(r.l6P,{id:"service",labelText:"Select a Service",onChange:function(e){var t=e.target.value;v(t)}},o().createElement(r.ebT,{value:"",text:"Select"}),";",y&&y.map((function(e){return o().createElement(r.ebT,{value:e.uuid,text:e.display})}))))),o().createElement("div",{className:ee.formRow},o().createElement("div",{className:ee.formControl},o().createElement(r.l6P,{id:"priority",labelText:"Select Priority",onChange:function(e){return t=e.target.value,void E(t);var t}},o().createElement(r.ebT,{value:"",text:"Select"}),";",o().createElement(r.ebT,{value:"bbd99c12-67e9-4381-8b4c-1f231e86f8e2",text:"NORMAL"}),";",o().createElement(r.ebT,{value:"8e86ff12-ec83-41e8-a534-bb410739d880",text:"EMERGENCY"}),";"))))):o().createElement(o().Fragment,null),o().createElement("div",{className:ee.actionSection},t.length>0?o().createElement("div",{className:ee.btnContainer},o().createElement(r.$nd,{kind:"primary",onClick:function(){return se((function(){var e,t;return de(this,(function(n){switch(n.label){case 0:k(!0),n.label=1;case 1:return n.trys.push([1,5,6,7]),[4,se((function(){var e,t;return de(this,(function(n){switch(n.label){case 0:return e=O(),D(e)?[4,ie(e)]:[2,!1];case 1:if(t=n.sent())return j("success","Visit has been created succesfully",""),[2,t];throw j("error","Error creating patient visit",""),new Error("Error creating patient visit")}}))}))()];case 2:return(e=n.sent())?(r=e.uuid,t={visit:{uuid:r},queueEntry:{status:{uuid:"89d01aa5-0ab0-4626-934b-37766b4cd779"},priority:{uuid:C},queue:{uuid:g},patient:{uuid:d.uuid},startedAt:(new Date).toISOString(),sortWeight:0}},[4,(a=t,ne((function(){var e,t,n;return re(this,(function(r){switch(r.label){case 0:return e="".concat(I.restBaseUrl,"/visit-queue-entry"),[4,(0,I.openmrsFetch)(e,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(a)})];case 1:return(t=r.sent()).ok?[3,3]:[4,t.text()];case 2:throw n=r.sent(),new Error("Request failed with ".concat(t.status,": ").concat(n));case 3:return[2,t.json()]}}))}))())]):[3,4];case 3:n.sent()&&(j("success","Patient has succesfully been moved to the Triage queue",""),i({success:!0})),n.label=4;case 4:return[3,7];case 5:return n.sent(),j("error","Error creating visit",""),[3,7];case 6:return k(!1),[7];case 7:return[2]}var r,a}))}))()}},S?o().createElement(r.OuH,{description:"Sending To Triage..."}):"Send To Triage")):o().createElement(o().Fragment,null,o().createElement("div",{className:ee.patientAction},o().createElement("div",{className:ee.btnContainer},o().createElement(r.$nd,{kind:"primary",onClick:function(){return c(l)}},"Automatically Register in AMRS")),o().createElement("div",{className:ee.btnContainer},o().createElement(r.$nd,{kind:"secondary",onClick:s},"Manually Register")))))))))};var me=n(27114);function pe(e,t){return"".concat(e.first_name," ").concat(R(e.middle_name)," (").concat(e.gender,") (DOB: ").concat(e.date_of_birth,") (").concat(t,") (CR: ").concat(e.id,")")}function Ae(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function he(e){return function(e){if(Array.isArray(e))return Ae(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(e){if("string"==typeof e)return Ae(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Ae(e,t):void 0}}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}var ye=he([C.Cr,C.SHANumber,C.HouseholdNumber,C.RefugeeID,C.MandateNumber,C.AlienID,C.NationalID,C.TemporaryDependantID]).concat(he(["first_name","middle_name","last_name"]),he(["gender","date_of_birth","is_alive","deceased_datetime"]),he(["phone","email","civil_status","place_of_birth","citizenship"]),he(["country","county","sub_county","ward","village_estate","longitude","latitude"]));function _e(e){var t="";switch(e){case"Divorced":t="a899ad58-1350-11df-a1f1-0026b9348838";break;case"Married":t="a8aa76b0-1350-11df-a1f1-0026b9348838";break;case"Single":t="a899ac7c-1350-11df-a1f1-0026b9348838";break;default:t="a89ad3a4-1350-11df-a1f1-0026b9348838"}return t}function be(e){var t;switch(e){case C.NationalID:t="58a47054-1359-11df-a1f1-0026b9348838";break;case C.HouseholdNumber:t="bb74b20e-dcee-4f59-bdf1-2dffc3abf106";break;case C.AlienID:t="12f5b147-3403-4a73-913d-7ded9ffec094";break;case C.SHANumber:t="cf5362b2-8049-4442-b3c6-36f870e320cb";break;case C.MandateNumber:t="aae2d097-20ba-43ca-9b71-fd8296068f39";break;case C.RefugeeID:t="465e81af-8d69-47e9-9127-53a94adc75fb";break;case C.Cr:t="e88dc246-3614-4ee3-8141-1f2a83054e72";break;case C.BirthCertificate:t="7924e13b-131a-4da8-8efa-e294184a1b0d";break;case C.TemporaryDependantID:t="a3d34214-93e8-4faf-bf4d-0272eee079eb"}return t}function ge(e,t,n,r,a,o,i){try{var l=e[o](i),c=l.value}catch(e){return void n(e)}l.done?t(c):Promise.resolve(c).then(r,a)}function ve(e){return function(){var t=this,n=arguments;return new Promise((function(r,a){var o=e.apply(t,n);function i(e){ge(o,r,a,i,l,"next",e)}function l(e){ge(o,r,a,i,l,"throw",e)}i(void 0)}))}}function we(e,t){var n,r,a,o={label:0,sent:function(){if(1&a[0])throw a[1];return a[1]},trys:[],ops:[]},i=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return i.next=l(0),i.throw=l(1),i.return=l(2),"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function l(l){return function(c){return function(l){if(n)throw new TypeError("Generator is already executing.");for(;i&&(i=0,l[0]&&(o=0)),o;)try{if(n=1,r&&(a=2&l[0]?r.return:l[0]?r.throw||((a=r.return)&&a.call(r),0):r.next)&&!(a=a.call(r,l[1])).done)return a;switch(r=0,a&&(l=[2&l[0],a.value]),l[0]){case 0:case 1:a=l;break;case 4:return o.label++,{value:l[1],done:!1};case 5:o.label++,r=l[1],l=[0];continue;case 7:l=o.ops.pop(),o.trys.pop();continue;default:if(!((a=(a=o.trys).length>0&&a[a.length-1])||6!==l[0]&&2!==l[0])){o=0;continue}if(3===l[0]&&(!a||l[1]>a[0]&&l[1]<a[3])){o.label=l[1];break}if(6===l[0]&&o.label<a[1]){o.label=a[1],a=l;break}if(a&&o.label<a[2]){o.label=a[2],o.ops.push(l);break}a[2]&&o.ops.pop(),o.trys.pop();continue}l=t.call(e,o)}catch(e){l=[6,e],r=0}finally{n=a=0}if(5&l[0])throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}([l,c])}}}var Ce=function(e,t){return ve((function(){var n,r;return we(this,(function(a){switch(a.label){case 0:return[4,ve((function(){var e,t,n;return we(this,(function(r){switch(r.label){case 0:return e=new AbortController,[4,(0,I.openmrsFetch)("https://staging.ampath.or.ke/amrs-id-generator/generateidentifier",{headers:{"Content-Type":"application/json"},method:"POST",body:{user:1},signal:e.signal})];case 1:return[4,r.sent().json()];case 2:return t=r.sent(),[2,null!==(n=t.identifier)&&void 0!==n?n:""]}}))}))()];case 1:return n=a.sent(),r=function(e,t){var n=[];return n.push({identifierType:be(C.Cr),identifier:e.id,location:t}),n.push({identifierType:be(e.identification_type),identifier:e.identification_number,location:t}),n}(t,e),r.push({identifierType:"58a4732e-1359-11df-a1f1-0026b9348838",identifier:n,location:e,preferred:!0}),[2,r]}}))}))()};function Ee(e,t,n,r,a,o,i){try{var l=e[o](i),c=l.value}catch(e){return void n(e)}l.done?t(c):Promise.resolve(c).then(r,a)}function xe(e,t){return(n=function(){var n,r;return function(e,t){var n,r,a,o={label:0,sent:function(){if(1&a[0])throw a[1];return a[1]},trys:[],ops:[]},i=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return i.next=l(0),i.throw=l(1),i.return=l(2),"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function l(l){return function(c){return function(l){if(n)throw new TypeError("Generator is already executing.");for(;i&&(i=0,l[0]&&(o=0)),o;)try{if(n=1,r&&(a=2&l[0]?r.return:l[0]?r.throw||((a=r.return)&&a.call(r),0):r.next)&&!(a=a.call(r,l[1])).done)return a;switch(r=0,a&&(l=[2&l[0],a.value]),l[0]){case 0:case 1:a=l;break;case 4:return o.label++,{value:l[1],done:!1};case 5:o.label++,r=l[1],l=[0];continue;case 7:l=o.ops.pop(),o.trys.pop();continue;default:if(!((a=(a=o.trys).length>0&&a[a.length-1])||6!==l[0]&&2!==l[0])){o=0;continue}if(3===l[0]&&(!a||l[1]>a[0]&&l[1]<a[3])){o.label=l[1];break}if(6===l[0]&&o.label<a[1]){o.label=a[1],a=l;break}if(a&&o.label<a[2]){o.label=a[2],o.ops.push(l);break}a[2]&&o.ops.pop(),o.trys.pop();continue}l=t.call(e,o)}catch(e){l=[6,e],r=0}finally{n=a=0}if(5&l[0])throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}([l,c])}}}(this,(function(a){switch(a.label){case 0:return n=function(e){var t={},n={},r={},a=[];ye.forEach((function(o){"first_name"===o&&(n.givenName=e.first_name),"middle_name"===o&&(n.middleName=e.middle_name),"last_name"===o&&(n.familyName=e.last_name),"gender"===o&&(t.gender="Male"===e.gender?"M":"F"),"date_of_birth"===o&&(t.birthdate=e.date_of_birth,t.birthdateEstimated=!1),"is_alive"===o&&(t.dead=0===e.is_alive),"deceased_datetime"===o&&e.deceased_datetime.length>0&&(t.deathDate=e.deceased_datetime),"country"===o&&e.country.length>0&&(r.country=e.country,r.address1=e.country),"place_of_birth"===o&&e.place_of_birth.length>0&&(r.address10=e.place_of_birth),"county"===o&&e.county.length>0&&(r.countyDistrict=e.county),"sub_county"===o&&e.sub_county.length>0&&(r.address2=e.sub_county,r.stateProvince=e.sub_county),"ward"===o&&e.sub_county.length>0&&(r.address7=e.sub_county,r.address4=e.sub_county),"village_estate"===o&&e.village_estate.length>0&&(r.cityVillage=e.village_estate),"longitude"===o&&e.longitude.length>0&&(r.longitude=e.longitude),"latitude"===o&&e.latitude.length>0&&(r.latitude=e.latitude),"place_of_birth"===o&&e.place_of_birth.length>0&&a.push({value:e.place_of_birth,attributeType:"8d8718c2-c2cc-11de-8d13-0010c6dffd0f"}),"phone"===o&&e.phone.length>0&&a.push({value:e.phone,attributeType:"72a759a8-1359-11df-a1f1-0026b9348838"}),"email"===o&&e.email.length>0&&a.push({value:e.email,attributeType:"2f65dbcb-3e58-45a3-8be7-fd1dc9aa0faa"}),"civil_status"===o&&e.civil_status.length>0&&a.push({value:_e(e.civil_status),attributeType:"8d871f2a-c2cc-11de-8d13-0010c6dffd0f"}),"id"===o&&e.id&&a.push({value:e.id,attributeType:"e068e02b-faac-4baf-bd58-fe6e0c29a81f"}),"citizenship"===o&&e.citizenship&&a.push({value:e.citizenship,attributeType:"8d871afc-c2cc-11de-8d13-0010c6dffd0f"})}));var o=function(e){var t=[],n=e.find((function(e){return"Alternative Phone Number"===e.relationship})),r=e.find((function(e){return"Next Of Kin"===e.remarks}));return n&&"Phone"===n.contact_type&&t.push({value:n.contact_id,attributeType:"c725f524-c14a-4468-ac19-4a0e6661c930"}),r&&("Phone"===r.contact_type&&t.push({value:r.contact_id,attributeType:"a657a4f1-9c0f-444b-a1fd-445bb91dd12d"}),t.push({value:r.relationship,attributeType:"5730994e-c267-426b-87b6-c152b606973d"}),t.push({value:r.contact_name,attributeType:"72a75bec-1359-11df-a1f1-0026b9348838"})),t}(e.alternative_contacts);return a=he(a).concat(he(o)),Object.keys(n).length>0&&(t.names=[n]),Object.keys(r).length>0&&(t.addresses=[r]),a.length>0&&(t.attributes=a),t}(e),[4,Ce(t,e)];case 1:return r=a.sent(),[4,(o={person:n,identifiers:r},ve((function(){return we(this,(function(e){switch(e.label){case 0:return[4,(0,I.openmrsFetch)("".concat(I.restBaseUrl,"/patient"),{method:"POST",headers:{"Content-Type":"application/json"},body:o})];case 1:return[2,e.sent()]}}))}))())];case 2:return[4,a.sent().json()];case 3:return[2,a.sent()]}var o}))},function(){var e=this,t=arguments;return new Promise((function(r,a){var o=n.apply(e,t);function i(e){Ee(o,r,a,i,l,"next",e)}function l(e){Ee(o,r,a,i,l,"throw",e)}i(void 0)}))})();var n}function Se(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function ke(e,t,n,r,a,o,i){try{var l=e[o](i),c=l.value}catch(e){return void n(e)}l.done?t(c):Promise.resolve(c).then(r,a)}function Te(e){return function(){var t=this,n=arguments;return new Promise((function(r,a){var o=e.apply(t,n);function i(e){ke(o,r,a,i,l,"next",e)}function l(e){ke(o,r,a,i,l,"throw",e)}i(void 0)}))}}function Ne(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,a,o=[],i=!0,l=!1;try{for(n=n.call(e);!(i=(r=n.next()).done)&&(o.push(r.value),!t||o.length!==t);i=!0);}catch(e){l=!0,a=e}finally{try{i||null==n.return||n.return()}finally{if(l)throw a}}return o}}(e,t)||function(e,t){if(e){if("string"==typeof e)return Se(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Se(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Ie(e,t){var n,r,a,o={label:0,sent:function(){if(1&a[0])throw a[1];return a[1]},trys:[],ops:[]},i=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return i.next=l(0),i.throw=l(1),i.return=l(2),"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function l(l){return function(c){return function(l){if(n)throw new TypeError("Generator is already executing.");for(;i&&(i=0,l[0]&&(o=0)),o;)try{if(n=1,r&&(a=2&l[0]?r.return:l[0]?r.throw||((a=r.return)&&a.call(r),0):r.next)&&!(a=a.call(r,l[1])).done)return a;switch(r=0,a&&(l=[2&l[0],a.value]),l[0]){case 0:case 1:a=l;break;case 4:return o.label++,{value:l[1],done:!1};case 5:o.label++,r=l[1],l=[0];continue;case 7:l=o.ops.pop(),o.trys.pop();continue;default:if(!((a=(a=o.trys).length>0&&a[a.length-1])||6!==l[0]&&2!==l[0])){o=0;continue}if(3===l[0]&&(!a||l[1]>a[0]&&l[1]<a[3])){o.label=l[1];break}if(6===l[0]&&o.label<a[1]){o.label=a[1],a=l;break}if(a&&o.label<a[2]){o.label=a[2],o.ops.push(l);break}a[2]&&o.ops.pop(),o.trys.pop();continue}l=t.call(e,o)}catch(e){l=[6,e],r=0}finally{n=a=0}if(5&l[0])throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}([l,c])}}}const Pe=function(){var e=Ne((0,a.useState)("National ID"),2),t=e[0],n=e[1],i=Ne((0,a.useState)(""),2),l=i[0],c=i[1],s=Ne((0,a.useState)(!1),2),u=s[0],d=s[1],f=Ne((0,a.useState)(),2),m=f[0],p=f[1],A=Ne((0,a.useState)(),2),h=A[0],y=A[1],_=Ne((0,a.useState)([]),2),b=_[0],w=_[1],C=Ne((0,a.useState)("principal"),2),E=C[0],x=C[1],S=Ne((0,a.useState)(!1),2),k=S[0],T=S[1],P=Ne((0,a.useState)(!1),2),D=P[0],O=P[1],F=Ne((0,a.useState)(!1),2),B=F[0],H=F[1],U=Ne((0,a.useState)(),2),Y=U[0],q=U[1],L=(0,I.useSession)().sessionLocation.uuid,V=(0,me.useNavigate)(),J=function(e,t,n){(0,I.showSnackbar)({kind:e,title:t,subtitle:n})},W=function(){O(!1)},G=function(){window.location.href="".concat(window.spaBase,"/patient-registration")},$=function(){return"principal"===E?m:"dependants"===E?h:m};return o().createElement(o().Fragment,null,o().createElement("div",{className:g.registryLayout},o().createElement("div",{className:g.mainContent},o().createElement("div",{className:g.registryHeader},o().createElement("h4",null,"Client Registry"),o().createElement("p",null,"Please enter identification number to begin")),o().createElement("div",{className:g.registryContent},o().createElement("div",{className:g.formRow},o().createElement("div",{className:g.formControl},o().createElement(r.msM,{id:"identifier-type-dropdown",label:"Identifier Type",titleText:"Select Identifier Type",items:v,selectedItem:t,onChange:function(e){var t=e.selectedItem;return n(t)}})),o().createElement("div",{className:g.formControl},o().createElement(r.ksK,{id:"identifier-value",labelText:"".concat(t," Value"),value:l,onChange:function(e){return c(e.target.value)},placeholder:"Enter ".concat(t.toLowerCase()," value")}))),o().createElement("div",{className:g.formRow},o().createElement("div",{className:g.formControl},o().createElement("div",{className:g.formBtn},o().createElement(r.$nd,{className:g.registrySearchBtn,kind:"primary",onClick:function(){return Te((function(){var e,n,r,a,o,i;return Ie(this,(function(c){switch(c.label){case 0:d(!0),c.label=1;case 1:return c.trys.push([1,3,4,5]),function(e){return e.identificationNumber?e.identificationType?!!e.locationUuid||(J("error","No default location selected",""),!1):(J("error","Please enter a valid identification type",""),!1):(J("error","Please enter a valid identification number",""),!1)}(e={identificationNumber:l,identificationType:t,locationUuid:L})?(q(e),[4,N(e)]):[2,!1];case 2:if(n=c.sent(),0===(r=Array.isArray(n)?n:[]).length)throw new Error("No matching patient found in Client Registry.");return a=r[0],p(a),J("success","Client Data Loaded","Patient fetched successfully"),[3,5];case 3:return o=c.sent(),i=o.message||"Failed to fetch client data",J("error","Fetch Failed",i),[3,5];case 4:return d(!1),[7];case 5:return[2]}}))}))()},disabled:u},u?o().createElement(r.OuH,{description:"Searching..."}):"Search"),o().createElement(r.$nd,{className:g.registrySearchBtn,kind:"secondary",onClick:G},"Emergency Registration")))),m?o().createElement("div",{className:g.formRow},o().createElement("div",{className:g.hieData},o().createElement("div",{className:g.selectionHeader},o().createElement("h5",null,"Please select one patient and request patient to share the OTP sent")),o().createElement("div",{className:g.patientSelect},o().createElement("div",{className:g.patientSelectRadio},o().createElement(r.zWQ,{defaultSelected:"principal",legendText:"Patient",onChange:function(e){x(e)},name:"radio-button-default-group"},o().createElement(r.aaP,{id:"principal",labelText:"Principal",value:"principal"}),o().createElement(r.aaP,{id:"dependants",labelText:"Dependants",value:"dependants"}))),o().createElement("div",{className:g.patientConfirmSelection},o().createElement("div",{className:g.btnContainer},o().createElement(r.$nd,{kind:"primary",onClick:function(){T(!0)}}," ","Confirm")),o().createElement("div",{className:g.btnContainer},o().createElement(r.$nd,{kind:"secondary",onClick:function(){p(null),y(null),w([]),x(null),c(""),n("National ID"),O(!1),T(!1),H(!1)}},"Cancel")))),o().createElement("div",{className:g.principalDependantSection},"principal"===E?o().createElement(o().Fragment,null,o().createElement(r.XIK,null,o().createElement(r.ndF,null,o().createElement(r.Hjg,null,o().createElement(r.A0N,null,"Name"),o().createElement(r.A0N,null,"CR"),o().createElement(r.A0N,null,"Phone No"),o().createElement(r.A0N,null,"ID No"))),o().createElement(r.BFY,null,o().createElement(r.Hjg,null,o().createElement(r.nA6,null,m.first_name," ",R(m.middle_name)," ",R(m.last_name)),o().createElement(r.nA6,null,j(m.id)),o().createElement(r.nA6,null,j(m.phone)),o().createElement(r.nA6,null,j(m.identification_number)))))):o().createElement(o().Fragment,null),"dependants"===E?o().createElement(o().Fragment,null,o().createElement(r.zWQ,{defaultSelected:"",helperText:"",invalidText:"",legendText:"",name:"dependant-group",onChange:function(e){return function(e){var t=m.dependants;if(t.length>0){var n=t.find((function(t){return t.result[0].id===e}));n&&y(n.result[0])}}(e)}},m.dependants.map((function(e){var t=e.result[0],n=e.relationship;return o().createElement(r.aaP,{id:t.id,labelText:pe(t,n),value:t.id})})))):o().createElement(o().Fragment,null),k?o().createElement(M,{requestCustomOtpDto:Y,phoneNumber:m.phone,open:k,onModalClose:function(){T(!1)},onOtpSuccessfullVerification:function(){T(!1),O(!0)}}):o().createElement(o().Fragment,null),m&&D?o().createElement(o().Fragment,null,o().createElement(z,{client:$(),open:D,onModalClose:W,onSubmit:function(){},onSendClientToTriage:function(e){return Te((function(){var t;return Ie(this,(function(n){switch(n.label){case 0:return W(),[4,Q(e)];case 1:return(t=n.sent()).totalCount>0?(J("success","".concat(t.totalCount," ").concat(t.totalCount>0?"Patients":"Patient"," found in the system with ").concat(e),""),w(t.results),H(!0)):(J("error","Patient not found in the system",""),w([]),H(!0)),[2]}}))}))()}})," "):o().createElement(o().Fragment,null),m&&B?o().createElement(o().Fragment,null,o().createElement(fe,{client:$(),patients:b,open:B,onModalClose:function(e){H(!1),e&&e.success&&V("/triage")},onSubmit:function(){},onCreateAmrsPatient:function(e){return Te((function(){var e,t,n,r,a,o,i,l,c,s,u;return Ie(this,(function(d){switch(d.label){case 0:return d.trys.push([0,2,,3]),[4,xe(h,L)];case 1:return(e=d.sent())&&(J("success","Patient created succesfully",""),w([e])),[3,3];case 2:if(t=d.sent(),r=null!==(n=t.responseBody)&&void 0!==n?n:t.message,J("error","Error Creating Patient",""),a=function(e){var t=[];if(e&&e.error)if(e.error.error){var n=e.error.error.globalErrors||null;if(n){var r=!0,a=!1,o=void 0;try{for(var i,l=n[Symbol.iterator]();!(r=(i=l.next()).done);r=!0){var c=i.value;t.push(c.message)}}catch(e){a=!0,o=e}finally{try{r||null==l.return||l.return()}finally{if(a)throw o}}}}else if(e.error)if(e.error.globalErrors){var s=e.error.globalErrors||null;if(s){var u=!0,d=!1,f=void 0;try{for(var m,p=s[Symbol.iterator]();!(u=(m=p.next()).done);u=!0){var A=m.value;t.push(A.message)}}catch(e){d=!0,f=e}finally{try{u||null==p.return||p.return()}finally{if(d)throw f}}}}else e.error.message&&t.push(e.error.message);else t.push(e.error.error.message||"An error occurred while creating the patient. Please try again or contact support");return t}(r),a&&a.length>0){o=!0,i=!1,l=void 0;try{for(c=a[Symbol.iterator]();!(o=(s=c.next()).done);o=!0)u=s.value,J("error",u,"")}catch(e){i=!0,l=e}finally{try{o||null==c.return||c.return()}finally{if(i)throw l}}}return[3,3];case 3:return[2]}}))}))()},onManualRegistration:function(){H(!1),G()}})):o().createElement(o().Fragment,null)))):o().createElement(o().Fragment,null)))))}}}]);
1
+ "use strict";(globalThis.webpackChunk_ampath_esm_dha_workflow_app=globalThis.webpackChunk_ampath_esm_dha_workflow_app||[]).push([[306],{3754:(e,t,n)=>{n.d(t,{A:()=>l});var r=n(72996),a=n.n(r),o=n(70159),i=n.n(o)()(a());i.push([e.id,".-esm-dha-workflow__send-to-triage-modal__formSection___8euyX{display:flex;flex-direction:column;width:100%;row-gap:5px;margin-top:15px}.-esm-dha-workflow__send-to-triage-modal__formRow___Hf27O{display:flex;flex-direction:row;width:100%;column-gap:5px}.-esm-dha-workflow__send-to-triage-modal__formControl___Gmnpd{display:flex;flex-direction:column;width:40%;row-gap:5px}.-esm-dha-workflow__send-to-triage-modal__actionSection___Dlgbe{display:flex;flex-direction:row;column-gap:5px;margin-top:15px}.-esm-dha-workflow__send-to-triage-modal__patientAction___ECxUB{display:flex;flex-direction:row;column-gap:5px;margin-top:15px}","",{version:3,sources:["webpack://./src/registry/modal/send-to-triage/send-to-triage.modal.scss"],names:[],mappings:"AAAA,8DACI,YAAA,CACA,qBAAA,CACA,UAAA,CACA,WAAA,CACA,eAAA,CAEJ,0DACG,YAAA,CACA,kBAAA,CACA,UAAA,CACA,cAAA,CAEH,8DACG,YAAA,CACA,qBAAA,CACA,SAAA,CACA,WAAA,CAEH,gEACI,YAAA,CACA,kBAAA,CACA,cAAA,CACA,eAAA,CAEJ,gEACI,YAAA,CACA,kBAAA,CACA,cAAA,CACA,eAAA",sourcesContent:[".formSection{\n display: flex;\n flex-direction: column;\n width: 100%;\n row-gap: 5px;\n margin-top: 15px;\n}\n.formRow{\n display: flex;\n flex-direction: row;\n width: 100%;\n column-gap: 5px;\n}\n.formControl{\n display: flex;\n flex-direction: column;\n width: 40%;\n row-gap: 5px;\n}\n.actionSection{\n display: flex;\n flex-direction: row;\n column-gap: 5px;\n margin-top: 15px;\n}\n.patientAction{\n display: flex;\n flex-direction: row;\n column-gap: 5px;\n margin-top: 15px;\n}"],sourceRoot:""}]),i.locals={formSection:"-esm-dha-workflow__send-to-triage-modal__formSection___8euyX",formRow:"-esm-dha-workflow__send-to-triage-modal__formRow___Hf27O",formControl:"-esm-dha-workflow__send-to-triage-modal__formControl___Gmnpd",actionSection:"-esm-dha-workflow__send-to-triage-modal__actionSection___Dlgbe",patientAction:"-esm-dha-workflow__send-to-triage-modal__patientAction___ECxUB"};const l=i},6842:(e,t,n)=>{n.d(t,{A:()=>l});var r=n(72996),a=n.n(r),o=n(70159),i=n.n(o)()(a());i.push([e.id,".-esm-dha-workflow__registry-component__registryLayout___PF4WP{display:flex;flex-direction:row;width:100%;row-gap:10px;padding:2% 2%}.-esm-dha-workflow__registry-component__mainContent___qOmrp{display:flex;flex-direction:column;width:100%}.-esm-dha-workflow__registry-component__registryHeader___YIQ62{display:flex;flex-direction:column;row-gap:10px;width:100%}.-esm-dha-workflow__registry-component__registryContent___W1b-9{display:flex;flex-direction:column;width:100%}.-esm-dha-workflow__registry-component__formRow___qlwjG{display:flex;flex-direction:row;width:100%;column-gap:5px;margin-top:10px}.-esm-dha-workflow__registry-component__formControl___R5c2A{width:30%}.-esm-dha-workflow__registry-component__hieData___jx5gt{margin-top:15px;display:flex;flex-direction:column;width:80%;row-gap:10px}.-esm-dha-workflow__registry-component__btnContainer___aXZfC{padding:5px 5px}.-esm-dha-workflow__registry-component__selectionHeader___-zRam{display:flex;flex-direction:column;width:100%;row-gap:5px}.-esm-dha-workflow__registry-component__patientSelect___wgPYw{display:flex;flex-direction:row;width:100%;column-gap:5px}.-esm-dha-workflow__registry-component__patientSelectRadio___3aGYW{width:70%}.-esm-dha-workflow__registry-component__patientConfirmSelection___Py9-y{display:flex;flex-direction:row;width:30%;column-gap:5px}.-esm-dha-workflow__registry-component__formBtn___ok0W6{display:flex;flex-direction:row;column-gap:5px}.-esm-dha-workflow__registry-component__registrySearchBtn___jHA2M{height:30px}.-esm-dha-workflow__registry-component__principalDependantSection___y\\+Uv2{display:flex;flex-direction:row;width:100%;margin-top:15px}.-esm-dha-workflow__registry-component__dependantCard___BUkYp{display:flex;flex-direction:row;width:30%}","",{version:3,sources:["webpack://./src/registry/registry.component.scss"],names:[],mappings:"AAAA,+DACI,YAAA,CACA,kBAAA,CACA,UAAA,CACA,YAAA,CACA,aAAA,CAEJ,4DACE,YAAA,CACA,qBAAA,CACA,UAAA,CAEF,+DACI,YAAA,CACA,qBAAA,CACA,YAAA,CACA,UAAA,CAEJ,gEACI,YAAA,CACA,qBAAA,CACA,UAAA,CAEJ,wDACI,YAAA,CACA,kBAAA,CACA,UAAA,CACA,cAAA,CACA,eAAA,CAEJ,4DACI,SAAA,CAEJ,wDACI,eAAA,CACA,YAAA,CACA,qBAAA,CACA,SAAA,CACA,YAAA,CAEJ,6DACI,eAAA,CAEJ,gEACI,YAAA,CACA,qBAAA,CACA,UAAA,CACA,WAAA,CAEJ,8DACI,YAAA,CACA,kBAAA,CACA,UAAA,CACA,cAAA,CAEJ,mEACI,SAAA,CAEJ,wEACI,YAAA,CACA,kBAAA,CACA,SAAA,CACA,cAAA,CAEJ,wDACI,YAAA,CACA,kBAAA,CACA,cAAA,CAEJ,kEACI,WAAA,CAEJ,2EACI,YAAA,CACA,kBAAA,CACA,UAAA,CACA,eAAA,CAEJ,8DACI,YAAA,CACA,kBAAA,CACA,SAAA",sourcesContent:[".registryLayout{\n display: flex;\n flex-direction: row;\n width: 100%;\n row-gap: 10px;\n padding: 2% 2%;\n}\n.mainContent{\n display: flex;\n flex-direction: column;\n width: 100%;\n}\n.registryHeader{\n display: flex;\n flex-direction: column;\n row-gap: 10px;\n width: 100%;\n}\n.registryContent{\n display: flex;\n flex-direction: column;\n width: 100%;\n}\n.formRow{\n display: flex;\n flex-direction: row;\n width: 100%;\n column-gap: 5px;\n margin-top: 10px;\n}\n.formControl{\n width: 30%;\n}\n.hieData{\n margin-top: 15px;\n display: flex;\n flex-direction: column;\n width: 80%;\n row-gap: 10px;\n}\n.btnContainer{\n padding: 5px 5px;\n}\n.selectionHeader{\n display: flex;\n flex-direction: column;\n width: 100%;\n row-gap: 5px;\n}\n.patientSelect{\n display: flex;\n flex-direction: row;\n width: 100%;\n column-gap: 5px;\n}\n.patientSelectRadio{\n width: 70%;\n}\n.patientConfirmSelection{\n display: flex;\n flex-direction: row;\n width: 30%;\n column-gap: 5px;\n}\n.formBtn{\n display: flex;\n flex-direction: row;\n column-gap: 5px;\n}\n.registrySearchBtn{\n height: 30px;\n}\n.principalDependantSection{\n display: flex;\n flex-direction: row;\n width: 100%;\n margin-top: 15px;\n}\n.dependantCard{\n display: flex;\n flex-direction: row;\n width: 30%;\n}"],sourceRoot:""}]),i.locals={registryLayout:"-esm-dha-workflow__registry-component__registryLayout___PF4WP",mainContent:"-esm-dha-workflow__registry-component__mainContent___qOmrp",registryHeader:"-esm-dha-workflow__registry-component__registryHeader___YIQ62",registryContent:"-esm-dha-workflow__registry-component__registryContent___W1b-9",formRow:"-esm-dha-workflow__registry-component__formRow___qlwjG",formControl:"-esm-dha-workflow__registry-component__formControl___R5c2A",hieData:"-esm-dha-workflow__registry-component__hieData___jx5gt",btnContainer:"-esm-dha-workflow__registry-component__btnContainer___aXZfC",selectionHeader:"-esm-dha-workflow__registry-component__selectionHeader___-zRam",patientSelect:"-esm-dha-workflow__registry-component__patientSelect___wgPYw",patientSelectRadio:"-esm-dha-workflow__registry-component__patientSelectRadio___3aGYW",patientConfirmSelection:"-esm-dha-workflow__registry-component__patientConfirmSelection___Py9-y",formBtn:"-esm-dha-workflow__registry-component__formBtn___ok0W6",registrySearchBtn:"-esm-dha-workflow__registry-component__registrySearchBtn___jHA2M",principalDependantSection:"-esm-dha-workflow__registry-component__principalDependantSection___y+Uv2",dependantCard:"-esm-dha-workflow__registry-component__dependantCard___BUkYp"};const l=i},84497:(e,t,n)=>{n.d(t,{A:()=>l});var r=n(72996),a=n.n(r),o=n(70159),i=n.n(o)()(a());i.push([e.id,".-esm-dha-workflow__otp-verification-modal__modalVerificationLayout___MST8n{display:flex;flex-direction:column;row-gap:10px;width:100%}.-esm-dha-workflow__otp-verification-modal__sectionHeader___g62oo{display:flex;flex-direction:column;column-gap:5px;margin-top:5px;margin-bottom:5px}","",{version:3,sources:["webpack://./src/registry/modal/otp-verification-modal/otp-verification-modal.scss"],names:[],mappings:"AAAA,4EACE,YAAA,CACA,qBAAA,CACA,YAAA,CACA,UAAA,CAEF,kEACE,YAAA,CACA,qBAAA,CACA,cAAA,CACA,cAAA,CACA,iBAAA",sourcesContent:[".modalVerificationLayout {\n display: flex;\n flex-direction: column;\n row-gap: 10px;\n width: 100%;\n}\n.sectionHeader{\n display: flex;\n flex-direction: column;\n column-gap: 5px;\n margin-top: 5px;\n margin-bottom: 5px;\n}"],sourceRoot:""}]),i.locals={modalVerificationLayout:"-esm-dha-workflow__otp-verification-modal__modalVerificationLayout___MST8n",sectionHeader:"-esm-dha-workflow__otp-verification-modal__sectionHeader___g62oo"};const l=i},86575:(e,t,n)=>{n.d(t,{A:()=>l});var r=n(72996),a=n.n(r),o=n(70159),i=n.n(o)()(a());i.push([e.id,".-esm-dha-workflow__client-details-modal__clientDetailsLayout___r5WF\\+{display:flex;flex-direction:column;width:100%;row-gap:5px}.-esm-dha-workflow__client-details-modal__sectionHeader___lH-gL{display:flex;flex-direction:column;row-gap:5px;margin-top:5px;margin-bottom:10px}.-esm-dha-workflow__client-details-modal__sectionContent___QDFT7{display:flex;flex-direction:column;row-gap:5px}.-esm-dha-workflow__client-details-modal__actionSection___okVDp{display:flex;flex-direction:row;width:100%;column-gap:5px}.-esm-dha-workflow__client-details-modal__btnContainer___ETNEk{margin-top:2px;margin-bottom:2px}","",{version:3,sources:["webpack://./src/registry/modal/client-details-modal/client-details-modal.scss"],names:[],mappings:"AAAA,uEACI,YAAA,CACA,qBAAA,CACA,UAAA,CACA,WAAA,CAEJ,gEACI,YAAA,CACA,qBAAA,CACA,WAAA,CACA,cAAA,CACA,kBAAA,CAEJ,iEACI,YAAA,CACA,qBAAA,CACA,WAAA,CAEJ,gEACI,YAAA,CACA,kBAAA,CACA,UAAA,CACA,cAAA,CAEJ,+DACI,cAAA,CACA,iBAAA",sourcesContent:[".clientDetailsLayout{\n display: flex;\n flex-direction: column;\n width: 100%;\n row-gap: 5px;\n}\n.sectionHeader{\n display: flex;\n flex-direction: column;\n row-gap: 5px;\n margin-top: 5px;\n margin-bottom: 10px;\n}\n.sectionContent{\n display: flex;\n flex-direction: column;\n row-gap: 5px;\n}\n.actionSection{\n display: flex;\n flex-direction: row;\n width: 100%;\n column-gap: 5px;\n}\n.btnContainer{\n margin-top: 2px;\n margin-bottom: 2px;\n}"],sourceRoot:""}]),i.locals={clientDetailsLayout:"-esm-dha-workflow__client-details-modal__clientDetailsLayout___r5WF+",sectionHeader:"-esm-dha-workflow__client-details-modal__sectionHeader___lH-gL",sectionContent:"-esm-dha-workflow__client-details-modal__sectionContent___QDFT7",actionSection:"-esm-dha-workflow__client-details-modal__actionSection___okVDp",btnContainer:"-esm-dha-workflow__client-details-modal__btnContainer___ETNEk"};const l=i},99306:(e,t,n)=>{n.r(t),n.d(t,{default:()=>Ie});var r=n(63388),a=n(16072),o=n.n(a),i=n(85072),l=n.n(i),c=n(97825),s=n.n(c),u=n(77659),d=n.n(u),f=n(55056),m=n.n(f),p=n(10540),A=n.n(p),h=n(41113),y=n.n(h),_=n(6842),b={};b.styleTagTransform=y(),b.setAttributes=m(),b.insert=d().bind(null,"head"),b.domAPI=s(),b.insertStyleElement=A(),l()(_.A,b);const w=_.A&&_.A.locals?_.A.locals:void 0;var g=["National ID","Alien ID","Passport","Mandate Number","Refugee ID"],v=function(e){return e.Draft="DRAFT",e.Sent="SENT",e.Verified="VERIFIED",e}({}),C=function(e){return e.NationalID="National ID",e.SHANumber="SHA Number",e.HouseholdNumber="Household Number",e.RefugeeID="Refugee ID",e.AlienID="Alien ID",e.MandateNumber="Mandate Number",e.Cr="id",e.TemporaryDependantID="Temporary Dependant ID",e.BirthCertificate="Birth Certificate",e}({}),E="https://staging.ampath.or.ke/hie";function x(e,t,n,r,a,o,i){try{var l=e[o](i),c=l.value}catch(e){return void n(e)}l.done?t(c):Promise.resolve(c).then(r,a)}function k(e){return function(){var t=this,n=arguments;return new Promise((function(r,a){var o=e.apply(t,n);function i(e){x(o,r,a,i,l,"next",e)}function l(e){x(o,r,a,i,l,"throw",e)}i(void 0)}))}}function S(e,t){var n,r,a,o={label:0,sent:function(){if(1&a[0])throw a[1];return a[1]},trys:[],ops:[]},i=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return i.next=l(0),i.throw=l(1),i.return=l(2),"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function l(l){return function(c){return function(l){if(n)throw new TypeError("Generator is already executing.");for(;i&&(i=0,l[0]&&(o=0)),o;)try{if(n=1,r&&(a=2&l[0]?r.return:l[0]?r.throw||((a=r.return)&&a.call(r),0):r.next)&&!(a=a.call(r,l[1])).done)return a;switch(r=0,a&&(l=[2&l[0],a.value]),l[0]){case 0:case 1:a=l;break;case 4:return o.label++,{value:l[1],done:!1};case 5:o.label++,r=l[1],l=[0];continue;case 7:l=o.ops.pop(),o.trys.pop();continue;default:if(!((a=(a=o.trys).length>0&&a[a.length-1])||6!==l[0]&&2!==l[0])){o=0;continue}if(3===l[0]&&(!a||l[1]>a[0]&&l[1]<a[3])){o.label=l[1];break}if(6===l[0]&&o.label<a[1]){o.label=a[1],a=l;break}if(a&&o.label<a[2]){o.label=a[2],o.ops.push(l);break}a[2]&&o.ops.pop(),o.trys.pop();continue}l=t.call(e,o)}catch(e){l=[6,e],r=0}finally{n=a=0}if(5&l[0])throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}([l,c])}}}function T(e,t){return k((function(){var n,r;return S(this,(function(a){switch(a.label){case 0:return[4,fetch(e,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)})];case 1:return(n=a.sent()).ok?[3,3]:[4,n.text()];case 2:throw r=a.sent(),new Error("Request failed with ".concat(n.status,": ").concat(r));case 3:return[2,n.json()]}}))}))()}function N(e){return k((function(){var t,n;return S(this,(function(r){return t="".concat(E,"/client/search"),n={identificationNumber:e.identificationNumber,identificationType:e.identificationType,locationUuid:e.locationUuid},[2,T(t,n)]}))}))()}var P=n(25987),I=n(84497),D={};D.styleTagTransform=y(),D.setAttributes=m(),D.insert=d().bind(null,"head"),D.domAPI=s(),D.insertStyleElement=A(),l()(I.A,D);const O=I.A&&I.A.locals?I.A.locals:void 0;var j=function(e){for(var t=e.split(""),n=0;n<e.length;n++)n%2==0&&(t[n]="*");return t.join("")},F=function(e){for(var t=e.split(""),n=0;n<e.length;n++)0!=n&&n!==e.length-1&&(t[n]="*");return t.join("")};function B(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function R(e,t,n,r,a,o,i){try{var l=e[o](i),c=l.value}catch(e){return void n(e)}l.done?t(c):Promise.resolve(c).then(r,a)}function H(e){return function(){var t=this,n=arguments;return new Promise((function(r,a){var o=e.apply(t,n);function i(e){R(o,r,a,i,l,"next",e)}function l(e){R(o,r,a,i,l,"throw",e)}i(void 0)}))}}function Y(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,a,o=[],i=!0,l=!1;try{for(n=n.call(e);!(i=(r=n.next()).done)&&(o.push(r.value),!t||o.length!==t);i=!0);}catch(e){l=!0,a=e}finally{try{i||null==n.return||n.return()}finally{if(l)throw a}}return o}}(e,t)||function(e,t){if(e){if("string"==typeof e)return B(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?B(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function U(e,t){var n,r,a,o={label:0,sent:function(){if(1&a[0])throw a[1];return a[1]},trys:[],ops:[]},i=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return i.next=l(0),i.throw=l(1),i.return=l(2),"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function l(l){return function(c){return function(l){if(n)throw new TypeError("Generator is already executing.");for(;i&&(i=0,l[0]&&(o=0)),o;)try{if(n=1,r&&(a=2&l[0]?r.return:l[0]?r.throw||((a=r.return)&&a.call(r),0):r.next)&&!(a=a.call(r,l[1])).done)return a;switch(r=0,a&&(l=[2&l[0],a.value]),l[0]){case 0:case 1:a=l;break;case 4:return o.label++,{value:l[1],done:!1};case 5:o.label++,r=l[1],l=[0];continue;case 7:l=o.ops.pop(),o.trys.pop();continue;default:if(!((a=(a=o.trys).length>0&&a[a.length-1])||6!==l[0]&&2!==l[0])){o=0;continue}if(3===l[0]&&(!a||l[1]>a[0]&&l[1]<a[3])){o.label=l[1];break}if(6===l[0]&&o.label<a[1]){o.label=a[1],a=l;break}if(a&&o.label<a[2]){o.label=a[2],o.ops.push(l);break}a[2]&&o.ops.pop(),o.trys.pop();continue}l=t.call(e,o)}catch(e){l=[6,e],r=0}finally{n=a=0}if(5&l[0])throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}([l,c])}}}const q=function(e){var t=e.requestCustomOtpDto,n=e.phoneNumber,i=e.open,l=e.onModalClose,c=e.onOtpSuccessfullVerification,s=Y((0,a.useState)(""),2),u=s[0],d=s[1],f=Y((0,a.useState)(v.Draft),2),m=f[0],p=f[1],A=Y((0,a.useState)(!1),2),h=A[0],y=A[1],_=Y((0,a.useState)(""),2),b=_[0],w=_[1],g=function(e,t,n){(0,P.showSnackbar)({kind:e,title:t,subtitle:n})};return o().createElement(o().Fragment,null,o().createElement(r.aFV,{open:i,size:"md",onSecondarySubmit:l,onRequestClose:l,onRequestSubmit:function(){window.open("https://afyayangu.go.ke/","_blank")},primaryButtonText:"Register on Afya Yangu",secondaryButtonText:"Cancel"},o().createElement(r.cwr,null,o().createElement("div",{className:O.modalVerificationLayout},o().createElement("div",{className:O.sectionHeader},o().createElement("h4",{className:O.sectionTitle},"One Time Password (OTP)"),o().createElement("h6",null,"Enter one time password to proceed")),o().createElement("div",{className:O.sectionContent},o().createElement("div",{className:O.contentHeader},m===v.Draft?o().createElement(o().Fragment,null,o().createElement("h6",null,"Send Code to Phone ",j(n))):o().createElement(o().Fragment,null),m===v.Sent?o().createElement(o().Fragment,null,o().createElement(r.ksK,{id:"otp-input",labelText:"Enter OTP",value:u,onChange:function(e){return d(e.target.value)},placeholder:"Enter the code sent to your phone"})):o().createElement(o().Fragment,null),m===v.Verified?o().createElement(o().Fragment,null,o().createElement("h6",null,"OTP Verification Successfull!")):o().createElement(o().Fragment,null))),o().createElement("div",{className:O.sectionAction},m===v.Draft?o().createElement(o().Fragment,null,o().createElement(r.$nd,{kind:"primary",onClick:function(){return H((function(){var e,n,r;return U(this,(function(a){switch(a.label){case 0:if(!t.identificationNumber)return g("error","Invalid Identification Value","Please enter a valid ID value"),[2];y(!0),a.label=1;case 1:return a.trys.push([1,3,4,5]),[4,(o=t,k((function(){var e,t;return S(this,(function(n){return e="".concat(E,"/client/send-custom-otp"),t={identificationNumber:o.identificationNumber,identificationType:o.identificationType,locationUuid:o.locationUuid},[2,T(e,t)]}))}))())];case 2:return e=a.sent(),w(e.sessionId),p(v.Sent),g("success","OTP sent successfully","A code was sent to ".concat(e.maskedPhone)),[3,5];case 3:return n=a.sent(),r=n.message||"Failed to send OTP",g("error","Error sending OTP",r),[3,5];case 4:return y(!1),[7];case 5:return[2]}var o}))}))()}},h?o().createElement(r.OuH,{description:"Sending OTP..."}):"Send OTP")):o().createElement(o().Fragment,null),m===v.Sent?o().createElement(o().Fragment,null,o().createElement(r.$nd,{kind:"primary",onClick:function(){return H((function(){var e,n;return U(this,(function(r){switch(r.label){case 0:if(!u.trim())return g("error","Please enter the OTP code",""),[2];y(!0),r.label=1;case 1:return r.trys.push([1,3,4,5]),[4,(a={sessionId:b,otp:u,locationUuid:t.locationUuid},k((function(){var e,t;return S(this,(function(n){return e="".concat(E,"/client/validate-custom-otp"),t={sessionId:a.sessionId,otp:a.otp,locationUuid:a.locationUuid},[2,T(e,t)]}))}))())];case 2:return r.sent(),p(v.Verified),(0,P.showSnackbar)({kind:"success",title:"OTP Verified",subtitle:"You can now fetch data from Client Registry."}),[3,5];case 3:return e=r.sent(),n=e.message||"OTP verification failed",(0,P.showSnackbar)({kind:"error",title:"OTP Verification Failed",subtitle:n}),[3,5];case 4:return y(!1),[7];case 5:return[2]}var a}))}))()}},h?o().createElement(r.OuH,{description:"Verifying OTP..."}):"Verify")):o().createElement(o().Fragment,null),m===v.Verified?o().createElement(o().Fragment,null,o().createElement(r.$nd,{kind:"primary",onClick:c},"Continue")):o().createElement(o().Fragment,null))))))};var M=n(86575),V={};V.styleTagTransform=y(),V.setAttributes=m(),V.insert=d().bind(null,"head"),V.domAPI=s(),V.insertStyleElement=A(),l()(M.A,V);const L=M.A&&M.A.locals?M.A.locals:void 0;function J(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var W=["id","other_identifications","first_name","middle_name","last_name","gender","date_of_birth","is_alive","deceased_datetime","phone","email","civil_status","place_of_birth","citizenship","country","county","sub_county","ward","village_estate","longitude","latitude","identification_type"];const G=function(e){var t=e.client,n=(0,a.useMemo)((function(){return e=t,n={},Object.keys(e).filter((function(e){return W.includes(e)})).forEach((function(t){if("other_identifications"===t){var r=(o=e[t],i={},o.forEach((function(e){i[e.identification_type]=e.identification_number})),i);n=function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter((function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable})))),r.forEach((function(t){J(e,t,n[t])}))}return e}({},n,r)}else if("identification_type"===t)n[e.identification_type]=e.identification_number;else{var a=e[t];n[t]=a}var o,i})),n;var e,n}),[t]);return t&&n?o().createElement(o().Fragment,null,o().createElement(r.XIK,null,o().createElement(r.ndF,null,o().createElement(r.Hjg,null,o().createElement(r.A0N,null,"Field"),o().createElement(r.A0N,null,"Value"))),o().createElement(r.BFY,null,Object.keys(n).map((function(e){return o().createElement(r.Hjg,null,o().createElement(r.nA6,null,e),o().createElement(r.nA6,null,n[e]))}))))):o().createElement(o().Fragment,null,o().createElement("h4",null,"No patient Data to Display"))},$=function(){return o().createElement(o().Fragment,null,o().createElement(r.zWQ,{defaultSelected:"sha",legendText:"Patient",onChange:function(e){},name:"payment-options-radio-group"},o().createElement(r.aaP,{id:"sha",labelText:"Social Health Authority",value:"sha"}),o().createElement(r.aaP,{id:"insurance",labelText:"Other Insurance",value:"other"}),o().createElement(r.aaP,{id:"cash",labelText:"Cash",value:"cash"})))},z=function(e){var t=e.client,n=e.open,a=e.onModalClose,i=(e.onSubmit,e.onSendClientToTriage);return t?o().createElement(o().Fragment,null,o().createElement(r.aFV,{open:n,size:"md",onSecondarySubmit:a,onRequestClose:a,onRequestSubmit:function(){window.open("https://afyayangu.go.ke/","_blank")},primaryButtonText:"Register on Afya Yangu",secondaryButtonText:"Cancel"},o().createElement(r.cwr,null,o().createElement("div",{className:L.clientDetailsLayout},o().createElement("div",{className:L.sectionHeader},o().createElement("h4",{className:L.sectionTitle},"Patient/Payment Details")),o().createElement("div",{className:L.sectionContent},o().createElement(r.tUM,null,o().createElement(r.wbY,{contained:!0},o().createElement(r.ozo,null,"Patient Details"),o().createElement(r.ozo,null,"Payment Details")),o().createElement(r.T2N,null,o().createElement(r.KpK,null,o().createElement(G,{client:t})),o().createElement(r.KpK,null,o().createElement($,null))))),o().createElement("div",{className:L.actionSection},o().createElement("div",{className:L.btnContainer},o().createElement(r.$nd,{kind:"primary"},"Book Appointment")),o().createElement("div",{className:L.btnContainer},o().createElement(r.$nd,{kind:"secondary"},"Walk In Orders")),o().createElement("div",{className:L.btnContainer},o().createElement(r.$nd,{kind:"tertiary",onClick:function(){return i(t.id)}},"Send To Triage"))))))):o().createElement(o().Fragment,null,"No Client data")};function K(e,t,n,r,a,o,i){try{var l=e[o](i),c=l.value}catch(e){return void n(e)}l.done?t(c):Promise.resolve(c).then(r,a)}function Q(e){return(t=function(){var t,n,r,a;return function(e,t){var n,r,a,o={label:0,sent:function(){if(1&a[0])throw a[1];return a[1]},trys:[],ops:[]},i=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return i.next=l(0),i.throw=l(1),i.return=l(2),"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function l(l){return function(c){return function(l){if(n)throw new TypeError("Generator is already executing.");for(;i&&(i=0,l[0]&&(o=0)),o;)try{if(n=1,r&&(a=2&l[0]?r.return:l[0]?r.throw||((a=r.return)&&a.call(r),0):r.next)&&!(a=a.call(r,l[1])).done)return a;switch(r=0,a&&(l=[2&l[0],a.value]),l[0]){case 0:case 1:a=l;break;case 4:return o.label++,{value:l[1],done:!1};case 5:o.label++,r=l[1],l=[0];continue;case 7:l=o.ops.pop(),o.trys.pop();continue;default:if(!((a=(a=o.trys).length>0&&a[a.length-1])||6!==l[0]&&2!==l[0])){o=0;continue}if(3===l[0]&&(!a||l[1]>a[0]&&l[1]<a[3])){o.label=l[1];break}if(6===l[0]&&o.label<a[1]){o.label=a[1],a=l;break}if(a&&o.label<a[2]){o.label=a[2],o.ops.push(l);break}a[2]&&o.ops.pop(),o.trys.pop();continue}l=t.call(e,o)}catch(e){l=[6,e],r=0}finally{n=a=0}if(5&l[0])throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}([l,c])}}}(this,(function(o){switch(o.label){case 0:return t="".concat(P.restBaseUrl,"/patient"),n=new URLSearchParams({q:e,v:"full",includeDead:"true",limit:"10",totalCount:"true"}).toString(),[4,(0,P.openmrsFetch)("".concat(t,"?").concat(n))];case 1:return(r=o.sent()).ok?[3,3]:[4,r.text()];case 2:throw a=o.sent(),new Error("Request failed with ".concat(r.status,": ").concat(a));case 3:return[2,r.json()]}}))},function(){var e=this,n=arguments;return new Promise((function(r,a){var o=t.apply(e,n);function i(e){K(o,r,a,i,l,"next",e)}function l(e){K(o,r,a,i,l,"throw",e)}i(void 0)}))})();var t}var X=n(3754),Z={};Z.styleTagTransform=y(),Z.setAttributes=m(),Z.insert=d().bind(null,"head"),Z.domAPI=s(),Z.insertStyleElement=A(),l()(X.A,Z);const ee=X.A&&X.A.locals?X.A.locals:void 0;function te(e,t,n,r,a,o,i){try{var l=e[o](i),c=l.value}catch(e){return void n(e)}l.done?t(c):Promise.resolve(c).then(r,a)}function ne(e){return function(){var t=this,n=arguments;return new Promise((function(r,a){var o=e.apply(t,n);function i(e){te(o,r,a,i,l,"next",e)}function l(e){te(o,r,a,i,l,"throw",e)}i(void 0)}))}}function re(e,t){var n,r,a,o={label:0,sent:function(){if(1&a[0])throw a[1];return a[1]},trys:[],ops:[]},i=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return i.next=l(0),i.throw=l(1),i.return=l(2),"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function l(l){return function(c){return function(l){if(n)throw new TypeError("Generator is already executing.");for(;i&&(i=0,l[0]&&(o=0)),o;)try{if(n=1,r&&(a=2&l[0]?r.return:l[0]?r.throw||((a=r.return)&&a.call(r),0):r.next)&&!(a=a.call(r,l[1])).done)return a;switch(r=0,a&&(l=[2&l[0],a.value]),l[0]){case 0:case 1:a=l;break;case 4:return o.label++,{value:l[1],done:!1};case 5:o.label++,r=l[1],l=[0];continue;case 7:l=o.ops.pop(),o.trys.pop();continue;default:if(!((a=(a=o.trys).length>0&&a[a.length-1])||6!==l[0]&&2!==l[0])){o=0;continue}if(3===l[0]&&(!a||l[1]>a[0]&&l[1]<a[3])){o.label=l[1];break}if(6===l[0]&&o.label<a[1]){o.label=a[1],a=l;break}if(a&&o.label<a[2]){o.label=a[2],o.ops.push(l);break}a[2]&&o.ops.pop(),o.trys.pop();continue}l=t.call(e,o)}catch(e){l=[6,e],r=0}finally{n=a=0}if(5&l[0])throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}([l,c])}}}function ae(e){return ne((function(){var t,n,r,a;return re(this,(function(o){switch(o.label){case 0:return t="".concat(P.restBaseUrl,"/queue"),n=new URLSearchParams({v:"custom:(uuid,display,name,description,service:(uuid,display),allowedPriorities:(uuid,display),allowedStatuses:(uuid,display),location:(uuid,display))",location:e}).toString(),[4,(0,P.openmrsFetch)("".concat(t,"?").concat(n))];case 1:return(r=o.sent()).ok?[3,3]:[4,r.text()];case 2:throw a=o.sent(),new Error("Request failed with ".concat(r.status,": ").concat(a));case 3:return[2,r.json()]}}))}))()}function oe(e,t,n,r,a,o,i){try{var l=e[o](i),c=l.value}catch(e){return void n(e)}l.done?t(c):Promise.resolve(c).then(r,a)}function ie(e){return(t=function(){var t,n,r;return function(e,t){var n,r,a,o={label:0,sent:function(){if(1&a[0])throw a[1];return a[1]},trys:[],ops:[]},i=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return i.next=l(0),i.throw=l(1),i.return=l(2),"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function l(l){return function(c){return function(l){if(n)throw new TypeError("Generator is already executing.");for(;i&&(i=0,l[0]&&(o=0)),o;)try{if(n=1,r&&(a=2&l[0]?r.return:l[0]?r.throw||((a=r.return)&&a.call(r),0):r.next)&&!(a=a.call(r,l[1])).done)return a;switch(r=0,a&&(l=[2&l[0],a.value]),l[0]){case 0:case 1:a=l;break;case 4:return o.label++,{value:l[1],done:!1};case 5:o.label++,r=l[1],l=[0];continue;case 7:l=o.ops.pop(),o.trys.pop();continue;default:if(!((a=(a=o.trys).length>0&&a[a.length-1])||6!==l[0]&&2!==l[0])){o=0;continue}if(3===l[0]&&(!a||l[1]>a[0]&&l[1]<a[3])){o.label=l[1];break}if(6===l[0]&&o.label<a[1]){o.label=a[1],a=l;break}if(a&&o.label<a[2]){o.label=a[2],o.ops.push(l);break}a[2]&&o.ops.pop(),o.trys.pop();continue}l=t.call(e,o)}catch(e){l=[6,e],r=0}finally{n=a=0}if(5&l[0])throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}([l,c])}}}(this,(function(a){switch(a.label){case 0:return t="".concat(P.restBaseUrl,"/visit"),[4,(0,P.openmrsFetch)(t,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(e)})];case 1:return(n=a.sent()).ok?[3,3]:[4,n.text()];case 2:throw r=a.sent(),new Error("Request failed with ".concat(n.status,": ").concat(r));case 3:return[2,n.json()]}}))},function(){var e=this,n=arguments;return new Promise((function(r,a){var o=t.apply(e,n);function i(e){oe(o,r,a,i,l,"next",e)}function l(e){oe(o,r,a,i,l,"throw",e)}i(void 0)}))})();var t}function le(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function ce(e,t,n,r,a,o,i){try{var l=e[o](i),c=l.value}catch(e){return void n(e)}l.done?t(c):Promise.resolve(c).then(r,a)}function se(e){return function(){var t=this,n=arguments;return new Promise((function(r,a){var o=e.apply(t,n);function i(e){ce(o,r,a,i,l,"next",e)}function l(e){ce(o,r,a,i,l,"throw",e)}i(void 0)}))}}function ue(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,a,o=[],i=!0,l=!1;try{for(n=n.call(e);!(i=(r=n.next()).done)&&(o.push(r.value),!t||o.length!==t);i=!0);}catch(e){l=!0,a=e}finally{try{i||null==n.return||n.return()}finally{if(l)throw a}}return o}}(e,t)||function(e,t){if(e){if("string"==typeof e)return le(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?le(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function de(e,t){var n,r,a,o={label:0,sent:function(){if(1&a[0])throw a[1];return a[1]},trys:[],ops:[]},i=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return i.next=l(0),i.throw=l(1),i.return=l(2),"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function l(l){return function(c){return function(l){if(n)throw new TypeError("Generator is already executing.");for(;i&&(i=0,l[0]&&(o=0)),o;)try{if(n=1,r&&(a=2&l[0]?r.return:l[0]?r.throw||((a=r.return)&&a.call(r),0):r.next)&&!(a=a.call(r,l[1])).done)return a;switch(r=0,a&&(l=[2&l[0],a.value]),l[0]){case 0:case 1:a=l;break;case 4:return o.label++,{value:l[1],done:!1};case 5:o.label++,r=l[1],l=[0];continue;case 7:l=o.ops.pop(),o.trys.pop();continue;default:if(!((a=(a=o.trys).length>0&&a[a.length-1])||6!==l[0]&&2!==l[0])){o=0;continue}if(3===l[0]&&(!a||l[1]>a[0]&&l[1]<a[3])){o.label=l[1];break}if(6===l[0]&&o.label<a[1]){o.label=a[1],a=l;break}if(a&&o.label<a[2]){o.label=a[2],o.ops.push(l);break}a[2]&&o.ops.pop(),o.trys.pop();continue}l=t.call(e,o)}catch(e){l=[6,e],r=0}finally{n=a=0}if(5&l[0])throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}([l,c])}}}const fe=function(e){var t=e.patients,n=e.open,i=e.onModalClose,l=(e.onSubmit,e.client),c=e.onCreateAmrsPatient,s=e.onManualRegistration,u=ue((0,a.useState)(),2),d=u[0],f=u[1],m=ue((0,a.useState)(),2),p=m[0],A=m[1],h=ue((0,a.useState)(),2),y=h[0],_=h[1],b=ue((0,a.useState)(),2),w=b[0],g=b[1],v=ue((0,a.useState)(""),2),C=v[0],E=v[1],x=ue((0,a.useState)(!1),2),k=x[0],S=x[1],T=(0,P.useVisitTypes)(),N=(0,P.useSession)().sessionLocation.uuid;if((0,a.useEffect)((function(){I()}),[t]),!t)return o().createElement(o().Fragment,null,"No Client data");var I=function(){return se((function(){var e;return de(this,(function(t){switch(t.label){case 0:return[4,ae(N)];case 1:return(e=t.sent())&&e.results&&_(e.results),[2]}}))}))()},D=function(e){return e.location?e.patient?!!e.visitType||(j("error","Please select a visit",""),!1):(j("error","Please select a patient",""),!1):(j("error","Missing location in create visits",""),!1)},O=function(){var e;return{visitType:p,location:N,startDatetime:null,stopDatetime:null,patient:null!==(e=null==d?void 0:d.uuid)&&void 0!==e?e:""}},j=function(e,t,n){(0,P.showSnackbar)({kind:e,title:t,subtitle:n})};return o().createElement(o().Fragment,null,o().createElement(r.aFV,{open:n,size:"md",onSecondarySubmit:function(){return i({success:!1})},onRequestClose:function(){return i({success:!1})},onRequestSubmit:function(){window.open("https://afyayangu.go.ke/","_blank")},primaryButtonText:"Register on Afya Yangu",secondaryButtonText:"Cancel"},o().createElement(r.cwr,null,o().createElement("div",{className:ee.clientDetailsLayout},o().createElement("div",{className:ee.sectionHeader},o().createElement("h4",{className:ee.sectionTitle},"Send To Triage")),t.length>0?o().createElement("div",{className:ee.sectionContent},o().createElement("div",{className:ee.patientSelect},o().createElement(r.XIK,null,o().createElement(r.ndF,null,o().createElement(r.Hjg,null,o().createElement(r.A0N,null,"No"),o().createElement(r.A0N,null,"Name"),o().createElement(r.A0N,null,"Gender"),o().createElement(r.A0N,null,"Select Patient"))),o().createElement(r.BFY,null,t.map((function(e,t){return o().createElement(r.Hjg,{key:e.uuid},o().createElement(r.nA6,null,t+1),o().createElement(r.nA6,null,e.person.preferredName.display),o().createElement(r.nA6,null,e.person.gender),o().createElement(r.nA6,null,o().createElement(r.Sc0,{id:e.uuid,labelText:"",onChange:function(){f(e)}})))}))))),o().createElement("div",{className:ee.formSection},o().createElement("div",{className:ee.formRow},o().createElement("div",{className:ee.formControl},o().createElement(r.l6P,{id:"visit-type",labelText:"Select a Visit Type",onChange:function(e){var t=e.target.value;A(t)}},o().createElement(r.ebT,{value:"",text:"Select"}),";",T&&T.map((function(e){return o().createElement(r.ebT,{value:e.uuid,text:e.display})})))),o().createElement("div",{className:ee.formControl},o().createElement(r.l6P,{id:"service",labelText:"Select a Service",onChange:function(e){var t=e.target.value;g(t)}},o().createElement(r.ebT,{value:"",text:"Select"}),";",y&&y.map((function(e){return o().createElement(r.ebT,{value:e.uuid,text:e.display})}))))),o().createElement("div",{className:ee.formRow},o().createElement("div",{className:ee.formControl},o().createElement(r.l6P,{id:"priority",labelText:"Select Priority",onChange:function(e){return t=e.target.value,void E(t);var t}},o().createElement(r.ebT,{value:"",text:"Select"}),";",o().createElement(r.ebT,{value:"bbd99c12-67e9-4381-8b4c-1f231e86f8e2",text:"NORMAL"}),";",o().createElement(r.ebT,{value:"8e86ff12-ec83-41e8-a534-bb410739d880",text:"EMERGENCY"}),";"))))):o().createElement(o().Fragment,null),o().createElement("div",{className:ee.actionSection},t.length>0?o().createElement("div",{className:ee.btnContainer},o().createElement(r.$nd,{kind:"primary",onClick:function(){return se((function(){var e,t;return de(this,(function(n){switch(n.label){case 0:S(!0),n.label=1;case 1:return n.trys.push([1,5,6,7]),[4,se((function(){var e,t;return de(this,(function(n){switch(n.label){case 0:return e=O(),D(e)?[4,ie(e)]:[2,!1];case 1:if(t=n.sent())return j("success","Visit has been created succesfully",""),[2,t];throw j("error","Error creating patient visit",""),new Error("Error creating patient visit")}}))}))()];case 2:return(e=n.sent())?(r=e.uuid,t={visit:{uuid:r},queueEntry:{status:{uuid:"89d01aa5-0ab0-4626-934b-37766b4cd779"},priority:{uuid:C},queue:{uuid:w},patient:{uuid:d.uuid},startedAt:(new Date).toISOString(),sortWeight:0}},[4,(a=t,ne((function(){var e,t,n;return re(this,(function(r){switch(r.label){case 0:return e="".concat(P.restBaseUrl,"/visit-queue-entry"),[4,(0,P.openmrsFetch)(e,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(a)})];case 1:return(t=r.sent()).ok?[3,3]:[4,t.text()];case 2:throw n=r.sent(),new Error("Request failed with ".concat(t.status,": ").concat(n));case 3:return[2,t.json()]}}))}))())]):[3,4];case 3:n.sent()&&(j("success","Patient has succesfully been moved to the Triage queue",""),i({success:!0})),n.label=4;case 4:return[3,7];case 5:return n.sent(),j("error","Error creating visit",""),[3,7];case 6:return S(!1),[7];case 7:return[2]}var r,a}))}))()}},k?o().createElement(r.OuH,{description:"Sending To Triage..."}):"Send To Triage")):o().createElement(o().Fragment,null,o().createElement("div",{className:ee.patientAction},o().createElement("div",{className:ee.btnContainer},o().createElement(r.$nd,{kind:"primary",onClick:function(){return c(l)}},"Automatically Register in AMRS")),o().createElement("div",{className:ee.btnContainer},o().createElement(r.$nd,{kind:"secondary",onClick:s},"Manually Register")))))))))};var me=n(27114);function pe(e,t){return"".concat(e.first_name," ").concat(F(e.middle_name)," (").concat(e.gender,") (DOB: ").concat(e.date_of_birth,") (").concat(t,") (CR: ").concat(e.id,")")}function Ae(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function he(e){return function(e){if(Array.isArray(e))return Ae(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(e){if("string"==typeof e)return Ae(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Ae(e,t):void 0}}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}var ye=he([C.Cr,C.SHANumber,C.HouseholdNumber,C.RefugeeID,C.MandateNumber,C.AlienID,C.NationalID,C.TemporaryDependantID]).concat(he(["first_name","middle_name","last_name"]),he(["gender","date_of_birth","is_alive","deceased_datetime"]),he(["phone","email","civil_status","place_of_birth","citizenship"]),he(["country","county","sub_county","ward","village_estate","longitude","latitude"]));function _e(e){var t="";switch(e){case"Divorced":t="a899ad58-1350-11df-a1f1-0026b9348838";break;case"Married":t="a8aa76b0-1350-11df-a1f1-0026b9348838";break;case"Single":t="a899ac7c-1350-11df-a1f1-0026b9348838";break;default:t="a89ad3a4-1350-11df-a1f1-0026b9348838"}return t}function be(e){var t;switch(e){case C.NationalID:t="58a47054-1359-11df-a1f1-0026b9348838";break;case C.HouseholdNumber:t="bb74b20e-dcee-4f59-bdf1-2dffc3abf106";break;case C.AlienID:t="12f5b147-3403-4a73-913d-7ded9ffec094";break;case C.SHANumber:t="cf5362b2-8049-4442-b3c6-36f870e320cb";break;case C.MandateNumber:t="aae2d097-20ba-43ca-9b71-fd8296068f39";break;case C.RefugeeID:t="465e81af-8d69-47e9-9127-53a94adc75fb";break;case C.Cr:t="e88dc246-3614-4ee3-8141-1f2a83054e72";break;case C.BirthCertificate:t="7924e13b-131a-4da8-8efa-e294184a1b0d";break;case C.TemporaryDependantID:t="a3d34214-93e8-4faf-bf4d-0272eee079eb"}return t}function we(e,t,n,r,a,o,i){try{var l=e[o](i),c=l.value}catch(e){return void n(e)}l.done?t(c):Promise.resolve(c).then(r,a)}function ge(e){return function(){var t=this,n=arguments;return new Promise((function(r,a){var o=e.apply(t,n);function i(e){we(o,r,a,i,l,"next",e)}function l(e){we(o,r,a,i,l,"throw",e)}i(void 0)}))}}function ve(e,t){var n,r,a,o={label:0,sent:function(){if(1&a[0])throw a[1];return a[1]},trys:[],ops:[]},i=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return i.next=l(0),i.throw=l(1),i.return=l(2),"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function l(l){return function(c){return function(l){if(n)throw new TypeError("Generator is already executing.");for(;i&&(i=0,l[0]&&(o=0)),o;)try{if(n=1,r&&(a=2&l[0]?r.return:l[0]?r.throw||((a=r.return)&&a.call(r),0):r.next)&&!(a=a.call(r,l[1])).done)return a;switch(r=0,a&&(l=[2&l[0],a.value]),l[0]){case 0:case 1:a=l;break;case 4:return o.label++,{value:l[1],done:!1};case 5:o.label++,r=l[1],l=[0];continue;case 7:l=o.ops.pop(),o.trys.pop();continue;default:if(!((a=(a=o.trys).length>0&&a[a.length-1])||6!==l[0]&&2!==l[0])){o=0;continue}if(3===l[0]&&(!a||l[1]>a[0]&&l[1]<a[3])){o.label=l[1];break}if(6===l[0]&&o.label<a[1]){o.label=a[1],a=l;break}if(a&&o.label<a[2]){o.label=a[2],o.ops.push(l);break}a[2]&&o.ops.pop(),o.trys.pop();continue}l=t.call(e,o)}catch(e){l=[6,e],r=0}finally{n=a=0}if(5&l[0])throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}([l,c])}}}var Ce=function(e,t){return ge((function(){var n,r;return ve(this,(function(a){switch(a.label){case 0:return[4,ge((function(){var e,t,n;return ve(this,(function(r){switch(r.label){case 0:return e=new AbortController,[4,(0,P.openmrsFetch)("https://staging.ampath.or.ke/amrs-id-generator/generateidentifier",{headers:{"Content-Type":"application/json"},method:"POST",body:{user:1},signal:e.signal})];case 1:return[4,r.sent().json()];case 2:return t=r.sent(),[2,null!==(n=t.identifier)&&void 0!==n?n:""]}}))}))()];case 1:return n=a.sent(),r=function(e,t){var n=[];return n.push({identifierType:be(C.Cr),identifier:e.id,location:t}),n.push({identifierType:be(e.identification_type),identifier:e.identification_number,location:t}),n}(t,e),r.push({identifierType:"58a4732e-1359-11df-a1f1-0026b9348838",identifier:n,location:e,preferred:!0}),[2,r]}}))}))()};function Ee(e,t,n,r,a,o,i){try{var l=e[o](i),c=l.value}catch(e){return void n(e)}l.done?t(c):Promise.resolve(c).then(r,a)}function xe(e,t){return(n=function(){var n,r;return function(e,t){var n,r,a,o={label:0,sent:function(){if(1&a[0])throw a[1];return a[1]},trys:[],ops:[]},i=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return i.next=l(0),i.throw=l(1),i.return=l(2),"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function l(l){return function(c){return function(l){if(n)throw new TypeError("Generator is already executing.");for(;i&&(i=0,l[0]&&(o=0)),o;)try{if(n=1,r&&(a=2&l[0]?r.return:l[0]?r.throw||((a=r.return)&&a.call(r),0):r.next)&&!(a=a.call(r,l[1])).done)return a;switch(r=0,a&&(l=[2&l[0],a.value]),l[0]){case 0:case 1:a=l;break;case 4:return o.label++,{value:l[1],done:!1};case 5:o.label++,r=l[1],l=[0];continue;case 7:l=o.ops.pop(),o.trys.pop();continue;default:if(!((a=(a=o.trys).length>0&&a[a.length-1])||6!==l[0]&&2!==l[0])){o=0;continue}if(3===l[0]&&(!a||l[1]>a[0]&&l[1]<a[3])){o.label=l[1];break}if(6===l[0]&&o.label<a[1]){o.label=a[1],a=l;break}if(a&&o.label<a[2]){o.label=a[2],o.ops.push(l);break}a[2]&&o.ops.pop(),o.trys.pop();continue}l=t.call(e,o)}catch(e){l=[6,e],r=0}finally{n=a=0}if(5&l[0])throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}([l,c])}}}(this,(function(a){switch(a.label){case 0:return n=function(e){var t={},n={},r={},a=[];ye.forEach((function(o){"first_name"===o&&(n.givenName=e.first_name),"middle_name"===o&&(n.middleName=e.middle_name),"last_name"===o&&(n.familyName=e.last_name),"gender"===o&&(t.gender="Male"===e.gender?"M":"F"),"date_of_birth"===o&&(t.birthdate=e.date_of_birth,t.birthdateEstimated=!1),"is_alive"===o&&(t.dead=0===e.is_alive),"deceased_datetime"===o&&e.deceased_datetime.length>0&&(t.deathDate=e.deceased_datetime),"country"===o&&e.country.length>0&&(r.country=e.country,r.address1=e.country),"place_of_birth"===o&&e.place_of_birth.length>0&&(r.address10=e.place_of_birth),"county"===o&&e.county.length>0&&(r.countyDistrict=e.county),"sub_county"===o&&e.sub_county.length>0&&(r.address2=e.sub_county,r.stateProvince=e.sub_county),"ward"===o&&e.sub_county.length>0&&(r.address7=e.sub_county,r.address4=e.sub_county),"village_estate"===o&&e.village_estate.length>0&&(r.cityVillage=e.village_estate),"longitude"===o&&e.longitude.length>0&&(r.longitude=e.longitude),"latitude"===o&&e.latitude.length>0&&(r.latitude=e.latitude),"place_of_birth"===o&&e.place_of_birth.length>0&&a.push({value:e.place_of_birth,attributeType:"8d8718c2-c2cc-11de-8d13-0010c6dffd0f"}),"phone"===o&&e.phone.length>0&&a.push({value:e.phone,attributeType:"72a759a8-1359-11df-a1f1-0026b9348838"}),"email"===o&&e.email.length>0&&a.push({value:e.email,attributeType:"2f65dbcb-3e58-45a3-8be7-fd1dc9aa0faa"}),"civil_status"===o&&e.civil_status.length>0&&a.push({value:_e(e.civil_status),attributeType:"8d871f2a-c2cc-11de-8d13-0010c6dffd0f"}),"id"===o&&e.id&&a.push({value:e.id,attributeType:"e068e02b-faac-4baf-bd58-fe6e0c29a81f"}),"citizenship"===o&&e.citizenship&&a.push({value:e.citizenship,attributeType:"8d871afc-c2cc-11de-8d13-0010c6dffd0f"})}));var o=function(e){var t=[],n=e.find((function(e){return"Alternative Phone Number"===e.relationship})),r=e.find((function(e){return"Next Of Kin"===e.remarks}));return n&&"Phone"===n.contact_type&&t.push({value:n.contact_id,attributeType:"c725f524-c14a-4468-ac19-4a0e6661c930"}),r&&("Phone"===r.contact_type&&t.push({value:r.contact_id,attributeType:"a657a4f1-9c0f-444b-a1fd-445bb91dd12d"}),t.push({value:r.relationship,attributeType:"5730994e-c267-426b-87b6-c152b606973d"}),t.push({value:r.contact_name,attributeType:"72a75bec-1359-11df-a1f1-0026b9348838"})),t}(e.alternative_contacts);return a=he(a).concat(he(o)),Object.keys(n).length>0&&(t.names=[n]),Object.keys(r).length>0&&(t.addresses=[r]),a.length>0&&(t.attributes=a),t}(e),[4,Ce(t,e)];case 1:return r=a.sent(),[4,(o={person:n,identifiers:r},ge((function(){return ve(this,(function(e){switch(e.label){case 0:return[4,(0,P.openmrsFetch)("".concat(P.restBaseUrl,"/patient"),{method:"POST",headers:{"Content-Type":"application/json"},body:o})];case 1:return[2,e.sent()]}}))}))())];case 2:return[4,a.sent().json()];case 3:return[2,a.sent()]}var o}))},function(){var e=this,t=arguments;return new Promise((function(r,a){var o=n.apply(e,t);function i(e){Ee(o,r,a,i,l,"next",e)}function l(e){Ee(o,r,a,i,l,"throw",e)}i(void 0)}))})();var n}function ke(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function Se(e,t,n,r,a,o,i){try{var l=e[o](i),c=l.value}catch(e){return void n(e)}l.done?t(c):Promise.resolve(c).then(r,a)}function Te(e){return function(){var t=this,n=arguments;return new Promise((function(r,a){var o=e.apply(t,n);function i(e){Se(o,r,a,i,l,"next",e)}function l(e){Se(o,r,a,i,l,"throw",e)}i(void 0)}))}}function Ne(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,a,o=[],i=!0,l=!1;try{for(n=n.call(e);!(i=(r=n.next()).done)&&(o.push(r.value),!t||o.length!==t);i=!0);}catch(e){l=!0,a=e}finally{try{i||null==n.return||n.return()}finally{if(l)throw a}}return o}}(e,t)||function(e,t){if(e){if("string"==typeof e)return ke(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?ke(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Pe(e,t){var n,r,a,o={label:0,sent:function(){if(1&a[0])throw a[1];return a[1]},trys:[],ops:[]},i=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return i.next=l(0),i.throw=l(1),i.return=l(2),"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function l(l){return function(c){return function(l){if(n)throw new TypeError("Generator is already executing.");for(;i&&(i=0,l[0]&&(o=0)),o;)try{if(n=1,r&&(a=2&l[0]?r.return:l[0]?r.throw||((a=r.return)&&a.call(r),0):r.next)&&!(a=a.call(r,l[1])).done)return a;switch(r=0,a&&(l=[2&l[0],a.value]),l[0]){case 0:case 1:a=l;break;case 4:return o.label++,{value:l[1],done:!1};case 5:o.label++,r=l[1],l=[0];continue;case 7:l=o.ops.pop(),o.trys.pop();continue;default:if(!((a=(a=o.trys).length>0&&a[a.length-1])||6!==l[0]&&2!==l[0])){o=0;continue}if(3===l[0]&&(!a||l[1]>a[0]&&l[1]<a[3])){o.label=l[1];break}if(6===l[0]&&o.label<a[1]){o.label=a[1],a=l;break}if(a&&o.label<a[2]){o.label=a[2],o.ops.push(l);break}a[2]&&o.ops.pop(),o.trys.pop();continue}l=t.call(e,o)}catch(e){l=[6,e],r=0}finally{n=a=0}if(5&l[0])throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}([l,c])}}}const Ie=function(){var e=Ne((0,a.useState)("National ID"),2),t=e[0],n=e[1],i=Ne((0,a.useState)(""),2),l=i[0],c=i[1],s=Ne((0,a.useState)(!1),2),u=s[0],d=s[1],f=Ne((0,a.useState)(),2),m=f[0],p=f[1],A=Ne((0,a.useState)(),2),h=A[0],y=A[1],_=Ne((0,a.useState)([]),2),b=_[0],v=_[1],C=Ne((0,a.useState)("principal"),2),E=C[0],x=C[1],k=Ne((0,a.useState)(!1),2),S=k[0],T=k[1],I=Ne((0,a.useState)(!1),2),D=I[0],O=I[1],B=Ne((0,a.useState)(!1),2),R=B[0],H=B[1],Y=Ne((0,a.useState)(),2),U=Y[0],M=Y[1],V=(0,P.useSession)().sessionLocation.uuid,L=(0,me.useNavigate)(),J=function(e,t,n){(0,P.showSnackbar)({kind:e,title:t,subtitle:n})},W=function(){O(!1)},G=function(){window.location.href="".concat(window.spaBase,"/patient-registration")},$=function(){return"principal"===E?m:"dependants"===E?h:m};return o().createElement(o().Fragment,null,o().createElement("div",{className:w.registryLayout},o().createElement("div",{className:w.mainContent},o().createElement("div",{className:w.registryHeader},o().createElement("h4",null,"Client Registry"),o().createElement("p",null,"Please enter identification number to begin")),o().createElement("div",{className:w.registryContent},o().createElement("div",{className:w.formRow},o().createElement("div",{className:w.formControl},o().createElement(r.msM,{id:"identifier-type-dropdown",label:"Identifier Type",titleText:"Select Identifier Type",items:g,selectedItem:t,onChange:function(e){var t=e.selectedItem;return n(t)}})),o().createElement("div",{className:w.formControl},o().createElement(r.ksK,{id:"identifier-value",labelText:"".concat(t," Value"),value:l,onChange:function(e){return c(e.target.value)},placeholder:"Enter ".concat(t.toLowerCase()," value")}))),o().createElement("div",{className:w.formRow},o().createElement("div",{className:w.formControl},o().createElement("div",{className:w.formBtn},o().createElement(r.$nd,{className:w.registrySearchBtn,kind:"primary",onClick:function(){return Te((function(){var e,n,r,a,o,i;return Pe(this,(function(c){switch(c.label){case 0:d(!0),c.label=1;case 1:return c.trys.push([1,3,4,5]),function(e){return e.identificationNumber?e.identificationType?!!e.locationUuid||(J("error","No default location selected",""),!1):(J("error","Please enter a valid identification type",""),!1):(J("error","Please enter a valid identification number",""),!1)}(e={identificationNumber:l,identificationType:t,locationUuid:V})?(M(e),[4,N(e)]):[2,!1];case 2:if(n=c.sent(),0===(r=Array.isArray(n)?n:[]).length)throw new Error("No matching patient found in Client Registry.");return a=r[0],p(a),J("success","Client Data Loaded","Patient fetched successfully"),[3,5];case 3:return o=c.sent(),i=o.message||"Failed to fetch client data",J("error","Fetch Failed",i),[3,5];case 4:return d(!1),[7];case 5:return[2]}}))}))()},disabled:u},u?o().createElement(r.OuH,{description:"Searching..."}):"Search"),o().createElement(r.$nd,{className:w.registrySearchBtn,kind:"secondary",onClick:G},"Emergency Registration")))),m?o().createElement("div",{className:w.formRow},o().createElement("div",{className:w.hieData},o().createElement("div",{className:w.selectionHeader},o().createElement("h5",null,"Please select one patient and request patient to share the OTP sent")),o().createElement("div",{className:w.patientSelect},o().createElement("div",{className:w.patientSelectRadio},o().createElement(r.zWQ,{defaultSelected:"principal",legendText:"Patient",onChange:function(e){x(e)},name:"radio-button-default-group"},o().createElement(r.aaP,{id:"principal",labelText:"Principal",value:"principal"}),o().createElement(r.aaP,{id:"dependants",labelText:"Dependants",value:"dependants"}))),o().createElement("div",{className:w.patientConfirmSelection},o().createElement("div",{className:w.btnContainer},o().createElement(r.$nd,{kind:"primary",onClick:function(){T(!0)}}," ","Confirm")),o().createElement("div",{className:w.btnContainer},o().createElement(r.$nd,{kind:"secondary",onClick:function(){p(null),y(null),v([]),x(null),c(""),n("National ID"),O(!1),T(!1),H(!1)}},"Cancel")))),o().createElement("div",{className:w.principalDependantSection},"principal"===E?o().createElement(o().Fragment,null,o().createElement(r.XIK,null,o().createElement(r.ndF,null,o().createElement(r.Hjg,null,o().createElement(r.A0N,null,"Name"),o().createElement(r.A0N,null,"CR"),o().createElement(r.A0N,null,"Phone No"),o().createElement(r.A0N,null,"ID No"))),o().createElement(r.BFY,null,o().createElement(r.Hjg,null,o().createElement(r.nA6,null,m.first_name," ",F(m.middle_name)," ",F(m.last_name)),o().createElement(r.nA6,null,j(m.id)),o().createElement(r.nA6,null,j(m.phone)),o().createElement(r.nA6,null,j(m.identification_number)))))):o().createElement(o().Fragment,null),"dependants"===E?o().createElement(o().Fragment,null,o().createElement(r.zWQ,{defaultSelected:"",helperText:"",invalidText:"",legendText:"",name:"dependant-group",onChange:function(e){return function(e){var t=m.dependants;if(t.length>0){var n=t.find((function(t){return t.result[0].id===e}));n&&y(n.result[0])}}(e)}},m.dependants.map((function(e){var t=e.result[0],n=e.relationship;return o().createElement(r.aaP,{id:t.id,labelText:pe(t,n),value:t.id})})))):o().createElement(o().Fragment,null),S?o().createElement(q,{requestCustomOtpDto:U,phoneNumber:m.phone,open:S,onModalClose:function(){T(!1)},onOtpSuccessfullVerification:function(){T(!1),O(!0)}}):o().createElement(o().Fragment,null),m&&D?o().createElement(o().Fragment,null,o().createElement(z,{client:$(),open:D,onModalClose:W,onSubmit:function(){},onSendClientToTriage:function(e){return Te((function(){var t;return Pe(this,(function(n){switch(n.label){case 0:return W(),[4,Q(e)];case 1:return(t=n.sent()).totalCount>0?(J("success","".concat(t.totalCount," ").concat(t.totalCount>0?"Patients":"Patient"," found in the system with ").concat(e),""),v(t.results),H(!0)):(J("error","Patient not found in the system",""),v([]),H(!0)),[2]}}))}))()}})," "):o().createElement(o().Fragment,null),m&&R?o().createElement(o().Fragment,null,o().createElement(fe,{client:$(),patients:b,open:R,onModalClose:function(e){H(!1),e&&e.success&&L("/triage")},onSubmit:function(){},onCreateAmrsPatient:function(e){return Te((function(){var e,t,n,r,a,o,i,l,c,s,u;return Pe(this,(function(d){switch(d.label){case 0:return d.trys.push([0,2,,3]),[4,xe(h,V)];case 1:return(e=d.sent())&&(J("success","Patient created succesfully",""),v([e])),[3,3];case 2:if(t=d.sent(),r=null!==(n=t.responseBody)&&void 0!==n?n:t.message,J("error","Error Creating Patient",""),a=function(e){var t=[];if(e&&e.error)if(e.error.error){var n=e.error.error.globalErrors||null;if(n){var r=!0,a=!1,o=void 0;try{for(var i,l=n[Symbol.iterator]();!(r=(i=l.next()).done);r=!0){var c=i.value;t.push(c.message)}}catch(e){a=!0,o=e}finally{try{r||null==l.return||l.return()}finally{if(a)throw o}}}}else if(e.error)if(e.error.globalErrors){var s=e.error.globalErrors||null;if(s){var u=!0,d=!1,f=void 0;try{for(var m,p=s[Symbol.iterator]();!(u=(m=p.next()).done);u=!0){var A=m.value;t.push(A.message)}}catch(e){d=!0,f=e}finally{try{u||null==p.return||p.return()}finally{if(d)throw f}}}}else e.error.message&&t.push(e.error.message);else t.push(e.error.error.message||"An error occurred while creating the patient. Please try again or contact support");return t}(r),a&&a.length>0){o=!0,i=!1,l=void 0;try{for(c=a[Symbol.iterator]();!(o=(s=c.next()).done);o=!0)u=s.value,J("error",u,"")}catch(e){i=!0,l=e}finally{try{o||null==c.return||c.return()}finally{if(i)throw l}}}return[3,3];case 3:return[2]}}))}))()},onManualRegistration:function(){H(!1),G()}})):o().createElement(o().Fragment,null)))):o().createElement(o().Fragment,null)))))}}}]);