@instructure/platform-notebook 1.0.0 → 1.1.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";
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({
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
+ import { Text as U } from "@instructure/ui-text";
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 We = /* @__PURE__ */ ((t) => (t[t.FORWARDS = 1] = "FORWARDS", t[t.BACKWARDS = 2] = "BACKWARDS", t))(We || {});
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] = Ue(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
140
  return Ue(this.element, this.offset)[0];
141
- } catch (t) {
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 === We.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 += Ge(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 Ge = (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 += Ge(e), e = e.previousSibling;
326
+ return n;
327
+ }, Ue = (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,378 @@ 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));
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 e = document.getElementById(xe(t));
418
419
  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" });
420
+ const n = e.getBoundingClientRect();
421
+ n.top >= 0 && n.left >= 0 && n.bottom <= (window.innerHeight || document.documentElement.clientHeight) && n.right <= (window.innerWidth || document.documentElement.clientWidth) || e.scrollIntoView({ behavior: "smooth", block: "start" });
421
422
  }
422
- }, se = 90, ie = 172, vt = (n) => {
423
- const e = n.getClientRects();
423
+ }, ae = 90, ce = 172, wt = (t) => {
424
+ const e = t.getClientRects();
424
425
  if (!e.length)
425
426
  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;
427
+ 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) => {
428
+ const T = y + ce;
429
+ return y >= i && T <= l - i;
430
+ }, c = (y) => {
431
+ const T = y + ae;
432
+ return y >= i && T <= a - i;
432
433
  };
433
- let g;
434
- const m = t.right - ie;
435
- if (u(m))
436
- g = m;
434
+ let h;
435
+ const g = n.right - ce;
436
+ if (m(g))
437
+ h = g;
437
438
  else {
438
- const E = t.left;
439
- if (u(E))
440
- g = E;
439
+ const y = n.left;
440
+ if (m(y))
441
+ h = y;
441
442
  else {
442
- const N = (t.left + t.right) / 2 - ie / 2;
443
- u(N) ? g = N : m < i ? g = i : g = l - ie - i;
443
+ const N = (n.left + n.right) / 2 - ce / 2;
444
+ m(N) ? h = N : g < i ? h = i : h = l - ce - i;
444
445
  }
445
446
  }
446
- let f;
447
- const h = o.bottom + r;
448
- if (c(h))
449
- f = h;
447
+ let u;
448
+ const p = o.bottom + r;
449
+ if (c(p))
450
+ u = p;
450
451
  else {
451
- const E = t.top - se - r;
452
- c(E) ? f = E : h + se > a - i ? f = a - se - i : f = i;
452
+ const y = n.top - ae - r;
453
+ c(y) ? u = y : p + ae > a - i ? u = a - ae - i : u = i;
453
454
  }
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)
455
+ return { top: u, left: h };
456
+ }, kt = (t, e) => {
457
+ for (const n of e)
458
+ if (t.start < n.end && t.end > n.start)
458
459
  return !0;
459
460
  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;
461
+ }, 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) => {
462
+ const n = Number.parseInt(t.slice(1, 3), 16), o = Number.parseInt(t.slice(3, 5), 16), r = Number.parseInt(t.slice(5, 7), 16);
463
+ return `rgba(${n}, ${o}, ${r}, ${e})`;
464
+ }, Ot = (t, e) => {
465
+ var n;
465
466
  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;
467
+ const o = ((n = e.nodeValue) == null ? void 0 : n.length) ?? e.childNodes.length;
468
+ return t.comparePoint(e, 0) <= 0 && t.comparePoint(e, o) >= 0;
468
469
  } catch {
469
470
  return !1;
470
471
  }
471
- }, xt = (n) => {
472
+ }, Rt = (t) => {
472
473
  var i;
473
- if (n.collapsed)
474
+ if (t.collapsed)
474
475
  return [];
475
- let e = n.commonAncestorContainer;
476
+ let e = t.commonAncestorContainer;
476
477
  if (e && e.nodeType !== Node.ELEMENT_NODE && (e = e.parentElement), !e)
477
478
  return [];
478
- const t = [], o = (i = e == null ? void 0 : e.ownerDocument) == null ? void 0 : i.createNodeIterator(e, NodeFilter.SHOW_TEXT);
479
+ const n = [], o = (i = e == null ? void 0 : e.ownerDocument) == null ? void 0 : i.createNodeIterator(e, NodeFilter.SHOW_TEXT);
479
480
  let r = (o == null ? void 0 : o.nextNode()) || null;
480
481
  for (; r; ) {
481
- if (!wt(n, r)) {
482
+ if (!Ot(t, r)) {
482
483
  r = (o == null ? void 0 : o.nextNode()) || null;
483
484
  continue;
484
485
  }
485
486
  const l = r;
486
- if (l === n.startContainer && n.startOffset > 0) {
487
- l.splitText(n.startOffset), r = (o == null ? void 0 : o.nextNode()) || null;
487
+ if (l === t.startContainer && t.startOffset > 0) {
488
+ l.splitText(t.startOffset), r = (o == null ? void 0 : o.nextNode()) || null;
488
489
  continue;
489
490
  }
490
- l === n.endContainer && n.endOffset < l.data.length && l.splitText(n.endOffset), t.push(l), r = (o == null ? void 0 : o.nextNode()) || null;
491
+ l === t.endContainer && t.endOffset < l.data.length && l.splitText(t.endOffset), n.push(l), r = (o == null ? void 0 : o.nextNode()) || null;
491
492
  }
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);
493
+ return n;
494
+ }, Dt = (t, e, n) => {
495
+ if (t.collapsed) return;
496
+ const o = e.id ?? "", r = Ie(o);
497
+ if (document.getElementById(xe(o))) {
498
+ Pt(e, n);
498
499
  return;
499
500
  }
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);
501
+ 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");
502
+ 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";
503
+ const p = document.createElement("span");
504
+ p.id = qe(o), p.className = "highlight-marker-end", p.dataset.highlightId = o || "";
505
+ const y = t.cloneRange();
506
+ y.collapse(!1), y.insertNode(p);
507
+ const T = t.cloneRange();
508
+ T.collapse(!0), T.insertNode(u);
508
509
  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();
510
+ N.setStartAfter(u), N.setEndBefore(p);
511
+ const L = Rt(N).filter((b) => b.textContent && b.textContent.length > 0);
512
+ L.forEach((b, I) => {
513
+ var G;
514
+ const R = b.parentElement;
515
+ if ((R == null ? void 0 : R.dataset.highlightId) === o) return;
516
+ const C = I === 0, B = I === L.length - 1, x = L.length === 1;
517
+ let A;
518
+ x ? A = "single" : C ? A = "first" : B ? A = "last" : A = "middle";
519
+ const w = document.createElement("span");
520
+ 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) => {
521
+ var $;
522
+ te.target.tagName !== "A" && (($ = e.onClick) == null || $.call(e));
523
+ }), (G = b.parentNode) == null || G.insertBefore(w, b), w.appendChild(b);
524
+ }), u.addEventListener("click", (b) => {
525
+ var I;
526
+ b.target.tagName !== "A" && ((I = e.onClick) == null || I.call(e));
527
+ }), u.addEventListener("keydown", (b) => {
528
+ var I;
529
+ if (b.key === "Enter" || b.key === " ")
530
+ b.preventDefault(), (I = e.onClick) == null || I.call(e);
531
+ else if (b.key === "Tab" && !b.shiftKey) {
532
+ const R = document.querySelectorAll(se(o));
533
+ for (const C of R) {
534
+ const B = C.querySelector("a");
535
+ if (B) {
536
+ b.preventDefault(), B.focus();
536
537
  break;
537
538
  }
538
539
  }
539
540
  }
540
- }), f.addEventListener("focus", () => {
541
+ }), u.addEventListener("focus", () => {
541
542
  document.querySelectorAll(
542
- oe(o)
543
- ).forEach((C) => {
544
- C.classList.add("highlight-focused");
543
+ se(o)
544
+ ).forEach((I) => {
545
+ I.classList.add("highlight-focused");
545
546
  });
546
- }), f.addEventListener("blur", () => {
547
+ }), u.addEventListener("blur", () => {
547
548
  document.querySelectorAll(
548
- oe(o)
549
- ).forEach((C) => {
550
- C.classList.remove("highlight-focused");
549
+ se(o)
550
+ ).forEach((I) => {
551
+ I.classList.remove("highlight-focused");
551
552
  });
552
553
  });
553
554
  };
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);
555
+ function Pt(t, e) {
556
+ const n = t.type === k.IMPORTANT ? e.colors.importantBackground : e.colors.confusingBackground, r = t.id === t.selectedNoteId ? n : we(n, 0.5);
556
557
  document.querySelectorAll(
557
- oe(n.id ?? "")
558
+ se(t.id ?? "")
558
559
  ).forEach((l) => {
559
560
  l.style.backgroundColor = r;
560
561
  });
561
562
  }
