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