@bahmni/clinical-app 0.0.1-dev.349 → 0.0.1-dev.350

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
1
  import { jsx as r, jsxs as h, Fragment as x } from "react/jsx-runtime";
2
- import { f as G, u as W, o as X, z as Y, X as J, V as Z, Q as ee, d as te } from "./index-aVz5vm6R.js";
2
+ import { m as G, u as W, o as X, R as Y, X as J, g as Z, Q as ee, a as te } from "./index-CErj4Z3U.js";
3
3
  import { useQuery as ae } from "@tanstack/react-query";
4
- import { useState as l, useCallback as _, useEffect as D, useMemo as p } from "react";
4
+ import { useState as l, useCallback as _, useEffect as I, useMemo as p } from "react";
5
5
  const ne = "DocumentsTable-module_documentsTableBody__6iR3w", oe = "DocumentsTable-module_viewAttachmentsLink__aQ1on", re = "DocumentsTable-module_documentViewerContainer__F5m8D", de = "DocumentsTable-module_attachmentItem__17KA7", se = "DocumentsTable-module_attachmentCounter__WFiI3", me = "DocumentsTable-module_attachmentError__RI4U2", ce = "DocumentsTable-module_documentIframe__ptq5I", le = "DocumentsTable-module_documentImage__KQVgS", d = {
6
6
  documentsTableBody: ne,
7
7
  viewAttachmentsLink: oe,
@@ -18,13 +18,13 @@ const ne = "DocumentsTable-module_documentsTableBody__6iR3w", oe = "DocumentsTab
18
18
  uploadedBy: "DOCUMENTS_UPLOADED_BY",
19
19
  attachments: "DOCUMENTS_ATTACHMENTS"
20
20
  };
