@bahmni/registration-app 0.0.1-dev.181 → 0.0.1-dev.184

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,28 +1,28 @@
1
1
  import { jsx as s, jsxs as p, Fragment as P } from "react/jsx-runtime";
2
- import { u as ee, f as re, E as ae, U as te, q as oe, W as ne, F as se, H as de, a as me, D as ie, A as U, c as le, Y as ce, G as ue, y as be, Z as q, P as pe, p as fe, T as F, d as _e, e as $e, g as ge, h as ve } from "./index-BkB_GERJ.js";
3
- import { useQueryClient as he, useQuery as A } from "@tanstack/react-query";
4
- import { useState as H, useMemo as h, useCallback as R } from "react";
5
- const ye = "_formsTableBody_1pd36_1", Ne = "_customAccordianItem_1pd36_6", Ae = "_formContent_1pd36_18", Re = "_formDetailsContainer_1pd36_25", Fe = "_observation_1pd36_30", Le = "_groupContainer_1pd36_39", Ce = "_rowContainer_1pd36_43", Oe = "_groupLabel_1pd36_48", Ie = "_rowLabel_1pd36_58", Te = "_rowValue_1pd36_67", Me = "_groupMembers_1pd36_75", Ve = "_memberRow_1pd36_81", Se = "_memberLabel_1pd36_86", De = "_memberValue_1pd36_94", Ee = "_abnormalValue_1pd36_102", we = "_commentSection_1pd36_110", xe = "_commentText_1pd36_116", Be = "_nestedGroup_1pd36_125", Ge = "_nestedGroupLabel_1pd36_132", Ue = "_nestedGroupMembers_1pd36_141", o = {
6
- formsTableBody: ye,
7
- customAccordianItem: Ne,
8
- formContent: Ae,
9
- formDetailsContainer: Re,
10
- observation: Fe,
2
+ import { u as ee, M as re, i as ae, b as te, q as oe, K as ne, U as se, S as de, j as me, C as ie, a as U, f as le, m as ce, Y as ue, V as be, c as q, d as pe, P as fe, g as F, e as _e, y as $e, x as ve, h as ge, F as he } from "./index-B1XCKgec.js";
3
+ import { useQueryClient as ye, useQuery as A } from "@tanstack/react-query";
4
+ import { useState as z, useMemo as h, useCallback as C } from "react";
5
+ const Ne = "_formsTableBody_1pd36_1", Ae = "_customAccordianItem_1pd36_6", Ce = "_formContent_1pd36_18", Fe = "_formDetailsContainer_1pd36_25", Re = "_observation_1pd36_30", Le = "_groupContainer_1pd36_39", Me = "_rowContainer_1pd36_43", Oe = "_groupLabel_1pd36_48", Ve = "_rowLabel_1pd36_58", Ie = "_rowValue_1pd36_67", Se = "_groupMembers_1pd36_75", Te = "_memberRow_1pd36_81", De = "_memberLabel_1pd36_86", we = "_memberValue_1pd36_94", xe = "_abnormalValue_1pd36_102", Ee = "_commentSection_1pd36_110", Be = "_commentText_1pd36_116", Ge = "_nestedGroup_1pd36_125", Ue = "_nestedGroupLabel_1pd36_132", qe = "_nestedGroupMembers_1pd36_141", o = {
6
+ formsTableBody: Ne,
7
+ customAccordianItem: Ae,
8
+ formContent: Ce,
9
+ formDetailsContainer: Fe,
10
+ observation: Re,
11
11
  groupContainer: Le,
12
- rowContainer: Ce,
12
+ rowContainer: Me,
13
13
  groupLabel: Oe,
14
- rowLabel: Ie,
15
- rowValue: Te,
16
- groupMembers: Me,
17
- memberRow: Ve,
18
- memberLabel: Se,
19
- memberValue: De,
20
- abnormalValue: Ee,
21
- commentSection: we,
22
- commentText: xe,
23
- nestedGroup: Be,
24
- nestedGroupLabel: Ge,
25
- nestedGroupMembers: Ue
14
+ rowLabel: Ve,
15
+ rowValue: Ie,
16
+ groupMembers: Se,
17
+ memberRow: Te,
18
+ memberLabel: De,
19
+ memberValue: we,
20
+ abnormalValue: xe,
21
+ commentSection: Ee,
22
+ commentText: Be,
23
+ nestedGroup: Ge,
24
+ nestedGroupLabel: Ue,
25
+ nestedGroupMembers: qe
26
26
  }, K = (e) => {
27
27
  const r = _e(e);
28
28
  return r === "Image" ? /* @__PURE__ */ s(
@@ -32,11 +32,11 @@ const ye = "_formsTableBody_1pd36_1", Ne = "_customAccordianItem_1pd36_6", Ae =
32
32
  alt: e,
33
33
  id: `${e}-img`
34
34
  }
35
- ) : r === "Video" ? /* @__PURE__ */ s(ge, { id: `${e}-video`, videoSrc: e }) : e;
36
- }, k = (e) => {
35
+ ) : r === "Video" ? /* @__PURE__ */ s(ve, { id: `${e}-video`, videoSrc: e }) : r === "PDF" ? /* @__PURE__ */ s(ge, { id: `${e}-pdf`, src: e }) : e;
36
+ }, j = (e) => {
37
37
  const r = e.observationValue?.unit, n = e.observationValue?.referenceRange?.low?.value, a = e.observationValue?.referenceRange?.high?.value, d = n != null, c = a != null, m = d && c ? ` (${n} - ${a})` : d ? ` (>${n})` : c ? ` (<${a})` : "", t = e.observationValue?.isAbnormal === !0;
38
38
  return { units: r, rangeString: m, isAbnormal: t };
39
- }, j = ({
39
+ }, H = ({
40
40
  member: e,
41
41
  depth: r = 0,
42
42
  memberIndex: n = 0,
@@ -66,7 +66,7 @@ const ye = "_formsTableBody_1pd36_1", Ne = "_customAccordianItem_1pd36_6", Ae =
66
66
  className: o.nestedGroupMembers,
67
67
  "data-testid": `${t}obs-nested-group-members-${m}-${n}`,
68
68
  children: e.members?.map((y, N) => /* @__PURE__ */ s(
69
- j,
69
+ H,
70
70
  {
71
71
  member: y,
72
72
  depth: r + 1,
@@ -80,7 +80,7 @@ const ye = "_formsTableBody_1pd36_1", Ne = "_customAccordianItem_1pd36_6", Ae =
80
80
  ]
81
81
  }
82
82
  );
83
- const { units: b, rangeString: g, isAbnormal: f } = k(e), _ = e.observationValue?.value?.toString(), $ = _ ? K(_) : null;
83
+ const { units: b, rangeString: v, isAbnormal: f } = j(e), _ = e.observationValue?.value?.toString(), $ = _ ? K(_) : null;
84
84
  return /* @__PURE__ */ p(P, { children: [
85
85
  /* @__PURE__ */ p(
86
86
  "div",
@@ -99,7 +99,7 @@ const ye = "_formsTableBody_1pd36_1", Ne = "_customAccordianItem_1pd36_6", Ae =
99
99
  "data-testid": `${t}obs-member-label-${m}-${n}`,
100
100
  children: [
101
101
  m,
102
- g
102
+ v
103
103
  ]
104
104
  }
105
105
  ),
@@ -133,13 +133,13 @@ const ye = "_formsTableBody_1pd36_1", Ne = "_customAccordianItem_1pd36_6", Ae =
133
133
  }
134
134
  )
135
135
  ] });
