@instructure/platform-notebook 1.2.0 → 1.3.0

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