@instructure/platform-notebook 1.3.1 → 1.4.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.
@@ -1 +1 @@
1
- {"version":3,"file":"NoteChip.d.ts","sourceRoot":"","sources":["../src/NoteChip.tsx"],"names":[],"mappings":"AAMA,OAAO,EAAE,aAAa,EAAE,MAAM,SAAS,CAAA;AAEvC,MAAM,MAAM,aAAa,GAAG;IAC1B,IAAI,EAAE,aAAa,CAAA;IACnB,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,aAAa,KAAK,IAAI,CAAA;IAC5C,mBAAmB,CAAC,EAAE,OAAO,CAAA;CAC9B,CAAA;AAeD,eAAO,MAAM,QAAQ,GAAI,6CAAqD,aAAa,4CAkD1F,CAAA"}
1
+ {"version":3,"file":"NoteChip.d.ts","sourceRoot":"","sources":["../src/NoteChip.tsx"],"names":[],"mappings":"AAMA,OAAO,EAAE,aAAa,EAAE,MAAM,SAAS,CAAA;AAEvC,MAAM,MAAM,aAAa,GAAG;IAC1B,IAAI,EAAE,aAAa,CAAA;IACnB,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,aAAa,KAAK,IAAI,CAAA;IAC5C,mBAAmB,CAAC,EAAE,OAAO,CAAA;CAC9B,CAAA;AAeD,eAAO,MAAM,QAAQ,GAAI,6CAAqD,aAAa,4CAwE1F,CAAA"}
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { jsx as i, jsxs as S, Fragment as nt } from "react/jsx-runtime";
2
- import { createContext as $e, useMemo as ae, useContext as ze, useReducer as Ue, useRef as J, useEffect as Z, useState as z, useCallback as q } from "react";
2
+ import { createContext as Ue, useMemo as ae, useContext as $e, useReducer as ze, useRef as J, useEffect as Q, useState as $, useCallback as q } from "react";
3
3
  import { createPortal as ot } from "react-dom";
4
4
  import { z as d } from "zod";
5
5
  import rt from "diff-match-patch";
@@ -103,7 +103,7 @@ d.object({
103
103
  deleteNote: d.string()
104
104
  });
105
105
  var qe = /* @__PURE__ */ ((t) => (t[t.FORWARDS = 1] = "FORWARDS", t[t.BACKWARDS = 2] = "BACKWARDS", t))(qe || {});