562
- const Rt = (n) => {
563
- const e = n.id ?? "", t = document.getElementById(Ie(e)), o = document.getElementById(We(e));
563
+ const Lt = (t) => {
564
+ const e = t.id ?? "", n = document.getElementById(xe(e)), o = document.getElementById(qe(e));
564
565
  document.querySelectorAll(
565
- oe(e)
566
+ se(e)
566
567
  ).forEach((i) => {
567
568
  var l;
568
569
  for (; i.firstChild; )
569
570
  (l = i.parentNode) == null || l.insertBefore(i.firstChild, i);
570
571
  i.remove();
571
- }), t == null || t.remove(), o == null || o.remove();
572
- }, te = {
572
+ }), n == null || n.remove(), o == null || o.remove();
573
+ }, oe = {
573
574
  all: ["notebook"],
574
- notes: (n) => ["notebook", "notes", n]
575
+ notes: (t) => ["notebook", "notes", t]
575
576
  };
576
- function Dt(n) {
577
- const e = pe();
578
- return Ne({
579
- mutationFn: (t) => n.createNote(t),
577
+ function At(t) {
578
+ const e = be();
579
+ return Ee({
580
+ mutationFn: (n) => t.createNote(n),
580
581
  onSuccess: () => {
581
- e.invalidateQueries({ queryKey: te.all });
582
+ e.invalidateQueries({ queryKey: oe.all });
582
583
  }
583
584
  });
584
585
  }
585
- function Pt(n) {
586
- const e = pe();
587
- return Ne({
588
- mutationFn: (t) => n.deleteNote(t),
586
+ function Ft(t) {
587
+ const e = be();
588
+ return Ee({
589
+ mutationFn: (n) => t.deleteNote(n),
589
590
  onSuccess: () => {
590
- e.invalidateQueries({ queryKey: te.all });
591
+ e.invalidateQueries({ queryKey: oe.all });
591
592
  }
592
593
  });
593
594
  }
594
- function Ge({
595
- api: n,
595
+ function Ke({
596
+ api: t,
596
597
  enabled: e = !0,
597
- ...t
598
+ ...n
598
599
  }) {
599
- return et({
600
- queryKey: te.notes(t),
601
- queryFn: () => n.getNotes(t),
600
+ return ot({
601
+ queryKey: oe.notes(n),
602
+ queryFn: () => t.getNotes(n),
602
603
  enabled: e
603
604
  });
604
605
  }
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();
606
+ function _t(t) {
607
+ const e = be();
608
+ return Ee({
609
+ mutationFn: ({ id: n, input: o }) => t.updateNote(n, o),
610
+ onMutate: async ({ id: n, input: o }) => {
611
+ await e.cancelQueries({ queryKey: oe.all });
612
+ const i = e.getQueryCache().findAll({ queryKey: oe.all }), l = /* @__PURE__ */ new Map();
612
613
  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
614
+ const m = a.state.data;
615
+ m && (l.set(a.queryKey, m), e.setQueryData(a.queryKey, {
616
+ ...m,
617
+ notes: m.notes.map(
618
+ (c) => c.id === n ? { ...c, ...o, updatedAt: (/* @__PURE__ */ new Date()).toISOString() } : c
618
619
  )
619
620
  }));
620
621
  }
621
622
  return { previousData: l };
622
623
  },
623
- onError: (t, o, r) => {
624
+ onError: (n, o, r) => {
624
625
  if (r != null && r.previousData)
625
626
  for (const [i, l] of r.previousData)
626
627
  e.setQueryData(i, l);
627
628
  },
628
629
  onSettled: () => {
629
- e.invalidateQueries({ queryKey: te.all });
630
+ e.invalidateQueries({ queryKey: oe.all });
630
631
  }
631
632
  });
632
633
  }
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,
634
+ const Mt = "Notebook", Bt = "Notes", Ht = "Important", jt = "Unclear", zt = "Back", $t = "Edit note", Wt = "Save", Gt = "Cancel", Ut = "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 = {
635
+ notebook: Mt,
636
+ notes: Bt,
637
+ important: Ht,
638
+ unclear: jt,
639
+ back: zt,
640
+ editNote: $t,
641
+ save: Wt,
642
+ cancel: Gt,
642
643
  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;
644
+ note: qt,
645
+ addNotePrompt: Kt,
646
+ removeFromNotebook: Xt,
647
+ addNoteOptional: Qt,
648
+ markImportant: Vt,
649
+ markUnclear: Yt,
650
+ savedToNotebook: Zt,
651
+ noteUpdated: Jt,
652
+ noteDeleted: en,
653
+ errorSavingNote: tn,
654
+ errorUpdatingNote: nn,
655
+ noteDeletionFailed: on,
656
+ loadingNotes: rn,
657
+ failedToLoadNotes: sn,
658
+ emptyStateHeading: ln,
659
+ emptyStateDescription: an,
660
+ nothingHereYet: cn,
661
+ adjustFiltersOrCreate: dn,
662
+ noNotesForFilter: un,
663
+ previousPage: fn,
664
+ nextPage: mn,
665
+ allCourses: gn,
666
+ allNotes: hn,
667
+ closeNotebookPanel: pn,
668
+ featureDescription: Nn,
669
+ highlightUnavailable: yn
670
+ }, Xe = Be(null);
671
+ function Qe(t, e) {
672
+ const n = ke[t] ?? t;
673
+ return e ? n.replace(/%\{([^}]+)}/g, (o, r) => String(e[r] ?? `%{${r}}`)) : n;
673
674
  }
674
- function pn({
675
- translations: n,
675
+ function bn({
676
+ translations: t,
676
677
  translate: e,
677
- children: t
678
+ children: n
678
679
  }) {
679
- const o = re(
680
+ const o = ie(
680
681
  () => ({
681
- translations: { ...Ce, ...n },
682
- translate: e ?? qe
682
+ translations: { ...ke, ...t },
683
+ translate: e ?? Qe
683
684
  }),
684
- [n, e]
685
+ [t, e]
685
686
  );
686
- return /* @__PURE__ */ s($e.Provider, { value: o, children: t });
687
+ return /* @__PURE__ */ s(Xe.Provider, { value: o, children: n });
687
688
  }
688
- function K() {
689
- const n = _e($e);
690
- return n || { translations: Ce, translate: qe };
689
+ function Q() {
690
+ const t = He(Xe);
691
+ return t || { translations: ke, translate: Qe };
691
692
  }
692
- const Nn = (n) => ({
693
- selectedNoteId: n ?? null,
693
+ const En = (t) => ({
694
+ selectedNoteId: t ?? null,
694
695
  isNoteEditing: !1,
695
- isTrayOpen: n != null
696
+ isTrayOpen: t != null
696
697
  });
697
- function yn(n, e) {
698
+ function Sn(t, e) {
698
699
  switch (e.type) {
699
700
  case "SELECT_NOTE":
700
701
  return {
701
- ...n,
702
+ ...t,
702
703
  selectedNoteId: e.payload.id,
703
704
  isNoteEditing: e.payload.isEditing
704
705
  };
705
706
  case "CLEAR_SELECTED_NOTE":
706
- return { ...n, selectedNoteId: null, isNoteEditing: !1 };
707
+ return { ...t, selectedNoteId: null, isNoteEditing: !1 };
707
708
  case "SET_EDITING":
708
- return { ...n, isNoteEditing: e.payload };
709
+ return { ...t, isNoteEditing: e.payload };
709
710
  case "OPEN_TRAY":
710
- return { ...n, isTrayOpen: !0 };
711
+ return { ...t, isTrayOpen: !0 };
711
712
  case "CLOSE_TRAY":
712
- return { ...n, isTrayOpen: !1, selectedNoteId: null, isNoteEditing: !1 };
713
+ return { ...t, isTrayOpen: !1, selectedNoteId: null, isNoteEditing: !1 };
713
714
  default:
714
- return n;
715
+ return t;
715
716
  }
716
717
  }
717
- const Ke = Fe(null);
718
- function Vn({
719
- api: n,
718
+ const Ve = Be(null);
719
+ function Jn({
720
+ api: t,
720
721
  currentUserId: e,
721
- objectId: t,
722
+ objectId: n,
722
723
  objectType: o,
723
724
  courseId: r,
724
725
  pageLastModifiedAt: i,
725
726
  onAnalyticsEvent: l,
726
727
  onOpen: a,
727
- initialNoteId: u,
728
+ initialNoteId: m,
728
729
  translations: c,
729
- translate: g,
730
- children: m
730
+ translate: h,
731
+ children: g
731
732
  }) {
732
- const [f, h] = Me(yn, Nn(u)), E = V(u != null), S = re(
733
+ const [u, p] = je(Sn, En(m)), y = J(m != null), T = ie(
733
734
  () => ({
734
- api: n,
735
+ api: t,
735
736
  currentUserId: e,
736
- objectId: t,
737
+ objectId: n,
737
738
  objectType: o,
738
739
  courseId: r,
739
740
  pageLastModifiedAt: i,
740
741
  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 }),
742
+ ...u,
743
+ selectNote: (N, O = !1) => p({ type: "SELECT_NOTE", payload: { id: N, isEditing: O } }),
744
+ clearSelectedNote: () => p({ type: "CLEAR_SELECTED_NOTE" }),
745
+ setEditing: (N) => p({ type: "SET_EDITING", payload: N }),
745
746
  openTray: () => {
746
- E.current || (E.current = !0, a == null || a()), h({ type: "OPEN_TRAY" });
747
+ y.current || (y.current = !0, a == null || a()), p({ type: "OPEN_TRAY" });
747
748
  },
748
749
  closeTray: () => {
749
- E.current = !1, h({ type: "CLOSE_TRAY" });
750
+ y.current = !1, p({ type: "CLOSE_TRAY" });
750
751
  }
751
752
  }),
752
753
  [
753
- n,
754
- e,
755
754
  t,
755
+ e,
756
+ n,
756
757
  o,
757
758
  r,
758
759
  i,
759
760
  l,
760
761
  a,
761
- f
762
+ u
762
763
  ]
763
764
  );
764
- return /* @__PURE__ */ s(Ke.Provider, { value: S, children: /* @__PURE__ */ s(pn, { translations: c, translate: g, children: m }) });
765
+ return /* @__PURE__ */ s(Ve.Provider, { value: T, children: /* @__PURE__ */ s(bn, { translations: c, translate: h, children: g }) });
765
766
  }
766
- function Xe() {
767
- const n = _e(Ke);
768
- if (!n)
767
+ function Ye() {
768
+ const t = He(Ve);
769
+ if (!t)
769
770
  throw new Error("useNotebook must be used within a NotebookProvider");
770
- return n;
771
+ return t;
771
772
  }
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(
773
+ const Tn = ({ currentType: t, onSelectReaction: e }) => {
774
+ const { translations: n } = Q(), o = J(null), r = J(null);
775
+ return Z(() => {
776
+ t === k.CONFUSING && o.current ? o.current.focus() : t === k.IMPORTANT && r.current ? r.current.focus() : o.current && o.current.focus();
777
+ }, [t]), /* @__PURE__ */ s(
777
778
  z,
778
779
  {
779
780
  as: "div",
@@ -782,221 +783,225 @@ const bn = ({ currentType: n, onSelectReaction: e }) => {
782
783
  borderColor: "secondary",
783
784
  borderRadius: "medium",
784
785
  shadow: "resting",
785
- children: /* @__PURE__ */ I(ee, { children: [
786
- /* @__PURE__ */ I(
787
- ee.Item,
786
+ children: /* @__PURE__ */ E(ne, { children: [
787
+ /* @__PURE__ */ E(
788
+ ne.Item,
788
789
  {
789
790
  ref: o,
790
791
  onClick: () => e(k.CONFUSING),
791
792
  children: [
792
- /* @__PURE__ */ s(ye, { size: "x-small" }),
793
- ` ${t.markUnclear}`
793
+ /* @__PURE__ */ s(Se, { size: "x-small" }),
794
+ ` ${n.markUnclear}`
794
795
  ]
795
796
  }
796
797
  ),
797
- /* @__PURE__ */ I(
798
- ee.Item,
798
+ /* @__PURE__ */ E(
799
+ ne.Item,
799
800
  {
800
801
  ref: r,
801
802
  onClick: () => e(k.IMPORTANT),
802
803
  children: [
803
- /* @__PURE__ */ s(be, { size: "x-small" }),
804
- ` ${t.markImportant}`
804
+ /* @__PURE__ */ s(Te, { size: "x-small" }),
805
+ ` ${n.markImportant}`
805
806
  ]
806
807
  }
807
808
  )
808
809
  ] })
809
810
  }
810
811
  );
811
- }, ue = "notebook-inline-reaction-menu";
812
- function Yn({
813
- containerRef: n,
812
+ }, ge = "notebook-inline-reaction-menu";
813
+ function eo({
814
+ containerRef: t,
814
815
  highlightTheme: e,
815
- debounceTime: t = 500
816
+ debounceTime: n = 500,
817
+ onCreateError: o,
818
+ onUpdateError: r,
819
+ onDeleteError: i
816
820
  }) {
817
821
  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,
822
+ api: l,
823
+ objectId: a,
824
+ objectType: m,
825
+ courseId: c,
826
+ pageLastModifiedAt: h,
827
+ selectedNoteId: g,
828
+ selectNote: u,
829
+ openTray: p
830
+ } = Ye(), { data: y } = Ke({
831
+ api: l,
828
832
  filter: {
829
- learningObject: { type: i, id: r }
833
+ learningObject: { type: m, id: a }
830
834
  },
831
- courseId: l,
835
+ courseId: c,
832
836
  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);
837
+ }), { 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), [G, te] = H(!1);
838
+ Z(() => {
839
+ const D = t.current;
840
+ if (!D) return;
841
+ const f = D.closest(".user_content") ?? D;
842
+ if (f.classList.contains("enhanced")) {
843
+ te(!0);
840
844
  return;
841
845
  }
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();
846
+ const F = new MutationObserver((_) => {
847
+ for (const M of _)
848
+ if (M.type === "attributes" && M.attributeName === "class" && M.target.classList.contains("enhanced")) {
849
+ te(!0), F.disconnect();
846
850
  return;
847
851
  }
848
852
  });
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("");
853
+ return F.observe(f, { attributes: !0, attributeFilter: ["class"] }), () => F.disconnect();
854
+ }, [t]), Z(() => {
855
+ if (!G || !t.current) return;
856
+ let f = null;
857
+ const F = () => {
858
+ f && clearTimeout(f), f = setTimeout(() => {
859
+ var Re;
860
+ const v = window.getSelection(), P = t.current;
861
+ if (!(v != null && v.rangeCount) || !P) return;
862
+ const W = v.toString().trim();
863
+ if (W === "") return;
864
+ const V = v.getRangeAt(0);
865
+ if (!P.contains(V.commonAncestorContainer)) return;
866
+ const Oe = (Re = Y.fromRange(P, V)) == null ? void 0 : Re.toSelector();
867
+ Oe && !kt(Oe, b) && (C(V.cloneRange()), x(W), w(wt(V)));
868
+ }, n);
869
+ }, _ = (v) => {
870
+ if (!(v.target instanceof Node)) return;
871
+ const P = document.getElementById(ge);
872
+ P != null && P.contains(v.target) ? (v.preventDefault(), v.stopImmediatePropagation()) : (w(null), C(null), x(""));
873
+ }, M = () => {
874
+ w(null), C(null), x("");
871
875
  };
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);
876
+ return document.addEventListener("selectionchange", F), document.addEventListener("mousedown", _), document.addEventListener("touchstart", _), window.addEventListener("scroll", M, !0), () => {
877
+ f && clearTimeout(f), document.removeEventListener("selectionchange", F), document.removeEventListener("mousedown", _), document.removeEventListener("touchstart", _), window.removeEventListener("scroll", M, !0);
874
878
  };
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],
879
+ }, [G, b, n, t]);
880
+ const $ = q(
881
+ (D) => {
882
+ var W;
883
+ const f = t.current;
884
+ if (!f || !D.highlightData) return null;
885
+ const { highlightData: F, reaction: _, id: M } = D, { range: v } = F, P = v && ((W = ee.fromSelector(f, v)) == null ? void 0 : W.toRange());
886
+ if (P) {
887
+ const V = {
888
+ id: M,
889
+ selectedNoteId: g,
890
+ type: _[0],
887
891
  onClick: () => {
888
- c(p), g();
892
+ u(M), p();
889
893
  }
890
894
  };
891
- return kt(A, J, e), _.textPosition;
895
+ return Dt(P, V, e), F.textPosition;
892
896
  }
893
897
  return null;
894
898
  },
895
- [n, u, e, c, g]
899
+ [t, g, e, u, p]
896
900
  );
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([]);
901
+ Z(() => {
902
+ if (!G || !y || !t.current) return;
903
+ const D = t.current, f = y.notes, F = /* @__PURE__ */ new Set(), _ = [], M = [];
904
+ if (f.length === 0) {
905
+ if (L.current.length > 0) {
906
+ for (const v of L.current)
907
+ _e(v, D);
908
+ L.current = [], I([]);
905
909
  }
906
910
  return;
907
911
  }
908
- if (a && b[0].highlightData.pageLastModifiedAt !== a) {
909
- const { notesForUpdate: T, noteIdsForDelete: A } = Tt(
910
- R,
911
- b,
912
- a
912
+ if (h && f[0].highlightData.pageLastModifiedAt !== h) {
913
+ const { notesForUpdate: v, noteIdsForDelete: P } = It(
914
+ D,
915
+ f,
916
+ h
913
917
  );
914
- for (const U of T)
915
- h({ id: U.id, input: U });
916
- for (const U of A)
917
- E(U);
918
+ for (const W of v)
919
+ N({ id: W.id, input: W }).catch((V) => r == null ? void 0 : r(V));
920
+ for (const W of P)
921
+ O(W, { onError: i });
918
922
  } else {
919
- for (const T of b) {
920
- const A = P(T);
921
- _.add(T.id), A && (L.push(T), p.push(A));
923
+ for (const v of f) {
924
+ const P = $(v);
925
+ F.add(v.id), P && (_.push(v), M.push(P));
922
926
  }
923
- for (const T of S.current)
924
- _.has(T.id) || Le(T, R);
925
- D(p), S.current = L, u && It(u);
927
+ for (const v of L.current)
928
+ F.has(v.id) || _e(v, D);
929
+ I(M), L.current = _, g && xt(g);
926
930
  }
927
931
  }, [
928
- x,
929
- m,
930
- P,
931
- a,
932
- n,
932
+ G,
933
+ y,
934
+ $,
933
935
  h,
934
- E,
935
- u
936
+ t,
937
+ N,
938
+ O,
939
+ g
936
940
  ]);
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(
941
+ const le = (D) => {
942
+ const f = t.current;
943
+ if (!R || !f) return;
944
+ const F = ee.fromRange(f, R), _ = Y.fromRange(f, R);
945
+ T(
942
946
  {
943
- courseId: l,
944
- objectId: r,
945
- objectType: i,
947
+ courseId: c,
948
+ objectId: a,
949
+ objectType: m,
946
950
  userText: "",
947
- reaction: [R],
951
+ reaction: [D],
948
952
  highlightData: {
949
- selectedText: C,
950
- textPosition: (L == null ? void 0 : L.toSelector()) ?? null,
951
- range: _.toSelector(),
952
- pageLastModifiedAt: a ?? ""
953
+ selectedText: B,
954
+ textPosition: (_ == null ? void 0 : _.toSelector()) ?? null,
955
+ range: F.toSelector(),
956
+ pageLastModifiedAt: h ?? ""
953
957
  }
954
958
  },
955
959
  {
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
- }
960
+ onSuccess: (M) => {
961
+ var P;
962
+ const v = M.id;
963
+ C(null), x(""), w(null), (P = window.getSelection()) == null || P.removeAllRanges(), u(v), p();
964
+ },
965
+ onError: o
961
966
  }
962
967
  );
963
968
  };
964
- return !M || !w ? null : Ze(
969
+ return !R || !A ? null : tt(
965
970
  /* @__PURE__ */ s(
966
971
  "div",
967
972
  {
968
- id: ue,
973
+ id: ge,
969
974
  role: "toolbar",
970
975
  style: {
971
976
  position: "fixed",
972
977
  zIndex: 100,
973
- top: w.top,
974
- left: w.left,
978
+ top: A.top,
979
+ left: A.left,
975
980
  whiteSpace: "nowrap"
976
981
  },
977
- onBlur: (R) => {
978
- const b = document.getElementById(ue);
979
- b != null && b.contains(R.relatedTarget) || (F(null), y(null), O(""));
982
+ onBlur: (D) => {
983
+ const f = document.getElementById(ge);
984
+ f != null && f.contains(D.relatedTarget) || (w(null), C(null), x(""));
980
985
  },
981
- children: /* @__PURE__ */ s(bn, { onSelectReaction: Z })
986
+ children: /* @__PURE__ */ s(Tn, { onSelectReaction: le })
982
987
  }
983
988
  ),
984
989
  document.body
985
990
  );
986
991
  }
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,
992
+ const vn = (t, e) => ({
993
+ backgroundColor: t === k.IMPORTANT ? e.colors.importantBackground : e.colors.confusingBackground,
994
+ underlineColor: t === k.IMPORTANT ? e.colors.importantUnderline : e.colors.confusingUnderline,
995
+ underlineStyle: t === k.IMPORTANT ? "solid" : "dashed"
996
+ }), ye = ({
997
+ children: t,
993
998
  type: e = k.IMPORTANT,
994
- isCardActive: t = !0,
999
+ isCardActive: n = !0,
995
1000
  theme: o
996
1001
  }) => {
997
- const r = En(e, o), l = {
1002
+ const r = vn(e, o), l = {
998
1003
  position: "relative",
999
- backgroundColor: t ? r.backgroundColor : ve(r.backgroundColor, 0.5),
1004
+ backgroundColor: n ? r.backgroundColor : we(r.backgroundColor, 0.5),
1000
1005
  textDecorationLine: "underline",
1001
1006
  textDecorationStyle: r.underlineStyle,
1002
1007
  textDecorationColor: r.underlineColor,
@@ -1004,245 +1009,245 @@ const En = (n, e) => ({
1004
1009
  textUnderlineOffset: o.underlineOffset,
1005
1010
  lineHeight: "normal"
1006
1011
  };
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 }) })
1012
+ return /* @__PURE__ */ s("span", { "data-note-highlight": "true", style: l, children: t });
1013
+ }, Ze = () => {
1014
+ const { translations: t } = Q();
1015
+ return /* @__PURE__ */ E(S, { gap: "xx-small", alignItems: "start", as: "div", children: [
1016
+ /* @__PURE__ */ s(S.Item, { as: "div", children: /* @__PURE__ */ s(rt, { color: "error" }) }),
1017
+ /* @__PURE__ */ s(S.Item, { padding: "xxx-small none", shouldShrink: !0, children: /* @__PURE__ */ s(Ne, { maxLines: 3, children: t.highlightUnavailable }) })
1013
1018
  ] });
1014
- }, Sn = {
1019
+ }, Cn = {
1015
1020
  filter: null,
1016
1021
  courseFilter: null,
1017
1022
  currentPage: 1,
1018
1023
  totalPages: void 0
1019
1024
  };
1020
- function le(n, e) {
1021
- const t = typeof e == "number" ? Math.min(e, n) : n;
1022
- return Math.max(1, t);
1025
+ function de(t, e) {
1026
+ const n = typeof e == "number" ? Math.min(e, t) : t;
1027
+ return Math.max(1, n);
1023
1028
  }
1024
- function Tn(n, e) {
1029
+ function In(t, e) {
1025
1030
  switch (e.type) {
1026
1031
  case "SET_FILTER":
1027
- return { ...n, filter: e.payload, currentPage: 1 };
1032
+ return { ...t, filter: e.payload, currentPage: 1 };
1028
1033
  case "SET_COURSE_FILTER":
1029
- return { ...n, courseFilter: e.payload, currentPage: 1 };
1034
+ return { ...t, courseFilter: e.payload, currentPage: 1 };
1030
1035
  case "SET_PAGE":
1031
- return { ...n, currentPage: le(e.payload, n.totalPages) };
1036
+ return { ...t, currentPage: de(e.payload, t.totalPages) };
1032
1037
  case "INCREMENT_PAGE":
1033
- return { ...n, currentPage: le(n.currentPage + 1, n.totalPages) };
1038
+ return { ...t, currentPage: de(t.currentPage + 1, t.totalPages) };
1034
1039
  case "DECREMENT_PAGE":
1035
- return { ...n, currentPage: le(n.currentPage - 1, n.totalPages) };
1040
+ return { ...t, currentPage: de(t.currentPage - 1, t.totalPages) };
1036
1041
  case "SET_TOTAL_PAGES":
1037
- return n.totalPages === e.payload ? n : {
1038
- ...n,
1042
+ return t.totalPages === e.payload ? t : {
1043
+ ...t,
1039
1044
  totalPages: e.payload,
1040
- currentPage: le(n.currentPage, e.payload)
1045
+ currentPage: de(t.currentPage, e.payload)
1041
1046
  };
1042
1047
  default:
1043
- return n;
1048
+ return t;
1044
1049
  }
1045
1050
  }
1046
- function Zn({
1047
- api: n,
1051
+ function to({
1052
+ api: t,
1048
1053
  courseId: e,
1049
- enableCourseFilter: t = !1,
1054
+ enableCourseFilter: n = !1,
1050
1055
  learningObject: o,
1051
1056
  pageSize: r = 16
1052
1057
  }) {
1053
- const [i, l] = Me(Tn, Sn), { filter: a, courseFilter: u, currentPage: c, totalPages: g } = i;
1054
- Q(() => {
1058
+ const [i, l] = je(In, Cn), { filter: a, courseFilter: m, currentPage: c, totalPages: h } = i;
1059
+ Z(() => {
1055
1060
  l({ type: "SET_PAGE", payload: 1 });
1056
1061
  }, [r]);
1057
- const m = t ? u : e, f = (c - 1) * r, { data: h, isLoading: E, isError: S } = Ge({
1058
- api: n,
1062
+ const g = n ? m : e, u = (c - 1) * r, { data: p, isLoading: y, isError: T } = Ke({
1063
+ api: t,
1059
1064
  filter: {
1060
- ...m ? { courseId: m } : {},
1065
+ ...g ? { courseId: g } : {},
1061
1066
  ...a ? { reactions: [a] } : {},
1062
1067
  ...o ? { learningObject: o } : {}
1063
1068
  },
1064
- offset: f,
1069
+ offset: u,
1065
1070
  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) => {
1071
+ }), N = (p == null ? void 0 : p.notes) ?? [], O = p == null ? void 0 : p.pageInfo, L = (O == null ? void 0 : O.totalNrOfPages) ?? void 0;
1072
+ Z(() => {
1073
+ l({ type: "SET_TOTAL_PAGES", payload: L });
1074
+ }, [L]);
1075
+ const b = q((x) => {
1071
1076
  l({ type: "SET_PAGE", payload: x });
1072
- }, []), C = G(() => {
1077
+ }, []), I = q(() => {
1073
1078
  l({
1074
1079
  type: "INCREMENT_PAGE"
1075
1080
  /* IncrementPage */
1076
1081
  });
1077
- }, []), O = G(() => {
1082
+ }, []), R = q(() => {
1078
1083
  l({
1079
1084
  type: "DECREMENT_PAGE"
1080
1085
  /* DecrementPage */
1081
1086
  });
1082
- }, []), w = G((x) => {
1087
+ }, []), C = q((x) => {
1083
1088
  l({ type: "SET_FILTER", payload: x });
1084
- }, []), F = G((x) => {
1089
+ }, []), B = q((x) => {
1085
1090
  l({ type: "SET_COURSE_FILTER", payload: x });
1086
1091
  }, []);
1087
1092
  return {
1088
1093
  notes: N,
1089
- pageInfo: D,
1090
- isLoading: E,
1091
- isError: S,
1094
+ pageInfo: O,
1095
+ isLoading: y,
1096
+ isError: T,
1092
1097
  filter: a,
1093
- courseFilter: u,
1098
+ courseFilter: m,
1094
1099
  currentPage: c,
1095
- totalPages: g,
1096
- setFilter: w,
1097
- setCourseFilter: F,
1098
- setPage: y,
1099
- fetchNextPage: C,
1100
- fetchPreviousPage: O
1100
+ totalPages: h,
1101
+ setFilter: C,
1102
+ setCourseFilter: B,
1103
+ setPage: b,
1104
+ fetchNextPage: I,
1105
+ fetchPreviousPage: R
1101
1106
  };
1102
1107
  }
1103
- const fe = "all";
1104
- function Jn({ filter: n, setFilter: e }) {
1105
- const { translations: t } = K(), o = re(
1108
+ const he = "all";
1109
+ function no({ filter: t, setFilter: e }) {
1110
+ const { translations: n } = Q(), o = ie(
1106
1111
  () => [
1107
- { label: t.allNotes, value: fe },
1108
- { label: t.important, value: k.IMPORTANT },
1109
- { label: t.unclear, value: k.CONFUSING }
1112
+ { label: n.allNotes, value: he },
1113
+ { label: n.important, value: k.IMPORTANT },
1114
+ { label: n.unclear, value: k.CONFUSING }
1110
1115
  ],
1111
- [t]
1112
- ), r = G(
1116
+ [n]
1117
+ ), r = q(
1113
1118
  (l, { value: a }) => {
1114
- e(!a || a === fe ? null : a);
1119
+ e(!a || a === he ? null : a);
1115
1120
  },
1116
1121
  [e]
1117
1122
  );
1118
1123
  return {
1119
- filterElement: re(
1124
+ filterElement: ie(
1120
1125
  () => /* @__PURE__ */ s(
1121
- ke,
1126
+ De,
1122
1127
  {
1123
- renderLabel: /* @__PURE__ */ s(Be, { children: t.notes }),
1124
- value: n ?? fe,
1128
+ renderLabel: /* @__PURE__ */ s(ze, { children: n.notes }),
1129
+ value: t ?? he,
1125
1130
  onChange: r,
1126
- children: o.map((l) => /* @__PURE__ */ s(ke.Option, { id: l.value, value: l.value, children: l.label }, l.value))
1131
+ children: o.map((l) => /* @__PURE__ */ s(De.Option, { id: l.value, value: l.value, children: l.label }, l.value))
1127
1132
  }
1128
1133
  ),
1129
- [n, o, r, t.notes]
1134
+ [t, o, r, n.notes]
1130
1135
  ),
1131
1136
  reactionFilterOptions: o,
1132
1137
  handleReactionFilterChange: r
1133
1138
  };
1134
1139
  }
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 }),
1140
- /* @__PURE__ */ s(W, { color: "secondary", children: o })
1140
+ const xn = ({ hasActiveFilter: t = !1 }) => {
1141
+ const { translations: e } = Q(), n = t ? e.nothingHereYet : e.emptyStateHeading, o = t ? e.adjustFiltersOrCreate : e.emptyStateDescription;
1142
+ return /* @__PURE__ */ s(z, { as: "div", textAlign: "center", children: /* @__PURE__ */ E(S, { direction: "column", alignItems: "center", gap: "small", children: [
1143
+ !t && /* @__PURE__ */ s(st, { size: "medium" }),
1144
+ /* @__PURE__ */ s(fe, { level: "h3", children: n }),
1145
+ /* @__PURE__ */ s(U, { color: "secondary", children: o })
1141
1146
  ] }) });
1142
- }, eo = ({ children: n }) => {
1143
- const { isTrayOpen: e, closeTray: t } = Xe(), { translations: o } = K();
1147
+ }, oo = ({ children: t }) => {
1148
+ const { isTrayOpen: e, closeTray: n } = Ye(), { translations: o } = Q();
1144
1149
  return /* @__PURE__ */ s(
1145
- st,
1150
+ at,
1146
1151
  {
1147
1152
  label: o.notebook,
1148
1153
  open: e,
1149
- onDismiss: t,
1154
+ onDismiss: n,
1150
1155
  placement: "end",
1151
1156
  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 }),
1157
+ children: /* @__PURE__ */ E(S, { direction: "column", height: "100vh", children: [
1158
+ /* @__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: [
1159
+ /* @__PURE__ */ s(fe, { level: "h3", children: o.notebook }),
1155
1160
  /* @__PURE__ */ s(
1156
- rt,
1161
+ lt,
1157
1162
  {
1158
1163
  screenReaderLabel: o.closeNotebookPanel,
1159
- onClick: t,
1164
+ onClick: n,
1160
1165
  size: "small",
1161
1166
  "data-testid": "notebook-tray-close"
1162
1167
  }
1163
1168
  )
1164
1169
  ] }) }) }),
1165
- /* @__PURE__ */ s(v.Item, { shouldGrow: !0, shouldShrink: !0, overflowY: "auto", overflowX: "hidden", children: n })
1170
+ /* @__PURE__ */ s(S.Item, { shouldGrow: !0, shouldShrink: !0, overflowY: "auto", overflowX: "hidden", children: t })
1166
1171
  ] })
1167
1172
  }
1168
1173
  );
1169
- }, vn = {
1174
+ }, wn = {
1170
1175
  [k.IMPORTANT]: {
1171
1176
  color: "success",
1172
1177
  translationKey: "important",
1173
- icon: /* @__PURE__ */ s(be, { size: "x-small" })
1178
+ icon: /* @__PURE__ */ s(Te, { size: "x-small" })
1174
1179
  },
1175
1180
  [k.CONFUSING]: {
1176
1181
  color: "danger",
1177
1182
  translationKey: "unclear",
1178
- icon: /* @__PURE__ */ s(ye, { size: "x-small" })
1183
+ icon: /* @__PURE__ */ s(Se, { size: "x-small" })
1179
1184
  }
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);
1185
+ }, Je = ({ type: t, onTypeChange: e, renderAsMenuTrigger: n = !1 }) => {
1186
+ const { translations: o } = Q(), r = wn[t], i = o[r.translationKey], [l, a] = H(!1), m = J(null), c = J(null), h = q(
1187
+ (g) => {
1188
+ e == null || e(g), a(!1);
1184
1189
  },
1185
1190
  [e]
1186
1191
  );
1187
- return t && e ? /* @__PURE__ */ I(
1188
- ee,
1192
+ return n && e ? /* @__PURE__ */ E(
1193
+ ne,
1189
1194
  {
1190
1195
  placement: "bottom start",
1191
1196
  show: l,
1192
- onToggle: (m) => a(m),
1197
+ onToggle: (g) => a(g),
1193
1198
  shouldHideOnSelect: !0,
1194
1199
  shouldFocusTriggerOnClose: !0,
1195
- trigger: /* @__PURE__ */ s(Oe, { color: r.color, renderIcon: r.icon, children: i }),
1200
+ trigger: /* @__PURE__ */ s(Pe, { color: r.color, renderIcon: r.icon, children: i }),
1196
1201
  children: [
1197
- /* @__PURE__ */ I(ee.Item, { ref: u, onClick: () => g(k.CONFUSING), children: [
1198
- /* @__PURE__ */ s(ye, { size: "x-small" }),
1202
+ /* @__PURE__ */ E(ne.Item, { ref: m, onClick: () => h(k.CONFUSING), children: [
1203
+ /* @__PURE__ */ s(Se, { size: "x-small" }),
1199
1204
  ` ${o.markUnclear}`
1200
1205
  ] }),
1201
- /* @__PURE__ */ I(ee.Item, { ref: c, onClick: () => g(k.IMPORTANT), children: [
1202
- /* @__PURE__ */ s(be, { size: "x-small" }),
1206
+ /* @__PURE__ */ E(ne.Item, { ref: c, onClick: () => h(k.IMPORTANT), children: [
1207
+ /* @__PURE__ */ s(Te, { size: "x-small" }),
1203
1208
  ` ${o.markImportant}`
1204
1209
  ] })
1205
1210
  ]
1206
1211
  }
1207
- ) : /* @__PURE__ */ s(z, { display: "inline-flex", children: /* @__PURE__ */ s(Oe, { color: r.color, renderIcon: r.icon, children: i }) });
1212
+ ) : /* @__PURE__ */ s(z, { display: "inline-flex", children: /* @__PURE__ */ s(Pe, { color: r.color, renderIcon: r.icon, children: i }) });
1208
1213
  };
1209
- function Ae(n, e) {
1210
- return (n instanceof Date ? n : new Date(n)).toLocaleString(e, {
1214
+ function Me(t, e) {
1215
+ return (t instanceof Date ? t : new Date(t)).toLocaleString(e, {
1211
1216
  year: "numeric",
1212
1217
  month: "short",
1213
1218
  day: "numeric"
1214
1219
  });
1215
1220
  }
1216
- const Cn = ({
1217
- noteId: n,
1221
+ const kn = ({
1222
+ noteId: t,
1218
1223
  date: e,
1219
- highlight: t,
1224
+ highlight: n,
1220
1225
  note: o,
1221
1226
  type: r,
1222
1227
  onClick: i,
1223
1228
  onDelete: l,
1224
1229
  onSaveNote: a,
1225
- onTypeChange: u,
1230
+ onTypeChange: m,
1226
1231
  isActive: c,
1227
- isPanelView: g = !1,
1228
- courseName: m,
1229
- locale: f,
1230
- highlightTheme: h,
1231
- renderLink: E,
1232
- href: S
1232
+ isPanelView: h = !1,
1233
+ courseName: g,
1234
+ locale: u,
1235
+ highlightTheme: p,
1236
+ renderLink: y,
1237
+ href: T
1233
1238
  }) => {
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;
1239
+ 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) => {
1240
+ A.current = f;
1236
1241
  }, []);
1237
- Q(() => {
1238
- var p, T;
1239
- c && ((p = B.current) == null || p.scrollIntoView({ behavior: "smooth", block: "nearest" }), (T = B.current) == null || T.focus());
1242
+ Z(() => {
1243
+ var f, F;
1244
+ c && ((f = A.current) == null || f.scrollIntoView({ behavior: "smooth", block: "nearest" }), (F = A.current) == null || F.focus());
1240
1245
  }, [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(
1246
+ const G = r === k.IMPORTANT ? N.important : N.unclear, te = (f) => {
1247
+ f.key === "Enter" && (f.preventDefault(), i == null || i());
1248
+ }, $ = [G, N.note];
1249
+ n && $.push(n), o && $.push(o), e && $.push(Me(e, u)), g && $.push(g);
1250
+ const le = $.join(", "), D = /* @__PURE__ */ E(
1246
1251
  z,
1247
1252
  {
1248
1253
  as: "div",
@@ -1250,140 +1255,140 @@ const Cn = ({
1250
1255
  borderRadius: "medium",
1251
1256
  padding: "small",
1252
1257
  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,
1258
+ role: T || b ? void 0 : "button",
1259
+ "aria-label": T ? void 0 : le,
1260
+ "aria-pressed": T || b ? void 0 : c,
1261
+ tabIndex: T || c ? -1 : 0,
1262
+ "data-testid": `note-card-${t}`,
1263
+ elementRef: w,
1259
1264
  onClick: c ? void 0 : i,
1260
- onMouseEnter: () => M(!0),
1261
- onMouseLeave: () => M(!1),
1262
- onKeyDown: c ? void 0 : R,
1263
- cursor: y ? "default" : "pointer",
1265
+ onMouseEnter: () => L(!0),
1266
+ onMouseLeave: () => L(!1),
1267
+ onKeyDown: c ? void 0 : te,
1268
+ cursor: b ? "default" : "pointer",
1264
1269
  children: [
1265
- /* @__PURE__ */ I(v, { direction: "column", gap: "small", children: [
1270
+ /* @__PURE__ */ E(S, { direction: "column", gap: "small", children: [
1266
1271
  /* @__PURE__ */ s(
1267
- Ve,
1272
+ Je,
1268
1273
  {
1269
1274
  type: r,
1270
- onTypeChange: g && u ? (p) => u(n, p) : void 0,
1271
- renderAsMenuTrigger: g && !!u && !!c
1275
+ onTypeChange: h && m ? (f) => m(t, f) : void 0,
1276
+ renderAsMenuTrigger: h && !!m && !!c
1272
1277
  }
1273
1278
  ),
1274
- t ? /* @__PURE__ */ s("div", { style: { wordBreak: "break-word", overflowWrap: "break-word" }, children: /* @__PURE__ */ s(W, { children: c && g ? /* @__PURE__ */ s(
1275
- he,
1279
+ n ? /* @__PURE__ */ s("div", { style: { wordBreak: "break-word", overflowWrap: "break-word" }, children: /* @__PURE__ */ s(U, { children: c && h ? /* @__PURE__ */ s(
1280
+ ye,
1276
1281
  {
1277
1282
  type: r,
1278
- isCardActive: !!c || D,
1279
- theme: h,
1280
- children: t
1283
+ isCardActive: !!c || O,
1284
+ theme: p,
1285
+ children: n
1281
1286
  }
1282
- ) : /* @__PURE__ */ s(ge, { maxLines: 3, truncate: "word", children: /* @__PURE__ */ s(
1283
- he,
1287
+ ) : /* @__PURE__ */ s(Ne, { maxLines: 3, truncate: "word", children: /* @__PURE__ */ s(
1288
+ ye,
1284
1289
  {
1285
1290
  type: r,
1286
- isCardActive: !!c || D,
1287
- theme: h,
1288
- children: t
1291
+ isCardActive: !!c || O,
1292
+ theme: p,
1293
+ children: n
1289
1294
  }
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: [
1295
+ ) }) }) }) : /* @__PURE__ */ s(Ze, {}),
1296
+ /* @__PURE__ */ E(S, { direction: "column", gap: "small", children: [
1297
+ b && h ? /* @__PURE__ */ E(S, { direction: "column", gap: "x-small", children: [
1293
1298
  /* @__PURE__ */ s(
1294
- He,
1299
+ $e,
1295
1300
  {
1296
- label: /* @__PURE__ */ s(Be, { children: N.editNote }),
1297
- value: O,
1298
- onChange: (p) => w(p.target.value),
1301
+ label: /* @__PURE__ */ s(ze, { children: N.editNote }),
1302
+ value: R,
1303
+ onChange: (f) => C(f.target.value),
1299
1304
  placeholder: N.addNoteOptional
1300
1305
  }
1301
1306
  ),
1302
- /* @__PURE__ */ I(v, { gap: "xx-small", children: [
1303
- /* @__PURE__ */ s(v.Item, { shouldGrow: !0, children: /* @__PURE__ */ s(
1304
- $,
1307
+ /* @__PURE__ */ E(S, { gap: "xx-small", children: [
1308
+ /* @__PURE__ */ s(S.Item, { shouldGrow: !0, children: /* @__PURE__ */ s(
1309
+ K,
1305
1310
  {
1306
1311
  display: "block",
1307
1312
  size: "small",
1308
- "data-testid": "note-card-cancel",
1313
+ "data-testid": `note-card-${t}-cancel`,
1309
1314
  onClick: () => {
1310
- w(o || ""), C(!1);
1315
+ C(o || ""), I(!1);
1311
1316
  },
1312
1317
  children: N.cancel
1313
1318
  }
1314
1319
  ) }),
1315
- /* @__PURE__ */ s(v.Item, { shouldGrow: !0, children: /* @__PURE__ */ s(
1316
- $,
1320
+ /* @__PURE__ */ s(S.Item, { shouldGrow: !0, children: /* @__PURE__ */ s(
1321
+ K,
1317
1322
  {
1318
1323
  display: "block",
1319
1324
  color: "primary",
1320
1325
  size: "small",
1321
- "data-testid": "note-card-save",
1326
+ "data-testid": `note-card-${t}-save`,
1322
1327
  onClick: () => {
1323
- a == null || a(n, O), C(!1);
1328
+ a == null || a(t, R), I(!1);
1324
1329
  },
1325
- interaction: O.trim() ? "enabled" : "disabled",
1330
+ interaction: R.trim() ? "enabled" : "disabled",
1326
1331
  children: N.save
1327
1332
  }
1328
1333
  ) })
1329
1334
  ] })
1330
- ] }) : o ? /* @__PURE__ */ s("div", { style: { wordBreak: "break-word", overflowWrap: "break-word" }, children: c && g ? /* @__PURE__ */ I(W, { children: [
1335
+ ] }) : o ? /* @__PURE__ */ s("div", { style: { wordBreak: "break-word", overflowWrap: "break-word" }, children: c && h ? /* @__PURE__ */ E(U, { children: [
1331
1336
  o,
1332
1337
  " ",
1333
1338
  /* @__PURE__ */ s(
1334
- ne,
1339
+ re,
1335
1340
  {
1336
1341
  size: "small",
1337
1342
  withBackground: !1,
1338
1343
  withBorder: !1,
1339
1344
  screenReaderLabel: N.editNote,
1340
- "data-testid": "note-card-edit",
1341
- onClick: (p) => {
1342
- p.stopPropagation(), C(!0);
1345
+ "data-testid": `note-card-${t}-edit`,
1346
+ onClick: (f) => {
1347
+ f.stopPropagation(), I(!0);
1343
1348
  },
1344
- children: /* @__PURE__ */ s(me, {})
1349
+ children: /* @__PURE__ */ s(pe, {})
1345
1350
  }
1346
1351
  )
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: [
1352
+ ] }) : /* @__PURE__ */ s(U, { children: /* @__PURE__ */ s(Ne, { maxLines: 3, truncate: "word", children: o }) }) }) : h && c ? /* @__PURE__ */ s("div", { children: /* @__PURE__ */ E(U, { color: "secondary", children: [
1348
1353
  N.addNotePrompt,
1349
1354
  " ",
1350
1355
  /* @__PURE__ */ s(
1351
- ne,
1356
+ re,
1352
1357
  {
1353
1358
  size: "small",
1354
1359
  withBackground: !1,
1355
1360
  withBorder: !1,
1356
1361
  screenReaderLabel: N.editNote,
1357
- "data-testid": "note-card-edit",
1358
- onClick: (p) => {
1359
- p.stopPropagation(), C(!0);
1362
+ "data-testid": `note-card-${t}-edit`,
1363
+ onClick: (f) => {
1364
+ f.stopPropagation(), I(!0);
1360
1365
  },
1361
- children: /* @__PURE__ */ s(me, {})
1366
+ children: /* @__PURE__ */ s(pe, {})
1362
1367
  }
1363
1368
  )
1364
1369
  ] }) }) : null,
1365
- /* @__PURE__ */ I(v, { justifyItems: "space-between", alignItems: "center", children: [
1366
- /* @__PURE__ */ s(W, { size: "small", color: "secondary", children: Ae(e, f) }),
1370
+ /* @__PURE__ */ E(S, { justifyItems: "space-between", alignItems: "center", children: [
1371
+ /* @__PURE__ */ s(U, { size: "small", color: "secondary", children: Me(e, u) }),
1367
1372
  c && l && /* @__PURE__ */ s(
1368
- ne,
1373
+ re,
1369
1374
  {
1370
1375
  size: "small",
1371
1376
  withBackground: !1,
1372
1377
  withBorder: !1,
1373
1378
  color: "danger",
1374
1379
  screenReaderLabel: N.deleteNote,
1375
- "data-testid": "note-card-delete",
1376
- onClick: (p) => {
1377
- p.stopPropagation(), x(!0);
1380
+ "data-testid": `note-card-${t}-delete`,
1381
+ onClick: (f) => {
1382
+ f.stopPropagation(), x(!0);
1378
1383
  },
1379
- children: /* @__PURE__ */ s(ae, {})
1384
+ children: /* @__PURE__ */ s(ue, {})
1380
1385
  }
1381
1386
  )
1382
1387
  ] }),
1383
- m && /* @__PURE__ */ s(W, { size: "small", color: "secondary", children: m })
1388
+ g && /* @__PURE__ */ s(U, { size: "small", color: "secondary", children: g })
1384
1389
  ] })
1385
1390
  ] }),
1386
- F && l && /* @__PURE__ */ s(
1391
+ B && l && /* @__PURE__ */ s(
1387
1392
  z,
1388
1393
  {
1389
1394
  as: "div",
@@ -1396,8 +1401,8 @@ const Cn = ({
1396
1401
  insetInlineStart: "0",
1397
1402
  insetInlineEnd: "0",
1398
1403
  stacking: "above",
1399
- children: /* @__PURE__ */ I(
1400
- v,
1404
+ children: /* @__PURE__ */ E(
1405
+ S,
1401
1406
  {
1402
1407
  direction: "column",
1403
1408
  justifyItems: "center",
@@ -1406,27 +1411,27 @@ const Cn = ({
1406
1411
  height: "100%",
1407
1412
  children: [
1408
1413
  /* @__PURE__ */ s(
1409
- $,
1414
+ K,
1410
1415
  {
1411
1416
  display: "block",
1412
1417
  color: "danger",
1413
1418
  size: "small",
1414
- renderIcon: /* @__PURE__ */ s(ae, {}),
1415
- "data-testid": "note-card-confirm-delete",
1416
- onClick: (p) => {
1417
- p.stopPropagation(), l(n), x(!1);
1419
+ renderIcon: /* @__PURE__ */ s(ue, {}),
1420
+ "data-testid": `note-card-${t}-confirm-delete`,
1421
+ onClick: (f) => {
1422
+ f.stopPropagation(), l(t), x(!1);
1418
1423
  },
1419
1424
  children: N.deleteNote
1420
1425
  }
1421
1426
  ),
1422
1427
  /* @__PURE__ */ s(
1423
- $,
1428
+ K,
1424
1429
  {
1425
1430
  display: "block",
1426
1431
  size: "small",
1427
- "data-testid": "note-card-cancel-delete",
1428
- onClick: (p) => {
1429
- p.stopPropagation(), x(!1);
1432
+ "data-testid": `note-card-${t}-cancel-delete`,
1433
+ onClick: (f) => {
1434
+ f.stopPropagation(), x(!1);
1430
1435
  },
1431
1436
  children: N.cancel
1432
1437
  }
@@ -1439,168 +1444,168 @@ const Cn = ({
1439
1444
  ]
1440
1445
  }
1441
1446
  );
1442
- return S && E ? E({ href: S, children: L, ariaLabel: _ }) : L;
1447
+ return T && y ? y({ href: T, children: D, ariaLabel: le }) : D;
1443
1448
  };
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;
1449
+ function On(t, e) {
1450
+ const n = Array.from({ length: e }, () => []);
1451
+ return t.forEach((o, r) => {
1452
+ n[r % e].push(o);
1453
+ }), n;
1449
1454
  }
1450
- const xn = {
1455
+ const Rn = {
1451
1456
  display: "flex",
1452
1457
  gap: "1rem",
1453
1458
  boxSizing: "border-box",
1454
1459
  width: "100%",
1455
1460
  alignItems: "flex-start"
1456
- }, kn = {
1461
+ }, Dn = {
1457
1462
  display: "flex",
1458
1463
  flexDirection: "column",
1459
1464
  gap: "1rem",
1460
1465
  flex: 1,
1461
1466
  minWidth: 0
1462
- }, to = ({
1463
- notes: n,
1467
+ }, ro = ({
1468
+ notes: t,
1464
1469
  isLoading: e,
1465
- isError: t,
1470
+ isError: n,
1466
1471
  currentPage: o,
1467
1472
  totalPages: r,
1468
1473
  onPageChange: i,
1469
1474
  onNoteSelect: l,
1470
1475
  onNoteDelete: a,
1471
- onNoteSave: u,
1476
+ onNoteSave: m,
1472
1477
  onNoteTypeChange: c,
1473
- selectedNoteId: g,
1474
- hasActiveFilter: m = !1,
1475
- columnCount: f = 1,
1476
- highlightTheme: h,
1477
- locale: E,
1478
- renderNoteLink: S,
1478
+ selectedNoteId: h,
1479
+ hasActiveFilter: g = !1,
1480
+ columnCount: u = 1,
1481
+ highlightTheme: p,
1482
+ locale: y,
1483
+ renderNoteLink: T,
1479
1484
  noteHref: N
1480
1485
  }) => {
1481
- const { translations: D } = K(), M = re(
1482
- () => wn(n, f),
1483
- [n, f]
1486
+ const { translations: O } = Q(), L = ie(
1487
+ () => On(t, u),
1488
+ [t, u]
1484
1489
  );
1485
1490
  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) => (
1491
+ return /* @__PURE__ */ s(z, { as: "div", textAlign: "center", padding: "large", "data-testid": "notes-loading", children: /* @__PURE__ */ s(dt, { renderTitle: O.loadingNotes }) });
1492
+ if (n)
1493
+ return /* @__PURE__ */ s(z, { as: "div", textAlign: "center", padding: "large", "data-testid": "notes-error", children: /* @__PURE__ */ s(fe, { level: "h4", children: O.failedToLoadNotes }) });
1494
+ if (t.length === 0)
1495
+ return /* @__PURE__ */ s(z, { as: "div", padding: "large", "data-testid": "empty-notes", children: /* @__PURE__ */ s(xn, { hasActiveFilter: g }) });
1496
+ const b = typeof o == "number" && typeof r == "number" && r > 1 && i !== void 0;
1497
+ return /* @__PURE__ */ E(et, { children: [
1498
+ /* @__PURE__ */ s("div", { style: Rn, "data-testid": "notes-grid", children: L.map((I, R) => (
1494
1499
  // 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;
1500
+ /* @__PURE__ */ s("div", { style: Dn, children: I.map((C) => {
1501
+ var B;
1497
1502
  return /* @__PURE__ */ s(
1498
- Cn,
1503
+ kn,
1499
1504
  {
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,
1505
+ noteId: C.id,
1506
+ date: C.createdAt,
1507
+ type: C.reaction[0] ?? k.IMPORTANT,
1508
+ highlight: (B = C.highlightData) == null ? void 0 : B.selectedText,
1509
+ note: C.userText,
1510
+ isActive: h === C.id,
1511
+ isPanelView: !!h,
1512
+ onClick: l ? () => l(C.id) : void 0,
1508
1513
  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
1514
+ onSaveNote: m ? (x, A) => m(x, A) : void 0,
1515
+ onTypeChange: c ? (x, A) => c(x, A) : void 0,
1516
+ highlightTheme: p,
1517
+ locale: y,
1518
+ renderLink: T,
1519
+ href: N ? N(C.id, C) : void 0
1515
1520
  },
1516
- w.id
1521
+ C.id
1517
1522
  );
1518
- }) }, O)
1523
+ }) }, R)
1519
1524
  )) }),
1520
- y && /* @__PURE__ */ s(v, { justifyItems: "center", padding: "small", "data-testid": "notes-pagination", children: /* @__PURE__ */ s(v.Item, { children: /* @__PURE__ */ s(
1521
- it,
1525
+ b && /* @__PURE__ */ s(S, { justifyItems: "center", padding: "small", "data-testid": "notes-pagination", children: /* @__PURE__ */ s(S.Item, { children: /* @__PURE__ */ s(
1526
+ ct,
1522
1527
  {
1523
1528
  as: "nav",
1524
1529
  variant: "input",
1525
- labelNext: D.nextPage,
1526
- labelPrev: D.previousPage,
1530
+ labelNext: O.nextPage,
1531
+ labelPrev: O.previousPage,
1527
1532
  currentPage: o,
1528
1533
  totalPageNumber: r,
1529
1534
  onPageChange: i
1530
1535
  }
1531
1536
  ) }) })
1532
1537
  ] });
1533
- }, no = ({
1534
- noteText: n,
1538
+ }, so = ({
1539
+ noteText: t,
1535
1540
  reaction: e,
1536
- highlightText: t,
1541
+ highlightText: n,
1537
1542
  highlightTheme: o,
1538
1543
  onSave: r,
1539
1544
  onDelete: i,
1540
1545
  onTypeChange: l,
1541
1546
  onBack: a,
1542
- editing: u = !1
1547
+ editing: m = !1
1543
1548
  }) => {
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: [
1549
+ const { translations: c } = Q(), [h, g] = H(m), [u, p] = H(t || ""), [y, T] = H(!1);
1550
+ return /* @__PURE__ */ E(S, { direction: "column", gap: "small", "data-testid": "single-note", children: [
1551
+ n != null ? /* @__PURE__ */ s(z, { as: "div", children: /* @__PURE__ */ s(U, { children: /* @__PURE__ */ s(ye, { type: e, isCardActive: !0, theme: o, children: n }) }) }) : /* @__PURE__ */ s(Ze, {}),
1552
+ /* @__PURE__ */ s(Je, { type: e, onTypeChange: l, renderAsMenuTrigger: !!l }),
1553
+ h ? /* @__PURE__ */ E(S, { direction: "column", gap: "x-small", children: [
1549
1554
  /* @__PURE__ */ s(
1550
- He,
1555
+ $e,
1551
1556
  {
1552
1557
  label: c.addNoteOptional,
1553
- value: f,
1554
- onChange: (N) => h(N.target.value),
1558
+ value: u,
1559
+ onChange: (N) => p(N.target.value),
1555
1560
  resize: "vertical"
1556
1561
  }
1557
1562
  ),
1558
- /* @__PURE__ */ I(v, { gap: "xx-small", children: [
1559
- /* @__PURE__ */ s(v.Item, { shouldGrow: !0, children: /* @__PURE__ */ s(
1560
- $,
1563
+ /* @__PURE__ */ E(S, { gap: "xx-small", children: [
1564
+ /* @__PURE__ */ s(S.Item, { shouldGrow: !0, children: /* @__PURE__ */ s(
1565
+ K,
1561
1566
  {
1562
1567
  display: "block",
1563
1568
  size: "small",
1564
1569
  "data-testid": "single-note-cancel",
1565
1570
  onClick: () => {
1566
- h(n || ""), m(!1);
1571
+ p(t || ""), g(!1);
1567
1572
  },
1568
1573
  children: c.cancel
1569
1574
  }
1570
1575
  ) }),
1571
- /* @__PURE__ */ s(v.Item, { shouldGrow: !0, children: /* @__PURE__ */ s(
1572
- $,
1576
+ /* @__PURE__ */ s(S.Item, { shouldGrow: !0, children: /* @__PURE__ */ s(
1577
+ K,
1573
1578
  {
1574
1579
  display: "block",
1575
1580
  color: "primary",
1576
1581
  size: "small",
1577
1582
  "data-testid": "single-note-save",
1578
1583
  onClick: () => {
1579
- r(f), m(!1);
1584
+ r(u), g(!1);
1580
1585
  },
1581
1586
  children: c.save
1582
1587
  }
1583
1588
  ) })
1584
1589
  ] })
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 })
1590
+ ] }) : /* @__PURE__ */ E(S, { direction: "column", gap: "small", children: [
1591
+ t && /* @__PURE__ */ E(z, { as: "div", children: [
1592
+ /* @__PURE__ */ s(fe, { level: "h4", margin: "0 0 xx-small 0", children: c.note }),
1593
+ /* @__PURE__ */ s(U, { children: t })
1589
1594
  ] }),
1590
- /* @__PURE__ */ I(v, { justifyItems: "space-between", children: [
1595
+ /* @__PURE__ */ E(S, { justifyItems: "space-between", children: [
1591
1596
  /* @__PURE__ */ s(
1592
- $,
1597
+ K,
1593
1598
  {
1594
1599
  size: "small",
1595
- renderIcon: /* @__PURE__ */ s(ot, {}),
1600
+ renderIcon: /* @__PURE__ */ s(it, {}),
1596
1601
  "data-testid": "single-note-back",
1597
1602
  onClick: () => a == null ? void 0 : a(),
1598
1603
  children: c.back
1599
1604
  }
1600
1605
  ),
1601
- /* @__PURE__ */ I(v, { gap: "xx-small", children: [
1606
+ /* @__PURE__ */ E(S, { gap: "xx-small", children: [
1602
1607
  i && /* @__PURE__ */ s(
1603
- ne,
1608
+ re,
1604
1609
  {
1605
1610
  size: "small",
1606
1611
  withBackground: !1,
@@ -1608,46 +1613,46 @@ const xn = {
1608
1613
  color: "danger",
1609
1614
  screenReaderLabel: c.deleteNote,
1610
1615
  "data-testid": "single-note-delete",
1611
- onClick: () => S(!0),
1612
- children: /* @__PURE__ */ s(ae, {})
1616
+ onClick: () => T(!0),
1617
+ children: /* @__PURE__ */ s(ue, {})
1613
1618
  }
1614
1619
  ),
1615
1620
  /* @__PURE__ */ s(
1616
- ne,
1621
+ re,
1617
1622
  {
1618
1623
  size: "small",
1619
1624
  withBackground: !1,
1620
1625
  withBorder: !1,
1621
1626
  screenReaderLabel: c.editNote,
1622
1627
  "data-testid": "single-note-edit",
1623
- onClick: () => m(!0),
1624
- children: /* @__PURE__ */ s(me, {})
1628
+ onClick: () => g(!0),
1629
+ children: /* @__PURE__ */ s(pe, {})
1625
1630
  }
1626
1631
  )
1627
1632
  ] })
1628
1633
  ] }),
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: [
1634
+ 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
1635
  /* @__PURE__ */ s(
1631
- $,
1636
+ K,
1632
1637
  {
1633
1638
  display: "block",
1634
1639
  color: "danger",
1635
1640
  size: "small",
1636
- renderIcon: /* @__PURE__ */ s(ae, {}),
1641
+ renderIcon: /* @__PURE__ */ s(ue, {}),
1637
1642
  "data-testid": "single-note-confirm-delete",
1638
1643
  onClick: () => {
1639
- i(), S(!1);
1644
+ i(), T(!1);
1640
1645
  },
1641
1646
  children: c.deleteNote
1642
1647
  }
1643
1648
  ),
1644
1649
  /* @__PURE__ */ s(
1645
- $,
1650
+ K,
1646
1651
  {
1647
1652
  display: "block",
1648
1653
  size: "small",
1649
1654
  "data-testid": "single-note-cancel-delete",
1650
- onClick: () => S(!1),
1655
+ onClick: () => T(!1),
1651
1656
  children: c.cancel
1652
1657
  }
1653
1658
  )
@@ -1656,26 +1661,26 @@ const xn = {
1656
1661
  ] });
1657
1662
  };
1658
1663
  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,
1664
+ eo as ContentWithNoteWrapper,
1665
+ ye as Highlight,
1666
+ Ze as HighlightError,
1667
+ kn as NoteCard,
1668
+ Je as NoteChip,
1669
+ Tn as NoteReactionMenu,
1670
+ xn as NotebookEmptyState,
1671
+ Jn as NotebookProvider,
1672
+ bn as NotebookTranslationsProvider,
1673
+ oo as NotebookTray,
1674
+ ro as NotesListView,
1670
1675
  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
1676
+ so as SingleNote,
1677
+ we as createTransparentColor,
1678
+ At as useCreateNote,
1679
+ Ft as useDeleteNote,
1680
+ Ke as useGetNotes,
1681
+ Ye as useNotebook,
1682
+ Q as useNotebookTranslations,
1683
+ to as useNotesData,
1684
+ no as useReactionFilter,
1685
+ _t as useUpdateNote
1681
1686
  };