@ampath-kenya/ngx-openmrs-formentry 2.12.23 → 2.12.25

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (287) hide show
  1. package/ampath-kenya-ngx-openmrs-formentry.metadata.json +1 -1
  2. package/bundles/ampath-kenya-ngx-openmrs-formentry.umd.js +130 -7
  3. package/bundles/ampath-kenya-ngx-openmrs-formentry.umd.js.map +1 -1
  4. package/bundles/ampath-kenya-ngx-openmrs-formentry.umd.min.js +1 -1
  5. package/bundles/ampath-kenya-ngx-openmrs-formentry.umd.min.js.map +1 -1
  6. package/components/ngx-date-time-picker/ngx-date-time-picker.component.d.ts +11 -0
  7. package/esm2015/abstract-controls-extension/afe-control-type.js +1 -0
  8. package/esm2015/abstract-controls-extension/afe-form-array.js +1 -0
  9. package/esm2015/abstract-controls-extension/afe-form-control.js +1 -0
  10. package/esm2015/abstract-controls-extension/afe-form-group.js +1 -0
  11. package/esm2015/abstract-controls-extension/control-extensions.js +1 -0
  12. package/esm2015/abstract-controls-extension/index.js +1 -0
  13. package/esm2015/abstract-controls-extension/value-change.listener.js +1 -0
  14. package/esm2015/ampath-kenya-ngx-openmrs-formentry.js +1 -0
  15. package/esm2015/change-tracking/control-relation.js +1 -0
  16. package/esm2015/change-tracking/control-relations.js +1 -0
  17. package/esm2015/components/afe-ng-select.component.js +1 -0
  18. package/esm2015/components/appointments-overview/appointments-overview.component.js +3 -1
  19. package/esm2015/components/check-box/checkbox.component.js +1 -0
  20. package/esm2015/components/check-box/checkbox.module.js +1 -0
  21. package/esm2015/components/date-time-picker/date-picker/date-picker.component.js +3 -1
  22. package/esm2015/components/date-time-picker/date-time-picker.component.js +3 -1
  23. package/esm2015/components/date-time-picker/date-time-picker.module.js +1 -0
  24. package/esm2015/components/date-time-picker/picker-modal/modal.component.js +3 -1
  25. package/esm2015/components/date-time-picker/pipes/moment.pipe.js +1 -0
  26. package/esm2015/components/date-time-picker/time-picker/time-picker.component.js +3 -1
  27. package/esm2015/components/file-upload/file-upload.component.js +3 -1
  28. package/esm2015/components/file-upload/file-upload.module.js +1 -0
  29. package/esm2015/components/file-upload/secure.pipe.js +3 -1
  30. package/esm2015/components/ngx-date-time-picker/ngx-date-time-picker.component.js +85 -19
  31. package/esm2015/components/ngx-date-time-picker/ngx-date-time-picker.module.js +5 -3
  32. package/esm2015/components/ngx-time-picker/ngx-time-picker.component.js +1 -0
  33. package/esm2015/components/ngx-time-picker/ngx-time-picker.module.js +1 -0
  34. package/esm2015/components/remote-select/remote-select.component.js +3 -1
  35. package/esm2015/components/remote-select/remote-select.module.js +1 -0
  36. package/esm2015/components/select/diacritics.js +1 -0
  37. package/esm2015/components/select/option-list.js +1 -0
  38. package/esm2015/components/select/option.js +1 -0
  39. package/esm2015/components/select/select-dropdown.component.js +1 -0
  40. package/esm2015/components/select/select-dropdown.component.style.js +1 -0
  41. package/esm2015/components/select/select.component.js +1 -0
  42. package/esm2015/components/select/select.component.style.js +1 -0
  43. package/esm2015/components/select/select.module.js +1 -0
  44. package/esm2015/encounter-viewer/display-controls/file-preview.component.js +3 -1
  45. package/esm2015/encounter-viewer/display-controls/question-control.component.js +3 -1
  46. package/esm2015/encounter-viewer/display-controls/remote-answer.component.js +3 -1
  47. package/esm2015/encounter-viewer/encounter-container/encounter-container.component.js +3 -1
  48. package/esm2015/encounter-viewer/encounter-pdf-viewer.service.js +3 -1
  49. package/esm2015/encounter-viewer/encounter-view/encounter-viewer.component.js +3 -1
  50. package/esm2015/encounter-viewer/encounter-viewer.module.js +1 -0
  51. package/esm2015/encounter-viewer/encounter-viewer.service.js +2 -0
  52. package/esm2015/form-entry/control-alerts/alert-helpers.js +1 -0
  53. package/esm2015/form-entry/control-alerts/can-generate-alert.js +1 -0
  54. package/esm2015/form-entry/control-calculators/can-calculate.js +1 -0
  55. package/esm2015/form-entry/control-hiders-disablers/can-disable.js +1 -0
  56. package/esm2015/form-entry/control-hiders-disablers/can-hide.js +1 -0
  57. package/esm2015/form-entry/control-hiders-disablers/disabler-helper.js +1 -0
  58. package/esm2015/form-entry/control-hiders-disablers/hider-helpers.js +1 -0
  59. package/esm2015/form-entry/data-sources/data-sources.js +2 -0
  60. package/esm2015/form-entry/data-sources/dummy-data-source.js +1 -0
  61. package/esm2015/form-entry/directives/historical-value-directive.js +3 -1
  62. package/esm2015/form-entry/error-renderer/error-renderer.component.js +3 -1
  63. package/esm2015/form-entry/expression-runner/expression-runner.js +1 -0
  64. package/esm2015/form-entry/form-entry.module.js +1 -0
  65. package/esm2015/form-entry/form-factory/control-relations.factory.js +2 -0
  66. package/esm2015/form-entry/form-factory/form-control.service.js +3 -1
  67. package/esm2015/form-entry/form-factory/form-node.js +1 -0
  68. package/esm2015/form-entry/form-factory/form.factory.js +3 -1
  69. package/esm2015/form-entry/form-factory/form.js +1 -0
  70. package/esm2015/form-entry/form-factory/hiders-disablers.factory.js +3 -1
  71. package/esm2015/form-entry/form-factory/question.factory.js +8 -1
  72. package/esm2015/form-entry/form-factory/show-messages.factory.js +3 -1
  73. package/esm2015/form-entry/form-factory/validation.factory.js +2 -0
  74. package/esm2015/form-entry/form-renderer/form-renderer.component.css.js +1 -0
  75. package/esm2015/form-entry/form-renderer/form-renderer.component.js +11 -1
  76. package/esm2015/form-entry/helpers/historical-expression-helper-service.js +2 -0
  77. package/esm2015/form-entry/helpers/historical-field-helper-service.js +1 -0
  78. package/esm2015/form-entry/helpers/js-expression-helper.js +1 -0
  79. package/esm2015/form-entry/question-models/checkbox.model.js +1 -0
  80. package/esm2015/form-entry/question-models/conditional-validation.model.js +1 -0
  81. package/esm2015/form-entry/question-models/date-question.js +3 -1
  82. package/esm2015/form-entry/question-models/date-validation.model.js +1 -0
  83. package/esm2015/form-entry/question-models/decimal-point-validation.model.js +1 -0
  84. package/esm2015/form-entry/question-models/file-upload-question.js +1 -0
  85. package/esm2015/form-entry/question-models/group-question.js +1 -0
  86. package/esm2015/form-entry/question-models/interfaces/base-options.js +2 -1
  87. package/esm2015/form-entry/question-models/interfaces/checkbox-options.js +1 -0
  88. package/esm2015/form-entry/question-models/interfaces/data-source.js +1 -0
  89. package/esm2015/form-entry/question-models/interfaces/date-question-options.js +1 -0
  90. package/esm2015/form-entry/question-models/interfaces/file-upload-question-options.js +1 -0
  91. package/esm2015/form-entry/question-models/interfaces/group-question-options.js +1 -0
  92. package/esm2015/form-entry/question-models/interfaces/multi-select-options.js +1 -0
  93. package/esm2015/form-entry/question-models/interfaces/nested-questions.js +1 -0
  94. package/esm2015/form-entry/question-models/interfaces/repeating-question-options.js +1 -0
  95. package/esm2015/form-entry/question-models/interfaces/select-option.js +1 -0
  96. package/esm2015/form-entry/question-models/interfaces/select-question-options.js +1 -0
  97. package/esm2015/form-entry/question-models/interfaces/test-order-question-options.js +1 -0
  98. package/esm2015/form-entry/question-models/interfaces/text-area-question-options.js +1 -0
  99. package/esm2015/form-entry/question-models/interfaces/text-question-options.js +1 -0
  100. package/esm2015/form-entry/question-models/interfaces/time-question-options.js +1 -0
  101. package/esm2015/form-entry/question-models/interfaces/ui-select-question-options.js +1 -0
  102. package/esm2015/form-entry/question-models/js-expression-validation.model.js +1 -0
  103. package/esm2015/form-entry/question-models/max-validation.model.js +1 -0
  104. package/esm2015/form-entry/question-models/min-validation.model.js +1 -0
  105. package/esm2015/form-entry/question-models/models.js +1 -0
  106. package/esm2015/form-entry/question-models/multi-select-question.js +1 -0
  107. package/esm2015/form-entry/question-models/pair.model.js +1 -0
  108. package/esm2015/form-entry/question-models/question-base.js +2 -1
  109. package/esm2015/form-entry/question-models/rendering-type.js +1 -0
  110. package/esm2015/form-entry/question-models/repeating-question.js +1 -0
  111. package/esm2015/form-entry/question-models/select-option.js +1 -0
  112. package/esm2015/form-entry/question-models/select-question.js +1 -0
  113. package/esm2015/form-entry/question-models/test-order-question.js +1 -0
  114. package/esm2015/form-entry/question-models/text-area-input-question.js +1 -0
  115. package/esm2015/form-entry/question-models/text-input-question.js +1 -0
  116. package/esm2015/form-entry/question-models/time-question.js +1 -0
  117. package/esm2015/form-entry/question-models/ui-select-question.js +1 -0
  118. package/esm2015/form-entry/question-models/validation.model.js +1 -0
  119. package/esm2015/form-entry/services/debug-mode.service.js +2 -0
  120. package/esm2015/form-entry/services/form-errors.service.js +1 -0
  121. package/esm2015/form-entry/services/form-schema-compiler.service.js +2 -0
  122. package/esm2015/form-entry/services/historical-encounter-data.service.js +2 -0
  123. package/esm2015/form-entry/utils/messages.js +1 -0
  124. package/esm2015/form-entry/validators/conditional-answered.validator.js +1 -0
  125. package/esm2015/form-entry/validators/conditional-required.validator.js +1 -0
  126. package/esm2015/form-entry/validators/date.validator.js +1 -0
  127. package/esm2015/form-entry/validators/future-date-restriction.validator.js +1 -0
  128. package/esm2015/form-entry/validators/js-expression.validator.js +1 -0
  129. package/esm2015/form-entry/validators/max-date.validator.js +1 -0
  130. package/esm2015/form-entry/validators/max.validator.js +1 -0
  131. package/esm2015/form-entry/validators/min-date.validator.js +1 -0
  132. package/esm2015/form-entry/validators/min.validator.js +1 -0
  133. package/esm2015/form-entry/validators/required.validator.js +1 -0
  134. package/esm2015/form-entry/validators/validations.js +1 -0
  135. package/esm2015/form-entry/value-adapters/encounter.adapter.js +3 -1
  136. package/esm2015/form-entry/value-adapters/obs-adapter-helper.js +1 -0
  137. package/esm2015/form-entry/value-adapters/obs.adapter.js +3 -1
  138. package/esm2015/form-entry/value-adapters/order.adapter.js +1 -0
  139. package/esm2015/form-entry/value-adapters/person-attribute.adapter.js +2 -0
  140. package/esm2015/form-entry/value-adapters/value.adapter.js +1 -0
  141. package/esm2015/public_api.js +1 -0
  142. package/esm2015/shared.module.js +1 -0
  143. package/esm5/abstract-controls-extension/afe-control-type.js +1 -0
  144. package/esm5/abstract-controls-extension/afe-form-array.js +1 -0
  145. package/esm5/abstract-controls-extension/afe-form-control.js +1 -0
  146. package/esm5/abstract-controls-extension/afe-form-group.js +1 -0
  147. package/esm5/abstract-controls-extension/control-extensions.js +1 -0
  148. package/esm5/abstract-controls-extension/index.js +1 -0
  149. package/esm5/abstract-controls-extension/value-change.listener.js +1 -0
  150. package/esm5/ampath-kenya-ngx-openmrs-formentry.js +1 -0
  151. package/esm5/change-tracking/control-relation.js +1 -0
  152. package/esm5/change-tracking/control-relations.js +1 -0
  153. package/esm5/components/afe-ng-select.component.js +1 -0
  154. package/esm5/components/appointments-overview/appointments-overview.component.js +3 -1
  155. package/esm5/components/check-box/checkbox.component.js +1 -0
  156. package/esm5/components/check-box/checkbox.module.js +1 -0
  157. package/esm5/components/date-time-picker/date-picker/date-picker.component.js +3 -1
  158. package/esm5/components/date-time-picker/date-time-picker.component.js +3 -1
  159. package/esm5/components/date-time-picker/date-time-picker.module.js +1 -0
  160. package/esm5/components/date-time-picker/picker-modal/modal.component.js +3 -1
  161. package/esm5/components/date-time-picker/pipes/moment.pipe.js +1 -0
  162. package/esm5/components/date-time-picker/time-picker/time-picker.component.js +3 -1
  163. package/esm5/components/file-upload/file-upload.component.js +3 -1
  164. package/esm5/components/file-upload/file-upload.module.js +1 -0
  165. package/esm5/components/file-upload/secure.pipe.js +3 -1
  166. package/esm5/components/ngx-date-time-picker/ngx-date-time-picker.component.js +85 -6
  167. package/esm5/components/ngx-date-time-picker/ngx-date-time-picker.module.js +5 -3
  168. package/esm5/components/ngx-time-picker/ngx-time-picker.component.js +1 -0
  169. package/esm5/components/ngx-time-picker/ngx-time-picker.module.js +1 -0
  170. package/esm5/components/remote-select/remote-select.component.js +3 -1
  171. package/esm5/components/remote-select/remote-select.module.js +1 -0
  172. package/esm5/components/select/diacritics.js +1 -0
  173. package/esm5/components/select/option-list.js +1 -0
  174. package/esm5/components/select/option.js +1 -0
  175. package/esm5/components/select/select-dropdown.component.js +1 -0
  176. package/esm5/components/select/select-dropdown.component.style.js +1 -0
  177. package/esm5/components/select/select.component.js +1 -0
  178. package/esm5/components/select/select.component.style.js +1 -0
  179. package/esm5/components/select/select.module.js +1 -0
  180. package/esm5/encounter-viewer/display-controls/file-preview.component.js +3 -1
  181. package/esm5/encounter-viewer/display-controls/question-control.component.js +3 -1
  182. package/esm5/encounter-viewer/display-controls/remote-answer.component.js +3 -1
  183. package/esm5/encounter-viewer/encounter-container/encounter-container.component.js +3 -1
  184. package/esm5/encounter-viewer/encounter-pdf-viewer.service.js +3 -1
  185. package/esm5/encounter-viewer/encounter-view/encounter-viewer.component.js +3 -1
  186. package/esm5/encounter-viewer/encounter-viewer.module.js +1 -0
  187. package/esm5/encounter-viewer/encounter-viewer.service.js +3 -1
  188. package/esm5/form-entry/control-alerts/alert-helpers.js +1 -0
  189. package/esm5/form-entry/control-alerts/can-generate-alert.js +1 -0
  190. package/esm5/form-entry/control-calculators/can-calculate.js +1 -0
  191. package/esm5/form-entry/control-hiders-disablers/can-disable.js +1 -0
  192. package/esm5/form-entry/control-hiders-disablers/can-hide.js +1 -0
  193. package/esm5/form-entry/control-hiders-disablers/disabler-helper.js +1 -0
  194. package/esm5/form-entry/control-hiders-disablers/hider-helpers.js +1 -0
  195. package/esm5/form-entry/data-sources/data-sources.js +3 -1
  196. package/esm5/form-entry/data-sources/dummy-data-source.js +1 -0
  197. package/esm5/form-entry/directives/historical-value-directive.js +3 -1
  198. package/esm5/form-entry/error-renderer/error-renderer.component.js +3 -1
  199. package/esm5/form-entry/expression-runner/expression-runner.js +1 -0
  200. package/esm5/form-entry/form-entry.module.js +1 -0
  201. package/esm5/form-entry/form-factory/control-relations.factory.js +3 -1
  202. package/esm5/form-entry/form-factory/form-control.service.js +3 -1
  203. package/esm5/form-entry/form-factory/form-node.js +1 -0
  204. package/esm5/form-entry/form-factory/form.factory.js +3 -1
  205. package/esm5/form-entry/form-factory/form.js +1 -0
  206. package/esm5/form-entry/form-factory/hiders-disablers.factory.js +3 -1
  207. package/esm5/form-entry/form-factory/question.factory.js +8 -1
  208. package/esm5/form-entry/form-factory/show-messages.factory.js +3 -1
  209. package/esm5/form-entry/form-factory/validation.factory.js +3 -1
  210. package/esm5/form-entry/form-renderer/form-renderer.component.css.js +1 -0
  211. package/esm5/form-entry/form-renderer/form-renderer.component.js +10 -2
  212. package/esm5/form-entry/helpers/historical-expression-helper-service.js +3 -1
  213. package/esm5/form-entry/helpers/historical-field-helper-service.js +1 -0
  214. package/esm5/form-entry/helpers/js-expression-helper.js +1 -0
  215. package/esm5/form-entry/question-models/checkbox.model.js +1 -0
  216. package/esm5/form-entry/question-models/conditional-validation.model.js +1 -0
  217. package/esm5/form-entry/question-models/date-question.js +3 -1
  218. package/esm5/form-entry/question-models/date-validation.model.js +1 -0
  219. package/esm5/form-entry/question-models/decimal-point-validation.model.js +1 -0
  220. package/esm5/form-entry/question-models/file-upload-question.js +1 -0
  221. package/esm5/form-entry/question-models/group-question.js +1 -0
  222. package/esm5/form-entry/question-models/interfaces/base-options.js +2 -1
  223. package/esm5/form-entry/question-models/interfaces/checkbox-options.js +1 -0
  224. package/esm5/form-entry/question-models/interfaces/data-source.js +1 -0
  225. package/esm5/form-entry/question-models/interfaces/date-question-options.js +1 -0
  226. package/esm5/form-entry/question-models/interfaces/file-upload-question-options.js +1 -0
  227. package/esm5/form-entry/question-models/interfaces/group-question-options.js +1 -0
  228. package/esm5/form-entry/question-models/interfaces/multi-select-options.js +1 -0
  229. package/esm5/form-entry/question-models/interfaces/nested-questions.js +1 -0
  230. package/esm5/form-entry/question-models/interfaces/repeating-question-options.js +1 -0
  231. package/esm5/form-entry/question-models/interfaces/select-option.js +1 -0
  232. package/esm5/form-entry/question-models/interfaces/select-question-options.js +1 -0
  233. package/esm5/form-entry/question-models/interfaces/test-order-question-options.js +1 -0
  234. package/esm5/form-entry/question-models/interfaces/text-area-question-options.js +1 -0
  235. package/esm5/form-entry/question-models/interfaces/text-question-options.js +1 -0
  236. package/esm5/form-entry/question-models/interfaces/time-question-options.js +1 -0
  237. package/esm5/form-entry/question-models/interfaces/ui-select-question-options.js +1 -0
  238. package/esm5/form-entry/question-models/js-expression-validation.model.js +1 -0
  239. package/esm5/form-entry/question-models/max-validation.model.js +1 -0
  240. package/esm5/form-entry/question-models/min-validation.model.js +1 -0
  241. package/esm5/form-entry/question-models/models.js +1 -0
  242. package/esm5/form-entry/question-models/multi-select-question.js +1 -0
  243. package/esm5/form-entry/question-models/pair.model.js +1 -0
  244. package/esm5/form-entry/question-models/question-base.js +2 -1
  245. package/esm5/form-entry/question-models/rendering-type.js +1 -0
  246. package/esm5/form-entry/question-models/repeating-question.js +1 -0
  247. package/esm5/form-entry/question-models/select-option.js +1 -0
  248. package/esm5/form-entry/question-models/select-question.js +1 -0
  249. package/esm5/form-entry/question-models/test-order-question.js +1 -0
  250. package/esm5/form-entry/question-models/text-area-input-question.js +1 -0
  251. package/esm5/form-entry/question-models/text-input-question.js +1 -0
  252. package/esm5/form-entry/question-models/time-question.js +1 -0
  253. package/esm5/form-entry/question-models/ui-select-question.js +1 -0
  254. package/esm5/form-entry/question-models/validation.model.js +1 -0
  255. package/esm5/form-entry/services/debug-mode.service.js +3 -1
  256. package/esm5/form-entry/services/form-errors.service.js +1 -0
  257. package/esm5/form-entry/services/form-schema-compiler.service.js +3 -1
  258. package/esm5/form-entry/services/historical-encounter-data.service.js +3 -1
  259. package/esm5/form-entry/utils/messages.js +1 -0
  260. package/esm5/form-entry/validators/conditional-answered.validator.js +1 -0
  261. package/esm5/form-entry/validators/conditional-required.validator.js +1 -0
  262. package/esm5/form-entry/validators/date.validator.js +1 -0
  263. package/esm5/form-entry/validators/future-date-restriction.validator.js +1 -0
  264. package/esm5/form-entry/validators/js-expression.validator.js +1 -0
  265. package/esm5/form-entry/validators/max-date.validator.js +1 -0
  266. package/esm5/form-entry/validators/max.validator.js +1 -0
  267. package/esm5/form-entry/validators/min-date.validator.js +1 -0
  268. package/esm5/form-entry/validators/min.validator.js +1 -0
  269. package/esm5/form-entry/validators/required.validator.js +1 -0
  270. package/esm5/form-entry/validators/validations.js +1 -0
  271. package/esm5/form-entry/value-adapters/encounter.adapter.js +3 -1
  272. package/esm5/form-entry/value-adapters/obs-adapter-helper.js +1 -0
  273. package/esm5/form-entry/value-adapters/obs.adapter.js +3 -1
  274. package/esm5/form-entry/value-adapters/order.adapter.js +1 -0
  275. package/esm5/form-entry/value-adapters/person-attribute.adapter.js +3 -1
  276. package/esm5/form-entry/value-adapters/value.adapter.js +1 -0
  277. package/esm5/public_api.js +1 -0
  278. package/esm5/shared.module.js +1 -0
  279. package/fesm2015/ampath-kenya-ngx-openmrs-formentry.js +133 -21
  280. package/fesm2015/ampath-kenya-ngx-openmrs-formentry.js.map +1 -1
  281. package/fesm5/ampath-kenya-ngx-openmrs-formentry.js +132 -9
  282. package/fesm5/ampath-kenya-ngx-openmrs-formentry.js.map +1 -1
  283. package/form-entry/form-renderer/form-renderer.component.d.ts +2 -0
  284. package/form-entry/question-models/date-question.d.ts +2 -0
  285. package/form-entry/question-models/interfaces/base-options.d.ts +1 -0
  286. package/form-entry/question-models/question-base.d.ts +1 -0
  287. package/package.json +1 -1
@@ -1,2 +1,2 @@
1
- !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@angular/core"),require("rxjs"),require("@angular/forms"),require("moment"),require("lodash"),require("hammerjs"),require("@angular/common"),require("@angular/platform-browser"),require("ngx-file-uploader"),require("ngx-webcam"),require("@angular/material/core"),require("@angular/material-moment-adapter"),require("@angular/material/datepicker"),require("@angular/material/form-field"),require("@angular/material"),require("@angular/material/select"),require("pdfmake/build/pdfmake.js"),require("pdfmake/build/vfs_fonts.js"),require("@angular/common/http"),require("ngx-bootstrap/collapse"),require("time-ago-pipe")):"function"==typeof define&&define.amd?define("@ampath-kenya/ngx-openmrs-formentry",["exports","@angular/core","rxjs","@angular/forms","moment","lodash","hammerjs","@angular/common","@angular/platform-browser","ngx-file-uploader","ngx-webcam","@angular/material/core","@angular/material-moment-adapter","@angular/material/datepicker","@angular/material/form-field","@angular/material","@angular/material/select","pdfmake/build/pdfmake.js","pdfmake/build/vfs_fonts.js","@angular/common/http","ngx-bootstrap/collapse","time-ago-pipe"],t):t((e["ampath-kenya"]=e["ampath-kenya"]||{},e["ampath-kenya"]["ngx-openmrs-formentry"]={}),e.ng.core,e.rxjs,e.ng.forms,null,null,null,e.ng.common,e.ng.platformBrowser,null,null,e.ng.material.core,e.ng["material-moment-adapter"],e.ng.material.datepicker,e.ng.material["form-field"],e.ng.material,e.ng.material.select,null,null,e.ng.common.http,null,null)}(this,function(exports,i0,rxjs,forms,moment_,_,hammerjs,common,platformBrowser,ngxFileUploader,ngxWebcam,core,materialMomentAdapter,datepicker,formField,material,select,pdfMake,vfs_fonts_js,http,collapse,timeAgoPipe){"use strict";var DebugModeService=function(){function e(){this.cookieKey="formDebug"}return e.prototype.debugEnabled=function(){return!1},e.decorators=[{type:i0.Injectable}],e.ctorParameters=function(){return[]},e}(),FormErrorsService=function(){function e(){this.announceErrorFieldSource=new rxjs.Subject,this.announceErrorField$=this.announceErrorFieldSource.asObservable()}return e.prototype.announceErrorField=function(e){this.announceErrorFieldSource.next(e)},e.control=null,e.tab=null,e.decorators=[{type:i0.Injectable}],e}(),extendStatics=function(e,t){return(extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)};function __extends(e,t){function n(){this.constructor=e}extendStatics(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}function __values(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],o=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&o>=e.length&&(e=void 0),{value:e&&e[o++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}var ControlRelation=function(){function e(e,t){this._control=e,this._relatedTo=t,this._registerForChangesFromRelatedControl()}return Object.defineProperty(e.prototype,"control",{get:function(){return this._control},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"relatedTo",{get:function(){return this._relatedTo},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"lastUpdateValue",{get:function(){return this._lastUpdateValue},enumerable:!0,configurable:!0}),e.prototype.updateControlBasedOnRelation=function(e){return e!==this._lastUpdateValue&&(this._lastUpdateValue=e,this._control.updateCalculatedValue&&this._control.updateCalculatedValue(),this._control.updateValueAndValidity(),this._control.updateHiddenState&&this._control.updateHiddenState(),this._control.updateDisabledState&&this._control.updateDisabledState(),this._control.updateAlert&&this._control.updateAlert(),!0)},e.prototype._registerForChangesFromRelatedControl=function(){var t=this;this._relatedTo.valueChanges.subscribe(function(e){t.updateControlBasedOnRelation(e)})},e}(),ControlRelations=function(){function e(e,t){this._otherRelations=[],this._relationFor=e,this._relations=[],t&&this.addRelatedControls(t)}return Object.defineProperty(e.prototype,"relationsFor",{get:function(){return this._relationFor},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"relations",{get:function(){return this._relations},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"otherRelations",{get:function(){return this._otherRelations},enumerable:!0,configurable:!0}),e.prototype.addRelatedControls=function(e){if(e instanceof forms.AbstractControl&&this.relations.push(new ControlRelation(this._relationFor,e)),e instanceof Array)for(var t=0;t<e.length;t++)this.relations.push(new ControlRelation(this._relationFor,e[t]))},e}(),HiderHelper=function(){function e(){}return e.prototype.hideControl=function(e){e.hidden=!0,e.disable&&e.disable()},e.prototype.showControl=function(e){e.hidden=!1},e.prototype.setHiderForControl=function(e,t){e.hiders.push(t)},e.prototype.clearHidersForControl=function(e){e.hiders.splice(0),e.hidden=!1},e.prototype.evaluateControlHiders=function(e){var t=!1;e.hiders.forEach(function(e){e.reEvaluateHidingExpression(),!0===e.toHide&&(t=!0)}),e.hidden=t,e.hidden&&e.disable&&e.disable()},e.prototype.setUpReEvaluationWhenValueChanges=function(t){t.updateHiddenState&&t.valueChanges.subscribe(function(e){t.updateHiddenState()})},e}(),AlertHelper=function(){function e(){}return e.prototype.hideAlert=function(e){e.shown=!1},e.prototype.showAlert=function(e){e.shown=!0},e.prototype.setAlertsForControl=function(e,t){e.alerts.push(t)},e.prototype.clearAlertsForControl=function(e){e.alerts.splice(0),e.alert=""},e.prototype.evaluateControlAlerts=function(e){var t="";e.alerts.forEach(function(e){e.reEvaluateAlertExpression(),t=!0===e.shown?e.alertMessage:""}),e.alert=t},e.prototype.setUpReEvaluationWhenValueChanges=function(t){t.updateAlert&&t.valueChanges.subscribe(function(e){t.updateAlert()})},e}(),DisablerHelper=function(){function e(){}return e.prototype.setDisablerForControl=function(e,t){e.disablers.push(t)},e.prototype.clearDisablersForControl=function(e){e.disablers.splice(0),e.disable()},e.prototype.evaluateControlDisablers=function(e){var t=!1;e.disablers.forEach(function(e){e.reEvaluateDisablingExpression(),!0===e.toDisable&&(t=!0)}),t?e.disable():e.enable()},e.prototype.setUpReEvaluationWhenValueChanges=function(t){t.updateDisabledState&&t.valueChanges.subscribe(function(e){t.updateDisabledState()})},e}(),NodeBase=function(){function e(e,t,n,o){this._control=t,this._questionModel=e,this._form=n,this._path=o?o+"."+e.key:e.key}return Object.defineProperty(e.prototype,"question",{get:function(){return this._questionModel},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"control",{get:function(){return this._control},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"form",{get:function(){return this._form},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"path",{get:function(){return this._path},enumerable:!0,configurable:!0}),e.prototype.removeAt=function(e){},e.prototype.createChildNode=function(){},e.prototype.removeChildNode=function(){},e}(),LeafNode=function(i){function e(e,t,n,o,r){return i.call(this,e,t,o,r)||this}return __extends(e,i),e}(NodeBase),GroupNode=function(a){function e(e,t,n,o,r){var i=a.call(this,e,t,o,r)||this;return i._children={},i}return __extends(e,a),Object.defineProperty(e.prototype,"children",{get:function(){return this._children},enumerable:!0,configurable:!0}),e.prototype.setChild=function(e,t){this.children[e]=t},e}(NodeBase),ArrayNode=function(s){function e(e,t,n,o,r,i){var a=s.call(this,e,t,r,i)||this;return a.formFactory=o,a.childNodeCreatedEvents=[],a._children=[],a.childNodeCreatedEvents=[],a}return __extends(e,s),Object.defineProperty(e.prototype,"children",{get:function(){return this._children},enumerable:!0,configurable:!0}),e.prototype.createChildNode=function(){if(this.createChildFunc){var e=this.createChildFunc(this.question,this,this.formFactory);return this.fireChildNodeCreatedListener(e),e}return null},e.prototype.removeAt=function(e){confirm("Are you sure you want to remove?")&&this.removeChildFunc&&this.removeChildFunc(e,this)},e.prototype.addChildNodeCreatedListener=function(e){this.childNodeCreatedEvents.push(e)},e.prototype.fireChildNodeCreatedListener=function(e){for(var t=0;t<this.childNodeCreatedEvents.length;t++){(0,this.childNodeCreatedEvents[t])(e)}},e}(NodeBase),ValidationModel=function Xa(e){this.type=e.type,this.message=e.message||null},JsExpressionValidationModel=function(n){function e(e){var t=n.call(this,e)||this;return t.failsWhenExpression=e.failsWhenExpression,t}return __extends(e,n),e}(ValidationModel),ConditionalValidationModel=function(n){function e(e){var t=n.call(this,e)||this;return t.referenceQuestionId=e.referenceQuestionId,t.referenceQuestionAnswers=e.referenceQuestionAnswers,t}return __extends(e,n),e}(ValidationModel),ControlRelationsFactory=function(){function e(){}return e.prototype.buildRelations=function(e){var t=this.mapControlIds(e,{});for(var n in t)if(t.hasOwnProperty(n)){var o=t[n];this.setRelations(t,o)}},e.prototype.buildArrayNodeRelations=function(e){var t=e.form;if(t){var n=t.rootNode;this.buildRelations(e);var o=this.mapControlIds(n,{}),r=this.mapControlIds(e,{});for(var i in o){if(o.hasOwnProperty(i))if((l=o[i])instanceof LeafNode){var a=l.question;a.key&&0<a.key.length&&this.setRelations(r,l)}}for(var s in this.createRelationsToArrayControls(e),r)if(r.hasOwnProperty(s)){var l,u=(l=r[s]).control;u.updateHiddenState(),u.updateAlert()}}},e.prototype.createRelationsToArrayControls=function(a){var s=a.form.rootNode,e=this.mapControlIds(s,{}),l=this.mapControlIds(a,{});for(var t in e)if(e.hasOwnProperty(t)){var u=e[t],c=a.path.substring(0,a.path.lastIndexOf("."));if(-1===u.path.indexOf(c+".")){var n=function(e){if(l.hasOwnProperty(e)){var t=l[e],n=t.question.key;if(p.hasRelation(n,u.question)){var o=a.form.searchNodeByPath(s,c,[]);if(0<o.length){var r=o[0],i=u.control;-1===i.controlRelations.otherRelations.indexOf(r)&&i.controlRelations.otherRelations.push(r),t.control.addValueChangeListener(function(e){i.updateCalculatedValue&&i.updateCalculatedValue(),i.updateValueAndValidity(),i.updateHiddenState&&i.updateHiddenState(),i.updateAlert&&i.updateAlert(),i.updateDisabledState&&i.updateDisabledState()})}}}},p=this;for(var o in l)n(o)}}},e.prototype.getRelationsForControl=function(e,t){var n=new Array,o=t.form.searchNodeByQuestionId(e);if(0<o.length){var r=o[0],i=this.mapControlIds(t,{});for(var a in i)i.hasOwnProperty(a)&&this.hasRelation(i[a].question.key,r.question)&&n.push(i[a].control)}return n},e.prototype.mapControlIds=function(e,t){var n=e.children;for(var o in n)if(n.hasOwnProperty(o)){var r=n[o];if(r instanceof GroupNode)this.mapControlIds(r,t);else if(r instanceof LeafNode){(i=r.question).key&&0<i.key.length&&(t[i.key]=r)}else if(r instanceof ArrayNode){var i;(i=r.question).key&&0<i.key.length&&(t[i.key]=r)}}return t},e.prototype.setRelations=function(e,t){var n=t.question.key;for(var o in e)if(e.hasOwnProperty(o)&&o!==n){var r=e[o],i=r.question;if(this.hasRelation(n,i,t)&&this.addRelationToControl(r.control,t.control),"object"==typeof i.required){var a=i.required;"conditionalRequired"===a.type&&a.referenceQuestionId===n&&this.addRelationToControl(r.control,t.control)}}},e.prototype.hasRelation=function(n,e,t){var o=!1;if(e.validators&&0<e.validators.length&&e.validators.forEach(function(e){if(e instanceof JsExpressionValidationModel){var t=e.failsWhenExpression;t&&-1!==t.indexOf(n)&&(o=!0)}else e instanceof ConditionalValidationModel&&"conditionalAnswered"===e.type&&e.referenceQuestionId===n&&(o=!0)}),!o){if("string"==typeof e.hide){var r=e.hide;0<r.length&&-1!==r.indexOf(n)&&(o=!0)}else if("object"==typeof e.hide){e.hide.field===n&&(o=!0)}if(e.alert&&"object"==typeof e.alert&&(o=!0),"string"==typeof e.disable){var i=e.disable;0<i.length&&-1!==i.indexOf(n)&&(o=!0)}}return!o&&e.calculateExpression&&0<e.calculateExpression.length&&-1!==e.calculateExpression.indexOf(n)&&(o=!0),o},e.prototype.addRelationToControl=function(e,t){e.controlRelations.addRelatedControls(t)},e.decorators=[{type:i0.Injectable}],e.ctorParameters=function(){return[]},e}(),moment=moment_,ExpressionRunner=function(){function ExpressionRunner(){}return ExpressionRunner.prototype.getRunnable=function(expression,control,helper,dataDependencies,form){var runner=this,runnable={run:function(){var scope={};control.uuid&&(scope[control.uuid]=control.value),window.moment=moment,scope.myValue=control.value,runner.getControlRelationValueString(control,scope),runner.getHelperMethods(helper,scope),runner.getDataDependencies(dataDependencies,scope),form&&runner.getDataDependencies(form.dataSourcesContainer.dataSources,scope);var paramList="",argList="";for(var o in scope)paramList=""===paramList?paramList+o:paramList+","+o,argList=""===argList?argList+"scope['"+o+"']":argList+",scope['"+o+"']";-1===expression.indexOf("return")&&(expression='"return '+expression+'"');var funcDeclarationCode='var afeDynamicFunc = new Function("'+paramList+'", '+expression+");",funcCallCode="afeDynamicFunc.call(this "+(""===argList?"":","+argList)+");";try{return 0<=Object.keys(scope).indexOf("undefined")?(console.warn("Missing reference found",expression,scope),!1):eval(funcDeclarationCode+funcCallCode)}catch(e){return!1}}};return runnable},ExpressionRunner.prototype.getControlRelationValueString=function(i,a){var s=this;i&&i.controlRelations&&i.controlRelations.relations&&i.controlRelations.relations.forEach(function(e){if(e.relatedTo){var t=e.relatedTo,n=e.relatedTo;n&&Array.isArray(n.value)?a[t.uuid]=e.relatedTo.value:a[t.uuid]=e.relatedTo.value&&e.relatedTo.value.value?e.relatedTo.value.value:e.relatedTo.value}}),i&&i.controlRelations&&i.controlRelations.otherRelations&&0<i.controlRelations.otherRelations.length&&i.controlRelations.otherRelations.forEach(function(e){if(e instanceof ArrayNode){var t=e,n=i.uuid,o=new ControlRelationsFactory,r=[];t.children.forEach(function(e){r=r.concat(o.getRelationsForControl(n,e))}),s.setControlArrayValues(i,r,a)}})},ExpressionRunner.prototype.setControlArrayValues=function(e,n,o){var r=this;this._getFormControlKeys(n).forEach(function(e){var t=r._getValuesForKey(e,n);o[e]=t})},ExpressionRunner.prototype._getFormControlKeys=function(e){var t=[];return e.forEach(function(e){-1===t.indexOf(e.uuid)&&t.push(e.uuid)}),t},ExpressionRunner.prototype._getValuesForKey=function(t,e){var n=[];return e.forEach(function(e){e.uuid===t&&n.push(e.value)}),n},ExpressionRunner.prototype.getHelperMethods=function(e,t){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])},ExpressionRunner.prototype.getDataDependencies=function(e,t){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])},ExpressionRunner}(),AfeFormControl=function(r){function e(e,t,n){var o=r.call(this,e,t,n)||this;return o.hidden=!1,o.hiderHelper=new HiderHelper,o.disablerHelper=new DisablerHelper,o.AlertHelper=new AlertHelper,o._controlRelations=new ControlRelations(o),o.hiders=[],o.disablers=[],o.alerts=[],o.valueChanges.subscribe(function(e){o._previousValue!==e&&(o.fireValueChangeListener(e),o._previousValue=e)}),o}return __extends(e,r),Object.defineProperty(e.prototype,"controlRelations",{get:function(){return this._controlRelations},enumerable:!0,configurable:!0}),e.prototype.disable=function(e){r.prototype.disable.call(this,e),r.prototype.setValue.call(this,"")},e.prototype.hide=function(){this.hiderHelper.hideControl(this)},e.prototype.show=function(){this.hiderHelper.showControl(this)},e.prototype.setHidingFn=function(e){this.hiderHelper.setHiderForControl(this,e)},e.prototype.setCalculatorFn=function(e){this.calculator=e},e.prototype.updateCalculatedValue=function(){if(this.calculator){var e=this.calculator.call(ExpressionRunner,{});this.setValue(e)}},e.prototype.clearHidingFns=function(){this.hiderHelper.clearHidersForControl(this)},e.prototype.updateHiddenState=function(){this.hiderHelper.evaluateControlHiders(this)},e.prototype.setDisablingFn=function(e){this.disablerHelper.setDisablerForControl(this,e)},e.prototype.clearDisablingFns=function(){this.disablerHelper.clearDisablersForControl(this)},e.prototype.updateDisabledState=function(){this.disablerHelper.evaluateControlDisablers(this)},e.prototype.setAlertFn=function(e){this.AlertHelper.setAlertsForControl(this,e)},e.prototype.clearMessageFns=function(){this.AlertHelper.clearAlertsForControl(this)},e.prototype.updateAlert=function(){this.AlertHelper.evaluateControlAlerts(this)},e.prototype.addValueChangeListener=function(e){this._valueChangeListener=e},e.prototype.fireValueChangeListener=function(e){this._valueChangeListener&&"function"==typeof this._valueChangeListener&&this._valueChangeListener(e)},e.prototype.setValue=function(e){r.prototype.setValue.call(this,e)},e}(forms.FormControl),AfeFormGroup=function(r){function e(e,t,n){var o=r.call(this,e,t,n)||this;return o.hiderHelper=new HiderHelper,o.disablerHelper=new DisablerHelper,o.AlertHelper=new AlertHelper,o._controlRelations=new ControlRelations(o),o.hiders=[],o.disablers=[],o.alerts=[],o}return __extends(e,r),Object.defineProperty(e.prototype,"controlRelations",{get:function(){return this._controlRelations},enumerable:!0,configurable:!0}),e.prototype.hide=function(){this.hiderHelper.hideControl(this)},e.prototype.show=function(){this.hiderHelper.showControl(this)},e.prototype.disable=function(e){r.prototype.disable.call(this,e),r.prototype.setValue.call(this,{})},e.prototype.setHidingFn=function(e){this.hiderHelper.setHiderForControl(this,e)},e.prototype.clearHidingFns=function(){this.hiderHelper.clearHidersForControl(this)},e.prototype.updateHiddenState=function(){this.hiderHelper.evaluateControlHiders(this)},e.prototype.setDisablingFn=function(e){this.disablerHelper.setDisablerForControl(this,e)},e.prototype.clearDisablingFns=function(){this.disablerHelper.clearDisablersForControl(this)},e.prototype.updateDisabledState=function(){this.disablerHelper.evaluateControlDisablers(this)},e.prototype.setAlertFn=function(e){this.AlertHelper.setAlertsForControl(this,e)},e.prototype.clearMessageFns=function(){this.AlertHelper.clearAlertsForControl(this)},e.prototype.updateAlert=function(){this.AlertHelper.evaluateControlAlerts(this)},e.prototype.setValue=function(e){r.prototype.setValue.call(this,e)},e}(forms.FormGroup),AfeFormArray=function(r){function e(e,t,n){var o=r.call(this,e,t,n)||this;return o.hiderHelper=new HiderHelper,o.AlertHelper=new AlertHelper,o.disablerHelper=new DisablerHelper,o._controlRelations=new ControlRelations(o),o.hiders=[],o.alerts=[],o.disablers=[],o.valueChanges.subscribe(function(e){o._previousValue!==e&&(o.fireValueChangeListener(e),o._previousValue=e)}),o}return __extends(e,r),Object.defineProperty(e.prototype,"uuid",{get:function(){return this._uuid},set:function(e){this._uuid=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"controlRelations",{get:function(){return this._controlRelations},enumerable:!0,configurable:!0}),e.prototype.hide=function(){this.hiderHelper.hideControl(this)},e.prototype.show=function(){this.hiderHelper.showControl(this)},e.prototype.disable=function(e){r.prototype.disable.call(this,e),r.prototype.setValue.call(this,[])},e.prototype.setHidingFn=function(e){this.hiderHelper.setHiderForControl(this,e)},e.prototype.clearHidingFns=function(){this.hiderHelper.clearHidersForControl(this)},e.prototype.updateHiddenState=function(){this.hiderHelper.evaluateControlHiders(this)},e.prototype.setDisablingFn=function(e){this.disablerHelper.setDisablerForControl(this,e)},e.prototype.clearDisablingFns=function(){this.disablerHelper.clearDisablersForControl(this)},e.prototype.updateDisabledState=function(){this.disablerHelper.evaluateControlDisablers(this)},e.prototype.setAlertFn=function(e){this.AlertHelper.setAlertsForControl(this,e)},e.prototype.clearMessageFns=function(){this.AlertHelper.clearAlertsForControl(this)},e.prototype.updateAlert=function(){this.AlertHelper.evaluateControlAlerts(this)},e.prototype.addValueChangeListener=function(e){this._valueChangeListener=e},e.prototype.fireValueChangeListener=function(e){0<this.alerts.length&&this.updateAlert(),this._valueChangeListener&&"function"==typeof this._valueChangeListener&&this._valueChangeListener(e)},e.prototype.setValue=function(e){r.prototype.setValue.call(this,e)},e}(forms.FormArray),Ld;Ld=exports.AfeControlType||(exports.AfeControlType={}),Ld[Ld.AfeFormControl=0]="AfeFormControl",Ld[Ld.AfeFormArray=1]="AfeFormArray",Ld[Ld.AfeFormGroup=2]="AfeFormGroup",Ld[Ld.None=3]="None";var QuestionBase=function(){function e(e){this.defaultValue=e.defaultValue,this.originalValue=e.originalValue,this.extras=e.extras,this.renderingType=e.type,this.key=e.key||"",this.label=e.label||"",this.validators=e.validators||[],this.required=e.required,this.hide=e.hide,this.disable=e.disable,this.alert=e.alert,this.historicalDataValue=e.historicalDataValue,this.calculateExpression=e.calculateExpression}return e.prototype.setHistoricalValue=function(e){this.enableHistoricalValue=e},e.prototype.showHistoricalEncounterDate=function(e){this.showHistoricalValueDate=e===undefined||e},e}(),ConditionalRequiredValidator=function(){function e(){}return e.prototype.validate=function(a){return function(e){var t,n=e.value,o=null,r=a.referenceQuestionId,i=a.referenceQuestionAnswers;return e&&e.controlRelations&&e.controlRelations.relations&&e.controlRelations.relations.forEach(function(e){var t=e.relatedTo;t.uuid===r&&(o=t&&Array.isArray(t.value)?e.relatedTo.value:e.relatedTo.value&&e.relatedTo.value.value?e.relatedTo.value.value:e.relatedTo.value)}),"object"==typeof i&&-1!==i.indexOf(o)&&(t=!0),t&&!n?{conditional_required:{message:a.message}}:null}},e}(),ConditionalAnsweredValidator=function(){function e(){}return e.prototype.validate=function(a){return function(e){var t=e.value,n=null,o=a.referenceQuestionId,r=a.referenceQuestionAnswers,i=!0;return t&&e&&e.controlRelations&&e.controlRelations.relations&&e.controlRelations.relations.forEach(function(e){var t=e.relatedTo;t.uuid===o&&(n=Array.isArray(t.value)?t.value:t.value&&"object"==typeof t.value&&t.value.value?t.value.value:t.value),n?"object"==typeof r&&-1===r.indexOf(n)&&(i=!1):i=!1}),i?null:{conditional_answered:{message:a.message}}}},e}(),RequiredValidator=function(){function e(){}return e.prototype.validate=function(e){if(e.hidden)return null;var t=e.value;return null==t||"string"==typeof t&&0===t.length?{required:!0}:null},e}(),DateValidator=function(){function e(){}return e.prototype.validate=function(e){if(e.hidden)return null;var t=e.value;return t&&0!==t.length?!/Invalid|NaN/.test(new Date(t).toString())?null:{date:!0}:null},e}(),MinValidator=function(){function e(){}return e.prototype.validate=function(n){return function(e){if(e.hidden)return null;if(e.value&&0!==e.value.length){var t=e.value;return n<=t?null:{min:{requiredValue:n,actualValue:t}}}return null}},e}(),MaxValidator=function(){function e(){}return e.prototype.validate=function(n){return function(e){if(e.hidden)return null;if(e.value&&0!==e.value.length){var t=e.value;return t<=n?null:{max:{requiredValue:n,actualValue:t}}}return null}},e}(),MinDateValidator=function(){function e(){}return e.prototype.validate=function(n){return function(e){if(e.hidden)return null;if(e.value&&0!==e.value.length){if((new DateValidator).validate(e.value))return{mindate:{requiredDate:n}};var t=new Date(e.value);return t.getTime()<n.getTime()?{mindate:{requiredDate:n,actualDate:t}}:null}return null}},e}(),MaxDateValidator=function(){function e(){}return e.prototype.validate=function(n){return function(e){if(e.hidden)return null;if(e.value&&0!==e.value.length){if((new DateValidator).validate(e.value))return{maxdate:{requiredDate:n}};var t=new Date(e.value);return t.getTime()>n.getTime()?{maxdate:{requiredDate:n,actualDate:t}}:null}return null}},e}(),FutureDateRestrictionValidator=function(){function e(){}return e.prototype.validate=function(e){if(e.hidden)return null;var t=e.value,n=new Date;if(t&&0!==t.length&&!(new DateValidator).validate(t))return new Date(t).getTime()>n.getTime()?{futureDateRestriction:!0}:null;return null},e}(),JsExpressionHelper=function(){function e(){}return e.prototype.calcBMI=function(e,t){var n;return e&&t&&(n=(t/(e/100*e/100)).toFixed(1)),e&&t?parseFloat(n):null},e.prototype.calcBSA=function(e,t){var n;return e&&t&&(n=Math.sqrt(e*t/3600).toFixed(2)),e&&t?parseFloat(n):null},e.prototype.calcBMIForAgeZscore=function(e,t,n){var o;t&&n&&(o=(n/(t/100*t/100)).toFixed(1));var r,i=_.first(e);if(i){var a=Object.keys(i).map(function(e){return i[e]}).map(function(e){return e}),s=Object.keys(i),l=a[1],u=[];o<l?u.push(l):_.forEach(a,function(e){e<=o&&u.push(e)});var c=_.last(u);(r=s[_.findIndex(a,function(e){return e===c})].replace("SD","")).includes("neg")&&(r="-"+(r=r.substring(1,0))),"S"!==r&&"L"!==r&&"M"!==r&&"-5"!==r||(r="-4")}return o&&i?r:null},e.prototype.calcWeightForHeightZscore=function(e,t,n){var o,r;t&&n&&(t=parseFloat(t).toFixed(1));t<45||110<t?r=-4:o=_.filter(e,function(e){return parseFloat(e.Length).toFixed(1)===t});var i=_.first(o);if(i){var a=Object.keys(i).map(function(e){return i[e]}).map(function(e){return e}),s=Object.keys(i),l=a[1],u=[];n<l?u.push(l):_.forEach(a,function(e){e<=n&&u.push(e)});var c=_.last(u);(r=s[_.findIndex(a,function(e){return e===c})].replace("SD","")).includes("neg")&&(r="-"+(r=r.substring(1,0))),"S"!==r&&"L"!==r&&"M"!==r&&"-5"!==r||(r="-4")}return t&&n?r:null},e.prototype.calcHeightForAgeZscore=function(e,t,n){var o,r=_.first(e);if(r){var i=Object.keys(r).map(function(e){return r[e]}).map(function(e){return e}),a=Object.keys(r),s=i[1],l=[];t<s?l.push(s):_.forEach(i,function(e){e<=t&&l.push(e)});var u=_.last(l);(o=a[_.findIndex(i,function(e){return e===u})].replace("SD","")).includes("neg")&&(o="-"+(o=o.substring(1,0))),"S"!==o&&"L"!==o&&"M"!==o&&"-5"!==o||(o="-4")}return t&&n&&r?o:null},e.prototype.isEmpty=function(e){return e===undefined||null===e||""===e||"null"===e||"undefined"===e||!(!Array.isArray(e)||0!==e.length)},e.prototype.arrayContains=function(e,t){if(Array.isArray(t)){if(0===t.length)return!0;for(var n=!0,o=0;o<t.length;o++){var r=t[o];-1===e.indexOf(r)&&(n=!1)}return n}return-1!==e.indexOf(t)},e.prototype.extractRepeatingGroupValues=function(t,e){return e.map(function(e){return e[t]})},e.prototype.formatDate=function(e,t,n){if(t=t||"yyyy-MM-dd",n=n||"+0300",!(e instanceof Date||null!==(e=new Date(e))&&e!==undefined))throw new Error("DateFormatException: value passed is not a valid date");return e},e.prototype.arrayContainsAny=function(e,t){if(Array.isArray(t)){if(0===t.length)return!0;for(var n=!1,o=0;o<t.length;o++){var r=t[o];-1!==e.indexOf(r)&&(n=!0)}return n}return-1!==e.indexOf(t)},Object.defineProperty(e.prototype,"helperFunctions",{get:function(){var e=this;return{arrayContainsAny:e.arrayContainsAny,calcBMI:e.calcBMI,calcBMIForAgeZscore:e.calcBMIForAgeZscore,calcWeightForHeightZscore:e.calcWeightForHeightZscore,calcHeightForAgeZscore:e.calcHeightForAgeZscore,isEmpty:e.isEmpty,arrayContains:e.arrayContains,extractRepeatingGroupValues:e.extractRepeatingGroupValues}},enumerable:!0,configurable:!0}),e}(),Validations=function(){function e(){}return e.JSExpressionValidatorsEnabled=!1,e}(),JsExpressionValidator=function(){function e(){}return e.prototype.validate=function(o,r){return function(e){if(!Validations.JSExpressionValidatorsEnabled)return null;var t=o.failsWhenExpression,n=(new JsExpressionHelper).helperFunctions;return(new ExpressionRunner).getRunnable(t,e,n,{},r).run()?{js_expression:{expression:t,message:o.message}}:null}},e}(),Messages=function(){function e(){}return e.REQUIRED_FIELD_MSG="This field is required!",e.INVALID_DATE_MSG="Provided date is invalid!",e.FUTURE_DATE_RESTRICTION_MSG="Future date is not allowed!",e.MIN_LENGTH_MSG="Min Length should be {minLength}",e.MAX_LENGTH_MSG="Max Length should be {maxLength}",e.MAX_DATE_MSG="Max Date should be {maxDate}",e.MIN_DATE_MSG="Min Date should be {minDate}",e.MAX_MSG="Max value should be {max}",e.MIN_MSG="Min value should be {min}",e}(),ValidationFactory=function(){function e(){}return e.prototype.getValidators=function(e,t){var n=this,o=[];return e.validators&&_.forEach(e.validators,function(e){switch(e.type){case"date":o.push(n.dateValidator),e.allowFutureDates||o.push(n.futureDateRestrictionValidator);break;case"js_expression":o.push(n.jsExpressionValidator.validate(e,t));break;case"max":o.push(n.getMaxValueValidator(e.max));break;case"min":o.push(n.getMinValueValidator(e.min));break;case"conditionalRequired":o.push(n.conditionalRequiredValidator.validate(e));break;case"conditionalAnswered":o.push(n.conditionalAnsweredValidator.validate(e))}}),e.required&&"string"==typeof e.required&&"true"===e.required&&o.push(this.requiredValidator),o},Object.defineProperty(e.prototype,"conditionalRequiredValidator",{get:function(){return new ConditionalRequiredValidator},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"conditionalAnsweredValidator",{get:function(){return new ConditionalAnsweredValidator},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"requiredValidator",{get:function(){return(new RequiredValidator).validate},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"dateValidator",{get:function(){return(new DateValidator).validate},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"futureDateRestrictionValidator",{get:function(){return(new FutureDateRestrictionValidator).validate},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"maxDateValidator",{get:function(){return(new MaxDateValidator).validate},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"minDateValidator",{get:function(){return(new MinDateValidator).validate},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"minLengthValidator",{get:function(){return forms.Validators.minLength},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"maxLengthValidator",{get:function(){return forms.Validators.maxLength},enumerable:!0,configurable:!0}),e.prototype.getMinValueValidator=function(e){return(new MinValidator).validate(e)},e.prototype.getMaxValueValidator=function(e){return(new MaxValidator).validate(e)},Object.defineProperty(e.prototype,"jsExpressionValidator",{get:function(){return new JsExpressionValidator},enumerable:!0,configurable:!0}),e.prototype.errors=function(e,t){var n=[];for(var o in e)if(e.hasOwnProperty(o))switch(o){case"required":n.push(Messages.REQUIRED_FIELD_MSG);break;case"date":n.push(Messages.INVALID_DATE_MSG);break;case"futureDateRestriction":n.push(Messages.FUTURE_DATE_RESTRICTION_MSG);break;case"minlength":n.push(Messages.MIN_LENGTH_MSG.replace("{minLength}",e.minlength.requiredLength));break;case"maxlength":n.push(Messages.MIN_LENGTH_MSG.replace("{maxLength}",e.maxlength.requiredLength));break;case"maxdate":n.push(Messages.MAX_DATE_MSG.replace("{maxDate}",e.maxdate.requiredDate));break;case"mindate":n.push(Messages.MIN_DATE_MSG.replace("{minDate}",e.mindate.requiredDate));break;case"max":n.push(Messages.MAX_MSG.replace("{max}",e.max.requiredValue));break;case"min":n.push(Messages.MIN_MSG.replace("{min}",e.min.requiredValue));break;case"js_expression":n.push(e.js_expression.message);break;case"conditional_required":n.push(e.conditional_required.message);break;case"conditional_answered":n.push(e.conditional_answered.message)}return n},e.decorators=[{type:i0.Injectable}],e.ctorParameters=function(){return[]},e}(),HidersDisablersFactory=function(){function e(e,t,n){this.expressionRunner=e,this.expressionHelper=t,this._debugModeService=n}return e.prototype.getJsExpressionDisabler=function(e,t,n){var o=this.expressionRunner.getRunnable(e.disable,t,this.expressionHelper.helperFunctions,{},n),r={toDisable:!1,disableWhenExpression:e.disable,reEvaluateDisablingExpression:function(){var e=o.run();r.toDisable=e}};return r},e.prototype.getJsExpressionHider=function(e,t,n){var o=e.hide,r="object"==typeof o?this.convertHideObjectToString(o):e.hide,i=this._debugModeService.debugEnabled(),a=this.expressionRunner.getRunnable(r,t,this.expressionHelper.helperFunctions,{},n),s={toHide:!1,hideWhenExpression:r,reEvaluateHidingExpression:function(){s.toHide=!0!==i&&a.run()}};return s},e.prototype.convertHideObjectToString=function(e){return e.value instanceof Array?"!arrayContains(["+("'"+e.value.join("','")+"'")+"],"+e.field+")":""},e.decorators=[{type:i0.Injectable}],e.ctorParameters=function(){return[{type:ExpressionRunner},{type:JsExpressionHelper},{type:DebugModeService}]},e}(),AlertsFactory=function(){function e(e,t){this.expressionRunner=e,this.expressionHelper=t}return e.prototype.getJsExpressionshowAlert=function(e,t,n){var o=this.expressionRunner.getRunnable(e.alert.alertWhenExpression,t,this.expressionHelper.helperFunctions,{},n),r={shown:!1,alertWhenExpression:e.alert.alertWhenExpression,alertMessage:e.alert.message,reEvaluateAlertExpression:function(){var e=o.run();r.shown=e}};return r},e.decorators=[{type:i0.Injectable}],e.ctorParameters=function(){return[{type:ExpressionRunner},{type:JsExpressionHelper}]},e}(),FormControlService=function(){function e(e,t,n){this.alertsFactory=n,this.controls=[],this.validationFactory=e,this.hidersDisablersFactory=t}return e.prototype.generateControlModel=function(e,t,n,o){if(e instanceof QuestionBase){if(e.controlType===exports.AfeControlType.AfeFormArray)return this.generateFormArray(e,t,o);if(e.controlType===exports.AfeControlType.AfeFormGroup)return this.generateFormGroupModel(e,n,t,o);if(e.controlType===exports.AfeControlType.AfeFormControl)return this.generateFormControl(e,t,o)}return null},e.prototype.generateFormGroupModel=function(e,t,n,o){var r=new AfeFormGroup({});this.wireHidersDisablers(e,r,o),this.wireAlerts(e,r,o),n instanceof AfeFormGroup&&n.setControl(e.key,r);var i=e;return t&&i&&0<i.questions.length&&this._generateFormGroupChildrenModel(i.questions,r,o),r},e.prototype._generateFormGroupChildrenModel=function(e,n,o){var r=this;0<e.length&&e.forEach(function(e){var t=r.generateControlModel(e,n,!0,o);null!==t&&n.addControl(e.key,t)})},e.prototype.generateFormArray=function(e,t,n){var o,r=this.validationFactory.getValidators(e,n);return(o=r&&0<r.length?new AfeFormArray([],r[0]):new AfeFormArray([])).uuid=e.key,this.wireHidersDisablers(e,o,n),this.wireAlerts(e,o,n),t instanceof AfeFormGroup&&t.setControl(e.key,o),o},e.prototype.generateFormControl=function(e,t,n){var o=e.defaultValue||"",r=this.validationFactory.getValidators(e,n),i=new AfeFormControl(o,r);return i.uuid=e.key,this.wireHidersDisablers(e,i,n),this.wireAlerts(e,i,n),this.wireCalculator(e,i,n?n.dataSourcesContainer.dataSources:null),t instanceof AfeFormGroup&&t.setControl(e.key,i),i},e.prototype.wireAlerts=function(e,t,n){if(e.alert&&""!==e.alert){var o=this.alertsFactory.getJsExpressionshowAlert(e,t,n);t.setAlertFn(o)}},e.prototype.wireHidersDisablers=function(e,t,n){if(e.hide&&""!==e.hide){var o=this.hidersDisablersFactory.getJsExpressionHider(e,t,n);t.setHidingFn(o)}if(e.disable&&""!==e.disable){var r=this.hidersDisablersFactory.getJsExpressionDisabler(e,t,n);t.setDisablingFn(r)}},e.prototype.wireCalculator=function(e,t,n){if(e.calculateExpression&&""!==e.calculateExpression){var o=new JsExpressionHelper,r=(new ExpressionRunner).getRunnable(e.calculateExpression,t,o.helperFunctions,n);t.setCalculatorFn(r.run)}},e.decorators=[{type:i0.Injectable}],e.ctorParameters=function(){return[{type:ValidationFactory},{type:HidersDisablersFactory},{type:AlertsFactory}]},e}(),DEFAULT_STYLES='a {\n color: white;\n text-decoration: none;\n font-size: 12px;\n text-transform: uppercase;\n }\n\n ul {\n list-style-type: none;\n margin: 2px auto;\n position: relative;\n }\n\n li {\n display: block;\n padding: 10px 20px;\n white-space: nowrap;\n transition: all 0.3s ease-in;\n border-bottom: 4px solid transparent;\n }\n\n li:hover {\n border-bottom: 4px solid white;\n opacity: 0.7;\n cursor: pointer;\n }\n\n .owl-theme .owl-controls .owl-nav {\n position: absolute;\n width: 100%;\n top: 0;\n }\n\n .owl-theme .owl-controls .owl-nav [class*="owl-"] {\n position: absolute;\n background: none;\n color: black;\n }\n\n .owl-theme .owl-controls .owl-nav [class*="owl-"]:hover {\n background: none;\n color: black;\n }\n\n .owl-theme .owl-controls .owl-nav .owl-next {\n right: 0;\n transform: translate(120%);\n }\n\n .owl-theme .owl-controls .owl-nav .owl-prev {\n left: 0;\n transform: translate(-120%);\n }\n\n .slick-initialized .swipe-tab-content {\n position: relative;\n min-height: 365px;\n }\n @media screen and (min-width: 767px) {\n .slick-initialized .swipe-tab-content {\n min-height: 500px;\n }\n .time-control{\n width:50%;\n }\n }\n .slick-initialized .swipe-tab {\n display: flex;\n align-items: center;\n justify-content: center;\n height: 50px;\n background: none;\n border: 0;\n color: #757575;\n cursor: pointer;\n text-align: center;\n border-bottom: 2px solid rgba(51, 122, 183, 0);\n transition: all 0.5s;\n }\n .slick-initialized .swipe-tab:hover {\n color: #337AB7;\n }\n .slick-initialized .swipe-tab.active-tab {\n border-bottom-color: #337AB7;\n color: #337AB7;\n font-weight: bold;\n }\n\n .disabled {\n opacity: .5;\n pointer-events: none;\n }\n\n .select2-container {\n margin-top: -5px;\n }\n\n .btn {\n padding: 0px 12px !important;\n }\n\n .form-tooltip{\n color:rgb(51, 122, 183);\n display: inline-block;\n }\n .question-info{\n opacity:0;\n height:0px;\n display: none;\n transition-duration: opacity 1s ease-out;\n transtion-delay: 0.5s;\n padding-top: 2px;\n padding-bottom: 2px;\n color: #696969;\n border-style: ridge;\n border-width: 1px;\n border-color: #337ab7;\n margin-top: 2px;\n }\n .hide-info{\n display:none;\n height:0px;\n }\n .form-tooltip:hover ~ .question-info {\n display:block;\n opacity:1;\n height:auto;\n }\n .form-tooltip .tooltipcontent::after {\n content: " ";\n position: absolute;\n bottom: 100%; /* At the top of the tooltip */\n right: 0%;\n margin-left: -5px;\n border-width: 5px;\n border-style: solid;\n border-top-color: transparent;\n border-right-color: transparent;\n border-bottom-color: #337ab7;\n border-left-color: transparent;\n }\n\n ng-select.form-control {\n padding-top: 0;\n height: auto;\n padding-bottom: 0;\n }\n\n .forms-dropdown-menu {\n max-height: 450px;\n overflow-y: scroll;\n }\n .no-border {\n border: 0;\n box-shadow: none;\n}\n.time-control{\n width:100%;\n}\n\n ',DataSources=function(){function e(){this._dataSources={}}return Object.defineProperty(e.prototype,"dataSources",{get:function(){return this._dataSources},enumerable:!0,configurable:!0}),e.prototype.registerDataSource=function(e,t,n){if(void 0===n&&(n=!1),n)for(var o in t)console.log("registering",o,t[o]),this.registerDataSource(o,t[o],!1);this.dataSources[e]&&console.warn("Overriding registered data source",e),this._dataSources[e]=t},e.prototype.clearDataSource=function(e){delete this._dataSources[e]},e.decorators=[{type:i0.Injectable}],e.ctorParameters=function(){return[]},e}(),FormRendererComponent=function(){function e(e,t,n,o){this.validationFactory=e,this.dataSources=t,this.formErrorsService=n,this.document=o,this.childComponents=[],this.isCollapsed=!1,this.activeTab=0}return e.prototype.ngOnInit=function(){var t=this;if(this.setUpRemoteSelect(),this.setUpFileUpload(),this.node&&this.node.form){var e=this.node.form.valueProcessingInfo.lastFormTab;e&&e!==this.activeTab&&(this.activeTab=e)}this.node&&"form"===this.node.question.renderingType&&this.formErrorsService.announceErrorField$.subscribe(function(e){t.scrollToControl(e)}),this.node&&"section"===this.node.question.renderingType&&(this.isCollapsed=!this.node.question.isExpanded),this.parentComponent&&this.parentComponent.addChildComponent(this)},e.prototype.addChildComponent=function(e){this.childComponents.push(e)},e.prototype.setUpRemoteSelect=function(){this.node&&this.node.question.extras&&"remote-select"===this.node.question.renderingType&&(this.dataSource=this.dataSources.dataSources[this.node.question.dataSource],this.dataSource&&this.node.question.dataSourceOptions&&(this.dataSource.dataSourceOptions=this.node.question.dataSourceOptions))},e.prototype.setUpFileUpload=function(){this.node&&this.node.question.extras&&"file"===this.node.question.renderingType&&(this.dataSource=this.dataSources.dataSources[this.node.question.dataSource])},e.prototype.checkSection=function(n){if("section"!==n.question.renderingType)return!0;var o=!1;return!Object.keys(n.children).every(function(e){var t=n.children[e];return t instanceof GroupNode&&(o=Object.keys(t.children).every(function(e){return t.children[e].control.hidden})),n.children[e].control.hidden||o})},e.prototype.clickTab=function(e){this.activeTab=e},e.prototype.loadPreviousTab=function(){this.isCurrentTabFirst()||(this.clickTab(this.activeTab-1),document.body.scrollTop=0)},e.prototype.isCurrentTabFirst=function(){return 0===this.activeTab},e.prototype.isCurrentTabLast=function(){return this.activeTab===this.node.question.questions.length-1},e.prototype.loadNextTab=function(){this.isCurrentTabLast()||(this.clickTab(this.activeTab+1),document.body.scrollTop=0)},e.prototype.tabSelected=function(e){this.activeTab=e,this.setPreviousTab()},e.prototype.setPreviousTab=function(){this.node&&this.node.form&&(this.node.form.valueProcessingInfo.lastFormTab=this.activeTab)},e.prototype.hasErrors=function(){return this.node.control.touched&&!this.node.control.valid},e.prototype.errors=function(){return this.getErrors(this.node)},e.prototype.scrollToControl=function(e){var t=this,n=+e.split(",")[0],o=e.split(",")[1]+"id",r=this.childComponents[n];this.clickTab(n),setTimeout(function(){r.childComponents.forEach(function(e){e.isCollapsed=!1,setTimeout(function(){var e=t.document.getElementById(o);null!==e&&e.focus&&(e.focus(),e.scrollIntoView({behavior:"smooth",block:"center"}))},100)})},200)},e.prototype.onDateChanged=function(e){this.node=e},e.prototype.upload=function(e){},e.prototype.toggleInformation=function(e){var t=document.getElementById(e);"block"===t.style.display?t.style.display="none":t.style.display="block",console.log("InfoId",e)},e.prototype.getErrors=function(e){var t=e.control.errors;return t?this.validationFactory.errors(t,e.question):[]},e.decorators=[{type:i0.Component,args:[{selector:"form-renderer",template:'\x3c!--CONTAINERS--\x3e\n<div *ngIf="node.question.renderingType === \'form\'">\n <div class="dropdown dropdown-tabs forms-dropdown">\n <a class="btn dropdown-toggle" data-toggle="dropdown">\n <i class="fa fa-angle-double-down"></i>\n </a>\n <ul\n class="dropdown-menu dropdown-menu-right forms-dropdown-menu"\n role="menu"\n aria-labelledby="dropdownMenu"\n >\n <li\n *ngFor="let question of node.question.questions; let i = index"\n (click)="clickTab(i)"\n >\n {{ question.label }}\n </li>\n </ul>\n </div>\n <mat-tab-group\n (selectedIndexChange)="tabSelected($event)"\n [selectedIndex]="activeTab"\n >\n <mat-tab\n [label]="question.label"\n *ngFor="let question of node.question.questions; let i = index"\n >\n <div (swipeLeft)="loadNextTab()" (swipeRight)="loadPreviousTab()">\n <form-renderer\n [node]="node.children[question.key]"\n [parentComponent]="this"\n [parentGroup]="node.control"\n ></form-renderer>\n </div>\n </mat-tab>\n </mat-tab-group>\n\n <div style="text-align: center">\n <button\n type="button"\n class="btn btn-default"\n (click)="loadPreviousTab()"\n [ngClass]="{ disabled: isCurrentTabFirst() }"\n >\n &lt;&lt;\n </button>\n <button\n type="button"\n class="btn btn-default"\n (click)="loadNextTab()"\n [ngClass]="{ disabled: isCurrentTabLast() }"\n >\n &gt;&gt;\n </button>\n </div>\n</div>\n<div *ngIf="node.question.renderingType === \'page\'">\n \x3c!--<h2>{{node.question.label}}</h2>--\x3e\n <form-renderer\n *ngFor="let question of node.question.questions"\n [parentComponent]="this"\n [node]="node.children[question.key]"\n [parentGroup]="parentGroup"\n ></form-renderer>\n</div>\n<div *ngIf="node.question.renderingType === \'section\' && checkSection(node)">\n <div class="panel panel-primary">\n <div class="panel-heading">\n <button\n type="button"\n class="btn btn-primary pull-right"\n (click)="isCollapsed = !isCollapsed"\n >\n {{ isCollapsed ? \'Show\' : \'Hide\' }}\n </button>\n {{ node.question.label }}\n </div>\n <div class="panel-body" [collapse]="isCollapsed">\n <form-renderer\n *ngFor="let question of node.question.questions"\n [parentComponent]="this"\n [node]="node.children[question.key]"\n [parentGroup]="parentGroup"\n ></form-renderer>\n </div>\n </div>\n</div>\n\n\x3c!-- MESSAGES --\x3e\n<div\n *ngIf="node.control && node.control.alert && node.control.alert !== \'\'"\n class="alert alert-warning"\n>\n <a class="close" data-dismiss="alert">&times;</a> {{ node.control.alert }}\n</div>\n\n\x3c!--CONTROLS--\x3e\n\n<div\n *ngIf="node.question.controlType === 0"\n class="form-group"\n [formGroup]="parentGroup"\n [hidden]="node.control.hidden"\n [ngClass]="{ disabled: node.control.disabled }"\n>\n \x3c!--LEAF CONTROL--\x3e\n <div class="question-area">\n <a\n class="form-tooltip pull-right"\n (click)="toggleInformation(node.question.extras.id)"\n data-placement="right"\n *ngIf="\n node.question &&\n node.question.extras.questionInfo &&\n node.question.extras.questionInfo !== \'\' &&\n node.question.extras.questionInfo !== \' \'\n "\n >\n <i class="glyphicon glyphicon-question-sign" aria-hidden="true"></i>\n </a>\n\n <label\n *ngIf="node.question.label"\n [style.color]="hasErrors() ? \'red\' : \'\'"\n class="control-label"\n [attr.for]="node.question.key"\n >\n {{ node.question.required ? \'*\' : \'\' }} {{ node.question.label }}\n </label>\n <div [ngSwitch]="node.question.renderingType">\n <select\n class="form-control"\n *ngSwitchCase="\'select\'"\n [formControlName]="node.question.key"\n [id]="node.question.key + \'id\'"\n >\n <option *ngFor="let o of node.question.options" [ngValue]="o.value">\n {{ o.label }}\n </option>\n </select>\n\n <app-file-upload\n *ngSwitchCase="\'file\'"\n [dataSource]="dataSource"\n [formControlName]="node.question.key"\n [id]="node.question.key + \'id\'"\n (fileChanged)="upload($event)"\n >\n </app-file-upload>\n <textarea\n [placeholder]="node.question.placeholder"\n [rows]="node.question.rows"\n class="form-control"\n *ngSwitchCase="\'textarea\'"\n [formControlName]="node.question.key"\n [id]="node.question.key + \'id\'"\n >\n </textarea>\n \x3c!--\n <ng-select *ngSwitchCase="\'remote-select\'" [items]="items$ | async" bindLabel="label" bindValue="value" placeholder="{{node.question.placeholder}}"\n [hideSelected]="true" [loading]="itemsLoading" [typeahead]="itemsInput$" [formControlName]="node.question.key" [id]="node.question.key + \'id\'">\n </ng-select>\n --\x3e\n <remote-select\n *ngSwitchCase="\'remote-select\'"\n [placeholder]="node.question.placeholder"\n tabindex="0"\n [dataSource]="dataSource"\n [componentID]="node.question.key + \'id\'"\n [formControlName]="node.question.key"\n [id]="node.question.key + \'id\'"\n ></remote-select>\n \x3c!-- \n <date-time-picker *ngSwitchCase="\'date\'" [showTime]="node.question.showTime" tabindex="0" [weeks]=\'node.question.extras.questionOptions.weeksList\'\n (onDateChange)="onDateChanged(node)" [showWeeks]="node.question.showWeeksAdder" [formControlName]="node.question.key"\n [id]="node.question.key + \'id\'"></date-time-picker>\n --\x3e\n\n <ngx-date-time-picker\n *ngSwitchCase="\'date\'"\n [showTime]="node.question.showTime"\n [id]="node.question.key + \'id\'"\n [formControlName]="node.question.key"\n [weeks]="node.question.extras.questionOptions.weeksList"\n (onDateChange)="onDateChanged(node)"\n [showWeeks]="node.question.showWeeksAdder"\n ></ngx-date-time-picker>\n <ngx-time-picker \n *ngSwitchCase="\'time\'" \n id="node.question.key + \'id\'" \n [formControlName]="node.question.key"\n ></ngx-time-picker>\n <ng-select\n *ngSwitchCase="\'multi-select\'"\n [style.height]="\'auto\'"\n [style.overflow-x]="\'hidden\'"\n tabindex="0"\n [formControlName]="node.question.key"\n [id]="node.question.key + \'id\'"\n [options]="node.question.options"\n [multiple]="true"\n >\n </ng-select>\n <ng-select\n *ngSwitchCase="\'single-select\'"\n [style.height]="auto"\n tabindex="0"\n [formControlName]="node.question.key"\n [id]="node.question.key + \'id\'"\n [options]="node.question.options"\n [multiple]="false"\n >\n </ng-select>\n <input\n class="form-control"\n *ngSwitchCase="\'number\'"\n [formControlName]="node.question.key"\n [attr.placeholder]="node.question.placeholder"\n [type]="\'number\'"\n [id]="node.question.key + \'id\'"\n [step]="\'any\'"\n [min]="node.question.extras.questionOptions.min"\n [max]="node.question.extras.questionOptions.max"\n />\n <input\n class="form-control"\n *ngSwitchCase="\'decimal\'"\n [formControlName]="node.question.key"\n [attr.placeholder]="node.question.placeholder"\n [type]="\'text\'"\n [id]="node.question.key + \'id\'"\n [min]="node.question.extras.questionOptions.min"\n [max]="node.question.extras.questionOptions.max"\n />\n <input\n class="form-control"\n *ngSwitchDefault\n [formControlName]="node.question.key"\n [attr.placeholder]="node.question.placeholder"\n [type]="node.question.renderingType"\n [id]="node.question.key + \'id\'"\n />\n\n <div *ngSwitchCase="\'radio\'">\n <div *ngFor="let o of node.question.options">\n <label class="form-control no-border">\n <input\n type="radio"\n [formControlName]="node.question.key"\n [id]="node.question.key + \'id\'"\n [value]="o.value"\n />\n {{ o.label }}\n </label>\n </div>\n </div>\n\n <div *ngSwitchCase="\'checkbox\'">\n <checkbox\n [id]="node.question.key + \'id\'"\n [formControlName]="node.question.key"\n [options]="node.question.options"\n [selected]="node.control.value"\n ></checkbox>\n </div>\n\n <div\n *ngIf="\n node.question.enableHistoricalValue && node.question.historicalDisplay\n "\n style="margin-top: 2px"\n >\n <div class="container-fluid">\n <div class="row">\n <div class="col-xs-9">\n <span class="text-warning">Previous Value: </span>\n <strong>{{ node.question.historicalDisplay?.text }}</strong>\n <span *ngIf="node.question.showHistoricalValueDate">\n <span> | </span>\n <strong class="text-primary"\n >{{ node.question.historicalDisplay?._date }}\n </strong>\n <span\n class="text-primary"\n *ngIf="\n node.question.historicalDisplay &&\n node.question.historicalDisplay._date\n "\n >\n ({{ node.question.historicalDisplay._date | timeAgo }})</span\n >\n </span>\n </div>\n <button\n type="button"\n [node]="node"\n [name]="\'historyValue\'"\n class="btn btn-primary btn-small col-xs-3"\n >\n Use Value\n </button>\n </div>\n </div>\n </div>\n <appointments-overview [node]="node"></appointments-overview>\n <div *ngIf="hasErrors()">\n <p *ngFor="let e of errors()">\n <span class="text-danger">{{ e }}</span>\n </p>\n </div>\n </div>\n\n <div\n class="question-info col-md-12 col-lg-12 col-sm-12"\n id="{{ node.question.extras.id }}"\n *ngIf="\n node.question &&\n node.question.extras.questionInfo &&\n node.question.extras.questionInfo !== \'\' &&\n node.question.extras.questionInfo !== \' \'\n "\n >\n {{ node.question.extras.questionInfo }}\n </div>\n </div>\n</div>\n<div\n *ngIf="node.question.controlType === 1"\n [hidden]="node.control.hidden"\n [ngClass]="{ disabled: node.control.disabled }"\n>\n \x3c!--ARRAY CONTROL--\x3e\n <div [ngSwitch]="node.question.renderingType">\n <div class="well" style="padding: 2px" *ngSwitchCase="\'repeating\'">\n <h4 style="margin: 2px; font-weight: bold">{{ node.question.label }}</h4>\n <hr\n style="\n margin-left: -2px;\n margin-right: -2px;\n margin-bottom: 4px;\n margin-top: 8px;\n border-width: 2px;\n "\n />\n <div [ngSwitch]="node.question.extras.type">\n <div *ngSwitchCase="\'testOrder\'">\n <div *ngFor="let child of node.children; let i = index">\n <form-renderer\n *ngFor="let question of child.question.questions"\n [parentComponent]="this"\n [node]="child.children[question.key]"\n [parentGroup]="child.control"\n ></form-renderer>\n <div>{{ child.orderNumber }}</div>\n <button\n type="button "\n class="btn btn-sm btn-danger"\n (click)="node.removeAt(i)"\n >\n Remove\n </button>\n <br />\n <hr\n style="\n margin-left: -2px;\n margin-right: -2px;\n margin-bottom: 4px;\n margin-top: 8px;\n border-width: 1px;\n "\n />\n </div>\n </div>\n\n <div *ngSwitchCase="\'obsGroup\'" style="margin-bottom: 20px">\n <div *ngFor="let child of node.children; let i = index">\n <form-renderer\n *ngFor="let question of child.question.questions"\n [parentComponent]="this"\n [node]="child.children[question.key]"\n [parentGroup]="child.control"\n ></form-renderer>\n <button\n type="button "\n class="btn btn-sm btn-danger"\n (click)="node.removeAt(i)"\n >\n Remove\n </button>\n <br />\n <hr\n style="\n margin-left: -2px;\n margin-right: -2px;\n margin-bottom: 4px;\n margin-top: 8px;\n border-width: 1px;\n "\n />\n </div>\n </div>\n </div>\n <button\n type="button "\n class="btn btn-primary"\n (click)="node.createChildNode()"\n >\n Add\n </button>\n </div>\n </div>\n</div>\n<div\n *ngIf="node.question.controlType === 2"\n [hidden]="node.control.hidden"\n [ngClass]="{ disabled: node.control.disabled }"\n>\n \x3c!--GROUP--\x3e\n <div [ngSwitch]="node.question.renderingType">\n <div *ngSwitchCase="\'group\'">\n <form-renderer\n *ngFor="let question of node.question.questions"\n [parentComponent]="this"\n [node]="node.children[question.key]"\n [parentGroup]="node.control"\n ></form-renderer>\n </div>\n <div\n *ngSwitchCase="\'field-set\'"\n style="border: 1px solid #eeeeee; padding: 2px; margin: 2px"\n >\n <form-renderer\n *ngFor="let question of node.question.questions"\n [parentComponent]="this"\n [node]="node.children[question.key]"\n [parentGroup]="node.control"\n ></form-renderer>\n </div>\n </div>\n</div>\n',styles:["../../style/app.css",DEFAULT_STYLES]}]}],e.ctorParameters=function(){return[{type:ValidationFactory},{type:DataSources},{type:FormErrorsService},{type:undefined,decorators:[{type:i0.Inject,args:[common.DOCUMENT]}]}]},e.propDecorators={parentComponent:[{type:i0.Input}],node:[{type:i0.Input}],parentGroup:[{type:i0.Input}]},e}(),ErrorRendererComponent=function(){function e(e,t){this.validationFactory=e,this.formErrorsService=t}return e.prototype.ngOnInit=function(){},e.prototype.showErrors=function(){return!this.form.valid&&this.form.showErrors},Object.defineProperty(e.prototype,"errorNodes",{get:function(){return this.form.markInvalidControls(this.form.rootNode,[])},enumerable:!0,configurable:!0}),e.prototype.getControlError=function(e){var t=e.control.errors;return t?this.validationFactory.errors(t,e.question):[]},e.prototype.announceErrorField=function(n){var o=this,e=this.form.searchNodeByQuestionId(n.path.substring(0,n.path.indexOf(".")));_.forEach(e,function(e){if("page"===e.question.renderingType){var t=o.getPageIndex(e);o.formErrorsService.announceErrorField(t+","+n.question.key)}})},e.prototype.getPageIndex=function(e){return this.form.rootNode.question.questions.indexOf(e.question)},e.decorators=[{type:i0.Component,args:[{selector:"error-renderer",template:'<div *ngIf="showErrors()" class="container">\n <ul class="list-group">\n <li\n class="list-group-item list-group-item-warning"\n *ngFor="let errorNode of errorNodes"\n (click)="announceErrorField(errorNode)"\n >\n <div class="error" *ngIf="errorNode.control.valid == false">\n <h4>{{ errorNode.question.label }}</h4>\n <span class="text-danger"> {{ getControlError(errorNode) }}</span>\n </div>\n </li>\n </ul>\n</div>\n',styles:["ul{list-style:none}.list-group-item{padding:2px 15px;cursor:pointer}ul li:hover{background-color:#fff}h4{margin-top:7px;margin-bottom:7px}"]}]}],e.ctorParameters=function(){return[{type:ValidationFactory},{type:FormErrorsService}]},e.propDecorators={form:[{type:i0.Input}]},e}(),HistoricalFieldHelperService=function(){function e(){}return e.prototype.getDisplayTextFromOptions=function(e,n,o){var r="",t=e.historicalDataValue;if(_.isArray(t.value)){var i=0;_.each(t.value,function(t){_.each(e.options,function(e){e[n]===t&&(0===i?r+=e[o]:r=r+", "+e[o],i++)})})}else _.each(e.options,function(e){e[n]===t.value&&(r=e[o])});return r},e}(),HistoricalValueDirective=function(){function e(e){this.historicalFieldHelper=e,this._nodeChange=new i0.EventEmitter}return e.prototype.setValue=function(e){"historyValue"===e.target.name&&(!this._node||this.compareString(this._node.question.renderingType,"page")&&this.compareString(this._node.question.renderingType,"section")||(this._node.control.setValue(this._node.question.historicalDataValue.value),this._node.question.historicalValue=this._node.question.historicalDataValue,e.stopPropagation(),this._nodeChange.emit(this._node)))},e.prototype.compareString=function(e,t){return e===t},Object.defineProperty(e.prototype,"node",{set:function(e){if(e&&(this._node=e,this._node.question.enableHistoricalValue&&!_.isUndefined(this._node.question.historicalDataValue))){var t={text:"",_date:""};"select"===this._node.question.renderingType||"multi-select"===this._node.question.renderingType||"single-select"===this._node.question.renderingType?(t.text=this.historicalFieldHelper.getDisplayTextFromOptions(this._node.question,"value","label"),t._date=this._node.question.historicalDataValue.valueDate,this._node.question.historicalDisplay=t):_.isUndefined(this._node.question.historicalDataValue)||(t.text=this._node.question.historicalDataValue.value,t._date=this._node.question.historicalDataValue.valueDate,this._node.question.historicalDisplay=t)}},enumerable:!0,configurable:!0}),e.decorators=[{type:i0.Directive,args:[{selector:"[node]"}]}],e.ctorParameters=function(){return[{type:HistoricalFieldHelperService}]},e.propDecorators={_node:[{type:i0.Input}],_nodeChange:[{type:i0.Output}],setValue:[{type:i0.HostListener,args:["click",["$event"]]}],node:[{type:i0.Input}]},e}(),STYLE="\nng-select {\n display: inline-block;\n margin: 0;\n position: relative;\n vertical-align: middle;\n width: 100%;\n}\nng-select * {\n box-sizing: border-box;\n font-family: Sans-Serif;\n}\nng-select > div {\n border: 1px solid #ddd;\n box-sizing: border-box;\n cursor: pointer;\n user-select: none;\n width: 100%;\n}\nng-select > div.disabled {\n background-color: #eee;\n color: #aaa;\n cursor: default;\n pointer-events: none;\n}\nng-select > div > div.single {\n display: flex;\n height: 30px;\n width: 100%;\n}\nng-select > div > div.single > div.value,\nng-select > div > div.single > div.placeholder {\n flex: 1;\n line-height: 30px;\n overflow: hidden;\n padding: 0 10px;\n white-space: nowrap;\n}\nng-select > div > div.single > div.placeholder {\n color: #a9a9a9;\n}\nng-select > div > div.single > div.clear,\nng-select > div > div.single > div.toggle {\n color: #aaa;\n line-height: 30px;\n text-align: center;\n width: 30px;\n}\nng-select > div > div.single > div.clear:hover,\nng-select > div > div.single > div.toggle:hover {\n background-color: #ececec;\n}\nng-select > div > div.single > div.clear {\n font-size: 18px;\n}\nng-select > div > div.single > div.toggle {\n font-size: 14px;\n}\nng-select > div > div.multiple {\n display: flex;\n flex-flow: row wrap;\n height: 100%;\n min-height: 30px;\n padding: 0 10px;\n width: 100%;\n}\nng-select > div > div.multiple > div.option {\n background-color: #eee;\n border: 1px solid #aaa;\n border-radius: 4px;\n color: #333;\n cursor: default;\n display: inline-block;\n flex-shrink: 0;\n font-size: 14px;\n line-height: 22px;\n margin: 3px 5px 3px 0;\n padding: 0 4px;\n}\nng-select > div > div.multiple > div.option span.deselect-option {\n color: #aaa;\n cursor: pointer;\n font-size: 14px;\n height: 20px;\n line-height: 20px;\n}\nng-select > div > div.multiple > div.option span.deselect-option:hover {\n color: #555;\n}\nng-select > div > div.multiple input {\n background-color: transparent;\n border: none;\n height: 30px;\n line-height: 30px;\n padding: 0;\n}\nng-select > div > div.multiple input:focus {\n outline: none;\n}\n",Option=function(){function e(e,t){this.value=e,this.label=t,this.disabled=!1,this.highlighted=!1,this.selected=!1,this.shown=!0}return e.prototype.show=function(){this.shown=!0},e.prototype.hide=function(){this.shown=!1},e.prototype.disable=function(){this.disabled=!0},e.prototype.enable=function(){this.disabled=!1},e.prototype.undecoratedCopy=function(){return{label:this.label,value:this.value}},e}(),Diacritics=function(){function e(){}return e.strip=function(e){var t=this;return e?e.replace(/[^\u0000-\u007E]/g,function(e){return t.DIACRITICS[e]||e}):""},e.DIACRITICS={"Ⓐ":"A","A":"A","À":"A","Á":"A","Â":"A","Ầ":"A","Ấ":"A","Ẫ":"A","Ẩ":"A","Ã":"A","Ā":"A","Ă":"A","Ằ":"A","Ắ":"A","Ẵ":"A","Ẳ":"A","Ȧ":"A","Ǡ":"A","Ä":"A","Ǟ":"A","Ả":"A","Å":"A","Ǻ":"A","Ǎ":"A","Ȁ":"A","Ȃ":"A","Ạ":"A","Ậ":"A","Ặ":"A","Ḁ":"A","Ą":"A","Ⱥ":"A","Ɐ":"A","Ꜳ":"AA","Æ":"AE","Ǽ":"AE","Ǣ":"AE","Ꜵ":"AO","Ꜷ":"AU","Ꜹ":"AV","Ꜻ":"AV","Ꜽ":"AY","Ⓑ":"B","B":"B","Ḃ":"B","Ḅ":"B","Ḇ":"B","Ƀ":"B","Ƃ":"B","Ɓ":"B","Ⓒ":"C","C":"C","Ć":"C","Ĉ":"C","Ċ":"C","Č":"C","Ç":"C","Ḉ":"C","Ƈ":"C","Ȼ":"C","Ꜿ":"C","Ⓓ":"D","D":"D","Ḋ":"D","Ď":"D","Ḍ":"D","Ḑ":"D","Ḓ":"D","Ḏ":"D","Đ":"D","Ƌ":"D","Ɗ":"D","Ɖ":"D","Ꝺ":"D","DZ":"DZ","DŽ":"DZ","Dz":"Dz","Dž":"Dz","Ⓔ":"E","E":"E","È":"E","É":"E","Ê":"E","Ề":"E","Ế":"E","Ễ":"E","Ể":"E","Ẽ":"E","Ē":"E","Ḕ":"E","Ḗ":"E","Ĕ":"E","Ė":"E","Ë":"E","Ẻ":"E","Ě":"E","Ȅ":"E","Ȇ":"E","Ẹ":"E","Ệ":"E","Ȩ":"E","Ḝ":"E","Ę":"E","Ḙ":"E","Ḛ":"E","Ɛ":"E","Ǝ":"E","Ⓕ":"F","F":"F","Ḟ":"F","Ƒ":"F","Ꝼ":"F","Ⓖ":"G","G":"G","Ǵ":"G","Ĝ":"G","Ḡ":"G","Ğ":"G","Ġ":"G","Ǧ":"G","Ģ":"G","Ǥ":"G","Ɠ":"G","Ꞡ":"G","Ᵹ":"G","Ꝿ":"G","Ⓗ":"H","H":"H","Ĥ":"H","Ḣ":"H","Ḧ":"H","Ȟ":"H","Ḥ":"H","Ḩ":"H","Ḫ":"H","Ħ":"H","Ⱨ":"H","Ⱶ":"H","Ɥ":"H","Ⓘ":"I","I":"I","Ì":"I","Í":"I","Î":"I","Ĩ":"I","Ī":"I","Ĭ":"I","İ":"I","Ï":"I","Ḯ":"I","Ỉ":"I","Ǐ":"I","Ȉ":"I","Ȋ":"I","Ị":"I","Į":"I","Ḭ":"I","Ɨ":"I","Ⓙ":"J","J":"J","Ĵ":"J","Ɉ":"J","Ⓚ":"K","K":"K","Ḱ":"K","Ǩ":"K","Ḳ":"K","Ķ":"K","Ḵ":"K","Ƙ":"K","Ⱪ":"K","Ꝁ":"K","Ꝃ":"K","Ꝅ":"K","Ꞣ":"K","Ⓛ":"L","L":"L","Ŀ":"L","Ĺ":"L","Ľ":"L","Ḷ":"L","Ḹ":"L","Ļ":"L","Ḽ":"L","Ḻ":"L","Ł":"L","Ƚ":"L","Ɫ":"L","Ⱡ":"L","Ꝉ":"L","Ꝇ":"L","Ꞁ":"L","LJ":"LJ","Lj":"Lj","Ⓜ":"M","M":"M","Ḿ":"M","Ṁ":"M","Ṃ":"M","Ɱ":"M","Ɯ":"M","Ⓝ":"N","N":"N","Ǹ":"N","Ń":"N","Ñ":"N","Ṅ":"N","Ň":"N","Ṇ":"N","Ņ":"N","Ṋ":"N","Ṉ":"N","Ƞ":"N","Ɲ":"N","Ꞑ":"N","Ꞥ":"N","NJ":"NJ","Nj":"Nj","Ⓞ":"O","O":"O","Ò":"O","Ó":"O","Ô":"O","Ồ":"O","Ố":"O","Ỗ":"O","Ổ":"O","Õ":"O","Ṍ":"O","Ȭ":"O","Ṏ":"O","Ō":"O","Ṑ":"O","Ṓ":"O","Ŏ":"O","Ȯ":"O","Ȱ":"O","Ö":"O","Ȫ":"O","Ỏ":"O","Ő":"O","Ǒ":"O","Ȍ":"O","Ȏ":"O","Ơ":"O","Ờ":"O","Ớ":"O","Ỡ":"O","Ở":"O","Ợ":"O","Ọ":"O","Ộ":"O","Ǫ":"O","Ǭ":"O","Ø":"O","Ǿ":"O","Ɔ":"O","Ɵ":"O","Ꝋ":"O","Ꝍ":"O","Ƣ":"OI","Ꝏ":"OO","Ȣ":"OU","Ⓟ":"P","P":"P","Ṕ":"P","Ṗ":"P","Ƥ":"P","Ᵽ":"P","Ꝑ":"P","Ꝓ":"P","Ꝕ":"P","Ⓠ":"Q","Q":"Q","Ꝗ":"Q","Ꝙ":"Q","Ɋ":"Q","Ⓡ":"R","R":"R","Ŕ":"R","Ṙ":"R","Ř":"R","Ȑ":"R","Ȓ":"R","Ṛ":"R","Ṝ":"R","Ŗ":"R","Ṟ":"R","Ɍ":"R","Ɽ":"R","Ꝛ":"R","Ꞧ":"R","Ꞃ":"R","Ⓢ":"S","S":"S","ẞ":"S","Ś":"S","Ṥ":"S","Ŝ":"S","Ṡ":"S","Š":"S","Ṧ":"S","Ṣ":"S","Ṩ":"S","Ș":"S","Ş":"S","Ȿ":"S","Ꞩ":"S","Ꞅ":"S","Ⓣ":"T","T":"T","Ṫ":"T","Ť":"T","Ṭ":"T","Ț":"T","Ţ":"T","Ṱ":"T","Ṯ":"T","Ŧ":"T","Ƭ":"T","Ʈ":"T","Ⱦ":"T","Ꞇ":"T","Ꜩ":"TZ","Ⓤ":"U","U":"U","Ù":"U","Ú":"U","Û":"U","Ũ":"U","Ṹ":"U","Ū":"U","Ṻ":"U","Ŭ":"U","Ü":"U","Ǜ":"U","Ǘ":"U","Ǖ":"U","Ǚ":"U","Ủ":"U","Ů":"U","Ű":"U","Ǔ":"U","Ȕ":"U","Ȗ":"U","Ư":"U","Ừ":"U","Ứ":"U","Ữ":"U","Ử":"U","Ự":"U","Ụ":"U","Ṳ":"U","Ų":"U","Ṷ":"U","Ṵ":"U","Ʉ":"U","Ⓥ":"V","V":"V","Ṽ":"V","Ṿ":"V","Ʋ":"V","Ꝟ":"V","Ʌ":"V","Ꝡ":"VY","Ⓦ":"W","W":"W","Ẁ":"W","Ẃ":"W","Ŵ":"W","Ẇ":"W","Ẅ":"W","Ẉ":"W","Ⱳ":"W","Ⓧ":"X","X":"X","Ẋ":"X","Ẍ":"X","Ⓨ":"Y","Y":"Y","Ỳ":"Y","Ý":"Y","Ŷ":"Y","Ỹ":"Y","Ȳ":"Y","Ẏ":"Y","Ÿ":"Y","Ỷ":"Y","Ỵ":"Y","Ƴ":"Y","Ɏ":"Y","Ỿ":"Y","Ⓩ":"Z","Z":"Z","Ź":"Z","Ẑ":"Z","Ż":"Z","Ž":"Z","Ẓ":"Z","Ẕ":"Z","Ƶ":"Z","Ȥ":"Z","Ɀ":"Z","Ⱬ":"Z","Ꝣ":"Z","ⓐ":"a","a":"a","ẚ":"a","à":"a","á":"a","â":"a","ầ":"a","ấ":"a","ẫ":"a","ẩ":"a","ã":"a","ā":"a","ă":"a","ằ":"a","ắ":"a","ẵ":"a","ẳ":"a","ȧ":"a","ǡ":"a","ä":"a","ǟ":"a","ả":"a","å":"a","ǻ":"a","ǎ":"a","ȁ":"a","ȃ":"a","ạ":"a","ậ":"a","ặ":"a","ḁ":"a","ą":"a","ⱥ":"a","ɐ":"a","ꜳ":"aa","æ":"ae","ǽ":"ae","ǣ":"ae","ꜵ":"ao","ꜷ":"au","ꜹ":"av","ꜻ":"av","ꜽ":"ay","ⓑ":"b","b":"b","ḃ":"b","ḅ":"b","ḇ":"b","ƀ":"b","ƃ":"b","ɓ":"b","ⓒ":"c","c":"c","ć":"c","ĉ":"c","ċ":"c","č":"c","ç":"c","ḉ":"c","ƈ":"c","ȼ":"c","ꜿ":"c","ↄ":"c","ⓓ":"d","d":"d","ḋ":"d","ď":"d","ḍ":"d","ḑ":"d","ḓ":"d","ḏ":"d","đ":"d","ƌ":"d","ɖ":"d","ɗ":"d","ꝺ":"d","dz":"dz","dž":"dz","ⓔ":"e","e":"e","è":"e","é":"e","ê":"e","ề":"e","ế":"e","ễ":"e","ể":"e","ẽ":"e","ē":"e","ḕ":"e","ḗ":"e","ĕ":"e","ė":"e","ë":"e","ẻ":"e","ě":"e","ȅ":"e","ȇ":"e","ẹ":"e","ệ":"e","ȩ":"e","ḝ":"e","ę":"e","ḙ":"e","ḛ":"e","ɇ":"e","ɛ":"e","ǝ":"e","ⓕ":"f","f":"f","ḟ":"f","ƒ":"f","ꝼ":"f","ⓖ":"g","g":"g","ǵ":"g","ĝ":"g","ḡ":"g","ğ":"g","ġ":"g","ǧ":"g","ģ":"g","ǥ":"g","ɠ":"g","ꞡ":"g","ᵹ":"g","ꝿ":"g","ⓗ":"h","h":"h","ĥ":"h","ḣ":"h","ḧ":"h","ȟ":"h","ḥ":"h","ḩ":"h","ḫ":"h","ẖ":"h","ħ":"h","ⱨ":"h","ⱶ":"h","ɥ":"h","ƕ":"hv","ⓘ":"i","i":"i","ì":"i","í":"i","î":"i","ĩ":"i","ī":"i","ĭ":"i","ï":"i","ḯ":"i","ỉ":"i","ǐ":"i","ȉ":"i","ȋ":"i","ị":"i","į":"i","ḭ":"i","ɨ":"i","ı":"i","ⓙ":"j","j":"j","ĵ":"j","ǰ":"j","ɉ":"j","ⓚ":"k","k":"k","ḱ":"k","ǩ":"k","ḳ":"k","ķ":"k","ḵ":"k","ƙ":"k","ⱪ":"k","ꝁ":"k","ꝃ":"k","ꝅ":"k","ꞣ":"k","ⓛ":"l","l":"l","ŀ":"l","ĺ":"l","ľ":"l","ḷ":"l","ḹ":"l","ļ":"l","ḽ":"l","ḻ":"l","ſ":"l","ł":"l","ƚ":"l","ɫ":"l","ⱡ":"l","ꝉ":"l","ꞁ":"l","ꝇ":"l","lj":"lj","ⓜ":"m","m":"m","ḿ":"m","ṁ":"m","ṃ":"m","ɱ":"m","ɯ":"m","ⓝ":"n","n":"n","ǹ":"n","ń":"n","ñ":"n","ṅ":"n","ň":"n","ṇ":"n","ņ":"n","ṋ":"n","ṉ":"n","ƞ":"n","ɲ":"n","ʼn":"n","ꞑ":"n","ꞥ":"n","nj":"nj","ⓞ":"o","o":"o","ò":"o","ó":"o","ô":"o","ồ":"o","ố":"o","ỗ":"o","ổ":"o","õ":"o","ṍ":"o","ȭ":"o","ṏ":"o","ō":"o","ṑ":"o","ṓ":"o","ŏ":"o","ȯ":"o","ȱ":"o","ö":"o","ȫ":"o","ỏ":"o","ő":"o","ǒ":"o","ȍ":"o","ȏ":"o","ơ":"o","ờ":"o","ớ":"o","ỡ":"o","ở":"o","ợ":"o","ọ":"o","ộ":"o","ǫ":"o","ǭ":"o","ø":"o","ǿ":"o","ɔ":"o","ꝋ":"o","ꝍ":"o","ɵ":"o","ƣ":"oi","ȣ":"ou","ꝏ":"oo","ⓟ":"p","p":"p","ṕ":"p","ṗ":"p","ƥ":"p","ᵽ":"p","ꝑ":"p","ꝓ":"p","ꝕ":"p","ⓠ":"q","q":"q","ɋ":"q","ꝗ":"q","ꝙ":"q","ⓡ":"r","r":"r","ŕ":"r","ṙ":"r","ř":"r","ȑ":"r","ȓ":"r","ṛ":"r","ṝ":"r","ŗ":"r","ṟ":"r","ɍ":"r","ɽ":"r","ꝛ":"r","ꞧ":"r","ꞃ":"r","ⓢ":"s","s":"s","ß":"s","ś":"s","ṥ":"s","ŝ":"s","ṡ":"s","š":"s","ṧ":"s","ṣ":"s","ṩ":"s","ș":"s","ş":"s","ȿ":"s","ꞩ":"s","ꞅ":"s","ẛ":"s","ⓣ":"t","t":"t","ṫ":"t","ẗ":"t","ť":"t","ṭ":"t","ț":"t","ţ":"t","ṱ":"t","ṯ":"t","ŧ":"t","ƭ":"t","ʈ":"t","ⱦ":"t","ꞇ":"t","ꜩ":"tz","ⓤ":"u","u":"u","ù":"u","ú":"u","û":"u","ũ":"u","ṹ":"u","ū":"u","ṻ":"u","ŭ":"u","ü":"u","ǜ":"u","ǘ":"u","ǖ":"u","ǚ":"u","ủ":"u","ů":"u","ű":"u","ǔ":"u","ȕ":"u","ȗ":"u","ư":"u","ừ":"u","ứ":"u","ữ":"u","ử":"u","ự":"u","ụ":"u","ṳ":"u","ų":"u","ṷ":"u","ṵ":"u","ʉ":"u","ⓥ":"v","v":"v","ṽ":"v","ṿ":"v","ʋ":"v","ꝟ":"v","ʌ":"v","ꝡ":"vy","ⓦ":"w","w":"w","ẁ":"w","ẃ":"w","ŵ":"w","ẇ":"w","ẅ":"w","ẘ":"w","ẉ":"w","ⱳ":"w","ⓧ":"x","x":"x","ẋ":"x","ẍ":"x","ⓨ":"y","y":"y","ỳ":"y","ý":"y","ŷ":"y","ỹ":"y","ȳ":"y","ẏ":"y","ÿ":"y","ỷ":"y","ẙ":"y","ỵ":"y","ƴ":"y","ɏ":"y","ỿ":"y","ⓩ":"z","z":"z","ź":"z","ẑ":"z","ż":"z","ž":"z","ẓ":"z","ẕ":"z","ƶ":"z","ȥ":"z","ɀ":"z","ⱬ":"z","ꝣ":"z","Ά":"Α","Έ":"Ε","Ή":"Η","Ί":"Ι","Ϊ":"Ι","Ό":"Ο","Ύ":"Υ","Ϋ":"Υ","Ώ":"Ω","ά":"α","έ":"ε","ή":"η","ί":"ι","ϊ":"ι","ΐ":"ι","ό":"ο","ύ":"υ","ϋ":"υ","ΰ":"υ","ω":"ω","ς":"σ"},e}(),OptionList=function(){function e(e){(this._highlightedOption=null)==e&&(e=[]),this._options=e.map(function(e){var t=new Option(e.value,e.label);return e.disabled&&t.disable(),t}),this.highlight()}return e.equalValues=function(e,t){if(e.length!==t.length)return!1;var n=e.slice().sort(),o=t.slice().sort();return n.every(function(e,t){return e===o[t]})},Object.defineProperty(e.prototype,"options",{get:function(){return this._options},enumerable:!0,configurable:!0}),e.prototype.getOptionsByValue=function(t){return this.options.filter(function(e){return e.value===t})},Object.defineProperty(e.prototype,"value",{get:function(){return this.selection.map(function(e){return e.value})},set:function(t){t=null==t?[]:t,this.options.forEach(function(e){e.selected=-1<t.indexOf(e.value)})},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"selection",{get:function(){return this.options.filter(function(e){return e.selected})},enumerable:!0,configurable:!0}),e.prototype.select=function(e,t){t||this.clearSelection(),e.selected=!0},e.prototype.deselect=function(e){e.selected=!1},e.prototype.clearSelection=function(){this.options.forEach(function(e){e.selected=!1})},Object.defineProperty(e.prototype,"filtered",{get:function(){return this.options.filter(function(e){return e.shown})},enumerable:!0,configurable:!0}),e.prototype.filter=function(o){""===o.trim()?this.resetFilter():this.options.forEach(function(e){var t=Diacritics.strip(e.label).toUpperCase(),n=Diacritics.strip(o).toUpperCase();e.shown=-1<t.indexOf(n)}),this.highlight()},e.prototype.resetFilter=function(){this.options.forEach(function(e){e.shown=!0})},Object.defineProperty(e.prototype,"highlightedOption",{get:function(){return this._highlightedOption},enumerable:!0,configurable:!0}),e.prototype.highlight=function(){var e=this.hasShownSelected()?this.getFirstShownSelected():this.getFirstShown();this.highlightOption(e)},e.prototype.highlightOption=function(e){this.clearHighlightedOption(),null!==e&&(e.highlighted=!0,this._highlightedOption=e)},e.prototype.highlightNextOption=function(){var e=this.filtered,t=this.getHighlightedIndexFromList(e);-1<t&&t<e.length-1&&this.highlightOption(e[t+1])},e.prototype.highlightPreviousOption=function(){var e=this.filtered,t=this.getHighlightedIndexFromList(e);0<t&&this.highlightOption(e[t-1])},e.prototype.clearHighlightedOption=function(){null!==this.highlightedOption&&(this.highlightedOption.highlighted=!1,this._highlightedOption=null)},e.prototype.getHighlightedIndexFromList=function(e){for(var t=0;t<e.length;t++)if(e[t].highlighted)return t;return-1},e.prototype.getHighlightedIndex=function(){return this.getHighlightedIndexFromList(this.filtered)},e.prototype.hasShown=function(){return this.options.some(function(e){return e.shown})},e.prototype.hasSelected=function(){return this.options.some(function(e){return e.selected})},e.prototype.hasShownSelected=function(){return this.options.some(function(e){return e.shown&&e.selected})},e.prototype.getFirstShown=function(){try{for(var e=__values(this.options),t=e.next();!t.done;t=e.next()){var n=t.value;if(n.shown)return n}}catch(i){o={error:i}}finally{try{t&&!t.done&&(r=e["return"])&&r.call(e)}finally{if(o)throw o.error}}return null;var o,r},e.prototype.getFirstShownSelected=function(){try{for(var e=__values(this.options),t=e.next();!t.done;t=e.next()){var n=t.value;if(n.shown&&n.selected)return n}}catch(i){o={error:i}}finally{try{t&&!t.done&&(r=e["return"])&&r.call(e)}finally{if(o)throw o.error}}return null;var o,r},e}(),SELECT_VALUE_ACCESSOR={provide:forms.NG_VALUE_ACCESSOR,useExisting:i0.forwardRef(function(){return SelectComponent}),multi:!0},SelectComponent=function(){function e(){this.KEYS={BACKSPACE:8,TAB:9,ENTER:13,ESC:27,SPACE:32,UP:38,DOWN:40},this.allowClear=!1,this.disabled=!1,this.highlightColor="#2196f3",this.highlightTextColor="#fff",this.multiple=!1,this.noFilter=0,this.notFoundMsg="No results found",this.placeholder="",this.opened=new i0.EventEmitter,this.closed=new i0.EventEmitter,this.selected=new i0.EventEmitter,this.deselected=new i0.EventEmitter,this.typed=new i0.EventEmitter,this._value=[],this.hasSelected=!1,this.filterEnabled=!0,this.filterInputWidth=1,this.hasFocus=!1,this.isBelow=!0,this.isDisabled=!1,this.isOpen=!1,this.placeholderView="",this.clearClicked=!1,this.selectContainerClicked=!1,this.onChange=function(e){},this.onTouched=function(){}}return e.prototype.ngOnInit=function(){this.placeholderView=this.placeholder},e.prototype.ngAfterViewInit=function(){this.updateFilterWidth()},e.prototype.ngOnChanges=function(e){if(e.hasOwnProperty("options")&&this.updateOptionsList(e.options.isFirstChange()),e.hasOwnProperty("noFilter")){var t=this.optionList.options.length,n=e.noFilter.currentValue;this.filterEnabled=n<=t}},e.prototype.onWindowClick=function(){this.selectContainerClicked||this.closeDropdown(),this.clearClicked=!1,this.selectContainerClicked=!1},e.prototype.onWindowResize=function(){this.updateWidth()},e.prototype.onSelectContainerClick=function(e){this.selectContainerClicked=!0,this.clearClicked||this.toggleDropdown()},e.prototype.onSelectContainerFocus=function(){this.onTouched()},e.prototype.onSelectContainerKeydown=function(e){this.handleSelectContainerKeydown(e)},e.prototype.onDropdownOptionClicked=function(e){this.multiple?this.toggleSelectOption(e):this.selectOption(e)},e.prototype.onDropdownClose=function(e){this.closeDropdown(e)},e.prototype.onSingleFilterClick=function(){this.selectContainerClicked=!0},e.prototype.onSingleFilterInput=function(e){var t=this;setTimeout(function(){2<e.length&&t.typed.emit(e)},500),this.optionList.filter(e)},e.prototype.onSingleFilterKeydown=function(e){this.handleSingleFilterKeydown(e)},e.prototype.onMultipleFilterInput=function(e){var t=this;this.isOpen||this.openDropdown(),this.updateFilterWidth(),setTimeout(function(){t.optionList.filter(e.target.value)})},e.prototype.onMultipleFilterKeydown=function(e){this.handleMultipleFilterKeydown(e)},e.prototype.onClearSelectionClick=function(e){this.clearClicked=!0,this.clearSelection(),this.closeDropdown(!0)},e.prototype.onDeselectOptionClick=function(e){this.clearClicked=!0,this.deselectOption(e)},e.prototype.open=function(){this.openDropdown()},e.prototype.close=function(){this.closeDropdown()},e.prototype.clear=function(){this.clearSelection()},e.prototype.select=function(e){var t=this;this.optionList.getOptionsByValue(e).forEach(function(e){t.selectOption(e)}),this.valueChanged()},e.prototype.writeValue=function(e){this.value=e},e.prototype.registerOnChange=function(e){this.onChange=e},e.prototype.registerOnTouched=function(e){this.onTouched=e},e.prototype.setDisabledState=function(e){this.disabled=e},Object.defineProperty(e.prototype,"value",{get:function(){return 0===this._value.length?"":this.multiple?this._value:this._value[0]},set:function(e){if(null==e||""===e)e=[];else if("string"==typeof e)e=[e];else if(!Array.isArray(e))throw new TypeError("Value must be a string or an array.");OptionList.equalValues(e,this._value)||(this.optionList.value=e,this.valueChanged())},enumerable:!0,configurable:!0}),e.prototype.valueChanged=function(){this._value=this.optionList.value,this.hasSelected=0<this._value.length,this.placeholderView=this.hasSelected?"":this.placeholder,this.updateFilterWidth(),this.onChange(this.value)},e.prototype.updateOptionsList=function(e){var t;e||(t=this.optionList.value),this.optionList=new OptionList(this.options),e||(this.optionList.value=t,this.valueChanged())},e.prototype.toggleDropdown=function(){this.isDisabled||(this.isOpen?this.closeDropdown(!0):this.openDropdown())},e.prototype.openDropdown=function(){this.isOpen||(this.updateWidth(),this.updatePosition(),this.isOpen=!0,this.multiple&&this.filterEnabled&&this.filterInput.nativeElement.focus(),this.opened.emit(null))},e.prototype.closeDropdown=function(e){void 0===e&&(e=!1),this.isOpen&&(this.clearFilterInput(),this.isOpen=!1,e&&this.focus(),this.closed.emit(null))},e.prototype.selectOption=function(e){e.selected||(this.optionList.select(e,this.multiple),this.valueChanged(),this.selected.emit(e.undecoratedCopy()))},e.prototype.deselectOption=function(e){var t=this;e.selected&&(this.optionList.deselect(e),this.valueChanged(),this.deselected.emit(e.undecoratedCopy()),setTimeout(function(){t.multiple&&(t.updatePosition(),t.optionList.highlight(),t.isOpen&&t.dropdown.moveHighlightedIntoView())}))},e.prototype.clearSelection=function(){var e=this.optionList.selection;0<e.length&&(this.optionList.clearSelection(),this.valueChanged(),1===e.length?this.deselected.emit(e[0].undecoratedCopy()):this.deselected.emit(e.map(function(e){return e.undecoratedCopy()})))},e.prototype.toggleSelectOption=function(e){e.selected?this.deselectOption(e):this.selectOption(e)},e.prototype.selectHighlightedOption=function(){var e=this.optionList.highlightedOption;null!==e&&(this.selectOption(e),this.closeDropdown(!0))},e.prototype.deselectLast=function(){var e=this.optionList.selection;if(0<e.length){var t=e[e.length-1];this.deselectOption(t),this.setMultipleFilterInput(t.label+" ")}},e.prototype.clearFilterInput=function(){this.multiple&&this.filterEnabled?this.filterInput.nativeElement.value="":this.dropdown.clearFilterInput()},e.prototype.setMultipleFilterInput=function(e){this.filterEnabled&&(this.filterInput.nativeElement.value=e)},e.prototype.handleSelectContainerKeydown=function(e){var t=this,n=e.which;this.isOpen?n===this.KEYS.ESC||n===this.KEYS.UP&&e.altKey?this.closeDropdown(!0):n===this.KEYS.TAB?this.closeDropdown():n===this.KEYS.ENTER?this.selectHighlightedOption():n===this.KEYS.UP?(this.optionList.highlightPreviousOption(),this.dropdown.moveHighlightedIntoView(),this.filterEnabled||e.preventDefault()):n===this.KEYS.DOWN&&(this.optionList.highlightNextOption(),this.dropdown.moveHighlightedIntoView(),this.filterEnabled||e.preventDefault()):(n===this.KEYS.ENTER||n===this.KEYS.SPACE||n===this.KEYS.DOWN&&e.altKey)&&setTimeout(function(){t.openDropdown()})},e.prototype.handleMultipleFilterKeydown=function(e){e.which===this.KEYS.BACKSPACE&&this.hasSelected&&this.filterEnabled&&""===this.filterInput.nativeElement.value&&this.deselectLast()},e.prototype.handleSingleFilterKeydown=function(e){var t=e.which;t!==this.KEYS.ESC&&t!==this.KEYS.TAB&&t!==this.KEYS.UP&&t!==this.KEYS.DOWN&&t!==this.KEYS.ENTER||this.handleSelectContainerKeydown(e)},e.prototype.focus=function(){this.hasFocus=!0,this.multiple&&this.filterEnabled?this.filterInput.nativeElement.focus():this.selectionSpan.nativeElement.focus()},e.prototype.blur=function(){this.hasFocus=!1,this.selectionSpan.nativeElement.blur()},e.prototype.updateWidth=function(){this.width=this.selectionSpan.nativeElement.offsetWidth},e.prototype.updatePosition=function(){var e=this.selectionSpan.nativeElement;this.left=e.offsetLeft,this.top=e.offsetTop+e.offsetHeight},e.prototype.updateFilterWidth=function(){if("undefined"!=typeof this.filterInput){var e=this.filterInput.nativeElement.value;this.filterInputWidth=0===e.length?1+10*this.placeholderView.length:1+10*e.length}},e.decorators=[{type:i0.Component,args:[{selector:"ng-select",template:'<div\n #selection\n [attr.tabindex]="disabled ? null : 0"\n [ngClass]="{\n open: isOpen,\n focus: hasFocus,\n below: isBelow,\n disabled: disabled\n }"\n (click)="onSelectContainerClick($event)"\n (focus)="onSelectContainerFocus()"\n (keydown)="onSelectContainerKeydown($event)"\n (window:click)="onWindowClick()"\n (window:resize)="onWindowResize()"\n>\n <div class="single" *ngIf="!multiple">\n <div class="value" *ngIf="optionList.hasSelected()">\n {{ optionList.selection[0].label }}\n </div>\n <div class="placeholder" *ngIf="!optionList.hasSelected()">\n {{ placeholderView }}\n </div>\n <div\n class="clear"\n *ngIf="allowClear"\n (click)="onClearSelectionClick($event)"\n >\n &#x2715;\n </div>\n <div class="toggle" *ngIf="isOpen">&#x25B2;</div>\n <div class="toggle" *ngIf="!isOpen">&#x25BC;</div>\n </div>\n\n <div class="multiple" *ngIf="multiple">\n <div class="option" *ngFor="let option of optionList.selection">\n <span class="deselect-option" (click)="onDeselectOptionClick(option)">\n &#x2715;\n </span>\n {{ option.label }}\n </div>\n <input\n *ngIf="filterEnabled"\n #filterInput\n tabindex="-1"\n [placeholder]="placeholderView"\n [ngStyle]="{ \'width.px\': filterInputWidth }"\n (input)="onMultipleFilterInput($event)"\n (keydown)="onMultipleFilterKeydown($event)"\n />\n </div>\n</div>\n<select-dropdown\n *ngIf="isOpen"\n #dropdown\n [multiple]="multiple"\n [optionList]="optionList"\n [notFoundMsg]="notFoundMsg"\n [highlightColor]="highlightColor"\n [highlightTextColor]="highlightTextColor"\n [filterEnabled]="filterEnabled"\n [width]="width"\n [top]="top"\n [left]="left"\n (close)="onDropdownClose($event)"\n (optionClicked)="onDropdownOptionClicked($event)"\n (singleFilterClick)="onSingleFilterClick()"\n (singleFilterInput)="onSingleFilterInput($event)"\n (singleFilterKeydown)="onSingleFilterKeydown($event)"\n>\n</select-dropdown>\n',styles:[STYLE],providers:[SELECT_VALUE_ACCESSOR],encapsulation:i0.ViewEncapsulation.None}]}],e.propDecorators={options:[{type:i0.Input}],allowClear:[{type:i0.Input}],disabled:[{type:i0.Input}],highlightColor:[{type:i0.Input}],highlightTextColor:[{type:i0.Input}],multiple:[{type:i0.Input}],noFilter:[{type:i0.Input}],notFoundMsg:[{type:i0.Input}],placeholder:[{type:i0.Input}],opened:[{type:i0.Output}],closed:[{type:i0.Output}],selected:[{type:i0.Output}],deselected:[{type:i0.Output}],typed:[{type:i0.Output}],selectionSpan:[{type:i0.ViewChild,args:["selection"]}],dropdown:[{type:i0.ViewChild,args:["dropdown"]}],filterInput:[{type:i0.ViewChild,args:["filterInput"]}]},e}(),STYLE$1="select-dropdown {\n box-sizing: border-box;\n font-family: Sans-Serif;\n}\nselect-dropdown * {\n box-sizing: border-box;\n font-family: Sans-Serif;\n}\nselect-dropdown > div {\n background-color: #fff;\n border: 1px solid #ccc;\n border-top: none;\n box-sizing: border-box;\n position: absolute;\n z-index: 1;\n}\nselect-dropdown > div .filter {\n padding: 3px;\n width: 100%;\n}\nselect-dropdown > div .filter input {\n border: 1px solid #eee;\n box-sizing: border-box;\n padding: 4px;\n width: 100%;\n}\nselect-dropdown > div .options {\n max-height: 200px;\n overflow-y: auto;\n}\nselect-dropdown > div .options ul {\n list-style: none;\n margin: 0;\n padding: 0;\n}\nselect-dropdown > div .options ul li {\n padding: 4px 8px;\n cursor: pointer;\n user-select: none;\n}\nselect-dropdown .selected {\n background-color: #e0e0e0;\n}\nselect-dropdown .selected.highlighted {\n background-color: #2196F3;\n color: #fff;\n}\nselect-dropdown .highlighted {\n background-color: #2196F3;\n color: #fff;\n}\nselect-dropdown .disabled {\n background-color: #fff;\n color: #9e9e9e;\n cursor: default;\n pointer-events: none;\n}",SelectDropdownComponent=function(){function e(){this.close=new i0.EventEmitter,this.optionClicked=new i0.EventEmitter,this.singleFilterClick=new i0.EventEmitter,this.singleFilterInput=new i0.EventEmitter,this.singleFilterKeydown=new i0.EventEmitter,this.disabledColor="#fff",this.disabledTextColor="9e9e9e"}return e.prototype.ngOnInit=function(){this.optionsReset()},e.prototype.ngOnChanges=function(e){e.hasOwnProperty("optionList")&&this.optionsReset()},e.prototype.ngAfterViewInit=function(){this.moveHighlightedIntoView(),!this.multiple&&this.filterEnabled&&this.filterInput.nativeElement.focus()},e.prototype.onSingleFilterClick=function(e){this.singleFilterClick.emit(null)},e.prototype.onSingleFilterInput=function(e){this.singleFilterInput.emit(e.target.value)},e.prototype.onSingleFilterKeydown=function(e){this.singleFilterKeydown.emit(e)},e.prototype.onOptionsWheel=function(e){this.handleOptionsWheel(e)},e.prototype.onOptionMouseover=function(e){this.optionList.highlightOption(e)},e.prototype.onOptionClick=function(e){this.optionClicked.emit(e)},e.prototype.optionsReset=function(){this.optionList.resetFilter(),this.optionList.highlight()},e.prototype.getOptionStyle=function(e){return e.highlighted?{"background-color":this.highlightColor,color:this.highlightTextColor}:{}},e.prototype.clearFilterInput=function(){this.filterEnabled&&(this.filterInput.nativeElement.value="")},e.prototype.moveHighlightedIntoView=function(){var e=this.optionsList.nativeElement,t=e.offsetHeight,n=this.optionList.getHighlightedIndex();if(-1<n){var o=e.children[0].children[n].offsetHeight,r=n*o,i=r+o,a=e.scrollTop;a+t<i?e.scrollTop=i-t:r<a&&(e.scrollTop=r)}},e.prototype.handleOptionsWheel=function(e){var t=this.optionsList.nativeElement,n=0===t.scrollTop,o=t.offsetHeight+t.scrollTop===t.scrollHeight;n&&e.deltaY<0?e.preventDefault():o&&0<e.deltaY&&e.preventDefault()},e.decorators=[{type:i0.Component,args:[{selector:"select-dropdown",template:'<div [ngStyle]="{ \'top.px\': top, \'left.px\': left, \'width.px\': width }">\n <div class="filter" *ngIf="!multiple">\n <input\n *ngIf="filterEnabled"\n #filterInput\n (click)="onSingleFilterClick($event)"\n (input)="onSingleFilterInput($event)"\n (keydown)="onSingleFilterKeydown($event)"\n />\n </div>\n\n <div class="options" #optionsList>\n <ul (wheel)="onOptionsWheel($event)">\n <li\n *ngFor="let option of optionList.filtered"\n [ngClass]="{\n highlighted: option.highlighted,\n selected: option.selected,\n disabled: option.disabled\n }"\n [ngStyle]="getOptionStyle(option)"\n (click)="onOptionClick(option)"\n (mouseover)="onOptionMouseover(option)"\n >\n {{ option.label }}\n </li>\n <li *ngIf="!optionList.hasShown()" class="message">\n {{ notFoundMsg }}\n </li>\n </ul>\n </div>\n</div>\n',styles:[STYLE$1],encapsulation:i0.ViewEncapsulation.None}]}],e.propDecorators={filterEnabled:[{type:i0.Input}],highlightColor:[{type:i0.Input}],highlightTextColor:[{type:i0.Input}],left:[{type:i0.Input}],multiple:[{type:i0.Input}],notFoundMsg:[{type:i0.Input}],optionList:[{type:i0.Input}],top:[{type:i0.Input}],width:[{type:i0.Input}],close:[{type:i0.Output}],optionClicked:[{type:i0.Output}],singleFilterClick:[{type:i0.Output}],singleFilterInput:[{type:i0.Output}],singleFilterKeydown:[{type:i0.Output}],filterInput:[{type:i0.ViewChild,args:["filterInput"]}],optionsList:[{type:i0.ViewChild,args:["optionsList"]}]},e}(),SelectModule=function(){function e(){}return e.decorators=[{type:i0.NgModule,args:[{declarations:[SelectComponent,SelectDropdownComponent],exports:[SelectComponent],imports:[common.CommonModule,forms.FormsModule]}]}],e}(),SecurePipe=function(){function e(e,t){this._ref=e,this.sanitizer=t,this._latestValue=null,this._latestReturnedValue=null,this._subscription=null,this._obj=null,this._result=new rxjs.BehaviorSubject(null),this.result=this._result.asObservable(),this._internalSubscription=null}return e.prototype.ngOnDestroy=function(){this._subscription&&this._dispose()},e.prototype.transform=function(e,t){this.getfile=t;var n=this.internalTransform(e);return this.asyncTrasnform(n)},e.prototype.internalTransform=function(e){var n=this;return e&&this.previousUrl!==e&&(this.previousUrl=e,this._internalSubscription=this.getfile(e).subscribe(function(e){var t=n.sanitizer.bypassSecurityTrustUrl(e);n._result.next(t)})),this.result},e.prototype.asyncTrasnform=function(e){return this._obj?e!==this._obj?(this._dispose(),this.asyncTrasnform(e)):this._latestValue===this._latestReturnedValue?this._latestReturnedValue:(this._latestReturnedValue=this._latestValue,i0.WrappedValue.wrap(this._latestValue)):(e&&this._subscribe(e),this._latestReturnedValue=this._latestValue,this._latestValue)},e.prototype._subscribe=function(t){var n=this;this._obj=t,this._subscription=t.subscribe({next:function(e){return n._updateLatestValue(t,e)},error:function(e){throw e}})},e.prototype._dispose=function(){this._subscription&&this._subscription.unsubscribe(),this._internalSubscription&&this._internalSubscription.unsubscribe(),this._internalSubscription=null,this._latestValue=null,this._latestReturnedValue=null,this._subscription=null,this._obj=null},e.prototype._updateLatestValue=function(e,t){e===this._obj&&(this._latestValue=t,this._ref.markForCheck())},e.decorators=[{type:i0.Pipe,args:[{name:"secure",pure:!1}]}],e.ctorParameters=function(){return[{type:i0.ChangeDetectorRef},{type:platformBrowser.DomSanitizer}]},e}(),SharedModule=function(){function e(){}return e.decorators=[{type:i0.NgModule,args:[{declarations:[SecurePipe],imports:[common.CommonModule],exports:[SecurePipe],providers:[DataSources]}]}],e}(),FileUploadComponent=function(){function e(e){this.renderer=e,this.uploading=!1,this.fileUuid=null,this.pdfUploaded=!1,this.formEntryMode=!0,this.propagateChange=function(e){}}return Object.defineProperty(e.prototype,"dataSource",{get:function(){return this._dataSource},set:function(e){this._dataSource=e},enumerable:!0,configurable:!0}),e.prototype.ngOnInit=function(){this.fileUuid&&this.checkFileType()},e.prototype.onFileChange=function(e){try{for(var t=__values(e),n=t.next();!n.done;n=t.next()){var o=n.value;this.upload(o)}}catch(a){r={error:a}}finally{try{n&&!n.done&&(i=t["return"])&&i.call(t)}finally{if(r)throw r.error}}var r,i},e.prototype.upload=function(e){var t=this;this.dataSource&&(this.uploading=!0,this.dataSource.fileUpload(e).subscribe(function(e){t.fileUuid=e.image,t.checkFileType(),t.propagateChange(t.fileUuid),t.uploading=!1},function(e){t.uploading=!1}))},e.prototype.writeValue=function(e){e!==this.fileUuid&&(this.fileUuid=e,this.checkFileType())},e.prototype.registerOnChange=function(e){this.propagateChange=e},e.prototype.registerOnTouched=function(){},e.prototype.onChange=function(e){this.propagateChange(e.id)},e.prototype.clearValue=function(){this.fileUuid=null,this.pdfUploaded=!1,this.pdfUrl=null,this.propagateChange(this.fileUuid)},e.prototype.getPdfUrl=function(e){var t=this;this.dataSource.fetchFile(e,"pdf").subscribe(function(e){t.pdfUploaded=!0,t.pdfUrl=e.changingThisBreaksApplicationSecurity})},e.prototype.checkFileType=function(){-1!==this.fileUuid.search(/pdf/gi)&&this.getPdfUrl(this.fileUuid)},e.decorators=[{type:i0.Component,args:[{selector:"app-file-upload",template:'<lib-file-uploader\n [srcUrl]="pdfUrl"\n [formEntry]="formEntryMode"\n [(ngModel)]="fileUuid"\n (_onClear)="clearValue()"\n (uploadData)="onFileChange($event)"\n>\n</lib-file-uploader>\n<div *ngIf="fileUuid">\n <img\n *ngIf="!pdfUploaded"\n class="img-responsive"\n [src]="fileUuid | secure: this.dataSource.fetchFile"\n alt=""\n />\n</div>\n',providers:[{provide:forms.NG_VALUE_ACCESSOR,useExisting:i0.forwardRef(function(){return e}),multi:!0}],styles:["\n img {\n margin-left: auto;\n margin-right: auto;\n display: block;\n }\n "]}]}],e.ctorParameters=function(){return[{type:i0.Renderer2}]},e.propDecorators={dataSource:[{type:i0.Input}]},e}(),RemoteFileUploadModule=function(){function e(){}return e.decorators=[{type:i0.NgModule,args:[{imports:[common.CommonModule,SelectModule,forms.FormsModule,SharedModule,ngxWebcam.WebcamModule,ngxFileUploader.NgxFileUploaderModule],exports:[FileUploadComponent],declarations:[FileUploadComponent],providers:[]}]}],e}(),moment$1=moment_,DatePickerComponent=function(){function e(){this.locale="en",this.viewFormat="ll",this.returnObject="js",this.onDatePickerCancel=new i0.EventEmitter,this.onSelectDate=new i0.EventEmitter,this.onDisplayMonths=!1,this.onDisplayYears=!1,this.displayYearsIndex=0,this.monthsShort=moment$1.monthsShort()}return e.prototype.ngOnInit=function(){var n=this;this.initValue(),_.each(this.fullYearRange,function(e,t){n.currentYear=n.calendarDate.clone().startOf("year").year(),-1!==e.indexOf(n.currentYear)&&(n.displayYearsIndex=t)}),this.displayYearRange=this.fullYearRange[this.displayYearsIndex],this.generateCalendar()},e.prototype.prev=function(){this.onDisplayYears?(this.displayYearsIndex--,this.displayYearsIndex<0&&(this.displayYearsIndex=0),this.displayYearRange=this.fullYearRange[this.displayYearsIndex]):this.calendarDate=this.calendarDate.clone().subtract(1,"M"),this.generateCalendar()},e.prototype.showMonthSelection=function(){this.onDisplayMonths=!0,this.onDisplayYears=!1},e.prototype.showYearSelection=function(){this.onDisplayYears=!0,this.onDisplayMonths=!1},e.prototype.next=function(){this.onDisplayYears?(this.displayYearsIndex++,this.displayYearsIndex>=this.fullYearRange.length&&(this.displayYearsIndex=this.fullYearRange.length-1),this.displayYearRange=this.fullYearRange[this.displayYearsIndex++]):this.calendarDate=this.calendarDate.clone().add(1,"M"),this.generateCalendar()},e.prototype.selectDay=function(e){var t=e.diff(this.calendarDate.clone().startOf("date"),"days");e=this.calendarDate.clone().add(t,"d");var n=this.parseToReturnObjectType(e);this.onSelectDate.emit(n),this.cancelDatePicker()},e.prototype.selectMonth=function(e){this.calendarDate=this.calendarDate.clone().month(e),this.onDisplayMonths=!1,this.generateCalendar()},e.prototype.selectYear=function(e){this.calendarDate=this.calendarDate.clone().year(e),this.onDisplayYears=!1,this.generateCalendar()},e.prototype.selectToday=function(){var e=this.parseToReturnObjectType(moment$1());this.onSelectDate.emit(e),this.cancelDatePicker()},e.prototype.clearPickDate=function(){this.onSelectDate.emit(null),this.cancelDatePicker()},e.prototype.cancelDatePicker=function(){this.onDatePickerCancel.emit(!1)},e.prototype.generateYears=function(){for(var e=moment$1().year(),t=[],n=this.calendarDate.clone().subtract(100,"y").year();n<=e;n++)t.push(n);this.fullYearRange=_.chunk(t,14)},e.prototype.initValue=function(){moment$1.locale(this.locale),this.today=moment$1().startOf("date"),this.currentMonth=this.monthsShort[moment$1().month()],this.currentYear=moment$1().year(),this.dayNames=moment$1.weekdaysShort(!0),this.initDate?(this.calendarDate="string"===this.returnObject?moment$1(this.initDate,this.viewFormat):moment$1(this.initDate),this.selectedDate=this.calendarDate.clone().startOf("date")):this.calendarDate=moment$1(),this.generateYears()},e.prototype.generateCalendar=function(){this.calendarDays=[];for(var e=0-(this.calendarDate.clone().startOf("month").day()+(7-moment$1.localeData().firstDayOfWeek()))%7,t=41+e,n=e;n<=t;n+=1){var o=this.calendarDate.clone().startOf("month").add(n,"days");this.calendarDays.push(o)}},e.prototype.parseToReturnObjectType=function(e){switch(this.returnObject){case"js":return e.toDate();case"string":return e.format(this.viewFormat);case"moment":return e;case"json":return e.toJSON();case"array":return e.toArray();case"iso":return e.toISOString();case"object":return e.toObject();default:return e}},e.decorators=[{type:i0.Component,args:[{selector:"date-picker",template:'<picker-modal (onOverlayClick)="cancelDatePicker()">\n <div class="picker-wrap">\n <div class="picker-box">\n <div class="picker-header">\n <div class="picker-header-nav">\n <span class="nav-prev" (click)="prev()"></span>\n </div>\n <div class="picker-header-content">\n <div class="content">\n <span (click)="showMonthSelection()" class="month">{{\n calendarDate | moment: \'MMMM\'\n }}</span>\n <span class="seperator">|</span>\n <span (click)="showYearSelection()" class="year">{{\n calendarDate | moment: \'YYYY\'\n }}</span>\n </div>\n </div>\n <div class="picker-header-nav">\n <span class="nav-next" (click)="next()"></span>\n </div>\n </div>\n <div class="picker-calendar">\n <div\n class="picker-calendar-row"\n *ngIf="!onDisplayMonths && !onDisplayYears"\n >\n <span class="picker-weekday" *ngFor="let day of dayNames">{{\n day\n }}</span>\n </div>\n <div\n class="picker-calendar-row"\n *ngIf="!onDisplayMonths && !onDisplayYears"\n >\n <span\n class="picker-day"\n (click)="selectDay(day)"\n [ngClass]="{\n \'out-focus\': day.month() != calendarDate.month(),\n today: day.isSame(today),\n selected: day.isSame(selectedDate)\n }"\n *ngFor="let day of calendarDays"\n >\n {{ day | moment: \'D\' }}\n </span>\n </div>\n <div class="picker-calendar-row" *ngIf="onDisplayMonths">\n <span\n class="picker-month"\n *ngFor="let month of monthsShort"\n (click)="selectMonth(month)"\n [ngClass]="{\n selected: month === currentMonth\n }"\n >\n {{ month }}\n </span>\n </div>\n <div class="picker-calendar-row" *ngIf="onDisplayYears">\n <span\n class="picker-year"\n *ngFor="let year of displayYearRange"\n (click)="selectYear(year)"\n [ngClass]="{\n selected: year === currentYear\n }"\n >\n {{ year }}\n </span>\n </div>\n </div>\n <div class="picker-footer">\n <div class="picker-action action-today" (click)="selectToday()">\n <span class="text">Today</span>\n </div>\n <div class="picker-action action-clear" (click)="clearPickDate()">\n <span class="text">Clear</span>\n </div>\n <div class="picker-action action-close" (click)="cancelDatePicker()">\n <span class="text">Close</span>\n </div>\n </div>\n </div>\n </div>\n</picker-modal>\n',styles:["*,::after,::before{box-sizing:border-box}.picker-wrap{width:95vw;max-width:666px}.picker-box{font-family:'Open Sans';min-width:400px!important;padding:.625rem 1rem;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.picker-footer,.picker-header{font-size:1.333rem;line-height:2.5rem;display:flex;height:2.5rem;width:100%}.picker-header-nav{position:relative;cursor:pointer;width:calc(100% / 8)}.picker-header-nav>*{position:absolute;top:50%;right:auto;bottom:auto;left:50%;-webkit-transform:translate(-50%,-50%);transform:translate(-50%,-50%)}.picker-header-nav .nav-next::before,.picker-header-nav .nav-prev::before{content:' ';border-top:.5em solid transparent;border-bottom:.5em solid transparent;border-right:.75em solid #000;width:0;height:0;display:block;margin:0 auto}.picker-header-nav .nav-next::before{border-right:0;border-left:.75em solid #000}.picker-header-content{width:calc(100% * 6 / 8);text-align:center}.picker-header-content .month{font-size:1.778rem;line-height:2.5rem;margin-right:.5rem;font-weight:700}.picker-header-content .year{font-style:italic;color:#999}.picker-calendar{width:100%}.picker-calendar .picker-calendar-row{display:flex;flex-wrap:wrap;width:100%;margin-bottom:.625rem}.picker-calendar .picker-weekday{font-weight:700;text-align:left;color:#999;width:calc(100% / 7)}.picker-calendar .picker-day,.picker-calendar .picker-month,.picker-calendar .picker-year{font-size:1.333rem;line-height:2.5rem;position:relative;height:2.5rem;text-align:center;cursor:pointer;width:calc(100% / 7)}.picker-calendar .picker-day:hover,.picker-calendar .picker-month:hover,.picker-calendar .picker-year:hover{background:#b1dcfb}.picker-calendar .out-focus{color:#ddd}.picker-calendar .out-focus:hover{color:#000}.picker-calendar .selected{background:#0089ec;color:#fff}.picker-calendar .selected:hover{background:#0089ec}.picker-calendar .today::before{content:' ';position:absolute;top:2px;right:2px;width:0;height:0;border-top:.5em solid #0059bc;border-left:.5em solid transparent}.picker-footer{cursor:pointer}.picker-footer .picker-action{text-align:center;width:calc(100% / 3)}.picker-footer .picker-action:hover{background-color:#b1dcfb}.picker-footer .picker-action .text{padding-left:.8rem}.picker-footer .action-clear::before,.picker-footer .action-close::before,.picker-footer .action-today::before{content:' ';position:relative;display:inline-block;height:0;width:0}.picker-footer .action-today::before{border-top:.66em solid #0059bc;border-left:.66em solid transparent}.picker-footer .action-clear::before{top:-.5rem;width:1rem;border-top:3px solid #e20}.picker-footer .action-close::before{width:1rem;height:1rem;background:linear-gradient(to bottom,transparent 35%,#777 35%,#777 65%,transparent 65%),linear-gradient(to right,transparent 35%,#777 35%,#777 65%,transparent 65%);-webkit-transform:rotate(45deg);transform:rotate(45deg)}"]}]}],e.ctorParameters=function(){return[]},e.propDecorators={initDate:[{type:i0.Input}],locale:[{type:i0.Input}],viewFormat:[{type:i0.Input}],returnObject:[{type:i0.Input}],onDatePickerCancel:[{type:i0.Output}],onSelectDate:[{type:i0.Output}]},e}(),moment$2=moment_,TimePickerComponent=function(){function e(){this.showSecond=!0,this.viewFormat="hh:mm A",this.use12Hour=!1,this.returnObject="js",this.onSelectTime=new i0.EventEmitter,this.onTimePickerCancel=new i0.EventEmitter,this.hourFormat="HH"}return e.prototype.ngOnInit=function(){this.use12Hour&&(this.hourFormat="hh"),this.time=this.initTime?moment$2(this.initTime,this.viewFormat):moment$2(),this.initTime?this.time="string"===this.returnObject?moment$2(this.initTime,this.viewFormat):moment$2(this.initTime):this.time=moment$2()},e.prototype.increaseHour=function(){this.time=this.time.clone().add(1,"h")},e.prototype.decreaseHour=function(){this.time=this.time.clone().subtract(1,"h")},e.prototype.increaseMinute=function(){this.time=this.time.clone().add(1,"m")},e.prototype.decreaseMinute=function(){this.time=this.time.clone().subtract(1,"m")},e.prototype.increaseSecond=function(){this.time=this.time.clone().add(1,"s")},e.prototype.decreaseSecond=function(){this.time=this.time.clone().subtract(1,"s")},e.prototype.selectTime=function(){var e=this.parseToReturnObjectType(this.time);this.onSelectTime.emit(e),this.cancelTimePicker()},e.prototype.selectNow=function(){var e=this.parseToReturnObjectType(moment$2());this.onSelectTime.emit(e),this.cancelTimePicker()},e.prototype.clearTime=function(){this.onSelectTime.emit(null),this.cancelTimePicker()},e.prototype.cancelTimePicker=function(){this.onTimePickerCancel.emit(!1)},e.prototype.parseToReturnObjectType=function(e){switch(this.returnObject){case"js":return e.toDate();case"string":return e.format(this.viewFormat);case"moment":return e;case"json":return e.toJSON();case"array":return e.toArray();case"iso":return e.toISOString();case"object":return e.toObject();default:return e}},e.decorators=[{type:i0.Component,args:[{selector:"time-picker",template:'<picker-modal (onOverlayClick)="cancelTimePicker()">\n <div class="picker-wrap">\n <div class="picker-box">\n <div class="picker-header">Time Picker</div>\n <div class="picker-table">\n <ul class="picker-table-time">\n <li class="picker-table-number hour">\n <span class="arrow up" (click)="increaseHour()"></span>\n {{ time | moment: hourFormat }}\n <span class="arrow down" (click)="decreaseHour()"></span>\n </li>\n <li class="picker-table-separator">:</li>\n <li class="picker-table-number minute">\n <span class="arrow up" (click)="increaseMinute()"></span>\n {{ time | moment: \'mm\' }}\n <span class="arrow down" (click)="decreaseMinute()"></span>\n </li>\n <li *ngIf="showSecond" class="picker-table-separator">:</li>\n <li *ngIf="showSecond" class="picker-table-number second">\n <span class="arrow up" (click)="increaseSecond()"></span>\n {{ time | moment: \'ss\' }}\n <span class="arrow down" (click)="decreaseSecond()"></span>\n </li>\n <li *ngIf="use12Hour" class="picker-table-meridiem meridiem">\n {{ time | moment: \'A\' }}\n </li>\n </ul>\n </div>\n <div class="picker-footer">\n <div class="picker-action action-now" (click)="selectNow()">\n <span class="text">Now</span>\n </div>\n <div class="picker-action action-confirm" (click)="selectTime()">\n <span class="text">Confirm</span>\n </div>\n <div class="picker-action action-clear" (click)="clearTime()">\n <span class="text">Clear</span>\n </div>\n <div class="picker-action action-close" (click)="cancelTimePicker()">\n <span class="text">Close</span>\n </div>\n </div>\n </div>\n </div>\n</picker-modal>\n',styles:["*,::after,::before{box-sizing:border-box}.picker-wrap{width:95vw;max-width:40rem;font-family:'Open Sans'}.picker-box{width:100%;padding:.625rem 1rem;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.picker-footer,.picker-header{font-size:1.333rem;line-height:2.5rem;height:2.5rem;width:100%}.picker-header{text-align:center}.picker-table{width:100%;margin:2.5rem 0}.picker-table-time{font-size:2.37rem;line-height:2.5rem;list-style:none;margin:0;padding:0;display:flex;justify-content:center;width:100%;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.picker-table-meridiem,.picker-table-number,.picker-table-separator{text-align:center}.picker-table-meridiem,.picker-table-number{position:relative;width:20%}.arrow{position:absolute;left:50%;border:solid #777;border-width:0 .2rem .2rem 0;display:inline-block;padding:.25rem;cursor:pointer}.arrow.up{top:-1rem;-webkit-transform:translateX(-50%) rotate(-135deg);transform:translateX(-50%) rotate(-135deg)}.arrow.down{bottom:-1rem;-webkit-transform:translateX(-50%) rotate(45deg);transform:translateX(-50%) rotate(45deg)}.arrow:hover{border-color:#1975d2}.picker-table-separator{width:calc(20% / 3)}.picker-footer{display:flex;justify-content:center;width:100%;cursor:pointer}.picker-footer .picker-action{width:25%;text-align:center}.picker-footer .picker-action:hover{background-color:#b1dcfb}.picker-footer .picker-action .text{padding-left:.8rem}.picker-footer .action-clear::before,.picker-footer .action-close::before,.picker-footer .action-confirm::before,.picker-footer .action-now::before{content:' ';position:relative;display:inline-block;height:0;width:0}.picker-footer .action-now::before{border-top:.66em solid #0059bc;border-left:.66em solid transparent}.picker-footer .action-confirm::before{width:1rem;height:1rem;border-radius:100%;background-color:#00b5ad}.picker-footer .action-clear::before{top:-.5rem;width:1rem;border-top:3px solid #e20}.picker-footer .action-close::before{width:1rem;height:1rem;background:linear-gradient(to bottom,transparent 35%,#777 35%,#777 65%,transparent 65%),linear-gradient(to right,transparent 35%,#777 35%,#777 65%,transparent 65%);-webkit-transform:rotate(45deg);transform:rotate(45deg)}"]}]}],e.ctorParameters=function(){return[]},e.propDecorators={initTime:[{type:i0.Input}],showSecond:[{type:i0.Input}],viewFormat:[{type:i0.Input}],use12Hour:[{type:i0.Input}],returnObject:[{type:i0.Input}],onSelectTime:[{type:i0.Output}],onTimePickerCancel:[{type:i0.Output}]},e}(),ModalComponent=function(){function e(){this.onOverlayClick=new i0.EventEmitter}return e.prototype.ngOnInit=function(){},e.prototype.closeModal=function(){this.onOverlayClick.emit(!1)},e.decorators=[{type:i0.Component,args:[{selector:"picker-modal",template:'<section class="x-modal">\n <section class="modal-overlay" (click)="closeModal()"></section>\n <section class="modal-main" id="section-modal-main">\n <ng-content></ng-content>\n </section>\n</section>\n',styles:[":host{z-index:9999999999}*,::after,::before{box-sizing:border-box}.modal-main{position:absolute;left:19.6%;right:auto;top:auto;z-index:111;background-color:#fff;border:1px solid #d7dad7;border-radius:6px;-webkit-transform:translate(-50%,0);transform:translate(-50%,0);box-shadow:0 5px 15px rgba(0,0,0,.3)}"],changeDetection:i0.ChangeDetectionStrategy.OnPush,animations:[]}]}],e.ctorParameters=function(){return[]},e.propDecorators={onOverlayClick:[{type:i0.Output}]},e}(),MomentPipe=function(){function e(){}return e.prototype.transform=function(e,t){return t?e.format(t):e.format("MMM DD, YYYY")},e.decorators=[{type:i0.Pipe,args:[{name:"moment"}]}],e}(),Moment=moment_,DateTimePickerComponent=function(){function e(){this.showDate=!0,this.showTime=!1,this.showWeeks=!1,this.weeks=[2,4,6,8,12,16,24],this.onDateChange=new i0.EventEmitter,this.showDatePicker=!1,this.showTimePicker=!1,this.onChange=function(){},this.onTouched=function(){}}return e.prototype.ngOnInit=function(){},e.prototype.weeksSelected=function(e){var t=new Date,n=t.setDate(t.getDate()+7*e);this.value=Moment(n).format()},e.prototype.setDate=function(e){this.value=e&&""!==e?Moment(e).format():e},e.prototype.setTime=function(e){this.value=e&&""!==e?Moment(e).format():e},e.prototype.toggleDatePicker=function(e){this.showDatePicker=e},e.prototype.toggleTimePicker=function(e){this.showTimePicker=e},Object.defineProperty(e.prototype,"value",{get:function(){return this.modelValue},set:function(e){this.modelValue=e,this.onDateChange.emit(e),this.onChange(e),this.onTouched()},enumerable:!0,configurable:!0}),e.prototype.registerOnChange=function(e){this.onChange=e},e.prototype.registerOnTouched=function(e){this.onTouched=e},e.prototype.writeValue=function(e){e instanceof Date?this.value=Moment(e).format():this.value=e},e.decorators=[{type:i0.Component,args:[{selector:"date-time-picker",template:'<div class="row">\n <div *ngIf="!showTime" class="col-xs-12 col-md-12">\n <input\n *ngIf="!showWeeks"\n type="text"\n class="form-control"\n [value]="value | date: \'mediumDate\'"\n (focus)="toggleDatePicker(true)"\n readonly\n placeholder="Select Date"\n />\n <div *ngIf="showWeeks" class="input-group">\n <input\n type="text"\n class="form-control"\n class="form-control"\n [value]="value | date: \'mediumDate\'"\n (focus)="toggleDatePicker(true)"\n readonly\n placeholder="Select Date"\n />\n <div class="input-group-btn">\n <button\n type="button"\n class="btn btn-default dropdown-toggle"\n data-toggle="dropdown"\n aria-haspopup="true"\n aria-expanded="false"\n >\n Weeks <span class="caret"></span>\n </button>\n <ul class="dropdown-menu up">\n <li (click)="weeksSelected(count)" *ngFor="let count of weeks">\n <span> {{ count }} Weeks</span>\n </li>\n </ul>\n </div>\n </div>\n </div>\n <div *ngIf="showTime" class="col-xs-8 col-md-8">\n <input\n *ngIf="!showWeeks"\n type="text"\n class="form-control"\n [value]="value | date: \'mediumDate\'"\n (focus)="toggleDatePicker(true)"\n readonly\n placeholder="Select Date"\n />\n <div *ngIf="showWeeks" class="input-group">\n <input\n type="text"\n class="form-control"\n class="form-control"\n [value]="value | date: \'mediumDate\'"\n (focus)="toggleDatePicker(true)"\n readonly\n placeholder="Select Date"\n />\n <div class="input-group-btn">\n <button\n type="button"\n class="btn btn-default dropdown-toggle"\n data-toggle="dropdown"\n aria-haspopup="true"\n aria-expanded="false"\n >\n Weeks <span class="caret"></span>\n </button>\n <ul class="dropdown-menu up">\n <li (click)="weeksSelected(count)" *ngFor="let count of weeks">\n <span> {{ count }} Weeks</span>\n </li>\n </ul>\n </div>\n </div>\n </div>\n <div *ngIf="showTime" class="col-xs-4 col-md-4">\n <input\n type="text"\n class="form-control"\n [value]="value | date: \'shortTime\'"\n (focus)="toggleTimePicker(true)"\n readonly\n placeholder="Select Time"\n />\n </div>\n</div>\n<date-picker\n *ngIf="showDatePicker"\n [initDate]="value"\n (onSelectDate)="setDate($event)"\n (onDatePickerCancel)="toggleDatePicker($event)"\n></date-picker>\n\n<time-picker\n *ngIf="showTimePicker"\n [initTime]="value"\n [use12Hour]="true"\n (onSelectTime)="setTime($event)"\n (onTimePickerCancel)="toggleTimePicker($event)"\n></time-picker>\n',styles:["input[readonly]{background-color:#fff}.up{bottom:100%!important;top:auto!important}.glyphicon{top:1px}"],providers:[{provide:forms.NG_VALUE_ACCESSOR,useExisting:i0.forwardRef(function(){return e}),multi:!0}]}]}],e.ctorParameters=function(){return[]},e.propDecorators={modelValue:[{type:i0.Input}],showDate:[{type:i0.Input}],showTime:[{type:i0.Input}],showWeeks:[{type:i0.Input}],weeks:[{type:i0.Input}],onDateChange:[{type:i0.Output}]},e}(),DateTimePickerModule=function(){function e(){}return e.decorators=[{type:i0.NgModule,args:[{imports:[common.CommonModule,forms.FormsModule],declarations:[DatePickerComponent,TimePickerComponent,ModalComponent,MomentPipe,DateTimePickerComponent],exports:[DatePickerComponent,TimePickerComponent,ModalComponent,MomentPipe,DateTimePickerComponent],providers:[]}]}],e}(),moment$3=moment_,MY_FORMATS={parse:{dateInput:"LL"},display:{dateInput:"LL",monthYearLabel:"MMM YYYY",dateA11yLabel:"LL",monthYearA11yLabel:"MMMM YYYY"}},NgxDateTimePickerComponent=function(){function e(){this.selectedTime=moment$3().format(),this.selectedDate=moment$3().format(),this.loadInitial=!1,this.showTimePicker=!1,this.weeks=[0,2,4,6,8,12,16,24],this.showTime=!1,this.showWeeks=!0,this.onDateChange=new i0.EventEmitter,this.onChange=function(){},this.onTouched=function(){}}return e.prototype.ngOnInit=function(){},e.prototype.writeValue=function(e){this.value=e},e.prototype.registerOnChange=function(e){this.onChange=e},e.prototype.registerOnTouched=function(e){},e.prototype.onTimeSelect=function(e){var t=moment$3(this.selectedDate),n=e;this.setDateTime(t,n)},e.prototype.onDateSelect=function(e){var t=moment$3(e.value),n=this.selectedTime,o=this.setDateTime(t,n);e.value;this.value=o},e.prototype.toggleTimePicker=function(e){this.showTimePicker=e},e.prototype.setCurrentTime=function(){var e=moment$3(this.selectedDate),t=moment$3().format("HH:mm:ss");this.setDateTime(e,t)},e.prototype.weekSelect=function(e){var t=moment$3().format(),n=moment$3(t).add(e.value,"days"),o=t;this.setDateTime(n,o)},e.prototype.selectionChange=function(e){console.log("Week selected",e)},e.prototype.getWeekPickerCssClass=function(){return this.showTime?"col-sm-2 form-group":"col-sm-3 form-group"},e.prototype.getDatePickerCssClass=function(){return this.showTime&&this.showWeeks?"col-sm-5 form-group":!0===this.showWeeks?"col-sm-9 form-group":!0===this.showTime?"col-sm-8 form-group":"col-sm-12 form-group"},e.prototype.getTimePickerCssClass=function(){return this.showTime&&this.showWeeks?"col-sm-5 form-group":!0===this.showWeeks?"col-sm-9 form-group":"col-sm-4 form-group"},e.prototype.setDateTime=function(e,t){var n,o=moment$3(e).format("DD-MM-YYYY");n=this.showTime?moment$3(t).format("HH:mm:ss"):"00:00:00";var r=moment$3(o+""+n,"DD-MM-YYYY HH:mm:ss"),i=moment$3(r).format();return this.selectedDate=i,this.selectedTime=i,this.value=i,this.onChange(this.value),i},e.decorators=[{type:i0.Component,args:[{selector:"ngx-date-time-picker",template:'<div>\n <div class="row">\n <div [class]="getDatePickerCssClass()">\n <div class="input-group">\n <input\n matInput\n [matDatepicker]="picker"\n class="form-control"\n [value]="value"\n placeholder="Choose a date"\n (dateChange)="onDateSelect($event)"\n (click)="picker.open()"\n readonly\n />\n <mat-datepicker #picker disabled="false"></mat-datepicker>\n <mat-datepicker-toggle\n matSuffix\n [for]="picker"\n class="input-group-btn"\n ></mat-datepicker-toggle>\n </div>\n </div>\n <div [class]="getWeekPickerCssClass()" *ngIf="showWeeks">\n <mat-select\n placeholder="Select Days"\n class="form-control"\n name="weeks"\n (selectionChange)="weekSelect($event)"\n >\n <mat-option *ngFor="let count of weeks" [value]="count">\n {{ count }} Days\n </mat-option>\n </mat-select>\n </div>\n <div [class]="getTimePickerCssClass()" *ngIf="showTime">\n <input\n type="text"\n class="form-control"\n [value]="value | date: \'shortTime\'"\n (focus)="toggleTimePicker(true)"\n readonly\n placeholder="Select Time"\n />\n <time-picker\n *ngIf="showTimePicker"\n [initTime]="value"\n [use12Hour]="true"\n (onSelectTime)="onTimeSelect($event)"\n (onTimePickerCancel)="toggleTimePicker($event)"\n ></time-picker>\n </div>\n </div>\n</div>\n',styles:["#time-section{display:inline-block}#ngx-atp-time-picker,#ngx-mat-form-field{width:100%}.up{bottom:100%!important;top:auto!important}.time-btn{margin-top:-20px}"],providers:[{provide:core.MAT_DATE_FORMATS,useValue:MY_FORMATS},{provide:core.DateAdapter,useClass:materialMomentAdapter.MomentDateAdapter},{provide:forms.NG_VALUE_ACCESSOR,useExisting:i0.forwardRef(function(){return e}),multi:!0}]}]}],e.propDecorators={weeks:[{type:i0.Input}],modelValue:[{type:i0.Input}],showTime:[{type:i0.Input}],showWeeks:[{type:i0.Input}],onDateChange:[{type:i0.Output}]},e}(),NgxDateTimePickerModule=function(){function e(){}return e.decorators=[{type:i0.NgModule,args:[{imports:[common.CommonModule,forms.FormsModule,forms.ReactiveFormsModule,datepicker.MatDatepickerModule,formField.MatFormFieldModule,material.MatNativeDateModule,material.MatInputModule,DateTimePickerModule,select.MatSelectModule],declarations:[NgxDateTimePickerComponent],exports:[datepicker.MatDatepickerModule,formField.MatFormFieldModule,material.MatNativeDateModule,material.MatInputModule,NgxDateTimePickerComponent],providers:[]}]}],e}(),Option$1=function Kn(e){this.label=e.label,this.value=e.value},AfeNgSelectComponent=function(){function e(){this.question_options=[],this.errors=[],this.propagateChange=function(e){}}return e.prototype.getChangingText=function(e){var t=this;this.getData(e).subscribe(function(e){t.question_options=e})},e.prototype.writeValue=function(e){},e.prototype.registerOnChange=function(e){this.propagateChange=e},e.prototype.registerOnTouched=function(e){},e.prototype.ngOnChanges=function(e){},e.prototype.ngOnInit=function(){var t=this;this.extras&&this.extras.originalValue&&this.resolveSelectedOption(this.extras.originalValue).subscribe(function(e){t.selected_question_option=e})},e.prototype.getData=function(e){var o=this;return this.subject=new rxjs.BehaviorSubject([]),this.dataSource.searchOptions(e).subscribe(function(e){for(var t=new Array,n=0;n<e.length;n++)t.push(new Option$1(e[n]));o.subject.next(t)},function(e){o.subject.error(e)}),this.subject.asObservable()},e.prototype.onValueChange=function(e){},e.prototype.resolveSelectedOption=function(e){var t=this;return this.subjectOption=new rxjs.BehaviorSubject(null),this.dataSource.resolveSelectedValue(e).subscribe(function(e){t.subjectOption.next(e)},function(e){t.subjectOption.error(e)}),this.subjectOption.asObservable()},e.prototype.resetOptions=function(){this.subject.next(new Array)},e.decorators=[{type:i0.Component,args:[{selector:"afe-ng-select",template:'<ng-select\n (searchInputText)="getChangingText($event)"\n (ngModelChange)="onValueChange($event)"\n [options]="question_options"\n [multiple]="multiple"\n >\n </ng-select> ',providers:[{provide:forms.NG_VALUE_ACCESSOR,useExisting:i0.forwardRef(function(){return e}),multi:!0}]}]}],e.propDecorators={dataSource:[{type:i0.Input}],multiple:[{type:i0.Input}],extras:[{type:i0.Input}]},e}(),FormSchemaCompiler=function(){function e(){}return e.prototype.compileFormSchema=function(e,t){var n=this.getReferencedForms(e,t);if(_.isEmpty(n))return e;var o=this.getAllPlaceholderObjects(e);return _.isEmpty(o)||this.replaceAllPlaceholdersWithActualObjects(n,o),e},e.prototype.findSchemaByName=function(e,t){if(!_.isEmpty(e)&&!_.isEmpty(t)){var n={};return _.each(e,function(e){e.name===t&&(n=e)}),n}},e.prototype.getPageInSchemaByLabel=function(e,t){if(!_.isEmpty(e)&&!_.isEmpty(t)){var n={};return _.each(e.pages,function(e){e.label===t&&(n=e)}),n}},e.prototype.getSectionInSchemaByPageLabelBySectionLabel=function(e,t,n){if(!(_.isEmpty(e)||_.isEmpty(t)||_.isEmpty(n))){var o=this.getPageInSchemaByLabel(e,t);if(!_.isEmpty(o)){var r={};return _.each(o.sections,function(e){e.label===n&&(r=e)}),r}}},e.prototype.getQuestionByIdInSchema=function(e,t){if(!_.isEmpty(e)&&!_.isEmpty(t)){if(Array.isArray(e)){for(var n=void 0,o=0;o<e.length&&(_.isEmpty(e[o])||(n=this.getQuestionByIdInSchema(e[o],t)),_.isEmpty(n));o++);return n}if("object"==typeof e){if(this.isQuestionObjectWithId(e,t))return e;if(this.isSchemaSubObjectExpandable(e)){var r=e.pages||e.sections||e.questions;return this.getQuestionByIdInSchema(r,t)}}}},e.prototype.getQuestionsArrayByQuestionIdInSchema=function(e,t){if(!_.isEmpty(e)&&!_.isEmpty(t))return this.getQuestionsArrayByQuestionId(e,e,t)},e.prototype.getQuestionsArrayByQuestionId=function(e,t,n){if(Array.isArray(t)){for(var o=void 0,r=0;r<t.length&&(_.isEmpty(t[r])||(o=this.getQuestionsArrayByQuestionId(t,t[r],n)),_.isEmpty(o));r++);return o}if("object"==typeof t){if(this.isQuestionObjectWithId(t,n))return e;if(this.isSchemaSubObjectExpandable(t)){var i=t.pages||t.sections||t.questions;return this.getQuestionsArrayByQuestionId(i,i,n)}}},e.prototype.isSchemaSubObjectExpandable=function(e){if("object"==typeof e){var t=Object.keys(e);if(_.includes(t,"pages")||_.includes(t,"sections")||_.includes(t,"questions"))return!0}return!1},e.prototype.isQuestionObjectWithId=function(e,t){return e.id===t},e.prototype.getAllPlaceholderObjects=function(e){var t=[];return this.extractPlaceholderObjects(e,t),t},e.prototype.extractPlaceholderObjects=function(e,t){if(!_.isEmpty(e))if(Array.isArray(e))for(var n=0;n<e.length;n++)_.isEmpty(e[n])||this.extractPlaceholderObjects(e[n],t);else if("object"==typeof e)if(_.isEmpty(e.reference)){if(this.isSchemaSubObjectExpandable(e)){var o=e.pages||e.sections||e.questions;this.extractPlaceholderObjects(o,t)}}else t.push(e)},e.prototype.fillPlaceholderObject=function(e,t){for(var n in t)_.isEmpty(e[n])&&(e[n]=t[n]);return e},e.prototype.replaceAllPlaceholdersWithActualObjects=function(n,e){var o=this;return _.each(e,function(e){var t=o.getReferencedObject(e.reference,n);_.isEmpty(t)?console.error("Form compile: Error finding referenced object",e.reference):(e=o.fillPlaceholderObject(e,t),delete(e=o.removeExcludedQuestionsFromPlaceholder(e)).reference)}),e},e.prototype.removeObjectFromArray=function(e,t){var n=e.indexOf(t);-1!==n&&e.splice(n,1)},e.prototype.removeExcludedQuestionsFromPlaceholder=function(o){var r=this;return Array.isArray(o.reference.excludeQuestions)&&_.each(o.reference.excludeQuestions,function(e){var t=r.getQuestionsArrayByQuestionIdInSchema(o,e);if(Array.isArray(t)){var n=r.getQuestionByIdInSchema(t,e);r.removeObjectFromArray(t,n)}}),o},e.prototype.getReferencedObject=function(e,t){if(_.isEmpty(e.form))console.error("Form compile: reference missing form attribute",e);else{if(!_.isEmpty(t[e.form]))return _.isEmpty(e.questionId)?_.isEmpty(e.page)||_.isEmpty(e.section)?_.isEmpty(e.page)?void console.error("Form compile: Unsupported reference type",e.reference):this.getPageInSchemaByLabel(t[e.form],e.page):this.getSectionInSchemaByPageLabelBySectionLabel(t[e.form],e.page,e.section):this.getQuestionByIdInSchema(t[e.form],e.questionId);console.error("Form compile: referenced form alias not found",e)}},e.prototype.getReferencedForms=function(e,t){var n=this,o=e.referencedForms;if(!_.isEmpty(o)){var r={};return _.each(o,function(e){r[e.alias]=n.findSchemaByName(t,e.formName)}),r}},e.decorators=[{type:i0.Injectable}],e.ctorParameters=function(){return[]},e}(),TextInputQuestion=function(n){function e(e){var t=n.call(this,e)||this;return t.placeholder=e.placeholder||"",t.controlType=exports.AfeControlType.AfeFormControl,t}return __extends(e,n),e}(QuestionBase),TextAreaInputQuestion=function(n){function e(e){var t=n.call(this,e)||this;return t.placeholder=e.placeholder||"",t.isExpanded=e.isExpanded||!1,t.rows=e.rows||18,t.renderingType="textarea",t.controlType=exports.AfeControlType.AfeFormControl,t}return __extends(e,n),e}(TextInputQuestion),SelectQuestion=function(n){function e(e){var t=n.call(this,e)||this;return t.renderingType="select",t.options=e.options||[],t.controlType=exports.AfeControlType.AfeFormControl,t.dataSource=e.dataSource||"",t}return __extends(e,n),e}(QuestionBase),UiSelectQuestion=function(n){function e(e){var t=n.call(this,e)||this;return t.renderingType="ui-select",t.options=e.options||[],t.controlType=exports.AfeControlType.AfeFormControl,t}return __extends(e,n),e}(QuestionBase),DateQuestion=function(n){function e(e){var t=n.call(this,e)||this;return t.showTime=!0,t.showWeeksAdder=!1,t.renderingType="date",t.controlType=exports.AfeControlType.AfeFormControl,t}return __extends(e,n),e}(QuestionBase),MultiSelectQuestion=function(n){function e(e){var t=n.call(this,e)||this;return t.renderingType="multi-select",t.options=e.options||[],t.controlType=exports.AfeControlType.AfeFormControl,t}return __extends(e,n),e}(SelectQuestion),NestedQuestion=function(t){function e(e){return t.call(this,e)||this}return __extends(e,t),e}(QuestionBase),QuestionGroup=function(n){function e(e){var t=n.call(this,e)||this;return t.isExpanded=!0,t.renderingType="group",t.questions=e.questions||[],t.controlType=exports.AfeControlType.AfeFormGroup,t}return __extends(e,n),e}(NestedQuestion),RepeatingQuestion=function(n){function e(e){var t=n.call(this,e)||this;return t.renderingType="repeating",t.questions=e.questions||[],t.controlType=exports.AfeControlType.AfeFormArray,t}return __extends(e,n),e}(NestedQuestion),CheckBoxQuestion=function(n){function e(e){var t=n.call(this,e)||this;return t.renderingType="checkbox",t.options=e.options||[],t.controlType=exports.AfeControlType.AfeFormControl,t}return __extends(e,n),e}(QuestionBase),TimeQuestion=function(n){function e(e){var t=n.call(this,e)||this;return t.renderingType="time",t.controlType=exports.AfeControlType.AfeFormControl,t}return __extends(e,n),e}(QuestionBase),FileUploadQuestion=function(n){function e(e){var t=n.call(this,e)||this;return t.showTime=!0,t.showWeeksAdder=!1,t.renderingType="file",t.dataSource=e.dataSource,t.controlType=exports.AfeControlType.AfeFormControl,t}return __extends(e,n),e}(QuestionBase),TestOrderQuestion=function(n){function e(e){var t=n.call(this,e)||this;return t.renderingType="select",t.orderType=e.orderType,t.selectableOrders=e.selectableOrders,t.options=e.options,t.orderSettingUuid=e.orderSettingUuid,t.rendering=e.orderSettingUuid,t.controlType=exports.AfeControlType.AfeFormControl,t}return __extends(e,n),e}(QuestionBase),DateValidationModel=function(n){function e(e){var t=n.call(this,e)||this;return t.allowFutureDates=!1,t.allowFutureDates="true"===e.allowFutureDates,t}return __extends(e,n),e}(ValidationModel),MaxValidationModel=function(o){function e(e){var t=o.call(this,e)||this,n=e.max;return t.max=+n,t}return __extends(e,o),e}(ValidationModel),MinValidationModel=function(o){function e(e){var t=o.call(this,e)||this,n=e.min;return t.min=+n,t}return __extends(e,o),e}(ValidationModel),DecimalPointValidationModel=function(){function e(e){this.decimalPlace=0,this.failsWhenExpression="",this.type="js_expression",this.decimalPlace=e.decimalPlace}return e.prototype.setFailExpression=function(){this.failsWhenExpression="!isEmpty(myValue) && String(myValue).split('.')[1].length !== "+this.decimalPlace},e.prototype.setMessage=function(){this.message="Value must be to "+this.decimalPlace+" decimal places"},e.prototype.setValuesAndExpressions=function(){this.setMessage(),this.setFailExpression()},e}(),DummyDataSource=function(){function e(){this.returnErrorOnNext=!1}return e.prototype.resolveSelectedValue=function(t){var e=this.sampleData();e=(e=e.map(function(e){return new Option$1({label:e.label,value:e.concept})})).filter(function(e){return e.value===t});var n=new rxjs.BehaviorSubject([]);return this.returnErrorOnNext?n.error(new Error("Error loading Options")):n.next(e[0]),n.asObservable()},e.prototype.fileUpload=function(e){return rxjs.of({image:""})},e.prototype.fetchFile=function(e){return rxjs.of({image:""})},e.prototype.searchOptions=function(t){var e=this.sampleData();e=(e=e.map(function(e){return new Option$1({label:e.label,value:e.concept})})).filter(function(e){return-1!==e.label.indexOf(t)});var n=new rxjs.BehaviorSubject([]);return this.returnErrorOnNext?n.error(new Error("Error loading Options")):n.next(e),n.asObservable()},e.prototype.sampleData=function(){return[{concept:"a899e0ac-1350-11df-a1f1-0026b9348838",label:"None"},{concept:"a8ad1276-1350-11df-a1f1-0026b9348838",label:"Breathlessness"},{concept:"a892e4b4-1350-11df-a1f1-0026b9348838",label:"Chest pain"},{concept:"a8afc8b8-1350-11df-a1f1-0026b9348838",label:"Cough = 2 weeks"},{concept:"d7adae14-c386-49cc-8f7c-765d8ceec566",label:"Fever for = 2 weeks"},{concept:"3f57aafc-7162-41da-a51b-6a804cb6f5e8",label:"New exposure to household contact with TB"},{concept:"a89807f0-1350-11df-a1f1-0026b9348838",label:"Noticeable Weight loss"},{concept:"e1862fef-68ed-4df4-90dd-a00152f719aa",label:"Night sweats = 2 weeks"},{concept:"a8ad462e-1350-11df-a1f1-0026b9348838",label:"Abdomen"},{concept:"f218c60e-4b54-475a-a4fa-facab9216da8",label:"Groin"},{concept:"a8a774b0-1350-11df-a1f1-0026b9348838",label:"Joints"},{concept:"4639388c-ee31-4dcf-abb4-ad71253493bb",label:"Neck Kw"}]},e}(),moment$4=moment_,HistoricalEncounterDataService=function(){function e(){this.dataSources={}}return e.prototype.registerEncounters=function(e,t){var o=this,r={data:[],getValue:function(e,t){void 0===t&&(t=0);var n=e.split(".");return 0<n.length?o.getFirstValue(n,r.data[t]):r.data[t][e]},getAllObjects:function(){return r.data},getSingleObject:function(e){return void 0===e&&(e=0),r.data[e]}};if(_.isArray(t)){var n=[];_.each(t,function(e){n.push(o._transformEncounter(e))}),r.data=_.sortBy(n,"encounterDatetime").reverse()}else r.data.push(this._transformEncounter(t));this.putObject(e,r)},e.prototype.putObject=function(e,t){this.dataSources[e]=t},e.prototype.getObject=function(e){return this.dataSources[e]||null},e.prototype.getFirstValue=function(e,t){var n=[];if(this.getAllValues(e,t,n),0<n.length)return{value:n[0],valueDate:moment$4(t.encounterDatetime).format("ll")}},e.prototype.getAllValues=function(e,t,n){var o=this;if(!_.isNil(t))if(e.length<=1)_.isNil(t[e[0]])||n.push(t[e[0]]);else{var r=e.splice(1),i=e[0];_.isArray(t[i])&&0<t[i].length?_.each(t[i],function(e){o.getAllValues(r.slice(0),e,n)}):this.getAllValues(r.slice(0),t[i],n)}},e.prototype._transformEncounter=function(e){if(!_.isNil(e)){var t={encounterDatetime:e.encounterDatetime};if(e.location&&e.location.uuid&&(t.location=e.location.uuid),e.patient&&e.patient.uuid&&(t.patient=e.patient.uuid),e.form&&e.form.uuid&&(t.form=e.form.uuid),e.encounterType&&e.encounterType.uuid&&(t.encounterType=e.encounterType.uuid),e.provider){var n=e.provider;t.provider=n.uuid}if(e.obs){var o=this._transformObs(e.obs);_.extend(t,o)}return t}},e.prototype._transformObs=function(e){var t=this;if(!e)return null;var n={};if(_.isArray(e))return _.each(e,function(e){t._augumentObs(n,t._transformObs(e))}),n;if(e.groupMembers){var o={};return _.each(e.groupMembers,function(e){t._augumentObs(o,t._transformObs(e))}),n[e.concept.uuid]&&_.isArray(n[e.concept.uuid])?n[e.concept.uuid].push(o):n[e.concept.uuid]=[o],n}return e.value instanceof Object?n[e.concept.uuid]=e.value.uuid:n[e.concept.uuid]=e.value,n},e.prototype._augumentObs=function(e,t){for(var n in t)if(_.has(e,n)){if(!_.isArray(e[n])){var o=e[n];e[n]=[o]}_.isArray(t[n])?Array.prototype.push.apply(e[n],t[n]):e[n].push(t[n])}else e[n]=t[n];return e},e.decorators=[{type:i0.Injectable}],e.ctorParameters=function(){return[]},e}(),HistoricalHelperService=function(){function e(){}return e.prototype.evaluate=function(e,t,n){var o=new HistoricalEncounterDataService;o.registerEncounters("prevEnc",t.rawPrevEnc);var r={HD:o};if(n)for(var i in n)n[i]&&(r[i]=n[i]);var a=new JsExpressionHelper,s=new AfeFormControl;return(new ExpressionRunner).getRunnable(e,s,a.helperFunctions,r).run()},e.prototype.evaluatePrecondition=function(e,t,n){var o={histValue:n};return this.evaluate(e,t,o)},e.decorators=[{type:i0.Injectable}],e.ctorParameters=function(){return[]},e}(),moment$5=moment_,QuestionFactory=function(){function e(){this.dataSources={},this.historicalHelperService=new HistoricalHelperService}return e.prototype.createQuestionModel=function(e,t){if(t){var n=t.dataSourcesContainer.dataSources;this.dataSources=n}return this.toFormQuestionModel(e)},e.prototype.toSelectQuestion=function(e){var t=new SelectQuestion({options:[],type:"",key:""});t.label=e.label,t.key=e.id,t.options=e.questionOptions.answers.map(function(e){return{label:e.label,value:e.concept}}),t.options.splice(0,0,{label:"",value:""}),t.renderingType=e.questionOptions.rendering,t.validators=this.addValidators(e),t.extras=e;return this.copyProperties({label:"label",required:"required",id:"key"},e,t),this.addDisableOrHideProperty(e,t),this.addAlertProperty(e,t),this.addHistoricalExpressions(e,t),this.addCalculatorProperty(e,t),t},e.prototype.toNumericQuestion=function(e){var t=new TextInputQuestion({placeholder:"",type:"",key:""});t.label=e.label,t.key=e.id,t.renderingType="number",t.placeholder=e.questionOptions.placeholder,t.validators=this.addValidators(e),t.extras=e,t.placeholder=e.questionOptions.placeholder||"";return this.copyProperties({label:"label",required:"required",id:"key"},e,t),this.addDisableOrHideProperty(e,t),this.addAlertProperty(e,t),this.addHistoricalExpressions(e,t),this.addCalculatorProperty(e,t),t},e.prototype.toNumberQuestion=function(e){var t=new TextInputQuestion({placeholder:"",type:"",key:""});t.label=e.label,t.key=e.id,t.renderingType="number",t.placeholder=e.questionOptions.placeholder||"",t.extras=e;return this.copyProperties({label:"label",required:"required",id:"key"},e,t),t.validators=this.addValidators(e),this.addDisableOrHideProperty(e,t),this.addAlertProperty(e,t),this.addHistoricalExpressions(e,t),this.addCalculatorProperty(e,t),t},e.prototype.toDecimalQuestion=function(e){var t=new TextInputQuestion({placeholder:"",type:"",key:""});t.label=e.label,t.key=e.id,t.renderingType="decimal",t.placeholder=e.questionOptions.placeholder||"",t.extras=e;return this.copyProperties({label:"label",required:"required",id:"key"},e,t),t.validators=this.addValidators(e),this.addDisableOrHideProperty(e,t),this.addAlertProperty(e,t),this.addHistoricalExpressions(e,t),this.addCalculatorProperty(e,t),t},e.prototype.toDateQuestion=function(e){if("encounterDatetime"===e.type)return this.toEncounterDatetimeQuestion(e);var t=new DateQuestion({type:"",key:""});t.renderingType="date",t.validators=this.addValidators(e),t.extras=e,t.showTime=e.questionOptions.showTime,t.showWeeksAdder=!!e.questionOptions.weeksList;return this.copyProperties({label:"label",required:"required",id:"key"},e,t),this.addDisableOrHideProperty(e,t),this.addAlertProperty(e,t),this.addHistoricalExpressions(e,t),this.addCalculatorProperty(e,t),t},e.prototype.toTimeQuestion=function(e){var t=new TimeQuestion({type:"",key:""});t.renderingType="time",t.validators=this.addValidators(e),t.extras=e;return this.copyProperties({label:"label",required:"required",id:"key"},e,t),this.addDisableOrHideProperty(e,t),this.addAlertProperty(e,t),this.addHistoricalExpressions(e,t),this.addCalculatorProperty(e,t),t},e.prototype.toEncounterDatetimeQuestion=function(e){var t=new DateQuestion({type:"",key:""});t.label=e.label,t.renderingType="date",t.key=e.id,t.validators=this.addValidators(e),t.extras=e,t.showWeeksAdder=!!e.questionOptions.weeksList;return t.showTime=!0,this.copyProperties({label:"label",required:"required",id:"key"},e,t),this.addDisableOrHideProperty(e,t),this.addAlertProperty(e,t),this.addHistoricalExpressions(e,t),this.addCalculatorProperty(e,t),t},e.prototype.toCheckBoxQuestion=function(e){var t=new CheckBoxQuestion({options:[],type:"",key:""});t.label=e.label,t.key=e.id,t.extras=e,t.options=e.questionOptions.answers.map(function(e){return{label:e.label,value:e.concept}}),t.options.splice(0,0),t.renderingType=e.questionOptions.rendering;return this.copyProperties({label:"label",id:"key"},e,t),this.addDisableOrHideProperty(e,t),this.addAlertProperty(e,t),this.addHistoricalExpressions(e,t),this.addCalculatorProperty(e,t),t},e.prototype.toMultiCheckboxQuestion=function(e){var t=new MultiSelectQuestion({renderType:"",options:[],type:"",key:""});t.label=e.label,t.key=e.id,t.options=e.questionOptions.answers.map(function(e){return{label:e.label,value:e.concept}}),t.validators=this.addValidators(e),t.dataSource=new DummyDataSource,t.extras=e;return this.copyProperties({label:"label",required:"required",id:"key"},e,t),this.addDisableOrHideProperty(e,t),this.addAlertProperty(e,t),this.addHistoricalExpressions(e,t),this.addCalculatorProperty(e,t),t},e.prototype.toTextAreaQuestion=function(e){var t=new TextAreaInputQuestion({isExpanded:!1,rows:18,placeholder:"",type:"",key:""});t.label=e.label,t.key=e.id,t.placeholder=e.questionOptions.placeholder,t.isExpanded=e.isExpanded,t.rows=e.questionOptions.rows,t.validators=this.addValidators(e),t.extras=e,t.placeholder=e.questionOptions.placeholder||"";return this.copyProperties({label:"label",required:"required",id:"key"},e,t),this.addDisableOrHideProperty(e,t),this.addAlertProperty(e,t),this.addHistoricalExpressions(e,t),this.addCalculatorProperty(e,t),t},e.prototype.toTextQuestion=function(e){var t=new TextInputQuestion({placeholder:"",type:"",key:""});t.label=e.label,t.key=e.id,t.renderingType="text",t.placeholder=e.questionOptions.placeholder,t.validators=this.addValidators(e),t.extras=e,t.placeholder=e.questionOptions.placeholder||"";return this.copyProperties({label:"label",required:"required",id:"key"},e,t),this.addDisableOrHideProperty(e,t),this.addAlertProperty(e,t),this.addHistoricalExpressions(e,t),this.addCalculatorProperty(e,t),t},e.prototype.toFileUploadQuestion=function(e){var t=new FileUploadQuestion({type:"",key:""});t.label=e.label,t.key=e.id,t.renderingType="file",t.dataSource="file",t.validators=this.addValidators(e),t.extras=e;return this.copyProperties({label:"label",required:"required",id:"key"},e,t),this.addDisableOrHideProperty(e,t),this.addAlertProperty(e,t),this.addHistoricalExpressions(e,t),this.addCalculatorProperty(e,t),t},e.prototype.toDrugQuestion=function(e){var t=new SelectQuestion({options:[],type:"",key:""});t.label=e.label,t.key=e.id,t.renderingType="remote-select",t.validators=this.addValidators(e),t.extras=e,t.dataSource="drug";return this.copyProperties({label:"label",required:"required",id:"key"},e,t),this.addDisableOrHideProperty(e,t),this.addAlertProperty(e,t),this.addHistoricalExpressions(e,t),this.addCalculatorProperty(e,t),t},e.prototype.toProblemQuestion=function(e){var t=new SelectQuestion({options:[],type:"",key:""});t.label=e.label,t.key=e.id,t.renderingType="remote-select",t.validators=this.addValidators(e),t.extras=e,t.dataSource="problem";return this.copyProperties({label:"label",required:"required",id:"key"},e,t),this.addDisableOrHideProperty(e,t),this.addAlertProperty(e,t),this.addHistoricalExpressions(e,t),this.addCalculatorProperty(e,t),t},e.prototype.toConceptAnswerSelect=function(e){var t=new SelectQuestion({options:[],type:"",key:""});t.label=e.label,t.key=e.id,t.renderingType="remote-select",t.validators=this.addValidators(e),t.extras=e,t.dataSource=e.questionOptions.dataSource||"conceptAnswers",t.dataSourceOptions={concept:e.questionOptions.concept};return this.copyProperties({label:"label",required:"required",id:"key"},e,t),this.addDisableOrHideProperty(e,t),this.addAlertProperty(e,t),this.addHistoricalExpressions(e,t),this.addCalculatorProperty(e,t),t},e.prototype.toRepeatingQuestion=function(e){var t=new RepeatingQuestion({questions:[],type:"",key:""});if(t.label=e.label,t.questions=this.getChildrenQuestionModels(e.questions),t.key=e.id,t.validators=this.addValidators(e),"testOrder"===(t.extras=e).type){var n=this.toTestOrderQuestion(e),o=[];o.push(n),t.questions=o}return this.copyProperties({label:"label",required:"required",id:"key"},e,t),this.addDisableOrHideProperty(e,t),this.addAlertProperty(e,t),this.addHistoricalExpressions(e,t),this.addCalculatorProperty(e,t),t},e.prototype.toGroupQuestion=function(e){var t=new QuestionGroup({questions:[],type:"",key:""});t.label=e.label,t.questions=this.getChildrenQuestionModels(e.questions),t.key=e.id,t.validators=this.addValidators(e),t.extras=e;return this.copyProperties({label:"label",required:"required",id:"key"},e,t),this.addDisableOrHideProperty(e,t),this.addAlertProperty(e,t),this.addHistoricalExpressions(e,t),this.addCalculatorProperty(e,t),t},e.prototype.toPageQuestion=function(e){var t=this,n=new QuestionGroup({questions:[],type:"",key:""});return n.label=e.label,n.key=e.label,n.renderingType="page",n.controlType=exports.AfeControlType.None,n.questions=[],e.sections.forEach(function(e){n.questions.push(t.toSectionQuestion(e))}),n},e.prototype.toFormQuestionModel=function(e){var t=this,n=new QuestionGroup({questions:[],type:"",key:""});return n.label=e.label,n.key=e.label,n.renderingType="form",n.controlType=exports.AfeControlType.AfeFormGroup,n.extras=e,n.questions=[],e.pages.forEach(function(e){n.questions.push(t.toPageQuestion(e))}),n},e.prototype.toSectionQuestion=function(e){var t=new QuestionGroup({questions:[],type:"",key:""});return t.label=e.label,t.key=e.label,t.renderingType="section",t.controlType=exports.AfeControlType.None,t.isExpanded="true"===e.isExpanded,t.questions=this.getSchemaQuestions(e.questions),t},e.prototype.toPersonAttributeQuestion=function(e){var t=new UiSelectQuestion({options:[],type:"",key:"",searchFunction:function(){},resolveFunction:function(){}});t.label=e.label,t.key=e.id,t.renderingType="remote-select",t.validators=this.addValidators(e),t.extras=e,t.dataSource="personAttribute";return this.copyProperties({label:"label",required:"required",id:"key"},e,t),this.addHistoricalExpressions(e,t),this.addDisableOrHideProperty(e,t),this.addAlertProperty(e,t),this.addHistoricalExpressions(e,t),this.addCalculatorProperty(e,t),t},e.prototype.toEncounterProviderQuestion=function(e){var t=new UiSelectQuestion({options:[],type:"",key:"",searchFunction:function(){},resolveFunction:function(){}});t.label=e.label,t.key=e.id,t.renderingType="remote-select",t.validators=this.addValidators(e),t.extras=e,t.dataSource="provider";return this.copyProperties({label:"label",required:"required",id:"key"},e,t),this.addDisableOrHideProperty(e,t),this.addAlertProperty(e,t),this.addHistoricalExpressions(e,t),this.addCalculatorProperty(e,t),t},e.prototype.toFieldSetQuestion=function(e){var t=this.toGroupQuestion(e);return t.renderingType="field-set",t},e.prototype.toEncounterLocationQuestion=function(e){var t=new UiSelectQuestion({options:[],type:"",key:"",searchFunction:function(){},resolveFunction:function(){}});t.label=e.label,t.key=e.id,t.renderingType=e.type,t.renderingType="remote-select",t.validators=this.addValidators(e),t.extras=e,t.dataSource="location";return this.copyProperties({label:"label",required:"required",id:"key"},e,t),this.addDisableOrHideProperty(e,t),this.addAlertProperty(e,t),this.addHistoricalExpressions(e,t),this.addCalculatorProperty(e,t),t},e.prototype.toAmrsLocationsQuestion=function(e){var t=new UiSelectQuestion({options:[],type:"",key:"",searchFunction:function(){},resolveFunction:function(){}});t.label=e.label,t.key=e.id,t.renderingType=e.type,t.renderingType="remote-select",t.validators=this.addValidators(e),t.extras=e,t.dataSource="amrsLocations";return this.copyProperties({label:"label",required:"required",id:"key"},e,t),this.addDisableOrHideProperty(e,t),this.addAlertProperty(e,t),this.addHistoricalExpressions(e,t),this.addCalculatorProperty(e,t),t},e.prototype.toSiblingLocationsQuestion=function(e){var t=new UiSelectQuestion({options:[],type:"",key:"",searchFunction:function(){},resolveFunction:function(){}});t.label=e.label,t.key=e.id,t.renderingType=e.type,t.renderingType="remote-select",t.validators=this.addValidators(e),t.extras=e,t.dataSource="siblingLocations";return this.copyProperties({label:"label",required:"required",id:"key"},e,t),this.addDisableOrHideProperty(e,t),this.addAlertProperty(e,t),this.addHistoricalExpressions(e,t),this.addCalculatorProperty(e,t),t},e.prototype.toNonAmrsLocationsQuestion=function(e){var t=new UiSelectQuestion({options:[],type:"",key:"",searchFunction:function(){},resolveFunction:function(){}});t.label=e.label,t.key=e.id,t.renderingType=e.type,t.renderingType="remote-select",t.validators=this.addValidators(e),t.extras=e,t.dataSource="nonAmrsLocations";return this.copyProperties({label:"label",required:"required",id:"key"},e,t),this.addDisableOrHideProperty(e,t),this.addAlertProperty(e,t),this.addHistoricalExpressions(e,t),this.addCalculatorProperty(e,t),t},e.prototype.toTestOrderQuestion=function(e){var t=new TestOrderQuestion({type:"",key:"",orderType:"",selectableOrders:[],orderSettingUuid:"",label:"",rendering:""});t.label=e.label,t.key=e.id,t.validators=this.addValidators(e),t.extras=e,t.options=e.questionOptions.selectableOrders.map(function(e){return{label:e.label,value:e.concept}});return this.copyProperties({label:"label",required:"required",id:"key"},e,t),t},e.prototype.getSchemaQuestions=function(e){var t=new Array;return this.getQuestions(e,t),t},e.prototype.getQuestions=function(e,t){if(Array.isArray(t)||(t=[]),Array.isArray(e))for(var n in e)e.hasOwnProperty(n)&&this.getQuestions(e[n],t);if(e&&!Array.isArray(e)&&"object"==typeof e)if(e.questionOptions)"group"===e.questionOptions.rendering||"repeating"===e.questionOptions.rendering?t.push(this.toModel(e,e.questionOptions.rendering)):"field-set"===e.questionOptions.rendering||t.push(this.toModel(e,e.questionOptions.rendering));else for(var o in e)e.hasOwnProperty(o)&&this.getQuestions(e[o],t)},e.prototype.getChildrenQuestionModels=function(e){var t=[];return this.getQuestions(e,t),t},e.prototype.toModel=function(e,t){switch("ui-select-extended"===t&&(t=e.type),e.id||(e.id=this.generateId(10)),!e.questionOptions||!0!==e.questionOptions.showDate&&"true"!==e.questionOptions.showDate||(e=this.convertOldVersionComplexObsQuestionToNewVersion(e),t="field-set"),t){case"select":case"single-select":case"multi-select":return this.toSelectQuestion(e);case"numeric":return this.toNumericQuestion(e);case"number":return this.toNumberQuestion(e);case"decimal":return this.toDecimalQuestion(e);case"encounterDatetime":return this.toEncounterDatetimeQuestion(e);case"date":return this.toDateQuestion(e);case"time":return this.toTimeQuestion(e);case"multiCheckbox":return this.toMultiCheckboxQuestion(e);case"drug":return this.toDrugQuestion(e);case"problem":return this.toProblemQuestion(e);case"group":return this.toGroupQuestion(e);case"field-set":return this.toFieldSetQuestion(e);case"repeating":return this.toRepeatingQuestion(e);case"personAttribute":return this.toPersonAttributeQuestion(e);case"text":return this.toTextQuestion(e);case"textarea":return this.toTextAreaQuestion(e);case"select-concept-answers":return this.toConceptAnswerSelect(e);case"encounterLocation":return this.toEncounterLocationQuestion(e);case"amrsLocations":return this.toAmrsLocationsQuestion(e);case"nonAmrsLocations":return this.toNonAmrsLocationsQuestion(e);case"siblingLocations":return this.toSiblingLocationsQuestion(e);case"encounterDatetime":return this.toEncounterDatetimeQuestion(e);case"encounterProvider":return this.toEncounterProviderQuestion(e);case"radio":case"checkbox":return this.toCheckBoxQuestion(e);case"encounterProvider":return this.toEncounterProviderQuestion(e);case"file":return this.toFileUploadQuestion(e);default:return console.warn("New Schema Question Type found........."+t),this.toTextQuestion(e)}},e.prototype.convertOldVersionComplexObsQuestionToNewVersion=function(e){var t={type:"complex-obs"};t.label=e.label,t.id="complex_"+e.id,t.questionOptions={},t.questionOptions.concept=e.questionOptions.concept,t.questionOptions.rendering="field-set",t.questions=[],t.validators=[];var n=JSON.parse(JSON.stringify(e));n.type="complex-obs-child",delete n.questionOptions.showDate,delete n.questionOptions.shownDateOptions,n.questionOptions.obsField="value";var o={type:"complex-obs-child"};o.label="Date of "+n.label,o.id="date_"+n.id,o.questionOptions={},o.questionOptions.concept=e.questionOptions.concept,o.questionOptions.rendering="date",o.questionOptions.obsField="obsDatetime";var r=Object.assign({},e.questionOptions.shownDateOptions);return o.validators=r.validators,o.hide=r.hide,t.questions.push(n),t.questions.push(o),t},e.prototype.copyProperties=function(e,t,n){for(var o in t)e.hasOwnProperty(o)&&n.hasOwnProperty(e[o])&&(n[e[o]]=t[o])},e.prototype.addValidators=function(e){var n=[];e.validators&&_.forEach(e.validators,function(e){switch(e.type){case"date":n.push(new DateValidationModel(e));break;case"js_expression":n.push(new JsExpressionValidationModel(e));break;case"decimal":var t=new DecimalPointValidationModel(e);t.setValuesAndExpressions(),n.push(t);break;case"conditionalAnswered":n.push(new ConditionalValidationModel(e));break;default:n.push(new ValidationModel(e))}});var t=e.questionOptions,o=t?t.rendering:"";if("number"!==o&&"decimal"!==o||t.max&&t.min&&(n.push(new MaxValidationModel({type:"max",max:t.max})),n.push(new MinValidationModel({type:"min",min:t.min}))),"object"==typeof e.required){var r=e.required;"conditionalRequired"===r.type&&n.push(new ConditionalValidationModel({referenceQuestionId:r.referenceQuestionId,referenceQuestionAnswers:r.referenceQuestionAnswers,type:r.type,message:r.message}))}return n},e.prototype.addHistoricalExpressions=function(e,t){if(e.historicalExpression&&0<e.historicalExpression.length){t.setHistoricalValue(!0),e.showHistoricalEncounterDate!==undefined?t.showHistoricalEncounterDate("true"===e.showHistoricalEncounterDate):t.showHistoricalEncounterDate();var n=this.historicalHelperService.evaluate(e.historicalExpression,this.dataSources,undefined);if(t.historicalDataValue=n,e.historicalPrepopulateCondition&&n)return void(this.historicalHelperService.evaluatePrecondition(e.historicalPrepopulateCondition,this.dataSources,n)&&(t.defaultValue=n.value));if(e.historicalPrepopulate&&n){var o=moment$5(n.valueDate),r=moment$5().diff(o,"days");Number.isInteger(e.allowedHistoricalValueAgeInDays)?r<=e.allowedHistoricalValueAgeInDays&&(t.defaultValue=n.value):t.defaultValue=n.value}}},e.prototype.addCalculatorProperty=function(e,t){e.questionOptions&&"object"==typeof e.questionOptions.calculate&&(t.calculateExpression=e.questionOptions.calculate.calculateExpression)},e.prototype.addAlertProperty=function(e,t){e.alert&&(t.alert=e.alert)},e.prototype.addDisableOrHideProperty=function(e,t){e.disable&&(t.disable=e.disable),"object"==typeof e.disable&&(t.disable=e.disable.disableWhenExpression),e.hide&&(t.hide=e.hide),"object"==typeof e.hide&&e.hide.hideWhenExpression&&(t.hide=e.hide.hideWhenExpression)},e.prototype.generateId=function(e){for(var t="_";t.length<e&&0<e;){var n=Math.random();t+=n<.1?Math.floor(100*n):String.fromCharCode(Math.floor(26*n)+(.5<n?97:65))}return"_"+t},e}(),Form=function(){function e(e,t,n){this.schema=e,this.formFactory=t,this.questionFactory=n,this.valueProcessingInfo={},this.existingOrders={},this._showErrors=!1,this._dataSourcesContainer=new DataSources}return Object.defineProperty(e.prototype,"dataSourcesContainer",{get:function(){return this._dataSourcesContainer},enumerable:!0,configurable:!0}),e.prototype.searchNodeByPath=function(e,t,n){var o=this,r=e.children;for(var i in r)if(r.hasOwnProperty(i)){var a=r[i];if(a instanceof GroupNode){if(t===a.path)return n.push(a),n;this.searchNodeByPath(a,t,n)}else if(a instanceof LeafNode){if(t===a.path)return n.push(a),n}else if(a instanceof ArrayNode){if(t===a.path)return n.push(a),n;a.children.forEach(function(e){o.searchNodeByPath(e,t,n)})}}return n},e.prototype.searchNodeByQuestionId=function(e,t){var n=[];return t?this.searchNodeByQuestionType(this.rootNode,t,n):this.findNodesByQuestionId(this.rootNode,e,n),n},e.prototype.searchNodeByQuestionType=function(e,t,n){var o=this;if(e instanceof GroupNode){var r=e;for(var i in r.children)this.searchNodeByQuestionType(r.children[i],t,n)}e instanceof ArrayNode&&e.children.forEach(function(e){o.searchNodeByQuestionType(e,t,n)});if(e instanceof LeafNode){var a=e.question;a.extras&&a.extras.type&&a.extras.type===t&&n.push(e)}},e.prototype.findNodesByQuestionId=function(e,t,n){var o=this;if(e.question.key===t&&n.push(e),e instanceof GroupNode){var r=e;for(var i in r.children)this.findNodesByQuestionId(r.children[i],t,n)}e instanceof ArrayNode&&e.children.forEach(function(e){o.findNodesByQuestionId(e,t,n)})},Object.defineProperty(e.prototype,"valid",{get:function(){return this.rootNode.control.valid},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"showErrors",{get:function(){return this._showErrors},set:function(e){this._showErrors=e},enumerable:!0,configurable:!0}),e.prototype.markInvalidControls=function(e,t){var n=this,o=e.children;for(var r in o)if(o.hasOwnProperty(r)){var i=o[r];if(i instanceof GroupNode)this.markInvalidControls(i,t);else if(i instanceof LeafNode){var a=i.question;if(a.key&&0<a.key.length){var s=i.control;s.valid||s.disabled||(t&&t.push(i),s.markAsTouched())}}else if(i instanceof ArrayNode){var l=i;l&&l.children&&0<l.children.length&&_.forEach(l.children,function(e){n.markInvalidControls(e,t)})}}return t},e.prototype.updateHiddenDisabledStateForAllControls=function(){this._updateHiddenDisabledStateForAllControls(this.rootNode)},e.prototype.updateAlertsForAllControls=function(){this._updateAlertsForAllControls(this.rootNode)},e.prototype._updateAlertsForAllControls=function(e){var t=this;if(e.control&&e.control.updateAlert&&e.control.updateAlert(),e instanceof GroupNode){var n=e;for(var o in n.children)this._updateAlertsForAllControls(n.children[o])}e instanceof ArrayNode&&e.children.forEach(function(e){t._updateAlertsForAllControls(e)})},e.prototype._updateHiddenDisabledStateForAllControls=function(e){var t=this;if(e.control&&(e.control.updateDisabledState&&e.control.updateDisabledState(),e.control.updateHiddenState&&e.control.updateHiddenState()),e instanceof GroupNode){var n=e;for(var o in n.children)this._updateHiddenDisabledStateForAllControls(n.children[o])}e instanceof ArrayNode&&e.children.forEach(function(e){t._updateHiddenDisabledStateForAllControls(e)})},e}(),FormFactory=function(){function e(e,t,n){this.controlService=e,this.questionFactroy=t,this.controlRelationsFactory=n,this.hd={getValue:function(){return 20}}}return e.prototype.createForm=function(e,t){var n=new Form(e,this,this.questionFactroy);if(t)for(var o in t)t.hasOwnProperty(o)&&n.dataSourcesContainer.registerDataSource(o,t[o],!1);var r=this.questionFactroy.createQuestionModel(e,n);return n.rootNode=this.createNode(r,null,null,n),this.buildRelations(n.rootNode),n.updateHiddenDisabledStateForAllControls(),n.updateAlertsForAllControls(),n},e.prototype.buildRelations=function(e){Validations.JSExpressionValidatorsEnabled=!1,this.controlRelationsFactory.buildRelations(e),Validations.JSExpressionValidatorsEnabled=!0},e.prototype.createNode=function(e,t,n,o){return e instanceof NestedQuestion?e instanceof RepeatingQuestion?this.createArrayNode(e,t,n,o):this.createGroupNode(e,t,n,o):this.createLeafNode(e,t,n,o)},e.prototype.createLeafNode=function(e,t,n,o){var r=this.controlService.generateControlModel(e,n,!1,o);return new LeafNode(e,r,null,o,t?t.path:undefined)},e.prototype.createGroupNode=function(e,t,n,o){var r=this.controlService.generateControlModel(e,n,!1,o),i=new GroupNode(e,r,null,o,t?t.path:undefined);return this.createNodeChildren(e,i,r||n,o),i},e.prototype.createArrayNode=function(e,t,n,o){var r=this,i=this.controlService.generateControlModel(e,n,!1,o),a=new ArrayNode(e,i,n,this,o,t?t.path:undefined);return a.createChildFunc=this.createArrayNodeChild,a.removeChildFunc=this.removeArrayNodeChild,a.addChildNodeCreatedListener(function(e){Validations.JSExpressionValidatorsEnabled=!1,r.controlRelationsFactory.buildArrayNodeRelations(e),Validations.JSExpressionValidatorsEnabled=!0}),a},e.prototype.createNodeChildren=function(e,n,o,r){var i=this;return e.questions.forEach(function(e){var t=i.createNode(e,n,o,r);n.setChild(e.key,t)}),n.children},e.prototype.createArrayNodeChild=function(e,t,n){null!==n&&n!==undefined||(n=this);var o=new QuestionGroup({key:t.path+"."+t.children.length,type:"group",extras:e.extras,label:"",questions:e.questions});e.controlType===exports.AfeControlType.None&&(o.controlType=e.controlType);var r=n.createGroupNode(o,null,null,t.form);if(t.children.push(r),t.control instanceof AfeFormArray){var i=t.control;i.setControl(i.controls.length,r.control)}return r},e.prototype.removeArrayNodeChild=function(e,t){var n=t.children[e];if(t.children.splice(e,1),(null!==t.control||t.control!==undefined)&&t.control instanceof AfeFormArray){var o=t.control,r=o.controls.indexOf(n.control);0<=r&&o.removeAt(r)}},e.decorators=[{type:i0.Injectable}],e.ctorParameters=function(){return[{type:FormControlService},{type:QuestionFactory},{type:ControlRelationsFactory}]},e}(),moment$6=moment_,ObsAdapterHelper=function(){function e(){}return e.prototype.findObsAnswerToQuestion=function(t,e){var n=this,o=[];if(!this.isObsNode(t))return o;if(t instanceof LeafNode||t instanceof GroupNode&&"complex-obs"===t.question.extras.type)return _.each(e,function(e){e.concept&&e.concept.uuid===t.question.extras.questionOptions.concept&&o.push(e)}),o;var r=this.getChildQuestionsConceptUuids(t);return 0<r.length&&_.each(e,function(e){e.concept&&e.concept.uuid===t.question.extras.questionOptions.concept&&Array.isArray(e.groupMembers)&&n.isSubsetOf(r,n.getGroupMembersConceptUuids(e))&&o.push(e)}),o},e.prototype.getChildQuestionsConceptUuids=function(e){var t=[];return e.question.extras&&e.question.extras.questions&&_.each(e.question.extras.questions,function(e){e.questionOptions&&e.questionOptions.concept&&t.push(e.questionOptions.concept)}),t},e.prototype.getGroupMembersConceptUuids=function(e){var t=[];return Array.isArray(e.groupMembers)&&_.each(e.groupMembers,function(e){t.push(e.concept.uuid)}),t},e.prototype.isObsNode=function(e){return e.question.extras&&("obs"===e.question.extras.type||"obsGroup"===e.question.extras.type||"complex-obs"===e.question.extras.type||"complex-obs-child"===e.question.extras.type)},e.prototype.isSubsetOf=function(t,e){return 0===e.length&&0===t.length||e.every(function(e){return 0<=t.indexOf(e)})},e.prototype.setSimpleObsNodeValue=function(e,t){if(e&&0<t.length){var n=t[0];e.initialValue=n,!this.isEmpty(n.value)&&n.value.uuid?this.setNodeFormControlValue(e,n.value.uuid):this.isEmpty(n.value)||this.setNodeFormControlValue(e,n.value)}},e.prototype.setMultiselectObsNodeValue=function(e,t){if(e&&0<t.length){e.initialValue=t;var n=[];try{for(var o=__values(t),r=o.next();!r.done;r=o.next()){var i=r.value;n.push(i.value.uuid)}}catch(l){a={error:l}}finally{try{r&&!r.done&&(s=o["return"])&&s.call(o)}finally{if(a)throw a.error}}this.setNodeFormControlValue(e,n)}var a,s},e.prototype.setComplexObsNodeValue=function(e,t){if(e&&0<t.length){var n=void 0,o=void 0,r=e;for(var i in r.children)"value"===r.children[i].question.extras.questionOptions.obsField&&(n=r.children[i]),"obsDatetime"===r.children[i].question.extras.questionOptions.obsField&&(o=r.children[i]);this.setNodeValue(n,t),e.initialValue=n.initialValue,o.initialValue=n.initialValue,this.setNodeFormControlValue(o,n.initialValue.obsDatetime)}},e.prototype.setGroupObsNodeValue=function(e,t){if(e&&0<t.length){var n=e;for(var o in n.initialValue=t[0],n.children)this.setNodeValue(n.children[o],t[0].groupMembers)}},e.prototype.setRepeatingGroupObsNodeValue=function(e,t){if(e&&0<t.length){var n=e;n.initialValue=t;for(var o=0;o<t.length;o++){var r=n.createChildNode();this.setGroupObsNodeValue(r,[t[o]])}}},e.prototype.setNodeValue=function(e,t){switch(this.getObsNodeType(e)){case"unknown":if(e instanceof GroupNode){var n=e;for(var o in n.children)this.setNodeValue(n.children[o],t);break}if(e instanceof ArrayNode){for(var r=e,i=0;i<r.children.length;i++)this.setNodeValue(r.children[i],t);break}break;case"simple":var a=this.findObsAnswerToQuestion(e,t);this.setSimpleObsNodeValue(e,a);break;case"multiselect":var s=this.findObsAnswerToQuestion(e,t);this.setMultiselectObsNodeValue(e,s);break;case"complex":var l=this.findObsAnswerToQuestion(e,t);this.setComplexObsNodeValue(e,l);break;case"group":var u=this.findObsAnswerToQuestion(e,t);0<u.length&&this.setGroupObsNodeValue(e,u);break;case"repeatingGroup":var c=this.findObsAnswerToQuestion(e,t);0<c.length&&this.setRepeatingGroupObsNodeValue(e,c);break;default:console.error("Unknown obs node",e)}},e.prototype.setNodeFormControlValue=function(e,t){e.control.setValue(t),e.question.enableHistoricalValue&&e.initialValue!==undefined&&e.question.setHistoricalValue(!1)},e.prototype.getObsNodeType=function(e){return this.isObsNode(e)?e instanceof LeafNode&&("multiCheckbox"===e.question.extras.questionOptions.rendering||"checkbox"===e.question.extras.questionOptions.rendering||"multi-select"===e.question.extras.questionOptions.rendering)?"multiselect":e instanceof LeafNode?"simple":e instanceof GroupNode&&"complex-obs"===e.question.extras.type?"complex":e instanceof ArrayNode&&"obsGroup"===e.question.extras.type&&"repeating"===e.question.extras.questionOptions.rendering?"repeatingGroup":e instanceof GroupNode&&"obsGroup"===e.question.extras.type?"group":"unknownObs":"unknown"},e.prototype.getSimpleObsPayload=function(e){if(this.isEmpty(e.control.value))return e.initialValue?{uuid:e.initialValue.uuid,voided:!0}:null;if(e.initialValue&&!this.simpleNodeValueChanged(e))return null;var t={concept:e.question.extras.questionOptions.concept,value:e.control.value};return"date"===e.question.extras.questionOptions.rendering&&(t.value=this.toOpenMrsDateTimeString(e.control.value)),e.initialValue&&(delete t.concept,t.uuid=e.initialValue.uuid),t},e.prototype.getComplexObsPayload=function(e){var t,n,o=e;for(var r in o.children)"value"===o.children[r].question.extras.questionOptions.obsField&&(t=o.children[r]),"obsDatetime"===o.children[r].question.extras.questionOptions.obsField&&(n=o.children[r]);var i=this.getObsNodePayload(t);if(console.log("valuePayload",i),0<i.length)return i[0].obsDatetime=this.toOpenMrsDateTimeString(n.control.value),i[0];if(0!==i.length||!e.initialValue||this.areDatesEqual(e.initialValue.obsDatetime,n.control.value))return null;var a={uuid:e.initialValue.uuid};return a.obsDatetime=this.toOpenMrsDateTimeString(n.control.value),a},e.prototype.getMultiselectObsPayload=function(t){var n=[],o=[];return Array.isArray(t.initialValue)&&_.each(t.initialValue,function(e){o.push(e.value.uuid),Array.isArray(t.control.value)?t.control.value.indexOf(e.value.uuid)<0&&n.push({uuid:e.uuid,voided:!0}):n.push({uuid:e.uuid,voided:!0})}),Array.isArray(t.control.value)&&_.each(t.control.value,function(e){o.indexOf(e)<0&&n.push({concept:t.question.extras.questionOptions.concept,value:e})}),n},e.prototype.getGroupPayload=function(e){var n=this,t=e,o=[];if(_.each(t.children,function(e){var t=n.getObsNodePayload(e);0<t.length&&(o=o.concat(t))}),0===o.length)return null;var r={groupMembers:o};return t.initialValue?r.uuid=t.initialValue.uuid:r.concept=t.question.extras.questionOptions.concept,r},e.prototype.getRepeatingGroupPayload=function(e){var n=this,t=e,o=[],r=[];return _.each(t.children,function(e){var t=n.getObsNodePayload(e);0<t.length&&(o=o.concat(t)),e.initialValue&&e.initialValue.uuid&&r.push(e.initialValue.uuid)}),t.initialValue&&Array.isArray(t.initialValue)&&_.each(t.initialValue,function(e){if(r.indexOf(e.uuid)<0){var t={uuid:e.uuid,voided:!0};o.push(t)}}),o.length<=0?null:o},e.prototype.getObsNodePayload=function(e){var t=[];switch(this.getObsNodeType(e)){case"unknown":if(e instanceof GroupNode){var n=e;for(var o in n.children){var r=this.getObsNodePayload(n.children[o]);Array.isArray(r)&&0<r.length&&(t=t.concat(r))}break}if(e instanceof ArrayNode){for(var i=e,a=0;a<i.children.length;a++){var s=this.getObsNodePayload(i.children[a]);Array.isArray(s)&&0<s.length&&(t=t.concat(s))}break}break;case"simple":var l=this.getSimpleObsPayload(e);null!==l&&t.push(l);break;case"multiselect":var u=this.getMultiselectObsPayload(e);Array.isArray(u)&&0<u.length&&(t=t.concat(u));break;case"complex":var c=this.getComplexObsPayload(e);null!==c&&t.push(c);break;case"group":var p=this.getGroupPayload(e);p&&null!==p&&t.push(p);break;case"repeatingGroup":var d=this.getRepeatingGroupPayload(e);Array.isArray(d)&&0<d.length&&(t=t.concat(d))}return t},e.prototype.simpleNodeValueChanged=function(e){return!!e.initialValue&&(e.initialValue.value&&e.initialValue.value.uuid?e.control.value!==e.initialValue.value.uuid:"date"===e.question.extras.questionOptions.rendering?!this.areDatesEqual(e.control.value,e.initialValue.value):e.control.value!==e.initialValue.value)},e.prototype.areDatesEqual=function(e,t){return moment$6(e).isSame(t)},e.prototype.isEmpty=function(e){return""===e||null===e||e===undefined},e.prototype.toOpenMrsDateTimeString=function(e){if(this.isEmpty(e))return undefined;var t=moment$6(e).format().substring(0,19).replace("T"," ");return this.isEmpty(t)?undefined:t},e}(),ObsValueAdapter=function(){function e(e){this.helper=e}return e.prototype.generateFormPayload=function(e){return this.helper.getObsNodePayload(e.rootNode)},e.prototype.populateForm=function(e,t){this.helper.setNodeValue(e.rootNode,t)},e.prototype.setValues=function(e,n,o){if(e){var t=function(t){if(t instanceof LeafNode)r.setObsValue(t,n),t.question.enableHistoricalValue&&t.initialValue!==undefined&&t.question.setHistoricalValue(!1);else if(t.question&&t.question.extras&&"group"===t.question.renderingType||o){var e=_.find(n,function(e){return e.concept.uuid===t.question.extras.questionOptions.concept&&e.groupMembers});e&&(t.node&&(t.node.initialValue=e),r.setValues(t.groupMembers,e.groupMembers)),o&&t.payload&&r.setValues(t.groupMembers,t.payload.groupMembers)}else if(t instanceof GroupNode&&"complex-obs"===t.question.extras.type)r.setComplexObsValue(t,n);else{if(!t.question||!t.question.extras||"repeating"!==t.question.renderingType||o)throw new Error("not implemented");r.setRepeatingGroupValues(t,n),t.node.control.updateValueAndValidity()}},r=this;try{for(var i=__values(e),a=i.next();!a.done;a=i.next()){t(a.value)}}catch(u){s={error:u}}finally{try{a&&!a.done&&(l=i["return"])&&l.call(i)}finally{if(s)throw s.error}}}var s,l},e.prototype.setObsValue=function(t,e){if(t.question&&t.question.extras&&("obs"===t.question.extras.type||"complex-obs-child"===t.question.extras.type&&"value"===t.question.extras.questionOptions.obsField)&&"multiCheckbox"!==t.question.extras.questionOptions.rendering||"checkbox"!==t.question.extras.questionOptions.rendering||"multi-select"!==t.question.extras.questionOptions.rendering){var n=_.find(e,function(e){return e.concept.uuid===t.question.extras.questionOptions.concept});n&&(n.value instanceof Object?t.control.setValue(n.value.uuid):t.control.setValue(n.value),t.control.updateValueAndValidity(),t.initialValue={obsUuid:n.uuid,value:n.value})}else{var o=_.filter(e,function(e){return e.concept.uuid===t.question.extras.questionOptions.concept});o&&0<o.length&&(t.control.setValue(this.getMultiselectValues(o)),t.control.updateValueAndValidity(),t.initialValue=o)}},e.prototype.setComplexObsValue=function(t,e){var n,o;for(var r in t.children)"value"===t.children[r].question.extras.questionOptions.obsField&&(n=t.children[r]),"obsDatetime"===t.children[r].question.extras.questionOptions.obsField&&(o=t.children[r]);this.setObsValue(n,e);var i=_.find(e,function(e){return e.concept.uuid===t.question.extras.questionOptions.concept});i&&(o.initialValue={obsUuid:i.uuid,value:i.obsDatetime},o.control.setValue(i.obsDatetime),o.control.updateValueAndValidity())},e.prototype.getMultiselectValues=function(e){var t,n,o=[];try{for(var r=__values(e),i=r.next();!i.done;i=r.next()){var a=i.value;o.push(a.value.uuid)}}catch(s){t={error:s}}finally{try{i&&!i.done&&(n=r["return"])&&n.call(r)}finally{if(t)throw t.error}}return o},e.prototype.setRepeatingGroupValues=function(i,e){var o=_.filter(e,function(e){var t=e.concept.uuid===i.question.extras.questionOptions.concept,n=!1;if(t&&e.groupMembers){var o=e.groupMembers.map(function(e){return e.concept.uuid}),r=i.question.questions.map(function(e){return e.extras.questionOptions.concept});n=0<_.intersection(o,r).length}return t&&n});if(0<o.length){i.node.initialValue=o;for(var t=0;t<o.length;t++)i.node.createChildNode()}var n,r,a=[],s=0,l=function(t){var e=Object.keys(t.children).map(function(e){return t.children[e]}),n=o[s];a.push({question:i.question,groupMembers:e,payload:n}),s++};try{for(var u=__values(i.node.children),c=u.next();!c.done;c=u.next()){l(c.value)}}catch(p){n={error:p}}finally{try{c&&!c.done&&(r=u["return"])&&r.call(u)}finally{if(n)throw n.error}}this.setValues(a,o,!0)},e.prototype.getQuestionNodes=function(e){var t,n,o,r,i=[];try{for(var a=__values(e),s=a.next();!s.done;s=a.next()){var l=s.value;try{for(var u=__values(l.page),c=u.next();!c.done;c=u.next()){var p=c.value;i.push(p.section)}}catch(d){o={error:d}}finally{try{c&&!c.done&&(r=u["return"])&&r.call(u)}finally{if(o)throw o.error}}}}catch(h){t={error:h}}finally{try{s&&!s.done&&(n=a["return"])&&n.call(a)}finally{if(t)throw t.error}}return[].concat.apply([],i)},e.prototype.repeatingGroup=function(e){var t,n,o=[];try{for(var r=__values(e),i=r.next();!i.done;i=r.next()){var a=i.value;o.push({question:a.question,groupMembers:this.traverse(a)})}}catch(s){t={error:s}}finally{try{i&&!i.done&&(n=r["return"])&&n.call(r)}finally{if(t)throw t.error}}return o},e.prototype.processGroup=function(e,t){if(e.question&&e.question.extras&&"group"===e.question.extras.questionOptions.rendering){var n=_.filter(this.getObsPayload(e.groupMembers),function(e){return""!==e.value}),o=n.map(function(e){return e.voided});0<n.length&&o.every(Boolean)?t.push({uuid:e.node.initialValue.uuid,voided:!0}):0<n.length&&(e.node.initialValue?t.push({uuid:e.node.initialValue.uuid,groupMembers:n}):t.push({concept:e.question.extras.questionOptions.concept,groupMembers:n}))}},e.prototype.mapInitialGroup=function(e){var t,n,o={};try{for(var r=__values(e.groupMembers),i=r.next();!i.done;i=r.next()){var a=i.value,s="";a.value instanceof Object?s=a.value.uuid:a.value?s=a.value:a.groupMembers&&0<a.groupMembers.length&&(o=this.mapInitialGroup(e)),o[a.concept.uuid+":"+s]=s}}catch(l){t={error:l}}finally{try{i&&!i.done&&(n=r["return"])&&n.call(r)}finally{if(t)throw t.error}}return o},e.prototype.mapModelGroup=function(e,t){var n={};for(var o in t)if(t.hasOwnProperty(o)){var r=_.find(e.question.questions,{key:o}),i=t[o];i instanceof Object||""!==i&&(n[r.extras.questionOptions.concept+":"+i]=i)}return n},e.prototype.processRepeatingGroups=function(e,t){var n=[];if(e.node.initialValue)try{for(var o=__values(e.node.initialValue),r=o.next();!r.done;r=o.next()){var i=r.value;n.push({uuid:i.uuid,value:this.mapInitialGroup(i)})}}catch(E){c={error:E}}finally{try{r&&!r.done&&(p=o["return"])&&p.call(o)}finally{if(c)throw c.error}}var a=[];try{for(var s=__values(e.node.control.value),l=s.next();!l.done;l=s.next()){var u=l.value;a.push({value:this.mapModelGroup(e,u)})}}catch(D){d={error:D}}finally{try{l&&!l.done&&(h=s["return"])&&h.call(s)}finally{if(d)throw d.error}}var c,p,d,h,f,y,m,g,v=this.leftOuterJoinArrays(n,a),b=this.leftOuterJoinArrays(a,n),x=e.question.extras.questionOptions.concept,w=[];if(0<v.length){var C=this.createGroupDeletedObs(v);try{for(var k=__values(C),S=k.next();!S.done;S=k.next()){var O=S.value;t.push(O)}}catch(T){f={error:T}}finally{try{S&&!S.done&&(y=k["return"])&&y.call(k)}finally{if(f)throw f.error}}0<b.length&&(w=this.createGroupNewObs(b,x))}else w=this.createGroupNewObs(b,x);if(0<w.length)try{for(var q=__values(w),A=q.next();!A.done;A=q.next()){var _=A.value;t.push(_)}}catch(V){m={error:V}}finally{try{A&&!A.done&&(g=q["return"])&&g.call(q)}finally{if(m)throw m.error}}},e.prototype.leftOuterJoinArrays=function(e,n){return e.filter(function(t){return!n.some(function(e){return _.isEqual(t.value,e.value)})})},e.prototype.createGroupNewObs=function(e,t){var n,o,r=[];try{for(var i=__values(e),a=i.next();!a.done;a=i.next()){var s=a.value,l=[];for(var u in s.value){var c=u.split(":")[0],p=u.split(":")[1];l.push({concept:c,value:p})}r.push({concept:t,groupMembers:l})}}catch(d){n={error:d}}finally{try{a&&!a.done&&(o=i["return"])&&o.call(i)}finally{if(n)throw n.error}}return r},e.prototype.createGroupDeletedObs=function(e){var t,n,o=[];try{for(var r=__values(e),i=r.next();!i.done;i=r.next()){var a=i.value;o.push({uuid:a.uuid,voided:!0})}}catch(s){t={error:s}}finally{try{i&&!i.done&&(n=r["return"])&&n.call(r)}finally{if(t)throw t.error}}return o},e.prototype.getExactTime=function(e){return e.substring(0,19).replace("T"," ")},e.prototype.processObs=function(e,t){if(e.control&&e.question.extras){var n={concept:e.question.extras.questionOptions.concept,value:"date"!==e.question.extras.questionOptions.rendering||this.isEmpty(e.control.value)?e.control.value:this.getExactTime(e.control.value)};if("multiCheckbox"===e.question.extras.questionOptions.rendering||"checkbox"===e.question.extras.questionOptions.rendering||"multi-select"===e.question.extras.questionOptions.rendering){var o=this.processMultiSelect(e.question.extras.questionOptions.concept,e.control.value);if(e.initialValue){var r=e.initialValue.map(function(e){return{uuid:e.uuid,value:{concept:e.concept.uuid,value:e.value.uuid}}}),i=o.map(function(e){return{value:e}}),a=this.leftOuterJoinArrays(r,i),s=this.leftOuterJoinArrays(i,r);this.processDeletedMultiSelectObs(a,t),this.processNewMultiSelectObs(s,t)}else this.processNewMultiSelectObs(o,t)}else e.initialValue&&e.initialValue.value&&n?this.updateOrVoidObs(n,e.initialValue,t):""!==n.value&&null!==n.value&&t.push(n)}},e.prototype.processComplexObs=function(e,t){var n,o;for(var r in e.children)"value"===e.children[r].question.extras.questionOptions.obsField&&(n=e.children[r]),"obsDatetime"===e.children[r].question.extras.questionOptions.obsField&&(o=e.children[r]);if(n){this.processObs(n,t);var i=0<t.length?t[t.length-1]:undefined;i&&(i.concept&&i.concept===e.question.extras.questionOptions.concept||n.initialValue&&i.uuid===n.initialValue.obsUuid)&&o.initialValue&&o.control.value!==o.initialValue.value&&(i.obsDatetime=o.control.value)}},e.prototype.processDeletedMultiSelectObs=function(e,t){try{for(var n=__values(e),o=n.next();!o.done;o=n.next()){var r=o.value;t.push({uuid:r.uuid,voided:!0})}}catch(s){i={error:s}}finally{try{o&&!o.done&&(a=n["return"])&&a.call(n)}finally{if(i)throw i.error}}var i,a},e.prototype.processNewMultiSelectObs=function(e,t){try{for(var n=__values(e),o=n.next();!o.done;o=n.next()){var r=o.value;r.value instanceof Object?t.push(r.value):t.push(r)}}catch(s){i={error:s}}finally{try{o&&!o.done&&(a=n["return"])&&a.call(n)}finally{if(i)throw i.error}}var i,a},e.prototype.updateOrVoidObs=function(e,t,n){this.isEmpty(e.value)&&t.value?n.push({uuid:t.obsUuid,voided:!0}):!this.isEmpty(e.value)&&t.value&&n.push({uuid:t.obsUuid,value:e.value})},e.prototype.isEmpty=function(e){return""===e||null===e||e===undefined},e.prototype.traverse=function(e,t){var n=[];if(e.children){if(e.children instanceof Array)return this.repeatingGroup(e.children);if(e.children instanceof Object)for(var o in e.children)if(e.children.hasOwnProperty(o))switch(e.children[o].question.renderingType){case"page":var r=this.traverse(e.children[o]);n.push({page:r,label:e.children[o].question.label});break;case"section":var i=this.traverse(e.children[o]);n.push({section:i,node:e.children[o],label:e.children[o].question.label});break;case"group":var a=this.traverse(e.children[o]);n.push({node:e.children[o],question:e.children[o].question,groupMembers:a});break;case"repeating":var s=this.repeatingGroup(e.children[o].children);n.push({node:e.children[o],question:e.children[o].question,groupMembers:s});break;default:n.push(e.children[o])}}return n},e.prototype.processMultiSelect=function(e,t){var n,o,r=[];if(t&&null!==t)try{for(var i=__values(t),a=i.next();!a.done;a=i.next()){var s={concept:e,value:a.value};r.push(s)}}catch(l){n={error:l}}finally{try{a&&!a.done&&(o=i["return"])&&o.call(i)}finally{if(n)throw n.error}}return r},e.prototype.isObs=function(e){return"obs"===e.question.extras.type||"obsGroup"===e.question.extras.type||"complex-obs"===e.question.extras.type},e.prototype.getObsPayload=function(e){var t,n,o=[];try{for(var r=__values(e),i=r.next();!i.done;i=r.next()){var a=i.value;this.isObs(a)&&(a.groupMembers,"group"===a.question.extras.questionOptions.rendering?this.processGroup(a,o):(a.groupMembers,"repeating"===a.question.extras.questionOptions.rendering?this.processRepeatingGroups(a,o):a instanceof GroupNode&&"complex-obs"===a.question.extras.type?this.processComplexObs(a,o):this.processObs(a,o)))}}catch(s){t={error:s}}finally{try{i&&!i.done&&(n=r["return"])&&n.call(r)}finally{if(t)throw t.error}}return o},e.decorators=[{type:i0.Injectable}],e.ctorParameters=function(){return[{type:ObsAdapterHelper}]},e}(),OrderValueAdapter=function(){function e(){this.formOrderNodes=[],this.provider=""}return e.prototype.generateFormPayload=function(e){return this.formOrderNodes=[],this._setOrderProvider(e),this._findTestOrderQuestionNodes(e.rootNode),this._createOrdersPayload(this.formOrderNodes,e)},e.prototype.populateForm=function(e,t){e.existingOrders=t,this.formOrderNodes=[],this._findTestOrderQuestionNodes(e.rootNode);var n=this._getExistingOrders(e);this._setOrderValues(this.formOrderNodes,n)},e.prototype._setOrderProvider=function(e){e.valueProcessingInfo.providerUuid&&(this.provider=e.valueProcessingInfo.providerUuid)},e.prototype._createOrdersPayload=function(e,t){var n,o,r,a=[],s=[],l=this._getExistingOrders(t),i=function(e){var t=e.control.value,n=[];for(var o in l&&l.map(function(e){n[e.concept]=e.concept}),t)if(t.hasOwnProperty(o)){var r=t[o][e.question.key],i=u._createPayloadOrder(r,e.question.extras);n[r]!==r&&""!==i.concept&&a.push(i),s[r]=r,""===i.orderNumber&&delete i.orderNumber,""===i.uuid&&delete i.uuid}},u=this;try{for(var c=__values(e),p=c.next();!p.done;p=c.next()){i(p.value)}}catch(d){o={error:d}}finally{try{p&&!p.done&&(r=c["return"])&&r.call(c)}finally{if(o)throw o.error}}return n=this._getDeletedOrders(s,l),this._addDeletedOrdersToPayload(n,a)},e.prototype._getExistingOrders=function(e){if(e.existingOrders&&e.existingOrders.orders){var t=e.existingOrders.orders.map(function(e){return{concept:e.concept.uuid,orderNumber:e.orderNumber,orderUuid:e.uuid,voided:e.voided,dateVoided:e.auditInfo.dateVoided}});return _.filter(t,function(e){return!0!==e.voided&&!e.dateVoided})}},e.prototype._setOrderValues=function(e,t){this._findTestOrderQuestionNodes(e);var n,o,r=this.formOrderNodes;try{for(var i=__values(r),a=i.next();!a.done;a=i.next()){var s=a.value;this._setOrderNodeValues(s,t)}}catch(l){n={error:l}}finally{try{a&&!a.done&&(o=i["return"])&&o.call(i)}finally{if(n)throw n.error}}},e.prototype._addDeletedOrdersToPayload=function(e,t){for(var n in e)e.hasOwnProperty(n)&&t.push({uuid:e[n],voided:!0});return t},e.prototype._createPayloadOrder=function(e,t){var n={concept:"",type:"",orderer:"",careSetting:""};return n.concept=e,n.type=t.questionOptions.orderType,n.orderer=this.provider,n.careSetting=t.questionOptions.orderSettingUuid,""===n.orderer&&delete n.orderer,n},e.prototype._getDeletedOrders=function(e,t){var n=[];if(e)for(var o in t)if(t.hasOwnProperty(o)){var r=t[o].concept;e[r]!==r&&n.push(t[o].orderUuid)}return n},e.prototype._setOrderNodeValues=function(e,t){var n,o,r=0;e.initialValue=t;try{for(var i=__values(t),a=i.next();!a.done;a=i.next()){var s=a.value;e.createChildNode();var l={};l[e.question.key]=s.concept;var u=e.children[r];u.control.setValue(l),u.initialValue=l,u.orderNumber=s.orderNumber,r++}}catch(c){n={error:c}}finally{try{a&&!a.done&&(o=i["return"])&&o.call(i)}finally{if(n)throw n.error}}},e.prototype._findTestOrderQuestionNodes=function(e){if(e.children&&e.children instanceof Object)for(var t in e.children)if(e.children.hasOwnProperty(t))switch(e.children[t].question.renderingType){case"page":case"section":case"group":this._findTestOrderQuestionNodes(e.children[t]);break;case"repeating":if(e.children)for(var n in e.children){var o=e.children[n].question;o.extras&&"testOrder"===o.extras.type&&this.formOrderNodes.push(e.children[n])}}},e.decorators=[{type:i0.Injectable}],e}(),moment$7=moment_,EncounterAdapter=function(){function e(e,t){this.ordersAdapter=e,this.obsAdapter=t}return e.prototype.populateForm=function(e,t){this.populateNode(e.rootNode,t),Array.isArray(t.orders)&&this.ordersAdapter.populateForm(e,t),Array.isArray(t.obs)&&this.obsAdapter.populateForm(e,t.obs)},e.prototype.populateNode=function(e,n){if(n===undefined||null===n)throw new Error("Expected payload");this.getEncounterNodes(e).forEach(function(e){switch(e.question.extras.type){case"encounterDatetime":n.encounterDatetime&&(e.control.setValue(moment$7(n.encounterDatetime).toDate()),e.initialValue=moment$7(n.encounterDatetime).toDate());break;case"encounterProvider":if(Array.isArray(n.encounterProviders)&&0<n.encounterProviders.length){var t=n.encounterProviders[0].provider;t&&t.uuid&&(e.control.setValue(t.uuid),setTimeout(function(){e.control.setValue(t.uuid)}),e.initialValue=t.uuid)}break;case"encounterLocation":n.location&&n.location.uuid&&(e.control.setValue(n.location.uuid),e.initialValue=n.location.uuid)}})},e.prototype.generateFormPayload=function(e){var t=this.generateNodePayload(e.rootNode);return this.setNonFilledPayloadMembers(e,t),t.obs=this.obsAdapter.generateFormPayload(e)||[],t.orders=this.ordersAdapter.generateFormPayload(e)||[],t},e.prototype.generateNodePayload=function(o){var e=this.getEncounterNodes(o),r={};return e.forEach(function(e){if(null!==e.control.value&&e.control.value!==undefined&&""!==e.control.value)switch(e.question.extras.type){case"encounterDatetime":var t=moment$7(e.control.value).utcOffset(o.form.valueProcessingInfo.utcOffset||"+0300");r.encounterDatetime=t.format("YYYY-MM-DD HH:mm:ss");break;case"encounterProvider":if(e.control.value&&""!==e.control.value){var n=[];n.push({provider:e.control.value,encounterRole:"a0b03050-c99b-11e0-9572-0800200c9a66"}),r.encounterProviders=n}break;case"encounterLocation":r.location=e.control.value}}),r},e.prototype.getEncounterNodes=function(e){var t=[];return this._getEncounterNodes(e,t),t},e.prototype.setNonFilledPayloadMembers=function(e,t){e.valueProcessingInfo.patientUuid&&this.setPayloadPatientUuid(t,e.valueProcessingInfo.patientUuid),e.valueProcessingInfo.visitUuid&&this.setPayloadVisitUuid(t,e.valueProcessingInfo.visitUuid),e.valueProcessingInfo.encounterTypeUuid&&this.setPayloadEncounterTypeUuid(t,e.valueProcessingInfo.encounterTypeUuid),e.valueProcessingInfo.formUuid&&this.setPayloadFormUuid(t,e.valueProcessingInfo.formUuid),e.valueProcessingInfo.encounterUuid&&this.setPayloadEncounterUuid(t,e.valueProcessingInfo.encounterUuid)},e.prototype.setPayloadPatientUuid=function(e,t){e.patient=t},e.prototype.setPayloadVisitUuid=function(e,t){e.visit=t},e.prototype.setPayloadEncounterTypeUuid=function(e,t){e.encounterType=t},e.prototype.setPayloadFormUuid=function(e,t){e.form=t},e.prototype.setPayloadEncounterUuid=function(e,t){e.uuid=t},e.prototype._getEncounterNodes=function(e,t){var n=this;if(this._isEncounterNode(e)&&t.push(e),e instanceof GroupNode){var o=e;for(var r in o.children)o.children[r]instanceof NodeBase&&this._getEncounterNodes(o.children[r],t)}e instanceof ArrayNode&&(o=e).children.forEach(function(e){n._getEncounterNodes(e,t)})},e.prototype._isEncounterNode=function(e){return!(!e.question.extras||"encounterDatetime"!==e.question.extras.type&&"encounterProvider"!==e.question.extras.type&&"encounterLocation"!==e.question.extras.type)},e.decorators=[{type:i0.Injectable}],e.ctorParameters=function(){return[{type:OrderValueAdapter},{type:ObsValueAdapter}]},e}(),PersonAttribuAdapter=function(){function e(){}return e.prototype.generateFormPayload=function(e){return this.generateNodePayload(e.rootNode)},e.prototype.generateNodePayload=function(e){var t=this.getPersonAttributeNodes(e),n=[];return t.forEach(function(e){null!==e.control.value&&e.control.value!==undefined&&""!==e.control.value&&e.initialValue!==e.control.value&&(!0===e.question.extras.questionOptions.isSimpleValue?n.push({attributeType:e.question.extras.questionOptions.attributeType,value:e.control.value}):n.push({attributeType:e.question.extras.questionOptions.attributeType,hydratedObject:e.control.value}))}),n},e.prototype.populateForm=function(e,t){this.populateNode(e.rootNode,t)},e.prototype.populateNode=function(e,n){if(!Array.isArray(n))throw new Error("Expected an array of attributes");this.getPersonAttributeNodes(e).forEach(function(t){n.forEach(function(e){e.attributeType.uuid===t.question.extras.questionOptions.attributeType&&(e.value.uuid?(t.control.setValue(e.value.uuid),t.initialValue=e.value.uuid):(t.control.setValue(e.value),t.initialValue=e.value))})})},e.prototype.getPersonAttributeNodes=function(e){var t=[];return this._getPersonAttributesNodes(e,t),t},e.prototype._getPersonAttributesNodes=function(e,t){var n=this;if(!e.question.extras||"personAttribute"!==e.question.extras.type&&"amrsLocations"!==e.question.extras.type&&"nonAmrsLocations"!==e.question.extras.type&&"siblingLocations"!==e.question.extras.type||t.push(e),e instanceof GroupNode){var o=e;for(var r in o.children)o.children[r]instanceof NodeBase&&this._getPersonAttributesNodes(o.children[r],t)}e instanceof ArrayNode&&(o=e).children.forEach(function(e){n._getPersonAttributesNodes(e,t)})},e.decorators=[{type:i0.Injectable}],e.ctorParameters=function(){return[]},e}(),RemoteSelectComponent=function(){function e(e){this.renderer=e,this.placeholder="Search...",this.items=[],this.value=[],this.loading=!1,this.searchText="",this.notFoundMsg="match no found",this.done=new i0.EventEmitter,this.characters=[],this.propagateChange=function(e){}}return Object.defineProperty(e.prototype,"dataSource",{get:function(){return this._dataSource},set:function(e){this._dataSource=e,this._dataSource&&this._dataSource.dataFromSourceChanged&&this.subscribeToDataSourceDataChanges()},enumerable:!0,configurable:!0}),e.prototype.ngOnInit=function(){},e.prototype.subscribeToDataSourceDataChanges=function(){var t=this;this._dataSource.dataFromSourceChanged.subscribe(function(e){0<e.length?(t.items=e,t.notFoundMsg="",t.restoreSelectedValue(t.selectC.value,e)):(t.notFoundMsg="Not found",t.items=[])})},e.prototype.typed=function(e){this.search(e)},e.prototype.search=function(e){var n=this;this.dataSource&&(this.searchText=e,this.notFoundMsg="Loading.........",this.dataSource.searchOptions(e).subscribe(function(e){if(0<e.length){var t=_.map(n.value,_.clone).concat(e);n.items=_.uniqBy(t,"value")}n.notFoundMsg=""},function(e){n.notFoundMsg="Errored"}))},e.prototype.restoreSelectedValue=function(t,e){var n=this,o=!1;_.each(e,function(e){e.value===t&&(setTimeout(function(){n.selectC.select(t),n.selectC.value=t}),o=!0)}),o||setTimeout(function(){n.selectC.select(""),n.selectC.value=""})},e.prototype.canSearch=function(e){return(2<=e.length-this.searchText.length||e.length-this.searchText.length<=2&&""!==e)&&!1===this.loading},e.prototype.writeValue=function(e){var t=this;e&&""!==e&&this.dataSource&&(this.loading=!0,this.dataSource.resolveSelectedValue(e).subscribe(function(e){t.items=[e],setTimeout(function(){t.selectC.select(e.value),t.selectC.value=e.value}),t.loading=!1},function(e){t.loading=!1}))},e.prototype.registerOnChange=function(e){this.propagateChange=e},e.prototype.registerOnTouched=function(){},e.prototype.onChange=function(e){this.propagateChange(e.id)},e.prototype.removed=function(e){console.log("Removed"),this.propagateChange("")},e.prototype.selected=function(e){this.propagateChange(e.value)},e.decorators=[{type:i0.Component,args:[{selector:"remote-select",template:'<div>\n <ng-select\n [id]="componentID"\n [noFilter]="0"\n (selected)="selected($event)"\n (deselected)="removed($event)"\n [options]="items"\n [allowClear]="true"\n [placeholder]="placeholder"\n [notFoundMsg]="notFoundMsg"\n (typed)="typed($event)"\n tabindex="0"\n >\n </ng-select>\n <div *ngIf="loading">resolving....</div>\n</div>\n',providers:[{provide:forms.NG_VALUE_ACCESSOR,useExisting:i0.forwardRef(function(){return e}),multi:!0}]}]}],e.ctorParameters=function(){return[{type:i0.Renderer2}]},e.propDecorators={placeholder:[{type:i0.Input}],componentID:[{type:i0.Input}],done:[{type:i0.Output}],selectC:[{type:i0.ViewChild,args:[SelectComponent]}],dataSource:[{type:i0.Input}]},e}(),RemoteSelectModule=function(){function e(){}return e.decorators=[{type:i0.NgModule,args:[{imports:[common.CommonModule,SelectModule,forms.FormsModule],exports:[RemoteSelectComponent],declarations:[RemoteSelectComponent],providers:[]}]}],e}(),moment$8=moment_,AppointmentsOverviewComponent=function(){function e(){this.showAppointments=!1,this.loadingAppointments=!1,this.errorLoadingAppointments=!1,this.appointmentsLoaded=!1,this.appointments=[],this.today=""}return e.prototype.ngOnInit=function(){},e.prototype.ngOnChanges=function(){var s=this;this.node.control.valueChanges.subscribe(function(a){s.resetProperties();var e=s.node;if(e.question.extras.questionOptions.concept&&("a8a666ba-1350-11df-a1f1-0026b9348838"===e.question.extras.questionOptions.concept||"a89d2398-1350-11df-a1f1-0026b9348838"===e.question.extras.questionOptions.concept)&&!s.showAppointments){s.loadingAppointments=!0,s.showAppointments=!0;var t=void 0;e.form&&e.form.dataSourcesContainer.dataSources&&(t=e.form.dataSourcesContainer.dataSources.monthlyScheduleResourceService);var n=e.form.dataSourcesContainer.dataSources.userLocation.uuid;if(t&&n){var o=moment$8(a).startOf("week").add(1,"day").format("YYYY-MM-DD"),r=moment$8(a).endOf("week").subtract(1,"day").format("YYYY-MM-DD");s.today=moment$8(a).format("DD-MM-YYYY"),t.getMonthlySchedule({startDate:o,endDate:r,limit:5,locationUuids:n,department:"HIV",groupBy:"groupByPerson,groupByAttendedDate,groupByRtcDate"}).subscribe(function(e){for(var o=[],t=new Map,n=0;n<5;n++){var r=moment$8(a).startOf("week").add(n,"day").format("YYYY-MM-DD"),i={date:r,count:{scheduled:0}};t.set(r,i)}(e.results||[]).forEach(function(e){t.set(e.date,e)}),t.forEach(function(e,t){var n={date:t,count:e.count.scheduled||0};o.push(n)}),s.appointmentsLoaded=!0,s.loadingAppointments=!1,s.appointments=o},function(e){s.loadingAppointments=!1,s.errorLoadingAppointments=!0,s.showAppointments=!1,console.error(e)})}else s.showAppointments=!1,s.errorLoadingAppointments=!0}})},e.prototype.resetProperties=function(){this.loadingAppointments=!1,this.appointmentsLoaded=!1,this.errorLoadingAppointments=!1,this.showAppointments=!1,this.appointments=[],this.today=""},e.decorators=[{type:i0.Component,args:[{selector:"appointments-overview",template:'<div *ngIf="showAppointments" class="appointments">\n <p *ngIf="loadingAppointments">\n <span *ngIf="!appointmentsLoaded && errorLoadingAppointments"\n >Error checking appointments</span\n >\n <span *ngIf="loadingAppointments"\n ><span class="fa fa-spinner fa-spin"></span>Checking appointments...</span\n >\n </p>\n <div *ngIf="appointmentsLoaded && !errorLoadingAppointments">\n <table\n *ngIf="appointments.length > 0"\n class="table table-stripped table-bordered"\n >\n <thead>\n <tr>\n <th\n *ngFor="let appointment of appointments"\n [ngClass]="{ active: appointment.date === today }"\n >\n <span>{{ appointment.date }}</span>\n </th>\n </tr>\n </thead>\n <tbody>\n <tr>\n <td\n *ngFor="let appointment of appointments"\n [ngClass]="{ active: appointment.date === today }"\n >\n <span\n ><strong\n ><em>{{ appointment.count }}</em></strong\n ></span\n >\n </td>\n </tr>\n </tbody>\n </table>\n </div>\n</div>\n',styles:[".appointments{margin-top:12px;font-size:12px;color:#999}.appointments p{padding-top:12px}.appointments th{border-bottom:0!important;color:#333}.appointments td span,.appointments th span{display:block}.appointments td.active,.appointments th.active{background-color:#3c8dbc;color:#fff!important;padding:0}.appointments td.active span,.appointments th.active span{padding:4px}.appointments span.fa{display:inline-block;margin-right:7px}"]}]}],e.ctorParameters=function(){return[]},e.propDecorators={node:[{type:i0.Input}]},e}(),EncounterViewerService=function(){function e(){}return e.prototype.resolveSelectedValue=function(e){},e.prototype.searchOptions=function(e){},e.prototype.fileUpload=function(e){},e.prototype.fetchFile=function(e){},e.prototype.resolveSelectedValueFromSchema=function(n,e){var o,r=this;return e.pages&&_.forEach(e.pages,function(e){var t=r.resolveSelectedValueFromSchema(n,e);t&&(o=t)}),e.sections&&_.forEach(e.sections,function(e){var t=r.resolveSelectedValueFromSchema(n,e);t&&(o=t)}),e.questions&&_.forEach(e.questions,function(e){if(e.questions){var t=r.resolveSelectedValueFromSchema(n,e);t&&(o=t)}else e.questionOptions.answers?_.forEach(e.questionOptions.answers,function(e){e.concept===n&&(o=e.label)}):e.questionOptions.selectableOrders&&_.forEach(e.questionOptions.selectableOrders,function(e){e.concept===n&&(o=e.label)})}),o},e.prototype.hasAnswer=function(e){var t=!1;return e.initialValue&&(t=!0),t},e.prototype.questionsAnswered=function(e,t){var n=this,o=t||[];if("page"===e.question.renderingType)_.forEach(e.children,function(e){n.questionsAnswered(e,o)});else{if("section"!==e.question.renderingType)return this.hasAnswer(e);_.forEach(e.children,function(e){"group"===e.question.renderingType?_.forEach(e.children,function(e){var t=n.questionsAnswered(e,o);t&&o.push(t)}):n.hasAnswer(e)&&o.push(!0)})}return 0<o.length},e.prototype.isDate=function(e){return!!Date.parse(e)},e.prototype.convertTime=function(e){var t=new Date(e),n=t.getFullYear(),o=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"][t.getMonth()],r=t.getDate(),i=t.getHours(),a=t.getMinutes();t.getSeconds();return 0===i&&0===a?r+" "+o+" "+n:r+" "+o+" "+n+" "+i+":"+a+(i<12?"AM":"PM")+" (EAT)"},e.decorators=[{type:i0.Injectable}],e.ctorParameters=function(){return[]},e}(),EncounterViewerComponent=function(){function e(e,t){this.encounterViewerService=e,this.dataSources=t}return Object.defineProperty(e.prototype,"node",{set:function(e){this.rootNode=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"schema",{set:function(e){this._schema=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"encounter",{set:function(e){this.enc=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"form",{set:function(e){this.rootNode=e.rootNode,this._schema=e.schema,console.log(this.getQuestionNodes(this.traverse(this.rootNode)))},enumerable:!0,configurable:!0}),e.prototype.getQuestionNodes=function(e){var t,n,o=[];try{for(var r=__values(e),i=r.next();!i.done;i=r.next()){var a=i.value;o.push(a.page)}}catch(s){t={error:s}}finally{try{i&&!i.done&&(n=r["return"])&&n.call(r)}finally{if(t)throw t.error}}return[].concat.apply([],o)},e.prototype.ngOnInit=function(){this.rootNode,this.rootNode&&this.rootNode.question.extras&&"file"===this.rootNode.question.renderingType?this.fileDataSource=this.dataSources.dataSources[this.rootNode.question.dataSource]:this.rootNode&&this.rootNode.question.extras&&"remote-select"===this.rootNode.question.renderingType?this.remoteDataSource=this.dataSources.dataSources[this.rootNode.question.dataSource]:this.customDataSource=this.encounterViewerService},e.prototype.questionsAnswered=function(e){return this.encounterViewerService.questionsAnswered(e)},e.prototype.questionAnswered=function(e){return this.encounterViewerService.hasAnswer(e)},e.prototype.checkForColon=function(e){return-1===e.indexOf(":")},e.prototype.traverse=function(e,t){var n=[];if(e.children){if(e.children instanceof Array)return this.repeatingGroup(e.children);if(e.children instanceof Object){for(var o in e.children)if(e.children.hasOwnProperty(o))switch(e.children[o].question.renderingType){case"page":var r=this.traverse(e.children[o]);n.push({page:r});break;case"section":var i=this.traverse(e.children[o]);n.push({section:i});break;case"group":var a=this.traverse(e.children[o]);n.push({node:e.children[o],question:e.children[o].question,groupMembers:a});break;case"repeating":var s=this.repeatingGroup(e.children[o].children);n.push({node:e.children[o],question:e.children[o].question,groupMembers:s});break;default:n.push(e.children[o])}}else console.log("Console.log",e)}return n},e.prototype.repeatingGroup=function(e){var t,n,o=[];try{for(var r=__values(e),i=r.next();!i.done;i=r.next()){var a=i.value;o.push({question:a.question,groupMembers:this.traverse(a)})}}catch(s){t={error:s}}finally{try{i&&!i.done&&(n=r["return"])&&n.call(r)}finally{if(t)throw t.error}}return o},e.decorators=[{type:i0.Component,args:[{selector:"encounter-viewer",template:'<div class="viewer">\n <div *ngIf="rootNode.question.renderingType === \'form\'" class="form">\n <div *ngFor="let question of rootNode.question.questions; let i = index">\n <div *ngIf="questionsAnswered(rootNode.children[question.key])">\n <div [attr.id]="\'page\' + i" class="panel panel-default">\n <p class="page-label panel-heading text-primary">\n {{ question.label }}\n </p>\n <div class="panel-body">\n <encounter-viewer\n [node]="rootNode.children[question.key]"\n [schema]="_schema"\n [parentComponent]="this"\n [parentGroup]="rootNode.control"\n ></encounter-viewer>\n </div>\n </div>\n </div>\n </div>\n </div>\n\n <div *ngIf="rootNode.question.renderingType === \'page\'" class="page">\n <encounter-viewer\n *ngFor="let question of rootNode.question.questions"\n [parentComponent]="this"\n [node]="rootNode.children[question.key]"\n [schema]="_schema"\n [parentGroup]="parentGroup"\n ></encounter-viewer>\n </div>\n\n <div\n *ngIf="\n rootNode.question.renderingType === \'section\' &&\n questionsAnswered(rootNode)\n "\n class="section"\n >\n <div class="panel panel-primary">\n <p class="panel-heading section-label">{{ rootNode.question.label }}</p>\n </div>\n <div *ngFor="let question of rootNode.question.questions">\n <encounter-viewer\n [node]="rootNode.children[question.key]"\n [parentComponent]="this"\n [schema]="_schema"\n [parentGroup]="parentGroup"\n ></encounter-viewer>\n </div>\n </div>\n\n \x3c!--Leaf Controls--\x3e\n <div style="margin-left: 10px">\n <form *ngIf="rootNode.question.controlType === 0" [formGroup]="parentGroup">\n <div *ngIf="rootNode.control.value">\n <div class="question-answer">\n <label\n *ngIf="rootNode.question.label"\n [attr.for]="rootNode.question.key"\n style="font-weight: 400"\n >\n {{ rootNode.question.label }}\n </label>\n <span *ngIf="checkForColon(rootNode.question.label)">:</span>\n <div\n [ngSwitch]="rootNode.question.renderingType"\n style="display: inline-block; font-weight: bold"\n >\n <div *ngSwitchCase="\'file\'">\n <file-preview\n [formControlName]="rootNode.question.key"\n [id]="rootNode.question.key + \'id\'"\n [dataSource]="fileDataSource"\n ></file-preview>\n </div>\n <div *ngSwitchCase="\'remote-select\'">\n <remote-answer\n [formControlName]="rootNode.question.key"\n [id]="rootNode.question.key + \'id\'"\n [dataSource]="remoteDataSource"\n ></remote-answer>\n </div>\n <div *ngSwitchDefault style="display: inline-block">\n <question-control\n [schema]="_schema"\n [value]="rootNode.control.value"\n [dataSource]="customDataSource"\n ></question-control>\n </div>\n </div>\n </div>\n </div>\n </form>\n </div>\n\n \x3c!--Array Controls--\x3e\n <div\n *ngIf="rootNode.question.controlType === 1 && questionsAnswered(rootNode)"\n >\n <div [ngSwitch]="rootNode.question.renderingType">\n <div *ngSwitchCase="\'repeating\'">\n <div [ngSwitch]="rootNode.question.extras.type">\n <div *ngSwitchCase="\'testOrder\'">\n <label>{{ rootNode.question.label }}:</label>\n <div *ngFor="let child of rootNode.children; let i = index">\n <encounter-viewer\n *ngFor="let question of child.question.questions"\n [parentComponent]="this"\n [node]="child.children[question.key]"\n [parentGroup]="child.control"\n [schema]="_schema"\n ></encounter-viewer>\n </div>\n </div>\n\n <div *ngSwitchCase="\'obsGroup\'">\n <div *ngFor="let child of rootNode.children; let i = index">\n <encounter-viewer\n *ngFor="let question of child.question.questions"\n [parentComponent]="this"\n [node]="child.children[question.key]"\n [parentGroup]="child.control"\n [schema]="_schema"\n ></encounter-viewer>\n </div>\n </div>\n </div>\n </div>\n </div>\n </div>\n\n <div *ngIf="rootNode.question.controlType === 2">\n \x3c!--GROUP--\x3e\n <div [ngSwitch]="rootNode.question.renderingType">\n <div *ngSwitchCase="\'group\'">\n <encounter-viewer\n *ngFor="let question of rootNode.question.questions"\n [parentComponent]="this"\n [node]="rootNode.children[question.key]"\n [parentGroup]="rootNode.control"\n [schema]="_schema"\n ></encounter-viewer>\n </div>\n <div *ngSwitchCase="\'field-set\'">\n <encounter-viewer\n *ngFor="let question of rootNode.question.questions"\n [parentComponent]="this"\n [node]="rootNode.children[question.key]"\n [parentGroup]="rootNode.control"\n [schema]="_schema"\n ></encounter-viewer>\n </div>\n </div>\n </div>\n</div>\n',styles:[".page-label{font-size:20px;font-weight:700}.section-label{font-size:18px;font-weight:500}.panel-primary{border:none!important}.question-answer{font-size:16px}.panel{margin-bottom:5px}div.section{margin-bottom:15px!important}.line-breaker{white-space:pre-line}hr{margin:10px}"]}]}],e.ctorParameters=function(){return[{type:EncounterViewerService},{type:DataSources}]},e.propDecorators={parentGroup:[{type:i0.Input}],parentComponent:[{type:i0.Input}],node:[{type:i0.Input}],schema:[{type:i0.Input}],encounter:[{type:i0.Input}],form:[{type:i0.Input}]},e}(),moment$9=moment_,EncounterPdfViewerService=function(){function e(e,t,n){this.encounterViewerService=e,this.obsValueAdapter=t,this.dataSources=n,this.subscribedAnswers={questions:{stack:[]},answers:[]}}return e.prototype.getPages=function(e,t,n,o){var r,i,a,s,l=[],u=[];try{for(var c=__values(e),p=c.next();!p.done;p=c.next()){var d=p.value;if(n)u=u.concat(this.getSections(d.page,t,!1,o));else try{for(var h=__values(t.rootNode.question.questions),f=h.next();!f.done;f=h.next()){var y=f.value;d.label===t.rootNode.children[y.key].question.label&&this.encounterViewerService.questionsAnswered(t.rootNode.children[y.key])&&l.push({style:"tableExample",table:{widths:["*"],headerRows:1,keepWithHeaderRows:1,body:[[{text:d.label,style:"tableHeader"}],[{style:"tableExample",table:{widths:["*"],body:this.getSections(d.page,t,!0,o)},layout:"noBorders",margin:[5,0,0,0]}]]},layout:{hLineWidth:function(e,t){return 0===e||t.table.body.length,.5},vLineWidth:function(e,t){return 0===e||t.table.widths.length,.5},hLineColor:function(e,t){return 0===e||t.table.body.length,"#ddd"},vLineColor:function(e,t){return 0===e||t.table.body.length,"#ddd"}}})}}catch(m){a={error:m}}finally{try{f&&!f.done&&(s=h["return"])&&s.call(h)}finally{if(a)throw a.error}}}}catch(g){r={error:g}}finally{try{p&&!p.done&&(i=c["return"])&&i.call(c)}finally{if(r)throw r.error}}return n?u:l},e.prototype.getSections=function(e,t,n,o){var r,i,a,s,l=this,u=[],c=[],p=[];e.map(function(e){l.encounterViewerService.questionsAnswered(e.node)&&c.push(e)});try{for(var d=__values(c),h=d.next();!h.done;h=d.next()){var f=h.value;p=p.concat(this.getRemoteSectionData(f.section))}}catch(g){r={error:g}}finally{try{h&&!h.done&&(i=d["return"])&&i.call(d)}finally{if(r)throw r.error}}if(n&&o){try{for(var y=__values(c),m=y.next();!m.done;m=y.next()){f=m.value;u.push([{table:{widths:["*"],body:[[{text:f.label,style:"tableSubheader"}],[this.getSectionData(f.section,o,t)]]},layout:"noBorders"}])}}catch(v){a={error:v}}finally{try{m&&!m.done&&(s=y["return"])&&s.call(y)}finally{if(a)throw a.error}}return u}return p},e.prototype.appendResolvedAnswer=function(e,t,n){e&&t.stack.push({text:[(n?n.question.label:"Question label")+(n?1<n.question.label.indexOf(":")?"":":":"")+" ",{text:""+e,bold:!0}],style:"answers"})},e.prototype.getRemoteSectionData=function(e){var t,n,o=[];this.subscribedAnswers.questions.stack=[];try{for(var r=__values(e),i=r.next();!i.done;i=r.next()){var a=i.value;"remote-select"===a.question.renderingType&&(this.remoteDataSource=this.dataSources.dataSources[a.question.dataSource],""!==a.control.value&&this.remoteDataSource&&o.push(this.remoteDataSource.resolveSelectedValue(a.control.value)))}}catch(s){t={error:s}}finally{try{i&&!i.done&&(n=r["return"])&&n.call(r)}finally{if(t)throw t.error}}return o},e.prototype.getSectionData=function(e,c,p){var t,n,d={stack:[]},h="",o=function(t){switch(t.question.renderingType){case"group":t.groupMembers&&d.stack.push(f.getSectionData(t.groupMembers,c,p));break;case"field-set":if(t.children){var e=[],n=Object.keys(t.children).map(function(e){return t.children[e]});n&&(e.push(n),d.stack.push(f.getSectionData(e[0],c,p)))}break;case"repeating":t.groupMembers&&d.stack.push(f.getSectionData(t.groupMembers,c,p));break;case"remote-select":f.remoteDataSource=f.dataSources.dataSources[t.question.dataSource];try{for(var o=__values(c),r=o.next();!r.done;r=o.next()){var i=r.value;i.value===t.control.value&&f.appendResolvedAnswer(i.label,d,t)}}catch(u){s={error:u}}finally{try{r&&!r.done&&(l=o["return"])&&l.call(o)}finally{if(s)throw s.error}}break;default:var a=t.control.value;a&&(h=f.resolveValue(a,p),f.appendResolvedAnswer(h,d,t))}var s,l},f=this;try{for(var r=__values(e),i=r.next();!i.done;i=r.next()){o(i.value)}}catch(a){t={error:a}}finally{try{i&&!i.done&&(n=r["return"])&&n.call(r)}finally{if(t)throw t.error}}return d},e.prototype.resolveValue=function(t,n,e){var o=this;if(""!==t){if(this.isUuid(t)){var r=this.encounterViewerService.resolveSelectedValueFromSchema(t,n.schema);return e?r:r?r.toUpperCase():t}if(_.isArray(t)){var i=[];return _.forEach(t,function(e){i.push(o.resolveValue(e,n,!0))}),i.toString()}if(this.isDate(t))return this.encounterViewerService.convertTime(t);if("object"!=typeof t)return t;var a=[],s=Object.keys(t).map(function(e){return[e,t[e]]});return a.push(s),a}},e.prototype.generatePdfDefinition=function(n){var o=this,r=new rxjs.BehaviorSubject({}),e=this.getPages(this.obsValueAdapter.traverse(n.rootNode),n,!0);return rxjs.combineLatest(e).subscribe(function(e){if(e){var t={pageSize:"A4",content:o.getPages(o.obsValueAdapter.traverse(n.rootNode),n,!1,e),styles:{answers:{fontSize:8},banner:{fontSize:9,bold:!0,margin:[50,15,30,0]},bannerItem:{margin:[2,2,2,2]},bannerLabel:{color:"#2f4f4f"},confidential:{color:"red",fontSize:8,bold:!0,margin:[60,0,0,0]},footer:{alignment:"center",fontSize:8,bold:!0},header:{fontSize:9,bold:!0,margin:[5,5,5,5]},pageNumber:{color:"#2f4f4f",fontSize:6},tableExample:{fontSize:10,margin:[5,0,0,5]},tableHeader:{fillColor:"#f5f5f5",width:["100%"],borderColor:"#333",fontSize:9,bold:!0,margin:[5,0,5,0]},tableSubheader:{fillColor:"#337ab7",width:["100%"],fontSize:9,color:"white",margin:[5,0,5,0]},timestamp:{bold:!0,color:"#2f4f4f"}},defaultStyle:{fontSize:7}};r.next(t)}}),r},e.prototype.displayPdf=function(e){var o,r=this,i=pdfMake;i.vfs=pdfMake.vfs,e.dataSourcesContainer.dataSources._dataSources&&(o=e.dataSourcesContainer.dataSources._dataSources.patientInfo),this.generatePdfDefinition(e).subscribe(function(e){if(!_.isEmpty(e)){if(void 0!==o){var t=[];o.name&&t.push({text:[{text:"Name: ",style:"bannerLabel"},{text:""+r.titleize(o.name)}],style:"bannerItem"}),o.nid&&t.push({text:[{text:"ID: ",style:"bannerLabel"},{text:""+o.nid}],style:"bannerItem"}),o.birthdate&&t.push({text:[{text:"DOB: ",style:"bannerLabel"},{text:moment$9(o.birthdate).format("l")+" ("+o.age+" yo)"}],style:"bannerItem"}),o.mui&&t.push({text:[{text:"MUI: ",style:"bannerLabel"},{text:""+o.mui}],style:"bannerItem"}),o.mhn&&t.push({text:[{text:"MTRH No: ",style:"bannerLabel"},{text:""+o.mhn}],style:"bannerItem"}),e.header={style:"banner",table:{body:[t]},layout:"noBorders"}}e.footer=function(e,t){return{style:"footer",widths:["*","auto"],table:{body:[[{text:"Note: Confidentiality is one of the core duties of all medical practitioners. Patients' personal health information should be kept private.",style:"confidential"},""],[{text:"Generated on "+(new Date).toUTCString(),style:"timestamp"},{text:e.toString()+" of "+t,style:"pageNumber"}]]},layout:"noBorders"}};var n=window.open("","_blank");i.createPdf(e).open({},n)}},function(e){console.log("Error: ",e)})},e.prototype.isDate=function(e){return moment$9(e,moment$9.ISO_8601,!0).isValid()},e.prototype.isUuid=function(e){return 36===e.length&&-1===e.indexOf(" ")&&-1===e.indexOf(".")},e.prototype.titleize=function(e){return e.replace(/\w\S*/g,function(e){return e.charAt(0).toUpperCase()+e.substr(1).toLowerCase()})},e.decorators=[{type:i0.Injectable,args:[{providedIn:"root"}]}],e.ctorParameters=function(){return[{type:EncounterViewerService},{type:ObsValueAdapter},{type:DataSources}]},e.ngInjectableDef=i0.defineInjectable({factory:function(){return new e(i0.inject(EncounterViewerService),i0.inject(ObsValueAdapter),i0.inject(DataSources))},token:e,providedIn:"root"}),e}(),EncounterContainerComponent=function(){function e(e,t){this.encAdapter=e,this.encounterPdfViewerService=t}return Object.defineProperty(e.prototype,"form",{set:function(e){this.$form=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"encounter",{set:function(e){this.$enc=e},enumerable:!0,configurable:!0}),e.prototype.ngOnInit=function(){},e.prototype.displayPdf=function(){this.encounterPdfViewerService.displayPdf(this.$form)},e.decorators=[{type:i0.Component,args:[{selector:"encounter-renderer",template:'<a\n type="button"\n style="display: block; font-size: 28px; cursor: pointer"\n class="text-right"\n (click)="displayPdf()"\n>\n <span class="glyphicon text-primary glyphicon-print"></span>\n</a>\n<encounter-viewer\n class="card"\n [form]="$form"\n [encounter]="$enc"\n></encounter-viewer>\n',styles:[".card{box-shadow:0 2px 5px 0 rgba(0,0,0,.16),0 2px 10px 0 rgba(0,0,0,.12)}"]}]}],e.ctorParameters=function(){return[{type:EncounterAdapter},{type:EncounterPdfViewerService}]},e.propDecorators={form:[{type:i0.Input}],encounter:[{type:i0.Input}]},e}(),QuestionControlComponent=function(){function e(){this.innerValue=""}return Object.defineProperty(e.prototype,"schema",{set:function(e){this._schema=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"value",{set:function(e){this._value=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"dataSource",{set:function(e){this._dataSource=e},enumerable:!0,configurable:!0}),e.prototype.ngOnInit=function(){this.writeValue(this._value)},e.prototype.isUuid=function(e){return 36===e.length&&-1===e.indexOf(" ")&&-1===e.indexOf(".")},e.prototype.writeValue=function(e,t){var n=this;if(e!==this.innerValue)if(this.isUuid(e)){if(t)return this._dataSource.resolveSelectedValueFromSchema(e,this._schema);var o=this._dataSource.resolveSelectedValueFromSchema(e,this._schema);this.innerValue=o?o.toUpperCase():e}else if(_.isArray(e)){var r=[];_.forEach(e,function(e){r.push(n.writeValue(e,!0))}),this.innerValue=r}else if(this.isDate(e)){if(t)return this._dataSource.convertTime(e);this.innerValue=this._dataSource.convertTime(e)}else{if(t)return e;this.innerValue=e}},e.prototype.isDate=function(e){return this._dataSource.isDate(e)&&!_.isNumber(e)},e.decorators=[{type:i0.Component,args:[{selector:"question-control",styles:["input{border:none;box-shadow:none;color:#000;background:#fff!important;padding-top:23px;display:block;position:relative}"],template:"<div>\n {{ innerValue }}\n</div>\n"}]}],e.ctorParameters=function(){return[]},e.propDecorators={schema:[{type:i0.Input}],value:[{type:i0.Input}],dataSource:[{type:i0.Input}]},e}(),noop=function(){},FilePreviewComponent=function(){function e(e){this.encounterService=e,this.fileUuid=null,this.resultsIsPdf=!1,this.onTouchedCallback=noop,this.onChangeCallback=noop}return Object.defineProperty(e.prototype,"dataSource",{get:function(){return this._dataSource},set:function(e){this._dataSource=e},enumerable:!0,configurable:!0}),e.prototype.ngOnInit=function(){},Object.defineProperty(e.prototype,"value",{get:function(){return this.fileUuid},set:function(e){e!==this.fileUuid&&(this.fileUuid=e)},enumerable:!0,configurable:!0}),e.prototype.writeValue=function(e){e!==this.fileUuid&&(this.fileUuid=e,this.checkFileType())},e.prototype.checkFileType=function(){-1!==this.fileUuid.search(/pdf/gi)&&(this.resultsIsPdf=!0)},e.prototype.registerOnChange=function(e){this.onChangeCallback=e},e.prototype.registerOnTouched=function(e){this.onTouchedCallback=e},e.prototype.onBlur=function(){this.onTouchedCallback()},e.prototype.onChange=function(e){},e.prototype.getUrl=function(){this.dataSource.fetchFile(this.fileUuid,"pdf").subscribe(function(e){window.open(e.changingThisBreaksApplicationSecurity,"_blank")})},e.decorators=[{type:i0.Component,args:[{selector:"file-preview",styles:[""],template:'<div *ngIf="fileUuid">\n <img\n *ngIf="!resultsIsPdf"\n class="img-responsive"\n [src]="fileUuid | secure: this._dataSource.fetchFile"\n alt="image"\n />\n </div>\n <a *ngIf="resultsIsPdf" (click)="getUrl()" style="cursor: pointer"\n ><u>Open PDF</u></a\n > ',providers:[{provide:forms.NG_VALUE_ACCESSOR,useExisting:i0.forwardRef(function(){return e}),multi:!0}]}]}],e.ctorParameters=function(){return[{type:EncounterViewerService}]},e.propDecorators={source:[{type:i0.Input}],dataSource:[{type:i0.Input}]},e}(),noop$1=function(){},RemoteAnswerComponent=function(){function e(){this.innerValue=null,this.onTouchedCallback=noop$1,this.onChangeCallback=noop$1}return Object.defineProperty(e.prototype,"dataSource",{get:function(){return this._dataSource},set:function(e){this._dataSource=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"value",{get:function(){return this.innerValue},set:function(e){e!==this.innerValue&&(this.innerValue=e)},enumerable:!0,configurable:!0}),e.prototype.writeValue=function(e){var t=this;e!==this.innerValue&&(this._dataSource?this._dataSource.resolveSelectedValue(e).subscribe(function(e){t.innerValue=e.label}):this.innerValue=e)},e.prototype.registerOnChange=function(e){this.onChangeCallback=e},e.prototype.registerOnTouched=function(e){this.onTouchedCallback=e},e.prototype.onBlur=function(){this.onTouchedCallback()},e.prototype.onChange=function(e){},e.decorators=[{type:i0.Component,args:[{selector:"remote-answer",styles:[],template:'\n <div *ngIf="innerValue">\n {{ innerValue }}\n </div>\n ',providers:[{provide:forms.NG_VALUE_ACCESSOR,useExisting:i0.forwardRef(function(){return e}),multi:!0}]}]}],e.ctorParameters=function(){return[]},e.propDecorators={source:[{type:i0.Input}],dataSource:[{type:i0.Input}]},e}(),EncounterViewerModule=function(){function e(){}return e.decorators=[{type:i0.NgModule,args:[{declarations:[EncounterViewerComponent,EncounterContainerComponent,QuestionControlComponent,FilePreviewComponent,RemoteAnswerComponent],imports:[forms.FormsModule,forms.ReactiveFormsModule,common.CommonModule,http.HttpClientModule,SharedModule],providers:[EncounterViewerService,EncounterPdfViewerService],exports:[EncounterContainerComponent,http.HttpClientModule]}]}],e}(),CheckboxControlComponent=function(){function e(){this._value=[],this.onChange=function(e){},this.onTouched=function(){}}return e.prototype.ngOnInit=function(){var t=this;this.options=this.options.map(function(e){return-1!==t.selected.indexOf(e.value)&&Object.assign(e,{checked:!0}),e})},e.prototype.ngAfterViewInit=function(){},e.prototype.writeValue=function(e){this.value=e},e.prototype.registerOnChange=function(e){this.onChange=e},e.prototype.registerOnTouched=function(e){this.onTouched=e},Object.defineProperty(e.prototype,"value",{get:function(){return 0===this._value.length?"":this._value||this._value[0]},set:function(e){if(null==e||""===e)e=[];else if("string"==typeof e)e=[e];else if(!Array.isArray(e))throw new TypeError("Value must be a string or an array.")},enumerable:!0,configurable:!0}),e.prototype.selectOpt=function(t,e){var n=this;e.target.checked?this._value.push(t.value):this.options.forEach(function(e){e.value===t.value&&n._value.splice(e,1)}),this.onChange(this.value)},e.decorators=[{type:i0.Component,args:[{selector:"checkbox",template:'<div *ngFor="let option of options; let i = index">\n <label class="form-control no-border">\n <input\n type="checkbox"\n id="i + \'id\'"\n (change)="selectOpt(option, $event)"\n value="option.value"\n [checked]="option.checked"\n />\n {{ option.label }}\n </label>\n</div>\n',providers:[{provide:forms.NG_VALUE_ACCESSOR,useExisting:i0.forwardRef(function(){return e}),multi:!0}],styles:["\n .no-border {\n border: 0;\n box-shadow: none;\n }\n "]}]}],e.propDecorators={options:[{type:i0.Input}],selected:[{type:i0.Input}]},e}(),CheckboxModule=function(){function e(){}return e.decorators=[{type:i0.NgModule,args:[{declarations:[CheckboxControlComponent],exports:[CheckboxControlComponent],imports:[common.CommonModule,forms.FormsModule]}]}],e}(),moment$a=moment_,NgxTimePickerComponent=function(){function e(){this.value=moment$a().format("HH:mm:ss"),this.onChange=function(){},this.onTouched=function(){}}return e.prototype.ngOnInit=function(){},e.prototype.writeValue=function(e){this.value=this.formatTimeValue(e)},e.prototype.registerOnChange=function(e){this.onChange=e},e.prototype.registerOnTouched=function(e){},e.prototype.onTimeSelect=function(e){var t=this.formatTimeValue(e);this.value=t,this.onChange(t)},e.prototype.formatTimeValue=function(e){var t=[],n=[];return null==e||(t=e.split(":"),n=e.split("-")),1===t.length&&moment$a(e).isValid()?moment$a(e).format("HH:mm:ss"):1<t.length&&t.length<2?moment$a(e,moment$a.defaultFormat).format("HH:mm:ss"):2<=t.length&&1<n.length?moment$a(e,moment$a.defaultFormat).format("HH:mm:ss"):2<=t.length&&n.length<=1?moment$a(e,"HH:mm:ss").format("HH:mm:ss"):moment$a().format("HH:mm:ss")},e.decorators=[{type:i0.Component,args:[{selector:"ngx-time-picker",template:'<input\n type="time"\n class="form-control"\n [ngModel]="value"\n (ngModelChange)="onTimeSelect($event)"\n/>\n',styles:[""],providers:[{provide:forms.NG_VALUE_ACCESSOR,multi:!0,useExisting:i0.forwardRef(function(){return e})}]}]}],e}(),NgxTimePickerModule=function(){function e(){}return e.decorators=[{type:i0.NgModule,args:[{imports:[common.CommonModule,forms.FormsModule,forms.ReactiveFormsModule],declarations:[NgxTimePickerComponent],exports:[NgxTimePickerComponent],providers:[]}]}],e}(),FormEntryModule=function(){function e(){}return e.decorators=[{type:i0.NgModule,args:[{imports:[common.CommonModule,forms.ReactiveFormsModule,collapse.CollapseModule,SelectModule,DateTimePickerModule,RemoteSelectModule,RemoteFileUploadModule,EncounterViewerModule,CheckboxModule,material.MatIconModule,material.MatTabsModule,material.MatCardModule,NgxDateTimePickerModule,NgxTimePickerModule,SharedModule],declarations:[FormRendererComponent,AfeNgSelectComponent,AppointmentsOverviewComponent,HistoricalValueDirective,ErrorRendererComponent,timeAgoPipe.TimeAgoPipe],providers:[forms.FormBuilder,FormControlService,FormErrorsService,ValidationFactory,HidersDisablersFactory,AlertsFactory,ExpressionRunner,JsExpressionHelper,HistoricalFieldHelperService,FormSchemaCompiler,FormFactory,QuestionFactory,ValidationFactory,ControlRelationsFactory,ObsAdapterHelper,ObsValueAdapter,EncounterAdapter,PersonAttribuAdapter,OrderValueAdapter,DebugModeService],exports:[FormRendererComponent,AfeNgSelectComponent,ErrorRendererComponent,DateTimePickerModule,EncounterViewerModule,NgxDateTimePickerModule,NgxTimePickerModule]}]}],e}(),Pair=function nL(e,t){this.key=e,this.value=t},qL;qL=exports.RenderingType||(exports.RenderingType={}),qL[qL.Form=0]="Form",qL[qL.Page=1]="Page",qL[qL.Section=2]="Section",qL[qL.Select=3]="Select",qL[qL.DropDown=4]="DropDown",exports.ɵbg=AfeNgSelectComponent,exports.ɵbh=AppointmentsOverviewComponent,exports.ɵz=CheckboxControlComponent,exports.ɵy=CheckboxModule,exports.ɵg=DatePickerComponent,exports.ɵk=DateTimePickerComponent,exports.ɵi=ModalComponent,exports.ɵj=MomentPipe,exports.ɵh=TimePickerComponent,exports.ɵq=FileUploadComponent,exports.ɵn=RemoteFileUploadModule,exports.ɵp=SecurePipe,exports.ɵba=MY_FORMATS,exports.ɵbb=NgxDateTimePickerComponent,exports.ɵbd=NgxTimePickerComponent,exports.ɵbc=NgxTimePickerModule,exports.ɵm=RemoteSelectComponent,exports.ɵl=RemoteSelectModule,exports.ɵe=SelectDropdownComponent,exports.ɵf=STYLE$1,exports.ɵb=SELECT_VALUE_ACCESSOR,exports.ɵc=SelectComponent,exports.ɵd=STYLE,exports.ɵa=SelectModule,exports.ɵw=FilePreviewComponent,exports.ɵv=QuestionControlComponent,exports.ɵx=RemoteAnswerComponent,exports.ɵu=EncounterContainerComponent,exports.ɵs=EncounterViewerComponent,exports.ɵr=EncounterViewerModule,exports.ɵt=EncounterViewerService,exports.ɵbi=HistoricalValueDirective,exports.ɵbk=ErrorRendererComponent,exports.ɵbm=ExpressionRunner,exports.ɵbl=HidersDisablersFactory,exports.ɵbo=AlertsFactory,exports.ɵbe=FormRendererComponent,exports.ɵbf=DEFAULT_STYLES,exports.ɵbj=HistoricalFieldHelperService,exports.ɵbn=DebugModeService,exports.ɵo=SharedModule,exports.FormEntryModule=FormEntryModule,exports.AfeFormControl=AfeFormControl,exports.AfeFormGroup=AfeFormGroup,exports.AfeFormArray=AfeFormArray,exports.EncounterPdfViewerService=EncounterPdfViewerService,exports.ControlRelationsFactory=ControlRelationsFactory,exports.FormControlService=FormControlService,exports.FormFactory=FormFactory,exports.Form=Form,exports.QuestionFactory=QuestionFactory,exports.ValidationFactory=ValidationFactory,exports.FormSchemaCompiler=FormSchemaCompiler,exports.HistoricalEncounterDataService=HistoricalEncounterDataService,exports.FormErrorsService=FormErrorsService,exports.EncounterAdapter=EncounterAdapter,exports.PersonAttribuAdapter=PersonAttribuAdapter,exports.OrderValueAdapter=OrderValueAdapter,exports.ObsValueAdapter=ObsValueAdapter,exports.ObsAdapterHelper=ObsAdapterHelper,exports.DataSources=DataSources,exports.CheckBoxQuestion=CheckBoxQuestion,exports.ConditionalValidationModel=ConditionalValidationModel,exports.DateQuestion=DateQuestion,exports.DateValidationModel=DateValidationModel,exports.FileUploadQuestion=FileUploadQuestion,exports.QuestionGroup=QuestionGroup,exports.JsExpressionValidationModel=JsExpressionValidationModel,exports.MaxValidationModel=MaxValidationModel,exports.MinValidationModel=MinValidationModel,exports.MultiSelectQuestion=MultiSelectQuestion,exports.Pair=Pair,exports.QuestionBase=QuestionBase,exports.RepeatingQuestion=RepeatingQuestion,exports.Option=Option$1,exports.SelectQuestion=SelectQuestion,exports.TestOrderQuestion=TestOrderQuestion,exports.TextAreaInputQuestion=TextAreaInputQuestion,exports.TextInputQuestion=TextInputQuestion,exports.UiSelectQuestion=UiSelectQuestion,exports.ValidationModel=ValidationModel,exports.NestedQuestion=NestedQuestion,exports.DateTimePickerModule=DateTimePickerModule,exports.NgxDateTimePickerModule=NgxDateTimePickerModule,exports.JsExpressionHelper=JsExpressionHelper,Object.defineProperty(exports,"__esModule",{value:!0})});
1
+ !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@angular/core"),require("rxjs"),require("@angular/forms"),require("moment"),require("lodash"),require("hammerjs"),require("@angular/common"),require("@angular/platform-browser"),require("ngx-file-uploader"),require("ngx-webcam"),require("@angular/material/core"),require("@angular/material-moment-adapter"),require("@angular/material/datepicker"),require("@angular/material/form-field"),require("@angular/material"),require("@angular/material/select"),require("pdfmake/build/pdfmake.js"),require("pdfmake/build/vfs_fonts.js"),require("@angular/common/http"),require("ngx-bootstrap/collapse"),require("time-ago-pipe")):"function"==typeof define&&define.amd?define("@ampath-kenya/ngx-openmrs-formentry",["exports","@angular/core","rxjs","@angular/forms","moment","lodash","hammerjs","@angular/common","@angular/platform-browser","ngx-file-uploader","ngx-webcam","@angular/material/core","@angular/material-moment-adapter","@angular/material/datepicker","@angular/material/form-field","@angular/material","@angular/material/select","pdfmake/build/pdfmake.js","pdfmake/build/vfs_fonts.js","@angular/common/http","ngx-bootstrap/collapse","time-ago-pipe"],t):t((e["ampath-kenya"]=e["ampath-kenya"]||{},e["ampath-kenya"]["ngx-openmrs-formentry"]={}),e.ng.core,e.rxjs,e.ng.forms,null,null,null,e.ng.common,e.ng.platformBrowser,null,null,e.ng.material.core,e.ng["material-moment-adapter"],e.ng.material.datepicker,e.ng.material["form-field"],e.ng.material,e.ng.material.select,null,null,e.ng.common.http,null,null)}(this,function(exports,i0,rxjs,forms,moment_,_,hammerjs,common,platformBrowser,ngxFileUploader,ngxWebcam,core,materialMomentAdapter,datepicker,formField,material,select,pdfMake,vfs_fonts_js,http,collapse,timeAgoPipe){"use strict";var DebugModeService=function(){function e(){this.cookieKey="formDebug"}return e.prototype.debugEnabled=function(){return!1},e.decorators=[{type:i0.Injectable}],e.ctorParameters=function(){return[]},e}(),FormErrorsService=function(){function e(){this.announceErrorFieldSource=new rxjs.Subject,this.announceErrorField$=this.announceErrorFieldSource.asObservable()}return e.prototype.announceErrorField=function(e){this.announceErrorFieldSource.next(e)},e.control=null,e.tab=null,e.decorators=[{type:i0.Injectable}],e}(),extendStatics=function(e,t){return(extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)};function __extends(e,t){function n(){this.constructor=e}extendStatics(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}function __values(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],o=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&o>=e.length&&(e=void 0),{value:e&&e[o++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}var ControlRelation=function(){function e(e,t){this._control=e,this._relatedTo=t,this._registerForChangesFromRelatedControl()}return Object.defineProperty(e.prototype,"control",{get:function(){return this._control},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"relatedTo",{get:function(){return this._relatedTo},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"lastUpdateValue",{get:function(){return this._lastUpdateValue},enumerable:!0,configurable:!0}),e.prototype.updateControlBasedOnRelation=function(e){return e!==this._lastUpdateValue&&(this._lastUpdateValue=e,this._control.updateCalculatedValue&&this._control.updateCalculatedValue(),this._control.updateValueAndValidity(),this._control.updateHiddenState&&this._control.updateHiddenState(),this._control.updateDisabledState&&this._control.updateDisabledState(),this._control.updateAlert&&this._control.updateAlert(),!0)},e.prototype._registerForChangesFromRelatedControl=function(){var t=this;this._relatedTo.valueChanges.subscribe(function(e){t.updateControlBasedOnRelation(e)})},e}(),ControlRelations=function(){function e(e,t){this._otherRelations=[],this._relationFor=e,this._relations=[],t&&this.addRelatedControls(t)}return Object.defineProperty(e.prototype,"relationsFor",{get:function(){return this._relationFor},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"relations",{get:function(){return this._relations},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"otherRelations",{get:function(){return this._otherRelations},enumerable:!0,configurable:!0}),e.prototype.addRelatedControls=function(e){if(e instanceof forms.AbstractControl&&this.relations.push(new ControlRelation(this._relationFor,e)),e instanceof Array)for(var t=0;t<e.length;t++)this.relations.push(new ControlRelation(this._relationFor,e[t]))},e}(),HiderHelper=function(){function e(){}return e.prototype.hideControl=function(e){e.hidden=!0,e.disable&&e.disable()},e.prototype.showControl=function(e){e.hidden=!1},e.prototype.setHiderForControl=function(e,t){e.hiders.push(t)},e.prototype.clearHidersForControl=function(e){e.hiders.splice(0),e.hidden=!1},e.prototype.evaluateControlHiders=function(e){var t=!1;e.hiders.forEach(function(e){e.reEvaluateHidingExpression(),!0===e.toHide&&(t=!0)}),e.hidden=t,e.hidden&&e.disable&&e.disable()},e.prototype.setUpReEvaluationWhenValueChanges=function(t){t.updateHiddenState&&t.valueChanges.subscribe(function(e){t.updateHiddenState()})},e}(),AlertHelper=function(){function e(){}return e.prototype.hideAlert=function(e){e.shown=!1},e.prototype.showAlert=function(e){e.shown=!0},e.prototype.setAlertsForControl=function(e,t){e.alerts.push(t)},e.prototype.clearAlertsForControl=function(e){e.alerts.splice(0),e.alert=""},e.prototype.evaluateControlAlerts=function(e){var t="";e.alerts.forEach(function(e){e.reEvaluateAlertExpression(),t=!0===e.shown?e.alertMessage:""}),e.alert=t},e.prototype.setUpReEvaluationWhenValueChanges=function(t){t.updateAlert&&t.valueChanges.subscribe(function(e){t.updateAlert()})},e}(),DisablerHelper=function(){function e(){}return e.prototype.setDisablerForControl=function(e,t){e.disablers.push(t)},e.prototype.clearDisablersForControl=function(e){e.disablers.splice(0),e.disable()},e.prototype.evaluateControlDisablers=function(e){var t=!1;e.disablers.forEach(function(e){e.reEvaluateDisablingExpression(),!0===e.toDisable&&(t=!0)}),t?e.disable():e.enable()},e.prototype.setUpReEvaluationWhenValueChanges=function(t){t.updateDisabledState&&t.valueChanges.subscribe(function(e){t.updateDisabledState()})},e}(),NodeBase=function(){function e(e,t,n,o){this._control=t,this._questionModel=e,this._form=n,this._path=o?o+"."+e.key:e.key}return Object.defineProperty(e.prototype,"question",{get:function(){return this._questionModel},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"control",{get:function(){return this._control},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"form",{get:function(){return this._form},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"path",{get:function(){return this._path},enumerable:!0,configurable:!0}),e.prototype.removeAt=function(e){},e.prototype.createChildNode=function(){},e.prototype.removeChildNode=function(){},e}(),LeafNode=function(i){function e(e,t,n,o,r){return i.call(this,e,t,o,r)||this}return __extends(e,i),e}(NodeBase),GroupNode=function(a){function e(e,t,n,o,r){var i=a.call(this,e,t,o,r)||this;return i._children={},i}return __extends(e,a),Object.defineProperty(e.prototype,"children",{get:function(){return this._children},enumerable:!0,configurable:!0}),e.prototype.setChild=function(e,t){this.children[e]=t},e}(NodeBase),ArrayNode=function(s){function e(e,t,n,o,r,i){var a=s.call(this,e,t,r,i)||this;return a.formFactory=o,a.childNodeCreatedEvents=[],a._children=[],a.childNodeCreatedEvents=[],a}return __extends(e,s),Object.defineProperty(e.prototype,"children",{get:function(){return this._children},enumerable:!0,configurable:!0}),e.prototype.createChildNode=function(){if(this.createChildFunc){var e=this.createChildFunc(this.question,this,this.formFactory);return this.fireChildNodeCreatedListener(e),e}return null},e.prototype.removeAt=function(e){confirm("Are you sure you want to remove?")&&this.removeChildFunc&&this.removeChildFunc(e,this)},e.prototype.addChildNodeCreatedListener=function(e){this.childNodeCreatedEvents.push(e)},e.prototype.fireChildNodeCreatedListener=function(e){for(var t=0;t<this.childNodeCreatedEvents.length;t++){(0,this.childNodeCreatedEvents[t])(e)}},e}(NodeBase),ValidationModel=function Xa(e){this.type=e.type,this.message=e.message||null},JsExpressionValidationModel=function(n){function e(e){var t=n.call(this,e)||this;return t.failsWhenExpression=e.failsWhenExpression,t}return __extends(e,n),e}(ValidationModel),ConditionalValidationModel=function(n){function e(e){var t=n.call(this,e)||this;return t.referenceQuestionId=e.referenceQuestionId,t.referenceQuestionAnswers=e.referenceQuestionAnswers,t}return __extends(e,n),e}(ValidationModel),ControlRelationsFactory=function(){function e(){}return e.prototype.buildRelations=function(e){var t=this.mapControlIds(e,{});for(var n in t)if(t.hasOwnProperty(n)){var o=t[n];this.setRelations(t,o)}},e.prototype.buildArrayNodeRelations=function(e){var t=e.form;if(t){var n=t.rootNode;this.buildRelations(e);var o=this.mapControlIds(n,{}),r=this.mapControlIds(e,{});for(var i in o){if(o.hasOwnProperty(i))if((l=o[i])instanceof LeafNode){var a=l.question;a.key&&0<a.key.length&&this.setRelations(r,l)}}for(var s in this.createRelationsToArrayControls(e),r)if(r.hasOwnProperty(s)){var l,u=(l=r[s]).control;u.updateHiddenState(),u.updateAlert()}}},e.prototype.createRelationsToArrayControls=function(a){var s=a.form.rootNode,e=this.mapControlIds(s,{}),l=this.mapControlIds(a,{});for(var t in e)if(e.hasOwnProperty(t)){var u=e[t],c=a.path.substring(0,a.path.lastIndexOf("."));if(-1===u.path.indexOf(c+".")){var n=function(e){if(l.hasOwnProperty(e)){var t=l[e],n=t.question.key;if(p.hasRelation(n,u.question)){var o=a.form.searchNodeByPath(s,c,[]);if(0<o.length){var r=o[0],i=u.control;-1===i.controlRelations.otherRelations.indexOf(r)&&i.controlRelations.otherRelations.push(r),t.control.addValueChangeListener(function(e){i.updateCalculatedValue&&i.updateCalculatedValue(),i.updateValueAndValidity(),i.updateHiddenState&&i.updateHiddenState(),i.updateAlert&&i.updateAlert(),i.updateDisabledState&&i.updateDisabledState()})}}}},p=this;for(var o in l)n(o)}}},e.prototype.getRelationsForControl=function(e,t){var n=new Array,o=t.form.searchNodeByQuestionId(e);if(0<o.length){var r=o[0],i=this.mapControlIds(t,{});for(var a in i)i.hasOwnProperty(a)&&this.hasRelation(i[a].question.key,r.question)&&n.push(i[a].control)}return n},e.prototype.mapControlIds=function(e,t){var n=e.children;for(var o in n)if(n.hasOwnProperty(o)){var r=n[o];if(r instanceof GroupNode)this.mapControlIds(r,t);else if(r instanceof LeafNode){(i=r.question).key&&0<i.key.length&&(t[i.key]=r)}else if(r instanceof ArrayNode){var i;(i=r.question).key&&0<i.key.length&&(t[i.key]=r)}}return t},e.prototype.setRelations=function(e,t){var n=t.question.key;for(var o in e)if(e.hasOwnProperty(o)&&o!==n){var r=e[o],i=r.question;if(this.hasRelation(n,i,t)&&this.addRelationToControl(r.control,t.control),"object"==typeof i.required){var a=i.required;"conditionalRequired"===a.type&&a.referenceQuestionId===n&&this.addRelationToControl(r.control,t.control)}}},e.prototype.hasRelation=function(n,e,t){var o=!1;if(e.validators&&0<e.validators.length&&e.validators.forEach(function(e){if(e instanceof JsExpressionValidationModel){var t=e.failsWhenExpression;t&&-1!==t.indexOf(n)&&(o=!0)}else e instanceof ConditionalValidationModel&&"conditionalAnswered"===e.type&&e.referenceQuestionId===n&&(o=!0)}),!o){if("string"==typeof e.hide){var r=e.hide;0<r.length&&-1!==r.indexOf(n)&&(o=!0)}else if("object"==typeof e.hide){e.hide.field===n&&(o=!0)}if(e.alert&&"object"==typeof e.alert&&(o=!0),"string"==typeof e.disable){var i=e.disable;0<i.length&&-1!==i.indexOf(n)&&(o=!0)}}return!o&&e.calculateExpression&&0<e.calculateExpression.length&&-1!==e.calculateExpression.indexOf(n)&&(o=!0),o},e.prototype.addRelationToControl=function(e,t){e.controlRelations.addRelatedControls(t)},e.decorators=[{type:i0.Injectable}],e.ctorParameters=function(){return[]},e}(),moment=moment_,ExpressionRunner=function(){function ExpressionRunner(){}return ExpressionRunner.prototype.getRunnable=function(expression,control,helper,dataDependencies,form){var runner=this,runnable={run:function(){var scope={};control.uuid&&(scope[control.uuid]=control.value),window.moment=moment,scope.myValue=control.value,runner.getControlRelationValueString(control,scope),runner.getHelperMethods(helper,scope),runner.getDataDependencies(dataDependencies,scope),form&&runner.getDataDependencies(form.dataSourcesContainer.dataSources,scope);var paramList="",argList="";for(var o in scope)paramList=""===paramList?paramList+o:paramList+","+o,argList=""===argList?argList+"scope['"+o+"']":argList+",scope['"+o+"']";-1===expression.indexOf("return")&&(expression='"return '+expression+'"');var funcDeclarationCode='var afeDynamicFunc = new Function("'+paramList+'", '+expression+");",funcCallCode="afeDynamicFunc.call(this "+(""===argList?"":","+argList)+");";try{return 0<=Object.keys(scope).indexOf("undefined")?(console.warn("Missing reference found",expression,scope),!1):eval(funcDeclarationCode+funcCallCode)}catch(e){return!1}}};return runnable},ExpressionRunner.prototype.getControlRelationValueString=function(i,a){var s=this;i&&i.controlRelations&&i.controlRelations.relations&&i.controlRelations.relations.forEach(function(e){if(e.relatedTo){var t=e.relatedTo,n=e.relatedTo;n&&Array.isArray(n.value)?a[t.uuid]=e.relatedTo.value:a[t.uuid]=e.relatedTo.value&&e.relatedTo.value.value?e.relatedTo.value.value:e.relatedTo.value}}),i&&i.controlRelations&&i.controlRelations.otherRelations&&0<i.controlRelations.otherRelations.length&&i.controlRelations.otherRelations.forEach(function(e){if(e instanceof ArrayNode){var t=e,n=i.uuid,o=new ControlRelationsFactory,r=[];t.children.forEach(function(e){r=r.concat(o.getRelationsForControl(n,e))}),s.setControlArrayValues(i,r,a)}})},ExpressionRunner.prototype.setControlArrayValues=function(e,n,o){var r=this;this._getFormControlKeys(n).forEach(function(e){var t=r._getValuesForKey(e,n);o[e]=t})},ExpressionRunner.prototype._getFormControlKeys=function(e){var t=[];return e.forEach(function(e){-1===t.indexOf(e.uuid)&&t.push(e.uuid)}),t},ExpressionRunner.prototype._getValuesForKey=function(t,e){var n=[];return e.forEach(function(e){e.uuid===t&&n.push(e.value)}),n},ExpressionRunner.prototype.getHelperMethods=function(e,t){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])},ExpressionRunner.prototype.getDataDependencies=function(e,t){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])},ExpressionRunner}(),AfeFormControl=function(r){function e(e,t,n){var o=r.call(this,e,t,n)||this;return o.hidden=!1,o.hiderHelper=new HiderHelper,o.disablerHelper=new DisablerHelper,o.AlertHelper=new AlertHelper,o._controlRelations=new ControlRelations(o),o.hiders=[],o.disablers=[],o.alerts=[],o.valueChanges.subscribe(function(e){o._previousValue!==e&&(o.fireValueChangeListener(e),o._previousValue=e)}),o}return __extends(e,r),Object.defineProperty(e.prototype,"controlRelations",{get:function(){return this._controlRelations},enumerable:!0,configurable:!0}),e.prototype.disable=function(e){r.prototype.disable.call(this,e),r.prototype.setValue.call(this,"")},e.prototype.hide=function(){this.hiderHelper.hideControl(this)},e.prototype.show=function(){this.hiderHelper.showControl(this)},e.prototype.setHidingFn=function(e){this.hiderHelper.setHiderForControl(this,e)},e.prototype.setCalculatorFn=function(e){this.calculator=e},e.prototype.updateCalculatedValue=function(){if(this.calculator){var e=this.calculator.call(ExpressionRunner,{});this.setValue(e)}},e.prototype.clearHidingFns=function(){this.hiderHelper.clearHidersForControl(this)},e.prototype.updateHiddenState=function(){this.hiderHelper.evaluateControlHiders(this)},e.prototype.setDisablingFn=function(e){this.disablerHelper.setDisablerForControl(this,e)},e.prototype.clearDisablingFns=function(){this.disablerHelper.clearDisablersForControl(this)},e.prototype.updateDisabledState=function(){this.disablerHelper.evaluateControlDisablers(this)},e.prototype.setAlertFn=function(e){this.AlertHelper.setAlertsForControl(this,e)},e.prototype.clearMessageFns=function(){this.AlertHelper.clearAlertsForControl(this)},e.prototype.updateAlert=function(){this.AlertHelper.evaluateControlAlerts(this)},e.prototype.addValueChangeListener=function(e){this._valueChangeListener=e},e.prototype.fireValueChangeListener=function(e){this._valueChangeListener&&"function"==typeof this._valueChangeListener&&this._valueChangeListener(e)},e.prototype.setValue=function(e){r.prototype.setValue.call(this,e)},e}(forms.FormControl),AfeFormGroup=function(r){function e(e,t,n){var o=r.call(this,e,t,n)||this;return o.hiderHelper=new HiderHelper,o.disablerHelper=new DisablerHelper,o.AlertHelper=new AlertHelper,o._controlRelations=new ControlRelations(o),o.hiders=[],o.disablers=[],o.alerts=[],o}return __extends(e,r),Object.defineProperty(e.prototype,"controlRelations",{get:function(){return this._controlRelations},enumerable:!0,configurable:!0}),e.prototype.hide=function(){this.hiderHelper.hideControl(this)},e.prototype.show=function(){this.hiderHelper.showControl(this)},e.prototype.disable=function(e){r.prototype.disable.call(this,e),r.prototype.setValue.call(this,{})},e.prototype.setHidingFn=function(e){this.hiderHelper.setHiderForControl(this,e)},e.prototype.clearHidingFns=function(){this.hiderHelper.clearHidersForControl(this)},e.prototype.updateHiddenState=function(){this.hiderHelper.evaluateControlHiders(this)},e.prototype.setDisablingFn=function(e){this.disablerHelper.setDisablerForControl(this,e)},e.prototype.clearDisablingFns=function(){this.disablerHelper.clearDisablersForControl(this)},e.prototype.updateDisabledState=function(){this.disablerHelper.evaluateControlDisablers(this)},e.prototype.setAlertFn=function(e){this.AlertHelper.setAlertsForControl(this,e)},e.prototype.clearMessageFns=function(){this.AlertHelper.clearAlertsForControl(this)},e.prototype.updateAlert=function(){this.AlertHelper.evaluateControlAlerts(this)},e.prototype.setValue=function(e){r.prototype.setValue.call(this,e)},e}(forms.FormGroup),AfeFormArray=function(r){function e(e,t,n){var o=r.call(this,e,t,n)||this;return o.hiderHelper=new HiderHelper,o.AlertHelper=new AlertHelper,o.disablerHelper=new DisablerHelper,o._controlRelations=new ControlRelations(o),o.hiders=[],o.alerts=[],o.disablers=[],o.valueChanges.subscribe(function(e){o._previousValue!==e&&(o.fireValueChangeListener(e),o._previousValue=e)}),o}return __extends(e,r),Object.defineProperty(e.prototype,"uuid",{get:function(){return this._uuid},set:function(e){this._uuid=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"controlRelations",{get:function(){return this._controlRelations},enumerable:!0,configurable:!0}),e.prototype.hide=function(){this.hiderHelper.hideControl(this)},e.prototype.show=function(){this.hiderHelper.showControl(this)},e.prototype.disable=function(e){r.prototype.disable.call(this,e),r.prototype.setValue.call(this,[])},e.prototype.setHidingFn=function(e){this.hiderHelper.setHiderForControl(this,e)},e.prototype.clearHidingFns=function(){this.hiderHelper.clearHidersForControl(this)},e.prototype.updateHiddenState=function(){this.hiderHelper.evaluateControlHiders(this)},e.prototype.setDisablingFn=function(e){this.disablerHelper.setDisablerForControl(this,e)},e.prototype.clearDisablingFns=function(){this.disablerHelper.clearDisablersForControl(this)},e.prototype.updateDisabledState=function(){this.disablerHelper.evaluateControlDisablers(this)},e.prototype.setAlertFn=function(e){this.AlertHelper.setAlertsForControl(this,e)},e.prototype.clearMessageFns=function(){this.AlertHelper.clearAlertsForControl(this)},e.prototype.updateAlert=function(){this.AlertHelper.evaluateControlAlerts(this)},e.prototype.addValueChangeListener=function(e){this._valueChangeListener=e},e.prototype.fireValueChangeListener=function(e){0<this.alerts.length&&this.updateAlert(),this._valueChangeListener&&"function"==typeof this._valueChangeListener&&this._valueChangeListener(e)},e.prototype.setValue=function(e){r.prototype.setValue.call(this,e)},e}(forms.FormArray),Ld;Ld=exports.AfeControlType||(exports.AfeControlType={}),Ld[Ld.AfeFormControl=0]="AfeFormControl",Ld[Ld.AfeFormArray=1]="AfeFormArray",Ld[Ld.AfeFormGroup=2]="AfeFormGroup",Ld[Ld.None=3]="None";var QuestionBase=function(){function e(e){this.defaultValue=e.defaultValue,this.originalValue=e.originalValue,this.extras=e.extras,this.renderingType=e.type,this.key=e.key||"",this.label=e.label||"",this.validators=e.validators||[],this.required=e.required,this.hide=e.hide,this.disable=e.disable,this.alert=e.alert,this.historicalDataValue=e.historicalDataValue,this.calculateExpression=e.calculateExpression}return e.prototype.setHistoricalValue=function(e){this.enableHistoricalValue=e},e.prototype.showHistoricalEncounterDate=function(e){this.showHistoricalValueDate=e===undefined||e},e}(),ConditionalRequiredValidator=function(){function e(){}return e.prototype.validate=function(a){return function(e){var t,n=e.value,o=null,r=a.referenceQuestionId,i=a.referenceQuestionAnswers;return e&&e.controlRelations&&e.controlRelations.relations&&e.controlRelations.relations.forEach(function(e){var t=e.relatedTo;t.uuid===r&&(o=t&&Array.isArray(t.value)?e.relatedTo.value:e.relatedTo.value&&e.relatedTo.value.value?e.relatedTo.value.value:e.relatedTo.value)}),"object"==typeof i&&-1!==i.indexOf(o)&&(t=!0),t&&!n?{conditional_required:{message:a.message}}:null}},e}(),ConditionalAnsweredValidator=function(){function e(){}return e.prototype.validate=function(a){return function(e){var t=e.value,n=null,o=a.referenceQuestionId,r=a.referenceQuestionAnswers,i=!0;return t&&e&&e.controlRelations&&e.controlRelations.relations&&e.controlRelations.relations.forEach(function(e){var t=e.relatedTo;t.uuid===o&&(n=Array.isArray(t.value)?t.value:t.value&&"object"==typeof t.value&&t.value.value?t.value.value:t.value),n?"object"==typeof r&&-1===r.indexOf(n)&&(i=!1):i=!1}),i?null:{conditional_answered:{message:a.message}}}},e}(),RequiredValidator=function(){function e(){}return e.prototype.validate=function(e){if(e.hidden)return null;var t=e.value;return null==t||"string"==typeof t&&0===t.length?{required:!0}:null},e}(),DateValidator=function(){function e(){}return e.prototype.validate=function(e){if(e.hidden)return null;var t=e.value;return t&&0!==t.length?!/Invalid|NaN/.test(new Date(t).toString())?null:{date:!0}:null},e}(),MinValidator=function(){function e(){}return e.prototype.validate=function(n){return function(e){if(e.hidden)return null;if(e.value&&0!==e.value.length){var t=e.value;return n<=t?null:{min:{requiredValue:n,actualValue:t}}}return null}},e}(),MaxValidator=function(){function e(){}return e.prototype.validate=function(n){return function(e){if(e.hidden)return null;if(e.value&&0!==e.value.length){var t=e.value;return t<=n?null:{max:{requiredValue:n,actualValue:t}}}return null}},e}(),MinDateValidator=function(){function e(){}return e.prototype.validate=function(n){return function(e){if(e.hidden)return null;if(e.value&&0!==e.value.length){if((new DateValidator).validate(e.value))return{mindate:{requiredDate:n}};var t=new Date(e.value);return t.getTime()<n.getTime()?{mindate:{requiredDate:n,actualDate:t}}:null}return null}},e}(),MaxDateValidator=function(){function e(){}return e.prototype.validate=function(n){return function(e){if(e.hidden)return null;if(e.value&&0!==e.value.length){if((new DateValidator).validate(e.value))return{maxdate:{requiredDate:n}};var t=new Date(e.value);return t.getTime()>n.getTime()?{maxdate:{requiredDate:n,actualDate:t}}:null}return null}},e}(),FutureDateRestrictionValidator=function(){function e(){}return e.prototype.validate=function(e){if(e.hidden)return null;var t=e.value,n=new Date;if(t&&0!==t.length&&!(new DateValidator).validate(t))return new Date(t).getTime()>n.getTime()?{futureDateRestriction:!0}:null;return null},e}(),JsExpressionHelper=function(){function e(){}return e.prototype.calcBMI=function(e,t){var n;return e&&t&&(n=(t/(e/100*e/100)).toFixed(1)),e&&t?parseFloat(n):null},e.prototype.calcBSA=function(e,t){var n;return e&&t&&(n=Math.sqrt(e*t/3600).toFixed(2)),e&&t?parseFloat(n):null},e.prototype.calcBMIForAgeZscore=function(e,t,n){var o;t&&n&&(o=(n/(t/100*t/100)).toFixed(1));var r,i=_.first(e);if(i){var a=Object.keys(i).map(function(e){return i[e]}).map(function(e){return e}),s=Object.keys(i),l=a[1],u=[];o<l?u.push(l):_.forEach(a,function(e){e<=o&&u.push(e)});var c=_.last(u);(r=s[_.findIndex(a,function(e){return e===c})].replace("SD","")).includes("neg")&&(r="-"+(r=r.substring(1,0))),"S"!==r&&"L"!==r&&"M"!==r&&"-5"!==r||(r="-4")}return o&&i?r:null},e.prototype.calcWeightForHeightZscore=function(e,t,n){var o,r;t&&n&&(t=parseFloat(t).toFixed(1));t<45||110<t?r=-4:o=_.filter(e,function(e){return parseFloat(e.Length).toFixed(1)===t});var i=_.first(o);if(i){var a=Object.keys(i).map(function(e){return i[e]}).map(function(e){return e}),s=Object.keys(i),l=a[1],u=[];n<l?u.push(l):_.forEach(a,function(e){e<=n&&u.push(e)});var c=_.last(u);(r=s[_.findIndex(a,function(e){return e===c})].replace("SD","")).includes("neg")&&(r="-"+(r=r.substring(1,0))),"S"!==r&&"L"!==r&&"M"!==r&&"-5"!==r||(r="-4")}return t&&n?r:null},e.prototype.calcHeightForAgeZscore=function(e,t,n){var o,r=_.first(e);if(r){var i=Object.keys(r).map(function(e){return r[e]}).map(function(e){return e}),a=Object.keys(r),s=i[1],l=[];t<s?l.push(s):_.forEach(i,function(e){e<=t&&l.push(e)});var u=_.last(l);(o=a[_.findIndex(i,function(e){return e===u})].replace("SD","")).includes("neg")&&(o="-"+(o=o.substring(1,0))),"S"!==o&&"L"!==o&&"M"!==o&&"-5"!==o||(o="-4")}return t&&n&&r?o:null},e.prototype.isEmpty=function(e){return e===undefined||null===e||""===e||"null"===e||"undefined"===e||!(!Array.isArray(e)||0!==e.length)},e.prototype.arrayContains=function(e,t){if(Array.isArray(t)){if(0===t.length)return!0;for(var n=!0,o=0;o<t.length;o++){var r=t[o];-1===e.indexOf(r)&&(n=!1)}return n}return-1!==e.indexOf(t)},e.prototype.extractRepeatingGroupValues=function(t,e){return e.map(function(e){return e[t]})},e.prototype.formatDate=function(e,t,n){if(t=t||"yyyy-MM-dd",n=n||"+0300",!(e instanceof Date||null!==(e=new Date(e))&&e!==undefined))throw new Error("DateFormatException: value passed is not a valid date");return e},e.prototype.arrayContainsAny=function(e,t){if(Array.isArray(t)){if(0===t.length)return!0;for(var n=!1,o=0;o<t.length;o++){var r=t[o];-1!==e.indexOf(r)&&(n=!0)}return n}return-1!==e.indexOf(t)},Object.defineProperty(e.prototype,"helperFunctions",{get:function(){var e=this;return{arrayContainsAny:e.arrayContainsAny,calcBMI:e.calcBMI,calcBMIForAgeZscore:e.calcBMIForAgeZscore,calcWeightForHeightZscore:e.calcWeightForHeightZscore,calcHeightForAgeZscore:e.calcHeightForAgeZscore,isEmpty:e.isEmpty,arrayContains:e.arrayContains,extractRepeatingGroupValues:e.extractRepeatingGroupValues}},enumerable:!0,configurable:!0}),e}(),Validations=function(){function e(){}return e.JSExpressionValidatorsEnabled=!1,e}(),JsExpressionValidator=function(){function e(){}return e.prototype.validate=function(o,r){return function(e){if(!Validations.JSExpressionValidatorsEnabled)return null;var t=o.failsWhenExpression,n=(new JsExpressionHelper).helperFunctions;return(new ExpressionRunner).getRunnable(t,e,n,{},r).run()?{js_expression:{expression:t,message:o.message}}:null}},e}(),Messages=function(){function e(){}return e.REQUIRED_FIELD_MSG="This field is required!",e.INVALID_DATE_MSG="Provided date is invalid!",e.FUTURE_DATE_RESTRICTION_MSG="Future date is not allowed!",e.MIN_LENGTH_MSG="Min Length should be {minLength}",e.MAX_LENGTH_MSG="Max Length should be {maxLength}",e.MAX_DATE_MSG="Max Date should be {maxDate}",e.MIN_DATE_MSG="Min Date should be {minDate}",e.MAX_MSG="Max value should be {max}",e.MIN_MSG="Min value should be {min}",e}(),ValidationFactory=function(){function e(){}return e.prototype.getValidators=function(e,t){var n=this,o=[];return e.validators&&_.forEach(e.validators,function(e){switch(e.type){case"date":o.push(n.dateValidator),e.allowFutureDates||o.push(n.futureDateRestrictionValidator);break;case"js_expression":o.push(n.jsExpressionValidator.validate(e,t));break;case"max":o.push(n.getMaxValueValidator(e.max));break;case"min":o.push(n.getMinValueValidator(e.min));break;case"conditionalRequired":o.push(n.conditionalRequiredValidator.validate(e));break;case"conditionalAnswered":o.push(n.conditionalAnsweredValidator.validate(e))}}),e.required&&"string"==typeof e.required&&"true"===e.required&&o.push(this.requiredValidator),o},Object.defineProperty(e.prototype,"conditionalRequiredValidator",{get:function(){return new ConditionalRequiredValidator},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"conditionalAnsweredValidator",{get:function(){return new ConditionalAnsweredValidator},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"requiredValidator",{get:function(){return(new RequiredValidator).validate},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"dateValidator",{get:function(){return(new DateValidator).validate},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"futureDateRestrictionValidator",{get:function(){return(new FutureDateRestrictionValidator).validate},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"maxDateValidator",{get:function(){return(new MaxDateValidator).validate},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"minDateValidator",{get:function(){return(new MinDateValidator).validate},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"minLengthValidator",{get:function(){return forms.Validators.minLength},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"maxLengthValidator",{get:function(){return forms.Validators.maxLength},enumerable:!0,configurable:!0}),e.prototype.getMinValueValidator=function(e){return(new MinValidator).validate(e)},e.prototype.getMaxValueValidator=function(e){return(new MaxValidator).validate(e)},Object.defineProperty(e.prototype,"jsExpressionValidator",{get:function(){return new JsExpressionValidator},enumerable:!0,configurable:!0}),e.prototype.errors=function(e,t){var n=[];for(var o in e)if(e.hasOwnProperty(o))switch(o){case"required":n.push(Messages.REQUIRED_FIELD_MSG);break;case"date":n.push(Messages.INVALID_DATE_MSG);break;case"futureDateRestriction":n.push(Messages.FUTURE_DATE_RESTRICTION_MSG);break;case"minlength":n.push(Messages.MIN_LENGTH_MSG.replace("{minLength}",e.minlength.requiredLength));break;case"maxlength":n.push(Messages.MIN_LENGTH_MSG.replace("{maxLength}",e.maxlength.requiredLength));break;case"maxdate":n.push(Messages.MAX_DATE_MSG.replace("{maxDate}",e.maxdate.requiredDate));break;case"mindate":n.push(Messages.MIN_DATE_MSG.replace("{minDate}",e.mindate.requiredDate));break;case"max":n.push(Messages.MAX_MSG.replace("{max}",e.max.requiredValue));break;case"min":n.push(Messages.MIN_MSG.replace("{min}",e.min.requiredValue));break;case"js_expression":n.push(e.js_expression.message);break;case"conditional_required":n.push(e.conditional_required.message);break;case"conditional_answered":n.push(e.conditional_answered.message)}return n},e.decorators=[{type:i0.Injectable}],e.ctorParameters=function(){return[]},e}(),HidersDisablersFactory=function(){function e(e,t,n){this.expressionRunner=e,this.expressionHelper=t,this._debugModeService=n}return e.prototype.getJsExpressionDisabler=function(e,t,n){var o=this.expressionRunner.getRunnable(e.disable,t,this.expressionHelper.helperFunctions,{},n),r={toDisable:!1,disableWhenExpression:e.disable,reEvaluateDisablingExpression:function(){var e=o.run();r.toDisable=e}};return r},e.prototype.getJsExpressionHider=function(e,t,n){var o=e.hide,r="object"==typeof o?this.convertHideObjectToString(o):e.hide,i=this._debugModeService.debugEnabled(),a=this.expressionRunner.getRunnable(r,t,this.expressionHelper.helperFunctions,{},n),s={toHide:!1,hideWhenExpression:r,reEvaluateHidingExpression:function(){s.toHide=!0!==i&&a.run()}};return s},e.prototype.convertHideObjectToString=function(e){return e.value instanceof Array?"!arrayContains(["+("'"+e.value.join("','")+"'")+"],"+e.field+")":""},e.decorators=[{type:i0.Injectable}],e.ctorParameters=function(){return[{type:ExpressionRunner},{type:JsExpressionHelper},{type:DebugModeService}]},e}(),AlertsFactory=function(){function e(e,t){this.expressionRunner=e,this.expressionHelper=t}return e.prototype.getJsExpressionshowAlert=function(e,t,n){var o=this.expressionRunner.getRunnable(e.alert.alertWhenExpression,t,this.expressionHelper.helperFunctions,{},n),r={shown:!1,alertWhenExpression:e.alert.alertWhenExpression,alertMessage:e.alert.message,reEvaluateAlertExpression:function(){var e=o.run();r.shown=e}};return r},e.decorators=[{type:i0.Injectable}],e.ctorParameters=function(){return[{type:ExpressionRunner},{type:JsExpressionHelper}]},e}(),FormControlService=function(){function e(e,t,n){this.alertsFactory=n,this.controls=[],this.validationFactory=e,this.hidersDisablersFactory=t}return e.prototype.generateControlModel=function(e,t,n,o){if(e instanceof QuestionBase){if(e.controlType===exports.AfeControlType.AfeFormArray)return this.generateFormArray(e,t,o);if(e.controlType===exports.AfeControlType.AfeFormGroup)return this.generateFormGroupModel(e,n,t,o);if(e.controlType===exports.AfeControlType.AfeFormControl)return this.generateFormControl(e,t,o)}return null},e.prototype.generateFormGroupModel=function(e,t,n,o){var r=new AfeFormGroup({});this.wireHidersDisablers(e,r,o),this.wireAlerts(e,r,o),n instanceof AfeFormGroup&&n.setControl(e.key,r);var i=e;return t&&i&&0<i.questions.length&&this._generateFormGroupChildrenModel(i.questions,r,o),r},e.prototype._generateFormGroupChildrenModel=function(e,n,o){var r=this;0<e.length&&e.forEach(function(e){var t=r.generateControlModel(e,n,!0,o);null!==t&&n.addControl(e.key,t)})},e.prototype.generateFormArray=function(e,t,n){var o,r=this.validationFactory.getValidators(e,n);return(o=r&&0<r.length?new AfeFormArray([],r[0]):new AfeFormArray([])).uuid=e.key,this.wireHidersDisablers(e,o,n),this.wireAlerts(e,o,n),t instanceof AfeFormGroup&&t.setControl(e.key,o),o},e.prototype.generateFormControl=function(e,t,n){var o=e.defaultValue||"",r=this.validationFactory.getValidators(e,n),i=new AfeFormControl(o,r);return i.uuid=e.key,this.wireHidersDisablers(e,i,n),this.wireAlerts(e,i,n),this.wireCalculator(e,i,n?n.dataSourcesContainer.dataSources:null),t instanceof AfeFormGroup&&t.setControl(e.key,i),i},e.prototype.wireAlerts=function(e,t,n){if(e.alert&&""!==e.alert){var o=this.alertsFactory.getJsExpressionshowAlert(e,t,n);t.setAlertFn(o)}},e.prototype.wireHidersDisablers=function(e,t,n){if(e.hide&&""!==e.hide){var o=this.hidersDisablersFactory.getJsExpressionHider(e,t,n);t.setHidingFn(o)}if(e.disable&&""!==e.disable){var r=this.hidersDisablersFactory.getJsExpressionDisabler(e,t,n);t.setDisablingFn(r)}},e.prototype.wireCalculator=function(e,t,n){if(e.calculateExpression&&""!==e.calculateExpression){var o=new JsExpressionHelper,r=(new ExpressionRunner).getRunnable(e.calculateExpression,t,o.helperFunctions,n);t.setCalculatorFn(r.run)}},e.decorators=[{type:i0.Injectable}],e.ctorParameters=function(){return[{type:ValidationFactory},{type:HidersDisablersFactory},{type:AlertsFactory}]},e}(),DEFAULT_STYLES='a {\n color: white;\n text-decoration: none;\n font-size: 12px;\n text-transform: uppercase;\n }\n\n ul {\n list-style-type: none;\n margin: 2px auto;\n position: relative;\n }\n\n li {\n display: block;\n padding: 10px 20px;\n white-space: nowrap;\n transition: all 0.3s ease-in;\n border-bottom: 4px solid transparent;\n }\n\n li:hover {\n border-bottom: 4px solid white;\n opacity: 0.7;\n cursor: pointer;\n }\n\n .owl-theme .owl-controls .owl-nav {\n position: absolute;\n width: 100%;\n top: 0;\n }\n\n .owl-theme .owl-controls .owl-nav [class*="owl-"] {\n position: absolute;\n background: none;\n color: black;\n }\n\n .owl-theme .owl-controls .owl-nav [class*="owl-"]:hover {\n background: none;\n color: black;\n }\n\n .owl-theme .owl-controls .owl-nav .owl-next {\n right: 0;\n transform: translate(120%);\n }\n\n .owl-theme .owl-controls .owl-nav .owl-prev {\n left: 0;\n transform: translate(-120%);\n }\n\n .slick-initialized .swipe-tab-content {\n position: relative;\n min-height: 365px;\n }\n @media screen and (min-width: 767px) {\n .slick-initialized .swipe-tab-content {\n min-height: 500px;\n }\n .time-control{\n width:50%;\n }\n }\n .slick-initialized .swipe-tab {\n display: flex;\n align-items: center;\n justify-content: center;\n height: 50px;\n background: none;\n border: 0;\n color: #757575;\n cursor: pointer;\n text-align: center;\n border-bottom: 2px solid rgba(51, 122, 183, 0);\n transition: all 0.5s;\n }\n .slick-initialized .swipe-tab:hover {\n color: #337AB7;\n }\n .slick-initialized .swipe-tab.active-tab {\n border-bottom-color: #337AB7;\n color: #337AB7;\n font-weight: bold;\n }\n\n .disabled {\n opacity: .5;\n pointer-events: none;\n }\n\n .select2-container {\n margin-top: -5px;\n }\n\n .btn {\n padding: 0px 12px !important;\n }\n\n .form-tooltip{\n color:rgb(51, 122, 183);\n display: inline-block;\n }\n .question-info{\n opacity:0;\n height:0px;\n display: none;\n transition-duration: opacity 1s ease-out;\n transtion-delay: 0.5s;\n padding-top: 2px;\n padding-bottom: 2px;\n color: #696969;\n border-style: ridge;\n border-width: 1px;\n border-color: #337ab7;\n margin-top: 2px;\n }\n .hide-info{\n display:none;\n height:0px;\n }\n .form-tooltip:hover ~ .question-info {\n display:block;\n opacity:1;\n height:auto;\n }\n .form-tooltip .tooltipcontent::after {\n content: " ";\n position: absolute;\n bottom: 100%; /* At the top of the tooltip */\n right: 0%;\n margin-left: -5px;\n border-width: 5px;\n border-style: solid;\n border-top-color: transparent;\n border-right-color: transparent;\n border-bottom-color: #337ab7;\n border-left-color: transparent;\n }\n\n ng-select.form-control {\n padding-top: 0;\n height: auto;\n padding-bottom: 0;\n }\n\n .forms-dropdown-menu {\n max-height: 450px;\n overflow-y: scroll;\n }\n .no-border {\n border: 0;\n box-shadow: none;\n}\n.time-control{\n width:100%;\n}\n\n ',DataSources=function(){function e(){this._dataSources={}}return Object.defineProperty(e.prototype,"dataSources",{get:function(){return this._dataSources},enumerable:!0,configurable:!0}),e.prototype.registerDataSource=function(e,t,n){if(void 0===n&&(n=!1),n)for(var o in t)console.log("registering",o,t[o]),this.registerDataSource(o,t[o],!1);this.dataSources[e]&&console.warn("Overriding registered data source",e),this._dataSources[e]=t},e.prototype.clearDataSource=function(e){delete this._dataSources[e]},e.decorators=[{type:i0.Injectable}],e.ctorParameters=function(){return[]},e}(),FormRendererComponent=function(){function e(e,t,n,o){this.validationFactory=e,this.dataSources=t,this.formErrorsService=n,this.document=o,this.childComponents=[],this.isCollapsed=!1,this.activeTab=0}return e.prototype.ngOnInit=function(){var t=this;if(this.setUpRemoteSelect(),this.setUpFileUpload(),this.setUpDatepickerHolidays(),this.node&&this.node.form){var e=this.node.form.valueProcessingInfo.lastFormTab;e&&e!==this.activeTab&&(this.activeTab=e)}this.node&&"form"===this.node.question.renderingType&&this.formErrorsService.announceErrorField$.subscribe(function(e){t.scrollToControl(e)}),this.node&&"section"===this.node.question.renderingType&&(this.isCollapsed=!this.node.question.isExpanded),this.parentComponent&&this.parentComponent.addChildComponent(this)},e.prototype.addChildComponent=function(e){this.childComponents.push(e)},e.prototype.setUpRemoteSelect=function(){this.node&&this.node.question.extras&&"remote-select"===this.node.question.renderingType&&(this.dataSource=this.dataSources.dataSources[this.node.question.dataSource],this.dataSource&&this.node.question.dataSourceOptions&&(this.dataSource.dataSourceOptions=this.node.question.dataSourceOptions))},e.prototype.setUpFileUpload=function(){this.node&&this.node.question.extras&&"file"===this.node.question.renderingType&&(this.dataSource=this.dataSources.dataSources[this.node.question.dataSource])},e.prototype.setUpDatepickerHolidays=function(){this.node&&this.node.question&&this.node.question.showHolidays&&(this.dataSource=this.dataSources.dataSources[this.node.question.dataSource])},e.prototype.checkSection=function(n){if("section"!==n.question.renderingType)return!0;var o=!1;return!Object.keys(n.children).every(function(e){var t=n.children[e];return t instanceof GroupNode&&(o=Object.keys(t.children).every(function(e){return t.children[e].control.hidden})),n.children[e].control.hidden||o})},e.prototype.clickTab=function(e){this.activeTab=e},e.prototype.loadPreviousTab=function(){this.isCurrentTabFirst()||(this.clickTab(this.activeTab-1),document.body.scrollTop=0)},e.prototype.isCurrentTabFirst=function(){return 0===this.activeTab},e.prototype.isCurrentTabLast=function(){return this.activeTab===this.node.question.questions.length-1},e.prototype.loadNextTab=function(){this.isCurrentTabLast()||(this.clickTab(this.activeTab+1),document.body.scrollTop=0)},e.prototype.tabSelected=function(e){this.activeTab=e,this.setPreviousTab()},e.prototype.setPreviousTab=function(){this.node&&this.node.form&&(this.node.form.valueProcessingInfo.lastFormTab=this.activeTab)},e.prototype.hasErrors=function(){return this.node.control.touched&&!this.node.control.valid},e.prototype.errors=function(){return this.getErrors(this.node)},e.prototype.scrollToControl=function(e){var t=this,n=+e.split(",")[0],o=e.split(",")[1]+"id",r=this.childComponents[n];this.clickTab(n),setTimeout(function(){r.childComponents.forEach(function(e){e.isCollapsed=!1,setTimeout(function(){var e=t.document.getElementById(o);null!==e&&e.focus&&(e.focus(),e.scrollIntoView({behavior:"smooth",block:"center"}))},100)})},200)},e.prototype.onDateChanged=function(e){this.node=e},e.prototype.upload=function(e){},e.prototype.toggleInformation=function(e){var t=document.getElementById(e);"block"===t.style.display?t.style.display="none":t.style.display="block",console.log("InfoId",e)},e.prototype.getErrors=function(e){var t=e.control.errors;return t?this.validationFactory.errors(t,e.question):[]},e.decorators=[{type:i0.Component,args:[{selector:"form-renderer",template:'\x3c!--CONTAINERS--\x3e\n<div *ngIf="node.question.renderingType === \'form\'">\n <div class="dropdown dropdown-tabs forms-dropdown">\n <a class="btn dropdown-toggle" data-toggle="dropdown">\n <i class="fa fa-angle-double-down"></i>\n </a>\n <ul\n class="dropdown-menu dropdown-menu-right forms-dropdown-menu"\n role="menu"\n aria-labelledby="dropdownMenu"\n >\n <li\n *ngFor="let question of node.question.questions; let i = index"\n (click)="clickTab(i)"\n >\n {{ question.label }}\n </li>\n </ul>\n </div>\n <mat-tab-group\n (selectedIndexChange)="tabSelected($event)"\n [selectedIndex]="activeTab"\n >\n <mat-tab\n [label]="question.label"\n *ngFor="let question of node.question.questions; let i = index"\n >\n <div (swipeLeft)="loadNextTab()" (swipeRight)="loadPreviousTab()">\n <form-renderer\n [node]="node.children[question.key]"\n [parentComponent]="this"\n [parentGroup]="node.control"\n ></form-renderer>\n </div>\n </mat-tab>\n </mat-tab-group>\n\n <div style="text-align: center">\n <button\n type="button"\n class="btn btn-default"\n (click)="loadPreviousTab()"\n [ngClass]="{ disabled: isCurrentTabFirst() }"\n >\n &lt;&lt;\n </button>\n <button\n type="button"\n class="btn btn-default"\n (click)="loadNextTab()"\n [ngClass]="{ disabled: isCurrentTabLast() }"\n >\n &gt;&gt;\n </button>\n </div>\n</div>\n<div *ngIf="node.question.renderingType === \'page\'">\n \x3c!--<h2>{{node.question.label}}</h2>--\x3e\n <form-renderer\n *ngFor="let question of node.question.questions"\n [parentComponent]="this"\n [node]="node.children[question.key]"\n [parentGroup]="parentGroup"\n ></form-renderer>\n</div>\n<div *ngIf="node.question.renderingType === \'section\' && checkSection(node)">\n <div class="panel panel-primary">\n <div class="panel-heading">\n <button\n type="button"\n class="btn btn-primary pull-right"\n (click)="isCollapsed = !isCollapsed"\n >\n {{ isCollapsed ? \'Show\' : \'Hide\' }}\n </button>\n {{ node.question.label }}\n </div>\n <div class="panel-body" [collapse]="isCollapsed">\n <form-renderer\n *ngFor="let question of node.question.questions"\n [parentComponent]="this"\n [node]="node.children[question.key]"\n [parentGroup]="parentGroup"\n ></form-renderer>\n </div>\n </div>\n</div>\n\n\x3c!-- MESSAGES --\x3e\n<div\n *ngIf="node.control && node.control.alert && node.control.alert !== \'\'"\n class="alert alert-warning"\n>\n <a class="close" data-dismiss="alert">&times;</a> {{ node.control.alert }}\n</div>\n\n\x3c!--CONTROLS--\x3e\n\n<div\n *ngIf="node.question.controlType === 0"\n class="form-group"\n [formGroup]="parentGroup"\n [hidden]="node.control.hidden"\n [ngClass]="{ disabled: node.control.disabled }"\n>\n \x3c!--LEAF CONTROL--\x3e\n <div class="question-area">\n <a\n class="form-tooltip pull-right"\n (click)="toggleInformation(node.question.extras.id)"\n data-placement="right"\n *ngIf="\n node.question &&\n node.question.extras.questionInfo &&\n node.question.extras.questionInfo !== \'\' &&\n node.question.extras.questionInfo !== \' \'\n "\n >\n <i class="glyphicon glyphicon-question-sign" aria-hidden="true"></i>\n </a>\n\n <label\n *ngIf="node.question.label"\n [style.color]="hasErrors() ? \'red\' : \'\'"\n class="control-label"\n [attr.for]="node.question.key"\n >\n {{ node.question.required ? \'*\' : \'\' }} {{ node.question.label }}\n </label>\n <div [ngSwitch]="node.question.renderingType">\n <select\n class="form-control"\n *ngSwitchCase="\'select\'"\n [formControlName]="node.question.key"\n [id]="node.question.key + \'id\'"\n >\n <option *ngFor="let o of node.question.options" [ngValue]="o.value">\n {{ o.label }}\n </option>\n </select>\n\n <app-file-upload\n *ngSwitchCase="\'file\'"\n [dataSource]="dataSource"\n [formControlName]="node.question.key"\n [id]="node.question.key + \'id\'"\n (fileChanged)="upload($event)"\n >\n </app-file-upload>\n <textarea\n [placeholder]="node.question.placeholder"\n [rows]="node.question.rows"\n class="form-control"\n *ngSwitchCase="\'textarea\'"\n [formControlName]="node.question.key"\n [id]="node.question.key + \'id\'"\n >\n </textarea>\n \x3c!--\n <ng-select *ngSwitchCase="\'remote-select\'" [items]="items$ | async" bindLabel="label" bindValue="value" placeholder="{{node.question.placeholder}}"\n [hideSelected]="true" [loading]="itemsLoading" [typeahead]="itemsInput$" [formControlName]="node.question.key" [id]="node.question.key + \'id\'">\n </ng-select>\n --\x3e\n <remote-select\n *ngSwitchCase="\'remote-select\'"\n [placeholder]="node.question.placeholder"\n tabindex="0"\n [dataSource]="dataSource"\n [componentID]="node.question.key + \'id\'"\n [formControlName]="node.question.key"\n [id]="node.question.key + \'id\'"\n ></remote-select>\n \x3c!-- \n <date-time-picker *ngSwitchCase="\'date\'" [showTime]="node.question.showTime" tabindex="0" [weeks]=\'node.question.extras.questionOptions.weeksList\'\n (onDateChange)="onDateChanged(node)" [showWeeks]="node.question.showWeeksAdder" [formControlName]="node.question.key"\n [id]="node.question.key + \'id\'"></date-time-picker>\n --\x3e\n\n <ngx-date-time-picker\n *ngSwitchCase="\'date\'"\n [showTime]="node.question.showTime"\n [id]="node.question.key + \'id\'"\n [formControlName]="node.question.key"\n [weeks]="node.question.extras.questionOptions.weeksList"\n (onDateChange)="onDateChanged(node)"\n [showWeeks]="node.question.showWeeksAdder"\n [showHolidays]="node.question.showHolidays"\n [dataSource]="dataSource"\n ></ngx-date-time-picker>\n <ngx-time-picker \n *ngSwitchCase="\'time\'" \n id="node.question.key + \'id\'" \n [formControlName]="node.question.key"\n ></ngx-time-picker>\n <ng-select\n *ngSwitchCase="\'multi-select\'"\n [style.height]="\'auto\'"\n [style.overflow-x]="\'hidden\'"\n tabindex="0"\n [formControlName]="node.question.key"\n [id]="node.question.key + \'id\'"\n [options]="node.question.options"\n [multiple]="true"\n >\n </ng-select>\n <ng-select\n *ngSwitchCase="\'single-select\'"\n [style.height]="auto"\n tabindex="0"\n [formControlName]="node.question.key"\n [id]="node.question.key + \'id\'"\n [options]="node.question.options"\n [multiple]="false"\n >\n </ng-select>\n <input\n class="form-control"\n *ngSwitchCase="\'number\'"\n [formControlName]="node.question.key"\n [attr.placeholder]="node.question.placeholder"\n [type]="\'number\'"\n [id]="node.question.key + \'id\'"\n [step]="\'any\'"\n [min]="node.question.extras.questionOptions.min"\n [max]="node.question.extras.questionOptions.max"\n />\n <input\n class="form-control"\n *ngSwitchCase="\'decimal\'"\n [formControlName]="node.question.key"\n [attr.placeholder]="node.question.placeholder"\n [type]="\'text\'"\n [id]="node.question.key + \'id\'"\n [min]="node.question.extras.questionOptions.min"\n [max]="node.question.extras.questionOptions.max"\n />\n <input\n class="form-control"\n *ngSwitchDefault\n [formControlName]="node.question.key"\n [attr.placeholder]="node.question.placeholder"\n [type]="node.question.renderingType"\n [id]="node.question.key + \'id\'"\n />\n\n <div *ngSwitchCase="\'radio\'">\n <div *ngFor="let o of node.question.options">\n <label class="form-control no-border">\n <input\n type="radio"\n [formControlName]="node.question.key"\n [id]="node.question.key + \'id\'"\n [value]="o.value"\n />\n {{ o.label }}\n </label>\n </div>\n </div>\n\n <div *ngSwitchCase="\'checkbox\'">\n <checkbox\n [id]="node.question.key + \'id\'"\n [formControlName]="node.question.key"\n [options]="node.question.options"\n [selected]="node.control.value"\n ></checkbox>\n </div>\n\n <div\n *ngIf="\n node.question.enableHistoricalValue && node.question.historicalDisplay\n "\n style="margin-top: 2px"\n >\n <div class="container-fluid">\n <div class="row">\n <div class="col-xs-9">\n <span class="text-warning">Previous Value: </span>\n <strong>{{ node.question.historicalDisplay?.text }}</strong>\n <span *ngIf="node.question.showHistoricalValueDate">\n <span> | </span>\n <strong class="text-primary"\n >{{ node.question.historicalDisplay?._date }}\n </strong>\n <span\n class="text-primary"\n *ngIf="\n node.question.historicalDisplay &&\n node.question.historicalDisplay._date\n "\n >\n ({{ node.question.historicalDisplay._date | timeAgo }})</span\n >\n </span>\n </div>\n <button\n type="button"\n [node]="node"\n [name]="\'historyValue\'"\n class="btn btn-primary btn-small col-xs-3"\n >\n Use Value\n </button>\n </div>\n </div>\n </div>\n <appointments-overview [node]="node"></appointments-overview>\n <div *ngIf="hasErrors()">\n <p *ngFor="let e of errors()">\n <span class="text-danger">{{ e }}</span>\n </p>\n </div>\n </div>\n\n <div\n class="question-info col-md-12 col-lg-12 col-sm-12"\n id="{{ node.question.extras.id }}"\n *ngIf="\n node.question &&\n node.question.extras.questionInfo &&\n node.question.extras.questionInfo !== \'\' &&\n node.question.extras.questionInfo !== \' \'\n "\n >\n {{ node.question.extras.questionInfo }}\n </div>\n </div>\n</div>\n<div\n *ngIf="node.question.controlType === 1"\n [hidden]="node.control.hidden"\n [ngClass]="{ disabled: node.control.disabled }"\n>\n \x3c!--ARRAY CONTROL--\x3e\n <div [ngSwitch]="node.question.renderingType">\n <div class="well" style="padding: 2px" *ngSwitchCase="\'repeating\'">\n <h4 style="margin: 2px; font-weight: bold">{{ node.question.label }}</h4>\n <hr\n style="\n margin-left: -2px;\n margin-right: -2px;\n margin-bottom: 4px;\n margin-top: 8px;\n border-width: 2px;\n "\n />\n <div [ngSwitch]="node.question.extras.type">\n <div *ngSwitchCase="\'testOrder\'">\n <div *ngFor="let child of node.children; let i = index">\n <form-renderer\n *ngFor="let question of child.question.questions"\n [parentComponent]="this"\n [node]="child.children[question.key]"\n [parentGroup]="child.control"\n ></form-renderer>\n <div>{{ child.orderNumber }}</div>\n <button\n type="button "\n class="btn btn-sm btn-danger"\n (click)="node.removeAt(i)"\n >\n Remove\n </button>\n <br />\n <hr\n style="\n margin-left: -2px;\n margin-right: -2px;\n margin-bottom: 4px;\n margin-top: 8px;\n border-width: 1px;\n "\n />\n </div>\n </div>\n\n <div *ngSwitchCase="\'obsGroup\'" style="margin-bottom: 20px">\n <div *ngFor="let child of node.children; let i = index">\n <form-renderer\n *ngFor="let question of child.question.questions"\n [parentComponent]="this"\n [node]="child.children[question.key]"\n [parentGroup]="child.control"\n ></form-renderer>\n <button\n type="button "\n class="btn btn-sm btn-danger"\n (click)="node.removeAt(i)"\n >\n Remove\n </button>\n <br />\n <hr\n style="\n margin-left: -2px;\n margin-right: -2px;\n margin-bottom: 4px;\n margin-top: 8px;\n border-width: 1px;\n "\n />\n </div>\n </div>\n </div>\n <button\n type="button "\n class="btn btn-primary"\n (click)="node.createChildNode()"\n >\n Add\n </button>\n </div>\n </div>\n</div>\n<div\n *ngIf="node.question.controlType === 2"\n [hidden]="node.control.hidden"\n [ngClass]="{ disabled: node.control.disabled }"\n>\n \x3c!--GROUP--\x3e\n <div [ngSwitch]="node.question.renderingType">\n <div *ngSwitchCase="\'group\'">\n <form-renderer\n *ngFor="let question of node.question.questions"\n [parentComponent]="this"\n [node]="node.children[question.key]"\n [parentGroup]="node.control"\n ></form-renderer>\n </div>\n <div\n *ngSwitchCase="\'field-set\'"\n style="border: 1px solid #eeeeee; padding: 2px; margin: 2px"\n >\n <form-renderer\n *ngFor="let question of node.question.questions"\n [parentComponent]="this"\n [node]="node.children[question.key]"\n [parentGroup]="node.control"\n ></form-renderer>\n </div>\n </div>\n</div>\n',styles:["../../style/app.css",DEFAULT_STYLES]}]}],e.ctorParameters=function(){return[{type:ValidationFactory},{type:DataSources},{type:FormErrorsService},{type:undefined,decorators:[{type:i0.Inject,args:[common.DOCUMENT]}]}]},e.propDecorators={parentComponent:[{type:i0.Input}],node:[{type:i0.Input}],parentGroup:[{type:i0.Input}]},e}(),ErrorRendererComponent=function(){function e(e,t){this.validationFactory=e,this.formErrorsService=t}return e.prototype.ngOnInit=function(){},e.prototype.showErrors=function(){return!this.form.valid&&this.form.showErrors},Object.defineProperty(e.prototype,"errorNodes",{get:function(){return this.form.markInvalidControls(this.form.rootNode,[])},enumerable:!0,configurable:!0}),e.prototype.getControlError=function(e){var t=e.control.errors;return t?this.validationFactory.errors(t,e.question):[]},e.prototype.announceErrorField=function(n){var o=this,e=this.form.searchNodeByQuestionId(n.path.substring(0,n.path.indexOf(".")));_.forEach(e,function(e){if("page"===e.question.renderingType){var t=o.getPageIndex(e);o.formErrorsService.announceErrorField(t+","+n.question.key)}})},e.prototype.getPageIndex=function(e){return this.form.rootNode.question.questions.indexOf(e.question)},e.decorators=[{type:i0.Component,args:[{selector:"error-renderer",template:'<div *ngIf="showErrors()" class="container">\n <ul class="list-group">\n <li\n class="list-group-item list-group-item-warning"\n *ngFor="let errorNode of errorNodes"\n (click)="announceErrorField(errorNode)"\n >\n <div class="error" *ngIf="errorNode.control.valid == false">\n <h4>{{ errorNode.question.label }}</h4>\n <span class="text-danger"> {{ getControlError(errorNode) }}</span>\n </div>\n </li>\n </ul>\n</div>\n',styles:["ul{list-style:none}.list-group-item{padding:2px 15px;cursor:pointer}ul li:hover{background-color:#fff}h4{margin-top:7px;margin-bottom:7px}"]}]}],e.ctorParameters=function(){return[{type:ValidationFactory},{type:FormErrorsService}]},e.propDecorators={form:[{type:i0.Input}]},e}(),HistoricalFieldHelperService=function(){function e(){}return e.prototype.getDisplayTextFromOptions=function(e,n,o){var r="",t=e.historicalDataValue;if(_.isArray(t.value)){var i=0;_.each(t.value,function(t){_.each(e.options,function(e){e[n]===t&&(0===i?r+=e[o]:r=r+", "+e[o],i++)})})}else _.each(e.options,function(e){e[n]===t.value&&(r=e[o])});return r},e}(),HistoricalValueDirective=function(){function e(e){this.historicalFieldHelper=e,this._nodeChange=new i0.EventEmitter}return e.prototype.setValue=function(e){"historyValue"===e.target.name&&(!this._node||this.compareString(this._node.question.renderingType,"page")&&this.compareString(this._node.question.renderingType,"section")||(this._node.control.setValue(this._node.question.historicalDataValue.value),this._node.question.historicalValue=this._node.question.historicalDataValue,e.stopPropagation(),this._nodeChange.emit(this._node)))},e.prototype.compareString=function(e,t){return e===t},Object.defineProperty(e.prototype,"node",{set:function(e){if(e&&(this._node=e,this._node.question.enableHistoricalValue&&!_.isUndefined(this._node.question.historicalDataValue))){var t={text:"",_date:""};"select"===this._node.question.renderingType||"multi-select"===this._node.question.renderingType||"single-select"===this._node.question.renderingType?(t.text=this.historicalFieldHelper.getDisplayTextFromOptions(this._node.question,"value","label"),t._date=this._node.question.historicalDataValue.valueDate,this._node.question.historicalDisplay=t):_.isUndefined(this._node.question.historicalDataValue)||(t.text=this._node.question.historicalDataValue.value,t._date=this._node.question.historicalDataValue.valueDate,this._node.question.historicalDisplay=t)}},enumerable:!0,configurable:!0}),e.decorators=[{type:i0.Directive,args:[{selector:"[node]"}]}],e.ctorParameters=function(){return[{type:HistoricalFieldHelperService}]},e.propDecorators={_node:[{type:i0.Input}],_nodeChange:[{type:i0.Output}],setValue:[{type:i0.HostListener,args:["click",["$event"]]}],node:[{type:i0.Input}]},e}(),STYLE="\nng-select {\n display: inline-block;\n margin: 0;\n position: relative;\n vertical-align: middle;\n width: 100%;\n}\nng-select * {\n box-sizing: border-box;\n font-family: Sans-Serif;\n}\nng-select > div {\n border: 1px solid #ddd;\n box-sizing: border-box;\n cursor: pointer;\n user-select: none;\n width: 100%;\n}\nng-select > div.disabled {\n background-color: #eee;\n color: #aaa;\n cursor: default;\n pointer-events: none;\n}\nng-select > div > div.single {\n display: flex;\n height: 30px;\n width: 100%;\n}\nng-select > div > div.single > div.value,\nng-select > div > div.single > div.placeholder {\n flex: 1;\n line-height: 30px;\n overflow: hidden;\n padding: 0 10px;\n white-space: nowrap;\n}\nng-select > div > div.single > div.placeholder {\n color: #a9a9a9;\n}\nng-select > div > div.single > div.clear,\nng-select > div > div.single > div.toggle {\n color: #aaa;\n line-height: 30px;\n text-align: center;\n width: 30px;\n}\nng-select > div > div.single > div.clear:hover,\nng-select > div > div.single > div.toggle:hover {\n background-color: #ececec;\n}\nng-select > div > div.single > div.clear {\n font-size: 18px;\n}\nng-select > div > div.single > div.toggle {\n font-size: 14px;\n}\nng-select > div > div.multiple {\n display: flex;\n flex-flow: row wrap;\n height: 100%;\n min-height: 30px;\n padding: 0 10px;\n width: 100%;\n}\nng-select > div > div.multiple > div.option {\n background-color: #eee;\n border: 1px solid #aaa;\n border-radius: 4px;\n color: #333;\n cursor: default;\n display: inline-block;\n flex-shrink: 0;\n font-size: 14px;\n line-height: 22px;\n margin: 3px 5px 3px 0;\n padding: 0 4px;\n}\nng-select > div > div.multiple > div.option span.deselect-option {\n color: #aaa;\n cursor: pointer;\n font-size: 14px;\n height: 20px;\n line-height: 20px;\n}\nng-select > div > div.multiple > div.option span.deselect-option:hover {\n color: #555;\n}\nng-select > div > div.multiple input {\n background-color: transparent;\n border: none;\n height: 30px;\n line-height: 30px;\n padding: 0;\n}\nng-select > div > div.multiple input:focus {\n outline: none;\n}\n",Option=function(){function e(e,t){this.value=e,this.label=t,this.disabled=!1,this.highlighted=!1,this.selected=!1,this.shown=!0}return e.prototype.show=function(){this.shown=!0},e.prototype.hide=function(){this.shown=!1},e.prototype.disable=function(){this.disabled=!0},e.prototype.enable=function(){this.disabled=!1},e.prototype.undecoratedCopy=function(){return{label:this.label,value:this.value}},e}(),Diacritics=function(){function e(){}return e.strip=function(e){var t=this;return e?e.replace(/[^\u0000-\u007E]/g,function(e){return t.DIACRITICS[e]||e}):""},e.DIACRITICS={"Ⓐ":"A","A":"A","À":"A","Á":"A","Â":"A","Ầ":"A","Ấ":"A","Ẫ":"A","Ẩ":"A","Ã":"A","Ā":"A","Ă":"A","Ằ":"A","Ắ":"A","Ẵ":"A","Ẳ":"A","Ȧ":"A","Ǡ":"A","Ä":"A","Ǟ":"A","Ả":"A","Å":"A","Ǻ":"A","Ǎ":"A","Ȁ":"A","Ȃ":"A","Ạ":"A","Ậ":"A","Ặ":"A","Ḁ":"A","Ą":"A","Ⱥ":"A","Ɐ":"A","Ꜳ":"AA","Æ":"AE","Ǽ":"AE","Ǣ":"AE","Ꜵ":"AO","Ꜷ":"AU","Ꜹ":"AV","Ꜻ":"AV","Ꜽ":"AY","Ⓑ":"B","B":"B","Ḃ":"B","Ḅ":"B","Ḇ":"B","Ƀ":"B","Ƃ":"B","Ɓ":"B","Ⓒ":"C","C":"C","Ć":"C","Ĉ":"C","Ċ":"C","Č":"C","Ç":"C","Ḉ":"C","Ƈ":"C","Ȼ":"C","Ꜿ":"C","Ⓓ":"D","D":"D","Ḋ":"D","Ď":"D","Ḍ":"D","Ḑ":"D","Ḓ":"D","Ḏ":"D","Đ":"D","Ƌ":"D","Ɗ":"D","Ɖ":"D","Ꝺ":"D","DZ":"DZ","DŽ":"DZ","Dz":"Dz","Dž":"Dz","Ⓔ":"E","E":"E","È":"E","É":"E","Ê":"E","Ề":"E","Ế":"E","Ễ":"E","Ể":"E","Ẽ":"E","Ē":"E","Ḕ":"E","Ḗ":"E","Ĕ":"E","Ė":"E","Ë":"E","Ẻ":"E","Ě":"E","Ȅ":"E","Ȇ":"E","Ẹ":"E","Ệ":"E","Ȩ":"E","Ḝ":"E","Ę":"E","Ḙ":"E","Ḛ":"E","Ɛ":"E","Ǝ":"E","Ⓕ":"F","F":"F","Ḟ":"F","Ƒ":"F","Ꝼ":"F","Ⓖ":"G","G":"G","Ǵ":"G","Ĝ":"G","Ḡ":"G","Ğ":"G","Ġ":"G","Ǧ":"G","Ģ":"G","Ǥ":"G","Ɠ":"G","Ꞡ":"G","Ᵹ":"G","Ꝿ":"G","Ⓗ":"H","H":"H","Ĥ":"H","Ḣ":"H","Ḧ":"H","Ȟ":"H","Ḥ":"H","Ḩ":"H","Ḫ":"H","Ħ":"H","Ⱨ":"H","Ⱶ":"H","Ɥ":"H","Ⓘ":"I","I":"I","Ì":"I","Í":"I","Î":"I","Ĩ":"I","Ī":"I","Ĭ":"I","İ":"I","Ï":"I","Ḯ":"I","Ỉ":"I","Ǐ":"I","Ȉ":"I","Ȋ":"I","Ị":"I","Į":"I","Ḭ":"I","Ɨ":"I","Ⓙ":"J","J":"J","Ĵ":"J","Ɉ":"J","Ⓚ":"K","K":"K","Ḱ":"K","Ǩ":"K","Ḳ":"K","Ķ":"K","Ḵ":"K","Ƙ":"K","Ⱪ":"K","Ꝁ":"K","Ꝃ":"K","Ꝅ":"K","Ꞣ":"K","Ⓛ":"L","L":"L","Ŀ":"L","Ĺ":"L","Ľ":"L","Ḷ":"L","Ḹ":"L","Ļ":"L","Ḽ":"L","Ḻ":"L","Ł":"L","Ƚ":"L","Ɫ":"L","Ⱡ":"L","Ꝉ":"L","Ꝇ":"L","Ꞁ":"L","LJ":"LJ","Lj":"Lj","Ⓜ":"M","M":"M","Ḿ":"M","Ṁ":"M","Ṃ":"M","Ɱ":"M","Ɯ":"M","Ⓝ":"N","N":"N","Ǹ":"N","Ń":"N","Ñ":"N","Ṅ":"N","Ň":"N","Ṇ":"N","Ņ":"N","Ṋ":"N","Ṉ":"N","Ƞ":"N","Ɲ":"N","Ꞑ":"N","Ꞥ":"N","NJ":"NJ","Nj":"Nj","Ⓞ":"O","O":"O","Ò":"O","Ó":"O","Ô":"O","Ồ":"O","Ố":"O","Ỗ":"O","Ổ":"O","Õ":"O","Ṍ":"O","Ȭ":"O","Ṏ":"O","Ō":"O","Ṑ":"O","Ṓ":"O","Ŏ":"O","Ȯ":"O","Ȱ":"O","Ö":"O","Ȫ":"O","Ỏ":"O","Ő":"O","Ǒ":"O","Ȍ":"O","Ȏ":"O","Ơ":"O","Ờ":"O","Ớ":"O","Ỡ":"O","Ở":"O","Ợ":"O","Ọ":"O","Ộ":"O","Ǫ":"O","Ǭ":"O","Ø":"O","Ǿ":"O","Ɔ":"O","Ɵ":"O","Ꝋ":"O","Ꝍ":"O","Ƣ":"OI","Ꝏ":"OO","Ȣ":"OU","Ⓟ":"P","P":"P","Ṕ":"P","Ṗ":"P","Ƥ":"P","Ᵽ":"P","Ꝑ":"P","Ꝓ":"P","Ꝕ":"P","Ⓠ":"Q","Q":"Q","Ꝗ":"Q","Ꝙ":"Q","Ɋ":"Q","Ⓡ":"R","R":"R","Ŕ":"R","Ṙ":"R","Ř":"R","Ȑ":"R","Ȓ":"R","Ṛ":"R","Ṝ":"R","Ŗ":"R","Ṟ":"R","Ɍ":"R","Ɽ":"R","Ꝛ":"R","Ꞧ":"R","Ꞃ":"R","Ⓢ":"S","S":"S","ẞ":"S","Ś":"S","Ṥ":"S","Ŝ":"S","Ṡ":"S","Š":"S","Ṧ":"S","Ṣ":"S","Ṩ":"S","Ș":"S","Ş":"S","Ȿ":"S","Ꞩ":"S","Ꞅ":"S","Ⓣ":"T","T":"T","Ṫ":"T","Ť":"T","Ṭ":"T","Ț":"T","Ţ":"T","Ṱ":"T","Ṯ":"T","Ŧ":"T","Ƭ":"T","Ʈ":"T","Ⱦ":"T","Ꞇ":"T","Ꜩ":"TZ","Ⓤ":"U","U":"U","Ù":"U","Ú":"U","Û":"U","Ũ":"U","Ṹ":"U","Ū":"U","Ṻ":"U","Ŭ":"U","Ü":"U","Ǜ":"U","Ǘ":"U","Ǖ":"U","Ǚ":"U","Ủ":"U","Ů":"U","Ű":"U","Ǔ":"U","Ȕ":"U","Ȗ":"U","Ư":"U","Ừ":"U","Ứ":"U","Ữ":"U","Ử":"U","Ự":"U","Ụ":"U","Ṳ":"U","Ų":"U","Ṷ":"U","Ṵ":"U","Ʉ":"U","Ⓥ":"V","V":"V","Ṽ":"V","Ṿ":"V","Ʋ":"V","Ꝟ":"V","Ʌ":"V","Ꝡ":"VY","Ⓦ":"W","W":"W","Ẁ":"W","Ẃ":"W","Ŵ":"W","Ẇ":"W","Ẅ":"W","Ẉ":"W","Ⱳ":"W","Ⓧ":"X","X":"X","Ẋ":"X","Ẍ":"X","Ⓨ":"Y","Y":"Y","Ỳ":"Y","Ý":"Y","Ŷ":"Y","Ỹ":"Y","Ȳ":"Y","Ẏ":"Y","Ÿ":"Y","Ỷ":"Y","Ỵ":"Y","Ƴ":"Y","Ɏ":"Y","Ỿ":"Y","Ⓩ":"Z","Z":"Z","Ź":"Z","Ẑ":"Z","Ż":"Z","Ž":"Z","Ẓ":"Z","Ẕ":"Z","Ƶ":"Z","Ȥ":"Z","Ɀ":"Z","Ⱬ":"Z","Ꝣ":"Z","ⓐ":"a","a":"a","ẚ":"a","à":"a","á":"a","â":"a","ầ":"a","ấ":"a","ẫ":"a","ẩ":"a","ã":"a","ā":"a","ă":"a","ằ":"a","ắ":"a","ẵ":"a","ẳ":"a","ȧ":"a","ǡ":"a","ä":"a","ǟ":"a","ả":"a","å":"a","ǻ":"a","ǎ":"a","ȁ":"a","ȃ":"a","ạ":"a","ậ":"a","ặ":"a","ḁ":"a","ą":"a","ⱥ":"a","ɐ":"a","ꜳ":"aa","æ":"ae","ǽ":"ae","ǣ":"ae","ꜵ":"ao","ꜷ":"au","ꜹ":"av","ꜻ":"av","ꜽ":"ay","ⓑ":"b","b":"b","ḃ":"b","ḅ":"b","ḇ":"b","ƀ":"b","ƃ":"b","ɓ":"b","ⓒ":"c","c":"c","ć":"c","ĉ":"c","ċ":"c","č":"c","ç":"c","ḉ":"c","ƈ":"c","ȼ":"c","ꜿ":"c","ↄ":"c","ⓓ":"d","d":"d","ḋ":"d","ď":"d","ḍ":"d","ḑ":"d","ḓ":"d","ḏ":"d","đ":"d","ƌ":"d","ɖ":"d","ɗ":"d","ꝺ":"d","dz":"dz","dž":"dz","ⓔ":"e","e":"e","è":"e","é":"e","ê":"e","ề":"e","ế":"e","ễ":"e","ể":"e","ẽ":"e","ē":"e","ḕ":"e","ḗ":"e","ĕ":"e","ė":"e","ë":"e","ẻ":"e","ě":"e","ȅ":"e","ȇ":"e","ẹ":"e","ệ":"e","ȩ":"e","ḝ":"e","ę":"e","ḙ":"e","ḛ":"e","ɇ":"e","ɛ":"e","ǝ":"e","ⓕ":"f","f":"f","ḟ":"f","ƒ":"f","ꝼ":"f","ⓖ":"g","g":"g","ǵ":"g","ĝ":"g","ḡ":"g","ğ":"g","ġ":"g","ǧ":"g","ģ":"g","ǥ":"g","ɠ":"g","ꞡ":"g","ᵹ":"g","ꝿ":"g","ⓗ":"h","h":"h","ĥ":"h","ḣ":"h","ḧ":"h","ȟ":"h","ḥ":"h","ḩ":"h","ḫ":"h","ẖ":"h","ħ":"h","ⱨ":"h","ⱶ":"h","ɥ":"h","ƕ":"hv","ⓘ":"i","i":"i","ì":"i","í":"i","î":"i","ĩ":"i","ī":"i","ĭ":"i","ï":"i","ḯ":"i","ỉ":"i","ǐ":"i","ȉ":"i","ȋ":"i","ị":"i","į":"i","ḭ":"i","ɨ":"i","ı":"i","ⓙ":"j","j":"j","ĵ":"j","ǰ":"j","ɉ":"j","ⓚ":"k","k":"k","ḱ":"k","ǩ":"k","ḳ":"k","ķ":"k","ḵ":"k","ƙ":"k","ⱪ":"k","ꝁ":"k","ꝃ":"k","ꝅ":"k","ꞣ":"k","ⓛ":"l","l":"l","ŀ":"l","ĺ":"l","ľ":"l","ḷ":"l","ḹ":"l","ļ":"l","ḽ":"l","ḻ":"l","ſ":"l","ł":"l","ƚ":"l","ɫ":"l","ⱡ":"l","ꝉ":"l","ꞁ":"l","ꝇ":"l","lj":"lj","ⓜ":"m","m":"m","ḿ":"m","ṁ":"m","ṃ":"m","ɱ":"m","ɯ":"m","ⓝ":"n","n":"n","ǹ":"n","ń":"n","ñ":"n","ṅ":"n","ň":"n","ṇ":"n","ņ":"n","ṋ":"n","ṉ":"n","ƞ":"n","ɲ":"n","ʼn":"n","ꞑ":"n","ꞥ":"n","nj":"nj","ⓞ":"o","o":"o","ò":"o","ó":"o","ô":"o","ồ":"o","ố":"o","ỗ":"o","ổ":"o","õ":"o","ṍ":"o","ȭ":"o","ṏ":"o","ō":"o","ṑ":"o","ṓ":"o","ŏ":"o","ȯ":"o","ȱ":"o","ö":"o","ȫ":"o","ỏ":"o","ő":"o","ǒ":"o","ȍ":"o","ȏ":"o","ơ":"o","ờ":"o","ớ":"o","ỡ":"o","ở":"o","ợ":"o","ọ":"o","ộ":"o","ǫ":"o","ǭ":"o","ø":"o","ǿ":"o","ɔ":"o","ꝋ":"o","ꝍ":"o","ɵ":"o","ƣ":"oi","ȣ":"ou","ꝏ":"oo","ⓟ":"p","p":"p","ṕ":"p","ṗ":"p","ƥ":"p","ᵽ":"p","ꝑ":"p","ꝓ":"p","ꝕ":"p","ⓠ":"q","q":"q","ɋ":"q","ꝗ":"q","ꝙ":"q","ⓡ":"r","r":"r","ŕ":"r","ṙ":"r","ř":"r","ȑ":"r","ȓ":"r","ṛ":"r","ṝ":"r","ŗ":"r","ṟ":"r","ɍ":"r","ɽ":"r","ꝛ":"r","ꞧ":"r","ꞃ":"r","ⓢ":"s","s":"s","ß":"s","ś":"s","ṥ":"s","ŝ":"s","ṡ":"s","š":"s","ṧ":"s","ṣ":"s","ṩ":"s","ș":"s","ş":"s","ȿ":"s","ꞩ":"s","ꞅ":"s","ẛ":"s","ⓣ":"t","t":"t","ṫ":"t","ẗ":"t","ť":"t","ṭ":"t","ț":"t","ţ":"t","ṱ":"t","ṯ":"t","ŧ":"t","ƭ":"t","ʈ":"t","ⱦ":"t","ꞇ":"t","ꜩ":"tz","ⓤ":"u","u":"u","ù":"u","ú":"u","û":"u","ũ":"u","ṹ":"u","ū":"u","ṻ":"u","ŭ":"u","ü":"u","ǜ":"u","ǘ":"u","ǖ":"u","ǚ":"u","ủ":"u","ů":"u","ű":"u","ǔ":"u","ȕ":"u","ȗ":"u","ư":"u","ừ":"u","ứ":"u","ữ":"u","ử":"u","ự":"u","ụ":"u","ṳ":"u","ų":"u","ṷ":"u","ṵ":"u","ʉ":"u","ⓥ":"v","v":"v","ṽ":"v","ṿ":"v","ʋ":"v","ꝟ":"v","ʌ":"v","ꝡ":"vy","ⓦ":"w","w":"w","ẁ":"w","ẃ":"w","ŵ":"w","ẇ":"w","ẅ":"w","ẘ":"w","ẉ":"w","ⱳ":"w","ⓧ":"x","x":"x","ẋ":"x","ẍ":"x","ⓨ":"y","y":"y","ỳ":"y","ý":"y","ŷ":"y","ỹ":"y","ȳ":"y","ẏ":"y","ÿ":"y","ỷ":"y","ẙ":"y","ỵ":"y","ƴ":"y","ɏ":"y","ỿ":"y","ⓩ":"z","z":"z","ź":"z","ẑ":"z","ż":"z","ž":"z","ẓ":"z","ẕ":"z","ƶ":"z","ȥ":"z","ɀ":"z","ⱬ":"z","ꝣ":"z","Ά":"Α","Έ":"Ε","Ή":"Η","Ί":"Ι","Ϊ":"Ι","Ό":"Ο","Ύ":"Υ","Ϋ":"Υ","Ώ":"Ω","ά":"α","έ":"ε","ή":"η","ί":"ι","ϊ":"ι","ΐ":"ι","ό":"ο","ύ":"υ","ϋ":"υ","ΰ":"υ","ω":"ω","ς":"σ"},e}(),OptionList=function(){function e(e){(this._highlightedOption=null)==e&&(e=[]),this._options=e.map(function(e){var t=new Option(e.value,e.label);return e.disabled&&t.disable(),t}),this.highlight()}return e.equalValues=function(e,t){if(e.length!==t.length)return!1;var n=e.slice().sort(),o=t.slice().sort();return n.every(function(e,t){return e===o[t]})},Object.defineProperty(e.prototype,"options",{get:function(){return this._options},enumerable:!0,configurable:!0}),e.prototype.getOptionsByValue=function(t){return this.options.filter(function(e){return e.value===t})},Object.defineProperty(e.prototype,"value",{get:function(){return this.selection.map(function(e){return e.value})},set:function(t){t=null==t?[]:t,this.options.forEach(function(e){e.selected=-1<t.indexOf(e.value)})},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"selection",{get:function(){return this.options.filter(function(e){return e.selected})},enumerable:!0,configurable:!0}),e.prototype.select=function(e,t){t||this.clearSelection(),e.selected=!0},e.prototype.deselect=function(e){e.selected=!1},e.prototype.clearSelection=function(){this.options.forEach(function(e){e.selected=!1})},Object.defineProperty(e.prototype,"filtered",{get:function(){return this.options.filter(function(e){return e.shown})},enumerable:!0,configurable:!0}),e.prototype.filter=function(o){""===o.trim()?this.resetFilter():this.options.forEach(function(e){var t=Diacritics.strip(e.label).toUpperCase(),n=Diacritics.strip(o).toUpperCase();e.shown=-1<t.indexOf(n)}),this.highlight()},e.prototype.resetFilter=function(){this.options.forEach(function(e){e.shown=!0})},Object.defineProperty(e.prototype,"highlightedOption",{get:function(){return this._highlightedOption},enumerable:!0,configurable:!0}),e.prototype.highlight=function(){var e=this.hasShownSelected()?this.getFirstShownSelected():this.getFirstShown();this.highlightOption(e)},e.prototype.highlightOption=function(e){this.clearHighlightedOption(),null!==e&&(e.highlighted=!0,this._highlightedOption=e)},e.prototype.highlightNextOption=function(){var e=this.filtered,t=this.getHighlightedIndexFromList(e);-1<t&&t<e.length-1&&this.highlightOption(e[t+1])},e.prototype.highlightPreviousOption=function(){var e=this.filtered,t=this.getHighlightedIndexFromList(e);0<t&&this.highlightOption(e[t-1])},e.prototype.clearHighlightedOption=function(){null!==this.highlightedOption&&(this.highlightedOption.highlighted=!1,this._highlightedOption=null)},e.prototype.getHighlightedIndexFromList=function(e){for(var t=0;t<e.length;t++)if(e[t].highlighted)return t;return-1},e.prototype.getHighlightedIndex=function(){return this.getHighlightedIndexFromList(this.filtered)},e.prototype.hasShown=function(){return this.options.some(function(e){return e.shown})},e.prototype.hasSelected=function(){return this.options.some(function(e){return e.selected})},e.prototype.hasShownSelected=function(){return this.options.some(function(e){return e.shown&&e.selected})},e.prototype.getFirstShown=function(){try{for(var e=__values(this.options),t=e.next();!t.done;t=e.next()){var n=t.value;if(n.shown)return n}}catch(i){o={error:i}}finally{try{t&&!t.done&&(r=e["return"])&&r.call(e)}finally{if(o)throw o.error}}return null;var o,r},e.prototype.getFirstShownSelected=function(){try{for(var e=__values(this.options),t=e.next();!t.done;t=e.next()){var n=t.value;if(n.shown&&n.selected)return n}}catch(i){o={error:i}}finally{try{t&&!t.done&&(r=e["return"])&&r.call(e)}finally{if(o)throw o.error}}return null;var o,r},e}(),SELECT_VALUE_ACCESSOR={provide:forms.NG_VALUE_ACCESSOR,useExisting:i0.forwardRef(function(){return SelectComponent}),multi:!0},SelectComponent=function(){function e(){this.KEYS={BACKSPACE:8,TAB:9,ENTER:13,ESC:27,SPACE:32,UP:38,DOWN:40},this.allowClear=!1,this.disabled=!1,this.highlightColor="#2196f3",this.highlightTextColor="#fff",this.multiple=!1,this.noFilter=0,this.notFoundMsg="No results found",this.placeholder="",this.opened=new i0.EventEmitter,this.closed=new i0.EventEmitter,this.selected=new i0.EventEmitter,this.deselected=new i0.EventEmitter,this.typed=new i0.EventEmitter,this._value=[],this.hasSelected=!1,this.filterEnabled=!0,this.filterInputWidth=1,this.hasFocus=!1,this.isBelow=!0,this.isDisabled=!1,this.isOpen=!1,this.placeholderView="",this.clearClicked=!1,this.selectContainerClicked=!1,this.onChange=function(e){},this.onTouched=function(){}}return e.prototype.ngOnInit=function(){this.placeholderView=this.placeholder},e.prototype.ngAfterViewInit=function(){this.updateFilterWidth()},e.prototype.ngOnChanges=function(e){if(e.hasOwnProperty("options")&&this.updateOptionsList(e.options.isFirstChange()),e.hasOwnProperty("noFilter")){var t=this.optionList.options.length,n=e.noFilter.currentValue;this.filterEnabled=n<=t}},e.prototype.onWindowClick=function(){this.selectContainerClicked||this.closeDropdown(),this.clearClicked=!1,this.selectContainerClicked=!1},e.prototype.onWindowResize=function(){this.updateWidth()},e.prototype.onSelectContainerClick=function(e){this.selectContainerClicked=!0,this.clearClicked||this.toggleDropdown()},e.prototype.onSelectContainerFocus=function(){this.onTouched()},e.prototype.onSelectContainerKeydown=function(e){this.handleSelectContainerKeydown(e)},e.prototype.onDropdownOptionClicked=function(e){this.multiple?this.toggleSelectOption(e):this.selectOption(e)},e.prototype.onDropdownClose=function(e){this.closeDropdown(e)},e.prototype.onSingleFilterClick=function(){this.selectContainerClicked=!0},e.prototype.onSingleFilterInput=function(e){var t=this;setTimeout(function(){2<e.length&&t.typed.emit(e)},500),this.optionList.filter(e)},e.prototype.onSingleFilterKeydown=function(e){this.handleSingleFilterKeydown(e)},e.prototype.onMultipleFilterInput=function(e){var t=this;this.isOpen||this.openDropdown(),this.updateFilterWidth(),setTimeout(function(){t.optionList.filter(e.target.value)})},e.prototype.onMultipleFilterKeydown=function(e){this.handleMultipleFilterKeydown(e)},e.prototype.onClearSelectionClick=function(e){this.clearClicked=!0,this.clearSelection(),this.closeDropdown(!0)},e.prototype.onDeselectOptionClick=function(e){this.clearClicked=!0,this.deselectOption(e)},e.prototype.open=function(){this.openDropdown()},e.prototype.close=function(){this.closeDropdown()},e.prototype.clear=function(){this.clearSelection()},e.prototype.select=function(e){var t=this;this.optionList.getOptionsByValue(e).forEach(function(e){t.selectOption(e)}),this.valueChanged()},e.prototype.writeValue=function(e){this.value=e},e.prototype.registerOnChange=function(e){this.onChange=e},e.prototype.registerOnTouched=function(e){this.onTouched=e},e.prototype.setDisabledState=function(e){this.disabled=e},Object.defineProperty(e.prototype,"value",{get:function(){return 0===this._value.length?"":this.multiple?this._value:this._value[0]},set:function(e){if(null==e||""===e)e=[];else if("string"==typeof e)e=[e];else if(!Array.isArray(e))throw new TypeError("Value must be a string or an array.");OptionList.equalValues(e,this._value)||(this.optionList.value=e,this.valueChanged())},enumerable:!0,configurable:!0}),e.prototype.valueChanged=function(){this._value=this.optionList.value,this.hasSelected=0<this._value.length,this.placeholderView=this.hasSelected?"":this.placeholder,this.updateFilterWidth(),this.onChange(this.value)},e.prototype.updateOptionsList=function(e){var t;e||(t=this.optionList.value),this.optionList=new OptionList(this.options),e||(this.optionList.value=t,this.valueChanged())},e.prototype.toggleDropdown=function(){this.isDisabled||(this.isOpen?this.closeDropdown(!0):this.openDropdown())},e.prototype.openDropdown=function(){this.isOpen||(this.updateWidth(),this.updatePosition(),this.isOpen=!0,this.multiple&&this.filterEnabled&&this.filterInput.nativeElement.focus(),this.opened.emit(null))},e.prototype.closeDropdown=function(e){void 0===e&&(e=!1),this.isOpen&&(this.clearFilterInput(),this.isOpen=!1,e&&this.focus(),this.closed.emit(null))},e.prototype.selectOption=function(e){e.selected||(this.optionList.select(e,this.multiple),this.valueChanged(),this.selected.emit(e.undecoratedCopy()))},e.prototype.deselectOption=function(e){var t=this;e.selected&&(this.optionList.deselect(e),this.valueChanged(),this.deselected.emit(e.undecoratedCopy()),setTimeout(function(){t.multiple&&(t.updatePosition(),t.optionList.highlight(),t.isOpen&&t.dropdown.moveHighlightedIntoView())}))},e.prototype.clearSelection=function(){var e=this.optionList.selection;0<e.length&&(this.optionList.clearSelection(),this.valueChanged(),1===e.length?this.deselected.emit(e[0].undecoratedCopy()):this.deselected.emit(e.map(function(e){return e.undecoratedCopy()})))},e.prototype.toggleSelectOption=function(e){e.selected?this.deselectOption(e):this.selectOption(e)},e.prototype.selectHighlightedOption=function(){var e=this.optionList.highlightedOption;null!==e&&(this.selectOption(e),this.closeDropdown(!0))},e.prototype.deselectLast=function(){var e=this.optionList.selection;if(0<e.length){var t=e[e.length-1];this.deselectOption(t),this.setMultipleFilterInput(t.label+" ")}},e.prototype.clearFilterInput=function(){this.multiple&&this.filterEnabled?this.filterInput.nativeElement.value="":this.dropdown.clearFilterInput()},e.prototype.setMultipleFilterInput=function(e){this.filterEnabled&&(this.filterInput.nativeElement.value=e)},e.prototype.handleSelectContainerKeydown=function(e){var t=this,n=e.which;this.isOpen?n===this.KEYS.ESC||n===this.KEYS.UP&&e.altKey?this.closeDropdown(!0):n===this.KEYS.TAB?this.closeDropdown():n===this.KEYS.ENTER?this.selectHighlightedOption():n===this.KEYS.UP?(this.optionList.highlightPreviousOption(),this.dropdown.moveHighlightedIntoView(),this.filterEnabled||e.preventDefault()):n===this.KEYS.DOWN&&(this.optionList.highlightNextOption(),this.dropdown.moveHighlightedIntoView(),this.filterEnabled||e.preventDefault()):(n===this.KEYS.ENTER||n===this.KEYS.SPACE||n===this.KEYS.DOWN&&e.altKey)&&setTimeout(function(){t.openDropdown()})},e.prototype.handleMultipleFilterKeydown=function(e){e.which===this.KEYS.BACKSPACE&&this.hasSelected&&this.filterEnabled&&""===this.filterInput.nativeElement.value&&this.deselectLast()},e.prototype.handleSingleFilterKeydown=function(e){var t=e.which;t!==this.KEYS.ESC&&t!==this.KEYS.TAB&&t!==this.KEYS.UP&&t!==this.KEYS.DOWN&&t!==this.KEYS.ENTER||this.handleSelectContainerKeydown(e)},e.prototype.focus=function(){this.hasFocus=!0,this.multiple&&this.filterEnabled?this.filterInput.nativeElement.focus():this.selectionSpan.nativeElement.focus()},e.prototype.blur=function(){this.hasFocus=!1,this.selectionSpan.nativeElement.blur()},e.prototype.updateWidth=function(){this.width=this.selectionSpan.nativeElement.offsetWidth},e.prototype.updatePosition=function(){var e=this.selectionSpan.nativeElement;this.left=e.offsetLeft,this.top=e.offsetTop+e.offsetHeight},e.prototype.updateFilterWidth=function(){if("undefined"!=typeof this.filterInput){var e=this.filterInput.nativeElement.value;this.filterInputWidth=0===e.length?1+10*this.placeholderView.length:1+10*e.length}},e.decorators=[{type:i0.Component,args:[{selector:"ng-select",template:'<div\n #selection\n [attr.tabindex]="disabled ? null : 0"\n [ngClass]="{\n open: isOpen,\n focus: hasFocus,\n below: isBelow,\n disabled: disabled\n }"\n (click)="onSelectContainerClick($event)"\n (focus)="onSelectContainerFocus()"\n (keydown)="onSelectContainerKeydown($event)"\n (window:click)="onWindowClick()"\n (window:resize)="onWindowResize()"\n>\n <div class="single" *ngIf="!multiple">\n <div class="value" *ngIf="optionList.hasSelected()">\n {{ optionList.selection[0].label }}\n </div>\n <div class="placeholder" *ngIf="!optionList.hasSelected()">\n {{ placeholderView }}\n </div>\n <div\n class="clear"\n *ngIf="allowClear"\n (click)="onClearSelectionClick($event)"\n >\n &#x2715;\n </div>\n <div class="toggle" *ngIf="isOpen">&#x25B2;</div>\n <div class="toggle" *ngIf="!isOpen">&#x25BC;</div>\n </div>\n\n <div class="multiple" *ngIf="multiple">\n <div class="option" *ngFor="let option of optionList.selection">\n <span class="deselect-option" (click)="onDeselectOptionClick(option)">\n &#x2715;\n </span>\n {{ option.label }}\n </div>\n <input\n *ngIf="filterEnabled"\n #filterInput\n tabindex="-1"\n [placeholder]="placeholderView"\n [ngStyle]="{ \'width.px\': filterInputWidth }"\n (input)="onMultipleFilterInput($event)"\n (keydown)="onMultipleFilterKeydown($event)"\n />\n </div>\n</div>\n<select-dropdown\n *ngIf="isOpen"\n #dropdown\n [multiple]="multiple"\n [optionList]="optionList"\n [notFoundMsg]="notFoundMsg"\n [highlightColor]="highlightColor"\n [highlightTextColor]="highlightTextColor"\n [filterEnabled]="filterEnabled"\n [width]="width"\n [top]="top"\n [left]="left"\n (close)="onDropdownClose($event)"\n (optionClicked)="onDropdownOptionClicked($event)"\n (singleFilterClick)="onSingleFilterClick()"\n (singleFilterInput)="onSingleFilterInput($event)"\n (singleFilterKeydown)="onSingleFilterKeydown($event)"\n>\n</select-dropdown>\n',styles:[STYLE],providers:[SELECT_VALUE_ACCESSOR],encapsulation:i0.ViewEncapsulation.None}]}],e.propDecorators={options:[{type:i0.Input}],allowClear:[{type:i0.Input}],disabled:[{type:i0.Input}],highlightColor:[{type:i0.Input}],highlightTextColor:[{type:i0.Input}],multiple:[{type:i0.Input}],noFilter:[{type:i0.Input}],notFoundMsg:[{type:i0.Input}],placeholder:[{type:i0.Input}],opened:[{type:i0.Output}],closed:[{type:i0.Output}],selected:[{type:i0.Output}],deselected:[{type:i0.Output}],typed:[{type:i0.Output}],selectionSpan:[{type:i0.ViewChild,args:["selection"]}],dropdown:[{type:i0.ViewChild,args:["dropdown"]}],filterInput:[{type:i0.ViewChild,args:["filterInput"]}]},e}(),STYLE$1="select-dropdown {\n box-sizing: border-box;\n font-family: Sans-Serif;\n}\nselect-dropdown * {\n box-sizing: border-box;\n font-family: Sans-Serif;\n}\nselect-dropdown > div {\n background-color: #fff;\n border: 1px solid #ccc;\n border-top: none;\n box-sizing: border-box;\n position: absolute;\n z-index: 1;\n}\nselect-dropdown > div .filter {\n padding: 3px;\n width: 100%;\n}\nselect-dropdown > div .filter input {\n border: 1px solid #eee;\n box-sizing: border-box;\n padding: 4px;\n width: 100%;\n}\nselect-dropdown > div .options {\n max-height: 200px;\n overflow-y: auto;\n}\nselect-dropdown > div .options ul {\n list-style: none;\n margin: 0;\n padding: 0;\n}\nselect-dropdown > div .options ul li {\n padding: 4px 8px;\n cursor: pointer;\n user-select: none;\n}\nselect-dropdown .selected {\n background-color: #e0e0e0;\n}\nselect-dropdown .selected.highlighted {\n background-color: #2196F3;\n color: #fff;\n}\nselect-dropdown .highlighted {\n background-color: #2196F3;\n color: #fff;\n}\nselect-dropdown .disabled {\n background-color: #fff;\n color: #9e9e9e;\n cursor: default;\n pointer-events: none;\n}",SelectDropdownComponent=function(){function e(){this.close=new i0.EventEmitter,this.optionClicked=new i0.EventEmitter,this.singleFilterClick=new i0.EventEmitter,this.singleFilterInput=new i0.EventEmitter,this.singleFilterKeydown=new i0.EventEmitter,this.disabledColor="#fff",this.disabledTextColor="9e9e9e"}return e.prototype.ngOnInit=function(){this.optionsReset()},e.prototype.ngOnChanges=function(e){e.hasOwnProperty("optionList")&&this.optionsReset()},e.prototype.ngAfterViewInit=function(){this.moveHighlightedIntoView(),!this.multiple&&this.filterEnabled&&this.filterInput.nativeElement.focus()},e.prototype.onSingleFilterClick=function(e){this.singleFilterClick.emit(null)},e.prototype.onSingleFilterInput=function(e){this.singleFilterInput.emit(e.target.value)},e.prototype.onSingleFilterKeydown=function(e){this.singleFilterKeydown.emit(e)},e.prototype.onOptionsWheel=function(e){this.handleOptionsWheel(e)},e.prototype.onOptionMouseover=function(e){this.optionList.highlightOption(e)},e.prototype.onOptionClick=function(e){this.optionClicked.emit(e)},e.prototype.optionsReset=function(){this.optionList.resetFilter(),this.optionList.highlight()},e.prototype.getOptionStyle=function(e){return e.highlighted?{"background-color":this.highlightColor,color:this.highlightTextColor}:{}},e.prototype.clearFilterInput=function(){this.filterEnabled&&(this.filterInput.nativeElement.value="")},e.prototype.moveHighlightedIntoView=function(){var e=this.optionsList.nativeElement,t=e.offsetHeight,n=this.optionList.getHighlightedIndex();if(-1<n){var o=e.children[0].children[n].offsetHeight,r=n*o,i=r+o,a=e.scrollTop;a+t<i?e.scrollTop=i-t:r<a&&(e.scrollTop=r)}},e.prototype.handleOptionsWheel=function(e){var t=this.optionsList.nativeElement,n=0===t.scrollTop,o=t.offsetHeight+t.scrollTop===t.scrollHeight;n&&e.deltaY<0?e.preventDefault():o&&0<e.deltaY&&e.preventDefault()},e.decorators=[{type:i0.Component,args:[{selector:"select-dropdown",template:'<div [ngStyle]="{ \'top.px\': top, \'left.px\': left, \'width.px\': width }">\n <div class="filter" *ngIf="!multiple">\n <input\n *ngIf="filterEnabled"\n #filterInput\n (click)="onSingleFilterClick($event)"\n (input)="onSingleFilterInput($event)"\n (keydown)="onSingleFilterKeydown($event)"\n />\n </div>\n\n <div class="options" #optionsList>\n <ul (wheel)="onOptionsWheel($event)">\n <li\n *ngFor="let option of optionList.filtered"\n [ngClass]="{\n highlighted: option.highlighted,\n selected: option.selected,\n disabled: option.disabled\n }"\n [ngStyle]="getOptionStyle(option)"\n (click)="onOptionClick(option)"\n (mouseover)="onOptionMouseover(option)"\n >\n {{ option.label }}\n </li>\n <li *ngIf="!optionList.hasShown()" class="message">\n {{ notFoundMsg }}\n </li>\n </ul>\n </div>\n</div>\n',styles:[STYLE$1],encapsulation:i0.ViewEncapsulation.None}]}],e.propDecorators={filterEnabled:[{type:i0.Input}],highlightColor:[{type:i0.Input}],highlightTextColor:[{type:i0.Input}],left:[{type:i0.Input}],multiple:[{type:i0.Input}],notFoundMsg:[{type:i0.Input}],optionList:[{type:i0.Input}],top:[{type:i0.Input}],width:[{type:i0.Input}],close:[{type:i0.Output}],optionClicked:[{type:i0.Output}],singleFilterClick:[{type:i0.Output}],singleFilterInput:[{type:i0.Output}],singleFilterKeydown:[{type:i0.Output}],filterInput:[{type:i0.ViewChild,args:["filterInput"]}],optionsList:[{type:i0.ViewChild,args:["optionsList"]}]},e}(),SelectModule=function(){function e(){}return e.decorators=[{type:i0.NgModule,args:[{declarations:[SelectComponent,SelectDropdownComponent],exports:[SelectComponent],imports:[common.CommonModule,forms.FormsModule]}]}],e}(),SecurePipe=function(){function e(e,t){this._ref=e,this.sanitizer=t,this._latestValue=null,this._latestReturnedValue=null,this._subscription=null,this._obj=null,this._result=new rxjs.BehaviorSubject(null),this.result=this._result.asObservable(),this._internalSubscription=null}return e.prototype.ngOnDestroy=function(){this._subscription&&this._dispose()},e.prototype.transform=function(e,t){this.getfile=t;var n=this.internalTransform(e);return this.asyncTrasnform(n)},e.prototype.internalTransform=function(e){var n=this;return e&&this.previousUrl!==e&&(this.previousUrl=e,this._internalSubscription=this.getfile(e).subscribe(function(e){var t=n.sanitizer.bypassSecurityTrustUrl(e);n._result.next(t)})),this.result},e.prototype.asyncTrasnform=function(e){return this._obj?e!==this._obj?(this._dispose(),this.asyncTrasnform(e)):this._latestValue===this._latestReturnedValue?this._latestReturnedValue:(this._latestReturnedValue=this._latestValue,i0.WrappedValue.wrap(this._latestValue)):(e&&this._subscribe(e),this._latestReturnedValue=this._latestValue,this._latestValue)},e.prototype._subscribe=function(t){var n=this;this._obj=t,this._subscription=t.subscribe({next:function(e){return n._updateLatestValue(t,e)},error:function(e){throw e}})},e.prototype._dispose=function(){this._subscription&&this._subscription.unsubscribe(),this._internalSubscription&&this._internalSubscription.unsubscribe(),this._internalSubscription=null,this._latestValue=null,this._latestReturnedValue=null,this._subscription=null,this._obj=null},e.prototype._updateLatestValue=function(e,t){e===this._obj&&(this._latestValue=t,this._ref.markForCheck())},e.decorators=[{type:i0.Pipe,args:[{name:"secure",pure:!1}]}],e.ctorParameters=function(){return[{type:i0.ChangeDetectorRef},{type:platformBrowser.DomSanitizer}]},e}(),SharedModule=function(){function e(){}return e.decorators=[{type:i0.NgModule,args:[{declarations:[SecurePipe],imports:[common.CommonModule],exports:[SecurePipe],providers:[DataSources]}]}],e}(),FileUploadComponent=function(){function e(e){this.renderer=e,this.uploading=!1,this.fileUuid=null,this.pdfUploaded=!1,this.formEntryMode=!0,this.propagateChange=function(e){}}return Object.defineProperty(e.prototype,"dataSource",{get:function(){return this._dataSource},set:function(e){this._dataSource=e},enumerable:!0,configurable:!0}),e.prototype.ngOnInit=function(){this.fileUuid&&this.checkFileType()},e.prototype.onFileChange=function(e){try{for(var t=__values(e),n=t.next();!n.done;n=t.next()){var o=n.value;this.upload(o)}}catch(a){r={error:a}}finally{try{n&&!n.done&&(i=t["return"])&&i.call(t)}finally{if(r)throw r.error}}var r,i},e.prototype.upload=function(e){var t=this;this.dataSource&&(this.uploading=!0,this.dataSource.fileUpload(e).subscribe(function(e){t.fileUuid=e.image,t.checkFileType(),t.propagateChange(t.fileUuid),t.uploading=!1},function(e){t.uploading=!1}))},e.prototype.writeValue=function(e){e!==this.fileUuid&&(this.fileUuid=e,this.checkFileType())},e.prototype.registerOnChange=function(e){this.propagateChange=e},e.prototype.registerOnTouched=function(){},e.prototype.onChange=function(e){this.propagateChange(e.id)},e.prototype.clearValue=function(){this.fileUuid=null,this.pdfUploaded=!1,this.pdfUrl=null,this.propagateChange(this.fileUuid)},e.prototype.getPdfUrl=function(e){var t=this;this.dataSource.fetchFile(e,"pdf").subscribe(function(e){t.pdfUploaded=!0,t.pdfUrl=e.changingThisBreaksApplicationSecurity})},e.prototype.checkFileType=function(){-1!==this.fileUuid.search(/pdf/gi)&&this.getPdfUrl(this.fileUuid)},e.decorators=[{type:i0.Component,args:[{selector:"app-file-upload",template:'<lib-file-uploader\n [srcUrl]="pdfUrl"\n [formEntry]="formEntryMode"\n [(ngModel)]="fileUuid"\n (_onClear)="clearValue()"\n (uploadData)="onFileChange($event)"\n>\n</lib-file-uploader>\n<div *ngIf="fileUuid">\n <img\n *ngIf="!pdfUploaded"\n class="img-responsive"\n [src]="fileUuid | secure: this.dataSource.fetchFile"\n alt=""\n />\n</div>\n',providers:[{provide:forms.NG_VALUE_ACCESSOR,useExisting:i0.forwardRef(function(){return e}),multi:!0}],styles:["\n img {\n margin-left: auto;\n margin-right: auto;\n display: block;\n }\n "]}]}],e.ctorParameters=function(){return[{type:i0.Renderer2}]},e.propDecorators={dataSource:[{type:i0.Input}]},e}(),RemoteFileUploadModule=function(){function e(){}return e.decorators=[{type:i0.NgModule,args:[{imports:[common.CommonModule,SelectModule,forms.FormsModule,SharedModule,ngxWebcam.WebcamModule,ngxFileUploader.NgxFileUploaderModule],exports:[FileUploadComponent],declarations:[FileUploadComponent],providers:[]}]}],e}(),moment$1=moment_,DatePickerComponent=function(){function e(){this.locale="en",this.viewFormat="ll",this.returnObject="js",this.onDatePickerCancel=new i0.EventEmitter,this.onSelectDate=new i0.EventEmitter,this.onDisplayMonths=!1,this.onDisplayYears=!1,this.displayYearsIndex=0,this.monthsShort=moment$1.monthsShort()}return e.prototype.ngOnInit=function(){var n=this;this.initValue(),_.each(this.fullYearRange,function(e,t){n.currentYear=n.calendarDate.clone().startOf("year").year(),-1!==e.indexOf(n.currentYear)&&(n.displayYearsIndex=t)}),this.displayYearRange=this.fullYearRange[this.displayYearsIndex],this.generateCalendar()},e.prototype.prev=function(){this.onDisplayYears?(this.displayYearsIndex--,this.displayYearsIndex<0&&(this.displayYearsIndex=0),this.displayYearRange=this.fullYearRange[this.displayYearsIndex]):this.calendarDate=this.calendarDate.clone().subtract(1,"M"),this.generateCalendar()},e.prototype.showMonthSelection=function(){this.onDisplayMonths=!0,this.onDisplayYears=!1},e.prototype.showYearSelection=function(){this.onDisplayYears=!0,this.onDisplayMonths=!1},e.prototype.next=function(){this.onDisplayYears?(this.displayYearsIndex++,this.displayYearsIndex>=this.fullYearRange.length&&(this.displayYearsIndex=this.fullYearRange.length-1),this.displayYearRange=this.fullYearRange[this.displayYearsIndex++]):this.calendarDate=this.calendarDate.clone().add(1,"M"),this.generateCalendar()},e.prototype.selectDay=function(e){var t=e.diff(this.calendarDate.clone().startOf("date"),"days");e=this.calendarDate.clone().add(t,"d");var n=this.parseToReturnObjectType(e);this.onSelectDate.emit(n),this.cancelDatePicker()},e.prototype.selectMonth=function(e){this.calendarDate=this.calendarDate.clone().month(e),this.onDisplayMonths=!1,this.generateCalendar()},e.prototype.selectYear=function(e){this.calendarDate=this.calendarDate.clone().year(e),this.onDisplayYears=!1,this.generateCalendar()},e.prototype.selectToday=function(){var e=this.parseToReturnObjectType(moment$1());this.onSelectDate.emit(e),this.cancelDatePicker()},e.prototype.clearPickDate=function(){this.onSelectDate.emit(null),this.cancelDatePicker()},e.prototype.cancelDatePicker=function(){this.onDatePickerCancel.emit(!1)},e.prototype.generateYears=function(){for(var e=moment$1().year(),t=[],n=this.calendarDate.clone().subtract(100,"y").year();n<=e;n++)t.push(n);this.fullYearRange=_.chunk(t,14)},e.prototype.initValue=function(){moment$1.locale(this.locale),this.today=moment$1().startOf("date"),this.currentMonth=this.monthsShort[moment$1().month()],this.currentYear=moment$1().year(),this.dayNames=moment$1.weekdaysShort(!0),this.initDate?(this.calendarDate="string"===this.returnObject?moment$1(this.initDate,this.viewFormat):moment$1(this.initDate),this.selectedDate=this.calendarDate.clone().startOf("date")):this.calendarDate=moment$1(),this.generateYears()},e.prototype.generateCalendar=function(){this.calendarDays=[];for(var e=0-(this.calendarDate.clone().startOf("month").day()+(7-moment$1.localeData().firstDayOfWeek()))%7,t=41+e,n=e;n<=t;n+=1){var o=this.calendarDate.clone().startOf("month").add(n,"days");this.calendarDays.push(o)}},e.prototype.parseToReturnObjectType=function(e){switch(this.returnObject){case"js":return e.toDate();case"string":return e.format(this.viewFormat);case"moment":return e;case"json":return e.toJSON();case"array":return e.toArray();case"iso":return e.toISOString();case"object":return e.toObject();default:return e}},e.decorators=[{type:i0.Component,args:[{selector:"date-picker",template:'<picker-modal (onOverlayClick)="cancelDatePicker()">\n <div class="picker-wrap">\n <div class="picker-box">\n <div class="picker-header">\n <div class="picker-header-nav">\n <span class="nav-prev" (click)="prev()"></span>\n </div>\n <div class="picker-header-content">\n <div class="content">\n <span (click)="showMonthSelection()" class="month">{{\n calendarDate | moment: \'MMMM\'\n }}</span>\n <span class="seperator">|</span>\n <span (click)="showYearSelection()" class="year">{{\n calendarDate | moment: \'YYYY\'\n }}</span>\n </div>\n </div>\n <div class="picker-header-nav">\n <span class="nav-next" (click)="next()"></span>\n </div>\n </div>\n <div class="picker-calendar">\n <div\n class="picker-calendar-row"\n *ngIf="!onDisplayMonths && !onDisplayYears"\n >\n <span class="picker-weekday" *ngFor="let day of dayNames">{{\n day\n }}</span>\n </div>\n <div\n class="picker-calendar-row"\n *ngIf="!onDisplayMonths && !onDisplayYears"\n >\n <span\n class="picker-day"\n (click)="selectDay(day)"\n [ngClass]="{\n \'out-focus\': day.month() != calendarDate.month(),\n today: day.isSame(today),\n selected: day.isSame(selectedDate)\n }"\n *ngFor="let day of calendarDays"\n >\n {{ day | moment: \'D\' }}\n </span>\n </div>\n <div class="picker-calendar-row" *ngIf="onDisplayMonths">\n <span\n class="picker-month"\n *ngFor="let month of monthsShort"\n (click)="selectMonth(month)"\n [ngClass]="{\n selected: month === currentMonth\n }"\n >\n {{ month }}\n </span>\n </div>\n <div class="picker-calendar-row" *ngIf="onDisplayYears">\n <span\n class="picker-year"\n *ngFor="let year of displayYearRange"\n (click)="selectYear(year)"\n [ngClass]="{\n selected: year === currentYear\n }"\n >\n {{ year }}\n </span>\n </div>\n </div>\n <div class="picker-footer">\n <div class="picker-action action-today" (click)="selectToday()">\n <span class="text">Today</span>\n </div>\n <div class="picker-action action-clear" (click)="clearPickDate()">\n <span class="text">Clear</span>\n </div>\n <div class="picker-action action-close" (click)="cancelDatePicker()">\n <span class="text">Close</span>\n </div>\n </div>\n </div>\n </div>\n</picker-modal>\n',styles:["*,::after,::before{box-sizing:border-box}.picker-wrap{width:95vw;max-width:666px}.picker-box{font-family:'Open Sans';min-width:400px!important;padding:.625rem 1rem;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.picker-footer,.picker-header{font-size:1.333rem;line-height:2.5rem;display:flex;height:2.5rem;width:100%}.picker-header-nav{position:relative;cursor:pointer;width:calc(100% / 8)}.picker-header-nav>*{position:absolute;top:50%;right:auto;bottom:auto;left:50%;-webkit-transform:translate(-50%,-50%);transform:translate(-50%,-50%)}.picker-header-nav .nav-next::before,.picker-header-nav .nav-prev::before{content:' ';border-top:.5em solid transparent;border-bottom:.5em solid transparent;border-right:.75em solid #000;width:0;height:0;display:block;margin:0 auto}.picker-header-nav .nav-next::before{border-right:0;border-left:.75em solid #000}.picker-header-content{width:calc(100% * 6 / 8);text-align:center}.picker-header-content .month{font-size:1.778rem;line-height:2.5rem;margin-right:.5rem;font-weight:700}.picker-header-content .year{font-style:italic;color:#999}.picker-calendar{width:100%}.picker-calendar .picker-calendar-row{display:flex;flex-wrap:wrap;width:100%;margin-bottom:.625rem}.picker-calendar .picker-weekday{font-weight:700;text-align:left;color:#999;width:calc(100% / 7)}.picker-calendar .picker-day,.picker-calendar .picker-month,.picker-calendar .picker-year{font-size:1.333rem;line-height:2.5rem;position:relative;height:2.5rem;text-align:center;cursor:pointer;width:calc(100% / 7)}.picker-calendar .picker-day:hover,.picker-calendar .picker-month:hover,.picker-calendar .picker-year:hover{background:#b1dcfb}.picker-calendar .out-focus{color:#ddd}.picker-calendar .out-focus:hover{color:#000}.picker-calendar .selected{background:#0089ec;color:#fff}.picker-calendar .selected:hover{background:#0089ec}.picker-calendar .today::before{content:' ';position:absolute;top:2px;right:2px;width:0;height:0;border-top:.5em solid #0059bc;border-left:.5em solid transparent}.picker-footer{cursor:pointer}.picker-footer .picker-action{text-align:center;width:calc(100% / 3)}.picker-footer .picker-action:hover{background-color:#b1dcfb}.picker-footer .picker-action .text{padding-left:.8rem}.picker-footer .action-clear::before,.picker-footer .action-close::before,.picker-footer .action-today::before{content:' ';position:relative;display:inline-block;height:0;width:0}.picker-footer .action-today::before{border-top:.66em solid #0059bc;border-left:.66em solid transparent}.picker-footer .action-clear::before{top:-.5rem;width:1rem;border-top:3px solid #e20}.picker-footer .action-close::before{width:1rem;height:1rem;background:linear-gradient(to bottom,transparent 35%,#777 35%,#777 65%,transparent 65%),linear-gradient(to right,transparent 35%,#777 35%,#777 65%,transparent 65%);-webkit-transform:rotate(45deg);transform:rotate(45deg)}"]}]}],e.ctorParameters=function(){return[]},e.propDecorators={initDate:[{type:i0.Input}],locale:[{type:i0.Input}],viewFormat:[{type:i0.Input}],returnObject:[{type:i0.Input}],onDatePickerCancel:[{type:i0.Output}],onSelectDate:[{type:i0.Output}]},e}(),moment$2=moment_,TimePickerComponent=function(){function e(){this.showSecond=!0,this.viewFormat="hh:mm A",this.use12Hour=!1,this.returnObject="js",this.onSelectTime=new i0.EventEmitter,this.onTimePickerCancel=new i0.EventEmitter,this.hourFormat="HH"}return e.prototype.ngOnInit=function(){this.use12Hour&&(this.hourFormat="hh"),this.time=this.initTime?moment$2(this.initTime,this.viewFormat):moment$2(),this.initTime?this.time="string"===this.returnObject?moment$2(this.initTime,this.viewFormat):moment$2(this.initTime):this.time=moment$2()},e.prototype.increaseHour=function(){this.time=this.time.clone().add(1,"h")},e.prototype.decreaseHour=function(){this.time=this.time.clone().subtract(1,"h")},e.prototype.increaseMinute=function(){this.time=this.time.clone().add(1,"m")},e.prototype.decreaseMinute=function(){this.time=this.time.clone().subtract(1,"m")},e.prototype.increaseSecond=function(){this.time=this.time.clone().add(1,"s")},e.prototype.decreaseSecond=function(){this.time=this.time.clone().subtract(1,"s")},e.prototype.selectTime=function(){var e=this.parseToReturnObjectType(this.time);this.onSelectTime.emit(e),this.cancelTimePicker()},e.prototype.selectNow=function(){var e=this.parseToReturnObjectType(moment$2());this.onSelectTime.emit(e),this.cancelTimePicker()},e.prototype.clearTime=function(){this.onSelectTime.emit(null),this.cancelTimePicker()},e.prototype.cancelTimePicker=function(){this.onTimePickerCancel.emit(!1)},e.prototype.parseToReturnObjectType=function(e){switch(this.returnObject){case"js":return e.toDate();case"string":return e.format(this.viewFormat);case"moment":return e;case"json":return e.toJSON();case"array":return e.toArray();case"iso":return e.toISOString();case"object":return e.toObject();default:return e}},e.decorators=[{type:i0.Component,args:[{selector:"time-picker",template:'<picker-modal (onOverlayClick)="cancelTimePicker()">\n <div class="picker-wrap">\n <div class="picker-box">\n <div class="picker-header">Time Picker</div>\n <div class="picker-table">\n <ul class="picker-table-time">\n <li class="picker-table-number hour">\n <span class="arrow up" (click)="increaseHour()"></span>\n {{ time | moment: hourFormat }}\n <span class="arrow down" (click)="decreaseHour()"></span>\n </li>\n <li class="picker-table-separator">:</li>\n <li class="picker-table-number minute">\n <span class="arrow up" (click)="increaseMinute()"></span>\n {{ time | moment: \'mm\' }}\n <span class="arrow down" (click)="decreaseMinute()"></span>\n </li>\n <li *ngIf="showSecond" class="picker-table-separator">:</li>\n <li *ngIf="showSecond" class="picker-table-number second">\n <span class="arrow up" (click)="increaseSecond()"></span>\n {{ time | moment: \'ss\' }}\n <span class="arrow down" (click)="decreaseSecond()"></span>\n </li>\n <li *ngIf="use12Hour" class="picker-table-meridiem meridiem">\n {{ time | moment: \'A\' }}\n </li>\n </ul>\n </div>\n <div class="picker-footer">\n <div class="picker-action action-now" (click)="selectNow()">\n <span class="text">Now</span>\n </div>\n <div class="picker-action action-confirm" (click)="selectTime()">\n <span class="text">Confirm</span>\n </div>\n <div class="picker-action action-clear" (click)="clearTime()">\n <span class="text">Clear</span>\n </div>\n <div class="picker-action action-close" (click)="cancelTimePicker()">\n <span class="text">Close</span>\n </div>\n </div>\n </div>\n </div>\n</picker-modal>\n',styles:["*,::after,::before{box-sizing:border-box}.picker-wrap{width:95vw;max-width:40rem;font-family:'Open Sans'}.picker-box{width:100%;padding:.625rem 1rem;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.picker-footer,.picker-header{font-size:1.333rem;line-height:2.5rem;height:2.5rem;width:100%}.picker-header{text-align:center}.picker-table{width:100%;margin:2.5rem 0}.picker-table-time{font-size:2.37rem;line-height:2.5rem;list-style:none;margin:0;padding:0;display:flex;justify-content:center;width:100%;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.picker-table-meridiem,.picker-table-number,.picker-table-separator{text-align:center}.picker-table-meridiem,.picker-table-number{position:relative;width:20%}.arrow{position:absolute;left:50%;border:solid #777;border-width:0 .2rem .2rem 0;display:inline-block;padding:.25rem;cursor:pointer}.arrow.up{top:-1rem;-webkit-transform:translateX(-50%) rotate(-135deg);transform:translateX(-50%) rotate(-135deg)}.arrow.down{bottom:-1rem;-webkit-transform:translateX(-50%) rotate(45deg);transform:translateX(-50%) rotate(45deg)}.arrow:hover{border-color:#1975d2}.picker-table-separator{width:calc(20% / 3)}.picker-footer{display:flex;justify-content:center;width:100%;cursor:pointer}.picker-footer .picker-action{width:25%;text-align:center}.picker-footer .picker-action:hover{background-color:#b1dcfb}.picker-footer .picker-action .text{padding-left:.8rem}.picker-footer .action-clear::before,.picker-footer .action-close::before,.picker-footer .action-confirm::before,.picker-footer .action-now::before{content:' ';position:relative;display:inline-block;height:0;width:0}.picker-footer .action-now::before{border-top:.66em solid #0059bc;border-left:.66em solid transparent}.picker-footer .action-confirm::before{width:1rem;height:1rem;border-radius:100%;background-color:#00b5ad}.picker-footer .action-clear::before{top:-.5rem;width:1rem;border-top:3px solid #e20}.picker-footer .action-close::before{width:1rem;height:1rem;background:linear-gradient(to bottom,transparent 35%,#777 35%,#777 65%,transparent 65%),linear-gradient(to right,transparent 35%,#777 35%,#777 65%,transparent 65%);-webkit-transform:rotate(45deg);transform:rotate(45deg)}"]}]}],e.ctorParameters=function(){return[]},e.propDecorators={initTime:[{type:i0.Input}],showSecond:[{type:i0.Input}],viewFormat:[{type:i0.Input}],use12Hour:[{type:i0.Input}],returnObject:[{type:i0.Input}],onSelectTime:[{type:i0.Output}],onTimePickerCancel:[{type:i0.Output}]},e}(),ModalComponent=function(){function e(){this.onOverlayClick=new i0.EventEmitter}return e.prototype.ngOnInit=function(){},e.prototype.closeModal=function(){this.onOverlayClick.emit(!1)},e.decorators=[{type:i0.Component,args:[{selector:"picker-modal",template:'<section class="x-modal">\n <section class="modal-overlay" (click)="closeModal()"></section>\n <section class="modal-main" id="section-modal-main">\n <ng-content></ng-content>\n </section>\n</section>\n',styles:[":host{z-index:9999999999}*,::after,::before{box-sizing:border-box}.modal-main{position:absolute;left:19.6%;right:auto;top:auto;z-index:111;background-color:#fff;border:1px solid #d7dad7;border-radius:6px;-webkit-transform:translate(-50%,0);transform:translate(-50%,0);box-shadow:0 5px 15px rgba(0,0,0,.3)}"],changeDetection:i0.ChangeDetectionStrategy.OnPush,animations:[]}]}],e.ctorParameters=function(){return[]},e.propDecorators={onOverlayClick:[{type:i0.Output}]},e}(),MomentPipe=function(){function e(){}return e.prototype.transform=function(e,t){return t?e.format(t):e.format("MMM DD, YYYY")},e.decorators=[{type:i0.Pipe,args:[{name:"moment"}]}],e}(),Moment=moment_,DateTimePickerComponent=function(){function e(){this.showDate=!0,this.showTime=!1,this.showWeeks=!1,this.weeks=[2,4,6,8,12,16,24],this.onDateChange=new i0.EventEmitter,this.showDatePicker=!1,this.showTimePicker=!1,this.onChange=function(){},this.onTouched=function(){}}return e.prototype.ngOnInit=function(){},e.prototype.weeksSelected=function(e){var t=new Date,n=t.setDate(t.getDate()+7*e);this.value=Moment(n).format()},e.prototype.setDate=function(e){this.value=e&&""!==e?Moment(e).format():e},e.prototype.setTime=function(e){this.value=e&&""!==e?Moment(e).format():e},e.prototype.toggleDatePicker=function(e){this.showDatePicker=e},e.prototype.toggleTimePicker=function(e){this.showTimePicker=e},Object.defineProperty(e.prototype,"value",{get:function(){return this.modelValue},set:function(e){this.modelValue=e,this.onDateChange.emit(e),this.onChange(e),this.onTouched()},enumerable:!0,configurable:!0}),e.prototype.registerOnChange=function(e){this.onChange=e},e.prototype.registerOnTouched=function(e){this.onTouched=e},e.prototype.writeValue=function(e){e instanceof Date?this.value=Moment(e).format():this.value=e},e.decorators=[{type:i0.Component,args:[{selector:"date-time-picker",template:'<div class="row">\n <div *ngIf="!showTime" class="col-xs-12 col-md-12">\n <input\n *ngIf="!showWeeks"\n type="text"\n class="form-control"\n [value]="value | date: \'mediumDate\'"\n (focus)="toggleDatePicker(true)"\n readonly\n placeholder="Select Date"\n />\n <div *ngIf="showWeeks" class="input-group">\n <input\n type="text"\n class="form-control"\n class="form-control"\n [value]="value | date: \'mediumDate\'"\n (focus)="toggleDatePicker(true)"\n readonly\n placeholder="Select Date"\n />\n <div class="input-group-btn">\n <button\n type="button"\n class="btn btn-default dropdown-toggle"\n data-toggle="dropdown"\n aria-haspopup="true"\n aria-expanded="false"\n >\n Weeks <span class="caret"></span>\n </button>\n <ul class="dropdown-menu up">\n <li (click)="weeksSelected(count)" *ngFor="let count of weeks">\n <span> {{ count }} Weeks</span>\n </li>\n </ul>\n </div>\n </div>\n </div>\n <div *ngIf="showTime" class="col-xs-8 col-md-8">\n <input\n *ngIf="!showWeeks"\n type="text"\n class="form-control"\n [value]="value | date: \'mediumDate\'"\n (focus)="toggleDatePicker(true)"\n readonly\n placeholder="Select Date"\n />\n <div *ngIf="showWeeks" class="input-group">\n <input\n type="text"\n class="form-control"\n class="form-control"\n [value]="value | date: \'mediumDate\'"\n (focus)="toggleDatePicker(true)"\n readonly\n placeholder="Select Date"\n />\n <div class="input-group-btn">\n <button\n type="button"\n class="btn btn-default dropdown-toggle"\n data-toggle="dropdown"\n aria-haspopup="true"\n aria-expanded="false"\n >\n Weeks <span class="caret"></span>\n </button>\n <ul class="dropdown-menu up">\n <li (click)="weeksSelected(count)" *ngFor="let count of weeks">\n <span> {{ count }} Weeks</span>\n </li>\n </ul>\n </div>\n </div>\n </div>\n <div *ngIf="showTime" class="col-xs-4 col-md-4">\n <input\n type="text"\n class="form-control"\n [value]="value | date: \'shortTime\'"\n (focus)="toggleTimePicker(true)"\n readonly\n placeholder="Select Time"\n />\n </div>\n</div>\n<date-picker\n *ngIf="showDatePicker"\n [initDate]="value"\n (onSelectDate)="setDate($event)"\n (onDatePickerCancel)="toggleDatePicker($event)"\n></date-picker>\n\n<time-picker\n *ngIf="showTimePicker"\n [initTime]="value"\n [use12Hour]="true"\n (onSelectTime)="setTime($event)"\n (onTimePickerCancel)="toggleTimePicker($event)"\n></time-picker>\n',styles:["input[readonly]{background-color:#fff}.up{bottom:100%!important;top:auto!important}.glyphicon{top:1px}"],providers:[{provide:forms.NG_VALUE_ACCESSOR,useExisting:i0.forwardRef(function(){return e}),multi:!0}]}]}],e.ctorParameters=function(){return[]},e.propDecorators={modelValue:[{type:i0.Input}],showDate:[{type:i0.Input}],showTime:[{type:i0.Input}],showWeeks:[{type:i0.Input}],weeks:[{type:i0.Input}],onDateChange:[{type:i0.Output}]},e}(),DateTimePickerModule=function(){function e(){}return e.decorators=[{type:i0.NgModule,args:[{imports:[common.CommonModule,forms.FormsModule],declarations:[DatePickerComponent,TimePickerComponent,ModalComponent,MomentPipe,DateTimePickerComponent],exports:[DatePickerComponent,TimePickerComponent,ModalComponent,MomentPipe,DateTimePickerComponent],providers:[]}]}],e}(),moment$3=moment_,MY_FORMATS={parse:{dateInput:"LL"},display:{dateInput:"MMMM DD, YYYY (dddd)",monthYearLabel:"MMM YYYY",dateA11yLabel:"LL",monthYearA11yLabel:"MMMM YYYY"}},NgxDateTimePickerComponent=function(){function e(){this.selectedTime=moment$3().format(),this.selectedDate=moment$3().format(),this.loadInitial=!1,this.showTimePicker=!1,this.weeks=[0,2,4,6,8,12,16,24],this.showTime=!1,this.showWeeks=!0,this.dateFormat="MMMM DD, YYYY (dddd)",this._showHolidays=!0,this.observer=null,this.onDateChange=new i0.EventEmitter,this.onChange=function(){},this.onTouched=function(){}}return Object.defineProperty(e.prototype,"showHolidays",{set:function(e){this._showHolidays=!0===e||"true"===e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"dataSource",{get:function(){return this._dataSource},set:function(e){this._dataSource=e},enumerable:!0,configurable:!0}),e.prototype.ngOnInit=function(){},e.prototype.writeValue=function(e){this.value=e},e.prototype.registerOnChange=function(e){this.onChange=e},e.prototype.registerOnTouched=function(e){},e.prototype.onTimeSelect=function(e){var t=moment$3(this.selectedDate),n=e;this.setDateTime(t,n)},e.prototype.onDateSelect=function(e){var t=moment$3(e.value),n=this.selectedTime,o=this.setDateTime(t,n);e.value;this.value=o},e.prototype.toggleTimePicker=function(e){this.showTimePicker=e},e.prototype.setCurrentTime=function(){var e=moment$3(this.selectedDate),t=moment$3().format("HH:mm:ss");this.setDateTime(e,t)},e.prototype.weekSelect=function(e){var t=moment$3().format(),n=moment$3(t).add(e.value,"weeks"),o=t;this.setDateTime(n,o)},e.prototype.selectionChange=function(e){console.log("Week selected",e)},e.prototype.getWeekPickerCssClass=function(){return this.showTime?"col-sm-2 form-group":"col-sm-3 form-group"},e.prototype.getDatePickerCssClass=function(){return this.showTime&&this.showWeeks?"col-sm-5 form-group":!0===this.showWeeks?"col-sm-9 form-group":!0===this.showTime?"col-sm-8 form-group":"col-sm-12 form-group"},e.prototype.getTimePickerCssClass=function(){return this.showTime&&this.showWeeks?"col-sm-5 form-group":!0===this.showWeeks?"col-sm-9 form-group":"col-sm-4 form-group"},e.prototype.setDateTime=function(e,t){var n,o=moment$3(e).format("DD-MM-YYYY");n=this.showTime?moment$3(t).format("HH:mm:ss"):"00:00:00";var r=moment$3(o+""+n,"DD-MM-YYYY HH:mm:ss"),i=moment$3(r).format();return this.selectedDate=i,this.selectedTime=i,this.value=i,this.onChange(this.value),i},e.prototype.onOpen=function(){var e=this,t=document.querySelector(".mat-calendar-content");t&&(this.observer=new MutationObserver(function(){e.highlightHolidays()}),this.observer.observe(t,{childList:!0,subtree:!0}))},e.prototype.onClose=function(){this.observer&&(this.observer.disconnect(),this.observer=null)},e.prototype.highlightHolidays=function(){if(!!document.querySelector("mat-month-view")){var a=document.querySelectorAll(".mat-calendar-body-cell"),e=function(e){var t=a[e],n=new Date(t.getAttribute("aria-label")),o=moment$3(n).format("YYYY-MM-DD"),r=s.dataSource.filter(function(e){return e.date===o});if(0<r.length){var i=r.map(function(e){return e.name}).sort().join("\n\n");t.classList.add("highlight-date"),t.setAttribute("data-tooltip",i)}else t.classList.remove("highlight-date"),t.removeAttribute("data-tooltip")},s=this;for(n=0;n<a.length;n++)e(n)}else for(var t=document.querySelectorAll(".mat-calendar-body-cell"),n=0;n<t.length;n++)t[n].classList.remove("highlight-date"),t[n].removeAttribute("data-tooltip")},e.decorators=[{type:i0.Component,args:[{selector:"ngx-date-time-picker",template:'<div>\n <div class="row">\n <div [class]="getDatePickerCssClass()">\n <div class="input-group">\n <input\n matInput\n [matDatepicker]="picker"\n class="form-control"\n [value]="value"\n placeholder="Choose a date"\n (dateChange)="onDateSelect($event)"\n (click)="picker.open()"\n readonly\n />\n <mat-datepicker #picker (opened)="onOpen()" (closed)="onClose()"></mat-datepicker>\n <mat-datepicker-toggle\n matSuffix\n [for]="picker"\n class="input-group-btn"\n ></mat-datepicker-toggle>\n </div>\n </div>\n <div [class]="getWeekPickerCssClass()" *ngIf="showWeeks">\n <mat-select\n placeholder="Select Weeks"\n class="form-control"\n name="weeks"\n (selectionChange)="weekSelect($event)"\n >\n <mat-option *ngFor="let count of weeks" [value]="count">\n {{ count }} Weeks\n </mat-option>\n </mat-select>\n </div>\n <div [class]="getTimePickerCssClass()" *ngIf="showTime">\n <input\n type="text"\n class="form-control"\n [value]="value | date: \'shortTime\'"\n (focus)="toggleTimePicker(true)"\n readonly\n placeholder="Select Time"\n />\n <time-picker\n *ngIf="showTimePicker"\n [initTime]="value"\n [use12Hour]="true"\n (onSelectTime)="onTimeSelect($event)"\n (onTimePickerCancel)="toggleTimePicker($event)"\n ></time-picker>\n </div>\n </div>\n</div>\n',styles:["#time-section{display:inline-block}#ngx-atp-time-picker,#ngx-mat-form-field{width:100%}.up{bottom:100%!important;top:auto!important}.time-btn{margin-top:-20px}::ng-deep .highlight-date{border-radius:999px;background-color:#90ee90!important}::ng-deep .highlight-date[data-tooltip]:hover::after{content:attr(data-tooltip);position:absolute;top:-40px;left:50%;-webkit-transform:translateX(-50%);transform:translateX(-50%);background-color:#333;color:#fff;padding:9px 10px;border-radius:4px;font-size:12px;line-height:6px;white-space:pre-wrap;z-index:1000;height:-webkit-fit-content;height:-moz-fit-content;height:fit-content;width:-webkit-max-content;width:-moz-max-content;width:max-content;text-align:start}::ng-deep .highlight-date[data-tooltip]:hover::before{content:'';position:absolute;top:-8px;left:50%;-webkit-transform:translateX(-50%);transform:translateX(-50%);border:4px solid transparent;border-top-color:#333;z-index:1000}"],providers:[{provide:core.MAT_DATE_FORMATS,useValue:MY_FORMATS},{provide:core.DateAdapter,useClass:materialMomentAdapter.MomentDateAdapter},{provide:forms.NG_VALUE_ACCESSOR,useExisting:i0.forwardRef(function(){return e}),multi:!0}]}]}],e.propDecorators={weeks:[{type:i0.Input}],modelValue:[{type:i0.Input}],showTime:[{type:i0.Input}],showWeeks:[{type:i0.Input}],dateFormat:[{type:i0.Input}],showHolidays:[{type:i0.Input}],picker:[{type:i0.ViewChild,args:["picker"]}],dataSource:[{type:i0.Input}],onDateChange:[{type:i0.Output}]},e}(),NgxDateTimePickerModule=function(){function e(){}return e.decorators=[{type:i0.NgModule,args:[{imports:[common.CommonModule,forms.FormsModule,forms.ReactiveFormsModule,datepicker.MatDatepickerModule,formField.MatFormFieldModule,material.MatNativeDateModule,material.MatInputModule,DateTimePickerModule,select.MatSelectModule,material.MatTooltipModule],declarations:[NgxDateTimePickerComponent],exports:[datepicker.MatDatepickerModule,formField.MatFormFieldModule,material.MatNativeDateModule,material.MatInputModule,NgxDateTimePickerComponent],providers:[]}]}],e}(),Option$1=function ao(e){this.label=e.label,this.value=e.value},AfeNgSelectComponent=function(){function e(){this.question_options=[],this.errors=[],this.propagateChange=function(e){}}return e.prototype.getChangingText=function(e){var t=this;this.getData(e).subscribe(function(e){t.question_options=e})},e.prototype.writeValue=function(e){},e.prototype.registerOnChange=function(e){this.propagateChange=e},e.prototype.registerOnTouched=function(e){},e.prototype.ngOnChanges=function(e){},e.prototype.ngOnInit=function(){var t=this;this.extras&&this.extras.originalValue&&this.resolveSelectedOption(this.extras.originalValue).subscribe(function(e){t.selected_question_option=e})},e.prototype.getData=function(e){var o=this;return this.subject=new rxjs.BehaviorSubject([]),this.dataSource.searchOptions(e).subscribe(function(e){for(var t=new Array,n=0;n<e.length;n++)t.push(new Option$1(e[n]));o.subject.next(t)},function(e){o.subject.error(e)}),this.subject.asObservable()},e.prototype.onValueChange=function(e){},e.prototype.resolveSelectedOption=function(e){var t=this;return this.subjectOption=new rxjs.BehaviorSubject(null),this.dataSource.resolveSelectedValue(e).subscribe(function(e){t.subjectOption.next(e)},function(e){t.subjectOption.error(e)}),this.subjectOption.asObservable()},e.prototype.resetOptions=function(){this.subject.next(new Array)},e.decorators=[{type:i0.Component,args:[{selector:"afe-ng-select",template:'<ng-select\n (searchInputText)="getChangingText($event)"\n (ngModelChange)="onValueChange($event)"\n [options]="question_options"\n [multiple]="multiple"\n >\n </ng-select> ',providers:[{provide:forms.NG_VALUE_ACCESSOR,useExisting:i0.forwardRef(function(){return e}),multi:!0}]}]}],e.propDecorators={dataSource:[{type:i0.Input}],multiple:[{type:i0.Input}],extras:[{type:i0.Input}]},e}(),FormSchemaCompiler=function(){function e(){}return e.prototype.compileFormSchema=function(e,t){var n=this.getReferencedForms(e,t);if(_.isEmpty(n))return e;var o=this.getAllPlaceholderObjects(e);return _.isEmpty(o)||this.replaceAllPlaceholdersWithActualObjects(n,o),e},e.prototype.findSchemaByName=function(e,t){if(!_.isEmpty(e)&&!_.isEmpty(t)){var n={};return _.each(e,function(e){e.name===t&&(n=e)}),n}},e.prototype.getPageInSchemaByLabel=function(e,t){if(!_.isEmpty(e)&&!_.isEmpty(t)){var n={};return _.each(e.pages,function(e){e.label===t&&(n=e)}),n}},e.prototype.getSectionInSchemaByPageLabelBySectionLabel=function(e,t,n){if(!(_.isEmpty(e)||_.isEmpty(t)||_.isEmpty(n))){var o=this.getPageInSchemaByLabel(e,t);if(!_.isEmpty(o)){var r={};return _.each(o.sections,function(e){e.label===n&&(r=e)}),r}}},e.prototype.getQuestionByIdInSchema=function(e,t){if(!_.isEmpty(e)&&!_.isEmpty(t)){if(Array.isArray(e)){for(var n=void 0,o=0;o<e.length&&(_.isEmpty(e[o])||(n=this.getQuestionByIdInSchema(e[o],t)),_.isEmpty(n));o++);return n}if("object"==typeof e){if(this.isQuestionObjectWithId(e,t))return e;if(this.isSchemaSubObjectExpandable(e)){var r=e.pages||e.sections||e.questions;return this.getQuestionByIdInSchema(r,t)}}}},e.prototype.getQuestionsArrayByQuestionIdInSchema=function(e,t){if(!_.isEmpty(e)&&!_.isEmpty(t))return this.getQuestionsArrayByQuestionId(e,e,t)},e.prototype.getQuestionsArrayByQuestionId=function(e,t,n){if(Array.isArray(t)){for(var o=void 0,r=0;r<t.length&&(_.isEmpty(t[r])||(o=this.getQuestionsArrayByQuestionId(t,t[r],n)),_.isEmpty(o));r++);return o}if("object"==typeof t){if(this.isQuestionObjectWithId(t,n))return e;if(this.isSchemaSubObjectExpandable(t)){var i=t.pages||t.sections||t.questions;return this.getQuestionsArrayByQuestionId(i,i,n)}}},e.prototype.isSchemaSubObjectExpandable=function(e){if("object"==typeof e){var t=Object.keys(e);if(_.includes(t,"pages")||_.includes(t,"sections")||_.includes(t,"questions"))return!0}return!1},e.prototype.isQuestionObjectWithId=function(e,t){return e.id===t},e.prototype.getAllPlaceholderObjects=function(e){var t=[];return this.extractPlaceholderObjects(e,t),t},e.prototype.extractPlaceholderObjects=function(e,t){if(!_.isEmpty(e))if(Array.isArray(e))for(var n=0;n<e.length;n++)_.isEmpty(e[n])||this.extractPlaceholderObjects(e[n],t);else if("object"==typeof e)if(_.isEmpty(e.reference)){if(this.isSchemaSubObjectExpandable(e)){var o=e.pages||e.sections||e.questions;this.extractPlaceholderObjects(o,t)}}else t.push(e)},e.prototype.fillPlaceholderObject=function(e,t){for(var n in t)_.isEmpty(e[n])&&(e[n]=t[n]);return e},e.prototype.replaceAllPlaceholdersWithActualObjects=function(n,e){var o=this;return _.each(e,function(e){var t=o.getReferencedObject(e.reference,n);_.isEmpty(t)?console.error("Form compile: Error finding referenced object",e.reference):(e=o.fillPlaceholderObject(e,t),delete(e=o.removeExcludedQuestionsFromPlaceholder(e)).reference)}),e},e.prototype.removeObjectFromArray=function(e,t){var n=e.indexOf(t);-1!==n&&e.splice(n,1)},e.prototype.removeExcludedQuestionsFromPlaceholder=function(o){var r=this;return Array.isArray(o.reference.excludeQuestions)&&_.each(o.reference.excludeQuestions,function(e){var t=r.getQuestionsArrayByQuestionIdInSchema(o,e);if(Array.isArray(t)){var n=r.getQuestionByIdInSchema(t,e);r.removeObjectFromArray(t,n)}}),o},e.prototype.getReferencedObject=function(e,t){if(_.isEmpty(e.form))console.error("Form compile: reference missing form attribute",e);else{if(!_.isEmpty(t[e.form]))return _.isEmpty(e.questionId)?_.isEmpty(e.page)||_.isEmpty(e.section)?_.isEmpty(e.page)?void console.error("Form compile: Unsupported reference type",e.reference):this.getPageInSchemaByLabel(t[e.form],e.page):this.getSectionInSchemaByPageLabelBySectionLabel(t[e.form],e.page,e.section):this.getQuestionByIdInSchema(t[e.form],e.questionId);console.error("Form compile: referenced form alias not found",e)}},e.prototype.getReferencedForms=function(e,t){var n=this,o=e.referencedForms;if(!_.isEmpty(o)){var r={};return _.each(o,function(e){r[e.alias]=n.findSchemaByName(t,e.formName)}),r}},e.decorators=[{type:i0.Injectable}],e.ctorParameters=function(){return[]},e}(),TextInputQuestion=function(n){function e(e){var t=n.call(this,e)||this;return t.placeholder=e.placeholder||"",t.controlType=exports.AfeControlType.AfeFormControl,t}return __extends(e,n),e}(QuestionBase),TextAreaInputQuestion=function(n){function e(e){var t=n.call(this,e)||this;return t.placeholder=e.placeholder||"",t.isExpanded=e.isExpanded||!1,t.rows=e.rows||18,t.renderingType="textarea",t.controlType=exports.AfeControlType.AfeFormControl,t}return __extends(e,n),e}(TextInputQuestion),SelectQuestion=function(n){function e(e){var t=n.call(this,e)||this;return t.renderingType="select",t.options=e.options||[],t.controlType=exports.AfeControlType.AfeFormControl,t.dataSource=e.dataSource||"",t}return __extends(e,n),e}(QuestionBase),UiSelectQuestion=function(n){function e(e){var t=n.call(this,e)||this;return t.renderingType="ui-select",t.options=e.options||[],t.controlType=exports.AfeControlType.AfeFormControl,t}return __extends(e,n),e}(QuestionBase),DateQuestion=function(n){function e(e){var t=n.call(this,e)||this;return t.showTime=!0,t.showWeeksAdder=!1,t.showHolidays=!0,t.renderingType="date",t.controlType=exports.AfeControlType.AfeFormControl,t}return __extends(e,n),e}(QuestionBase),MultiSelectQuestion=function(n){function e(e){var t=n.call(this,e)||this;return t.renderingType="multi-select",t.options=e.options||[],t.controlType=exports.AfeControlType.AfeFormControl,t}return __extends(e,n),e}(SelectQuestion),NestedQuestion=function(t){function e(e){return t.call(this,e)||this}return __extends(e,t),e}(QuestionBase),QuestionGroup=function(n){function e(e){var t=n.call(this,e)||this;return t.isExpanded=!0,t.renderingType="group",t.questions=e.questions||[],t.controlType=exports.AfeControlType.AfeFormGroup,t}return __extends(e,n),e}(NestedQuestion),RepeatingQuestion=function(n){function e(e){var t=n.call(this,e)||this;return t.renderingType="repeating",t.questions=e.questions||[],t.controlType=exports.AfeControlType.AfeFormArray,t}return __extends(e,n),e}(NestedQuestion),CheckBoxQuestion=function(n){function e(e){var t=n.call(this,e)||this;return t.renderingType="checkbox",t.options=e.options||[],t.controlType=exports.AfeControlType.AfeFormControl,t}return __extends(e,n),e}(QuestionBase),TimeQuestion=function(n){function e(e){var t=n.call(this,e)||this;return t.renderingType="time",t.controlType=exports.AfeControlType.AfeFormControl,t}return __extends(e,n),e}(QuestionBase),FileUploadQuestion=function(n){function e(e){var t=n.call(this,e)||this;return t.showTime=!0,t.showWeeksAdder=!1,t.renderingType="file",t.dataSource=e.dataSource,t.controlType=exports.AfeControlType.AfeFormControl,t}return __extends(e,n),e}(QuestionBase),TestOrderQuestion=function(n){function e(e){var t=n.call(this,e)||this;return t.renderingType="select",t.orderType=e.orderType,t.selectableOrders=e.selectableOrders,t.options=e.options,t.orderSettingUuid=e.orderSettingUuid,t.rendering=e.orderSettingUuid,t.controlType=exports.AfeControlType.AfeFormControl,t}return __extends(e,n),e}(QuestionBase),DateValidationModel=function(n){function e(e){var t=n.call(this,e)||this;return t.allowFutureDates=!1,t.allowFutureDates="true"===e.allowFutureDates,t}return __extends(e,n),e}(ValidationModel),MaxValidationModel=function(o){function e(e){var t=o.call(this,e)||this,n=e.max;return t.max=+n,t}return __extends(e,o),e}(ValidationModel),MinValidationModel=function(o){function e(e){var t=o.call(this,e)||this,n=e.min;return t.min=+n,t}return __extends(e,o),e}(ValidationModel),DecimalPointValidationModel=function(){function e(e){this.decimalPlace=0,this.failsWhenExpression="",this.type="js_expression",this.decimalPlace=e.decimalPlace}return e.prototype.setFailExpression=function(){this.failsWhenExpression="!isEmpty(myValue) && String(myValue).split('.')[1].length !== "+this.decimalPlace},e.prototype.setMessage=function(){this.message="Value must be to "+this.decimalPlace+" decimal places"},e.prototype.setValuesAndExpressions=function(){this.setMessage(),this.setFailExpression()},e}(),DummyDataSource=function(){function e(){this.returnErrorOnNext=!1}return e.prototype.resolveSelectedValue=function(t){var e=this.sampleData();e=(e=e.map(function(e){return new Option$1({label:e.label,value:e.concept})})).filter(function(e){return e.value===t});var n=new rxjs.BehaviorSubject([]);return this.returnErrorOnNext?n.error(new Error("Error loading Options")):n.next(e[0]),n.asObservable()},e.prototype.fileUpload=function(e){return rxjs.of({image:""})},e.prototype.fetchFile=function(e){return rxjs.of({image:""})},e.prototype.searchOptions=function(t){var e=this.sampleData();e=(e=e.map(function(e){return new Option$1({label:e.label,value:e.concept})})).filter(function(e){return-1!==e.label.indexOf(t)});var n=new rxjs.BehaviorSubject([]);return this.returnErrorOnNext?n.error(new Error("Error loading Options")):n.next(e),n.asObservable()},e.prototype.sampleData=function(){return[{concept:"a899e0ac-1350-11df-a1f1-0026b9348838",label:"None"},{concept:"a8ad1276-1350-11df-a1f1-0026b9348838",label:"Breathlessness"},{concept:"a892e4b4-1350-11df-a1f1-0026b9348838",label:"Chest pain"},{concept:"a8afc8b8-1350-11df-a1f1-0026b9348838",label:"Cough = 2 weeks"},{concept:"d7adae14-c386-49cc-8f7c-765d8ceec566",label:"Fever for = 2 weeks"},{concept:"3f57aafc-7162-41da-a51b-6a804cb6f5e8",label:"New exposure to household contact with TB"},{concept:"a89807f0-1350-11df-a1f1-0026b9348838",label:"Noticeable Weight loss"},{concept:"e1862fef-68ed-4df4-90dd-a00152f719aa",label:"Night sweats = 2 weeks"},{concept:"a8ad462e-1350-11df-a1f1-0026b9348838",label:"Abdomen"},{concept:"f218c60e-4b54-475a-a4fa-facab9216da8",label:"Groin"},{concept:"a8a774b0-1350-11df-a1f1-0026b9348838",label:"Joints"},{concept:"4639388c-ee31-4dcf-abb4-ad71253493bb",label:"Neck Kw"}]},e}(),moment$4=moment_,HistoricalEncounterDataService=function(){function e(){this.dataSources={}}return e.prototype.registerEncounters=function(e,t){var o=this,r={data:[],getValue:function(e,t){void 0===t&&(t=0);var n=e.split(".");return 0<n.length?o.getFirstValue(n,r.data[t]):r.data[t][e]},getAllObjects:function(){return r.data},getSingleObject:function(e){return void 0===e&&(e=0),r.data[e]}};if(_.isArray(t)){var n=[];_.each(t,function(e){n.push(o._transformEncounter(e))}),r.data=_.sortBy(n,"encounterDatetime").reverse()}else r.data.push(this._transformEncounter(t));this.putObject(e,r)},e.prototype.putObject=function(e,t){this.dataSources[e]=t},e.prototype.getObject=function(e){return this.dataSources[e]||null},e.prototype.getFirstValue=function(e,t){var n=[];if(this.getAllValues(e,t,n),0<n.length)return{value:n[0],valueDate:moment$4(t.encounterDatetime).format("ll")}},e.prototype.getAllValues=function(e,t,n){var o=this;if(!_.isNil(t))if(e.length<=1)_.isNil(t[e[0]])||n.push(t[e[0]]);else{var r=e.splice(1),i=e[0];_.isArray(t[i])&&0<t[i].length?_.each(t[i],function(e){o.getAllValues(r.slice(0),e,n)}):this.getAllValues(r.slice(0),t[i],n)}},e.prototype._transformEncounter=function(e){if(!_.isNil(e)){var t={encounterDatetime:e.encounterDatetime};if(e.location&&e.location.uuid&&(t.location=e.location.uuid),e.patient&&e.patient.uuid&&(t.patient=e.patient.uuid),e.form&&e.form.uuid&&(t.form=e.form.uuid),e.encounterType&&e.encounterType.uuid&&(t.encounterType=e.encounterType.uuid),e.provider){var n=e.provider;t.provider=n.uuid}if(e.obs){var o=this._transformObs(e.obs);_.extend(t,o)}return t}},e.prototype._transformObs=function(e){var t=this;if(!e)return null;var n={};if(_.isArray(e))return _.each(e,function(e){t._augumentObs(n,t._transformObs(e))}),n;if(e.groupMembers){var o={};return _.each(e.groupMembers,function(e){t._augumentObs(o,t._transformObs(e))}),n[e.concept.uuid]&&_.isArray(n[e.concept.uuid])?n[e.concept.uuid].push(o):n[e.concept.uuid]=[o],n}return e.value instanceof Object?n[e.concept.uuid]=e.value.uuid:n[e.concept.uuid]=e.value,n},e.prototype._augumentObs=function(e,t){for(var n in t)if(_.has(e,n)){if(!_.isArray(e[n])){var o=e[n];e[n]=[o]}_.isArray(t[n])?Array.prototype.push.apply(e[n],t[n]):e[n].push(t[n])}else e[n]=t[n];return e},e.decorators=[{type:i0.Injectable}],e.ctorParameters=function(){return[]},e}(),HistoricalHelperService=function(){function e(){}return e.prototype.evaluate=function(e,t,n){var o=new HistoricalEncounterDataService;o.registerEncounters("prevEnc",t.rawPrevEnc);var r={HD:o};if(n)for(var i in n)n[i]&&(r[i]=n[i]);var a=new JsExpressionHelper,s=new AfeFormControl;return(new ExpressionRunner).getRunnable(e,s,a.helperFunctions,r).run()},e.prototype.evaluatePrecondition=function(e,t,n){var o={histValue:n};return this.evaluate(e,t,o)},e.decorators=[{type:i0.Injectable}],e.ctorParameters=function(){return[]},e}(),moment$5=moment_,QuestionFactory=function(){function e(){this.dataSources={},this.historicalHelperService=new HistoricalHelperService}return e.prototype.createQuestionModel=function(e,t){if(t){var n=t.dataSourcesContainer.dataSources;this.dataSources=n}return this.toFormQuestionModel(e)},e.prototype.toSelectQuestion=function(e){var t=new SelectQuestion({options:[],type:"",key:""});t.label=e.label,t.key=e.id,t.options=e.questionOptions.answers.map(function(e){return{label:e.label,value:e.concept}}),t.options.splice(0,0,{label:"",value:""}),t.renderingType=e.questionOptions.rendering,t.validators=this.addValidators(e),t.extras=e;return this.copyProperties({label:"label",required:"required",id:"key"},e,t),this.addDisableOrHideProperty(e,t),this.addAlertProperty(e,t),this.addHistoricalExpressions(e,t),this.addCalculatorProperty(e,t),t},e.prototype.toNumericQuestion=function(e){var t=new TextInputQuestion({placeholder:"",type:"",key:""});t.label=e.label,t.key=e.id,t.renderingType="number",t.placeholder=e.questionOptions.placeholder,t.validators=this.addValidators(e),t.extras=e,t.placeholder=e.questionOptions.placeholder||"";return this.copyProperties({label:"label",required:"required",id:"key"},e,t),this.addDisableOrHideProperty(e,t),this.addAlertProperty(e,t),this.addHistoricalExpressions(e,t),this.addCalculatorProperty(e,t),t},e.prototype.toNumberQuestion=function(e){var t=new TextInputQuestion({placeholder:"",type:"",key:""});t.label=e.label,t.key=e.id,t.renderingType="number",t.placeholder=e.questionOptions.placeholder||"",t.extras=e;return this.copyProperties({label:"label",required:"required",id:"key"},e,t),t.validators=this.addValidators(e),this.addDisableOrHideProperty(e,t),this.addAlertProperty(e,t),this.addHistoricalExpressions(e,t),this.addCalculatorProperty(e,t),t},e.prototype.toDecimalQuestion=function(e){var t=new TextInputQuestion({placeholder:"",type:"",key:""});t.label=e.label,t.key=e.id,t.renderingType="decimal",t.placeholder=e.questionOptions.placeholder||"",t.extras=e;return this.copyProperties({label:"label",required:"required",id:"key"},e,t),t.validators=this.addValidators(e),this.addDisableOrHideProperty(e,t),this.addAlertProperty(e,t),this.addHistoricalExpressions(e,t),this.addCalculatorProperty(e,t),t},e.prototype.toDateQuestion=function(e){if("encounterDatetime"===e.type)return this.toEncounterDatetimeQuestion(e);var t=new DateQuestion({type:"",key:""});t.renderingType="date",t.validators=this.addValidators(e),t.extras=e,t.showTime=e.questionOptions.showTime,t.showHolidays=e.questionOptions.showHolidays,t.showWeeksAdder=!!e.questionOptions.weeksList;return t.dataSource="holidays",this.copyProperties({label:"label",required:"required",id:"key"},e,t),this.addDisableOrHideProperty(e,t),this.addAlertProperty(e,t),this.addHistoricalExpressions(e,t),this.addCalculatorProperty(e,t),t},e.prototype.toTimeQuestion=function(e){var t=new TimeQuestion({type:"",key:""});t.renderingType="time",t.validators=this.addValidators(e),t.extras=e;return this.copyProperties({label:"label",required:"required",id:"key"},e,t),this.addDisableOrHideProperty(e,t),this.addAlertProperty(e,t),this.addHistoricalExpressions(e,t),this.addCalculatorProperty(e,t),t},e.prototype.toEncounterDatetimeQuestion=function(e){var t=new DateQuestion({type:"",key:""});t.label=e.label,t.renderingType="date",t.key=e.id,t.validators=this.addValidators(e),t.extras=e,t.showHolidays=e.questionOptions.showHolidays,t.showWeeksAdder=!!e.questionOptions.weeksList;return t.showTime=!0,t.dataSource="holidays",this.copyProperties({label:"label",required:"required",id:"key"},e,t),this.addDisableOrHideProperty(e,t),this.addAlertProperty(e,t),this.addHistoricalExpressions(e,t),this.addCalculatorProperty(e,t),t},e.prototype.toCheckBoxQuestion=function(e){var t=new CheckBoxQuestion({options:[],type:"",key:""});t.label=e.label,t.key=e.id,t.extras=e,t.options=e.questionOptions.answers.map(function(e){return{label:e.label,value:e.concept}}),t.options.splice(0,0),t.renderingType=e.questionOptions.rendering;return this.copyProperties({label:"label",id:"key"},e,t),this.addDisableOrHideProperty(e,t),this.addAlertProperty(e,t),this.addHistoricalExpressions(e,t),this.addCalculatorProperty(e,t),t},e.prototype.toMultiCheckboxQuestion=function(e){var t=new MultiSelectQuestion({renderType:"",options:[],type:"",key:""});t.label=e.label,t.key=e.id,t.options=e.questionOptions.answers.map(function(e){return{label:e.label,value:e.concept}}),t.validators=this.addValidators(e),t.dataSource=new DummyDataSource,t.extras=e;return this.copyProperties({label:"label",required:"required",id:"key"},e,t),this.addDisableOrHideProperty(e,t),this.addAlertProperty(e,t),this.addHistoricalExpressions(e,t),this.addCalculatorProperty(e,t),t},e.prototype.toTextAreaQuestion=function(e){var t=new TextAreaInputQuestion({isExpanded:!1,rows:18,placeholder:"",type:"",key:""});t.label=e.label,t.key=e.id,t.placeholder=e.questionOptions.placeholder,t.isExpanded=e.isExpanded,t.rows=e.questionOptions.rows,t.validators=this.addValidators(e),t.extras=e,t.placeholder=e.questionOptions.placeholder||"";return this.copyProperties({label:"label",required:"required",id:"key"},e,t),this.addDisableOrHideProperty(e,t),this.addAlertProperty(e,t),this.addHistoricalExpressions(e,t),this.addCalculatorProperty(e,t),t},e.prototype.toTextQuestion=function(e){var t=new TextInputQuestion({placeholder:"",type:"",key:""});t.label=e.label,t.key=e.id,t.renderingType="text",t.placeholder=e.questionOptions.placeholder,t.validators=this.addValidators(e),t.extras=e,t.placeholder=e.questionOptions.placeholder||"";return this.copyProperties({label:"label",required:"required",id:"key"},e,t),this.addDisableOrHideProperty(e,t),this.addAlertProperty(e,t),this.addHistoricalExpressions(e,t),this.addCalculatorProperty(e,t),t},e.prototype.toFileUploadQuestion=function(e){var t=new FileUploadQuestion({type:"",key:""});t.label=e.label,t.key=e.id,t.renderingType="file",t.dataSource="file",t.validators=this.addValidators(e),t.extras=e;return this.copyProperties({label:"label",required:"required",id:"key"},e,t),this.addDisableOrHideProperty(e,t),this.addAlertProperty(e,t),this.addHistoricalExpressions(e,t),this.addCalculatorProperty(e,t),t},e.prototype.toDrugQuestion=function(e){var t=new SelectQuestion({options:[],type:"",key:""});t.label=e.label,t.key=e.id,t.renderingType="remote-select",t.validators=this.addValidators(e),t.extras=e,t.dataSource="drug";return this.copyProperties({label:"label",required:"required",id:"key"},e,t),this.addDisableOrHideProperty(e,t),this.addAlertProperty(e,t),this.addHistoricalExpressions(e,t),this.addCalculatorProperty(e,t),t},e.prototype.toProblemQuestion=function(e){var t=new SelectQuestion({options:[],type:"",key:""});t.label=e.label,t.key=e.id,t.renderingType="remote-select",t.validators=this.addValidators(e),t.extras=e,t.dataSource="problem";return this.copyProperties({label:"label",required:"required",id:"key"},e,t),this.addDisableOrHideProperty(e,t),this.addAlertProperty(e,t),this.addHistoricalExpressions(e,t),this.addCalculatorProperty(e,t),t},e.prototype.toConceptAnswerSelect=function(e){var t=new SelectQuestion({options:[],type:"",key:""});t.label=e.label,t.key=e.id,t.renderingType="remote-select",t.validators=this.addValidators(e),t.extras=e,t.dataSource=e.questionOptions.dataSource||"conceptAnswers",t.dataSourceOptions={concept:e.questionOptions.concept};return this.copyProperties({label:"label",required:"required",id:"key"},e,t),this.addDisableOrHideProperty(e,t),this.addAlertProperty(e,t),this.addHistoricalExpressions(e,t),this.addCalculatorProperty(e,t),t},e.prototype.toRepeatingQuestion=function(e){var t=new RepeatingQuestion({questions:[],type:"",key:""});if(t.label=e.label,t.questions=this.getChildrenQuestionModels(e.questions),t.key=e.id,t.validators=this.addValidators(e),"testOrder"===(t.extras=e).type){var n=this.toTestOrderQuestion(e),o=[];o.push(n),t.questions=o}return this.copyProperties({label:"label",required:"required",id:"key"},e,t),this.addDisableOrHideProperty(e,t),this.addAlertProperty(e,t),this.addHistoricalExpressions(e,t),this.addCalculatorProperty(e,t),t},e.prototype.toGroupQuestion=function(e){var t=new QuestionGroup({questions:[],type:"",key:""});t.label=e.label,t.questions=this.getChildrenQuestionModels(e.questions),t.key=e.id,t.validators=this.addValidators(e),t.extras=e;return this.copyProperties({label:"label",required:"required",id:"key"},e,t),this.addDisableOrHideProperty(e,t),this.addAlertProperty(e,t),this.addHistoricalExpressions(e,t),this.addCalculatorProperty(e,t),t},e.prototype.toPageQuestion=function(e){var t=this,n=new QuestionGroup({questions:[],type:"",key:""});return n.label=e.label,n.key=e.label,n.renderingType="page",n.controlType=exports.AfeControlType.None,n.questions=[],e.sections.forEach(function(e){n.questions.push(t.toSectionQuestion(e))}),n},e.prototype.toFormQuestionModel=function(e){var t=this,n=new QuestionGroup({questions:[],type:"",key:""});return n.label=e.label,n.key=e.label,n.renderingType="form",n.controlType=exports.AfeControlType.AfeFormGroup,n.extras=e,n.questions=[],e.pages.forEach(function(e){n.questions.push(t.toPageQuestion(e))}),n},e.prototype.toSectionQuestion=function(e){var t=new QuestionGroup({questions:[],type:"",key:""});return t.label=e.label,t.key=e.label,t.renderingType="section",t.controlType=exports.AfeControlType.None,t.isExpanded="true"===e.isExpanded,t.questions=this.getSchemaQuestions(e.questions),t},e.prototype.toPersonAttributeQuestion=function(e){var t=new UiSelectQuestion({options:[],type:"",key:"",searchFunction:function(){},resolveFunction:function(){}});t.label=e.label,t.key=e.id,t.renderingType="remote-select",t.validators=this.addValidators(e),t.extras=e,t.dataSource="personAttribute";return this.copyProperties({label:"label",required:"required",id:"key"},e,t),this.addHistoricalExpressions(e,t),this.addDisableOrHideProperty(e,t),this.addAlertProperty(e,t),this.addHistoricalExpressions(e,t),this.addCalculatorProperty(e,t),t},e.prototype.toEncounterProviderQuestion=function(e){var t=new UiSelectQuestion({options:[],type:"",key:"",searchFunction:function(){},resolveFunction:function(){}});t.label=e.label,t.key=e.id,t.renderingType="remote-select",t.validators=this.addValidators(e),t.extras=e,t.dataSource="provider";return this.copyProperties({label:"label",required:"required",id:"key"},e,t),this.addDisableOrHideProperty(e,t),this.addAlertProperty(e,t),this.addHistoricalExpressions(e,t),this.addCalculatorProperty(e,t),t},e.prototype.toFieldSetQuestion=function(e){var t=this.toGroupQuestion(e);return t.renderingType="field-set",t},e.prototype.toEncounterLocationQuestion=function(e){var t=new UiSelectQuestion({options:[],type:"",key:"",searchFunction:function(){},resolveFunction:function(){}});t.label=e.label,t.key=e.id,t.renderingType=e.type,t.renderingType="remote-select",t.validators=this.addValidators(e),t.extras=e,t.dataSource="location";return this.copyProperties({label:"label",required:"required",id:"key"},e,t),this.addDisableOrHideProperty(e,t),this.addAlertProperty(e,t),this.addHistoricalExpressions(e,t),this.addCalculatorProperty(e,t),t},e.prototype.toAmrsLocationsQuestion=function(e){var t=new UiSelectQuestion({options:[],type:"",key:"",searchFunction:function(){},resolveFunction:function(){}});t.label=e.label,t.key=e.id,t.renderingType=e.type,t.renderingType="remote-select",t.validators=this.addValidators(e),t.extras=e,t.dataSource="amrsLocations";return this.copyProperties({label:"label",required:"required",id:"key"},e,t),this.addDisableOrHideProperty(e,t),this.addAlertProperty(e,t),this.addHistoricalExpressions(e,t),this.addCalculatorProperty(e,t),t},e.prototype.toSiblingLocationsQuestion=function(e){var t=new UiSelectQuestion({options:[],type:"",key:"",searchFunction:function(){},resolveFunction:function(){}});t.label=e.label,t.key=e.id,t.renderingType=e.type,t.renderingType="remote-select",t.validators=this.addValidators(e),t.extras=e,t.dataSource="siblingLocations";return this.copyProperties({label:"label",required:"required",id:"key"},e,t),this.addDisableOrHideProperty(e,t),this.addAlertProperty(e,t),this.addHistoricalExpressions(e,t),this.addCalculatorProperty(e,t),t},e.prototype.toNonAmrsLocationsQuestion=function(e){var t=new UiSelectQuestion({options:[],type:"",key:"",searchFunction:function(){},resolveFunction:function(){}});t.label=e.label,t.key=e.id,t.renderingType=e.type,t.renderingType="remote-select",t.validators=this.addValidators(e),t.extras=e,t.dataSource="nonAmrsLocations";return this.copyProperties({label:"label",required:"required",id:"key"},e,t),this.addDisableOrHideProperty(e,t),this.addAlertProperty(e,t),this.addHistoricalExpressions(e,t),this.addCalculatorProperty(e,t),t},e.prototype.toTestOrderQuestion=function(e){var t=new TestOrderQuestion({type:"",key:"",orderType:"",selectableOrders:[],orderSettingUuid:"",label:"",rendering:""});t.label=e.label,t.key=e.id,t.validators=this.addValidators(e),t.extras=e,t.options=e.questionOptions.selectableOrders.map(function(e){return{label:e.label,value:e.concept}});return this.copyProperties({label:"label",required:"required",id:"key"},e,t),t},e.prototype.getSchemaQuestions=function(e){var t=new Array;return this.getQuestions(e,t),t},e.prototype.getQuestions=function(e,t){if(Array.isArray(t)||(t=[]),Array.isArray(e))for(var n in e)e.hasOwnProperty(n)&&this.getQuestions(e[n],t);if(e&&!Array.isArray(e)&&"object"==typeof e)if(e.questionOptions)"group"===e.questionOptions.rendering||"repeating"===e.questionOptions.rendering?t.push(this.toModel(e,e.questionOptions.rendering)):"field-set"===e.questionOptions.rendering||t.push(this.toModel(e,e.questionOptions.rendering));else for(var o in e)e.hasOwnProperty(o)&&this.getQuestions(e[o],t)},e.prototype.getChildrenQuestionModels=function(e){var t=[];return this.getQuestions(e,t),t},e.prototype.toModel=function(e,t){switch("ui-select-extended"===t&&(t=e.type),e.id||(e.id=this.generateId(10)),!e.questionOptions||!0!==e.questionOptions.showDate&&"true"!==e.questionOptions.showDate||(e=this.convertOldVersionComplexObsQuestionToNewVersion(e),t="field-set"),t){case"select":case"single-select":case"multi-select":return this.toSelectQuestion(e);case"numeric":return this.toNumericQuestion(e);case"number":return this.toNumberQuestion(e);case"decimal":return this.toDecimalQuestion(e);case"encounterDatetime":return this.toEncounterDatetimeQuestion(e);case"date":return this.toDateQuestion(e);case"time":return this.toTimeQuestion(e);case"multiCheckbox":return this.toMultiCheckboxQuestion(e);case"drug":return this.toDrugQuestion(e);case"problem":return this.toProblemQuestion(e);case"group":return this.toGroupQuestion(e);case"field-set":return this.toFieldSetQuestion(e);case"repeating":return this.toRepeatingQuestion(e);case"personAttribute":return this.toPersonAttributeQuestion(e);case"text":return this.toTextQuestion(e);case"textarea":return this.toTextAreaQuestion(e);case"select-concept-answers":return this.toConceptAnswerSelect(e);case"encounterLocation":return this.toEncounterLocationQuestion(e);case"amrsLocations":return this.toAmrsLocationsQuestion(e);case"nonAmrsLocations":return this.toNonAmrsLocationsQuestion(e);case"siblingLocations":return this.toSiblingLocationsQuestion(e);case"encounterDatetime":return this.toEncounterDatetimeQuestion(e);case"encounterProvider":return this.toEncounterProviderQuestion(e);case"radio":case"checkbox":return this.toCheckBoxQuestion(e);case"encounterProvider":return this.toEncounterProviderQuestion(e);case"file":return this.toFileUploadQuestion(e);default:return console.warn("New Schema Question Type found........."+t),this.toTextQuestion(e)}},e.prototype.convertOldVersionComplexObsQuestionToNewVersion=function(e){var t={type:"complex-obs"};t.label=e.label,t.id="complex_"+e.id,t.questionOptions={},t.questionOptions.concept=e.questionOptions.concept,t.questionOptions.rendering="field-set",t.questions=[],t.validators=[];var n=JSON.parse(JSON.stringify(e));n.type="complex-obs-child",delete n.questionOptions.showDate,delete n.questionOptions.shownDateOptions,n.questionOptions.obsField="value";var o={type:"complex-obs-child"};o.label="Date of "+n.label,o.id="date_"+n.id,o.questionOptions={},o.questionOptions.concept=e.questionOptions.concept,o.questionOptions.rendering="date",o.questionOptions.obsField="obsDatetime";var r=Object.assign({},e.questionOptions.shownDateOptions);return o.validators=r.validators,o.hide=r.hide,t.questions.push(n),t.questions.push(o),t},e.prototype.copyProperties=function(e,t,n){for(var o in t)e.hasOwnProperty(o)&&n.hasOwnProperty(e[o])&&(n[e[o]]=t[o])},e.prototype.addValidators=function(e){var n=[];e.validators&&_.forEach(e.validators,function(e){switch(e.type){case"date":n.push(new DateValidationModel(e));break;case"js_expression":n.push(new JsExpressionValidationModel(e));break;case"decimal":var t=new DecimalPointValidationModel(e);t.setValuesAndExpressions(),n.push(t);break;case"conditionalAnswered":n.push(new ConditionalValidationModel(e));break;default:n.push(new ValidationModel(e))}});var t=e.questionOptions,o=t?t.rendering:"";if("number"!==o&&"decimal"!==o||t.max&&t.min&&(n.push(new MaxValidationModel({type:"max",max:t.max})),n.push(new MinValidationModel({type:"min",min:t.min}))),"object"==typeof e.required){var r=e.required;"conditionalRequired"===r.type&&n.push(new ConditionalValidationModel({referenceQuestionId:r.referenceQuestionId,referenceQuestionAnswers:r.referenceQuestionAnswers,type:r.type,message:r.message}))}return n},e.prototype.addHistoricalExpressions=function(e,t){if(e.historicalExpression&&0<e.historicalExpression.length){t.setHistoricalValue(!0),e.showHistoricalEncounterDate!==undefined?t.showHistoricalEncounterDate("true"===e.showHistoricalEncounterDate):t.showHistoricalEncounterDate();var n=this.historicalHelperService.evaluate(e.historicalExpression,this.dataSources,undefined);if(t.historicalDataValue=n,e.historicalPrepopulateCondition&&n)return void(this.historicalHelperService.evaluatePrecondition(e.historicalPrepopulateCondition,this.dataSources,n)&&(t.defaultValue=n.value));if(e.historicalPrepopulate&&n){var o=moment$5(n.valueDate),r=moment$5().diff(o,"days");Number.isInteger(e.allowedHistoricalValueAgeInDays)?r<=e.allowedHistoricalValueAgeInDays&&(t.defaultValue=n.value):t.defaultValue=n.value}}},e.prototype.addCalculatorProperty=function(e,t){e.questionOptions&&"object"==typeof e.questionOptions.calculate&&(t.calculateExpression=e.questionOptions.calculate.calculateExpression)},e.prototype.addAlertProperty=function(e,t){e.alert&&(t.alert=e.alert)},e.prototype.addDisableOrHideProperty=function(e,t){e.disable&&(t.disable=e.disable),"object"==typeof e.disable&&(t.disable=e.disable.disableWhenExpression),e.hide&&(t.hide=e.hide),"object"==typeof e.hide&&e.hide.hideWhenExpression&&(t.hide=e.hide.hideWhenExpression)},e.prototype.generateId=function(e){for(var t="_";t.length<e&&0<e;){var n=Math.random();t+=n<.1?Math.floor(100*n):String.fromCharCode(Math.floor(26*n)+(.5<n?97:65))}return"_"+t},e}(),Form=function(){function e(e,t,n){this.schema=e,this.formFactory=t,this.questionFactory=n,this.valueProcessingInfo={},this.existingOrders={},this._showErrors=!1,this._dataSourcesContainer=new DataSources}return Object.defineProperty(e.prototype,"dataSourcesContainer",{get:function(){return this._dataSourcesContainer},enumerable:!0,configurable:!0}),e.prototype.searchNodeByPath=function(e,t,n){var o=this,r=e.children;for(var i in r)if(r.hasOwnProperty(i)){var a=r[i];if(a instanceof GroupNode){if(t===a.path)return n.push(a),n;this.searchNodeByPath(a,t,n)}else if(a instanceof LeafNode){if(t===a.path)return n.push(a),n}else if(a instanceof ArrayNode){if(t===a.path)return n.push(a),n;a.children.forEach(function(e){o.searchNodeByPath(e,t,n)})}}return n},e.prototype.searchNodeByQuestionId=function(e,t){var n=[];return t?this.searchNodeByQuestionType(this.rootNode,t,n):this.findNodesByQuestionId(this.rootNode,e,n),n},e.prototype.searchNodeByQuestionType=function(e,t,n){var o=this;if(e instanceof GroupNode){var r=e;for(var i in r.children)this.searchNodeByQuestionType(r.children[i],t,n)}e instanceof ArrayNode&&e.children.forEach(function(e){o.searchNodeByQuestionType(e,t,n)});if(e instanceof LeafNode){var a=e.question;a.extras&&a.extras.type&&a.extras.type===t&&n.push(e)}},e.prototype.findNodesByQuestionId=function(e,t,n){var o=this;if(e.question.key===t&&n.push(e),e instanceof GroupNode){var r=e;for(var i in r.children)this.findNodesByQuestionId(r.children[i],t,n)}e instanceof ArrayNode&&e.children.forEach(function(e){o.findNodesByQuestionId(e,t,n)})},Object.defineProperty(e.prototype,"valid",{get:function(){return this.rootNode.control.valid},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"showErrors",{get:function(){return this._showErrors},set:function(e){this._showErrors=e},enumerable:!0,configurable:!0}),e.prototype.markInvalidControls=function(e,t){var n=this,o=e.children;for(var r in o)if(o.hasOwnProperty(r)){var i=o[r];if(i instanceof GroupNode)this.markInvalidControls(i,t);else if(i instanceof LeafNode){var a=i.question;if(a.key&&0<a.key.length){var s=i.control;s.valid||s.disabled||(t&&t.push(i),s.markAsTouched())}}else if(i instanceof ArrayNode){var l=i;l&&l.children&&0<l.children.length&&_.forEach(l.children,function(e){n.markInvalidControls(e,t)})}}return t},e.prototype.updateHiddenDisabledStateForAllControls=function(){this._updateHiddenDisabledStateForAllControls(this.rootNode)},e.prototype.updateAlertsForAllControls=function(){this._updateAlertsForAllControls(this.rootNode)},e.prototype._updateAlertsForAllControls=function(e){var t=this;if(e.control&&e.control.updateAlert&&e.control.updateAlert(),e instanceof GroupNode){var n=e;for(var o in n.children)this._updateAlertsForAllControls(n.children[o])}e instanceof ArrayNode&&e.children.forEach(function(e){t._updateAlertsForAllControls(e)})},e.prototype._updateHiddenDisabledStateForAllControls=function(e){var t=this;if(e.control&&(e.control.updateDisabledState&&e.control.updateDisabledState(),e.control.updateHiddenState&&e.control.updateHiddenState()),e instanceof GroupNode){var n=e;for(var o in n.children)this._updateHiddenDisabledStateForAllControls(n.children[o])}e instanceof ArrayNode&&e.children.forEach(function(e){t._updateHiddenDisabledStateForAllControls(e)})},e}(),FormFactory=function(){function e(e,t,n){this.controlService=e,this.questionFactroy=t,this.controlRelationsFactory=n,this.hd={getValue:function(){return 20}}}return e.prototype.createForm=function(e,t){var n=new Form(e,this,this.questionFactroy);if(t)for(var o in t)t.hasOwnProperty(o)&&n.dataSourcesContainer.registerDataSource(o,t[o],!1);var r=this.questionFactroy.createQuestionModel(e,n);return n.rootNode=this.createNode(r,null,null,n),this.buildRelations(n.rootNode),n.updateHiddenDisabledStateForAllControls(),n.updateAlertsForAllControls(),n},e.prototype.buildRelations=function(e){Validations.JSExpressionValidatorsEnabled=!1,this.controlRelationsFactory.buildRelations(e),Validations.JSExpressionValidatorsEnabled=!0},e.prototype.createNode=function(e,t,n,o){return e instanceof NestedQuestion?e instanceof RepeatingQuestion?this.createArrayNode(e,t,n,o):this.createGroupNode(e,t,n,o):this.createLeafNode(e,t,n,o)},e.prototype.createLeafNode=function(e,t,n,o){var r=this.controlService.generateControlModel(e,n,!1,o);return new LeafNode(e,r,null,o,t?t.path:undefined)},e.prototype.createGroupNode=function(e,t,n,o){var r=this.controlService.generateControlModel(e,n,!1,o),i=new GroupNode(e,r,null,o,t?t.path:undefined);return this.createNodeChildren(e,i,r||n,o),i},e.prototype.createArrayNode=function(e,t,n,o){var r=this,i=this.controlService.generateControlModel(e,n,!1,o),a=new ArrayNode(e,i,n,this,o,t?t.path:undefined);return a.createChildFunc=this.createArrayNodeChild,a.removeChildFunc=this.removeArrayNodeChild,a.addChildNodeCreatedListener(function(e){Validations.JSExpressionValidatorsEnabled=!1,r.controlRelationsFactory.buildArrayNodeRelations(e),Validations.JSExpressionValidatorsEnabled=!0}),a},e.prototype.createNodeChildren=function(e,n,o,r){var i=this;return e.questions.forEach(function(e){var t=i.createNode(e,n,o,r);n.setChild(e.key,t)}),n.children},e.prototype.createArrayNodeChild=function(e,t,n){null!==n&&n!==undefined||(n=this);var o=new QuestionGroup({key:t.path+"."+t.children.length,type:"group",extras:e.extras,label:"",questions:e.questions});e.controlType===exports.AfeControlType.None&&(o.controlType=e.controlType);var r=n.createGroupNode(o,null,null,t.form);if(t.children.push(r),t.control instanceof AfeFormArray){var i=t.control;i.setControl(i.controls.length,r.control)}return r},e.prototype.removeArrayNodeChild=function(e,t){var n=t.children[e];if(t.children.splice(e,1),(null!==t.control||t.control!==undefined)&&t.control instanceof AfeFormArray){var o=t.control,r=o.controls.indexOf(n.control);0<=r&&o.removeAt(r)}},e.decorators=[{type:i0.Injectable}],e.ctorParameters=function(){return[{type:FormControlService},{type:QuestionFactory},{type:ControlRelationsFactory}]},e}(),moment$6=moment_,ObsAdapterHelper=function(){function e(){}return e.prototype.findObsAnswerToQuestion=function(t,e){var n=this,o=[];if(!this.isObsNode(t))return o;if(t instanceof LeafNode||t instanceof GroupNode&&"complex-obs"===t.question.extras.type)return _.each(e,function(e){e.concept&&e.concept.uuid===t.question.extras.questionOptions.concept&&o.push(e)}),o;var r=this.getChildQuestionsConceptUuids(t);return 0<r.length&&_.each(e,function(e){e.concept&&e.concept.uuid===t.question.extras.questionOptions.concept&&Array.isArray(e.groupMembers)&&n.isSubsetOf(r,n.getGroupMembersConceptUuids(e))&&o.push(e)}),o},e.prototype.getChildQuestionsConceptUuids=function(e){var t=[];return e.question.extras&&e.question.extras.questions&&_.each(e.question.extras.questions,function(e){e.questionOptions&&e.questionOptions.concept&&t.push(e.questionOptions.concept)}),t},e.prototype.getGroupMembersConceptUuids=function(e){var t=[];return Array.isArray(e.groupMembers)&&_.each(e.groupMembers,function(e){t.push(e.concept.uuid)}),t},e.prototype.isObsNode=function(e){return e.question.extras&&("obs"===e.question.extras.type||"obsGroup"===e.question.extras.type||"complex-obs"===e.question.extras.type||"complex-obs-child"===e.question.extras.type)},e.prototype.isSubsetOf=function(t,e){return 0===e.length&&0===t.length||e.every(function(e){return 0<=t.indexOf(e)})},e.prototype.setSimpleObsNodeValue=function(e,t){if(e&&0<t.length){var n=t[0];e.initialValue=n,!this.isEmpty(n.value)&&n.value.uuid?this.setNodeFormControlValue(e,n.value.uuid):this.isEmpty(n.value)||this.setNodeFormControlValue(e,n.value)}},e.prototype.setMultiselectObsNodeValue=function(e,t){if(e&&0<t.length){e.initialValue=t;var n=[];try{for(var o=__values(t),r=o.next();!r.done;r=o.next()){var i=r.value;n.push(i.value.uuid)}}catch(l){a={error:l}}finally{try{r&&!r.done&&(s=o["return"])&&s.call(o)}finally{if(a)throw a.error}}this.setNodeFormControlValue(e,n)}var a,s},e.prototype.setComplexObsNodeValue=function(e,t){if(e&&0<t.length){var n=void 0,o=void 0,r=e;for(var i in r.children)"value"===r.children[i].question.extras.questionOptions.obsField&&(n=r.children[i]),"obsDatetime"===r.children[i].question.extras.questionOptions.obsField&&(o=r.children[i]);this.setNodeValue(n,t),e.initialValue=n.initialValue,o.initialValue=n.initialValue,this.setNodeFormControlValue(o,n.initialValue.obsDatetime)}},e.prototype.setGroupObsNodeValue=function(e,t){if(e&&0<t.length){var n=e;for(var o in n.initialValue=t[0],n.children)this.setNodeValue(n.children[o],t[0].groupMembers)}},e.prototype.setRepeatingGroupObsNodeValue=function(e,t){if(e&&0<t.length){var n=e;n.initialValue=t;for(var o=0;o<t.length;o++){var r=n.createChildNode();this.setGroupObsNodeValue(r,[t[o]])}}},e.prototype.setNodeValue=function(e,t){switch(this.getObsNodeType(e)){case"unknown":if(e instanceof GroupNode){var n=e;for(var o in n.children)this.setNodeValue(n.children[o],t);break}if(e instanceof ArrayNode){for(var r=e,i=0;i<r.children.length;i++)this.setNodeValue(r.children[i],t);break}break;case"simple":var a=this.findObsAnswerToQuestion(e,t);this.setSimpleObsNodeValue(e,a);break;case"multiselect":var s=this.findObsAnswerToQuestion(e,t);this.setMultiselectObsNodeValue(e,s);break;case"complex":var l=this.findObsAnswerToQuestion(e,t);this.setComplexObsNodeValue(e,l);break;case"group":var u=this.findObsAnswerToQuestion(e,t);0<u.length&&this.setGroupObsNodeValue(e,u);break;case"repeatingGroup":var c=this.findObsAnswerToQuestion(e,t);0<c.length&&this.setRepeatingGroupObsNodeValue(e,c);break;default:console.error("Unknown obs node",e)}},e.prototype.setNodeFormControlValue=function(e,t){e.control.setValue(t),e.question.enableHistoricalValue&&e.initialValue!==undefined&&e.question.setHistoricalValue(!1)},e.prototype.getObsNodeType=function(e){return this.isObsNode(e)?e instanceof LeafNode&&("multiCheckbox"===e.question.extras.questionOptions.rendering||"checkbox"===e.question.extras.questionOptions.rendering||"multi-select"===e.question.extras.questionOptions.rendering)?"multiselect":e instanceof LeafNode?"simple":e instanceof GroupNode&&"complex-obs"===e.question.extras.type?"complex":e instanceof ArrayNode&&"obsGroup"===e.question.extras.type&&"repeating"===e.question.extras.questionOptions.rendering?"repeatingGroup":e instanceof GroupNode&&"obsGroup"===e.question.extras.type?"group":"unknownObs":"unknown"},e.prototype.getSimpleObsPayload=function(e){if(this.isEmpty(e.control.value))return e.initialValue?{uuid:e.initialValue.uuid,voided:!0}:null;if(e.initialValue&&!this.simpleNodeValueChanged(e))return null;var t={concept:e.question.extras.questionOptions.concept,value:e.control.value};return"date"===e.question.extras.questionOptions.rendering&&(t.value=this.toOpenMrsDateTimeString(e.control.value)),e.initialValue&&(delete t.concept,t.uuid=e.initialValue.uuid),t},e.prototype.getComplexObsPayload=function(e){var t,n,o=e;for(var r in o.children)"value"===o.children[r].question.extras.questionOptions.obsField&&(t=o.children[r]),"obsDatetime"===o.children[r].question.extras.questionOptions.obsField&&(n=o.children[r]);var i=this.getObsNodePayload(t);if(console.log("valuePayload",i),0<i.length)return i[0].obsDatetime=this.toOpenMrsDateTimeString(n.control.value),i[0];if(0!==i.length||!e.initialValue||this.areDatesEqual(e.initialValue.obsDatetime,n.control.value))return null;var a={uuid:e.initialValue.uuid};return a.obsDatetime=this.toOpenMrsDateTimeString(n.control.value),a},e.prototype.getMultiselectObsPayload=function(t){var n=[],o=[];return Array.isArray(t.initialValue)&&_.each(t.initialValue,function(e){o.push(e.value.uuid),Array.isArray(t.control.value)?t.control.value.indexOf(e.value.uuid)<0&&n.push({uuid:e.uuid,voided:!0}):n.push({uuid:e.uuid,voided:!0})}),Array.isArray(t.control.value)&&_.each(t.control.value,function(e){o.indexOf(e)<0&&n.push({concept:t.question.extras.questionOptions.concept,value:e})}),n},e.prototype.getGroupPayload=function(e){var n=this,t=e,o=[];if(_.each(t.children,function(e){var t=n.getObsNodePayload(e);0<t.length&&(o=o.concat(t))}),0===o.length)return null;var r={groupMembers:o};return t.initialValue?r.uuid=t.initialValue.uuid:r.concept=t.question.extras.questionOptions.concept,r},e.prototype.getRepeatingGroupPayload=function(e){var n=this,t=e,o=[],r=[];return _.each(t.children,function(e){var t=n.getObsNodePayload(e);0<t.length&&(o=o.concat(t)),e.initialValue&&e.initialValue.uuid&&r.push(e.initialValue.uuid)}),t.initialValue&&Array.isArray(t.initialValue)&&_.each(t.initialValue,function(e){if(r.indexOf(e.uuid)<0){var t={uuid:e.uuid,voided:!0};o.push(t)}}),o.length<=0?null:o},e.prototype.getObsNodePayload=function(e){var t=[];switch(this.getObsNodeType(e)){case"unknown":if(e instanceof GroupNode){var n=e;for(var o in n.children){var r=this.getObsNodePayload(n.children[o]);Array.isArray(r)&&0<r.length&&(t=t.concat(r))}break}if(e instanceof ArrayNode){for(var i=e,a=0;a<i.children.length;a++){var s=this.getObsNodePayload(i.children[a]);Array.isArray(s)&&0<s.length&&(t=t.concat(s))}break}break;case"simple":var l=this.getSimpleObsPayload(e);null!==l&&t.push(l);break;case"multiselect":var u=this.getMultiselectObsPayload(e);Array.isArray(u)&&0<u.length&&(t=t.concat(u));break;case"complex":var c=this.getComplexObsPayload(e);null!==c&&t.push(c);break;case"group":var p=this.getGroupPayload(e);p&&null!==p&&t.push(p);break;case"repeatingGroup":var d=this.getRepeatingGroupPayload(e);Array.isArray(d)&&0<d.length&&(t=t.concat(d))}return t},e.prototype.simpleNodeValueChanged=function(e){return!!e.initialValue&&(e.initialValue.value&&e.initialValue.value.uuid?e.control.value!==e.initialValue.value.uuid:"date"===e.question.extras.questionOptions.rendering?!this.areDatesEqual(e.control.value,e.initialValue.value):e.control.value!==e.initialValue.value)},e.prototype.areDatesEqual=function(e,t){return moment$6(e).isSame(t)},e.prototype.isEmpty=function(e){return""===e||null===e||e===undefined},e.prototype.toOpenMrsDateTimeString=function(e){if(this.isEmpty(e))return undefined;var t=moment$6(e).format().substring(0,19).replace("T"," ");return this.isEmpty(t)?undefined:t},e}(),ObsValueAdapter=function(){function e(e){this.helper=e}return e.prototype.generateFormPayload=function(e){return this.helper.getObsNodePayload(e.rootNode)},e.prototype.populateForm=function(e,t){this.helper.setNodeValue(e.rootNode,t)},e.prototype.setValues=function(e,n,o){if(e){var t=function(t){if(t instanceof LeafNode)r.setObsValue(t,n),t.question.enableHistoricalValue&&t.initialValue!==undefined&&t.question.setHistoricalValue(!1);else if(t.question&&t.question.extras&&"group"===t.question.renderingType||o){var e=_.find(n,function(e){return e.concept.uuid===t.question.extras.questionOptions.concept&&e.groupMembers});e&&(t.node&&(t.node.initialValue=e),r.setValues(t.groupMembers,e.groupMembers)),o&&t.payload&&r.setValues(t.groupMembers,t.payload.groupMembers)}else if(t instanceof GroupNode&&"complex-obs"===t.question.extras.type)r.setComplexObsValue(t,n);else{if(!t.question||!t.question.extras||"repeating"!==t.question.renderingType||o)throw new Error("not implemented");r.setRepeatingGroupValues(t,n),t.node.control.updateValueAndValidity()}},r=this;try{for(var i=__values(e),a=i.next();!a.done;a=i.next()){t(a.value)}}catch(u){s={error:u}}finally{try{a&&!a.done&&(l=i["return"])&&l.call(i)}finally{if(s)throw s.error}}}var s,l},e.prototype.setObsValue=function(t,e){if(t.question&&t.question.extras&&("obs"===t.question.extras.type||"complex-obs-child"===t.question.extras.type&&"value"===t.question.extras.questionOptions.obsField)&&"multiCheckbox"!==t.question.extras.questionOptions.rendering||"checkbox"!==t.question.extras.questionOptions.rendering||"multi-select"!==t.question.extras.questionOptions.rendering){var n=_.find(e,function(e){return e.concept.uuid===t.question.extras.questionOptions.concept});n&&(n.value instanceof Object?t.control.setValue(n.value.uuid):t.control.setValue(n.value),t.control.updateValueAndValidity(),t.initialValue={obsUuid:n.uuid,value:n.value})}else{var o=_.filter(e,function(e){return e.concept.uuid===t.question.extras.questionOptions.concept});o&&0<o.length&&(t.control.setValue(this.getMultiselectValues(o)),t.control.updateValueAndValidity(),t.initialValue=o)}},e.prototype.setComplexObsValue=function(t,e){var n,o;for(var r in t.children)"value"===t.children[r].question.extras.questionOptions.obsField&&(n=t.children[r]),"obsDatetime"===t.children[r].question.extras.questionOptions.obsField&&(o=t.children[r]);this.setObsValue(n,e);var i=_.find(e,function(e){return e.concept.uuid===t.question.extras.questionOptions.concept});i&&(o.initialValue={obsUuid:i.uuid,value:i.obsDatetime},o.control.setValue(i.obsDatetime),o.control.updateValueAndValidity())},e.prototype.getMultiselectValues=function(e){var t,n,o=[];try{for(var r=__values(e),i=r.next();!i.done;i=r.next()){var a=i.value;o.push(a.value.uuid)}}catch(s){t={error:s}}finally{try{i&&!i.done&&(n=r["return"])&&n.call(r)}finally{if(t)throw t.error}}return o},e.prototype.setRepeatingGroupValues=function(i,e){var o=_.filter(e,function(e){var t=e.concept.uuid===i.question.extras.questionOptions.concept,n=!1;if(t&&e.groupMembers){var o=e.groupMembers.map(function(e){return e.concept.uuid}),r=i.question.questions.map(function(e){return e.extras.questionOptions.concept});n=0<_.intersection(o,r).length}return t&&n});if(0<o.length){i.node.initialValue=o;for(var t=0;t<o.length;t++)i.node.createChildNode()}var n,r,a=[],s=0,l=function(t){var e=Object.keys(t.children).map(function(e){return t.children[e]}),n=o[s];a.push({question:i.question,groupMembers:e,payload:n}),s++};try{for(var u=__values(i.node.children),c=u.next();!c.done;c=u.next()){l(c.value)}}catch(p){n={error:p}}finally{try{c&&!c.done&&(r=u["return"])&&r.call(u)}finally{if(n)throw n.error}}this.setValues(a,o,!0)},e.prototype.getQuestionNodes=function(e){var t,n,o,r,i=[];try{for(var a=__values(e),s=a.next();!s.done;s=a.next()){var l=s.value;try{for(var u=__values(l.page),c=u.next();!c.done;c=u.next()){var p=c.value;i.push(p.section)}}catch(d){o={error:d}}finally{try{c&&!c.done&&(r=u["return"])&&r.call(u)}finally{if(o)throw o.error}}}}catch(h){t={error:h}}finally{try{s&&!s.done&&(n=a["return"])&&n.call(a)}finally{if(t)throw t.error}}return[].concat.apply([],i)},e.prototype.repeatingGroup=function(e){var t,n,o=[];try{for(var r=__values(e),i=r.next();!i.done;i=r.next()){var a=i.value;o.push({question:a.question,groupMembers:this.traverse(a)})}}catch(s){t={error:s}}finally{try{i&&!i.done&&(n=r["return"])&&n.call(r)}finally{if(t)throw t.error}}return o},e.prototype.processGroup=function(e,t){if(e.question&&e.question.extras&&"group"===e.question.extras.questionOptions.rendering){var n=_.filter(this.getObsPayload(e.groupMembers),function(e){return""!==e.value}),o=n.map(function(e){return e.voided});0<n.length&&o.every(Boolean)?t.push({uuid:e.node.initialValue.uuid,voided:!0}):0<n.length&&(e.node.initialValue?t.push({uuid:e.node.initialValue.uuid,groupMembers:n}):t.push({concept:e.question.extras.questionOptions.concept,groupMembers:n}))}},e.prototype.mapInitialGroup=function(e){var t,n,o={};try{for(var r=__values(e.groupMembers),i=r.next();!i.done;i=r.next()){var a=i.value,s="";a.value instanceof Object?s=a.value.uuid:a.value?s=a.value:a.groupMembers&&0<a.groupMembers.length&&(o=this.mapInitialGroup(e)),o[a.concept.uuid+":"+s]=s}}catch(l){t={error:l}}finally{try{i&&!i.done&&(n=r["return"])&&n.call(r)}finally{if(t)throw t.error}}return o},e.prototype.mapModelGroup=function(e,t){var n={};for(var o in t)if(t.hasOwnProperty(o)){var r=_.find(e.question.questions,{key:o}),i=t[o];i instanceof Object||""!==i&&(n[r.extras.questionOptions.concept+":"+i]=i)}return n},e.prototype.processRepeatingGroups=function(e,t){var n=[];if(e.node.initialValue)try{for(var o=__values(e.node.initialValue),r=o.next();!r.done;r=o.next()){var i=r.value;n.push({uuid:i.uuid,value:this.mapInitialGroup(i)})}}catch(D){c={error:D}}finally{try{r&&!r.done&&(p=o["return"])&&p.call(o)}finally{if(c)throw c.error}}var a=[];try{for(var s=__values(e.node.control.value),l=s.next();!l.done;l=s.next()){var u=l.value;a.push({value:this.mapModelGroup(e,u)})}}catch(E){d={error:E}}finally{try{l&&!l.done&&(h=s["return"])&&h.call(s)}finally{if(d)throw d.error}}var c,p,d,h,f,y,m,g,v=this.leftOuterJoinArrays(n,a),b=this.leftOuterJoinArrays(a,n),x=e.question.extras.questionOptions.concept,w=[];if(0<v.length){var C=this.createGroupDeletedObs(v);try{for(var k=__values(C),S=k.next();!S.done;S=k.next()){var O=S.value;t.push(O)}}catch(T){f={error:T}}finally{try{S&&!S.done&&(y=k["return"])&&y.call(k)}finally{if(f)throw f.error}}0<b.length&&(w=this.createGroupNewObs(b,x))}else w=this.createGroupNewObs(b,x);if(0<w.length)try{for(var q=__values(w),A=q.next();!A.done;A=q.next()){var _=A.value;t.push(_)}}catch(V){m={error:V}}finally{try{A&&!A.done&&(g=q["return"])&&g.call(q)}finally{if(m)throw m.error}}},e.prototype.leftOuterJoinArrays=function(e,n){return e.filter(function(t){return!n.some(function(e){return _.isEqual(t.value,e.value)})})},e.prototype.createGroupNewObs=function(e,t){var n,o,r=[];try{for(var i=__values(e),a=i.next();!a.done;a=i.next()){var s=a.value,l=[];for(var u in s.value){var c=u.split(":")[0],p=u.split(":")[1];l.push({concept:c,value:p})}r.push({concept:t,groupMembers:l})}}catch(d){n={error:d}}finally{try{a&&!a.done&&(o=i["return"])&&o.call(i)}finally{if(n)throw n.error}}return r},e.prototype.createGroupDeletedObs=function(e){var t,n,o=[];try{for(var r=__values(e),i=r.next();!i.done;i=r.next()){var a=i.value;o.push({uuid:a.uuid,voided:!0})}}catch(s){t={error:s}}finally{try{i&&!i.done&&(n=r["return"])&&n.call(r)}finally{if(t)throw t.error}}return o},e.prototype.getExactTime=function(e){return e.substring(0,19).replace("T"," ")},e.prototype.processObs=function(e,t){if(e.control&&e.question.extras){var n={concept:e.question.extras.questionOptions.concept,value:"date"!==e.question.extras.questionOptions.rendering||this.isEmpty(e.control.value)?e.control.value:this.getExactTime(e.control.value)};if("multiCheckbox"===e.question.extras.questionOptions.rendering||"checkbox"===e.question.extras.questionOptions.rendering||"multi-select"===e.question.extras.questionOptions.rendering){var o=this.processMultiSelect(e.question.extras.questionOptions.concept,e.control.value);if(e.initialValue){var r=e.initialValue.map(function(e){return{uuid:e.uuid,value:{concept:e.concept.uuid,value:e.value.uuid}}}),i=o.map(function(e){return{value:e}}),a=this.leftOuterJoinArrays(r,i),s=this.leftOuterJoinArrays(i,r);this.processDeletedMultiSelectObs(a,t),this.processNewMultiSelectObs(s,t)}else this.processNewMultiSelectObs(o,t)}else e.initialValue&&e.initialValue.value&&n?this.updateOrVoidObs(n,e.initialValue,t):""!==n.value&&null!==n.value&&t.push(n)}},e.prototype.processComplexObs=function(e,t){var n,o;for(var r in e.children)"value"===e.children[r].question.extras.questionOptions.obsField&&(n=e.children[r]),"obsDatetime"===e.children[r].question.extras.questionOptions.obsField&&(o=e.children[r]);if(n){this.processObs(n,t);var i=0<t.length?t[t.length-1]:undefined;i&&(i.concept&&i.concept===e.question.extras.questionOptions.concept||n.initialValue&&i.uuid===n.initialValue.obsUuid)&&o.initialValue&&o.control.value!==o.initialValue.value&&(i.obsDatetime=o.control.value)}},e.prototype.processDeletedMultiSelectObs=function(e,t){try{for(var n=__values(e),o=n.next();!o.done;o=n.next()){var r=o.value;t.push({uuid:r.uuid,voided:!0})}}catch(s){i={error:s}}finally{try{o&&!o.done&&(a=n["return"])&&a.call(n)}finally{if(i)throw i.error}}var i,a},e.prototype.processNewMultiSelectObs=function(e,t){try{for(var n=__values(e),o=n.next();!o.done;o=n.next()){var r=o.value;r.value instanceof Object?t.push(r.value):t.push(r)}}catch(s){i={error:s}}finally{try{o&&!o.done&&(a=n["return"])&&a.call(n)}finally{if(i)throw i.error}}var i,a},e.prototype.updateOrVoidObs=function(e,t,n){this.isEmpty(e.value)&&t.value?n.push({uuid:t.obsUuid,voided:!0}):!this.isEmpty(e.value)&&t.value&&n.push({uuid:t.obsUuid,value:e.value})},e.prototype.isEmpty=function(e){return""===e||null===e||e===undefined},e.prototype.traverse=function(e,t){var n=[];if(e.children){if(e.children instanceof Array)return this.repeatingGroup(e.children);if(e.children instanceof Object)for(var o in e.children)if(e.children.hasOwnProperty(o))switch(e.children[o].question.renderingType){case"page":var r=this.traverse(e.children[o]);n.push({page:r,label:e.children[o].question.label});break;case"section":var i=this.traverse(e.children[o]);n.push({section:i,node:e.children[o],label:e.children[o].question.label});break;case"group":var a=this.traverse(e.children[o]);n.push({node:e.children[o],question:e.children[o].question,groupMembers:a});break;case"repeating":var s=this.repeatingGroup(e.children[o].children);n.push({node:e.children[o],question:e.children[o].question,groupMembers:s});break;default:n.push(e.children[o])}}return n},e.prototype.processMultiSelect=function(e,t){var n,o,r=[];if(t&&null!==t)try{for(var i=__values(t),a=i.next();!a.done;a=i.next()){var s={concept:e,value:a.value};r.push(s)}}catch(l){n={error:l}}finally{try{a&&!a.done&&(o=i["return"])&&o.call(i)}finally{if(n)throw n.error}}return r},e.prototype.isObs=function(e){return"obs"===e.question.extras.type||"obsGroup"===e.question.extras.type||"complex-obs"===e.question.extras.type},e.prototype.getObsPayload=function(e){var t,n,o=[];try{for(var r=__values(e),i=r.next();!i.done;i=r.next()){var a=i.value;this.isObs(a)&&(a.groupMembers,"group"===a.question.extras.questionOptions.rendering?this.processGroup(a,o):(a.groupMembers,"repeating"===a.question.extras.questionOptions.rendering?this.processRepeatingGroups(a,o):a instanceof GroupNode&&"complex-obs"===a.question.extras.type?this.processComplexObs(a,o):this.processObs(a,o)))}}catch(s){t={error:s}}finally{try{i&&!i.done&&(n=r["return"])&&n.call(r)}finally{if(t)throw t.error}}return o},e.decorators=[{type:i0.Injectable}],e.ctorParameters=function(){return[{type:ObsAdapterHelper}]},e}(),OrderValueAdapter=function(){function e(){this.formOrderNodes=[],this.provider=""}return e.prototype.generateFormPayload=function(e){return this.formOrderNodes=[],this._setOrderProvider(e),this._findTestOrderQuestionNodes(e.rootNode),this._createOrdersPayload(this.formOrderNodes,e)},e.prototype.populateForm=function(e,t){e.existingOrders=t,this.formOrderNodes=[],this._findTestOrderQuestionNodes(e.rootNode);var n=this._getExistingOrders(e);this._setOrderValues(this.formOrderNodes,n)},e.prototype._setOrderProvider=function(e){e.valueProcessingInfo.providerUuid&&(this.provider=e.valueProcessingInfo.providerUuid)},e.prototype._createOrdersPayload=function(e,t){var n,o,r,a=[],s=[],l=this._getExistingOrders(t),i=function(e){var t=e.control.value,n=[];for(var o in l&&l.map(function(e){n[e.concept]=e.concept}),t)if(t.hasOwnProperty(o)){var r=t[o][e.question.key],i=u._createPayloadOrder(r,e.question.extras);n[r]!==r&&""!==i.concept&&a.push(i),s[r]=r,""===i.orderNumber&&delete i.orderNumber,""===i.uuid&&delete i.uuid}},u=this;try{for(var c=__values(e),p=c.next();!p.done;p=c.next()){i(p.value)}}catch(d){o={error:d}}finally{try{p&&!p.done&&(r=c["return"])&&r.call(c)}finally{if(o)throw o.error}}return n=this._getDeletedOrders(s,l),this._addDeletedOrdersToPayload(n,a)},e.prototype._getExistingOrders=function(e){if(e.existingOrders&&e.existingOrders.orders){var t=e.existingOrders.orders.map(function(e){return{concept:e.concept.uuid,orderNumber:e.orderNumber,orderUuid:e.uuid,voided:e.voided,dateVoided:e.auditInfo.dateVoided}});return _.filter(t,function(e){return!0!==e.voided&&!e.dateVoided})}},e.prototype._setOrderValues=function(e,t){this._findTestOrderQuestionNodes(e);var n,o,r=this.formOrderNodes;try{for(var i=__values(r),a=i.next();!a.done;a=i.next()){var s=a.value;this._setOrderNodeValues(s,t)}}catch(l){n={error:l}}finally{try{a&&!a.done&&(o=i["return"])&&o.call(i)}finally{if(n)throw n.error}}},e.prototype._addDeletedOrdersToPayload=function(e,t){for(var n in e)e.hasOwnProperty(n)&&t.push({uuid:e[n],voided:!0});return t},e.prototype._createPayloadOrder=function(e,t){var n={concept:"",type:"",orderer:"",careSetting:""};return n.concept=e,n.type=t.questionOptions.orderType,n.orderer=this.provider,n.careSetting=t.questionOptions.orderSettingUuid,""===n.orderer&&delete n.orderer,n},e.prototype._getDeletedOrders=function(e,t){var n=[];if(e)for(var o in t)if(t.hasOwnProperty(o)){var r=t[o].concept;e[r]!==r&&n.push(t[o].orderUuid)}return n},e.prototype._setOrderNodeValues=function(e,t){var n,o,r=0;e.initialValue=t;try{for(var i=__values(t),a=i.next();!a.done;a=i.next()){var s=a.value;e.createChildNode();var l={};l[e.question.key]=s.concept;var u=e.children[r];u.control.setValue(l),u.initialValue=l,u.orderNumber=s.orderNumber,r++}}catch(c){n={error:c}}finally{try{a&&!a.done&&(o=i["return"])&&o.call(i)}finally{if(n)throw n.error}}},e.prototype._findTestOrderQuestionNodes=function(e){if(e.children&&e.children instanceof Object)for(var t in e.children)if(e.children.hasOwnProperty(t))switch(e.children[t].question.renderingType){case"page":case"section":case"group":this._findTestOrderQuestionNodes(e.children[t]);break;case"repeating":if(e.children)for(var n in e.children){var o=e.children[n].question;o.extras&&"testOrder"===o.extras.type&&this.formOrderNodes.push(e.children[n])}}},e.decorators=[{type:i0.Injectable}],e}(),moment$7=moment_,EncounterAdapter=function(){function e(e,t){this.ordersAdapter=e,this.obsAdapter=t}return e.prototype.populateForm=function(e,t){this.populateNode(e.rootNode,t),Array.isArray(t.orders)&&this.ordersAdapter.populateForm(e,t),Array.isArray(t.obs)&&this.obsAdapter.populateForm(e,t.obs)},e.prototype.populateNode=function(e,n){if(n===undefined||null===n)throw new Error("Expected payload");this.getEncounterNodes(e).forEach(function(e){switch(e.question.extras.type){case"encounterDatetime":n.encounterDatetime&&(e.control.setValue(moment$7(n.encounterDatetime).toDate()),e.initialValue=moment$7(n.encounterDatetime).toDate());break;case"encounterProvider":if(Array.isArray(n.encounterProviders)&&0<n.encounterProviders.length){var t=n.encounterProviders[0].provider;t&&t.uuid&&(e.control.setValue(t.uuid),setTimeout(function(){e.control.setValue(t.uuid)}),e.initialValue=t.uuid)}break;case"encounterLocation":n.location&&n.location.uuid&&(e.control.setValue(n.location.uuid),e.initialValue=n.location.uuid)}})},e.prototype.generateFormPayload=function(e){var t=this.generateNodePayload(e.rootNode);return this.setNonFilledPayloadMembers(e,t),t.obs=this.obsAdapter.generateFormPayload(e)||[],t.orders=this.ordersAdapter.generateFormPayload(e)||[],t},e.prototype.generateNodePayload=function(o){var e=this.getEncounterNodes(o),r={};return e.forEach(function(e){if(null!==e.control.value&&e.control.value!==undefined&&""!==e.control.value)switch(e.question.extras.type){case"encounterDatetime":var t=moment$7(e.control.value).utcOffset(o.form.valueProcessingInfo.utcOffset||"+0300");r.encounterDatetime=t.format("YYYY-MM-DD HH:mm:ss");break;case"encounterProvider":if(e.control.value&&""!==e.control.value){var n=[];n.push({provider:e.control.value,encounterRole:"a0b03050-c99b-11e0-9572-0800200c9a66"}),r.encounterProviders=n}break;case"encounterLocation":r.location=e.control.value}}),r},e.prototype.getEncounterNodes=function(e){var t=[];return this._getEncounterNodes(e,t),t},e.prototype.setNonFilledPayloadMembers=function(e,t){e.valueProcessingInfo.patientUuid&&this.setPayloadPatientUuid(t,e.valueProcessingInfo.patientUuid),e.valueProcessingInfo.visitUuid&&this.setPayloadVisitUuid(t,e.valueProcessingInfo.visitUuid),e.valueProcessingInfo.encounterTypeUuid&&this.setPayloadEncounterTypeUuid(t,e.valueProcessingInfo.encounterTypeUuid),e.valueProcessingInfo.formUuid&&this.setPayloadFormUuid(t,e.valueProcessingInfo.formUuid),e.valueProcessingInfo.encounterUuid&&this.setPayloadEncounterUuid(t,e.valueProcessingInfo.encounterUuid)},e.prototype.setPayloadPatientUuid=function(e,t){e.patient=t},e.prototype.setPayloadVisitUuid=function(e,t){e.visit=t},e.prototype.setPayloadEncounterTypeUuid=function(e,t){e.encounterType=t},e.prototype.setPayloadFormUuid=function(e,t){e.form=t},e.prototype.setPayloadEncounterUuid=function(e,t){e.uuid=t},e.prototype._getEncounterNodes=function(e,t){var n=this;if(this._isEncounterNode(e)&&t.push(e),e instanceof GroupNode){var o=e;for(var r in o.children)o.children[r]instanceof NodeBase&&this._getEncounterNodes(o.children[r],t)}e instanceof ArrayNode&&(o=e).children.forEach(function(e){n._getEncounterNodes(e,t)})},e.prototype._isEncounterNode=function(e){return!(!e.question.extras||"encounterDatetime"!==e.question.extras.type&&"encounterProvider"!==e.question.extras.type&&"encounterLocation"!==e.question.extras.type)},e.decorators=[{type:i0.Injectable}],e.ctorParameters=function(){return[{type:OrderValueAdapter},{type:ObsValueAdapter}]},e}(),PersonAttribuAdapter=function(){function e(){}return e.prototype.generateFormPayload=function(e){return this.generateNodePayload(e.rootNode)},e.prototype.generateNodePayload=function(e){var t=this.getPersonAttributeNodes(e),n=[];return t.forEach(function(e){null!==e.control.value&&e.control.value!==undefined&&""!==e.control.value&&e.initialValue!==e.control.value&&(!0===e.question.extras.questionOptions.isSimpleValue?n.push({attributeType:e.question.extras.questionOptions.attributeType,value:e.control.value}):n.push({attributeType:e.question.extras.questionOptions.attributeType,hydratedObject:e.control.value}))}),n},e.prototype.populateForm=function(e,t){this.populateNode(e.rootNode,t)},e.prototype.populateNode=function(e,n){if(!Array.isArray(n))throw new Error("Expected an array of attributes");this.getPersonAttributeNodes(e).forEach(function(t){n.forEach(function(e){e.attributeType.uuid===t.question.extras.questionOptions.attributeType&&(e.value.uuid?(t.control.setValue(e.value.uuid),t.initialValue=e.value.uuid):(t.control.setValue(e.value),t.initialValue=e.value))})})},e.prototype.getPersonAttributeNodes=function(e){var t=[];return this._getPersonAttributesNodes(e,t),t},e.prototype._getPersonAttributesNodes=function(e,t){var n=this;if(!e.question.extras||"personAttribute"!==e.question.extras.type&&"amrsLocations"!==e.question.extras.type&&"nonAmrsLocations"!==e.question.extras.type&&"siblingLocations"!==e.question.extras.type||t.push(e),e instanceof GroupNode){var o=e;for(var r in o.children)o.children[r]instanceof NodeBase&&this._getPersonAttributesNodes(o.children[r],t)}e instanceof ArrayNode&&(o=e).children.forEach(function(e){n._getPersonAttributesNodes(e,t)})},e.decorators=[{type:i0.Injectable}],e.ctorParameters=function(){return[]},e}(),RemoteSelectComponent=function(){function e(e){this.renderer=e,this.placeholder="Search...",this.items=[],this.value=[],this.loading=!1,this.searchText="",this.notFoundMsg="match no found",this.done=new i0.EventEmitter,this.characters=[],this.propagateChange=function(e){}}return Object.defineProperty(e.prototype,"dataSource",{get:function(){return this._dataSource},set:function(e){this._dataSource=e,this._dataSource&&this._dataSource.dataFromSourceChanged&&this.subscribeToDataSourceDataChanges()},enumerable:!0,configurable:!0}),e.prototype.ngOnInit=function(){},e.prototype.subscribeToDataSourceDataChanges=function(){var t=this;this._dataSource.dataFromSourceChanged.subscribe(function(e){0<e.length?(t.items=e,t.notFoundMsg="",t.restoreSelectedValue(t.selectC.value,e)):(t.notFoundMsg="Not found",t.items=[])})},e.prototype.typed=function(e){this.search(e)},e.prototype.search=function(e){var n=this;this.dataSource&&(this.searchText=e,this.notFoundMsg="Loading.........",this.dataSource.searchOptions(e).subscribe(function(e){if(0<e.length){var t=_.map(n.value,_.clone).concat(e);n.items=_.uniqBy(t,"value")}n.notFoundMsg=""},function(e){n.notFoundMsg="Errored"}))},e.prototype.restoreSelectedValue=function(t,e){var n=this,o=!1;_.each(e,function(e){e.value===t&&(setTimeout(function(){n.selectC.select(t),n.selectC.value=t}),o=!0)}),o||setTimeout(function(){n.selectC.select(""),n.selectC.value=""})},e.prototype.canSearch=function(e){return(2<=e.length-this.searchText.length||e.length-this.searchText.length<=2&&""!==e)&&!1===this.loading},e.prototype.writeValue=function(e){var t=this;e&&""!==e&&this.dataSource&&(this.loading=!0,this.dataSource.resolveSelectedValue(e).subscribe(function(e){t.items=[e],setTimeout(function(){t.selectC.select(e.value),t.selectC.value=e.value}),t.loading=!1},function(e){t.loading=!1}))},e.prototype.registerOnChange=function(e){this.propagateChange=e},e.prototype.registerOnTouched=function(){},e.prototype.onChange=function(e){this.propagateChange(e.id)},e.prototype.removed=function(e){console.log("Removed"),this.propagateChange("")},e.prototype.selected=function(e){this.propagateChange(e.value)},e.decorators=[{type:i0.Component,args:[{selector:"remote-select",template:'<div>\n <ng-select\n [id]="componentID"\n [noFilter]="0"\n (selected)="selected($event)"\n (deselected)="removed($event)"\n [options]="items"\n [allowClear]="true"\n [placeholder]="placeholder"\n [notFoundMsg]="notFoundMsg"\n (typed)="typed($event)"\n tabindex="0"\n >\n </ng-select>\n <div *ngIf="loading">resolving....</div>\n</div>\n',providers:[{provide:forms.NG_VALUE_ACCESSOR,useExisting:i0.forwardRef(function(){return e}),multi:!0}]}]}],e.ctorParameters=function(){return[{type:i0.Renderer2}]},e.propDecorators={placeholder:[{type:i0.Input}],componentID:[{type:i0.Input}],done:[{type:i0.Output}],selectC:[{type:i0.ViewChild,args:[SelectComponent]}],dataSource:[{type:i0.Input}]},e}(),RemoteSelectModule=function(){function e(){}return e.decorators=[{type:i0.NgModule,args:[{imports:[common.CommonModule,SelectModule,forms.FormsModule],exports:[RemoteSelectComponent],declarations:[RemoteSelectComponent],providers:[]}]}],e}(),moment$8=moment_,AppointmentsOverviewComponent=function(){function e(){this.showAppointments=!1,this.loadingAppointments=!1,this.errorLoadingAppointments=!1,this.appointmentsLoaded=!1,this.appointments=[],this.today=""}return e.prototype.ngOnInit=function(){},e.prototype.ngOnChanges=function(){var s=this;this.node.control.valueChanges.subscribe(function(a){s.resetProperties();var e=s.node;if(e.question.extras.questionOptions.concept&&("a8a666ba-1350-11df-a1f1-0026b9348838"===e.question.extras.questionOptions.concept||"a89d2398-1350-11df-a1f1-0026b9348838"===e.question.extras.questionOptions.concept)&&!s.showAppointments){s.loadingAppointments=!0,s.showAppointments=!0;var t=void 0;e.form&&e.form.dataSourcesContainer.dataSources&&(t=e.form.dataSourcesContainer.dataSources.monthlyScheduleResourceService);var n=e.form.dataSourcesContainer.dataSources.userLocation.uuid;if(t&&n){var o=moment$8(a).startOf("week").add(1,"day").format("YYYY-MM-DD"),r=moment$8(a).endOf("week").subtract(1,"day").format("YYYY-MM-DD");s.today=moment$8(a).format("DD-MM-YYYY"),t.getMonthlySchedule({startDate:o,endDate:r,limit:5,locationUuids:n,department:"HIV",groupBy:"groupByPerson,groupByAttendedDate,groupByRtcDate"}).subscribe(function(e){for(var o=[],t=new Map,n=0;n<5;n++){var r=moment$8(a).startOf("week").add(n,"day").format("YYYY-MM-DD"),i={date:r,count:{scheduled:0}};t.set(r,i)}(e.results||[]).forEach(function(e){t.set(e.date,e)}),t.forEach(function(e,t){var n={date:t,count:e.count.scheduled||0};o.push(n)}),s.appointmentsLoaded=!0,s.loadingAppointments=!1,s.appointments=o},function(e){s.loadingAppointments=!1,s.errorLoadingAppointments=!0,s.showAppointments=!1,console.error(e)})}else s.showAppointments=!1,s.errorLoadingAppointments=!0}})},e.prototype.resetProperties=function(){this.loadingAppointments=!1,this.appointmentsLoaded=!1,this.errorLoadingAppointments=!1,this.showAppointments=!1,this.appointments=[],this.today=""},e.decorators=[{type:i0.Component,args:[{selector:"appointments-overview",template:'<div *ngIf="showAppointments" class="appointments">\n <p *ngIf="loadingAppointments">\n <span *ngIf="!appointmentsLoaded && errorLoadingAppointments"\n >Error checking appointments</span\n >\n <span *ngIf="loadingAppointments"\n ><span class="fa fa-spinner fa-spin"></span>Checking appointments...</span\n >\n </p>\n <div *ngIf="appointmentsLoaded && !errorLoadingAppointments">\n <table\n *ngIf="appointments.length > 0"\n class="table table-stripped table-bordered"\n >\n <thead>\n <tr>\n <th\n *ngFor="let appointment of appointments"\n [ngClass]="{ active: appointment.date === today }"\n >\n <span>{{ appointment.date }}</span>\n </th>\n </tr>\n </thead>\n <tbody>\n <tr>\n <td\n *ngFor="let appointment of appointments"\n [ngClass]="{ active: appointment.date === today }"\n >\n <span\n ><strong\n ><em>{{ appointment.count }}</em></strong\n ></span\n >\n </td>\n </tr>\n </tbody>\n </table>\n </div>\n</div>\n',styles:[".appointments{margin-top:12px;font-size:12px;color:#999}.appointments p{padding-top:12px}.appointments th{border-bottom:0!important;color:#333}.appointments td span,.appointments th span{display:block}.appointments td.active,.appointments th.active{background-color:#3c8dbc;color:#fff!important;padding:0}.appointments td.active span,.appointments th.active span{padding:4px}.appointments span.fa{display:inline-block;margin-right:7px}"]}]}],e.ctorParameters=function(){return[]},e.propDecorators={node:[{type:i0.Input}]},e}(),EncounterViewerService=function(){function e(){}return e.prototype.resolveSelectedValue=function(e){},e.prototype.searchOptions=function(e){},e.prototype.fileUpload=function(e){},e.prototype.fetchFile=function(e){},e.prototype.resolveSelectedValueFromSchema=function(n,e){var o,r=this;return e.pages&&_.forEach(e.pages,function(e){var t=r.resolveSelectedValueFromSchema(n,e);t&&(o=t)}),e.sections&&_.forEach(e.sections,function(e){var t=r.resolveSelectedValueFromSchema(n,e);t&&(o=t)}),e.questions&&_.forEach(e.questions,function(e){if(e.questions){var t=r.resolveSelectedValueFromSchema(n,e);t&&(o=t)}else e.questionOptions.answers?_.forEach(e.questionOptions.answers,function(e){e.concept===n&&(o=e.label)}):e.questionOptions.selectableOrders&&_.forEach(e.questionOptions.selectableOrders,function(e){e.concept===n&&(o=e.label)})}),o},e.prototype.hasAnswer=function(e){var t=!1;return e.initialValue&&(t=!0),t},e.prototype.questionsAnswered=function(e,t){var n=this,o=t||[];if("page"===e.question.renderingType)_.forEach(e.children,function(e){n.questionsAnswered(e,o)});else{if("section"!==e.question.renderingType)return this.hasAnswer(e);_.forEach(e.children,function(e){"group"===e.question.renderingType?_.forEach(e.children,function(e){var t=n.questionsAnswered(e,o);t&&o.push(t)}):n.hasAnswer(e)&&o.push(!0)})}return 0<o.length},e.prototype.isDate=function(e){return!!Date.parse(e)},e.prototype.convertTime=function(e){var t=new Date(e),n=t.getFullYear(),o=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"][t.getMonth()],r=t.getDate(),i=t.getHours(),a=t.getMinutes();t.getSeconds();return 0===i&&0===a?r+" "+o+" "+n:r+" "+o+" "+n+" "+i+":"+a+(i<12?"AM":"PM")+" (EAT)"},e.decorators=[{type:i0.Injectable}],e.ctorParameters=function(){return[]},e}(),EncounterViewerComponent=function(){function e(e,t){this.encounterViewerService=e,this.dataSources=t}return Object.defineProperty(e.prototype,"node",{set:function(e){this.rootNode=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"schema",{set:function(e){this._schema=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"encounter",{set:function(e){this.enc=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"form",{set:function(e){this.rootNode=e.rootNode,this._schema=e.schema,console.log(this.getQuestionNodes(this.traverse(this.rootNode)))},enumerable:!0,configurable:!0}),e.prototype.getQuestionNodes=function(e){var t,n,o=[];try{for(var r=__values(e),i=r.next();!i.done;i=r.next()){var a=i.value;o.push(a.page)}}catch(s){t={error:s}}finally{try{i&&!i.done&&(n=r["return"])&&n.call(r)}finally{if(t)throw t.error}}return[].concat.apply([],o)},e.prototype.ngOnInit=function(){this.rootNode,this.rootNode&&this.rootNode.question.extras&&"file"===this.rootNode.question.renderingType?this.fileDataSource=this.dataSources.dataSources[this.rootNode.question.dataSource]:this.rootNode&&this.rootNode.question.extras&&"remote-select"===this.rootNode.question.renderingType?this.remoteDataSource=this.dataSources.dataSources[this.rootNode.question.dataSource]:this.customDataSource=this.encounterViewerService},e.prototype.questionsAnswered=function(e){return this.encounterViewerService.questionsAnswered(e)},e.prototype.questionAnswered=function(e){return this.encounterViewerService.hasAnswer(e)},e.prototype.checkForColon=function(e){return-1===e.indexOf(":")},e.prototype.traverse=function(e,t){var n=[];if(e.children){if(e.children instanceof Array)return this.repeatingGroup(e.children);if(e.children instanceof Object){for(var o in e.children)if(e.children.hasOwnProperty(o))switch(e.children[o].question.renderingType){case"page":var r=this.traverse(e.children[o]);n.push({page:r});break;case"section":var i=this.traverse(e.children[o]);n.push({section:i});break;case"group":var a=this.traverse(e.children[o]);n.push({node:e.children[o],question:e.children[o].question,groupMembers:a});break;case"repeating":var s=this.repeatingGroup(e.children[o].children);n.push({node:e.children[o],question:e.children[o].question,groupMembers:s});break;default:n.push(e.children[o])}}else console.log("Console.log",e)}return n},e.prototype.repeatingGroup=function(e){var t,n,o=[];try{for(var r=__values(e),i=r.next();!i.done;i=r.next()){var a=i.value;o.push({question:a.question,groupMembers:this.traverse(a)})}}catch(s){t={error:s}}finally{try{i&&!i.done&&(n=r["return"])&&n.call(r)}finally{if(t)throw t.error}}return o},e.decorators=[{type:i0.Component,args:[{selector:"encounter-viewer",template:'<div class="viewer">\n <div *ngIf="rootNode.question.renderingType === \'form\'" class="form">\n <div *ngFor="let question of rootNode.question.questions; let i = index">\n <div *ngIf="questionsAnswered(rootNode.children[question.key])">\n <div [attr.id]="\'page\' + i" class="panel panel-default">\n <p class="page-label panel-heading text-primary">\n {{ question.label }}\n </p>\n <div class="panel-body">\n <encounter-viewer\n [node]="rootNode.children[question.key]"\n [schema]="_schema"\n [parentComponent]="this"\n [parentGroup]="rootNode.control"\n ></encounter-viewer>\n </div>\n </div>\n </div>\n </div>\n </div>\n\n <div *ngIf="rootNode.question.renderingType === \'page\'" class="page">\n <encounter-viewer\n *ngFor="let question of rootNode.question.questions"\n [parentComponent]="this"\n [node]="rootNode.children[question.key]"\n [schema]="_schema"\n [parentGroup]="parentGroup"\n ></encounter-viewer>\n </div>\n\n <div\n *ngIf="\n rootNode.question.renderingType === \'section\' &&\n questionsAnswered(rootNode)\n "\n class="section"\n >\n <div class="panel panel-primary">\n <p class="panel-heading section-label">{{ rootNode.question.label }}</p>\n </div>\n <div *ngFor="let question of rootNode.question.questions">\n <encounter-viewer\n [node]="rootNode.children[question.key]"\n [parentComponent]="this"\n [schema]="_schema"\n [parentGroup]="parentGroup"\n ></encounter-viewer>\n </div>\n </div>\n\n \x3c!--Leaf Controls--\x3e\n <div style="margin-left: 10px">\n <form *ngIf="rootNode.question.controlType === 0" [formGroup]="parentGroup">\n <div *ngIf="rootNode.control.value">\n <div class="question-answer">\n <label\n *ngIf="rootNode.question.label"\n [attr.for]="rootNode.question.key"\n style="font-weight: 400"\n >\n {{ rootNode.question.label }}\n </label>\n <span *ngIf="checkForColon(rootNode.question.label)">:</span>\n <div\n [ngSwitch]="rootNode.question.renderingType"\n style="display: inline-block; font-weight: bold"\n >\n <div *ngSwitchCase="\'file\'">\n <file-preview\n [formControlName]="rootNode.question.key"\n [id]="rootNode.question.key + \'id\'"\n [dataSource]="fileDataSource"\n ></file-preview>\n </div>\n <div *ngSwitchCase="\'remote-select\'">\n <remote-answer\n [formControlName]="rootNode.question.key"\n [id]="rootNode.question.key + \'id\'"\n [dataSource]="remoteDataSource"\n ></remote-answer>\n </div>\n <div *ngSwitchDefault style="display: inline-block">\n <question-control\n [schema]="_schema"\n [value]="rootNode.control.value"\n [dataSource]="customDataSource"\n ></question-control>\n </div>\n </div>\n </div>\n </div>\n </form>\n </div>\n\n \x3c!--Array Controls--\x3e\n <div\n *ngIf="rootNode.question.controlType === 1 && questionsAnswered(rootNode)"\n >\n <div [ngSwitch]="rootNode.question.renderingType">\n <div *ngSwitchCase="\'repeating\'">\n <div [ngSwitch]="rootNode.question.extras.type">\n <div *ngSwitchCase="\'testOrder\'">\n <label>{{ rootNode.question.label }}:</label>\n <div *ngFor="let child of rootNode.children; let i = index">\n <encounter-viewer\n *ngFor="let question of child.question.questions"\n [parentComponent]="this"\n [node]="child.children[question.key]"\n [parentGroup]="child.control"\n [schema]="_schema"\n ></encounter-viewer>\n </div>\n </div>\n\n <div *ngSwitchCase="\'obsGroup\'">\n <div *ngFor="let child of rootNode.children; let i = index">\n <encounter-viewer\n *ngFor="let question of child.question.questions"\n [parentComponent]="this"\n [node]="child.children[question.key]"\n [parentGroup]="child.control"\n [schema]="_schema"\n ></encounter-viewer>\n </div>\n </div>\n </div>\n </div>\n </div>\n </div>\n\n <div *ngIf="rootNode.question.controlType === 2">\n \x3c!--GROUP--\x3e\n <div [ngSwitch]="rootNode.question.renderingType">\n <div *ngSwitchCase="\'group\'">\n <encounter-viewer\n *ngFor="let question of rootNode.question.questions"\n [parentComponent]="this"\n [node]="rootNode.children[question.key]"\n [parentGroup]="rootNode.control"\n [schema]="_schema"\n ></encounter-viewer>\n </div>\n <div *ngSwitchCase="\'field-set\'">\n <encounter-viewer\n *ngFor="let question of rootNode.question.questions"\n [parentComponent]="this"\n [node]="rootNode.children[question.key]"\n [parentGroup]="rootNode.control"\n [schema]="_schema"\n ></encounter-viewer>\n </div>\n </div>\n </div>\n</div>\n',styles:[".page-label{font-size:20px;font-weight:700}.section-label{font-size:18px;font-weight:500}.panel-primary{border:none!important}.question-answer{font-size:16px}.panel{margin-bottom:5px}div.section{margin-bottom:15px!important}.line-breaker{white-space:pre-line}hr{margin:10px}"]}]}],e.ctorParameters=function(){return[{type:EncounterViewerService},{type:DataSources}]},e.propDecorators={parentGroup:[{type:i0.Input}],parentComponent:[{type:i0.Input}],node:[{type:i0.Input}],schema:[{type:i0.Input}],encounter:[{type:i0.Input}],form:[{type:i0.Input}]},e}(),moment$9=moment_,EncounterPdfViewerService=function(){function e(e,t,n){this.encounterViewerService=e,this.obsValueAdapter=t,this.dataSources=n,this.subscribedAnswers={questions:{stack:[]},answers:[]}}return e.prototype.getPages=function(e,t,n,o){var r,i,a,s,l=[],u=[];try{for(var c=__values(e),p=c.next();!p.done;p=c.next()){var d=p.value;if(n)u=u.concat(this.getSections(d.page,t,!1,o));else try{for(var h=__values(t.rootNode.question.questions),f=h.next();!f.done;f=h.next()){var y=f.value;d.label===t.rootNode.children[y.key].question.label&&this.encounterViewerService.questionsAnswered(t.rootNode.children[y.key])&&l.push({style:"tableExample",table:{widths:["*"],headerRows:1,keepWithHeaderRows:1,body:[[{text:d.label,style:"tableHeader"}],[{style:"tableExample",table:{widths:["*"],body:this.getSections(d.page,t,!0,o)},layout:"noBorders",margin:[5,0,0,0]}]]},layout:{hLineWidth:function(e,t){return 0===e||t.table.body.length,.5},vLineWidth:function(e,t){return 0===e||t.table.widths.length,.5},hLineColor:function(e,t){return 0===e||t.table.body.length,"#ddd"},vLineColor:function(e,t){return 0===e||t.table.body.length,"#ddd"}}})}}catch(m){a={error:m}}finally{try{f&&!f.done&&(s=h["return"])&&s.call(h)}finally{if(a)throw a.error}}}}catch(g){r={error:g}}finally{try{p&&!p.done&&(i=c["return"])&&i.call(c)}finally{if(r)throw r.error}}return n?u:l},e.prototype.getSections=function(e,t,n,o){var r,i,a,s,l=this,u=[],c=[],p=[];e.map(function(e){l.encounterViewerService.questionsAnswered(e.node)&&c.push(e)});try{for(var d=__values(c),h=d.next();!h.done;h=d.next()){var f=h.value;p=p.concat(this.getRemoteSectionData(f.section))}}catch(g){r={error:g}}finally{try{h&&!h.done&&(i=d["return"])&&i.call(d)}finally{if(r)throw r.error}}if(n&&o){try{for(var y=__values(c),m=y.next();!m.done;m=y.next()){f=m.value;u.push([{table:{widths:["*"],body:[[{text:f.label,style:"tableSubheader"}],[this.getSectionData(f.section,o,t)]]},layout:"noBorders"}])}}catch(v){a={error:v}}finally{try{m&&!m.done&&(s=y["return"])&&s.call(y)}finally{if(a)throw a.error}}return u}return p},e.prototype.appendResolvedAnswer=function(e,t,n){e&&t.stack.push({text:[(n?n.question.label:"Question label")+(n?1<n.question.label.indexOf(":")?"":":":"")+" ",{text:""+e,bold:!0}],style:"answers"})},e.prototype.getRemoteSectionData=function(e){var t,n,o=[];this.subscribedAnswers.questions.stack=[];try{for(var r=__values(e),i=r.next();!i.done;i=r.next()){var a=i.value;"remote-select"===a.question.renderingType&&(this.remoteDataSource=this.dataSources.dataSources[a.question.dataSource],""!==a.control.value&&this.remoteDataSource&&o.push(this.remoteDataSource.resolveSelectedValue(a.control.value)))}}catch(s){t={error:s}}finally{try{i&&!i.done&&(n=r["return"])&&n.call(r)}finally{if(t)throw t.error}}return o},e.prototype.getSectionData=function(e,c,p){var t,n,d={stack:[]},h="",o=function(t){switch(t.question.renderingType){case"group":t.groupMembers&&d.stack.push(f.getSectionData(t.groupMembers,c,p));break;case"field-set":if(t.children){var e=[],n=Object.keys(t.children).map(function(e){return t.children[e]});n&&(e.push(n),d.stack.push(f.getSectionData(e[0],c,p)))}break;case"repeating":t.groupMembers&&d.stack.push(f.getSectionData(t.groupMembers,c,p));break;case"remote-select":f.remoteDataSource=f.dataSources.dataSources[t.question.dataSource];try{for(var o=__values(c),r=o.next();!r.done;r=o.next()){var i=r.value;i.value===t.control.value&&f.appendResolvedAnswer(i.label,d,t)}}catch(u){s={error:u}}finally{try{r&&!r.done&&(l=o["return"])&&l.call(o)}finally{if(s)throw s.error}}break;default:var a=t.control.value;a&&(h=f.resolveValue(a,p),f.appendResolvedAnswer(h,d,t))}var s,l},f=this;try{for(var r=__values(e),i=r.next();!i.done;i=r.next()){o(i.value)}}catch(a){t={error:a}}finally{try{i&&!i.done&&(n=r["return"])&&n.call(r)}finally{if(t)throw t.error}}return d},e.prototype.resolveValue=function(t,n,e){var o=this;if(""!==t){if(this.isUuid(t)){var r=this.encounterViewerService.resolveSelectedValueFromSchema(t,n.schema);return e?r:r?r.toUpperCase():t}if(_.isArray(t)){var i=[];return _.forEach(t,function(e){i.push(o.resolveValue(e,n,!0))}),i.toString()}if(this.isDate(t))return this.encounterViewerService.convertTime(t);if("object"!=typeof t)return t;var a=[],s=Object.keys(t).map(function(e){return[e,t[e]]});return a.push(s),a}},e.prototype.generatePdfDefinition=function(n){var o=this,r=new rxjs.BehaviorSubject({}),e=this.getPages(this.obsValueAdapter.traverse(n.rootNode),n,!0);return rxjs.combineLatest(e).subscribe(function(e){if(e){var t={pageSize:"A4",content:o.getPages(o.obsValueAdapter.traverse(n.rootNode),n,!1,e),styles:{answers:{fontSize:8},banner:{fontSize:9,bold:!0,margin:[50,15,30,0]},bannerItem:{margin:[2,2,2,2]},bannerLabel:{color:"#2f4f4f"},confidential:{color:"red",fontSize:8,bold:!0,margin:[60,0,0,0]},footer:{alignment:"center",fontSize:8,bold:!0},header:{fontSize:9,bold:!0,margin:[5,5,5,5]},pageNumber:{color:"#2f4f4f",fontSize:6},tableExample:{fontSize:10,margin:[5,0,0,5]},tableHeader:{fillColor:"#f5f5f5",width:["100%"],borderColor:"#333",fontSize:9,bold:!0,margin:[5,0,5,0]},tableSubheader:{fillColor:"#337ab7",width:["100%"],fontSize:9,color:"white",margin:[5,0,5,0]},timestamp:{bold:!0,color:"#2f4f4f"}},defaultStyle:{fontSize:7}};r.next(t)}}),r},e.prototype.displayPdf=function(e){var o,r=this,i=pdfMake;i.vfs=pdfMake.vfs,e.dataSourcesContainer.dataSources._dataSources&&(o=e.dataSourcesContainer.dataSources._dataSources.patientInfo),this.generatePdfDefinition(e).subscribe(function(e){if(!_.isEmpty(e)){if(void 0!==o){var t=[];o.name&&t.push({text:[{text:"Name: ",style:"bannerLabel"},{text:""+r.titleize(o.name)}],style:"bannerItem"}),o.nid&&t.push({text:[{text:"ID: ",style:"bannerLabel"},{text:""+o.nid}],style:"bannerItem"}),o.birthdate&&t.push({text:[{text:"DOB: ",style:"bannerLabel"},{text:moment$9(o.birthdate).format("l")+" ("+o.age+" yo)"}],style:"bannerItem"}),o.mui&&t.push({text:[{text:"MUI: ",style:"bannerLabel"},{text:""+o.mui}],style:"bannerItem"}),o.mhn&&t.push({text:[{text:"MTRH No: ",style:"bannerLabel"},{text:""+o.mhn}],style:"bannerItem"}),e.header={style:"banner",table:{body:[t]},layout:"noBorders"}}e.footer=function(e,t){return{style:"footer",widths:["*","auto"],table:{body:[[{text:"Note: Confidentiality is one of the core duties of all medical practitioners. Patients' personal health information should be kept private.",style:"confidential"},""],[{text:"Generated on "+(new Date).toUTCString(),style:"timestamp"},{text:e.toString()+" of "+t,style:"pageNumber"}]]},layout:"noBorders"}};var n=window.open("","_blank");i.createPdf(e).open({},n)}},function(e){console.log("Error: ",e)})},e.prototype.isDate=function(e){return moment$9(e,moment$9.ISO_8601,!0).isValid()},e.prototype.isUuid=function(e){return 36===e.length&&-1===e.indexOf(" ")&&-1===e.indexOf(".")},e.prototype.titleize=function(e){return e.replace(/\w\S*/g,function(e){return e.charAt(0).toUpperCase()+e.substr(1).toLowerCase()})},e.decorators=[{type:i0.Injectable,args:[{providedIn:"root"}]}],e.ctorParameters=function(){return[{type:EncounterViewerService},{type:ObsValueAdapter},{type:DataSources}]},e.ngInjectableDef=i0.defineInjectable({factory:function(){return new e(i0.inject(EncounterViewerService),i0.inject(ObsValueAdapter),i0.inject(DataSources))},token:e,providedIn:"root"}),e}(),EncounterContainerComponent=function(){function e(e,t){this.encAdapter=e,this.encounterPdfViewerService=t}return Object.defineProperty(e.prototype,"form",{set:function(e){this.$form=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"encounter",{set:function(e){this.$enc=e},enumerable:!0,configurable:!0}),e.prototype.ngOnInit=function(){},e.prototype.displayPdf=function(){this.encounterPdfViewerService.displayPdf(this.$form)},e.decorators=[{type:i0.Component,args:[{selector:"encounter-renderer",template:'<a\n type="button"\n style="display: block; font-size: 28px; cursor: pointer"\n class="text-right"\n (click)="displayPdf()"\n>\n <span class="glyphicon text-primary glyphicon-print"></span>\n</a>\n<encounter-viewer\n class="card"\n [form]="$form"\n [encounter]="$enc"\n></encounter-viewer>\n',styles:[".card{box-shadow:0 2px 5px 0 rgba(0,0,0,.16),0 2px 10px 0 rgba(0,0,0,.12)}"]}]}],e.ctorParameters=function(){return[{type:EncounterAdapter},{type:EncounterPdfViewerService}]},e.propDecorators={form:[{type:i0.Input}],encounter:[{type:i0.Input}]},e}(),QuestionControlComponent=function(){function e(){this.innerValue=""}return Object.defineProperty(e.prototype,"schema",{set:function(e){this._schema=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"value",{set:function(e){this._value=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"dataSource",{set:function(e){this._dataSource=e},enumerable:!0,configurable:!0}),e.prototype.ngOnInit=function(){this.writeValue(this._value)},e.prototype.isUuid=function(e){return 36===e.length&&-1===e.indexOf(" ")&&-1===e.indexOf(".")},e.prototype.writeValue=function(e,t){var n=this;if(e!==this.innerValue)if(this.isUuid(e)){if(t)return this._dataSource.resolveSelectedValueFromSchema(e,this._schema);var o=this._dataSource.resolveSelectedValueFromSchema(e,this._schema);this.innerValue=o?o.toUpperCase():e}else if(_.isArray(e)){var r=[];_.forEach(e,function(e){r.push(n.writeValue(e,!0))}),this.innerValue=r}else if(this.isDate(e)){if(t)return this._dataSource.convertTime(e);this.innerValue=this._dataSource.convertTime(e)}else{if(t)return e;this.innerValue=e}},e.prototype.isDate=function(e){return this._dataSource.isDate(e)&&!_.isNumber(e)},e.decorators=[{type:i0.Component,args:[{selector:"question-control",styles:["input{border:none;box-shadow:none;color:#000;background:#fff!important;padding-top:23px;display:block;position:relative}"],template:"<div>\n {{ innerValue }}\n</div>\n"}]}],e.ctorParameters=function(){return[]},e.propDecorators={schema:[{type:i0.Input}],value:[{type:i0.Input}],dataSource:[{type:i0.Input}]},e}(),noop=function(){},FilePreviewComponent=function(){function e(e){this.encounterService=e,this.fileUuid=null,this.resultsIsPdf=!1,this.onTouchedCallback=noop,this.onChangeCallback=noop}return Object.defineProperty(e.prototype,"dataSource",{get:function(){return this._dataSource},set:function(e){this._dataSource=e},enumerable:!0,configurable:!0}),e.prototype.ngOnInit=function(){},Object.defineProperty(e.prototype,"value",{get:function(){return this.fileUuid},set:function(e){e!==this.fileUuid&&(this.fileUuid=e)},enumerable:!0,configurable:!0}),e.prototype.writeValue=function(e){e!==this.fileUuid&&(this.fileUuid=e,this.checkFileType())},e.prototype.checkFileType=function(){-1!==this.fileUuid.search(/pdf/gi)&&(this.resultsIsPdf=!0)},e.prototype.registerOnChange=function(e){this.onChangeCallback=e},e.prototype.registerOnTouched=function(e){this.onTouchedCallback=e},e.prototype.onBlur=function(){this.onTouchedCallback()},e.prototype.onChange=function(e){},e.prototype.getUrl=function(){this.dataSource.fetchFile(this.fileUuid,"pdf").subscribe(function(e){window.open(e.changingThisBreaksApplicationSecurity,"_blank")})},e.decorators=[{type:i0.Component,args:[{selector:"file-preview",styles:[""],template:'<div *ngIf="fileUuid">\n <img\n *ngIf="!resultsIsPdf"\n class="img-responsive"\n [src]="fileUuid | secure: this._dataSource.fetchFile"\n alt="image"\n />\n </div>\n <a *ngIf="resultsIsPdf" (click)="getUrl()" style="cursor: pointer"\n ><u>Open PDF</u></a\n > ',providers:[{provide:forms.NG_VALUE_ACCESSOR,useExisting:i0.forwardRef(function(){return e}),multi:!0}]}]}],e.ctorParameters=function(){return[{type:EncounterViewerService}]},e.propDecorators={source:[{type:i0.Input}],dataSource:[{type:i0.Input}]},e}(),noop$1=function(){},RemoteAnswerComponent=function(){function e(){this.innerValue=null,this.onTouchedCallback=noop$1,this.onChangeCallback=noop$1}return Object.defineProperty(e.prototype,"dataSource",{get:function(){return this._dataSource},set:function(e){this._dataSource=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"value",{get:function(){return this.innerValue},set:function(e){e!==this.innerValue&&(this.innerValue=e)},enumerable:!0,configurable:!0}),e.prototype.writeValue=function(e){var t=this;e!==this.innerValue&&(this._dataSource?this._dataSource.resolveSelectedValue(e).subscribe(function(e){t.innerValue=e.label}):this.innerValue=e)},e.prototype.registerOnChange=function(e){this.onChangeCallback=e},e.prototype.registerOnTouched=function(e){this.onTouchedCallback=e},e.prototype.onBlur=function(){this.onTouchedCallback()},e.prototype.onChange=function(e){},e.decorators=[{type:i0.Component,args:[{selector:"remote-answer",styles:[],template:'\n <div *ngIf="innerValue">\n {{ innerValue }}\n </div>\n ',providers:[{provide:forms.NG_VALUE_ACCESSOR,useExisting:i0.forwardRef(function(){return e}),multi:!0}]}]}],e.ctorParameters=function(){return[]},e.propDecorators={source:[{type:i0.Input}],dataSource:[{type:i0.Input}]},e}(),EncounterViewerModule=function(){function e(){}return e.decorators=[{type:i0.NgModule,args:[{declarations:[EncounterViewerComponent,EncounterContainerComponent,QuestionControlComponent,FilePreviewComponent,RemoteAnswerComponent],imports:[forms.FormsModule,forms.ReactiveFormsModule,common.CommonModule,http.HttpClientModule,SharedModule],providers:[EncounterViewerService,EncounterPdfViewerService],exports:[EncounterContainerComponent,http.HttpClientModule]}]}],e}(),CheckboxControlComponent=function(){function e(){this._value=[],this.onChange=function(e){},this.onTouched=function(){}}return e.prototype.ngOnInit=function(){var t=this;this.options=this.options.map(function(e){return-1!==t.selected.indexOf(e.value)&&Object.assign(e,{checked:!0}),e})},e.prototype.ngAfterViewInit=function(){},e.prototype.writeValue=function(e){this.value=e},e.prototype.registerOnChange=function(e){this.onChange=e},e.prototype.registerOnTouched=function(e){this.onTouched=e},Object.defineProperty(e.prototype,"value",{get:function(){return 0===this._value.length?"":this._value||this._value[0]},set:function(e){if(null==e||""===e)e=[];else if("string"==typeof e)e=[e];else if(!Array.isArray(e))throw new TypeError("Value must be a string or an array.")},enumerable:!0,configurable:!0}),e.prototype.selectOpt=function(t,e){var n=this;e.target.checked?this._value.push(t.value):this.options.forEach(function(e){e.value===t.value&&n._value.splice(e,1)}),this.onChange(this.value)},e.decorators=[{type:i0.Component,args:[{selector:"checkbox",template:'<div *ngFor="let option of options; let i = index">\n <label class="form-control no-border">\n <input\n type="checkbox"\n id="i + \'id\'"\n (change)="selectOpt(option, $event)"\n value="option.value"\n [checked]="option.checked"\n />\n {{ option.label }}\n </label>\n</div>\n',providers:[{provide:forms.NG_VALUE_ACCESSOR,useExisting:i0.forwardRef(function(){return e}),multi:!0}],styles:["\n .no-border {\n border: 0;\n box-shadow: none;\n }\n "]}]}],e.propDecorators={options:[{type:i0.Input}],selected:[{type:i0.Input}]},e}(),CheckboxModule=function(){function e(){}return e.decorators=[{type:i0.NgModule,args:[{declarations:[CheckboxControlComponent],exports:[CheckboxControlComponent],imports:[common.CommonModule,forms.FormsModule]}]}],e}(),moment$a=moment_,NgxTimePickerComponent=function(){function e(){this.value=moment$a().format("HH:mm:ss"),this.onChange=function(){},this.onTouched=function(){}}return e.prototype.ngOnInit=function(){},e.prototype.writeValue=function(e){this.value=this.formatTimeValue(e)},e.prototype.registerOnChange=function(e){this.onChange=e},e.prototype.registerOnTouched=function(e){},e.prototype.onTimeSelect=function(e){var t=this.formatTimeValue(e);this.value=t,this.onChange(t)},e.prototype.formatTimeValue=function(e){var t=[],n=[];return null==e||(t=e.split(":"),n=e.split("-")),1===t.length&&moment$a(e).isValid()?moment$a(e).format("HH:mm:ss"):1<t.length&&t.length<2?moment$a(e,moment$a.defaultFormat).format("HH:mm:ss"):2<=t.length&&1<n.length?moment$a(e,moment$a.defaultFormat).format("HH:mm:ss"):2<=t.length&&n.length<=1?moment$a(e,"HH:mm:ss").format("HH:mm:ss"):moment$a().format("HH:mm:ss")},e.decorators=[{type:i0.Component,args:[{selector:"ngx-time-picker",template:'<input\n type="time"\n class="form-control"\n [ngModel]="value"\n (ngModelChange)="onTimeSelect($event)"\n/>\n',styles:[""],providers:[{provide:forms.NG_VALUE_ACCESSOR,multi:!0,useExisting:i0.forwardRef(function(){return e})}]}]}],e}(),NgxTimePickerModule=function(){function e(){}return e.decorators=[{type:i0.NgModule,args:[{imports:[common.CommonModule,forms.FormsModule,forms.ReactiveFormsModule],declarations:[NgxTimePickerComponent],exports:[NgxTimePickerComponent],providers:[]}]}],e}(),FormEntryModule=function(){function e(){}return e.decorators=[{type:i0.NgModule,args:[{imports:[common.CommonModule,forms.ReactiveFormsModule,collapse.CollapseModule,SelectModule,DateTimePickerModule,RemoteSelectModule,RemoteFileUploadModule,EncounterViewerModule,CheckboxModule,material.MatIconModule,material.MatTabsModule,material.MatCardModule,NgxDateTimePickerModule,NgxTimePickerModule,SharedModule],declarations:[FormRendererComponent,AfeNgSelectComponent,AppointmentsOverviewComponent,HistoricalValueDirective,ErrorRendererComponent,timeAgoPipe.TimeAgoPipe],providers:[forms.FormBuilder,FormControlService,FormErrorsService,ValidationFactory,HidersDisablersFactory,AlertsFactory,ExpressionRunner,JsExpressionHelper,HistoricalFieldHelperService,FormSchemaCompiler,FormFactory,QuestionFactory,ValidationFactory,ControlRelationsFactory,ObsAdapterHelper,ObsValueAdapter,EncounterAdapter,PersonAttribuAdapter,OrderValueAdapter,DebugModeService],exports:[FormRendererComponent,AfeNgSelectComponent,ErrorRendererComponent,DateTimePickerModule,EncounterViewerModule,NgxDateTimePickerModule,NgxTimePickerModule]}]}],e}(),Pair=function FL(e,t){this.key=e,this.value=t},IL;IL=exports.RenderingType||(exports.RenderingType={}),IL[IL.Form=0]="Form",IL[IL.Page=1]="Page",IL[IL.Section=2]="Section",IL[IL.Select=3]="Select",IL[IL.DropDown=4]="DropDown",exports.ɵbg=AfeNgSelectComponent,exports.ɵbh=AppointmentsOverviewComponent,exports.ɵz=CheckboxControlComponent,exports.ɵy=CheckboxModule,exports.ɵg=DatePickerComponent,exports.ɵk=DateTimePickerComponent,exports.ɵi=ModalComponent,exports.ɵj=MomentPipe,exports.ɵh=TimePickerComponent,exports.ɵq=FileUploadComponent,exports.ɵn=RemoteFileUploadModule,exports.ɵp=SecurePipe,exports.ɵba=MY_FORMATS,exports.ɵbb=NgxDateTimePickerComponent,exports.ɵbd=NgxTimePickerComponent,exports.ɵbc=NgxTimePickerModule,exports.ɵm=RemoteSelectComponent,exports.ɵl=RemoteSelectModule,exports.ɵe=SelectDropdownComponent,exports.ɵf=STYLE$1,exports.ɵb=SELECT_VALUE_ACCESSOR,exports.ɵc=SelectComponent,exports.ɵd=STYLE,exports.ɵa=SelectModule,exports.ɵw=FilePreviewComponent,exports.ɵv=QuestionControlComponent,exports.ɵx=RemoteAnswerComponent,exports.ɵu=EncounterContainerComponent,exports.ɵs=EncounterViewerComponent,exports.ɵr=EncounterViewerModule,exports.ɵt=EncounterViewerService,exports.ɵbi=HistoricalValueDirective,exports.ɵbk=ErrorRendererComponent,exports.ɵbm=ExpressionRunner,exports.ɵbl=HidersDisablersFactory,exports.ɵbo=AlertsFactory,exports.ɵbe=FormRendererComponent,exports.ɵbf=DEFAULT_STYLES,exports.ɵbj=HistoricalFieldHelperService,exports.ɵbn=DebugModeService,exports.ɵo=SharedModule,exports.FormEntryModule=FormEntryModule,exports.AfeFormControl=AfeFormControl,exports.AfeFormGroup=AfeFormGroup,exports.AfeFormArray=AfeFormArray,exports.EncounterPdfViewerService=EncounterPdfViewerService,exports.ControlRelationsFactory=ControlRelationsFactory,exports.FormControlService=FormControlService,exports.FormFactory=FormFactory,exports.Form=Form,exports.QuestionFactory=QuestionFactory,exports.ValidationFactory=ValidationFactory,exports.FormSchemaCompiler=FormSchemaCompiler,exports.HistoricalEncounterDataService=HistoricalEncounterDataService,exports.FormErrorsService=FormErrorsService,exports.EncounterAdapter=EncounterAdapter,exports.PersonAttribuAdapter=PersonAttribuAdapter,exports.OrderValueAdapter=OrderValueAdapter,exports.ObsValueAdapter=ObsValueAdapter,exports.ObsAdapterHelper=ObsAdapterHelper,exports.DataSources=DataSources,exports.CheckBoxQuestion=CheckBoxQuestion,exports.ConditionalValidationModel=ConditionalValidationModel,exports.DateQuestion=DateQuestion,exports.DateValidationModel=DateValidationModel,exports.FileUploadQuestion=FileUploadQuestion,exports.QuestionGroup=QuestionGroup,exports.JsExpressionValidationModel=JsExpressionValidationModel,exports.MaxValidationModel=MaxValidationModel,exports.MinValidationModel=MinValidationModel,exports.MultiSelectQuestion=MultiSelectQuestion,exports.Pair=Pair,exports.QuestionBase=QuestionBase,exports.RepeatingQuestion=RepeatingQuestion,exports.Option=Option$1,exports.SelectQuestion=SelectQuestion,exports.TestOrderQuestion=TestOrderQuestion,exports.TextAreaInputQuestion=TextAreaInputQuestion,exports.TextInputQuestion=TextInputQuestion,exports.UiSelectQuestion=UiSelectQuestion,exports.ValidationModel=ValidationModel,exports.NestedQuestion=NestedQuestion,exports.DateTimePickerModule=DateTimePickerModule,exports.NgxDateTimePickerModule=NgxDateTimePickerModule,exports.JsExpressionHelper=JsExpressionHelper,Object.defineProperty(exports,"__esModule",{value:!0})});
2
2
  //# sourceMappingURL=ampath-kenya-ngx-openmrs-formentry.umd.min.js.map