1(self.webpackChunkweb=self.webpackChunkweb||[]).push([[13],{32715:function(e,n,t){"use strict";t.d(n,{A:function(){return v}});t(50016);var i=t(45802),l=t(47312),a=t.n(l),s=t(72661),r=t(55740),o=t(11527),d=t(25120),c=t(3426),u=t(83872),m=t(90076);function v(e){var n=e.patientId,t=e.className,l=(0,i.Zp)(),v=(0,u._)(n).defaultViewLink;return(0,m.jsx)(o.Xj,{id:"patient:record",children:(0,m.jsx)(o.wM,{secured:["patient:clinical:view"],children:(0,m.jsx)(d.$n,{transparent:!0,className:a()("pl-0",t),id:"patient-medical-record-button","aria-label":"patient clinical record",tooltip:"View Medical Record",onClick:function(){return l(v)},children:(0,m.jsx)(r.In,{icon:s.sUh,color:c.z1,size:"xl",className:"mb-1"})})})})}},13:function(e,n,t){"use strict";t.r(n),t.d(n,{default:function(){return mn}});var i=t(69740),l=t(90689),a=t(50016),s=t(26517),r=t.n(s),o=t(45802),d=t(99207),c=t(35849),u=t(72661),m=t(11527),v=t(25120),f=t(69993),h=t(86330),x=t(83705),p=t(39850),j=t(22119),b=t(88622),g=t(44450),A=t(45743),I=t.n(A),N=t(67449),y=t(55740),w=t(92302),k=t(34437),C=t(89731),z=t(99180),S=t(71995),E=t(94471),D=t(47312),_=t.n(D),T=t(97641),V=t(48808),P=t.n(V),O=t(88475),R=t.n(O),$=t(36541),M=t(67219),B=t(93701),Y=t(13472),q=t.n(Y),L=t(3426),F=t(87090),G=/^[a-zA-Z]([-\w\s.'])*$/,U=F.Ik().shape({firstName:F.Yj().trim().matches(G,{message:"Names must start with a letter and be alphanumeric (may include spaces, dashes, apostraphes, or period).",excludeEmptyString:!0}).required("First Name is required"),lastName:F.Yj().trim().matches(G,{message:"Names must start with a letter and be alphanumeric (may include spaces, dashes, apostraphes, or period).",excludeEmptyString:!0}).required("Last Name is required"),middleName:F.Yj().trim().matches(G,{message:"Names must start with a letter and be alphanumeric (may include spaces, dashes, apostraphes, or period).",excludeEmptyString:!0}).nullable(),dob:F.p6().nullable().required("Date of birth is required"),gender:F.Yj().nullable(),suffix:F.Yj().nullable(),identifiers:F.YO().nullable(),ssn:F.Yj().matches(/^(\d{3}-?\d{2}-?)?\d{4}$/,{message:"SSN must either be 9 digits or the last 4 digits",excludeEmptyString:!0}),contactInfo:F.Ik().shape({phone:F.YO().of(F.Ik().shape({type:F.Yj(),number:F.Yj().transform(function(e){return e.replace(/[^+\d]/g,"")}).matches(/^(\+1)?\d{10}$/,{message:"Phone must be the correct format"})})),email:F.Yj().email("Email must be valid").nullable(),address:F.Ik().shape({street1:F.Yj().nullable(),street2:F.Yj().nullable(),city:F.Yj().nullable(),state:F.Yj().nullable(),zip:F.Yj().nullable().matches(/^\d{5}(-?\d{4})?$/,{message:"Zip must either be 5 or 9 digits",excludeEmptyString:!0})})})}),K=t(36421),W=t(73329),X=t(21063),Z=t(19162),H=t.n(Z),J=t(90076),Q=["ref"],ee=F.Ik().shape({id:F.Yj().required("ID is required"),assigner:F.Yj().required("Assigner is required"),type:F.Yj().required("Type is required")});function ne(e){var n=e.onSubmit,t=e.onClose,l=(0,B.mN)({mode:"onBlur",reValidateMode:"onBlur",resolver:(0,M.t)(ee)}),a=function(){var e=(0,i.A)({},l.register.apply(l,arguments)),n=e.ref,t=(0,p.A)(e,Q);return(0,i.A)((0,i.A)({},t),{},{innerRef:n})},s=l.handleSubmit,r=l.getValues,o=l.formState,d=function(e){return e&&q()(o.dirtyFields,e)&&r(e)&&!q()(o.errors,e)},c=function(e){return e&&q()(o.dirtyFields,e)&&q()(o.errors,e)};return(0,J.jsx)(K.A,{className:"bg-light",children:(0,J.jsx)(W.A,{children:(0,J.jsx)(B.Op,(0,i.A)((0,i.A)({},l),{},{children:(0,J.jsxs)("form",{id:"mrn-form",onSubmit:s(H()),children:[(0,J.jsxs)(w.A,{children:[(0,J.jsx)(k.A,{for:"id",children:"ID"}),(0,J.jsx)(X.A,(0,i.A)((0,i.A)({id:"id"},a("id")),{},{valid:d("id"),invalid:c("id")})),(0,J.jsx)(te,{field:"id"})]}),(0,J.jsxs)(w.A,{children:[(0,J.jsx)(k.A,{for:"assigner",children:"Facility"}),(0,J.jsx)(X.A,(0,i.A)((0,i.A)({id:"assigner"},a("assigner")),{},{valid:d("assigner"),invalid:c("assigner")})),(0,J.jsx)(te,{field:"assigner"})]}),(0,J.jsxs)(w.A,{children:[(0,J.jsx)(k.A,{for:"type",children:"Type"}),(0,J.jsx)(X.A,(0,i.A)((0,i.A)({id:"type"},a("type")),{},{valid:d("type"),invalid:c("type")})),(0,J.jsx)(te,{field:"type"})]}),(0,J.jsx)("hr",{}),(0,J.jsxs)("div",{className:"d-flex justify-content-center",children:[(0,J.jsxs)(v.$n,{onClick:function(){return n&&n(r())},disabled:!o.isDirty||!o.isValid,form:"mrn-form",className:"d-flex align-items-center mx-2",color:"primary",tooltip:"Submit",children:[(0,J.jsx)(y.In,{icon:u.mP5,color:"white",size:"sm"}),(0,J.jsx)("span",{className:"ml-1",children:"Save"})]}),(0,J.jsxs)(v.$n,{className:"d-flex align-items-center mx-2",onClick:function(){return t&&t()}
1,color:"secondary",tooltip:"Cancel",children:[(0,J.jsx)(y.In,{icon:u.Gsv,color:"white",size:"md"}),(0,J.jsx)("span",{className:"ml-1",children:"Cancel"})]})]})]})}))})})}function te(e){var n,t,i=e.field,l=(0,B.xW)().formState;return null!==(n=l.errors[i])&&void 0!==n&&n.message?(0,J.jsxs)("span",{className:"text-danger",children:[(0,J.jsx)(y.In,{icon:N.BS8,size:"xs",className:"mr-2"}),(0,J.jsx)("small",{className:"font-weight-bold",children:null===(t=l.errors[i])||void 0===t?void 0:t.message})]}):null}var ie=t(81253),le=t(20591),ae=t(16426),se=t(273),re=t(55921),oe=t.n(re);function de(e){var n=e.field,t=(0,B.xW)().formState;return q()(t.errors,"".concat(n,".message"))?(0,J.jsxs)("span",{className:"text-danger",children:[(0,J.jsx)(y.In,{icon:N.BS8,size:"1em",className:"mr-2"}),(0,J.jsx)("small",{className:"font-weight-bold",children:q()(t.errors,"".concat(n,".message"))})]}):null}var ce=["home","mobile","work"],ue=function(e){switch(e){case"work":return u.hjC;case"home":return u.sjR;case"mobile":return u.iJi;default:return u.XpP}},me=function(e){return(null===e||void 0===e?void 0:e[0].toUpperCase())+(null===e||void 0===e?void 0:e.slice(1))};var ve=function(e){var n,t=e.methods,l=e.isValid,a=e.isNotValid,s=e.readonly,r=void 0!==s&&s,o=t.getValues,d=t.control,c=(0,B.jz)({name:"contactInfo.phone",control:d}),m=c.fields,f=c.append,h=c.remove,x=function(){return o("contactInfo.phone").map(function(e){return e.type})},p=function(e){var n=ce.map(function(n){return(0,J.jsxs)(ie.A,{className:"py-2",onClick:function(){return e(n)},children:[(0,J.jsx)(y.In,{icon:ue(n),color:"black",size:"lg",className:"pr-2"}),me(n)]},n)}),t=x();return n.filter(function(e){return!t.includes(e.key)})},j=ce.length===(null===(n=o("contactInfo.phone"))||void 0===n?void 0:n.length);return(0,J.jsxs)(w.A,{children:[(0,J.jsx)(k.A,{id:"contactInfo-phone",children:"Phone Numbers"}),(0,J.jsx)(v.$n,{"aria-label":"add phone number",onClick:function(){return f({number:"",type:oe()(ce,x())[0]})},disabled:!function(){var e,n=o("contactInfo.phone"),t=null===n||void 0===n?void 0:n.length;return t<3&&t>=0&&""!==(null===(e=n[t-1])||void 0===e?void 0:e.number)}()||r,transparent:!0,className:" d-inline-block",children:(0,J.jsx)(y.In,{icon:u.dBP,color:"green",size:"lg",className:"mr-2"})}),m.map(function(e,n){return(0,J.jsxs)("div",{className:"mb-2",children:[(0,J.jsxs)(C.A,{children:[(0,J.jsx)(z.A,{addonType:"prepend",children:(0,J.jsx)(S.A,{className:r||j?"":"p-0 m-0",children:(0,J.jsx)(B.xI,{control:d,name:"contactInfo.phone[".concat(n,"].type"),defaultValue:e.type,render:function(e){var t=e.field,i=(0,J.jsx)(y.In,{icon:ue(o("contactInfo.phone[".concat(n,"].type"))),color:"black",size:"1.20em",className:"d-block"});return(0,J.jsx)(v.m_,{id:n,content:me(o("contactInfo.phone[".concat(n,"].type"))),delay:750,children:r||j?i:(0,J.jsxs)(le.A,{"aria-label":"phone number type",children:[(0,J.jsx)(ae.A,{"aria-label":"phone number type",color:"transparent",disabled:x().length===ce.length||r,children:i}),(0,J.jsx)(se.A,{className:"p-0 m-0",children:p(function(e){t.onChange(e),t.onBlur(e)})})]})})}})})}),(0,J.jsx)(B.xI,{control:d,name:"contactInfo.phone[".concat(n,"].number"),defaultValue:o("contactInfo.phone[".concat(n,"].number")),render:function(e){var t=e.field;return(0,J.jsx)(y.LR,(0,i.A)((0,i.A)({},t),{},{ref:null,"aria-label":"phone number","aria-labelledby":"contactInfo-phone",value:o("contactInfo.phone[".concat(n,"].number")),className:_()("form-control"),valid:l("contactInfo.phone[".concat(n,"].number"))?"true":"false",invalid:a("contactInfo.phone[".concat(n,"].number"))?"true":"false",disabled:r,onChange:function(e){t.onChange(e),t.onBlur(e)}}))}}),r?null:(0,J.jsx)(z.A,{addonType:"append",children:(0,J.jsx)(v.$n,{"aria-label":"remove phone number",onClick:function(){return h(n)},color:"red",disabled:r,children:(0,J.jsx)(y.In,{icon:u.YJx,size:"md",className:"d-block"})})})]}),(0,J.jsx)(de,{field:"contactInfo.phone[".concat(n,"].number")})]},e.type)})]})},fe=t(9928),he=t.n(fe);var xe=function(e){var n=e.methods,t=e.isValid,s=e.isNotValid,r=e.readonly,o=void 0!==r&&r,d=n.getValues,c=n.setValue,u=n.control,m=n.trigger,v=(0,a.useState)("9999"),f=(0,l.A)(v,2),h=f[0],x=f[1];(0,a.useEffect)(function(){4===d("ssn").length&&x("xxx-xx-9999"),d("ssn").length>4&&x("999-99-9999")},[d]);var p=function(e,n){var t,i,l,a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"";return 4===(null===n||void 0===n||null===(t=n.value)||void 0===t?void 0:t.replace(/\D/g,"").length)&&a?(x("999-99-9999"),{value:"".concat(null===n||void 0===n?void 0:n.value.replace(/\D/g,"")).concat(a),selection:{start:(null===e||void 0===e?void 0:e.selection.start)+3,end:(null===e||void 0===e?void 0:e.selection.end)+3}}):5!=="".concat(null===n||void 0===n||null===(i=n.value)||void 0===i?void 0:i.replace(/\D/g,"")).length||4!==(null===e||void 0===e||null===(l=e.value)||void 0===l?void 0:l.replace(/\D/g,"").length)||a?(null===e||void 0===e?void 0:e.value.replace(/\D/g,"").length)<4?(x("9999"),{value:null===e||void 0===e?void 0:e.value,selection:null===e||void 0===e?void 0:e.selection}):(null===e||void 0===e?void 0:e.value.replace(/\D/g,"").length)>4?(x("999-99-9999"),{value:null===e||void 0===e?void 0:e.value,selection:null===e||void 0===e?void 0:e.selection}):{value:null===e||void 0===e?void 0:e.value,selection:null===e||void 0===e?void 0:e.selection}:(x("9999"),{value:null===e||void 0===e?void 0:e.value.replace(/\D/g,""),selection:null===e||void 0===e?void 0:e.selection})};return(0,J.jsxs)(w.A,{children:[(0,J.jsx)(k.A,{id:"ssn-label",for:"ssn",children:"SSN"}),(0,J.jsx)(B.xI,{control:u,name:"ssn",defaultValue:d("ssn"),render:function(e){var n=e.field;return(0,J.jsx)(he(),(0,i.A)((0,i.A)({id:"ssn",mask:h},n),{},{"aria-labelledby":"ssn-label",ref:null,className:_()("form-control"),disabled:o,valid:t("ssn")?"true":"false",invalid:s("ssn")?"true":"false",onBlur:function(e){var n;c("ssn",null===(n=d("ssn"))||void 0===n?void 0:n.replace(/\D/g,"")),m(["ssn"]),4===e.target.value.replace(/\D/g,"").length&&x("xxx-xx-9999")},onFocus:function(e){e.target.value.replace(/\D/g,"").length<=4&&x("9999"),e.target.value.replace(/\D/g,"").length>4&&x("999-99-9999")},onChange:function(e){n.onChange(e),n.onBlur(e)},beforeMaskedValueChange:p}))}}),(0,J.jsx)(de,{field:"ssn"})]})};var pe=function(e){var n=e.methods,t=e.isValid,s=e.isNotValid,r=e.readonly,o=void 0!==r&&r,d=n.getValues,c=n.setValue,u=n.control,m=n.trigger,v=(0,a.useState)("99999"),f=(0,l.A)(v,2),h=f[0],x=f[1];(0,a.useEffect)(function(){var e,n;5===(null===(e=d("contactInfo.address.zip"))||void 0===e?void 0:e.length)&&x("99999"),(null===(n=d("contactInfo.address.zip"))||void 0===n?void 0:n.length)>5&&x("99999-9999")},[d]);var p=function(e,n){var t,i,l,a,s,r,o,d,c=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"";return 5===(null===n||void 0===n||null===(t=n.value)||void 0===t||null===(i=t.replace(/\D/g,""))||void 0===i?void 0:i.length)&&c?(x("99999-9999"),{value:"".concat(null===n||void 0===n?void 0:n.value.replace(/\D/g,"")).concat(c),selection:{start:(null===e||void 0===e?void 0:e.selection.start)+2,end:(null===e||void 0===e?void 0:e.selection.end)+2}}):6!==(null===n||void 0===n||null===(l=n.value)||void 0===l||null===(a=l.replace(/\D/g,""))||void 0===a?void 0:a.length)||5!==(null===e||void 0===e||null===(s=e.value)||void 0===s||null===(r=s.replace(/\D/g,""))||void 0===r?void 0:r.length)||c?(null===e||void 0===e||null===(o=e.value.replace(/\D/g,""))||void 0===o?void 0:o.length)<5?(x("99999"),{value:null===e||void 0===e?void 0:e.value,selection:null===e||void 0===e?void 0:e.selection}):(null===e||void 0===e||null===(d=e.value.replace(/\D/g,""))||void 0===d?void 0:d.length)>5?(x("99999-9999"),{value:null===e||void 0===e?void 0:e.value,selection:null===e||void 0===e?void 0:e.selection}):{value:null===e||void 0===e?void 0:e.value,selection:null===e||void 0===e?void 0:e.selection}:(x("99999"),{value:null===e||void 0===e?void 0:e.value.replace(/\D/g,""),selection:null===e||void 0===e?void 0:e.selection})};return(0,J.jsxs)(w.A,{children:[(0,J.jsx)(k.A,{id:"contactInfo.address.zip-label",for:"txt-zip",children:"Zip"}),(0,J.jsx)(B.xI,{control:u,id:"contactInfo.address.zip",name:"contactInfo.address.zip",defaultValue:d("contactInfo.address.zip"),render:function(e){var n=e.field;return(0,J.jsx)(he(),(0,i.A)((0,i.A)({id:"txt-zip",mask:h},n),{}
1,{"aria-labelledby":"contactInfo.address.zip-label",ref:null,className:_()("form-control"),disabled:o,valid:t("contactInfo.address.zip")?"true":"false",invalid:s("contactInfo.address.zip")?"true":"false",onBlur:function(){var e;c("contactInfo.address.zip",null===(e=d("contactInfo.address.zip"))||void 0===e?void 0:e.replace(/\D/g,"")),m(["contactInfo.address.zip"])},onChange:function(e){n.onChange(e),n.onBlur(e)},beforeMaskedValueChange:p}))}}),(0,J.jsx)(de,{field:"contactInfo.address.zip"})]})},je=["ref"],be=function(e){var n=e.title,t=e.icon;return(0,J.jsxs)("div",{style:{borderBottom:"1px solid ".concat(L.wL),paddingBottom:5,paddingLeft:10},children:[(0,J.jsx)("span",{style:{marginRight:10,fontSize:"1.1em",fontWeight:600},children:n}),(0,J.jsx)(y.In,{icon:t,size:"lg"})]})};function ge(e){var n,t=e.patient,s=e.onSubmit,o=e.onChanged,f=e.readonly,h=[{value:"M",label:"Male"},{value:"F",label:"Female"}],x=(0,a.useState)(),j=(0,l.A)(x,2),b=j[0],g=j[1];if(t){var A=t.contactInfo||{},I=A.address,N=A.phone;t.contactInfo||(t.contactInfo={}),I||(t.contactInfo.address={street1:"",street2:"",city:"",state:null,zip:""}),N||(t.contactInfo.phone=[]),t.ssn||(t.ssn=""),t.contactInfo.phone=t.contactInfo.phone.map(function(e){return(0,i.A)((0,i.A)({},e),{},{__typename:void 0})})}var D=(0,B.mN)({mode:"onBlur",reValidateMode:"onBlur",defaultValues:R()(t),resolver:(0,M.t)(U)}),V=function(){var e=(0,i.A)({},D.register.apply(D,arguments)),n=e.ref,t=(0,p.A)(e,je);return(0,i.A)((0,i.A)({},t),{},{innerRef:n})},O=D.handleSubmit,Y=D.setError,L=D.getValues,F=D.formState,G=D.control,K=D.watch,W=D.setValue,X=K(),Z=function(e,n){return e&&q()(F.dirtyFields,e)&&!q()(F.errors,e)&&""!==n},H=function(e){return e&&q()(F.dirtyFields,e)&&!!q()(F.errors,e)};(0,a.useEffect)(function(){var e=!P()(t,X);o&&o(e,(0,$.A)(t,X))},[X,t,o,F]),(0,a.useEffect)(function(){var e=function(e){"Enter"!==e.code&&"NumpadEnter"!==e.code||e.preventDefault()};return document.addEventListener("keydown",e),function(){document.removeEventListener("keydown",e)}},[]);var Q=L("identifiers");return(0,J.jsx)(J.Fragment,{children:(0,J.jsxs)(B.Op,(0,i.A)((0,i.A)({},D),{},{children:[(0,J.jsxs)("form",{id:"patient-editor-form",onSubmit:O(s),children:[(0,J.jsx)(d.A,{children:(0,J.jsx)(c.A,{sm:12,className:"d-flex justify-content-end",children:(0,J.jsx)(be,{title:"Personal Information",icon:u.Mbw})})}),(0,J.jsxs)(d.A,{children:[(0,J.jsx)(c.A,{sm:6,children:(0,J.jsxs)(w.A,{children:[(0,J.jsx)(k.A,{className:"required",for:"firstName",children:"First Name"}),(0,J.jsx)(y.ks,(0,i.A)((0,i.A)({id:"firstName",name:"firstName"},V("firstName",{required:!0})),{},{defaultValue:L("firstName"),disabled:f,valid:Z("firstName"),invalid:H("firstName")})),(0,J.jsx)(de,{field:"firstName"})]})}),(0,J.jsx)(c.A,{sm:6,children:(0,J.jsxs)(w.A,{children:[(0,J.jsx)(k.A,{className:"required",for:"lastName",children:"Last Name"}),(0,J.jsx)(y.ks,(0,i.A)((0,i.A)({id:"lastName",name:"lastName"},V("lastName",{required:!0})),{},{defaultValue:L("lastName"),disabled:f,valid:Z("lastName"),invalid:H("lastName")})),(0,J.jsx)(de,{field:"lastName"})," "]})})]}),(0,J.jsxs)(d.A,{children:[(0,J.jsx)(c.A,{sm:6,children:(0,J.jsxs)(w.A,{children:[(0,J.jsx)(k.A,{for:"middleName",children:"Middle Name"}),(0,J.jsx)(y.ks,(0,i.A)((0,i.A)({id:"middleName",name:"middleName"},V("middleName")),{},{defaultValue:L("middleName"),disabled:f,valid:Z("middleName"),invalid:H("middleName")})),(0,J.jsx)(de,{field:"middleName"})]})}),(0,J.jsx)(c.A,{sm:6,children:(0,J.jsxs)(w.A,{children:[(0,J.jsx)(k.A,{for:"suffix",children:"Suffix"}),(0,J.jsx)(y.ks,(0,i.A)((0,i.A)({id:"suffix",name:"suffix"},V("suffix")),{},{defaultValue:L("suffix"),disabled:f,valid:Z("suffix"),invalid:H("suffix")})),(0,J.jsx)(de,{field:"suffix"})]})})]}),(0,J.jsx)(d.A,{children:(0,J.jsx)(c.A,{sm:12,children:(0,J.jsxs)(w.A,{children:[(0,J.jsx)(k.A,{id:"contactInfo.email-label",for:"txt-email",children:"Email"}),(0,J.jsxs)(C.A,{children:[(0,J.jsx)(z.A,{addonType:"prepend",children:(0,J.jsx)(S.A,{children:(0,J.jsx)(y.In,{icon:u.bl0,color:"text-gray",size:"md"})})}),(0,J.jsx)(B.xI,{control:G,id:"contactInfo.email",name:"contactInfo.email",defaultValue:L("contactInfo.email"),render:function(e){var n=e.field;return(0,J.jsx)(y.j5,(0,i.A)((0,i.A)({id:"txt-email"},n),{}
1,{"aria-labelledby":"contactInfo.email-label",ref:null,value:n.value||void 0,valid:Z("contactInfo.email"),invalid:H("contactInfo.email"),disabled:f,onChange:function(e){n.onChange(e),n.onBlur(e)}}))}})]}),(0,J.jsx)(de,{field:"contactInfo.email"})]})})}),(0,J.jsxs)(d.A,{children:[(0,J.jsxs)(c.A,{sm:6,children:[(0,J.jsx)(ve,{methods:D,isValid:Z,isNotValid:H,readonly:f}),(0,J.jsx)(xe,{methods:D,isValid:Z,isNotValid:H,readonly:f})]}),(0,J.jsxs)(c.A,{sm:6,className:"pl-0",children:[(0,J.jsx)(c.A,{sm:12,children:(0,J.jsxs)(w.A,{className:"form-group__datepicker",children:[(0,J.jsx)(k.A,{for:"dob","aria-label":"date Of birth",className:"pt-2 pb-1 required",children:"Date of Birth"}),(0,J.jsxs)(C.A,{style:{flexWrap:"nowrap"},children:[(0,J.jsx)(z.A,{addonType:"prepend",children:(0,J.jsx)(S.A,{children:(0,J.jsx)(y.In,{icon:u.ip,color:"text-gray",size:"md"})})}),(0,J.jsx)(B.xI,{control:G,name:"dob",placeholderText:"MM/DD/YYYY",render:function(e){var n=e.field,t=e.fieldState;return(0,J.jsx)(y.lr,(0,i.A)((0,i.A)({},n),{},{ref:null,id:"dob",wrapperClassName:_()("d-block w-100"),width:"100%",selected:n.value,onInvalidDate:function(e){return Y(n.name,{type:"manual",message:e})},isError:!r()(t),disabled:f,maxDate:new Date,onChange:function(e){n.onChange(e),n.onBlur(e)}}))}})]}),(0,J.jsx)(de,{field:"dob"})]})}),(0,J.jsx)(c.A,{sm:12,children:(0,J.jsxs)(w.A,{children:[(0,J.jsx)(k.A,{id:"gender-label",for:"cmb-gender",children:"Gender"}),(0,J.jsx)(B.xI,{control:G,placeholder:"Gender",className:"flex-fill",name:"gender",defaultValue:L("gender"),render:function(e){var n=e.field;return(0,J.jsx)(T.Ay,(0,i.A)((0,i.A)({inputId:"cmb-gender"},n),{},{ref:null,"aria-labelledby":"gender-label",options:h,isClearable:!1,isSearchable:!1,isDisabled:f,value:n&&h.find(function(e){return e.value===n.value}),onChange:function(e){n.onChange(e.value),n.onBlur(e.value)},styles:{placeholder:function(e){return(0,i.A)((0,i.A)({},e),{},{color:"#545454"})}}}))}})]})})]})]}),(0,J.jsx)(d.A,{children:(0,J.jsx)(c.A,{sm:12,children:(0,J.jsxs)(w.A,{children:[(0,J.jsx)(k.A,{for:"contactInfo.address.street1",children:"Street"}),(0,J.jsx)(y.ks,(0,i.A)((0,i.A)({id:"contactInfo.address.street1",name:"contactInfo.address.street1"},V("contactInfo.address.street1")),{},{defaultValue:L("contactInfo.address.street1"),valid:Z("contactInfo.address.street1"),invalid:H("contactInfo.address.street1"),disabled:f})),(0,J.jsx)(de,{field:"contactInfo.address.street1"})]})})}),(0,J.jsx)(d.A,{children:(0,J.jsx)(c.A,{sm:12,children:(0,J.jsxs)(w.A,{children:[(0,J.jsx)(k.A,{for:"contactInfo.address.street2",children:"Street 2"}),(0,J.jsx)(y.ks,(0,i.A)((0,i.A)({id:"contactInfo.address.street2",name:"contactInfo.address.street2"},V("contactInfo.address.street2")),{},{defaultValue:L("contactInfo.address.street2"),valid:Z("contactInfo.address.street2"),invalid:H("contactInfo.address.street2"),disabled:f})),(0,J.jsx)(de,{field:"contactInfo.address.street2"})]})})}),(0,J.jsxs)(d.A,{children:[(0,J.jsx)(c.A,{sm:4,children:(0,J.jsxs)(w.A,{children:[(0,J.jsx)(k.A,{for:"contactInfo.address.city",children:"City"}),(0,J.jsx)(y.ks,(0,i.A)((0,i.A)({id:"contactInfo.address.city",name:"contactInfo.address.city"},V("contactInfo.address.city")),{},{defaultValue:L("contactInfo.address.city"),valid:Z("contactInfo.address.city"),invalid:H("contactInfo.address.city"),disabled:f})),(0,J.jsx)(de,{field:"contactInfo.address.city"})]})}),(0,J.jsx)(c.A,{sm:4,children:(0,J.jsxs)(w.A,{children:[(0,J.jsx)(k.A,{id:"contactInfo.address.state-label",for:"cmb-state",children:"State"}),(0,J.jsx)(B.xI,{control:G,name:"contactInfo.address.state",render:function(e){var n=e.field,t=e.fieldState;return(0,J.jsx)(y.dX,(0,i.A)((0,i.A)({"aria-labelledby":"contactInfo.address.state-label",inputId:"cmb-state"},n),{},{ref:null,hasError:t.error,isDisabled:f,onChange:function(e){n.onChange(e&&e.value),n.onBlur(e&&e.value)}}))}}),(0,J.jsx)(de,{field:"contactInfo.address.state"})]})}),(0,J.jsx)(c.A,{sm:4,children:(0,J.jsx)(pe,{methods:D,isValid:Z,isNotValid:H,readonly:f})})]}),(0,J.jsx)("hr",{}),(0,J.jsx)(d.A,{children:(0,J.jsxs)(c.A,{className:"d-flex justify-content-end",children:[(0,J.jsx)(m.Xj,{id:"patient:identifiers:add",children:(0,J.jsx)("span",{className:"d-inline-block ml-2",children:(0,J.jsx)(v.$n,{disabled:f,transparent:!0,tooltip:"Add New MRN","aria-label":"add new MRN",onClick:function(){return r()(b)&&g({})},className:"p-0",children:(0,J.jsx)(y.In,{icon:u.dBP,color:"green",size:"lg"})})})}),(0,J.jsx)(be,{title:"Identifiers",icon:u.Etn})]})}),(0,J.jsx)(d.A,{className:"justify-content-center",children:(0,J.jsx)(c.A,{md:8,sm:8,className:"mt-2 mb-2",children:b&&(0,J.jsx)(ne,{mrn:b,onSubmit:function(e){if(!r()(e.id)&&!r()(e.assigner)){var n=L().identifiers,t=void 0===n?[]:n;t?t.push(e):t=[e],W("identifiers",t),g(null)}},onClose:function(){return g(null)}})})})]}),Q&&(0,J.jsxs)(E.A,{striped:!0,children:[(0,J.jsx)("thead",{children:(0,J.jsxs)("tr",{children:[(0,J.jsx)("th",{children:"Type"}),(0,J.jsx)("th",{children:"ID"}),(0,J.jsx)("th",{children:"Assigning Authority"})]})}),(0,J.jsx)("tbody",{children:null===Q||void 0===Q||null===(n=Q.map)||void 0===n?void 0:n.call(Q,function(e){return(0,J.jsxs)("tr",{children:[(0,J.jsx)("td",{children:e.type||"N/A"}),(0,J.jsx)("td",{children:e.id}),(0,J.jsx)("td",{children:(0,J.jsx)(v.m_,{id:null===e||void 0===e?void 0:e.id,content:e.assigner||"N/A",delay:750,children:e.assigner||"N/A"})})]},null===e||void 0===e?void 0:e.id)})})]})]}))})}var Ae=t(37814),Ie=t(17230),Ne="Failed to save patient. Please make sure all fields are not empty and correct. If entering a MRN, duplicates are not allowed",ye="Failed to save patient due to a service error. Please try again later, or contact support if the error continues.",we="Failed to save patient because the patient identity has a conflict in Verato.",ke=new Set(["PATIENT_IDENTITY_CONFLICT"]),Ce=new Set(["INTERNAL_SERVER_ERROR","BAD_GATEWAY","SERVICE_UNAVAILABLE","GATEWAY_TIMEOUT"]),ze=/Overlay Error Detected|identity conflict/i;function Se(e){if(void 0===e||null===e||""===e)return null;var n=Number(e);return Number.isInteger(n)?n:null}function Ee(e){var n,t,i,l,a,s,r,o;return[null===e||void 0===e||null===(n=e.extensions)||void 0===n?void 0:n.status,null===e||void 0===e||null===(t=e.extensions)||void 0===t?void 0:t.statusCode,null===e||void 0===e||null===(i=e.extensions)||void 0===i||null===(l=i.http)||void 0===l?void 0:l.status,null===e||void 0===e||null===(a=e.extensions)||void 0===a||null===(s=a.exception)||void 0===s?void 0:s.status,null===e||void 0===e||null===(r=e.extensions)||void 0===r||null===(o=r.exception)||void 0===o?void 0:o.statusCode].map(Se).find(function(e){return null!==e})}function De(e){if(!Ae.g.is(e)||!e.bodyText)return null;try{return JSON.parse(e.bodyText)}catch(n){return null}}function _e(e){var n;return Ie.K.is(e)?e.errors:null!==(n=null===e||void 0===e?void 0:e.graphQLErrors)&&void 0!==n?n:[]}function Te(e){var n,t,i,l,a,s,r;return[].concat((0,x.A)(null!==(n=null===e||void 0===e||null===(t=e.networkError)||void 0===t||null===(i=t.result)||void 0===i?void 0:i.errors)&&void 0!==n?n:[]),(0,x.A)(null!==(l=null===e||void 0===e||null===(a=e.result)||void 0===a?void 0:a.errors)&&void 0!==l?l:[]),(0,x.A)(null!==(s=null===(r=De(e))||void 0===r?void 0:r.errors)&&void 0!==s?s:[]))}function Ve(e){var n;return!(null===(n=[].concat((0,x.A)(_e(e)),(0,x.A)(Te(e))).some(function(e){var n=e.extensions;return ke.has(null===n||void 0===n?void 0:n.code)}))||void 0===n||!n)||function(e){var n,t,i,l=De(e);return[null===e||void 0===e?void 0:e.message,null===e||void 0===e||null===(n=e.networkError)||void 0===n?void 0:n.message,null===l||void 0===l?void 0:l.message].concat((0,x.A)(null!==(t=_e(e).map(function(e){return e.message}))&&void 0!==t?t:[]),(0,x.A)(null!==(i=Te(e).map(function(e){return e.message}
1))&&void 0!==i?i:[])).filter(Boolean)}(e).some(function(e){return ze.test(e)})}function Pe(e){var n=function(e){var n,t,i,l,a,s,r=[null===e||void 0===e?void 0:e.status,null===e||void 0===e?void 0:e.statusCode,null===e||void 0===e||null===(n=e.response)||void 0===n?void 0:n.status,null===e||void 0===e||null===(t=e.networkError)||void 0===t?void 0:t.status,null===e||void 0===e||null===(i=e.networkError)||void 0===i?void 0:i.statusCode,null===e||void 0===e||null===(l=e.networkError)||void 0===l||null===(a=l.response)||void 0===a?void 0:a.status].map(Se).find(function(e){return null!==e});return void 0!==r?r:null!==(s=[].concat((0,x.A)(_e(e)),(0,x.A)(Te(e))).map(Ee).find(function(e){return void 0!==e&&null!==e}))&&void 0!==s?s:null}(e);return n>=500||(!(!function(e){return!!e&&!_e(e).length&&(Ae.g.is(e)||(null===e||void 0===e?void 0:e.networkError)||e instanceof Error)}(e)||null!==n)||[].concat((0,x.A)(_e(e)),(0,x.A)(Te(e))).some(function(e){var n=e.extensions;return Ce.has(null===n||void 0===n?void 0:n.code)}))}function Oe(e){return Ve(e)?we:Pe(e)?ye:Ne}var Re,$e=["__typename","directEmail"],Me=["patientId","consent"],Be=(0,b.J1)(Re||(Re=(0,j.A)(["\n mutation SAVE_PATIENT($patientId: ID, $patient: PatientData!) {\n patient(patientId: $patientId) {\n add(patient: $patient) {\n patientId\n firstName\n lastName\n middleName\n suffix\n ssn\n contactInfo {\n phone {\n number\n type\n }\n email\n address {\n street1\n street2\n city\n state\n zip\n county\n }\n }\n dob\n identifiers {\n id\n assigner {\n id\n description\n }\n type\n }\n }\n }\n }\n"])));function Ye(e){var n,t,i,s=e.selectedPatient,r=e.isOpen,o=e.onClose,d=e.readonly,c=e.onSave,m=(0,a.useState)(!1),j=(0,l.A)(m,2),b=j[0],A=j[1],w=s||{},k=w.patientId,C=w.dob,z=w.identifiers,S=(0,v.dz)(),E=null!==s&&void 0!==s&&null!==(n=s.contactInfo)&&void 0!==n&&n.phone?null===s||void 0===s||null===(t=s.contactInfo)||void 0===t||null===(i=t.phone)||void 0===i?void 0:i.map(function(e,n){return"contactInfo.phone[".concat(n,"].__typename")}):[],D=I()(s,["contactInfo.__typename","contactInfo.address.__typename"].concat((0,x.A)(E),["providers","interestedParties"])),_=(D.__typename,D.directEmail,(0,p.A)(D,$e));_.identifiers=z&&z.length>0?z.map(function(e){var n;return{id:e.id,assigner:null===(n=e.assigner)||void 0===n?void 0:n.description,type:e.type}}):null;var T=C&&new Date(C);_.dob=T&&new Date(T.getTime()+6e4*T.getTimezoneOffset());var V=(0,g.n)(Be,{refetchQueries:["PATIENT_FIND"]}),P=(0,l.A)(V,2),O=P[0],R=P[1],$=R.loading,M=R.error;return(0,J.jsx)(v.fZ,{size:"sm",header:function(){return(0,J.jsxs)("div",{className:"d-flex align-items-center",children:[(0,J.jsx)(y.In,{icon:N.AvB,color:"white",size:"1x",className:"mr-3"}),(0,J.jsxs)("div",{className:"d-flex flex-column",children:[(0,J.jsx)("div",{children:_&&_.firstName&&_.lastName&&"".concat(_.firstName," ").concat(_.lastName)||k||"New patient"}),k&&(0,J.jsx)("small",{className:"d-inline-block mt-1",style:{fontSize:12},children:k})]})]})},isOpen:!!r,onClosed:function(){o&&o()},footer:function(e){var n=e.close;return d?null:(0,J.jsxs)("div",{className:"d-flex align-items-center",children:[(0,J.jsxs)(v.$n,{type:"submit",form:"patient-editor-form",disabled:$||!b,className:"d-flex align-items-center mx-2",color:"primary",tooltip:"Save changes",children:[(0,J.jsx)(y.In,{icon:u.mP5,color:"white",size:"sm"}),(0,J.jsx)("span",{className:"ml-1",children:"Save"})]}),(0,J.jsxs)(v.$n,{className:"d-flex align-items-center mx-2",onClick:n,color:"secondary",tooltip:"Close without saving",children:[(0,J.jsx)(y.In,{icon:u.Gsv,color:"white",size:"md"}),(0,J.jsx)("span",{className:"ml-1",children:"Cancel"})]})]})},children:(0,J.jsx)(y.yK,{isBusy:$,error:M,text:"Saving...",children:(0,J.jsx)(ge,{patient:_,readonly:d,onSubmit:function(){var e=(0,h.A)((0,f.A)().m(function e(n){var t,i,l;return(0,f.A)().w(function(e){for(;;)switch(e.p=e.n){case 0:return t=n.patientId,n.consent,i=(0,p.A)(n,Me),e.p=1,e.n=2,O({variables:{patientId:t,patient:i,persistRecords:void 0}});case 2:S.success("Patient successfully saved."),A(!1),c&&c(),o&&o(),e.n=4;break;case 3:e.p=3,l=e.v,S.error(Oe(l),{details:null===l||void 0===l?void 0:l.message});case 4:c();case 5:return e.a(2)}},e,null,[[1,3]])}
1));return function(n){return e.apply(this,arguments)}}(),onChanged:function(e){return A(e)}})})})}var qe,Le,Fe,Ge=t(75191),Ue=t(31148),Ke=t(8378),We=t(33386),Xe=t(44123),Ze=(0,b.J1)(qe||(qe=(0,j.A)(["\n query COHORTS_LOOKUP {\n cohorts {\n partyId\n description\n cohortId\n inform\n owner\n isEditable\n }\n }\n"])));var He=(0,b.J1)(Le||(Le=(0,j.A)(["\n mutation ADD_PATIENT_TO_COHORT($cohortId: ID, $patientId: ID!) {\n cohort(cohortId: $cohortId) {\n addPatient(patientId: $patientId)\n }\n }\n"]))),Je=(0,b.J1)(Fe||(Fe=(0,j.A)(["\n mutation REMOVE_PATIENT_FROM_COHORT($cohortId: ID, $patientId: ID!) {\n cohort(cohortId: $cohortId) {\n removePatient(patientId: $patientId)\n }\n }\n"])));function Qe(e){var n=e.className,t=e.id,s=e.patient,r=(0,v.dz)(),o=(0,m.As)().user,p=function(){var e=(0,Ge.I)(Ze),n=e.data,t=e.error,i=e.loading;return{cohorts:(null===n||void 0===n?void 0:n.cohorts)||[],error:t,loading:i}}(),j=p.cohorts,b=p.loading,A=p.error,I=(0,a.useState)(!1),N=(0,l.A)(I,2),C=N[0],z=N[1],S=(0,a.useState)([]),E=(0,l.A)(S,2),D=E[0],V=E[1],P=(0,a.useMemo)(function(){return(j||[]).filter(function(e){return(null===e||void 0===e?void 0:e.isEditable)||(null===e||void 0===e?void 0:e.owner)===(null===o||void 0===o?void 0:o.uid)})},[j,null===o||void 0===o?void 0:o.uid]),O=(0,a.useMemo)(function(){var e=(null===s||void 0===s?void 0:s.interestedParties)||[],n={};return P.forEach(function(e){n[null===e||void 0===e?void 0:e.cohortId]=e}),e.map(function(e){return n[null===e||void 0===e?void 0:e.cohortId]}).filter(Boolean)},[P,null===s||void 0===s?void 0:s.interestedParties]),R=(0,a.useMemo)(function(){var e=[],n=[];if(0===(null===D||void 0===D?void 0:D.length)&&(null===O||void 0===O?void 0:O.length)>0)n=(0,x.A)(O);else if((null===D||void 0===D?void 0:D.length)>0&&0===(null===O||void 0===O?void 0:O.length))e=(0,x.A)(D);else{var t,i;e=null!==(t=null===D||void 0===D?void 0:D.filter(function(e){return e&&!(null!==O&&void 0!==O&&O.find(function(n){return(null===e||void 0===e?void 0:e.cohortId)===(null===n||void 0===n?void 0:n.cohortId)&&(null===e||void 0===e?void 0:e.type)===(null===n||void 0===n?void 0:n.type)}))}))&&void 0!==t?t:[],n=null!==(i=null===O||void 0===O?void 0:O.filter(function(e){return e&&!(null!==D&&void 0!==D&&D.find(function(n){return(null===e||void 0===e?void 0:e.cohortId)===(null===n||void 0===n?void 0:n.cohortId)&&(null===e||void 0===e?void 0:e.type)===(null===n||void 0===n?void 0:n.type)}))}))&&void 0!==i?i:[]}return[e,n]},[O,D]),$=(0,l.A)(R,2),M=$[0],B=$[1];(0,a.useEffect)(function(){V(O)},[O]);var Y=(0,g.n)(He,{refetchQueries:["MY_PATIENTS_QUERY","COHORTS_LOOKUP"]}),q=(0,l.A)(Y,2),F=q[0],G=q[1].loading,U=(0,g.n)(Je,{refetchQueries:["MY_PATIENTS_QUERY","COHORTS_LOOKUP"]}),K=(0,l.A)(U,2),W=K[0],X=K[1].loading,Z=function(){z(!1),V(O)},H=function(){var e=(0,h.A)((0,f.A)().m(function e(){var n,t,i,l,a,o,d,c,u,m,v,h,x,p,j,b,g,A;return(0,f.A)().w(function(e){for(;;)switch(e.p=e.n){case 0:n=[],t=[],i=!1,l=!1,e.p=1,o=(0,Ue.A)(M);case 2:return e.n=3,o.next();case 3:if(!(i=!(d=e.v).done)){e.n=8;break}return c=d.value,e.p=4,e.n=5,F({variables:{type:null===c||void 0===c?void 0:c.type,cohortId:null===c||void 0===c?void 0:c.cohortId,patientId:s.patientId}});case 5:n.push(null===c||void 0===c?void 0:c.description),e.n=7;break;case 6:e.p=6,j=e.v,r.error("An error occurred trying to add patient to cohort",{details:j});case 7:i=!1,e.n=2;break;case 8:e.n=10;break;case 9:e.p=9,b=e.v,l=!0,a=b;case 10:if(e.p=10,e.p=11,!i||null==o.return){e.n=12;break}return e.n=12,o.return();case 12:if(e.p=12,!l){e.n=13;break}throw a;case 13:return e.f(12);case 14:return e.f(10);case 15:(null===n||void 0===n?void 0:n.length)>0&&r.success("".concat(s.firstName," ").concat(s.lastName," added to cohort ").concat(null===n||void 0===n?void 0:n.join(", "),".")),u=!1,m=!1,e.p=16,h=(0,Ue.A)(B);case 17:return e.n=18,h.next();case 18:if(!(u=!(x=e.v).done)){e.n=24;break}if(p=x.value,e.p=19,!p){e.n=21;break}return e.n=20,W({variables:{type:null===p||void 0===p?void 0:p.type,cohortId:null===p||void 0===p?void 0:p.cohortId,patientId:null===s||void 0===s?void 0:s.patientId}});case 20:t.push(null===p||void 0===p?void 0:p.description);case 21:e.n=23;break;case 22:e.p=22,g=e.v,r.error("An error occurred trying to remove patient from cohort",{details:g});case 23:u=!1,e.n=17;break;case 24:e.n=26;break;case 25:e.p=25,A=e.v,m=!0,v=A;case 26:if(e.p=26,e.p=27,!u||null==h.return){e.n=28;break}return e.n=28,h.return();case 28:if(e.p=28,!m){e.n=29;break}throw v;case 29:return e.f(28);
1case 30:return e.f(26);case 31:(null===t||void 0===t?void 0:t.length)>0&&r.success("".concat(s.firstName," ").concat(s.lastName," removed from cohort ").concat(null===t||void 0===t?void 0:t.join(", "),".")),Z();case 32:return e.a(2)}},e,null,[[27,,28,30],[19,22],[16,25,26,31],[11,,12,14],[4,6],[1,9,10,15]])}));return function(){return e.apply(this,arguments)}}();return s?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(v.$n,{id:t,"aria-label":"edit cohorts",transparent:!0,tooltip:"Cohort",className:_()("pr-1 pl-2",n),onClick:C?Z:function(){z(!0)},children:(0,J.jsx)(y.In,{title:"Cohort",icon:Xe.tM5,color:L.wm,size:"xl",className:"mb-1"})}),C&&(0,J.jsx)("div",{className:"inline-block align-middle",id:"cohort-action-".concat(s.patientId),children:(0,J.jsx)(m.wM,{secured:["patient:read"],children:(0,J.jsx)(Ke.A,{placement:"bottom",target:t,trigger:"legacy",isOpen:C,children:(0,J.jsxs)(We.A,{children:[(0,J.jsx)(d.A,{children:(0,J.jsx)(c.A,{sm:12,children:(0,J.jsx)(v.Z,{loading:b,error:A,children:(0,J.jsxs)(w.A,{children:[(0,J.jsx)(k.A,{id:"cohorts-selector-label",children:"Cohort(s)"}),(0,J.jsx)(T.Ay,{name:"cohorts","aria-labelledby":"cohorts-selector-label",className:"text-gray",id:"cohorts",isMulti:!0,isSearchable:!0,isClearable:!0,value:D,onChange:function(e){return V(e)},noOptionsMessage:function(e){return e.inputValue?"No cohorts found":"Enter search criteria"},getOptionLabel:function(e){return null===e||void 0===e?void 0:e.description},getOptionValue:function(e){return"".concat(null===e||void 0===e?void 0:e.type,"-").concat(null===e||void 0===e?void 0:e.cohortId)},options:P,defaultOptions:!0,styles:{placeholder:function(e){return(0,i.A)((0,i.A)({},e),{},{color:"#545454"})}}})]})})})}),(0,J.jsxs)("div",{className:"my-2",children:[(0,J.jsxs)(v.$n,{size:"sm",color:"success",onClick:H,disabled:G||X||0===(null===M||void 0===M?void 0:M.length)&&0===(null===B||void 0===B?void 0:B.length),children:[(0,J.jsx)(y.In,{icon:u.mP5,color:"white",size:"sm"}),(0,J.jsx)("span",{className:"ml-1",children:"Save"})]}),(0,J.jsxs)(v.$n,{size:"sm",className:"ml-3",onClick:Z,children:[(0,J.jsx)(y.In,{icon:u.Gsv,color:"white",size:"md"}),(0,J.jsx)("span",{className:"ml-1",children:"Cancel"})]})]})]})})})})]}):null}var en,nn={list:"list_list__b+yFA",container:"list_container__HeEEm",container1:"list_container1__0Uwgm",container2:"list_container2__iKrDj",visible:"list_visible__XICqx"},tn=t(32715),ln=(0,b.J1)(en||(en=(0,j.A)(["\n query MY_PATIENTS_QUERY($criteria: PatientSearchCriteria, $uid: String, $inform: Boolean) {\n patients(criteria: $criteria) {\n patientId\n firstName\n lastName\n middleName\n suffix\n ssn\n dob\n gender\n consent\n contactInfo {\n phone {\n number\n type\n }\n email\n address {\n street1\n street2\n city\n state\n zip\n }\n }\n identifiers {\n id\n type\n assigner {\n id\n description\n }\n }\n interestedParties(uid: $uid, inform: $inform) {\n cohortId\n partyId\n uid\n }\n }\n }\n"]))),an=function(e){var n=e.isMobile,t=e.rowIndex,i=e.onClick,l=e.features,a=(0,m.jI)("patients:consent",l),s=(0,m.jI)("patient:fhir:persist",l),r="open-patient-access-".concat(t),o="",d="mx-n4 mb-1",c={marginLeft:5};return n&&(r="open-patient-access-mobile-".concat(t),o="p-0 mr-1",d="",c={}),(0,J.jsx)(J.Fragment,{children:(a||s)&&(0,J.jsx)(v.$n,{transparent:!0,id:r,"aria-label":"open patient consent tray",onClick:i,tooltip:"Patient Consent",className:o,style:c,children:(0,J.jsx)(y.In,{icon:u.vOd,color:L.wm,size:"lg",className:d})})})};function sn(e){var n,t=e.filters,i=e.onChange,l=e.onChangeAccess,a=e.reload,s=(0,m.As)(),r=s.isAuthorized,o=s.user,d=(0,m.UK)().features,c=void 0===d?[]:d,f=!(0,m.jI)("patient:update",c),h=(0,Ge.I)(ln,{variables:{criteria:t.criteria,uid:null===o||void 0===o?void 0:o.uid,inform:!1},skip:!t.criteria,fetchPolicy:"network-only"}),x=h.data,p=h.error,j=h.loading,b=q()(x,"patients",[]),g=[{label:"Action",headerClassName:"align-self-center",dataKey:"actions",width:140,maxWidth:180,flexShrink:0,cellRenderer:function(e){var n=e.rowData,t=e.rowIndex;return(0,J.jsxs)("div",{className:"d-flex align-items-center flex-nowrap",children:[!f&&r(["patient:update"])?(0,J.jsx)(v.$n,{transparent:!0,"aria-label":"open patient editor tray",id:"open-patient-".concat(t,"-a88ba776-18b7-4e03-9884-89e5448a2bdd"),onClick:function(){return i(n,!1)},tooltip:"Edit Patient",children:(0,J.jsx)(y.In,{icon:u.guD,color:L.wm,size:"xl",className:"mx-n4 mb-1"})}):(0,J.jsx)(v.$n,{transparent:!0,"aria-label":"open patient viewer tray",id:"view-patient-".concat(t,"-a88ba776-18b7-4e03-9884-89e5448a2bdd"),onClick:function(){return i(n,!0)},tooltip:"View Patient",children:(0,J.jsx)(y.In,{icon:u.AGM,color:L.wm,size:"xl",className:"mx-n4"})}),(0,J.jsx)(an,{rowIndex:t,onClick:function(){return l(n)},features:c}),(0,J.jsx)(m.Xj,{id:"patient:cohorts",children:(0,J.jsx)(m.wM,{secured:["patient:cohort:manage"],children:(0,J.jsx)(Qe,{id:"patient-cohort-action-".concat(t),patient:n})})}),(0,J.jsx)(tn.A,{patientId:n.patientId,className:"ml-2"})]})}},{label:"Patient",headerClassName:"align-self-center",headerRenderer:function(e){var n=e.label;return(0,J.jsx)("div",{className:"ml-4 d-inline",children:n})},dataKey:"patientId",width:240,maxWidth:300,flexShrink:0,flexGrow:65,cellRenderer:function(e){var n=e.rowIndex,t=e.rowData,i=t.patientId,l=t.firstName,a=t.lastName,s="".concat(l," ").concat(a);return(0,J.jsx)(y.m_,{id:"patient-".concat(n),tooltip:(0,J.jsxs)("div",{children:[(0,J.jsx)("div",{children:s}),(0,J.jsx)("span",{children:i})]}),children:(0,J.jsxs)("div",{className:"text-truncate",id:"patient-".concat(n),children:[(0,J.jsx)("div",{className:"text-truncate",children:(0,J.jsx)("b",{className:"mb-1",children:s})}),(0,J.jsxs)("small",{style:{color:"#707070"},children:[(0,J.jsx)(y.In,{icon:u.Etn,color:L.wL,size:"sm",className:"d-inline-block mr-1 mb-1"}),i]})]})})}},{label:"DOB",headerRenderer:function(e){var n=e.label;return(0,J.jsx)("div",{className:"ml-4 d-inline",children:n})},dataKey:"dob",width:120,maxWidth:140,flexShrink:0,flexGrow:0,cellRenderer:function(e){var n=e.cellData;return(0,J.jsx)("div",{className:"d-flex flex-column",children:(0,J.jsxs)("div",{children:[(0,J.jsx)(y.In,{icon:N.V4G,color:L.jZ,size:"md",className:"mr-2 mb-2"}),(0,J.jsx)("span",{children:n&&(0,J.jsx)(m.ow,{value:n,timezone:"UTC"})})]})})}},{label:"Contact",headerRenderer:function(e){var n=e.label;return(0,J.jsx)("div",{className:"ml-4 d-inline",children:n})},dataKey:"email",width:125,maxWidth:300,flexShrink:0,flexGrow:0,cellRenderer:rn},{label:"Address",headerClassName:"d-flex",headerRenderer:function(e){var n=e.label;return(0,J.jsx)("div",{className:"ml-4 d-inline",children:n})},width:190,dataKey:"address",cellRenderer:function(e){var n,t,i,l,a,s,r,o,d,c,u,m=e.rowIndex,v=e.rowData.contactInfo;return(null===v||void 0===v||null===(n=v.address)||void 0===n?void 0:n.street1)&&(0,J.jsxs)("div",{className:"d-flex align-items-center",children:[(null===v||void 0===v?void 0:v.address)&&(0,J.jsx)(y.In,{icon:N.meu,color:L.g2,size:"xs",className:"mr-3"}),(0,J.jsx)(y.m_,{id:"address-".concat(m),tooltip:(0,J.jsxs)("div",{children:[(null===v||void 0===v||null===(t=v.address)||void 0===t?void 0:t.street1)&&(0,J.jsx)("div",{children:null===v||void 0===v||null===(i=v.address)||void 0===i?void 0:i.street1}),(0,J.jsxs)("span",{children:[null===v||void 0===v||null===(l=v.address)||void 0===l?void 0:l.city," ",null===v||void 0===v||null===(a=v.address)||void 0===a?void 0:a.state," ",null===v||void 0===v||null===(s=v.address)||void 0===s?void 0:s.zip]})]}),children:(0,J.jsxs)("div",{className:"text-truncate",id:"address-".concat(m),children:[(null===v||void 0===v||null===(r=v.address)||void 0===r?void 0:r.street1)&&(0,J.jsx)("div",{className:"text-truncate",children:null===v||void 0===v||null===(o=v.address)||void 0===o?void 0:o.street1}),(0,J.jsxs)("span",{children:[null===v||void 0===v||null===(d=v.address)||void 0===d?void 0:d.city," ",null===v||void 0===v||null===(c=v.address)||void 0===c?void 0:c.state," ",null===v||void 0===v||null===(u=v.address)||void 0===u?void 0:u.zip]})]})})]})}}],A=null!==(n={1:nn.container1,2:nn.container2}[b.length])&&void 0!==n?n:nn.container;return p?(0,J.jsx)(y.n1,{title:"Search Error",errorText:"An error occurred while fetching data from server.",details:p}):(0,J.jsx)(v.Z,{loading:j,children:(null===b||void 0===b?void 0:b.length)>0?(0,J.jsx)("div",{className:A,children:(0,J.jsx)(v.uO,{data:b,bandedRows:{odd:"#f9f9f9",even:"white"},rowHeight:65,className:nn.list,columns:g,showRowNumbers:{maxWidth:40},mobileRowHeight:r(["patient:consent"])?260:180,mobileRenderer:function(e){var n=e.cellData,t=e.rowData;return(0,J.jsx)(on,{cellData:n,rowData:t,onChange:i,reload:a,onChangeAccess:l})}})}):(0,J.jsx)("div",{className:"my-auto",children:(0,J.jsx)(y.q_,{children:"No patient found. Please modify your search criteria and try again..."})})})}function rn(e){var n,t,i,l,a,s,r,o=e.rowIndex,d=e.rowData;return(0,J.jsxs)("div",{className:"text-truncate",children:[(null===(n=d.contactInfo)||void 0===n?void 0:n.email)&&(0,J.jsx)(y.m_,{id:"email-".concat(o),tooltip:null===(t=d.contactInfo)||void 0===t?void 0:t.email,children:(0,J.jsxs)("div",{className:"text-truncate",id:"email-".concat(o),children:[(0,J.jsx)(y.In,{icon:u.FPg,color:L.g2,size:"lg",className:"mr-2"}),null===(i=d.contactInfo)||void 0===i?void 0:i.email]})}),(null===(l=d.contactInfo)||void 0===l?void 0:l.phone)&&(0,J.jsxs)("div",{className:"d-flex align-items-center flex-nowrap",children:[(0,J.jsx)(y.In,{icon:u.XpP,color:L.g2,size:"lg",className:"mr-2"}),null===(a=d.contactInfo)||void 0===a||null===(s=a.phone)||void 0===s||null===(r=s[0])||void 0===r?void 0:r.number]})]})}function on(e){var n,t,i,l,a,s,r,o,f,h,x,p,j,b,g,A,I=e.rowData,w=e.rowIndex,k=e.onCh
1ange,C=e.onChangeAccess,z=e.reload,S=(0,m.As)().isAuthorized,E=(0,m.UK)().features,D=void 0===E?[]:E,T=!(0,m.jI)("patient:update",D);return(0,J.jsx)("div",{className:_()("p-2 border-top d-flex flex-column justify-content-center h-100",w%2===0?"bg-white":"bg-light"),children:(0,J.jsx)(d.A,{children:(0,J.jsx)(c.A,{sm:12,children:(0,J.jsx)("div",{className:"d-flex align-items-center flex-nowrap",children:(0,J.jsxs)("div",{children:[(0,J.jsxs)("div",{id:"patient-name-".concat(w),className:"d-flex align-items-center flex-nowrap",children:[(0,J.jsxs)("strong",{className:"mr-2",style:{lineHeight:1.2},children:[I.firstName," ",I.lastName]}),!T&&S(["patient:update"])?(0,J.jsx)(v.$n,{transparent:!0,id:"open-patient-mobile-".concat(w,"-a88ba776-18b7-4e03-9884-89e5448a2bdd"),onClick:function(){return k(I,!1)},tooltip:"Edit Patient",className:"p-0 mr-1",children:(0,J.jsx)(y.In,{icon:u.guD,color:L.wm,size:"lg"})}):(0,J.jsx)(v.$n,{transparent:!0,id:"view-patient-mobile-".concat(w,"-a88ba776-18b7-4e03-9884-89e5448a2bdd"),onClick:function(){return k(I,!0)},tooltip:"View Patient",className:"p-0 mr-1",children:(0,J.jsx)(y.In,{icon:u.AGM,color:L.wm,size:"xl"})}),(0,J.jsx)(an,{rowIndex:w,onClick:function(){return C(I)},isMobile:!0,features:D}),(0,J.jsx)(m.Xj,{id:"patient:cohorts",children:(0,J.jsx)(Qe,{id:"patient-cohort-action-mobile-".concat(w),patient:I,className:"mr-2"})}),(0,J.jsx)(tn.A,{patientId:I.patientId,reload:z})]}),(0,J.jsxs)("div",{children:[(0,J.jsx)(y.In,{icon:u.Etn,color:L.wL,size:"1em",className:"d-inline-block mr-1 mb-1"}),I.patientId]}),I.dob&&(0,J.jsxs)("div",{children:[(0,J.jsx)(y.In,{icon:N.V4G,color:L.jZ,size:"1em",className:"d-inline-block mr-1 mb-1"}),(0,J.jsx)(m.ow,{value:I.dob,timezone:"UTC"})]}),(0,J.jsx)("div",{children:(0,J.jsxs)("span",{children:[(null===(n=I.contactInfo)||void 0===n||null===(t=n.address)||void 0===t?void 0:t.street1)&&(0,J.jsx)(y.In,{icon:N.meu,color:L.g2,size:"1em",className:"d-inline-block mr-1"}),(0,J.jsx)("span",{children:[null===(i=I.contactInfo)||void 0===i||null===(l=i.address)||void 0===l?void 0:l.street1,null===(a=I.contactInfo)||void 0===a||null===(s=a.address)||void 0===s?void 0:s.city,null===(r=I.contactInfo)||void 0===r||null===(o=r.address)||void 0===o?void 0:o.state,null===(f=I.contactInfo)||void 0===f||null===(h=f.address)||void 0===h?void 0:h.zip].filter(Boolean).join(" ")})]})}),(null===(x=I.contactInfo)||void 0===x?void 0:x.phone)&&(0,J.jsxs)("div",{children:[(0,J.jsx)(y.In,{icon:u.XpP,color:L.wL,size:"sm",className:"d-inline-block mr-1"}),null===(p=I.contactInfo)||void 0===p||null===(j=p.phone)||void 0===j||null===(b=j[0])||void 0===b?void 0:b.number]}),(null===(g=I.contactInfo)||void 0===g?void 0:g.email)&&(0,J.jsxs)("div",{children:[(0,J.jsx)(y.In,{icon:u.FPg,color:L.g2,size:"sm",className:"mr-2"}),null===(A=I.contactInfo)||void 0===A?void 0:A.email]})]})})})})})}var dn=t(59411);function cn(e){var n=e.filters,t=e.onChange,s=(0,a.useState)(!1),r=(0,l.A)(s,2),o=r[0],m=r[1],f=(0,a.useState)((0,i.A)({},n.criteria)),h=(0,l.A)(f,2),x=h[0],p=h[1],j=(0,a.useState)({}),b=(0,l.A)(j,2),g=b[0],A=b[1],I=(0,a.useCallback)(function(){var e={};x.firstName&&!(0,dn.yS)(x.firstName)&&(e.firstName="Names must start with a letter and be alphanumeric (may include spaces, dashes, apostraphes, or period)."),x.lastName&&!(0,dn.yS)(x.lastName)&&(e.lastName="Names must start with a letter and be alphanumeric (may include spaces, dashes, apostraphes, or period)."),A(e)},[x.firstName,x.lastName]);(0,a.useEffect)(function(){I()},[I]);return(0,J.jsx)("form",{onSubmit:function(e){e.preventDefault(),0===Object.keys(g).length&&t({criteria:(0,i.A)({},x)})},children:(0,J.jsxs)(d.A,{className:"d-flex pl-xl-4",children:[(0,J.jsxs)(c.A,{xs:12,md:6,xl:4,className:"d-flex align-items-top mt-2",children:[(0,J.jsx)(k.A,{for:"patient-search-patientId","aria-label":"patient ID",className:"d-inline-block mr-2",children:(0,J.jsx)(y.In,{icon:u.Etn,color:"text-gray",size:"2x"})}),(0,J.jsx)(y.ks,{id:"patient-search-patientId",name:"patientId",placeholder:"Patient ID",disabled:x.firstName||x.lastName||x.dob,onChange:function(e){m(!0),p(function(n){return(0,i.A)((0,i.A)({},n),{},{patientId:e&&e.target?e.target.value:null})})},value:x.patientId||""})]}),(0,J.jsxs)(c.A,{xs:12,md:6,xl:4,className:"d-flex align-items-top mt-2",children:[(0,J.jsx)(k.A,{for:"patient-search-first-name","aria-label":"patient first name",className:"d-inline-block mr-2",children:(0,J.jsx)(y.In,{icon:N.AvB,color:"text-gray",size:"2x"})}),(0,J.jsx)("div",{className:"flex-grow-1",children:(0,J.jsxs)(d.A,{noGutters:!0,children:[(0,J.jsxs)(c.A,{xs:6,className:"d-flex flex-column",children:[(0,J.jsx)(y.ks,{id:"patient-search-first-name",name:"firstName",placeholder:"First Name",disabled:x.patientId,onChange:function(e){m(!0),p(function(n){return(0,i.A)((0,i.A)({},n),{},{firstName:e&&e.target?e.target.value:null})})},value:x.firstName||""}),(0,J.jsx)("div",{className:"flex-grow-0",children:(0,J.jsx)(un,{message:g.firstName})})]}),(0,J.jsxs)(c.A,{xs:6,className:"pl-2 d-flex flex-column",children:[(0,J.jsx)(y.ks,{id:"patient-search-last-name","aria-label":"patient last name",name:"lastName",placeholder:"Last Name",disabled:x.patientId,onChange:function(e){m(!0),p(function(n){return(0,i.A)((0,i.A)({},n),{},{lastName:e&&e.target?e.target.value:null})})},value:x.lastName||""}),(0,J.jsxs)("div",{className:"flex-grow-0",children:[(0,J.jsx)(un,{message:o&&!x.patientId&&!x.lastName&&"Last Name Required"}),(0,J.jsx)(un,{message:g.lastName})]})]})]})})]}),(0,J.jsxs)(c.A,{xs:12,md:6,xl:4,className:"d-flex align-items-top mt-2",children:[(0,J.jsxs)("div",{className:"d-flex mr-auto",children:[(0,J.jsx)(k.A,{for:"patient-search-dob","aria-label":"patient date of birth",className:"d-inline-block mr-2",children:(0,J.jsx)(y.In,{icon:N.V4G,color:"text-gray",size:"2x"})}),(0,J.jsx)(y.lr,{id:"patient-search-dob",name:"dob",placeholderText:"Date of Birth",placement:"bottom",width:"100%",disabled:x.patientId,onChange:function(e){m(!0),p(function(n){return(0,i.A)((0,i.A)({},n),{},{dob:e||null})})},selected:x.dob||null})]}),(0,J.jsxs)("div",{className:"d-flex ml-4",children:[(0,J.jsx)(v.$n,{type:"submit","aria-label":"search",color:"success",id:"patient-search",disabled:!x.patientId&&!x.lastName||Object.keys(g).length>0,tooltip:"Search",className:"d-flex align -items-center justify-content-center",children:(0,J.jsx)(y.In,{icon:u.iyI,color:"white",size:"md"})}),(0,J.jsx)(v.$n,{color:"secondary",id:"patient-clear","aria-label":"clear",className:"d-flex ml-1 align-items-center justify-content-center",onClick:function(){m(!1),p(function(e){return(0,i.A)((0,i.A)({},e),{},{patientId:null,firstName:null,lastName:null,dob:null})}),t({criteria:null})}
1,tooltip:"Clear",children:(0,J.jsx)(y.In,{icon:u.Gsv,color:"white",size:"md"})})]})]})]})})}var un=function(e){var n=e.message,t=e.className;return n?(0,J.jsxs)("span",{className:_()("text-danger",t),children:[(0,J.jsx)(y.In,{icon:N.BS8,size:"xs",className:"mr-2"}),(0,J.jsx)("small",{className:"font-weight-bold",children:n})]}):null};function mn(){var e=(0,o.zy)(),n=(0,a.useState)({cohort:null,criteria:e.state?{patientId:e.state.patientId}:null}),t=(0,l.A)(n,2),s=t[0],f=t[1],h=(0,a.useState)(null),x=(0,l.A)(h,2),p=x[0],j=x[1],b=(0,a.useState)(!1),g=(0,l.A)(b,2),A=g[0],I=g[1],N=(0,a.useState)(null),w=(0,l.A)(N,2),k=w[0],C=w[1],z=(0,a.useState)(!1),S=(0,l.A)(z,2),E=S[0],D=S[1];return(0,J.jsxs)("div",{className:"d-flex flex-column h-100",children:[(0,J.jsx)(Ye,{selectedPatient:p,readonly:A,isOpen:!!p,onClose:function(){return j(null)},onSave:function(){return D(function(e){return!e})}},(null===p||void 0===p?void 0:p.patientId)||(p?"new-patient":"closed-patient-editor")),(null===k||void 0===k?void 0:k.patientId)&&(0,J.jsx)(y.GS,{patientId:null===k||void 0===k?void 0:k.patientId,isOpen:!!k,onClose:function(){return C(null)}}),(0,J.jsxs)(d.A,{children:[(0,J.jsx)(c.A,{xs:12,sm:12,md:12,lg:5,xl:3,xxl:2,children:(0,J.jsxs)("h1",{className:"d-flex mt-0 mb-3",children:[(0,J.jsx)("div",{className:"mr-3",children:"Patients"}),(0,J.jsx)(m.Xj,{id:"patient:create",children:(0,J.jsx)(m.wM,{secured:["patient:update"],children:(0,J.jsx)("div",{className:"mr-3",children:(0,J.jsx)(v.$n,{id:"add-patient",transparent:!0,tooltip:"New Patient",className:"p-0",onClick:function(){return j({})},children:(0,J.jsx)(y.In,{icon:u.dBP,color:"green",size:"xxl",title:"Add Patient"})})})})})]})}),(0,J.jsx)(c.A,{xs:12,sm:12,md:12,lg:7,xl:9,xxl:10,className:"d-flex flex-grow-1 justify-content-end",children:(0,J.jsx)(cn,{filters:s,onChange:function(e){return f((0,i.A)((0,i.A)({},s),e))}})})]}),(0,J.jsx)(d.A,{className:"d-block d-md-flex flex-grow-1 mt-2",children:(0,J.jsx)(c.A,{xs:12,children:(0,J.jsx)(y.Zp,{className:"h-100 p-4",children:r()(s.criteria)?(0,J.jsx)("div",{className:"my-auto",children:(0,J.jsx)(y.q_,{children:"To find a patient Last Name is required or search by Patient ID ..."})}):(0,J.jsx)(sn,{reload:E,filters:s,onChange:function(e,n){j(e),I(n)},onChangeAccess:function(e,n){C(e),I(n)}})})})})]})}},88475:function(e,n,t){var i=t(65667);e.exports=function(e){return i(e,5)}},55921:function(e,n,t){var i=t(37855),l=t(7588),a=t(47874),s=t(54273),r=a(function(e,n){return s(e)?i(e,l(n,1,s,!0)):[]});e.exports=r},94471:function(e,n,t){"use strict";var i=t(89575),l=t(17502),a=t(50016),s=t(82704),r=t.n(s),o=t(47312),d=t.n(o),c=t(47034),u=["className","cssModule","size","bordered","borderless","striped","dark","hover","responsive","tag","responsiveTag","innerRef"],m={className:r().string,cssModule:r().object,size:r().string,bordered:r().bool,borderless:r().bool,striped:r().bool,dark:r().bool,hover:r().bool,responsive:r().oneOfType([r().bool,r().string]),tag:c.Wx,responsiveTag:c.Wx,innerRef:r().oneOfType([r().func,r().string,r().object])},v=function(e){var n=e.className,t=e.cssModule,s=e.size,r=e.bordered,o=e.borderless,m=e.striped,v=e.dark,f=e.hover,h=e.responsive,x=e.tag,p=e.responsiveTag,j=e.innerRef,b=(0,l.A)(e,u),g=(0,c.qO)(d()(n,"table",!!s&&"table-"+s,!!r&&"table-bordered",!!o&&"table-borderless",!!m&&"table-striped",!!v&&"table-dark",!!f&&"table-hover"),t),A=a.createElement(x,(0,i.A)({},b,{ref:j,className:g}));if(h){var I=(0,c.qO)(!0===h?"table-responsive":"table-responsive-"+h,t);return a.createElement(p,{className:I},A)}return A};v.propTypes=m,v.defaultProps={tag:"table",responsiveTag:"div"},n.A=v}}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.