106
- class Q {
106
+ class V {
107
107
  constructor(e, n) {
108
108
  this.start = e, this.end = n;
109
109
  }
@@ -121,17 +121,17 @@ class Q {
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 = U.fromPoint(e.startContainer, e.startOffset), o = U.fromPoint(e.endContainer, e.endOffset);
125
- return !n || !o ? null : new Q(n, o);
124
+ const n = z.fromPoint(e.startContainer, e.startOffset), o = z.fromPoint(e.endContainer, e.endOffset);
125
+ return !n || !o ? null : new V(n, o);
126
126
  }
127
127
  static fromOffsets(e, n, o) {
128
- return new Q(new U(e, n), new U(e, o));
128
+ return new V(new z(e, n), new z(e, o));
129
129
  }
130
130
  relativeTo(e) {
131
- return new Q(this.start.relativeTo(e), this.end.relativeTo(e));
131
+ return new V(this.start.relativeTo(e), this.end.relativeTo(e));
132
132
  }
133
133
  }
134
- class U {
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
  }
@@ -153,9 +153,9 @@ class U {
153
153
  static fromCharOffset(e, n) {
154
154
  switch (e.nodeType) {
155
155
  case Node.TEXT_NODE:
156
- return U.fromPoint(e, n);
156
+ return z.fromPoint(e, n);
157
157
  case Node.ELEMENT_NODE:
158
- return new U(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,7 +168,7 @@ class U {
168
168
  if (!e.parentElement)
169
169
  return console.error("Text node has no parent"), null;
170
170
  const o = Be(e) + n;
171
- return new U(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)
@@ -176,7 +176,7 @@ class U {
176
176
  let o = 0;
177
177
  for (let r = 0; r < n; r++)
178
178
  o += Ke(e.childNodes[r]);
179
- return new U(e, o);
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 U {
188
188
  let n = this.element, o = this.offset;
189
189
  for (; n !== e; )
190
190
  o += Be(n), n.parentElement && (n = n.parentElement);
191
- return new U(n, o);
191
+ return new z(n, o);
192
192
  }
193
193
  }
194
194
  const bt = (t) => {
@@ -268,10 +268,10 @@ class ne {
268
268
  const r = Me(n.endContainer, e);
269
269
  if (!r)
270
270
  return console.error("Failed to resolve endContainer XPath"), null;
271
- const s = U.fromCharOffset(o, n.startOffset), l = U.fromCharOffset(r, n.endOffset);
271
+ const s = z.fromCharOffset(o, n.startOffset), l = z.fromCharOffset(r, n.endOffset);
272
272
  if (!s || !l)
273
273
  return null;
274
- const a = new Q(s, l).toRange();
274
+ const a = new V(s, l).toRange();
275
275
  return a ? new ne(e, a) : null;
276
276
  }
277
277
  toRange() {
@@ -279,7 +279,7 @@ class ne {
279
279
  }
280
280
  toSelector() {
281
281
  var s;
282
- const e = (s = Q.fromRange(this.range)) == null ? void 0 : s.toRange(), n = e && Q.fromRange(e), o = n && Fe(n.start.element, this.root), r = n && Fe(n.end.element, this.root);
282
+ const e = (s = V.fromRange(this.range)) == null ? void 0 : s.toRange(), n = e && V.fromRange(e), o = n && Fe(n.start.element, this.root), r = n && Fe(n.end.element, this.root);
283
283
  return !o || !r ? null : {
284
284
  startContainer: o,
285
285
  startOffset: n.start.offset,
@@ -294,7 +294,7 @@ class ee {
294
294
  }
295
295
  static fromRange(e, n) {
296
296
  var r;
297
- const o = (r = Q.fromRange(n)) == null ? void 0 : r.relativeTo(e);
297
+ const o = (r = V.fromRange(n)) == null ? void 0 : r.relativeTo(e);
298
298
  return o ? new ee(e, o.start.offset, o.end.offset) : null;
299
299
  }
300
300
  static fromSelector(e, n) {
@@ -307,7 +307,7 @@ class ee {
307
307
  };
308
308
  }
309
309
  toRange() {
310
- return Q.fromOffsets(this.root, this.start, this.end).toRange();
310
+ return V.fromOffsets(this.root, this.start, this.end).toRange();
311
311
  }
312
312
  }
313
313
  const Ke = (t) => {
@@ -348,16 +348,16 @@ const Ke = (t) => {
348
348
  if (e.length > 32) {
349
349
  const l = e.slice(0, 32), a = e.slice(-32), f = o - n;
350
350
  let c = r.match_main(s, l, n);
351
- const m = r.match_main(s, a, o), h = m + a.length;
351
+ const m = r.match_main(s, a, o), g = m + a.length;
352
352
  if (c === -1 || m === -1)
353
353
  return null;
354
- const u = h - c, N = Math.abs(u - f);
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 Ct(t, c, h, f);
357
- if (c < h && N <= 5)
354
+ const u = g - c, p = Math.abs(u - f);
355
+ if ((c > g || p > 5) && (r.Match_Distance = e.length + 100, c = r.match_main(s, l, g), c !== -1 && c < g))
356
+ return Ct(t, c, g, f);
357
+ if (c < g && p <= 5)
358
358
  return ee.fromSelector(t, {
359
359
  start: c,
360
- end: h
360
+ end: g
361
361
  });
362
362
  } else {
363
363
  const l = r.match_main(s, e, n);
@@ -434,25 +434,25 @@ const Ke = (t) => {
434
434
  return y >= s && E <= a - s;
435
435
  };
436
436
  let m;
437
- const h = n.right - ue;
438
- if (f(h))
439
- m = h;
437
+ const g = n.right - ue;
438
+ if (f(g))
439
+ m = g;
440
440
  else {
441
441
  const y = n.left;
442
442
  if (f(y))
443
443
  m = y;
444
444
  else {
445
- const p = (n.left + n.right) / 2 - ue / 2;
446
- f(p) ? m = p : h < s ? m = s : m = l - ue - s;
445
+ const N = (n.left + n.right) / 2 - ue / 2;
446
+ f(N) ? m = N : g < s ? m = s : m = l - ue - s;
447
447
  }
448
448
  }
449
449
  let u;
450
- const N = o.bottom + r;
451
- if (c(N))
452
- u = N;
450
+ const p = o.bottom + r;
451
+ if (c(p))
452
+ u = p;
453
453
  else {
454
454
  const y = n.top - de - r;
455
- c(y) ? u = y : N + de > a - s ? u = a - de - s : u = s;
455
+ c(y) ? u = y : p + de > a - s ? u = a - de - s : u = s;
456
456
  }
457
457
  return { top: u, left: m };
458
458
  }, Rt = (t, e) => {
@@ -471,7 +471,7 @@ const Ke = (t) => {
471
471
  } catch {
472
472
  return !1;
473
473
  }
474
- }, Dt = (t) => {
474
+ }, Lt = (t) => {
475
475
  var s;
476
476
  if (t.collapsed)
477
477
  return [];
@@ -493,35 +493,35 @@ const Ke = (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
- }, Lt = (t, e, n) => {
496
+ }, Dt = (t, e, n) => {
497
497
  if (t.collapsed) return;
498
498
  const o = e.id ?? "", r = ke(o);
499
499
  if (document.getElementById(Oe(o))) {
500
500
  At(e, n);
501
501
  return;
502
502
  }
503
- const l = e.type === k.IMPORTANT ? n.colors.importantBackground : n.colors.confusingBackground, f = e.id === e.selectedNoteId ? l : Re(l, 0.5), c = e.type === k.IMPORTANT ? n.colors.importantUnderline : n.colors.confusingUnderline, m = e.type === k.IMPORTANT ? "solid" : "dashed", h = 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", 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";
505
- const N = document.createElement("span");
506
- N.id = Qe(o), N.className = "highlight-marker-end", N.dataset.highlightId = o || "";
503
+ const l = e.type === k.IMPORTANT ? n.colors.importantBackground : n.colors.confusingBackground, f = e.id === e.selectedNoteId ? l : Re(l, 0.5), c = e.type === k.IMPORTANT ? n.colors.importantUnderline : n.colors.confusingUnderline, m = e.type === k.IMPORTANT ? "solid" : "dashed", g = t.toString(), u = document.createElement("span");
504
+ u.id = `${r}-start`, u.className = "highlight-marker-start", u.dataset.highlightId = o || "", u.setAttribute("role", "button"), u.setAttribute("tabindex", "0"), u.setAttribute("aria-label", g), u.style.position = "relative", u.style.fontSize = "0", u.style.lineHeight = "0", u.style.width = "0", u.style.height = "0", u.style.margin = "0", u.style.padding = "0", u.style.border = "0";
505
+ const p = document.createElement("span");
506
+ p.id = Qe(o), p.className = "highlight-marker-end", p.dataset.highlightId = o || "";
507
507
  const y = t.cloneRange();
508
- y.collapse(!1), y.insertNode(N);
508
+ y.collapse(!1), y.insertNode(p);
509
509
  const E = t.cloneRange();
510
510
  E.collapse(!0), E.insertNode(u);
511
- const p = document.createRange();
512
- p.setStartAfter(u), p.setEndBefore(N);
513
- const w = Dt(p).filter((b) => b.textContent && b.textContent.length > 0);
511
+ const N = document.createRange();
512
+ N.setStartAfter(u), N.setEndBefore(p);
513
+ const w = Lt(N).filter((b) => b.textContent && b.textContent.length > 0);
514
514
  w.forEach((b, C) => {
515
515
  var W;
516
516
  const O = b.parentElement;
517
517
  if ((O == null ? void 0 : O.dataset.highlightId) === o) return;
518
- const I = C === 0, B = C === w.length - 1, L = w.length === 1;
518
+ const I = C === 0, B = C === w.length - 1, D = w.length === 1;
519
519
  let P;
520
- L ? P = "single" : I ? P = "first" : B ? P = "last" : P = "middle";
520
+ D ? P = "single" : I ? P = "first" : B ? P = "last" : P = "middle";
521
521
  const R = document.createElement("span");
522
- R.className = "highlight-content", R.dataset.highlightId = o || "", R.dataset.position = P, R.style.backgroundColor = f, R.style.textDecorationLine = "underline", R.style.textDecorationColor = c, R.style.textDecorationStyle = m, R.style.textDecorationThickness = n.borderWidthSmall, R.style.textUnderlineOffset = n.underlineOffset, R.style.cursor = "pointer", R.addEventListener("click", (Y) => {
522
+ R.className = "highlight-content", R.dataset.highlightId = o || "", R.dataset.position = P, R.style.backgroundColor = f, R.style.textDecorationLine = "underline", R.style.textDecorationColor = c, R.style.textDecorationStyle = m, R.style.textDecorationThickness = n.borderWidthSmall, R.style.textUnderlineOffset = n.underlineOffset, R.style.cursor = "pointer", R.addEventListener("click", (Z) => {
523
523
  var A;
524
- Y.target.tagName !== "A" && ((A = e.onClick) == null || A.call(e));
524
+ Z.target.tagName !== "A" && ((A = e.onClick) == null || A.call(e));
525
525
  }), (W = b.parentNode) == null || W.insertBefore(R, b), R.appendChild(b);
526
526
  }), u.addEventListener("click", (b) => {
527
527
  var C;
@@ -633,12 +633,12 @@ function Bt(t) {
633
633
  }
634
634
  });
635
635
  }
636
- const Ht = "Notebook", jt = "Notes", $t = "Important", zt = "Unclear", Ut = "Back", Gt = "Edit note", Wt = "Save", qt = "Cancel", Kt = "Delete note", Xt = "note", Qt = "Add note (optional)", Vt = "Remove from Notebook", Yt = "Add a note (optional)", Zt = "Mark important", Jt = "Mark unclear", en = "Saved to Notebook.", tn = "Note updated", nn = "Note deleted", on = "Error saving to Notebook.", rn = "Error updating note", sn = "Note deletion failed", ln = "Loading notes", an = "Failed to load notes", cn = "Start capturing your notes", dn = "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.", un = "Nothing here yet", fn = "Adjust your filters or create a new note to get started.", mn = "You have no notes for the selected filter", gn = "Previous page", hn = "Next page", pn = "All courses", Nn = "All notes", yn = "Close Notebook panel", bn = "To use the Notebook feature, highlight an excerpt from your learning material to flag it as 'confusing' or 'important' and leave an optional note.", En = "The content you highlighted is no longer available.", Pe = {
636
+ const Ht = "Notebook", jt = "Notes", Ut = "Important", $t = "Unclear", zt = "Back", Gt = "Edit note", Wt = "Save", qt = "Cancel", Kt = "Delete note", Xt = "note", Qt = "Add note (optional)", Vt = "Remove from Notebook", Yt = "Add a note (optional)", Zt = "Mark important", Jt = "Mark unclear", en = "Saved to Notebook.", tn = "Note updated", nn = "Note deleted", on = "Error saving to Notebook.", rn = "Error updating note", sn = "Note deletion failed", ln = "Loading notes", an = "Failed to load notes", cn = "Start capturing your notes", dn = "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.", un = "Nothing here yet", fn = "Adjust your filters or create a new note to get started.", mn = "You have no notes for the selected filter", gn = "Previous page", hn = "Next page", pn = "All courses", Nn = "All notes", yn = "Close Notebook panel", bn = "To use the Notebook feature, highlight an excerpt from your learning material to flag it as 'confusing' or 'important' and leave an optional note.", En = "The content you highlighted is no longer available.", Pe = {
637
637
  notebook: Ht,
638
638
  notes: jt,
639
- important: $t,
640
- unclear: zt,
641
- back: Ut,
639
+ important: Ut,
640
+ unclear: $t,
641
+ back: zt,
642
642
  editNote: Gt,
643
643
  save: Wt,
644
644
  cancel: qt,
@@ -669,7 +669,7 @@ const Ht = "Notebook", jt = "Notes", $t = "Important", zt = "Unclear", Ut = "Bac
669
669
  closeNotebookPanel: yn,
670
670
  featureDescription: bn,
671
671
  highlightUnavailable: En
672
- }, Ve = $e(null);
672
+ }, Ve = Ue(null);
673
673
  function Ye(t, e) {
674
674
  const n = Pe[t] ?? t;
675
675
  return e ? n.replace(/%\{([^}]+)}/g, (o, r) => String(e[r] ?? `%{${r}}`)) : n;
@@ -688,8 +688,8 @@ function Sn({
688
688
  );
689
689
  return /* @__PURE__ */ i(Ve.Provider, { value: o, children: n });
690
690
  }
691
- function V() {
692
- const t = ze(Ve);
691
+ function Y() {
692
+ const t = $e(Ve);
693
693
  return t || { translations: Pe, translate: Ye };
694
694
  }
695
695
  const vn = (t) => ({
@@ -717,7 +717,7 @@ function Tn(t, e) {
717
717
  return t;
718
718
  }
719
719
  }
720
- const Ze = $e(null);
720
+ const Ze = Ue(null);
721
721
  function no({
722
722
  api: t,
723
723
  currentUserId: e,
@@ -730,9 +730,9 @@ function no({
730
730
  initialNoteId: f,
731
731
  translations: c,
732
732
  translate: m,
733
- children: h
733
+ children: g
734
734
  }) {
735
- const [u, N] = Ue(Tn, vn(f)), y = J(f != null), E = ae(
735
+ const [u, p] = ze(Tn, vn(f)), y = J(f != null), E = ae(
736
736
  () => ({
737
737
  api: t,
738
738
  currentUserId: e,
@@ -742,14 +742,14 @@ function no({
742
742
  pageLastModifiedAt: s,
743
743
  onAnalyticsEvent: l,
744
744
  ...u,
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 }),
745
+ selectNote: (N, _ = !1) => p({ type: "SELECT_NOTE", payload: { id: N, isEditing: _ } }),
746
+ clearSelectedNote: () => p({ type: "CLEAR_SELECTED_NOTE" }),
747
+ setEditing: (N) => p({ type: "SET_EDITING", payload: N }),
748
748
  openTray: () => {
749
- y.current || (y.current = !0, a == null || a()), N({ type: "OPEN_TRAY" });
749
+ y.current || (y.current = !0, a == null || a()), p({ type: "OPEN_TRAY" });
750
750
  },
751
751
  closeTray: () => {
752
- y.current = !1, N({ type: "CLOSE_TRAY" });
752
+ y.current = !1, p({ type: "CLOSE_TRAY" });
753
753
  }
754
754
  }),
755
755
  [
@@ -764,17 +764,17 @@ function no({
764
764
  u
765
765
  ]
766
766
  );
767
- return /* @__PURE__ */ i(Ze.Provider, { value: E, children: /* @__PURE__ */ i(Sn, { translations: c, translate: m, children: h }) });
767
+ return /* @__PURE__ */ i(Ze.Provider, { value: E, children: /* @__PURE__ */ i(Sn, { translations: c, translate: m, children: g }) });
768
768
  }
769
769
  function Je() {
770
- const t = ze(Ze);
770
+ const t = $e(Ze);
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 Cn = ({ currentType: t, onSelectReaction: e }) => {
776
- const { translations: n } = V(), o = J(null), r = J(null);
777
- return Z(() => {
776
+ const { translations: n } = Y(), o = J(null), r = J(null);
777
+ return Q(() => {
778
778
  t === k.CONFUSING && o.current ? o.current.focus() : t === k.IMPORTANT && r.current ? r.current.focus() : o.current && o.current.focus();
779
779
  }, [t]), /* @__PURE__ */ i(
780
780
  G,
@@ -826,9 +826,9 @@ function oo({
826
826
  objectType: f,
827
827
  courseId: c,
828
828
  pageLastModifiedAt: m,
829
- selectedNoteId: h,
829
+ selectedNoteId: g,
830
830
  selectNote: u,
831
- openTray: N
831
+ openTray: p
832
832
  } = Je(), { data: y } = Ee({
833
833
  api: l,
834
834
  filter: {
@@ -836,105 +836,105 @@ function oo({
836
836
  },
837
837
  courseId: c,
838
838
  pageSize: 100
839
- }), { mutate: E } = Ft(l), { mutateAsync: p } = Bt(l), { mutate: _ } = Mt(l), w = J([]), [b, C] = z([]), [O, I] = z(null), [B, L] = z(""), [P, R] = z(null), [W, Y] = z(!1);
840
- Z(() => {
841
- const g = t.current;
842
- if (!g) return;
843
- const v = g.closest(".user_content") ?? g;
839
+ }), { mutate: E } = Ft(l), { mutateAsync: N } = Bt(l), { mutate: _ } = Mt(l), w = J([]), [b, C] = $([]), [O, I] = $(null), [B, D] = $(""), [P, R] = $(null), [W, Z] = $(!1);
840
+ Q(() => {
841
+ const h = t.current;
842
+ if (!h) return;
843
+ const v = h.closest(".user_content") ?? h;
844
844
  if (v.classList.contains("enhanced")) {
845
- Y(!0);
845
+ Z(!0);
846
846
  return;
847
847
  }
848
848
  const j = new MutationObserver((F) => {
849
- for (const $ of F)
850
- if ($.type === "attributes" && $.attributeName === "class" && $.target.classList.contains("enhanced")) {
851
- Y(!0), j.disconnect();
849
+ for (const U of F)
850
+ if (U.type === "attributes" && U.attributeName === "class" && U.target.classList.contains("enhanced")) {
851
+ Z(!0), j.disconnect();
852
852
  return;
853
853
  }
854
854
  });
855
855
  return j.observe(v, { attributes: !0, attributeFilter: ["class"] }), () => j.disconnect();
856
856
  }, [t]);
857
857
  const A = q(() => {
858
- R(null), I(null), L("");
858
+ R(null), I(null), D("");
859
859
  }, []);
860
- Z(() => {
860
+ Q(() => {
861
861
  if (!W || !t.current) return;
862
862
  let v = null;
863
863
  const j = () => {
864
864
  v && clearTimeout(v), v = setTimeout(() => {
865
- var Le;
865
+ var De;
866
866
  const x = window.getSelection(), M = t.current;
867
867
  if (!(x != null && x.rangeCount) || !M) return;
868
868
  const oe = x.toString().trim();
869
869
  if (oe === "") return;
870
870
  const ce = x.getRangeAt(0);
871
871
  if (!M.contains(ce.commonAncestorContainer)) return;
872
- const De = (Le = ee.fromRange(M, ce)) == null ? void 0 : Le.toSelector();
873
- De && !Rt(De, b) && (I(ce.cloneRange()), L(oe), R(Ot(ce)));
872
+ const Le = (De = ee.fromRange(M, ce)) == null ? void 0 : De.toSelector();
873
+ Le && !Rt(Le, b) && (I(ce.cloneRange()), D(oe), R(Ot(ce)));
874
874
  }, n);
875
875
  }, F = (x) => {
876
876
  if (!(x.target instanceof Node)) return;
877
877
  const M = document.getElementById(pe);
878
878
  M != null && M.contains(x.target) ? (x.preventDefault(), x.stopImmediatePropagation()) : A();
879
- }, $ = () => {
879
+ }, U = () => {
880
880
  A();
881
- }, D = (x) => {
881
+ }, L = (x) => {
882
882
  x.key === "Escape" && A();
883
883
  };
884
- return document.addEventListener("selectionchange", j), document.addEventListener("mousedown", F), document.addEventListener("touchstart", F), document.addEventListener("keydown", D), window.addEventListener("scroll", $, !0), () => {
885
- v && clearTimeout(v), document.removeEventListener("selectionchange", j), document.removeEventListener("mousedown", F), document.removeEventListener("touchstart", F), document.removeEventListener("keydown", D), window.removeEventListener("scroll", $, !0);
884
+ return document.addEventListener("selectionchange", j), document.addEventListener("mousedown", F), document.addEventListener("touchstart", F), document.addEventListener("keydown", L), window.addEventListener("scroll", U, !0), () => {
885
+ v && clearTimeout(v), document.removeEventListener("selectionchange", j), document.removeEventListener("mousedown", F), document.removeEventListener("touchstart", F), document.removeEventListener("keydown", L), window.removeEventListener("scroll", U, !0);
886
886
  };
887
887
  }, [W, b, n, t, A]);
888
888
  const H = q(
889
- (g) => {
889
+ (h) => {
890
890
  var M;
891
891
  const v = t.current;
892
- if (!v || !g.highlightData) return null;
893
- const { highlightData: j, reaction: F, id: $ } = g, { range: D } = j, x = D && ((M = ne.fromSelector(v, D)) == null ? void 0 : M.toRange());
892
+ if (!v || !h.highlightData) return null;
893
+ const { highlightData: j, reaction: F, id: U } = h, { range: L } = j, x = L && ((M = ne.fromSelector(v, L)) == null ? void 0 : M.toRange());
894
894
  if (x) {
895
895
  const oe = {
896
- id: $,
897
- selectedNoteId: h,
896
+ id: U,
897
+ selectedNoteId: g,
898
898
  type: F[0],
899
899
  onClick: () => {
900
- u($), N();
900
+ u(U), p();
901
901
  }
902
902
  };
903
- return Lt(x, oe, e), j.textPosition;
903
+ return Dt(x, oe, e), j.textPosition;
904
904
  }
905
905
  return null;
906
906
  },
907
- [t, h, e, u, N]
907
+ [t, g, e, u, p]
908
908
  );
909
- Z(() => {
909
+ Q(() => {
910
910
  if (!W || !y || !t.current) return;
911
- const g = t.current, v = y.notes, j = /* @__PURE__ */ new Set(), F = [], $ = [];
911
+ const h = t.current, v = y.notes, j = /* @__PURE__ */ new Set(), F = [], U = [];
912
912
  if (v.length === 0) {
913
913
  if (w.current.length > 0) {
914
- for (const D of w.current)
915
- He(D, g);
914
+ for (const L of w.current)
915
+ He(L, h);
916
916
  w.current = [], C([]);
917
917
  }
918
918
  return;
919
919
  }
920
920
  if (m && v[0].highlightData.pageLastModifiedAt !== m) {
921
- const { notesForUpdate: D, noteIdsForDelete: x } = wt(
922
- g,
921
+ const { notesForUpdate: L, noteIdsForDelete: x } = wt(
922
+ h,
923
923
  v,
924
924
  m
925
925
  );
926
- for (const M of D)
927
- p({ id: M.id, input: M }).catch((oe) => r == null ? void 0 : r(oe));
926
+ for (const M of L)
927
+ N({ id: M.id, input: M }).catch((oe) => r == null ? void 0 : r(oe));
928
928
  for (const M of x)
929
929
  _(M, { onError: s });
930
930
  } else {
931
- for (const D of v) {
932
- const x = H(D);
933
- j.add(D.id), x && (F.push(D), $.push(x));
931
+ for (const L of v) {
932
+ const x = H(L);
933
+ j.add(L.id), x && (F.push(L), U.push(x));
934
934
  }
935
- for (const D of w.current)
936
- j.has(D.id) || He(D, g);
937
- C($), w.current = F, h && kt(h);
935
+ for (const L of w.current)
936
+ j.has(L.id) || He(L, h);
937
+ C(U), w.current = F, g && kt(g);
938
938
  }
939
939
  }, [
940
940
  W,
@@ -942,11 +942,11 @@ function oo({
942
942
  H,
943
943
  m,
944
944
  t,
945
- p,
945
+ N,
946
946
  _,
947
- h
947
+ g
948
948
  ]);
949
- const te = (g) => {
949
+ const te = (h) => {
950
950
  const v = t.current;
951
951
  if (!O || !v) return;
952
952
  const j = ne.fromRange(v, O), F = ee.fromRange(v, O);
@@ -956,7 +956,7 @@ function oo({
956
956
  objectId: a,
957
957
  objectType: f,
958
958
  userText: "",
959
- reaction: [g],
959
+ reaction: [h],
960
960
  highlightData: {
961
961
  selectedText: B,
962
962
  textPosition: (F == null ? void 0 : F.toSelector()) ?? null,
@@ -965,10 +965,10 @@ function oo({
965
965
  }
966
966
  },
967
967
  {
968
- onSuccess: ($) => {
968
+ onSuccess: (U) => {
969
969
  var x;
970
- const D = $.id;
971
- A(), (x = window.getSelection()) == null || x.removeAllRanges(), u(D), N();
970
+ const L = U.id;
971
+ A(), (x = window.getSelection()) == null || x.removeAllRanges(), u(L), p();
972
972
  },
973
973
  onError: o
974
974
  }
@@ -987,9 +987,9 @@ function oo({
987
987
  left: P.left,
988
988
  whiteSpace: "nowrap"
989
989
  },
990
- onBlur: (g) => {
990
+ onBlur: (h) => {
991
991
  const v = document.getElementById(pe);
992
- v != null && v.contains(g.relatedTarget) || A();
992
+ v != null && v.contains(h.relatedTarget) || A();
993
993
  },
994
994
  children: /* @__PURE__ */ i(Cn, { onSelectReaction: te })
995
995
  }
@@ -1019,7 +1019,7 @@ const In = (t, e) => ({
1019
1019
  };
1020
1020
  return /* @__PURE__ */ i("span", { "data-note-highlight": "true", style: l, children: t });
1021
1021
  }, et = () => {
1022
- const { translations: t } = V();
1022
+ const { translations: t } = Y();
1023
1023
  return /* @__PURE__ */ S(T, { gap: "xx-small", alignItems: "start", as: "div", children: [
1024
1024
  /* @__PURE__ */ i(T.Item, { as: "div", children: /* @__PURE__ */ i(it, { color: "error" }) }),
1025
1025
  /* @__PURE__ */ i(T.Item, { padding: "xxx-small none", shouldShrink: !0, children: /* @__PURE__ */ i(be, { maxLines: 3, children: t.highlightUnavailable }) })
@@ -1066,18 +1066,18 @@ function ro({
1066
1066
  pageSize: r = 16,
1067
1067
  focusNoteId: s
1068
1068
  }) {
1069
- const [l, a] = Ue(kn, wn), { filter: f, courseFilter: c, currentPage: m, totalPages: h } = l;
1070
- Z(() => {
1069
+ const [l, a] = ze(kn, wn), { filter: f, courseFilter: c, currentPage: m, totalPages: g } = l;
1070
+ Q(() => {
1071
1071
  a({ type: "SET_PAGE", payload: 1 });
1072
1072
  }, [r]);
1073
- const u = n ? c : e, N = (m - 1) * r, y = {
1073
+ const u = n ? c : e, p = (m - 1) * r, y = {
1074
1074
  ...u ? { courseId: u } : {},
1075
1075
  ...f ? { reactions: [f] } : {},
1076
1076
  ...o ? { learningObject: o } : {}
1077
- }, { data: E, isLoading: p, isError: _ } = Ee({
1077
+ }, { data: E, isLoading: N, isError: _ } = Ee({
1078
1078
  api: t,
1079
1079
  filter: y,
1080
- offset: N,
1080
+ offset: p,
1081
1081
  pageSize: r
1082
1082
  }), { data: w } = Ee({
1083
1083
  api: t,
@@ -1086,22 +1086,22 @@ function ro({
1086
1086
  pageSize: xn,
1087
1087
  enabled: !!s
1088
1088
  }), b = J(null);
1089
- Z(() => {
1089
+ Q(() => {
1090
1090
  if (!s) {
1091
1091
  b.current = null;
1092
1092
  return;
1093
1093
  }
1094
1094
  if (b.current === s) return;
1095
- const H = (w == null ? void 0 : w.notes.findIndex((g) => g.id === s)) ?? -1;
1095
+ const H = (w == null ? void 0 : w.notes.findIndex((h) => h.id === s)) ?? -1;
1096
1096
  if (H === -1) return;
1097
1097
  b.current = s;
1098
1098
  const te = Math.floor(H / r) + 1;
1099
1099
  te !== m && a({ type: "FOCUS_PAGE", payload: te });
1100
1100
  }, [s, w, r, m]);
1101
- const C = (E == null ? void 0 : E.notes) ?? [], O = E == null ? void 0 : E.pageInfo, I = (O == null ? void 0 : O.totalNrOfPages) ?? void 0, B = s && w ? Math.ceil(w.notes.length / r) : void 0, L = I === void 0 && B === void 0 ? void 0 : Math.max(I ?? 0, B ?? 0);
1102
- Z(() => {
1103
- a({ type: "SET_TOTAL_PAGES", payload: L });
1104
- }, [L]);
1101
+ const C = (E == null ? void 0 : E.notes) ?? [], O = E == null ? void 0 : E.pageInfo, I = (O == null ? void 0 : O.totalNrOfPages) ?? void 0, B = s && w ? Math.ceil(w.notes.length / r) : void 0, D = I === void 0 && B === void 0 ? void 0 : Math.max(I ?? 0, B ?? 0);
1102
+ Q(() => {
1103
+ a({ type: "SET_TOTAL_PAGES", payload: D });
1104
+ }, [D]);
1105
1105
  const P = q((H) => {
1106
1106
  a({ type: "SET_PAGE", payload: H });
1107
1107
  }, []), R = q(() => {
@@ -1114,7 +1114,7 @@ function ro({
1114
1114
  type: "DECREMENT_PAGE"
1115
1115
  /* DecrementPage */
1116
1116
  });
1117
- }, []), Y = q((H) => {
1117
+ }, []), Z = q((H) => {
1118
1118
  a({ type: "SET_FILTER", payload: H });
1119
1119
  }, []), A = q((H) => {
1120
1120
  a({ type: "SET_COURSE_FILTER", payload: H });
@@ -1122,13 +1122,13 @@ function ro({
1122
1122
  return {
1123
1123
  notes: C,
1124
1124
  pageInfo: O,
1125
- isLoading: p,
1125
+ isLoading: N,
1126
1126
  isError: _,
1127
1127
  filter: f,
1128
1128
  courseFilter: c,
1129
1129
  currentPage: m,
1130
- totalPages: h,
1131
- setFilter: Y,
1130
+ totalPages: g,
1131
+ setFilter: Z,
1132
1132
  setCourseFilter: A,
1133
1133
  setPage: P,
1134
1134
  fetchNextPage: R,
@@ -1137,7 +1137,7 @@ function ro({
1137
1137
  }
1138
1138
  const Ne = "all";
1139
1139
  function so({ filter: t, setFilter: e }) {
1140
- const { translations: n } = V(), o = ae(
1140
+ const { translations: n } = Y(), o = ae(
1141
1141
  () => [
1142
1142
  { label: n.allNotes, value: Ne },
1143
1143
  { label: n.important, value: k.IMPORTANT },
@@ -1168,14 +1168,14 @@ function so({ filter: t, setFilter: e }) {
1168
1168
  };
1169
1169
  }
1170
1170
  const On = ({ hasActiveFilter: t = !1 }) => {
1171
- const { translations: e } = V(), n = t ? e.nothingHereYet : e.emptyStateHeading, o = t ? e.adjustFiltersOrCreate : e.emptyStateDescription;
1171
+ const { translations: e } = Y(), n = t ? e.nothingHereYet : e.emptyStateHeading, o = t ? e.adjustFiltersOrCreate : e.emptyStateDescription;
1172
1172
  return /* @__PURE__ */ i(G, { as: "div", textAlign: "center", children: /* @__PURE__ */ S(T, { direction: "column", alignItems: "center", gap: "small", children: [
1173
1173
  !t && /* @__PURE__ */ i(lt, { size: "medium" }),
1174
1174
  /* @__PURE__ */ i(ge, { level: "h3", children: n }),
1175
1175
  /* @__PURE__ */ i(K, { color: "secondary", children: o })
1176
1176
  ] }) });
1177
1177
  }, io = ({ children: t }) => {
1178
- const { isTrayOpen: e, closeTray: n } = Je(), { translations: o } = V();
1178
+ const { isTrayOpen: e, closeTray: n } = Je(), { translations: o } = Y();
1179
1179
  return /* @__PURE__ */ i(
1180
1180
  dt,
1181
1181
  {
@@ -1213,18 +1213,28 @@ const On = ({ hasActiveFilter: t = !1 }) => {
1213
1213
  icon: /* @__PURE__ */ i(Ce, { size: "x-small" })
1214
1214
  }
1215
1215
  }, tt = ({ type: t, onTypeChange: e, renderAsMenuTrigger: n = !1 }) => {
1216
- const { translations: o } = V(), r = Rn[t], s = o[r.translationKey], [l, a] = z(!1), f = J(null), c = J(null), m = q(
1217
- (h) => {
1218
- e == null || e(h), a(!1);
1216
+ const { translations: o } = Y(), r = Rn[t], s = o[r.translationKey], [l, a] = $(!1), f = J(null), c = J(null), m = q(
1217
+ (g) => {
1218
+ e == null || e(g), a(!1);
1219
1219
  },
1220
1220
  [e]
1221
1221
  );
1222
- return n && e ? /* @__PURE__ */ S(
1222
+ return Q(() => {
1223
+ if (!l) return;
1224
+ const g = (p) => {
1225
+ p.key === "Escape" && p.stopPropagation();
1226
+ }, u = (p) => {
1227
+ p.key === "Escape" && (p.stopPropagation(), a(!1));
1228
+ };
1229
+ return document.addEventListener("keydown", g, !0), document.addEventListener("keyup", u, !0), () => {
1230
+ document.removeEventListener("keydown", g, !0), document.removeEventListener("keyup", u, !0);
1231
+ };
1232
+ }, [l]), n && e ? /* @__PURE__ */ S(
1223
1233
  re,
1224
1234
  {
1225
1235
  placement: "bottom start",
1226
1236
  show: l,
1227
- onToggle: (h) => a(h),
1237
+ onToggle: (g) => a(g),
1228
1238
  shouldHideOnSelect: !0,
1229
1239
  shouldFocusTriggerOnClose: !0,
1230
1240
  trigger: /* @__PURE__ */ i(_e, { color: r.color, renderIcon: r.icon, children: s }),
@@ -1260,23 +1270,23 @@ const Pn = ({
1260
1270
  onTypeChange: f,
1261
1271
  isActive: c,
1262
1272
  isPanelView: m = !1,
1263
- courseName: h,
1273
+ courseName: g,
1264
1274
  locale: u,
1265
- highlightTheme: N,
1275
+ highlightTheme: p,
1266
1276
  renderLink: y,
1267
1277
  href: E
1268
1278
  }) => {
1269
- const { translations: p } = V(), [_, w] = z(!1), [b, C] = z(!1), [O, I] = z(o || ""), [B, L] = z(!1), P = J(null), R = q((g) => {
1270
- P.current = g;
1279
+ const { translations: N } = Y(), [_, w] = $(!1), [b, C] = $(!1), [O, I] = $(o || ""), [B, D] = $(!1), P = J(null), R = q((h) => {
1280
+ P.current = h;
1271
1281
  }, []);
1272
- Z(() => {
1273
- var g, v;
1274
- c && ((g = P.current) == null || g.scrollIntoView({ behavior: "smooth", block: "nearest" }), (v = P.current) == null || v.focus());
1282
+ Q(() => {
1283
+ var h, v;
1284
+ c && ((h = P.current) == null || h.scrollIntoView({ behavior: "smooth", block: "nearest" }), (v = P.current) == null || v.focus());
1275
1285
  }, [c]);
1276
- const W = r === k.IMPORTANT ? p.important : p.unclear, Y = (g) => {
1277
- g.key === "Enter" && (g.preventDefault(), s == null || s());
1278
- }, A = [W, p.note];
1279
- n && A.push(n), o && A.push(o), e && A.push(je(e, u)), h && A.push(h);
1286
+ const W = r === k.IMPORTANT ? N.important : N.unclear, Z = (h) => {
1287
+ h.key === "Enter" && (h.preventDefault(), s == null || s());
1288
+ }, A = [W, N.note];
1289
+ n && A.push(n), o && A.push(o), e && A.push(je(e, u)), g && A.push(g);
1280
1290
  const H = A.join(", "), te = /* @__PURE__ */ S(
1281
1291
  G,
1282
1292
  {
@@ -1294,7 +1304,7 @@ const Pn = ({
1294
1304
  onClick: c ? void 0 : s,
1295
1305
  onMouseEnter: () => w(!0),
1296
1306
  onMouseLeave: () => w(!1),
1297
- onKeyDown: c ? void 0 : Y,
1307
+ onKeyDown: c ? void 0 : Z,
1298
1308
  cursor: b ? "default" : "pointer",
1299
1309
  children: [
1300
1310
  /* @__PURE__ */ S(T, { direction: "column", gap: "small", children: [
@@ -1302,7 +1312,7 @@ const Pn = ({
1302
1312
  tt,
1303
1313
  {
1304
1314
  type: r,
1305
- onTypeChange: m && f ? (g) => f(t, g) : void 0,
1315
+ onTypeChange: m && f ? (h) => f(t, h) : void 0,
1306
1316
  renderAsMenuTrigger: m && !!f && !!c
1307
1317
  }
1308
1318
  ),
@@ -1311,7 +1321,7 @@ const Pn = ({
1311
1321
  {
1312
1322
  type: r,
1313
1323
  isCardActive: !!c || _,
1314
- theme: N,
1324
+ theme: p,
1315
1325
  children: n
1316
1326
  }
1317
1327
  ) : /* @__PURE__ */ i(be, { maxLines: 3, truncate: "word", children: /* @__PURE__ */ i(
@@ -1319,7 +1329,7 @@ const Pn = ({
1319
1329
  {
1320
1330
  type: r,
1321
1331
  isCardActive: !!c || _,
1322
- theme: N,
1332
+ theme: p,
1323
1333
  children: n
1324
1334
  }
1325
1335
  ) }) }) }) : /* @__PURE__ */ i(et, {}),
@@ -1328,10 +1338,10 @@ const Pn = ({
1328
1338
  /* @__PURE__ */ i(
1329
1339
  We,
1330
1340
  {
1331
- label: /* @__PURE__ */ i(Ge, { children: p.editNote }),
1341
+ label: /* @__PURE__ */ i(Ge, { children: N.editNote }),
1332
1342
  value: O,
1333
- onChange: (g) => I(g.target.value),
1334
- placeholder: p.addNoteOptional
1343
+ onChange: (h) => I(h.target.value),
1344
+ placeholder: N.addNoteOptional
1335
1345
  }
1336
1346
  ),
1337
1347
  /* @__PURE__ */ S(T, { gap: "xx-small", children: [
@@ -1344,7 +1354,7 @@ const Pn = ({
1344
1354
  onClick: () => {
1345
1355
  I(o || ""), C(!1);
1346
1356
  },
1347
- children: p.cancel
1357
+ children: N.cancel
1348
1358
  }
1349
1359
  ) }),
1350
1360
  /* @__PURE__ */ i(T.Item, { shouldGrow: !0, children: /* @__PURE__ */ i(
@@ -1357,7 +1367,7 @@ const Pn = ({
1357
1367
  onClick: () => {
1358
1368
  a == null || a(t, O.trim()), C(!1);
1359
1369
  },
1360
- children: p.save
1370
+ children: N.save
1361
1371
  }
1362
1372
  ) })
1363
1373
  ] })
@@ -1370,16 +1380,16 @@ const Pn = ({
1370
1380
  size: "small",
1371
1381
  withBackground: !1,
1372
1382
  withBorder: !1,
1373
- screenReaderLabel: p.editNote,
1383
+ screenReaderLabel: N.editNote,
1374
1384
  "data-testid": `note-card-${t}-edit`,
1375
- onClick: (g) => {
1376
- g.stopPropagation(), C(!0);
1385
+ onClick: (h) => {
1386
+ h.stopPropagation(), C(!0);
1377
1387
  },
1378
1388
  children: /* @__PURE__ */ i(ye, {})
1379
1389
  }
1380
1390
  )
1381
1391
  ] }) : /* @__PURE__ */ i(K, { children: /* @__PURE__ */ i(be, { maxLines: 3, truncate: "word", children: o }) }) }) : m && c ? /* @__PURE__ */ i("div", { children: /* @__PURE__ */ S(K, { color: "secondary", children: [
1382
- p.addNotePrompt,
1392
+ N.addNotePrompt,
1383
1393
  " ",
1384
1394
  /* @__PURE__ */ i(
1385
1395
  ie,
@@ -1387,10 +1397,10 @@ const Pn = ({
1387
1397
  size: "small",
1388
1398
  withBackground: !1,
1389
1399
  withBorder: !1,
1390
- screenReaderLabel: p.editNote,
1400
+ screenReaderLabel: N.editNote,
1391
1401
  "data-testid": `note-card-${t}-edit`,
1392
- onClick: (g) => {
1393
- g.stopPropagation(), C(!0);
1402
+ onClick: (h) => {
1403
+ h.stopPropagation(), C(!0);
1394
1404
  },
1395
1405
  children: /* @__PURE__ */ i(ye, {})
1396
1406
  }
@@ -1405,16 +1415,16 @@ const Pn = ({
1405
1415
  withBackground: !1,
1406
1416
  withBorder: !1,
1407
1417
  color: "danger",
1408
- screenReaderLabel: p.deleteNote,
1418
+ screenReaderLabel: N.deleteNote,
1409
1419
  "data-testid": `note-card-${t}-delete`,
1410
- onClick: (g) => {
1411
- g.stopPropagation(), L(!0);
1420
+ onClick: (h) => {
1421
+ h.stopPropagation(), D(!0);
1412
1422
  },
1413
1423
  children: /* @__PURE__ */ i(me, {})
1414
1424
  }
1415
1425
  )
1416
1426
  ] }),
1417
- h && /* @__PURE__ */ i(K, { size: "small", color: "secondary", children: h })
1427
+ g && /* @__PURE__ */ i(K, { size: "small", color: "secondary", children: g })
1418
1428
  ] })
1419
1429
  ] }),
1420
1430
  B && l && /* @__PURE__ */ i(
@@ -1447,10 +1457,10 @@ const Pn = ({
1447
1457
  size: "small",
1448
1458
  renderIcon: /* @__PURE__ */ i(me, {}),
1449
1459
  "data-testid": `note-card-${t}-confirm-delete`,
1450
- onClick: (g) => {
1451
- g.stopPropagation(), l(t), L(!1);
1460
+ onClick: (h) => {
1461
+ h.stopPropagation(), l(t), D(!1);
1452
1462
  },
1453
- children: p.deleteNote
1463
+ children: N.deleteNote
1454
1464
  }
1455
1465
  ),
1456
1466
  /* @__PURE__ */ i(
@@ -1459,10 +1469,10 @@ const Pn = ({
1459
1469
  display: "block",
1460
1470
  size: "small",
1461
1471
  "data-testid": `note-card-${t}-cancel-delete`,
1462
- onClick: (g) => {
1463
- g.stopPropagation(), L(!1);
1472
+ onClick: (h) => {
1473
+ h.stopPropagation(), D(!1);
1464
1474
  },
1465
- children: p.cancel
1475
+ children: N.cancel
1466
1476
  }
1467
1477
  )
1468
1478
  ]
@@ -1475,13 +1485,13 @@ const Pn = ({
1475
1485
  );
1476
1486
  return E && y ? y({ href: E, children: te, ariaLabel: H }) : te;
1477
1487
  };
1478
- function Dn(t, e) {
1488
+ function Ln(t, e) {
1479
1489
  const n = Array.from({ length: e }, () => []);
1480
1490
  return t.forEach((o, r) => {
1481
1491
  n[r % e].push(o);
1482
1492
  }), n;
1483
1493
  }
1484
- const Ln = {
1494
+ const Dn = {
1485
1495
  display: "flex",
1486
1496
  gap: "1rem",
1487
1497
  boxSizing: "border-box",
@@ -1505,15 +1515,15 @@ const Ln = {
1505
1515
  onNoteSave: f,
1506
1516
  onNoteTypeChange: c,
1507
1517
  selectedNoteId: m,
1508
- hasActiveFilter: h = !1,
1518
+ hasActiveFilter: g = !1,
1509
1519
  columnCount: u = 1,
1510
- highlightTheme: N,
1520
+ highlightTheme: p,
1511
1521
  locale: y,
1512
1522
  renderNoteLink: E,
1513
- noteHref: p
1523
+ noteHref: N
1514
1524
  }) => {
1515
- const { translations: _ } = V(), w = ae(
1516
- () => Dn(t, u),
1525
+ const { translations: _ } = Y(), w = ae(
1526
+ () => Ln(t, u),
1517
1527
  [t, u]
1518
1528
  );
1519
1529
  if (e)
@@ -1521,10 +1531,10 @@ const Ln = {
1521
1531
  if (n)
1522
1532
  return /* @__PURE__ */ i(G, { as: "div", textAlign: "center", padding: "large", "data-testid": "notes-error", children: /* @__PURE__ */ i(ge, { level: "h4", children: _.failedToLoadNotes }) });
1523
1533
  if (t.length === 0)
1524
- return /* @__PURE__ */ i(G, { as: "div", padding: "large", "data-testid": "empty-notes", children: /* @__PURE__ */ i(On, { hasActiveFilter: h }) });
1534
+ return /* @__PURE__ */ i(G, { as: "div", padding: "large", "data-testid": "empty-notes", children: /* @__PURE__ */ i(On, { hasActiveFilter: g }) });
1525
1535
  const b = typeof o == "number" && typeof r == "number" && r > 1 && s !== void 0;
1526
1536
  return /* @__PURE__ */ S(nt, { children: [
1527
- /* @__PURE__ */ i("div", { style: Ln, "data-testid": "notes-grid", children: w.map((C, O) => (
1537
+ /* @__PURE__ */ i("div", { style: Dn, "data-testid": "notes-grid", children: w.map((C, O) => (
1528
1538
  // oxlint-disable-next-line react/no-array-index-key -- columns are positional, index is stable
1529
1539
  /* @__PURE__ */ i("div", { style: An, children: C.map((I) => {
1530
1540
  var B;
@@ -1539,13 +1549,13 @@ const Ln = {
1539
1549
  isActive: m === I.id,
1540
1550
  isPanelView: !!m,
1541
1551
  onClick: l ? () => l(I.id) : void 0,
1542
- onDelete: a ? (L) => a(L) : void 0,
1543
- onSaveNote: f ? (L, P) => f(L, P) : void 0,
1544
- onTypeChange: c ? (L, P) => c(L, P) : void 0,
1545
- highlightTheme: N,
1552
+ onDelete: a ? (D) => a(D) : void 0,
1553
+ onSaveNote: f ? (D, P) => f(D, P) : void 0,
1554
+ onTypeChange: c ? (D, P) => c(D, P) : void 0,
1555
+ highlightTheme: p,
1546
1556
  locale: y,
1547
1557
  renderLink: E,
1548
- href: p ? p(I.id, I) : void 0
1558
+ href: N ? N(I.id, I) : void 0
1549
1559
  },
1550
1560
  I.id
1551
1561
  );
@@ -1575,7 +1585,7 @@ const Ln = {
1575
1585
  onBack: a,
1576
1586
  editing: f = !1
1577
1587
  }) => {
1578
- const { translations: c } = V(), [m, h] = z(f), [u, N] = z(t || ""), [y, E] = z(!1);
1588
+ const { translations: c } = Y(), [m, g] = $(f), [u, p] = $(t || ""), [y, E] = $(!1);
1579
1589
  return /* @__PURE__ */ S(T, { direction: "column", gap: "small", "data-testid": "single-note", children: [
1580
1590
  n != null ? /* @__PURE__ */ i(G, { as: "div", children: /* @__PURE__ */ i(K, { children: /* @__PURE__ */ i(Se, { type: e, isCardActive: !0, theme: o, children: n }) }) }) : /* @__PURE__ */ i(et, {}),
1581
1591
  /* @__PURE__ */ i(tt, { type: e, onTypeChange: l, renderAsMenuTrigger: !!l }),
@@ -1585,7 +1595,7 @@ const Ln = {
1585
1595
  {
1586
1596
  label: c.addNoteOptional,
1587
1597
  value: u,
1588
- onChange: (p) => N(p.target.value),
1598
+ onChange: (N) => p(N.target.value),
1589
1599
  resize: "vertical"
1590
1600
  }
1591
1601
  ),
@@ -1597,7 +1607,7 @@ const Ln = {
1597
1607
  size: "small",
1598
1608
  "data-testid": "single-note-cancel",
1599
1609
  onClick: () => {
1600
- N(t || ""), h(!1);
1610
+ p(t || ""), g(!1);
1601
1611
  },
1602
1612
  children: c.cancel
1603
1613
  }
@@ -1610,7 +1620,7 @@ const Ln = {
1610
1620
  size: "small",
1611
1621
  "data-testid": "single-note-save",
1612
1622
  onClick: () => {
1613
- r(u), h(!1);
1623
+ r(u), g(!1);
1614
1624
  },
1615
1625
  children: c.save
1616
1626
  }
@@ -1654,7 +1664,7 @@ const Ln = {
1654
1664
  withBorder: !1,
1655
1665
  screenReaderLabel: c.editNote,
1656
1666
  "data-testid": "single-note-edit",
1657
- onClick: () => h(!0),
1667
+ onClick: () => g(!0),
1658
1668
  children: /* @__PURE__ */ i(ye, {})
1659
1669
  }
1660
1670
  )
@@ -1708,7 +1718,7 @@ export {
1708
1718
  Mt as useDeleteNote,
1709
1719
  Ee as useGetNotes,
1710
1720
  Je as useNotebook,
1711
- V as useNotebookTranslations,
1721
+ Y as useNotebookTranslations,
1712
1722
  ro as useNotesData,
1713
1723
  so as useReactionFilter,
1714
1724
  Bt as useUpdateNote
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@instructure/platform-notebook",
3
- "version": "1.3.1",
3
+ "version": "1.4.0",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.js",