@instructure/platform-notebook 1.0.0 → 1.2.0

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