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