@instructure/platform-notebook 1.6.0 → 1.6.2

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