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