@bahmni/clinical-app 0.0.1-dev.146 → 0.0.1-dev.148

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,7 +1,7 @@
1
- import { jsx as t, jsxs as p, Fragment as Q } from "react/jsx-runtime";
2
- import { u as X, V as Y, h as J, a as h, d as Z, w as ee, $ as x, q as re, W as ae, F as oe, _ as te, y as G, P as ne, b as v, n as se, t as de, r as me, e as ie } from "./index-BJ3OpmgT.js";
3
- import { useState as U, useMemo as $, useCallback as y } from "react";
4
- const le = "_formsTableBody_1pd36_1", ce = "_customAccordianItem_1pd36_6", ue = "_formContent_1pd36_18", pe = "_formDetailsContainer_1pd36_25", be = "_observation_1pd36_30", _e = "_groupContainer_1pd36_39", fe = "_rowContainer_1pd36_43", $e = "_groupLabel_1pd36_48", Ne = "_rowLabel_1pd36_58", ge = "_rowValue_1pd36_67", he = "_groupMembers_1pd36_75", ye = "_memberRow_1pd36_81", ve = "_memberLabel_1pd36_86", Ae = "_memberValue_1pd36_94", Me = "_abnormalValue_1pd36_102", Te = "_commentSection_1pd36_110", Le = "_commentText_1pd36_116", Ce = "_nestedGroup_1pd36_125", De = "_nestedGroupLabel_1pd36_132", Oe = "_nestedGroupMembers_1pd36_141", o = {
1
+ import { jsx as t, jsxs as p, Fragment as W } from "react/jsx-runtime";
2
+ import { u as J, H as Q, w as X, a as h, i as Z, C as ee, A as G, Y as re, G as ae, b as oe, V as te, c as U, g as ne, d as v, W as se, q as de, U as me, F as ie } from "./index-BkD8km-2.js";
3
+ import { useState as x, useMemo as N, useCallback as y } from "react";
4
+ const le = "_formsTableBody_1pd36_1", ce = "_customAccordianItem_1pd36_6", ue = "_formContent_1pd36_18", pe = "_formDetailsContainer_1pd36_25", be = "_observation_1pd36_30", _e = "_groupContainer_1pd36_39", fe = "_rowContainer_1pd36_43", Ne = "_groupLabel_1pd36_48", $e = "_rowLabel_1pd36_58", ge = "_rowValue_1pd36_67", he = "_groupMembers_1pd36_75", ye = "_memberRow_1pd36_81", ve = "_memberLabel_1pd36_86", Ae = "_memberValue_1pd36_94", Me = "_abnormalValue_1pd36_102", Te = "_commentSection_1pd36_110", Ce = "_commentText_1pd36_116", Le = "_nestedGroup_1pd36_125", De = "_nestedGroupLabel_1pd36_132", Oe = "_nestedGroupMembers_1pd36_141", o = {
5
5
  formsTableBody: le,
6
6
  customAccordianItem: ce,
7
7
  formContent: ue,
@@ -9,8 +9,8 @@ const le = "_formsTableBody_1pd36_1", ce = "_customAccordianItem_1pd36_6", ue =
9
9
  observation: be,
10
10
  groupContainer: _e,
11
11
  rowContainer: fe,
12
- groupLabel: $e,
13
- rowLabel: Ne,
12
+ groupLabel: Ne,
13
+ rowLabel: $e,
14
14
  rowValue: ge,
15
15
  groupMembers: he,
16
16
  memberRow: ye,
@@ -18,8 +18,8 @@ const le = "_formsTableBody_1pd36_1", ce = "_customAccordianItem_1pd36_6", ue =
18
18
  memberValue: Ae,
19
19
  abnormalValue: Me,
20
20
  commentSection: Te,
21
- commentText: Le,
22
- nestedGroup: Ce,
21
+ commentText: Ce,
22
+ nestedGroup: Le,
23
23
  nestedGroupLabel: De,
24
24
  nestedGroupMembers: Oe
25
25
  }, Re = "ABNORMAL", q = (e) => {
@@ -53,15 +53,15 @@ const le = "_formsTableBody_1pd36_1", ce = "_customAccordianItem_1pd36_6", ue =
53
53
  {
54
54
  className: o.nestedGroupMembers,
55
55
  "data-testid": `${c}obs-nested-group-members-${d}-${m}`,
56
- children: e.groupMembers?.map((N, g) => /* @__PURE__ */ t(
56
+ children: e.groupMembers?.map(($, g) => /* @__PURE__ */ t(
57
57
  k,
58
58
  {
59
- member: N,
59
+ member: $,
60
60
  depth: s + 1,
61
61
  memberIndex: g,
62
62
  formName: r
63
63
  },
64
- `${N.concept.uuid}`
64
+ `${$.concept.uuid}`
65
65
  ))
66
66
  }
67
67
  )
@@ -192,19 +192,19 @@ const le = "_formsTableBody_1pd36_1", ce = "_customAccordianItem_1pd36_6", ue =
192
192
  encounterUuids: s,
193
193
  config: m
194
194
  }) => {
195
- const { t: r } = X(), u = Y(), [d, c] = U(!1), [a, b] = U(null), _ = m?.numberOfVisits, N = J(
195
+ const { t: r } = J(), u = Q(), [d, c] = x(!1), [a, b] = x(null), _ = m?.numberOfVisits, $ = X(
196
196
  e,
197
197
  s
198
198
  ), {
199
199
  data: g = [],
200
- isLoading: L,
201
- isError: C,
200
+ isLoading: C,
201
+ isError: L,
202
202
  error: H
203
203
  } = h({
204
204
  queryKey: ["forms", u, e],
205
205
  queryFn: () => se(u, void 0, _),
206
- enabled: !!u && !N
207
- }), D = $(() => !s || s.length === 0 ? g : g.filter(
206
+ enabled: !!u && !$
207
+ }), D = N(() => !s || s.length === 0 ? g : g.filter(
208
208
  (n) => s.includes(n.encounterUuid)
209
209
  ), [g, s]), { data: O = [] } = h({
210
210
  queryKey: ["observationForms"],
@@ -212,12 +212,12 @@ const le = "_formsTableBody_1pd36_1", ce = "_customAccordianItem_1pd36_6", ue =
212
212
  }), R = y(
213
213
  (n) => O.find((l) => l.name === n)?.uuid,
214
214
  [O]
215
- ), A = $(() => {
215
+ ), A = N(() => {
216
216
  if (a)
217
217
  return R(a.formName);
218
218
  }, [a, R]), {
219
219
  data: we,
220
- isLoading: P,
220
+ isLoading: j,
221
221
  error: F
222
222
  } = h({
223
223
  queryKey: ["formMetadata", A],
@@ -225,32 +225,32 @@ const le = "_formsTableBody_1pd36_1", ce = "_customAccordianItem_1pd36_6", ue =
225
225
  enabled: !!A && d
226
226
  }), {
227
227
  data: M,
228
- isLoading: j,
228
+ isLoading: K,
229
229
  error: w
230
230
  } = h({
231
231
  queryKey: ["formsEncounter", a?.encounterUuid],
232
232
  queryFn: () => ie(a.encounterUuid, !0),
233
233
  enabled: !!a?.encounterUuid && d
234
- }), I = $(() => !M?.observations || !a?.formName ? [] : M.observations.filter(
234
+ }), I = N(() => !M?.observations || !a?.formName ? [] : M.observations.filter(
235
235
  (n) => "formFieldPath" in n && typeof n.formFieldPath == "string" && n.formFieldPath.includes(a.formName)
236
- ), [M?.observations, a?.formName]), V = $(
236
+ ), [M?.observations, a?.formName]), V = N(
237
237
  () => [
238
238
  { key: "recordedOn", header: r("FORM_RECORDED_ON") },
239
239
  { key: "recordedBy", header: r("FORM_RECORDED_BY") }
240
240
  ],
241
241
  [r]
242
- ), K = $(
242
+ ), P = N(
243
243
  () => [
244
244
  { key: "recordedOn", sortable: !0 },
245
245
  { key: "recordedBy", sortable: !0 }
246
246
  ],
247
247
  []
248
- ), E = $(() => {
248
+ ), E = N(() => {
249
249
  const n = D.reduce(
250
250
  (l, i) => {
251
251
  const f = i.formName;
252
252
  l[f] ??= [];
253
- const T = i.providers.map((W) => W.providerName).filter(Boolean).join(", ");
253
+ const T = i.providers.map((z) => z.providerName).filter(Boolean).join(", ");
254
254
  return l[f].push({
255
255
  id: i.encounterUuid,
256
256
  formName: i.formName,
@@ -272,7 +272,7 @@ const le = "_formsTableBody_1pd36_1", ce = "_customAccordianItem_1pd36_6", ue =
272
272
  ).sort((l, i) => l.formName.localeCompare(i.formName));
273
273
  }, [D, r]), S = y((n) => {
274
274
  b(n), c(!0);
275
- }, []), z = y(() => {
275
+ }, []), Y = y(() => {
276
276
  c(!1), b(null);
277
277
  }, []), B = y(
278
278
  (n, l) => {
@@ -287,15 +287,15 @@ const le = "_formsTableBody_1pd36_1", ce = "_customAccordianItem_1pd36_6", ue =
287
287
  },
288
288
  [S]
289
289
  );
290
- return /* @__PURE__ */ p(Q, { children: [
291
- /* @__PURE__ */ t("div", { "data-testid": "forms-table", children: L || C || E.length === 0 || N ? /* @__PURE__ */ t(
292
- x,
290
+ return /* @__PURE__ */ p(W, { children: [
291
+ /* @__PURE__ */ t("div", { "data-testid": "forms-table", children: C || L || E.length === 0 || $ ? /* @__PURE__ */ t(
292
+ G,
293
293
  {
294
294
  headers: V,
295
295
  ariaLabel: r("FORMS_HEADING"),
296
296
  rows: [],
297
- loading: L,
298
- errorStateMessage: C ? H?.message : void 0,
297
+ loading: C,
298
+ errorStateMessage: L ? H?.message : void 0,
299
299
  emptyStateMessage: r("FORMS_UNAVAILABLE"),
300
300
  renderCell: B,
301
301
  className: o.formsTableBody,
@@ -311,14 +311,14 @@ const le = "_formsTableBody_1pd36_1", ce = "_customAccordianItem_1pd36_6", ue =
311
311
  testId: `accordian-title-${i}`,
312
312
  open: l === 0,
313
313
  children: /* @__PURE__ */ t(
314
- x,
314
+ G,
315
315
  {
316
316
  headers: V,
317
317
  ariaLabel: r("FORMS_HEADING"),
318
318
  rows: f,
319
319
  loading: !1,
320
320
  errorStateMessage: "",
321
- sortable: K,
321
+ sortable: P,
322
322
  emptyStateMessage: r("FORMS_UNAVAILABLE"),
323
323
  renderCell: B,
324
324
  className: o.formsTableBody,
@@ -334,13 +334,13 @@ const le = "_formsTableBody_1pd36_1", ce = "_customAccordianItem_1pd36_6", ue =
334
334
  {
335
335
  id: "modalIdForActionAreaLayout",
336
336
  open: d,
337
- onRequestClose: z,
337
+ onRequestClose: Y,
338
338
  modalHeading: a.formName,
339
339
  modalLabel: `${a.recordedOn} | ${a.recordedBy}`,
340
340
  passiveModal: !0,
341
341
  size: "md",
342
342
  testId: "form-details-modal",
343
- children: /* @__PURE__ */ t("div", { className: o.formContent, children: P || j ? /* @__PURE__ */ t(te, { width: "100%", lineCount: 3 }) : F ? /* @__PURE__ */ t("div", { children: G(F).message ?? r("ERROR_FETCHING_FORM_METADATA") }) : w ? /* @__PURE__ */ t("div", { children: G(w).message ?? r("ERROR_FETCHING_FORM_DATA") }) : I.length > 0 ? /* @__PURE__ */ t("div", { className: o.formDetailsContainer, children: I.map((n, l) => /* @__PURE__ */ t(
343
+ children: /* @__PURE__ */ t("div", { className: o.formContent, children: j || K ? /* @__PURE__ */ t(te, { width: "100%", lineCount: 3 }) : F ? /* @__PURE__ */ t("div", { children: U(F).message ?? r("ERROR_FETCHING_FORM_METADATA") }) : w ? /* @__PURE__ */ t("div", { children: U(w).message ?? r("ERROR_FETCHING_FORM_DATA") }) : I.length > 0 ? /* @__PURE__ */ t("div", { className: o.formDetailsContainer, children: I.map((n, l) => /* @__PURE__ */ t(
344
344
  Fe,
345
345
  {
346
346
  observation: n,
@@ -1,5 +1,5 @@
1
- import { c, T as l, P as m, a as u, D as v, Q as i } from "./YPM2AS64-CPdvO3lJ.js";
2
- import { j as d, k as f, l as e } from "./index-BJ3OpmgT.js";
1
+ import { c, T as l, P as m, a as u, D as v, Q as i } from "./YPM2AS64-CFlM_viP.js";
2
+ import { L as d, N as f, R as e } from "./index-BkD8km-2.js";
3
3
  var p = (a) => {
4
4
  const [r, t] = c({
5
5
  prefix: "TanstackQueryDevtools"
@@ -1,5 +1,5 @@
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-CPdvO3lJ.js";
2
- import { j as v, k as C, l as e } from "./index-BJ3OpmgT.js";
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-CFlM_viP.js";
2
+ import { L as v, N as C, R as e } from "./index-BkD8km-2.js";
3
3
  var h = (t) => {
4
4
  const [r, o] = s({
5
5
  prefix: "TanstackQueryDevtools"
@@ -0,0 +1,361 @@
1
+ import { jsxs as A, jsx as m } from "react/jsx-runtime";
2
+ import { S as U, n as w, r as P, Q as q, e as V, f as K, h as j, j as z, k as G, l as X, m as J, s as _, o as C, p as W, t as Y, H as Z, v as ee, u as k, P as se, a as te, K as re, X as ie, x as ne, y as oe, A as ae, z as ue, B, J as le, D as ce, O as he, E as de, M as be, I as pe } from "./index-BkD8km-2.js";
3
+ import * as E from "react";
4
+ import { useRef as fe, useEffect as I, useMemo as T } from "react";
5
+ function $(e, s) {
6
+ const t = new Set(s);
7
+ return e.filter((i) => !t.has(i));
8
+ }
9
+ function ye(e, s, t) {
10
+ const i = e.slice(0);
11
+ return i[s] = t, i;
12
+ }
13
+ var me = class extends U {
14
+ #r;
15
+ #e;
16
+ #i;
17
+ #n;
18
+ #s;
19
+ #t;
20
+ #o;
21
+ #a;
22
+ #u = [];
23
+ constructor(e, s, t) {
24
+ super(), this.#r = e, this.#n = t, this.#i = [], this.#s = [], this.#e = [], this.setQueries(s);
25
+ }
26
+ onSubscribe() {
27
+ this.listeners.size === 1 && this.#s.forEach((e) => {
28
+ e.subscribe((s) => {
29
+ this.#d(e, s);
30
+ });
31
+ });
32
+ }
33
+ onUnsubscribe() {
34
+ this.listeners.size || this.destroy();
35
+ }
36
+ destroy() {
37
+ this.listeners = /* @__PURE__ */ new Set(), this.#s.forEach((e) => {
38
+ e.destroy();
39
+ });
40
+ }
41
+ setQueries(e, s) {
42
+ if (this.#i = e, this.#n = s, process.env.NODE_ENV !== "production") {
43
+ const t = e.map(
44
+ (i) => this.#r.defaultQueryOptions(i).queryHash
45
+ );
46
+ new Set(t).size !== t.length && console.warn(
47
+ "[QueriesObserver]: Duplicate Queries found. This might result in unexpected behavior."
48
+ );
49
+ }
50
+ w.batch(() => {
51
+ const t = this.#s, i = this.#h(this.#i);
52
+ this.#u = i, i.forEach(
53
+ (n) => n.observer.setOptions(n.defaultedQueryOptions)
54
+ );
55
+ const r = i.map((n) => n.observer), o = r.map(
56
+ (n) => n.getCurrentResult()
57
+ ), a = r.some(
58
+ (n, u) => n !== t[u]
59
+ );
60
+ t.length === r.length && !a || (this.#s = r, this.#e = o, this.hasListeners() && ($(t, r).forEach((n) => {
61
+ n.destroy();
62
+ }), $(r, t).forEach((n) => {
63
+ n.subscribe((u) => {
64
+ this.#d(n, u);
65
+ });
66
+ }), this.#b()));
67
+ });
68
+ }
69
+ getCurrentResult() {
70
+ return this.#e;
71
+ }
72
+ getQueries() {
73
+ return this.#s.map((e) => e.getCurrentQuery());
74
+ }
75
+ getObservers() {
76
+ return this.#s;
77
+ }
78
+ getOptimisticResult(e, s) {
79
+ const t = this.#h(e), i = t.map(
80
+ (r) => r.observer.getOptimisticResult(r.defaultedQueryOptions)
81
+ );
82
+ return [
83
+ i,
84
+ (r) => this.#c(r ?? i, s),
85
+ () => this.#l(i, t)
86
+ ];
87
+ }
88
+ #l(e, s) {
89
+ return s.map((t, i) => {
90
+ const r = e[i];
91
+ return t.defaultedQueryOptions.notifyOnChangeProps ? r : t.observer.trackResult(r, (o) => {
92
+ s.forEach((a) => {
93
+ a.observer.trackProp(o);
94
+ });
95
+ });
96
+ });
97
+ }
98
+ #c(e, s) {
99
+ return s ? ((!this.#t || this.#e !== this.#a || s !== this.#o) && (this.#o = s, this.#a = this.#e, this.#t = P(
100
+ this.#t,
101
+ s(e)
102
+ )), this.#t) : e;
103
+ }
104
+ #h(e) {
105
+ const s = new Map(
106
+ this.#s.map((i) => [i.options.queryHash, i])
107
+ ), t = [];
108
+ return e.forEach((i) => {
109
+ const r = this.#r.defaultQueryOptions(i), o = s.get(r.queryHash);
110
+ o ? t.push({
111
+ defaultedQueryOptions: r,
112
+ observer: o
113
+ }) : t.push({
114
+ defaultedQueryOptions: r,
115
+ observer: new q(this.#r, r)
116
+ });
117
+ }), t;
118
+ }
119
+ #d(e, s) {
120
+ const t = this.#s.indexOf(e);
121
+ t !== -1 && (this.#e = ye(this.#e, t, s), this.#b());
122
+ }
123
+ #b() {
124
+ if (this.hasListeners()) {
125
+ const e = this.#t, s = this.#l(this.#e, this.#u), t = this.#c(s, this.#n?.combine);
126
+ e !== t && w.batch(() => {
127
+ this.listeners.forEach((i) => {
128
+ i(this.#e);
129
+ });
130
+ });
131
+ }
132
+ }
133
+ };
134
+ function ve({
135
+ queries: e,
136
+ ...s
137
+ }, t) {
138
+ const i = V(t), r = K(), o = j(), a = E.useMemo(
139
+ () => e.map((l) => {
140
+ const f = i.defaultQueryOptions(
141
+ l
142
+ );
143
+ return f._optimisticResults = r ? "isRestoring" : "optimistic", f;
144
+ }),
145
+ [e, i, r]
146
+ );
147
+ a.forEach((l) => {
148
+ z(l), G(l, o);
149
+ }), X(o);
150
+ const [n] = E.useState(
151
+ () => new me(
152
+ i,
153
+ a,
154
+ s
155
+ )
156
+ ), [u, d, y] = n.getOptimisticResult(
157
+ a,
158
+ s.combine
159
+ ), b = !r && s.subscribed !== !1;
160
+ E.useSyncExternalStore(
161
+ E.useCallback(
162
+ (l) => b ? n.subscribe(w.batchCalls(l)) : J,
163
+ [n, b]
164
+ ),
165
+ () => n.getCurrentResult(),
166
+ () => n.getCurrentResult()
167
+ ), E.useEffect(() => {
168
+ n.setQueries(
169
+ a,
170
+ s
171
+ );
172
+ }, [a, s, n]);
173
+ const S = u.some(
174
+ (l, f) => _(a[f], l)
175
+ ) ? u.flatMap((l, f) => {
176
+ const h = a[f];
177
+ if (h) {
178
+ const R = new q(i, h);
179
+ if (_(h, l))
180
+ return C(h, R, o);
181
+ W(l, r) && C(h, R, o);
182
+ }
183
+ return [];
184
+ }) : [];
185
+ if (S.length > 0)
186
+ throw Promise.all(S);
187
+ const v = u.find(
188
+ (l, f) => {
189
+ const h = a[f];
190
+ return h && Y({
191
+ result: l,
192
+ errorResetBoundary: o,
193
+ throwOnError: h.throwOnError,
194
+ query: i.getQueryCache().get(h.queryHash),
195
+ suspense: h.suspense
196
+ });
197
+ }
198
+ );
199
+ if (v?.error)
200
+ throw v.error;
201
+ return d(y());
202
+ }
203
+ const D = (e, s, t, i, r) => {
204
+ const o = le(e, s), a = o.value, n = ce(a);
205
+ let u = a;
206
+ n === "Image" && (u = /* @__PURE__ */ m(de, { imageSrc: a, alt: a, id: `${a}-img` })), n === "Video" && (u = /* @__PURE__ */ m(be, { id: `${a}-video`, videoSrc: a }));
207
+ const d = r("OBSERVATIONS_RECORDED_BY", {
208
+ provider: o.provider
209
+ }), y = e.display, b = e.observationValue?.isAbnormal ? "abnormal-obs" : "obs", p = i ? `${i}-${b}-${y}-${t}-${s}` : `${b}-${y}-${t}-${s}`;
210
+ return /* @__PURE__ */ m(
211
+ he,
212
+ {
213
+ header: o.header,
214
+ value: u,
215
+ info: d,
216
+ id: p,
217
+ testId: p,
218
+ ariaLabel: p
219
+ },
220
+ `obs-${e.id}`
221
+ );
222
+ }, Oe = (e, s, t, i, r, o) => /* @__PURE__ */ m(
223
+ B,
224
+ {
225
+ title: e.display,
226
+ id: `grouped-obs-${e.display}-${i}`,
227
+ open: t,
228
+ children: e.members?.map(
229
+ (a, n) => D(a, n, r, o, s)
230
+ )
231
+ },
232
+ `grouped-obs-${e.id}`
233
+ ), Re = ({
234
+ groupedData: e,
235
+ title: s = ""
236
+ }) => {
237
+ const { t } = k(), i = (r, o, a) => {
238
+ const n = ue(r.encounterDetails, t);
239
+ return /* @__PURE__ */ A(
240
+ B,
241
+ {
242
+ title: n,
243
+ id: `encounter-${r.encounterId}`,
244
+ open: o,
245
+ children: [
246
+ r.observations.map(
247
+ (u, d) => D(u, d, a, s, t)
248
+ ),
249
+ r.groupedObservations.map(
250
+ (u, d) => Oe(
251
+ u,
252
+ t,
253
+ o,
254
+ d,
255
+ a,
256
+ s
257
+ )
258
+ )
259
+ ]
260
+ },
261
+ `encounter-${r.encounterId}`
262
+ );
263
+ };
264
+ return /* @__PURE__ */ m(
265
+ "div",
266
+ {
267
+ id: "obs-by-encounter",
268
+ "data-testid": "obs-by-encounter-test-id",
269
+ "aria-label": "obs-by-encounter-aria-label",
270
+ children: e.map(
271
+ (r, o) => i(r, o === 0, o)
272
+ )
273
+ }
274
+ );
275
+ }, ge = "_observations_kfbhq_1", Ee = "_title_kfbhq_12", N = {
276
+ observations: ge,
277
+ title: Ee
278
+ }, Se = (e) => ["conceptUuid", e], Qe = (e, s) => ["observations", e, ...s], Ce = ({ config: e }) => {
279
+ const s = e, { conceptNames: t = [], conceptUuid: i = [] } = s, r = fe(/* @__PURE__ */ new Set()), o = Z(), { addNotification: a } = ee(), { t: n } = k(), u = ve({
280
+ queries: t.map((c) => ({
281
+ queryKey: Se(c),
282
+ queryFn: () => se(c),
283
+ enabled: !!c
284
+ }))
285
+ });
286
+ I(() => {
287
+ u.forEach((c, O) => {
288
+ if (c.isError && !r.current.has(O)) {
289
+ const F = t[O];
290
+ a({
291
+ title: n("ERROR_DEFAULT_TITLE"),
292
+ message: n("ERROR_FETCHING_CONCEPT", { conceptName: F }),
293
+ type: "error"
294
+ }), r.current.add(O);
295
+ } else c.isError || r.current.delete(O);
296
+ });
297
+ }, [u, t]);
298
+ const d = T(() => u.map((c) => c.data?.uuid).filter((c) => !!c), [u]), y = T(() => [.../* @__PURE__ */ new Set([...d, ...i])], [d, i]), b = T(() => t.length === 0 ? !0 : u.every((c) => !c.isLoading), [u, t.length]), {
299
+ data: p,
300
+ isLoading: S,
301
+ isError: v
302
+ } = te({
303
+ queryKey: Qe(o, y),
304
+ queryFn: () => pe(o, y),
305
+ enabled: !!o && y.length > 0 && b
306
+ });
307
+ I(() => {
308
+ v && a({
309
+ title: n("ERROR_DEFAULT_TITLE"),
310
+ message: n("ERROR_FETCHING_OBSERVATIONS"),
311
+ type: "error"
312
+ });
313
+ }, [v]);
314
+ const l = T(() => {
315
+ if (!p) return [];
316
+ const c = re(p), O = ie(c);
317
+ return ne(O);
318
+ }, [p]), f = [
319
+ { key: "name", header: "name" },
320
+ { key: "value", header: "value" },
321
+ { key: "form", header: "form" }
322
+ ], h = S || !b, R = v && b, L = (!p || p.entry?.length === 0 || y.length === 0) && b, M = R ? n("ERROR_FETCHING_OBSERVATIONS") : null, H = L ? n("NO_OBSERVATIONS_FOUND") : void 0, x = l.length > 0 && !h && !R, Q = s.titleTranslationKey, g = Q ? n(Q) : "";
323
+ return /* @__PURE__ */ A(
324
+ "div",
325
+ {
326
+ id: "observations",
327
+ "data-testid": Q ? `observations-${g}` : "observations",
328
+ "aria-label": "observations-aria-label",
329
+ className: N.observations,
330
+ children: [
331
+ /* @__PURE__ */ m(
332
+ oe,
333
+ {
334
+ id: "observations-title",
335
+ testId: Q ? `observations-title-${g}` : "observations-title",
336
+ title: g,
337
+ className: N.title,
338
+ children: /* @__PURE__ */ m("p", { children: g })
339
+ }
340
+ ),
341
+ x ? /* @__PURE__ */ m(Re, { groupedData: l, title: g }) : /* @__PURE__ */ m(
342
+ ae,
343
+ {
344
+ headers: f,
345
+ rows: [],
346
+ ariaLabel: n("OBSERVATIONS"),
347
+ loading: h,
348
+ errorStateMessage: M,
349
+ emptyStateMessage: H,
350
+ dataTestId: "observations-table"
351
+ }
352
+ )
353
+ ]
354
+ }
355
+ );
356
+ };
357
+ export {
358
+ Se as conceptUuidQueryKeys,
359
+ Ce as default,
360
+ Qe as observationsQueryKeys
361
+ };