@claudebernard/patient-profile-element 0.0.1
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.
- package/README.md +10 -0
- package/dist/custom-elements.json +823 -0
- package/dist/patient-profile.d.ts +24 -0
- package/dist/patient-profile.es.js +1017 -0
- package/package.json +146 -0
|
@@ -0,0 +1,1017 @@
|
|
|
1
|
+
import "@claudebernard/design-system";
|
|
2
|
+
const PREFIX = "claudebernard";
|
|
3
|
+
const isStrTagged = (val) => typeof val !== "string" && "strTag" in val;
|
|
4
|
+
const joinStringsAndValues = (strings, values, valueOrder) => {
|
|
5
|
+
let concat = strings[0];
|
|
6
|
+
for (let i2 = 1; i2 < strings.length; i2++) {
|
|
7
|
+
concat += values[i2 - 1];
|
|
8
|
+
concat += strings[i2];
|
|
9
|
+
}
|
|
10
|
+
return concat;
|
|
11
|
+
};
|
|
12
|
+
const defaultMsg = ((template) => isStrTagged(template) ? joinStringsAndValues(template.strings, template.values) : template);
|
|
13
|
+
let msg = defaultMsg;
|
|
14
|
+
class Deferred {
|
|
15
|
+
constructor() {
|
|
16
|
+
this.settled = false;
|
|
17
|
+
this.promise = new Promise((resolve, reject) => {
|
|
18
|
+
this._resolve = resolve;
|
|
19
|
+
this._reject = reject;
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
resolve(value) {
|
|
23
|
+
this.settled = true;
|
|
24
|
+
this._resolve(value);
|
|
25
|
+
}
|
|
26
|
+
reject(error) {
|
|
27
|
+
this.settled = true;
|
|
28
|
+
this._reject(error);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
for (let i2 = 0; i2 < 256; i2++) {
|
|
32
|
+
(i2 >> 4 & 15).toString(16) + (i2 & 15).toString(16);
|
|
33
|
+
}
|
|
34
|
+
let loading = new Deferred();
|
|
35
|
+
loading.resolve();
|
|
36
|
+
const acceptedLoincCodesForRenalClearance = [
|
|
37
|
+
"2163-4",
|
|
38
|
+
"2164-2",
|
|
39
|
+
"13441-1",
|
|
40
|
+
"13442-9",
|
|
41
|
+
"13443-7",
|
|
42
|
+
"13446-0",
|
|
43
|
+
"13447-8",
|
|
44
|
+
"13449-4",
|
|
45
|
+
"13450-2",
|
|
46
|
+
"26752-6",
|
|
47
|
+
"35591-7",
|
|
48
|
+
"35594-1",
|
|
49
|
+
"50380-5",
|
|
50
|
+
"50381-3",
|
|
51
|
+
"104805-7"
|
|
52
|
+
];
|
|
53
|
+
const acceptedLoincCodesForRenalGFR = [
|
|
54
|
+
"69405-9",
|
|
55
|
+
"70969-1"
|
|
56
|
+
];
|
|
57
|
+
const acceptedLoincCodesForRenalGFRPerBSA = [
|
|
58
|
+
"48642-3",
|
|
59
|
+
"48643-1",
|
|
60
|
+
"50044-7",
|
|
61
|
+
"50210-4",
|
|
62
|
+
"50384-7",
|
|
63
|
+
"62238-1",
|
|
64
|
+
"77147-7",
|
|
65
|
+
"78006-4",
|
|
66
|
+
"88293-6",
|
|
67
|
+
"88294-4",
|
|
68
|
+
"94677-2",
|
|
69
|
+
"96591-3",
|
|
70
|
+
"96592-1",
|
|
71
|
+
"98979-8",
|
|
72
|
+
"98980-6",
|
|
73
|
+
"102097-3"
|
|
74
|
+
];
|
|
75
|
+
function calculateBMI(weight, height) {
|
|
76
|
+
const heightInMeters = height / 100;
|
|
77
|
+
return Math.round(weight / (heightInMeters * heightInMeters) * 10) / 10;
|
|
78
|
+
}
|
|
79
|
+
function getPatientGender(bundle) {
|
|
80
|
+
const patient = bundle?.entry?.find(
|
|
81
|
+
(entry) => entry.resource?.resourceType === "Patient"
|
|
82
|
+
)?.resource;
|
|
83
|
+
if (!patient?.gender) {
|
|
84
|
+
return void 0;
|
|
85
|
+
}
|
|
86
|
+
return patient.gender === "female" ? "Femme" : patient.gender === "male" ? "Homme" : patient.gender;
|
|
87
|
+
}
|
|
88
|
+
function getPatientName(bundle) {
|
|
89
|
+
const patient = bundle?.entry?.find(
|
|
90
|
+
(entry) => entry.resource?.resourceType === "Patient"
|
|
91
|
+
)?.resource;
|
|
92
|
+
if (!patient?.name?.length || !patient?.name[0].given?.length) {
|
|
93
|
+
return void 0;
|
|
94
|
+
}
|
|
95
|
+
return `${patient.name[0].given[0]} ${patient.name[0].family}`;
|
|
96
|
+
}
|
|
97
|
+
function getPatientAge(bundle) {
|
|
98
|
+
const patient = bundle?.entry?.find(
|
|
99
|
+
(entry) => entry.resource?.resourceType === "Patient"
|
|
100
|
+
)?.resource;
|
|
101
|
+
if (!patient?.birthDate) {
|
|
102
|
+
return void 0;
|
|
103
|
+
}
|
|
104
|
+
const birthDate = new Date(patient.birthDate);
|
|
105
|
+
const today = /* @__PURE__ */ new Date();
|
|
106
|
+
let age = today.getFullYear() - birthDate.getFullYear();
|
|
107
|
+
const monthDiff = today.getMonth() - birthDate.getMonth();
|
|
108
|
+
if (monthDiff < 0 || monthDiff === 0 && today.getDate() < birthDate.getDate()) {
|
|
109
|
+
age--;
|
|
110
|
+
}
|
|
111
|
+
return age;
|
|
112
|
+
}
|
|
113
|
+
function getPatientWeight(bundle) {
|
|
114
|
+
const obs = bundle?.entry?.find(
|
|
115
|
+
(entry) => entry.resource?.resourceType === "Observation" && entry.resource.code?.coding?.some(
|
|
116
|
+
(coding) => coding.code === "29463-7"
|
|
117
|
+
)
|
|
118
|
+
)?.resource;
|
|
119
|
+
return obs?.valueQuantity?.value;
|
|
120
|
+
}
|
|
121
|
+
function getPatientWeightWithUnit(bundle) {
|
|
122
|
+
const obs = bundle?.entry?.find(
|
|
123
|
+
(entry) => entry.resource?.resourceType === "Observation" && entry.resource.code?.coding?.some(
|
|
124
|
+
(coding) => coding.code === "29463-7"
|
|
125
|
+
)
|
|
126
|
+
)?.resource;
|
|
127
|
+
return (obs?.valueQuantity?.value ? obs.valueQuantity.value.toString() : "") + (obs?.valueQuantity?.unit ? ` ${obs.valueQuantity.unit}` : "");
|
|
128
|
+
}
|
|
129
|
+
function getPatientHeight(bundle) {
|
|
130
|
+
const obs = bundle?.entry?.find(
|
|
131
|
+
(entry) => entry.resource?.resourceType === "Observation" && entry.resource.code?.coding?.some(
|
|
132
|
+
(coding) => coding.code === "8302-2"
|
|
133
|
+
)
|
|
134
|
+
)?.resource;
|
|
135
|
+
return obs?.valueQuantity?.value;
|
|
136
|
+
}
|
|
137
|
+
function getPatientHeightWithUnit(bundle) {
|
|
138
|
+
const obs = bundle?.entry?.find(
|
|
139
|
+
(entry) => entry.resource?.resourceType === "Observation" && entry.resource.code?.coding?.some(
|
|
140
|
+
(coding) => coding.code === "8302-2"
|
|
141
|
+
)
|
|
142
|
+
)?.resource;
|
|
143
|
+
return (obs?.valueQuantity?.value ? obs.valueQuantity.value.toString() : "") + (obs?.valueQuantity?.unit ? ` ${obs.valueQuantity.unit}` : "");
|
|
144
|
+
}
|
|
145
|
+
function getPatientRenalInsufficiencyStatus(bundle) {
|
|
146
|
+
const clearance = bundle?.entry?.find(
|
|
147
|
+
(entry) => entry.resource?.resourceType === "Observation" && entry.resource.code?.coding?.some(
|
|
148
|
+
(coding) => acceptedLoincCodesForRenalClearance.includes(coding.code ?? "")
|
|
149
|
+
)
|
|
150
|
+
)?.resource;
|
|
151
|
+
const gfr = bundle?.entry?.find(
|
|
152
|
+
(entry) => entry.resource?.resourceType === "Observation" && entry.resource.code?.coding?.some(
|
|
153
|
+
(coding) => acceptedLoincCodesForRenalGFR.includes(coding.code ?? "")
|
|
154
|
+
)
|
|
155
|
+
)?.resource;
|
|
156
|
+
let gfrValue;
|
|
157
|
+
if (gfr?.valueQuantity?.value) {
|
|
158
|
+
gfrValue = gfr.valueQuantity;
|
|
159
|
+
} else {
|
|
160
|
+
const gfrByBsa = bundle?.entry?.find(
|
|
161
|
+
(entry) => entry.resource?.resourceType === "Observation" && entry.resource.code?.coding?.some(
|
|
162
|
+
(coding) => acceptedLoincCodesForRenalGFRPerBSA.includes(coding.code ?? "")
|
|
163
|
+
)
|
|
164
|
+
)?.resource;
|
|
165
|
+
if (gfrByBsa?.valueQuantity?.value) {
|
|
166
|
+
const weight = getPatientWeight(bundle);
|
|
167
|
+
const height = getPatientHeight(bundle);
|
|
168
|
+
if (weight && height) {
|
|
169
|
+
const bsa = calculateBSA(height, weight);
|
|
170
|
+
gfrValue = {
|
|
171
|
+
value: normalizedGFRtoAbsolute(gfrByBsa.valueQuantity.value, bsa),
|
|
172
|
+
unit: "mL/min",
|
|
173
|
+
system: "http://unitsofmeasure.org",
|
|
174
|
+
code: "mL/min"
|
|
175
|
+
};
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
return {
|
|
180
|
+
clearance: clearance?.valueQuantity,
|
|
181
|
+
gfr: gfrValue
|
|
182
|
+
};
|
|
183
|
+
}
|
|
184
|
+
function calculateCreatinineFromClearance(bundle, results) {
|
|
185
|
+
if (results.length > 0) {
|
|
186
|
+
return;
|
|
187
|
+
}
|
|
188
|
+
const clr = getPatientRenalInsufficiencyStatus(bundle).clearance?.value;
|
|
189
|
+
const age = getPatientAge(bundle);
|
|
190
|
+
const weight = getPatientWeight(bundle);
|
|
191
|
+
const patient = bundle?.entry?.find(
|
|
192
|
+
(e2) => e2.resource?.resourceType === "Patient"
|
|
193
|
+
)?.resource;
|
|
194
|
+
const sexFactor = patient?.gender === "female" ? 0.85 : patient?.gender === "male" ? 1 : void 0;
|
|
195
|
+
if (clr && age && weight && sexFactor) {
|
|
196
|
+
const scrMgdl = round2((140 - age) * weight * sexFactor / (72 * clr));
|
|
197
|
+
results.push({
|
|
198
|
+
value: round2(mgdlToMgl(scrMgdl)),
|
|
199
|
+
unit: "mg/L",
|
|
200
|
+
system: "http://unitsofmeasure.org",
|
|
201
|
+
code: "mg/L"
|
|
202
|
+
});
|
|
203
|
+
results.push({
|
|
204
|
+
value: round2(mgdlToUmolL(scrMgdl)),
|
|
205
|
+
unit: "μmol/L",
|
|
206
|
+
system: "http://unitsofmeasure.org",
|
|
207
|
+
code: "umol/L"
|
|
208
|
+
});
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
function hasUnit(results, unitCode, unitSymbol) {
|
|
212
|
+
return results.some((q) => (q.code ?? q.unit) === unitCode) || (unitSymbol ? results.some((q) => q.unit === unitSymbol) : false);
|
|
213
|
+
}
|
|
214
|
+
function convertAndAddMissingUnits(results) {
|
|
215
|
+
const hasUmol = hasUnit(results, "umol/L", "μmol/L");
|
|
216
|
+
const hasMgl = hasUnit(results, "mg/L");
|
|
217
|
+
if (hasMgl && !hasUmol) {
|
|
218
|
+
const mgl = results.find((q) => (q.code ?? q.unit) === "mg/L").value;
|
|
219
|
+
results.push({
|
|
220
|
+
value: round2(mglToUmolL(mgl)),
|
|
221
|
+
unit: "μmol/L",
|
|
222
|
+
system: "http://unitsofmeasure.org",
|
|
223
|
+
code: "umol/L"
|
|
224
|
+
});
|
|
225
|
+
}
|
|
226
|
+
if (!hasMgl && hasUmol) {
|
|
227
|
+
const umol = results.find((q) => (q.code ?? q.unit) === "umol/L")?.value ?? results.find((q) => q.unit === "μmol/L").value;
|
|
228
|
+
results.push({
|
|
229
|
+
value: round2(umolLToMgl(umol)),
|
|
230
|
+
unit: "mg/L",
|
|
231
|
+
system: "http://unitsofmeasure.org",
|
|
232
|
+
code: "mg/L"
|
|
233
|
+
});
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
function getCreatinine(bundle) {
|
|
237
|
+
const results = [];
|
|
238
|
+
const creatinineMassObs = bundle?.entry?.find((e2) => e2.resource?.resourceType === "Observation" && e2.resource.code?.coding?.some((c2) => c2.code === "2160-0"))?.resource;
|
|
239
|
+
if (creatinineMassObs?.valueQuantity?.value !== null && creatinineMassObs?.valueQuantity?.value !== void 0) {
|
|
240
|
+
const mgdl = creatinineMassObs.valueQuantity.value;
|
|
241
|
+
results.push({
|
|
242
|
+
value: round2(mgdlToMgl(mgdl)),
|
|
243
|
+
unit: "mg/L",
|
|
244
|
+
system: "http://unitsofmeasure.org",
|
|
245
|
+
code: "mg/L"
|
|
246
|
+
});
|
|
247
|
+
}
|
|
248
|
+
const creatinineMolObs = bundle?.entry?.find((e2) => e2.resource?.resourceType === "Observation" && e2.resource.code?.coding?.some((c2) => c2.code === "15051-6"))?.resource;
|
|
249
|
+
if (creatinineMolObs?.valueQuantity?.value !== null && creatinineMolObs?.valueQuantity?.value !== void 0) {
|
|
250
|
+
results.push({
|
|
251
|
+
value: creatinineMolObs.valueQuantity.value,
|
|
252
|
+
unit: "μmol/L",
|
|
253
|
+
system: "http://unitsofmeasure.org",
|
|
254
|
+
code: "umol/L"
|
|
255
|
+
});
|
|
256
|
+
}
|
|
257
|
+
convertAndAddMissingUnits(results);
|
|
258
|
+
calculateCreatinineFromClearance(bundle, results);
|
|
259
|
+
return results;
|
|
260
|
+
}
|
|
261
|
+
function mgdlToMgl(mgdl) {
|
|
262
|
+
return mgdl * 10;
|
|
263
|
+
}
|
|
264
|
+
function mgdlToUmolL(mgdl) {
|
|
265
|
+
return mgdl * 88.4;
|
|
266
|
+
}
|
|
267
|
+
function mglToUmolL(mgl) {
|
|
268
|
+
return mgl * 8.84;
|
|
269
|
+
}
|
|
270
|
+
function umolLToMgl(umolL) {
|
|
271
|
+
return umolL / 8.84;
|
|
272
|
+
}
|
|
273
|
+
function round2(n3) {
|
|
274
|
+
return Math.round(n3 * 100) / 100;
|
|
275
|
+
}
|
|
276
|
+
function getPatientHepaticInsufficiencyStatus(bundle) {
|
|
277
|
+
const obs = bundle?.entry?.find(
|
|
278
|
+
(entry) => entry.resource?.resourceType === "Observation" && entry.resource.code?.coding?.some(
|
|
279
|
+
(coding) => coding.code === "98152-2"
|
|
280
|
+
)
|
|
281
|
+
)?.resource;
|
|
282
|
+
if (obs?.valueQuantity?.value) {
|
|
283
|
+
return childPughScore(obs?.valueQuantity?.value);
|
|
284
|
+
}
|
|
285
|
+
return "";
|
|
286
|
+
}
|
|
287
|
+
function getPatientConditions(patient) {
|
|
288
|
+
if (!patient?.entry) {
|
|
289
|
+
return [];
|
|
290
|
+
}
|
|
291
|
+
const conditions = [];
|
|
292
|
+
for (const entry of patient.entry) {
|
|
293
|
+
if (entry.resource?.resourceType === "Condition" && entry.resource.code?.text) {
|
|
294
|
+
conditions.push(entry.resource.code.text);
|
|
295
|
+
}
|
|
296
|
+
}
|
|
297
|
+
return conditions;
|
|
298
|
+
}
|
|
299
|
+
function getPatientAllergies(patient) {
|
|
300
|
+
if (!patient?.entry) {
|
|
301
|
+
return [];
|
|
302
|
+
}
|
|
303
|
+
const allergies = [];
|
|
304
|
+
for (const entry of patient.entry) {
|
|
305
|
+
if (entry.resource?.resourceType === "AllergyIntolerance" && entry.resource.code?.text) {
|
|
306
|
+
allergies.push(entry.resource.code.text);
|
|
307
|
+
}
|
|
308
|
+
}
|
|
309
|
+
return allergies;
|
|
310
|
+
}
|
|
311
|
+
function childPughScore(score) {
|
|
312
|
+
if (score < 7) {
|
|
313
|
+
return msg("Stade A");
|
|
314
|
+
} else if (score < 10) {
|
|
315
|
+
return msg("Stade B");
|
|
316
|
+
}
|
|
317
|
+
return msg("Stade C");
|
|
318
|
+
}
|
|
319
|
+
function calculateBSA(height, weight) {
|
|
320
|
+
return Math.sqrt(height * weight / 3600);
|
|
321
|
+
}
|
|
322
|
+
function normalizedGFRtoAbsolute(normalizedGFR, bsa) {
|
|
323
|
+
return Math.round(normalizedGFR * (bsa / 1.73) * 100) / 100;
|
|
324
|
+
}
|
|
325
|
+
const t$2 = globalThis, e$2 = t$2.ShadowRoot && (void 0 === t$2.ShadyCSS || t$2.ShadyCSS.nativeShadow) && "adoptedStyleSheets" in Document.prototype && "replace" in CSSStyleSheet.prototype, s$2 = Symbol(), o$4 = /* @__PURE__ */ new WeakMap();
|
|
326
|
+
let n$3 = class n {
|
|
327
|
+
constructor(t2, e2, o2) {
|
|
328
|
+
if (this._$cssResult$ = true, o2 !== s$2) throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");
|
|
329
|
+
this.cssText = t2, this.t = e2;
|
|
330
|
+
}
|
|
331
|
+
get styleSheet() {
|
|
332
|
+
let t2 = this.o;
|
|
333
|
+
const s2 = this.t;
|
|
334
|
+
if (e$2 && void 0 === t2) {
|
|
335
|
+
const e2 = void 0 !== s2 && 1 === s2.length;
|
|
336
|
+
e2 && (t2 = o$4.get(s2)), void 0 === t2 && ((this.o = t2 = new CSSStyleSheet()).replaceSync(this.cssText), e2 && o$4.set(s2, t2));
|
|
337
|
+
}
|
|
338
|
+
return t2;
|
|
339
|
+
}
|
|
340
|
+
toString() {
|
|
341
|
+
return this.cssText;
|
|
342
|
+
}
|
|
343
|
+
};
|
|
344
|
+
const r$4 = (t2) => new n$3("string" == typeof t2 ? t2 : t2 + "", void 0, s$2), i$3 = (t2, ...e2) => {
|
|
345
|
+
const o2 = 1 === t2.length ? t2[0] : e2.reduce(((e3, s2, o3) => e3 + ((t3) => {
|
|
346
|
+
if (true === t3._$cssResult$) return t3.cssText;
|
|
347
|
+
if ("number" == typeof t3) return t3;
|
|
348
|
+
throw Error("Value passed to 'css' function must be a 'css' function result: " + t3 + ". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.");
|
|
349
|
+
})(s2) + t2[o3 + 1]), t2[0]);
|
|
350
|
+
return new n$3(o2, t2, s$2);
|
|
351
|
+
}, S$1 = (s2, o2) => {
|
|
352
|
+
if (e$2) s2.adoptedStyleSheets = o2.map(((t2) => t2 instanceof CSSStyleSheet ? t2 : t2.styleSheet));
|
|
353
|
+
else for (const e2 of o2) {
|
|
354
|
+
const o3 = document.createElement("style"), n3 = t$2.litNonce;
|
|
355
|
+
void 0 !== n3 && o3.setAttribute("nonce", n3), o3.textContent = e2.cssText, s2.appendChild(o3);
|
|
356
|
+
}
|
|
357
|
+
}, c$2 = e$2 ? (t2) => t2 : (t2) => t2 instanceof CSSStyleSheet ? ((t3) => {
|
|
358
|
+
let e2 = "";
|
|
359
|
+
for (const s2 of t3.cssRules) e2 += s2.cssText;
|
|
360
|
+
return r$4(e2);
|
|
361
|
+
})(t2) : t2;
|
|
362
|
+
const { is: i$2, defineProperty: e$1, getOwnPropertyDescriptor: h$1, getOwnPropertyNames: r$3, getOwnPropertySymbols: o$3, getPrototypeOf: n$2 } = Object, a$1 = globalThis, c$1 = a$1.trustedTypes, l$1 = c$1 ? c$1.emptyScript : "", p$1 = a$1.reactiveElementPolyfillSupport, d$1 = (t2, s2) => t2, u$1 = { toAttribute(t2, s2) {
|
|
363
|
+
switch (s2) {
|
|
364
|
+
case Boolean:
|
|
365
|
+
t2 = t2 ? l$1 : null;
|
|
366
|
+
break;
|
|
367
|
+
case Object:
|
|
368
|
+
case Array:
|
|
369
|
+
t2 = null == t2 ? t2 : JSON.stringify(t2);
|
|
370
|
+
}
|
|
371
|
+
return t2;
|
|
372
|
+
}, fromAttribute(t2, s2) {
|
|
373
|
+
let i2 = t2;
|
|
374
|
+
switch (s2) {
|
|
375
|
+
case Boolean:
|
|
376
|
+
i2 = null !== t2;
|
|
377
|
+
break;
|
|
378
|
+
case Number:
|
|
379
|
+
i2 = null === t2 ? null : Number(t2);
|
|
380
|
+
break;
|
|
381
|
+
case Object:
|
|
382
|
+
case Array:
|
|
383
|
+
try {
|
|
384
|
+
i2 = JSON.parse(t2);
|
|
385
|
+
} catch (t3) {
|
|
386
|
+
i2 = null;
|
|
387
|
+
}
|
|
388
|
+
}
|
|
389
|
+
return i2;
|
|
390
|
+
} }, f$1 = (t2, s2) => !i$2(t2, s2), b = { attribute: true, type: String, converter: u$1, reflect: false, useDefault: false, hasChanged: f$1 };
|
|
391
|
+
Symbol.metadata ??= Symbol("metadata"), a$1.litPropertyMetadata ??= /* @__PURE__ */ new WeakMap();
|
|
392
|
+
let y$1 = class y extends HTMLElement {
|
|
393
|
+
static addInitializer(t2) {
|
|
394
|
+
this._$Ei(), (this.l ??= []).push(t2);
|
|
395
|
+
}
|
|
396
|
+
static get observedAttributes() {
|
|
397
|
+
return this.finalize(), this._$Eh && [...this._$Eh.keys()];
|
|
398
|
+
}
|
|
399
|
+
static createProperty(t2, s2 = b) {
|
|
400
|
+
if (s2.state && (s2.attribute = false), this._$Ei(), this.prototype.hasOwnProperty(t2) && ((s2 = Object.create(s2)).wrapped = true), this.elementProperties.set(t2, s2), !s2.noAccessor) {
|
|
401
|
+
const i2 = Symbol(), h2 = this.getPropertyDescriptor(t2, i2, s2);
|
|
402
|
+
void 0 !== h2 && e$1(this.prototype, t2, h2);
|
|
403
|
+
}
|
|
404
|
+
}
|
|
405
|
+
static getPropertyDescriptor(t2, s2, i2) {
|
|
406
|
+
const { get: e2, set: r2 } = h$1(this.prototype, t2) ?? { get() {
|
|
407
|
+
return this[s2];
|
|
408
|
+
}, set(t3) {
|
|
409
|
+
this[s2] = t3;
|
|
410
|
+
} };
|
|
411
|
+
return { get: e2, set(s3) {
|
|
412
|
+
const h2 = e2?.call(this);
|
|
413
|
+
r2?.call(this, s3), this.requestUpdate(t2, h2, i2);
|
|
414
|
+
}, configurable: true, enumerable: true };
|
|
415
|
+
}
|
|
416
|
+
static getPropertyOptions(t2) {
|
|
417
|
+
return this.elementProperties.get(t2) ?? b;
|
|
418
|
+
}
|
|
419
|
+
static _$Ei() {
|
|
420
|
+
if (this.hasOwnProperty(d$1("elementProperties"))) return;
|
|
421
|
+
const t2 = n$2(this);
|
|
422
|
+
t2.finalize(), void 0 !== t2.l && (this.l = [...t2.l]), this.elementProperties = new Map(t2.elementProperties);
|
|
423
|
+
}
|
|
424
|
+
static finalize() {
|
|
425
|
+
if (this.hasOwnProperty(d$1("finalized"))) return;
|
|
426
|
+
if (this.finalized = true, this._$Ei(), this.hasOwnProperty(d$1("properties"))) {
|
|
427
|
+
const t3 = this.properties, s2 = [...r$3(t3), ...o$3(t3)];
|
|
428
|
+
for (const i2 of s2) this.createProperty(i2, t3[i2]);
|
|
429
|
+
}
|
|
430
|
+
const t2 = this[Symbol.metadata];
|
|
431
|
+
if (null !== t2) {
|
|
432
|
+
const s2 = litPropertyMetadata.get(t2);
|
|
433
|
+
if (void 0 !== s2) for (const [t3, i2] of s2) this.elementProperties.set(t3, i2);
|
|
434
|
+
}
|
|
435
|
+
this._$Eh = /* @__PURE__ */ new Map();
|
|
436
|
+
for (const [t3, s2] of this.elementProperties) {
|
|
437
|
+
const i2 = this._$Eu(t3, s2);
|
|
438
|
+
void 0 !== i2 && this._$Eh.set(i2, t3);
|
|
439
|
+
}
|
|
440
|
+
this.elementStyles = this.finalizeStyles(this.styles);
|
|
441
|
+
}
|
|
442
|
+
static finalizeStyles(s2) {
|
|
443
|
+
const i2 = [];
|
|
444
|
+
if (Array.isArray(s2)) {
|
|
445
|
+
const e2 = new Set(s2.flat(1 / 0).reverse());
|
|
446
|
+
for (const s3 of e2) i2.unshift(c$2(s3));
|
|
447
|
+
} else void 0 !== s2 && i2.push(c$2(s2));
|
|
448
|
+
return i2;
|
|
449
|
+
}
|
|
450
|
+
static _$Eu(t2, s2) {
|
|
451
|
+
const i2 = s2.attribute;
|
|
452
|
+
return false === i2 ? void 0 : "string" == typeof i2 ? i2 : "string" == typeof t2 ? t2.toLowerCase() : void 0;
|
|
453
|
+
}
|
|
454
|
+
constructor() {
|
|
455
|
+
super(), this._$Ep = void 0, this.isUpdatePending = false, this.hasUpdated = false, this._$Em = null, this._$Ev();
|
|
456
|
+
}
|
|
457
|
+
_$Ev() {
|
|
458
|
+
this._$ES = new Promise(((t2) => this.enableUpdating = t2)), this._$AL = /* @__PURE__ */ new Map(), this._$E_(), this.requestUpdate(), this.constructor.l?.forEach(((t2) => t2(this)));
|
|
459
|
+
}
|
|
460
|
+
addController(t2) {
|
|
461
|
+
(this._$EO ??= /* @__PURE__ */ new Set()).add(t2), void 0 !== this.renderRoot && this.isConnected && t2.hostConnected?.();
|
|
462
|
+
}
|
|
463
|
+
removeController(t2) {
|
|
464
|
+
this._$EO?.delete(t2);
|
|
465
|
+
}
|
|
466
|
+
_$E_() {
|
|
467
|
+
const t2 = /* @__PURE__ */ new Map(), s2 = this.constructor.elementProperties;
|
|
468
|
+
for (const i2 of s2.keys()) this.hasOwnProperty(i2) && (t2.set(i2, this[i2]), delete this[i2]);
|
|
469
|
+
t2.size > 0 && (this._$Ep = t2);
|
|
470
|
+
}
|
|
471
|
+
createRenderRoot() {
|
|
472
|
+
const t2 = this.shadowRoot ?? this.attachShadow(this.constructor.shadowRootOptions);
|
|
473
|
+
return S$1(t2, this.constructor.elementStyles), t2;
|
|
474
|
+
}
|
|
475
|
+
connectedCallback() {
|
|
476
|
+
this.renderRoot ??= this.createRenderRoot(), this.enableUpdating(true), this._$EO?.forEach(((t2) => t2.hostConnected?.()));
|
|
477
|
+
}
|
|
478
|
+
enableUpdating(t2) {
|
|
479
|
+
}
|
|
480
|
+
disconnectedCallback() {
|
|
481
|
+
this._$EO?.forEach(((t2) => t2.hostDisconnected?.()));
|
|
482
|
+
}
|
|
483
|
+
attributeChangedCallback(t2, s2, i2) {
|
|
484
|
+
this._$AK(t2, i2);
|
|
485
|
+
}
|
|
486
|
+
_$ET(t2, s2) {
|
|
487
|
+
const i2 = this.constructor.elementProperties.get(t2), e2 = this.constructor._$Eu(t2, i2);
|
|
488
|
+
if (void 0 !== e2 && true === i2.reflect) {
|
|
489
|
+
const h2 = (void 0 !== i2.converter?.toAttribute ? i2.converter : u$1).toAttribute(s2, i2.type);
|
|
490
|
+
this._$Em = t2, null == h2 ? this.removeAttribute(e2) : this.setAttribute(e2, h2), this._$Em = null;
|
|
491
|
+
}
|
|
492
|
+
}
|
|
493
|
+
_$AK(t2, s2) {
|
|
494
|
+
const i2 = this.constructor, e2 = i2._$Eh.get(t2);
|
|
495
|
+
if (void 0 !== e2 && this._$Em !== e2) {
|
|
496
|
+
const t3 = i2.getPropertyOptions(e2), h2 = "function" == typeof t3.converter ? { fromAttribute: t3.converter } : void 0 !== t3.converter?.fromAttribute ? t3.converter : u$1;
|
|
497
|
+
this._$Em = e2;
|
|
498
|
+
const r2 = h2.fromAttribute(s2, t3.type);
|
|
499
|
+
this[e2] = r2 ?? this._$Ej?.get(e2) ?? r2, this._$Em = null;
|
|
500
|
+
}
|
|
501
|
+
}
|
|
502
|
+
requestUpdate(t2, s2, i2) {
|
|
503
|
+
if (void 0 !== t2) {
|
|
504
|
+
const e2 = this.constructor, h2 = this[t2];
|
|
505
|
+
if (i2 ??= e2.getPropertyOptions(t2), !((i2.hasChanged ?? f$1)(h2, s2) || i2.useDefault && i2.reflect && h2 === this._$Ej?.get(t2) && !this.hasAttribute(e2._$Eu(t2, i2)))) return;
|
|
506
|
+
this.C(t2, s2, i2);
|
|
507
|
+
}
|
|
508
|
+
false === this.isUpdatePending && (this._$ES = this._$EP());
|
|
509
|
+
}
|
|
510
|
+
C(t2, s2, { useDefault: i2, reflect: e2, wrapped: h2 }, r2) {
|
|
511
|
+
i2 && !(this._$Ej ??= /* @__PURE__ */ new Map()).has(t2) && (this._$Ej.set(t2, r2 ?? s2 ?? this[t2]), true !== h2 || void 0 !== r2) || (this._$AL.has(t2) || (this.hasUpdated || i2 || (s2 = void 0), this._$AL.set(t2, s2)), true === e2 && this._$Em !== t2 && (this._$Eq ??= /* @__PURE__ */ new Set()).add(t2));
|
|
512
|
+
}
|
|
513
|
+
async _$EP() {
|
|
514
|
+
this.isUpdatePending = true;
|
|
515
|
+
try {
|
|
516
|
+
await this._$ES;
|
|
517
|
+
} catch (t3) {
|
|
518
|
+
Promise.reject(t3);
|
|
519
|
+
}
|
|
520
|
+
const t2 = this.scheduleUpdate();
|
|
521
|
+
return null != t2 && await t2, !this.isUpdatePending;
|
|
522
|
+
}
|
|
523
|
+
scheduleUpdate() {
|
|
524
|
+
return this.performUpdate();
|
|
525
|
+
}
|
|
526
|
+
performUpdate() {
|
|
527
|
+
if (!this.isUpdatePending) return;
|
|
528
|
+
if (!this.hasUpdated) {
|
|
529
|
+
if (this.renderRoot ??= this.createRenderRoot(), this._$Ep) {
|
|
530
|
+
for (const [t4, s3] of this._$Ep) this[t4] = s3;
|
|
531
|
+
this._$Ep = void 0;
|
|
532
|
+
}
|
|
533
|
+
const t3 = this.constructor.elementProperties;
|
|
534
|
+
if (t3.size > 0) for (const [s3, i2] of t3) {
|
|
535
|
+
const { wrapped: t4 } = i2, e2 = this[s3];
|
|
536
|
+
true !== t4 || this._$AL.has(s3) || void 0 === e2 || this.C(s3, void 0, i2, e2);
|
|
537
|
+
}
|
|
538
|
+
}
|
|
539
|
+
let t2 = false;
|
|
540
|
+
const s2 = this._$AL;
|
|
541
|
+
try {
|
|
542
|
+
t2 = this.shouldUpdate(s2), t2 ? (this.willUpdate(s2), this._$EO?.forEach(((t3) => t3.hostUpdate?.())), this.update(s2)) : this._$EM();
|
|
543
|
+
} catch (s3) {
|
|
544
|
+
throw t2 = false, this._$EM(), s3;
|
|
545
|
+
}
|
|
546
|
+
t2 && this._$AE(s2);
|
|
547
|
+
}
|
|
548
|
+
willUpdate(t2) {
|
|
549
|
+
}
|
|
550
|
+
_$AE(t2) {
|
|
551
|
+
this._$EO?.forEach(((t3) => t3.hostUpdated?.())), this.hasUpdated || (this.hasUpdated = true, this.firstUpdated(t2)), this.updated(t2);
|
|
552
|
+
}
|
|
553
|
+
_$EM() {
|
|
554
|
+
this._$AL = /* @__PURE__ */ new Map(), this.isUpdatePending = false;
|
|
555
|
+
}
|
|
556
|
+
get updateComplete() {
|
|
557
|
+
return this.getUpdateComplete();
|
|
558
|
+
}
|
|
559
|
+
getUpdateComplete() {
|
|
560
|
+
return this._$ES;
|
|
561
|
+
}
|
|
562
|
+
shouldUpdate(t2) {
|
|
563
|
+
return true;
|
|
564
|
+
}
|
|
565
|
+
update(t2) {
|
|
566
|
+
this._$Eq &&= this._$Eq.forEach(((t3) => this._$ET(t3, this[t3]))), this._$EM();
|
|
567
|
+
}
|
|
568
|
+
updated(t2) {
|
|
569
|
+
}
|
|
570
|
+
firstUpdated(t2) {
|
|
571
|
+
}
|
|
572
|
+
};
|
|
573
|
+
y$1.elementStyles = [], y$1.shadowRootOptions = { mode: "open" }, y$1[d$1("elementProperties")] = /* @__PURE__ */ new Map(), y$1[d$1("finalized")] = /* @__PURE__ */ new Map(), p$1?.({ ReactiveElement: y$1 }), (a$1.reactiveElementVersions ??= []).push("2.1.1");
|
|
574
|
+
const t$1 = globalThis, i$1 = t$1.trustedTypes, s$1 = i$1 ? i$1.createPolicy("lit-html", { createHTML: (t2) => t2 }) : void 0, e = "$lit$", h = `lit$${Math.random().toFixed(9).slice(2)}$`, o$2 = "?" + h, n$1 = `<${o$2}>`, r$2 = document, l = () => r$2.createComment(""), c = (t2) => null === t2 || "object" != typeof t2 && "function" != typeof t2, a = Array.isArray, u = (t2) => a(t2) || "function" == typeof t2?.[Symbol.iterator], d = "[ \n\f\r]", f = /<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g, v = /-->/g, _ = />/g, m = RegExp(`>|${d}(?:([^\\s"'>=/]+)(${d}*=${d}*(?:[^
|
|
575
|
+
\f\r"'\`<>=]|("|')|))|$)`, "g"), p = /'/g, g = /"/g, $ = /^(?:script|style|textarea|title)$/i, y2 = (t2) => (i2, ...s2) => ({ _$litType$: t2, strings: i2, values: s2 }), x = y2(1), T = Symbol.for("lit-noChange"), E = Symbol.for("lit-nothing"), A = /* @__PURE__ */ new WeakMap(), C = r$2.createTreeWalker(r$2, 129);
|
|
576
|
+
function P(t2, i2) {
|
|
577
|
+
if (!a(t2) || !t2.hasOwnProperty("raw")) throw Error("invalid template strings array");
|
|
578
|
+
return void 0 !== s$1 ? s$1.createHTML(i2) : i2;
|
|
579
|
+
}
|
|
580
|
+
const V = (t2, i2) => {
|
|
581
|
+
const s2 = t2.length - 1, o2 = [];
|
|
582
|
+
let r2, l2 = 2 === i2 ? "<svg>" : 3 === i2 ? "<math>" : "", c2 = f;
|
|
583
|
+
for (let i3 = 0; i3 < s2; i3++) {
|
|
584
|
+
const s3 = t2[i3];
|
|
585
|
+
let a2, u2, d2 = -1, y3 = 0;
|
|
586
|
+
for (; y3 < s3.length && (c2.lastIndex = y3, u2 = c2.exec(s3), null !== u2); ) y3 = c2.lastIndex, c2 === f ? "!--" === u2[1] ? c2 = v : void 0 !== u2[1] ? c2 = _ : void 0 !== u2[2] ? ($.test(u2[2]) && (r2 = RegExp("</" + u2[2], "g")), c2 = m) : void 0 !== u2[3] && (c2 = m) : c2 === m ? ">" === u2[0] ? (c2 = r2 ?? f, d2 = -1) : void 0 === u2[1] ? d2 = -2 : (d2 = c2.lastIndex - u2[2].length, a2 = u2[1], c2 = void 0 === u2[3] ? m : '"' === u2[3] ? g : p) : c2 === g || c2 === p ? c2 = m : c2 === v || c2 === _ ? c2 = f : (c2 = m, r2 = void 0);
|
|
587
|
+
const x2 = c2 === m && t2[i3 + 1].startsWith("/>") ? " " : "";
|
|
588
|
+
l2 += c2 === f ? s3 + n$1 : d2 >= 0 ? (o2.push(a2), s3.slice(0, d2) + e + s3.slice(d2) + h + x2) : s3 + h + (-2 === d2 ? i3 : x2);
|
|
589
|
+
}
|
|
590
|
+
return [P(t2, l2 + (t2[s2] || "<?>") + (2 === i2 ? "</svg>" : 3 === i2 ? "</math>" : "")), o2];
|
|
591
|
+
};
|
|
592
|
+
class N {
|
|
593
|
+
constructor({ strings: t2, _$litType$: s2 }, n3) {
|
|
594
|
+
let r2;
|
|
595
|
+
this.parts = [];
|
|
596
|
+
let c2 = 0, a2 = 0;
|
|
597
|
+
const u2 = t2.length - 1, d2 = this.parts, [f2, v2] = V(t2, s2);
|
|
598
|
+
if (this.el = N.createElement(f2, n3), C.currentNode = this.el.content, 2 === s2 || 3 === s2) {
|
|
599
|
+
const t3 = this.el.content.firstChild;
|
|
600
|
+
t3.replaceWith(...t3.childNodes);
|
|
601
|
+
}
|
|
602
|
+
for (; null !== (r2 = C.nextNode()) && d2.length < u2; ) {
|
|
603
|
+
if (1 === r2.nodeType) {
|
|
604
|
+
if (r2.hasAttributes()) for (const t3 of r2.getAttributeNames()) if (t3.endsWith(e)) {
|
|
605
|
+
const i2 = v2[a2++], s3 = r2.getAttribute(t3).split(h), e2 = /([.?@])?(.*)/.exec(i2);
|
|
606
|
+
d2.push({ type: 1, index: c2, name: e2[2], strings: s3, ctor: "." === e2[1] ? H : "?" === e2[1] ? I : "@" === e2[1] ? L : k }), r2.removeAttribute(t3);
|
|
607
|
+
} else t3.startsWith(h) && (d2.push({ type: 6, index: c2 }), r2.removeAttribute(t3));
|
|
608
|
+
if ($.test(r2.tagName)) {
|
|
609
|
+
const t3 = r2.textContent.split(h), s3 = t3.length - 1;
|
|
610
|
+
if (s3 > 0) {
|
|
611
|
+
r2.textContent = i$1 ? i$1.emptyScript : "";
|
|
612
|
+
for (let i2 = 0; i2 < s3; i2++) r2.append(t3[i2], l()), C.nextNode(), d2.push({ type: 2, index: ++c2 });
|
|
613
|
+
r2.append(t3[s3], l());
|
|
614
|
+
}
|
|
615
|
+
}
|
|
616
|
+
} else if (8 === r2.nodeType) if (r2.data === o$2) d2.push({ type: 2, index: c2 });
|
|
617
|
+
else {
|
|
618
|
+
let t3 = -1;
|
|
619
|
+
for (; -1 !== (t3 = r2.data.indexOf(h, t3 + 1)); ) d2.push({ type: 7, index: c2 }), t3 += h.length - 1;
|
|
620
|
+
}
|
|
621
|
+
c2++;
|
|
622
|
+
}
|
|
623
|
+
}
|
|
624
|
+
static createElement(t2, i2) {
|
|
625
|
+
const s2 = r$2.createElement("template");
|
|
626
|
+
return s2.innerHTML = t2, s2;
|
|
627
|
+
}
|
|
628
|
+
}
|
|
629
|
+
function S(t2, i2, s2 = t2, e2) {
|
|
630
|
+
if (i2 === T) return i2;
|
|
631
|
+
let h2 = void 0 !== e2 ? s2._$Co?.[e2] : s2._$Cl;
|
|
632
|
+
const o2 = c(i2) ? void 0 : i2._$litDirective$;
|
|
633
|
+
return h2?.constructor !== o2 && (h2?._$AO?.(false), void 0 === o2 ? h2 = void 0 : (h2 = new o2(t2), h2._$AT(t2, s2, e2)), void 0 !== e2 ? (s2._$Co ??= [])[e2] = h2 : s2._$Cl = h2), void 0 !== h2 && (i2 = S(t2, h2._$AS(t2, i2.values), h2, e2)), i2;
|
|
634
|
+
}
|
|
635
|
+
class M {
|
|
636
|
+
constructor(t2, i2) {
|
|
637
|
+
this._$AV = [], this._$AN = void 0, this._$AD = t2, this._$AM = i2;
|
|
638
|
+
}
|
|
639
|
+
get parentNode() {
|
|
640
|
+
return this._$AM.parentNode;
|
|
641
|
+
}
|
|
642
|
+
get _$AU() {
|
|
643
|
+
return this._$AM._$AU;
|
|
644
|
+
}
|
|
645
|
+
u(t2) {
|
|
646
|
+
const { el: { content: i2 }, parts: s2 } = this._$AD, e2 = (t2?.creationScope ?? r$2).importNode(i2, true);
|
|
647
|
+
C.currentNode = e2;
|
|
648
|
+
let h2 = C.nextNode(), o2 = 0, n3 = 0, l2 = s2[0];
|
|
649
|
+
for (; void 0 !== l2; ) {
|
|
650
|
+
if (o2 === l2.index) {
|
|
651
|
+
let i3;
|
|
652
|
+
2 === l2.type ? i3 = new R(h2, h2.nextSibling, this, t2) : 1 === l2.type ? i3 = new l2.ctor(h2, l2.name, l2.strings, this, t2) : 6 === l2.type && (i3 = new z(h2, this, t2)), this._$AV.push(i3), l2 = s2[++n3];
|
|
653
|
+
}
|
|
654
|
+
o2 !== l2?.index && (h2 = C.nextNode(), o2++);
|
|
655
|
+
}
|
|
656
|
+
return C.currentNode = r$2, e2;
|
|
657
|
+
}
|
|
658
|
+
p(t2) {
|
|
659
|
+
let i2 = 0;
|
|
660
|
+
for (const s2 of this._$AV) void 0 !== s2 && (void 0 !== s2.strings ? (s2._$AI(t2, s2, i2), i2 += s2.strings.length - 2) : s2._$AI(t2[i2])), i2++;
|
|
661
|
+
}
|
|
662
|
+
}
|
|
663
|
+
class R {
|
|
664
|
+
get _$AU() {
|
|
665
|
+
return this._$AM?._$AU ?? this._$Cv;
|
|
666
|
+
}
|
|
667
|
+
constructor(t2, i2, s2, e2) {
|
|
668
|
+
this.type = 2, this._$AH = E, this._$AN = void 0, this._$AA = t2, this._$AB = i2, this._$AM = s2, this.options = e2, this._$Cv = e2?.isConnected ?? true;
|
|
669
|
+
}
|
|
670
|
+
get parentNode() {
|
|
671
|
+
let t2 = this._$AA.parentNode;
|
|
672
|
+
const i2 = this._$AM;
|
|
673
|
+
return void 0 !== i2 && 11 === t2?.nodeType && (t2 = i2.parentNode), t2;
|
|
674
|
+
}
|
|
675
|
+
get startNode() {
|
|
676
|
+
return this._$AA;
|
|
677
|
+
}
|
|
678
|
+
get endNode() {
|
|
679
|
+
return this._$AB;
|
|
680
|
+
}
|
|
681
|
+
_$AI(t2, i2 = this) {
|
|
682
|
+
t2 = S(this, t2, i2), c(t2) ? t2 === E || null == t2 || "" === t2 ? (this._$AH !== E && this._$AR(), this._$AH = E) : t2 !== this._$AH && t2 !== T && this._(t2) : void 0 !== t2._$litType$ ? this.$(t2) : void 0 !== t2.nodeType ? this.T(t2) : u(t2) ? this.k(t2) : this._(t2);
|
|
683
|
+
}
|
|
684
|
+
O(t2) {
|
|
685
|
+
return this._$AA.parentNode.insertBefore(t2, this._$AB);
|
|
686
|
+
}
|
|
687
|
+
T(t2) {
|
|
688
|
+
this._$AH !== t2 && (this._$AR(), this._$AH = this.O(t2));
|
|
689
|
+
}
|
|
690
|
+
_(t2) {
|
|
691
|
+
this._$AH !== E && c(this._$AH) ? this._$AA.nextSibling.data = t2 : this.T(r$2.createTextNode(t2)), this._$AH = t2;
|
|
692
|
+
}
|
|
693
|
+
$(t2) {
|
|
694
|
+
const { values: i2, _$litType$: s2 } = t2, e2 = "number" == typeof s2 ? this._$AC(t2) : (void 0 === s2.el && (s2.el = N.createElement(P(s2.h, s2.h[0]), this.options)), s2);
|
|
695
|
+
if (this._$AH?._$AD === e2) this._$AH.p(i2);
|
|
696
|
+
else {
|
|
697
|
+
const t3 = new M(e2, this), s3 = t3.u(this.options);
|
|
698
|
+
t3.p(i2), this.T(s3), this._$AH = t3;
|
|
699
|
+
}
|
|
700
|
+
}
|
|
701
|
+
_$AC(t2) {
|
|
702
|
+
let i2 = A.get(t2.strings);
|
|
703
|
+
return void 0 === i2 && A.set(t2.strings, i2 = new N(t2)), i2;
|
|
704
|
+
}
|
|
705
|
+
k(t2) {
|
|
706
|
+
a(this._$AH) || (this._$AH = [], this._$AR());
|
|
707
|
+
const i2 = this._$AH;
|
|
708
|
+
let s2, e2 = 0;
|
|
709
|
+
for (const h2 of t2) e2 === i2.length ? i2.push(s2 = new R(this.O(l()), this.O(l()), this, this.options)) : s2 = i2[e2], s2._$AI(h2), e2++;
|
|
710
|
+
e2 < i2.length && (this._$AR(s2 && s2._$AB.nextSibling, e2), i2.length = e2);
|
|
711
|
+
}
|
|
712
|
+
_$AR(t2 = this._$AA.nextSibling, i2) {
|
|
713
|
+
for (this._$AP?.(false, true, i2); t2 !== this._$AB; ) {
|
|
714
|
+
const i3 = t2.nextSibling;
|
|
715
|
+
t2.remove(), t2 = i3;
|
|
716
|
+
}
|
|
717
|
+
}
|
|
718
|
+
setConnected(t2) {
|
|
719
|
+
void 0 === this._$AM && (this._$Cv = t2, this._$AP?.(t2));
|
|
720
|
+
}
|
|
721
|
+
}
|
|
722
|
+
class k {
|
|
723
|
+
get tagName() {
|
|
724
|
+
return this.element.tagName;
|
|
725
|
+
}
|
|
726
|
+
get _$AU() {
|
|
727
|
+
return this._$AM._$AU;
|
|
728
|
+
}
|
|
729
|
+
constructor(t2, i2, s2, e2, h2) {
|
|
730
|
+
this.type = 1, this._$AH = E, this._$AN = void 0, this.element = t2, this.name = i2, this._$AM = e2, this.options = h2, s2.length > 2 || "" !== s2[0] || "" !== s2[1] ? (this._$AH = Array(s2.length - 1).fill(new String()), this.strings = s2) : this._$AH = E;
|
|
731
|
+
}
|
|
732
|
+
_$AI(t2, i2 = this, s2, e2) {
|
|
733
|
+
const h2 = this.strings;
|
|
734
|
+
let o2 = false;
|
|
735
|
+
if (void 0 === h2) t2 = S(this, t2, i2, 0), o2 = !c(t2) || t2 !== this._$AH && t2 !== T, o2 && (this._$AH = t2);
|
|
736
|
+
else {
|
|
737
|
+
const e3 = t2;
|
|
738
|
+
let n3, r2;
|
|
739
|
+
for (t2 = h2[0], n3 = 0; n3 < h2.length - 1; n3++) r2 = S(this, e3[s2 + n3], i2, n3), r2 === T && (r2 = this._$AH[n3]), o2 ||= !c(r2) || r2 !== this._$AH[n3], r2 === E ? t2 = E : t2 !== E && (t2 += (r2 ?? "") + h2[n3 + 1]), this._$AH[n3] = r2;
|
|
740
|
+
}
|
|
741
|
+
o2 && !e2 && this.j(t2);
|
|
742
|
+
}
|
|
743
|
+
j(t2) {
|
|
744
|
+
t2 === E ? this.element.removeAttribute(this.name) : this.element.setAttribute(this.name, t2 ?? "");
|
|
745
|
+
}
|
|
746
|
+
}
|
|
747
|
+
class H extends k {
|
|
748
|
+
constructor() {
|
|
749
|
+
super(...arguments), this.type = 3;
|
|
750
|
+
}
|
|
751
|
+
j(t2) {
|
|
752
|
+
this.element[this.name] = t2 === E ? void 0 : t2;
|
|
753
|
+
}
|
|
754
|
+
}
|
|
755
|
+
class I extends k {
|
|
756
|
+
constructor() {
|
|
757
|
+
super(...arguments), this.type = 4;
|
|
758
|
+
}
|
|
759
|
+
j(t2) {
|
|
760
|
+
this.element.toggleAttribute(this.name, !!t2 && t2 !== E);
|
|
761
|
+
}
|
|
762
|
+
}
|
|
763
|
+
class L extends k {
|
|
764
|
+
constructor(t2, i2, s2, e2, h2) {
|
|
765
|
+
super(t2, i2, s2, e2, h2), this.type = 5;
|
|
766
|
+
}
|
|
767
|
+
_$AI(t2, i2 = this) {
|
|
768
|
+
if ((t2 = S(this, t2, i2, 0) ?? E) === T) return;
|
|
769
|
+
const s2 = this._$AH, e2 = t2 === E && s2 !== E || t2.capture !== s2.capture || t2.once !== s2.once || t2.passive !== s2.passive, h2 = t2 !== E && (s2 === E || e2);
|
|
770
|
+
e2 && this.element.removeEventListener(this.name, this, s2), h2 && this.element.addEventListener(this.name, this, t2), this._$AH = t2;
|
|
771
|
+
}
|
|
772
|
+
handleEvent(t2) {
|
|
773
|
+
"function" == typeof this._$AH ? this._$AH.call(this.options?.host ?? this.element, t2) : this._$AH.handleEvent(t2);
|
|
774
|
+
}
|
|
775
|
+
}
|
|
776
|
+
class z {
|
|
777
|
+
constructor(t2, i2, s2) {
|
|
778
|
+
this.element = t2, this.type = 6, this._$AN = void 0, this._$AM = i2, this.options = s2;
|
|
779
|
+
}
|
|
780
|
+
get _$AU() {
|
|
781
|
+
return this._$AM._$AU;
|
|
782
|
+
}
|
|
783
|
+
_$AI(t2) {
|
|
784
|
+
S(this, t2);
|
|
785
|
+
}
|
|
786
|
+
}
|
|
787
|
+
const j = t$1.litHtmlPolyfillSupport;
|
|
788
|
+
j?.(N, R), (t$1.litHtmlVersions ??= []).push("3.3.1");
|
|
789
|
+
const B = (t2, i2, s2) => {
|
|
790
|
+
const e2 = s2?.renderBefore ?? i2;
|
|
791
|
+
let h2 = e2._$litPart$;
|
|
792
|
+
if (void 0 === h2) {
|
|
793
|
+
const t3 = s2?.renderBefore ?? null;
|
|
794
|
+
e2._$litPart$ = h2 = new R(i2.insertBefore(l(), t3), t3, void 0, s2 ?? {});
|
|
795
|
+
}
|
|
796
|
+
return h2._$AI(t2), h2;
|
|
797
|
+
};
|
|
798
|
+
const s = globalThis;
|
|
799
|
+
class i extends y$1 {
|
|
800
|
+
constructor() {
|
|
801
|
+
super(...arguments), this.renderOptions = { host: this }, this._$Do = void 0;
|
|
802
|
+
}
|
|
803
|
+
createRenderRoot() {
|
|
804
|
+
const t2 = super.createRenderRoot();
|
|
805
|
+
return this.renderOptions.renderBefore ??= t2.firstChild, t2;
|
|
806
|
+
}
|
|
807
|
+
update(t2) {
|
|
808
|
+
const r2 = this.render();
|
|
809
|
+
this.hasUpdated || (this.renderOptions.isConnected = this.isConnected), super.update(t2), this._$Do = B(r2, this.renderRoot, this.renderOptions);
|
|
810
|
+
}
|
|
811
|
+
connectedCallback() {
|
|
812
|
+
super.connectedCallback(), this._$Do?.setConnected(true);
|
|
813
|
+
}
|
|
814
|
+
disconnectedCallback() {
|
|
815
|
+
super.disconnectedCallback(), this._$Do?.setConnected(false);
|
|
816
|
+
}
|
|
817
|
+
render() {
|
|
818
|
+
return T;
|
|
819
|
+
}
|
|
820
|
+
}
|
|
821
|
+
i._$litElement$ = true, i["finalized"] = true, s.litElementHydrateSupport?.({ LitElement: i });
|
|
822
|
+
const o$1 = s.litElementPolyfillSupport;
|
|
823
|
+
o$1?.({ LitElement: i });
|
|
824
|
+
(s.litElementVersions ??= []).push("4.2.1");
|
|
825
|
+
const t = (t2) => (e2, o2) => {
|
|
826
|
+
void 0 !== o2 ? o2.addInitializer((() => {
|
|
827
|
+
customElements.define(t2, e2);
|
|
828
|
+
})) : customElements.define(t2, e2);
|
|
829
|
+
};
|
|
830
|
+
const o = { attribute: true, type: String, converter: u$1, reflect: false, hasChanged: f$1 }, r$1 = (t2 = o, e2, r2) => {
|
|
831
|
+
const { kind: n3, metadata: i2 } = r2;
|
|
832
|
+
let s2 = globalThis.litPropertyMetadata.get(i2);
|
|
833
|
+
if (void 0 === s2 && globalThis.litPropertyMetadata.set(i2, s2 = /* @__PURE__ */ new Map()), "setter" === n3 && ((t2 = Object.create(t2)).wrapped = true), s2.set(r2.name, t2), "accessor" === n3) {
|
|
834
|
+
const { name: o2 } = r2;
|
|
835
|
+
return { set(r3) {
|
|
836
|
+
const n4 = e2.get.call(this);
|
|
837
|
+
e2.set.call(this, r3), this.requestUpdate(o2, n4, t2);
|
|
838
|
+
}, init(e3) {
|
|
839
|
+
return void 0 !== e3 && this.C(o2, void 0, t2, e3), e3;
|
|
840
|
+
} };
|
|
841
|
+
}
|
|
842
|
+
if ("setter" === n3) {
|
|
843
|
+
const { name: o2 } = r2;
|
|
844
|
+
return function(r3) {
|
|
845
|
+
const n4 = this[o2];
|
|
846
|
+
e2.call(this, r3), this.requestUpdate(o2, n4, t2);
|
|
847
|
+
};
|
|
848
|
+
}
|
|
849
|
+
throw Error("Unsupported decorator location: " + n3);
|
|
850
|
+
};
|
|
851
|
+
function n2(t2) {
|
|
852
|
+
return (e2, o2) => "object" == typeof o2 ? r$1(t2, e2, o2) : ((t3, e3, o3) => {
|
|
853
|
+
const r2 = e3.hasOwnProperty(o3);
|
|
854
|
+
return e3.constructor.createProperty(o3, t3), r2 ? Object.getOwnPropertyDescriptor(e3, o3) : void 0;
|
|
855
|
+
})(t2, e2, o2);
|
|
856
|
+
}
|
|
857
|
+
function r(r2) {
|
|
858
|
+
return n2({ ...r2, state: true, attribute: false });
|
|
859
|
+
}
|
|
860
|
+
const patientProfileCSS = '@charset "UTF-8";\n.claudebernard-patient-profile {\n font-family: var(--custom-font-family, "Ubuntu"), sans-serif;\n border: 1px solid var(--bcbd-border-gray-color, #CBD5E1);\n padding: 1rem;\n border-radius: 0.5rem;\n}\n@media (max-width: 600px) {\n .claudebernard-patient-profile {\n font-size: 0.8rem;\n }\n}\n.claudebernard-patient-profile__separator {\n border-right: 1px solid var(--bcbd-border-gray-color, #CBD5E1);\n}\n.claudebernard-patient-profile__first-info-container {\n display: flex;\n flex-direction: row;\n justify-content: space-between;\n}\n@media (max-width: 450px) {\n .claudebernard-patient-profile__first-info-container {\n flex-direction: column;\n gap: 1rem;\n align-items: center;\n }\n}\n.claudebernard-patient-profile__id-info-container {\n display: flex;\n flex-direction: column;\n justify-content: center;\n gap: 0.5rem;\n}\n.claudebernard-patient-profile__name-info {\n font-size: 1.2rem;\n}\n@media (max-width: 600px) {\n .claudebernard-patient-profile__name-info {\n font-size: 1rem;\n }\n}\n@media (max-width: 500px) {\n .claudebernard-patient-profile__name-info {\n font-size: 0.8rem;\n }\n}\n.claudebernard-patient-profile__id-info {\n width: fit-content;\n border: 1px solid var(--bcbd-border-gray-color, #CBD5E1);\n border-radius: 1rem;\n display: flex;\n flex-direction: row;\n padding: 0 0.8rem;\n gap: 0.5rem;\n}\n.claudebernard-patient-profile__id-info-info {\n padding: 0.2rem 0;\n}\n.claudebernard-patient-profile__physical-info-container {\n display: flex;\n flex-direction: row;\n justify-content: center;\n gap: 1rem;\n}\n@media (max-width: 600px) {\n .claudebernard-patient-profile__physical-info-container {\n gap: 0.5rem;\n }\n}\n.claudebernard-patient-profile__physical-info {\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: space-around;\n height: 100%;\n}\n.claudebernard-patient-profile__physical-info-label {\n color: var(--bcbd-gray-600-color, #475569);\n}\n.claudebernard-patient-profile__action-buttons-container {\n display: flex;\n flex-direction: row;\n align-content: center;\n flex-wrap: wrap;\n gap: 1rem;\n}\n@media (max-width: 600px) {\n .claudebernard-patient-profile__action-buttons-container {\n gap: 0.5rem;\n }\n}\n.claudebernard-patient-profile__second-info-container {\n margin-top: 1rem;\n display: none;\n}\n.claudebernard-patient-profile__second-info-container.active {\n display: flex;\n flex-direction: column;\n}\n.claudebernard-patient-profile__second-info {\n margin-top: 1rem;\n}\n.claudebernard-patient-profile__second-info-label {\n padding-right: 0.5rem;\n color: var(--bcbd-primary-color, #0C75AD);\n}\n@media (max-width: 600px) {\n .claudebernard-patient-profile__second-info-label {\n font-size: 0.8rem;\n }\n}\n.claudebernard-patient-profile__second-info-result > * + *::before {\n content: "•";\n margin: 0 0.5rem;\n}';
|
|
861
|
+
var __defProp = Object.defineProperty;
|
|
862
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
863
|
+
var __decorateClass = (decorators, target, key, kind) => {
|
|
864
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
|
|
865
|
+
for (var i2 = decorators.length - 1, decorator; i2 >= 0; i2--)
|
|
866
|
+
if (decorator = decorators[i2])
|
|
867
|
+
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
868
|
+
if (kind && result) __defProp(target, key, result);
|
|
869
|
+
return result;
|
|
870
|
+
};
|
|
871
|
+
let PatientProfile = class extends i {
|
|
872
|
+
constructor() {
|
|
873
|
+
super(...arguments);
|
|
874
|
+
this.editButtonVisible = true;
|
|
875
|
+
this.moreInformationVisible = false;
|
|
876
|
+
}
|
|
877
|
+
handleMoreInformation() {
|
|
878
|
+
this.moreInformationVisible = !this.moreInformationVisible;
|
|
879
|
+
}
|
|
880
|
+
displayRenalInsufficiencyStatus() {
|
|
881
|
+
const renalStatus = getPatientRenalInsufficiencyStatus(this.patientProfile);
|
|
882
|
+
let renderRenalInsufficiency = E;
|
|
883
|
+
if (renalStatus.clearance?.value) {
|
|
884
|
+
const clearance = renalStatus.clearance;
|
|
885
|
+
renderRenalInsufficiency = x`
|
|
886
|
+
<div class="${PREFIX}-patient-profile__second-info" data-test-id="clearance-section">
|
|
887
|
+
<span class="${PREFIX}-patient-profile__second-info-label">Clairance créatinine </span>
|
|
888
|
+
<span class="${PREFIX}-patient-profile__second-info-result">${clearance.value} ${clearance.unit}</span>
|
|
889
|
+
</div>`;
|
|
890
|
+
}
|
|
891
|
+
if (renalStatus.gfr?.value) {
|
|
892
|
+
const clearance = renalStatus.gfr;
|
|
893
|
+
renderRenalInsufficiency = x`
|
|
894
|
+
${renderRenalInsufficiency}
|
|
895
|
+
<div class="${PREFIX}-patient-profile__second-info" data-test-id="dfg-section">
|
|
896
|
+
<span class="${PREFIX}-patient-profile__second-info-label">DFG </span>
|
|
897
|
+
<span class="${PREFIX}-patient-profile__second-info-result">${clearance.value} ${clearance.unit}</span>
|
|
898
|
+
</div>`;
|
|
899
|
+
}
|
|
900
|
+
return renderRenalInsufficiency;
|
|
901
|
+
}
|
|
902
|
+
displayCreatininemieSection() {
|
|
903
|
+
const creatinine = getCreatinine(this.patientProfile);
|
|
904
|
+
const creatinineByMg = creatinine.find((c2) => c2.unit?.toLowerCase() === "mg/l");
|
|
905
|
+
const creatinineByUmol = creatinine.find((c2) => c2.unit === "μmol/L");
|
|
906
|
+
return x`
|
|
907
|
+
<div class="${PREFIX}-patient-profile__second-info" data-test-id="creatinine-section">
|
|
908
|
+
<span class="${PREFIX}-patient-profile__second-info-label">Créatininémie </span>
|
|
909
|
+
<span class="${PREFIX}-patient-profile__second-info-result sep-dots">
|
|
910
|
+
<span>${creatinineByUmol?.value} ${creatinineByUmol?.unit}</span>
|
|
911
|
+
<span class="">${creatinineByMg?.value} ${creatinineByMg?.unit}</span>
|
|
912
|
+
</span>
|
|
913
|
+
</div>`;
|
|
914
|
+
}
|
|
915
|
+
displayPathologies() {
|
|
916
|
+
const conditions = getPatientConditions(this.patientProfile);
|
|
917
|
+
return x`${conditions.join(", ")}`;
|
|
918
|
+
}
|
|
919
|
+
displayAllergies() {
|
|
920
|
+
const allergies = getPatientAllergies(this.patientProfile);
|
|
921
|
+
return x`${allergies.join(", ")}`;
|
|
922
|
+
}
|
|
923
|
+
render() {
|
|
924
|
+
return x`
|
|
925
|
+
<div class="${PREFIX}-patient-profile">
|
|
926
|
+
<div class="${PREFIX}-patient-profile__first-info-container">
|
|
927
|
+
<div class="${PREFIX}-patient-profile__id-info-container">
|
|
928
|
+
<div class="${PREFIX}-patient-profile__name-info" data-test-id="patient-name">
|
|
929
|
+
${getPatientName(this.patientProfile)}
|
|
930
|
+
</div>
|
|
931
|
+
<div class="${PREFIX}-patient-profile__id-info">
|
|
932
|
+
<div class="${PREFIX}-patient-profile__id-info-info" data-test-id="patient-gender">
|
|
933
|
+
${getPatientGender(this.patientProfile)}
|
|
934
|
+
</div>
|
|
935
|
+
<div class="${PREFIX}-patient-profile__separator">
|
|
936
|
+
</div>
|
|
937
|
+
<div class="${PREFIX}-patient-profile__id-info-info" data-test-id="patient-age">
|
|
938
|
+
${getPatientAge(this.patientProfile)} ans
|
|
939
|
+
</div>
|
|
940
|
+
</div>
|
|
941
|
+
</div>
|
|
942
|
+
|
|
943
|
+
<div class="${PREFIX}-patient-profile__physical-info-container">
|
|
944
|
+
<div class="${PREFIX}-patient-profile__physical-info" data-test-id="patient-height">
|
|
945
|
+
<div class="${PREFIX}-patient-profile__physical-info-label">
|
|
946
|
+
Taille
|
|
947
|
+
</div>
|
|
948
|
+
<div class="${PREFIX}-patient-profile__physical-info-result">
|
|
949
|
+
${getPatientHeightWithUnit(this.patientProfile)}
|
|
950
|
+
</div>
|
|
951
|
+
</div>
|
|
952
|
+
<div class="${PREFIX}-patient-profile__separator">
|
|
953
|
+
</div>
|
|
954
|
+
<div class="${PREFIX}-patient-profile__physical-info" data-test-id="patient-weight">
|
|
955
|
+
<div class="${PREFIX}-patient-profile__physical-info-label">
|
|
956
|
+
Poids
|
|
957
|
+
</div>
|
|
958
|
+
<div class="${PREFIX}-patient-profile__physical-info-result">
|
|
959
|
+
${getPatientWeightWithUnit(this.patientProfile)}
|
|
960
|
+
</div>
|
|
961
|
+
</div>
|
|
962
|
+
<div class="${PREFIX}-patient-profile__separator">
|
|
963
|
+
</div>
|
|
964
|
+
<div class="${PREFIX}-patient-profile__physical-info" data-test-id="patient-IMC">
|
|
965
|
+
<div class="${PREFIX}-patient-profile__physical-info-label">
|
|
966
|
+
IMC
|
|
967
|
+
</div>
|
|
968
|
+
<div class="${PREFIX}-patient-profile__physical-info-result">
|
|
969
|
+
${calculateBMI(getPatientWeight(this.patientProfile) ?? 0, getPatientHeight(this.patientProfile) ?? 0)}
|
|
970
|
+
</div>
|
|
971
|
+
</div>
|
|
972
|
+
</div>
|
|
973
|
+
|
|
974
|
+
<div class="${PREFIX}-patient-profile__action-buttons-container" data-test-id="action-buttons">
|
|
975
|
+
${this.editButtonVisible || this.editButtonVisible === void 0 ? x`<bcbd-button icon="pencil" size="medium" background-color="black" disabled data-test-id="modify-button"></bcbd-button>` : E}
|
|
976
|
+
<bcbd-button icon=${this.moreInformationVisible ? "chevron-up" : "chevron-down"} size="medium" background-color="primary" @click=${this.handleMoreInformation} data-test-id="visible-button"></bcbd-button>
|
|
977
|
+
</div>
|
|
978
|
+
</div>
|
|
979
|
+
<div class="${PREFIX}-patient-profile__second-info-container ${this.moreInformationVisible ? "active" : ""}" data-test-id="more-information-section">
|
|
980
|
+
<div class="${PREFIX}-patient-profile__second-info" data-test-id="pathology-section">
|
|
981
|
+
<span class="${PREFIX}-patient-profile__second-info-label">Pathologies suivies </span>
|
|
982
|
+
<span class="${PREFIX}-patient-profile__second-info-result">${this.displayPathologies()} </span>
|
|
983
|
+
</div>
|
|
984
|
+
<div class="${PREFIX}-patient-profile__second-info" data-test-id="allergy-section">
|
|
985
|
+
<span class="${PREFIX}-patient-profile__second-info-label">Allergies </span>
|
|
986
|
+
<span class="${PREFIX}-patient-profile__second-info-result">${this.displayAllergies()} </span>
|
|
987
|
+
</div>
|
|
988
|
+
|
|
989
|
+
${this.displayRenalInsufficiencyStatus()}
|
|
990
|
+
|
|
991
|
+
${this.displayCreatininemieSection()}
|
|
992
|
+
|
|
993
|
+
<div class="${PREFIX}-patient-profile__second-info" data-test-id="hepatic-insufficiency-section">
|
|
994
|
+
<span class="${PREFIX}-patient-profile__second-info-label">Insuffisance hépatique </span>
|
|
995
|
+
<span class="${PREFIX}-patient-profile__second-info-result">${getPatientHepaticInsufficiencyStatus(this.patientProfile)} </span>
|
|
996
|
+
</div>
|
|
997
|
+
</div>
|
|
998
|
+
</div>
|
|
999
|
+
`;
|
|
1000
|
+
}
|
|
1001
|
+
};
|
|
1002
|
+
PatientProfile.styles = i$3`${r$4(patientProfileCSS)}`;
|
|
1003
|
+
__decorateClass([
|
|
1004
|
+
n2({ type: Object, attribute: "patient-profile" })
|
|
1005
|
+
], PatientProfile.prototype, "patientProfile", 2);
|
|
1006
|
+
__decorateClass([
|
|
1007
|
+
n2({ type: Boolean, attribute: "edit-button-visible" })
|
|
1008
|
+
], PatientProfile.prototype, "editButtonVisible", 2);
|
|
1009
|
+
__decorateClass([
|
|
1010
|
+
r()
|
|
1011
|
+
], PatientProfile.prototype, "moreInformationVisible", 2);
|
|
1012
|
+
PatientProfile = __decorateClass([
|
|
1013
|
+
t("bcb-patient-profile")
|
|
1014
|
+
], PatientProfile);
|
|
1015
|
+
export {
|
|
1016
|
+
PatientProfile
|
|
1017
|
+
};
|