@instructure/platform-notebook 0.6.0 → 0.9.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/NoteCard.d.ts +1 -6
- package/dist/NoteCard.d.ts.map +1 -1
- package/dist/NoteChip.d.ts.map +1 -1
- package/dist/NotebookEmptyState.d.ts +5 -0
- package/dist/NotebookEmptyState.d.ts.map +1 -0
- package/dist/NotesListView.d.ts +1 -3
- package/dist/NotesListView.d.ts.map +1 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +648 -668
- package/locales/en.json +1 -1
- package/package.json +6 -3
package/dist/index.js
CHANGED
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { createContext as Pe, useMemo as
|
|
1
|
+
import { jsx as s, jsxs as S, Fragment as Ye } from "react/jsx-runtime";
|
|
2
|
+
import { createContext as Pe, useMemo as re, useContext as _e, useReducer as Fe, useRef as ne, useEffect as Q, useState as B, useCallback as K } 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 be, IconWarningLine as tt, IconNoteLine as nt, IconEditLine as fe, IconTrashLine as le, IconArrowOpenStartLine as ot, IconArrowOpenEndLine as rt, IconArrowStartLine as st } 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 T } 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 it, Button as U, IconButton as X } from "@instructure/ui-buttons";
|
|
14
13
|
import { Heading as ae } from "@instructure/ui-heading";
|
|
14
|
+
import { Text as U } from "@instructure/ui-text";
|
|
15
|
+
import { View as z } from "@instructure/ui-view";
|
|
16
|
+
import { CloseButton as it, Button as $, IconButton as V } from "@instructure/ui-buttons";
|
|
15
17
|
import { Tray as lt } from "@instructure/ui-tray";
|
|
16
|
-
import { View as Q } from "@instructure/ui-view";
|
|
17
|
-
import { Text as z } from "@instructure/ui-text";
|
|
18
18
|
import { TextArea as He } from "@instructure/ui-text-area";
|
|
19
|
-
import { Pill as
|
|
19
|
+
import { Pill as ke } from "@instructure/ui-pill";
|
|
20
20
|
import { Spinner as at } from "@instructure/ui-spinner";
|
|
21
21
|
const ct = a.object({
|
|
22
22
|
startContainer: a.string(),
|
|
@@ -26,15 +26,15 @@ const ct = a.object({
|
|
|
26
26
|
}), dt = a.object({
|
|
27
27
|
start: a.number(),
|
|
28
28
|
end: a.number()
|
|
29
|
-
}),
|
|
29
|
+
}), ye = a.object({
|
|
30
30
|
selectedText: a.string(),
|
|
31
31
|
hasNoHighlightAnymore: a.boolean().optional(),
|
|
32
32
|
textPosition: dt.nullable(),
|
|
33
33
|
range: ct.nullable(),
|
|
34
34
|
pageLastModifiedAt: a.string()
|
|
35
35
|
});
|
|
36
|
-
var
|
|
37
|
-
const
|
|
36
|
+
var w = /* @__PURE__ */ ((n) => (n.IMPORTANT = "Important", n.CONFUSING = "Confusing", n))(w || {});
|
|
37
|
+
const Ee = a.enum([
|
|
38
38
|
"Important",
|
|
39
39
|
"Confusing"
|
|
40
40
|
/* CONFUSING */
|
|
@@ -51,8 +51,8 @@ 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: ye,
|
|
56
56
|
createdAt: a.string(),
|
|
57
57
|
updatedAt: a.string()
|
|
58
58
|
}), ut = a.object({
|
|
@@ -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: ye
|
|
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: ye
|
|
100
100
|
});
|
|
101
101
|
a.object({
|
|
102
102
|
updateNote: ce
|
|
@@ -105,13 +105,13 @@ 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 q {
|
|
109
109
|
constructor(e, t) {
|
|
110
110
|
this.start = e, this.end = t;
|
|
111
111
|
}
|
|
112
112
|
toRange() {
|
|
113
113
|
let e, t;
|
|
114
|
-
if (this.start.element === this.end.element && this.start.offset <= this.end.offset ? [e, t] =
|
|
114
|
+
if (this.start.element === this.end.element && this.start.offset <= this.end.offset ? [e, t] = je(this.start.element, this.start.offset, this.end.offset) : (e = this.start.resolve({
|
|
115
115
|
direction: 1
|
|
116
116
|
/* FORWARDS */
|
|
117
117
|
}), t = this.end.resolve({
|
|
@@ -123,31 +123,31 @@ 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 q(t, o);
|
|
128
128
|
}
|
|
129
129
|
static fromOffsets(e, t, o) {
|
|
130
|
-
return new
|
|
130
|
+
return new q(new W(e, t), new W(e, o));
|
|
131
131
|
}
|
|
132
132
|
relativeTo(e) {
|
|
133
|
-
return new
|
|
133
|
+
return new q(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
|
}
|
|
140
140
|
resolve(e = {}) {
|
|
141
141
|
try {
|
|
142
|
-
return
|
|
142
|
+
return je(this.element, this.offset)[0];
|
|
143
143
|
} catch (t) {
|
|
144
144
|
if (this.offset === 0 && e.direction !== void 0) {
|
|
145
145
|
const o = document.createTreeWalker(this.element.getRootNode(), NodeFilter.SHOW_TEXT);
|
|
146
146
|
o.currentNode = this.element;
|
|
147
|
-
const r = e.direction === We.FORWARDS,
|
|
148
|
-
if (!
|
|
147
|
+
const r = e.direction === We.FORWARDS, i = r ? o.nextNode() : o.previousNode();
|
|
148
|
+
if (!i)
|
|
149
149
|
throw t;
|
|
150
|
-
return { node:
|
|
150
|
+
return { node: i, offset: r ? 0 : i.data.length };
|
|
151
151
|
}
|
|
152
152
|
throw t;
|
|
153
153
|
}
|
|
@@ -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,15 +170,15 @@ 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)
|
|
177
177
|
return console.error("Child node offset is out of range"), null;
|
|
178
178
|
let o = 0;
|
|
179
179
|
for (let r = 0; r < t; r++)
|
|
180
|
-
o +=
|
|
181
|
-
return new
|
|
180
|
+
o += ze(e.childNodes[r]);
|
|
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,7 +190,7 @@ 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
196
|
const ht = (n) => {
|
|
@@ -206,7 +206,7 @@ function gt(n) {
|
|
|
206
206
|
const pt = (n) => {
|
|
207
207
|
const e = ht(n), t = gt(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) {
|
|
@@ -219,28 +219,28 @@ const pt = (n) => {
|
|
|
219
219
|
}, Nt = (n, e, t) => {
|
|
220
220
|
const o = e.toUpperCase();
|
|
221
221
|
let r = -1;
|
|
222
|
-
for (let
|
|
223
|
-
const l = n.children[
|
|
222
|
+
for (let i = 0; i < n.children.length; i++) {
|
|
223
|
+
const l = n.children[i];
|
|
224
224
|
if (l.nodeName.toUpperCase() === o && (++r, r === t))
|
|
225
225
|
return l;
|
|
226
226
|
}
|
|
227
227
|
return null;
|
|
228
|
-
},
|
|
228
|
+
}, bt = (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
|
-
for (const
|
|
234
|
+
for (const i of o) {
|
|
235
235
|
let l, d;
|
|
236
|
-
const m =
|
|
236
|
+
const m = i.indexOf("[");
|
|
237
237
|
if (m !== -1) {
|
|
238
|
-
l =
|
|
239
|
-
const g =
|
|
238
|
+
l = i.slice(0, m);
|
|
239
|
+
const g = i.slice(m + 1, i.indexOf("]"));
|
|
240
240
|
if (d = Number.parseInt(g, 10) - 1, d < 0)
|
|
241
241
|
return null;
|
|
242
242
|
} else
|
|
243
|
-
l =
|
|
243
|
+
l = i, d = 0;
|
|
244
244
|
const c = Nt(r, l, d);
|
|
245
245
|
if (!c)
|
|
246
246
|
return null;
|
|
@@ -249,7 +249,7 @@ const pt = (n) => {
|
|
|
249
249
|
return r;
|
|
250
250
|
}, Re = (n, e = document.body) => {
|
|
251
251
|
try {
|
|
252
|
-
return
|
|
252
|
+
return bt(n, e);
|
|
253
253
|
} catch {
|
|
254
254
|
return document.evaluate(`.${n}`, e, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue;
|
|
255
255
|
}
|
|
@@ -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
|
|
274
|
-
if (!
|
|
273
|
+
const i = W.fromCharOffset(o, t.startOffset), l = W.fromCharOffset(r, t.endOffset);
|
|
274
|
+
if (!i || !l)
|
|
275
275
|
return null;
|
|
276
|
-
const d = new
|
|
276
|
+
const d = new q(i, l).toRange();
|
|
277
277
|
return d ? new Y(e, d) : null;
|
|
278
278
|
}
|
|
279
279
|
toRange() {
|
|
280
280
|
return this.range;
|
|
281
281
|
}
|
|
282
282
|
toSelector() {
|
|
283
|
-
var
|
|
284
|
-
const e = (
|
|
283
|
+
var i;
|
|
284
|
+
const e = (i = q.fromRange(this.range)) == null ? void 0 : i.toRange(), t = e && q.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 X {
|
|
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 = q.fromRange(t)) == null ? void 0 : r.relativeTo(e);
|
|
300
|
+
return o ? new X(e, o.start.offset, o.end.offset) : null;
|
|
301
301
|
}
|
|
302
302
|
static fromSelector(e, t) {
|
|
303
|
-
return new
|
|
303
|
+
return new X(e, t.start, t.end);
|
|
304
304
|
}
|
|
305
305
|
toSelector() {
|
|
306
306
|
return {
|
|
@@ -309,10 +309,10 @@ class G {
|
|
|
309
309
|
};
|
|
310
310
|
}
|
|
311
311
|
toRange() {
|
|
312
|
-
return
|
|
312
|
+
return q.fromOffsets(this.root, this.start, this.end).toRange();
|
|
313
313
|
}
|
|
314
314
|
}
|
|
315
|
-
const
|
|
315
|
+
const ze = (n) => {
|
|
316
316
|
var e;
|
|
317
317
|
switch (n.nodeType) {
|
|
318
318
|
case Node.ELEMENT_NODE:
|
|
@@ -324,47 +324,47 @@ const je = (n) => {
|
|
|
324
324
|
}, De = (n) => {
|
|
325
325
|
let e = n.previousSibling, t = 0;
|
|
326
326
|
for (; e; )
|
|
327
|
-
t +=
|
|
327
|
+
t += ze(e), e = e.previousSibling;
|
|
328
328
|
return t;
|
|
329
|
-
},
|
|
329
|
+
}, je = (n, ...e) => {
|
|
330
330
|
let t = e.shift();
|
|
331
331
|
const o = n.ownerDocument.createNodeIterator(n, NodeFilter.SHOW_TEXT), r = [];
|
|
332
|
-
let
|
|
333
|
-
for (; t !== void 0 &&
|
|
334
|
-
l =
|
|
332
|
+
let i = o.nextNode(), l = null, d = 0;
|
|
333
|
+
for (; t !== void 0 && i; )
|
|
334
|
+
l = i, d + l.data.length > t ? (r.push({ node: l, offset: t - d }), t = e.shift()) : (i = o.nextNode(), d += l.data.length);
|
|
335
335
|
for (; t !== void 0 && l && d === 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 ? X.fromSelector(n, {
|
|
341
341
|
start: e,
|
|
342
342
|
end: t
|
|
343
343
|
}) : null;
|
|
344
344
|
}, Et = (n, e, t, o) => {
|
|
345
345
|
const r = new Je();
|
|
346
346
|
r.Match_Distance = 5e3;
|
|
347
|
-
const
|
|
348
|
-
if (!
|
|
347
|
+
const i = n.textContent;
|
|
348
|
+
if (!i)
|
|
349
349
|
return null;
|
|
350
350
|
if (e.length > 32) {
|
|
351
351
|
const l = e.slice(0, 32), d = e.slice(-32), m = o - t;
|
|
352
|
-
let c = r.match_main(
|
|
353
|
-
const g = r.match_main(
|
|
352
|
+
let c = r.match_main(i, l, t);
|
|
353
|
+
const g = r.match_main(i, d, o), h = g + d.length;
|
|
354
354
|
if (c === -1 || g === -1)
|
|
355
355
|
return null;
|
|
356
356
|
const u = h - c, E = Math.abs(u - m);
|
|
357
|
-
if ((c > h || E > 5) && (r.Match_Distance = e.length + 100, c = r.match_main(
|
|
358
|
-
return
|
|
357
|
+
if ((c > h || E > 5) && (r.Match_Distance = e.length + 100, c = r.match_main(i, l, h), c !== -1 && c < h))
|
|
358
|
+
return yt(n, c, h, m);
|
|
359
359
|
if (c < h && E <= 5)
|
|
360
|
-
return
|
|
360
|
+
return X.fromSelector(n, {
|
|
361
361
|
start: c,
|
|
362
362
|
end: h
|
|
363
363
|
});
|
|
364
364
|
} else {
|
|
365
|
-
const l = r.match_main(
|
|
365
|
+
const l = r.match_main(i, e, t);
|
|
366
366
|
if (l !== -1)
|
|
367
|
-
return
|
|
367
|
+
return X.fromSelector(n, {
|
|
368
368
|
start: l,
|
|
369
369
|
end: l + e.length
|
|
370
370
|
});
|
|
@@ -379,18 +379,18 @@ const je = (n) => {
|
|
|
379
379
|
(o == null ? void 0 : o.start) ?? 0,
|
|
380
380
|
(o == null ? void 0 : o.end) ?? 0
|
|
381
381
|
);
|
|
382
|
-
},
|
|
382
|
+
}, vt = (n, e, t) => {
|
|
383
383
|
const o = [], r = [];
|
|
384
|
-
for (const
|
|
385
|
-
const l = St(
|
|
384
|
+
for (const i of e) {
|
|
385
|
+
const l = St(i, n);
|
|
386
386
|
if (l) {
|
|
387
387
|
const d = l.toRange(), m = d && Y.fromRange(n, d);
|
|
388
388
|
o.push({
|
|
389
|
-
id:
|
|
390
|
-
reaction:
|
|
391
|
-
userText:
|
|
389
|
+
id: i.id,
|
|
390
|
+
reaction: i.reaction,
|
|
391
|
+
userText: i.userText,
|
|
392
392
|
highlightData: {
|
|
393
|
-
...
|
|
393
|
+
...i.highlightData,
|
|
394
394
|
hasNoHighlightAnymore: !1,
|
|
395
395
|
range: (m == null ? void 0 : m.toSelector()) ?? null,
|
|
396
396
|
textPosition: l.toSelector(),
|
|
@@ -398,39 +398,39 @@ const je = (n) => {
|
|
|
398
398
|
}
|
|
399
399
|
});
|
|
400
400
|
} else
|
|
401
|
-
|
|
402
|
-
id:
|
|
403
|
-
reaction:
|
|
404
|
-
userText:
|
|
401
|
+
i.userText ? o.push({
|
|
402
|
+
id: i.id,
|
|
403
|
+
reaction: i.reaction,
|
|
404
|
+
userText: i.userText,
|
|
405
405
|
highlightData: {
|
|
406
|
-
...
|
|
406
|
+
...i.highlightData,
|
|
407
407
|
pageLastModifiedAt: t,
|
|
408
408
|
hasNoHighlightAnymore: !0
|
|
409
409
|
}
|
|
410
|
-
}) : r.push(
|
|
410
|
+
}) : r.push(i.id);
|
|
411
411
|
}
|
|
412
412
|
return { notesForUpdate: o, noteIdsForDelete: r };
|
|
413
|
-
},
|
|
413
|
+
}, Le = (n, e) => {
|
|
414
414
|
var l;
|
|
415
415
|
if (!e) return;
|
|
416
416
|
const { highlightData: t, id: o } = n, { range: r } = t ?? {};
|
|
417
417
|
r && ((l = Y.fromSelector(e, r)) == null ? void 0 : l.toRange()) && Rt({ id: o });
|
|
418
|
-
},
|
|
418
|
+
}, It = (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,
|
|
429
|
-
const
|
|
430
|
-
return f >=
|
|
428
|
+
const t = e[0], o = e[e.length - 1], r = 4, i = 16, l = window.innerWidth || document.documentElement.clientWidth, d = window.innerHeight || document.documentElement.clientHeight, m = (f) => {
|
|
429
|
+
const v = f + ie;
|
|
430
|
+
return f >= i && v <= l - i;
|
|
431
431
|
}, c = (f) => {
|
|
432
|
-
const
|
|
433
|
-
return f >=
|
|
432
|
+
const v = f + se;
|
|
433
|
+
return f >= i && v <= d - i;
|
|
434
434
|
};
|
|
435
435
|
let g;
|
|
436
436
|
const h = t.right - ie;
|
|
@@ -441,8 +441,8 @@ 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 < i ? g = i : g = l - ie - i;
|
|
446
446
|
}
|
|
447
447
|
}
|
|
448
448
|
let u;
|
|
@@ -451,15 +451,15 @@ const je = (n) => {
|
|
|
451
451
|
u = E;
|
|
452
452
|
else {
|
|
453
453
|
const f = t.top - se - r;
|
|
454
|
-
c(f) ? u = f : E + se > d -
|
|
454
|
+
c(f) ? u = f : E + se > d - i ? u = d - se - i : u = i;
|
|
455
455
|
}
|
|
456
456
|
return { top: u, left: g };
|
|
457
|
-
},
|
|
457
|
+
}, Ct = (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`, oe = (n) => `[data-highlight-id="${CSS.escape(n)}"]`, Ie = (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
|
}, xt = (n, e) => {
|
|
@@ -471,13 +471,13 @@ const je = (n) => {
|
|
|
471
471
|
return !1;
|
|
472
472
|
}
|
|
473
473
|
}, wt = (n) => {
|
|
474
|
-
var
|
|
474
|
+
var i;
|
|
475
475
|
if (n.collapsed)
|
|
476
476
|
return [];
|
|
477
477
|
let e = n.commonAncestorContainer;
|
|
478
478
|
if (e && e.nodeType !== Node.ELEMENT_NODE && (e = e.parentElement), !e)
|
|
479
479
|
return [];
|
|
480
|
-
const t = [], o = (
|
|
480
|
+
const t = [], o = (i = e == null ? void 0 : e.ownerDocument) == null ? void 0 : i.createNodeIterator(e, NodeFilter.SHOW_TEXT);
|
|
481
481
|
let r = (o == null ? void 0 : o.nextNode()) || null;
|
|
482
482
|
for (; r; ) {
|
|
483
483
|
if (!xt(n, r)) {
|
|
@@ -492,71 +492,71 @@ 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
|
+
}, kt = (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
|
+
Ot(e, t);
|
|
500
500
|
return;
|
|
501
501
|
}
|
|
502
|
-
const l = e.type ===
|
|
502
|
+
const l = e.type === w.IMPORTANT ? t.colors.importantBackground : t.colors.confusingBackground, m = e.id === e.selectedNoteId ? l : Ie(l, 0.5), c = e.type === w.IMPORTANT ? t.colors.importantUnderline : t.colors.confusingUnderline, g = e.type === w.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 F = wt(y).filter((N) => N.textContent && N.textContent.length > 0);
|
|
513
|
+
F.forEach((N, C) => {
|
|
514
|
+
var Z;
|
|
515
|
+
const k = N.parentElement;
|
|
516
|
+
if ((k == null ? void 0 : k.dataset.highlightId) === o) return;
|
|
517
|
+
const x = C === 0, O = C === F.length - 1, _ = F.length === 1;
|
|
518
|
+
let M;
|
|
519
|
+
_ ? M = "single" : x ? M = "first" : O ? 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
|
-
}), (
|
|
521
|
+
D.className = "highlight-content", D.dataset.highlightId = o || "", D.dataset.position = M, D.style.backgroundColor = m, D.style.textDecorationLine = "underline", D.style.textDecorationColor = c, D.style.textDecorationStyle = g, D.style.textDecorationThickness = t.borderWidthSmall, D.style.textUnderlineOffset = t.underlineOffset, D.style.cursor = "pointer", D.addEventListener("click", (R) => {
|
|
522
|
+
var b;
|
|
523
|
+
R.target.tagName !== "A" && ((b = e.onClick) == null || b.call(e));
|
|
524
|
+
}), (Z = N.parentNode) == null || Z.insertBefore(D, N), D.appendChild(N);
|
|
525
525
|
}), u.addEventListener("click", (N) => {
|
|
526
|
-
var
|
|
527
|
-
N.target.tagName !== "A" && ((
|
|
526
|
+
var C;
|
|
527
|
+
N.target.tagName !== "A" && ((C = e.onClick) == null || C.call(e));
|
|
528
528
|
}), u.addEventListener("keydown", (N) => {
|
|
529
|
-
var
|
|
529
|
+
var C;
|
|
530
530
|
if (N.key === "Enter" || N.key === " ")
|
|
531
|
-
N.preventDefault(), (
|
|
531
|
+
N.preventDefault(), (C = e.onClick) == null || C.call(e);
|
|
532
532
|
else if (N.key === "Tab" && !N.shiftKey) {
|
|
533
|
-
const
|
|
534
|
-
for (const
|
|
535
|
-
const
|
|
536
|
-
if (
|
|
537
|
-
N.preventDefault(),
|
|
533
|
+
const k = document.querySelectorAll(oe(o));
|
|
534
|
+
for (const x of k) {
|
|
535
|
+
const O = x.querySelector("a");
|
|
536
|
+
if (O) {
|
|
537
|
+
N.preventDefault(), O.focus();
|
|
538
538
|
break;
|
|
539
539
|
}
|
|
540
540
|
}
|
|
541
541
|
}
|
|
542
542
|
}), u.addEventListener("focus", () => {
|
|
543
543
|
document.querySelectorAll(
|
|
544
|
-
|
|
545
|
-
).forEach((
|
|
546
|
-
|
|
544
|
+
oe(o)
|
|
545
|
+
).forEach((C) => {
|
|
546
|
+
C.classList.add("highlight-focused");
|
|
547
547
|
});
|
|
548
548
|
}), u.addEventListener("blur", () => {
|
|
549
549
|
document.querySelectorAll(
|
|
550
|
-
|
|
551
|
-
).forEach((
|
|
552
|
-
|
|
550
|
+
oe(o)
|
|
551
|
+
).forEach((C) => {
|
|
552
|
+
C.classList.remove("highlight-focused");
|
|
553
553
|
});
|
|
554
554
|
});
|
|
555
555
|
};
|
|
556
|
-
function
|
|
557
|
-
const t = n.type ===
|
|
556
|
+
function Ot(n, e) {
|
|
557
|
+
const t = n.type === w.IMPORTANT ? e.colors.importantBackground : e.colors.confusingBackground, r = n.id === n.selectedNoteId ? t : Ie(t, 0.5);
|
|
558
558
|
document.querySelectorAll(
|
|
559
|
-
|
|
559
|
+
oe(n.id ?? "")
|
|
560
560
|
).forEach((l) => {
|
|
561
561
|
l.style.backgroundColor = r;
|
|
562
562
|
});
|
|
@@ -564,29 +564,29 @@ function kt(n, e) {
|
|
|
564
564
|
const Rt = (n) => {
|
|
565
565
|
const e = n.id ?? "", t = document.getElementById(ve(e)), o = document.getElementById(Ue(e));
|
|
566
566
|
document.querySelectorAll(
|
|
567
|
-
|
|
568
|
-
).forEach((
|
|
567
|
+
oe(e)
|
|
568
|
+
).forEach((i) => {
|
|
569
569
|
var l;
|
|
570
|
-
for (;
|
|
571
|
-
(l =
|
|
572
|
-
|
|
570
|
+
for (; i.firstChild; )
|
|
571
|
+
(l = i.parentNode) == null || l.insertBefore(i.firstChild, i);
|
|
572
|
+
i.remove();
|
|
573
573
|
}), t == null || t.remove(), o == null || o.remove();
|
|
574
574
|
}, te = {
|
|
575
575
|
all: ["notebook"],
|
|
576
576
|
notes: (n) => ["notebook", "notes", n]
|
|
577
577
|
};
|
|
578
578
|
function Dt(n) {
|
|
579
|
-
const e =
|
|
580
|
-
return
|
|
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 Lt(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,14 +604,14 @@ 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
|
-
const
|
|
614
|
-
for (const d of
|
|
613
|
+
const i = e.getQueryCache().findAll({ queryKey: te.all }), l = /* @__PURE__ */ new Map();
|
|
614
|
+
for (const d of i) {
|
|
615
615
|
const m = d.state.data;
|
|
616
616
|
m && (l.set(d.queryKey, m), e.setQueryData(d.queryKey, {
|
|
617
617
|
...m,
|
|
@@ -624,15 +624,15 @@ function Lt(n) {
|
|
|
624
624
|
},
|
|
625
625
|
onError: (t, o, r) => {
|
|
626
626
|
if (r != null && r.previousData)
|
|
627
|
-
for (const [
|
|
628
|
-
e.setQueryData(
|
|
627
|
+
for (const [i, l] of r.previousData)
|
|
628
|
+
e.setQueryData(i, l);
|
|
629
629
|
},
|
|
630
630
|
onSettled: () => {
|
|
631
631
|
e.invalidateQueries({ queryKey: te.all });
|
|
632
632
|
}
|
|
633
633
|
});
|
|
634
634
|
}
|
|
635
|
-
const Pt = "Notebook", _t = "Notes", Ft = "Important", Mt = "Unclear", Ht = "Back", Bt = "Edit note", Wt = "Save",
|
|
635
|
+
const Pt = "Notebook", _t = "Notes", Ft = "Important", Mt = "Unclear", Ht = "Back", Bt = "Edit note", Wt = "Save", zt = "Cancel", jt = "Delete note", Ut = "note", $t = "Add note (optional)", qt = "Remove from Notebook", Gt = "Add a note (optional)", Kt = "Mark important", Xt = "Mark unclear", Qt = "Saved to Notebook.", Vt = "Note updated", Yt = "Note deleted", Zt = "Error saving to Notebook.", Jt = "Error updating note", en = "Note deletion failed", tn = "Loading notes", nn = "Failed to load notes", on = "Start capturing your notes", rn = "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.", sn = "Nothing here yet", ln = "Adjust your filters or create a new note to get started.", an = "You have no notes for the selected filter", cn = "Previous page", dn = "Next page", un = "All courses", fn = "All notes", mn = "Close Notebook panel", hn = "To use the Notebook feature, highlight an excerpt from your learning material to flag it as 'confusing' or 'important' and leave an optional note.", gn = "The content you highlighted is no longer available.", Te = {
|
|
636
636
|
notebook: Pt,
|
|
637
637
|
notes: _t,
|
|
638
638
|
important: Ft,
|
|
@@ -640,17 +640,17 @@ const Pt = "Notebook", _t = "Notes", Ft = "Important", Mt = "Unclear", Ht = "Bac
|
|
|
640
640
|
back: Ht,
|
|
641
641
|
editNote: Bt,
|
|
642
642
|
save: Wt,
|
|
643
|
-
cancel:
|
|
644
|
-
deleteNote:
|
|
643
|
+
cancel: zt,
|
|
644
|
+
deleteNote: jt,
|
|
645
645
|
note: Ut,
|
|
646
646
|
addNotePrompt: $t,
|
|
647
|
-
removeFromNotebook:
|
|
648
|
-
addNoteOptional:
|
|
647
|
+
removeFromNotebook: qt,
|
|
648
|
+
addNoteOptional: Gt,
|
|
649
649
|
markImportant: Kt,
|
|
650
650
|
markUnclear: Xt,
|
|
651
651
|
savedToNotebook: Qt,
|
|
652
|
-
noteUpdated:
|
|
653
|
-
noteDeleted:
|
|
652
|
+
noteUpdated: Vt,
|
|
653
|
+
noteDeleted: Yt,
|
|
654
654
|
errorSavingNote: Zt,
|
|
655
655
|
errorUpdatingNote: Jt,
|
|
656
656
|
noteDeletionFailed: en,
|
|
@@ -668,9 +668,9 @@ const Pt = "Notebook", _t = "Notes", Ft = "Important", Mt = "Unclear", Ht = "Bac
|
|
|
668
668
|
closeNotebookPanel: mn,
|
|
669
669
|
featureDescription: hn,
|
|
670
670
|
highlightUnavailable: gn
|
|
671
|
-
},
|
|
672
|
-
function
|
|
673
|
-
const t =
|
|
671
|
+
}, qe = Pe(null);
|
|
672
|
+
function Ge(n, e) {
|
|
673
|
+
const t = Te[n] ?? n;
|
|
674
674
|
return e ? t.replace(/%\{([^}]+)}/g, (o, r) => String(e[r] ?? `%{${r}}`)) : t;
|
|
675
675
|
}
|
|
676
676
|
function pn({
|
|
@@ -678,25 +678,25 @@ function pn({
|
|
|
678
678
|
translate: e,
|
|
679
679
|
children: t
|
|
680
680
|
}) {
|
|
681
|
-
const o =
|
|
681
|
+
const o = re(
|
|
682
682
|
() => ({
|
|
683
|
-
translations: { ...
|
|
684
|
-
translate: e ??
|
|
683
|
+
translations: { ...Te, ...n },
|
|
684
|
+
translate: e ?? Ge
|
|
685
685
|
}),
|
|
686
686
|
[n, e]
|
|
687
687
|
);
|
|
688
|
-
return /* @__PURE__ */
|
|
688
|
+
return /* @__PURE__ */ s(qe.Provider, { value: o, children: t });
|
|
689
689
|
}
|
|
690
|
-
function
|
|
691
|
-
const n = _e(
|
|
692
|
-
return n || { translations:
|
|
690
|
+
function G() {
|
|
691
|
+
const n = _e(qe);
|
|
692
|
+
return n || { translations: Te, translate: Ge };
|
|
693
693
|
}
|
|
694
694
|
const Nn = {
|
|
695
695
|
selectedNoteId: null,
|
|
696
696
|
isNoteEditing: !1,
|
|
697
697
|
isTrayOpen: !1
|
|
698
698
|
};
|
|
699
|
-
function
|
|
699
|
+
function bn(n, e) {
|
|
700
700
|
switch (e.type) {
|
|
701
701
|
case "SELECT_NOTE":
|
|
702
702
|
return {
|
|
@@ -717,26 +717,26 @@ function yn(n, e) {
|
|
|
717
717
|
}
|
|
718
718
|
}
|
|
719
719
|
const Ke = Pe(null);
|
|
720
|
-
function
|
|
720
|
+
function Qn({
|
|
721
721
|
api: n,
|
|
722
722
|
currentUserId: e,
|
|
723
723
|
objectId: t,
|
|
724
724
|
objectType: o,
|
|
725
725
|
courseId: r,
|
|
726
|
-
pageLastModifiedAt:
|
|
726
|
+
pageLastModifiedAt: i,
|
|
727
727
|
onAnalyticsEvent: l,
|
|
728
728
|
translations: d,
|
|
729
729
|
translate: m,
|
|
730
730
|
children: c
|
|
731
731
|
}) {
|
|
732
|
-
const [g, h] = Fe(
|
|
732
|
+
const [g, h] = Fe(bn, Nn), u = re(
|
|
733
733
|
() => ({
|
|
734
734
|
api: n,
|
|
735
735
|
currentUserId: e,
|
|
736
736
|
objectId: t,
|
|
737
737
|
objectType: o,
|
|
738
738
|
courseId: r,
|
|
739
|
-
pageLastModifiedAt:
|
|
739
|
+
pageLastModifiedAt: i,
|
|
740
740
|
onAnalyticsEvent: l,
|
|
741
741
|
...g,
|
|
742
742
|
selectNote: (E, f = !1) => h({ type: "SELECT_NOTE", payload: { id: E, isEditing: f } }),
|
|
@@ -751,12 +751,12 @@ function Xn({
|
|
|
751
751
|
t,
|
|
752
752
|
o,
|
|
753
753
|
r,
|
|
754
|
-
|
|
754
|
+
i,
|
|
755
755
|
l,
|
|
756
756
|
g
|
|
757
757
|
]
|
|
758
758
|
);
|
|
759
|
-
return /* @__PURE__ */
|
|
759
|
+
return /* @__PURE__ */ s(Ke.Provider, { value: u, children: /* @__PURE__ */ s(pn, { translations: d, translate: m, children: c }) });
|
|
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 } =
|
|
769
|
-
return
|
|
770
|
-
n ===
|
|
771
|
-
}, [n]), /* @__PURE__ */
|
|
772
|
-
/* @__PURE__ */
|
|
773
|
-
/* @__PURE__ */
|
|
767
|
+
const yn = ({ currentType: n, onSelectReaction: e }) => {
|
|
768
|
+
const { translations: t } = G(), o = ne(null), r = ne(null);
|
|
769
|
+
return Q(() => {
|
|
770
|
+
n === w.CONFUSING && o.current ? o.current.focus() : n === w.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(w.CONFUSING), children: [
|
|
773
|
+
/* @__PURE__ */ s(Ne, { size: "x-small" }),
|
|
774
774
|
` ${t.markUnclear}`
|
|
775
775
|
] }),
|
|
776
|
-
/* @__PURE__ */
|
|
777
|
-
/* @__PURE__ */
|
|
776
|
+
/* @__PURE__ */ S(ee.Item, { ref: r, onClick: () => e(w.IMPORTANT), children: [
|
|
777
|
+
/* @__PURE__ */ s(be, { size: "x-small" }),
|
|
778
778
|
` ${t.markImportant}`
|
|
779
779
|
] })
|
|
780
780
|
] });
|
|
781
|
-
},
|
|
782
|
-
function
|
|
781
|
+
}, de = "notebook-inline-reaction-menu";
|
|
782
|
+
function Vn({
|
|
783
783
|
containerRef: n,
|
|
784
784
|
highlightTheme: e,
|
|
785
785
|
debounceTime: t = 500
|
|
@@ -787,7 +787,7 @@ function Qn({
|
|
|
787
787
|
const {
|
|
788
788
|
api: o,
|
|
789
789
|
objectId: r,
|
|
790
|
-
objectType:
|
|
790
|
+
objectType: i,
|
|
791
791
|
courseId: l,
|
|
792
792
|
pageLastModifiedAt: d,
|
|
793
793
|
selectedNoteId: m,
|
|
@@ -796,108 +796,108 @@ function Qn({
|
|
|
796
796
|
} = Xe(), { data: h } = $e({
|
|
797
797
|
api: o,
|
|
798
798
|
filter: {
|
|
799
|
-
learningObject: { type:
|
|
799
|
+
learningObject: { type: i, id: r }
|
|
800
800
|
},
|
|
801
801
|
courseId: l,
|
|
802
802
|
pageSize: 100
|
|
803
|
-
}), { mutate: u } = Dt(o), { mutate: E } =
|
|
804
|
-
|
|
805
|
-
const
|
|
806
|
-
if (!
|
|
807
|
-
const
|
|
808
|
-
if (
|
|
809
|
-
|
|
803
|
+
}), { mutate: u } = Dt(o), { mutate: E } = At(o), { mutate: f } = Lt(o), v = ne([]), [y, H] = B([]), [F, N] = B(null), [C, k] = B(""), [x, O] = B(null), [_, M] = B(!1);
|
|
804
|
+
Q(() => {
|
|
805
|
+
const R = n.current;
|
|
806
|
+
if (!R) return;
|
|
807
|
+
const b = R.closest(".user_content") ?? R;
|
|
808
|
+
if (b.classList.contains("enhanced")) {
|
|
809
|
+
M(!0);
|
|
810
810
|
return;
|
|
811
811
|
}
|
|
812
|
-
const
|
|
813
|
-
for (const
|
|
814
|
-
if (
|
|
815
|
-
|
|
812
|
+
const P = new MutationObserver((L) => {
|
|
813
|
+
for (const p of L)
|
|
814
|
+
if (p.type === "attributes" && p.attributeName === "class" && p.target.classList.contains("enhanced")) {
|
|
815
|
+
M(!0), P.disconnect();
|
|
816
816
|
return;
|
|
817
817
|
}
|
|
818
818
|
});
|
|
819
|
-
return
|
|
820
|
-
}, [n]),
|
|
821
|
-
if (!
|
|
822
|
-
let
|
|
823
|
-
const
|
|
824
|
-
|
|
819
|
+
return P.observe(b, { attributes: !0, attributeFilter: ["class"] }), () => P.disconnect();
|
|
820
|
+
}, [n]), Q(() => {
|
|
821
|
+
if (!_ || !n.current) return;
|
|
822
|
+
let b = null;
|
|
823
|
+
const P = () => {
|
|
824
|
+
b && clearTimeout(b), b = setTimeout(() => {
|
|
825
825
|
var xe;
|
|
826
|
-
const
|
|
827
|
-
if (!(
|
|
828
|
-
const j =
|
|
826
|
+
const I = window.getSelection(), A = n.current;
|
|
827
|
+
if (!(I != null && I.rangeCount) || !A) return;
|
|
828
|
+
const j = I.toString().trim();
|
|
829
829
|
if (j === "") return;
|
|
830
|
-
const
|
|
831
|
-
if (!
|
|
832
|
-
const
|
|
833
|
-
|
|
830
|
+
const J = I.getRangeAt(0);
|
|
831
|
+
if (!A.contains(J.commonAncestorContainer)) return;
|
|
832
|
+
const Ce = (xe = X.fromRange(A, J)) == null ? void 0 : xe.toSelector();
|
|
833
|
+
Ce && !Ct(Ce, y) && (N(J.cloneRange()), k(j), O(Tt(J)));
|
|
834
834
|
}, t);
|
|
835
|
-
},
|
|
836
|
-
if (!(
|
|
837
|
-
const
|
|
838
|
-
|
|
839
|
-
},
|
|
840
|
-
|
|
835
|
+
}, L = (I) => {
|
|
836
|
+
if (!(I.target instanceof Node)) return;
|
|
837
|
+
const A = document.getElementById(de);
|
|
838
|
+
A != null && A.contains(I.target) ? (I.preventDefault(), I.stopImmediatePropagation()) : (O(null), N(null), k(""));
|
|
839
|
+
}, p = () => {
|
|
840
|
+
O(null), N(null), k("");
|
|
841
841
|
};
|
|
842
|
-
return document.addEventListener("selectionchange",
|
|
843
|
-
|
|
842
|
+
return document.addEventListener("selectionchange", P), document.addEventListener("mousedown", L), document.addEventListener("touchstart", L), window.addEventListener("scroll", p, !0), () => {
|
|
843
|
+
b && clearTimeout(b), document.removeEventListener("selectionchange", P), document.removeEventListener("mousedown", L), document.removeEventListener("touchstart", L), window.removeEventListener("scroll", p, !0);
|
|
844
844
|
};
|
|
845
|
-
}, [
|
|
846
|
-
m &&
|
|
845
|
+
}, [_, y, t, n]), Q(() => {
|
|
846
|
+
m && It(m);
|
|
847
847
|
}, [m]);
|
|
848
848
|
const D = K(
|
|
849
|
-
(
|
|
849
|
+
(R) => {
|
|
850
850
|
var j;
|
|
851
|
-
const
|
|
852
|
-
if (!
|
|
853
|
-
const { highlightData:
|
|
854
|
-
if (
|
|
855
|
-
const
|
|
856
|
-
id:
|
|
851
|
+
const b = n.current;
|
|
852
|
+
if (!b || !R.highlightData) return null;
|
|
853
|
+
const { highlightData: P, reaction: L, id: p } = R, { range: I } = P, A = I && ((j = Y.fromSelector(b, I)) == null ? void 0 : j.toRange());
|
|
854
|
+
if (A) {
|
|
855
|
+
const J = {
|
|
856
|
+
id: p,
|
|
857
857
|
selectedNoteId: m,
|
|
858
|
-
type:
|
|
858
|
+
type: L[0],
|
|
859
859
|
onClick: () => {
|
|
860
|
-
c(
|
|
860
|
+
c(p), g();
|
|
861
861
|
}
|
|
862
862
|
};
|
|
863
|
-
return
|
|
863
|
+
return kt(A, J, e), P.textPosition;
|
|
864
864
|
}
|
|
865
865
|
return null;
|
|
866
866
|
},
|
|
867
867
|
[n, m, e, c, g]
|
|
868
868
|
);
|
|
869
|
-
|
|
870
|
-
if (!
|
|
871
|
-
const
|
|
872
|
-
if (
|
|
873
|
-
if (
|
|
874
|
-
for (const
|
|
875
|
-
|
|
876
|
-
|
|
869
|
+
Q(() => {
|
|
870
|
+
if (!_ || !h || !n.current) return;
|
|
871
|
+
const R = n.current, b = h.notes, P = /* @__PURE__ */ new Set(), L = [], p = [];
|
|
872
|
+
if (b.length === 0) {
|
|
873
|
+
if (v.current.length > 0) {
|
|
874
|
+
for (const I of v.current)
|
|
875
|
+
Le(I, R);
|
|
876
|
+
v.current = [], H([]);
|
|
877
877
|
}
|
|
878
878
|
return;
|
|
879
879
|
}
|
|
880
|
-
if (d &&
|
|
881
|
-
const { notesForUpdate:
|
|
882
|
-
|
|
883
|
-
|
|
880
|
+
if (d && b[0].highlightData.pageLastModifiedAt !== d) {
|
|
881
|
+
const { notesForUpdate: I, noteIdsForDelete: A } = vt(
|
|
882
|
+
R,
|
|
883
|
+
b,
|
|
884
884
|
d
|
|
885
885
|
);
|
|
886
|
-
for (const j of
|
|
886
|
+
for (const j of I)
|
|
887
887
|
E({ id: j.id, input: j });
|
|
888
|
-
for (const j of
|
|
888
|
+
for (const j of A)
|
|
889
889
|
f(j);
|
|
890
890
|
} else {
|
|
891
|
-
for (const
|
|
892
|
-
const
|
|
893
|
-
|
|
891
|
+
for (const I of b) {
|
|
892
|
+
const A = D(I);
|
|
893
|
+
P.add(I.id), A && (L.push(I), p.push(A));
|
|
894
894
|
}
|
|
895
|
-
for (const
|
|
896
|
-
|
|
897
|
-
|
|
895
|
+
for (const I of v.current)
|
|
896
|
+
P.has(I.id) || Le(I, R);
|
|
897
|
+
H(p), v.current = L;
|
|
898
898
|
}
|
|
899
899
|
}, [
|
|
900
|
-
|
|
900
|
+
_,
|
|
901
901
|
h,
|
|
902
902
|
D,
|
|
903
903
|
d,
|
|
@@ -905,69 +905,69 @@ function Qn({
|
|
|
905
905
|
E,
|
|
906
906
|
f
|
|
907
907
|
]);
|
|
908
|
-
const
|
|
909
|
-
const
|
|
910
|
-
if (!
|
|
911
|
-
const
|
|
908
|
+
const Z = (R) => {
|
|
909
|
+
const b = n.current;
|
|
910
|
+
if (!F || !b) return;
|
|
911
|
+
const P = Y.fromRange(b, F), L = X.fromRange(b, F);
|
|
912
912
|
u(
|
|
913
913
|
{
|
|
914
914
|
courseId: l,
|
|
915
915
|
objectId: r,
|
|
916
|
-
objectType:
|
|
916
|
+
objectType: i,
|
|
917
917
|
userText: "",
|
|
918
|
-
reaction: [
|
|
918
|
+
reaction: [R],
|
|
919
919
|
highlightData: {
|
|
920
|
-
selectedText:
|
|
921
|
-
textPosition: (
|
|
922
|
-
range:
|
|
920
|
+
selectedText: C,
|
|
921
|
+
textPosition: (L == null ? void 0 : L.toSelector()) ?? null,
|
|
922
|
+
range: P.toSelector(),
|
|
923
923
|
pageLastModifiedAt: d ?? ""
|
|
924
924
|
}
|
|
925
925
|
},
|
|
926
926
|
{
|
|
927
|
-
onSuccess: (
|
|
928
|
-
var
|
|
929
|
-
const
|
|
930
|
-
N(null),
|
|
927
|
+
onSuccess: (p) => {
|
|
928
|
+
var A;
|
|
929
|
+
const I = p.id;
|
|
930
|
+
N(null), k(""), O(null), (A = window.getSelection()) == null || A.removeAllRanges(), c(I), g();
|
|
931
931
|
}
|
|
932
932
|
}
|
|
933
933
|
);
|
|
934
934
|
};
|
|
935
|
-
return !
|
|
936
|
-
/* @__PURE__ */
|
|
935
|
+
return !F || !x ? null : Ze(
|
|
936
|
+
/* @__PURE__ */ s(
|
|
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: (R) => {
|
|
949
|
+
const b = document.getElementById(de);
|
|
950
|
+
b != null && b.contains(R.relatedTarget) || (O(null), N(null), k(""));
|
|
951
951
|
},
|
|
952
|
-
children: /* @__PURE__ */
|
|
952
|
+
children: /* @__PURE__ */ s(yn, { onSelectReaction: Z })
|
|
953
953
|
}
|
|
954
954
|
),
|
|
955
955
|
document.body
|
|
956
956
|
);
|
|
957
957
|
}
|
|
958
958
|
const En = (n, e) => ({
|
|
959
|
-
backgroundColor: n ===
|
|
960
|
-
underlineColor: n ===
|
|
961
|
-
underlineStyle: n ===
|
|
962
|
-
}),
|
|
959
|
+
backgroundColor: n === w.IMPORTANT ? e.colors.importantBackground : e.colors.confusingBackground,
|
|
960
|
+
underlineColor: n === w.IMPORTANT ? e.colors.importantUnderline : e.colors.confusingUnderline,
|
|
961
|
+
underlineStyle: n === w.IMPORTANT ? "solid" : "dashed"
|
|
962
|
+
}), he = ({
|
|
963
963
|
children: n,
|
|
964
|
-
type: e =
|
|
964
|
+
type: e = w.IMPORTANT,
|
|
965
965
|
isCardActive: t = !0,
|
|
966
966
|
theme: o
|
|
967
967
|
}) => {
|
|
968
968
|
const r = En(e, o), l = {
|
|
969
969
|
position: "relative",
|
|
970
|
-
backgroundColor: t ? r.backgroundColor :
|
|
970
|
+
backgroundColor: t ? r.backgroundColor : Ie(r.backgroundColor, 0.5),
|
|
971
971
|
textDecorationLine: "underline",
|
|
972
972
|
textDecorationStyle: r.underlineStyle,
|
|
973
973
|
textDecorationColor: r.underlineColor,
|
|
@@ -975,19 +975,19 @@ const En = (n, e) => ({
|
|
|
975
975
|
textUnderlineOffset: o.underlineOffset,
|
|
976
976
|
lineHeight: "normal"
|
|
977
977
|
};
|
|
978
|
-
return /* @__PURE__ */
|
|
978
|
+
return /* @__PURE__ */ s("span", { "data-note-highlight": "true", style: l, children: n });
|
|
979
979
|
}, Qe = () => {
|
|
980
|
-
const { translations: n } =
|
|
981
|
-
return /* @__PURE__ */
|
|
982
|
-
/* @__PURE__ */
|
|
983
|
-
/* @__PURE__ */
|
|
980
|
+
const { translations: n } = G();
|
|
981
|
+
return /* @__PURE__ */ S(T, { gap: "xx-small", alignItems: "start", as: "div", children: [
|
|
982
|
+
/* @__PURE__ */ s(T.Item, { as: "div", children: /* @__PURE__ */ s(tt, { color: "error" }) }),
|
|
983
|
+
/* @__PURE__ */ s(T.Item, { padding: "xxx-small none", shouldShrink: !0, children: /* @__PURE__ */ s(me, { maxLines: 3, children: n.highlightUnavailable }) })
|
|
984
984
|
] });
|
|
985
985
|
}, Sn = {
|
|
986
986
|
filter: null,
|
|
987
987
|
courseFilter: null,
|
|
988
988
|
pageParamsWithDirection: {}
|
|
989
989
|
};
|
|
990
|
-
function
|
|
990
|
+
function vn(n, e) {
|
|
991
991
|
switch (e.type) {
|
|
992
992
|
case "SET_FILTER":
|
|
993
993
|
return { ...n, filter: e.payload, pageParamsWithDirection: {} };
|
|
@@ -1006,11 +1006,11 @@ function Yn({
|
|
|
1006
1006
|
learningObject: o,
|
|
1007
1007
|
pageSize: r = 16
|
|
1008
1008
|
}) {
|
|
1009
|
-
const [
|
|
1010
|
-
|
|
1009
|
+
const [i, l] = Fe(vn, Sn), { filter: d, courseFilter: m, pageParamsWithDirection: c } = i;
|
|
1010
|
+
Q(() => {
|
|
1011
1011
|
Object.keys(c).length > 0 && l({ type: "SET_PAGE_PARAMS_WITH_DIRECTION", payload: {} });
|
|
1012
1012
|
}, [r]);
|
|
1013
|
-
const g = t ? m : e, { direction: h, pageParams: u } = c, 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:
|
|
1013
|
+
const g = t ? m : e, { direction: h, pageParams: u } = c, 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 } : {},
|
|
@@ -1020,58 +1020,58 @@ function Yn({
|
|
|
1020
1020
|
cursor: E,
|
|
1021
1021
|
direction: h,
|
|
1022
1022
|
pageSize: r
|
|
1023
|
-
}),
|
|
1023
|
+
}), H = (f == null ? void 0 : f.notes) ?? [], F = f == null ? void 0 : f.pageInfo, N = K(() => {
|
|
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 = K(() => {
|
|
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]), k = K((O) => {
|
|
1034
|
+
l({ type: "SET_FILTER", payload: O });
|
|
1035
|
+
}, []), x = K((O) => {
|
|
1036
|
+
l({ type: "SET_COURSE_FILTER", payload: O });
|
|
1037
1037
|
}, []);
|
|
1038
1038
|
return {
|
|
1039
|
-
notes:
|
|
1040
|
-
pageInfo:
|
|
1041
|
-
isLoading:
|
|
1042
|
-
isError:
|
|
1039
|
+
notes: H,
|
|
1040
|
+
pageInfo: F,
|
|
1041
|
+
isLoading: v,
|
|
1042
|
+
isError: y,
|
|
1043
1043
|
filter: d,
|
|
1044
1044
|
courseFilter: m,
|
|
1045
|
-
setFilter:
|
|
1046
|
-
setCourseFilter:
|
|
1045
|
+
setFilter: k,
|
|
1046
|
+
setCourseFilter: x,
|
|
1047
1047
|
fetchNextPage: N,
|
|
1048
|
-
fetchPreviousPage:
|
|
1048
|
+
fetchPreviousPage: C
|
|
1049
1049
|
};
|
|
1050
1050
|
}
|
|
1051
|
-
const
|
|
1052
|
-
function
|
|
1053
|
-
const { translations: t } =
|
|
1051
|
+
const ue = "all";
|
|
1052
|
+
function Zn({ filter: n, setFilter: e }) {
|
|
1053
|
+
const { translations: t } = G(), o = re(
|
|
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: w.IMPORTANT },
|
|
1057
|
+
{ label: t.unclear, value: w.CONFUSING }
|
|
1058
1058
|
],
|
|
1059
1059
|
[t]
|
|
1060
1060
|
), r = K(
|
|
1061
1061
|
(l, { value: d }) => {
|
|
1062
|
-
e(!d || d ===
|
|
1062
|
+
e(!d || d === ue ? null : d);
|
|
1063
1063
|
},
|
|
1064
1064
|
[e]
|
|
1065
1065
|
);
|
|
1066
1066
|
return {
|
|
1067
|
-
filterElement:
|
|
1068
|
-
() => /* @__PURE__ */
|
|
1067
|
+
filterElement: re(
|
|
1068
|
+
() => /* @__PURE__ */ s(
|
|
1069
1069
|
we,
|
|
1070
1070
|
{
|
|
1071
|
-
renderLabel: /* @__PURE__ */
|
|
1072
|
-
value: n ??
|
|
1071
|
+
renderLabel: /* @__PURE__ */ s(Me, { children: t.notes }),
|
|
1072
|
+
value: n ?? ue,
|
|
1073
1073
|
onChange: r,
|
|
1074
|
-
children: o.map((l) => /* @__PURE__ */
|
|
1074
|
+
children: o.map((l) => /* @__PURE__ */ s(we.Option, { id: l.value, value: l.value, children: l.label }, l.value))
|
|
1075
1075
|
}
|
|
1076
1076
|
),
|
|
1077
1077
|
[n, o, r, t.notes]
|
|
@@ -1080,9 +1080,16 @@ function Vn({ filter: n, setFilter: e }) {
|
|
|
1080
1080
|
handleReactionFilterChange: r
|
|
1081
1081
|
};
|
|
1082
1082
|
}
|
|
1083
|
-
const
|
|
1084
|
-
const {
|
|
1085
|
-
return /* @__PURE__ */
|
|
1083
|
+
const In = ({ hasActiveFilter: n = !1 }) => {
|
|
1084
|
+
const { translations: e } = G(), t = n ? e.nothingHereYet : e.emptyStateHeading, o = n ? e.adjustFiltersOrCreate : e.emptyStateDescription;
|
|
1085
|
+
return /* @__PURE__ */ s(z, { as: "div", textAlign: "center", children: /* @__PURE__ */ S(T, { direction: "column", alignItems: "center", gap: "small", children: [
|
|
1086
|
+
!n && /* @__PURE__ */ s(nt, { size: "medium" }),
|
|
1087
|
+
/* @__PURE__ */ s(ae, { level: "h3", children: t }),
|
|
1088
|
+
/* @__PURE__ */ s(U, { color: "secondary", children: o })
|
|
1089
|
+
] }) });
|
|
1090
|
+
}, Jn = ({ children: n }) => {
|
|
1091
|
+
const { isTrayOpen: e, closeTray: t } = Xe(), { translations: o } = G();
|
|
1092
|
+
return /* @__PURE__ */ s(
|
|
1086
1093
|
lt,
|
|
1087
1094
|
{
|
|
1088
1095
|
label: o.notebook,
|
|
@@ -1090,10 +1097,10 @@ const Zn = ({ children: n }) => {
|
|
|
1090
1097
|
onDismiss: t,
|
|
1091
1098
|
placement: "end",
|
|
1092
1099
|
size: "regular",
|
|
1093
|
-
children: /* @__PURE__ */
|
|
1094
|
-
/* @__PURE__ */
|
|
1095
|
-
/* @__PURE__ */
|
|
1096
|
-
/* @__PURE__ */
|
|
1100
|
+
children: /* @__PURE__ */ S(T, { direction: "column", height: "100vh", children: [
|
|
1101
|
+
/* @__PURE__ */ s(T.Item, { children: /* @__PURE__ */ s(z, { as: "div", padding: "small medium", borderWidth: "0 0 small 0", children: /* @__PURE__ */ S(T, { justifyItems: "space-between", alignItems: "center", children: [
|
|
1102
|
+
/* @__PURE__ */ s(ae, { level: "h3", children: o.notebook }),
|
|
1103
|
+
/* @__PURE__ */ s(
|
|
1097
1104
|
it,
|
|
1098
1105
|
{
|
|
1099
1106
|
screenReaderLabel: o.closeNotebookPanel,
|
|
@@ -1103,29 +1110,29 @@ const Zn = ({ children: n }) => {
|
|
|
1103
1110
|
}
|
|
1104
1111
|
)
|
|
1105
1112
|
] }) }) }),
|
|
1106
|
-
/* @__PURE__ */
|
|
1113
|
+
/* @__PURE__ */ s(T.Item, { shouldGrow: !0, shouldShrink: !0, overflowY: "auto", overflowX: "hidden", children: n })
|
|
1107
1114
|
] })
|
|
1108
1115
|
}
|
|
1109
1116
|
);
|
|
1110
|
-
},
|
|
1111
|
-
[
|
|
1112
|
-
color: "
|
|
1117
|
+
}, Tn = {
|
|
1118
|
+
[w.IMPORTANT]: {
|
|
1119
|
+
color: "success",
|
|
1113
1120
|
translationKey: "important",
|
|
1114
|
-
icon: /* @__PURE__ */
|
|
1121
|
+
icon: /* @__PURE__ */ s(be, { size: "x-small" })
|
|
1115
1122
|
},
|
|
1116
|
-
[
|
|
1123
|
+
[w.CONFUSING]: {
|
|
1117
1124
|
color: "danger",
|
|
1118
1125
|
translationKey: "unclear",
|
|
1119
|
-
icon: /* @__PURE__ */
|
|
1126
|
+
icon: /* @__PURE__ */ s(Ne, { size: "x-small" })
|
|
1120
1127
|
}
|
|
1121
|
-
},
|
|
1122
|
-
const { translations: o } =
|
|
1128
|
+
}, Ve = ({ type: n, onTypeChange: e, renderAsMenuTrigger: t = !1 }) => {
|
|
1129
|
+
const { translations: o } = G(), r = Tn[n], i = o[r.translationKey], [l, d] = B(!1), m = ne(null), c = ne(null), g = K(
|
|
1123
1130
|
(h) => {
|
|
1124
1131
|
e == null || e(h), d(!1);
|
|
1125
1132
|
},
|
|
1126
1133
|
[e]
|
|
1127
1134
|
);
|
|
1128
|
-
return t && e ? /* @__PURE__ */
|
|
1135
|
+
return t && e ? /* @__PURE__ */ S(
|
|
1129
1136
|
ee,
|
|
1130
1137
|
{
|
|
1131
1138
|
placement: "bottom start",
|
|
@@ -1133,38 +1140,34 @@ const Zn = ({ children: n }) => {
|
|
|
1133
1140
|
onToggle: (h) => d(h),
|
|
1134
1141
|
shouldHideOnSelect: !0,
|
|
1135
1142
|
shouldFocusTriggerOnClose: !0,
|
|
1136
|
-
trigger: /* @__PURE__ */
|
|
1137
|
-
s,
|
|
1138
|
-
" ",
|
|
1139
|
-
/* @__PURE__ */ i(nt, { size: "x-small" })
|
|
1140
|
-
] }),
|
|
1143
|
+
trigger: /* @__PURE__ */ s(ke, { color: r.color, renderIcon: r.icon, children: i }),
|
|
1141
1144
|
children: [
|
|
1142
|
-
/* @__PURE__ */
|
|
1143
|
-
/* @__PURE__ */
|
|
1145
|
+
/* @__PURE__ */ S(ee.Item, { ref: m, onClick: () => g(w.CONFUSING), children: [
|
|
1146
|
+
/* @__PURE__ */ s(Ne, { size: "x-small" }),
|
|
1144
1147
|
` ${o.markUnclear}`
|
|
1145
1148
|
] }),
|
|
1146
|
-
/* @__PURE__ */
|
|
1147
|
-
/* @__PURE__ */
|
|
1149
|
+
/* @__PURE__ */ S(ee.Item, { ref: c, onClick: () => g(w.IMPORTANT), children: [
|
|
1150
|
+
/* @__PURE__ */ s(be, { size: "x-small" }),
|
|
1148
1151
|
` ${o.markImportant}`
|
|
1149
1152
|
] })
|
|
1150
1153
|
]
|
|
1151
1154
|
}
|
|
1152
|
-
) : /* @__PURE__ */
|
|
1155
|
+
) : /* @__PURE__ */ s(z, { display: "inline-flex", children: /* @__PURE__ */ s(ke, { color: r.color, renderIcon: r.icon, children: i }) });
|
|
1153
1156
|
};
|
|
1154
|
-
function
|
|
1157
|
+
function Ae(n, e) {
|
|
1155
1158
|
return (n instanceof Date ? n : new Date(n)).toLocaleString(e, {
|
|
1156
1159
|
year: "numeric",
|
|
1157
1160
|
month: "short",
|
|
1158
1161
|
day: "numeric"
|
|
1159
1162
|
});
|
|
1160
1163
|
}
|
|
1161
|
-
const
|
|
1164
|
+
const Cn = ({
|
|
1162
1165
|
noteId: n,
|
|
1163
1166
|
date: e,
|
|
1164
1167
|
highlight: t,
|
|
1165
1168
|
note: o,
|
|
1166
1169
|
type: r,
|
|
1167
|
-
onClick:
|
|
1170
|
+
onClick: i,
|
|
1168
1171
|
onDelete: l,
|
|
1169
1172
|
onSaveNote: d,
|
|
1170
1173
|
onTypeChange: m,
|
|
@@ -1173,245 +1176,245 @@ const In = ({
|
|
|
1173
1176
|
courseName: h,
|
|
1174
1177
|
locale: u,
|
|
1175
1178
|
highlightTheme: E,
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
href: O
|
|
1179
|
+
renderLink: f,
|
|
1180
|
+
href: v
|
|
1179
1181
|
}) => {
|
|
1180
|
-
const { translations:
|
|
1181
|
-
|
|
1182
|
-
},
|
|
1183
|
-
|
|
1184
|
-
|
|
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
|
-
|
|
1182
|
+
const { translations: y } = G(), [H, F] = B(!1), [N, C] = B(!1), [k, x] = B(o || ""), [O, _] = B(!1), M = ne(null), D = K((p) => {
|
|
1183
|
+
M.current = p;
|
|
1184
|
+
}, []);
|
|
1185
|
+
Q(() => {
|
|
1186
|
+
var p;
|
|
1187
|
+
c && ((p = M.current) == null || p.scrollIntoView({ behavior: "smooth", block: "nearest" }));
|
|
1188
|
+
}, [c]);
|
|
1189
|
+
const Z = r === w.IMPORTANT ? y.important : y.unclear, R = (p) => {
|
|
1190
|
+
p.key === "Enter" && (p.preventDefault(), i == null || i());
|
|
1191
|
+
}, b = [Z, y.note];
|
|
1192
|
+
t && b.push(t), o && b.push(o), e && b.push(Ae(e, u)), h && b.push(h);
|
|
1193
|
+
const P = b.join(", "), L = /* @__PURE__ */ S(
|
|
1194
|
+
z,
|
|
1195
|
+
{
|
|
1196
|
+
as: "div",
|
|
1197
|
+
borderWidth: "small",
|
|
1198
|
+
borderRadius: "medium",
|
|
1199
|
+
padding: "small",
|
|
1200
|
+
position: "relative",
|
|
1201
|
+
role: v || N ? void 0 : "button",
|
|
1202
|
+
"aria-label": v ? void 0 : P,
|
|
1203
|
+
"aria-pressed": v || N ? void 0 : c,
|
|
1204
|
+
tabIndex: v || c ? -1 : 0,
|
|
1205
|
+
"data-testid": "note-card",
|
|
1206
|
+
elementRef: D,
|
|
1207
|
+
onClick: c ? void 0 : i,
|
|
1208
|
+
onMouseEnter: () => F(!0),
|
|
1209
|
+
onMouseLeave: () => F(!1),
|
|
1210
|
+
onKeyDown: c ? void 0 : R,
|
|
1211
|
+
cursor: N ? "default" : "pointer",
|
|
1212
|
+
children: [
|
|
1213
|
+
/* @__PURE__ */ S(T, { direction: "column", gap: "small", children: [
|
|
1214
|
+
/* @__PURE__ */ s(
|
|
1215
|
+
Ve,
|
|
1216
|
+
{
|
|
1217
|
+
type: r,
|
|
1218
|
+
onTypeChange: g && m ? (p) => m(n, p) : void 0,
|
|
1219
|
+
renderAsMenuTrigger: g && !!m && !!c
|
|
1220
|
+
}
|
|
1221
|
+
),
|
|
1222
|
+
t ? /* @__PURE__ */ s("div", { style: { wordBreak: "break-word", overflowWrap: "break-word" }, children: /* @__PURE__ */ s(U, { children: c && g ? /* @__PURE__ */ s(
|
|
1223
|
+
he,
|
|
1224
|
+
{
|
|
1225
|
+
type: r,
|
|
1226
|
+
isCardActive: !!c || H,
|
|
1227
|
+
theme: E,
|
|
1228
|
+
children: t
|
|
1229
|
+
}
|
|
1230
|
+
) : /* @__PURE__ */ s(me, { maxLines: 3, truncate: "word", children: /* @__PURE__ */ s(
|
|
1231
|
+
he,
|
|
1232
|
+
{
|
|
1233
|
+
type: r,
|
|
1234
|
+
isCardActive: !!c || H,
|
|
1235
|
+
theme: E,
|
|
1236
|
+
children: t
|
|
1237
|
+
}
|
|
1238
|
+
) }) }) }) : /* @__PURE__ */ s(Qe, {}),
|
|
1239
|
+
/* @__PURE__ */ S(T, { direction: "column", gap: "small", children: [
|
|
1240
|
+
N && g ? /* @__PURE__ */ S(T, { direction: "column", gap: "x-small", children: [
|
|
1241
|
+
/* @__PURE__ */ s(
|
|
1242
|
+
He,
|
|
1243
|
+
{
|
|
1244
|
+
label: /* @__PURE__ */ s(Me, { children: y.editNote }),
|
|
1245
|
+
value: k,
|
|
1246
|
+
onChange: (p) => x(p.target.value),
|
|
1247
|
+
placeholder: y.addNoteOptional
|
|
1248
|
+
}
|
|
1249
|
+
),
|
|
1250
|
+
/* @__PURE__ */ S(T, { gap: "xx-small", children: [
|
|
1251
|
+
/* @__PURE__ */ s(T.Item, { shouldGrow: !0, children: /* @__PURE__ */ s(
|
|
1252
|
+
$,
|
|
1239
1253
|
{
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
|
|
1254
|
+
display: "block",
|
|
1255
|
+
size: "small",
|
|
1256
|
+
"data-testid": "note-card-cancel",
|
|
1257
|
+
onClick: () => {
|
|
1258
|
+
x(o || ""), C(!1);
|
|
1259
|
+
},
|
|
1260
|
+
children: y.cancel
|
|
1244
1261
|
}
|
|
1245
|
-
),
|
|
1246
|
-
/* @__PURE__ */
|
|
1247
|
-
|
|
1248
|
-
|
|
1262
|
+
) }),
|
|
1263
|
+
/* @__PURE__ */ s(T.Item, { shouldGrow: !0, children: /* @__PURE__ */ s(
|
|
1264
|
+
$,
|
|
1265
|
+
{
|
|
1266
|
+
display: "block",
|
|
1267
|
+
color: "primary",
|
|
1268
|
+
size: "small",
|
|
1269
|
+
"data-testid": "note-card-save",
|
|
1270
|
+
onClick: () => {
|
|
1271
|
+
d == null || d(n, k), C(!1);
|
|
1272
|
+
},
|
|
1273
|
+
interaction: k.trim() ? "enabled" : "disabled",
|
|
1274
|
+
children: y.save
|
|
1275
|
+
}
|
|
1276
|
+
) })
|
|
1277
|
+
] })
|
|
1278
|
+
] }) : o ? /* @__PURE__ */ s("div", { style: { wordBreak: "break-word", overflowWrap: "break-word" }, children: c && g ? /* @__PURE__ */ S(U, { children: [
|
|
1279
|
+
o,
|
|
1280
|
+
" ",
|
|
1281
|
+
/* @__PURE__ */ s(
|
|
1282
|
+
V,
|
|
1283
|
+
{
|
|
1284
|
+
size: "small",
|
|
1285
|
+
withBackground: !1,
|
|
1286
|
+
withBorder: !1,
|
|
1287
|
+
screenReaderLabel: y.editNote,
|
|
1288
|
+
"data-testid": "note-card-edit",
|
|
1289
|
+
onClick: (p) => {
|
|
1290
|
+
p.stopPropagation(), C(!0);
|
|
1291
|
+
},
|
|
1292
|
+
children: /* @__PURE__ */ s(fe, {})
|
|
1293
|
+
}
|
|
1294
|
+
)
|
|
1295
|
+
] }) : /* @__PURE__ */ s(U, { children: /* @__PURE__ */ s(me, { maxLines: 3, truncate: "word", children: o }) }) }) : g && c ? /* @__PURE__ */ s("div", { children: /* @__PURE__ */ S(U, { color: "secondary", children: [
|
|
1296
|
+
y.addNotePrompt,
|
|
1297
|
+
" ",
|
|
1298
|
+
/* @__PURE__ */ s(
|
|
1299
|
+
V,
|
|
1300
|
+
{
|
|
1301
|
+
size: "small",
|
|
1302
|
+
withBackground: !1,
|
|
1303
|
+
withBorder: !1,
|
|
1304
|
+
screenReaderLabel: y.editNote,
|
|
1305
|
+
"data-testid": "note-card-edit",
|
|
1306
|
+
onClick: (p) => {
|
|
1307
|
+
p.stopPropagation(), C(!0);
|
|
1308
|
+
},
|
|
1309
|
+
children: /* @__PURE__ */ s(fe, {})
|
|
1310
|
+
}
|
|
1311
|
+
)
|
|
1312
|
+
] }) }) : null,
|
|
1313
|
+
/* @__PURE__ */ S(T, { justifyItems: "space-between", alignItems: "center", children: [
|
|
1314
|
+
/* @__PURE__ */ s(U, { size: "small", color: "secondary", children: Ae(e, u) }),
|
|
1315
|
+
c && l && /* @__PURE__ */ s(
|
|
1316
|
+
V,
|
|
1317
|
+
{
|
|
1318
|
+
size: "small",
|
|
1319
|
+
withBackground: !1,
|
|
1320
|
+
withBorder: !1,
|
|
1321
|
+
color: "danger",
|
|
1322
|
+
screenReaderLabel: y.deleteNote,
|
|
1323
|
+
"data-testid": "note-card-delete",
|
|
1324
|
+
onClick: (p) => {
|
|
1325
|
+
p.stopPropagation(), _(!0);
|
|
1326
|
+
},
|
|
1327
|
+
children: /* @__PURE__ */ s(le, {})
|
|
1328
|
+
}
|
|
1329
|
+
)
|
|
1330
|
+
] }),
|
|
1331
|
+
h && /* @__PURE__ */ s(U, { size: "small", color: "secondary", children: h })
|
|
1332
|
+
] })
|
|
1333
|
+
] }),
|
|
1334
|
+
O && l && /* @__PURE__ */ s(
|
|
1335
|
+
z,
|
|
1336
|
+
{
|
|
1337
|
+
as: "div",
|
|
1338
|
+
background: "primary",
|
|
1339
|
+
padding: "medium",
|
|
1340
|
+
borderRadius: "large",
|
|
1341
|
+
position: "absolute",
|
|
1342
|
+
insetBlockStart: "0",
|
|
1343
|
+
insetBlockEnd: "0",
|
|
1344
|
+
insetInlineStart: "0",
|
|
1345
|
+
insetInlineEnd: "0",
|
|
1346
|
+
stacking: "above",
|
|
1347
|
+
children: /* @__PURE__ */ S(
|
|
1348
|
+
T,
|
|
1349
|
+
{
|
|
1350
|
+
direction: "column",
|
|
1351
|
+
justifyItems: "center",
|
|
1352
|
+
alignItems: "center",
|
|
1353
|
+
gap: "x-small",
|
|
1354
|
+
height: "100%",
|
|
1355
|
+
children: [
|
|
1356
|
+
/* @__PURE__ */ s(
|
|
1357
|
+
$,
|
|
1249
1358
|
{
|
|
1250
1359
|
display: "block",
|
|
1360
|
+
color: "danger",
|
|
1251
1361
|
size: "small",
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
|
|
1362
|
+
renderIcon: /* @__PURE__ */ s(le, {}),
|
|
1363
|
+
"data-testid": "note-card-confirm-delete",
|
|
1364
|
+
onClick: (p) => {
|
|
1365
|
+
p.stopPropagation(), l(n), _(!1);
|
|
1255
1366
|
},
|
|
1256
|
-
children:
|
|
1367
|
+
children: y.deleteNote
|
|
1257
1368
|
}
|
|
1258
|
-
)
|
|
1259
|
-
/* @__PURE__ */
|
|
1260
|
-
|
|
1369
|
+
),
|
|
1370
|
+
/* @__PURE__ */ s(
|
|
1371
|
+
$,
|
|
1261
1372
|
{
|
|
1262
1373
|
display: "block",
|
|
1263
|
-
color: "primary",
|
|
1264
1374
|
size: "small",
|
|
1265
|
-
"data-testid": "note-card-
|
|
1266
|
-
onClick: () => {
|
|
1267
|
-
|
|
1375
|
+
"data-testid": "note-card-cancel-delete",
|
|
1376
|
+
onClick: (p) => {
|
|
1377
|
+
p.stopPropagation(), _(!1);
|
|
1268
1378
|
},
|
|
1269
|
-
|
|
1270
|
-
children: k.save
|
|
1379
|
+
children: y.cancel
|
|
1271
1380
|
}
|
|
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
|
-
)
|
|
1381
|
+
)
|
|
1382
|
+
]
|
|
1383
|
+
}
|
|
1384
|
+
)
|
|
1385
|
+
}
|
|
1386
|
+
)
|
|
1387
|
+
]
|
|
1388
|
+
}
|
|
1386
1389
|
);
|
|
1387
|
-
return
|
|
1390
|
+
return v && f ? f({ href: v, children: L, ariaLabel: P }) : L;
|
|
1388
1391
|
};
|
|
1389
|
-
function
|
|
1392
|
+
function xn(n, e) {
|
|
1390
1393
|
const t = Array.from({ length: e }, () => []);
|
|
1391
1394
|
return n.forEach((o, r) => {
|
|
1392
1395
|
t[r % e].push(o);
|
|
1393
1396
|
}), t;
|
|
1394
1397
|
}
|
|
1395
|
-
const
|
|
1398
|
+
const wn = {
|
|
1396
1399
|
display: "flex",
|
|
1397
1400
|
gap: "1rem",
|
|
1398
1401
|
padding: "1rem",
|
|
1399
1402
|
boxSizing: "border-box",
|
|
1400
1403
|
width: "100%",
|
|
1401
1404
|
alignItems: "flex-start"
|
|
1402
|
-
},
|
|
1405
|
+
}, kn = {
|
|
1403
1406
|
display: "flex",
|
|
1404
1407
|
flexDirection: "column",
|
|
1405
1408
|
gap: "1rem",
|
|
1406
1409
|
flex: 1,
|
|
1407
1410
|
minWidth: 0
|
|
1408
|
-
},
|
|
1411
|
+
}, eo = ({
|
|
1409
1412
|
notes: n,
|
|
1410
1413
|
isLoading: e,
|
|
1411
1414
|
isError: t,
|
|
1412
1415
|
pageInfo: o,
|
|
1413
1416
|
onPreviousPage: r,
|
|
1414
|
-
onNextPage:
|
|
1417
|
+
onNextPage: i,
|
|
1415
1418
|
onNoteSelect: l,
|
|
1416
1419
|
onNoteDelete: d,
|
|
1417
1420
|
onNoteSave: m,
|
|
@@ -1420,119 +1423,95 @@ const xn = {
|
|
|
1420
1423
|
hasActiveFilter: h = !1,
|
|
1421
1424
|
columnCount: u = 1,
|
|
1422
1425
|
highlightTheme: E,
|
|
1423
|
-
|
|
1424
|
-
|
|
1425
|
-
|
|
1426
|
-
noteHref: k
|
|
1426
|
+
locale: f,
|
|
1427
|
+
renderNoteLink: v,
|
|
1428
|
+
noteHref: y
|
|
1427
1429
|
}) => {
|
|
1428
|
-
const { translations:
|
|
1429
|
-
() =>
|
|
1430
|
+
const { translations: H } = G(), F = re(
|
|
1431
|
+
() => xn(n, u),
|
|
1430
1432
|
[n, u]
|
|
1431
|
-
),
|
|
1432
|
-
|
|
1433
|
-
|
|
1434
|
-
|
|
1435
|
-
|
|
1436
|
-
|
|
1437
|
-
|
|
1438
|
-
|
|
1439
|
-
v,
|
|
1440
|
-
{
|
|
1441
|
-
direction: "column",
|
|
1442
|
-
alignItems: "center",
|
|
1443
|
-
justifyItems: "center",
|
|
1444
|
-
padding: "large",
|
|
1445
|
-
gap: "small",
|
|
1446
|
-
"data-testid": "empty-notes",
|
|
1447
|
-
children: [
|
|
1448
|
-
/* @__PURE__ */ i(ae, { level: "h3", children: R }),
|
|
1449
|
-
/* @__PURE__ */ i(z, { color: "secondary", children: P })
|
|
1450
|
-
]
|
|
1451
|
-
}
|
|
1452
|
-
);
|
|
1453
|
-
}
|
|
1454
|
-
return /* @__PURE__ */ b(Ve, { children: [
|
|
1455
|
-
/* @__PURE__ */ i("div", { style: xn, "data-testid": "notes-grid", children: N.map((R, P) => (
|
|
1456
|
-
// biome-ignore lint/suspicious/noArrayIndexKey: columns are positional, index is stable
|
|
1457
|
-
/* @__PURE__ */ i("div", { style: wn, children: R.map((C) => {
|
|
1458
|
-
var W;
|
|
1459
|
-
return /* @__PURE__ */ i(
|
|
1460
|
-
In,
|
|
1433
|
+
), N = (o == null ? void 0 : o.hasNextPage) || (o == null ? void 0 : o.hasPreviousPage);
|
|
1434
|
+
return e ? /* @__PURE__ */ s(z, { as: "div", textAlign: "center", padding: "large", "data-testid": "notes-loading", children: /* @__PURE__ */ s(at, { renderTitle: H.loadingNotes }) }) : t ? /* @__PURE__ */ s(z, { as: "div", textAlign: "center", padding: "large", "data-testid": "notes-error", children: /* @__PURE__ */ s(ae, { level: "h4", children: H.failedToLoadNotes }) }) : n.length === 0 ? /* @__PURE__ */ s(z, { as: "div", padding: "large", "data-testid": "empty-notes", children: /* @__PURE__ */ s(In, { hasActiveFilter: h }) }) : /* @__PURE__ */ S(Ye, { children: [
|
|
1435
|
+
/* @__PURE__ */ s("div", { style: wn, "data-testid": "notes-grid", children: F.map((C, k) => (
|
|
1436
|
+
// oxlint-disable-next-line react/no-array-index-key -- columns are positional, index is stable
|
|
1437
|
+
/* @__PURE__ */ s("div", { style: kn, children: C.map((x) => {
|
|
1438
|
+
var O;
|
|
1439
|
+
return /* @__PURE__ */ s(
|
|
1440
|
+
Cn,
|
|
1461
1441
|
{
|
|
1462
|
-
noteId:
|
|
1463
|
-
date:
|
|
1464
|
-
type:
|
|
1465
|
-
highlight: (
|
|
1466
|
-
note:
|
|
1467
|
-
isActive: g ===
|
|
1442
|
+
noteId: x.id,
|
|
1443
|
+
date: x.createdAt,
|
|
1444
|
+
type: x.reaction[0] ?? w.IMPORTANT,
|
|
1445
|
+
highlight: (O = x.highlightData) == null ? void 0 : O.selectedText,
|
|
1446
|
+
note: x.userText,
|
|
1447
|
+
isActive: g === x.id,
|
|
1468
1448
|
isPanelView: !!g,
|
|
1469
|
-
onClick: l ? () => l(
|
|
1470
|
-
onDelete: d ? (
|
|
1471
|
-
onSaveNote: m ? (
|
|
1472
|
-
onTypeChange: c ? (
|
|
1449
|
+
onClick: l ? () => l(x.id) : void 0,
|
|
1450
|
+
onDelete: d ? (_) => d(_) : void 0,
|
|
1451
|
+
onSaveNote: m ? (_, M) => m(_, M) : void 0,
|
|
1452
|
+
onTypeChange: c ? (_, M) => c(_, M) : void 0,
|
|
1473
1453
|
highlightTheme: E,
|
|
1474
|
-
|
|
1475
|
-
|
|
1476
|
-
|
|
1477
|
-
href: k ? k(C.id, C) : void 0
|
|
1454
|
+
locale: f,
|
|
1455
|
+
renderLink: v,
|
|
1456
|
+
href: y ? y(x.id, x) : void 0
|
|
1478
1457
|
},
|
|
1479
|
-
|
|
1458
|
+
x.id
|
|
1480
1459
|
);
|
|
1481
|
-
}) },
|
|
1460
|
+
}) }, k)
|
|
1482
1461
|
)) }),
|
|
1483
|
-
|
|
1484
|
-
/* @__PURE__ */
|
|
1485
|
-
|
|
1462
|
+
N && /* @__PURE__ */ S(T, { justifyItems: "center", gap: "small", padding: "small", "data-testid": "notes-pagination", children: [
|
|
1463
|
+
/* @__PURE__ */ s(
|
|
1464
|
+
V,
|
|
1486
1465
|
{
|
|
1487
1466
|
size: "small",
|
|
1488
|
-
screenReaderLabel:
|
|
1467
|
+
screenReaderLabel: H.previousPage,
|
|
1489
1468
|
"data-testid": "notes-prev-page",
|
|
1490
1469
|
interaction: o != null && o.hasPreviousPage ? "enabled" : "disabled",
|
|
1491
1470
|
onClick: r,
|
|
1492
|
-
children: /* @__PURE__ */
|
|
1471
|
+
children: /* @__PURE__ */ s(ot, {})
|
|
1493
1472
|
}
|
|
1494
1473
|
),
|
|
1495
|
-
/* @__PURE__ */
|
|
1496
|
-
|
|
1474
|
+
/* @__PURE__ */ s(
|
|
1475
|
+
V,
|
|
1497
1476
|
{
|
|
1498
1477
|
size: "small",
|
|
1499
|
-
screenReaderLabel:
|
|
1478
|
+
screenReaderLabel: H.nextPage,
|
|
1500
1479
|
"data-testid": "notes-next-page",
|
|
1501
1480
|
interaction: o != null && o.hasNextPage ? "enabled" : "disabled",
|
|
1502
|
-
onClick:
|
|
1503
|
-
children: /* @__PURE__ */
|
|
1481
|
+
onClick: i,
|
|
1482
|
+
children: /* @__PURE__ */ s(rt, {})
|
|
1504
1483
|
}
|
|
1505
1484
|
)
|
|
1506
1485
|
] })
|
|
1507
1486
|
] });
|
|
1508
|
-
},
|
|
1487
|
+
}, to = ({
|
|
1509
1488
|
noteText: n,
|
|
1510
1489
|
reaction: e,
|
|
1511
1490
|
highlightText: t,
|
|
1512
1491
|
highlightTheme: o,
|
|
1513
1492
|
onSave: r,
|
|
1514
|
-
onDelete:
|
|
1493
|
+
onDelete: i,
|
|
1515
1494
|
onTypeChange: l,
|
|
1516
1495
|
onBack: d,
|
|
1517
1496
|
editing: m = !1
|
|
1518
1497
|
}) => {
|
|
1519
|
-
const { translations: c } =
|
|
1520
|
-
return /* @__PURE__ */
|
|
1521
|
-
t != null ? /* @__PURE__ */
|
|
1522
|
-
/* @__PURE__ */
|
|
1523
|
-
g ? /* @__PURE__ */
|
|
1524
|
-
/* @__PURE__ */
|
|
1498
|
+
const { translations: c } = G(), [g, h] = B(m), [u, E] = B(n || ""), [f, v] = B(!1);
|
|
1499
|
+
return /* @__PURE__ */ S(T, { direction: "column", gap: "small", "data-testid": "single-note", children: [
|
|
1500
|
+
t != null ? /* @__PURE__ */ s(z, { as: "div", children: /* @__PURE__ */ s(U, { children: /* @__PURE__ */ s(he, { type: e, isCardActive: !0, theme: o, children: t }) }) }) : /* @__PURE__ */ s(Qe, {}),
|
|
1501
|
+
/* @__PURE__ */ s(Ve, { type: e, onTypeChange: l, renderAsMenuTrigger: !!l }),
|
|
1502
|
+
g ? /* @__PURE__ */ S(T, { direction: "column", gap: "x-small", children: [
|
|
1503
|
+
/* @__PURE__ */ s(
|
|
1525
1504
|
He,
|
|
1526
1505
|
{
|
|
1527
1506
|
label: c.addNoteOptional,
|
|
1528
1507
|
value: u,
|
|
1529
|
-
onChange: (
|
|
1508
|
+
onChange: (y) => E(y.target.value),
|
|
1530
1509
|
resize: "vertical"
|
|
1531
1510
|
}
|
|
1532
1511
|
),
|
|
1533
|
-
/* @__PURE__ */
|
|
1534
|
-
/* @__PURE__ */
|
|
1535
|
-
|
|
1512
|
+
/* @__PURE__ */ S(T, { gap: "xx-small", children: [
|
|
1513
|
+
/* @__PURE__ */ s(T.Item, { shouldGrow: !0, children: /* @__PURE__ */ s(
|
|
1514
|
+
$,
|
|
1536
1515
|
{
|
|
1537
1516
|
display: "block",
|
|
1538
1517
|
size: "small",
|
|
@@ -1543,8 +1522,8 @@ const xn = {
|
|
|
1543
1522
|
children: c.cancel
|
|
1544
1523
|
}
|
|
1545
1524
|
) }),
|
|
1546
|
-
/* @__PURE__ */
|
|
1547
|
-
|
|
1525
|
+
/* @__PURE__ */ s(T.Item, { shouldGrow: !0, children: /* @__PURE__ */ s(
|
|
1526
|
+
$,
|
|
1548
1527
|
{
|
|
1549
1528
|
display: "block",
|
|
1550
1529
|
color: "primary",
|
|
@@ -1557,25 +1536,25 @@ const xn = {
|
|
|
1557
1536
|
}
|
|
1558
1537
|
) })
|
|
1559
1538
|
] })
|
|
1560
|
-
] }) : /* @__PURE__ */
|
|
1561
|
-
n && /* @__PURE__ */
|
|
1562
|
-
/* @__PURE__ */
|
|
1563
|
-
/* @__PURE__ */
|
|
1539
|
+
] }) : /* @__PURE__ */ S(T, { direction: "column", gap: "small", children: [
|
|
1540
|
+
n && /* @__PURE__ */ S(z, { as: "div", children: [
|
|
1541
|
+
/* @__PURE__ */ s(ae, { level: "h4", margin: "0 0 xx-small 0", children: c.note }),
|
|
1542
|
+
/* @__PURE__ */ s(U, { children: n })
|
|
1564
1543
|
] }),
|
|
1565
|
-
/* @__PURE__ */
|
|
1566
|
-
/* @__PURE__ */
|
|
1567
|
-
|
|
1544
|
+
/* @__PURE__ */ S(T, { justifyItems: "space-between", children: [
|
|
1545
|
+
/* @__PURE__ */ s(
|
|
1546
|
+
$,
|
|
1568
1547
|
{
|
|
1569
1548
|
size: "small",
|
|
1570
|
-
renderIcon: /* @__PURE__ */
|
|
1549
|
+
renderIcon: /* @__PURE__ */ s(st, {}),
|
|
1571
1550
|
"data-testid": "single-note-back",
|
|
1572
1551
|
onClick: () => d == null ? void 0 : d(),
|
|
1573
1552
|
children: c.back
|
|
1574
1553
|
}
|
|
1575
1554
|
),
|
|
1576
|
-
/* @__PURE__ */
|
|
1577
|
-
|
|
1578
|
-
|
|
1555
|
+
/* @__PURE__ */ S(T, { gap: "xx-small", children: [
|
|
1556
|
+
i && /* @__PURE__ */ s(
|
|
1557
|
+
V,
|
|
1579
1558
|
{
|
|
1580
1559
|
size: "small",
|
|
1581
1560
|
withBackground: !1,
|
|
@@ -1583,12 +1562,12 @@ const xn = {
|
|
|
1583
1562
|
color: "danger",
|
|
1584
1563
|
screenReaderLabel: c.deleteNote,
|
|
1585
1564
|
"data-testid": "single-note-delete",
|
|
1586
|
-
onClick: () =>
|
|
1587
|
-
children: /* @__PURE__ */
|
|
1565
|
+
onClick: () => v(!0),
|
|
1566
|
+
children: /* @__PURE__ */ s(le, {})
|
|
1588
1567
|
}
|
|
1589
1568
|
),
|
|
1590
|
-
/* @__PURE__ */
|
|
1591
|
-
|
|
1569
|
+
/* @__PURE__ */ s(
|
|
1570
|
+
V,
|
|
1592
1571
|
{
|
|
1593
1572
|
size: "small",
|
|
1594
1573
|
withBackground: !1,
|
|
@@ -1596,33 +1575,33 @@ const xn = {
|
|
|
1596
1575
|
screenReaderLabel: c.editNote,
|
|
1597
1576
|
"data-testid": "single-note-edit",
|
|
1598
1577
|
onClick: () => h(!0),
|
|
1599
|
-
children: /* @__PURE__ */
|
|
1578
|
+
children: /* @__PURE__ */ s(fe, {})
|
|
1600
1579
|
}
|
|
1601
1580
|
)
|
|
1602
1581
|
] })
|
|
1603
1582
|
] }),
|
|
1604
|
-
f &&
|
|
1605
|
-
/* @__PURE__ */
|
|
1606
|
-
|
|
1583
|
+
f && i && /* @__PURE__ */ s(z, { as: "div", background: "primary", padding: "medium", borderRadius: "large", children: /* @__PURE__ */ S(T, { direction: "column", justifyItems: "center", alignItems: "center", gap: "x-small", children: [
|
|
1584
|
+
/* @__PURE__ */ s(
|
|
1585
|
+
$,
|
|
1607
1586
|
{
|
|
1608
1587
|
display: "block",
|
|
1609
1588
|
color: "danger",
|
|
1610
1589
|
size: "small",
|
|
1611
|
-
renderIcon: /* @__PURE__ */
|
|
1590
|
+
renderIcon: /* @__PURE__ */ s(le, {}),
|
|
1612
1591
|
"data-testid": "single-note-confirm-delete",
|
|
1613
1592
|
onClick: () => {
|
|
1614
|
-
|
|
1593
|
+
i(), v(!1);
|
|
1615
1594
|
},
|
|
1616
1595
|
children: c.deleteNote
|
|
1617
1596
|
}
|
|
1618
1597
|
),
|
|
1619
|
-
/* @__PURE__ */
|
|
1620
|
-
|
|
1598
|
+
/* @__PURE__ */ s(
|
|
1599
|
+
$,
|
|
1621
1600
|
{
|
|
1622
1601
|
display: "block",
|
|
1623
1602
|
size: "small",
|
|
1624
1603
|
"data-testid": "single-note-cancel-delete",
|
|
1625
|
-
onClick: () =>
|
|
1604
|
+
onClick: () => v(!1),
|
|
1626
1605
|
children: c.cancel
|
|
1627
1606
|
}
|
|
1628
1607
|
)
|
|
@@ -1631,25 +1610,26 @@ const xn = {
|
|
|
1631
1610
|
] });
|
|
1632
1611
|
};
|
|
1633
1612
|
export {
|
|
1634
|
-
|
|
1635
|
-
|
|
1613
|
+
Vn as ContentWithNoteWrapper,
|
|
1614
|
+
he as Highlight,
|
|
1636
1615
|
Qe as HighlightError,
|
|
1637
|
-
|
|
1638
|
-
|
|
1639
|
-
|
|
1640
|
-
|
|
1616
|
+
Cn as NoteCard,
|
|
1617
|
+
Ve as NoteChip,
|
|
1618
|
+
yn as NoteReactionMenu,
|
|
1619
|
+
In as NotebookEmptyState,
|
|
1620
|
+
Qn as NotebookProvider,
|
|
1641
1621
|
pn as NotebookTranslationsProvider,
|
|
1642
|
-
|
|
1643
|
-
|
|
1644
|
-
|
|
1645
|
-
|
|
1646
|
-
|
|
1622
|
+
Jn as NotebookTray,
|
|
1623
|
+
eo as NotesListView,
|
|
1624
|
+
w as REACTION_TYPE,
|
|
1625
|
+
to as SingleNote,
|
|
1626
|
+
Ie as createTransparentColor,
|
|
1647
1627
|
Dt as useCreateNote,
|
|
1648
|
-
|
|
1628
|
+
Lt as useDeleteNote,
|
|
1649
1629
|
$e as useGetNotes,
|
|
1650
1630
|
Xe as useNotebook,
|
|
1651
|
-
|
|
1631
|
+
G as useNotebookTranslations,
|
|
1652
1632
|
Yn as useNotesData,
|
|
1653
|
-
|
|
1654
|
-
|
|
1633
|
+
Zn as useReactionFilter,
|
|
1634
|
+
At as useUpdateNote
|
|
1655
1635
|
};
|