@openmrs/esm-patient-registration-app 4.0.2-pre.624 → 4.0.2-pre.627

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,32 +1,32 @@
1
- @openmrs/esm-patient-registration-app:build: cache hit, replaying output da4ad6e70c630c8e
2
- @openmrs/esm-patient-registration-app:build: assets by chunk 892 KiB (id hint: vendors)
3
- @openmrs/esm-patient-registration-app:build:  asset 858.js 407 KiB [emitted] [minimized] [big] (id hint: vendors) 1 related asset
4
- @openmrs/esm-patient-registration-app:build:  asset 767.js 244 KiB [emitted] [minimized] (id hint: vendors) 1 related asset
5
- @openmrs/esm-patient-registration-app:build:  asset 553.js 95.1 KiB [emitted] [minimized] (id hint: vendors) 1 related asset
6
- @openmrs/esm-patient-registration-app:build:  asset 854.js 70.2 KiB [emitted] [minimized] (id hint: vendors) 1 related asset
7
- @openmrs/esm-patient-registration-app:build:  asset 460.js 39 KiB [emitted] [minimized] (id hint: vendors) 1 related asset
8
- @openmrs/esm-patient-registration-app:build:  asset 100.js 19.6 KiB [emitted] [minimized] (id hint: vendors)
9
- @openmrs/esm-patient-registration-app:build:  asset 290.js 16.6 KiB [emitted] [minimized] (id hint: vendors) 1 related asset
10
- @openmrs/esm-patient-registration-app:build: + 13 assets
11
- @openmrs/esm-patient-registration-app:build: orphan modules 3.61 MiB [orphan] 617 modules
12
- @openmrs/esm-patient-registration-app:build: runtime modules 38 KiB 28 modules
13
- @openmrs/esm-patient-registration-app:build: built modules 3.36 MiB (javascript) 168 bytes (share-init) 168 bytes (consume-shared) [built]
14
- @openmrs/esm-patient-registration-app:build:  modules by path ../../node_modules/ 3.04 MiB 409 modules
15
- @openmrs/esm-patient-registration-app:build:  modules by path ./ 326 KiB
16
- @openmrs/esm-patient-registration-app:build:  modules by path ./src/ 323 KiB 23 modules
17
- @openmrs/esm-patient-registration-app:build:  modules by path ./translations/ 3.13 KiB 2 modules
18
- @openmrs/esm-patient-registration-app:build:  provide-module modules 168 bytes
19
- @openmrs/esm-patient-registration-app:build:  provide shared module (default) @openmrs/esm-framework@4.0.2 = ../../node_modules/@openmrs/esm-framework/src/internal.ts 42 bytes [built] [code generated]
20
- @openmrs/esm-patient-registration-app:build:  + 3 modules
21
- @openmrs/esm-patient-registration-app:build:  consume-shared-module modules 168 bytes
22
- @openmrs/esm-patient-registration-app:build:  consume shared module (default) @openmrs/esm-framework@^4 (singleton) (fallback: ../../node_modules/@openmrs/esm-framework/src/internal.ts) 42 bytes [built] [code generated]
23
- @openmrs/esm-patient-registration-app:build:  consume shared module (default) react@^18 (singleton) (fallback: ../../node_modules/react/index.js) 42 bytes [built] [code generated]
24
- @openmrs/esm-patient-registration-app:build:  + 2 modules
25
- @openmrs/esm-patient-registration-app:build:  container entry 42 bytes [built] [code generated]
26
- @openmrs/esm-patient-registration-app:build: 
27
- @openmrs/esm-patient-registration-app:build: WARNING in asset size limit: The following asset(s) exceed the recommended size limit (244 KiB).
28
- @openmrs/esm-patient-registration-app:build: This can impact web performance.
29
- @openmrs/esm-patient-registration-app:build: Assets:
30
- @openmrs/esm-patient-registration-app:build:  858.js (407 KiB)
31
- @openmrs/esm-patient-registration-app:build: 
32
- @openmrs/esm-patient-registration-app:build: webpack 5.74.0 compiled with 1 warning in 112876 ms
1
+ @openmrs/esm-patient-registration-app:build: cache hit, replaying output 8a075b1630e9ee80
2
+ @openmrs/esm-patient-registration-app:build: assets by chunk 892 KiB (id hint: vendors)
3
+ @openmrs/esm-patient-registration-app:build:  asset 858.js 407 KiB [emitted] [minimized] [big] (id hint: vendors) 1 related asset
4
+ @openmrs/esm-patient-registration-app:build:  asset 767.js 244 KiB [emitted] [minimized] (id hint: vendors) 1 related asset
5
+ @openmrs/esm-patient-registration-app:build:  asset 553.js 95.1 KiB [emitted] [minimized] (id hint: vendors) 1 related asset
6
+ @openmrs/esm-patient-registration-app:build:  asset 854.js 70.2 KiB [emitted] [minimized] (id hint: vendors) 1 related asset
7
+ @openmrs/esm-patient-registration-app:build:  asset 460.js 39 KiB [emitted] [minimized] (id hint: vendors) 1 related asset
8
+ @openmrs/esm-patient-registration-app:build:  asset 100.js 19.6 KiB [emitted] [minimized] (id hint: vendors)
9
+ @openmrs/esm-patient-registration-app:build:  asset 290.js 16.6 KiB [emitted] [minimized] (id hint: vendors) 1 related asset
10
+ @openmrs/esm-patient-registration-app:build: + 13 assets
11
+ @openmrs/esm-patient-registration-app:build: orphan modules 3.61 MiB [orphan] 617 modules
12
+ @openmrs/esm-patient-registration-app:build: runtime modules 38 KiB 28 modules
13
+ @openmrs/esm-patient-registration-app:build: built modules 3.36 MiB (javascript) 168 bytes (share-init) 168 bytes (consume-shared) [built]
14
+ @openmrs/esm-patient-registration-app:build:  modules by path ../../node_modules/ 3.04 MiB 409 modules
15
+ @openmrs/esm-patient-registration-app:build:  modules by path ./ 327 KiB
16
+ @openmrs/esm-patient-registration-app:build:  modules by path ./src/ 323 KiB 23 modules
17
+ @openmrs/esm-patient-registration-app:build:  modules by path ./translations/ 3.19 KiB 2 modules
18
+ @openmrs/esm-patient-registration-app:build:  provide-module modules 168 bytes
19
+ @openmrs/esm-patient-registration-app:build:  provide shared module (default) @openmrs/esm-framework@4.0.2 = ../../node_modules/@openmrs/esm-framework/src/internal.ts 42 bytes [built] [code generated]
20
+ @openmrs/esm-patient-registration-app:build:  + 3 modules
21
+ @openmrs/esm-patient-registration-app:build:  consume-shared-module modules 168 bytes
22
+ @openmrs/esm-patient-registration-app:build:  consume shared module (default) @openmrs/esm-framework@^4 (singleton) (fallback: ../../node_modules/@openmrs/esm-framework/src/internal.ts) 42 bytes [built] [code generated]
23
+ @openmrs/esm-patient-registration-app:build:  consume shared module (default) react@^18 (singleton) (fallback: ../../node_modules/react/index.js) 42 bytes [built] [code generated]
24
+ @openmrs/esm-patient-registration-app:build:  + 2 modules
25
+ @openmrs/esm-patient-registration-app:build:  container entry 42 bytes [built] [code generated]
26
+ @openmrs/esm-patient-registration-app:build: 
27
+ @openmrs/esm-patient-registration-app:build: WARNING in asset size limit: The following asset(s) exceed the recommended size limit (244 KiB).
28
+ @openmrs/esm-patient-registration-app:build: This can impact web performance.
29
+ @openmrs/esm-patient-registration-app:build: Assets:
30
+ @openmrs/esm-patient-registration-app:build:  858.js (407 KiB)
31
+ @openmrs/esm-patient-registration-app:build: 
32
+ @openmrs/esm-patient-registration-app:build: webpack 5.74.0 compiled with 1 warning in 213022 ms
package/dist/574.js CHANGED
@@ -1 +1 @@
1
- "use strict";(self.webpackChunk_openmrs_esm_patient_registration_app=self.webpackChunk_openmrs_esm_patient_registration_app||[]).push([[574],{3574:e=>{e.exports=JSON.parse('{"addRelationshipButtonText":"Add Relationship","address1":"","addressHeader":"Address","allFieldsRequiredText":"All fields are required unless marked optional","autoGeneratedPlaceholderText":"Auto-generated","birthdayNotInTheFuture":"Birthday cannot be in the future","birthdayRequired":"Birthday is required","birthFieldLabelText":"Birth","cancel":"Cancel","causeOfDeathInputLabel":"Cause of Death","cityVillage":"","configure":"Configure","country":"","createNew":"Create New","dateOfBirthLabelText":"Date of Birth","deathDateInputLabel":"Date of Death","deathdayNotInTheFuture":"Death day cannot be in the future","deleteIdentifierTooltip":"Delete","deleteRelationshipTooltipText":"Delete","discard":"Discard","discardModalBody":"The changes you made to this patient\'s details have not been saved. Discard changes?","discardModalHeader":"Confirm Discard Changes","dobToggleLabelText":"Date of Birth Known?","edit":"Edit","editIdentifierTooltip":"Edit","editPatientDetails":"Edit patient details","emailLabelText":"Email","estimatedMonthsLabelText":"Estimated Months","estimatedYearsLabelText":"Estimated Years","familyNameLabelText":"Family Name","familyNameRequired":"Family name is required","fieldErrorTitleMessage":"The following fields have errors:","fullNameLabelText":"Full Name","genderLabelText":"Sex","genderRequired":"Gender is required","genderUnspecified":"Gender is not specified","givenNameLabelText":"First Name","givenNameRequired":"Given name is required","identifierValueRequired":"Identifier value is required","idFieldLabelText":"Identifiers","incompleteForm":"Incomplete form","invalidEmail":"A valid email has to be given","invalidInput":"Invalid Input","isDeadInputLabel":"Is Dead","jumpTo":"Jump to","middleNameLabelText":"Middle Name","months":"Months","negativeMonths":"Negative months","negativeYears":"Negative years","no":"No","numberInNameDubious":"Number is name is dubious","optional":"optional","patient":"Patient","patientNameKnown":"Patient\'s Name is Known?","phoneEmailLabelText":"Phone, Email, etc.","phoneNumberInputLabelText":"Phone number","postalCode":"","registerPatient":"Register Patient","registrationSuccessToastDescription":"The patient can now be found by searching for them using their name or ID number","registrationSuccessToastTitle":"New Patient Created","relationship":"Relationship","relationshipPlaceholder":"Relationship","relationshipRemovedText":"Relationship removed","relationshipToPatient":"Relationship to patient","relativeFullNameLabelText":"Full name","relativeNamePlaceholder":"Firstname Familyname","resetIdentifierTooltip":"Reset","restoreRelationshipActionButton":"Undo","sexFieldLabelText":"Sex","stateProvince":"","stroke":"Stroke","unidentifiedPatient":"Unidentified Patient","unknown":"Unknown","updatePatient":"Update Patient","updationSuccessToastDescription":"The patient\'s information has been successfully updated","updationSuccessToastTitle":"Patient Details Updated","years":"Years","yearsEstimateRequired":"Years estimate required","yes":"Yes"}')}}]);
1
+ "use strict";(self.webpackChunk_openmrs_esm_patient_registration_app=self.webpackChunk_openmrs_esm_patient_registration_app||[]).push([[574],{3574:e=>{e.exports=JSON.parse('{"addRelationshipButtonText":"Add Relationship","address1":"Address line 1","address2":"Address line 2","addressHeader":"Address","allFieldsRequiredText":"All fields are required unless marked optional","autoGeneratedPlaceholderText":"Auto-generated","birthdayNotInTheFuture":"Birthday cannot be in the future","birthdayRequired":"Birthday is required","birthFieldLabelText":"Birth","cancel":"Cancel","causeOfDeathInputLabel":"Cause of Death","cityVillage":"City","configure":"Configure","country":"Country","createNew":"Create New","dateOfBirthLabelText":"Date of Birth","deathDateInputLabel":"Date of Death","deathdayNotInTheFuture":"Death day cannot be in the future","deleteIdentifierTooltip":"Delete","deleteRelationshipTooltipText":"Delete","discard":"Discard","discardModalBody":"The changes you made to this patient\'s details have not been saved. Discard changes?","discardModalHeader":"Confirm Discard Changes","dobToggleLabelText":"Date of Birth Known?","edit":"Edit","editIdentifierTooltip":"Edit","editPatientDetails":"Edit patient details","emailLabelText":"Email","estimatedMonthsLabelText":"Estimated Months","estimatedYearsLabelText":"Estimated Years","familyNameLabelText":"Family Name","familyNameRequired":"Family name is required","fieldErrorTitleMessage":"The following fields have errors:","fullNameLabelText":"Full Name","genderLabelText":"Sex","genderRequired":"Gender is required","genderUnspecified":"Gender is not specified","givenNameLabelText":"First Name","givenNameRequired":"Given name is required","identifierValueRequired":"Identifier value is required","idFieldLabelText":"Identifiers","incompleteForm":"Incomplete form","invalidEmail":"A valid email has to be given","invalidInput":"Invalid Input","isDeadInputLabel":"Is Dead","jumpTo":"Jump to","middleNameLabelText":"Middle Name","months":"Months","negativeMonths":"Negative months","negativeYears":"Negative years","no":"No","numberInNameDubious":"Number is name is dubious","optional":"optional","patient":"Patient","patientNameKnown":"Patient\'s Name is Known?","phoneEmailLabelText":"Phone, Email, etc.","phoneNumberInputLabelText":"Phone number","postalCode":"Postcode","registerPatient":"Register Patient","registrationSuccessToastDescription":"The patient can now be found by searching for them using their name or ID number","registrationSuccessToastTitle":"New Patient Created","relationship":"Relationship","relationshipPlaceholder":"Relationship","relationshipRemovedText":"Relationship removed","relationshipToPatient":"Relationship to patient","relativeFullNameLabelText":"Full name","relativeNamePlaceholder":"Firstname Familyname","resetIdentifierTooltip":"Reset","restoreRelationshipActionButton":"Undo","sexFieldLabelText":"Sex","stateProvince":"State","stroke":"Stroke","unidentifiedPatient":"Unidentified Patient","unknown":"Unknown","updatePatient":"Update Patient","updationSuccessToastDescription":"The patient\'s information has been successfully updated","updationSuccessToastTitle":"Patient Details Updated","years":"Years","yearsEstimateRequired":"Years estimate required","yes":"Yes"}')}}]);
package/dist/686.js CHANGED
@@ -1 +1 @@
1
- (self.webpackChunk_openmrs_esm_patient_registration_app=self.webpackChunk_openmrs_esm_patient_registration_app||[]).push([[686],{225:(e,t,n)=>{"use strict";n.d(t,{X8:()=>s,bT:()=>u,bs:()=>o});var r=n(906);function i(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 a(e){return function(e){if(Array.isArray(e))return i(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 i(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)?i(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 o=[{id:"demographics",name:"Basic Info",fields:["name","gender","dob","id"]},{id:"contact",name:"Contact Details",fields:["address","phone & email"]},{id:"death",name:"Death Info",fields:[]},{id:"relationships",name:"Relationships",fields:[]}],s=["name","gender","dob","address","id","phone & email"],u={sections:{_type:r.Type.Array,_default:["demographics","contact","relationships"],_description:"An array of strings which are the keys from 'sectionDefinitions' or any of the following built-in sections: '".concat(o.map((function(e){return e.id})).join("', '"),"'."),_elements:{_type:r.Type.String}},sectionDefinitions:{_type:r.Type.Array,_elements:{id:{_type:r.Type.String,_description:"How this section will be referred to in the `sections` configuration. To override a built-in section, use that section's id. The built in section ids are '".concat(o.map((function(e){return e.id})).join("', '"),"'.")},name:{_type:r.Type.String,_description:"The title to display at the top of the section."},fields:{_type:r.Type.Array,_default:[],_description:"The parts to include in the section. Can be any of the following built-in fields: ".concat(s.join(", "),". Can also be an id from an object in the `fieldDefinitions` array, which you can use to define custom fields."),_elements:{_type:r.Type.String}}},_default:[]},fieldDefinitions:{_type:r.Type.Array,_elements:{id:{_type:r.Type.String,_description:"How this field will be referred to in the `fields` element of the `sectionDefinitions` configuration."},type:{_type:r.Type.String,_description:"How this field's data will be stored—a person attribute or an obs."},uuid:{_type:r.Type.UUID,_description:"Person attribute type UUID that this field's data should be saved to."},label:{_type:r.Type.String,_default:null,_description:"The label of the input. By default, uses the metadata `display` attribute."},placeholder:{_type:r.Type.String,_default:"",_description:"Placeholder that will appear in the input."},validation:{required:{_type:r.Type.Boolean,_default:!1},matches:{_type:r.Type.String,_default:null,_description:"Optional RegEx for testing the validity of the input."}},answerConceptSetUuid:{_type:r.Type.ConceptUuid,_default:null,_description:"For coded questions only. A concept which has the possible responses either as answers or as set members."},customConceptAnswers:{_type:r.Type.Array,_elements:{uuid:{_type:r.Type.UUID,_description:"Answer concept UUID"},label:{_type:r.Type.String,_default:null,_description:"The custom label for the answer concept."}},_default:[],_description:"For coded questions only. Provide ability to add custom concept answers."}},_default:[],_description:"Definitions for custom fields that can be used in sectionDefinitions. Can also be used to override built-in fields."},fieldConfigurations:{name:{displayMiddleName:{_type:r.Type.Boolean,_default:!0},unidentifiedPatient:{_type:r.Type.Boolean,_default:!0,_description:"Whether to allow patients to be registered without names."},defaultUnknownGivenName:{_type:r.Type.String,_default:"UNKNOWN",_description:"The given/first name to record for unidentified patients."},defaultUnknownFamilyName:{_type:r.Type.String,_default:"UNKNOWN",_description:"The family/last name to record for unidentified patients."}},gender:{_type:r.Type.Array,_elements:{value:{_type:r.Type.String,_description:"The value for sex option"},label:{_type:r.Type.String,_default:null,_description:"The label displayed for sex option."},id:{_type:r.Type.String,_default:null,_description:"The id for sex option."}},_default:[{id:"male",value:"Male",label:"Male"},{id:"female",value:"Female",label:"Female"},{id:"other",value:"Other",label:"Other"},{id:"unknown",value:"Unknown",label:"Unknown"}],_description:"Provide ability to configure sex options."}},links:{submitButton:{_type:r.Type.String,_default:"${openmrsSpaBase}/patient/${patientUuid}/chart",_validators:[r.validators.isUrlWithTemplateParameters(["patientUuid"])]}},concepts:{patientPhotoUuid:{_type:r.Type.ConceptUuid,_default:"736e8771-e501-4615-bfa7-570c03f4bef5"}},defaultPatientIdentifierTypes:{_type:r.Type.Array,_elements:{_type:r.Type.PatientIdentifierTypeUuid},_default:[]},registrationObs:{encounterTypeUuid:{_type:r.Type.UUID,_default:null,_description:"Obs created during registration will be associated with an encounter of this type. This must be set in order to use fields of type `obs`."},encounterProviderRoleUuid:{_type:r.Type.UUID,_default:"a0b03050-c99b-11e0-9572-0800200c9a66",_description:"The provider role to use for the registration encounter. Default is 'Unkown'."},registrationFormUuid:{_type:r.Type.UUID,_default:null,_description:"The form UUID to associate with the registration encounter. By default no form will be associated."}},_validators:[(0,r.validator)((function(e){return!e.fieldDefinitions.some((function(e){return"obs"==e.type}))||null!=e.registrationObs.encounterTypeUuid}),"If fieldDefinitions contains any fields of type 'obs', `registrationObs.encounterTypeUuid` must be specified."),(0,r.validator)((function(e){return e.sections.every((function(t){return a(o).concat(a(e.sectionDefinitions)).map((function(e){return e.id})).includes(t)}))}),(function(e){var t=a(o).concat(a(e.sectionDefinitions)).map((function(e){return e.id})),n=e.sections.find((function(e){return!t.includes(e)}));return"'".concat(n,"' is not a valid section ID. Valid section IDs include the built-in sections ").concat(c(o))+(e.sectionDefinitions.length?"; and the defined sections ".concat(c(e.sectionDefinitions),"."):".")})),(0,r.validator)((function(e){return e.sectionDefinitions.every((function(t){return t.fields.every((function(t){return a(s).concat(a(e.fieldDefinitions.map((function(e){return e.id})))).includes(t)}))}))}),(function(e){var t=a(s).concat(a(e.fieldDefinitions.map((function(e){return e.id})))),n=e.sectionDefinitions.find((function(e){return e.fields.some((function(e){return!t.includes(e)}))})),r=n.fields.find((function(e){return!t.includes(e)}));return"The section definition '".concat(n.id,"' contains an invalid field '").concat(r,"'. 'fields' can only contain the built-in fields '").concat(s.join("', '"),"'")+(e.fieldDefinitions.length?"; or the defined fields ".concat(c(e.fieldDefinitions),"."):".")}))]};function c(e){return"'".concat(e.map((function(e){return e.id})).join("', '"),"'")}},8179:(e,t,n)=>{"use strict";n.d(t,{Kt:()=>c,QT:()=>l,UO:()=>s,e1:()=>u});var r,i,a,o=n(906),s="custom:(display,uuid,personA:(age,display,birthdate,uuid),personB:(age,display,birthdate,uuid),relationshipType:(uuid,display,description,aIsToB,bIsToA))",u="@openmrs/esm-patient-registration-app",c="patient-registration",l=(r={},a="network-first",(i=o.omrsOfflineCachingStrategyHttpHeaderName)in r?Object.defineProperty(r,i,{value:a,enumerable:!0,configurable:!0,writable:!0}):r[i]=a,r)},1686:(e,t,n)=>{"use strict";n.r(t),n.d(t,{backendDependencies:()=>g,importTranslation:()=>b,setupOpenMRS:()=>w,version:()=>v});var r=n(906),i=n(3076),a=n(225),o=n(8179),s=n(5047),u=n.n(s),c=n(6279);function l(e,t,n,r,i,a,o){try{var s=e[a](o),u=s.value}catch(e){return void n(e)}s.done?t(u):Promise.resolve(u).then(r,i)}function p(e){return function(){var t=this,n=arguments;return new Promise((function(r,i){var a=e.apply(t,n);function o(e){l(a,r,i,o,s,"next",e)}function s(e){l(a,r,i,o,s,"throw",e)}o(void 0)}))}}function d(e){return["/ws/fhir2/R4/Patient/".concat(e),"/ws/rest/v1/relationship?v=".concat(o.UO,"&person=").concat(e),"/ws/rest/v1/person/".concat(e,"/attribute"),"/ws/rest/v1/patient/".concat(e,"/identifier?v=custom:(uuid,identifier,identifierType:(uuid,required,name),preferred)")].map((function(e){return window.origin+(0,r.makeUrl)(e)}))}function f(){return y.apply(this,arguments)}function y(){return(y=p(u().mark((function e(){return u().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Promise.all([(0,c.X1)(),(0,c.Te)(),(0,c.mt)(),(0,c.St)()]);case 2:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function h(e,t){return m.apply(this,arguments)}function m(){return(m=p(u().mark((function e(t,n){return u().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,i.y.savePatientFormOnline(t._patientRegistrationData.isNewPatient,t._patientRegistrationData.formValues,t._patientRegistrationData.patientUuidMap,t._patientRegistrationData.initialAddressFieldValues,t._patientRegistrationData.capturePhotoProps,t._patientRegistrationData.currentLocation,t._patientRegistrationData.initialIdentifierValues,t._patientRegistrationData.currentUser,t._patientRegistrationData.config,t._patientRegistrationData.savePatientTransactionManager,n.abort);case 2:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var v="4.0.2-pre.624",b=n(3979),g={"webservices.rest":"^2.24.0"};function w(){var e={featureName:"Patient Registration",moduleName:o.e1};return(0,r.defineConfigSchema)(o.e1,a.bT),(0,r.registerBreadcrumbs)([{path:"".concat(window.spaBase,"/").concat(o.Kt),title:"Patient Registration",parent:"".concat(window.spaBase,"/home")}]),(0,r.setupOfflineSync)(o.Kt,[],h,{onBeginEditSyncItem:function(e){(0,r.navigate)({to:"${openmrsSpaBase}/patient/".concat(e.content.fhirPatient.id,"/edit")})}}),(0,r.subscribePrecacheStaticDependencies)(f),(0,r.setupDynamicOfflineDataHandler)({id:"esm-patient-registration-app:patient",type:"patient",displayName:"Patient registration",isSynced:function(e){return p(u().mark((function t(){var n,r,i;return u().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=d(e),t.next=3,caches.open("omrs-spa-cache-v1");case 3:return r=t.sent,t.next=6,r.keys();case 6:return i=t.sent.map((function(e){return e.url})),t.abrupt("return",n.every((function(e){return i.includes(e)})));case 8:case"end":return t.stop()}}),t)})))()},sync:function(e){return p(u().mark((function t(){var n;return u().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=d(e),t.next=3,Promise.allSettled(n.map(function(){var e=p(u().mark((function e(t){return u().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,(0,r.messageOmrsServiceWorker)({type:"registerDynamicRoute",url:t});case 2:return e.next=4,fetch(t);case 4:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}()));case 3:case"end":return t.stop()}}),t)})))()}}),{pages:[{load:(0,r.getAsyncLifecycle)((function(){return Promise.all([n.e(767),n.e(553),n.e(924),n.e(859)]).then(n.bind(n,1859))}),e),route:"patient-registration",online:{savePatientForm:i.y.savePatientFormOnline,isOffline:!1},offline:{savePatientForm:i.y.savePatientFormOffline,isOffline:!0}}],extensions:[{id:"add-patient-action",slot:"top-nav-actions-slot",load:(0,r.getAsyncLifecycle)((function(){return Promise.all([n.e(767),n.e(206)]).then(n.bind(n,8206))}),e),online:!0,offline:!0},{id:"cancel-patient-edit-modal",load:(0,r.getAsyncLifecycle)((function(){return Promise.all([n.e(767),n.e(924),n.e(735)]).then(n.bind(n,5735))}),e),online:!0,offline:!0},{id:"patient-photo-widget",slot:"patient-photo-slot",load:(0,r.getAsyncLifecycle)((function(){return Promise.all([n.e(854),n.e(975)]).then(n.bind(n,9975))}),e),online:!0,offline:!0},{id:"edit-patient-details-button",slot:"patient-search-actions-slot",load:(0,r.getAsyncLifecycle)((function(){return Promise.all([n.e(924),n.e(635)]).then(n.bind(n,2635))}),e),online:!0,offline:!0},{id:"delete-identifier-confirmation-modal",load:(0,r.getAsyncLifecycle)((function(){return Promise.all([n.e(767),n.e(924),n.e(242)]).then(n.bind(n,5242))}),e),online:!0,offline:!0}]}}},6279:(e,t,n)=>{"use strict";n.d(t,{Cg:()=>g,St:()=>D,Te:()=>_,X1:()=>w,mt:()=>O});var r=n(5047),i=n.n(r),a=n(268),o=n.n(a),s=n(3662),u=n(2777),c=n(8407),l=n(906),p=n(8179);function d(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 f(e,t,n,r,i,a,o){try{var s=e[a](o),u=s.value}catch(e){return void n(e)}s.done?t(u):Promise.resolve(u).then(r,i)}function y(e){return function(){var t=this,n=arguments;return new Promise((function(r,i){var a=e.apply(t,n);function o(e){f(a,r,i,o,s,"next",e)}function s(e){f(a,r,i,o,s,"throw",e)}o(void 0)}))}}function h(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function m(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){h(e,t,n[t])}))}return e}function v(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):function(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n.push.apply(n,r)}return n}(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))})),e}function b(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,i,a=[],o=!0,s=!1;try{for(n=n.call(e);!(o=(r=n.next()).done)&&(a.push(r.value),!t||a.length!==t);o=!0);}catch(e){s=!0,i=e}finally{try{o||null==n.return||n.return()}finally{if(s)throw i}}return a}}(e,t)||function(e,t){if(e){if("string"==typeof e)return d(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)?d(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}var g=o().createContext(null);function w(e){return T.apply(this,arguments)}function T(){return(T=y(i().mark((function e(t){var n;return i().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,F("/ws/rest/v1/session",t);case 2:return n=e.sent.data,e.abrupt("return",n);case 4:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function _(e){return P.apply(this,arguments)}function P(){return(P=y(i().mark((function e(t){var n;return i().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,F("/ws/rest/v1/systemsetting?q=layout.address.format&v=custom:(value)",t);case 2:return n=e.sent.data,e.abrupt("return",n);case 4:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function O(e){return x.apply(this,arguments)}function x(){return(x=y(i().mark((function e(t){var n;return i().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,F("/ws/rest/v1/relationshiptype?v=default",t);case 2:return n=e.sent.data,e.abrupt("return",n);case 4:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function D(e){return U.apply(this,arguments)}function U(){return(U=y(i().mark((function e(t){var n,r,a,o,u,c,l,p,d,f,y;return i().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,k(t);case 2:n=e.sent,r=n.filter(Boolean),a=!0,o=!1,u=void 0,e.prev=5,c=r[Symbol.iterator]();case 7:if(a=(l=c.next()).done){e.next=20;break}return p=l.value,e.t0=b,e.next=12,Promise.all([j(p.uuid,t),N(t)]);case 12:e.t1=e.sent,d=(0,e.t0)(e.t1,2),f=d[0],y=d[1],p.identifierSources=f.data.results.map((function(e){var t=(0,s.Z)(y.data.results,{source:{uuid:e.uuid}});return e.autoGenerationOption=t,e}));case 17:a=!0,e.next=7;break;case 20:e.next=26;break;case 22:e.prev=22,e.t2=e.catch(5),o=!0,u=e.t2;case 26:e.prev=26,e.prev=27,a||null==c.return||c.return();case 29:if(e.prev=29,!o){e.next=32;break}throw u;case 32:return e.finish(29);case 33:return e.finish(26);case 34:return e.abrupt("return",r);case 35:case"end":return e.stop()}}),e,null,[[5,22,26,34],[27,,29,33]])})))).apply(this,arguments)}function k(e){return S.apply(this,arguments)}function S(){return(S=y(i().mark((function e(t){var n,r,a,o,s,c,l,p,d;return i().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,F("/ws/rest/v1/patientidentifiertype?v=full",t);case 2:return n=e.sent,e.next=5,F("/ws/rest/v1/metadatamapping/termmapping?v=full&code=emr.primaryIdentifierType",t);case 5:if(r=e.sent,!n.ok){e.next=13;break}return l=null==n||null===(a=n.data)||void 0===a?void 0:a.results,p=null==r||null===(o=r.data)||void 0===o||null===(s=o.results)||void 0===s||null===(c=s[0])||void 0===c?void 0:c.metadataUuid,d=(null==r?void 0:r.ok)?[E(null==l?void 0:l.find((function(e){return e.uuid===p})),!0)]:[],l.forEach((function(e){e.uuid!==p&&d.push(E(e,!1))})),e.abrupt("return",d.map((function(e){return v(m({},e),{fieldName:(0,u.Z)(e.name)})})));case 13:return e.abrupt("return",[]);case 14:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function j(e,t){return A.apply(this,arguments)}function A(){return(A=y(i().mark((function e(t,n){return i().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,F("/ws/rest/v1/idgen/identifiersource?v=default&identifierType=".concat(t),n);case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function N(e){return I.apply(this,arguments)}function I(){return(I=y(i().mark((function e(t){return i().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,F("/ws/rest/v1/idgen/autogenerationoption?v=full",t);case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function F(e,t){return C.apply(this,arguments)}function C(){return(C=y(i().mark((function e(t,n){return i().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,(0,l.messageOmrsServiceWorker)({type:"registerDynamicRoute",pattern:(0,c.Z)(t)});case 2:return e.next=4,(0,l.openmrsFetch)(t,{headers:p.QT,signal:null==n?void 0:n.signal});case 4:return e.abrupt("return",e.sent);case 5:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function E(e,t){return{name:e.display,fieldName:(0,u.Z)(e.display),required:e.required,uuid:e.uuid,format:e.format,isPrimary:t,uniquenessBehavior:e.uniquenessBehavior}}},3076:(e,t,n)=>{"use strict";n.d(t,{I:()=>b,y:()=>v});var r=n(5047),i=n.n(r),a=n(906),o=n(8179),s=n(7117),u=n(5741);function c(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 l(e,t,n,r,i,a,o){try{var s=e[a](o),u=s.value}catch(e){return void n(e)}s.done?t(u):Promise.resolve(u).then(r,i)}function p(e){return function(){var t=this,n=arguments;return new Promise((function(r,i){var a=e.apply(t,n);function o(e){l(a,r,i,o,s,"next",e)}function s(e){l(a,r,i,o,s,"throw",e)}o(void 0)}))}}function d(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function f(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function y(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){f(e,t,n[t])}))}return e}function h(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,i,a=[],o=!0,s=!1;try{for(n=n.call(e);!(o=(r=n.next()).done)&&(a.push(r.value),!t||a.length!==t);o=!0);}catch(e){s=!0,i=e}finally{try{o||null==n.return||n.return()}finally{if(s)throw i}}return a}}(e,t)||function(e,t){if(e){if("string"==typeof e)return c(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)?c(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}var m,v=function(){function e(){d(this,e)}return e.saveRelationships=function(e,t,n){return p(i().mark((function r(){return i().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return r.abrupt("return",Promise.all(e.filter((function(e){return e.relationshipType})).filter((function(e){return!!e.action})).map((function(e){var r=e.relatedPersonUuid,i=e.relationshipType,a=e.uuid,o=e.action,u=h(i.split("/"),2),c=u[0],l=u[1],p=t.data.uuid,d="aIsToB"===l,f={personA:d?r:p,personB:d?p:r,relationshipType:c};switch(o){case"ADD":return(0,s.bL)(n,f);case"UPDATE":return(0,s.r6)(n,a,f);case"DELETE":return(0,s.kE)(n,a)}}))));case 1:case"end":return r.stop()}}),r)})))()},e.saveObservations=function(e,t,n,r,a,o){return p(i().mark((function u(){var c;return i().wrap((function(i){for(;;)switch(i.prev=i.next){case 0:if(!(e&&Object.keys(e).length>0)){i.next=7;break}if(a.registrationObs.encounterTypeUuid){i.next=5;break}console.error("The registration form has been configured to have obs fields, but no registration encounter type has been configured. Obs field values will not be saved."),i.next=7;break;case 5:return c={encounterDatetime:new Date,patient:t.data.uuid,encounterType:a.registrationObs.encounterTypeUuid,location:n,encounterProviders:[{provider:r.currentProvider.uuid,encounterRole:a.registrationObs.encounterProviderRoleUuid}],form:a.registrationObs.registrationFormUuid,obs:Object.keys(e).map((function(t){return{concept:t,value:e[t]}}))},i.abrupt("return",(0,s.M1)(o,c));case 7:case"end":return i.stop()}}),u)})))()},e.savePatientIdentifiers=function(e,t,n,r,a,o){return p(i().mark((function u(){var c;return i().wrap((function(u){for(;;)switch(u.prev=u.next){case 0:return c=Object.values(n).map(function(){var n=p(i().mark((function n(r){var u,c,l,p,d,f,y,h,m;return i().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:if(u=r.identifierTypeUuid,c=r.identifierValue,l=r.identifierUuid,p=r.selectedSource,d=r.preferred,f=r.autoGeneration,y=r.initialValue,!(c||f&&p)){n.next=23;break}if(f){n.next=6;break}n.t0=c,n.next=11;break;case 6:return n.next=8,(0,s.fX)(r.selectedSource.uuid,o);case 8:return n.next=10,n.sent.data.identifier;case 10:n.t0=n.sent;case 11:if(h=n.t0,m={uuid:l,identifier:h,identifierType:u,location:a,preferred:d},e){n.next=22;break}if(y){n.next=19;break}return n.next=17,(0,s.eb)(t,m,o);case 17:n.next=22;break;case 19:if(y===h){n.next=22;break}return n.next=22,(0,s.nI)(t,l,m.identifier,o);case 22:return n.abrupt("return",m);case 23:case"end":return n.stop()}}),n)})));return function(e){return n.apply(this,arguments)}}()),t&&Object.keys(r).filter((function(e){return!n[e]})).forEach(function(){var e=p(i().mark((function e(n){return i().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,(0,s.ZB)(t,r[n].identifierUuid,o);case 2:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}()),u.abrupt("return",Promise.all(c));case 3:case"end":return u.stop()}}),u)})))()},e.getDeletedNames=function(e,t){return(null==t?void 0:t.additionalNameUuid)?[{nameUuid:t.additionalNameUuid,personUuid:e}]:[]},e.getPatientToCreate=function(t,n,r,i){var a,o,s,c=e.getPatientAddressField(t,r);return o=t.birthdate,a=(null!=(s=Date)&&"undefined"!=typeof Symbol&&s[Symbol.hasInstance]?s[Symbol.hasInstance](o):o instanceof s)?[t.birthdate.getFullYear(),t.birthdate.getMonth()+1,t.birthdate.getDate()].join("-"):t.birthdate,(0,u.Z)(r,c)&&(c={}),{uuid:t.patientUuid,person:y({uuid:t.patientUuid,names:e.getNames(t,n),gender:t.gender.charAt(0),birthdate:a,birthdateEstimated:t.birthdateEstimated,attributes:e.getPatientAttributes(t),addresses:[c]},e.getPatientDeathInfo(t)),identifiers:i}},e.getNames=function(e,t){var n=[{uuid:t.preferredNameUuid,preferred:!0,givenName:e.givenName,middleName:e.middleName,familyName:e.familyName}];return e.addNameInLocalLanguage&&n.push({uuid:t.additionalNameUuid,preferred:!1,givenName:e.additionalGivenName,middleName:e.additionalMiddleName,familyName:e.additionalFamilyName}),n},e.getPatientAttributes=function(e){var t=[];if(e.attributes){var n=!0,r=!1,i=void 0;try{for(var a,o=Object.entries(e.attributes)[Symbol.iterator]();!(n=(a=o.next()).done);n=!0){var s=h(a.value,2),u=s[0],c=s[1];t.push({attributeType:u,value:c})}}catch(e){r=!0,i=e}finally{try{n||null==o.return||o.return()}finally{if(r)throw i}}}return e.unidentifiedPatient&&t.push({attributeType:"8b56eac7-5c76-4b9c-8c6f-1deab8d3fc47",value:"true"}),t},e.getPatientAddressField=function(e,t){return Object.keys(t).reduce((function(t,n){return r=y({},t),i=null!=(i=f({},n,e[n]))?i:{},Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(i)):function(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n.push.apply(n,r)}return n}(Object(i)).forEach((function(e){Object.defineProperty(r,e,Object.getOwnPropertyDescriptor(i,e))})),r;var r,i}),{})},e.getPatientDeathInfo=function(e){var t=e.isDead,n=e.deathDate,r=e.deathCause;return{dead:t,deathDate:t?n:void 0,causeOfDeath:t?r:void 0}},e.mapPatientToFhirPatient=function(e){var t,n,r,i,a,o;return{id:e.uuid,gender:{M:"male",F:"female",O:"other",U:"unknown"}[null===(t=e.person)||void 0===t?void 0:t.gender],birthDate:null===(n=e.person)||void 0===n?void 0:n.birthdate,deceasedBoolean:e.person.dead,deceasedDateTime:e.person.deathDate,name:null===(r=e.person)||void 0===r||null===(i=r.names)||void 0===i?void 0:i.map((function(e){return{given:[e.givenName,e.middleName].filter(Boolean),family:e.familyName}})),address:null===(a=e.person)||void 0===a?void 0:a.addresses.map((function(e){return{city:e.cityVillage,country:e.country,postalCode:e.postalCode,state:e.stateProvince,use:"home"}})),telecom:null===(o=e.person.attributes)||void 0===o?void 0:o.filter((function(e){return"Telephone Number"===e.attributeType}))}},e}();v.savePatientFormOffline=(m=p(i().mark((function e(t,n,r,s,u,c,l,p,d){var f;return i().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return f={fhirPatient:v.mapPatientToFhirPatient(v.getPatientToCreate(n,r,s,[])),_patientRegistrationData:{isNewPatient:t,formValues:n,patientUuidMap:r,initialAddressFieldValues:s,capturePhotoProps:u,currentLocation:c,initialIdentifierValues:l,currentUser:p,config:d,savePatientTransactionManager:new b}},e.next=3,(0,a.queueSynchronizationItem)(o.Kt,f,{id:n.patientUuid,displayName:"Patient registration",patientUuid:f.fhirPatient.id,dependencies:[]});case 3:return e.abrupt("return",null);case 4:case"end":return e.stop()}}),e)}))),function(e,t,n,r,i,a,o,s,u){return m.apply(this,arguments)}),v.savePatientFormOnline=function(){var e=p(i().mark((function e(t,n,r,a,o,u,c,l,d,f,y){var h,m,b;return i().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,v.savePatientIdentifiers(t,n.patientUuid,n.identifiers,c,u,y);case 2:return h=e.sent,m=v.getPatientToCreate(n,r,a,h),v.getDeletedNames(n.patientUuid,r).forEach(function(){var e=p(i().mark((function e(t){return i().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,(0,s.uO)(t.nameUuid,t.personUuid,y);case 2:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}()),e.next=7,(0,s.co)(y,m,t&&!f.patientSaved?void 0:n.patientUuid);case 7:if(!(b=e.sent).ok){e.next=17;break}return f.patientSaved=!0,e.next=12,v.saveRelationships(n.relationships,b,y);case 12:return e.next=14,v.saveObservations(n.obs,b,u,l,d,y);case 14:if(!d.concepts.patientPhotoUuid||!(null==o?void 0:o.imageData)){e.next=17;break}return e.next=17,(0,s.oV)(b.data.uuid,o.imageData,"/ws/rest/v1/obs",o.dateTime||(new Date).toISOString(),d.concepts.patientPhotoUuid,y);case 17:return e.abrupt("return",b.data.uuid);case 18:case"end":return e.stop()}}),e)})));return function(t,n,r,i,a,o,s,u,c,l,p){return e.apply(this,arguments)}}();var b=function e(){d(this,e),this.patientSaved=!1}},7117:(e,t,n)=>{"use strict";n.d(t,{M1:()=>p,M8:()=>w,Uu:()=>g,ZB:()=>D,bL:()=>y,co:()=>l,eb:()=>_,fX:()=>d,kE:()=>m,nI:()=>O,oV:()=>v,r6:()=>h,uO:()=>f});var r=n(5047),i=n.n(r),a=n(9857),o=n(906);function s(e,t,n,r,i,a,o){try{var s=e[a](o),u=s.value}catch(e){return void n(e)}s.done?t(u):Promise.resolve(u).then(r,i)}function u(e){return function(){var t=this,n=arguments;return new Promise((function(r,i){var a=e.apply(t,n);function o(e){s(a,r,i,o,u,"next",e)}function u(e){s(a,r,i,o,u,"throw",e)}o(void 0)}))}}function c(e){for(var t=atob(e.split(",")[1]),n=e.split(",")[0].split(":")[1].split(";")[0],r=new Uint8Array(t.length),i=0;i<t.length;i++)r[i]=t.charCodeAt(i);var a=new Blob([r],{type:n});return new File([a],"patient-photo.png")}function l(e,t,n){return(0,o.openmrsFetch)("/ws/rest/v1/patient/".concat(n||""),{headers:{"Content-Type":"application/json"},method:"POST",body:t,signal:e.signal})}function p(e,t){return(0,o.openmrsFetch)("/ws/rest/v1/encounter",{headers:{"Content-Type":"application/json"},method:"POST",body:t,signal:e.signal})}function d(e,t){return(0,o.openmrsFetch)("/ws/rest/v1/idgen/identifiersource/".concat(e,"/identifier"),{headers:{"Content-Type":"application/json"},method:"POST",body:{},signal:t.signal})}function f(e,t,n){return(0,o.openmrsFetch)("/ws/rest/v1/person/".concat(t,"/name/").concat(e),{method:"DELETE",signal:n.signal})}function y(e,t){return(0,o.openmrsFetch)("/ws/rest/v1/relationship",{headers:{"Content-Type":"application/json"},method:"POST",body:t,signal:e.signal})}function h(e,t,n){return(0,o.openmrsFetch)("/ws/rest/v1/relationship/".concat(t),{headers:{"Content-Type":"application/json"},method:"POST",body:{relationshipType:n.relationshipType},signal:e.signal})}function m(e,t){return(0,o.openmrsFetch)("/ws/rest/v1/relationship/".concat(t),{headers:{"Content-Type":"application/json"},method:"DELETE",signal:e.signal})}function v(e,t,n,r,i,a){return b.apply(this,arguments)}function b(){return(b=u(i().mark((function e(t,n,r,a,s,u){var l;return i().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return(l=new FormData).append("patient",t),l.append("file",c(n)),l.append("json",JSON.stringify({person:t,concept:s,groupMembers:[],obsDatetime:a})),e.abrupt("return",(0,o.openmrsFetch)(r,{method:"POST",signal:u.signal,body:l}));case 5:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function g(e){var t,n,r,i=(0,o.useConfig)().concepts.patientPhotoUuid,s="/ws/rest/v1/obs?patient=".concat(e,"&concept=").concat(i,"&v=full"),u=(0,a.ZP)(e?s:null,o.openmrsFetch),c=u.data,l=u.error,p=null==c||null===(t=c.data)||void 0===t?void 0:t.results[0];return{data:p?{dateTime:null==p?void 0:p.obsDatetime,imageSrc:null==p||null===(n=p.value)||void 0===n||null===(r=n.links)||void 0===r?void 0:r.uri}:null,isError:l,isLoading:!c&&!l}}function w(e,t){return T.apply(this,arguments)}function T(){return(T=u(i().mark((function e(t,n){return i().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",(0,o.openmrsFetch)("/ws/rest/v1/person?q=".concat(t),{signal:n.signal}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function _(e,t,n){return P.apply(this,arguments)}function P(){return(P=u(i().mark((function e(t,n,r){return i().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",(0,o.openmrsFetch)("/ws/rest/v1/patient/".concat(t,"/identifier/"),{method:"POST",headers:{"Content-Type":"application/json"},signal:r.signal,body:n}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function O(e,t,n,r){return x.apply(this,arguments)}function x(){return(x=u(i().mark((function e(t,n,r,a){return i().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",(0,o.openmrsFetch)("/ws/rest/v1/patient/".concat(t,"/identifier/").concat(n),{method:"POST",headers:{"Content-Type":"application/json"},signal:a.signal,body:{identifier:r}}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function D(e,t,n){return U.apply(this,arguments)}function U(){return(U=u(i().mark((function e(t,n,r){return i().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",(0,o.openmrsFetch)("/ws/rest/v1/patient/".concat(t,"/identifier/").concat(n,"?purge"),{method:"DELETE",headers:{"Content-Type":"application/json"},signal:r.signal}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}},3979:(e,t,n)=>{var r={"./en.json":[3574,574]};function i(e){if(!n.o(r,e))return Promise.resolve().then((()=>{var t=new Error("Cannot find module '"+e+"'");throw t.code="MODULE_NOT_FOUND",t}));var t=r[e],i=t[0];return n.e(t[1]).then((()=>n(i)))}i.keys=()=>Object.keys(r),i.id=3979,e.exports=i}}]);
1
+ (self.webpackChunk_openmrs_esm_patient_registration_app=self.webpackChunk_openmrs_esm_patient_registration_app||[]).push([[686],{225:(e,t,n)=>{"use strict";n.d(t,{X8:()=>s,bT:()=>u,bs:()=>o});var r=n(906);function i(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 a(e){return function(e){if(Array.isArray(e))return i(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 i(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)?i(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 o=[{id:"demographics",name:"Basic Info",fields:["name","gender","dob","id"]},{id:"contact",name:"Contact Details",fields:["address","phone & email"]},{id:"death",name:"Death Info",fields:[]},{id:"relationships",name:"Relationships",fields:[]}],s=["name","gender","dob","address","id","phone & email"],u={sections:{_type:r.Type.Array,_default:["demographics","contact","relationships"],_description:"An array of strings which are the keys from 'sectionDefinitions' or any of the following built-in sections: '".concat(o.map((function(e){return e.id})).join("', '"),"'."),_elements:{_type:r.Type.String}},sectionDefinitions:{_type:r.Type.Array,_elements:{id:{_type:r.Type.String,_description:"How this section will be referred to in the `sections` configuration. To override a built-in section, use that section's id. The built in section ids are '".concat(o.map((function(e){return e.id})).join("', '"),"'.")},name:{_type:r.Type.String,_description:"The title to display at the top of the section."},fields:{_type:r.Type.Array,_default:[],_description:"The parts to include in the section. Can be any of the following built-in fields: ".concat(s.join(", "),". Can also be an id from an object in the `fieldDefinitions` array, which you can use to define custom fields."),_elements:{_type:r.Type.String}}},_default:[]},fieldDefinitions:{_type:r.Type.Array,_elements:{id:{_type:r.Type.String,_description:"How this field will be referred to in the `fields` element of the `sectionDefinitions` configuration."},type:{_type:r.Type.String,_description:"How this field's data will be stored—a person attribute or an obs."},uuid:{_type:r.Type.UUID,_description:"Person attribute type UUID that this field's data should be saved to."},label:{_type:r.Type.String,_default:null,_description:"The label of the input. By default, uses the metadata `display` attribute."},placeholder:{_type:r.Type.String,_default:"",_description:"Placeholder that will appear in the input."},validation:{required:{_type:r.Type.Boolean,_default:!1},matches:{_type:r.Type.String,_default:null,_description:"Optional RegEx for testing the validity of the input."}},answerConceptSetUuid:{_type:r.Type.ConceptUuid,_default:null,_description:"For coded questions only. A concept which has the possible responses either as answers or as set members."},customConceptAnswers:{_type:r.Type.Array,_elements:{uuid:{_type:r.Type.UUID,_description:"Answer concept UUID"},label:{_type:r.Type.String,_default:null,_description:"The custom label for the answer concept."}},_default:[],_description:"For coded questions only. Provide ability to add custom concept answers."}},_default:[],_description:"Definitions for custom fields that can be used in sectionDefinitions. Can also be used to override built-in fields."},fieldConfigurations:{name:{displayMiddleName:{_type:r.Type.Boolean,_default:!0},unidentifiedPatient:{_type:r.Type.Boolean,_default:!0,_description:"Whether to allow patients to be registered without names."},defaultUnknownGivenName:{_type:r.Type.String,_default:"UNKNOWN",_description:"The given/first name to record for unidentified patients."},defaultUnknownFamilyName:{_type:r.Type.String,_default:"UNKNOWN",_description:"The family/last name to record for unidentified patients."}},gender:{_type:r.Type.Array,_elements:{value:{_type:r.Type.String,_description:"The value for sex option"},label:{_type:r.Type.String,_default:null,_description:"The label displayed for sex option."},id:{_type:r.Type.String,_default:null,_description:"The id for sex option."}},_default:[{id:"male",value:"Male",label:"Male"},{id:"female",value:"Female",label:"Female"},{id:"other",value:"Other",label:"Other"},{id:"unknown",value:"Unknown",label:"Unknown"}],_description:"Provide ability to configure sex options."},address:{useAddressHeirarchy:{_type:r.Type.Boolean,_description:"Whether to use the Address heirarchy in the registration form or not",_default:!1}}},links:{submitButton:{_type:r.Type.String,_default:"${openmrsSpaBase}/patient/${patientUuid}/chart",_validators:[r.validators.isUrlWithTemplateParameters(["patientUuid"])]}},concepts:{patientPhotoUuid:{_type:r.Type.ConceptUuid,_default:"736e8771-e501-4615-bfa7-570c03f4bef5"}},defaultPatientIdentifierTypes:{_type:r.Type.Array,_elements:{_type:r.Type.PatientIdentifierTypeUuid},_default:[]},registrationObs:{encounterTypeUuid:{_type:r.Type.UUID,_default:null,_description:"Obs created during registration will be associated with an encounter of this type. This must be set in order to use fields of type `obs`."},encounterProviderRoleUuid:{_type:r.Type.UUID,_default:"a0b03050-c99b-11e0-9572-0800200c9a66",_description:"The provider role to use for the registration encounter. Default is 'Unkown'."},registrationFormUuid:{_type:r.Type.UUID,_default:null,_description:"The form UUID to associate with the registration encounter. By default no form will be associated."}},_validators:[(0,r.validator)((function(e){return!e.fieldDefinitions.some((function(e){return"obs"==e.type}))||null!=e.registrationObs.encounterTypeUuid}),"If fieldDefinitions contains any fields of type 'obs', `registrationObs.encounterTypeUuid` must be specified."),(0,r.validator)((function(e){return e.sections.every((function(t){return a(o).concat(a(e.sectionDefinitions)).map((function(e){return e.id})).includes(t)}))}),(function(e){var t=a(o).concat(a(e.sectionDefinitions)).map((function(e){return e.id})),n=e.sections.find((function(e){return!t.includes(e)}));return"'".concat(n,"' is not a valid section ID. Valid section IDs include the built-in sections ").concat(c(o))+(e.sectionDefinitions.length?"; and the defined sections ".concat(c(e.sectionDefinitions),"."):".")})),(0,r.validator)((function(e){return e.sectionDefinitions.every((function(t){return t.fields.every((function(t){return a(s).concat(a(e.fieldDefinitions.map((function(e){return e.id})))).includes(t)}))}))}),(function(e){var t=a(s).concat(a(e.fieldDefinitions.map((function(e){return e.id})))),n=e.sectionDefinitions.find((function(e){return e.fields.some((function(e){return!t.includes(e)}))})),r=n.fields.find((function(e){return!t.includes(e)}));return"The section definition '".concat(n.id,"' contains an invalid field '").concat(r,"'. 'fields' can only contain the built-in fields '").concat(s.join("', '"),"'")+(e.fieldDefinitions.length?"; or the defined fields ".concat(c(e.fieldDefinitions),"."):".")}))]};function c(e){return"'".concat(e.map((function(e){return e.id})).join("', '"),"'")}},8179:(e,t,n)=>{"use strict";n.d(t,{Kt:()=>c,QT:()=>l,UO:()=>s,e1:()=>u});var r,i,a,o=n(906),s="custom:(display,uuid,personA:(age,display,birthdate,uuid),personB:(age,display,birthdate,uuid),relationshipType:(uuid,display,description,aIsToB,bIsToA))",u="@openmrs/esm-patient-registration-app",c="patient-registration",l=(r={},a="network-first",(i=o.omrsOfflineCachingStrategyHttpHeaderName)in r?Object.defineProperty(r,i,{value:a,enumerable:!0,configurable:!0,writable:!0}):r[i]=a,r)},1686:(e,t,n)=>{"use strict";n.r(t),n.d(t,{backendDependencies:()=>g,importTranslation:()=>b,setupOpenMRS:()=>w,version:()=>v});var r=n(906),i=n(3076),a=n(225),o=n(8179),s=n(5047),u=n.n(s),c=n(6279);function l(e,t,n,r,i,a,o){try{var s=e[a](o),u=s.value}catch(e){return void n(e)}s.done?t(u):Promise.resolve(u).then(r,i)}function p(e){return function(){var t=this,n=arguments;return new Promise((function(r,i){var a=e.apply(t,n);function o(e){l(a,r,i,o,s,"next",e)}function s(e){l(a,r,i,o,s,"throw",e)}o(void 0)}))}}function d(e){return["/ws/fhir2/R4/Patient/".concat(e),"/ws/rest/v1/relationship?v=".concat(o.UO,"&person=").concat(e),"/ws/rest/v1/person/".concat(e,"/attribute"),"/ws/rest/v1/patient/".concat(e,"/identifier?v=custom:(uuid,identifier,identifierType:(uuid,required,name),preferred)")].map((function(e){return window.origin+(0,r.makeUrl)(e)}))}function f(){return y.apply(this,arguments)}function y(){return(y=p(u().mark((function e(){return u().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Promise.all([(0,c.X1)(),(0,c.Te)(),(0,c.mt)(),(0,c.St)()]);case 2:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function h(e,t){return m.apply(this,arguments)}function m(){return(m=p(u().mark((function e(t,n){return u().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,i.y.savePatientFormOnline(t._patientRegistrationData.isNewPatient,t._patientRegistrationData.formValues,t._patientRegistrationData.patientUuidMap,t._patientRegistrationData.initialAddressFieldValues,t._patientRegistrationData.capturePhotoProps,t._patientRegistrationData.currentLocation,t._patientRegistrationData.initialIdentifierValues,t._patientRegistrationData.currentUser,t._patientRegistrationData.config,t._patientRegistrationData.savePatientTransactionManager,n.abort);case 2:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var v="4.0.2-pre.627",b=n(3979),g={"webservices.rest":"^2.24.0"};function w(){var e={featureName:"Patient Registration",moduleName:o.e1};return(0,r.defineConfigSchema)(o.e1,a.bT),(0,r.registerBreadcrumbs)([{path:"".concat(window.spaBase,"/").concat(o.Kt),title:"Patient Registration",parent:"".concat(window.spaBase,"/home")}]),(0,r.setupOfflineSync)(o.Kt,[],h,{onBeginEditSyncItem:function(e){(0,r.navigate)({to:"${openmrsSpaBase}/patient/".concat(e.content.fhirPatient.id,"/edit")})}}),(0,r.subscribePrecacheStaticDependencies)(f),(0,r.setupDynamicOfflineDataHandler)({id:"esm-patient-registration-app:patient",type:"patient",displayName:"Patient registration",isSynced:function(e){return p(u().mark((function t(){var n,r,i;return u().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=d(e),t.next=3,caches.open("omrs-spa-cache-v1");case 3:return r=t.sent,t.next=6,r.keys();case 6:return i=t.sent.map((function(e){return e.url})),t.abrupt("return",n.every((function(e){return i.includes(e)})));case 8:case"end":return t.stop()}}),t)})))()},sync:function(e){return p(u().mark((function t(){var n;return u().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=d(e),t.next=3,Promise.allSettled(n.map(function(){var e=p(u().mark((function e(t){return u().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,(0,r.messageOmrsServiceWorker)({type:"registerDynamicRoute",url:t});case 2:return e.next=4,fetch(t);case 4:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}()));case 3:case"end":return t.stop()}}),t)})))()}}),{pages:[{load:(0,r.getAsyncLifecycle)((function(){return Promise.all([n.e(767),n.e(553),n.e(924),n.e(859)]).then(n.bind(n,1859))}),e),route:"patient-registration",online:{savePatientForm:i.y.savePatientFormOnline,isOffline:!1},offline:{savePatientForm:i.y.savePatientFormOffline,isOffline:!0}}],extensions:[{id:"add-patient-action",slot:"top-nav-actions-slot",load:(0,r.getAsyncLifecycle)((function(){return Promise.all([n.e(767),n.e(206)]).then(n.bind(n,8206))}),e),online:!0,offline:!0},{id:"cancel-patient-edit-modal",load:(0,r.getAsyncLifecycle)((function(){return Promise.all([n.e(767),n.e(924),n.e(735)]).then(n.bind(n,5735))}),e),online:!0,offline:!0},{id:"patient-photo-widget",slot:"patient-photo-slot",load:(0,r.getAsyncLifecycle)((function(){return Promise.all([n.e(854),n.e(975)]).then(n.bind(n,9975))}),e),online:!0,offline:!0},{id:"edit-patient-details-button",slot:"patient-search-actions-slot",load:(0,r.getAsyncLifecycle)((function(){return Promise.all([n.e(924),n.e(635)]).then(n.bind(n,2635))}),e),online:!0,offline:!0},{id:"delete-identifier-confirmation-modal",load:(0,r.getAsyncLifecycle)((function(){return Promise.all([n.e(767),n.e(924),n.e(242)]).then(n.bind(n,5242))}),e),online:!0,offline:!0}]}}},6279:(e,t,n)=>{"use strict";n.d(t,{Cg:()=>g,St:()=>D,Te:()=>_,X1:()=>w,mt:()=>O});var r=n(5047),i=n.n(r),a=n(268),o=n.n(a),s=n(3662),u=n(2777),c=n(8407),l=n(906),p=n(8179);function d(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 f(e,t,n,r,i,a,o){try{var s=e[a](o),u=s.value}catch(e){return void n(e)}s.done?t(u):Promise.resolve(u).then(r,i)}function y(e){return function(){var t=this,n=arguments;return new Promise((function(r,i){var a=e.apply(t,n);function o(e){f(a,r,i,o,s,"next",e)}function s(e){f(a,r,i,o,s,"throw",e)}o(void 0)}))}}function h(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function m(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){h(e,t,n[t])}))}return e}function v(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):function(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n.push.apply(n,r)}return n}(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))})),e}function b(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,i,a=[],o=!0,s=!1;try{for(n=n.call(e);!(o=(r=n.next()).done)&&(a.push(r.value),!t||a.length!==t);o=!0);}catch(e){s=!0,i=e}finally{try{o||null==n.return||n.return()}finally{if(s)throw i}}return a}}(e,t)||function(e,t){if(e){if("string"==typeof e)return d(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)?d(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}var g=o().createContext(null);function w(e){return T.apply(this,arguments)}function T(){return(T=y(i().mark((function e(t){var n;return i().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,F("/ws/rest/v1/session",t);case 2:return n=e.sent.data,e.abrupt("return",n);case 4:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function _(e){return P.apply(this,arguments)}function P(){return(P=y(i().mark((function e(t){var n;return i().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,F("/ws/rest/v1/systemsetting?q=layout.address.format&v=custom:(value)",t);case 2:return n=e.sent.data,e.abrupt("return",n);case 4:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function O(e){return x.apply(this,arguments)}function x(){return(x=y(i().mark((function e(t){var n;return i().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,F("/ws/rest/v1/relationshiptype?v=default",t);case 2:return n=e.sent.data,e.abrupt("return",n);case 4:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function D(e){return U.apply(this,arguments)}function U(){return(U=y(i().mark((function e(t){var n,r,a,o,u,c,l,p,d,f,y;return i().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,k(t);case 2:n=e.sent,r=n.filter(Boolean),a=!0,o=!1,u=void 0,e.prev=5,c=r[Symbol.iterator]();case 7:if(a=(l=c.next()).done){e.next=20;break}return p=l.value,e.t0=b,e.next=12,Promise.all([j(p.uuid,t),N(t)]);case 12:e.t1=e.sent,d=(0,e.t0)(e.t1,2),f=d[0],y=d[1],p.identifierSources=f.data.results.map((function(e){var t=(0,s.Z)(y.data.results,{source:{uuid:e.uuid}});return e.autoGenerationOption=t,e}));case 17:a=!0,e.next=7;break;case 20:e.next=26;break;case 22:e.prev=22,e.t2=e.catch(5),o=!0,u=e.t2;case 26:e.prev=26,e.prev=27,a||null==c.return||c.return();case 29:if(e.prev=29,!o){e.next=32;break}throw u;case 32:return e.finish(29);case 33:return e.finish(26);case 34:return e.abrupt("return",r);case 35:case"end":return e.stop()}}),e,null,[[5,22,26,34],[27,,29,33]])})))).apply(this,arguments)}function k(e){return S.apply(this,arguments)}function S(){return(S=y(i().mark((function e(t){var n,r,a,o,s,c,l,p,d;return i().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,F("/ws/rest/v1/patientidentifiertype?v=full",t);case 2:return n=e.sent,e.next=5,F("/ws/rest/v1/metadatamapping/termmapping?v=full&code=emr.primaryIdentifierType",t);case 5:if(r=e.sent,!n.ok){e.next=13;break}return l=null==n||null===(a=n.data)||void 0===a?void 0:a.results,p=null==r||null===(o=r.data)||void 0===o||null===(s=o.results)||void 0===s||null===(c=s[0])||void 0===c?void 0:c.metadataUuid,d=(null==r?void 0:r.ok)?[E(null==l?void 0:l.find((function(e){return e.uuid===p})),!0)]:[],l.forEach((function(e){e.uuid!==p&&d.push(E(e,!1))})),e.abrupt("return",d.map((function(e){return v(m({},e),{fieldName:(0,u.Z)(e.name)})})));case 13:return e.abrupt("return",[]);case 14:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function j(e,t){return A.apply(this,arguments)}function A(){return(A=y(i().mark((function e(t,n){return i().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,F("/ws/rest/v1/idgen/identifiersource?v=default&identifierType=".concat(t),n);case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function N(e){return I.apply(this,arguments)}function I(){return(I=y(i().mark((function e(t){return i().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,F("/ws/rest/v1/idgen/autogenerationoption?v=full",t);case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function F(e,t){return C.apply(this,arguments)}function C(){return(C=y(i().mark((function e(t,n){return i().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,(0,l.messageOmrsServiceWorker)({type:"registerDynamicRoute",pattern:(0,c.Z)(t)});case 2:return e.next=4,(0,l.openmrsFetch)(t,{headers:p.QT,signal:null==n?void 0:n.signal});case 4:return e.abrupt("return",e.sent);case 5:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function E(e,t){return{name:e.display,fieldName:(0,u.Z)(e.display),required:e.required,uuid:e.uuid,format:e.format,isPrimary:t,uniquenessBehavior:e.uniquenessBehavior}}},3076:(e,t,n)=>{"use strict";n.d(t,{I:()=>b,y:()=>v});var r=n(5047),i=n.n(r),a=n(906),o=n(8179),s=n(7117),u=n(5741);function c(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 l(e,t,n,r,i,a,o){try{var s=e[a](o),u=s.value}catch(e){return void n(e)}s.done?t(u):Promise.resolve(u).then(r,i)}function p(e){return function(){var t=this,n=arguments;return new Promise((function(r,i){var a=e.apply(t,n);function o(e){l(a,r,i,o,s,"next",e)}function s(e){l(a,r,i,o,s,"throw",e)}o(void 0)}))}}function d(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function f(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function y(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){f(e,t,n[t])}))}return e}function h(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,i,a=[],o=!0,s=!1;try{for(n=n.call(e);!(o=(r=n.next()).done)&&(a.push(r.value),!t||a.length!==t);o=!0);}catch(e){s=!0,i=e}finally{try{o||null==n.return||n.return()}finally{if(s)throw i}}return a}}(e,t)||function(e,t){if(e){if("string"==typeof e)return c(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)?c(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}var m,v=function(){function e(){d(this,e)}return e.saveRelationships=function(e,t,n){return p(i().mark((function r(){return i().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return r.abrupt("return",Promise.all(e.filter((function(e){return e.relationshipType})).filter((function(e){return!!e.action})).map((function(e){var r=e.relatedPersonUuid,i=e.relationshipType,a=e.uuid,o=e.action,u=h(i.split("/"),2),c=u[0],l=u[1],p=t.data.uuid,d="aIsToB"===l,f={personA:d?r:p,personB:d?p:r,relationshipType:c};switch(o){case"ADD":return(0,s.bL)(n,f);case"UPDATE":return(0,s.r6)(n,a,f);case"DELETE":return(0,s.kE)(n,a)}}))));case 1:case"end":return r.stop()}}),r)})))()},e.saveObservations=function(e,t,n,r,a,o){return p(i().mark((function u(){var c;return i().wrap((function(i){for(;;)switch(i.prev=i.next){case 0:if(!(e&&Object.keys(e).length>0)){i.next=7;break}if(a.registrationObs.encounterTypeUuid){i.next=5;break}console.error("The registration form has been configured to have obs fields, but no registration encounter type has been configured. Obs field values will not be saved."),i.next=7;break;case 5:return c={encounterDatetime:new Date,patient:t.data.uuid,encounterType:a.registrationObs.encounterTypeUuid,location:n,encounterProviders:[{provider:r.currentProvider.uuid,encounterRole:a.registrationObs.encounterProviderRoleUuid}],form:a.registrationObs.registrationFormUuid,obs:Object.keys(e).map((function(t){return{concept:t,value:e[t]}}))},i.abrupt("return",(0,s.M1)(o,c));case 7:case"end":return i.stop()}}),u)})))()},e.savePatientIdentifiers=function(e,t,n,r,a,o){return p(i().mark((function u(){var c;return i().wrap((function(u){for(;;)switch(u.prev=u.next){case 0:return c=Object.values(n).map(function(){var n=p(i().mark((function n(r){var u,c,l,p,d,f,y,h,m;return i().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:if(u=r.identifierTypeUuid,c=r.identifierValue,l=r.identifierUuid,p=r.selectedSource,d=r.preferred,f=r.autoGeneration,y=r.initialValue,!(c||f&&p)){n.next=23;break}if(f){n.next=6;break}n.t0=c,n.next=11;break;case 6:return n.next=8,(0,s.fX)(r.selectedSource.uuid,o);case 8:return n.next=10,n.sent.data.identifier;case 10:n.t0=n.sent;case 11:if(h=n.t0,m={uuid:l,identifier:h,identifierType:u,location:a,preferred:d},e){n.next=22;break}if(y){n.next=19;break}return n.next=17,(0,s.eb)(t,m,o);case 17:n.next=22;break;case 19:if(y===h){n.next=22;break}return n.next=22,(0,s.nI)(t,l,m.identifier,o);case 22:return n.abrupt("return",m);case 23:case"end":return n.stop()}}),n)})));return function(e){return n.apply(this,arguments)}}()),t&&Object.keys(r).filter((function(e){return!n[e]})).forEach(function(){var e=p(i().mark((function e(n){return i().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,(0,s.ZB)(t,r[n].identifierUuid,o);case 2:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}()),u.abrupt("return",Promise.all(c));case 3:case"end":return u.stop()}}),u)})))()},e.getDeletedNames=function(e,t){return(null==t?void 0:t.additionalNameUuid)?[{nameUuid:t.additionalNameUuid,personUuid:e}]:[]},e.getPatientToCreate=function(t,n,r,i){var a,o,s,c=e.getPatientAddressField(t,r);return o=t.birthdate,a=(null!=(s=Date)&&"undefined"!=typeof Symbol&&s[Symbol.hasInstance]?s[Symbol.hasInstance](o):o instanceof s)?[t.birthdate.getFullYear(),t.birthdate.getMonth()+1,t.birthdate.getDate()].join("-"):t.birthdate,(0,u.Z)(r,c)&&(c={}),{uuid:t.patientUuid,person:y({uuid:t.patientUuid,names:e.getNames(t,n),gender:t.gender.charAt(0),birthdate:a,birthdateEstimated:t.birthdateEstimated,attributes:e.getPatientAttributes(t),addresses:[c]},e.getPatientDeathInfo(t)),identifiers:i}},e.getNames=function(e,t){var n=[{uuid:t.preferredNameUuid,preferred:!0,givenName:e.givenName,middleName:e.middleName,familyName:e.familyName}];return e.addNameInLocalLanguage&&n.push({uuid:t.additionalNameUuid,preferred:!1,givenName:e.additionalGivenName,middleName:e.additionalMiddleName,familyName:e.additionalFamilyName}),n},e.getPatientAttributes=function(e){var t=[];if(e.attributes){var n=!0,r=!1,i=void 0;try{for(var a,o=Object.entries(e.attributes)[Symbol.iterator]();!(n=(a=o.next()).done);n=!0){var s=h(a.value,2),u=s[0],c=s[1];t.push({attributeType:u,value:c})}}catch(e){r=!0,i=e}finally{try{n||null==o.return||o.return()}finally{if(r)throw i}}}return e.unidentifiedPatient&&t.push({attributeType:"8b56eac7-5c76-4b9c-8c6f-1deab8d3fc47",value:"true"}),t},e.getPatientAddressField=function(e,t){return Object.keys(t).reduce((function(t,n){return r=y({},t),i=null!=(i=f({},n,e[n]))?i:{},Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(i)):function(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n.push.apply(n,r)}return n}(Object(i)).forEach((function(e){Object.defineProperty(r,e,Object.getOwnPropertyDescriptor(i,e))})),r;var r,i}),{})},e.getPatientDeathInfo=function(e){var t=e.isDead,n=e.deathDate,r=e.deathCause;return{dead:t,deathDate:t?n:void 0,causeOfDeath:t?r:void 0}},e.mapPatientToFhirPatient=function(e){var t,n,r,i,a,o;return{id:e.uuid,gender:{M:"male",F:"female",O:"other",U:"unknown"}[null===(t=e.person)||void 0===t?void 0:t.gender],birthDate:null===(n=e.person)||void 0===n?void 0:n.birthdate,deceasedBoolean:e.person.dead,deceasedDateTime:e.person.deathDate,name:null===(r=e.person)||void 0===r||null===(i=r.names)||void 0===i?void 0:i.map((function(e){return{given:[e.givenName,e.middleName].filter(Boolean),family:e.familyName}})),address:null===(a=e.person)||void 0===a?void 0:a.addresses.map((function(e){return{city:e.cityVillage,country:e.country,postalCode:e.postalCode,state:e.stateProvince,use:"home"}})),telecom:null===(o=e.person.attributes)||void 0===o?void 0:o.filter((function(e){return"Telephone Number"===e.attributeType}))}},e}();v.savePatientFormOffline=(m=p(i().mark((function e(t,n,r,s,u,c,l,p,d){var f;return i().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return f={fhirPatient:v.mapPatientToFhirPatient(v.getPatientToCreate(n,r,s,[])),_patientRegistrationData:{isNewPatient:t,formValues:n,patientUuidMap:r,initialAddressFieldValues:s,capturePhotoProps:u,currentLocation:c,initialIdentifierValues:l,currentUser:p,config:d,savePatientTransactionManager:new b}},e.next=3,(0,a.queueSynchronizationItem)(o.Kt,f,{id:n.patientUuid,displayName:"Patient registration",patientUuid:f.fhirPatient.id,dependencies:[]});case 3:return e.abrupt("return",null);case 4:case"end":return e.stop()}}),e)}))),function(e,t,n,r,i,a,o,s,u){return m.apply(this,arguments)}),v.savePatientFormOnline=function(){var e=p(i().mark((function e(t,n,r,a,o,u,c,l,d,f,y){var h,m,b;return i().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,v.savePatientIdentifiers(t,n.patientUuid,n.identifiers,c,u,y);case 2:return h=e.sent,m=v.getPatientToCreate(n,r,a,h),v.getDeletedNames(n.patientUuid,r).forEach(function(){var e=p(i().mark((function e(t){return i().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,(0,s.uO)(t.nameUuid,t.personUuid,y);case 2:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}()),e.next=7,(0,s.co)(y,m,t&&!f.patientSaved?void 0:n.patientUuid);case 7:if(!(b=e.sent).ok){e.next=17;break}return f.patientSaved=!0,e.next=12,v.saveRelationships(n.relationships,b,y);case 12:return e.next=14,v.saveObservations(n.obs,b,u,l,d,y);case 14:if(!d.concepts.patientPhotoUuid||!(null==o?void 0:o.imageData)){e.next=17;break}return e.next=17,(0,s.oV)(b.data.uuid,o.imageData,"/ws/rest/v1/obs",o.dateTime||(new Date).toISOString(),d.concepts.patientPhotoUuid,y);case 17:return e.abrupt("return",b.data.uuid);case 18:case"end":return e.stop()}}),e)})));return function(t,n,r,i,a,o,s,u,c,l,p){return e.apply(this,arguments)}}();var b=function e(){d(this,e),this.patientSaved=!1}},7117:(e,t,n)=>{"use strict";n.d(t,{M1:()=>p,M8:()=>w,Uu:()=>g,ZB:()=>D,bL:()=>y,co:()=>l,eb:()=>_,fX:()=>d,kE:()=>m,nI:()=>O,oV:()=>v,r6:()=>h,uO:()=>f});var r=n(5047),i=n.n(r),a=n(9857),o=n(906);function s(e,t,n,r,i,a,o){try{var s=e[a](o),u=s.value}catch(e){return void n(e)}s.done?t(u):Promise.resolve(u).then(r,i)}function u(e){return function(){var t=this,n=arguments;return new Promise((function(r,i){var a=e.apply(t,n);function o(e){s(a,r,i,o,u,"next",e)}function u(e){s(a,r,i,o,u,"throw",e)}o(void 0)}))}}function c(e){for(var t=atob(e.split(",")[1]),n=e.split(",")[0].split(":")[1].split(";")[0],r=new Uint8Array(t.length),i=0;i<t.length;i++)r[i]=t.charCodeAt(i);var a=new Blob([r],{type:n});return new File([a],"patient-photo.png")}function l(e,t,n){return(0,o.openmrsFetch)("/ws/rest/v1/patient/".concat(n||""),{headers:{"Content-Type":"application/json"},method:"POST",body:t,signal:e.signal})}function p(e,t){return(0,o.openmrsFetch)("/ws/rest/v1/encounter",{headers:{"Content-Type":"application/json"},method:"POST",body:t,signal:e.signal})}function d(e,t){return(0,o.openmrsFetch)("/ws/rest/v1/idgen/identifiersource/".concat(e,"/identifier"),{headers:{"Content-Type":"application/json"},method:"POST",body:{},signal:t.signal})}function f(e,t,n){return(0,o.openmrsFetch)("/ws/rest/v1/person/".concat(t,"/name/").concat(e),{method:"DELETE",signal:n.signal})}function y(e,t){return(0,o.openmrsFetch)("/ws/rest/v1/relationship",{headers:{"Content-Type":"application/json"},method:"POST",body:t,signal:e.signal})}function h(e,t,n){return(0,o.openmrsFetch)("/ws/rest/v1/relationship/".concat(t),{headers:{"Content-Type":"application/json"},method:"POST",body:{relationshipType:n.relationshipType},signal:e.signal})}function m(e,t){return(0,o.openmrsFetch)("/ws/rest/v1/relationship/".concat(t),{headers:{"Content-Type":"application/json"},method:"DELETE",signal:e.signal})}function v(e,t,n,r,i,a){return b.apply(this,arguments)}function b(){return(b=u(i().mark((function e(t,n,r,a,s,u){var l;return i().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return(l=new FormData).append("patient",t),l.append("file",c(n)),l.append("json",JSON.stringify({person:t,concept:s,groupMembers:[],obsDatetime:a})),e.abrupt("return",(0,o.openmrsFetch)(r,{method:"POST",signal:u.signal,body:l}));case 5:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function g(e){var t,n,r,i=(0,o.useConfig)().concepts.patientPhotoUuid,s="/ws/rest/v1/obs?patient=".concat(e,"&concept=").concat(i,"&v=full"),u=(0,a.ZP)(e?s:null,o.openmrsFetch),c=u.data,l=u.error,p=null==c||null===(t=c.data)||void 0===t?void 0:t.results[0];return{data:p?{dateTime:null==p?void 0:p.obsDatetime,imageSrc:null==p||null===(n=p.value)||void 0===n||null===(r=n.links)||void 0===r?void 0:r.uri}:null,isError:l,isLoading:!c&&!l}}function w(e,t){return T.apply(this,arguments)}function T(){return(T=u(i().mark((function e(t,n){return i().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",(0,o.openmrsFetch)("/ws/rest/v1/person?q=".concat(t),{signal:n.signal}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function _(e,t,n){return P.apply(this,arguments)}function P(){return(P=u(i().mark((function e(t,n,r){return i().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",(0,o.openmrsFetch)("/ws/rest/v1/patient/".concat(t,"/identifier/"),{method:"POST",headers:{"Content-Type":"application/json"},signal:r.signal,body:n}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function O(e,t,n,r){return x.apply(this,arguments)}function x(){return(x=u(i().mark((function e(t,n,r,a){return i().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",(0,o.openmrsFetch)("/ws/rest/v1/patient/".concat(t,"/identifier/").concat(n),{method:"POST",headers:{"Content-Type":"application/json"},signal:a.signal,body:{identifier:r}}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function D(e,t,n){return U.apply(this,arguments)}function U(){return(U=u(i().mark((function e(t,n,r){return i().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",(0,o.openmrsFetch)("/ws/rest/v1/patient/".concat(t,"/identifier/").concat(n,"?purge"),{method:"DELETE",headers:{"Content-Type":"application/json"},signal:r.signal}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}},3979:(e,t,n)=>{var r={"./en.json":[3574,574]};function i(e){if(!n.o(r,e))return Promise.resolve().then((()=>{var t=new Error("Cannot find module '"+e+"'");throw t.code="MODULE_NOT_FOUND",t}));var t=r[e],i=t[0];return n.e(t[1]).then((()=>n(i)))}i.keys=()=>Object.keys(r),i.id=3979,e.exports=i}}]);