21
- function R(a) {
21
+ function v(a) {
22
22
  return !a || a.includes(":") ? "#" : `/openmrs/auth?requested_document=/document_images/${a}`;
23
23
  }
24
- function ie(a, E) {
24
+ function ie(a, g) {
25
25
  return a.map((s) => ({
26
26
  key: s,
27
- header: E(ue[s])
27
+ header: g(ue[s])
28
28
  }));
29
29
  }
30
30
  const Te = [
@@ -33,50 +33,50 @@ const Te = [
33
33
  "attachments",
34
34
  "uploadedOn",
35
35
  "uploadedBy"
36
- ], he = /\.(jpg|jpeg|png|gif|webp|bmp|svg)$/i, B = (a) => a.attachments.length > 0 ? a.attachments : a.documentUrl ? [{ url: a.documentUrl, contentType: a.contentType }] : [], fe = ({ config: a, encounterUuids: E }) => {
36
+ ], he = /\.(jpg|jpeg|png|gif|webp|bmp|svg)$/i, B = (a) => a.attachments.length > 0 ? a.attachments : a.documentUrl ? [{ url: a.documentUrl, contentType: a.contentType }] : [], De = ({ config: a, encounterUuids: g }) => {
37
37
  const [s, w] = l(!1), [o, U] = l(
38
38
  null
39
- ), [V, I] = l(
39
+ ), [$, O] = l(
40
40
  /* @__PURE__ */ new Set()
41
- ), g = G(), { t: n } = W(), { addNotification: L } = X(), $ = Number(a?.pageSize) || 5, [O, C] = l(1), [u, k] = l($), [F, A] = l(void 0), M = _((e) => {
41
+ ), E = G(), { t: n } = W(), { addNotification: L } = X(), k = Number(a?.pageSize) || 5, [f, C] = l(1), [u, V] = l(k), [F, A] = l(void 0), M = _((e) => {
42
42
  U(e), w(!0);
43
43
  }, []), q = _(() => {
44
- w(!1), U(null), I(/* @__PURE__ */ new Set());
45
- }, []), v = _((e) => {
46
- I((t) => new Set(t).add(e));
44
+ w(!1), U(null), O(/* @__PURE__ */ new Set());
45
+ }, []), R = _((e) => {
46
+ O((t) => new Set(t).add(e));
47
47
  }, []), { data: i, isLoading: H, isError: b, error: y } = ae({
48
48
  queryKey: [
49
49
  "documents",
50
- g,
51
50
  E,
52
- O,
51
+ g,
52
+ f,
53
53
  u
54
54
  ],
55
- enabled: !!g,
55
+ enabled: !!E,
56
56
  queryFn: () => Y(
57
- g,
58
57
  E,
58
+ g,
59
59
  u,
60
- O
60
+ f
61
61
  )
62
62
  });
63
- D(() => {
63
+ I(() => {
64
64
  i && A(i.total);
65
- }, [i]), D(() => {
65
+ }, [i]), I(() => {
66
66
  C(1), A(void 0);
67
- }, [g]), D(() => {
67
+ }, [E]), I(() => {
68
68
  b && L({
69
69
  title: n("ERROR_DEFAULT_TITLE"),
70
70
  message: y?.message ?? "",
71
71
  type: "error"
72
72
  });
73
- }, [b, y, L, n]), D(() => {
73
+ }, [b, y, L, n]), I(() => {
74
74
  const e = new AbortController();
75
75
  return (async () => {
76
76
  if (!s || !o) return;
77
77
  const t = /* @__PURE__ */ new Set(), m = B(o);
78
78
  for (let c = 0; c < m.length; c++) {
79
- const S = R(m[c].url);
79
+ const S = v(m[c].url);
80
80
  try {
81
81
  (await fetch(S, {
82
82
  method: "HEAD",
@@ -86,23 +86,23 @@ const Te = [
86
86
  N instanceof Error && N.name !== "AbortError" && t.add(c);
87
87
  }
88
88
  }
89
- e.signal.aborted || I(t);
89
+ e.signal.aborted || O(t);
90
90
  })(), () => e.abort();
91
91
  }, [s, o]);
92
- const z = _(
92
+ const Q = _(
93
93
  (e, t) => {
94
- t !== u ? (k(t), C(1), A(void 0)) : C(e);
94
+ t !== u ? (V(t), C(1), A(void 0)) : C(e);
95
95
  },
96
96
  [u]
97
- ), f = p(
97
+ ), D = p(
98
98
  () => a?.fields ?? Te,
99
99
  [a?.fields]
100
- ), Q = p(() => [...i?.documents ?? []].sort((e, t) => !e.uploadedOn && !t.uploadedOn ? 0 : e.uploadedOn ? t.uploadedOn ? new Date(t.uploadedOn).getTime() - new Date(e.uploadedOn).getTime() : -1 : 1), [i]), j = p(() => ie(f, n), [f, n]), P = p(
101
- () => f.map((e) => ({
100
+ ), j = p(() => [...i?.documents ?? []].sort((e, t) => !e.uploadedOn && !t.uploadedOn ? 0 : e.uploadedOn ? t.uploadedOn ? new Date(t.uploadedOn).getTime() - new Date(e.uploadedOn).getTime() : -1 : 1), [i]), P = p(() => ie(D, n), [D, n]), z = p(
101
+ () => D.map((e) => ({
102
102
  key: e,
103
103
  sortable: e !== "attachments"
104
104
  })),
105
- [f]
105
+ [D]
106
106
  ), T = p(
107
107
  () => o ? B(o) : [],
108
108
  [o]
@@ -141,20 +141,20 @@ const Te = [
141
141
  /* @__PURE__ */ r("div", { "data-testid": "documents-table", children: /* @__PURE__ */ r(
142
142
  ee,
143
143
  {
144
- headers: j,
144
+ headers: P,
145
145
  ariaLabel: n("DOCUMENTS_TABLE_HEADING"),
146
- rows: Q,
146
+ rows: j,
147
147
  loading: H,
148
148
  errorStateMessage: b ? y?.message : null,
149
- sortable: P,
149
+ sortable: z,
150
150
  emptyStateMessage: n("DOCUMENTS_NO_RECORDS"),
151
151
  renderCell: K,
152
152
  className: d.documentsTableBody,
153
153
  dataTestId: "documents-table",
154
154
  pageSize: u,
155
155
  totalItems: F,
156
- page: O,
157
- onPageChange: z
156
+ page: f,
157
+ onPageChange: Q
158
158
  }
159
159
  ) }),
160
160
  s && o && /* @__PURE__ */ r(
@@ -169,7 +169,7 @@ const Te = [
169
169
  size: "lg",
170
170
  testId: "document-view-modal",
171
171
  children: /* @__PURE__ */ r("div", { className: d.documentViewerContainer, children: T.map((e, t) => {
172
- const m = R(e.url), c = e.contentType?.toLowerCase().includes("pdf"), S = (e.contentType?.toLowerCase().includes("image") ?? !1) || he.test(e.url ?? ""), N = V.has(t);
172
+ const m = v(e.url), c = e.contentType?.toLowerCase().includes("pdf"), S = (e.contentType?.toLowerCase().includes("image") ?? !1) || he.test(e.url ?? ""), N = $.has(t);
173
173
  return m === "#" || N ? /* @__PURE__ */ h(
174
174
  "div",
175
175
  {
@@ -202,7 +202,7 @@ const Te = [
202
202
  src: m,
203
203
  alt: o.documentIdentifier,
204
204
  className: d.documentImage,
205
- onError: () => v(t)
205
+ onError: () => R(t)
206
206
  }
207
207
  ) : /* @__PURE__ */ r(
208
208
  "iframe",
@@ -210,7 +210,7 @@ const Te = [
210
210
  src: c ? `${m}#toolbar=0` : m,
211
211
  className: d.documentIframe,
212
212
  title: o.documentIdentifier,
213
- onError: () => v(t)
213
+ onError: () => R(t)
214
214
  }
215
215
  )
216
216
  ]
@@ -223,5 +223,5 @@ const Te = [
223
223
  ] });
224
224
  };
225
225
  export {
226
- fe as default
226
+ De as default
227
227
  };
@@ -1,61 +1,61 @@
1
- import { jsx as i, jsxs as Q, Fragment as he } from "react/jsx-runtime";
2
- import { u as ge, f as pe, a as Ne, M as Oe, r as Te, C as be, w as Ee, _ as Ie, b as _e, G as Ae, c as ve, S as Fe, n as z, V as Me, E as K, e as x, X as Se, Q as P, g as Ce, Y as Re, d as Le, T as Ue, W as Be } from "./index-aVz5vm6R.js";
3
- import { useQueryClient as De, useQuery as T } from "@tanstack/react-query";
4
- import { useState as X, useMemo as d, useCallback as l } from "react";
5
- const qe = "FormsTable-module_formsTableBody__SvGha", ke = "FormsTable-module_modalHeading__wnTmA", we = "FormsTable-module_customAccordianItem__isszs", b = {
6
- formsTableBody: qe,
7
- modalHeading: ke,
1
+ import { jsx as i, jsxs as z, Fragment as ge } from "react/jsx-runtime";
2
+ import { u as ye, m as be, b as pe, M as Oe, c as Ne, L as Te, v as Ee, O as Ie, l as Ae, G as ve, d as _e, k as Fe, n as G, g as Me, E as K, e as x, X as Le, Q as P, Y as Se, J as Ce, a as Re, T as Be, f as Ue } from "./index-CErj4Z3U.js";
3
+ import { useQueryClient as De, useQuery as N } from "@tanstack/react-query";
4
+ import { useState as Y, useMemo as d, useCallback as l } from "react";
5
+ const ke = "FormsTable-module_formsTableBody__SvGha", qe = "FormsTable-module_modalHeading__wnTmA", we = "FormsTable-module_customAccordianItem__isszs", T = {
6
+ formsTableBody: ke,
7
+ modalHeading: qe,
8
8
  customAccordianItem: we
9
- }, Ve = "startConsultation", Qe = ({
10
- episodeOfCareUuids: S,
9
+ }, He = "startConsultation", ze = ({
10
+ episodeOfCareUuids: L,
11
11
  encounterUuids: u,
12
- config: Y,
13
- disableActions: W = !1,
14
- activeEncounterUuid: h = null
12
+ config: X,
13
+ disableActions: J = !1,
14
+ activeEncounterUuid: g = null
15
15
  }) => {
16
- const { t: n } = ge(), c = pe(), [g, C] = X(!1), [s, R] = X(null), {
16
+ const { t: n } = ye(), c = be(), [y, S] = Y(!1), [s, C] = Y(null), {
17
17
  numberOfVisits: Z,
18
- hideThumbnail: J = !1,
19
- forms: p
20
- } = Y ?? {}, ee = Ne(
21
- Be.EDIT_OBSERVATIONS
22
- ), { userPrivileges: N } = Oe(), E = ee && !W && !!h, L = Te(
23
- S,
18
+ hideThumbnail: W = !1,
19
+ forms: b
20
+ } = X ?? {}, ee = pe(
21
+ Ue.EDIT_OBSERVATIONS
22
+ ), { userPrivileges: p } = Oe(), E = ee && !J && !!g, R = Ne(
23
+ L,
24
24
  u
25
25
  ), re = De(), {
26
- data: U = [],
27
- isLoading: B,
26
+ data: B = [],
27
+ isLoading: U,
28
28
  isError: D,
29
29
  error: ae,
30
30
  refetch: oe
31
- } = T({
32
- queryKey: ["forms", c, S],
33
- queryFn: () => be(c, void 0, Z),
34
- enabled: !!c && !L
35
- }), q = d(() => {
36
- let e = U;
31
+ } = N({
32
+ queryKey: ["forms", c, L],
33
+ queryFn: () => Te(c, void 0, Z),
34
+ enabled: !!c && !R
35
+ }), k = d(() => {
36
+ let e = B;
37
37
  return u && u.length > 0 && (e = e.filter(
38
38
  (r) => u.includes(r.encounterUuid)
39
- )), Array.isArray(p) && p.length > 0 && (e = e.filter(
40
- (r) => p.some((a) => a.toLowerCase() === r.formName.toLowerCase())
39
+ )), Array.isArray(b) && b.length > 0 && (e = e.filter(
40
+ (r) => b.some((a) => a.toLowerCase() === r.formName.toLowerCase())
41
41
  )), e;
42
- }, [U, u, p]), { data: O = [] } = T({
42
+ }, [B, u, b]), { data: O = [] } = N({
43
43
  queryKey: ["observationForms"],
44
44
  queryFn: () => Ee()
45
- }), k = l(
45
+ }), q = l(
46
46
  (e) => {
47
47
  const r = O.find((o) => o.name === e);
48
48
  if (!r?.privileges || r.privileges.length === 0) return !0;
49
- if (!N || N.length === 0) return !1;
50
- const a = new Set(N.map((o) => o.name));
49
+ if (!p || p.length === 0) return !1;
50
+ const a = new Set(p.map((o) => o.name));
51
51
  return r.privileges.some(
52
52
  (o) => a.has(o.privilegeName) && o.editable
53
53
  );
54
54
  },
55
- [O, N]
55
+ [O, p]
56
56
  ), f = l(
57
- (e) => !h || e.encounterUuid !== h ? !1 : k(e.formName),
58
- [h, k]
57
+ (e) => !g || e.encounterUuid !== g ? !1 : q(e.formName),
58
+ [g, q]
59
59
  ), w = l(
60
60
  (e) => O.find((r) => r.name === e)?.uuid,
61
61
  [O]
@@ -66,28 +66,28 @@ const qe = "FormsTable-module_formsTableBody__SvGha", ke = "FormsTable-module_mo
66
66
  data: m,
67
67
  isLoading: te,
68
68
  isError: se,
69
- error: _
70
- } = T({
69
+ error: A
70
+ } = N({
71
71
  queryKey: ["formMetadata", I],
72
72
  queryFn: () => Ie(I),
73
- enabled: !!I && g
73
+ enabled: !!I && y
74
74
  }), {
75
- data: A,
75
+ data: v,
76
76
  isLoading: ne,
77
77
  isError: ie,
78
- error: v
79
- } = T({
78
+ error: _
79
+ } = N({
80
80
  queryKey: ["formsEncounterFHIR", s?.encounterUuid],
81
- queryFn: () => _e(s.encounterUuid),
82
- enabled: !!s?.encounterUuid && g
81
+ queryFn: () => Ae(s.encounterUuid),
82
+ enabled: !!s?.encounterUuid && y
83
83
  });
84
- Ae(
84
+ ve(
85
85
  (e) => {
86
86
  e.patientUUID === c && e.updatedConcepts.size > 0 && (oe(), re.invalidateQueries({ queryKey: ["formsEncounterFHIR"] }));
87
87
  },
88
88
  [c]
89
89
  );
90
- const de = d(() => !A?.entry || !s?.formName ? [] : A.entry.filter((e) => e.resource?.resourceType === "Observation").map((e) => e.resource).filter((e) => ve(e) ? Fe(e)?.toLowerCase() === s.formName.toLowerCase() : !0), [A, s?.formName]), le = d(() => {
90
+ const de = d(() => !v?.entry || !s?.formName ? [] : v.entry.filter((e) => e.resource?.resourceType === "Observation").map((e) => e.resource).filter((e) => _e(e) ? Fe(e)?.toLowerCase() === s.formName.toLowerCase() : !0), [v, s?.formName]), le = d(() => {
91
91
  if (!m?.schema) return;
92
92
  const e = [], r = (a) => {
93
93
  (a ?? []).forEach((o) => {
@@ -113,30 +113,30 @@ const qe = "FormsTable-module_formsTableBody__SvGha", ke = "FormsTable-module_mo
113
113
  null
114
114
  ), Object.keys(e).length > 0 ? e : void 0;
115
115
  }, [m]), ue = d(() => {
116
+ if (A)
117
+ return G(A).message;
116
118
  if (_)
117
- return z(_).message;
118
- if (v)
119
- return z(v).message;
120
- }, [_, v]), y = d(
119
+ return G(_).message;
120
+ }, [A, _]), h = d(
121
121
  () => [
122
122
  { key: "recordedOn", header: n("RECORDED_ON") },
123
123
  { key: "recordedBy", header: n("RECORDED_BY") }
124
124
  ],
125
125
  [n]
126
- ), V = d(
127
- () => [...y, { key: "actions", header: n("ACTIONS") }],
128
- [y, n]
126
+ ), H = d(
127
+ () => [...h, { key: "actions", header: n("ACTIONS") }],
128
+ [h, n]
129
129
  ), ce = l(
130
- (e) => E && e.some((r) => f(r)) ? V : y,
131
- [E, f, V, y]
132
- ), fe = y, ye = d(
130
+ (e) => E && e.some((r) => f(r)) ? H : h,
131
+ [E, f, H, h]
132
+ ), fe = h, he = d(
133
133
  () => [
134
134
  { key: "recordedOn", sortable: !0 },
135
135
  { key: "recordedBy", sortable: !0 }
136
136
  ],
137
137
  []
138
- ), H = d(() => {
139
- const e = q.reduce(
138
+ ), V = d(() => {
139
+ const e = k.reduce(
140
140
  (r, a) => {
141
141
  const o = a.formName;
142
142
  r[o] ??= [];
@@ -160,13 +160,13 @@ const qe = "FormsTable-module_formsTableBody__SvGha", ke = "FormsTable-module_mo
160
160
  )
161
161
  })
162
162
  ).sort((r, a) => r.formName.localeCompare(a.formName));
163
- }, [q, n]), G = l((e) => {
164
- R(e), C(!0);
163
+ }, [k, n]), Q = l((e) => {
164
+ C(e), S(!0);
165
165
  }, []), $ = l(() => {
166
- C(!1), R(null);
166
+ S(!1), C(null);
167
167
  }, []), F = l((e) => {
168
168
  globalThis.dispatchEvent(
169
- new CustomEvent(Ve, {
169
+ new CustomEvent(He, {
170
170
  detail: {
171
171
  editOnly: "observationForms",
172
172
  editTitle: "EDIT_OBSERVATION_FORM_TITLE",
@@ -180,7 +180,7 @@ const qe = "FormsTable-module_formsTableBody__SvGha", ke = "FormsTable-module_mo
180
180
  (e, r) => {
181
181
  switch (r) {
182
182
  case "recordedOn":
183
- return /* @__PURE__ */ i(Se, { onClick: () => G(e), children: e.recordedOn });
183
+ return /* @__PURE__ */ i(Le, { onClick: () => Q(e), children: e.recordedOn });
184
184
  case "recordedBy":
185
185
  return e.recordedBy;
186
186
  case "actions":
@@ -199,29 +199,29 @@ const qe = "FormsTable-module_formsTableBody__SvGha", ke = "FormsTable-module_mo
199
199
  return null;
200
200
  }
201
201
  },
202
- [G, F, f, n]
202
+ [Q, F, f, n]
203
203
  );
204
- return /* @__PURE__ */ Q(he, { children: [
205
- /* @__PURE__ */ i("div", { id: "forms-table", "data-testid": "forms-table", children: B || D || H.length === 0 || L ? /* @__PURE__ */ i(
204
+ return /* @__PURE__ */ z(ge, { children: [
205
+ /* @__PURE__ */ i("div", { id: "forms-table", "data-testid": "forms-table", children: U || D || V.length === 0 || R ? /* @__PURE__ */ i(
206
206
  P,
207
207
  {
208
208
  headers: fe,
209
209
  ariaLabel: n("FORMS_HEADING"),
210
210
  rows: [],
211
- loading: B,
211
+ loading: U,
212
212
  errorStateMessage: D ? ae?.message : void 0,
213
213
  emptyStateMessage: n("FORMS_UNAVAILABLE"),
214
214
  renderCell: j,
215
- className: b.formsTableBody,
215
+ className: T.formsTableBody,
216
216
  dataTestId: "forms-table"
217
217
  }
218
- ) : /* @__PURE__ */ i(Ce, { align: "start", children: H.map((e, r) => {
218
+ ) : /* @__PURE__ */ i(Se, { align: "start", children: V.map((e, r) => {
219
219
  const { formName: a, records: o } = e, t = ce(o);
220
220
  return /* @__PURE__ */ i(
221
- Re,
221
+ Ce,
222
222
  {
223
223
  title: a,
224
- className: b.customAccordianItem,
224
+ className: T.customAccordianItem,
225
225
  testId: `accordian-title-${a}`,
226
226
  open: r === 0,
227
227
  children: /* @__PURE__ */ i(
@@ -232,10 +232,10 @@ const qe = "FormsTable-module_formsTableBody__SvGha", ke = "FormsTable-module_mo
232
232
  rows: o,
233
233
  loading: !1,
234
234
  errorStateMessage: "",
235
- sortable: ye,
235
+ sortable: he,
236
236
  emptyStateMessage: n("FORMS_UNAVAILABLE"),
237
237
  renderCell: j,
238
- className: b.formsTableBody,
238
+ className: T.formsTableBody,
239
239
  dataTestId: `forms-table-${a}`
240
240
  }
241
241
  )
@@ -243,14 +243,14 @@ const qe = "FormsTable-module_formsTableBody__SvGha", ke = "FormsTable-module_mo
243
243
  a
244
244
  );
245
245
  }) }) }),
246
- g && s && /* @__PURE__ */ i(
247
- Le,
246
+ y && s && /* @__PURE__ */ i(
247
+ Re,
248
248
  {
249
249
  id: "modalIdForActionAreaLayout",
250
250
  portalId: "main-display-area",
251
- open: g,
251
+ open: y,
252
252
  onRequestClose: $,
253
- modalHeading: /* @__PURE__ */ Q("div", { className: b.modalHeading, children: [
253
+ modalHeading: /* @__PURE__ */ z("div", { className: T.modalHeading, children: [
254
254
  /* @__PURE__ */ i("span", { children: s.formName }),
255
255
  E && f(s) && /* @__PURE__ */ i(
256
256
  K,
@@ -271,7 +271,7 @@ const qe = "FormsTable-module_formsTableBody__SvGha", ke = "FormsTable-module_mo
271
271
  size: "md",
272
272
  testId: "form-details-modal",
273
273
  children: /* @__PURE__ */ i(
274
- Ue,
274
+ Be,
275
275
  {
276
276
  observations: de,
277
277
  isLoading: te || ne,
@@ -279,7 +279,7 @@ const qe = "FormsTable-module_formsTableBody__SvGha", ke = "FormsTable-module_mo
279
279
  errorMessage: ue,
280
280
  emptyStateMessage: n("NO_FORM_DATA_AVAILABLE"),
281
281
  testIdPrefix: s.formName,
282
- hideThumbnail: J,
282
+ hideThumbnail: W,
283
283
  controlOrder: le,
284
284
  sectionMap: me
285
285
  }
@@ -289,5 +289,5 @@ const qe = "FormsTable-module_formsTableBody__SvGha", ke = "FormsTable-module_mo
289
289
  ] });
290
290
  };
291
291
  export {
292
- Qe as default
292
+ ze as default
293
293
  };
@@ -1,5 +1,5 @@
1
- import { c, T as l, P as m, a as u, D as v, Q as i } from "./YPM2AS64-CWWMfFV2.js";
2
- import { bN as d, bO as f, bP as e } from "./index-aVz5vm6R.js";
1
+ import { c, T as l, P as m, a as u, D as v, Q as i } from "./YPM2AS64-SeqWXm0n.js";
2
+ import { bN as d, bO as f, bP as e } from "./index-CErj4Z3U.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-CWWMfFV2.js";
2
- import { bN as v, bO as C, bP as e } from "./index-aVz5vm6R.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-SeqWXm0n.js";
2
+ import { bN as v, bO as C, bP as e } from "./index-CErj4Z3U.js";
3
3
  var h = (t) => {
4
4
  const [r, o] = s({
5
5
  prefix: "TanstackQueryDevtools"
@@ -1,9 +1,9 @@
1
- import { jsxs as N, jsx as u } from "react/jsx-runtime";
2
- import { f as Q, o as V, u as S, A as K, N as G, G as M, Z as j, k as w, B as x, O as H, Q as Z, $ as z, s as q, I as P, h as J, i as X, j as Y, l as W, m as ee } from "./index-aVz5vm6R.js";
1
+ import { jsxs as S, jsx as u } from "react/jsx-runtime";
2
+ import { m as V, o as K, u as N, z as k, h as G, G as j, F as z, j as M, U as P, i as w, Q as x, B as H, p as q, P as Z, q as J, r as X, I as Y, s as W, Z as ee } from "./index-CErj4Z3U.js";
3
3
  import { useQueries as ae, useQuery as te } from "@tanstack/react-query";
4
- import { useRef as se, useEffect as I, useMemo as O } from "react";
4
+ import { useRef as se, useEffect as $, useMemo as T } from "react";
5
5
  const L = (a, n, d, l, b, r) => {
6
- const t = P(a, n, b), s = t.value, o = J(s);
6
+ const t = Z(a, n, b), s = t.value, o = J(s);
7
7
  let i = s;
8
8
  o === "Image" && (i = /* @__PURE__ */ u(
9
9
  Y,
@@ -59,9 +59,9 @@ const L = (a, n, d, l, b, r) => {
59
59
  title: n = "",
60
60
  hideThumbnail: d
61
61
  }) => {
62
- const { t: l } = S(), b = (r, t, s) => {
63
- const o = z(r.encounterDetails, l);
64
- return /* @__PURE__ */ N(
62
+ const { t: l } = N(), b = (r, t, s) => {
63
+ const o = H(r.encounterDetails, l);
64
+ return /* @__PURE__ */ S(
65
65
  q,
66
66
  {
67
67
  title: o,
@@ -105,7 +105,7 @@ const L = (a, n, d, l, b, r) => {
105
105
  )
106
106
  }
107
107
  );
108
- }, ie = "Observations-module_observations__RKSyo", ne = "Observations-module_title__TJL3z", _ = {
108
+ }, ie = "Observations-module_observations__RKSyo", ne = "Observations-module_title__TJL3z", I = {
109
109
  observations: ie,
110
110
  title: ne
111
111
  }, de = (a) => ["conceptUuid", a], le = (a, n) => ["observations", a, ...n], pe = ({ config: a }) => {
@@ -113,77 +113,77 @@ const L = (a, n, d, l, b, r) => {
113
113
  conceptNames: d = [],
114
114
  conceptUuid: l = [],
115
115
  hideThumbnail: b = !1
116
- } = n, r = se(/* @__PURE__ */ new Set()), t = Q(), { addNotification: s } = V(), { t: o } = S(), i = ae({
116
+ } = n, r = se(/* @__PURE__ */ new Set()), t = V(), { addNotification: s } = K(), { t: o } = N(), i = ae({
117
117
  queries: d.map((e) => ({
118
118
  queryKey: de(e),
119
- queryFn: () => K(e),
119
+ queryFn: () => k(e),
120
120
  enabled: !!e
121
121
  }))
122
122
  });
123
- I(() => {
123
+ $(() => {
124
124
  i.forEach((e, h) => {
125
125
  if (e.isError && !r.current.has(h)) {
126
- const k = d[h];
126
+ const Q = d[h];
127
127
  s({
128
128
  title: o("ERROR_DEFAULT_TITLE"),
129
- message: o("ERROR_FETCHING_CONCEPT", { conceptName: k }),
129
+ message: o("ERROR_FETCHING_CONCEPT", { conceptName: Q }),
130
130
  type: "error"
131
131
  }), r.current.add(h);
132
132
  } else e.isError || r.current.delete(h);
133
133
  });
134
134
  }, [i, d]);
135
- const m = O(() => i.map((e) => e.data?.uuid).filter((e) => !!e), [i]), p = O(() => [.../* @__PURE__ */ new Set([...m, ...l])], [m, l]), y = O(() => d.length === 0 ? !0 : i.every((e) => !e.isLoading), [i, d.length]), {
135
+ const m = T(() => i.map((e) => e.data?.uuid).filter((e) => !!e), [i]), p = T(() => [.../* @__PURE__ */ new Set([...m, ...l])], [m, l]), y = T(() => d.length === 0 ? !0 : i.every((e) => !e.isLoading), [i, d.length]), {
136
136
  data: c,
137
- isLoading: A,
137
+ isLoading: F,
138
138
  isError: R,
139
- refetch: T
139
+ refetch: O
140
140
  } = te({
141
141
  queryKey: le(t, p),
142
142
  queryFn: () => G(t, p),
143
143
  enabled: !!t && p.length > 0 && y
144
144
  });
145
- M(
145
+ j(
146
146
  (e) => {
147
147
  e.patientUUID === t && e.updatedConcepts.size > 0 && [...e.updatedConcepts.keys()].some(
148
148
  (h) => p.includes(h)
149
- ) && T();
149
+ ) && O();
150
150
  },
151
- [t, T]
152
- ), I(() => {
151
+ [t, O]
152
+ ), $(() => {
153
153
  R && s({
154
154
  title: o("ERROR_DEFAULT_TITLE"),
155
155
  message: o("ERROR_FETCHING_OBSERVATIONS"),
156
156
  type: "error"
157
157
  });
158
158
  }, [R]);
159
- const f = O(() => {
159
+ const f = T(() => {
160
160
  if (!c) return [];
161
- const e = j(c), h = w(e);
162
- return x(h);
161
+ const e = z(c), h = M(e);
162
+ return P(h);
163
163
  }, [c]), D = [
164
164
  { key: "name", header: "name" },
165
165
  { key: "value", header: "value" },
166
166
  { key: "form", header: "form" }
167
- ], $ = A || !y, g = R && y, F = (!c || c.entry?.length === 0 || p.length === 0) && y, B = g ? o("ERROR_FETCHING_OBSERVATIONS") : null, C = F ? o("NO_OBSERVATIONS_FOUND") : void 0, U = f.length > 0 && !$ && !g, E = n.titleTranslationKey, v = E ? o(E) : "";
168
- return /* @__PURE__ */ N(
167
+ ], g = F || !y, _ = R && y, U = (!c || c.entry?.length === 0 || p.length === 0) && y, A = _ ? o("ERROR_FETCHING_OBSERVATIONS") : null, B = U ? o("NO_OBSERVATIONS_FOUND") : void 0, C = f.length > 0 && !g && !_, E = n.titleTranslationKey, v = E ? o(E) : "";
168
+ return /* @__PURE__ */ S(
169
169
  "div",
170
170
  {
171
171
  id: "observations",
172
172
  "data-testid": E ? `observations-${v}` : "observations",
173
173
  "aria-label": "observations-aria-label",
174
- className: _.observations,
174
+ className: I.observations,
175
175
  children: [
176
176
  /* @__PURE__ */ u(
177
- H,
177
+ w,
178
178
  {
179
179
  id: "observations-title",
180
180
  testId: E ? `observations-title-${v}` : "observations-title",
181
181
  title: v,
182
- className: _.title,
182
+ className: I.title,
183
183
  children: /* @__PURE__ */ u("p", { children: v })
184
184
  }
185
185
  ),
186
- U ? /* @__PURE__ */ u(
186
+ C ? /* @__PURE__ */ u(
187
187
  oe,
188
188
  {
189
189
  groupedData: f,
@@ -191,14 +191,14 @@ const L = (a, n, d, l, b, r) => {
191
191
  hideThumbnail: b
192
192
  }
193
193
  ) : /* @__PURE__ */ u(
194
- Z,
194
+ x,
195
195
  {
196
196
  headers: D,
197
197
  rows: [],
198
198
  ariaLabel: o("OBSERVATIONS"),
199
- loading: $,
200
- errorStateMessage: B,
201
- emptyStateMessage: C,
199
+ loading: g,
200
+ errorStateMessage: A,
201
+ emptyStateMessage: B,
202
202
  dataTestId: "observations-table"
203
203
  }
204
204
  )
@@ -1,4 +1,4 @@
1
- import { bQ as we, bR as z, bS as xt, bT as B, bO as q, bP as y, bU as Ro, bV as ye, bW as R, bX as _, bY as k, bZ as N, b_ as A, b$ as bs, c0 as ir, c1 as $e, c2 as U, c3 as Hn, c4 as Vn, c5 as dt, c6 as D, c7 as xs, c8 as cn, c9 as Be, ca as ws, cb as qt, cc as zt, cd as $s, ce as Cs, cf as $n, cg as Ss, ch as Nr, ci as Bt, cj as zo, ck as ks, cl as Es, cm as j, cn as Ur, co as Ms, cp as Ds, cq as sr, cr as As, cs as Ts, ct as zn, cu as Fs, cv as Is, cw as Z, cx as Ps, cy as Os } from "./index-aVz5vm6R.js";
1
+ import { bQ as we, bR as z, bS as xt, bT as B, bO as q, bP as y, bU as Ro, bV as ye, bW as R, bX as _, bY as k, bZ as N, b_ as A, b$ as bs, c0 as ir, c1 as $e, c2 as U, c3 as Hn, c4 as Vn, c5 as dt, c6 as D, c7 as xs, c8 as cn, c9 as Be, ca as ws, cb as qt, cc as zt, cd as $s, ce as Cs, cf as $n, cg as Ss, ch as Nr, ci as Bt, cj as zo, ck as ks, cl as Es, cm as j, cn as Ur, co as Ms, cp as Ds, cq as sr, cr as As, cs as Ts, ct as zn, cu as Fs, cv as Is, cw as Z, cx as Ps, cy as Os } from "./index-CErj4Z3U.js";
2
2
  var Ls = (e) => e != null, qs = (e) => e.filter(Ls);
3
3
  function _s(e) {
4
4
  return (...t) => {