@instructure/platform-notebook 0.5.0 → 0.7.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/NoteCard.d.ts +1 -6
- package/dist/NoteCard.d.ts.map +1 -1
- package/dist/NoteChip.d.ts.map +1 -1
- package/dist/NotesListView.d.ts +1 -3
- package/dist/NotesListView.d.ts.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +667 -681
- package/locales/en.json +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,40 +1,40 @@
|
|
|
1
|
-
import { jsx as i, jsxs as
|
|
2
|
-
import { createContext as Pe, useMemo as oe, useContext as _e, useReducer as Fe, useRef as re, useEffect as J, useState as
|
|
1
|
+
import { jsx as i, jsxs as S, Fragment as Ve } from "react/jsx-runtime";
|
|
2
|
+
import { createContext as Pe, useMemo as oe, useContext as _e, useReducer as Fe, useRef as re, useEffect as J, useState as B, useCallback as Q } from "react";
|
|
3
3
|
import { createPortal as Ze } from "react-dom";
|
|
4
4
|
import { z as a } from "zod";
|
|
5
5
|
import Je from "diff-match-patch";
|
|
6
|
-
import { useQueryClient as
|
|
7
|
-
import { IconQuestionLine as
|
|
6
|
+
import { useQueryClient as ge, useMutation as pe, useQuery as et } from "@tanstack/react-query";
|
|
7
|
+
import { IconQuestionLine as Ne, IconPinLine as ye, IconWarningLine as tt, IconEditLine as fe, IconTrashLine as le, IconArrowOpenStartLine as nt, IconArrowOpenEndLine as ot, IconArrowStartLine as rt } from "@instructure/ui-icons";
|
|
8
8
|
import { Menu as ee } from "@instructure/ui-menu";
|
|
9
|
-
import { Flex as
|
|
10
|
-
import { TruncateText as
|
|
9
|
+
import { Flex as I } from "@instructure/ui-flex";
|
|
10
|
+
import { TruncateText as me } from "@instructure/ui-truncate-text";
|
|
11
11
|
import { ScreenReaderContent as Me } from "@instructure/ui-a11y-content";
|
|
12
12
|
import { SimpleSelect as we } from "@instructure/ui-simple-select";
|
|
13
|
-
import { CloseButton as
|
|
13
|
+
import { CloseButton as st, Button as $, IconButton as Y } from "@instructure/ui-buttons";
|
|
14
14
|
import { Heading as ae } from "@instructure/ui-heading";
|
|
15
|
-
import { Tray as
|
|
16
|
-
import { View as
|
|
17
|
-
import { Text as
|
|
15
|
+
import { Tray as it } from "@instructure/ui-tray";
|
|
16
|
+
import { View as q } from "@instructure/ui-view";
|
|
17
|
+
import { Text as U } from "@instructure/ui-text";
|
|
18
18
|
import { TextArea as He } from "@instructure/ui-text-area";
|
|
19
|
-
import { Pill as
|
|
20
|
-
import { Spinner as
|
|
21
|
-
const
|
|
19
|
+
import { Pill as ke } from "@instructure/ui-pill";
|
|
20
|
+
import { Spinner as lt } from "@instructure/ui-spinner";
|
|
21
|
+
const at = a.object({
|
|
22
22
|
startContainer: a.string(),
|
|
23
23
|
endContainer: a.string(),
|
|
24
24
|
startOffset: a.number(),
|
|
25
25
|
endOffset: a.number()
|
|
26
|
-
}),
|
|
26
|
+
}), ct = a.object({
|
|
27
27
|
start: a.number(),
|
|
28
28
|
end: a.number()
|
|
29
|
-
}),
|
|
29
|
+
}), be = a.object({
|
|
30
30
|
selectedText: a.string(),
|
|
31
31
|
hasNoHighlightAnymore: a.boolean().optional(),
|
|
32
|
-
textPosition:
|
|
33
|
-
range:
|
|
32
|
+
textPosition: ct.nullable(),
|
|
33
|
+
range: at.nullable(),
|
|
34
34
|
pageLastModifiedAt: a.string()
|
|
35
35
|
});
|
|
36
|
-
var
|
|
37
|
-
const
|
|
36
|
+
var k = /* @__PURE__ */ ((n) => (n.IMPORTANT = "Important", n.CONFUSING = "Confusing", n))(k || {});
|
|
37
|
+
const Ee = a.enum([
|
|
38
38
|
"Important",
|
|
39
39
|
"Confusing"
|
|
40
40
|
/* CONFUSING */
|
|
@@ -51,32 +51,32 @@ const Se = a.enum([
|
|
|
51
51
|
objectId: a.string(),
|
|
52
52
|
objectType: a.string(),
|
|
53
53
|
userText: a.string().optional(),
|
|
54
|
-
reaction: a.array(
|
|
55
|
-
highlightData:
|
|
54
|
+
reaction: a.array(Ee),
|
|
55
|
+
highlightData: be,
|
|
56
56
|
createdAt: a.string(),
|
|
57
57
|
updatedAt: a.string()
|
|
58
|
-
}),
|
|
58
|
+
}), dt = a.object({
|
|
59
59
|
cursor: a.string(),
|
|
60
60
|
node: ce
|
|
61
61
|
});
|
|
62
62
|
a.object({
|
|
63
63
|
notes: a.object({
|
|
64
|
-
edges: a.array(
|
|
64
|
+
edges: a.array(dt),
|
|
65
65
|
nodes: a.array(ce),
|
|
66
66
|
pageInfo: Be
|
|
67
67
|
})
|
|
68
68
|
});
|
|
69
|
-
const
|
|
69
|
+
const ut = a.object({
|
|
70
70
|
type: a.string(),
|
|
71
71
|
id: a.string()
|
|
72
|
-
}),
|
|
72
|
+
}), ft = a.object({
|
|
73
73
|
courseId: a.string().optional(),
|
|
74
|
-
learningObject:
|
|
74
|
+
learningObject: ut.optional(),
|
|
75
75
|
reactions: a.array(a.string()).optional()
|
|
76
76
|
}).optional();
|
|
77
77
|
a.object({
|
|
78
78
|
courseId: a.string().optional(),
|
|
79
|
-
filter:
|
|
79
|
+
filter: ft,
|
|
80
80
|
pageParams: Be.optional(),
|
|
81
81
|
direction: a.enum(["next", "prev"]).optional(),
|
|
82
82
|
pageSize: a.number().optional()
|
|
@@ -86,8 +86,8 @@ a.object({
|
|
|
86
86
|
objectId: a.string(),
|
|
87
87
|
objectType: a.string(),
|
|
88
88
|
userText: a.string().optional(),
|
|
89
|
-
reaction: a.array(
|
|
90
|
-
highlightData:
|
|
89
|
+
reaction: a.array(Ee),
|
|
90
|
+
highlightData: be
|
|
91
91
|
});
|
|
92
92
|
a.object({
|
|
93
93
|
createNote: ce
|
|
@@ -95,8 +95,8 @@ a.object({
|
|
|
95
95
|
a.object({
|
|
96
96
|
id: a.string(),
|
|
97
97
|
userText: a.string().optional(),
|
|
98
|
-
reaction: a.array(
|
|
99
|
-
highlightData:
|
|
98
|
+
reaction: a.array(Ee),
|
|
99
|
+
highlightData: be
|
|
100
100
|
});
|
|
101
101
|
a.object({
|
|
102
102
|
updateNote: ce
|
|
@@ -105,7 +105,7 @@ a.object({
|
|
|
105
105
|
deleteNote: a.string()
|
|
106
106
|
});
|
|
107
107
|
var We = /* @__PURE__ */ ((n) => (n[n.FORWARDS = 1] = "FORWARDS", n[n.BACKWARDS = 2] = "BACKWARDS", n))(We || {});
|
|
108
|
-
class
|
|
108
|
+
class G {
|
|
109
109
|
constructor(e, t) {
|
|
110
110
|
this.start = e, this.end = t;
|
|
111
111
|
}
|
|
@@ -123,17 +123,17 @@ class $ {
|
|
|
123
123
|
return o.setStart(e.node, e.offset), o.setEnd(t.node, t.offset), o;
|
|
124
124
|
}
|
|
125
125
|
static fromRange(e) {
|
|
126
|
-
const t =
|
|
127
|
-
return !t || !o ? null : new
|
|
126
|
+
const t = W.fromPoint(e.startContainer, e.startOffset), o = W.fromPoint(e.endContainer, e.endOffset);
|
|
127
|
+
return !t || !o ? null : new G(t, o);
|
|
128
128
|
}
|
|
129
129
|
static fromOffsets(e, t, o) {
|
|
130
|
-
return new
|
|
130
|
+
return new G(new W(e, t), new W(e, o));
|
|
131
131
|
}
|
|
132
132
|
relativeTo(e) {
|
|
133
|
-
return new
|
|
133
|
+
return new G(this.start.relativeTo(e), this.end.relativeTo(e));
|
|
134
134
|
}
|
|
135
135
|
}
|
|
136
|
-
class
|
|
136
|
+
class W {
|
|
137
137
|
constructor(e, t) {
|
|
138
138
|
t < 0 && console.error("Offset is invalid"), this.element = e, this.offset = t;
|
|
139
139
|
}
|
|
@@ -155,9 +155,9 @@ class B {
|
|
|
155
155
|
static fromCharOffset(e, t) {
|
|
156
156
|
switch (e.nodeType) {
|
|
157
157
|
case Node.TEXT_NODE:
|
|
158
|
-
return
|
|
158
|
+
return W.fromPoint(e, t);
|
|
159
159
|
case Node.ELEMENT_NODE:
|
|
160
|
-
return new
|
|
160
|
+
return new W(e, t);
|
|
161
161
|
default:
|
|
162
162
|
return console.error("Node is not an element or text node"), null;
|
|
163
163
|
}
|
|
@@ -170,7 +170,7 @@ class B {
|
|
|
170
170
|
if (!e.parentElement)
|
|
171
171
|
return console.error("Text node has no parent"), null;
|
|
172
172
|
const o = De(e) + t;
|
|
173
|
-
return new
|
|
173
|
+
return new W(e.parentElement, o);
|
|
174
174
|
}
|
|
175
175
|
case Node.ELEMENT_NODE: {
|
|
176
176
|
if (t < 0 || t > e.childNodes.length)
|
|
@@ -178,7 +178,7 @@ class B {
|
|
|
178
178
|
let o = 0;
|
|
179
179
|
for (let r = 0; r < t; r++)
|
|
180
180
|
o += je(e.childNodes[r]);
|
|
181
|
-
return new
|
|
181
|
+
return new W(e, o);
|
|
182
182
|
}
|
|
183
183
|
default:
|
|
184
184
|
return console.error("Point is not in an element or text node"), null;
|
|
@@ -190,33 +190,33 @@ class B {
|
|
|
190
190
|
let t = this.element, o = this.offset;
|
|
191
191
|
for (; t !== e; )
|
|
192
192
|
o += De(t), t.parentElement && (t = t.parentElement);
|
|
193
|
-
return new
|
|
193
|
+
return new W(t, o);
|
|
194
194
|
}
|
|
195
195
|
}
|
|
196
|
-
const
|
|
196
|
+
const mt = (n) => {
|
|
197
197
|
const e = n.nodeName.toLowerCase();
|
|
198
198
|
return e === "#text" ? "text()" : e;
|
|
199
199
|
};
|
|
200
|
-
function
|
|
200
|
+
function ht(n) {
|
|
201
201
|
let e = 0, t = n;
|
|
202
202
|
for (; t; )
|
|
203
203
|
t.nodeName === n.nodeName && (e += 1), t = t.previousSibling;
|
|
204
204
|
return e;
|
|
205
205
|
}
|
|
206
|
-
const
|
|
207
|
-
const e =
|
|
206
|
+
const gt = (n) => {
|
|
207
|
+
const e = mt(n), t = ht(n);
|
|
208
208
|
return `${e}[${t}]`;
|
|
209
|
-
},
|
|
209
|
+
}, Oe = (n, e) => {
|
|
210
210
|
let t = "", o = n;
|
|
211
211
|
for (; o !== e; ) {
|
|
212
212
|
if (!o) {
|
|
213
213
|
console.error("Node is not a descendant of root");
|
|
214
214
|
return;
|
|
215
215
|
}
|
|
216
|
-
t = `${
|
|
216
|
+
t = `${gt(o)}/${t}`, o = o.parentNode;
|
|
217
217
|
}
|
|
218
218
|
return t = `/${t}`, t = t.replace(/\/$/, ""), t;
|
|
219
|
-
},
|
|
219
|
+
}, pt = (n, e, t) => {
|
|
220
220
|
const o = e.toUpperCase();
|
|
221
221
|
let r = -1;
|
|
222
222
|
for (let s = 0; s < n.children.length; s++) {
|
|
@@ -225,41 +225,41 @@ const pt = (n) => {
|
|
|
225
225
|
return l;
|
|
226
226
|
}
|
|
227
227
|
return null;
|
|
228
|
-
},
|
|
228
|
+
}, Nt = (n, e) => {
|
|
229
229
|
if (!(n.match(/^(\/[A-Za-z0-9-]+(\[[0-9]+])?)+$/) !== null))
|
|
230
230
|
return console.error("Expression is not a simple XPath"), null;
|
|
231
231
|
const o = n.split("/");
|
|
232
232
|
let r = e;
|
|
233
233
|
o.shift();
|
|
234
234
|
for (const s of o) {
|
|
235
|
-
let l,
|
|
235
|
+
let l, c;
|
|
236
236
|
const m = s.indexOf("[");
|
|
237
237
|
if (m !== -1) {
|
|
238
238
|
l = s.slice(0, m);
|
|
239
239
|
const g = s.slice(m + 1, s.indexOf("]"));
|
|
240
|
-
if (
|
|
240
|
+
if (c = Number.parseInt(g, 10) - 1, c < 0)
|
|
241
241
|
return null;
|
|
242
242
|
} else
|
|
243
|
-
l = s,
|
|
244
|
-
const
|
|
245
|
-
if (!
|
|
243
|
+
l = s, c = 0;
|
|
244
|
+
const d = pt(r, l, c);
|
|
245
|
+
if (!d)
|
|
246
246
|
return null;
|
|
247
|
-
r =
|
|
247
|
+
r = d;
|
|
248
248
|
}
|
|
249
249
|
return r;
|
|
250
250
|
}, Re = (n, e = document.body) => {
|
|
251
251
|
try {
|
|
252
|
-
return
|
|
252
|
+
return Nt(n, e);
|
|
253
253
|
} catch {
|
|
254
254
|
return document.evaluate(`.${n}`, e, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue;
|
|
255
255
|
}
|
|
256
256
|
};
|
|
257
|
-
class
|
|
257
|
+
class V {
|
|
258
258
|
constructor(e, t) {
|
|
259
259
|
this.root = e, this.range = t;
|
|
260
260
|
}
|
|
261
261
|
static fromRange(e, t) {
|
|
262
|
-
return new
|
|
262
|
+
return new V(e, t);
|
|
263
263
|
}
|
|
264
264
|
static fromSelector(e, t) {
|
|
265
265
|
if (!(t != null && t.startContainer) || !(t != null && t.endContainer))
|
|
@@ -270,18 +270,18 @@ class Y {
|
|
|
270
270
|
const r = Re(t.endContainer, e);
|
|
271
271
|
if (!r)
|
|
272
272
|
return console.error("Failed to resolve endContainer XPath"), null;
|
|
273
|
-
const s =
|
|
273
|
+
const s = W.fromCharOffset(o, t.startOffset), l = W.fromCharOffset(r, t.endOffset);
|
|
274
274
|
if (!s || !l)
|
|
275
275
|
return null;
|
|
276
|
-
const
|
|
277
|
-
return
|
|
276
|
+
const c = new G(s, l).toRange();
|
|
277
|
+
return c ? new V(e, c) : null;
|
|
278
278
|
}
|
|
279
279
|
toRange() {
|
|
280
280
|
return this.range;
|
|
281
281
|
}
|
|
282
282
|
toSelector() {
|
|
283
283
|
var s;
|
|
284
|
-
const e = (s =
|
|
284
|
+
const e = (s = G.fromRange(this.range)) == null ? void 0 : s.toRange(), t = e && G.fromRange(e), o = t && Oe(t.start.element, this.root), r = t && Oe(t.end.element, this.root);
|
|
285
285
|
return !o || !r ? null : {
|
|
286
286
|
startContainer: o,
|
|
287
287
|
startOffset: t.start.offset,
|
|
@@ -290,17 +290,17 @@ class Y {
|
|
|
290
290
|
};
|
|
291
291
|
}
|
|
292
292
|
}
|
|
293
|
-
class
|
|
293
|
+
class K {
|
|
294
294
|
constructor(e, t, o) {
|
|
295
295
|
this.root = e, this.start = t, this.end = o;
|
|
296
296
|
}
|
|
297
297
|
static fromRange(e, t) {
|
|
298
298
|
var r;
|
|
299
|
-
const o = (r =
|
|
300
|
-
return o ? new
|
|
299
|
+
const o = (r = G.fromRange(t)) == null ? void 0 : r.relativeTo(e);
|
|
300
|
+
return o ? new K(e, o.start.offset, o.end.offset) : null;
|
|
301
301
|
}
|
|
302
302
|
static fromSelector(e, t) {
|
|
303
|
-
return new
|
|
303
|
+
return new K(e, t.start, t.end);
|
|
304
304
|
}
|
|
305
305
|
toSelector() {
|
|
306
306
|
return {
|
|
@@ -309,7 +309,7 @@ class G {
|
|
|
309
309
|
};
|
|
310
310
|
}
|
|
311
311
|
toRange() {
|
|
312
|
-
return
|
|
312
|
+
return G.fromOffsets(this.root, this.start, this.end).toRange();
|
|
313
313
|
}
|
|
314
314
|
}
|
|
315
315
|
const je = (n) => {
|
|
@@ -329,62 +329,62 @@ const je = (n) => {
|
|
|
329
329
|
}, ze = (n, ...e) => {
|
|
330
330
|
let t = e.shift();
|
|
331
331
|
const o = n.ownerDocument.createNodeIterator(n, NodeFilter.SHOW_TEXT), r = [];
|
|
332
|
-
let s = o.nextNode(), l = null,
|
|
332
|
+
let s = o.nextNode(), l = null, c = 0;
|
|
333
333
|
for (; t !== void 0 && s; )
|
|
334
|
-
l = s,
|
|
335
|
-
for (; t !== void 0 && l &&
|
|
334
|
+
l = s, c + l.data.length > t ? (r.push({ node: l, offset: t - c }), t = e.shift()) : (s = o.nextNode(), c += l.data.length);
|
|
335
|
+
for (; t !== void 0 && l && c === t; )
|
|
336
336
|
r.push({ node: l, offset: l.data.length }), t = e.shift();
|
|
337
337
|
return t !== void 0 && console.error("Offset exceeds text length"), r;
|
|
338
|
-
},
|
|
338
|
+
}, yt = (n, e, t, o) => {
|
|
339
339
|
const r = t - e;
|
|
340
|
-
return Math.abs(r - o) <= 5 ?
|
|
340
|
+
return Math.abs(r - o) <= 5 ? K.fromSelector(n, {
|
|
341
341
|
start: e,
|
|
342
342
|
end: t
|
|
343
343
|
}) : null;
|
|
344
|
-
},
|
|
344
|
+
}, bt = (n, e, t, o) => {
|
|
345
345
|
const r = new Je();
|
|
346
346
|
r.Match_Distance = 5e3;
|
|
347
347
|
const s = n.textContent;
|
|
348
348
|
if (!s)
|
|
349
349
|
return null;
|
|
350
350
|
if (e.length > 32) {
|
|
351
|
-
const l = e.slice(0, 32),
|
|
352
|
-
let
|
|
353
|
-
const g = r.match_main(s,
|
|
354
|
-
if (
|
|
351
|
+
const l = e.slice(0, 32), c = e.slice(-32), m = o - t;
|
|
352
|
+
let d = r.match_main(s, l, t);
|
|
353
|
+
const g = r.match_main(s, c, o), h = g + c.length;
|
|
354
|
+
if (d === -1 || g === -1)
|
|
355
355
|
return null;
|
|
356
|
-
const u = h -
|
|
357
|
-
if ((
|
|
358
|
-
return
|
|
359
|
-
if (
|
|
360
|
-
return
|
|
361
|
-
start:
|
|
356
|
+
const u = h - d, E = Math.abs(u - m);
|
|
357
|
+
if ((d > h || E > 5) && (r.Match_Distance = e.length + 100, d = r.match_main(s, l, h), d !== -1 && d < h))
|
|
358
|
+
return yt(n, d, h, m);
|
|
359
|
+
if (d < h && E <= 5)
|
|
360
|
+
return K.fromSelector(n, {
|
|
361
|
+
start: d,
|
|
362
362
|
end: h
|
|
363
363
|
});
|
|
364
364
|
} else {
|
|
365
365
|
const l = r.match_main(s, e, t);
|
|
366
366
|
if (l !== -1)
|
|
367
|
-
return
|
|
367
|
+
return K.fromSelector(n, {
|
|
368
368
|
start: l,
|
|
369
369
|
end: l + e.length
|
|
370
370
|
});
|
|
371
371
|
}
|
|
372
372
|
return null;
|
|
373
|
-
},
|
|
373
|
+
}, Et = (n, e) => {
|
|
374
374
|
if (!e) return null;
|
|
375
375
|
const { highlightData: t } = n, { textPosition: o, selectedText: r } = t;
|
|
376
|
-
return
|
|
376
|
+
return bt(
|
|
377
377
|
e,
|
|
378
378
|
r,
|
|
379
379
|
(o == null ? void 0 : o.start) ?? 0,
|
|
380
380
|
(o == null ? void 0 : o.end) ?? 0
|
|
381
381
|
);
|
|
382
|
-
},
|
|
382
|
+
}, St = (n, e, t) => {
|
|
383
383
|
const o = [], r = [];
|
|
384
384
|
for (const s of e) {
|
|
385
|
-
const l =
|
|
385
|
+
const l = Et(s, n);
|
|
386
386
|
if (l) {
|
|
387
|
-
const
|
|
387
|
+
const c = l.toRange(), m = c && V.fromRange(n, c);
|
|
388
388
|
o.push({
|
|
389
389
|
id: s.id,
|
|
390
390
|
reaction: s.reaction,
|
|
@@ -414,23 +414,23 @@ const je = (n) => {
|
|
|
414
414
|
var l;
|
|
415
415
|
if (!e) return;
|
|
416
416
|
const { highlightData: t, id: o } = n, { range: r } = t ?? {};
|
|
417
|
-
r && ((l =
|
|
417
|
+
r && ((l = V.fromSelector(e, r)) == null ? void 0 : l.toRange()) && Ot({ id: o });
|
|
418
418
|
}, vt = (n) => {
|
|
419
419
|
const e = document.getElementById(ve(n));
|
|
420
420
|
if (e) {
|
|
421
421
|
const t = e.getBoundingClientRect();
|
|
422
422
|
t.top >= 0 && t.left >= 0 && t.bottom <= (window.innerHeight || document.documentElement.clientHeight) && t.right <= (window.innerWidth || document.documentElement.clientWidth) || e.scrollIntoView({ behavior: "smooth", block: "start" });
|
|
423
423
|
}
|
|
424
|
-
}, se = 90, ie = 172,
|
|
424
|
+
}, se = 90, ie = 172, Tt = (n) => {
|
|
425
425
|
const e = n.getClientRects();
|
|
426
426
|
if (!e.length)
|
|
427
427
|
return null;
|
|
428
|
-
const t = e[0], o = e[e.length - 1], r = 4, s = 16, l = window.innerWidth || document.documentElement.clientWidth,
|
|
429
|
-
const
|
|
430
|
-
return f >= s &&
|
|
431
|
-
},
|
|
432
|
-
const
|
|
433
|
-
return f >= s &&
|
|
428
|
+
const t = e[0], o = e[e.length - 1], r = 4, s = 16, l = window.innerWidth || document.documentElement.clientWidth, c = window.innerHeight || document.documentElement.clientHeight, m = (f) => {
|
|
429
|
+
const v = f + ie;
|
|
430
|
+
return f >= s && v <= l - s;
|
|
431
|
+
}, d = (f) => {
|
|
432
|
+
const v = f + se;
|
|
433
|
+
return f >= s && v <= c - s;
|
|
434
434
|
};
|
|
435
435
|
let g;
|
|
436
436
|
const h = t.right - ie;
|
|
@@ -441,28 +441,28 @@ const je = (n) => {
|
|
|
441
441
|
if (m(f))
|
|
442
442
|
g = f;
|
|
443
443
|
else {
|
|
444
|
-
const
|
|
445
|
-
m(
|
|
444
|
+
const y = (t.left + t.right) / 2 - ie / 2;
|
|
445
|
+
m(y) ? g = y : h < s ? g = s : g = l - ie - s;
|
|
446
446
|
}
|
|
447
447
|
}
|
|
448
448
|
let u;
|
|
449
449
|
const E = o.bottom + r;
|
|
450
|
-
if (
|
|
450
|
+
if (d(E))
|
|
451
451
|
u = E;
|
|
452
452
|
else {
|
|
453
453
|
const f = t.top - se - r;
|
|
454
|
-
|
|
454
|
+
d(f) ? u = f : E + se > c - s ? u = c - se - s : u = s;
|
|
455
455
|
}
|
|
456
456
|
return { top: u, left: g };
|
|
457
|
-
},
|
|
457
|
+
}, It = (n, e) => {
|
|
458
458
|
for (const t of e)
|
|
459
459
|
if (n.start < t.end && n.end > t.start)
|
|
460
460
|
return !0;
|
|
461
461
|
return !1;
|
|
462
|
-
},
|
|
462
|
+
}, Se = (n) => `highlight-wrapper-${n}`, ve = (n) => `${Se(n)}-start`, Ue = (n) => `${Se(n)}-end`, ne = (n) => `[data-highlight-id="${CSS.escape(n)}"]`, Te = (n, e) => {
|
|
463
463
|
const t = Number.parseInt(n.slice(1, 3), 16), o = Number.parseInt(n.slice(3, 5), 16), r = Number.parseInt(n.slice(5, 7), 16);
|
|
464
464
|
return `rgba(${t}, ${o}, ${r}, ${e})`;
|
|
465
|
-
},
|
|
465
|
+
}, Ct = (n, e) => {
|
|
466
466
|
var t;
|
|
467
467
|
try {
|
|
468
468
|
const o = ((t = e.nodeValue) == null ? void 0 : t.length) ?? e.childNodes.length;
|
|
@@ -470,7 +470,7 @@ const je = (n) => {
|
|
|
470
470
|
} catch {
|
|
471
471
|
return !1;
|
|
472
472
|
}
|
|
473
|
-
},
|
|
473
|
+
}, xt = (n) => {
|
|
474
474
|
var s;
|
|
475
475
|
if (n.collapsed)
|
|
476
476
|
return [];
|
|
@@ -480,7 +480,7 @@ const je = (n) => {
|
|
|
480
480
|
const t = [], o = (s = e == null ? void 0 : e.ownerDocument) == null ? void 0 : s.createNodeIterator(e, NodeFilter.SHOW_TEXT);
|
|
481
481
|
let r = (o == null ? void 0 : o.nextNode()) || null;
|
|
482
482
|
for (; r; ) {
|
|
483
|
-
if (!
|
|
483
|
+
if (!Ct(n, r)) {
|
|
484
484
|
r = (o == null ? void 0 : o.nextNode()) || null;
|
|
485
485
|
continue;
|
|
486
486
|
}
|
|
@@ -492,49 +492,49 @@ const je = (n) => {
|
|
|
492
492
|
l === n.endContainer && n.endOffset < l.data.length && l.splitText(n.endOffset), t.push(l), r = (o == null ? void 0 : o.nextNode()) || null;
|
|
493
493
|
}
|
|
494
494
|
return t;
|
|
495
|
-
},
|
|
495
|
+
}, wt = (n, e, t) => {
|
|
496
496
|
if (n.collapsed) return;
|
|
497
|
-
const o = e.id ?? "", r =
|
|
497
|
+
const o = e.id ?? "", r = Se(o);
|
|
498
498
|
if (document.getElementById(ve(o))) {
|
|
499
499
|
kt(e, t);
|
|
500
500
|
return;
|
|
501
501
|
}
|
|
502
|
-
const l = e.type ===
|
|
502
|
+
const l = e.type === k.IMPORTANT ? t.colors.importantBackground : t.colors.confusingBackground, m = e.id === e.selectedNoteId ? l : Te(l, 0.5), d = e.type === k.IMPORTANT ? t.colors.importantUnderline : t.colors.confusingUnderline, g = e.type === k.IMPORTANT ? "solid" : "dashed", h = n.toString(), u = document.createElement("span");
|
|
503
503
|
u.id = `${r}-start`, u.className = "highlight-marker-start", u.dataset.highlightId = o || "", u.setAttribute("role", "button"), u.setAttribute("tabindex", "0"), u.setAttribute("aria-label", h), u.style.position = "relative", u.style.fontSize = "0", u.style.lineHeight = "0", u.style.width = "0", u.style.height = "0", u.style.margin = "0", u.style.padding = "0", u.style.border = "0";
|
|
504
504
|
const E = document.createElement("span");
|
|
505
505
|
E.id = Ue(o), E.className = "highlight-marker-end", E.dataset.highlightId = o || "";
|
|
506
506
|
const f = n.cloneRange();
|
|
507
507
|
f.collapse(!1), f.insertNode(E);
|
|
508
|
-
const
|
|
509
|
-
|
|
510
|
-
const
|
|
511
|
-
|
|
512
|
-
const
|
|
513
|
-
|
|
514
|
-
var
|
|
515
|
-
const
|
|
516
|
-
if ((
|
|
517
|
-
const
|
|
518
|
-
let
|
|
519
|
-
|
|
508
|
+
const v = n.cloneRange();
|
|
509
|
+
v.collapse(!0), v.insertNode(u);
|
|
510
|
+
const y = document.createRange();
|
|
511
|
+
y.setStartAfter(u), y.setEndBefore(E);
|
|
512
|
+
const _ = xt(y).filter((p) => p.textContent && p.textContent.length > 0);
|
|
513
|
+
_.forEach((p, C) => {
|
|
514
|
+
var j;
|
|
515
|
+
const w = p.parentElement;
|
|
516
|
+
if ((w == null ? void 0 : w.dataset.highlightId) === o) return;
|
|
517
|
+
const x = C === 0, R = C === _.length - 1, P = _.length === 1;
|
|
518
|
+
let M;
|
|
519
|
+
P ? M = "single" : x ? M = "first" : R ? M = "last" : M = "middle";
|
|
520
520
|
const D = document.createElement("span");
|
|
521
|
-
D.className = "highlight-content", D.dataset.highlightId = o || "", D.dataset.position =
|
|
522
|
-
var
|
|
523
|
-
|
|
524
|
-
}), (
|
|
525
|
-
}), u.addEventListener("click", (
|
|
526
|
-
var
|
|
527
|
-
|
|
528
|
-
}), u.addEventListener("keydown", (
|
|
529
|
-
var
|
|
530
|
-
if (
|
|
531
|
-
|
|
532
|
-
else if (
|
|
533
|
-
const
|
|
534
|
-
for (const
|
|
535
|
-
const
|
|
536
|
-
if (
|
|
537
|
-
|
|
521
|
+
D.className = "highlight-content", D.dataset.highlightId = o || "", D.dataset.position = M, D.style.backgroundColor = m, D.style.textDecorationLine = "underline", D.style.textDecorationColor = d, D.style.textDecorationStyle = g, D.style.textDecorationThickness = t.borderWidthSmall, D.style.textUnderlineOffset = t.underlineOffset, D.style.cursor = "pointer", D.addEventListener("click", (O) => {
|
|
522
|
+
var b;
|
|
523
|
+
O.target.tagName !== "A" && ((b = e.onClick) == null || b.call(e));
|
|
524
|
+
}), (j = p.parentNode) == null || j.insertBefore(D, p), D.appendChild(p);
|
|
525
|
+
}), u.addEventListener("click", (p) => {
|
|
526
|
+
var C;
|
|
527
|
+
p.target.tagName !== "A" && ((C = e.onClick) == null || C.call(e));
|
|
528
|
+
}), u.addEventListener("keydown", (p) => {
|
|
529
|
+
var C;
|
|
530
|
+
if (p.key === "Enter" || p.key === " ")
|
|
531
|
+
p.preventDefault(), (C = e.onClick) == null || C.call(e);
|
|
532
|
+
else if (p.key === "Tab" && !p.shiftKey) {
|
|
533
|
+
const w = document.querySelectorAll(ne(o));
|
|
534
|
+
for (const x of w) {
|
|
535
|
+
const R = x.querySelector("a");
|
|
536
|
+
if (R) {
|
|
537
|
+
p.preventDefault(), R.focus();
|
|
538
538
|
break;
|
|
539
539
|
}
|
|
540
540
|
}
|
|
@@ -542,26 +542,26 @@ const je = (n) => {
|
|
|
542
542
|
}), u.addEventListener("focus", () => {
|
|
543
543
|
document.querySelectorAll(
|
|
544
544
|
ne(o)
|
|
545
|
-
).forEach((
|
|
546
|
-
|
|
545
|
+
).forEach((C) => {
|
|
546
|
+
C.classList.add("highlight-focused");
|
|
547
547
|
});
|
|
548
548
|
}), u.addEventListener("blur", () => {
|
|
549
549
|
document.querySelectorAll(
|
|
550
550
|
ne(o)
|
|
551
|
-
).forEach((
|
|
552
|
-
|
|
551
|
+
).forEach((C) => {
|
|
552
|
+
C.classList.remove("highlight-focused");
|
|
553
553
|
});
|
|
554
554
|
});
|
|
555
555
|
};
|
|
556
556
|
function kt(n, e) {
|
|
557
|
-
const t = n.type ===
|
|
557
|
+
const t = n.type === k.IMPORTANT ? e.colors.importantBackground : e.colors.confusingBackground, r = n.id === n.selectedNoteId ? t : Te(t, 0.5);
|
|
558
558
|
document.querySelectorAll(
|
|
559
559
|
ne(n.id ?? "")
|
|
560
560
|
).forEach((l) => {
|
|
561
561
|
l.style.backgroundColor = r;
|
|
562
562
|
});
|
|
563
563
|
}
|
|
564
|
-
const
|
|
564
|
+
const Ot = (n) => {
|
|
565
565
|
const e = n.id ?? "", t = document.getElementById(ve(e)), o = document.getElementById(Ue(e));
|
|
566
566
|
document.querySelectorAll(
|
|
567
567
|
ne(e)
|
|
@@ -575,18 +575,18 @@ const Rt = (n) => {
|
|
|
575
575
|
all: ["notebook"],
|
|
576
576
|
notes: (n) => ["notebook", "notes", n]
|
|
577
577
|
};
|
|
578
|
-
function
|
|
579
|
-
const e =
|
|
580
|
-
return
|
|
578
|
+
function Rt(n) {
|
|
579
|
+
const e = ge();
|
|
580
|
+
return pe({
|
|
581
581
|
mutationFn: (t) => n.createNote(t),
|
|
582
582
|
onSuccess: () => {
|
|
583
583
|
e.invalidateQueries({ queryKey: te.all });
|
|
584
584
|
}
|
|
585
585
|
});
|
|
586
586
|
}
|
|
587
|
-
function
|
|
588
|
-
const e =
|
|
589
|
-
return
|
|
587
|
+
function Dt(n) {
|
|
588
|
+
const e = ge();
|
|
589
|
+
return pe({
|
|
590
590
|
mutationFn: (t) => n.deleteNote(t),
|
|
591
591
|
onSuccess: () => {
|
|
592
592
|
e.invalidateQueries({ queryKey: te.all });
|
|
@@ -604,19 +604,19 @@ function $e({
|
|
|
604
604
|
enabled: e
|
|
605
605
|
});
|
|
606
606
|
}
|
|
607
|
-
function
|
|
608
|
-
const e =
|
|
609
|
-
return
|
|
607
|
+
function At(n) {
|
|
608
|
+
const e = ge();
|
|
609
|
+
return pe({
|
|
610
610
|
mutationFn: ({ id: t, input: o }) => n.updateNote(t, o),
|
|
611
611
|
onMutate: async ({ id: t, input: o }) => {
|
|
612
612
|
await e.cancelQueries({ queryKey: te.all });
|
|
613
613
|
const s = e.getQueryCache().findAll({ queryKey: te.all }), l = /* @__PURE__ */ new Map();
|
|
614
|
-
for (const
|
|
615
|
-
const m =
|
|
616
|
-
m && (l.set(
|
|
614
|
+
for (const c of s) {
|
|
615
|
+
const m = c.state.data;
|
|
616
|
+
m && (l.set(c.queryKey, m), e.setQueryData(c.queryKey, {
|
|
617
617
|
...m,
|
|
618
618
|
notes: m.notes.map(
|
|
619
|
-
(
|
|
619
|
+
(d) => d.id === t ? { ...d, ...o, updatedAt: (/* @__PURE__ */ new Date()).toISOString() } : d
|
|
620
620
|
)
|
|
621
621
|
}));
|
|
622
622
|
}
|
|
@@ -632,48 +632,48 @@ function Lt(n) {
|
|
|
632
632
|
}
|
|
633
633
|
});
|
|
634
634
|
}
|
|
635
|
-
const
|
|
636
|
-
notebook:
|
|
637
|
-
notes:
|
|
638
|
-
important:
|
|
639
|
-
unclear:
|
|
640
|
-
back:
|
|
641
|
-
editNote:
|
|
642
|
-
save:
|
|
643
|
-
cancel:
|
|
644
|
-
deleteNote:
|
|
645
|
-
note:
|
|
646
|
-
addNotePrompt:
|
|
647
|
-
removeFromNotebook:
|
|
635
|
+
const Lt = "Notebook", Pt = "Notes", _t = "Important", Ft = "Unclear", Mt = "Back", Ht = "Edit note", Bt = "Save", Wt = "Cancel", jt = "Delete note", zt = "note", Ut = "Add note (optional)", $t = "Remove from Notebook", qt = "Add a note (optional)", Gt = "Mark important", Kt = "Mark unclear", Xt = "Saved to Notebook.", Qt = "Note updated", Yt = "Note deleted", Vt = "Error saving to Notebook.", Zt = "Error updating note", Jt = "Note deletion failed", en = "Loading notes", tn = "Failed to load notes", nn = "Start capturing your notes", on = "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", sn = "Adjust your filters or create a new note to get started.", ln = "You have no notes for the selected filter", an = "Previous page", cn = "Next page", dn = "All courses", un = "All notes", fn = "Close Notebook panel", mn = "To use the Notebook feature, highlight an excerpt from your learning material to flag it as 'confusing' or 'important' and leave an optional note.", hn = "The content you highlighted is no longer available.", Ie = {
|
|
636
|
+
notebook: Lt,
|
|
637
|
+
notes: Pt,
|
|
638
|
+
important: _t,
|
|
639
|
+
unclear: Ft,
|
|
640
|
+
back: Mt,
|
|
641
|
+
editNote: Ht,
|
|
642
|
+
save: Bt,
|
|
643
|
+
cancel: Wt,
|
|
644
|
+
deleteNote: jt,
|
|
645
|
+
note: zt,
|
|
646
|
+
addNotePrompt: Ut,
|
|
647
|
+
removeFromNotebook: $t,
|
|
648
648
|
addNoteOptional: qt,
|
|
649
|
-
markImportant:
|
|
650
|
-
markUnclear:
|
|
651
|
-
savedToNotebook:
|
|
652
|
-
noteUpdated:
|
|
653
|
-
noteDeleted:
|
|
654
|
-
errorSavingNote:
|
|
655
|
-
errorUpdatingNote:
|
|
656
|
-
noteDeletionFailed:
|
|
657
|
-
loadingNotes:
|
|
658
|
-
failedToLoadNotes:
|
|
659
|
-
emptyStateHeading:
|
|
660
|
-
emptyStateDescription:
|
|
661
|
-
nothingHereYet:
|
|
662
|
-
adjustFiltersOrCreate:
|
|
663
|
-
noNotesForFilter:
|
|
664
|
-
previousPage:
|
|
665
|
-
nextPage:
|
|
666
|
-
allCourses:
|
|
667
|
-
allNotes:
|
|
668
|
-
closeNotebookPanel:
|
|
669
|
-
featureDescription:
|
|
670
|
-
highlightUnavailable:
|
|
671
|
-
},
|
|
672
|
-
function
|
|
649
|
+
markImportant: Gt,
|
|
650
|
+
markUnclear: Kt,
|
|
651
|
+
savedToNotebook: Xt,
|
|
652
|
+
noteUpdated: Qt,
|
|
653
|
+
noteDeleted: Yt,
|
|
654
|
+
errorSavingNote: Vt,
|
|
655
|
+
errorUpdatingNote: Zt,
|
|
656
|
+
noteDeletionFailed: Jt,
|
|
657
|
+
loadingNotes: en,
|
|
658
|
+
failedToLoadNotes: tn,
|
|
659
|
+
emptyStateHeading: nn,
|
|
660
|
+
emptyStateDescription: on,
|
|
661
|
+
nothingHereYet: rn,
|
|
662
|
+
adjustFiltersOrCreate: sn,
|
|
663
|
+
noNotesForFilter: ln,
|
|
664
|
+
previousPage: an,
|
|
665
|
+
nextPage: cn,
|
|
666
|
+
allCourses: dn,
|
|
667
|
+
allNotes: un,
|
|
668
|
+
closeNotebookPanel: fn,
|
|
669
|
+
featureDescription: mn,
|
|
670
|
+
highlightUnavailable: hn
|
|
671
|
+
}, qe = Pe(null);
|
|
672
|
+
function Ge(n, e) {
|
|
673
673
|
const t = Ie[n] ?? n;
|
|
674
674
|
return e ? t.replace(/%\{([^}]+)}/g, (o, r) => String(e[r] ?? `%{${r}}`)) : t;
|
|
675
675
|
}
|
|
676
|
-
function
|
|
676
|
+
function gn({
|
|
677
677
|
translations: n,
|
|
678
678
|
translate: e,
|
|
679
679
|
children: t
|
|
@@ -681,22 +681,22 @@ function pn({
|
|
|
681
681
|
const o = oe(
|
|
682
682
|
() => ({
|
|
683
683
|
translations: { ...Ie, ...n },
|
|
684
|
-
translate: e ??
|
|
684
|
+
translate: e ?? Ge
|
|
685
685
|
}),
|
|
686
686
|
[n, e]
|
|
687
687
|
);
|
|
688
|
-
return /* @__PURE__ */ i(
|
|
688
|
+
return /* @__PURE__ */ i(qe.Provider, { value: o, children: t });
|
|
689
689
|
}
|
|
690
|
-
function
|
|
691
|
-
const n = _e(
|
|
692
|
-
return n || { translations: Ie, translate:
|
|
690
|
+
function X() {
|
|
691
|
+
const n = _e(qe);
|
|
692
|
+
return n || { translations: Ie, translate: Ge };
|
|
693
693
|
}
|
|
694
|
-
const
|
|
694
|
+
const pn = {
|
|
695
695
|
selectedNoteId: null,
|
|
696
696
|
isNoteEditing: !1,
|
|
697
697
|
isTrayOpen: !1
|
|
698
698
|
};
|
|
699
|
-
function
|
|
699
|
+
function Nn(n, e) {
|
|
700
700
|
switch (e.type) {
|
|
701
701
|
case "SELECT_NOTE":
|
|
702
702
|
return {
|
|
@@ -717,7 +717,7 @@ function yn(n, e) {
|
|
|
717
717
|
}
|
|
718
718
|
}
|
|
719
719
|
const Ke = Pe(null);
|
|
720
|
-
function
|
|
720
|
+
function Kn({
|
|
721
721
|
api: n,
|
|
722
722
|
currentUserId: e,
|
|
723
723
|
objectId: t,
|
|
@@ -725,11 +725,11 @@ function Xn({
|
|
|
725
725
|
courseId: r,
|
|
726
726
|
pageLastModifiedAt: s,
|
|
727
727
|
onAnalyticsEvent: l,
|
|
728
|
-
translations:
|
|
728
|
+
translations: c,
|
|
729
729
|
translate: m,
|
|
730
|
-
children:
|
|
730
|
+
children: d
|
|
731
731
|
}) {
|
|
732
|
-
const [g, h] = Fe(
|
|
732
|
+
const [g, h] = Fe(Nn, pn), u = oe(
|
|
733
733
|
() => ({
|
|
734
734
|
api: n,
|
|
735
735
|
currentUserId: e,
|
|
@@ -756,7 +756,7 @@ function Xn({
|
|
|
756
756
|
g
|
|
757
757
|
]
|
|
758
758
|
);
|
|
759
|
-
return /* @__PURE__ */ i(Ke.Provider, { value: u, children: /* @__PURE__ */ i(
|
|
759
|
+
return /* @__PURE__ */ i(Ke.Provider, { value: u, children: /* @__PURE__ */ i(gn, { translations: c, translate: m, children: d }) });
|
|
760
760
|
}
|
|
761
761
|
function Xe() {
|
|
762
762
|
const n = _e(Ke);
|
|
@@ -764,22 +764,22 @@ function Xe() {
|
|
|
764
764
|
throw new Error("useNotebook must be used within a NotebookProvider");
|
|
765
765
|
return n;
|
|
766
766
|
}
|
|
767
|
-
const
|
|
768
|
-
const { translations: t } =
|
|
767
|
+
const yn = ({ currentType: n, onSelectReaction: e }) => {
|
|
768
|
+
const { translations: t } = X(), o = re(null), r = re(null);
|
|
769
769
|
return J(() => {
|
|
770
|
-
n ===
|
|
771
|
-
}, [n]), /* @__PURE__ */
|
|
772
|
-
/* @__PURE__ */
|
|
773
|
-
/* @__PURE__ */ i(
|
|
770
|
+
n === k.CONFUSING && o.current ? o.current.focus() : n === k.IMPORTANT && r.current ? r.current.focus() : o.current && o.current.focus();
|
|
771
|
+
}, [n]), /* @__PURE__ */ S(ee, { children: [
|
|
772
|
+
/* @__PURE__ */ S(ee.Item, { ref: o, onClick: () => e(k.CONFUSING), children: [
|
|
773
|
+
/* @__PURE__ */ i(Ne, { size: "x-small" }),
|
|
774
774
|
` ${t.markUnclear}`
|
|
775
775
|
] }),
|
|
776
|
-
/* @__PURE__ */
|
|
777
|
-
/* @__PURE__ */ i(
|
|
776
|
+
/* @__PURE__ */ S(ee.Item, { ref: r, onClick: () => e(k.IMPORTANT), children: [
|
|
777
|
+
/* @__PURE__ */ i(ye, { size: "x-small" }),
|
|
778
778
|
` ${t.markImportant}`
|
|
779
779
|
] })
|
|
780
780
|
] });
|
|
781
|
-
},
|
|
782
|
-
function
|
|
781
|
+
}, de = "notebook-inline-reaction-menu";
|
|
782
|
+
function Xn({
|
|
783
783
|
containerRef: n,
|
|
784
784
|
highlightTheme: e,
|
|
785
785
|
debounceTime: t = 500
|
|
@@ -789,9 +789,9 @@ function Qn({
|
|
|
789
789
|
objectId: r,
|
|
790
790
|
objectType: s,
|
|
791
791
|
courseId: l,
|
|
792
|
-
pageLastModifiedAt:
|
|
792
|
+
pageLastModifiedAt: c,
|
|
793
793
|
selectedNoteId: m,
|
|
794
|
-
selectNote:
|
|
794
|
+
selectNote: d,
|
|
795
795
|
openTray: g
|
|
796
796
|
} = Xe(), { data: h } = $e({
|
|
797
797
|
api: o,
|
|
@@ -800,174 +800,174 @@ function Qn({
|
|
|
800
800
|
},
|
|
801
801
|
courseId: l,
|
|
802
802
|
pageSize: 100
|
|
803
|
-
}), { mutate: u } =
|
|
803
|
+
}), { mutate: u } = Rt(o), { mutate: E } = At(o), { mutate: f } = Dt(o), v = re([]), [y, L] = B([]), [_, p] = B(null), [C, w] = B(""), [x, R] = B(null), [P, M] = B(!1);
|
|
804
804
|
J(() => {
|
|
805
|
-
const
|
|
806
|
-
if (!
|
|
807
|
-
const
|
|
808
|
-
if (
|
|
809
|
-
|
|
805
|
+
const O = n.current;
|
|
806
|
+
if (!O) return;
|
|
807
|
+
const b = O.closest(".user_content") ?? O;
|
|
808
|
+
if (b.classList.contains("enhanced")) {
|
|
809
|
+
M(!0);
|
|
810
810
|
return;
|
|
811
811
|
}
|
|
812
|
-
const
|
|
813
|
-
for (const
|
|
814
|
-
if (
|
|
815
|
-
|
|
812
|
+
const N = new MutationObserver((F) => {
|
|
813
|
+
for (const H of F)
|
|
814
|
+
if (H.type === "attributes" && H.attributeName === "class" && H.target.classList.contains("enhanced")) {
|
|
815
|
+
M(!0), N.disconnect();
|
|
816
816
|
return;
|
|
817
817
|
}
|
|
818
818
|
});
|
|
819
|
-
return
|
|
819
|
+
return N.observe(b, { attributes: !0, attributeFilter: ["class"] }), () => N.disconnect();
|
|
820
820
|
}, [n]), J(() => {
|
|
821
|
-
if (!
|
|
822
|
-
let
|
|
823
|
-
const
|
|
824
|
-
|
|
821
|
+
if (!P || !n.current) return;
|
|
822
|
+
let b = null;
|
|
823
|
+
const N = () => {
|
|
824
|
+
b && clearTimeout(b), b = setTimeout(() => {
|
|
825
825
|
var xe;
|
|
826
|
-
const
|
|
827
|
-
if (!(
|
|
828
|
-
const
|
|
829
|
-
if (
|
|
830
|
-
const Z =
|
|
831
|
-
if (!
|
|
832
|
-
const
|
|
833
|
-
|
|
826
|
+
const T = window.getSelection(), A = n.current;
|
|
827
|
+
if (!(T != null && T.rangeCount) || !A) return;
|
|
828
|
+
const z = T.toString().trim();
|
|
829
|
+
if (z === "") return;
|
|
830
|
+
const Z = T.getRangeAt(0);
|
|
831
|
+
if (!A.contains(Z.commonAncestorContainer)) return;
|
|
832
|
+
const Ce = (xe = K.fromRange(A, Z)) == null ? void 0 : xe.toSelector();
|
|
833
|
+
Ce && !It(Ce, y) && (p(Z.cloneRange()), w(z), R(Tt(Z)));
|
|
834
834
|
}, t);
|
|
835
|
-
}, F = (
|
|
836
|
-
if (!(
|
|
837
|
-
const
|
|
838
|
-
|
|
839
|
-
},
|
|
840
|
-
|
|
835
|
+
}, F = (T) => {
|
|
836
|
+
if (!(T.target instanceof Node)) return;
|
|
837
|
+
const A = document.getElementById(de);
|
|
838
|
+
A != null && A.contains(T.target) ? (T.preventDefault(), T.stopImmediatePropagation()) : (R(null), p(null), w(""));
|
|
839
|
+
}, H = () => {
|
|
840
|
+
R(null), p(null), w("");
|
|
841
841
|
};
|
|
842
|
-
return document.addEventListener("selectionchange",
|
|
843
|
-
|
|
842
|
+
return document.addEventListener("selectionchange", N), document.addEventListener("mousedown", F), document.addEventListener("touchstart", F), window.addEventListener("scroll", H, !0), () => {
|
|
843
|
+
b && clearTimeout(b), document.removeEventListener("selectionchange", N), document.removeEventListener("mousedown", F), document.removeEventListener("touchstart", F), window.removeEventListener("scroll", H, !0);
|
|
844
844
|
};
|
|
845
|
-
}, [
|
|
845
|
+
}, [P, y, t, n]), J(() => {
|
|
846
846
|
m && vt(m);
|
|
847
847
|
}, [m]);
|
|
848
|
-
const D =
|
|
849
|
-
(
|
|
850
|
-
var
|
|
851
|
-
const
|
|
852
|
-
if (!
|
|
853
|
-
const { highlightData:
|
|
854
|
-
if (
|
|
848
|
+
const D = Q(
|
|
849
|
+
(O) => {
|
|
850
|
+
var z;
|
|
851
|
+
const b = n.current;
|
|
852
|
+
if (!b || !O.highlightData) return null;
|
|
853
|
+
const { highlightData: N, reaction: F, id: H } = O, { range: T } = N, A = T && ((z = V.fromSelector(b, T)) == null ? void 0 : z.toRange());
|
|
854
|
+
if (A) {
|
|
855
855
|
const Z = {
|
|
856
|
-
id:
|
|
856
|
+
id: H,
|
|
857
857
|
selectedNoteId: m,
|
|
858
858
|
type: F[0],
|
|
859
859
|
onClick: () => {
|
|
860
|
-
|
|
860
|
+
d(H), g();
|
|
861
861
|
}
|
|
862
862
|
};
|
|
863
|
-
return
|
|
863
|
+
return wt(A, Z, e), N.textPosition;
|
|
864
864
|
}
|
|
865
865
|
return null;
|
|
866
866
|
},
|
|
867
|
-
[n, m, e,
|
|
867
|
+
[n, m, e, d, g]
|
|
868
868
|
);
|
|
869
869
|
J(() => {
|
|
870
|
-
if (!
|
|
871
|
-
const
|
|
872
|
-
if (
|
|
873
|
-
if (
|
|
874
|
-
for (const
|
|
875
|
-
Ae(
|
|
876
|
-
|
|
870
|
+
if (!P || !h || !n.current) return;
|
|
871
|
+
const O = n.current, b = h.notes, N = /* @__PURE__ */ new Set(), F = [], H = [];
|
|
872
|
+
if (b.length === 0) {
|
|
873
|
+
if (v.current.length > 0) {
|
|
874
|
+
for (const T of v.current)
|
|
875
|
+
Ae(T, O);
|
|
876
|
+
v.current = [], L([]);
|
|
877
877
|
}
|
|
878
878
|
return;
|
|
879
879
|
}
|
|
880
|
-
if (
|
|
881
|
-
const { notesForUpdate:
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
880
|
+
if (c && b[0].highlightData.pageLastModifiedAt !== c) {
|
|
881
|
+
const { notesForUpdate: T, noteIdsForDelete: A } = St(
|
|
882
|
+
O,
|
|
883
|
+
b,
|
|
884
|
+
c
|
|
885
885
|
);
|
|
886
|
-
for (const
|
|
887
|
-
E({ id:
|
|
888
|
-
for (const
|
|
889
|
-
f(
|
|
886
|
+
for (const z of T)
|
|
887
|
+
E({ id: z.id, input: z });
|
|
888
|
+
for (const z of A)
|
|
889
|
+
f(z);
|
|
890
890
|
} else {
|
|
891
|
-
for (const
|
|
892
|
-
const
|
|
893
|
-
|
|
891
|
+
for (const T of b) {
|
|
892
|
+
const A = D(T);
|
|
893
|
+
N.add(T.id), A && (F.push(T), H.push(A));
|
|
894
894
|
}
|
|
895
|
-
for (const
|
|
896
|
-
|
|
897
|
-
|
|
895
|
+
for (const T of v.current)
|
|
896
|
+
N.has(T.id) || Ae(T, O);
|
|
897
|
+
L(H), v.current = F;
|
|
898
898
|
}
|
|
899
899
|
}, [
|
|
900
|
-
|
|
900
|
+
P,
|
|
901
901
|
h,
|
|
902
902
|
D,
|
|
903
|
-
|
|
903
|
+
c,
|
|
904
904
|
n,
|
|
905
905
|
E,
|
|
906
906
|
f
|
|
907
907
|
]);
|
|
908
|
-
const
|
|
909
|
-
const
|
|
910
|
-
if (!
|
|
911
|
-
const
|
|
908
|
+
const j = (O) => {
|
|
909
|
+
const b = n.current;
|
|
910
|
+
if (!_ || !b) return;
|
|
911
|
+
const N = V.fromRange(b, _), F = K.fromRange(b, _);
|
|
912
912
|
u(
|
|
913
913
|
{
|
|
914
914
|
courseId: l,
|
|
915
915
|
objectId: r,
|
|
916
916
|
objectType: s,
|
|
917
917
|
userText: "",
|
|
918
|
-
reaction: [
|
|
918
|
+
reaction: [O],
|
|
919
919
|
highlightData: {
|
|
920
|
-
selectedText:
|
|
920
|
+
selectedText: C,
|
|
921
921
|
textPosition: (F == null ? void 0 : F.toSelector()) ?? null,
|
|
922
|
-
range:
|
|
923
|
-
pageLastModifiedAt:
|
|
922
|
+
range: N.toSelector(),
|
|
923
|
+
pageLastModifiedAt: c ?? ""
|
|
924
924
|
}
|
|
925
925
|
},
|
|
926
926
|
{
|
|
927
|
-
onSuccess: (
|
|
928
|
-
var
|
|
929
|
-
const
|
|
930
|
-
|
|
927
|
+
onSuccess: (H) => {
|
|
928
|
+
var A;
|
|
929
|
+
const T = H.id;
|
|
930
|
+
p(null), w(""), R(null), (A = window.getSelection()) == null || A.removeAllRanges(), d(T), g();
|
|
931
931
|
}
|
|
932
932
|
}
|
|
933
933
|
);
|
|
934
934
|
};
|
|
935
|
-
return !
|
|
935
|
+
return !_ || !x ? null : Ze(
|
|
936
936
|
/* @__PURE__ */ i(
|
|
937
937
|
"div",
|
|
938
938
|
{
|
|
939
|
-
id:
|
|
939
|
+
id: de,
|
|
940
940
|
role: "toolbar",
|
|
941
941
|
style: {
|
|
942
942
|
position: "fixed",
|
|
943
943
|
zIndex: 100,
|
|
944
|
-
top:
|
|
945
|
-
left:
|
|
944
|
+
top: x.top,
|
|
945
|
+
left: x.left,
|
|
946
946
|
whiteSpace: "nowrap"
|
|
947
947
|
},
|
|
948
|
-
onBlur: (
|
|
949
|
-
const
|
|
950
|
-
|
|
948
|
+
onBlur: (O) => {
|
|
949
|
+
const b = document.getElementById(de);
|
|
950
|
+
b != null && b.contains(O.relatedTarget) || (R(null), p(null), w(""));
|
|
951
951
|
},
|
|
952
|
-
children: /* @__PURE__ */ i(
|
|
952
|
+
children: /* @__PURE__ */ i(yn, { onSelectReaction: j })
|
|
953
953
|
}
|
|
954
954
|
),
|
|
955
955
|
document.body
|
|
956
956
|
);
|
|
957
957
|
}
|
|
958
|
-
const
|
|
959
|
-
backgroundColor: n ===
|
|
960
|
-
underlineColor: n ===
|
|
961
|
-
underlineStyle: n ===
|
|
962
|
-
}),
|
|
958
|
+
const bn = (n, e) => ({
|
|
959
|
+
backgroundColor: n === k.IMPORTANT ? e.colors.importantBackground : e.colors.confusingBackground,
|
|
960
|
+
underlineColor: n === k.IMPORTANT ? e.colors.importantUnderline : e.colors.confusingUnderline,
|
|
961
|
+
underlineStyle: n === k.IMPORTANT ? "solid" : "dashed"
|
|
962
|
+
}), he = ({
|
|
963
963
|
children: n,
|
|
964
|
-
type: e =
|
|
964
|
+
type: e = k.IMPORTANT,
|
|
965
965
|
isCardActive: t = !0,
|
|
966
966
|
theme: o
|
|
967
967
|
}) => {
|
|
968
|
-
const r =
|
|
968
|
+
const r = bn(e, o), l = {
|
|
969
969
|
position: "relative",
|
|
970
|
-
backgroundColor: t ? r.backgroundColor :
|
|
970
|
+
backgroundColor: t ? r.backgroundColor : Te(r.backgroundColor, 0.5),
|
|
971
971
|
textDecorationLine: "underline",
|
|
972
972
|
textDecorationStyle: r.underlineStyle,
|
|
973
973
|
textDecorationColor: r.underlineColor,
|
|
@@ -977,17 +977,17 @@ const En = (n, e) => ({
|
|
|
977
977
|
};
|
|
978
978
|
return /* @__PURE__ */ i("span", { "data-note-highlight": "true", style: l, children: n });
|
|
979
979
|
}, Qe = () => {
|
|
980
|
-
const { translations: n } =
|
|
981
|
-
return /* @__PURE__ */
|
|
982
|
-
/* @__PURE__ */ i(
|
|
983
|
-
/* @__PURE__ */ i(
|
|
980
|
+
const { translations: n } = X();
|
|
981
|
+
return /* @__PURE__ */ S(I, { gap: "xx-small", alignItems: "start", as: "div", children: [
|
|
982
|
+
/* @__PURE__ */ i(I.Item, { as: "div", children: /* @__PURE__ */ i(tt, { color: "error" }) }),
|
|
983
|
+
/* @__PURE__ */ i(I.Item, { padding: "xxx-small none", shouldShrink: !0, children: /* @__PURE__ */ i(me, { maxLines: 3, children: n.highlightUnavailable }) })
|
|
984
984
|
] });
|
|
985
|
-
},
|
|
985
|
+
}, En = {
|
|
986
986
|
filter: null,
|
|
987
987
|
courseFilter: null,
|
|
988
988
|
pageParamsWithDirection: {}
|
|
989
989
|
};
|
|
990
|
-
function
|
|
990
|
+
function Sn(n, e) {
|
|
991
991
|
switch (e.type) {
|
|
992
992
|
case "SET_FILTER":
|
|
993
993
|
return { ...n, filter: e.payload, pageParamsWithDirection: {} };
|
|
@@ -999,67 +999,67 @@ function Cn(n, e) {
|
|
|
999
999
|
return n;
|
|
1000
1000
|
}
|
|
1001
1001
|
}
|
|
1002
|
-
function
|
|
1002
|
+
function Qn({
|
|
1003
1003
|
api: n,
|
|
1004
1004
|
courseId: e,
|
|
1005
1005
|
enableCourseFilter: t = !1,
|
|
1006
1006
|
learningObject: o,
|
|
1007
1007
|
pageSize: r = 16
|
|
1008
1008
|
}) {
|
|
1009
|
-
const [s, l] = Fe(
|
|
1009
|
+
const [s, l] = Fe(Sn, En), { filter: c, courseFilter: m, pageParamsWithDirection: d } = s;
|
|
1010
1010
|
J(() => {
|
|
1011
|
-
Object.keys(
|
|
1011
|
+
Object.keys(d).length > 0 && l({ type: "SET_PAGE_PARAMS_WITH_DIRECTION", payload: {} });
|
|
1012
1012
|
}, [r]);
|
|
1013
|
-
const g = t ? m : e, { direction: h, pageParams: u } =
|
|
1013
|
+
const g = t ? m : e, { direction: h, pageParams: u } = d, E = h === "next" ? (u == null ? void 0 : u.endCursor) ?? void 0 : h === "prev" ? (u == null ? void 0 : u.startCursor) ?? void 0 : void 0, { data: f, isLoading: v, isError: y } = $e({
|
|
1014
1014
|
api: n,
|
|
1015
1015
|
filter: {
|
|
1016
1016
|
...g ? { courseId: g } : {},
|
|
1017
|
-
...
|
|
1017
|
+
...c ? { reactions: [c] } : {},
|
|
1018
1018
|
...o ? { learningObject: o } : {}
|
|
1019
1019
|
},
|
|
1020
1020
|
cursor: E,
|
|
1021
1021
|
direction: h,
|
|
1022
1022
|
pageSize: r
|
|
1023
|
-
}),
|
|
1023
|
+
}), L = (f == null ? void 0 : f.notes) ?? [], _ = f == null ? void 0 : f.pageInfo, p = Q(() => {
|
|
1024
1024
|
l({
|
|
1025
1025
|
type: "SET_PAGE_PARAMS_WITH_DIRECTION",
|
|
1026
1026
|
payload: { pageParams: f == null ? void 0 : f.pageInfo, direction: "next" }
|
|
1027
1027
|
});
|
|
1028
|
-
}, [f == null ? void 0 : f.pageInfo]),
|
|
1028
|
+
}, [f == null ? void 0 : f.pageInfo]), C = Q(() => {
|
|
1029
1029
|
l({
|
|
1030
1030
|
type: "SET_PAGE_PARAMS_WITH_DIRECTION",
|
|
1031
1031
|
payload: { pageParams: f == null ? void 0 : f.pageInfo, direction: "prev" }
|
|
1032
1032
|
});
|
|
1033
|
-
}, [f == null ? void 0 : f.pageInfo]),
|
|
1034
|
-
l({ type: "SET_FILTER", payload:
|
|
1035
|
-
}, []),
|
|
1036
|
-
l({ type: "SET_COURSE_FILTER", payload:
|
|
1033
|
+
}, [f == null ? void 0 : f.pageInfo]), w = Q((R) => {
|
|
1034
|
+
l({ type: "SET_FILTER", payload: R });
|
|
1035
|
+
}, []), x = Q((R) => {
|
|
1036
|
+
l({ type: "SET_COURSE_FILTER", payload: R });
|
|
1037
1037
|
}, []);
|
|
1038
1038
|
return {
|
|
1039
|
-
notes:
|
|
1040
|
-
pageInfo:
|
|
1041
|
-
isLoading:
|
|
1042
|
-
isError:
|
|
1043
|
-
filter:
|
|
1039
|
+
notes: L,
|
|
1040
|
+
pageInfo: _,
|
|
1041
|
+
isLoading: v,
|
|
1042
|
+
isError: y,
|
|
1043
|
+
filter: c,
|
|
1044
1044
|
courseFilter: m,
|
|
1045
|
-
setFilter:
|
|
1046
|
-
setCourseFilter:
|
|
1047
|
-
fetchNextPage:
|
|
1048
|
-
fetchPreviousPage:
|
|
1045
|
+
setFilter: w,
|
|
1046
|
+
setCourseFilter: x,
|
|
1047
|
+
fetchNextPage: p,
|
|
1048
|
+
fetchPreviousPage: C
|
|
1049
1049
|
};
|
|
1050
1050
|
}
|
|
1051
|
-
const
|
|
1052
|
-
function
|
|
1053
|
-
const { translations: t } =
|
|
1051
|
+
const ue = "all";
|
|
1052
|
+
function Yn({ filter: n, setFilter: e }) {
|
|
1053
|
+
const { translations: t } = X(), o = oe(
|
|
1054
1054
|
() => [
|
|
1055
|
-
{ label: t.allNotes, value:
|
|
1056
|
-
{ label: t.important, value:
|
|
1057
|
-
{ label: t.unclear, value:
|
|
1055
|
+
{ label: t.allNotes, value: ue },
|
|
1056
|
+
{ label: t.important, value: k.IMPORTANT },
|
|
1057
|
+
{ label: t.unclear, value: k.CONFUSING }
|
|
1058
1058
|
],
|
|
1059
1059
|
[t]
|
|
1060
|
-
), r =
|
|
1061
|
-
(l, { value:
|
|
1062
|
-
e(!
|
|
1060
|
+
), r = Q(
|
|
1061
|
+
(l, { value: c }) => {
|
|
1062
|
+
e(!c || c === ue ? null : c);
|
|
1063
1063
|
},
|
|
1064
1064
|
[e]
|
|
1065
1065
|
);
|
|
@@ -1069,7 +1069,7 @@ function Vn({ filter: n, setFilter: e }) {
|
|
|
1069
1069
|
we,
|
|
1070
1070
|
{
|
|
1071
1071
|
renderLabel: /* @__PURE__ */ i(Me, { children: t.notes }),
|
|
1072
|
-
value: n ??
|
|
1072
|
+
value: n ?? ue,
|
|
1073
1073
|
onChange: r,
|
|
1074
1074
|
children: o.map((l) => /* @__PURE__ */ i(we.Option, { id: l.value, value: l.value, children: l.label }, l.value))
|
|
1075
1075
|
}
|
|
@@ -1080,21 +1080,21 @@ function Vn({ filter: n, setFilter: e }) {
|
|
|
1080
1080
|
handleReactionFilterChange: r
|
|
1081
1081
|
};
|
|
1082
1082
|
}
|
|
1083
|
-
const
|
|
1084
|
-
const { isTrayOpen: e, closeTray: t } = Xe(), { translations: o } =
|
|
1083
|
+
const Vn = ({ children: n }) => {
|
|
1084
|
+
const { isTrayOpen: e, closeTray: t } = Xe(), { translations: o } = X();
|
|
1085
1085
|
return /* @__PURE__ */ i(
|
|
1086
|
-
|
|
1086
|
+
it,
|
|
1087
1087
|
{
|
|
1088
1088
|
label: o.notebook,
|
|
1089
1089
|
open: e,
|
|
1090
1090
|
onDismiss: t,
|
|
1091
1091
|
placement: "end",
|
|
1092
1092
|
size: "regular",
|
|
1093
|
-
children: /* @__PURE__ */
|
|
1094
|
-
/* @__PURE__ */ i(
|
|
1093
|
+
children: /* @__PURE__ */ S(I, { direction: "column", height: "100vh", children: [
|
|
1094
|
+
/* @__PURE__ */ i(I.Item, { children: /* @__PURE__ */ i(q, { as: "div", padding: "small medium", borderWidth: "0 0 small 0", children: /* @__PURE__ */ S(I, { justifyItems: "space-between", alignItems: "center", children: [
|
|
1095
1095
|
/* @__PURE__ */ i(ae, { level: "h3", children: o.notebook }),
|
|
1096
1096
|
/* @__PURE__ */ i(
|
|
1097
|
-
|
|
1097
|
+
st,
|
|
1098
1098
|
{
|
|
1099
1099
|
screenReaderLabel: o.closeNotebookPanel,
|
|
1100
1100
|
onClick: t,
|
|
@@ -1103,53 +1103,49 @@ const Zn = ({ children: n }) => {
|
|
|
1103
1103
|
}
|
|
1104
1104
|
)
|
|
1105
1105
|
] }) }) }),
|
|
1106
|
-
/* @__PURE__ */ i(
|
|
1106
|
+
/* @__PURE__ */ i(I.Item, { shouldGrow: !0, shouldShrink: !0, overflowY: "auto", overflowX: "hidden", children: n })
|
|
1107
1107
|
] })
|
|
1108
1108
|
}
|
|
1109
1109
|
);
|
|
1110
1110
|
}, vn = {
|
|
1111
|
-
[
|
|
1112
|
-
color: "
|
|
1111
|
+
[k.IMPORTANT]: {
|
|
1112
|
+
color: "success",
|
|
1113
1113
|
translationKey: "important",
|
|
1114
|
-
icon: /* @__PURE__ */ i(
|
|
1114
|
+
icon: /* @__PURE__ */ i(ye, { size: "x-small" })
|
|
1115
1115
|
},
|
|
1116
|
-
[
|
|
1116
|
+
[k.CONFUSING]: {
|
|
1117
1117
|
color: "danger",
|
|
1118
1118
|
translationKey: "unclear",
|
|
1119
|
-
icon: /* @__PURE__ */ i(
|
|
1119
|
+
icon: /* @__PURE__ */ i(Ne, { size: "x-small" })
|
|
1120
1120
|
}
|
|
1121
1121
|
}, Ye = ({ type: n, onTypeChange: e, renderAsMenuTrigger: t = !1 }) => {
|
|
1122
|
-
const { translations: o } =
|
|
1122
|
+
const { translations: o } = X(), r = vn[n], s = o[r.translationKey], [l, c] = B(!1), m = re(null), d = re(null), g = Q(
|
|
1123
1123
|
(h) => {
|
|
1124
|
-
e == null || e(h),
|
|
1124
|
+
e == null || e(h), c(!1);
|
|
1125
1125
|
},
|
|
1126
1126
|
[e]
|
|
1127
1127
|
);
|
|
1128
|
-
return t && e ? /* @__PURE__ */
|
|
1128
|
+
return t && e ? /* @__PURE__ */ S(
|
|
1129
1129
|
ee,
|
|
1130
1130
|
{
|
|
1131
1131
|
placement: "bottom start",
|
|
1132
1132
|
show: l,
|
|
1133
|
-
onToggle: (h) =>
|
|
1133
|
+
onToggle: (h) => c(h),
|
|
1134
1134
|
shouldHideOnSelect: !0,
|
|
1135
1135
|
shouldFocusTriggerOnClose: !0,
|
|
1136
|
-
trigger: /* @__PURE__ */
|
|
1137
|
-
s,
|
|
1138
|
-
" ",
|
|
1139
|
-
/* @__PURE__ */ i(nt, { size: "x-small" })
|
|
1140
|
-
] }),
|
|
1136
|
+
trigger: /* @__PURE__ */ i(ke, { color: r.color, renderIcon: r.icon, children: s }),
|
|
1141
1137
|
children: [
|
|
1142
|
-
/* @__PURE__ */
|
|
1143
|
-
/* @__PURE__ */ i(
|
|
1138
|
+
/* @__PURE__ */ S(ee.Item, { ref: m, onClick: () => g(k.CONFUSING), children: [
|
|
1139
|
+
/* @__PURE__ */ i(Ne, { size: "x-small" }),
|
|
1144
1140
|
` ${o.markUnclear}`
|
|
1145
1141
|
] }),
|
|
1146
|
-
/* @__PURE__ */
|
|
1147
|
-
/* @__PURE__ */ i(
|
|
1142
|
+
/* @__PURE__ */ S(ee.Item, { ref: d, onClick: () => g(k.IMPORTANT), children: [
|
|
1143
|
+
/* @__PURE__ */ i(ye, { size: "x-small" }),
|
|
1148
1144
|
` ${o.markImportant}`
|
|
1149
1145
|
] })
|
|
1150
1146
|
]
|
|
1151
1147
|
}
|
|
1152
|
-
) : /* @__PURE__ */ i(
|
|
1148
|
+
) : /* @__PURE__ */ i(q, { display: "inline-flex", children: /* @__PURE__ */ i(ke, { color: r.color, renderIcon: r.icon, children: s }) });
|
|
1153
1149
|
};
|
|
1154
1150
|
function Le(n, e) {
|
|
1155
1151
|
return (n instanceof Date ? n : new Date(n)).toLocaleString(e, {
|
|
@@ -1158,7 +1154,7 @@ function Le(n, e) {
|
|
|
1158
1154
|
day: "numeric"
|
|
1159
1155
|
});
|
|
1160
1156
|
}
|
|
1161
|
-
const
|
|
1157
|
+
const Tn = ({
|
|
1162
1158
|
noteId: n,
|
|
1163
1159
|
date: e,
|
|
1164
1160
|
highlight: t,
|
|
@@ -1166,246 +1162,238 @@ const In = ({
|
|
|
1166
1162
|
type: r,
|
|
1167
1163
|
onClick: s,
|
|
1168
1164
|
onDelete: l,
|
|
1169
|
-
onSaveNote:
|
|
1165
|
+
onSaveNote: c,
|
|
1170
1166
|
onTypeChange: m,
|
|
1171
|
-
isActive:
|
|
1167
|
+
isActive: d,
|
|
1172
1168
|
isPanelView: g = !1,
|
|
1173
1169
|
courseName: h,
|
|
1174
1170
|
locale: u,
|
|
1175
1171
|
highlightTheme: E,
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
href: O
|
|
1172
|
+
renderLink: f,
|
|
1173
|
+
href: v
|
|
1179
1174
|
}) => {
|
|
1180
|
-
const { translations:
|
|
1181
|
-
|
|
1182
|
-
},
|
|
1183
|
-
t &&
|
|
1184
|
-
const
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
"
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
|
|
1175
|
+
const { translations: y } = X(), [L, _] = B(!1), [p, C] = B(!1), [w, x] = B(o || ""), [R, P] = B(!1), M = r === k.IMPORTANT ? y.important : y.unclear, D = (N) => {
|
|
1176
|
+
N.key === "Enter" && (N.preventDefault(), s == null || s());
|
|
1177
|
+
}, j = [M, y.note];
|
|
1178
|
+
t && j.push(t), o && j.push(o), e && j.push(Le(e, u)), h && j.push(h);
|
|
1179
|
+
const O = j.join(", "), b = /* @__PURE__ */ S(
|
|
1180
|
+
q,
|
|
1181
|
+
{
|
|
1182
|
+
as: "div",
|
|
1183
|
+
borderWidth: "small",
|
|
1184
|
+
borderRadius: "medium",
|
|
1185
|
+
padding: "small",
|
|
1186
|
+
position: "relative",
|
|
1187
|
+
role: v || p ? void 0 : "button",
|
|
1188
|
+
"aria-label": v ? void 0 : O,
|
|
1189
|
+
"aria-pressed": v || p ? void 0 : d,
|
|
1190
|
+
tabIndex: v || d ? -1 : 0,
|
|
1191
|
+
"data-testid": "note-card",
|
|
1192
|
+
onClick: d ? void 0 : s,
|
|
1193
|
+
onMouseEnter: () => _(!0),
|
|
1194
|
+
onMouseLeave: () => _(!1),
|
|
1195
|
+
onKeyDown: d ? void 0 : D,
|
|
1196
|
+
cursor: p ? "default" : "pointer",
|
|
1197
|
+
children: [
|
|
1198
|
+
/* @__PURE__ */ S(I, { direction: "column", gap: "small", children: [
|
|
1199
|
+
/* @__PURE__ */ i(
|
|
1200
|
+
Ye,
|
|
1201
|
+
{
|
|
1202
|
+
type: r,
|
|
1203
|
+
onTypeChange: g && m ? (N) => m(n, N) : void 0,
|
|
1204
|
+
renderAsMenuTrigger: g && !!m && !!d
|
|
1205
|
+
}
|
|
1206
|
+
),
|
|
1207
|
+
t ? /* @__PURE__ */ i("div", { style: { wordBreak: "break-word", overflowWrap: "break-word" }, children: /* @__PURE__ */ i(U, { children: d && g ? /* @__PURE__ */ i(
|
|
1208
|
+
he,
|
|
1209
|
+
{
|
|
1210
|
+
type: r,
|
|
1211
|
+
isCardActive: !!d || L,
|
|
1212
|
+
theme: E,
|
|
1213
|
+
children: t
|
|
1214
|
+
}
|
|
1215
|
+
) : /* @__PURE__ */ i(me, { maxLines: 3, truncate: "word", children: /* @__PURE__ */ i(
|
|
1216
|
+
he,
|
|
1217
|
+
{
|
|
1218
|
+
type: r,
|
|
1219
|
+
isCardActive: !!d || L,
|
|
1220
|
+
theme: E,
|
|
1221
|
+
children: t
|
|
1222
|
+
}
|
|
1223
|
+
) }) }) }) : /* @__PURE__ */ i(Qe, {}),
|
|
1224
|
+
/* @__PURE__ */ S(I, { direction: "column", gap: "small", children: [
|
|
1225
|
+
p && g ? /* @__PURE__ */ S(I, { direction: "column", gap: "x-small", children: [
|
|
1226
|
+
/* @__PURE__ */ i(
|
|
1227
|
+
He,
|
|
1228
|
+
{
|
|
1229
|
+
label: /* @__PURE__ */ i(Me, { children: y.editNote }),
|
|
1230
|
+
value: w,
|
|
1231
|
+
onChange: (N) => x(N.target.value),
|
|
1232
|
+
placeholder: y.addNoteOptional
|
|
1233
|
+
}
|
|
1234
|
+
),
|
|
1235
|
+
/* @__PURE__ */ S(I, { gap: "xx-small", children: [
|
|
1236
|
+
/* @__PURE__ */ i(I.Item, { shouldGrow: !0, children: /* @__PURE__ */ i(
|
|
1237
|
+
$,
|
|
1239
1238
|
{
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
|
|
1239
|
+
display: "block",
|
|
1240
|
+
size: "small",
|
|
1241
|
+
"data-testid": "note-card-cancel",
|
|
1242
|
+
onClick: () => {
|
|
1243
|
+
x(o || ""), C(!1);
|
|
1244
|
+
},
|
|
1245
|
+
children: y.cancel
|
|
1244
1246
|
}
|
|
1245
|
-
),
|
|
1246
|
-
/* @__PURE__ */
|
|
1247
|
-
|
|
1248
|
-
|
|
1247
|
+
) }),
|
|
1248
|
+
/* @__PURE__ */ i(I.Item, { shouldGrow: !0, children: /* @__PURE__ */ i(
|
|
1249
|
+
$,
|
|
1250
|
+
{
|
|
1251
|
+
display: "block",
|
|
1252
|
+
color: "primary",
|
|
1253
|
+
size: "small",
|
|
1254
|
+
"data-testid": "note-card-save",
|
|
1255
|
+
onClick: () => {
|
|
1256
|
+
c == null || c(n, w), C(!1);
|
|
1257
|
+
},
|
|
1258
|
+
interaction: w.trim() ? "enabled" : "disabled",
|
|
1259
|
+
children: y.save
|
|
1260
|
+
}
|
|
1261
|
+
) })
|
|
1262
|
+
] })
|
|
1263
|
+
] }) : o ? /* @__PURE__ */ i("div", { style: { wordBreak: "break-word", overflowWrap: "break-word" }, children: d && g ? /* @__PURE__ */ S(U, { children: [
|
|
1264
|
+
o,
|
|
1265
|
+
" ",
|
|
1266
|
+
/* @__PURE__ */ i(
|
|
1267
|
+
Y,
|
|
1268
|
+
{
|
|
1269
|
+
size: "small",
|
|
1270
|
+
withBackground: !1,
|
|
1271
|
+
withBorder: !1,
|
|
1272
|
+
screenReaderLabel: y.editNote,
|
|
1273
|
+
"data-testid": "note-card-edit",
|
|
1274
|
+
onClick: (N) => {
|
|
1275
|
+
N.stopPropagation(), C(!0);
|
|
1276
|
+
},
|
|
1277
|
+
children: /* @__PURE__ */ i(fe, {})
|
|
1278
|
+
}
|
|
1279
|
+
)
|
|
1280
|
+
] }) : /* @__PURE__ */ i(U, { children: /* @__PURE__ */ i(me, { maxLines: 3, truncate: "word", children: o }) }) }) : g && d ? /* @__PURE__ */ i("div", { children: /* @__PURE__ */ S(U, { color: "secondary", children: [
|
|
1281
|
+
y.addNotePrompt,
|
|
1282
|
+
" ",
|
|
1283
|
+
/* @__PURE__ */ i(
|
|
1284
|
+
Y,
|
|
1285
|
+
{
|
|
1286
|
+
size: "small",
|
|
1287
|
+
withBackground: !1,
|
|
1288
|
+
withBorder: !1,
|
|
1289
|
+
screenReaderLabel: y.editNote,
|
|
1290
|
+
"data-testid": "note-card-edit",
|
|
1291
|
+
onClick: (N) => {
|
|
1292
|
+
N.stopPropagation(), C(!0);
|
|
1293
|
+
},
|
|
1294
|
+
children: /* @__PURE__ */ i(fe, {})
|
|
1295
|
+
}
|
|
1296
|
+
)
|
|
1297
|
+
] }) }) : null,
|
|
1298
|
+
/* @__PURE__ */ S(I, { justifyItems: "space-between", alignItems: "center", children: [
|
|
1299
|
+
/* @__PURE__ */ i(U, { size: "small", color: "secondary", children: Le(e, u) }),
|
|
1300
|
+
d && l && /* @__PURE__ */ i(
|
|
1301
|
+
Y,
|
|
1302
|
+
{
|
|
1303
|
+
size: "small",
|
|
1304
|
+
withBackground: !1,
|
|
1305
|
+
withBorder: !1,
|
|
1306
|
+
color: "danger",
|
|
1307
|
+
screenReaderLabel: y.deleteNote,
|
|
1308
|
+
"data-testid": "note-card-delete",
|
|
1309
|
+
onClick: (N) => {
|
|
1310
|
+
N.stopPropagation(), P(!0);
|
|
1311
|
+
},
|
|
1312
|
+
children: /* @__PURE__ */ i(le, {})
|
|
1313
|
+
}
|
|
1314
|
+
)
|
|
1315
|
+
] }),
|
|
1316
|
+
h && /* @__PURE__ */ i(U, { size: "small", color: "secondary", children: h })
|
|
1317
|
+
] })
|
|
1318
|
+
] }),
|
|
1319
|
+
R && l && /* @__PURE__ */ i(
|
|
1320
|
+
q,
|
|
1321
|
+
{
|
|
1322
|
+
as: "div",
|
|
1323
|
+
background: "primary",
|
|
1324
|
+
padding: "medium",
|
|
1325
|
+
borderRadius: "large",
|
|
1326
|
+
position: "absolute",
|
|
1327
|
+
insetBlockStart: "0",
|
|
1328
|
+
insetBlockEnd: "0",
|
|
1329
|
+
insetInlineStart: "0",
|
|
1330
|
+
insetInlineEnd: "0",
|
|
1331
|
+
stacking: "above",
|
|
1332
|
+
children: /* @__PURE__ */ S(
|
|
1333
|
+
I,
|
|
1334
|
+
{
|
|
1335
|
+
direction: "column",
|
|
1336
|
+
justifyItems: "center",
|
|
1337
|
+
alignItems: "center",
|
|
1338
|
+
gap: "x-small",
|
|
1339
|
+
height: "100%",
|
|
1340
|
+
children: [
|
|
1341
|
+
/* @__PURE__ */ i(
|
|
1342
|
+
$,
|
|
1249
1343
|
{
|
|
1250
1344
|
display: "block",
|
|
1345
|
+
color: "danger",
|
|
1251
1346
|
size: "small",
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
|
|
1347
|
+
renderIcon: /* @__PURE__ */ i(le, {}),
|
|
1348
|
+
"data-testid": "note-card-confirm-delete",
|
|
1349
|
+
onClick: (N) => {
|
|
1350
|
+
N.stopPropagation(), l(n), P(!1);
|
|
1255
1351
|
},
|
|
1256
|
-
children:
|
|
1352
|
+
children: y.deleteNote
|
|
1257
1353
|
}
|
|
1258
|
-
)
|
|
1259
|
-
/* @__PURE__ */ i(
|
|
1260
|
-
|
|
1354
|
+
),
|
|
1355
|
+
/* @__PURE__ */ i(
|
|
1356
|
+
$,
|
|
1261
1357
|
{
|
|
1262
1358
|
display: "block",
|
|
1263
|
-
color: "primary",
|
|
1264
1359
|
size: "small",
|
|
1265
|
-
"data-testid": "note-card-
|
|
1266
|
-
onClick: () => {
|
|
1267
|
-
|
|
1360
|
+
"data-testid": "note-card-cancel-delete",
|
|
1361
|
+
onClick: (N) => {
|
|
1362
|
+
N.stopPropagation(), P(!1);
|
|
1268
1363
|
},
|
|
1269
|
-
|
|
1270
|
-
children: k.save
|
|
1364
|
+
children: y.cancel
|
|
1271
1365
|
}
|
|
1272
|
-
)
|
|
1273
|
-
]
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
|
|
1278
|
-
|
|
1279
|
-
|
|
1280
|
-
size: "small",
|
|
1281
|
-
withBackground: !1,
|
|
1282
|
-
withBorder: !1,
|
|
1283
|
-
screenReaderLabel: k.editNote,
|
|
1284
|
-
"data-testid": "note-card-edit",
|
|
1285
|
-
onClick: (p) => {
|
|
1286
|
-
p.stopPropagation(), R(!0);
|
|
1287
|
-
},
|
|
1288
|
-
children: /* @__PURE__ */ i(me, {})
|
|
1289
|
-
}
|
|
1290
|
-
)
|
|
1291
|
-
] }) : /* @__PURE__ */ i(z, { children: /* @__PURE__ */ i(he, { maxLines: 3, truncate: "word", children: o }) }) }) : g && c ? /* @__PURE__ */ i("div", { children: /* @__PURE__ */ b(z, { color: "secondary", children: [
|
|
1292
|
-
k.addNotePrompt,
|
|
1293
|
-
" ",
|
|
1294
|
-
/* @__PURE__ */ i(
|
|
1295
|
-
X,
|
|
1296
|
-
{
|
|
1297
|
-
size: "small",
|
|
1298
|
-
withBackground: !1,
|
|
1299
|
-
withBorder: !1,
|
|
1300
|
-
screenReaderLabel: k.editNote,
|
|
1301
|
-
"data-testid": "note-card-edit",
|
|
1302
|
-
onClick: (p) => {
|
|
1303
|
-
p.stopPropagation(), R(!0);
|
|
1304
|
-
},
|
|
1305
|
-
children: /* @__PURE__ */ i(me, {})
|
|
1306
|
-
}
|
|
1307
|
-
)
|
|
1308
|
-
] }) }) : null,
|
|
1309
|
-
/* @__PURE__ */ b(v, { justifyItems: "space-between", alignItems: "center", children: [
|
|
1310
|
-
/* @__PURE__ */ i(z, { size: "small", color: "secondary", children: Le(e, u) }),
|
|
1311
|
-
c && l && /* @__PURE__ */ i(
|
|
1312
|
-
X,
|
|
1313
|
-
{
|
|
1314
|
-
size: "small",
|
|
1315
|
-
withBackground: !1,
|
|
1316
|
-
withBorder: !1,
|
|
1317
|
-
color: "danger",
|
|
1318
|
-
screenReaderLabel: k.deleteNote,
|
|
1319
|
-
"data-testid": "note-card-delete",
|
|
1320
|
-
onClick: (p) => {
|
|
1321
|
-
p.stopPropagation(), L(!0);
|
|
1322
|
-
},
|
|
1323
|
-
children: /* @__PURE__ */ i(le, {})
|
|
1324
|
-
}
|
|
1325
|
-
)
|
|
1326
|
-
] }),
|
|
1327
|
-
h && /* @__PURE__ */ i(z, { size: "small", color: "secondary", children: h })
|
|
1328
|
-
] })
|
|
1329
|
-
] }),
|
|
1330
|
-
W && l && /* @__PURE__ */ i(
|
|
1331
|
-
Q,
|
|
1332
|
-
{
|
|
1333
|
-
as: "div",
|
|
1334
|
-
background: "primary",
|
|
1335
|
-
padding: "medium",
|
|
1336
|
-
borderRadius: "large",
|
|
1337
|
-
position: "absolute",
|
|
1338
|
-
insetBlockStart: "0",
|
|
1339
|
-
insetBlockEnd: "0",
|
|
1340
|
-
insetInlineStart: "0",
|
|
1341
|
-
insetInlineEnd: "0",
|
|
1342
|
-
stacking: "above",
|
|
1343
|
-
children: /* @__PURE__ */ b(
|
|
1344
|
-
v,
|
|
1345
|
-
{
|
|
1346
|
-
direction: "column",
|
|
1347
|
-
justifyItems: "center",
|
|
1348
|
-
alignItems: "center",
|
|
1349
|
-
gap: "x-small",
|
|
1350
|
-
height: "100%",
|
|
1351
|
-
children: [
|
|
1352
|
-
/* @__PURE__ */ i(
|
|
1353
|
-
U,
|
|
1354
|
-
{
|
|
1355
|
-
display: "block",
|
|
1356
|
-
color: "danger",
|
|
1357
|
-
size: "small",
|
|
1358
|
-
renderIcon: /* @__PURE__ */ i(le, {}),
|
|
1359
|
-
"data-testid": "note-card-confirm-delete",
|
|
1360
|
-
onClick: (p) => {
|
|
1361
|
-
p.stopPropagation(), l(n), L(!1);
|
|
1362
|
-
},
|
|
1363
|
-
children: k.deleteNote
|
|
1364
|
-
}
|
|
1365
|
-
),
|
|
1366
|
-
/* @__PURE__ */ i(
|
|
1367
|
-
U,
|
|
1368
|
-
{
|
|
1369
|
-
display: "block",
|
|
1370
|
-
size: "small",
|
|
1371
|
-
"data-testid": "note-card-cancel-delete",
|
|
1372
|
-
onClick: (p) => {
|
|
1373
|
-
p.stopPropagation(), L(!1);
|
|
1374
|
-
},
|
|
1375
|
-
children: k.cancel
|
|
1376
|
-
}
|
|
1377
|
-
)
|
|
1378
|
-
]
|
|
1379
|
-
}
|
|
1380
|
-
)
|
|
1381
|
-
}
|
|
1382
|
-
)
|
|
1383
|
-
]
|
|
1384
|
-
}
|
|
1385
|
-
)
|
|
1366
|
+
)
|
|
1367
|
+
]
|
|
1368
|
+
}
|
|
1369
|
+
)
|
|
1370
|
+
}
|
|
1371
|
+
)
|
|
1372
|
+
]
|
|
1373
|
+
}
|
|
1386
1374
|
);
|
|
1387
|
-
return
|
|
1375
|
+
return v && f ? f({ href: v, children: b, ariaLabel: O }) : b;
|
|
1388
1376
|
};
|
|
1389
|
-
function
|
|
1377
|
+
function In(n, e) {
|
|
1390
1378
|
const t = Array.from({ length: e }, () => []);
|
|
1391
1379
|
return n.forEach((o, r) => {
|
|
1392
1380
|
t[r % e].push(o);
|
|
1393
1381
|
}), t;
|
|
1394
1382
|
}
|
|
1395
|
-
const
|
|
1383
|
+
const Cn = {
|
|
1396
1384
|
display: "flex",
|
|
1397
1385
|
gap: "1rem",
|
|
1398
1386
|
padding: "1rem",
|
|
1399
1387
|
boxSizing: "border-box",
|
|
1400
1388
|
width: "100%",
|
|
1401
1389
|
alignItems: "flex-start"
|
|
1402
|
-
},
|
|
1390
|
+
}, xn = {
|
|
1403
1391
|
display: "flex",
|
|
1404
1392
|
flexDirection: "column",
|
|
1405
1393
|
gap: "1rem",
|
|
1406
1394
|
flex: 1,
|
|
1407
1395
|
minWidth: 0
|
|
1408
|
-
},
|
|
1396
|
+
}, Zn = ({
|
|
1409
1397
|
notes: n,
|
|
1410
1398
|
isLoading: e,
|
|
1411
1399
|
isError: t,
|
|
@@ -1413,30 +1401,29 @@ const xn = {
|
|
|
1413
1401
|
onPreviousPage: r,
|
|
1414
1402
|
onNextPage: s,
|
|
1415
1403
|
onNoteSelect: l,
|
|
1416
|
-
onNoteDelete:
|
|
1404
|
+
onNoteDelete: c,
|
|
1417
1405
|
onNoteSave: m,
|
|
1418
|
-
onNoteTypeChange:
|
|
1406
|
+
onNoteTypeChange: d,
|
|
1419
1407
|
selectedNoteId: g,
|
|
1420
1408
|
hasActiveFilter: h = !1,
|
|
1421
1409
|
columnCount: u = 1,
|
|
1422
1410
|
highlightTheme: E,
|
|
1423
|
-
|
|
1424
|
-
|
|
1425
|
-
|
|
1426
|
-
noteHref: k
|
|
1411
|
+
locale: f,
|
|
1412
|
+
renderNoteLink: v,
|
|
1413
|
+
noteHref: y
|
|
1427
1414
|
}) => {
|
|
1428
|
-
const { translations:
|
|
1429
|
-
() =>
|
|
1415
|
+
const { translations: L } = X(), _ = oe(
|
|
1416
|
+
() => In(n, u),
|
|
1430
1417
|
[n, u]
|
|
1431
|
-
),
|
|
1418
|
+
), p = (o == null ? void 0 : o.hasNextPage) || (o == null ? void 0 : o.hasPreviousPage);
|
|
1432
1419
|
if (e)
|
|
1433
|
-
return /* @__PURE__ */ i(
|
|
1420
|
+
return /* @__PURE__ */ i(q, { as: "div", textAlign: "center", padding: "large", "data-testid": "notes-loading", children: /* @__PURE__ */ i(lt, { renderTitle: L.loadingNotes }) });
|
|
1434
1421
|
if (t)
|
|
1435
|
-
return /* @__PURE__ */ i(
|
|
1422
|
+
return /* @__PURE__ */ i(q, { as: "div", textAlign: "center", padding: "large", "data-testid": "notes-error", children: /* @__PURE__ */ i(ae, { level: "h4", children: L.failedToLoadNotes }) });
|
|
1436
1423
|
if (n.length === 0) {
|
|
1437
|
-
const
|
|
1438
|
-
return /* @__PURE__ */
|
|
1439
|
-
|
|
1424
|
+
const C = h ? L.nothingHereYet : L.emptyStateHeading, w = h ? L.adjustFiltersOrCreate : L.emptyStateDescription;
|
|
1425
|
+
return /* @__PURE__ */ S(
|
|
1426
|
+
I,
|
|
1440
1427
|
{
|
|
1441
1428
|
direction: "column",
|
|
1442
1429
|
alignItems: "center",
|
|
@@ -1445,67 +1432,66 @@ const xn = {
|
|
|
1445
1432
|
gap: "small",
|
|
1446
1433
|
"data-testid": "empty-notes",
|
|
1447
1434
|
children: [
|
|
1448
|
-
/* @__PURE__ */ i(ae, { level: "h3", children:
|
|
1449
|
-
/* @__PURE__ */ i(
|
|
1435
|
+
/* @__PURE__ */ i(ae, { level: "h3", children: C }),
|
|
1436
|
+
/* @__PURE__ */ i(U, { color: "secondary", children: w })
|
|
1450
1437
|
]
|
|
1451
1438
|
}
|
|
1452
1439
|
);
|
|
1453
1440
|
}
|
|
1454
|
-
return /* @__PURE__ */
|
|
1455
|
-
/* @__PURE__ */ i("div", { style:
|
|
1441
|
+
return /* @__PURE__ */ S(Ve, { children: [
|
|
1442
|
+
/* @__PURE__ */ i("div", { style: Cn, "data-testid": "notes-grid", children: _.map((C, w) => (
|
|
1456
1443
|
// biome-ignore lint/suspicious/noArrayIndexKey: columns are positional, index is stable
|
|
1457
|
-
/* @__PURE__ */ i("div", { style:
|
|
1458
|
-
var
|
|
1444
|
+
/* @__PURE__ */ i("div", { style: xn, children: C.map((x) => {
|
|
1445
|
+
var R;
|
|
1459
1446
|
return /* @__PURE__ */ i(
|
|
1460
|
-
|
|
1447
|
+
Tn,
|
|
1461
1448
|
{
|
|
1462
|
-
noteId:
|
|
1463
|
-
date:
|
|
1464
|
-
type:
|
|
1465
|
-
highlight: (
|
|
1466
|
-
note:
|
|
1467
|
-
isActive: g ===
|
|
1449
|
+
noteId: x.id,
|
|
1450
|
+
date: x.createdAt,
|
|
1451
|
+
type: x.reaction[0] ?? k.IMPORTANT,
|
|
1452
|
+
highlight: (R = x.highlightData) == null ? void 0 : R.selectedText,
|
|
1453
|
+
note: x.userText,
|
|
1454
|
+
isActive: g === x.id,
|
|
1468
1455
|
isPanelView: !!g,
|
|
1469
|
-
onClick: l ? () => l(
|
|
1470
|
-
onDelete:
|
|
1471
|
-
onSaveNote: m ? (
|
|
1472
|
-
onTypeChange:
|
|
1456
|
+
onClick: l ? () => l(x.id) : void 0,
|
|
1457
|
+
onDelete: c ? (P) => c(P) : void 0,
|
|
1458
|
+
onSaveNote: m ? (P, M) => m(P, M) : void 0,
|
|
1459
|
+
onTypeChange: d ? (P, M) => d(P, M) : void 0,
|
|
1473
1460
|
highlightTheme: E,
|
|
1474
|
-
|
|
1475
|
-
|
|
1476
|
-
|
|
1477
|
-
href: k ? k(C.id, C) : void 0
|
|
1461
|
+
locale: f,
|
|
1462
|
+
renderLink: v,
|
|
1463
|
+
href: y ? y(x.id, x) : void 0
|
|
1478
1464
|
},
|
|
1479
|
-
|
|
1465
|
+
x.id
|
|
1480
1466
|
);
|
|
1481
|
-
}) },
|
|
1467
|
+
}) }, w)
|
|
1482
1468
|
)) }),
|
|
1483
|
-
|
|
1469
|
+
p && /* @__PURE__ */ S(I, { justifyItems: "center", gap: "small", padding: "small", "data-testid": "notes-pagination", children: [
|
|
1484
1470
|
/* @__PURE__ */ i(
|
|
1485
|
-
|
|
1471
|
+
Y,
|
|
1486
1472
|
{
|
|
1487
1473
|
size: "small",
|
|
1488
|
-
screenReaderLabel:
|
|
1474
|
+
screenReaderLabel: L.previousPage,
|
|
1489
1475
|
"data-testid": "notes-prev-page",
|
|
1490
1476
|
interaction: o != null && o.hasPreviousPage ? "enabled" : "disabled",
|
|
1491
1477
|
onClick: r,
|
|
1492
|
-
children: /* @__PURE__ */ i(
|
|
1478
|
+
children: /* @__PURE__ */ i(nt, {})
|
|
1493
1479
|
}
|
|
1494
1480
|
),
|
|
1495
1481
|
/* @__PURE__ */ i(
|
|
1496
|
-
|
|
1482
|
+
Y,
|
|
1497
1483
|
{
|
|
1498
1484
|
size: "small",
|
|
1499
|
-
screenReaderLabel:
|
|
1485
|
+
screenReaderLabel: L.nextPage,
|
|
1500
1486
|
"data-testid": "notes-next-page",
|
|
1501
1487
|
interaction: o != null && o.hasNextPage ? "enabled" : "disabled",
|
|
1502
1488
|
onClick: s,
|
|
1503
|
-
children: /* @__PURE__ */ i(
|
|
1489
|
+
children: /* @__PURE__ */ i(ot, {})
|
|
1504
1490
|
}
|
|
1505
1491
|
)
|
|
1506
1492
|
] })
|
|
1507
1493
|
] });
|
|
1508
|
-
},
|
|
1494
|
+
}, Jn = ({
|
|
1509
1495
|
noteText: n,
|
|
1510
1496
|
reaction: e,
|
|
1511
1497
|
highlightText: t,
|
|
@@ -1513,26 +1499,26 @@ const xn = {
|
|
|
1513
1499
|
onSave: r,
|
|
1514
1500
|
onDelete: s,
|
|
1515
1501
|
onTypeChange: l,
|
|
1516
|
-
onBack:
|
|
1502
|
+
onBack: c,
|
|
1517
1503
|
editing: m = !1
|
|
1518
1504
|
}) => {
|
|
1519
|
-
const { translations:
|
|
1520
|
-
return /* @__PURE__ */
|
|
1521
|
-
t != null ? /* @__PURE__ */ i(
|
|
1505
|
+
const { translations: d } = X(), [g, h] = B(m), [u, E] = B(n || ""), [f, v] = B(!1);
|
|
1506
|
+
return /* @__PURE__ */ S(I, { direction: "column", gap: "small", "data-testid": "single-note", children: [
|
|
1507
|
+
t != null ? /* @__PURE__ */ i(q, { as: "div", children: /* @__PURE__ */ i(U, { children: /* @__PURE__ */ i(he, { type: e, isCardActive: !0, theme: o, children: t }) }) }) : /* @__PURE__ */ i(Qe, {}),
|
|
1522
1508
|
/* @__PURE__ */ i(Ye, { type: e, onTypeChange: l, renderAsMenuTrigger: !!l }),
|
|
1523
|
-
g ? /* @__PURE__ */
|
|
1509
|
+
g ? /* @__PURE__ */ S(I, { direction: "column", gap: "x-small", children: [
|
|
1524
1510
|
/* @__PURE__ */ i(
|
|
1525
1511
|
He,
|
|
1526
1512
|
{
|
|
1527
|
-
label:
|
|
1513
|
+
label: d.addNoteOptional,
|
|
1528
1514
|
value: u,
|
|
1529
|
-
onChange: (
|
|
1515
|
+
onChange: (y) => E(y.target.value),
|
|
1530
1516
|
resize: "vertical"
|
|
1531
1517
|
}
|
|
1532
1518
|
),
|
|
1533
|
-
/* @__PURE__ */
|
|
1534
|
-
/* @__PURE__ */ i(
|
|
1535
|
-
|
|
1519
|
+
/* @__PURE__ */ S(I, { gap: "xx-small", children: [
|
|
1520
|
+
/* @__PURE__ */ i(I.Item, { shouldGrow: !0, children: /* @__PURE__ */ i(
|
|
1521
|
+
$,
|
|
1536
1522
|
{
|
|
1537
1523
|
display: "block",
|
|
1538
1524
|
size: "small",
|
|
@@ -1540,11 +1526,11 @@ const xn = {
|
|
|
1540
1526
|
onClick: () => {
|
|
1541
1527
|
E(n || ""), h(!1);
|
|
1542
1528
|
},
|
|
1543
|
-
children:
|
|
1529
|
+
children: d.cancel
|
|
1544
1530
|
}
|
|
1545
1531
|
) }),
|
|
1546
|
-
/* @__PURE__ */ i(
|
|
1547
|
-
|
|
1532
|
+
/* @__PURE__ */ i(I.Item, { shouldGrow: !0, children: /* @__PURE__ */ i(
|
|
1533
|
+
$,
|
|
1548
1534
|
{
|
|
1549
1535
|
display: "block",
|
|
1550
1536
|
color: "primary",
|
|
@@ -1553,57 +1539,57 @@ const xn = {
|
|
|
1553
1539
|
onClick: () => {
|
|
1554
1540
|
r(u), h(!1);
|
|
1555
1541
|
},
|
|
1556
|
-
children:
|
|
1542
|
+
children: d.save
|
|
1557
1543
|
}
|
|
1558
1544
|
) })
|
|
1559
1545
|
] })
|
|
1560
|
-
] }) : /* @__PURE__ */
|
|
1561
|
-
n && /* @__PURE__ */
|
|
1562
|
-
/* @__PURE__ */ i(ae, { level: "h4", margin: "0 0 xx-small 0", children:
|
|
1563
|
-
/* @__PURE__ */ i(
|
|
1546
|
+
] }) : /* @__PURE__ */ S(I, { direction: "column", gap: "small", children: [
|
|
1547
|
+
n && /* @__PURE__ */ S(q, { as: "div", children: [
|
|
1548
|
+
/* @__PURE__ */ i(ae, { level: "h4", margin: "0 0 xx-small 0", children: d.note }),
|
|
1549
|
+
/* @__PURE__ */ i(U, { children: n })
|
|
1564
1550
|
] }),
|
|
1565
|
-
/* @__PURE__ */
|
|
1551
|
+
/* @__PURE__ */ S(I, { justifyItems: "space-between", children: [
|
|
1566
1552
|
/* @__PURE__ */ i(
|
|
1567
|
-
|
|
1553
|
+
$,
|
|
1568
1554
|
{
|
|
1569
1555
|
size: "small",
|
|
1570
|
-
renderIcon: /* @__PURE__ */ i(
|
|
1556
|
+
renderIcon: /* @__PURE__ */ i(rt, {}),
|
|
1571
1557
|
"data-testid": "single-note-back",
|
|
1572
|
-
onClick: () =>
|
|
1573
|
-
children:
|
|
1558
|
+
onClick: () => c == null ? void 0 : c(),
|
|
1559
|
+
children: d.back
|
|
1574
1560
|
}
|
|
1575
1561
|
),
|
|
1576
|
-
/* @__PURE__ */
|
|
1562
|
+
/* @__PURE__ */ S(I, { gap: "xx-small", children: [
|
|
1577
1563
|
s && /* @__PURE__ */ i(
|
|
1578
|
-
|
|
1564
|
+
Y,
|
|
1579
1565
|
{
|
|
1580
1566
|
size: "small",
|
|
1581
1567
|
withBackground: !1,
|
|
1582
1568
|
withBorder: !1,
|
|
1583
1569
|
color: "danger",
|
|
1584
|
-
screenReaderLabel:
|
|
1570
|
+
screenReaderLabel: d.deleteNote,
|
|
1585
1571
|
"data-testid": "single-note-delete",
|
|
1586
|
-
onClick: () =>
|
|
1572
|
+
onClick: () => v(!0),
|
|
1587
1573
|
children: /* @__PURE__ */ i(le, {})
|
|
1588
1574
|
}
|
|
1589
1575
|
),
|
|
1590
1576
|
/* @__PURE__ */ i(
|
|
1591
|
-
|
|
1577
|
+
Y,
|
|
1592
1578
|
{
|
|
1593
1579
|
size: "small",
|
|
1594
1580
|
withBackground: !1,
|
|
1595
1581
|
withBorder: !1,
|
|
1596
|
-
screenReaderLabel:
|
|
1582
|
+
screenReaderLabel: d.editNote,
|
|
1597
1583
|
"data-testid": "single-note-edit",
|
|
1598
1584
|
onClick: () => h(!0),
|
|
1599
|
-
children: /* @__PURE__ */ i(
|
|
1585
|
+
children: /* @__PURE__ */ i(fe, {})
|
|
1600
1586
|
}
|
|
1601
1587
|
)
|
|
1602
1588
|
] })
|
|
1603
1589
|
] }),
|
|
1604
|
-
f && s && /* @__PURE__ */ i(
|
|
1590
|
+
f && s && /* @__PURE__ */ i(q, { as: "div", background: "primary", padding: "medium", borderRadius: "large", children: /* @__PURE__ */ S(I, { direction: "column", justifyItems: "center", alignItems: "center", gap: "x-small", children: [
|
|
1605
1591
|
/* @__PURE__ */ i(
|
|
1606
|
-
|
|
1592
|
+
$,
|
|
1607
1593
|
{
|
|
1608
1594
|
display: "block",
|
|
1609
1595
|
color: "danger",
|
|
@@ -1611,19 +1597,19 @@ const xn = {
|
|
|
1611
1597
|
renderIcon: /* @__PURE__ */ i(le, {}),
|
|
1612
1598
|
"data-testid": "single-note-confirm-delete",
|
|
1613
1599
|
onClick: () => {
|
|
1614
|
-
s(),
|
|
1600
|
+
s(), v(!1);
|
|
1615
1601
|
},
|
|
1616
|
-
children:
|
|
1602
|
+
children: d.deleteNote
|
|
1617
1603
|
}
|
|
1618
1604
|
),
|
|
1619
1605
|
/* @__PURE__ */ i(
|
|
1620
|
-
|
|
1606
|
+
$,
|
|
1621
1607
|
{
|
|
1622
1608
|
display: "block",
|
|
1623
1609
|
size: "small",
|
|
1624
1610
|
"data-testid": "single-note-cancel-delete",
|
|
1625
|
-
onClick: () =>
|
|
1626
|
-
children:
|
|
1611
|
+
onClick: () => v(!1),
|
|
1612
|
+
children: d.cancel
|
|
1627
1613
|
}
|
|
1628
1614
|
)
|
|
1629
1615
|
] }) })
|
|
@@ -1631,25 +1617,25 @@ const xn = {
|
|
|
1631
1617
|
] });
|
|
1632
1618
|
};
|
|
1633
1619
|
export {
|
|
1634
|
-
|
|
1635
|
-
|
|
1620
|
+
Xn as ContentWithNoteWrapper,
|
|
1621
|
+
he as Highlight,
|
|
1636
1622
|
Qe as HighlightError,
|
|
1637
|
-
|
|
1623
|
+
Tn as NoteCard,
|
|
1638
1624
|
Ye as NoteChip,
|
|
1639
|
-
|
|
1640
|
-
|
|
1641
|
-
|
|
1642
|
-
|
|
1643
|
-
|
|
1644
|
-
|
|
1645
|
-
|
|
1646
|
-
|
|
1647
|
-
|
|
1648
|
-
|
|
1625
|
+
yn as NoteReactionMenu,
|
|
1626
|
+
Kn as NotebookProvider,
|
|
1627
|
+
gn as NotebookTranslationsProvider,
|
|
1628
|
+
Vn as NotebookTray,
|
|
1629
|
+
Zn as NotesListView,
|
|
1630
|
+
k as REACTION_TYPE,
|
|
1631
|
+
Jn as SingleNote,
|
|
1632
|
+
Te as createTransparentColor,
|
|
1633
|
+
Rt as useCreateNote,
|
|
1634
|
+
Dt as useDeleteNote,
|
|
1649
1635
|
$e as useGetNotes,
|
|
1650
1636
|
Xe as useNotebook,
|
|
1651
|
-
|
|
1652
|
-
|
|
1653
|
-
|
|
1654
|
-
|
|
1637
|
+
X as useNotebookTranslations,
|
|
1638
|
+
Qn as useNotesData,
|
|
1639
|
+
Yn as useReactionFilter,
|
|
1640
|
+
At as useUpdateNote
|
|
1655
1641
|
};
|