136
- }, qe = ({
136
+ }, ze = ({
137
137
  observation: e,
138
138
  index: r,
139
139
  formName: n = "",
140
140
  comment: a
141
141
  }) => {
142
- const d = e.members && e.members.length > 0, { units: c, rangeString: m, isAbnormal: t } = k(e), b = n ? `${n}-` : "", g = e.observationValue?.value?.toString(), f = g ? K(g) : null;
142
+ const d = e.members && e.members.length > 0, { units: c, rangeString: m, isAbnormal: t } = j(e), b = n ? `${n}-` : "", v = e.observationValue?.value?.toString(), f = v ? K(v) : null;
143
143
  return /* @__PURE__ */ p(
144
144
  "div",
145
145
  {
@@ -172,7 +172,7 @@ const ye = "_formsTableBody_1pd36_1", Ne = "_customAccordianItem_1pd36_6", Ae =
172
172
  className: o.groupMembers,
173
173
  "data-testid": `${b}observation-group-members-${e.display}-${r}`,
174
174
  children: e.members?.map((_, $) => /* @__PURE__ */ s(
175
- j,
175
+ H,
176
176
  {
177
177
  member: _,
178
178
  depth: 0,
@@ -214,75 +214,75 @@ const ye = "_formsTableBody_1pd36_1", Ne = "_customAccordianItem_1pd36_6", Ae =
214
214
  },
215
215
  `${e.id}-${r}`
216
216
  );
217
- }, He = (e) => e ? e.extension?.find(
218
- (r) => r.url === ve
219
- )?.valueString : void 0, Pe = (e) => {
217
+ }, Pe = (e) => e ? e.extension?.find(
218
+ (r) => r.url === he
219
+ )?.valueString : void 0, Ke = (e) => {
220
220
  if (e)
221
221
  return e.note?.[0]?.text;
222
- }, Ke = (e, r) => e.entry?.find((n) => n.resource?.id === r)?.resource, I = (e, r) => {
223
- const n = Ke(e, r);
222
+ }, je = (e, r) => e.entry?.find((n) => n.resource?.id === r)?.resource, O = (e, r) => {
223
+ const n = je(e, r);
224
224
  return n ? {
225
- formFieldPath: He(n),
226
- comment: Pe(n)
225
+ formFieldPath: Pe(n),
226
+ comment: Ke(n)
227
227
  } : {};
228
- }, ke = (e, r) => {
228
+ }, He = (e, r) => {
229
229
  if (!e?.entry || !r)
230
230
  return [];
231
231
  const n = pe(e);
232
232
  return [
233
233
  ...n.observations.map((a) => {
234
- const { formFieldPath: d, comment: c } = I(
234
+ const { formFieldPath: d, comment: c } = O(
235
235
  e,
236
236
  a.id
237
237
  );
238
238
  return { obs: a, formFieldPath: d, comment: c };
239
239
  }),
240
240
  ...n.groupedObservations.flatMap((a) => {
241
- const { formFieldPath: d } = I(e, a.id);
241
+ const { formFieldPath: d } = O(e, a.id);
242
242
  return (a.members ?? []).map((c) => {
243
- const { comment: m } = I(e, c.id);
243
+ const { comment: m } = O(e, c.id);
244
244
  return { obs: c, formFieldPath: d, comment: m };
245
245
  });
246
246
  })
247
247
  ].filter(
248
248
  ({ formFieldPath: a }) => !a || a.includes(r)
249
249
  );
250
- }, ze = ({
250
+ }, Je = ({
251
251
  episodeOfCareUuids: e,
252
252
  encounterUuids: r,
253
253
  config: n
254
254
  }) => {
255
- const { t: a } = ee(), d = re(), [c, m] = H(!1), [t, b] = H(null), g = n?.numberOfVisits, f = ae(
255
+ const { t: a } = ee(), d = re(), [c, m] = z(!1), [t, b] = z(null), v = n?.numberOfVisits, f = ae(
256
256
  e,
257
257
  r
258
- ), _ = he(), {
258
+ ), _ = ye(), {
259
259
  data: $ = [],
260
260
  isLoading: y,
261
261
  isError: N,
262
- error: Q,
262
+ error: k,
263
263
  refetch: Y
264
264
  } = A({
265
265
  queryKey: ["forms", d, e],
266
- queryFn: () => te(d, void 0, g),
266
+ queryFn: () => te(d, void 0, v),
267
267
  enabled: !!d && !f
268
- }), T = h(() => !r || r.length === 0 ? $ : $.filter(
268
+ }), V = h(() => !r || r.length === 0 ? $ : $.filter(
269
269
  (i) => r.includes(i.encounterUuid)
270
- ), [$, r]), { data: M = [] } = A({
270
+ ), [$, r]), { data: I = [] } = A({
271
271
  queryKey: ["observationForms"],
272
272
  queryFn: () => oe()
273
- }), V = R(
274
- (i) => M.find((u) => u.name === i)?.uuid,
275
- [M]
276
- ), L = h(() => {
273
+ }), S = C(
274
+ (i) => I.find((u) => u.name === i)?.uuid,
275
+ [I]
276
+ ), R = h(() => {
277
277
  if (t)
278
- return V(t.formName);
279
- }, [t, V]), { isLoading: Z, error: S } = A({
280
- queryKey: ["formMetadata", L],
281
- queryFn: () => ne(L),
282
- enabled: !!L && c
278
+ return S(t.formName);
279
+ }, [t, S]), { isLoading: Q, error: T } = A({
280
+ queryKey: ["formMetadata", R],
281
+ queryFn: () => ne(R),
282
+ enabled: !!R && c
283
283
  }), {
284
- data: C,
285
- isLoading: z,
284
+ data: L,
285
+ isLoading: Z,
286
286
  error: D
287
287
  } = A({
288
288
  queryKey: ["formsEncounterFHIR", t?.encounterUuid],
@@ -295,32 +295,32 @@ const ye = "_formsTableBody_1pd36_1", Ne = "_customAccordianItem_1pd36_6", Ae =
295
295
  },
296
296
  [d]
297
297
  );
298
- const E = h(() => !C || !t?.formName ? [] : ke(
299
- C,
298
+ const w = h(() => !L || !t?.formName ? [] : He(
299
+ L,
300
300
  t.formName
301
- ), [C, t?.formName]), w = h(
301
+ ), [L, t?.formName]), x = h(
302
302
  () => [
303
303
  { key: "recordedOn", header: a("FORM_RECORDED_ON") },
304
304
  { key: "recordedBy", header: a("FORM_RECORDED_BY") }
305
305
  ],
306
306
  [a]
307
- ), W = h(
307
+ ), J = h(
308
308
  () => [
309
309
  { key: "recordedOn", sortable: !0 },
310
310
  { key: "recordedBy", sortable: !0 }
311
311
  ],
312
312
  []
313
- ), x = h(() => {
314
- const i = T.reduce(
313
+ ), E = h(() => {
314
+ const i = V.reduce(
315
315
  (u, l) => {
316
- const v = l.formName;
317
- u[v] ??= [];
318
- const O = l.providers.map((J) => J.providerName).filter(Boolean).join(", ");
319
- return u[v].push({
316
+ const g = l.formName;
317
+ u[g] ??= [];
318
+ const M = l.providers.map((X) => X.providerName).filter(Boolean).join(", ");
319
+ return u[g].push({
320
320
  id: l.encounterUuid,
321
321
  formName: l.formName,
322
322
  recordedOn: me(l.encounterDateTime, a, fe).formattedResult,
323
- recordedBy: O ?? "--",
323
+ recordedBy: M ?? "--",
324
324
  encounterDateTime: l.encounterDateTime,
325
325
  encounterUuid: l.encounterUuid
326
326
  }), u;
@@ -331,15 +331,15 @@ const ye = "_formsTableBody_1pd36_1", Ne = "_customAccordianItem_1pd36_6", Ae =
331
331
  ([u, l]) => ({
332
332
  formName: u,
333
333
  records: l.sort(
334
- (v, O) => O.encounterDateTime - v.encounterDateTime
334
+ (g, M) => M.encounterDateTime - g.encounterDateTime
335
335
  )
336
336
  })
337
337
  ).sort((u, l) => u.formName.localeCompare(l.formName));
338
- }, [T, a]), B = R((i) => {
338
+ }, [V, a]), B = C((i) => {
339
339
  b(i), m(!0);
340
- }, []), X = R(() => {
340
+ }, []), W = C(() => {
341
341
  m(!1), b(null);
342
- }, []), G = R(
342
+ }, []), G = C(
343
343
  (i, u) => {
344
344
  switch (u) {
345
345
  case "recordedOn":
@@ -353,21 +353,21 @@ const ye = "_formsTableBody_1pd36_1", Ne = "_customAccordianItem_1pd36_6", Ae =
353
353
  [B]
354
354
  );
355
355
  return /* @__PURE__ */ p(P, { children: [
356
- /* @__PURE__ */ s("div", { "data-testid": "forms-table", children: y || N || x.length === 0 || f ? /* @__PURE__ */ s(
356
+ /* @__PURE__ */ s("div", { "data-testid": "forms-table", children: y || N || E.length === 0 || f ? /* @__PURE__ */ s(
357
357
  U,
358
358
  {
359
- headers: w,
359
+ headers: x,
360
360
  ariaLabel: a("FORMS_HEADING"),
361
361
  rows: [],
362
362
  loading: y,
363
- errorStateMessage: N ? Q?.message : void 0,
363
+ errorStateMessage: N ? k?.message : void 0,
364
364
  emptyStateMessage: a("FORMS_UNAVAILABLE"),
365
365
  renderCell: G,
366
366
  className: o.formsTableBody,
367
367
  dataTestId: "forms-table"
368
368
  }
369
- ) : /* @__PURE__ */ s(le, { align: "start", children: x.map((i, u) => {
370
- const { formName: l, records: v } = i;
369
+ ) : /* @__PURE__ */ s(le, { align: "start", children: E.map((i, u) => {
370
+ const { formName: l, records: g } = i;
371
371
  return /* @__PURE__ */ s(
372
372
  ce,
373
373
  {
@@ -378,12 +378,12 @@ const ye = "_formsTableBody_1pd36_1", Ne = "_customAccordianItem_1pd36_6", Ae =
378
378
  children: /* @__PURE__ */ s(
379
379
  U,
380
380
  {
381
- headers: w,
381
+ headers: x,
382
382
  ariaLabel: a("FORMS_HEADING"),
383
- rows: v,
383
+ rows: g,
384
384
  loading: !1,
385
385
  errorStateMessage: "",
386
- sortable: W,
386
+ sortable: J,
387
387
  emptyStateMessage: a("FORMS_UNAVAILABLE"),
388
388
  renderCell: G,
389
389
  className: o.formsTableBody,
@@ -400,14 +400,14 @@ const ye = "_formsTableBody_1pd36_1", Ne = "_customAccordianItem_1pd36_6", Ae =
400
400
  id: "modalIdForActionAreaLayout",
401
401
  portalId: "main-display-area",
402
402
  open: c,
403
- onRequestClose: X,
403
+ onRequestClose: W,
404
404
  modalHeading: t.formName,
405
405
  modalLabel: `${t.recordedOn} | ${t.recordedBy}`,
406
406
  passiveModal: !0,
407
407
  size: "md",
408
408
  testId: "form-details-modal",
409
- children: /* @__PURE__ */ s("div", { className: o.formContent, children: Z || z ? /* @__PURE__ */ s(be, { width: "100%", lineCount: 3 }) : S ? /* @__PURE__ */ s("div", { children: q(S).message ?? a("ERROR_FETCHING_FORM_METADATA") }) : D ? /* @__PURE__ */ s("div", { children: q(D).message ?? a("ERROR_FETCHING_FORM_DATA") }) : E.length > 0 ? /* @__PURE__ */ s("div", { className: o.formDetailsContainer, children: E.map(({ obs: i, comment: u }, l) => /* @__PURE__ */ s(
410
- qe,
409
+ children: /* @__PURE__ */ s("div", { className: o.formContent, children: Q || Z ? /* @__PURE__ */ s(be, { width: "100%", lineCount: 3 }) : T ? /* @__PURE__ */ s("div", { children: q(T).message ?? a("ERROR_FETCHING_FORM_METADATA") }) : D ? /* @__PURE__ */ s("div", { children: q(D).message ?? a("ERROR_FETCHING_FORM_DATA") }) : w.length > 0 ? /* @__PURE__ */ s("div", { className: o.formDetailsContainer, children: w.map(({ obs: i, comment: u }, l) => /* @__PURE__ */ s(
410
+ ze,
411
411
  {
412
412
  observation: i,
413
413
  index: l,
@@ -421,5 +421,5 @@ const ye = "_formsTableBody_1pd36_1", Ne = "_customAccordianItem_1pd36_6", Ae =
421
421
  ] });
422
422
  };
423
423
  export {
424
- ze as default
424
+ Je as default
425
425
  };
@@ -1,25 +1,25 @@
1
- import { c, T as l, P as m, a as u, D as v, Q as i } from "./YPM2AS64-CvO9LW5R.js";
2
- import { l as d, m as f, n as e } from "./index-BkB_GERJ.js";
1
+ import { c, T as l, P as m, a as u, D as v, Q as i } from "./YPM2AS64-BJIc_uyE.js";
2
+ import { n as d, o as f, s as e } from "./index-B1XCKgec.js";
3
3
  var p = (a) => {
4
- const [r, t] = c({
4
+ const [r, o] = c({
5
5
  prefix: "TanstackQueryDevtools"
6
6
  }), n = d(), s = f(() => {
7
- const o = r.theme_preference || l;
8
- return o !== "system" ? o : n();
7
+ const t = r.theme_preference || l;
8
+ return t !== "system" ? t : n();
9
9
  });
10
10
  return e(i.Provider, {
11
11
  value: a,
12
12
  get children() {
13
13
  return e(m, {
14
14
  localStore: r,
15
- setLocalStore: t,
15
+ setLocalStore: o,
16
16
  get children() {
17
17
  return e(u.Provider, {
18
18
  value: s,
19
19
  get children() {
20
20
  return e(v, {
21
21
  localStore: r,
22
- setLocalStore: t
22
+ setLocalStore: o
23
23
  });
24
24
  }
25
25
  });
@@ -1,9 +1,9 @@
1
- import { c as s, T as c, P as u, a as i, b as m, C as P, Q as d } from "./YPM2AS64-CvO9LW5R.js";
2
- import { l as v, m as C, n as e } from "./index-BkB_GERJ.js";
1
+ import { c as l, T as c, P as u, a as i, b as m, C as P, Q as d } from "./YPM2AS64-BJIc_uyE.js";
2
+ import { n as v, o as C, s as e } from "./index-B1XCKgec.js";
3
3
  var h = (t) => {
4
- const [r, o] = s({
4
+ const [r, o] = l({
5
5
  prefix: "TanstackQueryDevtools"
6
- }), a = v(), l = C(() => {
6
+ }), a = v(), s = C(() => {
7
7
  const n = r.theme_preference || c;
8
8
  return n !== "system" ? n : a();
9
9
  });
@@ -16,7 +16,7 @@ var h = (t) => {
16
16
  setLocalStore: o,
17
17
  get children() {
18
18
  return e(i.Provider, {
19
- value: l,
19
+ value: s,
20
20
  get children() {
21
21
  return e(m, {
22
22
  get children() {
@@ -0,0 +1,171 @@
1
+ import { jsxs as T, jsx as l } from "react/jsx-runtime";
2
+ import { M as k, p as B, u as I, k as V, W as M, S as Q, d as x, t as H, r as K, R as G, a as j, Q as w, H as S, l as P, e as W, N as Y, y as J, x as X, h as Z } from "./index-B1XCKgec.js";
3
+ import { useQueries as ee, useQuery as te } from "@tanstack/react-query";
4
+ import { useRef as ae, useEffect as N, useMemo as h } from "react";
5
+ const C = (t, d, n, u, o) => {
6
+ const a = P(t, d), r = a.value, s = W(r);
7
+ let i = r;
8
+ s === "Image" && (i = /* @__PURE__ */ l(J, { imageSrc: r, alt: r, id: `${r}-img` })), s === "Video" && (i = /* @__PURE__ */ l(X, { id: `${r}-video`, videoSrc: r })), s === "PDF" && (i = /* @__PURE__ */ l(Z, { id: `${r}-pdf`, src: r }));
9
+ const b = o("OBSERVATIONS_RECORDED_BY", {
10
+ provider: a.provider
11
+ }), p = t.display, y = t.observationValue?.isAbnormal ? "abnormal-obs" : "obs", c = u ? `${u}-${y}-${p}-${n}-${d}` : `${y}-${p}-${n}-${d}`;
12
+ return /* @__PURE__ */ l(
13
+ Y,
14
+ {
15
+ header: a.header,
16
+ value: i,
17
+ info: b,
18
+ id: c,
19
+ testId: c,
20
+ ariaLabel: c
21
+ },
22
+ `obs-${t.id}`
23
+ );
24
+ }, re = (t, d, n, u, o, a) => /* @__PURE__ */ l(
25
+ S,
26
+ {
27
+ title: t.display,
28
+ id: `grouped-obs-${t.display}-${u}`,
29
+ open: n,
30
+ children: t.members?.map(
31
+ (r, s) => C(r, s, o, a, d)
32
+ )
33
+ },
34
+ `grouped-obs-${t.id}`
35
+ ), se = ({
36
+ groupedData: t,
37
+ title: d = ""
38
+ }) => {
39
+ const { t: n } = I(), u = (o, a, r) => {
40
+ const s = w(o.encounterDetails, n);
41
+ return /* @__PURE__ */ T(
42
+ S,
43
+ {
44
+ title: s,
45
+ id: `encounter-${o.encounterId}`,
46
+ open: a,
47
+ children: [
48
+ o.observations.map(
49
+ (i, b) => C(i, b, r, d, n)
50
+ ),
51
+ o.groupedObservations.map(
52
+ (i, b) => re(
53
+ i,
54
+ n,
55
+ a,
56
+ b,
57
+ r,
58
+ d
59
+ )
60
+ )
61
+ ]
62
+ },
63
+ `encounter-${o.encounterId}`
64
+ );
65
+ };
66
+ return /* @__PURE__ */ l(
67
+ "div",
68
+ {
69
+ id: "obs-by-encounter",
70
+ "data-testid": "obs-by-encounter-test-id",
71
+ "aria-label": "obs-by-encounter-aria-label",
72
+ children: t.map(
73
+ (o, a) => u(o, a === 0, a)
74
+ )
75
+ }
76
+ );
77
+ }, oe = "_observations_kfbhq_1", ie = "_title_kfbhq_12", $ = {
78
+ observations: oe,
79
+ title: ie
80
+ }, ne = (t) => ["conceptUuid", t], de = (t, d) => ["observations", t, ...d], pe = ({ config: t }) => {
81
+ const d = t, { conceptNames: n = [], conceptUuid: u = [] } = d, o = ae(/* @__PURE__ */ new Set()), a = k(), { addNotification: r } = B(), { t: s } = I(), i = ee({
82
+ queries: n.map((e) => ({
83
+ queryKey: ne(e),
84
+ queryFn: () => V(e),
85
+ enabled: !!e
86
+ }))
87
+ });
88
+ N(() => {
89
+ i.forEach((e, m) => {
90
+ if (e.isError && !o.current.has(m)) {
91
+ const q = n[m];
92
+ r({
93
+ title: s("ERROR_DEFAULT_TITLE"),
94
+ message: s("ERROR_FETCHING_CONCEPT", { conceptName: q }),
95
+ type: "error"
96
+ }), o.current.add(m);
97
+ } else e.isError || o.current.delete(m);
98
+ });
99
+ }, [i, n]);
100
+ const b = h(() => i.map((e) => e.data?.uuid).filter((e) => !!e), [i]), p = h(() => [.../* @__PURE__ */ new Set([...b, ...u])], [b, u]), y = h(() => n.length === 0 ? !0 : i.every((e) => !e.isLoading), [i, n.length]), {
101
+ data: c,
102
+ isLoading: D,
103
+ isError: E,
104
+ refetch: f
105
+ } = te({
106
+ queryKey: de(a, p),
107
+ queryFn: () => M(a, p),
108
+ enabled: !!a && p.length > 0 && y
109
+ });
110
+ Q(
111
+ (e) => {
112
+ e.patientUUID === a && e.updatedConcepts.size > 0 && [...e.updatedConcepts.keys()].some(
113
+ (m) => p.includes(m)
114
+ ) && f();
115
+ },
116
+ [a, f]
117
+ ), N(() => {
118
+ E && r({
119
+ title: s("ERROR_DEFAULT_TITLE"),
120
+ message: s("ERROR_FETCHING_OBSERVATIONS"),
121
+ type: "error"
122
+ });
123
+ }, [E]);
124
+ const g = h(() => {
125
+ if (!c) return [];
126
+ const e = x(c), m = H(e);
127
+ return K(m);
128
+ }, [c]), F = [
129
+ { key: "name", header: "name" },
130
+ { key: "value", header: "value" },
131
+ { key: "form", header: "form" }
132
+ ], O = D || !y, _ = E && y, z = (!c || c.entry?.length === 0 || p.length === 0) && y, A = _ ? s("ERROR_FETCHING_OBSERVATIONS") : null, L = z ? s("NO_OBSERVATIONS_FOUND") : void 0, U = g.length > 0 && !O && !_, R = d.titleTranslationKey, v = R ? s(R) : "";
133
+ return /* @__PURE__ */ T(
134
+ "div",
135
+ {
136
+ id: "observations",
137
+ "data-testid": R ? `observations-${v}` : "observations",
138
+ "aria-label": "observations-aria-label",
139
+ className: $.observations,
140
+ children: [
141
+ /* @__PURE__ */ l(
142
+ G,
143
+ {
144
+ id: "observations-title",
145
+ testId: R ? `observations-title-${v}` : "observations-title",
146
+ title: v,
147
+ className: $.title,
148
+ children: /* @__PURE__ */ l("p", { children: v })
149
+ }
150
+ ),
151
+ U ? /* @__PURE__ */ l(se, { groupedData: g, title: v }) : /* @__PURE__ */ l(
152
+ j,
153
+ {
154
+ headers: F,
155
+ rows: [],
156
+ ariaLabel: s("OBSERVATIONS"),
157
+ loading: O,
158
+ errorStateMessage: A,
159
+ emptyStateMessage: L,
160
+ dataTestId: "observations-table"
161
+ }
162
+ )
163
+ ]
164
+ }
165
+ );
166
+ };
167
+ export {
168
+ ne as conceptUuidQueryKeys,
169
+ pe as default,
170
+ de as observationsQueryKeys
171
+ };