@instructure/platform-notebook 1.9.3 → 1.10.0
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/dist/index.js
CHANGED
|
@@ -1,46 +1,46 @@
|
|
|
1
|
-
import { jsx as s, jsxs as S, Fragment as
|
|
2
|
-
import { createContext as
|
|
3
|
-
import { createPortal as
|
|
1
|
+
import { jsx as s, jsxs as S, Fragment as ze } from "react/jsx-runtime";
|
|
2
|
+
import { createContext as qe, useMemo as he, useContext as Ke, useReducer as Xe, useRef as B, useEffect as z, useState as j, useCallback as q } from "react";
|
|
3
|
+
import { createPortal as ft } from "react-dom";
|
|
4
4
|
import { z as u } from "zod";
|
|
5
|
-
import
|
|
6
|
-
import { useQueryClient as we, useMutation as Oe, useQuery as
|
|
7
|
-
import { CloseButton as
|
|
8
|
-
import { Flex as
|
|
9
|
-
import { Heading as Se } from "@instructure/ui-heading";
|
|
10
|
-
import { Tray as
|
|
11
|
-
import { View as X } from "@instructure/ui-view";
|
|
12
|
-
import { IconQuestionLine as Le, IconPinLine as Ae, IconWarningLine as
|
|
13
|
-
import { Menu as ue } from "@instructure/ui-menu";
|
|
14
|
-
import { TruncateText as Ee } from "@instructure/ui-truncate-text";
|
|
15
|
-
import { SimpleSelect as Be } from "@instructure/ui-simple-select";
|
|
16
|
-
import { Text as oe } from "@instructure/ui-text";
|
|
5
|
+
import mt from "diff-match-patch";
|
|
6
|
+
import { useQueryClient as we, useMutation as Oe, useQuery as gt } from "@tanstack/react-query";
|
|
7
|
+
import { CloseButton as ht, Button as re, IconButton as me } from "@instructure/ui-buttons/v11_7";
|
|
8
|
+
import { Flex as R } from "@instructure/ui-flex/v11_7";
|
|
9
|
+
import { Heading as Se } from "@instructure/ui-heading/v11_7";
|
|
10
|
+
import { Tray as pt } from "@instructure/ui-tray/v11_7";
|
|
11
|
+
import { View as X } from "@instructure/ui-view/v11_7";
|
|
12
|
+
import { IconQuestionLine as Le, IconPinLine as Ae, IconWarningLine as yt, IconNoteLine as bt, IconEditLine as Re, IconTrashLine as Te, IconArrowStartLine as Nt } from "@instructure/ui-icons";
|
|
13
|
+
import { Menu as ue } from "@instructure/ui-menu/v11_7";
|
|
14
|
+
import { TruncateText as Ee } from "@instructure/ui-truncate-text/v11_7";
|
|
15
|
+
import { SimpleSelect as Be } from "@instructure/ui-simple-select/v11_7";
|
|
16
|
+
import { Text as oe } from "@instructure/ui-text/v11_7";
|
|
17
17
|
import { ScreenReaderContent as pe } from "@instructure/ui-a11y-content";
|
|
18
|
-
import { Dialog as
|
|
19
|
-
import { TextArea as
|
|
20
|
-
import { Pill as $e } from "@instructure/ui-pill";
|
|
21
|
-
import { Pagination as
|
|
22
|
-
import { Spinner as
|
|
23
|
-
const
|
|
18
|
+
import { Dialog as Et } from "@instructure/ui-dialog";
|
|
19
|
+
import { TextArea as Qe } from "@instructure/ui-text-area/v11_7";
|
|
20
|
+
import { Pill as $e } from "@instructure/ui-pill/v11_7";
|
|
21
|
+
import { Pagination as Tt } from "@instructure/ui-pagination/v11_7";
|
|
22
|
+
import { Spinner as St } from "@instructure/ui-spinner/v11_7";
|
|
23
|
+
const vt = u.object({
|
|
24
24
|
startContainer: u.string(),
|
|
25
25
|
endContainer: u.string(),
|
|
26
26
|
startOffset: u.number(),
|
|
27
27
|
endOffset: u.number()
|
|
28
|
-
}),
|
|
28
|
+
}), It = u.object({
|
|
29
29
|
start: u.number(),
|
|
30
30
|
end: u.number()
|
|
31
31
|
}), De = u.object({
|
|
32
32
|
selectedText: u.string(),
|
|
33
33
|
hasNoHighlightAnymore: u.boolean().optional(),
|
|
34
|
-
textPosition:
|
|
35
|
-
range:
|
|
34
|
+
textPosition: It.nullable(),
|
|
35
|
+
range: vt.nullable(),
|
|
36
36
|
pageLastModifiedAt: u.string()
|
|
37
37
|
});
|
|
38
|
-
var
|
|
38
|
+
var k = /* @__PURE__ */ ((t) => (t.IMPORTANT = "Important", t.CONFUSING = "Confusing", t))(k || {});
|
|
39
39
|
const Pe = u.enum([
|
|
40
40
|
"Important",
|
|
41
41
|
"Confusing"
|
|
42
42
|
/* CONFUSING */
|
|
43
|
-
]),
|
|
43
|
+
]), Ct = u.object({
|
|
44
44
|
totalCount: u.number().nullish(),
|
|
45
45
|
totalNrOfPages: u.number().nullish()
|
|
46
46
|
}), ve = u.object({
|
|
@@ -55,28 +55,28 @@ const Pe = u.enum([
|
|
|
55
55
|
highlightData: De,
|
|
56
56
|
createdAt: u.string(),
|
|
57
57
|
updatedAt: u.string()
|
|
58
|
-
}),
|
|
58
|
+
}), xt = u.object({
|
|
59
59
|
cursor: u.string(),
|
|
60
60
|
node: ve
|
|
61
61
|
});
|
|
62
62
|
u.object({
|
|
63
63
|
notes: u.object({
|
|
64
|
-
edges: u.array(
|
|
64
|
+
edges: u.array(xt),
|
|
65
65
|
nodes: u.array(ve),
|
|
66
|
-
pageInfo:
|
|
66
|
+
pageInfo: Ct
|
|
67
67
|
})
|
|
68
68
|
});
|
|
69
69
|
const Rt = u.object({
|
|
70
70
|
type: u.string(),
|
|
71
71
|
id: u.string()
|
|
72
|
-
}),
|
|
72
|
+
}), kt = u.object({
|
|
73
73
|
courseId: u.string().optional(),
|
|
74
74
|
learningObject: Rt.optional(),
|
|
75
75
|
reactions: u.array(u.string()).optional()
|
|
76
76
|
}).optional();
|
|
77
77
|
u.object({
|
|
78
78
|
courseId: u.string().optional(),
|
|
79
|
-
filter:
|
|
79
|
+
filter: kt,
|
|
80
80
|
offset: u.number().optional(),
|
|
81
81
|
pageSize: u.number().optional()
|
|
82
82
|
});
|
|
@@ -103,14 +103,14 @@ u.object({
|
|
|
103
103
|
u.object({
|
|
104
104
|
deleteNote: u.string()
|
|
105
105
|
});
|
|
106
|
-
var
|
|
106
|
+
var Ye = /* @__PURE__ */ ((t) => (t[t.FORWARDS = 1] = "FORWARDS", t[t.BACKWARDS = 2] = "BACKWARDS", t))(Ye || {});
|
|
107
107
|
class se {
|
|
108
108
|
constructor(e, n) {
|
|
109
109
|
this.start = e, this.end = n;
|
|
110
110
|
}
|
|
111
111
|
toRange() {
|
|
112
112
|
let e, n;
|
|
113
|
-
if (this.start.element === this.end.element && this.start.offset <= this.end.offset ? [e, n] =
|
|
113
|
+
if (this.start.element === this.end.element && this.start.offset <= this.end.offset ? [e, n] = Ze(this.start.element, this.start.offset, this.end.offset) : (e = this.start.resolve({
|
|
114
114
|
direction: 1
|
|
115
115
|
/* FORWARDS */
|
|
116
116
|
}), n = this.end.resolve({
|
|
@@ -138,12 +138,12 @@ class K {
|
|
|
138
138
|
}
|
|
139
139
|
resolve(e = {}) {
|
|
140
140
|
try {
|
|
141
|
-
return
|
|
141
|
+
return Ze(this.element, this.offset)[0];
|
|
142
142
|
} catch (n) {
|
|
143
143
|
if (this.offset === 0 && e.direction !== void 0) {
|
|
144
144
|
const o = document.createTreeWalker(this.element.getRootNode(), NodeFilter.SHOW_TEXT);
|
|
145
145
|
o.currentNode = this.element;
|
|
146
|
-
const r = e.direction ===
|
|
146
|
+
const r = e.direction === Ye.FORWARDS, i = r ? o.nextNode() : o.previousNode();
|
|
147
147
|
if (!i)
|
|
148
148
|
throw n;
|
|
149
149
|
return { node: i, offset: r ? 0 : i.data.length };
|
|
@@ -168,7 +168,7 @@ class K {
|
|
|
168
168
|
return console.error("Text node offset is out of range"), null;
|
|
169
169
|
if (!e.parentElement)
|
|
170
170
|
return console.error("Text node has no parent"), null;
|
|
171
|
-
const o =
|
|
171
|
+
const o = je(e) + n;
|
|
172
172
|
return new K(e.parentElement, o);
|
|
173
173
|
}
|
|
174
174
|
case Node.ELEMENT_NODE: {
|
|
@@ -176,7 +176,7 @@ class K {
|
|
|
176
176
|
return console.error("Child node offset is out of range"), null;
|
|
177
177
|
let o = 0;
|
|
178
178
|
for (let r = 0; r < n; r++)
|
|
179
|
-
o +=
|
|
179
|
+
o += Ve(e.childNodes[r]);
|
|
180
180
|
return new K(e, o);
|
|
181
181
|
}
|
|
182
182
|
default:
|
|
@@ -188,22 +188,22 @@ class K {
|
|
|
188
188
|
throw new Error("Parent is not an ancestor of current element");
|
|
189
189
|
let n = this.element, o = this.offset;
|
|
190
190
|
for (; n !== e; )
|
|
191
|
-
o +=
|
|
191
|
+
o += je(n), n.parentElement && (n = n.parentElement);
|
|
192
192
|
return new K(n, o);
|
|
193
193
|
}
|
|
194
194
|
}
|
|
195
|
-
const
|
|
195
|
+
const wt = (t) => {
|
|
196
196
|
const e = t.nodeName.toLowerCase();
|
|
197
197
|
return e === "#text" ? "text()" : e;
|
|
198
198
|
};
|
|
199
|
-
function
|
|
199
|
+
function Ot(t) {
|
|
200
200
|
let e = 0, n = t;
|
|
201
201
|
for (; n; )
|
|
202
202
|
n.nodeName === t.nodeName && (e += 1), n = n.previousSibling;
|
|
203
203
|
return e;
|
|
204
204
|
}
|
|
205
|
-
const
|
|
206
|
-
const e =
|
|
205
|
+
const Lt = (t) => {
|
|
206
|
+
const e = wt(t), n = Ot(t);
|
|
207
207
|
return `${e}[${n}]`;
|
|
208
208
|
}, He = (t, e) => {
|
|
209
209
|
let n = "", o = t;
|
|
@@ -212,10 +212,10 @@ const At = (t) => {
|
|
|
212
212
|
console.error("Node is not a descendant of root");
|
|
213
213
|
return;
|
|
214
214
|
}
|
|
215
|
-
n = `${
|
|
215
|
+
n = `${Lt(o)}/${n}`, o = o.parentNode;
|
|
216
216
|
}
|
|
217
217
|
return n = `/${n}`, n = n.replace(/\/$/, ""), n;
|
|
218
|
-
},
|
|
218
|
+
}, At = (t, e, n) => {
|
|
219
219
|
const o = e.toUpperCase();
|
|
220
220
|
let r = -1;
|
|
221
221
|
for (let i = 0; i < t.children.length; i++) {
|
|
@@ -224,7 +224,7 @@ const At = (t) => {
|
|
|
224
224
|
return l;
|
|
225
225
|
}
|
|
226
226
|
return null;
|
|
227
|
-
},
|
|
227
|
+
}, Dt = (t, e) => {
|
|
228
228
|
if (!(t.match(/^(\/[A-Za-z0-9-]+(\[[0-9]+])?)+$/) !== null))
|
|
229
229
|
return console.error("Expression is not a simple XPath"), null;
|
|
230
230
|
const o = t.split("/");
|
|
@@ -232,15 +232,15 @@ const At = (t) => {
|
|
|
232
232
|
o.shift();
|
|
233
233
|
for (const i of o) {
|
|
234
234
|
let l, a;
|
|
235
|
-
const
|
|
236
|
-
if (
|
|
237
|
-
l = i.slice(0,
|
|
238
|
-
const y = i.slice(
|
|
235
|
+
const f = i.indexOf("[");
|
|
236
|
+
if (f !== -1) {
|
|
237
|
+
l = i.slice(0, f);
|
|
238
|
+
const y = i.slice(f + 1, i.indexOf("]"));
|
|
239
239
|
if (a = Number.parseInt(y, 10) - 1, a < 0)
|
|
240
240
|
return null;
|
|
241
241
|
} else
|
|
242
242
|
l = i, a = 0;
|
|
243
|
-
const c =
|
|
243
|
+
const c = At(r, l, a);
|
|
244
244
|
if (!c)
|
|
245
245
|
return null;
|
|
246
246
|
r = c;
|
|
@@ -248,7 +248,7 @@ const At = (t) => {
|
|
|
248
248
|
return r;
|
|
249
249
|
}, Ue = (t, e = document.body) => {
|
|
250
250
|
try {
|
|
251
|
-
return
|
|
251
|
+
return Dt(t, e);
|
|
252
252
|
} catch {
|
|
253
253
|
return document.evaluate(`.${t}`, e, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue;
|
|
254
254
|
}
|
|
@@ -311,7 +311,7 @@ class le {
|
|
|
311
311
|
return se.fromOffsets(this.root, this.start, this.end).toRange();
|
|
312
312
|
}
|
|
313
313
|
}
|
|
314
|
-
const
|
|
314
|
+
const Ve = (t) => {
|
|
315
315
|
var e;
|
|
316
316
|
switch (t.nodeType) {
|
|
317
317
|
case Node.ELEMENT_NODE:
|
|
@@ -320,12 +320,12 @@ const Ze = (t) => {
|
|
|
320
320
|
default:
|
|
321
321
|
return 0;
|
|
322
322
|
}
|
|
323
|
-
},
|
|
323
|
+
}, je = (t) => {
|
|
324
324
|
let e = t.previousSibling, n = 0;
|
|
325
325
|
for (; e; )
|
|
326
|
-
n +=
|
|
326
|
+
n += Ve(e), e = e.previousSibling;
|
|
327
327
|
return n;
|
|
328
|
-
},
|
|
328
|
+
}, Ze = (t, ...e) => {
|
|
329
329
|
let n = e.shift();
|
|
330
330
|
const o = t.ownerDocument.createNodeIterator(t, NodeFilter.SHOW_TEXT), r = [];
|
|
331
331
|
let i = o.nextNode(), l = null, a = 0;
|
|
@@ -334,28 +334,28 @@ const Ze = (t) => {
|
|
|
334
334
|
for (; n !== void 0 && l && a === n; )
|
|
335
335
|
r.push({ node: l, offset: l.data.length }), n = e.shift();
|
|
336
336
|
return n !== void 0 && console.error("Offset exceeds text length"), r;
|
|
337
|
-
},
|
|
337
|
+
}, Pt = (t, e, n, o) => {
|
|
338
338
|
const r = n - e;
|
|
339
339
|
return Math.abs(r - o) <= 5 ? le.fromSelector(t, {
|
|
340
340
|
start: e,
|
|
341
341
|
end: n
|
|
342
342
|
}) : null;
|
|
343
|
-
},
|
|
344
|
-
const r = new
|
|
343
|
+
}, _t = (t, e, n, o) => {
|
|
344
|
+
const r = new mt();
|
|
345
345
|
r.Match_Distance = 5e3;
|
|
346
346
|
const i = t.textContent;
|
|
347
347
|
if (!i)
|
|
348
348
|
return null;
|
|
349
349
|
if (e.length > 32) {
|
|
350
|
-
const l = e.slice(0, 32), a = e.slice(-32),
|
|
350
|
+
const l = e.slice(0, 32), a = e.slice(-32), f = o - n;
|
|
351
351
|
let c = r.match_main(i, l, n);
|
|
352
352
|
const y = r.match_main(i, a, o), d = y + a.length;
|
|
353
353
|
if (c === -1 || y === -1)
|
|
354
354
|
return null;
|
|
355
|
-
const h = d - c,
|
|
356
|
-
if ((c > d ||
|
|
357
|
-
return
|
|
358
|
-
if (c < d &&
|
|
355
|
+
const h = d - c, N = Math.abs(h - f);
|
|
356
|
+
if ((c > d || N > 5) && (r.Match_Distance = e.length + 100, c = r.match_main(i, l, d), c !== -1 && c < d))
|
|
357
|
+
return Pt(t, c, d, f);
|
|
358
|
+
if (c < d && N <= 5)
|
|
359
359
|
return le.fromSelector(t, {
|
|
360
360
|
start: c,
|
|
361
361
|
end: d
|
|
@@ -369,21 +369,21 @@ const Ze = (t) => {
|
|
|
369
369
|
});
|
|
370
370
|
}
|
|
371
371
|
return null;
|
|
372
|
-
},
|
|
372
|
+
}, Ft = (t, e) => {
|
|
373
373
|
if (!e) return null;
|
|
374
374
|
const { highlightData: n } = t, { textPosition: o, selectedText: r } = n;
|
|
375
|
-
return
|
|
375
|
+
return _t(
|
|
376
376
|
e,
|
|
377
377
|
r,
|
|
378
378
|
(o == null ? void 0 : o.start) ?? 0,
|
|
379
379
|
(o == null ? void 0 : o.end) ?? 0
|
|
380
380
|
);
|
|
381
|
-
},
|
|
381
|
+
}, Mt = (t, e, n) => {
|
|
382
382
|
const o = [], r = [];
|
|
383
383
|
for (const i of e) {
|
|
384
|
-
const l =
|
|
384
|
+
const l = Ft(i, t);
|
|
385
385
|
if (l) {
|
|
386
|
-
const a = l.toRange(),
|
|
386
|
+
const a = l.toRange(), f = a && ae.fromRange(t, a), c = (a == null ? void 0 : a.toString().trim()) || i.highlightData.selectedText;
|
|
387
387
|
o.push({
|
|
388
388
|
id: i.id,
|
|
389
389
|
reaction: i.reaction,
|
|
@@ -392,7 +392,7 @@ const Ze = (t) => {
|
|
|
392
392
|
...i.highlightData,
|
|
393
393
|
selectedText: c,
|
|
394
394
|
hasNoHighlightAnymore: !1,
|
|
395
|
-
range: (
|
|
395
|
+
range: (f == null ? void 0 : f.toSelector()) ?? null,
|
|
396
396
|
textPosition: l.toSelector(),
|
|
397
397
|
pageLastModifiedAt: n
|
|
398
398
|
}
|
|
@@ -410,12 +410,12 @@ const Ze = (t) => {
|
|
|
410
410
|
}) : r.push(i.id);
|
|
411
411
|
}
|
|
412
412
|
return { notesForUpdate: o, noteIdsForDelete: r };
|
|
413
|
-
},
|
|
413
|
+
}, Ge = (t, e) => {
|
|
414
414
|
var l;
|
|
415
415
|
if (!e) return;
|
|
416
416
|
const { highlightData: n, id: o } = t, { range: r } = n ?? {};
|
|
417
|
-
r && ((l = ae.fromSelector(e, r)) == null ? void 0 : l.toRange()) &&
|
|
418
|
-
},
|
|
417
|
+
r && ((l = ae.fromSelector(e, r)) == null ? void 0 : l.toRange()) && Qt({ id: o });
|
|
418
|
+
}, Bt = (t) => {
|
|
419
419
|
const n = document.querySelector(
|
|
420
420
|
`[data-highlight-id="${CSS.escape(t)}"].highlight-content`
|
|
421
421
|
) ?? document.getElementById(Ie(t));
|
|
@@ -423,50 +423,50 @@ const Ze = (t) => {
|
|
|
423
423
|
const o = n.getBoundingClientRect();
|
|
424
424
|
o.top >= 0 && o.bottom <= (window.innerHeight || document.documentElement.clientHeight) || n.scrollIntoView({ behavior: "smooth", block: "center" });
|
|
425
425
|
}
|
|
426
|
-
}, ye = 90,
|
|
426
|
+
}, ye = 90, be = 172, $t = (t) => {
|
|
427
427
|
const e = t.getClientRects();
|
|
428
428
|
if (!e.length)
|
|
429
429
|
return null;
|
|
430
|
-
const n = e[0], o = e[e.length - 1], r = 4, i = 16, l = window.innerWidth || document.documentElement.clientWidth, a = window.innerHeight || document.documentElement.clientHeight,
|
|
431
|
-
const E = p +
|
|
430
|
+
const n = e[0], o = e[e.length - 1], r = 4, i = 16, l = window.innerWidth || document.documentElement.clientWidth, a = window.innerHeight || document.documentElement.clientHeight, f = (p) => {
|
|
431
|
+
const E = p + be;
|
|
432
432
|
return p >= i && E <= l - i;
|
|
433
433
|
}, c = (p) => {
|
|
434
434
|
const E = p + ye;
|
|
435
435
|
return p >= i && E <= a - i;
|
|
436
436
|
};
|
|
437
437
|
let y;
|
|
438
|
-
const d = n.right -
|
|
439
|
-
if (
|
|
438
|
+
const d = n.right - be;
|
|
439
|
+
if (f(d))
|
|
440
440
|
y = d;
|
|
441
441
|
else {
|
|
442
442
|
const p = n.left;
|
|
443
|
-
if (
|
|
443
|
+
if (f(p))
|
|
444
444
|
y = p;
|
|
445
445
|
else {
|
|
446
|
-
const g = (n.left + n.right) / 2 -
|
|
447
|
-
|
|
446
|
+
const g = (n.left + n.right) / 2 - be / 2;
|
|
447
|
+
f(g) ? y = g : d < i ? y = i : y = l - be - i;
|
|
448
448
|
}
|
|
449
449
|
}
|
|
450
450
|
let h;
|
|
451
|
-
const
|
|
452
|
-
if (c(
|
|
453
|
-
h =
|
|
451
|
+
const N = o.bottom + r;
|
|
452
|
+
if (c(N))
|
|
453
|
+
h = N;
|
|
454
454
|
else {
|
|
455
455
|
const p = n.top - ye - r;
|
|
456
|
-
c(p) ? h = p :
|
|
456
|
+
c(p) ? h = p : N + ye > a - i ? h = a - ye - i : h = i;
|
|
457
457
|
}
|
|
458
458
|
return { top: h, left: y };
|
|
459
|
-
},
|
|
459
|
+
}, Ht = (t, e) => {
|
|
460
460
|
for (const n of e)
|
|
461
461
|
if (t.start < n.end && t.end > n.start)
|
|
462
462
|
return !0;
|
|
463
463
|
return !1;
|
|
464
|
-
}, _e = (t) => `highlight-wrapper-${t}`, Ie = (t) => `${_e(t)}-start`,
|
|
464
|
+
}, _e = (t) => `highlight-wrapper-${t}`, Ie = (t) => `${_e(t)}-start`, Je = (t) => `${_e(t)}-end`, ge = (t) => `[data-highlight-id="${CSS.escape(t)}"]`, Ut = "2px", jt = "3px", Gt = "1px", et = "3px", Wt = "1px", tt = "Notebook note", Fe = (t, e) => {
|
|
465
465
|
const n = Number.parseInt(t.slice(1, 3), 16), o = Number.parseInt(t.slice(3, 5), 16), r = Number.parseInt(t.slice(5, 7), 16);
|
|
466
466
|
return `rgba(${n}, ${o}, ${r}, ${e})`;
|
|
467
|
-
},
|
|
468
|
-
t.style.backgroundColor = n, t.style.textDecorationColor = o, t.style.textDecorationStyle = r, e ? (t.dataset.selected = "true", t.style.outline = `${
|
|
469
|
-
},
|
|
467
|
+
}, nt = (t, e, n, o, r) => {
|
|
468
|
+
t.style.backgroundColor = n, t.style.textDecorationColor = o, t.style.textDecorationStyle = r, e ? (t.dataset.selected = "true", t.style.outline = `${Gt} ${r} ${o}`, t.style.outlineOffset = Wt, t.style.borderRadius = et, t.style.fontWeight = "bold") : (t.removeAttribute("data-selected"), t.style.outline = "", t.style.outlineOffset = "", t.style.borderRadius = "", t.style.fontWeight = "");
|
|
469
|
+
}, zt = (t, e) => {
|
|
470
470
|
var n;
|
|
471
471
|
try {
|
|
472
472
|
const o = ((n = e.nodeValue) == null ? void 0 : n.length) ?? e.childNodes.length;
|
|
@@ -474,7 +474,7 @@ const Ze = (t) => {
|
|
|
474
474
|
} catch {
|
|
475
475
|
return !1;
|
|
476
476
|
}
|
|
477
|
-
},
|
|
477
|
+
}, qt = (t) => {
|
|
478
478
|
var i;
|
|
479
479
|
if (t.collapsed)
|
|
480
480
|
return [];
|
|
@@ -484,7 +484,7 @@ const Ze = (t) => {
|
|
|
484
484
|
const n = [], o = (i = e == null ? void 0 : e.ownerDocument) == null ? void 0 : i.createNodeIterator(e, NodeFilter.SHOW_TEXT);
|
|
485
485
|
let r = (o == null ? void 0 : o.nextNode()) || null;
|
|
486
486
|
for (; r; ) {
|
|
487
|
-
if (!
|
|
487
|
+
if (!zt(t, r)) {
|
|
488
488
|
r = (o == null ? void 0 : o.nextNode()) || null;
|
|
489
489
|
continue;
|
|
490
490
|
}
|
|
@@ -496,51 +496,51 @@ const Ze = (t) => {
|
|
|
496
496
|
l === t.endContainer && t.endOffset < l.data.length && l.splitText(t.endOffset), n.push(l), r = (o == null ? void 0 : o.nextNode()) || null;
|
|
497
497
|
}
|
|
498
498
|
return n;
|
|
499
|
-
},
|
|
499
|
+
}, Kt = (t, e, n) => {
|
|
500
500
|
if (t.collapsed) return;
|
|
501
501
|
const o = e.id ?? "", r = _e(o);
|
|
502
502
|
if (document.getElementById(Ie(o))) {
|
|
503
|
-
|
|
503
|
+
Xt(e, n);
|
|
504
504
|
return;
|
|
505
505
|
}
|
|
506
|
-
const l = e.type ===
|
|
506
|
+
const l = e.type === k.IMPORTANT ? n.colors.importantBackground : n.colors.confusingBackground, a = e.id === e.selectedNoteId, f = a ? l : Fe(l, 0.5), c = e.type === k.IMPORTANT ? n.colors.importantUnderline : n.colors.confusingUnderline, y = e.type === k.IMPORTANT ? "solid" : "dashed", d = document.createElement("span");
|
|
507
507
|
d.id = `${r}-start`, d.className = "highlight-marker-start", d.dataset.highlightId = o || "";
|
|
508
|
-
const h = e.labelPrefix ??
|
|
508
|
+
const h = e.labelPrefix ?? tt;
|
|
509
509
|
d.setAttribute("role", "button"), d.setAttribute("tabindex", "0"), d.setAttribute("aria-label", h), d.setAttribute("aria-haspopup", "dialog"), d.setAttribute("aria-expanded", String(a && !!e.isTrayOpen)), a && d.setAttribute("aria-current", "true"), e.popupId && d.setAttribute("aria-controls", e.popupId), d.style.position = "relative", d.style.fontSize = "0", d.style.lineHeight = "0", d.style.width = "0", d.style.height = "0", d.style.margin = "0", d.style.padding = "0", d.style.border = "0", d.style.outline = "none";
|
|
510
|
-
const
|
|
511
|
-
|
|
510
|
+
const N = document.createElement("span");
|
|
511
|
+
N.id = Je(o), N.className = "highlight-marker-end", N.dataset.highlightId = o || "";
|
|
512
512
|
const p = t.cloneRange();
|
|
513
|
-
p.collapse(!1), p.insertNode(
|
|
513
|
+
p.collapse(!1), p.insertNode(N);
|
|
514
514
|
const E = t.cloneRange();
|
|
515
515
|
E.collapse(!0), E.insertNode(d);
|
|
516
516
|
const g = document.createRange();
|
|
517
|
-
g.setStartAfter(d), g.setEndBefore(
|
|
518
|
-
const
|
|
519
|
-
|
|
520
|
-
var
|
|
521
|
-
const
|
|
522
|
-
if ((
|
|
523
|
-
const
|
|
517
|
+
g.setStartAfter(d), g.setEndBefore(N);
|
|
518
|
+
const G = qt(g).filter((b) => b.textContent && b.textContent.length > 0);
|
|
519
|
+
G.forEach((b, C) => {
|
|
520
|
+
var F;
|
|
521
|
+
const A = b.parentElement;
|
|
522
|
+
if ((A == null ? void 0 : A.dataset.highlightId) === o) return;
|
|
523
|
+
const $ = C === 0, D = C === G.length - 1, T = G.length === 1;
|
|
524
524
|
let O;
|
|
525
|
-
T ? O = "single" :
|
|
525
|
+
T ? O = "single" : $ ? O = "first" : D ? O = "last" : O = "middle";
|
|
526
526
|
const x = document.createElement("span");
|
|
527
|
-
x.className = "highlight-content", x.dataset.highlightId = o || "", x.dataset.position = O, x.style.textDecorationLine = "underline", x.style.textDecorationThickness = n.borderWidthSmall, x.style.textUnderlineOffset = n.underlineOffset, x.style.cursor = "pointer",
|
|
527
|
+
x.className = "highlight-content", x.dataset.highlightId = o || "", x.dataset.position = O, x.style.textDecorationLine = "underline", x.style.textDecorationThickness = n.borderWidthSmall, x.style.textUnderlineOffset = n.underlineOffset, x.style.cursor = "pointer", nt(x, a, f, c, y), x.addEventListener("click", (V) => {
|
|
528
528
|
var Z;
|
|
529
529
|
V.target.tagName !== "A" && ((Z = e.onClick) == null || Z.call(e));
|
|
530
|
-
}), (
|
|
531
|
-
}), d.addEventListener("click", (
|
|
530
|
+
}), (F = b.parentNode) == null || F.insertBefore(x, b), x.appendChild(b);
|
|
531
|
+
}), d.addEventListener("click", (b) => {
|
|
532
532
|
var C;
|
|
533
|
-
|
|
534
|
-
}), d.addEventListener("keydown", (
|
|
533
|
+
b.target.tagName !== "A" && ((C = e.onClick) == null || C.call(e));
|
|
534
|
+
}), d.addEventListener("keydown", (b) => {
|
|
535
535
|
var C;
|
|
536
|
-
if (
|
|
537
|
-
|
|
538
|
-
else if (
|
|
539
|
-
const
|
|
540
|
-
for (const
|
|
541
|
-
const
|
|
542
|
-
if (
|
|
543
|
-
|
|
536
|
+
if (b.key === "Enter" || b.key === " ")
|
|
537
|
+
b.preventDefault(), (C = e.onClick) == null || C.call(e);
|
|
538
|
+
else if (b.key === "Tab" && !b.shiftKey) {
|
|
539
|
+
const A = document.querySelectorAll(ge(o));
|
|
540
|
+
for (const $ of A) {
|
|
541
|
+
const D = $.querySelector("a");
|
|
542
|
+
if (D) {
|
|
543
|
+
b.preventDefault(), D.focus();
|
|
544
544
|
break;
|
|
545
545
|
}
|
|
546
546
|
}
|
|
@@ -549,30 +549,30 @@ const Ze = (t) => {
|
|
|
549
549
|
document.querySelectorAll(
|
|
550
550
|
`.highlight-content${ge(o)}`
|
|
551
551
|
).forEach((C) => {
|
|
552
|
-
C.style.boxShadow = `0 0 0 ${
|
|
552
|
+
C.style.boxShadow = `0 0 0 ${Ut} ${n.colors.focusOutline}`, C.style.borderRadius = jt;
|
|
553
553
|
});
|
|
554
554
|
}), d.addEventListener("blur", () => {
|
|
555
555
|
document.querySelectorAll(
|
|
556
556
|
`.highlight-content${ge(o)}`
|
|
557
557
|
).forEach((C) => {
|
|
558
|
-
C.style.boxShadow = "", C.style.borderRadius = C.dataset.selected ?
|
|
558
|
+
C.style.boxShadow = "", C.style.borderRadius = C.dataset.selected ? et : "";
|
|
559
559
|
});
|
|
560
560
|
});
|
|
561
561
|
};
|
|
562
|
-
function
|
|
563
|
-
const n = t.type ===
|
|
562
|
+
function Xt(t, e) {
|
|
563
|
+
const n = t.type === k.IMPORTANT ? e.colors.importantBackground : e.colors.confusingBackground, o = t.id === t.selectedNoteId, r = o ? n : Fe(n, 0.5), i = t.type === k.IMPORTANT ? e.colors.importantUnderline : e.colors.confusingUnderline, l = t.type === k.IMPORTANT ? "solid" : "dashed";
|
|
564
564
|
document.querySelectorAll(
|
|
565
565
|
`.highlight-content${ge(t.id ?? "")}`
|
|
566
566
|
).forEach((c) => {
|
|
567
|
-
|
|
567
|
+
nt(c, o, r, i, l);
|
|
568
568
|
});
|
|
569
|
-
const
|
|
569
|
+
const f = document.getElementById(
|
|
570
570
|
Ie(t.id ?? "")
|
|
571
571
|
);
|
|
572
|
-
|
|
572
|
+
f && (f.setAttribute("aria-label", t.labelPrefix ?? tt), f.setAttribute("aria-expanded", String(o && !!t.isTrayOpen)), o ? f.setAttribute("aria-current", "true") : f.removeAttribute("aria-current"));
|
|
573
573
|
}
|
|
574
|
-
const
|
|
575
|
-
const e = t.id ?? "", n = document.getElementById(Ie(e)), o = document.getElementById(
|
|
574
|
+
const Qt = (t) => {
|
|
575
|
+
const e = t.id ?? "", n = document.getElementById(Ie(e)), o = document.getElementById(Je(e));
|
|
576
576
|
document.querySelectorAll(
|
|
577
577
|
ge(e)
|
|
578
578
|
).forEach((i) => {
|
|
@@ -585,7 +585,7 @@ const Yt = (t) => {
|
|
|
585
585
|
all: ["notebook"],
|
|
586
586
|
notes: (t) => ["notebook", "notes", t]
|
|
587
587
|
};
|
|
588
|
-
function
|
|
588
|
+
function Yt(t) {
|
|
589
589
|
const e = we();
|
|
590
590
|
return Oe({
|
|
591
591
|
mutationFn: (n) => t.createNote(n),
|
|
@@ -594,7 +594,7 @@ function Vt(t) {
|
|
|
594
594
|
}
|
|
595
595
|
});
|
|
596
596
|
}
|
|
597
|
-
function
|
|
597
|
+
function Vt(t) {
|
|
598
598
|
const e = we();
|
|
599
599
|
return Oe({
|
|
600
600
|
mutationFn: (n) => t.deleteNote(n),
|
|
@@ -603,26 +603,26 @@ function Zt(t) {
|
|
|
603
603
|
}
|
|
604
604
|
});
|
|
605
605
|
}
|
|
606
|
-
function
|
|
606
|
+
function ot({
|
|
607
607
|
api: t,
|
|
608
608
|
enabled: e = !0,
|
|
609
609
|
...n
|
|
610
610
|
}) {
|
|
611
|
-
return
|
|
611
|
+
return gt({
|
|
612
612
|
queryKey: fe.notes(n),
|
|
613
613
|
queryFn: () => t.getNotes(n),
|
|
614
614
|
enabled: e
|
|
615
615
|
});
|
|
616
616
|
}
|
|
617
|
-
const
|
|
618
|
-
function
|
|
617
|
+
const Zt = 100;
|
|
618
|
+
function rt({
|
|
619
619
|
api: t,
|
|
620
620
|
courseId: e,
|
|
621
621
|
learningObject: n,
|
|
622
622
|
reactions: o,
|
|
623
623
|
enabled: r = !0
|
|
624
624
|
}) {
|
|
625
|
-
return
|
|
625
|
+
return ot({
|
|
626
626
|
api: t,
|
|
627
627
|
filter: {
|
|
628
628
|
...e ? { courseId: e } : {},
|
|
@@ -630,11 +630,11 @@ function st({
|
|
|
630
630
|
...o != null && o.length ? { reactions: o } : {}
|
|
631
631
|
},
|
|
632
632
|
offset: 0,
|
|
633
|
-
pageSize:
|
|
633
|
+
pageSize: Zt,
|
|
634
634
|
enabled: r
|
|
635
635
|
});
|
|
636
636
|
}
|
|
637
|
-
function
|
|
637
|
+
function Jt(t) {
|
|
638
638
|
const e = we();
|
|
639
639
|
return Oe({
|
|
640
640
|
mutationFn: ({ id: n, input: o }) => t.updateNote(n, o),
|
|
@@ -642,10 +642,10 @@ function en(t) {
|
|
|
642
642
|
await e.cancelQueries({ queryKey: fe.all });
|
|
643
643
|
const i = e.getQueryCache().findAll({ queryKey: fe.all }), l = /* @__PURE__ */ new Map();
|
|
644
644
|
for (const a of i) {
|
|
645
|
-
const
|
|
646
|
-
|
|
647
|
-
...
|
|
648
|
-
notes:
|
|
645
|
+
const f = a.state.data;
|
|
646
|
+
f && (l.set(a.queryKey, f), e.setQueryData(a.queryKey, {
|
|
647
|
+
...f,
|
|
648
|
+
notes: f.notes.map(
|
|
649
649
|
(c) => c.id === n ? { ...c, ...o, updatedAt: (/* @__PURE__ */ new Date()).toISOString() } : c
|
|
650
650
|
)
|
|
651
651
|
}));
|
|
@@ -662,74 +662,75 @@ function en(t) {
|
|
|
662
662
|
}
|
|
663
663
|
});
|
|
664
664
|
}
|
|
665
|
-
const
|
|
666
|
-
notebook:
|
|
667
|
-
notes:
|
|
668
|
-
important:
|
|
669
|
-
unclear:
|
|
670
|
-
back:
|
|
671
|
-
editNote:
|
|
672
|
-
save:
|
|
673
|
-
cancel:
|
|
674
|
-
deleteNote:
|
|
675
|
-
deleteNoteConfirmation:
|
|
676
|
-
note:
|
|
677
|
-
addNotePrompt:
|
|
678
|
-
removeFromNotebook:
|
|
679
|
-
addNoteOptional:
|
|
680
|
-
markImportant:
|
|
681
|
-
markUnclear:
|
|
682
|
-
savedToNotebook:
|
|
665
|
+
const en = "Notebook", tn = "Notes", nn = "Important", on = "Unclear", rn = "Back", sn = "Edit note", ln = "Save", an = "Cancel", cn = "Delete note", dn = "Delete note confirmation", un = "note", fn = "Add note (optional)", mn = "Remove from Notebook", gn = "Add a note (optional)", hn = "Mark important", pn = "Mark unclear", yn = "Saved to Notebook.", bn = "Note updated", Nn = "Note deleted", En = "Error saving to Notebook.", Tn = "Error updating note", Sn = "Note deletion failed", vn = "Loading notes", In = "Failed to load notes", Cn = "Start capturing your notes", xn = "Your notes from learning materials will appear here. Highlight key ideas, reflections, or questions as you learn—they'll all be saved in your Notebook for easy review later.", Rn = "Nothing here yet", kn = "Adjust your filters or create a new note to get started.", wn = "You have no notes for the selected filter", On = "Filter", Ln = "Previous page", An = "Next page", Dn = "All courses", Pn = "All notes", _n = "Close Notebook panel", Fn = "To use the Notebook feature, highlight an excerpt from your learning material to flag it as 'confusing' or 'important' and leave an optional note.", Mn = "The content you highlighted is no longer available.", Bn = "Notebook note", Me = {
|
|
666
|
+
notebook: en,
|
|
667
|
+
notes: tn,
|
|
668
|
+
important: nn,
|
|
669
|
+
unclear: on,
|
|
670
|
+
back: rn,
|
|
671
|
+
editNote: sn,
|
|
672
|
+
save: ln,
|
|
673
|
+
cancel: an,
|
|
674
|
+
deleteNote: cn,
|
|
675
|
+
deleteNoteConfirmation: dn,
|
|
676
|
+
note: un,
|
|
677
|
+
addNotePrompt: fn,
|
|
678
|
+
removeFromNotebook: mn,
|
|
679
|
+
addNoteOptional: gn,
|
|
680
|
+
markImportant: hn,
|
|
681
|
+
markUnclear: pn,
|
|
682
|
+
savedToNotebook: yn,
|
|
683
683
|
noteUpdated: bn,
|
|
684
|
-
noteDeleted:
|
|
685
|
-
errorSavingNote:
|
|
686
|
-
errorUpdatingNote:
|
|
687
|
-
noteDeletionFailed:
|
|
688
|
-
loadingNotes:
|
|
689
|
-
failedToLoadNotes:
|
|
690
|
-
emptyStateHeading:
|
|
691
|
-
emptyStateDescription:
|
|
684
|
+
noteDeleted: Nn,
|
|
685
|
+
errorSavingNote: En,
|
|
686
|
+
errorUpdatingNote: Tn,
|
|
687
|
+
noteDeletionFailed: Sn,
|
|
688
|
+
loadingNotes: vn,
|
|
689
|
+
failedToLoadNotes: In,
|
|
690
|
+
emptyStateHeading: Cn,
|
|
691
|
+
emptyStateDescription: xn,
|
|
692
692
|
nothingHereYet: Rn,
|
|
693
|
-
adjustFiltersOrCreate:
|
|
694
|
-
noNotesForFilter:
|
|
695
|
-
filter:
|
|
696
|
-
previousPage:
|
|
697
|
-
nextPage:
|
|
698
|
-
allCourses:
|
|
699
|
-
allNotes:
|
|
700
|
-
closeNotebookPanel:
|
|
701
|
-
featureDescription:
|
|
702
|
-
highlightUnavailable:
|
|
703
|
-
notebookNote:
|
|
704
|
-
},
|
|
705
|
-
function
|
|
693
|
+
adjustFiltersOrCreate: kn,
|
|
694
|
+
noNotesForFilter: wn,
|
|
695
|
+
filter: On,
|
|
696
|
+
previousPage: Ln,
|
|
697
|
+
nextPage: An,
|
|
698
|
+
allCourses: Dn,
|
|
699
|
+
allNotes: Pn,
|
|
700
|
+
closeNotebookPanel: _n,
|
|
701
|
+
featureDescription: Fn,
|
|
702
|
+
highlightUnavailable: Mn,
|
|
703
|
+
notebookNote: Bn
|
|
704
|
+
}, st = qe(null);
|
|
705
|
+
function it(t, e) {
|
|
706
706
|
const n = Me[t] ?? t;
|
|
707
707
|
return e ? n.replace(/%\{([^}]+)}/g, (o, r) => String(e[r] ?? `%{${r}}`)) : n;
|
|
708
708
|
}
|
|
709
|
-
function
|
|
709
|
+
function $n({
|
|
710
710
|
translations: t,
|
|
711
711
|
translate: e,
|
|
712
712
|
children: n
|
|
713
713
|
}) {
|
|
714
|
-
const o = he(
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
714
|
+
const o = he(() => ({
|
|
715
|
+
translations: new Proxy(Me, {
|
|
716
|
+
get(i, l) {
|
|
717
|
+
return (t == null ? void 0 : t[l]) ?? i[l];
|
|
718
|
+
}
|
|
718
719
|
}),
|
|
719
|
-
|
|
720
|
-
);
|
|
721
|
-
return /* @__PURE__ */ s(
|
|
720
|
+
translate: e ?? it
|
|
721
|
+
}), [t, e]);
|
|
722
|
+
return /* @__PURE__ */ s(st.Provider, { value: o, children: n });
|
|
722
723
|
}
|
|
723
724
|
function ee() {
|
|
724
|
-
const t =
|
|
725
|
-
return t || { translations: Me, translate:
|
|
725
|
+
const t = Ke(st);
|
|
726
|
+
return t || { translations: Me, translate: it };
|
|
726
727
|
}
|
|
727
|
-
const
|
|
728
|
+
const Hn = (t) => ({
|
|
728
729
|
selectedNoteId: t ?? null,
|
|
729
730
|
isNoteEditing: !1,
|
|
730
731
|
isTrayOpen: t != null
|
|
731
732
|
});
|
|
732
|
-
function
|
|
733
|
+
function Un(t, e) {
|
|
733
734
|
switch (e.type) {
|
|
734
735
|
case "SELECT_NOTE":
|
|
735
736
|
return {
|
|
@@ -749,8 +750,8 @@ function Gn(t, e) {
|
|
|
749
750
|
return t;
|
|
750
751
|
}
|
|
751
752
|
}
|
|
752
|
-
const
|
|
753
|
-
function
|
|
753
|
+
const lt = qe(null);
|
|
754
|
+
function No({
|
|
754
755
|
api: t,
|
|
755
756
|
currentUserId: e,
|
|
756
757
|
objectId: n,
|
|
@@ -759,11 +760,11 @@ function Eo({
|
|
|
759
760
|
pageLastModifiedAt: i,
|
|
760
761
|
onOpen: l,
|
|
761
762
|
initialNoteId: a,
|
|
762
|
-
translations:
|
|
763
|
+
translations: f,
|
|
763
764
|
translate: c,
|
|
764
765
|
children: y
|
|
765
766
|
}) {
|
|
766
|
-
const [d, h] =
|
|
767
|
+
const [d, h] = Xe(Un, Hn(a)), N = B(a != null), p = he(
|
|
767
768
|
() => ({
|
|
768
769
|
api: t,
|
|
769
770
|
currentUserId: e,
|
|
@@ -776,37 +777,37 @@ function Eo({
|
|
|
776
777
|
clearSelectedNote: () => h({ type: "CLEAR_SELECTED_NOTE" }),
|
|
777
778
|
setEditing: (E) => h({ type: "SET_EDITING", payload: E }),
|
|
778
779
|
openTray: () => {
|
|
779
|
-
|
|
780
|
+
N.current || (N.current = !0, l == null || l()), h({ type: "OPEN_TRAY" });
|
|
780
781
|
},
|
|
781
782
|
closeTray: () => {
|
|
782
|
-
|
|
783
|
+
N.current = !1, h({ type: "CLOSE_TRAY" });
|
|
783
784
|
}
|
|
784
785
|
}),
|
|
785
786
|
[t, e, n, o, r, i, l, d]
|
|
786
787
|
);
|
|
787
|
-
return /* @__PURE__ */ s(
|
|
788
|
+
return /* @__PURE__ */ s(lt.Provider, { value: p, children: /* @__PURE__ */ s($n, { translations: f, translate: c, children: y }) });
|
|
788
789
|
}
|
|
789
|
-
function
|
|
790
|
-
const t =
|
|
790
|
+
function at() {
|
|
791
|
+
const t = Ke(lt);
|
|
791
792
|
if (!t)
|
|
792
793
|
throw new Error("useNotebook must be used within a NotebookProvider");
|
|
793
794
|
return t;
|
|
794
795
|
}
|
|
795
|
-
const
|
|
796
|
-
const { isTrayOpen: e, closeTray: n } =
|
|
796
|
+
const ct = "notebook-tray-content", Eo = ({ children: t }) => {
|
|
797
|
+
const { isTrayOpen: e, closeTray: n } = at(), { translations: o } = ee();
|
|
797
798
|
return /* @__PURE__ */ s(
|
|
798
|
-
|
|
799
|
+
pt,
|
|
799
800
|
{
|
|
800
801
|
label: o.notebook,
|
|
801
802
|
open: e,
|
|
802
803
|
onDismiss: n,
|
|
803
804
|
placement: "end",
|
|
804
805
|
size: "regular",
|
|
805
|
-
children: /* @__PURE__ */ S(
|
|
806
|
-
/* @__PURE__ */ s(
|
|
806
|
+
children: /* @__PURE__ */ S(R, { direction: "column", height: "100vh", id: ct, children: [
|
|
807
|
+
/* @__PURE__ */ s(R.Item, { children: /* @__PURE__ */ s(X, { as: "div", padding: "small medium", borderWidth: "0 0 small 0", children: /* @__PURE__ */ S(R, { justifyItems: "space-between", alignItems: "center", children: [
|
|
807
808
|
/* @__PURE__ */ s(Se, { level: "h3", children: o.notebook }),
|
|
808
809
|
/* @__PURE__ */ s(
|
|
809
|
-
|
|
810
|
+
ht,
|
|
810
811
|
{
|
|
811
812
|
screenReaderLabel: o.closeNotebookPanel,
|
|
812
813
|
onClick: n,
|
|
@@ -815,14 +816,14 @@ const dt = "notebook-tray-content", To = ({ children: t }) => {
|
|
|
815
816
|
}
|
|
816
817
|
)
|
|
817
818
|
] }) }) }),
|
|
818
|
-
/* @__PURE__ */ s(
|
|
819
|
+
/* @__PURE__ */ s(R.Item, { shouldGrow: !0, shouldShrink: !0, overflowY: "auto", overflowX: "hidden", children: t })
|
|
819
820
|
] })
|
|
820
821
|
}
|
|
821
822
|
);
|
|
822
823
|
}, jn = ({ currentType: t, onSelectReaction: e }) => {
|
|
823
|
-
const { translations: n } = ee(), o =
|
|
824
|
+
const { translations: n } = ee(), o = B(null), r = B(null);
|
|
824
825
|
return z(() => {
|
|
825
|
-
t ===
|
|
826
|
+
t === k.CONFUSING && o.current ? o.current.focus() : t === k.IMPORTANT && r.current ? r.current.focus() : o.current && o.current.focus();
|
|
826
827
|
}, [t]), /* @__PURE__ */ s(
|
|
827
828
|
X,
|
|
828
829
|
{
|
|
@@ -837,7 +838,7 @@ const dt = "notebook-tray-content", To = ({ children: t }) => {
|
|
|
837
838
|
ue.Item,
|
|
838
839
|
{
|
|
839
840
|
ref: o,
|
|
840
|
-
onClick: () => e(
|
|
841
|
+
onClick: () => e(k.CONFUSING),
|
|
841
842
|
children: [
|
|
842
843
|
/* @__PURE__ */ s(Le, { size: "x-small" }),
|
|
843
844
|
` ${n.markUnclear}`
|
|
@@ -848,7 +849,7 @@ const dt = "notebook-tray-content", To = ({ children: t }) => {
|
|
|
848
849
|
ue.Item,
|
|
849
850
|
{
|
|
850
851
|
ref: r,
|
|
851
|
-
onClick: () => e(
|
|
852
|
+
onClick: () => e(k.IMPORTANT),
|
|
852
853
|
children: [
|
|
853
854
|
/* @__PURE__ */ s(Ae, { size: "x-small" }),
|
|
854
855
|
` ${n.markImportant}`
|
|
@@ -859,7 +860,7 @@ const dt = "notebook-tray-content", To = ({ children: t }) => {
|
|
|
859
860
|
}
|
|
860
861
|
);
|
|
861
862
|
}, Ce = "notebook-inline-reaction-menu";
|
|
862
|
-
function
|
|
863
|
+
function To({
|
|
863
864
|
containerRef: t,
|
|
864
865
|
highlightTheme: e,
|
|
865
866
|
debounceTime: n = 500,
|
|
@@ -870,19 +871,19 @@ function So({
|
|
|
870
871
|
}) {
|
|
871
872
|
const {
|
|
872
873
|
api: a,
|
|
873
|
-
objectId:
|
|
874
|
+
objectId: f,
|
|
874
875
|
objectType: c,
|
|
875
876
|
courseId: y,
|
|
876
877
|
pageLastModifiedAt: d,
|
|
877
878
|
selectedNoteId: h,
|
|
878
|
-
isTrayOpen:
|
|
879
|
+
isTrayOpen: N,
|
|
879
880
|
selectNote: p,
|
|
880
881
|
openTray: E
|
|
881
|
-
} =
|
|
882
|
+
} = at(), { translations: g } = ee(), { data: Q } = rt({
|
|
882
883
|
api: a,
|
|
883
884
|
courseId: y,
|
|
884
|
-
learningObject: { type: c, id:
|
|
885
|
-
}), { mutate:
|
|
885
|
+
learningObject: { type: c, id: f }
|
|
886
|
+
}), { mutate: G } = Yt(a), { mutateAsync: b } = Jt(a), { mutate: C } = Vt(a), A = B([]), [$, D] = j([]), [T, O] = j(null), [x, F] = j(""), [V, Z] = j(null), ce = B(null);
|
|
886
887
|
ce.current = V;
|
|
887
888
|
const [J, de] = j(!1);
|
|
888
889
|
z(() => {
|
|
@@ -893,99 +894,99 @@ function So({
|
|
|
893
894
|
de(!0);
|
|
894
895
|
return;
|
|
895
896
|
}
|
|
896
|
-
const
|
|
897
|
-
for (const
|
|
898
|
-
if (
|
|
899
|
-
de(!0),
|
|
897
|
+
const _ = new MutationObserver((L) => {
|
|
898
|
+
for (const U of L)
|
|
899
|
+
if (U.type === "attributes" && U.attributeName === "class" && U.target.classList.contains("enhanced")) {
|
|
900
|
+
de(!0), _.disconnect();
|
|
900
901
|
return;
|
|
901
902
|
}
|
|
902
903
|
});
|
|
903
|
-
return
|
|
904
|
+
return _.observe(I, { attributes: !0, attributeFilter: ["class"] }), () => _.disconnect();
|
|
904
905
|
}, [t]);
|
|
905
906
|
const Y = q(() => {
|
|
906
|
-
Z(null), O(null),
|
|
907
|
+
Z(null), O(null), F("");
|
|
907
908
|
}, []);
|
|
908
909
|
z(() => {
|
|
909
910
|
if (!J || !t.current) return;
|
|
910
911
|
let I = null;
|
|
911
|
-
const
|
|
912
|
+
const _ = () => {
|
|
912
913
|
I && clearTimeout(I), I = setTimeout(() => {
|
|
913
914
|
var ie;
|
|
914
|
-
const v = window.getSelection(),
|
|
915
|
-
if (!(v != null && v.rangeCount) || !
|
|
915
|
+
const v = window.getSelection(), M = t.current;
|
|
916
|
+
if (!(v != null && v.rangeCount) || !M) return;
|
|
916
917
|
const ne = v.toString().trim();
|
|
917
918
|
if (ne === "") return;
|
|
918
|
-
const
|
|
919
|
-
if (!
|
|
920
|
-
const
|
|
921
|
-
|
|
919
|
+
const m = v.getRangeAt(0);
|
|
920
|
+
if (!M.contains(m.commonAncestorContainer)) return;
|
|
921
|
+
const W = (ie = le.fromRange(M, m)) == null ? void 0 : ie.toSelector();
|
|
922
|
+
W && !Ht(W, $) && (O(m.cloneRange()), F(ne), Z($t(m)));
|
|
922
923
|
}, n);
|
|
923
|
-
},
|
|
924
|
+
}, L = (v) => {
|
|
924
925
|
if (!(v.target instanceof Node)) return;
|
|
925
|
-
const
|
|
926
|
-
|
|
927
|
-
},
|
|
926
|
+
const M = document.getElementById(Ce);
|
|
927
|
+
M != null && M.contains(v.target) ? (v.preventDefault(), v.stopImmediatePropagation()) : Y();
|
|
928
|
+
}, U = () => {
|
|
928
929
|
Y();
|
|
929
|
-
},
|
|
930
|
+
}, P = (v) => {
|
|
930
931
|
v.key === "Escape" && ce.current !== null && (Y(), v.stopImmediatePropagation());
|
|
931
932
|
};
|
|
932
|
-
return document.addEventListener("selectionchange",
|
|
933
|
-
I && clearTimeout(I), document.removeEventListener("selectionchange",
|
|
933
|
+
return document.addEventListener("selectionchange", _), document.addEventListener("mousedown", L), document.addEventListener("touchstart", L), document.addEventListener("keydown", P), window.addEventListener("scroll", U, !0), () => {
|
|
934
|
+
I && clearTimeout(I), document.removeEventListener("selectionchange", _), document.removeEventListener("mousedown", L), document.removeEventListener("touchstart", L), document.removeEventListener("keydown", P), window.removeEventListener("scroll", U, !0);
|
|
934
935
|
};
|
|
935
|
-
}, [J,
|
|
936
|
+
}, [J, $, n, t, Y]);
|
|
936
937
|
const te = q(
|
|
937
938
|
(w) => {
|
|
938
|
-
var
|
|
939
|
+
var M;
|
|
939
940
|
const I = t.current;
|
|
940
941
|
if (!I || !w.highlightData) return null;
|
|
941
|
-
const { highlightData:
|
|
942
|
+
const { highlightData: _, reaction: L, id: U } = w, { range: P } = _, v = P && ((M = ae.fromSelector(I, P)) == null ? void 0 : M.toRange());
|
|
942
943
|
if (v) {
|
|
943
|
-
const ne =
|
|
944
|
-
id:
|
|
944
|
+
const ne = L[0] === k.IMPORTANT ? g.important : g.unclear, m = {
|
|
945
|
+
id: U,
|
|
945
946
|
selectedNoteId: h,
|
|
946
|
-
type:
|
|
947
|
-
isTrayOpen:
|
|
947
|
+
type: L[0],
|
|
948
|
+
isTrayOpen: N,
|
|
948
949
|
labelPrefix: `${g.notebookNote} (${ne})`,
|
|
949
|
-
popupId:
|
|
950
|
+
popupId: ct,
|
|
950
951
|
onClick: () => {
|
|
951
|
-
p(
|
|
952
|
+
p(U), E();
|
|
952
953
|
}
|
|
953
954
|
};
|
|
954
|
-
return
|
|
955
|
+
return Kt(v, m, e), _.textPosition;
|
|
955
956
|
}
|
|
956
957
|
return null;
|
|
957
958
|
},
|
|
958
|
-
[t, h,
|
|
959
|
+
[t, h, N, e, g, p, E]
|
|
959
960
|
);
|
|
960
961
|
z(() => {
|
|
961
962
|
if (!J || !Q || !t.current) return;
|
|
962
|
-
const w = t.current, I = Q.notes,
|
|
963
|
+
const w = t.current, I = Q.notes, _ = /* @__PURE__ */ new Set(), L = [], U = [];
|
|
963
964
|
if (I.length === 0) {
|
|
964
|
-
if (
|
|
965
|
-
for (const
|
|
966
|
-
|
|
967
|
-
|
|
965
|
+
if (A.current.length > 0) {
|
|
966
|
+
for (const P of A.current)
|
|
967
|
+
Ge(P, w);
|
|
968
|
+
A.current = [], D([]);
|
|
968
969
|
}
|
|
969
970
|
return;
|
|
970
971
|
}
|
|
971
972
|
if (d && I[0].highlightData.pageLastModifiedAt !== d) {
|
|
972
|
-
const { notesForUpdate:
|
|
973
|
+
const { notesForUpdate: P, noteIdsForDelete: v } = Mt(
|
|
973
974
|
w,
|
|
974
975
|
I,
|
|
975
976
|
d
|
|
976
977
|
);
|
|
977
|
-
for (const
|
|
978
|
-
|
|
979
|
-
for (const
|
|
980
|
-
C(
|
|
978
|
+
for (const M of P)
|
|
979
|
+
b({ id: M.id, input: M }).catch((ne) => r == null ? void 0 : r(ne));
|
|
980
|
+
for (const M of v)
|
|
981
|
+
C(M, { onError: i });
|
|
981
982
|
} else {
|
|
982
|
-
for (const
|
|
983
|
-
const v = te(
|
|
984
|
-
|
|
983
|
+
for (const P of I) {
|
|
984
|
+
const v = te(P);
|
|
985
|
+
_.add(P.id), v && (L.push(P), U.push(v));
|
|
985
986
|
}
|
|
986
|
-
for (const
|
|
987
|
-
|
|
988
|
-
|
|
987
|
+
for (const P of A.current)
|
|
988
|
+
_.has(P.id) || Ge(P, w);
|
|
989
|
+
D(U), A.current = L, h && Bt(h);
|
|
989
990
|
}
|
|
990
991
|
}, [
|
|
991
992
|
J,
|
|
@@ -993,39 +994,39 @@ function So({
|
|
|
993
994
|
te,
|
|
994
995
|
d,
|
|
995
996
|
t,
|
|
996
|
-
|
|
997
|
+
b,
|
|
997
998
|
C,
|
|
998
999
|
h
|
|
999
1000
|
]);
|
|
1000
|
-
const
|
|
1001
|
+
const H = (w) => {
|
|
1001
1002
|
const I = t.current;
|
|
1002
1003
|
if (!T || !I) return;
|
|
1003
|
-
const
|
|
1004
|
-
|
|
1004
|
+
const _ = ae.fromRange(I, T), L = le.fromRange(I, T);
|
|
1005
|
+
G(
|
|
1005
1006
|
{
|
|
1006
1007
|
courseId: y,
|
|
1007
|
-
objectId:
|
|
1008
|
+
objectId: f,
|
|
1008
1009
|
objectType: c,
|
|
1009
1010
|
userText: "",
|
|
1010
1011
|
reaction: [w],
|
|
1011
1012
|
highlightData: {
|
|
1012
1013
|
selectedText: x,
|
|
1013
|
-
textPosition: (
|
|
1014
|
-
range:
|
|
1014
|
+
textPosition: (L == null ? void 0 : L.toSelector()) ?? null,
|
|
1015
|
+
range: _.toSelector(),
|
|
1015
1016
|
pageLastModifiedAt: d ?? ""
|
|
1016
1017
|
}
|
|
1017
1018
|
},
|
|
1018
1019
|
{
|
|
1019
|
-
onSuccess: (
|
|
1020
|
+
onSuccess: (U) => {
|
|
1020
1021
|
var v;
|
|
1021
|
-
const
|
|
1022
|
-
Y(), (v = window.getSelection()) == null || v.removeAllRanges(), p(
|
|
1022
|
+
const P = U.id;
|
|
1023
|
+
Y(), (v = window.getSelection()) == null || v.removeAllRanges(), p(P), E(), l == null || l(U);
|
|
1023
1024
|
},
|
|
1024
1025
|
onError: o
|
|
1025
1026
|
}
|
|
1026
1027
|
);
|
|
1027
1028
|
};
|
|
1028
|
-
return !T || !V ? null :
|
|
1029
|
+
return !T || !V ? null : ft(
|
|
1029
1030
|
/* @__PURE__ */ s(
|
|
1030
1031
|
"div",
|
|
1031
1032
|
{
|
|
@@ -1042,23 +1043,23 @@ function So({
|
|
|
1042
1043
|
const I = document.getElementById(Ce);
|
|
1043
1044
|
I != null && I.contains(w.relatedTarget) || Y();
|
|
1044
1045
|
},
|
|
1045
|
-
children: /* @__PURE__ */ s(jn, { onSelectReaction:
|
|
1046
|
+
children: /* @__PURE__ */ s(jn, { onSelectReaction: H })
|
|
1046
1047
|
}
|
|
1047
1048
|
),
|
|
1048
1049
|
document.body
|
|
1049
1050
|
);
|
|
1050
1051
|
}
|
|
1051
|
-
const
|
|
1052
|
-
backgroundColor: t ===
|
|
1053
|
-
underlineColor: t ===
|
|
1054
|
-
underlineStyle: t ===
|
|
1055
|
-
}),
|
|
1052
|
+
const Gn = (t, e) => ({
|
|
1053
|
+
backgroundColor: t === k.IMPORTANT ? e.colors.importantBackground : e.colors.confusingBackground,
|
|
1054
|
+
underlineColor: t === k.IMPORTANT ? e.colors.importantUnderline : e.colors.confusingUnderline,
|
|
1055
|
+
underlineStyle: t === k.IMPORTANT ? "solid" : "dashed"
|
|
1056
|
+
}), ke = ({
|
|
1056
1057
|
children: t,
|
|
1057
|
-
type: e =
|
|
1058
|
+
type: e = k.IMPORTANT,
|
|
1058
1059
|
isCardActive: n = !0,
|
|
1059
1060
|
theme: o
|
|
1060
1061
|
}) => {
|
|
1061
|
-
const r =
|
|
1062
|
+
const r = Gn(e, o), l = {
|
|
1062
1063
|
position: "relative",
|
|
1063
1064
|
backgroundColor: n ? r.backgroundColor : Fe(r.backgroundColor, 0.5),
|
|
1064
1065
|
textDecorationLine: "underline",
|
|
@@ -1069,47 +1070,47 @@ const Wn = (t, e) => ({
|
|
|
1069
1070
|
lineHeight: "normal"
|
|
1070
1071
|
};
|
|
1071
1072
|
return /* @__PURE__ */ s("span", { "data-note-highlight": "true", style: l, children: t });
|
|
1072
|
-
},
|
|
1073
|
+
}, dt = () => {
|
|
1073
1074
|
const { translations: t } = ee();
|
|
1074
|
-
return /* @__PURE__ */ S(
|
|
1075
|
-
/* @__PURE__ */ s(
|
|
1076
|
-
/* @__PURE__ */ s(
|
|
1075
|
+
return /* @__PURE__ */ S(R, { gap: "xx-small", alignItems: "start", as: "div", children: [
|
|
1076
|
+
/* @__PURE__ */ s(R.Item, { as: "div", children: /* @__PURE__ */ s(yt, { color: "error" }) }),
|
|
1077
|
+
/* @__PURE__ */ s(R.Item, { padding: "xxx-small none", shouldShrink: !0, children: /* @__PURE__ */ s(Ee, { maxLines: 3, children: t.highlightUnavailable }) })
|
|
1077
1078
|
] });
|
|
1078
|
-
},
|
|
1079
|
+
}, Wn = {
|
|
1079
1080
|
filter: null,
|
|
1080
1081
|
courseFilter: null,
|
|
1081
1082
|
currentPage: 1,
|
|
1082
1083
|
totalPages: void 0
|
|
1083
1084
|
};
|
|
1084
|
-
function
|
|
1085
|
+
function Ne(t, e) {
|
|
1085
1086
|
const n = typeof e == "number" ? Math.min(e, t) : t;
|
|
1086
1087
|
return Math.max(1, n);
|
|
1087
1088
|
}
|
|
1088
|
-
function
|
|
1089
|
+
function zn(t, e) {
|
|
1089
1090
|
switch (e.type) {
|
|
1090
1091
|
case "SET_FILTER":
|
|
1091
1092
|
return { ...t, filter: e.payload, currentPage: 1 };
|
|
1092
1093
|
case "SET_COURSE_FILTER":
|
|
1093
1094
|
return { ...t, courseFilter: e.payload, currentPage: 1 };
|
|
1094
1095
|
case "SET_PAGE":
|
|
1095
|
-
return { ...t, currentPage:
|
|
1096
|
+
return { ...t, currentPage: Ne(e.payload, t.totalPages) };
|
|
1096
1097
|
case "FOCUS_PAGE":
|
|
1097
1098
|
return { ...t, currentPage: Math.max(1, e.payload) };
|
|
1098
1099
|
case "INCREMENT_PAGE":
|
|
1099
|
-
return { ...t, currentPage:
|
|
1100
|
+
return { ...t, currentPage: Ne(t.currentPage + 1, t.totalPages) };
|
|
1100
1101
|
case "DECREMENT_PAGE":
|
|
1101
|
-
return { ...t, currentPage:
|
|
1102
|
+
return { ...t, currentPage: Ne(t.currentPage - 1, t.totalPages) };
|
|
1102
1103
|
case "SET_TOTAL_PAGES":
|
|
1103
1104
|
return t.totalPages === e.payload ? t : {
|
|
1104
1105
|
...t,
|
|
1105
1106
|
totalPages: e.payload,
|
|
1106
|
-
currentPage:
|
|
1107
|
+
currentPage: Ne(t.currentPage, e.payload)
|
|
1107
1108
|
};
|
|
1108
1109
|
default:
|
|
1109
1110
|
return t;
|
|
1110
1111
|
}
|
|
1111
1112
|
}
|
|
1112
|
-
function
|
|
1113
|
+
function So({
|
|
1113
1114
|
api: t,
|
|
1114
1115
|
courseId: e,
|
|
1115
1116
|
enableCourseFilter: n = !1,
|
|
@@ -1118,55 +1119,55 @@ function vo({
|
|
|
1118
1119
|
focusNoteId: i
|
|
1119
1120
|
}) {
|
|
1120
1121
|
var te;
|
|
1121
|
-
const [l, a] =
|
|
1122
|
+
const [l, a] = Xe(zn, Wn), { filter: f, courseFilter: c, currentPage: y, totalPages: d } = l;
|
|
1122
1123
|
z(() => {
|
|
1123
1124
|
a({ type: "SET_PAGE", payload: 1 });
|
|
1124
1125
|
}, [r]);
|
|
1125
|
-
const h = n ? c : e,
|
|
1126
|
+
const h = n ? c : e, N = (y - 1) * r, p = !!o, E = {
|
|
1126
1127
|
...h ? { courseId: h } : {},
|
|
1127
|
-
...
|
|
1128
|
+
...f ? { reactions: [f] } : {},
|
|
1128
1129
|
...o ? { learningObject: o } : {}
|
|
1129
1130
|
}, {
|
|
1130
1131
|
data: g,
|
|
1131
1132
|
isLoading: Q,
|
|
1132
|
-
isError:
|
|
1133
|
-
} =
|
|
1133
|
+
isError: G
|
|
1134
|
+
} = ot({
|
|
1134
1135
|
api: t,
|
|
1135
1136
|
filter: E,
|
|
1136
|
-
offset:
|
|
1137
|
+
offset: N,
|
|
1137
1138
|
pageSize: r,
|
|
1138
1139
|
enabled: !p
|
|
1139
1140
|
}), {
|
|
1140
|
-
data:
|
|
1141
|
+
data: b,
|
|
1141
1142
|
isLoading: C,
|
|
1142
|
-
isError:
|
|
1143
|
-
} =
|
|
1143
|
+
isError: A
|
|
1144
|
+
} = rt({
|
|
1144
1145
|
api: t,
|
|
1145
1146
|
courseId: h ?? void 0,
|
|
1146
1147
|
learningObject: o,
|
|
1147
1148
|
enabled: p
|
|
1148
|
-
}),
|
|
1149
|
-
const
|
|
1150
|
-
return
|
|
1151
|
-
}, [
|
|
1149
|
+
}), $ = he(() => {
|
|
1150
|
+
const H = (b == null ? void 0 : b.notes) ?? [];
|
|
1151
|
+
return f ? H.filter((w) => w.reaction.includes(f)) : H;
|
|
1152
|
+
}, [b, f]), D = B(null);
|
|
1152
1153
|
z(() => {
|
|
1153
1154
|
if (!i) {
|
|
1154
|
-
|
|
1155
|
+
D.current = null;
|
|
1155
1156
|
return;
|
|
1156
1157
|
}
|
|
1157
|
-
if (
|
|
1158
|
-
const
|
|
1159
|
-
if (
|
|
1160
|
-
|
|
1161
|
-
const w = Math.floor(
|
|
1158
|
+
if (D.current === i) return;
|
|
1159
|
+
const H = $.findIndex((I) => I.id === i);
|
|
1160
|
+
if (H === -1) return;
|
|
1161
|
+
D.current = i;
|
|
1162
|
+
const w = Math.floor(H / r) + 1;
|
|
1162
1163
|
w !== y && a({ type: "FOCUS_PAGE", payload: w });
|
|
1163
|
-
}, [i,
|
|
1164
|
-
const T = p ?
|
|
1164
|
+
}, [i, $, r, y]);
|
|
1165
|
+
const T = p ? $.slice(N, N + r) : (g == null ? void 0 : g.notes) ?? [], O = p ? C : Q, x = p ? A : G, F = p ? Math.max(1, Math.ceil($.length / r)) : ((te = g == null ? void 0 : g.pageInfo) == null ? void 0 : te.totalNrOfPages) ?? void 0, V = p ? { totalCount: $.length, totalNrOfPages: F } : g == null ? void 0 : g.pageInfo;
|
|
1165
1166
|
z(() => {
|
|
1166
|
-
a({ type: "SET_TOTAL_PAGES", payload:
|
|
1167
|
-
}, [
|
|
1168
|
-
const Z = q((
|
|
1169
|
-
a({ type: "SET_PAGE", payload:
|
|
1167
|
+
a({ type: "SET_TOTAL_PAGES", payload: F });
|
|
1168
|
+
}, [F]);
|
|
1169
|
+
const Z = q((H) => {
|
|
1170
|
+
a({ type: "SET_PAGE", payload: H });
|
|
1170
1171
|
}, []), ce = q(() => {
|
|
1171
1172
|
a({
|
|
1172
1173
|
type: "INCREMENT_PAGE"
|
|
@@ -1177,17 +1178,17 @@ function vo({
|
|
|
1177
1178
|
type: "DECREMENT_PAGE"
|
|
1178
1179
|
/* DecrementPage */
|
|
1179
1180
|
});
|
|
1180
|
-
}, []), de = q((
|
|
1181
|
-
a({ type: "SET_FILTER", payload:
|
|
1182
|
-
}, []), Y = q((
|
|
1183
|
-
a({ type: "SET_COURSE_FILTER", payload:
|
|
1181
|
+
}, []), de = q((H) => {
|
|
1182
|
+
a({ type: "SET_FILTER", payload: H });
|
|
1183
|
+
}, []), Y = q((H) => {
|
|
1184
|
+
a({ type: "SET_COURSE_FILTER", payload: H });
|
|
1184
1185
|
}, []);
|
|
1185
1186
|
return {
|
|
1186
1187
|
notes: T,
|
|
1187
1188
|
pageInfo: V,
|
|
1188
1189
|
isLoading: O,
|
|
1189
1190
|
isError: x,
|
|
1190
|
-
filter:
|
|
1191
|
+
filter: f,
|
|
1191
1192
|
courseFilter: c,
|
|
1192
1193
|
currentPage: y,
|
|
1193
1194
|
totalPages: d,
|
|
@@ -1199,12 +1200,12 @@ function vo({
|
|
|
1199
1200
|
};
|
|
1200
1201
|
}
|
|
1201
1202
|
const xe = "all";
|
|
1202
|
-
function
|
|
1203
|
+
function vo({ filter: t, setFilter: e }) {
|
|
1203
1204
|
const { translations: n } = ee(), o = he(
|
|
1204
1205
|
() => [
|
|
1205
1206
|
{ label: n.allNotes, value: xe },
|
|
1206
|
-
{ label: n.important, value:
|
|
1207
|
-
{ label: n.unclear, value:
|
|
1207
|
+
{ label: n.important, value: k.IMPORTANT },
|
|
1208
|
+
{ label: n.unclear, value: k.CONFUSING }
|
|
1208
1209
|
],
|
|
1209
1210
|
[n]
|
|
1210
1211
|
), r = q(
|
|
@@ -1230,26 +1231,26 @@ function Io({ filter: t, setFilter: e }) {
|
|
|
1230
1231
|
handleReactionFilterChange: r
|
|
1231
1232
|
};
|
|
1232
1233
|
}
|
|
1233
|
-
const
|
|
1234
|
+
const qn = ({ hasActiveFilter: t = !1 }) => {
|
|
1234
1235
|
const { translations: e } = ee(), n = t ? e.nothingHereYet : e.emptyStateHeading, o = t ? e.adjustFiltersOrCreate : e.emptyStateDescription;
|
|
1235
|
-
return /* @__PURE__ */ s(X, { as: "div", textAlign: "center", children: /* @__PURE__ */ S(
|
|
1236
|
+
return /* @__PURE__ */ s(X, { as: "div", textAlign: "center", children: /* @__PURE__ */ S(R, { direction: "column", alignItems: "center", gap: "small", children: [
|
|
1236
1237
|
!t && /* @__PURE__ */ s(bt, { size: "medium" }),
|
|
1237
1238
|
/* @__PURE__ */ s(Se, { level: "h3", children: n }),
|
|
1238
1239
|
/* @__PURE__ */ s(oe, { color: "secondary", children: o })
|
|
1239
1240
|
] }) });
|
|
1240
|
-
},
|
|
1241
|
-
[
|
|
1241
|
+
}, Kn = {
|
|
1242
|
+
[k.IMPORTANT]: {
|
|
1242
1243
|
color: "success",
|
|
1243
1244
|
translationKey: "important",
|
|
1244
1245
|
icon: /* @__PURE__ */ s(Ae, { size: "x-small" })
|
|
1245
1246
|
},
|
|
1246
|
-
[
|
|
1247
|
-
color: "
|
|
1247
|
+
[k.CONFUSING]: {
|
|
1248
|
+
color: "error",
|
|
1248
1249
|
translationKey: "unclear",
|
|
1249
1250
|
icon: /* @__PURE__ */ s(Le, { size: "x-small" })
|
|
1250
1251
|
}
|
|
1251
|
-
},
|
|
1252
|
-
const { translations: o } = ee(), r =
|
|
1252
|
+
}, ut = ({ type: t, onTypeChange: e, renderAsMenuTrigger: n = !1 }) => {
|
|
1253
|
+
const { translations: o } = ee(), r = Kn[t], i = o[r.translationKey], [l, a] = j(!1), f = B(null), c = B(null), y = B(null), d = q(
|
|
1253
1254
|
(h) => {
|
|
1254
1255
|
e == null || e(h), a(!1);
|
|
1255
1256
|
},
|
|
@@ -1259,12 +1260,12 @@ const Kn = ({ hasActiveFilter: t = !1 }) => {
|
|
|
1259
1260
|
if (!l) return;
|
|
1260
1261
|
const h = (p) => {
|
|
1261
1262
|
p.key === "Escape" && p.stopPropagation();
|
|
1262
|
-
},
|
|
1263
|
+
}, N = (p) => {
|
|
1263
1264
|
var E;
|
|
1264
1265
|
p.key === "Escape" && (p.stopPropagation(), a(!1), (E = y.current) == null || E.focus());
|
|
1265
1266
|
};
|
|
1266
|
-
return document.addEventListener("keydown", h, !0), document.addEventListener("keyup",
|
|
1267
|
-
document.removeEventListener("keydown", h, !0), document.removeEventListener("keyup",
|
|
1267
|
+
return document.addEventListener("keydown", h, !0), document.addEventListener("keyup", N, !0), () => {
|
|
1268
|
+
document.removeEventListener("keydown", h, !0), document.removeEventListener("keyup", N, !0);
|
|
1268
1269
|
};
|
|
1269
1270
|
}, [l]), n && e ? /* @__PURE__ */ S(
|
|
1270
1271
|
ue,
|
|
@@ -1286,26 +1287,26 @@ const Kn = ({ hasActiveFilter: t = !1 }) => {
|
|
|
1286
1287
|
}
|
|
1287
1288
|
),
|
|
1288
1289
|
children: [
|
|
1289
|
-
/* @__PURE__ */ S(ue.Item, { ref:
|
|
1290
|
+
/* @__PURE__ */ S(ue.Item, { ref: f, onClick: () => d(k.CONFUSING), children: [
|
|
1290
1291
|
/* @__PURE__ */ s(Le, { size: "x-small" }),
|
|
1291
1292
|
` ${o.markUnclear}`
|
|
1292
1293
|
] }),
|
|
1293
|
-
/* @__PURE__ */ S(ue.Item, { ref: c, onClick: () => d(
|
|
1294
|
+
/* @__PURE__ */ S(ue.Item, { ref: c, onClick: () => d(k.IMPORTANT), children: [
|
|
1294
1295
|
/* @__PURE__ */ s(Ae, { size: "x-small" }),
|
|
1295
1296
|
` ${o.markImportant}`
|
|
1296
1297
|
] })
|
|
1297
1298
|
]
|
|
1298
1299
|
}
|
|
1299
1300
|
) : /* @__PURE__ */ s(X, { display: "inline-flex", children: /* @__PURE__ */ s($e, { color: r.color, renderIcon: r.icon, children: i }) });
|
|
1300
|
-
}
|
|
1301
|
-
function
|
|
1301
|
+
};
|
|
1302
|
+
function We(t, e) {
|
|
1302
1303
|
return (t instanceof Date ? t : new Date(t)).toLocaleString(e, {
|
|
1303
1304
|
year: "numeric",
|
|
1304
1305
|
month: "short",
|
|
1305
1306
|
day: "numeric"
|
|
1306
1307
|
});
|
|
1307
1308
|
}
|
|
1308
|
-
const
|
|
1309
|
+
const Xn = ({
|
|
1309
1310
|
noteId: t,
|
|
1310
1311
|
date: e,
|
|
1311
1312
|
highlight: n,
|
|
@@ -1314,50 +1315,50 @@ const Qn = ({
|
|
|
1314
1315
|
onClick: i,
|
|
1315
1316
|
onDelete: l,
|
|
1316
1317
|
onSaveNote: a,
|
|
1317
|
-
onTypeChange:
|
|
1318
|
+
onTypeChange: f,
|
|
1318
1319
|
isActive: c,
|
|
1319
1320
|
isPanelView: y = !1,
|
|
1320
1321
|
courseName: d,
|
|
1321
1322
|
locale: h,
|
|
1322
|
-
highlightTheme:
|
|
1323
|
+
highlightTheme: N,
|
|
1323
1324
|
renderLink: p,
|
|
1324
1325
|
href: E
|
|
1325
1326
|
}) => {
|
|
1326
|
-
const { translations: g } = ee(), [Q,
|
|
1327
|
-
J.current =
|
|
1328
|
-
}, []), Y =
|
|
1327
|
+
const { translations: g } = ee(), [Q, G] = j(!1), [b, C] = j(!1), [A, $] = j(o || ""), [D, T] = j(!1), [O, x] = j(!1), [F, V] = j(!1), [Z, ce] = j(!1), J = B(null), de = q((m) => {
|
|
1328
|
+
J.current = m;
|
|
1329
|
+
}, []), Y = B(null), te = B(null), H = B(!1), w = B(null), I = B(null), _ = B(!1);
|
|
1329
1330
|
z(() => {
|
|
1330
|
-
var
|
|
1331
|
-
c ? ((
|
|
1331
|
+
var m, W;
|
|
1332
|
+
c ? ((m = J.current) == null || m.scrollIntoView({ behavior: "smooth", block: "nearest" }), (W = J.current) == null || W.focus()) : T(!1);
|
|
1332
1333
|
}, [c]), z(() => {
|
|
1333
|
-
var
|
|
1334
|
-
|
|
1335
|
-
}, [
|
|
1336
|
-
if (!
|
|
1337
|
-
|
|
1338
|
-
const
|
|
1339
|
-
|
|
1334
|
+
var m, W;
|
|
1335
|
+
b ? (H.current = !0, (m = Y.current) == null || m.focus()) : H.current && (H.current = !1, (W = te.current) == null || W.focus());
|
|
1336
|
+
}, [b]), z(() => {
|
|
1337
|
+
if (!D && _.current) {
|
|
1338
|
+
_.current = !1;
|
|
1339
|
+
const m = w.current;
|
|
1340
|
+
m != null && m.isConnected && m.focus();
|
|
1340
1341
|
}
|
|
1341
|
-
}, [
|
|
1342
|
-
const
|
|
1343
|
-
|
|
1342
|
+
}, [D]);
|
|
1343
|
+
const L = q((m, W) => {
|
|
1344
|
+
_.current = !W, T(!1);
|
|
1344
1345
|
}, []);
|
|
1345
1346
|
z(() => {
|
|
1346
|
-
if (!
|
|
1347
|
-
const
|
|
1347
|
+
if (!D) return;
|
|
1348
|
+
const m = (ie) => {
|
|
1348
1349
|
ie.key === "Escape" && ie.stopPropagation();
|
|
1349
|
-
},
|
|
1350
|
-
ie.key === "Escape" && (ie.stopPropagation(),
|
|
1350
|
+
}, W = (ie) => {
|
|
1351
|
+
ie.key === "Escape" && (ie.stopPropagation(), L());
|
|
1351
1352
|
};
|
|
1352
|
-
return window.addEventListener("keydown",
|
|
1353
|
-
window.removeEventListener("keydown",
|
|
1353
|
+
return window.addEventListener("keydown", m, !0), window.addEventListener("keyup", W, !0), () => {
|
|
1354
|
+
window.removeEventListener("keydown", m, !0), window.removeEventListener("keyup", W, !0);
|
|
1354
1355
|
};
|
|
1355
|
-
}, [
|
|
1356
|
-
const
|
|
1357
|
-
|
|
1358
|
-
}, v = [g.note,
|
|
1359
|
-
v.push(n || g.highlightUnavailable), o && v.push(o), e && v.push(
|
|
1360
|
-
const
|
|
1356
|
+
}, [D, L]);
|
|
1357
|
+
const U = r === k.IMPORTANT ? g.important : g.unclear, P = (m) => {
|
|
1358
|
+
m.key === "Enter" && (m.preventDefault(), i == null || i());
|
|
1359
|
+
}, v = [g.note, U];
|
|
1360
|
+
v.push(n || g.highlightUnavailable), o && v.push(o), e && v.push(We(e, h)), d && v.push(d);
|
|
1361
|
+
const M = v.join(", "), ne = /* @__PURE__ */ S(
|
|
1361
1362
|
X,
|
|
1362
1363
|
{
|
|
1363
1364
|
as: "div",
|
|
@@ -1366,17 +1367,17 @@ const Qn = ({
|
|
|
1366
1367
|
borderRadius: "medium",
|
|
1367
1368
|
padding: "small",
|
|
1368
1369
|
position: "relative",
|
|
1369
|
-
role: E ? void 0 : c ||
|
|
1370
|
-
"aria-label": E ? void 0 :
|
|
1371
|
-
"aria-pressed": E || c ||
|
|
1370
|
+
role: E ? void 0 : c || b ? "group" : "button",
|
|
1371
|
+
"aria-label": E ? void 0 : M,
|
|
1372
|
+
"aria-pressed": E || c || b ? void 0 : c,
|
|
1372
1373
|
tabIndex: E || c ? -1 : 0,
|
|
1373
1374
|
"data-testid": `note-card-${t}`,
|
|
1374
1375
|
elementRef: de,
|
|
1375
1376
|
onClick: c ? void 0 : i,
|
|
1376
|
-
onMouseEnter: () =>
|
|
1377
|
-
onMouseLeave: () =>
|
|
1378
|
-
onKeyDown: c ? void 0 :
|
|
1379
|
-
cursor:
|
|
1377
|
+
onMouseEnter: () => G(!0),
|
|
1378
|
+
onMouseLeave: () => G(!1),
|
|
1379
|
+
onKeyDown: c ? void 0 : P,
|
|
1380
|
+
cursor: b ? "default" : "pointer",
|
|
1380
1381
|
children: [
|
|
1381
1382
|
/* @__PURE__ */ s(
|
|
1382
1383
|
"div",
|
|
@@ -1384,65 +1385,65 @@ const Qn = ({
|
|
|
1384
1385
|
"data-testid": `note-card-${t}-content`,
|
|
1385
1386
|
style: {
|
|
1386
1387
|
height: "100%",
|
|
1387
|
-
opacity: c &&
|
|
1388
|
+
opacity: c && D && l ? 0.25 : void 0
|
|
1388
1389
|
},
|
|
1389
|
-
children: /* @__PURE__ */ S(
|
|
1390
|
+
children: /* @__PURE__ */ S(R, { direction: "column", gap: "small", height: "100%", children: [
|
|
1390
1391
|
/* @__PURE__ */ s(
|
|
1391
|
-
|
|
1392
|
+
ut,
|
|
1392
1393
|
{
|
|
1393
1394
|
type: r,
|
|
1394
|
-
onTypeChange: y &&
|
|
1395
|
-
renderAsMenuTrigger: y && !!
|
|
1395
|
+
onTypeChange: y && f ? (m) => f(t, m) : void 0,
|
|
1396
|
+
renderAsMenuTrigger: y && !!f && !!c
|
|
1396
1397
|
}
|
|
1397
1398
|
),
|
|
1398
1399
|
n ? /* @__PURE__ */ s("div", { style: { wordBreak: "break-word", overflowWrap: "break-word" }, children: /* @__PURE__ */ s(oe, { children: c && y ? /* @__PURE__ */ s(
|
|
1399
|
-
|
|
1400
|
+
ke,
|
|
1400
1401
|
{
|
|
1401
1402
|
type: r,
|
|
1402
1403
|
isCardActive: !!c || Q,
|
|
1403
|
-
theme:
|
|
1404
|
+
theme: N,
|
|
1404
1405
|
children: n
|
|
1405
1406
|
}
|
|
1406
|
-
) : /* @__PURE__ */ S(
|
|
1407
|
+
) : /* @__PURE__ */ S(ze, { children: [
|
|
1407
1408
|
O && /* @__PURE__ */ s(pe, { children: n }),
|
|
1408
1409
|
/* @__PURE__ */ s("span", { "aria-hidden": O, style: { display: "block" }, children: /* @__PURE__ */ s(Ee, { maxLines: 3, truncate: "word", onUpdate: x, children: /* @__PURE__ */ s(
|
|
1409
|
-
|
|
1410
|
+
ke,
|
|
1410
1411
|
{
|
|
1411
1412
|
type: r,
|
|
1412
1413
|
isCardActive: !!c || Q,
|
|
1413
|
-
theme:
|
|
1414
|
+
theme: N,
|
|
1414
1415
|
children: n
|
|
1415
1416
|
}
|
|
1416
1417
|
) }) })
|
|
1417
|
-
] }) }) }) : /* @__PURE__ */ s(
|
|
1418
|
-
/* @__PURE__ */ s(
|
|
1419
|
-
|
|
1418
|
+
] }) }) }) : /* @__PURE__ */ s(dt, {}),
|
|
1419
|
+
/* @__PURE__ */ s(R.Item, { shouldGrow: !0, children: /* @__PURE__ */ S(R, { direction: "column", gap: "small", height: "100%", children: [
|
|
1420
|
+
b && y ? /* @__PURE__ */ S(R, { direction: "column", gap: "x-small", margin: "xx-small", children: [
|
|
1420
1421
|
/* @__PURE__ */ s(
|
|
1421
|
-
|
|
1422
|
+
Qe,
|
|
1422
1423
|
{
|
|
1423
1424
|
label: /* @__PURE__ */ s(pe, { children: g.editNote }),
|
|
1424
|
-
value:
|
|
1425
|
-
onChange: (
|
|
1425
|
+
value: A,
|
|
1426
|
+
onChange: (m) => $(m.target.value),
|
|
1426
1427
|
placeholder: g.addNoteOptional,
|
|
1427
|
-
textareaRef: (
|
|
1428
|
-
Y.current =
|
|
1428
|
+
textareaRef: (m) => {
|
|
1429
|
+
Y.current = m;
|
|
1429
1430
|
}
|
|
1430
1431
|
}
|
|
1431
1432
|
),
|
|
1432
|
-
/* @__PURE__ */ S(
|
|
1433
|
-
/* @__PURE__ */ s(
|
|
1433
|
+
/* @__PURE__ */ S(R, { gap: "xx-small", children: [
|
|
1434
|
+
/* @__PURE__ */ s(R.Item, { shouldGrow: !0, children: /* @__PURE__ */ s(
|
|
1434
1435
|
re,
|
|
1435
1436
|
{
|
|
1436
1437
|
display: "block",
|
|
1437
1438
|
size: "small",
|
|
1438
1439
|
"data-testid": `note-card-${t}-cancel`,
|
|
1439
1440
|
onClick: () => {
|
|
1440
|
-
|
|
1441
|
+
$(o || ""), C(!1);
|
|
1441
1442
|
},
|
|
1442
1443
|
children: g.cancel
|
|
1443
1444
|
}
|
|
1444
1445
|
) }),
|
|
1445
|
-
/* @__PURE__ */ s(
|
|
1446
|
+
/* @__PURE__ */ s(R.Item, { shouldGrow: !0, children: /* @__PURE__ */ s(
|
|
1446
1447
|
re,
|
|
1447
1448
|
{
|
|
1448
1449
|
display: "block",
|
|
@@ -1450,7 +1451,7 @@ const Qn = ({
|
|
|
1450
1451
|
size: "small",
|
|
1451
1452
|
"data-testid": `note-card-${t}-save`,
|
|
1452
1453
|
onClick: () => {
|
|
1453
|
-
a == null || a(t,
|
|
1454
|
+
a == null || a(t, A.trim()), C(!1);
|
|
1454
1455
|
},
|
|
1455
1456
|
children: g.save
|
|
1456
1457
|
}
|
|
@@ -1468,18 +1469,18 @@ const Qn = ({
|
|
|
1468
1469
|
margin: "xx-small 0 0 xxx-small",
|
|
1469
1470
|
screenReaderLabel: g.editNote,
|
|
1470
1471
|
"data-testid": `note-card-${t}-edit`,
|
|
1471
|
-
elementRef: (
|
|
1472
|
-
te.current =
|
|
1472
|
+
elementRef: (m) => {
|
|
1473
|
+
te.current = m;
|
|
1473
1474
|
},
|
|
1474
|
-
onClick: (
|
|
1475
|
-
|
|
1475
|
+
onClick: (m) => {
|
|
1476
|
+
m.stopPropagation(), C(!0);
|
|
1476
1477
|
},
|
|
1477
|
-
children: /* @__PURE__ */ s(
|
|
1478
|
+
children: /* @__PURE__ */ s(Re, {})
|
|
1478
1479
|
}
|
|
1479
1480
|
)
|
|
1480
1481
|
] }) : /* @__PURE__ */ S(oe, { children: [
|
|
1481
|
-
|
|
1482
|
-
/* @__PURE__ */ s("span", { "aria-hidden":
|
|
1482
|
+
F && /* @__PURE__ */ s(pe, { children: o }),
|
|
1483
|
+
/* @__PURE__ */ s("span", { "aria-hidden": F, style: { display: "block" }, children: /* @__PURE__ */ s(Ee, { maxLines: 3, truncate: "word", onUpdate: V, children: o }) })
|
|
1483
1484
|
] }) }) : y && c ? /* @__PURE__ */ s("div", { children: /* @__PURE__ */ S(oe, { color: "secondary", children: [
|
|
1484
1485
|
g.addNotePrompt,
|
|
1485
1486
|
" ",
|
|
@@ -1492,18 +1493,18 @@ const Qn = ({
|
|
|
1492
1493
|
margin: "xx-small 0 0 xxx-small",
|
|
1493
1494
|
screenReaderLabel: g.editNote,
|
|
1494
1495
|
"data-testid": `note-card-${t}-edit`,
|
|
1495
|
-
elementRef: (
|
|
1496
|
-
te.current =
|
|
1496
|
+
elementRef: (m) => {
|
|
1497
|
+
te.current = m;
|
|
1497
1498
|
},
|
|
1498
|
-
onClick: (
|
|
1499
|
-
|
|
1499
|
+
onClick: (m) => {
|
|
1500
|
+
m.stopPropagation(), C(!0);
|
|
1500
1501
|
},
|
|
1501
|
-
children: /* @__PURE__ */ s(
|
|
1502
|
+
children: /* @__PURE__ */ s(Re, {})
|
|
1502
1503
|
}
|
|
1503
1504
|
)
|
|
1504
1505
|
] }) }) : null,
|
|
1505
|
-
/* @__PURE__ */ S(
|
|
1506
|
-
/* @__PURE__ */ s(oe, { as: "div", size: "small", color: "secondary", children:
|
|
1506
|
+
/* @__PURE__ */ S(R, { justifyItems: "space-between", alignItems: "center", margin: "auto 0 0 0", children: [
|
|
1507
|
+
/* @__PURE__ */ s(oe, { as: "div", size: "small", color: "secondary", children: We(e, h) }),
|
|
1507
1508
|
c && l && /* @__PURE__ */ s(
|
|
1508
1509
|
me,
|
|
1509
1510
|
{
|
|
@@ -1514,11 +1515,11 @@ const Qn = ({
|
|
|
1514
1515
|
margin: "xx-small",
|
|
1515
1516
|
screenReaderLabel: g.deleteNote,
|
|
1516
1517
|
"data-testid": `note-card-${t}-delete`,
|
|
1517
|
-
elementRef: (
|
|
1518
|
-
w.current =
|
|
1518
|
+
elementRef: (m) => {
|
|
1519
|
+
w.current = m;
|
|
1519
1520
|
},
|
|
1520
|
-
onClick: (
|
|
1521
|
-
|
|
1521
|
+
onClick: (m) => {
|
|
1522
|
+
m.stopPropagation(), _.current = !1, T(!0);
|
|
1522
1523
|
},
|
|
1523
1524
|
children: /* @__PURE__ */ s(Te, {})
|
|
1524
1525
|
}
|
|
@@ -1541,8 +1542,8 @@ const Qn = ({
|
|
|
1541
1542
|
] })
|
|
1542
1543
|
}
|
|
1543
1544
|
),
|
|
1544
|
-
c &&
|
|
1545
|
-
|
|
1545
|
+
c && D && l && /* @__PURE__ */ s(
|
|
1546
|
+
Et,
|
|
1546
1547
|
{
|
|
1547
1548
|
open: !0,
|
|
1548
1549
|
as: "div",
|
|
@@ -1553,11 +1554,13 @@ const Qn = ({
|
|
|
1553
1554
|
shouldCloseOnDocumentClick: !0,
|
|
1554
1555
|
shouldCloseOnEscape: !1,
|
|
1555
1556
|
shouldReturnFocus: !1,
|
|
1556
|
-
onDismiss:
|
|
1557
|
+
onDismiss: L,
|
|
1557
1558
|
children: /* @__PURE__ */ s(
|
|
1558
1559
|
X,
|
|
1559
1560
|
{
|
|
1560
1561
|
as: "div",
|
|
1562
|
+
background: "primary",
|
|
1563
|
+
borderRadius: "medium",
|
|
1561
1564
|
padding: "medium",
|
|
1562
1565
|
position: "absolute",
|
|
1563
1566
|
insetBlockStart: "0",
|
|
@@ -1566,7 +1569,7 @@ const Qn = ({
|
|
|
1566
1569
|
insetInlineEnd: "0",
|
|
1567
1570
|
stacking: "above",
|
|
1568
1571
|
children: /* @__PURE__ */ S(
|
|
1569
|
-
|
|
1572
|
+
R,
|
|
1570
1573
|
{
|
|
1571
1574
|
direction: "column",
|
|
1572
1575
|
justifyItems: "center",
|
|
@@ -1580,20 +1583,10 @@ const Qn = ({
|
|
|
1580
1583
|
display: "block",
|
|
1581
1584
|
color: "danger",
|
|
1582
1585
|
withBackground: !1,
|
|
1583
|
-
themeOverride: (f, L) => ({
|
|
1584
|
-
borderRadius: We,
|
|
1585
|
-
// Ghost states default to translucent fills; the faded card would show through.
|
|
1586
|
-
dangerGhostBackground: L.colors.contrasts.white1010,
|
|
1587
|
-
dangerGhostHoverBackground: L.colors.contrasts.red1212,
|
|
1588
|
-
dangerGhostActiveBackground: L.colors.contrasts.red1212,
|
|
1589
|
-
// red45 on the hover tint is 3.74:1; red57 clears AA in every state.
|
|
1590
|
-
dangerGhostColor: L.colors.contrasts.red5782,
|
|
1591
|
-
dangerGhostBorderColor: L.colors.contrasts.red5782
|
|
1592
|
-
}),
|
|
1593
1586
|
renderIcon: /* @__PURE__ */ s(Te, {}),
|
|
1594
1587
|
"data-testid": `note-card-${t}-confirm-delete`,
|
|
1595
|
-
onClick: (
|
|
1596
|
-
|
|
1588
|
+
onClick: (m) => {
|
|
1589
|
+
m.stopPropagation(), l(t), T(!1);
|
|
1597
1590
|
},
|
|
1598
1591
|
children: g.deleteNote
|
|
1599
1592
|
}
|
|
@@ -1603,17 +1596,12 @@ const Qn = ({
|
|
|
1603
1596
|
{
|
|
1604
1597
|
display: "block",
|
|
1605
1598
|
withBackground: !1,
|
|
1606
|
-
themeOverride: (f, L) => ({
|
|
1607
|
-
borderRadius: We,
|
|
1608
|
-
secondaryGhostBackground: L.colors.contrasts.white1010,
|
|
1609
|
-
secondaryGhostActiveBackground: L.colors.contrasts.grey1111
|
|
1610
|
-
}),
|
|
1611
1599
|
"data-testid": `note-card-${t}-cancel-delete`,
|
|
1612
|
-
elementRef: (
|
|
1613
|
-
I.current =
|
|
1600
|
+
elementRef: (m) => {
|
|
1601
|
+
I.current = m;
|
|
1614
1602
|
},
|
|
1615
|
-
onClick: (
|
|
1616
|
-
|
|
1603
|
+
onClick: (m) => {
|
|
1604
|
+
m.stopPropagation(), L();
|
|
1617
1605
|
},
|
|
1618
1606
|
children: g.cancel
|
|
1619
1607
|
}
|
|
@@ -1628,8 +1616,8 @@ const Qn = ({
|
|
|
1628
1616
|
]
|
|
1629
1617
|
}
|
|
1630
1618
|
);
|
|
1631
|
-
return E && p ? p({ href: E, children: ne, ariaLabel:
|
|
1632
|
-
},
|
|
1619
|
+
return E && p ? p({ href: E, children: ne, ariaLabel: M }) : ne;
|
|
1620
|
+
}, Qn = {
|
|
1633
1621
|
display: "grid",
|
|
1634
1622
|
gap: "1rem",
|
|
1635
1623
|
boxSizing: "border-box",
|
|
@@ -1637,7 +1625,7 @@ const Qn = ({
|
|
|
1637
1625
|
margin: 0,
|
|
1638
1626
|
padding: 0,
|
|
1639
1627
|
listStyle: "none"
|
|
1640
|
-
},
|
|
1628
|
+
}, Io = ({
|
|
1641
1629
|
notes: t,
|
|
1642
1630
|
isLoading: e,
|
|
1643
1631
|
isError: n,
|
|
@@ -1646,31 +1634,31 @@ const Qn = ({
|
|
|
1646
1634
|
onPageChange: i,
|
|
1647
1635
|
onNoteSelect: l,
|
|
1648
1636
|
onNoteDelete: a,
|
|
1649
|
-
onNoteSave:
|
|
1637
|
+
onNoteSave: f,
|
|
1650
1638
|
onNoteTypeChange: c,
|
|
1651
1639
|
onNotesEmptied: y,
|
|
1652
1640
|
selectedNoteId: d,
|
|
1653
1641
|
hasActiveFilter: h = !1,
|
|
1654
|
-
columnCount:
|
|
1642
|
+
columnCount: N = 1,
|
|
1655
1643
|
highlightTheme: p,
|
|
1656
1644
|
locale: E,
|
|
1657
1645
|
courseNames: g,
|
|
1658
1646
|
renderNoteLink: Q,
|
|
1659
|
-
noteHref:
|
|
1647
|
+
noteHref: G
|
|
1660
1648
|
}) => {
|
|
1661
|
-
const { translations:
|
|
1649
|
+
const { translations: b } = ee(), C = B(null), A = B(null), $ = q(
|
|
1662
1650
|
(T) => {
|
|
1663
|
-
const O = t.findIndex((
|
|
1651
|
+
const O = t.findIndex((F) => F.id === T);
|
|
1664
1652
|
let x = null;
|
|
1665
|
-
t.length > 1 && (x = O > 0 ? t[O - 1].id : t[1].id),
|
|
1653
|
+
t.length > 1 && (x = O > 0 ? t[O - 1].id : t[1].id), A.current = { targetId: x }, a == null || a(T);
|
|
1666
1654
|
},
|
|
1667
1655
|
[t, a]
|
|
1668
1656
|
);
|
|
1669
1657
|
if (z(() => {
|
|
1670
1658
|
var O;
|
|
1671
|
-
const T =
|
|
1659
|
+
const T = A.current;
|
|
1672
1660
|
if (T)
|
|
1673
|
-
if (
|
|
1661
|
+
if (A.current = null, T.targetId === null)
|
|
1674
1662
|
y == null || y();
|
|
1675
1663
|
else {
|
|
1676
1664
|
const x = (O = C.current) == null ? void 0 : O.querySelector(
|
|
@@ -1679,60 +1667,60 @@ const Qn = ({
|
|
|
1679
1667
|
x == null || x.focus();
|
|
1680
1668
|
}
|
|
1681
1669
|
}, [t, y]), e)
|
|
1682
|
-
return /* @__PURE__ */ s(X, { as: "div", textAlign: "center", padding: "large", "data-testid": "notes-loading", children: /* @__PURE__ */ s(
|
|
1670
|
+
return /* @__PURE__ */ s(X, { as: "div", textAlign: "center", padding: "large", "data-testid": "notes-loading", children: /* @__PURE__ */ s(St, { renderTitle: b.loadingNotes }) });
|
|
1683
1671
|
if (n)
|
|
1684
|
-
return /* @__PURE__ */ s(X, { as: "div", textAlign: "center", padding: "large", "data-testid": "notes-error", children: /* @__PURE__ */ s(Se, { level: "h4", children:
|
|
1672
|
+
return /* @__PURE__ */ s(X, { as: "div", textAlign: "center", padding: "large", "data-testid": "notes-error", children: /* @__PURE__ */ s(Se, { level: "h4", children: b.failedToLoadNotes }) });
|
|
1685
1673
|
if (t.length === 0)
|
|
1686
|
-
return /* @__PURE__ */ s(X, { as: "div", padding: "large", "data-testid": "empty-notes", children: /* @__PURE__ */ s(
|
|
1687
|
-
const
|
|
1688
|
-
return /* @__PURE__ */ S(
|
|
1674
|
+
return /* @__PURE__ */ s(X, { as: "div", padding: "large", "data-testid": "empty-notes", children: /* @__PURE__ */ s(qn, { hasActiveFilter: h }) });
|
|
1675
|
+
const D = typeof o == "number" && typeof r == "number" && r > 1 && i !== void 0;
|
|
1676
|
+
return /* @__PURE__ */ S(ze, { children: [
|
|
1689
1677
|
/* @__PURE__ */ s(
|
|
1690
1678
|
"ul",
|
|
1691
1679
|
{
|
|
1692
1680
|
ref: C,
|
|
1693
|
-
style: { ...
|
|
1681
|
+
style: { ...Qn, gridTemplateColumns: `repeat(${N}, minmax(0, 1fr))` },
|
|
1694
1682
|
role: "list",
|
|
1695
1683
|
"data-testid": "notes-grid",
|
|
1696
1684
|
children: t.map((T) => {
|
|
1697
1685
|
var O;
|
|
1698
1686
|
return /* @__PURE__ */ s("li", { children: /* @__PURE__ */ s(
|
|
1699
|
-
|
|
1687
|
+
Xn,
|
|
1700
1688
|
{
|
|
1701
1689
|
noteId: T.id,
|
|
1702
1690
|
date: T.createdAt,
|
|
1703
|
-
type: T.reaction[0] ??
|
|
1691
|
+
type: T.reaction[0] ?? k.IMPORTANT,
|
|
1704
1692
|
highlight: (O = T.highlightData) == null ? void 0 : O.selectedText,
|
|
1705
1693
|
note: T.userText,
|
|
1706
1694
|
isActive: d === T.id,
|
|
1707
1695
|
isPanelView: !!d,
|
|
1708
1696
|
onClick: l ? () => l(T.id) : void 0,
|
|
1709
|
-
onDelete: a ?
|
|
1710
|
-
onSaveNote:
|
|
1711
|
-
onTypeChange: c ? (x,
|
|
1697
|
+
onDelete: a ? $ : void 0,
|
|
1698
|
+
onSaveNote: f ? (x, F) => f(x, F) : void 0,
|
|
1699
|
+
onTypeChange: c ? (x, F) => c(x, F) : void 0,
|
|
1712
1700
|
highlightTheme: p,
|
|
1713
1701
|
locale: E,
|
|
1714
1702
|
courseName: g == null ? void 0 : g.get(T.courseId),
|
|
1715
1703
|
renderLink: Q,
|
|
1716
|
-
href:
|
|
1704
|
+
href: G ? G(T.id, T) : void 0
|
|
1717
1705
|
}
|
|
1718
1706
|
) }, T.id);
|
|
1719
1707
|
})
|
|
1720
1708
|
}
|
|
1721
1709
|
),
|
|
1722
|
-
|
|
1723
|
-
|
|
1710
|
+
D && /* @__PURE__ */ s(R, { justifyItems: "center", padding: "small", "data-testid": "notes-pagination", children: /* @__PURE__ */ s(R.Item, { children: /* @__PURE__ */ s(
|
|
1711
|
+
Tt,
|
|
1724
1712
|
{
|
|
1725
1713
|
as: "nav",
|
|
1726
1714
|
variant: "input",
|
|
1727
|
-
labelNext:
|
|
1728
|
-
labelPrev:
|
|
1715
|
+
labelNext: b.nextPage,
|
|
1716
|
+
labelPrev: b.previousPage,
|
|
1729
1717
|
currentPage: o,
|
|
1730
1718
|
totalPageNumber: r,
|
|
1731
1719
|
onPageChange: i
|
|
1732
1720
|
}
|
|
1733
1721
|
) }) })
|
|
1734
1722
|
] });
|
|
1735
|
-
},
|
|
1723
|
+
}, Co = ({
|
|
1736
1724
|
noteText: t,
|
|
1737
1725
|
reaction: e,
|
|
1738
1726
|
highlightText: n,
|
|
@@ -1741,36 +1729,36 @@ const Qn = ({
|
|
|
1741
1729
|
onDelete: i,
|
|
1742
1730
|
onTypeChange: l,
|
|
1743
1731
|
onBack: a,
|
|
1744
|
-
editing:
|
|
1732
|
+
editing: f = !1
|
|
1745
1733
|
}) => {
|
|
1746
|
-
const { translations: c } = ee(), [y, d] = j(
|
|
1747
|
-
return /* @__PURE__ */ S(
|
|
1748
|
-
n != null ? /* @__PURE__ */ s(X, { as: "div", children: /* @__PURE__ */ s(oe, { children: /* @__PURE__ */ s(
|
|
1749
|
-
/* @__PURE__ */ s(
|
|
1750
|
-
y ? /* @__PURE__ */ S(
|
|
1734
|
+
const { translations: c } = ee(), [y, d] = j(f), [h, N] = j(t || ""), [p, E] = j(!1);
|
|
1735
|
+
return /* @__PURE__ */ S(R, { direction: "column", gap: "small", "data-testid": "single-note", children: [
|
|
1736
|
+
n != null ? /* @__PURE__ */ s(X, { as: "div", children: /* @__PURE__ */ s(oe, { children: /* @__PURE__ */ s(ke, { type: e, isCardActive: !0, theme: o, children: n }) }) }) : /* @__PURE__ */ s(dt, {}),
|
|
1737
|
+
/* @__PURE__ */ s(ut, { type: e, onTypeChange: l, renderAsMenuTrigger: !!l }),
|
|
1738
|
+
y ? /* @__PURE__ */ S(R, { direction: "column", gap: "x-small", children: [
|
|
1751
1739
|
/* @__PURE__ */ s(
|
|
1752
|
-
|
|
1740
|
+
Qe,
|
|
1753
1741
|
{
|
|
1754
1742
|
label: c.addNoteOptional,
|
|
1755
1743
|
value: h,
|
|
1756
|
-
onChange: (g) =>
|
|
1744
|
+
onChange: (g) => N(g.target.value),
|
|
1757
1745
|
resize: "vertical"
|
|
1758
1746
|
}
|
|
1759
1747
|
),
|
|
1760
|
-
/* @__PURE__ */ S(
|
|
1761
|
-
/* @__PURE__ */ s(
|
|
1748
|
+
/* @__PURE__ */ S(R, { gap: "xx-small", children: [
|
|
1749
|
+
/* @__PURE__ */ s(R.Item, { shouldGrow: !0, children: /* @__PURE__ */ s(
|
|
1762
1750
|
re,
|
|
1763
1751
|
{
|
|
1764
1752
|
display: "block",
|
|
1765
1753
|
size: "small",
|
|
1766
1754
|
"data-testid": "single-note-cancel",
|
|
1767
1755
|
onClick: () => {
|
|
1768
|
-
|
|
1756
|
+
N(t || ""), d(!1);
|
|
1769
1757
|
},
|
|
1770
1758
|
children: c.cancel
|
|
1771
1759
|
}
|
|
1772
1760
|
) }),
|
|
1773
|
-
/* @__PURE__ */ s(
|
|
1761
|
+
/* @__PURE__ */ s(R.Item, { shouldGrow: !0, children: /* @__PURE__ */ s(
|
|
1774
1762
|
re,
|
|
1775
1763
|
{
|
|
1776
1764
|
display: "block",
|
|
@@ -1784,23 +1772,23 @@ const Qn = ({
|
|
|
1784
1772
|
}
|
|
1785
1773
|
) })
|
|
1786
1774
|
] })
|
|
1787
|
-
] }) : /* @__PURE__ */ S(
|
|
1775
|
+
] }) : /* @__PURE__ */ S(R, { direction: "column", gap: "small", children: [
|
|
1788
1776
|
t && /* @__PURE__ */ S(X, { as: "div", children: [
|
|
1789
1777
|
/* @__PURE__ */ s(Se, { level: "h4", margin: "0 0 xx-small 0", children: c.note }),
|
|
1790
1778
|
/* @__PURE__ */ s(oe, { children: t })
|
|
1791
1779
|
] }),
|
|
1792
|
-
/* @__PURE__ */ S(
|
|
1780
|
+
/* @__PURE__ */ S(R, { justifyItems: "space-between", children: [
|
|
1793
1781
|
/* @__PURE__ */ s(
|
|
1794
1782
|
re,
|
|
1795
1783
|
{
|
|
1796
1784
|
size: "small",
|
|
1797
|
-
renderIcon: /* @__PURE__ */ s(
|
|
1785
|
+
renderIcon: /* @__PURE__ */ s(Nt, {}),
|
|
1798
1786
|
"data-testid": "single-note-back",
|
|
1799
1787
|
onClick: () => a == null ? void 0 : a(),
|
|
1800
1788
|
children: c.back
|
|
1801
1789
|
}
|
|
1802
1790
|
),
|
|
1803
|
-
/* @__PURE__ */ S(
|
|
1791
|
+
/* @__PURE__ */ S(R, { gap: "xx-small", children: [
|
|
1804
1792
|
i && /* @__PURE__ */ s(
|
|
1805
1793
|
me,
|
|
1806
1794
|
{
|
|
@@ -1823,12 +1811,12 @@ const Qn = ({
|
|
|
1823
1811
|
screenReaderLabel: c.editNote,
|
|
1824
1812
|
"data-testid": "single-note-edit",
|
|
1825
1813
|
onClick: () => d(!0),
|
|
1826
|
-
children: /* @__PURE__ */ s(
|
|
1814
|
+
children: /* @__PURE__ */ s(Re, {})
|
|
1827
1815
|
}
|
|
1828
1816
|
)
|
|
1829
1817
|
] })
|
|
1830
1818
|
] }),
|
|
1831
|
-
p && i && /* @__PURE__ */ s(X, { as: "div", background: "primary", padding: "medium", borderRadius: "large", children: /* @__PURE__ */ S(
|
|
1819
|
+
p && i && /* @__PURE__ */ s(X, { as: "div", background: "primary", padding: "medium", borderRadius: "large", children: /* @__PURE__ */ S(R, { direction: "column", justifyItems: "center", alignItems: "center", gap: "x-small", children: [
|
|
1832
1820
|
/* @__PURE__ */ s(
|
|
1833
1821
|
re,
|
|
1834
1822
|
{
|
|
@@ -1858,26 +1846,26 @@ const Qn = ({
|
|
|
1858
1846
|
] });
|
|
1859
1847
|
};
|
|
1860
1848
|
export {
|
|
1861
|
-
|
|
1862
|
-
|
|
1863
|
-
|
|
1864
|
-
|
|
1865
|
-
|
|
1849
|
+
To as ContentWithNoteWrapper,
|
|
1850
|
+
ke as Highlight,
|
|
1851
|
+
dt as HighlightError,
|
|
1852
|
+
Xn as NoteCard,
|
|
1853
|
+
ut as NoteChip,
|
|
1866
1854
|
jn as NoteReactionMenu,
|
|
1867
|
-
|
|
1868
|
-
|
|
1869
|
-
|
|
1870
|
-
|
|
1871
|
-
|
|
1872
|
-
|
|
1873
|
-
|
|
1855
|
+
qn as NotebookEmptyState,
|
|
1856
|
+
No as NotebookProvider,
|
|
1857
|
+
$n as NotebookTranslationsProvider,
|
|
1858
|
+
Eo as NotebookTray,
|
|
1859
|
+
Io as NotesListView,
|
|
1860
|
+
k as REACTION_TYPE,
|
|
1861
|
+
Co as SingleNote,
|
|
1874
1862
|
Fe as createTransparentColor,
|
|
1875
|
-
|
|
1876
|
-
|
|
1877
|
-
|
|
1878
|
-
|
|
1863
|
+
Yt as useCreateNote,
|
|
1864
|
+
Vt as useDeleteNote,
|
|
1865
|
+
ot as useGetNotes,
|
|
1866
|
+
at as useNotebook,
|
|
1879
1867
|
ee as useNotebookTranslations,
|
|
1880
|
-
|
|
1881
|
-
|
|
1882
|
-
|
|
1868
|
+
So as useNotesData,
|
|
1869
|
+
vo as useReactionFilter,
|
|
1870
|
+
Jt as useUpdateNote
|
|
1883
1871
|
};
|